I wish to dump the memory contents of a pid that is not the current pid.
Then you will need to use OpenProcess() to get a handle to the process in question.
CreateToolhelp32Snapshot() doesn't snapshot the memory. It will give you lists of the modules (DLLs) that are a part of your process image which you can then iterate using Module32First/Next() and obtain the load addresses and extents.
It will also give you a list of the heaps, runtime allocated memory used by alloc/free and stacks. You then use Heap32ListFirst/Next to iterate those and obtain their start addresses and extents.
You then use those addresses with ReadProcessMemory() to actually read the ram.
It's a fairly involved process, but reasonably well documented. Remember you will need appropriate permissons.
Also, be sure to suspend the target process otherwise things could change the moment after you obtain your information. If the target process contains threads, you have another sets of loops to jump through.
In reply to Re^3: Win32::API->new( ReadProcessMemory ) not working how I'd expect
by BrowserUk
in thread dumping the memory of a foreign win32 pid from perl
by jettero
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |