小游戏辅助【源码】

[复制链接]

该用户从未签到

2380

主题

2433

帖子

9139

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
9139
QQ
跳转到指定楼层
楼主
发表于 2017-6-13 12:06:45 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

想要查看内容赶紧注册登陆吧!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
小宝-挂机版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;
DWORD  threadID;
HINSTANCE hins;
#pragma data_seg()

#define MM_FASTEST 0x20123454
#define MM_INIT      0x20123455
#define MM_START  0x20123456
#define MM_END    0x20123457
#define MM_STEP   0x20123458
char szBuf[256];
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)__stdcall  mousemove(short x,short y)
{  
    HWND hwnd = FindWindow(NULL,"QQ连连看");
    ::SetCursorPos(x,y);
    return true;
}

BOOL __declspec(dllexport)__stdcall  lbuttondown()
{
    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)__stdcall  CALLBACK MouseProc(int nCode,WPARAM wParam,LPARAM lParam)
{   
    LRESULT ret = CallNextHookEx(NULL,nCode,wParam,lParam);
    return ret;
}

LRESULT __declspec(dllexport)__stdcall  CALLBACK 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)__stdcall  CALLBACK 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;
}
分享到:  QQ好友和群QQ好友和群
收藏收藏
回复

使用道具 举报

快速回复高级模式
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表