DRIVER_CORRUPTED_EXPOOL bug

我的目的是在Filter中发送自定义数据。可是目前的问题是在每次卸载的时候出现了这样的Bugs:
[img]http://dl.iteye.com/upload/attachment/214204/1abbb531-86b9-3142-b034-3cc6c42b707f.png[/img]
看起来是Pool的问题,原因是内存访问存在异常,具体原因不详,估计是在创建MDL中可能会出现某些问题。流程:
1. Create an buffer for my data with size of 80
pWriteBuf = (PUCHAR)NdisAllocateMemoryWithTagPriority(pFilter->FilterHandle,BufferSize,FILTER _ALLOC_TAG, LowPoolPriority); NdisZeroMemory(pWriteBuf,BufferSize); // Try to fill this buffer with some necessary data like Ethernet Header pEthHeader = (PTESTPROV_ETH_HEADER)pWriteBuf; 

2.Fulfill the struct of TESTPROV_ETH_HEADER with Source mac address, etc.
3.set the virtual address for MDL
4.Crate an MDL:
pMdl = NdisAllocateMdl(pFilter->FilterHandle, pEthFrameNew, BufferSize); 

5.Copy the data to the MDL
NdisMoveMemory(pEthFrameNew,pEthHeader, BufferSize); 

6.Allocate and initialize a NBL:
pNetBufferList = NdisAllocateNetBufferAndNetBufferList( pFilter->SendNetBufferListPool, sizeof(FILTER_SEND_NETBUFLIST_RSVD), //Request control offset delta 0, // back fill size pMdl, 0, // Data offset BufferSize); 


测试的时候,能用Network Monitor检测出网卡发出的数据:

[img]http://dl.iteye.com/upload/attachment/214209/df80969d-7f19-3c67-affd-7ad7d0be7971.png[/img]
现在的问题是:为什么会出现这样的蓝屏问题呢?

你可能感兴趣的:(驱动开发)