I want my program to read a pointer whose adress is 0x111111 then add 0x111 to the adress which the pointer holds and write 0x0 to the new adress how can i do that with write and readmemory apis
i tried like that but could not succed what is the problem?
Code:
[LRESULT CALLBACK PencereProseduru (HWND AnaPencereTutmaci, UINT message, WPARAM wParam, LPARAM lParam)
{
char Dugme1Ismi[256];
HWND HedefTutmac;
DWORD ProsesKimligi, Alan=0x111111, AlinanAlan, HedefAlan;
HANDLE Islem;
BYTE eDegistirilen[1]={0x0};
BOOL a, b;
switch (message)
{ case WM_COMMAND:
if(LOWORD(wParam) == 1 && HIWORD(wParam) == BN_CLICKED)
{
GetWindowText(Dugme1Tutmaci, Dugme1Ismi, sizeof(Dugme1Ismi));
if (strcmp(Dugme1Ismi, "Durdur")== 0)
{SetWindowText (Dugme1Tutmaci,"Çalıştır");}
else
{SetWindowText (Dugme1Tutmaci, "Durdur");
HedefTutmac = FindWindow (NULL,"sdsmnd");
if (HedefTutmac == NULL)
{MessageBox(0, "Pencere bulunamadı", "Olumsuz", MB_OK);}
else
{
GetWindowThreadProcessId (HedefTutmac ,&ProsesKimligi);
Islem = OpenProcess(PROCESS_ALL_ACCESS,0, ProsesKimligi);
if (!Islem)
{MessageBox (NULL,"Tutmac alınamadı", "Olumsuz", MB_OK);}
else
{
if(ReadProcessMemory (Islem, (LPVOID)Alan, &AlinanAlan, 4, NULL))
{
HedefAlan = AlinanAlan + 0x111;
if(WriteProcessMemory(Islem, (LPVOID)HedefAlan, &eDegistirilen, 4 , NULL))
{CloseHandle(Islem);}
else
{MessageBox (NULL,"Hafıza bölgesine yazılamadı", "Olumsuz", MB_OK);}
}
else
{MessageBox (NULL, "Hafıza bölgesi okunamadı", "Olumsuz", MB_OK);}
}
}
}
}
break;
case WM_DESTROY:
PostQuitMessage (0);
break;
default:
return DefWindowProc (AnaPencereTutmaci, message, wParam, lParam);
}
return 0;
}