diff --git a/src/Utilities/Patch.cpp b/src/Utilities/Patch.cpp index c7350c3e..f3444392 100644 --- a/src/Utilities/Patch.cpp +++ b/src/Utilities/Patch.cpp @@ -61,7 +61,9 @@ void Patch::Apply() DWORD protect_flag; VirtualProtect(pAddress, this->size, PAGE_EXECUTE_READWRITE, &protect_flag); memcpy(pAddress, this->pData, this->size); - VirtualProtect(pAddress, this->size, protect_flag, NULL); + VirtualProtect(pAddress, this->size, protect_flag, &protect_flag); + // NOTE: Instruction cache flush isn't required on x86. This is just to conform with Win32 API docs. + FlushInstructionCache(GetCurrentProcess(), pAddress, this->size); } void Patch::Apply_LJMP(DWORD offset, DWORD pointer)