终身不匹配错误 [英] Lifetime mismatch error

查看:232
本文介绍了终身不匹配错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将过滤器实现为,

I tried to implement a filter as,

检查用户ID。 (我在sdBlob中获得了安全描述符)

check user id. (i got security descriptor in sdBlob)

我想阻止IP地址(在V4_ADDR_AND_MASK结构的AddrMask实例中指定)。 

and I want to block IP address (specified in AddrMask instance of V4_ADDR_AND_MASK structure). 

I想让过滤器在重启和BFE开始/停止后生存,所以我这样做了。 

I want to make filter to survive in reboot and after BFE start/stop so i did this. 

conds[0].fieldKey = FWPM_CONDITION_ALE_USER_ID;      
				conds[0].matchType = FWP_MATCH_EQUAL;      
				conds[0].conditionValue.type = FWP_SECURITY_DESCRIPTOR_TYPE;      
				conds[0].conditionValue.sd = &sdBlob;


				AddrMask.addr=ipadd.ipaddr.hex;
				AddrMask.mask=ipadd.submask.hex;



				conds[1].fieldKey = FWPM_CONDITION_IP_REMOTE_ADDRESS;      
				conds[1].matchType = FWP_MATCH_EQUAL;      
				conds[1].conditionValue.type = FWP_V4_ADDR_MASK;      
				conds[1].conditionValue.v4AddrMask = &AddrMask;

				
				memset(&filter,0,sizeof(filter));

				filter.flags=FWPM_FILTER_FLAG_PERSISTENT;

				filter.subLayerKey=SubLayer.subLayerKey;
				filter.displayData.name=L"RPS FIREWALL";
				filter.displayData.description=info;
				filter.action.type=FWP_ACTION_BLOCK;
				filter.numFilterConditions=2;
				filter.filterCondition=conds;
				filter.layerKey=FWPM_LAYER_ALE_ENDPOINT_CLOSURE_V4 ;
				
				result=FwpmFilterAdd(engineHandle,&filter,NULL,&filter.filterId);
				

我收到了错误代码, 

I got Error Code as, 

FWP_E_LIFETIME_MISMATCH


电话试图关联两个生命周期不兼容的对象。

The call tried to associate two objects with incompatible lifetimes.


它是如何发生的,以及如何通过实施我的要求来消除错误。?

How it occoured, And how to remove the error by implementing my requirement.??

RBN

推荐答案

添加持久性过滤器时,您应该使用非动态会话,以及提供者,子层,提供者上下文或标注过滤引用,也必须都是持久的。 在这种情况下,查看您的代码,请确保您添加的
子图标记为持久性(FWPM_SUBLAYER_FLAG_PERSISTENT)。

When adding a persistent filter, you should be using a non-dynamic session, and the provider, sublayer, provider context, or callout the filter references, must also all be made persistent.  In this case, looking at your code, make sure that the sublayer you added is marked as persistent (FWPM_SUBLAYER_FLAG_PERSISTENT).

希望这有帮助,


这篇关于终身不匹配错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆