Page 1 of 3

How do I read a variable value in another process?

Posted: Wed Oct 10, 2007 5:30 pm
by DevilDog
I found this snippet of code which reads the value a variable after first getting its memory address.

Code: Select all

varC=123
Debug varC
ptrA=@varC
Debug ptrA
Debug PeekL(ptrA)
varC=456
Debug PeekL(ptrA)
It works fine. But how can I apply this to another process?

For example if I know the name of a variable in another process to be "VarC" how can I read the value of that variable?

Thanks!
DevilDog

Posted: Wed Oct 10, 2007 5:35 pm
by Fluid Byte
The variable name is useless as it doesn't exist anymore in the compiled application. You need to know the memory addess and use ReadProcessMemory_().

Posted: Wed Oct 10, 2007 5:42 pm
by DevilDog
Ah yes, that makes sense.

I'm thinking about the PB debugger. It has the ability to display a variable's value.

If I run my program at the same time I have a different program open in the debugger, how can I find the address of a variable visible in the debugger?

:shock:

Devildog

Posted: Wed Oct 10, 2007 6:06 pm
by DevilDog
After re-reading my previous post, I can see how it might not be clear what I'm asking.

I'm trying to interact with the PB debugger.

Here's an example:

I have program "A" open in the PB debugger and it's stopped at a "calldebugger" line.

In the debugger I can see a variable in the code of program "A" called "VarC".

Now, I also have another compiled program "B" running separately and I want to see what the value of "VarC" in program "A" is from program "B".

Anyone know how I can do this? :?

Devildog

Posted: Wed Oct 10, 2007 6:06 pm
by DevilDog
After re-reading my previous post, I can see how it might not be clear what I'm asking.

I'm trying to interact with the PB debugger.

Here's an example:

I have program "A" open in the PB debugger and it's stopped at a "calldebugger" line.

In the debugger I can see a variable in the code of program "A" called "VarC".

Now, I also have another compiled program "B" running separately and I want to see what the value of "VarC" in program "A" is from program "B".

Anyone know how I can do this? :?

Devildog

Posted: Wed Oct 10, 2007 7:04 pm
by Fluid Byte
I have no clue but what would be the purpose of this anyway?

Posted: Wed Oct 10, 2007 7:05 pm
by Demivec
Déjà Vu! :wink:

Posted: Wed Oct 10, 2007 7:34 pm
by DevilDog
The purpose of this would be to be able to display the value of a variable by placing the mouse over it, much like vb.net does.

Posted: Wed Oct 10, 2007 7:34 pm
by DevilDog
The purpose of this would be to be able to display the value of a variable by placing the mouse over it, much like vb.net does.

Posted: Wed Oct 10, 2007 7:39 pm
by Demivec
DevilDog wrote:The purpose of this would be to be able to display the value of a variable by placing the mouse over it, much like vb.net does.
DevilDog wrote:The purpose of this would be to be able to display the value of a variable by placing the mouse over it, much like vb.net does.
Why don't you use the Variable or Watchlist function in the Debugger?

Posted: Wed Oct 10, 2007 7:39 pm
by Demivec
DevilDog wrote:The purpose of this would be to be able to display the value of a variable by placing the mouse over it, much like vb.net does.
DevilDog wrote:The purpose of this would be to be able to display the value of a variable by placing the mouse over it, much like vb.net does.
Why don't you use the Variable or Watchlist function in the Debugger?

Posted: Wed Oct 10, 2007 7:41 pm
by Fluid Byte
Yeah, why?

Posted: Wed Oct 10, 2007 7:41 pm
by Fluid Byte
Yeah, why?

Posted: Wed Oct 10, 2007 7:42 pm
by DevilDog
Because I'm trying to add this as a feature to my project (PB Project) so I can use it when I program.

I would prefer to have the ability to see the value of a variable by holding my mouse over a variable in the debugger window rather than have to open the debugger scroll through over a hundred variables looking for the one I need.

Devildog

Posted: Wed Oct 10, 2007 7:42 pm
by gekkonier
I know there is something going wrong here....





....but can't imagine.....

:lol: