Accessing direct memory addresses and obtaining the values in C++

前端 未结 5 1418
遇见更好的自我
遇见更好的自我 2020-12-31 04:14

I was wondering if it was possible to access a direct block of memory using C/C++ and grab the value. For example:

int i = 15;
int *p = &i;
cout <<         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 04:47

    You can't do it in a platform-agnostic way in C++. While I haven't used this "cheat engine" specifically, it almost certainly is using the same special API that a debugger uses. The code will be specific to Windows, and you will require a certain privilege level on the running process.

    (For instance, if you are using Visual Studio and execute a program from it in a Debug Mode, Visual Studio can look at and modify values in that program.)

    I haven't written a debugger in a while, so I don't know where a good place to get started on the Debug API is, but you can search around the web for things like this article:

    http://www.woodmann.com/fravia/iceman1.htm

提交回复
热议问题