Skip to content

Commit 4e4a132

Browse files
committed
Apply Belonit's fix for Patch::Apply from the C++ Spawner
1 parent 736074f commit 4e4a132

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Utilities/Patch.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ void Patch::Apply()
4242
DWORD protect_flag;
4343
VirtualProtect(pAddress, this->size, PAGE_EXECUTE_READWRITE, &protect_flag);
4444
memcpy(pAddress, this->pData, this->size);
45-
VirtualProtect(pAddress, this->size, protect_flag, NULL);
45+
VirtualProtect(pAddress, this->size, protect_flag, &protect_flag);
46+
// NOTE: Instruction cache flush isn't required on x86. This is just to conform with Win32 API docs.
47+
FlushInstructionCache(GetCurrentProcess(), pAddress, this->size);
4648
}
4749

4850
void Patch::Apply_LJMP(DWORD offset, DWORD pointer)

0 commit comments

Comments
 (0)