阅读:837回复:1
怎么在驱动中设网卡为混杂模式
as title
|
|
|
沙发#
发布于:2004-04-14 22:46
大侠,我也有同样的问题啊,不过我的问题是调试无法通过。我在passthru里的minihook.c 的ntstatus后面那个传说中可以加入自己对网卡模式设置的地方加入以下代码,但是有错误
DIS_STATUS MPSetInformation( IN NDIS_HANDLE MiniportAdapterContext, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, OUT PULONG BytesRead, OUT PULONG BytesNeeded ) {//my code start here NDIS_STATUS st; NDIS_REQUEST *pRequest; NDIS_OID oiddata; PADAPT pAdapt; /* { UINT i; PADAPT pAdapt; NDIS_STATUS Status = NDIS_STATUS_FAILURE; NDIS_STATUS BundleStatus = NDIS_STATUS_FAILURE; NDIS_STRING BundleUniString; KIRQL OldIrql; DBGPRINT(\"==>Passthru Initialize Miniport\\n\"); } */ oiddata=NDIS_PACKET_TYPE_PROMISCUOUS; /*设置为混杂模式*/ pRequest=ExAllocatePool(NonPagedPool,sizeof(NDIS_REQUEST));//分配内存 if(NULL==pRequest) { DBGPRINT(\"Can not allocate buffer for requestn\"); } pRequest->RequestType=NdisRequestSetInformation;//设置请求命令 pRequest->DATA.SET_INFORMATION.Oid=OID_GEN_CURRENT_PACKET_FILTER; pRequest->DATA.SET_INFORMATION.InformationBuffer=&oiddata; pRequest->DATA.SET_INFORMATION.InformationBufferLength=sizeof(NDIS_OID); NdisRequest(&st,pAdapt->BindingHandle,pRequest);//发送请求 if(st!=NDIS_STATUS_PENDING) { if(pRequest){ DBGPRINT(\"Free request\\n\"); ExFreePool(pRequest); } } ... 调试过后出现了pAdapt没有初始化的错误,大侠知道怎么回事么,谢谢了先!!!!! |
|
|