During my C++ program (on Home windows), I am allocating a block of memory and may make certain it stays locked (unswapped and contiguous) in physical memory (i.e. using VirtualAllocEx(), MapUserPhysicalPages() etc).

Poor my process, I'm able to obtain the VIRTUAL memory address of this block, but I have to discover the PHYSICAL memory address from it to be able to pass it with a exterior device.


1. Can there be in whatever way I'm able to translate the virtual address towards the physical one inside my program, in USER mode?

2. Otherwise, I'm able to discover this virtual to physical mapping only in KERNEL mode. I suppose this means I must write a person to get it done...? Are you aware associated with a easily available driver/DLL/API that we may use, that my application (program) will interface with to complete the translation?

3. Just in case I'm going to write the motive force myself, how do you do that translation? which functions will i use? Could it be mmGetPhysicalAddress()? How do you utilize it?

4. Also, basically understand properly, mmGetPhysicalAddress() returns the home address of the virtual base address that's poor the calling process. But when the calling process may be the driver, and I am using my application to call the motive force for your function, I am altering contexts and i'm no more poor the application once the mmGetPhysicalAddress routine is known as... so how do you translate the virtual address within the application (user-mode) storage, not the motive force?

Any solutions, tips and code excerpts is going to be much appreciated!!

Thanks