Ultimate Hooking Engine is project started for my own needs, to be honest, I got tired of rewriting inline hooks everytime I need to hook something.
This engine is very simple to use and is designed to be used by everyone that need to hook something, all that is required to hook certain target is carfully crafted hooking dll with certain exports, actually exports are used to locate API that you want to hook, there are 3 export types that your dll may have:
Note also that this is optional, if you don't need to call orignal proc, then you don't need this export.
Note that when working with MSVC2005 it will always screw export name for procedurs while function pointers are properly exported, so add this line to your .def file:
This procedure will be called before program jumps to entrypoint of target, here you may add some extra code, it isn't very useful and all initialization you may perfrom in DllEntry, but I leave this here just in case that you want to start your own tracer before code jmps to entrypoint. At least that's why I'm using it.
Examples for MSVC, Borland C and tasm you may find in examples folder,
Enjoy...
(c) 2007 deroko of ARTeam http://deroko.phearless.org/ultimate.zip
mov esi, api_address ;kernel32.CreateFileA
push ecx ;5
rep movsb
pop ecx
push edi
push eax
mov edi, api_address ;kernel32.CreateFileA
mov al, 90h ;替换成nop
rep stosb ;DLL基址替换成5个90
pop eax
pop edi
mov byte ptr[edi], 0e9h ;jmp命令
add edi, 5
sub esi, edi
mov dword ptr[edi-4], esi ;0EF9FFFB
push modulename
call Detoured_GetModuleHandleA
ret
HOOK_kernel32_GetModuleHandleA endp
HOOK_kernel32_ExitProcess proc exitcode:dword
invoke TerminateProcess, -1, exitcode
ret
HOOK_kernel32_ExitProcess endp
End DllEntry
-----------------------mydll.Inc-------------
HOOK_kernel32_GetModuleHandleA proto
HOOK_user32_MessageBoxA proto
HOOK_kernel32_ExitProcess proto
Detoured_GetModuleHandleA proto
Detoured_MessageBoxA proto