invoke setdlgitemtext,hdlg,idc_hook,addr hooktext
mov hookflag,false
invoke setdlgitemtext,hdlg,idc_classname,null
invoke setdlgitemtext,hdlg,idc_handle,null
invoke setdlgitemtext,hdlg,idc_wndproc,null
.endif
.endif
.endif
.endif
.else
mov eax,false
ret
.endif
mov eax,true
ret
dlgfunc endp
end start
;----------------------------------------------------- this is the source code of the dll --------------------------------------
.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\user32.inc
includelib \masm32\lib\user32.lib
.const
wm_mousehook equ wm_user+6
.data
hinstance dd 0
.data?
hhook dd ?
hwnd dd ?
.code
dllentry proc hinst:hinstance, reason:dword, reserved1:dword
.if reason==dll_process_attach
push hinst
pop hinstance
.endif
mov eax,true
ret
dllentry endp
mouseproc proc ncode:dword,wparam:dword,lparam:dword
invoke callnexthookex,hhook,ncode,wparam,lparam
mov edx,lparam
assume edx:ptr mousehookstruct
invoke windowfrompoint,[edx].pt.x,[edx].pt.y
invoke postmessage,hwnd,wm_mousehook,eax,0
assume edx:nothing
xor eax,eax
ret
mouseproc endp
installhook proc hwnd:dword
push hwnd
pop hwnd
invoke setwindowshookex,wh_mouse,addr mouseproc,hinstance,null
mov hhook,eax
ret
installhook endp
uninstallhook proc
invoke unhookwindowshookex,hhook
ret
uninstallhook endp
end dllentry
;---------------------------------------------- this is the makefile of the dll ----------------------------------------------
name=mousehook
$(name).dll: $(name).obj
link /section:.bss,s /dll /def:$(name).def /subsystem:windows /libpath:c:\masm\lib $(name).obj
$(name).obj: $(name).asm
ml /c /coff /cp $(name).asm