include \masm32\include\windows.inc
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
;数据段
.data
;reservebytes db 10h dup(090h) 本来是准备hook完了再改回去的,但是懒得写了,能做演示作用足够了
kernel32dll db "kernel32.dll",0h
hkernel32 dd 0h
exitprocessname db "ExitProcess",0h
hexitprocess dd 0h
sztext db "你以为点确定就可以退出?",0h
sztitle db "hooked" , 0h
errortext db "error",0h
errortitle db "error",0h
oldprotect dd 0h
;数据段?
.data?
;代码段
.code
newexitprocess proc p1:dword
invoke MessageBoxA,NULL,addr sztext,addr sztitle,MB_OK
newexitprocess endp
start:
main proc
invoke GetModuleHandle,addr kernel32dll
invoke GetProcAddress , eax , addr exitprocessname
mov hexitprocess,eax
invoke VirtualProtect,eax,2h,PAGE_EXECUTE_READWRITE,addr oldprotect
test eax,eax
jz fuck
lea eax,newexitprocess
call overtrash
push eax
ret
overtrash:
pop esi
mov edi,hexitprocess
movsw
invoke ExitProcess,NULL
jmp overfuck
fuck:
invoke MessageBoxA,NULL,addr errortext,addr errortitle,MB_OK
overfuck:
ret
main endp
end start