📄 ppcpkisd.cpp
字号:
// PpcPKISD.cpp : 定义应用程序的类行为。
//
#include "stdafx.h"
#include "PpcPKISD.h"
#include "PpcPKISDDlg.h"
#include "DlgPassWord.h"
#include "sd_mmc_auth_api.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#ifdef _DEBUG
#pragma comment (lib, "LIB\\Debug\\SD_MMC_Auth_Lib.lib")
#else
#pragma comment (lib, "LIB\\Release\\SD_MMC_Auth_Lib.lib")
#endif
#ifdef PC_DEBUG
#define SD_MMC_Driver _T("\\Storage Card\\")
#define SD_MMC_AuthFile _T("\\SD-MMC Card\\AuthFile.TXT")
#else
#define SD_MMC_Driver _T("\\SD-MMC Card\\")
#define SD_MMC_AuthFile _T("\\Storage Card\\AuthFile.TXT")
#endif
// CPpcPKISDApp
BEGIN_MESSAGE_MAP(CPpcPKISDApp, CWinApp)
END_MESSAGE_MAP()
// CPpcPKISDApp 构造
CPpcPKISDApp::CPpcPKISDApp()
: CWinApp()
{
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的一个 CPpcPKISDApp 对象
CPpcPKISDApp theApp;
// CPpcPKISDApp 初始化
BOOL CPpcPKISDApp::InitInstance()
{
// 在应用程序初始化期间,应调用一次 SHInitExtraControls 以初始化
// 所有 Windows Mobile 特定控件,如 CAPEDIT 和 SIPPREF。
SHInitExtraControls();
// 标准初始化
// 如果未使用这些功能并希望减小
// 最终可执行文件的大小,则应移除下列
// 不需要的特定初始化例程
// 更改用于存储设置的注册表项
// TODO: 应适当修改该字符串,
// 例如修改为公司或组织名
SetRegistryKey(_T("bupt zjw PKI SD test"));
if ( InitPKISD( SD_MMC_AuthFile ) != 0 )
{
AfxMessageBox(_T("初始化错误,请检查是否插入PKI SD卡!"));
return FALSE;
}
CDlgPassWord dlgPwd;
//下面代码有用
INT_PTR ndlgPwdResp=dlgPwd.DoModal();
if (ndlgPwdResp == IDCANCEL)
{
MessageBox(dlgPwd , _T("取消认证,退出系统"),_T("信息"),MB_OK|MB_ICONEXCLAMATION);
ClosePKISD();
return FALSE;
}
else if (ndlgPwdResp == IDOK)
{
}
CPpcPKISDDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: 在此处放置处理何时用“确定”来关闭
// 对话框的代码
}
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
// 而不是启动应用程序的消息泵。
return FALSE;
}
int CPpcPKISDApp::InitPKISD(CString sSDroot)
{
int nResult = -1;
wchar_t szDriver_File_Name[0x10+MAX_PATH];
wcscpy(szDriver_File_Name, sSDroot);
Auth_Init(szDriver_File_Name);
if(Auth_API()){
nResult = 0;
}else{
nResult = 0;
}
return nResult;
}
void CPpcPKISDApp::ClosePKISD(void)
{
CloseAuth_API();
ExitAuth_API();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -