阅读:1458回复:0
NdisMAllocateSharedMemory()调用失败,为什么?
//
// Set the attributes now. The NDIS_ATTRIBUTE_DESERIALIZE is the key. This enables us // to make up-calls to NDIS w/o having to call NdisIMSwitchToMiniport/NdisIMQueueCallBack. // This also forces us to protect our data using spinlocks where appropriate. Also in this // case NDIS does not queue packets on out behalf. Since this is a very simple pass-thru // miniport, we do not have a need to protect anything. However in a general case there // will be a need to use per-adapter spin-locks for the packet queues at the very least. // NdisMSetAttributesEx(MiniportAdapterHandle, pAdapt, 0, // CheckForHangTimeInSeconds NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT | NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT| NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER | NDIS_ATTRIBUTE_DESERIALIZE | NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND, 0); pAdapt->SharedMemorySize = 1024 * 4; // Fix, should get from registry. if (pAdapt->SharedMemorySize) { NdisMAllocateSharedMemory( pAdapt->NdisBindingContextFromProtocol,//输入是正确的 pAdapt->SharedMemorySize, TRUE,//FALSE, &pAdapt->SharedMemoryPtr, &pAdapt->SharedMemoryPhysicalAddress ); if (pAdapt->SharedMemoryPtr == NULL) { DBG_PRINT(("!!!!! Could not allocate shared memory.\n");); pAdapt->SharedMemorySize = 0; } else { NdisZeroMemory(pAdapt->SharedMemoryPtr, pAdapt->SharedMemorySize); } } 在一个中间层驱动中调用,在小端口驱动程序的初始化部分调用! |
|