Created
May 10, 2016 08:30
-
-
Save secretdataz/b0a48bfe14d93b67c480481decf7ff43 to your computer and use it in GitHub Desktop.
Mem edit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Windows.h> | |
BOOL WriteBytes(DWORD dwAddress, LPBYTE lpBuffer, DWORD nBytes) { | |
if (nBytes == 0) { | |
return FALSE; | |
} | |
DWORD dwOldProtect; | |
if (!VirtualProtect((LPVOID)dwAddress, nBytes, PAGE_EXECUTE_READWRITE, &dwOldProtect)) { | |
return FALSE; | |
} | |
memcpy((LPVOID)dwAddress, lpBuffer, nBytes); | |
if (!VirtualProtect((LPVOID)dwAddress, nBytes, dwOldProtect, &dwOldProtect)) { | |
return FALSE; | |
} | |
return TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment