INFO: MmMapLockedPages Returns Actual Virtual Address In SP4ID: Q199311
|
In the Windows NT 4.0 Service Pack 3 and earlier versions, MmMapLockedPages returns the base virtual address (a page-aligned address) that maps the locked pages for the range described by the MDL. However, this has been changed in Service Pack 4 and later versions to return the actual virtual address including the byte offset within a page of the buffer described by the MDL.
In Windows NT 4.0 Service Pack 3 and earlier versions, if the buffer described by the MDL is not page-aligned then you have to add the offset stored in the MDL with the base virtual address returned by the function to get the actual address as shown here:
VirtualAddress = (PVOID) (((ULONG) MmMapLockedPages(Mdl, Mode)) + MmGetMdlByteOffset(Mdl));
VirtualAddress = (PVOID) MmMapLockedPages(Mdl, Mode);
VirtualAddress = (PVOID) (((ULONG) MmMapLockedPages(Mdl, Mode)) | MmGetMdlByteOffset(Mdl));
VirtualAddress = (PVOID)(((ULONG)PAGE_ALIGN(MmMapLockedPages(Mdl, Mode))) + MmGetMdlByteOffset(Mdl));
Q189327
Additional query words: kbDSupport
Keywords : kbDDK kbKMode kbNTOS400 kbNTOS400fix kbWinOS2000
Version : winnt:
Platform : winnt
Issue type : kbinfo
Last Reviewed: April 8, 1999