1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <stdio.h>
#include <windows.h>
int main()
{
int newValue = 500;
HWND hWnd = FindWindow(0, "Kalkylatorn");
if (hWnd == 0) {
fprintf(stderr, "Cannot find window.");
} else {
DWORD pId;
GetWindowThreadProcessId(hWnd, &pId);
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pId);
if (!hProc) {
fprintf(stderr, "Cannot open process.");
} else {
int isSuccessful = WriteProcessMemory(hProc, (LPVOID)0x000AFCC4, &newValue, (DWORD)sizeof(newValue), NULL);
if (isSuccessful > 0) {
puts("Process memory written.");
} else {
fprintf(stderr, "Cannot write process memory.");
}
CloseHandle(hProc);
}
}
getchar();
return 0;
}
|