In my driver, I need to temporarily obtain write access to a virtual address
marked read-only. I use IoAllocateMdl, MmBuildMdlForNonPagedPool, and then need
to call MmMapLockedPagesSpecifyCache.

In the docs, it is stated that it is extremely important to specify the same
Cache type if a common set of physical pages is mapped to two different virtual

After greping through docs, newsgroups, and samples, I couldn’t find a way to
identify the cache specification for the original, write-protected virtual
memory block. Using !pfn on the pages in the MDL showed them to be Cached, but
I really would like a programatic way to determine this on the NT, 2K, XP and
W2K3 os platforms.

Any ideas? For now, I’m calling the deprecated MmMapLockedPages(), which calls
the underlying MmMapLockedPagesSpecifyCache, but haven’t reverse-engineered it
to see if there is an exported kernel function that performs this operation.