How to monitor the value at a specific address say 0x003b9c
-
Well i been searching for this one with no answer Glad to have some inputs. I am trying to read a DWord from a memory location 0x003b9c how do i do that in code ? indeed i just need to get a peek of the value
You need to use pointers.
DWORD *pointer = 0x00003b9c;
DWORD ValueAtAddress = *pointer; // dereference pointer to get value
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!
Honoured as one of The Most Helpful Members of 2004
-
You need to use pointers.
DWORD *pointer = 0x00003b9c;
DWORD ValueAtAddress = *pointer; // dereference pointer to get value
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!
Honoured as one of The Most Helpful Members of 2004
Well i tried that out your code PJ Arends, but i got some errors in as follow is what is keyed into the program. #include <stdio.h> #include<stdlib.h> void main() { DWORD *pointer = 0x00003b9c; DWORD ValueAtAddress = *pointer; } i got the following ERRORS Compiling... tervalor.cpp C:\tervalor.cpp(5) : error C2065: 'DWORD' : undeclared identifier C:\tervalor.cpp(5) : error C2065: 'pointer' : undeclared identifier C:\tervalor.cpp(5) : error C2106: '=' : left operand must be l-value C:\tervalor.cpp(6) : error C2146: syntax error : missing ';' before identifier 'ValueAtAddress' C:\tervalor.cpp(6) : error C2065: 'ValueAtAddress' : undeclared identifier C:\tervalor.cpp(6) : error C2100: illegal indirection Error executing cl.exe. tervalor.obj - 6 error(s), 0 warning(s) so i correct the code to the following : #include <stdio.h> #include<stdlib.h> void main() { int *pointer = 0x00003b9c; int ValueAtAddress = *pointer; } now i get the error as follow : Compiling... tervalor.cpp C:\tervalor.cpp(5) : error C2440: 'initializing' : cannot convert from 'const int' to 'int *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. tervalor.obj - 1 error(s), 0 warning(s) well i am new and so think i am not going to get it but i will try. Anyway please help me understand. I like this board pretty much and i will continue to use it until i become professional and be able to help people someday.
-
Well i tried that out your code PJ Arends, but i got some errors in as follow is what is keyed into the program. #include <stdio.h> #include<stdlib.h> void main() { DWORD *pointer = 0x00003b9c; DWORD ValueAtAddress = *pointer; } i got the following ERRORS Compiling... tervalor.cpp C:\tervalor.cpp(5) : error C2065: 'DWORD' : undeclared identifier C:\tervalor.cpp(5) : error C2065: 'pointer' : undeclared identifier C:\tervalor.cpp(5) : error C2106: '=' : left operand must be l-value C:\tervalor.cpp(6) : error C2146: syntax error : missing ';' before identifier 'ValueAtAddress' C:\tervalor.cpp(6) : error C2065: 'ValueAtAddress' : undeclared identifier C:\tervalor.cpp(6) : error C2100: illegal indirection Error executing cl.exe. tervalor.obj - 6 error(s), 0 warning(s) so i correct the code to the following : #include <stdio.h> #include<stdlib.h> void main() { int *pointer = 0x00003b9c; int ValueAtAddress = *pointer; } now i get the error as follow : Compiling... tervalor.cpp C:\tervalor.cpp(5) : error C2440: 'initializing' : cannot convert from 'const int' to 'int *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. tervalor.obj - 1 error(s), 0 warning(s) well i am new and so think i am not going to get it but i will try. Anyway please help me understand. I like this board pretty much and i will continue to use it until i become professional and be able to help people someday.
Hi there, I think you need to change the code to: int *pointer = (int*) 0x00003b9c; int ValueAtAddress = *pointer; This is because C++ is strongly typed - and 0x00003b9c is a constant. The compiler assumes you were trying to create a "const int *" and made a typo - the (int*) "casts" the value into the required type. Thanks, Neil Humphreys.