I have a WDM driver that works on W2K, but crashes on XP.
To investigate this, I have run up the application on the checked
build of XP. When the application is run, it encounters a breakpoint
and in the debug output, I see
“*** Assertion failed: (MemoryDescriptorList->MdlFlags & (
MDL_PAGES_LOCKED | MDL_MAPPED_TO_SYSTEM_VA |
MDL_SOURCE_IS_NONPAGED_POOL | MDL_PARTIAL | MDL_IO_SPACE)) == 0
*** Source File: d:\xpclient\base\ntos\mm\iosup.c, line 312”
This appears to be happening in the DispatchControl() routine that
handles an IOCTL. The IOCTL in question is defined as
CTL_CODE(FILE_DEVICE_UNKNOWN, 0x510, METHOD_IN_DIRECT,
FILE_ANY_ACCESS)
The code that appears to be causing the problem would seem to be
MmProbeAndLockPages(Irp->MdlAddress, UserMode,
IoModifyAccess);
The ASSERT statement output appears to imply that it is the MDL that
is at fault. However, it is my understanding that the MDL is
validated by the Memory Manager, and that if it were not valid,
control would not be passed to the driver.
In addition to wrapping the call in a __try, __except block (should
have be done initially), I also intend to include code to check that
the mdl is non-Null.
I am faced with the prospect that either:
- Something that was legal on W2K is not legal on XP.
- Some that was illegal on W2K but could be got away with, cannot
be got away with on XP.
If (1) then can anyone point me towards any references that would
cover such differences?
If (2) then can anyone see anything illegal about what is being done
above? Is there a conflict in using METHOD_IN_DIRECT in the IOCTL
definition and then using MmProbeAndLockPages() with IoModifyAccess?
By the way, when XP is loading, I notice the following debug output:
“MM: Loader/HAL memory block indicates large pages cannot be used for
80002000->8001BD7F
MM: Loader/HAL memory block indicates large pages cannot be used for
81153000->81393FFF
MM: Disabling large pages for all ranges due to overlap”
I’m assuming that this is to be expected and is not involved in the
problems that I am observing.
Any help would be appreciated.
Thanks,
Richard