Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Jester831

macrumors newbie
Original poster
Aug 16, 2008
5
0
Do any of the mac programming languages have a function for reading or writing to another programs memory?
 
What is your goal here? If you are looking to reach into someone else's code, or are you looking at doing inter-process communication?
 
You may also want to look in to shared memory. It may not be exactly what you need here, but it would allow you have a "buffer" shared between processes. You would need to implement some coherency checking using some sort of lock.

Another option would be using a file that you memory map in various processes. Again, coherency checking will be needed.

Cromulent already mentioned IPC, which would also be an option if these processes have a parent/child relationship.

This page describes about all of these options I've mentioned:
http://www.ecst.csuchico.edu/~beej/guide/ipc/

As an aside, I can't believe something like that exists in the Win32 API. When I searched for it, in the first page of google results there is an MSDN blog post explaining some reasons why the use of ReadProcessMemory is a bad idea anyway.
http://blogs.msdn.com/oldnewthing/archive/2006/01/17/513779.aspx

-Lee
 
It's a buddy program for another program that I did not write... stuff like shared memory and IPC isn't really viable. Soo, is it impossible then?
 
here's a write up on that topic: http://nntp.pl/readprocessmemory-and-writeprocessmemory-on-os-x/ (check out the linked pdf)

(sorry for necroing but google spits this thread here out as on of the few results for that topic and there's not much useful info in this topic)

In case that article disappears here's the $0.05 summary.
Code:
ReadProcessMemory() -> vm_read_overwrite()
WriteProcessMemory() -> vm_write()

It references the book "Mac OS X Internals: A Systems Approach" by Amit Singh.

B
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.