In C or C++ (windows), how do you read RAM by giving a physical (not virtual) address?
That means without going trough virtual memory system (mmu tables), and being specific to one process.
I already know the API ReadProcessMemory
, which reads from ram (used by most trainers) but it is only for a specific process.
I searched on MSDN and found that DevicePhysicalMemory seems to give such possibility, but I found no practical example and this feature seems to have been turned off by Windows service packs (to fix some vulnerability).
I know it is possible to do because WinHex does it (if you choose "tools" > "open ram" > "physical memory"). It will then display RAM content from 0x00000000 to your_ram_size just like when you open a traditional file. It requires administrator rights, but there is no driver to install (which means WinHex does it from user mode).
EDIT : added information about os.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…