Question about MmGetSystemAddressForMdlSafe

The windows 2000 DDK says that the input MDL of
MmGetSystemAddressForMdlSafe must describe an already
locked-down user-space buffer returned by
MmProbeAndLockPages, a locked-down buffer returned by
MmBuildMdlForNonPagedPool, or system-space memory
allocated from nonpaged pool, contiguous memory, or
noncached memory. Does it mean that before I call
MmGetSystemAddressForMdlSafe I need to call
MmProbeAndLockPages? How can I know whether these
requirments have already been satified so that I don’t
need to call MmProbeAndLockPages any more? By checking
PMDL->MdlFlags & MDL_PAGES_LOCKED?

Thanks

Michael


Post your free ad now! http://personals.yahoo.ca

No, you can’t peek in the MDL structure, treat it as opaque. If you’re
handed an MDL as part of an IRP you can safely call
MmGetSystemAddressForMdlSafe. The system is never going to give you a
‘half-baked’ MDL.

Michael Zhu wrote:

The windows 2000 DDK says that the input MDL of
MmGetSystemAddressForMdlSafe must describe an already
locked-down user-space buffer returned by
MmProbeAndLockPages, a locked-down buffer returned by
MmBuildMdlForNonPagedPool, or system-space memory
allocated from nonpaged pool, contiguous memory, or
noncached memory. Does it mean that before I call
MmGetSystemAddressForMdlSafe I need to call
MmProbeAndLockPages? How can I know whether these
requirments have already been satified so that I don’t
need to call MmProbeAndLockPages any more? By checking
PMDL->MdlFlags & MDL_PAGES_LOCKED?

Thanks

Michael


Post your free ad now! http://personals.yahoo.ca


Nick Ryan (MVP for DDK)

> noncached memory. Does it mean that before I call

MmGetSystemAddressForMdlSafe I need to call
MmProbeAndLockPages?

Yes, unless we are speaking on Irp->MdlAddress, which is already locked by IO
manager.

How can I know whether these
requirments have already been satified so that I don’t
need to call MmProbeAndLockPages any more?

They are always satisfied for Irp->MdlAddress.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com