Is there a particular piece of memory you're looking for? Environmental 
variables, etc., or are you simply trying to read arbitrary bytes from another 
processes?


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Mike Edenfield
Sent: Sunday, April 12, 2009 7:23 PM
To: mono-devel
Subject: [Mono-dev] {kinda OT} Linux equivalent of Win32 "ReadProcessMemory"...

I'm trying to port a utility from Windows that needs to read memory from
a running application.  It's using P/Invoke to call ReadProcessMemory,
which obviously isn't going to work on Linux.

Conceptually, I think this should be "easy":  use
Process.GetProcessByName().Id to get the pid of my target process,
open /proc/{pid}/mem as a filestream, and start reading.  The fact that
it seems so easy is what concerns me.  In particular:

* Has anyone actually done something like this and run into non-obvious
problems?  I'm most concerned that there are some gotchas in how Linux
manages memory, though if its just a matter of trial and error to find
the right spots in memory I'm already assuming that's coming.

* Is there an easier way to do this that I'm missing?  I briefly looked
for a glibc function that was similar to ReadProcessMemory and came up
empty.

--Mike

_______________________________________________
Mono-devel-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-devel-list

IMPORTANT: The information contained in this email and/or its attachments is 
confidential. If you are not the intended recipient, please notify the sender 
immediately by reply and immediately delete this message and all its 
attachments. Any review, use, reproduction, disclosure or dissemination of this 
message or any attachment by an unintended recipient is strictly prohibited. 
Neither this message nor any attachment is intended as or should be construed 
as an offer, solicitation or recommendation to buy or sell any security or 
other financial instrument. Neither the sender, his or her employer nor any of 
their respective affiliates makes any warranties as to the completeness or 
accuracy of any of the information contained herein or that this message or any 
of its attachments is free of viruses.
_______________________________________________
Mono-devel-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to