Click here to Skip to main content
15,886,362 members
Articles / Programming Languages / C++

Advanced Class Probe

Rate me:
Please Sign up or sign in to vote.
2.48/5 (8 votes)
19 Oct 20043 min read 67.6K   1K   17  
A program to probe a window for its class, and enumerate all the loaded modules
.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
WM_STOPHOOK equ WM_USER+5 ; this is added by me sanjit 
.data
hInstance dd 0

.data?
hHook dd ?
hWnd dd ?

.code
DllEntry proc hInst:HINSTANCE, reason:DWORD, reserved1:DWORD
	push hInst
	pop hInstance
      mov  eax,TRUE
      ret
DllEntry Endp

MouseProc proc nCode:DWORD,wParam:DWORD,lParam:DWORD
    .if(nCode < 0);modified by sanjit from the original code 
	invoke CallNextHookEx,hHook,nCode,wParam,lParam
	ret
	.endif

	.if(wParam == WM_RBUTTONDOWN);modified by sanjit from the original code
	  invoke PostMessage,hWnd,WM_STOPHOOK,0,0;stop the hook
	.endif
	
	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
	
	invoke CallNextHookEx,hHook,nCode,wParam,lParam
	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

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions