📄 asmepdlg.cpp
字号:
// asmepDlg.cpp : implementation file
//
#include "stdafx.h"
#include "asmep.h"
#include "asmepDlg.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()
/////////////////////////////////////////////////////////////////////////////
// CAsmepDlg dialog
CAsmepDlg::CAsmepDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAsmepDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAsmepDlg)
m_user = _T("");
m_psd = _T("");
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CAsmepDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAsmepDlg)
DDX_Text(pDX, IDC_EDIT2, m_user);
DDX_Text(pDX, IDC_EDIT3, m_psd);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAsmepDlg, CDialog)
//{{AFX_MSG_MAP(CAsmepDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAsmepDlg message handlers
BOOL CAsmepDlg::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 CAsmepDlg::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 CAsmepDlg::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 CAsmepDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void sub1(int list[0x80*2])
{
int i,j=0;
long ieax,iecx,iesi=0;
int temp;
for(i=0;i<0x80*2;i++)
list[i]=0;
do
{
ieax = 0x0c0c1;
iecx = 1;
do
{
if((iesi&iecx)!=0)
{
temp = (int)(ieax&0x0ffff);
list[j]=list[j]^temp;
}
ieax*=2;
iecx*=2;
ieax = ieax^0x04003;
}while(iecx<0x100);
j++;
iesi++;
}while(j<0x80*2);
}
long sub2(int n,char* user,int len,int* list)
{
long ieax,iebx,iedx,temp;
char *iecx;
iecx = user;
ieax = len;
ieax = 0;
do
{
iedx = ieax;
iebx = 0;
temp = *iecx;
iebx = iebx & 0xffffff00;
iebx = iebx^temp;
iedx = iedx&0x000000ff;
iedx = iedx^iebx;
iebx = 0;
temp = ieax;
temp = temp>>8;
temp = temp & 0x000000ff;
iebx = iebx & 0xffffff00;
iebx = iebx^temp;
temp = *(list+iedx);
ieax = ieax & 0xffff0000;
ieax = ieax^temp;
temp = iebx;
temp = temp & 0x0000ffff;
ieax = ieax ^ temp;
iecx++;
}while(*iecx!='\0');
return ieax;
}
void sub3(char* user,char* psd,int* list)
{
long eax,ecx,esi,edx,temp,eax0[5],ecx0[5];
char lst[25] = "";
eax = 0;
ecx = 1;
esi = strlen(user);
if((esi & esi) > 0)
{
do
{
edx = 0;
temp = edx & 0xffffff00;
edx = temp ^ *(user+eax);
ecx = ecx + edx;
eax++;
}while(eax < esi);
ecx = ecx*8+ecx+0x0a;
eax0[0] = 0x5556;
eax0[1] = 0x5555;
ecx0[0] = 0x0000ffff & ecx;
ecx0[1] = ecx >> 16 ;
eax0[2] = eax0[0]*ecx0[0];
eax0[3] = eax0[1]*ecx0[0];
ecx0[2] = eax0[0]*ecx0[1];
ecx0[3] = eax0[1]*ecx0[1];
eax0[2] = eax0[2]>>16;
edx = ((eax0[2] + eax0[3] & 0x0000ffff + ecx0[2] & 0x0000ffff)>>16) + (eax0[3]>>16) + (ecx0[2]>>16) + ecx0[3];
eax = edx;
eax = eax >>0x1f;
ecx = eax + edx + 0x24;
ecx = ecx & 0x8000000f;
if(ecx<=0)
{
ecx = ecx - 1;
ecx = ecx|(-0x10);
ecx = ecx + 1;
}
sprintf(lst,"%X",ecx);
*(psd+4) = lst[0];
eax = sub2(0,psd+2,strlen(psd)-2,list);
sprintf(lst,"%02X",eax);
psd[0] = lst[0];
psd[1] = lst[1];
}
}
void CAsmepDlg::OnOK()
{
UpdateData(TRUE);
char user[25],psd[25];
int list[256];
char lst[25];
strcpy(user,m_user);
strcpy(psd,"19840505");
int i = strlen(user);
int n = strlen(psd);
if(i<5)
{
MessageBox("请输入大于五位的用户名","warning",MB_OK);
return;
}
sub1(list);
long eax = sub2(0,user,i,list);
sprintf(lst,"%02X",eax);
psd[2] = lst[0];
psd[3] = lst[1];
eax = sub2(0,psd+2,n-2,list);
sprintf(lst,"%02X",eax);
psd[0] = lst[0];
psd[1] = lst[1];
sub3(user,psd,list);
m_psd.Format("%s",psd);
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -