首页 > 解决方案 > 为什么我看不到字符串?

问题描述

我知道这段代码很草率,但我想知道为什么当我使用 ReadProcessMemory() 函数时,我看不到存储在相​​关地址中的字符串。

    //If the game window is open then this function grabs the process ID.
if(FinderCheck)
{
    DWORD procID;

    GetWindowThreadProcessId(hwnd, &procID);

    //All so access you can read and write to process memory.
    HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS,FALSE,procID);

    if(procID = NULL)
    {
        cout << "Error: Failed to Obtain Process ID" << endl;
    }
    else
    {
        while(true)
        {


        //To read the process memory this line writes the memory data to buffer
        //Remember to change the address every time you boot the process or it will not work.
        ReadProcessMemory(handle, (PBYTE*)0xDC8F1AA904,&Cursor,sizeof(Cursor),0);
        cout << Cursor << endl;
        cout << "Test" << endl;

        Sleep(500);
        }
    }

标签: c++visual-c++

解决方案


    if(procID = NULL)

可悲的是,这个 if 语句总是评估为假,你错过了第二个“=”。这也意味着,从这一点procID来说NULL

剩下的代码呢?您能否向我们展示一下定义的Cursor外观以及您是如何实现的operator<<


推荐阅读