mirror of
https://github.com/isledecomp/LEGOIslandRebuilder.git
synced 2024-11-26 17:16:14 -05:00
util: return original func address in OverwriteCall
This commit is contained in:
parent
571261c85f
commit
9c70a965bc
2 changed files with 8 additions and 3 deletions
|
@ -125,15 +125,20 @@ LPVOID OverwriteVirtualTable(LPVOID object, SIZE_T methodIndex, LPVOID overrideF
|
|||
return originalFunction;
|
||||
}
|
||||
|
||||
BOOL OverwriteCall(LPVOID destination, LPVOID localCall)
|
||||
LPVOID OverwriteCall(LPVOID destination, LPVOID localCall)
|
||||
{
|
||||
char originalFunction[5];
|
||||
char callInst[5];
|
||||
|
||||
callInst[0] = '\xE8';
|
||||
|
||||
*(DWORD*)(&callInst[1]) = (DWORD)localCall - ((DWORD)destination + 5);
|
||||
|
||||
return WriteMemory(destination, callInst, 5);
|
||||
if (!WriteMemory(destination, callInst, 5, originalFunction)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (LPVOID)((*(DWORD *)(originalFunction + 1)) + ((DWORD)destination + 5));
|
||||
}
|
||||
|
||||
LPVOID SearchPattern(LPVOID imageBase, LPCVOID search, SIZE_T count)
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
BOOL WriteMemory(LPVOID destination, LPVOID source, size_t length, LPVOID oldData = NULL);
|
||||
|
||||
BOOL OverwriteCall(LPVOID destination, LPVOID localCall);
|
||||
LPVOID OverwriteCall(LPVOID destination, LPVOID localCall);
|
||||
|
||||
LPVOID SearchPattern(LPVOID imageBase, LPCVOID search, SIZE_T count);
|
||||
|
||||
|
|
Loading…
Reference in a new issue