MmGetMdlVirtualAddress is not the same as the return value from
MmGetMdlSystemAddressForSafe. If nobody has called
MmGetMdlSystemAddressForSafe then there is no mapped system va.
You should not be using the internal fields of the MDL. Instead use only
the defined apis for accessing mdl internal values.
in ntddk.h you can see that the system va field is not always valid:
#define MmGetSystemAddressForMdlSafe(MDL, PRIORITY) \
(((MDL)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \
MDL_SOURCE_IS_NONPAGED_POOL)) ? \
((MDL)->MappedSystemVa) : \
(MmMapLockedPagesSpecifyCache((MDL), \
KernelMode, \
MmCached, \
NULL, \
FALSE, \
(PRIORITY))))
===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032
-----Original Message-----
From: §»»Ê(David Wang)
To: “NT Developers Interest List”
Date: Fri, 30 Aug 2002 13:20:35 +0800
Subject: [ntdev] MdlAddress->MappedSystemVa == 0 and MdlAddress->StartVa
== 0
> Hi , all
>
> When does it happen that MdlAddress->MappedSystemVa == 0 and
> MdlAddress->StartVa == 0 ?
> The Classpnp driver set Srb->DataBuffer = MmGetMdlVirtualAddress(
> MdlAddress ).
>
> I add a completion routine to interpret IRP_MJ_SCSI. Then use
> buffer = MmGetMdlSystemAddressForSafe(MdlAddress) to get data. I am
> confused
> that sometimes the buffer address is equals to
> MdlAddress->MappedSystemVa, but sometimes is not.
>
> Best Regards
> A confused newbie…
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to %%email.unsub%%
>