Hi,
I am developing a NDIS Protocol driver that works on Win2000, XP and 2003. With respect to a particular implementation wherein user buffers are accessed in the kernel mode through MDL, I am seeing different behavior on Win2003. Can anybody pls suggest me the cause of difference? Problem is stated below:
I allocate a buffer array in user application, fill a first few buffer array element with the valid data and pass the buffer array to driver through an asynchronous operation. Driver starts processing the buffer array meanwhile user application is filling rest of the buffers.
A MDL is created from buffer pointer and buffer length of the buffer sent from the user application.
Code that is being used in the Driver to create MDL is given below:
mdl_size = MmSizeOfMdl(buffer_ptr,buffer_length);
mdl_ptr = (PMDL)ExAllocatePoolWithTag( NonPagedPool,mdl_size, ‘LDM’);
MmInitializeMdl(mdl_ptr,buffer_ptr,buffer_length);
if(mdl_ptr)
{
MmProbeAndLockPages(mdl_ptr,KernelMode,IoReadAccess);
mdl_buf = MmGetSystemAddressForMdlSafe(mdl_ptr,HighPagePriority);
//Now i store the mdl_buf & further use this to access the user space memory
svc_objp->txmt_pool->buffer_pool = mdl_buf;
}
Then this buffer pool is further used by the driver.
When this scenario is executed on the Windows 2000 & Windows XP machine, everything works fine. But Windows 2003 Server machine behave in a different fashion. Found that in the Windows 2003 Server machine only those buffers which were filled before making a call to the driver are having valid data & rest of the buffers contains some junk data.
Can u pls suggest me the reasons for the different behaviour of Windows 20003 Server and possible solutions?
Your help is very much appreciated !
Regds,
Bharti