苏州洗车店转让有没有:关于bcb做的hook注入``急````

来源:百度文库 编辑:神马品牌网 时间:2024/04/26 08:24:36
关于bcb做的hook注入``为什么注入后不一会儿游戏就出错关了?而用vc写的注入又可以(这样应该证明不是因为游戏反注入吧?)
以下是我注入dll的代码```键盘消息处理部分已经注释掉了`但是还是一样出错```请大家看一下``帮帮忙``(vc写界面太难了,不会,只能使用bcb了。。。)

//---------------------------------------------------------------------------#include <vcl.h>#include <windows.h>#include "Unit2.h"#pragma hdrstop//---------------------------------------------------------------------------extern "C" __declspec(dllexport) __stdcallbool SetHookGame(DWORD dwThreadId);//extern "C" __declspec(dllexport) __stdcallLRESULT CALLBACK MyProc(int nCode, WPARAM wParam, LPARAM lParam);static HHOOK hHook = NULL; // 钩子句柄static HINSTANCE hInst; // 当前DLL句柄static TForm * Main1;int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved) { hInst = hinst; return 1; } //--------------------------------------------------------------------------- // 安装钩子函数 bool __declspec(dllexport) __stdcall SetHookGame(DWORD dwThreadId){ if (dwThreadId != 0) {// 安装指定线程的钩子 hHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)MyProc, hInst,dwThreadId); if (hHook != NULL) {// MessageBox(0,"注入成功!","成功",0); return true; } else {// MessageBox(0,"注入失败!","失败",0); return false; } } else {//卸载HOOK钩子 return (UnhookWindowsHookEx(hHook)); }return true;} //---------------------------------------------------------------------------// 钩子函数 LRESULT CALLBACKMyProc(int nCode, WPARAM wParam, LPARAM lParam){/*WORD wKey = (WORD)wParam; if((HIWORD(lParam) & KF_UP) == 0 && HC_ACTION == nCode) { if(wKey == VK_HOME)//是热键 { if(Main1==NULL) {//启动外挂窗口 Main1 = new TMain(NULL); Main1->Show(); } else { Main1->Show(); } } } *///什么也不做,交给系统处理return (CallNextHookEx(hHook, nCode, wParam, lParam));} //---------------------------------------------------------------------------//---------------------------------------------------------------------------
由于上面的代码太缭乱``可能大家看起来困难``我把代码写在一个txt里传到了网上```大家可以到这个地址去看我的代码,谢谢``
http://www.ky163.net/numen/code.txt

对不起啊 我编程不是很厉害 帮不上你什么 太专业的知识最好别在这问 得不到答案的哦