4

The title is a bit confused. But, I'm trying to do is some thing like:

I have button (Button1 from TButton class)in a application. I want to get the pointer value of this button and check it properties from a second application.

Some one can say if it is possible ? And if it's not, explain why ?

Tks.


Re-opening 'cause I got other informations on internet.

If I use things like ? ReadProcessMemory

Examples: http://www.codeproject.com/KB/threads/int64_memsteal.aspx http://forum.cheatengine.org/viewtopic.php?p=4150408&sid=2358f118bab9f54b032d99377aed0545

Rodrigo Farias Rezino
  • 2,687
  • 3
  • 33
  • 60

5 Answers5

4

applications are protected from each other trying to corrupt each other. There is specific hardware in your PC to do this ( a MMU). It makes things both robust and secure.

So you can't simply go poking around in the memory of another application. You can share memory between applications using memory mapped files.... but thats more for data transfer typically.

However with windows controls (buttons, windows, etc) they are GDI objects and you can use windows API for sending messages to other applications controls to make them do things or query their properties.

Alternatively you can expose a cross process API, RPC / Com / Webservices / Sockets to allow other applications to query and change state

Keith Nicholas
  • 43,549
  • 15
  • 93
  • 156
3

It is possible. Just use the Windows API functions WriteProcessMemory/ReadProcessMemory. Pass in the handle of the process and the pointer to the data.

markus_ja
  • 2,931
  • 2
  • 28
  • 36
1

It is not impossible... It's just pretty complicated.

Like you wrote yourself, you can use ReadProcessMemory to read part of the memory of another application. The thing is to find the right address to read. Even if you would find the right way to do it, that would probably break between versions of delphi.

Of course, if your target application "expose" some methods to do it (by answering a windows message, for exemple), it's a different story.

Ken Bourassa
  • 6,363
  • 1
  • 19
  • 28
  • Like u said. It's a bitty complicated. But I already did it run partially to PAnsiString. I'll study I bit more and post the code here after. If some one have something that think can help me to study I'm ready to read. – Rodrigo Farias Rezino Feb 28 '11 at 12:40
0

Depending really on the OS

Normally all new OSes, and the multiuser OSes give memory protection. So you can't access the memory of another proccess unless you have privileges to do this through the OS system calls.

In an OS like MSDOS, you can have access to whatever address you want. With C you can declare a char far * pointer and assign it an address.

I used that to do a ncurses like library, accessing the video memory directly and writing/reading 8bit portions of the memory to set/get console text attributes.

What you want can be done by IPC or RPC if you're in a remote machine. You don't get a pointer, but can access the button properties using your favorite IPC/RPC api.

Revil
  • 145
  • 3
0

I first have a question for you: Why do you want to do this and is the application yours?

If its is for testing/debugging and you can build the target in debug mode you can use the Debugging Application Programming Interface to access whatever you want (from a debug build application that is).

Maybe you can find some info in this question Writing a very basic debugger

Community
  • 1
  • 1
Glenner003
  • 1,450
  • 10
  • 20
  • I want to wrap the malloc call from my application and access the possible MVT from the request memory and check how much objects from each class I have on my application. Why ? check for leaks (I know about FastMM) and to study. – Rodrigo Farias Rezino Feb 28 '11 at 12:34