How do I read a variable value in another process?

Just starting out? Need help? Post your questions and find answers here.
DevilDog
Enthusiast
Enthusiast
Posts: 210
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

How do I read a variable value in another process?

Post 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
When all is said and done, more is said than done.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post 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_().
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
DevilDog
Enthusiast
Enthusiast
Posts: 210
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

Post 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
When all is said and done, more is said than done.
DevilDog
Enthusiast
Enthusiast
Posts: 210
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

Post 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
When all is said and done, more is said than done.
DevilDog
Enthusiast
Enthusiast
Posts: 210
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

Post 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
When all is said and done, more is said than done.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

I have no clue but what would be the purpose of this anyway?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post by Demivec »

Déjà Vu! :wink:
DevilDog
Enthusiast
Enthusiast
Posts: 210
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

Post 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.
When all is said and done, more is said than done.
DevilDog
Enthusiast
Enthusiast
Posts: 210
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

Post 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.
When all is said and done, more is said than done.
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post 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?
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Post 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?
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Yeah, why?
Last edited by Fluid Byte on Wed Oct 10, 2007 7:41 pm, edited 1 time in total.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Yeah, why?
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
DevilDog
Enthusiast
Enthusiast
Posts: 210
Joined: Thu Aug 04, 2005 9:32 pm
Location: Houston, Tx.

Post 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
When all is said and done, more is said than done.
gekkonier
User
User
Posts: 78
Joined: Mon Apr 23, 2007 9:42 am

Post by gekkonier »

I know there is something going wrong here....





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

:lol:
Post Reply