Code: Select all
if(VirtualProtect(hAddress, sizeof(nData), PAGE_EXECUTE_READWRITE, &nOldPage) == 0)
{
TerminateProcess(GetCurrentProcess(), -1);
}
int nReturn = WriteProcessMemory(hGame, hAddress, &nData, sizeof(nData), 0);
/*VirtualProtect(hAddress, sizeof(nData), nOldPage, 0);*/
if(VirtualProtect(hAddress, sizeof(nData), nOldPage, 0) == 0)
{
TerminateProcess(GetCurrentProcess(), -1);
}
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
https://msdn.microsoft.com/de-de/librar ... 98(v=vs.85).aspx
strangely enough, with just this change done it closes the d2 window, so that means that the return value is indeed 0 with means that the function has failed, not sure yet what to make of this, but interesting