一个关于GetMessage的问题~弄了一夜不得结果,快来人帮帮我吧~(100分)

  • 主题发起人 主题发起人 gaiyueyue
  • 开始时间 开始时间
G

gaiyueyue

Unregistered / Unconfirmed
GUEST, unregistred user!
首先我安装了一个钩子<br>procedure StartHook; stdcall;<br>begin<br> &nbsp;if GetMsgHook = 0 then<br> &nbsp;begin<br> &nbsp;WriteToFile('已经进入starthook');//WriteToFile是我为了调试方便才用的<br>//功能是看看程序是运行到什么时候出错不前进的,它在C盘下生成1.txt<br> &nbsp; &nbsp;GetMsgHook := SetWindowsHookEx(WH_GETMESSAGE,GetMsgHookProc, HInstance, 0);<br> &nbsp; &nbsp;WriteToFile('已经进入安装完starthook');<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while GetMessage(MsgHook, 0, 0, 0) do<br> &nbsp; &nbsp; &nbsp; &nbsp; begin<br> &nbsp; &nbsp; &nbsp; &nbsp; WriteToFile('已经将机器码写入内存');<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WriteASM;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br><br>我现在的问题是把代码写到DLL里面之后,用我的EXE文件,上面放一个按钮,按一下就StartHook安装钩子,这样就好用没出现问题,可是当我把这个DLL注入到EXPLORER进程之<br>后用CreateThread(nil, 0, @StartHook, nil, 0, ThreadID)启动StartHook,程序走到WriteToFile('已经进入安装完starthook');这一行就不走了,后面的<br>while GetMessage(MsgHook, 0, 0, 0) do 也不执行,哪位好心人告诉我这是为什么啊,我弄了一晚上了也没找到原因啊?
 
BOOL GetMessage(<br> &nbsp; &nbsp;LPMSG lpMsg, // address of structure with message<br> &nbsp; &nbsp;HWND hWnd, // handle of window<br> &nbsp; &nbsp;UINT wMsgFilterMin, // first message<br> &nbsp; &nbsp;UINT wMsgFilterMax // last message<br> &nbsp; );<br>你這個可能是沒有得到LPMSG這個值啊。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部