[Q] Identifying page / nonpaged memory

Hello,

I want to write a generalized routine that will lock the pages for the
passed MDL, irrespective of from which pool (paged or nonpaged) the memory
is allocated - based on that, I want to call MmProbeAndLockPages() or
MmBuildMdlForNonPagedPool().

NTDDK.H defines a flag MDL_SOURCE_IS_NONPAGED_POOL. But it seems NT sets
this flag after MmBuildMdlForNonPagedPool() is called.

How can I find out which memory the MDL maps ?

Thanks,

  • Hrishikesh.