Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mid hook issue #131

Closed
dnblank123 opened this issue Jul 17, 2024 · 0 comments
Closed

Mid hook issue #131

dnblank123 opened this issue Jul 17, 2024 · 0 comments

Comments

@dnblank123
Copy link

dnblank123 commented Jul 17, 2024

game.exe+C4FE44 - 48 83 EC 28           - sub rsp,28
game.exe+C4FE48 - 4D 8B 41 38           - mov r8,[r9+38]
game.exe+C4FE4C - 48 8B CA              - mov rcx,rdx // trying to hook
game.exe+C4FE4F - 49 8B D1              - mov rdx,r9 
game.exe+C4FE52 - E8 0D000000           - call game.exe+C4FE64
game.exe+C4FE57 - B8 01000000           - mov eax,00000001
game.exe+C4FE5C - 48 83 C4 28           - add rsp,28
game.exe+C4FE60 - C3                    - ret
game.exe+C4FE44 - 48 83 EC 28           - sub rsp,28
game.exe+C4FE48 - 4D 8B 41 38           - mov r8,[r9+38]
game.exe+C4FE4C - E9 83113AFF           - jmp 7FF68AEE0FD4 //hooked
game.exe+C4FE51 - D1 E8                 - shr eax,1 // ??
game.exe+C4FE53 - 0D 000000B8           - or eax,B8000000 //??
game.exe+C4FE58 - 01 00                 - add [rax],eax // ??
game.exe+C4FE5A - 00 00                 - add [rax],al //??
game.exe+C4FE5C - 48 83 C4 28           - add rsp,28
game.exe+C4FE60 - C3                    - ret

code:

using HookTest = void(STDMETHODCALLTYPE*)();
HookTest HT = std::bit_cast<HookTest>(mem::moduleBase + 0xC4FE4C);
void FuncHT() {
	asm("ret");
	return HT();
}
void func() {
    MH_CreateHook(std::bit_cast<void*>(HT),std::bit_cast<void*>(&FuncHT), nullptr);
    MH_EnableHook(std::bit_cast<void*>(HT));
}

I tried on microsoft detour

game.exe+C4FE44 - 48 83 EC 28           - sub rsp,28
game.exe+C4FE48 - 4D 8B 41 38           - mov r8,[r9+38]
game.exe+C4FE4C - E9 0705B9BF           - jmp 7FF6E2980358
game.exe+C4FE51 - CC                    - int 3 
game.exe+C4FE52 - E8 0D000000           - call game.exe+C4FE64
game.exe+C4FE57 - B8 01000000           - mov eax,00000001
game.exe+C4FE5C - 48 83 C4 28           - add rsp,28
game.exe+C4FE60 - C3                    - ret 

I also tried #97 but doesn't fix the problem.

@dnblank123 dnblank123 reopened this Jul 21, 2024
@dnblank123 dnblank123 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant