Hook This !
Library for coders
Ok this is a simple, fast and modeable procedure that allows you to hook your own procedure in any part of code.
Yeah you hear well forgget about opening Ollydbg, make JMPs to other part of code for call your DLL and late restore them.
This fuction does it all, you can hook in any place of any program and without getting any error or modification of the actual code.
But what this means? lets see a example:
Code:
00401087 . 68 B80B0000 PUSH 0BB8 ; |ControlID = BB8 (3000.) 0040108C . FF75 08 PUSH DWORD PTR SS:[EBP+8] ; |hWnd 0040108F . E8 6A010000 CALL; \SetDlgItemTextA
Code:
0040106B . E8 9D41C00F CALL IndigoGS.1000520D ; |Message 00401070 . E8 83010000 CALL; \SendMessageA
Code:
00401087 . 68 B80B0000 PUSH 0BB8 ; |ControlID = BB8 (3000.) 0040108C . FF75 08 PUSH DWORD PTR SS:[EBP+8] ; |hWnd 0040108F . E8 6A010000 CALL; \SetDlgItemTextA
How use it:
First add into your source the Include file and the Library
Now you just need to call my library in your DLL or EXE program like this:
Code:
MASM32: invoke HookThis, 0040106Bh, Offset MyProcedure, 1 C++: HookThis(0040106B, MyProcedure, 1) Resumed: HookThis(HookOffset, MyProcedure, ID)
Once the hooked code call your procedure you can do anything has usual, but just remember before exit your procedure call this:
Code:
MASM32: invoke UnHookThis, 0040106B, 1 C++: UnHookThis(0040106B, 1) Resumed: UnHookThis(HookedOffset, ID)
Limitations:
The only limitation is that you can only do 100 hooks, but i can expand to much more if you need, also its open source and you can do yourself.
Extras:
I can expand the fuction for you to choose between make a CALL to your procedure or a JUMP to a portion of code, but i will make this later in other update.
Example:
Code:
Invoke HookThis, 00401064h, Offset MyProcedure1, 1 Invoke HookThis, 00401074h, Offset MyProcedure2, 2 Invoke HookThis, 00401094h, Offset MyProcedure3, 3 MyProcedure1 Proc ;DO ALL YOU WANT HERE invok UnHookThis, 00401064, 1 MyProcedure1 Endp MyProcedure2 Proc ;DO ALL YOU WANT HERE invok UnHookThis, 00401074, 2 MyProcedure2 Endp MyProcedure3 Proc ;DO ALL YOU WANT HERE invok UnHookThis, 00401094, 3 MyProcedure3 Endp
Code:
In hooked program: 0041000: invoke LoadLibrary, "MyDLL" 0041005: Other instructions In our DLL: DllEntry Proc hInst:HINSTANCE, reason:DWord, reserved1:DWord .if (reason == DLL_PROCESS_ATTACH) invoke HookThis, 0041005h, Offset InitAll, 1 .endif mov eax, TRUE ret DllEntry EndP
Enjoy, source code + Library + Include file in attachment.
Credits: [INDG]FeN$x
Code: HookAddr -> The offset where you want to hook YouProcedure -> The offset of your procedure in EXE or DLL ID -> This ID is like a counter, if you use first time then use 1 Code: HookThis 0041000h, Offset MyProcedure, 1 HookThis 0042000h, Offset MyProcedure2, 2 - Do a thread and each 1 second Hook and UnHook the procedure, this will avoid the CRC since your thread has to be more fast than GameGuard CRC thread. - If gameguard doesnt let you open your program probably you using some detected APIs or they patch your application (probably aimbot or something). Follow this advices and tell me if you need more help, but in the thread. thanks. |
0 comentarios:
Publicar un comentario