⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 patchdlg.cpp

📁 天网防火墙破解程序源码
💻 CPP
字号:
// patchDlg.cpp : implementation file
//

#include "stdafx.h"
#include "patch.h"
#include "patchDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPatchDlg dialog

CPatchDlg::CPatchDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPatchDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPatchDlg)
	PFWPath = _T("C:\\Program File\\SkyNet\\FileWall\\PFW.exe");
	PFWLiveUpdatePath = _T("C:\\Program File\\SkyNet\\FileWall\\PFWLiveUpdate.exe");
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CPatchDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPatchDlg)
	DDX_Text(pDX, IDC_SOURCE, PFWPath);
	DDX_Text(pDX, IDC_TARGET, PFWLiveUpdatePath);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CPatchDlg, CDialog)
	//{{AFX_MSG_MAP(CPatchDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_DESTROY()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_SRBROWSE, OnSrbrowse)
	ON_BN_CLICKED(IDC_TRBROWSE, OnTrbrowse)
	ON_BN_CLICKED(IDD_ABOUTBOX, OnAboutbox)
	ON_BN_CLICKED(IDC_ADD, OnAdd)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPatchDlg message handlers

BOOL CPatchDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CPatchDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

void CPatchDlg::OnDestroy()
{
	WinHelp(0L, HELP_QUIT);
	CDialog::OnDestroy();
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CPatchDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CPatchDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CPatchDlg::OnSrbrowse() 
{
	// TODO: Add your control notification handler code here
	CFileDialog Open(true/*如果为真则对话框为打开对话框,为否则为保存对话框*/, 
	"exe" /*默认后缀名*/, 
	"PFW.exe" /*默认文件名*/, 
	0 /*对话框风格*/, 
	"PFW.exe|PFW.exe|", 
	//"All File|*.*|",
	this /*父窗口指针*/);

	CString strFilePath;
	if (Open.DoModal() == IDOK) //有模式地显示对话框,如果返回确定则代表有文件选择,则
	{
		strFilePath = Open.GetPathName(); //取得文件路径字符串
		SetDlgItemText (IDC_SOURCE, strFilePath); //将ID为IDC_SOURCE的控件的文本设为该字符串
	}
	
}

void CPatchDlg::OnTrbrowse() 
{
	// TODO: Add your control notification handler code here
		CFileDialog Open(true/*如果为真则对话框为打开对话框,为否则为保存对话框*/, 
		".exe" /*默认后缀名*/, 
		"PFWLiveUpdate.exe" /*默认文件名*/, 
		0 /*对话框风格*/, 
		"PFWLiveUpdate.exe|PFWLiveUpdate.exe|", 
		//"All File|*.*|",
		this /*父窗口指针*/);

	CString strFilePath1;
	if (Open.DoModal() == IDOK) //有模式地显示对话框,如果返回确定则代表有文件选择,则
	{
		strFilePath1 = Open.GetPathName(); //取得文件路径字符串
		SetDlgItemText (IDC_TARGET, strFilePath1); //将ID为IDC_SOURCE的控件的文本设为该字符串
	}
	
}

void CPatchDlg::OnAboutbox() 
{
	// TODO: Add your control notification handler code here
	//MessageBox("Coding by :╰☆往事如风","PFW Path",MB_OK);
	CDialog dlg(IDD_ABOUTBOX); 
	dlg.DoModal(); 

}



void CPatchDlg::OnAdd() 
{
	// TODO: Add your control notification handler code here
	UpdateData(TRUE);
	FILE *fp, *fp1;
	int offsize = 0x292f;
	int offsize1 = 0x3c4e;
	unsigned char fill[5]   = {0x90, 0x90, 0x90, 0x90, 0x90};
	unsigned char fill1[2]  = {0x72, 0x10};
	unsigned char fill2[6]  = {0xe9, 0x91,0x00, 0x00, 0x00, 0x90};
	unsigned char fill3[32] = {
	0x38, 0x34, 0x65, 0x31, 0x64, 0x66, 0x33, 0x37, 0x65, 0x64, 0x33, 0x61, 0x63, 0x31, 0x39, 0x35, 
	0x63, 0x37, 0x65, 0x61, 0x31, 0x64, 0x32, 0x65, 0x31, 0x36, 0x34, 0x37, 0x64, 0x33, 0x61, 0x66
};
	if((fp = fopen( PFWPath, "rb+" )) == 0 )
	{
		MessageBoxEx(NULL, PFWPath,"找不到文件:",MB_OK, NULL);
		//MessageBoxEx(NULL, PFWPath,"不能打开文件:",MB_OK, NULL);
		//OnConfig();
		exit(0);
	}
	fseek(fp, offsize, 0);
	fwrite( fill, 5, 1, fp);
	fclose( fp );
	//MessageBox("配置成功。");
	if((fp1 = fopen( PFWLiveUpdatePath, "rb+" )) == 0 )
	{
		MessageBoxEx(NULL, PFWLiveUpdatePath,"找不到文件:",MB_OK, NULL);
		//MessageBoxEx(NULL, PFWLiveUpdatePath,"不能打开文件:",MB_OK, NULL);
		//OnConfig();
		exit(0);
	}
	fseek( fp1, offsize1, 0 );
	fwrite( fill1, 2, 1, fp1);
	offsize1 = 0x5502;
	fseek( fp1, offsize1, 0 );
	fwrite( fill2, 6, 1, fp1);
	offsize1 = 0x11072;
	fseek( fp1, offsize1, 0 );
	fwrite( fill3, 32, 1, fp1);
	MessageBox("破解成功。");
	fclose( fp1 );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -