in reply to dumping the memory of a foreign win32 pid from perl
It should work okay on the current process handle. OpenProcess is for attaching to another process. Your problem is that the lowest accessible address within a process is (usually) the process environment block which starts at 0x10000, so using 0 isn't going ot work. For starters, try setting the address to read from to the address of a perl variable. my $var = 'some text'; my $addr = 0+\$var;
From that you should be able to decipher the values in the SV and track through to read back the contents of the variable. Use Perlguts Illustrated and/or Devel::Peek as a guide.
Not sure where you are going with this, but be aware that Win32 processes are not made up of contiguous spaces. There are large gaps between 'sections'. You can use the 'debug' apis, in particular, CreateToolhelp32Snapshot() to iterate the sections and find their extents.
The best information I found for these and related apis is an (horribly formatted) Under the Hood article by Matt Pietrek.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Win32::API->new( ReadProcessMemory ) not working how I'd expect
by jettero (Monsignor) on Aug 14, 2007 at 20:33 UTC | |
by BrowserUk (Patriarch) on Aug 14, 2007 at 22:07 UTC | |
by jettero (Monsignor) on Aug 15, 2007 at 01:30 UTC | |
by BrowserUk (Patriarch) on Aug 15, 2007 at 06:50 UTC |