_RockeyDll2.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 _RockeyDll2
  10. {
  11. [System.Runtime.InteropServices.DllImport("Ry4S.dll")]
  12. static extern ushort Rockey(ushort function, out ushort handle, out uint lp1, out uint lp2,
  13. out ushort p1, out ushort p2, out ushort p3, out ushort p4, byte[] buffer);
  14. const ushort RY_FIND = 1;
  15. const ushort RY_FIND_NEXT = 2;
  16. const ushort RY_OPEN = 3;
  17. const ushort RY_CLOSE = 4;
  18. const ushort RY_READ = 5;
  19. const ushort RY_WRITE = 6;
  20. const ushort RY_RANDOM = 7;
  21. const ushort RY_SEED = 8;
  22. const ushort RY_WRITE_USERID = 9;
  23. const ushort RY_READ_USERID = 10;
  24. const ushort RY_SET_MOUDLE = 11;
  25. const ushort RY_CHECK_MOUDLE = 12;
  26. const ushort RY_WRITE_ARITHMETIC = 13;
  27. const ushort RY_CALCULATE1 = 14;
  28. const ushort RY_CALCULATE2 = 15;
  29. const ushort RY_CALCULATE3 = 16;
  30. const ushort RY_DECREASE = 17;
  31. const ushort RY_DES_ENC = 42;
  32. const ushort RY_GET_TIMER_EX = 0xA3;
  33. public static ushort[] m_Handle = new ushort[32];
  34. public static int m_HandleNum = 0;
  35. public static bool DonggleCheck()
  36. {
  37. ushort ret;
  38. ushort p1, p2, p3, p4;
  39. uint lp1, lp2;
  40. byte[] buffer = new byte[1024];
  41. p1 = 0xC44C;
  42. p2 = 0xC8F8;
  43. p3 = 0x799;
  44. p4 = 0xC43B;
  45. /*
  46. p1 = 0xF16D;
  47. p2 = 0xB0E4;
  48. p3 = 0xCBC7;
  49. p4 = 0x1457;
  50. */
  51. ret = Rockey(RY_FIND, out m_Handle[0], out lp1, out lp2, out p1, out p2, out p3, out p4, buffer);
  52. if (ret != 0)
  53. {
  54. Console.WriteLine("Not Found Rockey4SmartND!");
  55. return false;
  56. }
  57. else
  58. {
  59. // "HID: " + lp1.ToString("X") + "\r\n";
  60. return true;
  61. }
  62. }
  63. }
  64. }