c++ - Why is wparam changing if i use same message, with same paras? -
i trying implement code http://www.codeproject.com/kb/threads/winspy.aspx (subclassing part) project having problems, debugged dll , seems when send exact same message(or think) hooked thread's hwnd message appears different(i see debugging dll file directly trough visual studio).
so start, share custom winregistered mssg dll instances.. here writting use both projects(the 1 downloaded site above, , current 1 tries mimic same strategy)
i first share message register later(in dll process atach) dll instances..
#pragma data_seg("shared") uint wm_hookex = 0; #pragma data_seg()
ok time register when dll attaches...
bool apientry dllmain( handle hmodule, dword ul_reason_for_call, lpvoid lpreserved ) { if( ul_reason_for_call == dll_process_attach ) { g_hinstdll = (hinstance) hmodule; ::disablethreadlibrarycalls( g_hinstdll ); if( wm_hookex==null ) wm_hookex = ::registerwindowmessage( _t("wm_hookex_rk") ); } return true; }
and after hook thread send message
hhook = setwindowshookex( wh_callwndproc,(hookproc)hookproc, g_hinstdll, getwindowthreadprocessid(plist,null) ); sendmessage( hwnd,wm_hookex,0,1);
now vs dll debugging can inspect how message received on other side, in case of original "3 ways inject code" project subclassing part parameters are
wparam = 1 lparam = 23720848
while in project
wparam = 0 lparam = 23720824
and appears while debugging procedure doesnt recognize wm_hookex @ all, same parameters!
i dont this, register hook dll process attach exact same name, except using wm_hookex = ::registerwindowmessage( _t("wm_hookex_rk") );" _t project unicode doubt matters.
everything else 100% same
sendmessage( same hwnd ,same mssg ,0,1);
any ideas why other side in project wont see correct mssg correct paras?
thank you
first question, why doing this:
hhook = setwindowshookex( wh_callwndproc,(hookproc)hookproc, g_hinstdll, getwindowthreadprocessid(plist,null);
rewrite as
hhook = setwindowshookex( wh_callwndproc,hookproc, g_hinstdll, getwindowthreadprocessid(plist,null));
what on earth gave idea best way deal type mismatch error cast it? need fix hookproc right kind of function.
Comments
Post a Comment