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
|
namespace mem { void mem::Nop(char* dst, unsigned int size) { DWORD oldprotect; VirtualProtect(dst, size, PAGE_EXECUTE_READWRITE, &oldprotect); memset(dst, 0x90, size); VirtualProtect(dst, size, oldprotect, &oldprotect); }
void mem::NopEx(char* dst, unsigned int size, HANDLE hProcess) { char* nopArray = new char[size]; memset(nopArray, 0x90, size);
DWORD oldprotect; VirtualProtectEx(hProcess, dst, size, PAGE_EXECUTE_READWRITE, &oldprotect); WriteProcessMemory(hProcess, dst, nopArray, size, NULL); VirtualProtectEx(hProcess, dst, size, oldprotect, &oldprotect); delete[] nopArray; } }
|