HELP! I tried to read PlayerGUID with ReadProcessMemory in cpp. Sometimes it returned TRUE but the PlayerGUID is 0. And sometimes it returned FALSE with error code 299. It's a very simple program.
Code:
#include <stdlib.h>
#include <stdint.h>
#include <Windows.h>
static const ULONG PlayerGUID = 0x267D640;
int main(int argc, char* argv[])
{
HWND hWnd = FindWindow(NULL, "Wow.exe");
if (hWnd) {
DWORD ProcessID;
GetWindowThreadProcessId(hWnd, &ProcessID);
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_VM_OPERATION, false, ProcessID);
SIZE_T Bytes = 0;
uint64_t GUID;
BOOL Ret = ReadProcessMemory(hProcess, (LPVOID)PlayerGUID, &GUID, sizeof(GUID), &Bytes);
if (!Ret) {
DWORD dwError = GetLastError();
}
CloseHandle(hProcess);
}
return 0;
}
This is my cpp program. Ret is TRUE and the GUID is 0. Did I do something wrong?
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
I tried several times. Sometimes I got invalid GUIDs. For example, the GUID from ReadProcessMemory was 0x267D640. But what I got from /run UnitGUID("Player") is Player-4789-01764FA4.