WriteProcessMemory - Memory unprotecten
-
hallo
ich hab hier diesen code der mir 2 offsets patchen soll. jedoch sind die beiden stellen im speicher protected. meine frage ist also wie ich diese unprotecten kann dass ich sie patchen kann.
#include <string.h> #include <iostream> #include <windows.h> using namespace std; int main() { HWND hwnd; HANDLE handle; DWORD id; unsigned address1 = 0x6F868D0; unsigned address2 = 0x6F868CA; int inject1 = 0x384; int inject2 = 0x5A0; DWORD br; hwnd = FindWindow(0, "PK"); cout << "Window found -> hwnd=" << hwnd << endl; GetWindowThreadProcessId(hwnd, &id); cout << "ProcessID=" << id << endl; handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, id); if(WriteProcessMemory(handle,(LPVOID)address1, &inject1, sizeof(inject1), &br)) { cout << "Injected first address - Done" << endl; } else { cout << "Injected first address - Failed" << endl; } if(WriteProcessMemory(handle,(LPVOID)address2, &inject2, sizeof(inject2), &br)) { cout << "Injected second address - Done" << endl; } else { cout << "Injected second address - Failed" << endl; } CloseHandle(handle); system("PAUSE"); return 0; }
-
Dieser Thread wurde von Moderator/in volkard aus dem Forum C++ in das Forum WinAPI verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
das geht mit VirtualProtectEx
-
hm damit gings immernoch nicht. ich habe gelesen das es gehen soll wenn ich SeDebugPrivilege aktiviere. allerdings wie muesste ich das machen? irgendwie finde ich dazu nix passendes
-
Schlag nach in der MSDN und Du findest
http://msdn.microsoft.com/en-us/library/aa446619(VS.85).aspx