diff --git a/MemoryModule.c b/MemoryModule.c index cf38388..403b2af 100644 --- a/MemoryModule.c +++ b/MemoryModule.c @@ -392,6 +392,8 @@ PerformBaseRelocation(PMEMORYMODULE module, ptrdiff_t delta) } } + // flush instruction cache to avoid executing stale code after performing relocations + FlushInstructionCache(GetCurrentProcess(), (LPCVOID) dest, module->pageSize); // advance to next relocation block relocation = (PIMAGE_BASE_RELOCATION) OffsetPointer(relocation, relocation->SizeOfBlock); }