阅读:2593回复:2
NdisFOidRequest发送OID请求
我想从FIlter发送一个OID到miniport.可是总是出现蓝屏事件。烦请帮我看看:
NDIS_STATUS filterCreateNewMACRequest( IN NDIS_HANDLE FilterModuleContext, IN NDIS_OID Oid ) /* Routine Description: Send OID to underlying driver to create a new MAC Arguments: FilterModuleContext - pointer to filter module context Oid -- OID_DOT11_CREATE_MAC */ { PMS_FILTER pFilter =(PMS_FILTER)FilterModuleContext; NDIS_STATUS Status = NDIS_STATUS_SUCCESS; DOT11_MAC_INFO InformationBuffer; ULONG MethodId = 0; ULONG BytesProcessed; DEBUGP(DL_TEST,("==>FilterCreateNEwMACRequest!\n")); Status = filterDoInternalRequest(pFilter, NdisRequestMethod, Oid, (PVOID)&InformationBuffer, sizeof(DOT11_MAC_INFO), sizeof(DOT11_MAC_INFO), MethodId, &BytesProcessed); if(Status == NDIS_STATUS_SUCCESS) { DEBUGP(DL_TEST,("Create new mac successfully, and the length is %u!\n",InformationBufferLength)); goto Exit; }else { DEBUGP(DL_TEST,("Fail to create new MAC!\n")); goto Exit; } Exit: return Status; } filterDoInternalRequest的函数体为: NDIS_STATUS filterDoInternalRequest( IN PMS_FILTER FilterModuleContext, IN NDIS_REQUEST_TYPE RequestType, IN NDIS_OID Oid, IN PVOID InformationBuffer, IN ULONG InformationBufferLength, IN ULONG OutputBufferLength, OPTIONAL IN ULONG MethodId, OPTIONAL OUT PULONG pBytesProcessed ) { FILTER_REQUEST FilterRequest; PNDIS_OID_REQUEST NdisRequest = &FilterRequest.Request; NDIS_STATUS Status = NDIS_STATUS_SUCCESS; DEBUGP(DL_TEST,("==>filterDoInternalRequest\n")) NdisZeroMemory(NdisRequest, sizeof(NDIS_OID_REQUEST)); NdisInitializeEvent(&FilterRequest.ReqEvent); NdisRequest->Header.Type = NDIS_OBJECT_TYPE_OID_REQUEST; NdisRequest->Header.Revision = NDIS_OID_REQUEST_REVISION_1; NdisRequest->Header.Size = sizeof(NDIS_OID_REQUEST); NdisRequest->RequestType = RequestType; switch (RequestType) { case NdisRequestQueryInformation: NdisRequest->DATA.QUERY_INFORMATION.Oid = Oid; NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer = InformationBuffer; NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength = InformationBufferLength; break; case NdisRequestSetInformation: NdisRequest->DATA.SET_INFORMATION.Oid = Oid; NdisRequest->DATA.SET_INFORMATION.InformationBuffer = InformationBuffer; NdisRequest->DATA.SET_INFORMATION.InformationBufferLength = InformationBufferLength; break; case NdisRequestMethod: NdisRequest->DATA.METHOD_INFORMATION.Oid = Oid; NdisRequest->DATA.METHOD_INFORMATION.MethodId = MethodId; NdisRequest->DATA.METHOD_INFORMATION.InformationBuffer = InformationBuffer; NdisRequest->DATA.METHOD_INFORMATION.InputBufferLength = InformationBufferLength; NdisRequest->DATA.METHOD_INFORMATION.OutputBufferLength = OutputBufferLength; break; default: FILTER_ASSERT(FALSE); break; } / NdisRequest->RequestId = (PVOID)FILTER_REQUEST_ID; Status = NdisFOidRequest(FilterModuleContext->FilterHandle, NdisRequest); if (Status == NDIS_STATUS_PENDING) { NdisWaitEvent(&FilterRequest.ReqEvent, 0); Status = FilterRequest.Status; } if (Status == NDIS_STATUS_SUCCESS) { if (RequestType == NdisRequestSetInformation) { *pBytesProcessed = NdisRequest->DATA.SET_INFORMATION.BytesRead; } if (RequestType == NdisRequestQueryInformation) { *pBytesProcessed = NdisRequest->DATA.QUERY_INFORMATION.BytesWritten; } if (RequestType == NdisRequestMethod) { *pBytesProcessed = NdisRequest->DATA.METHOD_INFORMATION.BytesWritten; } // // The driver below should set the correct value to BytesWritten // or BytesRead. But now, we just truncate the value to InformationBufferLength // if (RequestType == NdisRequestMethod) { if (*pBytesProcessed > OutputBufferLength) { *pBytesProcessed = OutputBufferLength; } } else { if (*pBytesProcessed > InformationBufferLength) { *pBytesProcessed = InformationBufferLength; } } } return (Status); } 在函数filterDoInternalRequest中,每次执行到NdisFOidRequest()就出现蓝屏了。不知道哪里不对? |
|
最新喜欢:iihack... |
沙发#
发布于:2009-12-10 10:21
|
|
板凳#
发布于:2009-12-13 01:40
锁的问题,搞定
|
|