d4db70a45afc96b4d2d9900be6c91e84e0b42403.svn-base 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Threading;
  5. namespace IControls_FireManager
  6. {
  7. // 동글키 프로젝트
  8. // https://support.microsoft.com/ko-kr/kb/2478964
  9. public static class _RockeyDll
  10. {
  11. enum Ry4Cmd : ushort
  12. {
  13. RY_FIND = 1,
  14. RY_FIND_NEXT,
  15. RY_OPEN,
  16. RY_CLOSE,
  17. RY_READ,
  18. RY_WRITE,
  19. RY_RANDOM,
  20. RY_SEED,
  21. RY_WRITE_USERID,
  22. RY_READ_USERID,
  23. RY_SET_MOUDLE,
  24. RY_CHECK_MOUDLE,
  25. RY_WRITE_ARITHMETIC,
  26. RY_CALCULATE1,
  27. RY_CALCULATE2,
  28. RY_CALCULATE3,
  29. RY_DECREASE
  30. };
  31. enum Ry4ErrCode : uint
  32. {
  33. ERR_SUCCESS = 0,
  34. ERR_NO_PARALLEL_PORT = 0x80300001,
  35. ERR_NO_DRIVER,
  36. ERR_NO_ROCKEY,
  37. ERR_INVALID_PASSWORD,
  38. ERR_INVALID_PASSWORD_OR_ID,
  39. ERR_SETID,
  40. ERR_INVALID_ADDR_OR_SIZE,
  41. ERR_UNKNOWN_COMMAND,
  42. ERR_NOTBELEVEL3,
  43. ERR_READ,
  44. ERR_WRITE,
  45. ERR_RANDOM,
  46. ERR_SEED,
  47. ERR_CALCULATE,
  48. ERR_NO_OPEN,
  49. ERR_OPEN_OVERFLOW,
  50. ERR_NOMORE,
  51. ERR_NEED_FIND,
  52. ERR_DECREASE,
  53. ERR_AR_BADCOMMAND,
  54. ERR_AR_UNKNOWN_OPCODE,
  55. ERR_AR_WRONGBEGIN,
  56. ERR_AR_WRONG_END,
  57. ERR_AR_VALUEOVERFLOW,
  58. ERR_UNKNOWN = 0x8030ffff,
  59. ERR_RECEIVE_NULL = 0x80300100,
  60. ERR_PRNPORT_BUSY = 0x80300101
  61. };
  62. public static bool DonggleCheck()
  63. {
  64. byte[] buffer = new byte[1000];
  65. ushort handle = 0;
  66. ushort function = 1;
  67. ushort p1 = 0;
  68. ushort p2 = 0;
  69. ushort p3 = 0;
  70. ushort p4 = 0;
  71. uint lp1 = 0;
  72. uint lp2 = 0;
  73. int iMaxRockey = 0;
  74. uint[] uiarrRy4ID = new uint[32];
  75. p1 = 0xdaf8; p2 = 0x152a; p3 = 0xeaef; p4 = 0xe51a;
  76. Rockey4NDClass.Rockey4ND R4nd = new Rockey4NDClass.Rockey4ND();
  77. R4nd.Rockey(function, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer);
  78. ushort ret = R4nd.Rockey((ushort)Ry4Cmd.RY_FIND, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer);
  79. uiarrRy4ID[iMaxRockey] = lp1;
  80. iMaxRockey++;
  81. if (lp1 < 1)
  82. {
  83. Console.WriteLine("Not Found Rockey4ND!");
  84. return false;
  85. }
  86. else
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. }