Reading memory that belongs to another process on Windows

2 views (last 30 days)
Suppose I have another process running on Windws. That process is stopped in the debugger (Visual Studio). Visual Studio does not have a means of dumping the contents of specified memory locations into a file. However, Visual Studio will tell me the starting address in memory for the data.
Is there a way that Matlab can take a process i.d., a starting address and the number of bytes and read the memory from the process and load it into a Matlab variable / array? Then I would want to have Matlab read this data as 4-byte integer data and give me an array of the integers.
Is there anything that has to be set on the other process to make its memory readable of can Matlab read memory that belongs to any other process?
Thank you for your replies. This would be enormously cool if it worked.
Linda Seltzer

Answers (2)

James Tursa
James Tursa on 23 Jul 2012
No. In general, the memory of one process cannot be accessed by another process. There are ways to pass data such as the address itself across (e.g., a COM link ala the MATLAB Engine etc), but the address of one process means nothing to the other process and will not map correctly to the memory you are trying to access (you will likely get a seg fault if you try it).
  6 Comments
James Tursa
James Tursa on 23 Jul 2012
Am I to understand from your comment below that you cannot modify the C/C++ program? This would be required to add the code for the MATLAB Engine.
Walter Roberson
Walter Roberson on 23 Jul 2012
Can COM be used to control Visual Studios? And can Visual Studios, so controlled, report back memory contents?

Sign in to comment.


Walter Roberson
Walter Roberson on 23 Jul 2012

Categories

Find more on COM Component Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!