How do you read directly from physical memory on Windows?

You would have to write a kernel mode driver and use memory manager functions to map physical memory range to your kernel driver’s system space then export functionality to a user API or driver.

After windows 98 it is not possible in most cases to access physical memory from user mode. As others have put it this is so any old program can’t just destroy people’s computers. You would have to write a kernel driver, which can only be installed if it is signed and first loaded into the window’s store. This alone is not a simple process like linking a DLL.

In summary MmAllocateContiguousMemory() is a windows kernel mode function which maps contiguous physical memory to system memory and is a part of ntoskrnl.exe.

Also you can not call these API’s from user mode applications. Only drivers can use them. User mode applications CANNOT access physical memory without the help of a driver. The driver can either handle reques’s from the user API or use IOCTLs and map its resources to the user program virtual memory. Either way you will need the help of a driver which has to be installed by the plug n play manager. PnP has to choose to install the driver on its own either by hardware activation (i.e. hot plug) or some other method like a bus driver that is always on.

Further windows randomly assign’s virtual address so that it is not easily possible to discern any pattern or work out it’s physical location.

Leave a Comment