Код: Выделить всё
008C7695 | 0F85 39010000 | jne exordion_gl.8C77D4
008C769B | 3815 B1751301 | cmp byte ptr ds:[11375B1],dl
008C76A1 | 0F84 2D010000 | je exordion_gl.8C77D4
< /code>
То, что я пытаюсь сделать, - это просто зацепить 008c7695, чтобы решить, выполняются ли прыжки или нет. < /p>
Это мой основной пример: < /p>
uintptr_t hook_start = 0x008C7695; // Address to hook
uintptr_t return_address = 0x008C769B; // Return to this code
uintptr_t unencrypted_jmp = 0x008C77D4;
void __stdcall print_debug(const char* msg)
{
OutputDebugStringA(msg);
}
__declspec(naked) void MyHook() {
__asm {
pushad
pushfd
// get pointer
mov eax, [esp + 0x38]
// save stack and debug output
push eax
call print_debug
add esp, 4
// restore registers
popfd
popad
// cmp original
cmp byte ptr ds : [0x011375B1] , dl
jne jump_without_encrypt
jmp return_address
jump_without_encrypt:
mov eax, unencrypted_jmp
jmp eax
}
}
void InstallHook() {
DWORD oldProtect;
BYTE* target = (BYTE*)hook_start;
VirtualProtect(target, 6, PAGE_EXECUTE_READWRITE, &oldProtect);
uintptr_t rel_addr = (uintptr_t)MyHook - (uintptr_t)hook_start - 5;
target[0] = 0xE9;
*(DWORD*)(target + 1) = rel_addr;
target[5] = 0x90;
VirtualProtect(target, 6, oldProtect, &oldProtect);
}
< /code>
Крюк работает, чтобы я мог видеть вывод: < /p>
[HOOK] Value in [esp+14h]: 0x55cf734
[HOOK] As string: /config.otml
Подробнее здесь: https://stackoverflow.com/questions/795 ... k-crashing