String search in memory

  • Thread starter Thread starter Stu Banter
  • Start date Start date
S

Stu Banter

(similar msg posted in csharp.general)

I want to look up strings 'somewhere in memory' (beyond my control).
How can I do this quickly using C#?
The strings, coming from "black box" program A are used as input for program
"B" (B my program).
B is supposed to become a log function for A's output.

Ideas and hins very welcome!

TIA Stu Banter
 
Stu, you want to search the memory allocated for another program? Without
doing something very unsafe or having the other program expose that
information there really isn't a way. Applications are supposed to be
separate so that if one crashes it doesn't bring another down or one app
can't read secure information out of another. Can the "black box" program
expose the information in some other way?
 
Greg Ewing said:
Stu, you want to search the memory allocated for another program? Without
doing something very unsafe or having the other program expose that
information there really isn't a way. Applications are supposed to be
separate so that if one crashes it doesn't bring another down or one app
can't read secure information out of another. Can the "black box" program
expose the information in some other way?

Thanks for your reply Greg!

Unfortunately right now it is not possible to get the information another
way. Or I should 'scan' a screen region and do some nifty OCR job on very
small text size ;-)

I am not very well educated in how XP handles its memory allocation, maybe
my thought of just scanning the whole lot from 0 to 1 gig is not possible ?
Or just unsafe ? That I can live with for this one, heck I've been known as
mister unsafe since birth!

Best!
Stu
 
Stu Banter said:
Unfortunately right now it is not possible to get the
information another way. Or I should 'scan' a screen
region and do some nifty OCR job on very small
text size ;-)

Why can't you write it to a temporary file or Registry section?

P.
 
Memory in XP is protected - you can't scan the memory that's allocated to
other processes.

If it's something that's visible in the other application, you may be able
to navigate the window hierarchy to find the text and copy it. VS ships with
a utility named "Spy++" (spyxx.exe) that is useful to do this.

You might also look at my Win32Window class, which helps you navigate
windows.

http://www.gotdotnet.com/Community/...mpleGuid=6315FF6C-1347-4C9E-913B-81F266CE8DE2

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
 
(similar msg posted in csharp.general)

I want to look up strings 'somewhere in memory' (beyond my control).
How can I do this quickly using C#?
The strings, coming from "black box" program A are used as input for program
"B" (B my program).
B is supposed to become a log function for A's output.

Ideas and hins very welcome!

TIA Stu Banter
I was sure there was something ...
check this:
http://www.codeproject.com/csharp/minememoryreader.asp?print=true

Sunny
 
Back
Top