| 209 | } |
| 210 | |
| 211 | void 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected