123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading;
- namespace IControls_FireManager
- {
- // 동글키 프로젝트
- // https://support.microsoft.com/ko-kr/kb/2478964
- public static class _RockeyDll
- {
- enum Ry4Cmd : ushort
- {
- RY_FIND = 1,
- RY_FIND_NEXT,
- RY_OPEN,
- RY_CLOSE,
- RY_READ,
- RY_WRITE,
- RY_RANDOM,
- RY_SEED,
- RY_WRITE_USERID,
- RY_READ_USERID,
- RY_SET_MOUDLE,
- RY_CHECK_MOUDLE,
- RY_WRITE_ARITHMETIC,
- RY_CALCULATE1,
- RY_CALCULATE2,
- RY_CALCULATE3,
- RY_DECREASE
- };
- enum Ry4ErrCode : uint
- {
- ERR_SUCCESS = 0,
- ERR_NO_PARALLEL_PORT = 0x80300001,
- ERR_NO_DRIVER,
- ERR_NO_ROCKEY,
- ERR_INVALID_PASSWORD,
- ERR_INVALID_PASSWORD_OR_ID,
- ERR_SETID,
- ERR_INVALID_ADDR_OR_SIZE,
- ERR_UNKNOWN_COMMAND,
- ERR_NOTBELEVEL3,
- ERR_READ,
- ERR_WRITE,
- ERR_RANDOM,
- ERR_SEED,
- ERR_CALCULATE,
- ERR_NO_OPEN,
- ERR_OPEN_OVERFLOW,
- ERR_NOMORE,
- ERR_NEED_FIND,
- ERR_DECREASE,
- ERR_AR_BADCOMMAND,
- ERR_AR_UNKNOWN_OPCODE,
- ERR_AR_WRONGBEGIN,
- ERR_AR_WRONG_END,
- ERR_AR_VALUEOVERFLOW,
- ERR_UNKNOWN = 0x8030ffff,
- ERR_RECEIVE_NULL = 0x80300100,
- ERR_PRNPORT_BUSY = 0x80300101
- };
- public static bool DonggleCheck()
- {
- byte[] buffer = new byte[1000];
- ushort handle = 0;
- ushort function = 1;
- ushort p1 = 0;
- ushort p2 = 0;
- ushort p3 = 0;
- ushort p4 = 0;
- uint lp1 = 0;
- uint lp2 = 0;
- int iMaxRockey = 0;
- uint[] uiarrRy4ID = new uint[32];
- p1 = 0xdaf8; p2 = 0x152a; p3 = 0xeaef; p4 = 0xe51a;
- Rockey4NDClass.Rockey4ND R4nd = new Rockey4NDClass.Rockey4ND();
- R4nd.Rockey(function, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer);
- ushort ret = R4nd.Rockey((ushort)Ry4Cmd.RY_FIND, ref handle, ref lp1, ref lp2, ref p1, ref p2, ref p3, ref p4, buffer);
- uiarrRy4ID[iMaxRockey] = lp1;
- iMaxRockey++;
- if (lp1 < 1)
- {
- Console.WriteLine("Not Found Rockey4ND!");
- return false;
- }
- else
- {
- return true;
- }
- }
- }
- }
|