时间:2013-03-22 14:21:01 来源:互联网 阅读次数:16777215
程序代码:
MemoRepairDlg.h:
// MemoRepairDlg.h : 头文件
// #pragma once #include "afxwin.h"
// CMemoRepairDlg 对话框
class CMemoRepairDlg : public CDialogEx
{
// 构造
public:
CMemoRepairDlg(CWnd* pParent = NULL); // 标准构造函数
~CMemoRepairDlg(); //析构函数,释放进程句柄
// 对话框数据
enum { IDD = IDD_MEMOREPAIR_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedButton1();
afx_msg void OnBnClickedButton2();
public:
DWORD addrList[1024]; //地址列表
int addrCount; //有效地址个数
HANDLE hProcess; //目标进程句柄
BOOL conFirst; //第一次查找
public:
BOOL FirstFind(DWORD valueChange);
BOOL NextFind(DWORD valueChange);
BOOL WriteMemory(DWORD valueAddr, DWORD valueChange);
BOOL ComparePage(DWORD baseAddr, DWORD valueChange);
void ShowList();
afx_msg void OnBnClickedStartprocess();
CEdit editBox1;
CEdit editBox2;
CEdit editBox3;
int editValue;
int editValue3;
CString editStr;
};
MemoRepairDlg.cpp:
// MemoRepairDlg.cpp : 实现文件
// #include "stdafx.h"
#include "MemoRepair.h"
#include "MemoRepairDlg.h"
#include "afxdialogex.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMemoRepairDlg 对话框
CMemoRepairDlg::CMemoRepairDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CMemoRepairDlg::IDD, pParent)
, editValue(0)
, editValue3(0)
, editStr(_T(""))
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
addrCount = 0;
conFirst = TRUE;
}
void CMemoRepairDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_EDIT1, editBox1);
DDX_Control(pDX, IDC_EDIT2, editBox2);
DDX_Control(pDX, IDC_EDIT3, editBox3);
DDX_Text(pDX, IDC_EDIT2, editValue);
DDX_Text(pDX, IDC_EDIT3, editValue3);
DDX_Text(pDX, IDC_EDIT1, editStr);
}
BEGIN_MESSAGE_MAP(CMemoRepairDlg, CDialogEx)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, &CMemoRepairDlg::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON2, &CMemoRepairDlg::OnBnClickedButton2)
ON_BN_CLICKED(IDC_StartProcess, &CMemoRepairDlg::OnBnClickedStartprocess)
END_MESSAGE_MAP()