Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions MemoryModule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -645,9 +647,6 @@ HMEMORYMODULE MemoryLoadLibraryEx(const void *data, size_t size,
} else {
result->isRelocated = TRUE;
}

// flush instruction cache to avoid executing stale code after performing relocations
FlushInstructionCache((HANDLE)-1, NULL, 0);

// load required dlls and adjust function table of imports
if (!BuildImportTable(result)) {
Expand Down