SNRegister.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #pragma once
  2. #ifndef _TRYTO_SNREGISTER_HEAD
  3. #define _TRYTO_SNREGISTER_HEAD
  4. #include <afx.h>
  5. class CSNRegister:public CObject
  6. {
  7. enum{CREATE,OPEN};
  8. void ClearAll();
  9. char m_sztemp[1024];
  10. public:
  11. CSNRegister();
  12. ~CSNRegister();
  13. private:
  14. BOOL Load(const char *&pStrDirectroy);
  15. void Store(const char *&pStrDirectroy);
  16. virtual void Serialize(CArchive& ar);
  17. void encrypt(
  18. char *byCode,
  19. char *bySn,
  20. char *byUseTime,
  21. char *byPName,
  22. char *byStartTime,
  23. char *byEndTime,
  24. char *byLeftTime);
  25. void decrypt(
  26. char *byCode,
  27. char *bySn,
  28. char *byUseTime,
  29. char *byPName,
  30. char *byStartTime,
  31. char *byEndTime,
  32. char *byLeftTime);
  33. void ShowCihper(BYTE *rtext,long len);
  34. void HalfByteToByte(BYTE *rin,BYTE *rout, long len);
  35. int GetCheck(BOOL btype);
  36. void GetByteSum(DWORD &dwSum, CString &strSrc);
  37. public:
  38. BOOL itf_read_snfile(const char *szfile);
  39. BOOL itf_create_snfile(
  40. const char *szfile,
  41. char *byCode,
  42. char *bySn,
  43. char *byUseTime,
  44. char *byPName,
  45. char *byStartTime,
  46. char *byEndTime,
  47. char *byLeftTime);
  48. BOOL itf_modify_snfile(
  49. const char *szfile,
  50. char *byCode,
  51. char *bySn,
  52. char *byUseTime,
  53. char *byPName,
  54. char *byStartTime,
  55. char *byEndTime,
  56. char *byLeftTime);
  57. public:
  58. BOOL itf_IsCorrectSN(const char *szfile);
  59. void itf_SavebyLTime(const DWORD &dwLTime,const char *szPath);
  60. DWORD itf_returnLeftTime();
  61. char *itf_returnSnCode();
  62. char *itf_returnCheckCode();
  63. char *itf_encrypt(char *szSrc);
  64. char *itf_decrypt(char *szSrc);
  65. public:
  66. CString m_strStart; // 起始符; 7F;
  67. CString m_strCode; // 128位特征码,防伪,实码64位;
  68. CString m_strSn; // 48位加密SN码,实码18位;
  69. CString m_strUseTime; // 使用时间;
  70. CString m_strPName; // 项目名称;
  71. CString m_strStartTime; // 建成时间;
  72. CString m_strEndTime; // 完成时间;
  73. CString m_strLeftTime; // 剩余时间;
  74. CString m_strCheck; // 校验码;
  75. CString m_strEndof; // 终止符; 0D;
  76. };
  77. #endif