Rockey dongle Delphi API

The following constant have defined in Rydp32.dcu, you can use directly

RY_FIND                        	=1 ;		{Find Dongle}
RY_FIND_NEXT			=2 ;		{Find Next Dongle}
RY_OPEN                        	=3 ;		{Open Dongle}
RY_CLOSE                       	=4 ;		{Close Dongle}
RY_READ                        	=5 ;		{Read Dongle}
RY_WRITE                       	=6 ;		{Write Dongle}
RY_RANDOM                      	=7 ;		{Generate Random Number}
RY_SEED                      	=8 ;		{Generate Seed Code}
RY_WRITE_USERID			=9 ;		{Write User ID}
RY_READ_USERID			=10;		{Read User ID}
RY_SET_MOUDLE		 	=11;		{Set Module}
RY_CHECK_MOUDLE		     	=12;		{Check Module}
RY_WRITE_ARITHMETIC            	=13;		{Write Arithmetic}
RY_CALCULATE1		       	=14;		{Calculate 1}
RY_CALCULATE2		       	=15;		{Calculate 2}
RY_CALCULATE3		       	=16;		{Calculate 3}
RY_DECREASE		       	=17;		{Decrease Module Unit}

{Error Code}
ERR_SUCCESS			=0;		{Success}
ERR_NO_PARALLEL_PORT		=1;		{No parallel port on the computer}
ERR_NO_DRIVER			=2;		{No install drivers}
ERR_NO_ROCKEY	                =3;		{No rockey dongle}
ERR_INVALID_PASSWORD		=4;		{Found rockey dongle, but base password is wrong}
ERR_INVALID_PASSWORD_OR_ID 	=5;		{Wrong password or rockey HID}
ERR_SETID			=6;		{Set rockey HID wrong}
ERR_INVALID_ADDR_OR_SIZE	=7;		{Read/Write address is wrong}
ERR_UNKNOWN_COMMAND        	=8;		{No such command}
ERR_NOTBELEVEL3		      	=9;		{Inside error}
ERR_READ			=10;		{Read error}
ERR_WRITE                  	=11;		{Write error}
ERR_RANDOM                 	=12;		{Random error}
ERR_SEED                   	=13;		{Seed Code error}
ERR_CALCULATE              	=14;		{Calculate error}
ERR_NO_OPEN			=15;		{No open dongle before operate dongle}
ERR_OPEN_OVERFLOW          	=16;		{Too more open dongle(>16)}
ERR_NOMORE			=17;		{No more dongle}
ERR_NEED_FIND			=18;		{No Find before FindNext}
ERR_DECREASE			=19;		{Decrease error}
ERR_AR_BADCOMMAND		=20;		{Arithmetic instruction error}
ERR_AR_UNKNOWN_OPCODE		=21;		{Arithmetic operator error}
ERR_AR_WRONGBEGIN		=22;		{Const number can't use on first arithmetic instruction}
ERR_AR_WRONG_END		=23;		{Const number can't use on last arithmetic instruction}
ERR_AR_VALUEOVERFLOW		=24;		{Const number > 63}
ERR_UNKNOWN			=$ffff;		{Unknown error}
ERR_RECEIVE_NULL		=$100;		{Receive null}
ERR_PRNPORT_BUSY		=$101;		{Parallel busy}

{On DELPHI3, we defined LongWord as LongInt}

{ROCKEY dongle API}
function  Rockey( fun: Word ;var Handle:Word;var lp1,lp2:LongWord;
          var P1,P2,P3,P4:Word;var buf:Byte):Word;

///////////////////////////////////////////////////////////////
Usage
Add "Uses RyDp32.dcu" to your program

Note:
'fun' can use number or RY_XXXX, else must be variable.
The last parameter 'buf', that you would transfer the parameter as string,
but you should copy the string to a byte array, for example:

 cstr:='H=H^H, A=A*23, F=B*17, A=A+F, A=A+G, A=A<C, A=A^D, B=B^B, C=C^C, D=D^D';
  for i:=0 to strlen(cstr) do
      mBuf[i]:= Byte(cstr[i]);
  mBuf[i]:=0;
  mFun:=RY_WRITE_ARITHMETIC;
  mP1:=0;
   rt:= Rockey(mFun,mHand[num],lP1,lP2,mP1,mP2,mP3,mP4,mBuf[0]);
 ............


