Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to monitor the value at a specific address say 0x003b9c

How to monitor the value at a specific address say 0x003b9c

Scheduled Pinned Locked Moved C / C++ / MFC
questionalgorithmsperformancetutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tervalor
    wrote on last edited by
    #1

    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

    PJ ArendsP 1 Reply Last reply
    0
    • T tervalor

      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

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      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

      Within you lies the power for good; Use it!

      T 1 Reply Last reply
      0
      • PJ ArendsP PJ Arends

        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

        T Offline
        T Offline
        tervalor
        wrote on last edited by
        #3

        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.

        H 1 Reply Last reply
        0
        • T tervalor

          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.

          H Offline
          H Offline
          humps
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups