#ifndef JEFF_ENCRYPTLOCK_HAEDER_20150708 #define JEFF_ENCRYPTLOCK_HAEDER_20150708 #include #include #include "my32.h" #pragma comment (lib,"my32.lib") #pragma once namespace YtDongle { ////////////////////////////////////////////////////////////////////////// // 宏定义; #define TIMELEN 10 #define ENCRYPT_BLOCK_LEN 33 // 包含结束符'\0'; #define ISCHILDVER(Ver) ( 5-Ver > 2 ) // 判断是否儿童版本; ////////////////////////////////////////////////////////////////////////// // 枚举定义; enum EncryptType { EN_OCHILD = 0, // 儿童全能版; EN_LCHILD = 1, // 儿童座席版; EN_ECHILD = 2, // 儿童企业版; EN_OWDDING = 3, // 婚纱全能版; EN_LWDDING = 4, // 婚纱座席版; EN_EWDDING = 5, // 婚纱企业版; }; enum Ver1ModifyType { VER1_ADDCCOUNT = 0, VER1_MINUSCCOUNT, VER1_HOSPITAL, VER1_ADDTIME, VER1_MINUSTIME, }; ////////////////////////////////////////////////////////////////////////// // 结构体定义; typedef struct _YT_ERROR_ { INT nErrorCode; TCHAR* pErrorDescription; }YtError, *pYtError; typedef struct _ENCRYPT_LOCKINFO_ { INT nSoftVer; INT nCCount; BOOL bHospital; BOOL bAdddate; CHAR szRunyears[TIMELEN]; CHAR szRunmonths[TIMELEN]; CHAR szRundays[TIMELEN]; CHAR szRunhours[TIMELEN]; CHAR szRunminutes[TIMELEN]; _ENCRYPT_LOCKINFO_() { nSoftVer = -1; nCCount = 0; bHospital = FALSE; bAdddate = FALSE; memset(szRunyears, 0, TIMELEN); memset(szRunmonths, 0, TIMELEN); memset(szRundays, 0, TIMELEN); memset(szRunhours, 0, TIMELEN); memset(szRunminutes, 0, TIMELEN); } _ENCRYPT_LOCKINFO_(CONST INT& nsoftver, CONST INT& nccount, BOOL bhospital, BOOL badddate, CONST CHAR* szyears, CONST CHAR* szmonths, CONST CHAR* szday, CONST CHAR* szhours, CONST CHAR* szminutes) { nSoftVer = nsoftver; nCCount = nccount; bHospital = bhospital; bAdddate = badddate; if (szyears) { sprintf_s(szRunyears, "%s", szyears); } else { strcpy_s(szRunyears, "0"); } if (szmonths) { sprintf_s(szRunmonths, "%s", szmonths); } else { strcpy_s(szRunmonths, "0"); } if (szday) { sprintf_s(szRundays, "%s", szday); } else { strcpy_s(szRundays, "0"); } if (szhours) { sprintf_s(szRunhours, "%s", szhours); } else { strcpy_s(szRunhours, "0"); } if (szminutes) { sprintf_s(szRunminutes, "%s", szminutes); } else { strcpy_s(szRunminutes, "0"); } } }EncryptlockInfo, *pEncryptlockInfo; typedef struct _YT_INFO_VER1_ { INT nSoftVer; DWORD dwShortKey; CHAR szHospital[MAX_PATH]; CHAR szCCount[MAX_PATH]; CHAR szBranchId[MAX_PATH]; // 已运行时间; CHAR szHasRunyears[TIMELEN]; CHAR szHasRunmonths[TIMELEN]; CHAR szHasRundays[TIMELEN]; CHAR szHasRunhours[TIMELEN]; CHAR szHasRunminutes[TIMELEN]; CHAR szHasRunseconds[TIMELEN]; // 可运行时间; CHAR szCanRunyears[TIMELEN]; CHAR szCanRunmonths[TIMELEN]; CHAR szCanRundays[TIMELEN]; CHAR szCanRunhours[TIMELEN]; CHAR szCanRunminutes[TIMELEN]; _YT_INFO_VER1_() { nSoftVer = -1; dwShortKey = 0; memset(szHospital, 0, MAX_PATH*sizeof(CHAR)); memset(szCCount, 0, MAX_PATH*sizeof(CHAR)); memset(szBranchId, 0, MAX_PATH*sizeof(CHAR)); memset(szHasRunyears, 0, TIMELEN*sizeof(CHAR)); memset(szHasRunmonths, 0, TIMELEN*sizeof(CHAR)); memset(szHasRundays, 0, TIMELEN*sizeof(CHAR)); memset(szHasRunhours, 0, TIMELEN*sizeof(CHAR)); memset(szHasRunminutes, 0, TIMELEN*sizeof(CHAR)); memset(szHasRunseconds, 0, TIMELEN*sizeof(CHAR)); memset(szCanRunyears, 0, TIMELEN*sizeof(CHAR)); memset(szCanRunmonths, 0, TIMELEN*sizeof(CHAR)); memset(szCanRundays, 0, TIMELEN*sizeof(CHAR)); memset(szCanRunhours, 0, TIMELEN*sizeof(CHAR)); memset(szCanRunminutes, 0, TIMELEN*sizeof(CHAR)); } }YtInfoVer1, *pYtInfoVer1; typedef struct YTUSBINFO { int nUSBPort; CHAR szKeyPath[MAX_PATH]; YtInfoVer1 verInfo; }YtUsbInfo, *pYtUsbInfo; ////////////////////////////////////////////////////////////////////////// // 全局变量定义; extern CHAR *g_pHReadPassWord; extern CHAR *g_pLReadPassWord; extern CHAR *g_pHWritePassWord; extern CHAR *g_pLWritePassWord; extern BOOL g_bUSE_NEWPASSWORD; extern CHAR *g_szEncKey[][4]; extern CHAR *g_szRom[]; extern CHAR *g_szPassword[][2]; extern CHAR *g_szUserKey; extern BYTE g_byShotVersion[][10]; extern CONST BYTE g_byCalExVersion[][114]; extern CHAR g_szKeyPath[MAX_PATH]; extern CONST YtError g_YtError[]; ////////////////////////////////////////////////////////////////////////// // 全局函数定义; // // ASCII字符转UNICODE字符; WCHAR* ascii2unicode(IN const CHAR* pszascii); // 初始化密码; extern void ReSetPassWord(BOOL bClassicPsw = FALSE); // 返回错误码; extern CONST TCHAR* GetYtUSBKey32ErrInfo(IN const long lError); // 读取所有加密锁信息; extern void ReadAllClassicYtInfo(IN std::vector &vtYtInfo); // 读取加密锁信息; extern BOOL ReadYtInfoVer1(IN CONST INT &nUSBStartPos, OUT YtInfoVer1 &Infover1, OUT INT &nUSBPort, OUT CHAR* pszKeyPath = NULL, IN CONST INT &nKeypath = 0); // 修改加密狗版本1信息; extern BOOL ModifyYtVer1Info(IN CHAR* pszKeypath, IN YtInfoVer1 &Infover1, IN CONST INT &nModifyType); // 修改连接数; extern BOOL ChangeConnectCount(IN CHAR* pszKeypath, IN CONST INT& nCCount); // 修改域名; extern BOOL ChangeBranchId(IN CHAR* pszKeypath, IN CONST CHAR* pszBranchId, IN CONST INT& dwShortKey); // 修改医院跟踪; extern BOOL ChangeHospital(IN CHAR* pszKeypath, IN BOOL bEnableHospital); // 修改运行时间; extern BOOL ChangeRunTime(IN CHAR* pszKeypath, IN CONST DWORD& dwShortKey, IN BOOL bAppend, IN CONST INT& nRunYears, IN CONST INT& nRunMonth, IN CONST INT& nRunDays, IN CONST INT& nRunHours, IN CONST INT& nRunMinutes); // 修改加密锁版本; extern BOOL ChangeVersion(IN CHAR* pszKeypath, IN CONST INT& nOldVersion, IN CONST INT& nNewVersion); // 获取经典版加密锁剩余运行时间; extern BOOL GetRemainderRunTime(IN CHAR* pszKeypath, IN DWORD dwShortKey, OUT DWORD& dwHasRunTime, OUT DWORD& dwCanRunTime); // 生成经典版加时授权码; extern BOOL GenerateRunTimeRegCode(IN CHAR* pszKeypath, IN INT nShortKey, IN CONST INT& nSoftVer, OUT LPTSTR lpRegCode, IN CONST INT& nBufLen); // 逆向获取加时授权码,获取可运行时间; extern BOOL GetRunTimeByRegCode(IN CHAR* pszKeypath, IN DWORD dwShortKey, IN CONST INT& nSoftVer, IN LPCTSTR lpRegCode, IN CString& strResult); // 初始加密锁(完全清除所有内容,空加密锁); extern BOOL InitEncryptlock(IN const int &nStartUSBPort = 0); // 清除加密锁信息; extern BOOL ClearEncryptlockInfo(IN const int &nStartUSBPort = 0); // 生成指定软件版本的加密锁; extern BOOL CreateEncryptlockInfo(IN CONST INT &nStartPort, IN EncryptlockInfo &linfo, OUT LPTSTR lpHasRundate, IN CONST size_t &sizeOfhasrundate, OUT LPTSTR lpCouldRundate, IN CONST size_t &sizeOfcouldrundate, IN BOOL bfixedId = FALSE, IN CHAR* pszBranchId = NULL); // 查找锁,并返回锁短ID,锁版本号,锁物理位置; extern BOOL FindYtUSB(OUT DWORD &dwShortKey, OUT INT &nVersion, OUT CHAR *pszKeyPath, IN CONST INT &nStartPort = 0); // 返回计算机上第一个找到的加密锁; extern BOOL GetFirstYtUSBSoftVer(IN INT &nSoftVer, IN CHAR *pBranchIdBuffer, IN size_t sizeOfBranchIdBuffer, IN CONST INT &nUSBStartPos); // 获取第一个找到的加密锁; template BOOL GetFirstYtUSBSoftVer(IN INT &nSoftVer, IN CHAR(&szBranchId)[size], IN CONST INT &nUSBStartPos) { INT nRetval = 0; INT nVal[8] = { 0 }; DOUBLE fVal[8] = { 0.0 }; CHAR s0[50] = "", s1[50] = "", s2[50] = "", s3[50] = "", s4[50] = "", s5[50] = "", s6[50] = "", s7[50] = ""; BOOL bFind = FALSE; CHAR szKeyPath[MAX_PATH] = ""; for (INT nIndex = nUSBStartPos; nIndex < 256; nIndex++) { memset(szKeyPath, 0, sizeof(szKeyPath)); nRetval = FindPort(nIndex, szKeyPath); if (nRetval != 0 && nIndex == 0) continue; if (nRetval != 0) continue; for (int i = 0; i < 6; i++) { // 使用该设备路径锁进行运算; nRetval = CalEx(g_byShotVersion[i], 10, &nVal[0], &nVal[1], &nVal[2], &nVal[3], &nVal[4], &nVal[5], &nVal[6], &nVal[7], &fVal[0], &fVal[1], &fVal[2], &fVal[3], &fVal[4], &fVal[5], &fVal[6], &fVal[7], s0, s1, s2, s3, s4, s5, s6, s7, szKeyPath, 20000); //如果正确,则返回该设备路径供以后使用; if (nRetval == -63) continue; if ((nRetval == 0) && (nVal[0] == 123)) { bFind = TRUE; nSoftVer = i; if ((nRetval = YtReadString(szBranchId, 297, ENCRYPT_BLOCK_LEN, g_pHReadPassWord, g_pLReadPassWord, szKeyPath)) != 0) { AfxMessageBox(GetYtUSBKey32ErrInfo(nRetval)); } break; } } if (bFind) break; } return bFind; } template BOOL ReadClassicYtInfo(IN CONST INT &nUSBStartPos, OUT YtInfoVer1 &Infover1, OUT INT &nUSBPort, OUT CHAR(&pszKeyPath)[tlen]) { INT nRetval = 0; INT nVal[8] = { 0 }; DOUBLE fVal[8] = { 0.0 }; CHAR s0[50] = "", s1[50] = "", s2[50] = "", s3[50] = "", s4[50] = "", s5[50] = "", s6[50] = "", s7[50] = ""; BOOL bFind = FALSE; CHAR szKeyPath[MAX_PATH] = ""; for (INT nIndex = nUSBStartPos; nIndex < 256; nIndex++) { memset(szKeyPath, 0, sizeof(szKeyPath)); nRetval = FindPort(nIndex, szKeyPath); if (nRetval != 0 && nIndex == 0) continue; if (nRetval != 0) continue; for (int i = 0; i < 6; i++) { // 使用该设备路径锁进行运算; nRetval = CalEx(g_byShotVersion[i], 10, &nVal[0], &nVal[1], &nVal[2], &nVal[3], &nVal[4], &nVal[5], &nVal[6], &nVal[7], &fVal[0], &fVal[1], &fVal[2], &fVal[3], &fVal[4], &fVal[5], &fVal[6], &fVal[7], s0, s1, s2, s3, s4, s5, s6, s7, szKeyPath, 20000); //如果正确,则返回该设备路径供以后使用; if (nRetval == -63) continue; if ((nRetval == 0) && (nVal[0] == 123)) { nUSBPort = nIndex; if (pszKeyPath) sprintf_s(pszKeyPath, "%s", szKeyPath); bFind = TRUE; Infover1.nSoftVer = i; // 获取加密锁座席数量; if ((nRetval = YtReadString(Infover1.szCCount, 264, ENCRYPT_BLOCK_LEN, g_pHReadPassWord, g_pLReadPassWord, szKeyPath)) != 0) AfxMessageBox(GetYtUSBKey32ErrInfo(nRetval)); // 获取加密锁域名值; if ((nRetval = YtReadString(Infover1.szBranchId, 297, ENCRYPT_BLOCK_LEN, g_pHReadPassWord, g_pLReadPassWord, szKeyPath)) != 0) AfxMessageBox(GetYtUSBKey32ErrInfo(nRetval)); // 获取医院跟踪系统; if ((nRetval = YtReadString(Infover1.szHospital, 330, ENCRYPT_BLOCK_LEN, g_pHReadPassWord, g_pLReadPassWord, szKeyPath)) != 0) AfxMessageBox(GetYtUSBKey32ErrInfo(nRetval)); // 返回加密锁已运行时间; if ((nRetval = GetRunTimer(Infover1.szHasRunyears, Infover1.szHasRunmonths, Infover1.szHasRundays, Infover1.szHasRunhours, Infover1.szHasRunminutes, Infover1.szHasRunseconds, szKeyPath)) != 0) AfxMessageBox(GetYtUSBKey32ErrInfo(nRetval)); // 返回加密锁可运行时间; DWORD dwShortID = 0; // 锁短ID; CHAR szOutString[100] = { 0 }; CHAR HKey[50] = { 0 }, LKey[50] = { 0 }; // 30000以后的储存空间为公共区域; if ((nRetval = ReadTimeAuthFromEprom(HKey, LKey, szOutString, &dwShortID, 30128, "FFFFFFFF", "FFFFFFFF", szKeyPath)) != 0) AfxMessageBox(GetYtUSBKey32ErrInfo(nRetval)); std::string str = szOutString; int nStrPos = str.find("年"); if (nStrPos != std::string::npos) { sprintf_s(Infover1.szCanRunyears, "%s", str.substr(0, nStrPos).c_str()); str = str.substr(nStrPos + strlen("年")); nStrPos = str.find("月"); sprintf_s(Infover1.szCanRunmonths, "%s", str.substr(0, nStrPos).c_str()); str = str.substr(nStrPos + strlen("月")); nStrPos = str.find("日"); sprintf_s(Infover1.szCanRundays, "%s", str.substr(0, nStrPos).c_str()); str = str.substr(nStrPos + strlen("日")); nStrPos = str.find("小时"); sprintf_s(Infover1.szCanRunhours, "%s", str.substr(0, nStrPos).c_str()); str = str.substr(nStrPos + strlen("小时")); nStrPos = str.find("分钟"); sprintf_s(Infover1.szCanRunminutes, "%s", str.substr(0, nStrPos).c_str()); //str = str.substr(nStrPos + strlen("分钟")); } break; } } if (bFind) break; } return bFind; } // 生成指定软件版本的加密锁; template< size_t sizeOfhasrundate, size_t sizeofCouldrundate > BOOL CreateEncryptlockInfo(IN CONST INT &nStartPort, IN EncryptlockInfo &linfo, OUT TCHAR(&szHasRundate)[sizeOfhasrundate], OUT TCHAR(&szCouldRundate)[sizeofCouldrundate], IN BOOL bfixedId = FALSE, IN CHAR* pszBranchId = NULL); template< size_t sizeOfhasrundate, size_t sizeofCouldrundate > BOOL CreateEncryptlockInfo(IN CONST INT &nStartPort, IN EncryptlockInfo &linfo, OUT TCHAR(&szHasRundate)[sizeOfhasrundate], OUT TCHAR(&szCouldRundate)[sizeofCouldrundate], IN BOOL bfixedId /*= FALSE*/, IN CHAR* pszBranchId /*= NULL*/) { int nRet = -1; DWORD dwShortKey = 0; int nVersion = -1; CHAR szKeyPath[MAX_PATH] = { 0 }; if (!FindYtUSB(dwShortKey, nVersion, szKeyPath, nStartPort)) return FALSE; if (dwShortKey == -1) { // 不是域天智能锁; return FALSE; } nRet = SetReadPassword("FFFFFFFF", "FFFFFFFF", g_pHReadPassWord, g_pLReadPassWord, szKeyPath); if (nRet != 0) { AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); } nRet = SetWritePassword("FFFFFFFF", "FFFFFFFF", g_pHWritePassWord, g_pLWritePassWord, szKeyPath); if (nRet != 0) { AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); } // 从地址0~231+32,是所有加密锁共同内容; for (int i = 0; i < 8; i++) { if ((nRet = YtWriteString(g_szRom[i], i * 33, g_pHWritePassWord, g_pLWritePassWord, szKeyPath)) <= 0) { // 写区域错误; AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); } } // 264是座席数量; if (linfo.nCCount > 0) { CHAR szCCount[ENCRYPT_BLOCK_LEN] = { 0 }; // 包含结束符; sprintf_s(szCCount, "%d", linfo.nCCount); if ((nRet = YtWriteString(szCCount, 264, g_pHWritePassWord, g_pLWritePassWord, szKeyPath)) <= 0) { // 设置座席数失败; AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); return FALSE; } } // 297是域名值; // 生成域名串 = 日期 + 短ID; CHAR szDomain[ENCRYPT_BLOCK_LEN] = { 0 }; // 包含结束符; if (bfixedId && pszBranchId && pszBranchId[0] != '\0') { sprintf_s(szDomain, pszBranchId); } else { CTime tt = CTime::GetCurrentTime(); sprintf_s(szDomain, "%04d%02d%02d%02d%02d%02d%d.ly.com", tt.GetYear(), tt.GetMonth(), tt.GetDay(), tt.GetHour(), tt.GetMinute(), tt.GetSecond(), dwShortKey); } if ((nRet = YtWriteString(szDomain, 297, g_pHWritePassWord, g_pLWritePassWord, szKeyPath)) <= 0) { // 生成域名错误; AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); return FALSE; } // 330是医院跟踪系统; if (linfo.bHospital) { CHAR szHospital[ENCRYPT_BLOCK_LEN] = { 0 }; // 包含结束符; sprintf_s(szHospital, "%d", linfo.bHospital); if ((nRet = YtWriteString(szHospital, 330, g_pHWritePassWord, g_pLWritePassWord, szKeyPath)) <= 0) { // 设置医院跟踪系统失败; AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); return FALSE; } } // 生成指定软件版本加密解密密钥; switch (linfo.nSoftVer) { case EN_OCHILD: nRet = WriteEncKey("FFFFFFFF", "FFFFFFFF", "FFFFFFFF", "FFFFFFFF", g_szEncKey[EN_OCHILD][0], g_szEncKey[EN_OCHILD][1], g_szEncKey[EN_OCHILD][2], g_szEncKey[EN_OCHILD][3], szKeyPath); break; case EN_LCHILD: nRet = WriteEncKey("FFFFFFFF", "FFFFFFFF", "FFFFFFFF", "FFFFFFFF", g_szEncKey[EN_LCHILD][0], g_szEncKey[EN_LCHILD][1], g_szEncKey[EN_LCHILD][2], g_szEncKey[EN_LCHILD][3], szKeyPath); break; case EN_ECHILD: nRet = WriteEncKey("FFFFFFFF", "FFFFFFFF", "FFFFFFFF", "FFFFFFFF", g_szEncKey[EN_ECHILD][0], g_szEncKey[EN_ECHILD][1], g_szEncKey[EN_ECHILD][2], g_szEncKey[EN_ECHILD][3], szKeyPath); break; case EN_OWDDING: nRet = WriteEncKey("FFFFFFFF", "FFFFFFFF", "FFFFFFFF", "FFFFFFFF", g_szEncKey[EN_OWDDING][0], g_szEncKey[EN_OWDDING][1], g_szEncKey[EN_OWDDING][2], g_szEncKey[EN_OWDDING][3], szKeyPath); break; case EN_LWDDING: nRet = WriteEncKey("FFFFFFFF", "FFFFFFFF", "FFFFFFFF", "FFFFFFFF", g_szEncKey[EN_LWDDING][0], g_szEncKey[EN_LWDDING][1], g_szEncKey[EN_LWDDING][2], g_szEncKey[EN_LWDDING][3], szKeyPath); break; case EN_EWDDING: nRet = WriteEncKey("FFFFFFFF", "FFFFFFFF", "FFFFFFFF", "FFFFFFFF", g_szEncKey[EN_EWDDING][0], g_szEncKey[EN_EWDDING][1], g_szEncKey[EN_EWDDING][2], g_szEncKey[EN_EWDDING][3], szKeyPath); break; } if (nRet != 0) { // 生成密钥失败; AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); return FALSE; } ////////////////////////////////////////////////////////////////////////// // 授权时间码; CHAR szyear[10] = { 0 }, szmonth[10] = { 0 }, szday[10] = { 0 }, szhour[10] = { 0 }, szminute[10] = { 0 }, szsecond[10] = { 0 }; if ((nRet = GetRunTimer(szyear, szmonth, szday, szhour, szminute, szsecond, szKeyPath)) != 0) { // 获取运行时间失败; AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); return FALSE; } _stprintf_s(szHasRundate, _T("已运行 %d年%d月%d天%d时%d分"), atoi(szyear), atoi(szmonth), atoi(szday), atoi(szhour), atoi(szminute)); if (linfo.bAdddate) // 追加时间; { sprintf_s(szyear, "%d", atoi(linfo.szRunyears) + atoi(szyear)); sprintf_s(szmonth, "%d", atoi(linfo.szRunmonths) + atoi(szmonth)); sprintf_s(szday, "%d", atoi(linfo.szRundays) + atoi(szday)); sprintf_s(szhour, "%d", atoi(linfo.szRunhours) + atoi(szhour)); sprintf_s(szminute, "%d", atoi(linfo.szRunminutes) + atoi(szminute)); } else { sprintf_s(szyear, "%s", linfo.szRunyears); sprintf_s(szmonth, "%s", linfo.szRunmonths); sprintf_s(szday, "%s", linfo.szRundays); sprintf_s(szhour, "%s", linfo.szRunhours); sprintf_s(szminute, "%s", linfo.szRunminutes); } // 生成时间授权码; CHAR szOutString[100] = { 0 }; // 返回的时间授权码; if ((nRet = MakeTimerAuth(g_szUserKey, dwShortKey, szyear, szmonth, szday, szhour, szminute, szOutString, szKeyPath)) != 0) { // 生成时间授权码失败; AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); return FALSE; } CHAR HKey[9] = "FFFFFFFF", LKey[9] = "FFFFFFFF"; CHAR WHKey[41] = "0", WLKey[41] = "0"; memcpy(WHKey, szOutString, 40); memcpy(WLKey, &szOutString[40], 40); // 写授权时间到加密锁中; if ((nRet = WriteTimeAuthToEprom(30128, HKey, LKey, WHKey, WLKey, dwShortKey, szyear, szmonth, szday, szhour, szminute, szKeyPath)) != 0) { // 写授权时间失败; AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); return FALSE; } DWORD dwID; // 30000以后的储存空间为公共区域; if ((nRet = ReadTimeAuthFromEprom(WHKey, WLKey, szOutString, &dwID, 30128, "FFFFFFFF", "FFFFFFFF", szKeyPath)) == 0) { #ifdef UNICODE WCHAR *pOutString = ascii2unicode(szOutString); _stprintf_s(szCouldRundate, _T("%s"), pOutString); delete pOutString; pOutString = NULL; #else _stprintf_s(szCouldRundate, _T("%s"), szOutString); #endif } else { AfxMessageBox(GetYtUSBKey32ErrInfo(nRet)); } return TRUE; } }; #endif