📄 encodedialog.cpp
字号:
#include "stdafx.h"
#include "dll.h"
#include "md5.h"
#include "ripemd.h"
#include "rng.h"
#include "gzip.h"
#include "default.h"
#include "randpool.h"
#include "ida.h"
#include "base64.h"
#include "socketft.h"
#include "wait.h"
#include "factory.h"
#include "validate.h"
#include "bench.h"
#include "resource.h"
#include "NEWMAILDIALOG.h"
#include "xmldata.h"
#include <string>
#include <atlsimpstr.h>
#include ".\encodedialog.h"
USING_NAMESPACE(CryptoPP)
USING_NAMESPACE(std)
extern CXMLDATA XmlData;
using namespace std;
//
LRESULT CEncodeDialog::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
// center the dialog on the screen
this->CenterWindow ();
return TRUE;
}
LRESULT CEncodeDialog::OnOK(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
// TODO: Add validation code
char buf[200];
memset(buf,0,200);
GetDlgItem(IDC_EDIT_LOGINCODE).GetWindowText (buf,200);
if(strlen(buf)!=160)
{
this->MessageBox ("登陆码错误","错误");
return 0;
}
XmlData.VLogInCode .push_back (buf);
memset(buf,0,200);
GetDlgItem(IDC_EDIT_MAILNAME).GetWindowText (buf,200);
XmlData.VName .push_back (buf);
memset(buf,0,200);
GetDlgItem(IDC_EDIT_DOWNLOADCODE).GetWindowText (buf,200);
XmlData.VDownLoadCode .push_back (buf);
EndDialog(wID);
return 0;
}
LRESULT CEncodeDialog::OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}
LRESULT CEncodeDialog::OnClose(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
this->EndDialog (0);
return 0;
}
LRESULT CEncodeDialog::OnBnClickedEncodeEncode(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
// TODO: 在此添加控件通知处理程序代码
char buf[200];
memset(buf,0,200);
int n;
GetDlgItem(IDC_EDIT_USERNAME).GetWindowText (buf,200);
UserName=buf;
memset(buf,0,200);
GetDlgItem(IDC_EDIT_PASS).GetWindowText (buf,200);
Pass=buf;
//参数读取完毕
if(UserName.size ()==0)
{
GetDlgItem(IDC_EDIT_ENCODE).SetWindowText("你还没有输入用户名!");
return 0;
}
if(Pass.size ()==0)
{
GetDlgItem(IDC_EDIT_ENCODE).SetWindowText("你还没有输入密码!");
return 0;
}
//开始生成登陆码
char p[40];
memset(p,0,40);
strcpy(p,UserName.c_str ());
strcpy(p+20,Pass.c_str ());//plaintext
char pass[]="biqiong";
string outstr;
DefaultEncryptorWithMAC encryptor(pass,new HexEncoder(new StringSink(outstr)));
encryptor.Put((byte *)p,40);
encryptor.MessageEnd();
GetDlgItem(IDC_EDIT_ENCODE).SetWindowText(outstr.c_str ());
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -