my32.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. #include <winsock.h>
  2. // The following ifdef block is the standard way of creating macros which make exporting
  3. // from a DLL simpler. All files within this DLL are compiled with the MY32_EXPORTS
  4. // symbol defined on the command line. this symbol should not be defined on any project
  5. // that uses this DLL. This way any other project whose source files include this file see
  6. // MY32_API functions as being imported from a DLL, wheras this DLL sees symbols
  7. // defined with this macro as being exported.
  8. #if _MSC_VER >= 1800
  9. #pragma comment(linker, "/NODEFAULTLIB:libc.lib")
  10. #pragma comment(linker, "/NODEFAULTLIB:libcp.lib")
  11. #endif
  12. extern "C"
  13. {
  14. int __stdcall FindPort(int start, char *OutPath);
  15. int __stdcall FindPort_2(int start, BYTE *InByte, int InLen, char *OutPath);
  16. int __stdcall SetWritePassword(char *W_HKey, char *W_LKey, char *New_HKey, char *New_LKey, char *KeyPath);
  17. int __stdcall SetReadPassword(char *W_HKey, char *W_LKey, char *New_HKey, char *New_LKey, char *KeyPath);
  18. int __stdcall GetRetVar(int *D0, int *D1, int *D2, int *D3, int *D4, int *D5, int *D6, int *D7,
  19. double *F0, double *F1, double *F2, double *F3, double *F4, double *F5, double *F6, double *F7,
  20. char *S0, char *S1, char *S2, char *S3, char *S4, char *S5, char *S6, char *S7, char *KeyPath);
  21. int __stdcall WriteEncKey(char *Old_F_HKey, char *Old_F_LKey, char *Old_S_HKey, char *Old_S_LKey,
  22. char *New_F_HKey, char *New_F_LKey, char *New_S_HKey, char *New_S_LKey, char *KeyPath);
  23. int __stdcall MakeEncFile(char *InbinFile, char *KeyPath);
  24. int __stdcall TranfserVar(int *D0, int *D1, int *D2, int *D3, int *D4, int *D5, int *D6, int *D7,
  25. double *F0, double *F1, double *F2, double *F3, double *F4, double *F5, double *F6, double *F7,
  26. char *S0, char *S1, char *S2, char *S3, char *S4, char *S5, char *S6, char *S7, char *KeyPath);
  27. int __stdcall YtTranfser(BYTE *InByte, int in_len, int over_count, BOOL IsPub, char *KeyPath);
  28. int __stdcall CalEx(BYTE *InByte, int in_len, int *D0, int *D1, int *D2, int *D3, int *D4, int *D5, int *D6, int *D7,
  29. double *F0, double *F1, double *F2, double *F3, double *F4, double *F5, double *F6, double *F7,
  30. char *S0, char *S1, char *S2, char *S3, char *S4, char *S5, char *S6, char *S7, char *KeyPath, int over_count);
  31. int __stdcall CalExByFile(char *InFile, int *D0, int *D1, int *D2, int *D3, int *D4, int *D5, int *D6, int *D7,
  32. double *F0, double *F1, double *F2, double *F3, double *F4, double *F5, double *F6, double *F7,
  33. char *S0, char *S1, char *S2, char *S3, char *S4, char *S5, char *S6, char *S7, char *KeyPath, int over_count);
  34. int __stdcall YtWriteFloat(double indata, short add, char *HKey, char *LKey, char *KeyPath);
  35. int __stdcall YtWriteLong(int indata, short add, char *HKey, char *LKey, char *KeyPath);
  36. int __stdcall YtWriteEx(BYTE *InBuf, short add, short len, char *HKey, char *LKey, char *KeyPath);
  37. int __stdcall YtReadFloat(double *OutData, short add, char *HKey, char *LKey, char *KeyPath);
  38. int __stdcall YtReadLong(int *OutData, short add, char *HKey, char *LKey, char *KeyPath);
  39. int __stdcall YtReadEx(short add, short len, char *HKey, char *LKey, BYTE *dataout_buf, char *KeyPath);
  40. int __stdcall YtReadSting(char *OutString, short add, short len, char *HKey, char *LKey, char *KeyPath);
  41. int __stdcall YtWriteString(char *InString, short add, char *HKey, char *LKey, char *KeyPath);
  42. //取素数对
  43. int __stdcall GetPRIME(BYTE *p, BYTE *q, int m_len, char *KeyPath);
  44. //取密钥对
  45. int __stdcall GetRSAKey(BYTE *n, BYTE *e, BYTE *d, int m_len, char *KeyPath);
  46. //取密钥对,并返回对私钥进行加密的3DES密钥
  47. int __stdcall GetRSAKey_2(BYTE *n, BYTE *d, int m_len, char *Key_1, char *Key_2, char *Key_3, char *Key_4, char *KeyPath);
  48. //输入私钥对输入的数据进行加密
  49. int __stdcall YT_RSA_1(BYTE*e, BYTE *n, BYTE *InBuf, short len, char *KeyPath);
  50. //使用储存在加密锁中的私钥对输入的数据进行解密
  51. int __stdcall YT_RSA_2(short e_Addr, short n_Addr, BYTE *InBuf, short len, char *KeyPath);
  52. //使用输入的3DES密钥对储存在加密锁中的私钥进行解密后,再使用解密后的私钥对输入的数据进行解密
  53. int __stdcall YT_RSA_3(char *Key_1, char *Key_2, char *Key_3, char *Key_4, short Addr, BYTE *InBuf, short len, BOOL flag, char *KeyPath);
  54. //初始化3DES密钥
  55. int __stdcall YT_IniKey(char *KeyPath);
  56. //输入3des密钥对输入的数据进行加解密
  57. int __stdcall YT_3DES_1(char *Key_1, char *Key_2, char *Key_3, char *Key_4,
  58. BYTE *InBuf, short len, BOOL IsEnc, char *KeyPath);
  59. //使用储存在加密锁中的3DES对输入的数据进行加解密
  60. int __stdcall YT_3DES_2(short Addr, BYTE *InBuf, short len, BOOL flag, char *KeyPath);
  61. //使用储存在加密锁中的3DES及输入的3DES混合后对输入的数据进行加解密
  62. int __stdcall YT_3DES_3(char *Key_1, char *Key_2, char *Key_3, char *Key_4, short Addr, BYTE *InBuf, short len, BOOL flag, char *KeyPath);
  63. //字符串转化为字节数组
  64. void __stdcall StringToByteArray(char * InString, BYTE *out_data);
  65. //字节数组转化为16进制字符串
  66. void __stdcall ByteArrayToHexString(BYTE *in_data, char * OutString, int len);
  67. //取字符串的长度
  68. int __stdcall GetStringLenByByte(char * InString);
  69. //16进制字符串转化为数组
  70. void __stdcall HexStringToByteArray(char * InString, BYTE *in_data);
  71. //字节数组转化为字符串
  72. void __stdcall ByteArrayToString(char * OutString, BYTE *in_data, int m_len);
  73. BOOL __stdcall ComPareBigLong(BYTE*n, BYTE *a, short len);
  74. void __stdcall HexStringToByteArray_2(char * InString, BYTE *in_data);
  75. int __stdcall YtMd5ByFile(char *InFile, char *OutString, char *KeyPath);
  76. int __stdcall YtMd5ByFile_2(char *InFile, short Addr, char *KeyPath);
  77. int __stdcall YtMd5ByFile_3(char *InFile, short Addr, BOOL *biao, char *KeyPath);
  78. int __stdcall GetIDVersion(DWORD *ID, int *version, char *KeyPath);
  79. int __stdcall GetLongID(BYTE *OutLongIDByArray, char *OutLongIDByChar, char *KeyPath);
  80. int __stdcall WriteLimitTimes(char *Key1, char *Key2, char *Key3, char *Key4,
  81. DWORD SetTimes, char *KeyPath);
  82. int __stdcall WriteHostKey(char *Old_Key1, char *Old_Key2, char *Old_Key3, char *Old_Key4,
  83. char *New_Key1, char *New_Key2, char *New_Key3, char *New_Key4, char *KeyPath);
  84. int __stdcall GetLimitTimes(DWORD *OutTimes, char *KeyPath);
  85. // int __stdcall WriteYinZhi(char *Old_Key1,char *Old_Key2,char *Old_Key3,char *Old_Key4,
  86. // char *New_Key1,char *New_Key2,char *New_Key3,char *New_Key4,char *KeyPath);
  87. int __stdcall GetAlreadyTimes(DWORD *OutTimes, char *KeyPath);
  88. // int __stdcall MakeRemoteAuth(char *Key1,char *Old_Key2,char *Old_Key3,char *Old_Key4,
  89. // char *New_Key1,char *New_Key2,char *New_Key3,char *New_Key4,char *KeyPath);
  90. int __stdcall MakeEncFileByPublic(char *Key1, char *Key2, char *Key3, char *Key4,
  91. char *InbinFile, char *KeyPath);
  92. int __stdcall MakeAuthCode(char *Dev_Key1, char *Dev_Key2, char *Dev_Key3, char *Dev_Key4,
  93. char *LongKey, char *OutAuth, char *KeyPath);
  94. int __stdcall EdcByFile(char *Key,
  95. char *InbinFile, char *OutbinFile, char *KeyPath);
  96. int __stdcall CalPub(BYTE *InByte, int in_len, int *D0, int *D1, int *D2, int *D3, int *D4, int *D5, int *D6, int *D7,
  97. double *F0, double *F1, double *F2, double *F3, double *F4, double *F5, double *F6, double *F7,
  98. char *S0, char *S1, char *S2, char *S3, char *S4, char *S5, char *S6, char *S7, char *KeyPath, int over_count);
  99. int __stdcall CalPubByFile(char *InFile, int *D0, int *D1, int *D2, int *D3, int *D4, int *D5, int *D6, int *D7,
  100. double *F0, double *F1, double *F2, double *F3, double *F4, double *F5, double *F6, double *F7,
  101. char *S0, char *S1, char *S2, char *S3, char *S4, char *S5, char *S6, char *S7, char *KeyPath, int over_count);
  102. void __stdcall GetAppPath(char *OutAppPath);
  103. void __stdcall ConvertTimerToString(DWORD h_timer, DWORD l_timer, char *Year, char *Month, char *Day, char *Hour, char *Minuts, char *Second);
  104. int __stdcall GetRunTimer(char *Year, char *Month, char *Day, char *Hour, char *Minuts, char *Second, char *KeyPath);
  105. int __stdcall MakeTimerAuth(char *Key, DWORD ID, char *Year, char *Month, char *Day,
  106. char *Hour, char *Minuts, char *OutString, char *KeyPath);
  107. void __stdcall ConvertStringToTimer(DWORD *out_h_timer, DWORD *out_l_timer, char *Year,
  108. char *Month, char *Day, char *Hour, char *Minuts);
  109. DWORD __stdcall HexToInt(char* s);
  110. int __stdcall MakeTimerAuth_2(char *Key, DWORD ID, char *Year,
  111. char *Month, char *Day, char *Hour, char *Minuts,
  112. char *Add_Year, char *Add_Month, char *Add_Day, int bili,
  113. char *OutString, char *KeyPath, char *OutYear,
  114. char *OutMonth, char *OutDay, char *OutHour, char *OutMinuts);
  115. int __stdcall GetLeaveTimer(char *Year, char *Month, char *Day, char *Hour, char *Minuts, int *OutStatus,
  116. char *OutYear, char *OutMonth, char *OutDay, char *OutHour, char *OutMinuts, char *KeyPath);
  117. int __stdcall RemoteAuth(BYTE *InBuf, char *KeyPath);
  118. int __stdcall Yt3DesByKeyArray(char *KeyBuf,
  119. BYTE *InBuf, short len, BOOL IsEnc, char *KeyPath);
  120. BOOL __stdcall GetAuthFromFile(char *InFile, char *HKey, char *LKey, char *OutSetTime, DWORD *id);
  121. BOOL __stdcall ComPareTime(char *Year, char *Month, char *Day, char *Hour, char *Minuts, char *Second,
  122. char *Year_2, char *Month_2, char *Day_2, char *Hour_2, char *Minuts_2, char *Second_2,
  123. char *OutYear, char *OutMonth, char *OutDay, char *OutHour, char *OutMinuts, char *OutSecond);
  124. BOOL __stdcall WriteIniSetting(char *FileName, char *HKey, char *LKey, char *Time, DWORD id);
  125. int __stdcall ReadKeyFormEpm(char *OutAuthCode, int Addr, char *HKey, char *LKey, char *KeyPath);
  126. void __stdcall ConvertTimerToStringReal(DWORD InTimer, char *Year, char *Month, char *Day, char *Hour, char *Minuts, char *Second);
  127. DWORD __stdcall ConvertStringToTimerReal(char *Year, char *Month, char *Day, char *Hour, char *Minuts, char *Second);
  128. int __stdcall YTRSAUpdateData(char *Key_1, char *Key_2, char *Key_3, char *Key_4, char *LongKey,
  129. DWORD shortid, int InLongData, char *InString_1, char *InString_2,
  130. char *OutAuth, CHAR *VerfCode, char *KeyPath);
  131. int __stdcall WriteTimeLimitTimes(char *Key1, char *Key2, char *Key3, char *Key4,
  132. DWORD SetTimes, char *KeyPath);
  133. int __stdcall GetTimeAlreadyTimes(DWORD *OutTimes, char *KeyPath);
  134. int __stdcall GetTimeLimitTimes(DWORD *OutTimes, char *KeyPath);
  135. int __stdcall WriteTimeAuthToEprom(int addr, char *W_HKey, char *W_LKey, char *Key_1, char *Key_2,
  136. DWORD ID, char *Year, char *Month,
  137. char *Day, char *Hour, char *Minuts, char *KeyPath);
  138. int __stdcall ReadTimeAuthFromEprom(char *HKey, char *LKey, char *OutSetTime, DWORD *id, int addr, char *R_HKey, char *R_LKey, char *KeyPath);
  139. BOOL __stdcall GetAuthFromFile_Pub(char *InFile, char *PARAM1, char *PARAM2, char *PARAM3,
  140. char *PARAM4, char *PARAM5, char *PARAM6, char *OutSetTime, DWORD *id);
  141. int __stdcall ConvertStringToTimerRealEx(DWORD m_year, DWORD m_month, DWORD m_day, DWORD m_hour,
  142. DWORD m_minuts, DWORD m_second);
  143. int __stdcall GetSystemTimeByLong();
  144. int __stdcall ConnectServer(char *ServerName, int Port);
  145. int __stdcall ConnectServerEx(char *ServerName, int Port, DWORD *OutIP, DWORD *OutSockect);
  146. int __stdcall DisconnectServer();
  147. int __stdcall StartServer(int Port);
  148. int __stdcall StopServer();
  149. int __stdcall GetMachineCount();
  150. int __stdcall GetClientCount();
  151. int __stdcall GetAllowClientCount();
  152. void __stdcall SetInfoMode(int in_mode);
  153. int __stdcall GetInfoMode();
  154. int __stdcall SetRestrictMode(int ModeFlag);
  155. int __stdcall GetRestrictMode();
  156. int __stdcall GetConnectLastError(char *ErrorInfo);
  157. int __stdcall GetIP(int count, char *OutIP);
  158. int __stdcall GetNetBoisID(int count, char *OutNetBoisID, SOCKET *OutSocket);
  159. int __stdcall GetSystemDateTime(char *OutSystemDateTime);
  160. int __stdcall GetConnectComputerInfo(int count, char *OutIP, char *ComputerName, char *OutNetBoisID, char *LastTime, DWORD *m_socket, BOOL IsALL);
  161. int __stdcall GetConnectComputerInfoByFunNum(char InFunNum, int count, char *OutIP, char *ComputerName, char *OutNetBoisID, char *LastTime, DWORD *m_socket, BOOL IsALL);
  162. int __stdcall SendString(char *InString);
  163. void __stdcall SetInfoHwnd(HWND in_hwnd);
  164. HWND __stdcall GetInfoHwnd();
  165. int __stdcall GetLocalIP(char *LocalIP);
  166. void __stdcall SetFileNotReadOnly(char *s1);
  167. void __stdcall SetVfpOverCount(DWORD over_count);
  168. void __stdcall SetVfpKeyPath(char *KeyPath);
  169. int __stdcall VfpCalExByFile(char *InFile, int *D0, int *D1, int *D2, int *D3, int *D4, int *D5, int *D6, int *D7,
  170. double *F0, double *F1, double *F2, double *F3, double *F4, double *F5, double *F6, double *F7,
  171. char *S0, char *S1, char *S2, char *S3, char *S4, char *S5, char *S6, char *S7);
  172. int __stdcall VfpCalPubByFile(char *InFile, int *D0, int *D1, int *D2, int *D3, int *D4, int *D5, int *D6, int *D7,
  173. double *F0, double *F1, double *F2, double *F3, double *F4, double *F5, double *F6, double *F7,
  174. char *S0, char *S1, char *S2, char *S3, char *S4, char *S5, char *S6, char *S7);
  175. int __stdcall GetFunCount();
  176. int __stdcall GetFunNum(char pos);
  177. short __stdcall GetIpCountByFunNum(char FunNum);
  178. short __stdcall GetConCountByFunNum(char FunNum);
  179. short __stdcall GetConCountByIpFun(char FunNum, char *m_ip);
  180. int __stdcall IniStartServer(char *KeyPath);
  181. int __stdcall GetSetCountEx(short Addr, int *count, BOOL *IsMachine, char *OutFun, char *OutVerfCode, char *KeyPath);
  182. int __stdcall GetSetCount(short Addr, int *count, BOOL *IsMachine, char *OutFum, char *KeyPath);
  183. int __stdcall GetSetCountByFile(char *InFile, int *count, BOOL *IsMachine, char *OutFum, BOOL IsWriteToKey);
  184. int __stdcall YTRSAUpdateData_2(char *Key_1, char *Key_2, char *Key_3, char *Key_4, char *LongKey,
  185. DWORD shortid, int InLongData, BOOL IsMachine, char InFun, BYTE *OutBuf,
  186. char *OutAuth, char *VerfCode, char *KeyPath);
  187. short __stdcall AddConnectEx(BYTE InFunNum, short Addr, BOOL IfClose, char *KeyPath);
  188. int __stdcall CloseSocketByHandle(DWORD m_socket);
  189. void __stdcall GetServerPath(char *OutAppPath);
  190. int __stdcall GetTimerFromAuth(char *AuthString, char *Key, DWORD *ID, char *Year, char *Month,
  191. char *Day, char *Hour, char *Minuts, char *Second,
  192. char *KeyPath);
  193. HWND __stdcall GetEventHwnd();
  194. void __stdcall SetEventHwnd(HWND in_hwnd);
  195. int __stdcall WritePubTimeAuthToEprom(int addr, char *W_HKey, char *W_LKey,
  196. char *PARAM1, char *PARAM2, char *PARAM3,
  197. char *PARAM4, char *PARAM5, char *PARAM6,
  198. DWORD ID, char *Year, char *Month,
  199. char *Day, char *Hour, char *Minuts, char *Sec, char *KeyPath);
  200. int __stdcall ReadPubTimeAuthFromEprom(char *PARAM1, char *PARAM2, char *PARAM3,
  201. char *PARAM4, char *PARAM5, char *PARAM6,
  202. char *OutSetTime, DWORD *id, int addr, char *R_HKey, char *R_LKey,
  203. char *KeyPath);
  204. int __stdcall WriteNetAuthToEpmEx(int Addr, char *param1, char *param2, char *param3,
  205. char *param4, char *param5, char *param6,
  206. char *HKey, char *LKey, char *KeyPath);
  207. int __stdcall YtReadString(char *OutString, short add, short len, char *HKey, char *LKey, char *KeyPath);
  208. short __stdcall AddConnectNew(BYTE InFunNum, short Addr, BOOL IfClose, char *OutVerfCode, char *KeyPath);
  209. BOOL __stdcall EdccBin(char *Key,
  210. BYTE *InByte, int in_len, char *OutErrCode, char *KeyPath);
  211. void __stdcall StringToDword(DWORD *d0, DWORD *d1, DWORD *d2, char *InString);
  212. void __stdcall DwordToString(char *InString, DWORD d0);
  213. int __stdcall YtMd5(BYTE *InBuf, int m_len, char *OutString, char *KeyPath);
  214. int __stdcall YtMd5_2(BYTE *InBuf, int m_len, short Addr, char *KeyPath);
  215. int __stdcall YtMd5_3(BYTE *InBuf, int m_len, short Addr, BOOL *biao, char *KeyPath);
  216. //2008-2-16
  217. void __stdcall AutoDisConnect(DWORD timer, BOOL biao);
  218. typedef short(*OnMyConnect)(char *IP, char *ComputerName, char *NetBoisID, DWORD m_socket);
  219. void __stdcall SetCallBackFun(OnMyConnect FunConnec);
  220. // 初始化加密锁工具;
  221. int __stdcall ReSet(char *Keypath);
  222. }