小游戏辅助【源码】
小宝-挂机版1.083.013.rar热血江湖124版抓包器模拟按键外挂源码.7z
盛大传奇外挂原代码(vc).7z
连连看外挂源码.7z
// Hook.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
#include "Hook.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#pragma data_seg(".SHARDAT")
static HHOOK hkb=NULL;
static HHOOK hHk=NULL;
static HHOOK hkey = NULL;
DWORDthreadID;
HINSTANCE hins;
#pragma data_seg()
#define MM_FASTEST 0x20123454
#define MM_INIT 0x20123455
#define MM_START0x20123456
#define MM_END 0x20123457
#define MM_STEP 0x20123458
char szBuf;
char *p;
CString msg;
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC.This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CHookApp
BEGIN_MESSAGE_MAP(CHookApp, CWinApp)
//{{AFX_MSG_MAP(CHookApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHookApp construction
CHookApp::CHookApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CHookApp object
BOOL CHookApp::InitInstance ()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
hins=AfxGetInstanceHandle();
bFirst = TRUE;
GetModuleFileName(AfxGetInstanceHandle( ),szBuf,sizeof(szBuf));
p = szBuf;
while(strchr(p,'\\'))
{
p = strchr(p,'\\');
p++;
}
*p = '\0';
msg=szBuf;
return TRUE;
}
BOOL CHookApp::ExitInstance ()
{
return TRUE;
}
CHookApp theApp;
extern "C" BOOL __declspec(dllexport)__stdcallmousemove(short x,short y)
{
HWND hwnd = FindWindow(NULL,"QQ连连看");
::SetCursorPos(x,y);
return true;
}
BOOL __declspec(dllexport)__stdcalllbuttondown()
{
HWND hwnd = FindWindow(NULL,"QQ连连看");
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
return true;
}
LRESULT __declspec(dllexport)__stdcallCALLBACK MouseProc(int nCode,WPARAM wParam,LPARAM lParam)
{
LRESULT ret = CallNextHookEx(NULL,nCode,wParam,lParam);
return ret;
}
LRESULT __declspec(dllexport)__stdcallCALLBACK KeyBoardProc(int nCode,WPARAM wParam,LPARAM lParam)
{
if(((DWORD)lParam&0x40000000) && (HC_ACTION==nCode))
{
HWND hwnd = FindWindow(NULL,"QQ连连看外挂");
if (hwnd)
{
switch(wParam)
{
case VK_F8:
SendMessage(hwnd,WM_COMMAND,MM_FASTEST,0);
break;
case VK_F9:
SendMessage(hwnd,WM_COMMAND,MM_INIT,0);
break;
case VK_F10:
SendMessage(hwnd,WM_COMMAND,MM_START,0);
break;
case VK_F11:
SendMessage(hwnd,WM_COMMAND,MM_END,0);
break;
case VK_SPACE:
static last=0;
if ((::GetTickCount() - last )> 300 )
{
last = ::GetTickCount();
SendMessage(hwnd,WM_COMMAND,MM_STEP,0);
}
break;
}
}
}
LRESULT ret = CallNextHookEx(NULL,nCode,wParam,lParam);
return ret;
}
BOOL __declspec(dllexport)UnHook()
{
BOOL unhooked = UnhookWindowsHookEx(hkb);
return unhooked;
}
BOOL __declspec(dllexport)__stdcall installhook()
{
hkb=SetWindowsHookEx(WH_MOUSE,(HOOKPROC)MouseProc,hins,0);
hkey=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyBoardProc,hins,0);
return TRUE;
}
BOOL __declspec(dllexport)__stdcall ModMem()
{
HWND hnd = FindWindow(NULL,"QQ连连看");
if (hnd == NULL)
return false;
threadID=GetWindowThreadProcessId(hnd,NULL);
hHk = SetWindowsHookEx(WH_GETMESSAGE, ModifyIt, hins, threadID);
bFirst = true;
}
LRESULT __declspec(dllexport)__stdcallCALLBACK ModifyIt(int nCode, WPARAM wParam, LPARAM lParam)
{
PBYTE pData ;
DWORD dwOldProtect ;
MEMORY_BASIC_INFORMATION mbi_thunk ;
if (nCode < 0)
return CallNextHookEx(hHk, nCode, wParam, lParam);
if (!bFirst)
return 0;
pData = (PBYTE) 0x00403290 ;
VirtualQuery(pData, &mbi_thunk, sizeof(MEMORY_BASIC_INFORMATION));
VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize,
PAGE_READWRITE, &mbi_thunk.Protect);
(*pData) = 0x75 ;
(*(pData+1)) = 0x00 ;
VirtualProtect(mbi_thunk.BaseAddress, mbi_thunk.RegionSize,
mbi_thunk.Protect, &dwOldProtect);
bFirst = FALSE ;
return 1;
}
页:
[1]