76.游戏分析工具读取内存存到对象数据分析器一

免责声明:内容仅供学习参考,请合法利用知识,禁止进行违法犯罪活动!

内容参考于:易道云信息技术研究院

上一个内容:75.游戏分析工具对象信息的修改

以 75.游戏分析工具对象信息的修改 它的代码为基础进行修改

分析对象菜单添加事件

分析对象菜单的事件代码,添加到 CwndRAN.cpp文件中

void CwndRAN::OnAnlClass()
{
    auto hSel = mTree.GetSelectedItem();
    auto hRoot = mTree.GetRootItem();
    if (hSel == hRoot)return;
    auto h = GetFirstItem(hSel);
    if (h) {
        auto obj = GetOBJPtr(h);
        if (obj)CurOBJ = obj;
    }
}

CwndRAN.cpp文件的修改

void _stdcall ReadData(HWND _hwnd, UINT, UINT_PTR, DWORD) {
    if (!_wndThis->hProcess)return;
    if (!_wndThis->CurOBJ)return;
    
    if (!_wndThis->CurOBJ->UpdateData(_wndThis->hProcess)) {
        _wndThis->hProcess = 0;
        AfxMessageBox(L"游戏句柄打开失败!");
    }
}

BOOL CwndRAN::OnInitDialog()
{
    CDialogEx::OnInitDialog();

    LONG_PTR lStyle;
    // 得到窗口的样式,GWL_STYLE在GetWindowLongPtr说明中有
    lStyle = GetWindowLongPtr(LstData.m_hWnd, GWL_STYLE);
    lStyle |= LVS_REPORT;
    SetWindowLongPtr(LstData.m_hWnd, GWL_STYLE, lStyle);

    DWORD dStyle = LstData.GetExtendedStyle();
    dStyle |= LVS_EX_FULLROWSELECT;
    dStyle |= LVS_EX_GRIDLINES;
    LstData.SetExtendedStyle(dStyle);

    LstData.InsertColumn(0, L"内存地址", 0, 200);
    LstData.InsertColumn(1, L"偏移", 0, 200);
    LstData.InsertColumn(2, L"类型", 0, 200);
    LstData.InsertColumn(3, L"名称", 0, 200);
    LstData.InsertColumn(4, L"值", 0, 200);
    LstData.InsertColumn(5, L"注释", 0, 200);
    // ::表示全局命名空间,::SetTimer();表示使用全局命名空间里的 SetTimer 函数
    ::SetTimer(this->m_hWnd, 1002, 100, ReadData);
    return TRUE;
}

COBJContext.cpp文件的修改

void COBJContext::Set(const wchar_t* _name, const wchar_t* _address, DWORD _size, const wchar_t* _note, bool IsSet){

    CString _txtName;
    _txtName.Format(L"%s", _name);
    txtAddress.Format(L"%s", _address);
    txtNote.Format(L"%s", _note);
        
    if (_size > Size) {
        if (data) delete[]data;

        data = new char[Size];
    }
    Size = _size;

    Address = (LPVOID)wcstoul(_address, 0, 16);
    if(_txtName!=txtName && IsSet){
        DeleteFile(txtFile);

    }
    txtName = _txtName;
    txtFile = txtFolder + txtName + L".ini";
    Save();
}

新加名为 CWndAddClass 的类

CWndAddClass.h新加

#pragma once


// CWndAddClass 对话框

class CWndAddClass : public CDialogEx
{
    DECLARE_DYNAMIC(CWndAddClass)

public:
    CWndAddClass(CWnd* pParent = nullptr);   // 标准构造函数
    virtual ~CWndAddClass();

// 对话框数据
#ifdef AFX_DESIGN_TIME
    enum { IDD = IDD_ADDCLASS };
#endif

protected:
    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

    DECLARE_MESSAGE_MAP()
public:
    CString txtAddress; // 内存地址
    unsigned Size; // 对象大小
    CString txtName; // 对象名称
    CString txtNote; // 注释
    afx_msg void OnBnClickedButton1();
};

CWndAddClass.cpp文件新加

// CWndAddClass.cpp: 实现文件
//

#include "pch.h"
#include "GAMEHACKER2.h"
#include "CWndAddClass.h"
#include "afxdialogex.h"


// CWndAddClass 对话框

IMPLEMENT_DYNAMIC(CWndAddClass, CDialogEx)

CWndAddClass::CWndAddClass(CWnd* pParent /*=nullptr*/)
    : CDialogEx(IDD_ADDCLASS, pParent)
    , txtAddress(_T(""))
    , txtName(_T(""))
    , txtNote(_T(""))
{

}

CWndAddClass::~CWndAddClass()
{
}

void CWndAddClass::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Text(pDX, IDC_EDIT1, txtAddress);
    DDX_Text(pDX, IDC_EDIT4, Size);
    DDX_Text(pDX, IDC_EDIT3, txtName);
    DDX_Text(pDX, IDC_EDIT2, txtNote);
}


BEGIN_MESSAGE_MAP(CWndAddClass, CDialogEx)
    ON_BN_CLICKED(IDC_BUTTON1, &CWndAddClass::OnBnClickedButton1)
END_MESSAGE_MAP()


// CWndAddClass 消息处理程序


void CWndAddClass::OnBnClickedButton1()
{
    // TODO: 在此添加控件通知处理程序代码
    UpdateData(TRUE);
    CDialogEx::OnOK();
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值