MCPcopy Create free account
hub / github.com/Phobos-developers/Phobos / PatchLog

Method PatchLog

src/Utilities/Debug.cpp:211–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211void Console::PatchLog(DWORD dwAddr, void* fakeFunc, DWORD* pdwRealFunc)
212{
213#pragma pack(push, 1)
214 struct JMP_STRUCT
215 {
216 byte opcode;
217 DWORD offset;
218 } *pInst;
219#pragma pack(pop)
220
221 DWORD dwOldFlag;
222 VirtualProtect((LPVOID)dwAddr, 5, PAGE_EXECUTE_READWRITE, &dwOldFlag);
223
224 pInst = (JMP_STRUCT*)dwAddr;
225
226 if (pdwRealFunc && pInst->opcode == 0xE9) // If this function is hooked by Ares
227 *pdwRealFunc = pInst->offset + dwAddr + 5;
228
229 pInst->offset = reinterpret_cast<DWORD>(fakeFunc) - dwAddr - 5;
230
231 VirtualProtect((LPVOID)dwAddr, 5, dwOldFlag, NULL);
232}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected