MmAllocateContiguousMemory?
Q1. In MSDN, it says that MmAllocateContiguousMemory first attemps to
allocate a continuous range of memory from Nonpaged pool, if it fails, then
allocates from unused pages. So, here, if it fails allcating from Nonpaged
pool and then successfully allocates the continuous range of memory, is this
continuous range of memory still nonpaged or not?
Q2. MmBuildMdlForNonPagedPool, this routine receives an MDL that specifies a
virtual memory buffer in nonpaged pool, and updates it to describe the
underlying physical pages. And the MDL virtual address that is input must be
within the nonpaged portion of system space. So, here, if
MmAllocateContiguousMemory fails to allocate the continuous memory in
nonpaged pool but successfully allocates from unused pages, can I still call
MmBuildMdlForNonPagedPool to build my MDL?
Q3. If a memory is allcated from nonpaged pool, do I still call
MmProbeAndLockPages and then call MmMapLockedPages to map a system space VA
to user space VA? or directly call MmMapLockedPages to map?
Q4.
In MSND, it says
VOID
MmProbeAndLockPages(
IN OUT PMDL MemoryDescriptorList,
IN KPROCESSOR_MODE AccessMode,
IN LOCK_OPERATION Operation
);
Operation
Specifies the type of operation for which the caller wants the access rights
probed and the pages locked, one of IoReadAccess, IoWriteAccess, or
IoModifyAccess.
If I want the access rights to be read, write and modify, how should I do?
Set the third parameter as IoReadAccess | IoWriteAccess | IoModifyAccess or
otherwise?
date: Thu, 12 Jun 2008 11:15:00 -0700
author: Danial.F