Global.cpp 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. #include "StdAfx.h"
  2. #include "Global.h"
  3. //#include <tlhelp32.h>
  4. //#include <afxcoll.h>
  5. //#include <afxtempl.h>
  6. //#include <shlwapi.h>
  7. #include <strsafe.h>
  8. // GetFileVersion函数使用;
  9. #include <winver.h>
  10. #pragma comment(lib,"Version.lib")
  11. // 加密狗SDK;
  12. // #include "my32.h"
  13. // #pragma comment(lib,"my32.lib")
  14. // 全局变量;
  15. //////////////////////////////////////////////////////////////////////////
  16. vector <STBranchInfo> g_vtBranchInfo; // 从branchinfo.dat中获取的分店信息;
  17. //////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////
  19. TCHAR g_szModulePath[MAX_PATH] = _T(""); // 软件目录;
  20. TCHAR g_szModuleFileName[MAX_PATH] = _T(""); // 软件全名称;
  21. TCHAR g_szConnectString[MAX_PATH] = _T(""); // DB连接串;
  22. // 服务端主机信息;
  23. TCHAR g_szHostComputerIP[MAX_PATH] = _T(""); // 服务端主机名称;
  24. DWORD g_dwNICP = 0; // 多网卡时的网卡索引号;
  25. DWORD g_dwTCPChatPort = 0; // 服务端主机通信TCP端口;
  26. DWORD g_dwTCPFilePort = 0; // 服务端主机文件传输端口;
  27. // 短信服务端主机信息;
  28. TCHAR g_szSMSServer[MAX_PATH] = _T(""); // 短信服务端主机名称;
  29. DWORD g_dwTCPSMSPort = 0; // 短信服务端主机通信端口;
  30. // 数据库信息;
  31. TCHAR g_szDBSource[MAX_PATH] = _T(""); // 数据库源(服务所在IP或计算机名);
  32. TCHAR g_szDBSourcePort[MAX_PATH] = _T(""); // 数据库源端口;
  33. DWORD g_dwDBServerPort = 0; // 数据库源端口;
  34. TCHAR g_szDBAccount[MAX_PATH] = _T(""); // 数据库登录用户;
  35. TCHAR g_szDBPassWord[MAX_PATH] = _T(""); // 数据库登录密码;
  36. TCHAR g_szDBName[MAX_PATH] = _T(""); // 数据库名称;
  37. // SMScfg.ini中的加密狗类型信息;
  38. DWORD g_dwEncryType = 0;
  39. TCHAR g_szEncryS1[50] = _T("");
  40. // 相片存储目录;
  41. TCHAR g_szShareHost[MAX_PATH] = _T(""); // 共享主机名;
  42. TCHAR g_szOriginalFolder[MAX_PATH] = _T(""); // 原片目录;
  43. TCHAR g_szEarlyRepairFolder[MAX_PATH] = _T(""); // 初修片目录;
  44. TCHAR g_szFurtherRepairFolder[MAX_PATH] = _T(""); // 精修片目录;
  45. TCHAR g_szDesignFolder[MAX_PATH] = _T(""); // 设计片目录;
  46. TCHAR g_szOriginalBkFolder[MAX_PATH] = _T(""); // 原片备份目录;
  47. TCHAR g_szEarlyRepairBkFolder[MAX_PATH] = _T(""); // 初修片备份目录;
  48. TCHAR g_szFurtherRepairBkFolder[MAX_PATH] = _T(""); // 精修片备份目录;
  49. TCHAR g_szDesignBkFolder[MAX_PATH] = _T(""); // 设计片备份目录;
  50. TCHAR g_szTelRecordingFolder[MAX_PATH] = _T(""); // 电话录音目录;
  51. TCHAR g_szFullDressImageFolder[MAX_PATH] = _T(""); // 礼服图片目录;
  52. //////////////////////////////////////////////////////////////////////////
  53. DWORD g_dwFTPPort = 21;
  54. //////////////////////////////////////////////////////////////////////////
  55. // 升级包版本号;
  56. //WORD g_arrFileVersion[4] = { 0 };
  57. CHAR g_szKeyPath[MAX_PATH] = {0};
  58. int g_nVersion = -1;
  59. BYTE g_byShotVersion[6][10] =
  60. {
  61. { 6, 0, 148, 11, 205, 50, 4, 171, 32, 39 }, // 儿童座席版;
  62. { 6, 0, 4, 29, 24, 247, 189, 95, 83, 76 }, // 婚纱座席版;
  63. { 6, 0, 4, 187, 103, 10, 59, 169, 240, 220 }, // 儿童企业版;
  64. { 6, 0, 137, 160, 230, 173, 202, 2, 117, 142 }, // 婚纱企业版;
  65. { 6, 0, 194, 199, 210, 67, 185, 1, 138, 195 }, // 儿童全能版;
  66. { 6, 0, 188, 145, 100, 47, 154, 177, 34, 205 }, // 婚纱全能版;
  67. };
  68. // endof------------6版本加密狗信息----------------;
  69. // start---------------加密表达式加密后的数组----------------------;
  70. BYTE g_byCalExVersion[7][114] =
  71. {
  72. // 儿童座席版;
  73. { 109, 0, 90, 15, 108, 138, 37, 190, 82, 8, 20, 252, 32, 162, 7, 8, 254, 255, 56, 245, 194, 4, 46, 120, 49, 120, 156, 27, 17, 164, 217,
  74. 79, 167, 146, 197, 69, 55, 117, 197, 149, 42, 217, 151, 195, 254, 145, 187, 197, 232, 188, 114, 223, 40, 229, 151, 245, 116, 177, 141, 94, 134, 14,
  75. 13, 169, 165, 94, 5, 216, 235, 60, 176, 38, 174, 121, 187, 174, 16, 30, 17, 20, 246, 34, 20, 252, 32, 162, 7, 8, 254, 255, 56, 245, 194,
  76. 4, 46, 120, 49, 120, 156, 27, 17, 164, 217, 79, 167, 146, 143, 132, 219, 173, 211, 2, 99, 180 },
  77. // 婚纱座席版;
  78. { 109, 0, 128, 13, 164, 143, 252, 87, 30, 48, 20, 21, 145, 114, 160, 96, 49, 127, 181, 32, 144, 213, 109, 99, 142, 219, 71, 26, 22, 220, 177,
  79. 179, 191, 82, 138, 45, 173, 160, 9, 83, 162, 106, 182, 175, 47, 92, 214, 78, 93, 21, 202, 165, 167, 200, 198, 172, 218, 74, 236, 194, 194, 228,
  80. 40, 27, 95, 60, 160, 173, 66, 185, 178, 7, 159, 220, 58, 71, 140, 19, 20, 37, 66, 84, 20, 21, 145, 114, 160, 96, 49, 127, 181, 32, 144,
  81. 213, 109, 99, 142, 219, 71, 26, 22, 220, 177, 179, 191, 82, 232, 182, 45, 27, 13, 195, 225, 204 },
  82. // 儿童企业版;
  83. { 109, 0, 229, 36, 223, 222, 213, 46, 70, 55, 240, 207, 237, 75, 226, 68, 133, 100, 42, 119, 89, 131, 79, 104, 158, 17, 172, 239, 4, 158, 201,
  84. 51, 62, 51, 94, 232, 14, 124, 81, 64, 100, 141, 187, 85, 156, 59, 205, 116, 200, 24, 108, 218, 145, 22, 7, 36, 45, 7, 156, 255, 170, 130,
  85. 165, 140, 99, 216, 120, 72, 171, 196, 27, 49, 138, 199, 137, 246, 214, 247, 121, 114, 215, 199, 240, 207, 237, 75, 226, 68, 133, 100, 42, 119, 89,
  86. 131, 79, 104, 158, 17, 172, 239, 4, 158, 201, 51, 62, 51, 248, 214, 27, 254, 221, 208, 181, 209 },
  87. // 婚纱企业版;
  88. { 109, 0, 94, 220, 40, 182, 30, 120, 56, 193, 78, 101, 1, 144, 68, 206, 192, 52, 67, 9, 243, 20, 9, 195, 153, 15, 22, 217, 243, 79, 177,
  89. 22, 24, 171, 185, 157, 172, 67, 117, 124, 153, 165, 3, 41, 218, 47, 149, 150, 48, 152, 75, 250, 204, 253, 92, 53, 121, 147, 242, 140, 80, 66,
  90. 34, 194, 16, 109, 237, 17, 222, 161, 96, 8, 11, 194, 58, 45, 86, 15, 207, 121, 247, 104, 78, 101, 1, 144, 68, 206, 192, 52, 67, 9, 243,
  91. 20, 9, 195, 153, 15, 22, 217, 243, 79, 177, 22, 24, 171, 122, 243, 190, 146, 77, 222, 208, 129 },
  92. // 儿童全能版;
  93. { 109, 0, 26, 222, 0, 239, 199, 199, 188, 225, 180, 168, 178, 208, 21, 79, 62, 90, 51, 31, 88, 128, 180, 105, 53, 137, 230, 254, 244, 50, 195,
  94. 49, 167, 143, 168, 125, 130, 125, 8, 73, 224, 120, 80, 95, 178, 49, 44, 158, 38, 38, 247, 169, 62, 187, 119, 192, 77, 194, 118, 246, 133, 241,
  95. 157, 62, 144, 24, 94, 173, 49, 192, 46, 250, 249, 239, 82, 78, 135, 3, 86, 154, 8, 135, 180, 168, 178, 208, 21, 79, 62, 90, 51, 31, 88,
  96. 128, 180, 105, 53, 137, 230, 254, 244, 50, 195, 49, 167, 143, 241, 214, 38, 180, 198, 3, 158, 165 },
  97. // 婚纱全能版;
  98. { 109, 0, 139, 145, 163, 176, 66, 18, 207, 79, 172, 200, 12, 124, 89, 151, 248, 238, 26, 85, 137, 146, 119, 58, 76, 194, 151, 239, 204, 104, 18,
  99. 166, 208, 54, 37, 85, 3, 174, 28, 74, 154, 156, 120, 194, 8, 112, 79, 42, 27, 89, 81, 95, 238, 74, 59, 199, 160, 101, 117, 179, 51, 138,
  100. 70, 176, 239, 182, 160, 212, 11, 33, 224, 74, 155, 143, 216, 10, 220, 71, 8, 168, 18, 175, 172, 200, 12, 124, 89, 151, 248, 238, 26, 85, 137,
  101. 146, 119, 58, 76, 194, 151, 239, 204, 104, 18, 166, 208, 54, 114, 118, 181, 24, 252, 41, 246, 88 },
  102. };
  103. // endof---------------加密表达式加密后的数组----------------------;
  104. //////////////////////////////////////////////////////////////////////////
  105. // 删除文件或者文件夹;
  106. // DeleteFile("d:\\PID\0\0"); //删除一个文件夹;
  107. // DeleteFile("d:\\PID.dsp\0d:\\PID.dsw\0\0"); //删除多个文件;
  108. BOOL DeleteFolder(LPCTSTR lpszPath) // 只能删除本地目录,共享路径无法删除;
  109. {
  110. SHFILEOPSTRUCT FileOp;
  111. ZeroMemory((void*)&FileOp,sizeof(SHFILEOPSTRUCT));
  112. // fFlags:
  113. // FOF_ALLOWUNDO 允许放回回收站;
  114. // FOF_NOCONFIRMATION; 不出现确认对话框
  115. FileOp.fFlags = FOF_NOCONFIRMATION;
  116. FileOp.hNameMappings = NULL;
  117. FileOp.hwnd = NULL;
  118. //FileOp.hwnd = GetActiveWindow();
  119. FileOp.lpszProgressTitle = NULL;
  120. FileOp.pFrom = lpszPath;
  121. FileOp.pTo = NULL; // 一定要是NULL;
  122. FileOp.wFunc = FO_DELETE; // 删除操作;
  123. return SHFileOperation(&FileOp) == 0;
  124. }
  125. void GetPathFromNetShareName(LPTSTR lpShareDir, LPTSTR lpRet)
  126. {
  127. PSHARE_INFO_502 BufPtr = NULL;
  128. NET_API_STATUS res;
  129. #ifndef UNICODE
  130. TCHAR szPathName[255];
  131. WCHAR wszShareName[255];
  132. MultiByteToWideChar(CP_ACP, 0, lpShareDir, -1, wszShareName, 255);
  133. if (res = NetShareGetInfo(NULL, wszShareName, 502, (LPBYTE *)&BufPtr) == ERROR_SUCCESS)
  134. {
  135. _stprintf_s(szPathName, _T("%s"), BufPtr->shi502_path);
  136. }
  137. #else
  138. if ( (res = NetShareGetInfo(NULL, lpShareDir, 502, (LPBYTE *)&BufPtr)) == ERROR_SUCCESS)
  139. {
  140. _stprintf_s(lpRet, wcslen(BufPtr->shi502_path)+1, _T("%s"), BufPtr->shi502_path);
  141. }
  142. #endif
  143. // 释放缓冲;
  144. NetApiBufferFree(BufPtr);
  145. }
  146. //复制文件或文件夹;
  147. /*
  148. CopyFile("d:\0\0","D:\\MyProjects\\临时程序\0\0"); //把"临时程序"文件夹放到d盘下面
  149. CopyFile("d:\0\0","D:\\MyProjects\\临时程序\\PID.dsp\0D:\\MyProjects\\临时程序\\PID.dsw\0"); //把PID.dsp和PID.dsw俩个文件放到d盘下面
  150. 注意:,如果你想把"D:\\MyProjects\\临时程序\0\0"的文件夹复制到D盘下,并从命名为NewName,应该这样
  151. CopyFile("d:\\NewName\0\0","D:\\MyProjects\\临时程序\\*.*\0\0"); //把"临时程序"文件夹复制到d盘下并从命名为"NewName"
  152. */
  153. BOOL CopyFolder(LPCTSTR lpszFromPath,LPCTSTR lpszToPath)
  154. {
  155. SHFILEOPSTRUCT FileOp;
  156. ZeroMemory((void*)&FileOp,sizeof(SHFILEOPSTRUCT));
  157. FileOp.fFlags = FOF_NOCONFIRMATION ;
  158. FileOp.hNameMappings = NULL;
  159. FileOp.hwnd = NULL;
  160. FileOp.lpszProgressTitle = NULL;
  161. FileOp.pFrom = lpszFromPath;
  162. FileOp.pTo = lpszToPath;
  163. FileOp.wFunc = FO_COPY;
  164. return SHFileOperation(&FileOp) == 0;
  165. }
  166. BOOL IsValidDate(LPCTSTR lpDate)
  167. {
  168. if(lpDate == NULL || _tcscmp(lpDate,_T("")) == 0)
  169. return FALSE;
  170. CString strDate = lpDate;
  171. if (strDate.IsEmpty()) return FALSE;
  172. // 判断日期合法性;
  173. static int nYear = 0;
  174. static int nMonth = 0;
  175. static int nDay = 0;
  176. nYear = nMonth = nDay = 0;
  177. nYear = _ttoi(strDate.Left(4));
  178. nMonth = _ttoi(strDate.Mid(5, 2));
  179. nDay = _ttoi(strDate.Mid(8, 2));
  180. CONST static INT nNormalMonth[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  181. CONST static INT nLeapMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  182. if ((nDay <= 0) || (nDay > 31) || (nMonth <= 0) || (nMonth > 12)) return FALSE;
  183. if ((nYear % 400 == 0) || (nYear % 4 == 0 && nYear % 100 != 0))
  184. {
  185. if (nDay > nLeapMonth[nMonth - 1]) return FALSE;
  186. }
  187. else
  188. {
  189. if (nDay > nNormalMonth[nMonth - 1]) return FALSE;
  190. }
  191. return TRUE;
  192. }
  193. //************************************//
  194. // 数据库地址;
  195. // 数据库端口;
  196. // 数据库管理员账号;
  197. // 数据库管理员密码;
  198. // 数据库名称;
  199. //
  200. // [函数]:GetIniInfo
  201. // [描述]:获取指定ini信息;
  202. // [参数]:
  203. // szPath:ini所在目录;
  204. // szIniName:ini名;
  205. // [返回]:void
  206. //************************************//
  207. int GetSysIniInfo(const TCHAR *szPath, const TCHAR *szIniName)
  208. {
  209. TCHAR szDrive[_MAX_DRIVE] = { 0 };
  210. TCHAR szDir[_MAX_DIR] = { 0 };
  211. TCHAR szFna[_MAX_DIR] = { 0 };
  212. TCHAR szExt[_MAX_DIR] = { 0 };
  213. ::GetModuleFileName(NULL, g_szModuleFileName, sizeof(g_szModuleFileName) / sizeof(TCHAR));
  214. _stprintf_s(g_szModulePath, _T("%s"), g_szModuleFileName);
  215. _tsplitpath_s(g_szModulePath, szDrive, szDir, szFna, szExt);
  216. _tcscpy_s(g_szModulePath, szDrive);
  217. _tcscat_s(g_szModulePath, szDir);
  218. // -----------------------------------------------------//
  219. TCHAR szFile[MAX_PATH + 1] = _T("");
  220. if (szPath != NULL && szIniName != NULL)
  221. _stprintf_s(szFile, _T("%s\\%s"), szPath, szIniName);
  222. else
  223. _stprintf_s(szFile, _T("%s\\ServiceInfo.ini"), g_szModulePath);
  224. TRACE("szFile =%s\n", szFile);
  225. HANDLE hFile = CreateFile(szFile, 0/*GENERIC_READ*/, 0, NULL, OPEN_EXISTING, 0, NULL);
  226. if (ERROR_FILE_NOT_FOUND == GetLastError())
  227. {
  228. // 如果没找到,使用默认连接;
  229. _tcscpy_s(g_szHostComputerIP, _T("."));
  230. g_dwTCPChatPort = 5678;
  231. return -1;
  232. }
  233. // 获取数据库信息;
  234. GetPrivateProfileString(_T("DatabaseInfo"), _T("dbSource"), _T(""), g_szDBSource, MAX_PATH, szFile);
  235. g_dwDBServerPort = GetPrivateProfileInt(_T("DatabaseInfo"), _T("dbServerPort"), 0, szFile);
  236. GetPrivateProfileString(_T("DatabaseInfo"), _T("dbAccount"), _T(""), g_szDBAccount, MAX_PATH, szFile);
  237. GetPrivateProfileString(_T("DatabaseInfo"), _T("dbPassWord"), _T(""), g_szDBPassWord, MAX_PATH, szFile);
  238. GetPrivateProfileString(_T("DatabaseInfo"), _T("dbName"), _T(""), g_szDBName, MAX_PATH, szFile);
  239. if (g_dwDBServerPort != 0)
  240. _stprintf_s(g_szConnectString, _T("driver={SQL Server};Server=%s,%d;database=%s;uid=%s;pwd=%s"),
  241. g_szDBSource, g_dwDBServerPort, g_szDBName, g_szDBAccount, g_szDBPassWord);
  242. else
  243. _stprintf_s(g_szConnectString, _T("driver={SQL Server};Server=%s;database=%s;uid=%s;pwd=%s"),
  244. g_szDBSource, g_szDBName, g_szDBAccount, g_szDBPassWord);
  245. // 获取服务器信息;
  246. GetPrivateProfileString(_T("NetWorkInfo"), _T("ServerName"), _T(""), g_szHostComputerIP, MAX_PATH, szFile);
  247. g_dwTCPChatPort = GetPrivateProfileInt(_T("NetWorkInfo"), _T("TCPChatPort"), 0, szFile);
  248. g_dwTCPFilePort = GetPrivateProfileInt(_T("NetWorkInfo"), _T("TCPFilePort"), 0, szFile);
  249. // 获取利亚方舟服务器信息;
  250. GetPrivateProfileString(_T("NetWorkInfo"), _T("SMSServerName"), _T(""), g_szSMSServer, MAX_PATH, szFile);
  251. g_dwTCPSMSPort = GetPrivateProfileInt(_T("NetWorkInfo"), _T("TCPSMSPort"), 0, szFile);
  252. return 0;
  253. }
  254. // Jeff.注册控件函数;2014.09.11
  255. //----------------------------------------------------------
  256. // 函数:RegisterOcx
  257. // 描述:注册指定的组件文件;
  258. // 参数:ocxfile指定要注册的组件文件名;
  259. // 返回:TRUE表示注册成功;
  260. //----------------------------------------------------------
  261. BOOL RegisterOcx(LPCTSTR ocxfile)
  262. {
  263. HKEY hKey;
  264. bool bRet;
  265. USES_CONVERSION;
  266. ITypeLib* pTypeLib;
  267. CString CLSIDStr;
  268. CLSID clsid;
  269. LPOLESTR wRes = NULL;
  270. #ifdef UNICODE
  271. if (LoadTypeLib(ocxfile, &pTypeLib) == S_OK)
  272. #else
  273. if (LoadTypeLib(T2OLE(ocxfile), &pTypeLib) == S_OK)
  274. #endif
  275. {
  276. TLIBATTR tlibAttr, *ptlibAttr;
  277. ptlibAttr = &tlibAttr;
  278. pTypeLib->GetLibAttr(&ptlibAttr);
  279. clsid = ptlibAttr->guid;
  280. pTypeLib->Release();
  281. }
  282. ::StringFromCLSID(clsid, &wRes);
  283. CLSIDStr = OLE2CT(wRes);
  284. if ((RegOpenKeyEx(HKEY_CLASSES_ROOT, _T("CLSID\\") + CLSIDStr, 0, KEY_READ, &hKey) == ERROR_SUCCESS) || (RegOpenKeyEx(HKEY_CLASSES_ROOT, _T("Wow6432Node\\TypeLib\\") + CLSIDStr, 0, KEY_READ, &hKey) == ERROR_SUCCESS))
  285. {
  286. return true;
  287. }
  288. else
  289. {
  290. HINSTANCE hLib = LoadLibrary(ocxfile);
  291. if (hLib < (HINSTANCE)HINSTANCE_ERROR)
  292. {
  293. MessageBox(0, _T("权限不足,不能载入OCX文件!无法注册控件!"), _T("结果"), MB_OK);
  294. bRet = false;
  295. }
  296. else
  297. {
  298. FARPROC lpDllEntryPoint;
  299. lpDllEntryPoint = GetProcAddress(hLib, "DllRegisterServer");
  300. if (lpDllEntryPoint != NULL)
  301. {
  302. if (FAILED((*lpDllEntryPoint)()))
  303. {
  304. MessageBox(0, _T("调用注册函数(DllRegisterServer)失败!无法注册控件!"), _T("结果"), MB_OK);
  305. bRet = false;
  306. }
  307. else
  308. bRet = true;
  309. }
  310. else
  311. {
  312. MessageBox(0, _T("调用注册函数(DllRegisterServer)失败!无法注册控件!"), _T("结果"), MB_OK);
  313. bRet = false;
  314. }
  315. }
  316. FreeLibrary(hLib);
  317. return bRet;
  318. }
  319. }
  320. // Jeff.Hacker. WINDOWS NT 以上的内核需要提权,才能对系统进行高级管理;
  321. //----------------------------------------------------------
  322. // 函数:GetDebugPriv
  323. // 描述:对程序提权;
  324. // 参数:
  325. // 返回:TRUE表示程序提权成功;
  326. //----------------------------------------------------------
  327. BOOL GetDebugPriv()
  328. {
  329. // 返回的访问令牌指针;
  330. HANDLE hToken;
  331. // 接收所返回的制定特权名称的信息;
  332. LUID sedebugnameValue;
  333. // 新特权信息的指针(结构体);
  334. TOKEN_PRIVILEGES tkp;
  335. DWORD dwCurProcId = GetCurrentProcessId();
  336. // 要修改访问权限的进程句柄;
  337. HANDLE hCurProc;
  338. hCurProc = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwCurProcId);
  339. if (!::OpenProcessToken(hCurProc, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
  340. {
  341. ShowSystemErrorInfo(CString("提权OpenProcessToken失败。"), GetLastError());
  342. return FALSE;
  343. }
  344. if (!::LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &sedebugnameValue))
  345. {
  346. ShowSystemErrorInfo(CString("提权LookupPrivilegeValue失败。"), GetLastError());
  347. CloseHandle(hToken);
  348. return FALSE;
  349. }
  350. tkp.PrivilegeCount = 1;
  351. tkp.Privileges[0].Luid = sedebugnameValue;
  352. tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
  353. if (!::AdjustTokenPrivileges(hToken, FALSE, &tkp, sizeof tkp, NULL, NULL))
  354. {
  355. ShowSystemErrorInfo(CString("提权AdjustTokenPrivileges失败。"), GetLastError());
  356. CloseHandle(hToken);
  357. return FALSE;
  358. }
  359. CloseHandle(hCurProc);
  360. CloseHandle(hToken);
  361. return TRUE;
  362. }
  363. //----------------------------------------------------------
  364. // 函数:GetFileVersion
  365. // 描述:获取指定模块的文件版本信息
  366. // 参数:
  367. // hModule: 指定的模块(如果为NULL,表示获取自身文件版本信息);
  368. // pBuffer: 返回的文件版本信息;
  369. //
  370. // 返回:TRUE表示获取模块文件版本信息成功;
  371. //----------------------------------------------------------
  372. bool GetFileVersion(HMODULE hModule, WORD *pBuffer)
  373. {
  374. TCHAR fname[MAX_PATH];
  375. VS_FIXEDFILEINFO *pVi;
  376. DWORD dwHandle;
  377. std::string str;
  378. if (::GetModuleFileName(hModule, fname, MAX_PATH))
  379. {
  380. int size = GetFileVersionInfoSize(fname, &dwHandle);
  381. if (size > 0)
  382. {
  383. BYTE *buffer = new BYTE[size];
  384. memset(buffer, 0, size);
  385. if (GetFileVersionInfo(fname, dwHandle, size, buffer))
  386. {
  387. if (VerQueryValue(buffer, _T("\\"), (LPVOID *)&pVi, (PUINT)&size))
  388. {
  389. pBuffer[0] = HIWORD(pVi->dwFileVersionMS);
  390. pBuffer[1] = LOWORD(pVi->dwFileVersionMS);
  391. pBuffer[2] = HIWORD(pVi->dwFileVersionLS);
  392. pBuffer[3] = LOWORD(pVi->dwFileVersionLS);
  393. delete buffer;
  394. return true;
  395. }
  396. }
  397. delete buffer;
  398. }
  399. }
  400. return false;
  401. }
  402. //---------------------------------------------------------------------
  403. // Jeff add 2014.06.23;
  404. // 函数:ShowErrorInfo
  405. // 描述:
  406. // 参数:
  407. // lpszFunction:函数名;
  408. // dwError:错误码;
  409. // 返回:
  410. //---------------------------------------------------------------------
  411. void ShowSystemErrorInfo(CString &strDescription, const DWORD &dwError)
  412. {
  413. LPVOID lpMsgBuf;
  414. BOOL fOk = FormatMessage(
  415. FORMAT_MESSAGE_ALLOCATE_BUFFER |
  416. FORMAT_MESSAGE_FROM_SYSTEM |
  417. FORMAT_MESSAGE_IGNORE_INSERTS,
  418. NULL,
  419. dwError,
  420. MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
  421. (LPTSTR)&lpMsgBuf,
  422. 0, NULL);
  423. if (!fOk)
  424. {
  425. // Is it a network-related error?
  426. HMODULE hDll = LoadLibraryEx(TEXT("netmsg.dll"), NULL, DONT_RESOLVE_DLL_REFERENCES);
  427. if (hDll != NULL)
  428. {
  429. FormatMessage(
  430. FORMAT_MESSAGE_FROM_HMODULE |
  431. FORMAT_MESSAGE_FROM_SYSTEM |
  432. FORMAT_MESSAGE_IGNORE_INSERTS,
  433. hDll,
  434. dwError,
  435. MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
  436. (LPTSTR)&lpMsgBuf,
  437. 0,
  438. NULL);
  439. FreeLibrary(hDll);
  440. }
  441. }
  442. if (lpMsgBuf != NULL)
  443. {
  444. CString strDisplay;
  445. strDisplay.Format(_T("%s.错误码=%d,Windows描述:%s"), strDescription, dwError, (PCTSTR)LocalLock(lpMsgBuf));
  446. //WriteLogin(strDisplay);
  447. AfxMessageBox(strDisplay);
  448. LocalFree(lpMsgBuf);
  449. }
  450. else
  451. {
  452. //WriteLogin(strDescription);
  453. AfxMessageBox(_T("未知道错误"));
  454. }
  455. }
  456. CString GetLastErrorInfo(CONST DWORD &dwError)
  457. {
  458. LPVOID lpMsgBuf;
  459. BOOL fOk = FormatMessage(
  460. FORMAT_MESSAGE_ALLOCATE_BUFFER |
  461. FORMAT_MESSAGE_FROM_SYSTEM |
  462. FORMAT_MESSAGE_IGNORE_INSERTS,
  463. NULL,
  464. dwError,
  465. MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
  466. (LPTSTR)&lpMsgBuf,
  467. 0, NULL);
  468. if (!fOk)
  469. {
  470. // Is it a network-related error?
  471. HMODULE hDll = LoadLibraryEx(TEXT("netmsg.dll"), NULL, DONT_RESOLVE_DLL_REFERENCES);
  472. if (hDll != NULL)
  473. {
  474. FormatMessage(
  475. FORMAT_MESSAGE_FROM_HMODULE |
  476. FORMAT_MESSAGE_FROM_SYSTEM |
  477. FORMAT_MESSAGE_IGNORE_INSERTS,
  478. hDll,
  479. dwError,
  480. MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
  481. (LPTSTR)&lpMsgBuf,
  482. 0,
  483. NULL);
  484. FreeLibrary(hDll);
  485. }
  486. }
  487. CString strErrorInfo = _T("");
  488. if (lpMsgBuf != NULL)
  489. {
  490. strErrorInfo.Format(_T("错误码=%d,Windows描述:%s"), dwError, (PCTSTR)LocalLock(lpMsgBuf));
  491. LocalFree(lpMsgBuf);
  492. }
  493. else
  494. {
  495. strErrorInfo = _T("未知道错误");
  496. }
  497. return strErrorInfo;
  498. }
  499. CString FilterFileName(LPCTSTR lpFileName)
  500. {
  501. CString &strFileName = (CString)lpFileName;
  502. strFileName.Remove(_T('/'));
  503. strFileName.Remove(_T('\\'));
  504. strFileName.Remove(_T(':'));
  505. strFileName.Remove(_T('*'));
  506. strFileName.Remove(_T('?'));
  507. strFileName.Remove(_T('\"'));
  508. strFileName.Remove(_T('<'));
  509. strFileName.Remove(_T('>'));
  510. strFileName.Remove(_T('|'));
  511. return strFileName;
  512. }
  513. void InitSharePathInfo()
  514. {
  515. // 1.获取本机计算机名;
  516. DWORD dwLeng = 0;
  517. GetComputerName(NULL,&dwLeng);
  518. GetComputerName(g_szShareHost,&dwLeng);
  519. // 2.本机共享目录;
  520. _stprintf_s(g_szOriginalFolder,_T("\\\\%s\\%s"),g_szShareHost,ORIGINAL);
  521. _stprintf_s(g_szEarlyRepairFolder,_T("\\\\%s\\%s"),g_szShareHost,EARLY);
  522. _stprintf_s(g_szFurtherRepairFolder,_T("\\\\%s\\%s"),g_szShareHost,FUTHER);
  523. _stprintf_s(g_szDesignFolder,_T("\\\\%s\\%s"),g_szShareHost,DESIGN);
  524. #if 1
  525. // 3.读取branchinfo.dat文件信息;
  526. CArray<CStringArray, CStringArray> AryBranchInfo;
  527. CFile fbranchInfo;
  528. CString path = _T(".\\branchinfo.dat");
  529. if (PathFileExists(path) == 0)
  530. {
  531. return;
  532. }
  533. fbranchInfo.Open(path, CFile::modeRead);
  534. DWORD leng = fbranchInfo.GetLength();
  535. if (leng < sizeof(DWORD) * 2)
  536. {
  537. fbranchInfo.Close(); return;
  538. }
  539. DWORD flag;
  540. fbranchInfo.Seek(-(LONG)sizeof(DWORD), CFile::end);
  541. fbranchInfo.Read(&flag, sizeof(DWORD));
  542. if (flag != 889900)
  543. {
  544. fbranchInfo.Close(); return;
  545. }
  546. fbranchInfo.SeekToBegin();
  547. DWORD arraysize;
  548. fbranchInfo.Read(&arraysize, sizeof(DWORD));
  549. if (arraysize > 20)
  550. {
  551. fbranchInfo.Close();
  552. return;
  553. }
  554. BYTE *pData = new BYTE[leng - sizeof(DWORD)];
  555. fbranchInfo.Read(pData, leng - sizeof(DWORD));
  556. fbranchInfo.Close();
  557. CMemFile memfile;
  558. memfile.Attach(pData, leng - sizeof(DWORD));
  559. CArchive ar(&memfile, CArchive::load);
  560. AryBranchInfo.SetSize(arraysize, 1);
  561. for (int i = 0; i < AryBranchInfo.GetSize(); i++)
  562. {
  563. AryBranchInfo.ElementAt(i).Serialize(ar);
  564. }
  565. ar.Close();
  566. memfile.Detach();
  567. delete[]pData;
  568. // 4.存储为全局变量;
  569. for ( int i = 0; i < AryBranchInfo.GetSize(); i++)
  570. {
  571. CStringArray &strAry = AryBranchInfo.ElementAt(i);
  572. BOOL bExist = FALSE;
  573. vector<STBranchInfo>::iterator it;
  574. for ( it = g_vtBranchInfo.begin(); it != g_vtBranchInfo.end(); it++)
  575. {
  576. if (strAry.ElementAt(i).Compare(it->szBranchDoMain) == 0)
  577. {
  578. bExist = TRUE;
  579. break;
  580. }
  581. }
  582. if ( !bExist )
  583. {
  584. STBranchInfo tagBranchInfo;
  585. _stprintf_s(tagBranchInfo.szBranchDoMain,_T("%s"),strAry.ElementAt(0));
  586. _stprintf_s(tagBranchInfo.szBranchName,_T("%s"),strAry.ElementAt(1));
  587. _stprintf_s(tagBranchInfo.szBranchIP,_T("%s"),strAry.ElementAt(2));
  588. g_vtBranchInfo.push_back(tagBranchInfo);
  589. }
  590. }
  591. #endif
  592. }
  593. int FindPortEx(int start, BYTE *InByte, int InLen, char *OutPath)
  594. {
  595. int n;
  596. int ret;
  597. int D[8];
  598. double F[8];
  599. char s0[50] = "", s1[50] = "", s2[50] = "", s3[50] = "", s4[50] = "", s5[50] = "", s6[50] = "", s7[50] = "";
  600. CHAR KeyPath[MAX_PATH] = "";
  601. //查找系统上所有的锁;
  602. for (n = 0; n < 256; n++)
  603. {
  604. ZeroMemory(KeyPath, sizeof(KeyPath));
  605. ret = 0;//FindPort(n, KeyPath);
  606. if (ret != 0 && n == 0)return -1053;//表示系统上没有任何智能锁;
  607. if (ret != 0)return ret;
  608. #if 1
  609. sprintf_s(g_szKeyPath,"%s",KeyPath);
  610. #endif
  611. //使用该设备路径锁进行运算;
  612. // ret = CalEx(InByte, InLen, &D[0], &D[1], &D[2], &D[3], &D[4], &D[5], &D[6], &D[7],
  613. // &F[0], &F[1], &F[2], &F[3], &F[4], &F[5], &F[6], &F[7],
  614. // s0, s1, s2, s3, s4, s5, s6, s7, KeyPath, 20000);
  615. //如果正确,则返回该设备路径供以后使用;
  616. if (ret == -63)return ret;
  617. if ((ret == 0) && (D[0] == 123))return 0;
  618. }
  619. return -53;
  620. }
  621. int GetSoftWareVersion()
  622. {
  623. int nRet = 0;
  624. CHAR szUSBKeyPath[MAX_PATH] = "";
  625. for (int i(0); i < 6; i++)
  626. {
  627. nRet = FindPortEx(0, g_byShotVersion[i], 10, szUSBKeyPath);
  628. if (nRet == 0)
  629. {
  630. g_nVersion = i;
  631. break;
  632. }
  633. else
  634. {
  635. TCHAR szErrInfo[MAX_PATH] = _T("");
  636. GetUSBKey32ErrInfo(nRet,szErrInfo,MAX_PATH);
  637. }
  638. }
  639. if (nRet == 0 )
  640. {
  641. // 再获取本机加密狗的s1位置字符串;
  642. INT nUnit[8] = {0};
  643. double fUnit[8] = {0.0};
  644. char cUnit[8][50] = {""};
  645. // nRet = CalEx(g_byCalExVersion[g_nVersion],114,
  646. // &nUnit[0],&nUnit[1],&nUnit[2],&nUnit[3],&nUnit[4],&nUnit[5],&nUnit[6],&nUnit[7],
  647. // &fUnit[0],&fUnit[1],&fUnit[2],&fUnit[3],&fUnit[4],&fUnit[5],&fUnit[6],&fUnit[7],
  648. // cUnit[0],cUnit[1],cUnit[2],cUnit[3],cUnit[4],cUnit[5],cUnit[6],cUnit[7],
  649. // g_szKeyPath,200);
  650. if ( nRet == 0 || nRet == -43)
  651. {
  652. #if _DEBUG
  653. TRACE("加密狗S1:");
  654. TRACE(cUnit[1]);;
  655. TRACE("\n");
  656. #endif
  657. //LOG4C_NO_FILENUM((LOG_NOTICE,"本店域名:%s",cUnit[1]));
  658. USES_CONVERSION;
  659. _stprintf_s(g_szEncryS1,_T("%s"),A2W(cUnit[1]));
  660. }
  661. }
  662. return g_nVersion;
  663. }
  664. //------------------------------------------------------------------------------
  665. // Remark by Jeff 2014.11.05
  666. // 函数:GetUSBKey32ErrInfo
  667. // 描述:返回加密狗错误;
  668. // 参数:
  669. // lError:域天加密狗函数返回的错误码;
  670. // ErrorInfo:错误码描述缓冲区;
  671. // nErrorLen:错误码描述缓冲区大小;
  672. // 返回:无
  673. //
  674. //------------------------------------------------------------------------------
  675. void GetUSBKey32ErrInfo(IN const long lError, OUT TCHAR *ErrInfo, IN const INT_PTR &nErrorLen)
  676. {
  677. switch (lError)
  678. {
  679. case -1:
  680. StringCchCat(ErrInfo,nErrorLen, _T("未找到返回结果变量"));
  681. break;
  682. case -2:
  683. StringCchCat(ErrInfo,nErrorLen, _T("未找到 = 符号"));
  684. break;
  685. case -3:
  686. StringCchCat(ErrInfo,nErrorLen, _T("代表没有找到相应常数"));
  687. break;
  688. case -5:
  689. StringCchCat(ErrInfo,nErrorLen, _T("代表找不到字符串的第一个双引号"));
  690. break;
  691. case -6:
  692. StringCchCat(ErrInfo,nErrorLen, _T("代表找不到字符串的第二个双引号"));
  693. break;
  694. case -7:
  695. StringCchCat(ErrInfo,nErrorLen, _T("IF语句没有找到goto字符"));
  696. break;
  697. case -8:
  698. StringCchCat(ErrInfo,nErrorLen, _T("IF语句没有找到第一个比较字符"));
  699. break;
  700. case -9:
  701. StringCchCat(ErrInfo,nErrorLen, _T("IF语句没有找到比较符号"));
  702. break;
  703. case -10:
  704. StringCchCat(ErrInfo,nErrorLen, _T("两边变量类型不相符"));
  705. break;
  706. case -11:
  707. StringCchCat(ErrInfo,nErrorLen, _T("没有找到NOT符号"));
  708. break;
  709. case -12:
  710. StringCchCat(ErrInfo,nErrorLen, _T("不是整形变量"));
  711. break;
  712. case -13:
  713. StringCchCat(ErrInfo,nErrorLen, _T("代表没有找到相应整形常数"));
  714. break;
  715. case -14:
  716. StringCchCat(ErrInfo,nErrorLen, _T("代表没有找到相应字符串常数"));
  717. break;
  718. case -15:
  719. StringCchCat(ErrInfo,nErrorLen, _T("代表没有找到相应浮点常数"));
  720. break;
  721. case -16:
  722. StringCchCat(ErrInfo,nErrorLen, _T("代表不支持这个运算"));
  723. break;
  724. case -17:
  725. StringCchCat(ErrInfo,nErrorLen, _T("代表没有左边括号"));
  726. break;
  727. case -18:
  728. StringCchCat(ErrInfo,nErrorLen, _T("代表没有变量"));
  729. break;
  730. case -19:
  731. StringCchCat(ErrInfo,nErrorLen, _T("代表没“,”"));
  732. break;
  733. case -20:
  734. StringCchCat(ErrInfo,nErrorLen, _T("代表没有右边括号"));
  735. break;
  736. case -21:
  737. StringCchCat(ErrInfo,nErrorLen, _T("代表常数超过指这定的范围"));
  738. break;
  739. case -22:
  740. StringCchCat(ErrInfo,nErrorLen, _T("代表储存器的地址超过指定的范围,整数不能超过EEPROM_LEN-4,浮点不能超过30720-8"));
  741. break;
  742. case -23:
  743. StringCchCat(ErrInfo,nErrorLen, _T("代表储存器的地址超过指定的范围,字符串不能超过EEPROM_LEN-LEN,其中LEN为字符串的长度"));
  744. break;
  745. case -24:
  746. StringCchCat(ErrInfo,nErrorLen, _T("除法中,被除数不能为0"));
  747. break;
  748. case -25:
  749. StringCchCat(ErrInfo,nErrorLen, _T("未知错误"));
  750. break;
  751. case -26:
  752. StringCchCat(ErrInfo,nErrorLen, _T("第二个变量不在指定的位置"));
  753. break;
  754. case -27:
  755. StringCchCat(ErrInfo,nErrorLen, _T("字符串常量超过指定的长度"));
  756. break;
  757. case -28:
  758. StringCchCat(ErrInfo,nErrorLen, _T("不是字符串变量"));
  759. break;
  760. case -29:
  761. StringCchCat(ErrInfo,nErrorLen, _T("没有第三个变量"));
  762. break;
  763. case -30:
  764. StringCchCat(ErrInfo,nErrorLen, _T("GOTO的标识语句不能全为数字"));
  765. break;
  766. case -31:
  767. StringCchCat(ErrInfo,nErrorLen, _T("不能打开ENC文件"));
  768. break;
  769. case -32:
  770. StringCchCat(ErrInfo,nErrorLen, _T("不能读ENC文件"));
  771. break;
  772. case -33:
  773. StringCchCat(ErrInfo,nErrorLen, _T("GOTO CALL不能找到指定的跳转位置"));
  774. break;
  775. case -34:
  776. StringCchCat(ErrInfo,nErrorLen, _T("智能卡运算中,未知数据类型"));
  777. break;
  778. case -35:
  779. StringCchCat(ErrInfo,nErrorLen, _T("智能卡运算中,未知代码类型"));
  780. break;
  781. case -36:
  782. StringCchCat(ErrInfo,nErrorLen, _T("字符串长度超出50"));
  783. break;
  784. case -37:
  785. StringCchCat(ErrInfo,nErrorLen, _T("操作时超长,负长"));
  786. break;
  787. case -38:
  788. StringCchCat(ErrInfo,nErrorLen, _T("标识重复"));
  789. break;
  790. case -39:
  791. StringCchCat(ErrInfo,nErrorLen, _T("程序堆栈溢出"));
  792. break;
  793. case -40:
  794. StringCchCat(ErrInfo,nErrorLen, _T("堆栈溢出"));
  795. break;
  796. case -41:
  797. StringCchCat(ErrInfo,nErrorLen, _T("不能建立编译文件,请查看文件是否有只读属性,或被其它文件打开"));
  798. break;
  799. case -42:
  800. StringCchCat(ErrInfo,nErrorLen, _T("不能写文件,请查看文件是否有只读属性,或被其它文件打开"));
  801. break;
  802. case -43:
  803. StringCchCat(ErrInfo,nErrorLen, _T("程序被中途使用END语句结束"));
  804. break;
  805. case -44:
  806. StringCchCat(ErrInfo,nErrorLen, _T("程序跳转到外部的空间"));
  807. break;
  808. case -45:
  809. StringCchCat(ErrInfo,nErrorLen, _T("传送数据失败"));
  810. break;
  811. case -46:
  812. StringCchCat(ErrInfo,nErrorLen, _T("程序超出运算次数,可能是死循环"));
  813. break;
  814. case -47:
  815. StringCchCat(ErrInfo,nErrorLen, _T("写密码不正确"));
  816. break;
  817. case -48:
  818. StringCchCat(ErrInfo,nErrorLen, _T("读密码不正确"));
  819. break;
  820. case -49:
  821. StringCchCat(ErrInfo,nErrorLen, _T("读写EEPROM时,地址溢出"));
  822. break;
  823. case -50:
  824. StringCchCat(ErrInfo,nErrorLen, _T("USB操作失败,可能是没有找到相关的指令"));
  825. break;
  826. case -51:
  827. StringCchCat(ErrInfo,nErrorLen, _T("打开USB文件句柄失败"));
  828. break;
  829. case -52:
  830. StringCchCat(ErrInfo,nErrorLen, _T("使用加密锁加密自定义表达式,生成加密代码时生产错误"));
  831. break;
  832. case -53:
  833. StringCchCat(ErrInfo,nErrorLen, _T("无法打开usb设备,可能驱动程序没有安装或没有插入加密锁."));
  834. break;
  835. case -63:
  836. StringCchCat(ErrInfo,nErrorLen, _T("不能打开指定的文件"));
  837. break;
  838. case -64:
  839. StringCchCat(ErrInfo,nErrorLen, _T("不能建立指定的文件"));
  840. break;
  841. case -65:
  842. StringCchCat(ErrInfo,nErrorLen, _T(" 验证码错误,可能是输入解密密钥错误,或注册授权码错误"));
  843. break;
  844. case -66:
  845. StringCchCat(ErrInfo,nErrorLen, _T("执行TIMEOUT函数时,输入的ID与锁ID不相符"));
  846. break;
  847. case -67:
  848. StringCchCat(ErrInfo,nErrorLen, _T("执行TIMEOUT函数时,智能卡运行函数已到期"));
  849. break;
  850. case -68:
  851. StringCchCat(ErrInfo,nErrorLen, _T("操作浮点运算时,输入的参数将会导致返回值是一个无穷值"));
  852. break;
  853. case -69:
  854. StringCchCat(ErrInfo,nErrorLen, _T("代表没足够的变量参数"));
  855. break;
  856. case -70:
  857. StringCchCat(ErrInfo,nErrorLen, _T("返回变量与函数不相符"));
  858. break;
  859. case -71:
  860. StringCchCat(ErrInfo,nErrorLen, _T("浮点数转换字符串时,要转换的数据太大"));
  861. break;
  862. case -72:
  863. StringCchCat(ErrInfo,nErrorLen, _T("初始化服务器错误"));
  864. break;
  865. case -73:
  866. StringCchCat(ErrInfo,nErrorLen, _T("对缓冲区进行MD5运算时错误"));
  867. break;
  868. case -74:
  869. StringCchCat(ErrInfo,nErrorLen, _T("MD5验证IPVAR错误"));
  870. break;
  871. case -75:
  872. StringCchCat(ErrInfo,nErrorLen, _T("MD5验证IPCount错误"));
  873. break;
  874. case -76:
  875. StringCchCat(ErrInfo,nErrorLen, _T("没有找到对应的SOCKET连接"));
  876. break;
  877. case -77:
  878. StringCchCat(ErrInfo,nErrorLen, _T("没有找到要删除的对应的SOCKET连接"));
  879. break;
  880. case -78:
  881. StringCchCat(ErrInfo,nErrorLen, _T("没有找到要删除的对应的功能模块号连接"));
  882. break;
  883. case -79:
  884. StringCchCat(ErrInfo,nErrorLen, _T("没有找到要增加的对应的功能模块号连接"));
  885. break;
  886. case -80:
  887. StringCchCat(ErrInfo,nErrorLen, _T("用户数已超过限制的授权数量"));
  888. break;
  889. case -81:
  890. StringCchCat(ErrInfo,nErrorLen, _T("找不到对应的INI文件条目"));
  891. break;
  892. case -82:
  893. StringCchCat(ErrInfo,nErrorLen, _T("没有进行初始化服务工作"));
  894. break;
  895. case -252:
  896. StringCchCat(ErrInfo,nErrorLen, _T("密码不正确"));
  897. break;
  898. case -1088:
  899. StringCchCat(ErrInfo,nErrorLen, _T("发送数据错误"));
  900. break;
  901. case -1089:
  902. StringCchCat(ErrInfo,nErrorLen, _T("获取数据错误"));
  903. break;
  904. case -1092:
  905. StringCchCat(ErrInfo,nErrorLen, _T("找不到对应的服务端操作码"));
  906. break;
  907. case -1093:
  908. StringCchCat(ErrInfo,nErrorLen, _T("表示连接服务时错误"));
  909. break;
  910. case -1095:
  911. StringCchCat(ErrInfo,nErrorLen, _T("获取主机名称失败"));
  912. break;
  913. case -1097:
  914. StringCchCat(ErrInfo,nErrorLen, _T("建立套字接错误"));
  915. break;
  916. case -1098:
  917. StringCchCat(ErrInfo,nErrorLen, _T("绑定套字节端口错误"));
  918. break;
  919. case -1099:
  920. StringCchCat(ErrInfo,nErrorLen, _T("表示无效连接,不能进行相关的操作"));
  921. break;
  922. case -2002:
  923. StringCchCat(ErrInfo,nErrorLen, _T("表示监听时产生错误"));
  924. break;
  925. case -2003:
  926. StringCchCat(ErrInfo,nErrorLen, _T("表示发送的数据长度与接收的数据长度不相符"));
  927. break;
  928. case -2005:
  929. StringCchCat(ErrInfo,nErrorLen, _T("表示当前服务不存在任何连接"));
  930. break;
  931. case -2006:
  932. StringCchCat(ErrInfo,nErrorLen, _T("表示当前查询节点超出集合范范围"));
  933. break;
  934. case -2009:
  935. StringCchCat(ErrInfo,nErrorLen, _T("表示关闭连接错误"));
  936. break;
  937. case -1052:
  938. StringCchCat(ErrInfo,nErrorLen, _T("可能是输入的授权号不正确"));
  939. break;
  940. case -1053:
  941. StringCchCat(ErrInfo,nErrorLen, _T("系统上没有任何智能锁"));
  942. break;
  943. default:
  944. StringCchCat(ErrInfo,nErrorLen, _T("未知错误代码"));
  945. }
  946. }
  947. //////////////////////////////////////////////////////////////////////////