c++ - 为什么我看不到字符串?
问题描述
我知道这段代码很草率,但我想知道为什么当我使用 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);
}
}
解决方案
if(procID = NULL)
可悲的是,这个 if 语句总是评估为假,你错过了第二个“=”。这也意味着,从这一点procID
来说NULL
。
剩下的代码呢?您能否向我们展示一下定义的Cursor
外观以及您是如何实现的operator<<
?
推荐阅读
- javascript - 如何在另一个函数中引用父元素?
- visual-studio-2019 - 当类没有出现在引用中时,如何从我的 vb 解决方案中删除一个类?
- powershell - 使用没有循环的 cmdlet 后如何访问错误属性
- macos - 自定义 NSFont 选择器菜单
- javascript - 如何对每个产品实施星级评分系统
- java - 仿射变换后丑陋的对角线
- c - 使用“&&”和“||” 在 C 中条件之外的语句中
- wordpress - 在商店页面中首先显示特色产品,最后显示缺货产品
- python - Python:读取数据库以显示具有相等列的表
- swift - 在两个对象之间画一条线