请看下这个外挂的源码,DLL注入(100分)

  • 主题发起人 主题发起人 qet006
  • 开始时间 开始时间
Q

qet006

Unregistered / Unconfirmed
GUEST, unregistred user!
下边是简单网游加血的DEMO<br>它的运行程序能很好的运行,但这个文件不能编译,<br>函数KeyboardHookProc在Application.Handle:= GetForegroundWindow处不过<br>我在USER中加入Forms可以通过,但运行时没有出现窗口<br>unit drProc;<br><br>interface<br><br>uses<br> &nbsp;Windows, SysUtils;<br><br>var<br> &nbsp;hNextHookProc: HHook;<br> &nbsp;procSaveExit: Pointer;<br><br>function KeyboardHookProc(code: Integer; wparam: WPARAM;<br> &nbsp;lparam: LPARAM): LRESULT stdcall; export;<br>function CreateKeyboardHook: BOOL; stdcall; export;<br>function DestroyKeyboardHook: BOOL; stdcall; export;<br>procedure KeyboardHookExit;<br><br>implementation<br><br>var<br> &nbsp;GameSwitch: Word; &nbsp; &nbsp;//程序热键<br><br>function KeyboardHookProc(code: Integer; wparam: WPARAM;<br> &nbsp;lparam: LPARAM): LRESULT;<br>const<br> &nbsp;_KeyProcessMask = $80000000;<br>begin<br> &nbsp;Result := 0;<br> &nbsp;if code &lt; 0 then<br> &nbsp;begin<br> &nbsp; &nbsp;Result := Windows.CallNextHookEx(hNextHookProc, code, wparam, lparam);<br> &nbsp; &nbsp;Exit;<br> &nbsp;end;<br> &nbsp;if ((lparam and _KeyProcessMask) = 0) and (wparam = GameSwitch) then<br> &nbsp;begin<br> &nbsp; &nbsp;Application.Handle:= GetForegroundWindow; &nbsp;//返回当前窗口句柄<br><br> &nbsp; &nbsp;Result := 1;<br> &nbsp;end;<br>end;<br><br>function CreateKeyboardHook: BOOL;<br>begin<br> &nbsp;Result := false;<br> &nbsp;if hNextHookProc &lt;&gt; 0 then<br> &nbsp; &nbsp;exit;<br> &nbsp;hNextHookProc := Windows.SetWindowsHookEx(WH_KEYBOARD, @KeyboardHookProc,<br> &nbsp; &nbsp;hInstance, 0);<br> &nbsp;Result := hNextHookProc &lt;&gt; 0;<br>end;<br><br>function DestroyKeyboardHook: BOOL;<br>begin<br> &nbsp;if hNextHookProc &lt;&gt; 0 then<br> &nbsp;begin<br> &nbsp; &nbsp;Windows.UnhookWindowsHookEx(hNextHookProc);<br> &nbsp; &nbsp;hNextHookProc := 0;<br> &nbsp;end;<br> &nbsp;Result := hNextHookProc = 0;<br>end;<br><br>procedure KeyboardHookExit;<br>begin<br> &nbsp;if hNextHookProc &lt;&gt; 0 then<br> &nbsp; &nbsp;DestroyKeyboardHook;<br> &nbsp;ExitProc := procSaveExit;<br>end;<br><br>Initialization<br> &nbsp;GameSwitch := VK_HOME;<br><br>end.
 
那位高手知道呀
 
DLL下面能调用Application吗?<br>不可以吧如果真的要返回可以自己定义一个变量<br>来返回
 

Similar threads

后退
顶部