剑网三奇遇查询网站怎么做百度指数有什么参考意义
免责声明:内容仅供学习参考,请合法利用知识,禁止进行违法犯罪活动!
内容参考于:易道云信息技术研究院
上一个内容:69.搭建分析工具界面
以 69.搭建分析工具界面 它的代码为基础进行修改
效果图:
程序根目录创建RAN文件夹用来当分析工具的数据存储地
在菜单中添加两个项
GAMEHACKER2Dlg.cpp文件的修改
BOOL CGAMEHACKER2Dlg::OnInitDialog()
{CDialogEx::OnInitDialog();TCHAR FileModule[0x100]{};GetModuleFileName(NULL, FileModule, 0x100);int i;for (i = 0x100 - 1; FileModule[i] != '\\'; i--)FileModule[i] = 0;wAppPath.Format(L"%s", FileModule);// 将“关于...”菜单项添加到系统菜单中。// IDM_ABOUTBOX 必须在系统命令范围内。ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX < 0xF000);CMenu* pSysMenu = GetSystemMenu(FALSE);if (pSysMenu != nullptr){BOOL bNameValid;CString strAboutMenu;bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);ASSERT(bNameValid);if (!strAboutMenu.IsEmpty()){pSysMenu->AppendMenu(MF_SEPARATOR);pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);}}// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动// 执行此操作SetIcon(m_hIcon, TRUE); // 设置大图标SetIcon(m_hIcon, FALSE); // 设置小图标// TODO: 在此添加额外的初始化代码GetClientRect(&m_cRect);InstallPage(&PageINJ, IDD_PAGE_0, L"注入", TRUE);InstallPage(&PageINC, IDD_PAGE_1, L"注入检测");InstallPage(&PageRAN, IDD_PAGE_2, L"分析工具");PageINJ.Init(wAppPath);PageRAN.SetAppPath(wAppPath);return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
CwndRAN.h文件的修改
#pragma once
#include "CWndAddClass.h"
#include "CWindProcess.h"// CwndRAN 对话框class CwndRAN : public CDialogEx
{DECLARE_DYNAMIC(CwndRAN)public:CwndRAN(CWnd* pParent = nullptr); // 标准构造函数virtual ~CwndRAN();// 对话框数据
#ifdef AFX_DESIGN_TIMEenum { IDD = IDD_PAGE_2 };
#endifprotected:virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持DECLARE_MESSAGE_MAP()
private:void OnOK();void OnCancel();
public:CTreeCtrl mTree;CListCtrl LstData;CWindProcess wndSelProcess;CWndAddClass wndAddClass;HANDLE hProcess{};CString wAppPath;CString wAnlyPath;CString wAnlyData;afx_msg void OnBnClickedButton1();afx_msg void OnTvnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult);virtual BOOL OnInitDialog();afx_msg void OnNMRClickTree1(NMHDR* pNMHDR, LRESULT* pResult);afx_msg void OnLoadGame();void SetAppPath(const wchar_t * path);
};
CwndRAN.cpp文件的修改
// CwndRAN.cpp: 实现文件
//#include "pch.h"
#include "GAMEHACKER2.h"
#include "CwndRAN.h"
#include "afxdialogex.h"// CwndRAN 对话框IMPLEMENT_DYNAMIC(CwndRAN, CDialogEx)CwndRAN::CwndRAN(CWnd* pParent /*=nullptr*/): CDialogEx(IDD_PAGE_2, pParent)
{}CwndRAN::~CwndRAN()
{
}void CwndRAN::DoDataExchange(CDataExchange* pDX)
{CDialogEx::DoDataExchange(pDX);DDX_Control(pDX, IDC_TREE1, mTree);DDX_Control(pDX, IDC_LIST1, LstData);
}void CwndRAN::OnOK()
{
}void CwndRAN::OnCancel()
{
}BEGIN_MESSAGE_MAP(CwndRAN, CDialogEx)ON_BN_CLICKED(IDC_BUTTON1, &CwndRAN::OnBnClickedButton1)ON_NOTIFY(TVN_SELCHANGED, IDC_TREE1, &CwndRAN::OnTvnSelchangedTree1)ON_NOTIFY(NM_RCLICK, IDC_TREE1, &CwndRAN::OnNMRClickTree1)ON_COMMAND(ID_32773, &CwndRAN::OnLoadGame)
END_MESSAGE_MAP()// CwndRAN 消息处理程序void CwndRAN::OnBnClickedButton1()
{// TODO: 在此添加控件通知处理程序代码// 添加一个数据auto val = mTree.InsertItem(L"第一层", TVI_ROOT);// 给val添加一个子数据mTree.InsertItem(L"第二层", val);// 删除一个数据// mTree.DeleteItem(val);// 获取跟节点(第一行的第一层数据)// auto _root = mTree.GetRootItem();// 获取下一个跟节点// mTree.GetNextSiblingItem(_root);// 获取子数据// auto childData = mTree.GetChildItem(_root);// mTree.GetParentItem(childData);
}void CwndRAN::OnTvnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult)
{LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);// TODO: 在此添加控件通知处理程序代码*pResult = 0;
}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);return TRUE;
}void CwndRAN::OnNMRClickTree1(NMHDR* pNMHDR, LRESULT* pResult)
{// TODO: 在此添加控件通知处理程序代码*pResult = 0;DWORD dMenuId = 0;if (hProcess) {auto hSel = mTree.GetSelectedItem();auto hRoot = mTree.GetRootItem();if (hSel == hRoot) {dMenuId = 1;}}// 获取最后一个消息发生时的鼠标位置DWORD dwPos = GetMessagePos();CPoint point(LOWORD(dwPos), HIWORD(dwPos));CMenu menu;menu.LoadMenuW(IDR_MENU1);CMenu* pop = menu.GetSubMenu(1 + dMenuId);pop->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);}void CwndRAN::OnLoadGame()
{if (wndSelProcess.DoModal() == IDOK) {hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, wndSelProcess.dPid);if (hProcess) {auto troot = mTree.InsertItem(wndSelProcess.wExe, TVI_ROOT);mTree.InsertItem(L"公共数据", troot);mTree.InsertItem(L"公共函数", troot);mTree.InsertItem(L"HOOK分析", troot);wAnlyData = wAnlyPath + wndSelProcess.wExe;if (!PathIsDirectory(wAnlyData)) {if (!CreateDirectory(wAnlyData, NULL)) {AfxMessageBox(L"创建文件夹失败!");return;}}// 遍历文件夹下的文件WIN32_FIND_DATA fileData;HANDLE hFind = FindFirstFile(wAnlyData + L"\\*.ini", &fileData);while (hFind != INVALID_HANDLE_VALUE) {auto hRoot = mTree.InsertItem(fileData.cFileName, TVI_ROOT);auto hBase = mTree.InsertItem(L"基本信息", hRoot);mTree.InsertItem(L"内存地址", hBase);mTree.InsertItem(L"对象大小", hBase);mTree.InsertItem(L"注释", hBase);mTree.InsertItem(L"成员变量", hRoot);mTree.InsertItem(L"成员函数", hRoot);if (!FindNextFile(hFind, &fileData))break;}FindClose(hFind);}else {AfxMessageBox(L"游戏加载失败");}}if (wndAddClass.DoModal() == IDOK) {}
}void CwndRAN::SetAppPath(const wchar_t* path)
{wAppPath = path;wAnlyPath = wAppPath + L"RAN\\";
}