S
sy0116
Unregistered / Unconfirmed
GUEST, unregistred user!
中间DLL的代码如下:<br>procedure Load;<br>var<br> LibHd:THandle;<br>begin<br> Jumped:=True;<br> LibHd:=LoadLibrary(PChar('D:/Program Files/Borland/Delphi7/Projects/hook/Jump/key.dll'));<br> RealDLL:=GetProcAddress(LibHd,'SetHook');<br> if @RealDLL<>nil then<br> RealDLL<br> else<br> begin<br> MessageBox(0,'f','dd',0);<br> FreeLibrary(LibHd);<br> end;<br>end;<br><br>function JumpProc(ncode:Integer;wparam:WPARAM;lparam:LPARAM):LRESULT;stdcall;<br>var<br> pid:Cardinal;<br>begin<br> if Jumped=False then<br> begin<br> ThreadHd:=CreateThread(nil,0,@Load,nil,0,pid);<br> Jumped:=True;<br> end;<br> Result:=CallNextHookEx(JumpHook,ncode,wparam,lparam);<br>end;<br><br>procedure SetHook(ExpIDWORD);stdcall;export;<br>begin<br> JumpHook:=SetWindowsHookEx(WH_GETMESSAGE,@JumpProc,HInstance,ExpID);<br> Jumped:=False;<br>end;<br><br>需要真正注入的key.dll的代码如下:<br>function HookProc(ncode,wparam,lparam:Integer):Integer;stdcall;<br>begin<br> MessageBox(0,'sfsfasfsafsaf','fsf',0);<br> Result:=CallNextHookEx(oldhook,ncode,wparam,lparam);<br>end;<br>procedure SetHook;export;<br>begin<br> oldhook:=SetWindowsHookEx(WH_KEYBOARD,@HookProc,HInstance,0);<br> MessageBox(0,PChar(inttostr(oldhook)),'sd',0);<br>end;<br>exports<br> SetHook;<br>===========================================================================<br>运行后发现,key.dll确认已被注入到指定进程,key.dll的SetHook过程确实执行了,因为有一个对话框跳出并显示了一串数字,但是按键后却没有任何对话框跳出来,也就是说key.dll的HookProc函数并没有被调用,请问这是为什么?