0

MSDN documentation says that VirtualAllocEx

Actual physical pages are not allocated unless/until the virtual addresses are actually accessed.

I need to acces the physical address right after calling VirtualAllocEx yet i cant cause they are not allocated physically yet.

How can i force it to allocate the physicals pages with or right after VirtualAllocEx WITHOUT accessing the virtual memory first?

bmargulies
  • 97,814
  • 39
  • 186
  • 310
user3575889
  • 271
  • 1
  • 8
  • 1
    Why do you need to? What are you trying to do? – user253751 Feb 23 '15 at 03:05
  • I need to access directly to physical pages its just a project for learning more about the kernel internal, would be glad for help thanks. – user3575889 Feb 23 '15 at 03:12
  • 1
    The only way to directly access physical pages is to be running in kernel mode. VirtualAllocEx is not a kernel-mode function. – Harry Johnston Feb 23 '15 at 03:16
  • 1
    note that even kernel mode can't directly access physical pages, it still has to map them to a virtual address and then access them through the virtual address. – user253751 Feb 23 '15 at 03:19
  • Its my usermode program that call VirtualAllocEx and my kernel driver tries to access it. – user3575889 Feb 23 '15 at 03:28
  • Unless there is a way to allocate memory from kernel side for a usermode program? – user3575889 Feb 23 '15 at 03:36
  • @user3575889: yes, you can allocate physical memory from kernel-mode code, and map it into the user address space for a given process. See [Memory Manager Routines](https://msdn.microsoft.com/en-us/library/windows/hardware/ff554435%28v=vs.85%29.aspx). – Harry Johnston Feb 23 '15 at 06:15

0 Answers0