deroko的那个可能比较完美:
http://bbs.pediy.com/showthread.php?t=45601&highlight=Ultimate
.386
.model flat, stdcall
option casemap: none
include windows.inc
include user32.inc
include kernel32.inc
includelib user32.lib
includelib kernel32.lib
public C Detoured_MessageBoxA
public C Detoured_GetModuleHandleA
.data?
Detoured_MessageBoxA dd ?
Detoured_GetModuleHandleA dd ?
.code
DllEntry proc hInstance:HINSTANCE, reason:DWORD, reserved1:DWORD
.if reason==DLL_PROCESS_ATTACH
mov eax,TRUE
.endif
ret
DllEntry Endp
HOOK_user32_MessageBoxA proc hwnd:DWORD, text:DWORD, about:DWORD, icon:DWORD
push icon
push about
push text
push hwnd
call Detoured_MessageBoxA
ret
HOOK_user32_MessageBoxA endp
HOOK_kernel32_GetModuleHandleA proc modulename:dword
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
------------------------mydll.Def-------------
EXPORTS
HOOK_user32_MessageBoxA
HOOK_kernel32_GetModuleHandleA
HOOK_kernel32_ExitProcess
Detoured_GetModuleHandleA
Detoured_MessageBoxA