#pragma once

#include "windows.h"


// Net Rockey4 Command.
#define  RY_FIND                        1		//Find Rockey4.
#define  RY_FIND_NEXT					2		//Find next Rockey4.
#define  RY_OPEN                        3		//Open 
#define  RY_CLOSE                       4		//Close
#define  RY_READ                        5		//Read UDZ
#define  RY_WRITE                       6		//Write UDZ
#define  RY_RANDOM                      7		//Random
#define  RY_SEED                        8		//Seed code
#define  RY_READ_USERID					10		//Read UID
#define  RY_CHECK_MOUDLE				12		//Check module status
#define  RY_CALCULATE1					14		//Calculate 1
#define  RY_CALCULATE2					15		//Calculate 2
#define  RY_CALCULATE3					16		//Calculate 3
#define  RY_DECREASE					17		//Decrease



//Rockey4 Type defination.

#define TYPE_ROCKEY4					1			//Normal Ry4.
#define TYPE_ROCKEY4Plus				2			//Ry4Plus.
#define TYPE_ROCKEYUSB					3			//Ry4 USB.
#define TYPE_ROCKEYUSBPlus				4			//Ry4 USB Plus
#define TYPE_ROCKEYNET					5			//NetRy4
#define TYPE_ROCKEYUSBNET				6			//NetRy4 USB.


// Error codes.
#define  ERR_SUCCESS					0				//No error.
#define  ERR_NO_PARALLEL_PORT			0x80300001		//(0x80300001)No parallel port on the computer 
#define  ERR_NO_DRIVER					0x80300002		//(0x80300002)No driver installed 
#define  ERR_NO_ROCKEY					0x80300003		//(0x80300003)No ROCKEY4 dongle 
#define  ERR_INVALID_PASSWORD			0x80300004		//(0x80300004)ROCKEY4 dongle found, but base password is incorrect
#define  ERR_INVALID_PASSWORD_OR_ID 	0x80300005		//(0x80300005)Wrong password or ROCKEY4 HID
#define  ERR_SETID						0x80300006      //(0x80300006)Set ROCKEY4 HID wrong
#define  ERR_INVALID_ADDR_OR_SIZE		0x80300007		//(0x80300007)Read/Write address is wrong
#define  ERR_UNKNOWN_COMMAND        	0x80300008		//(0x80300008)No such command
#define  ERR_NOTBELEVEL3				0x80300009		//(0x80300009)Inside error
#define  ERR_READ						0x8030000A		//(0x8030000A)Read error
#define  ERR_WRITE                  	0x8030000B		//(0x8030000B)Write error
#define  ERR_RANDOM                 	0x8030000C		//(0x8030000C)Random error
#define  ERR_SEED                   	0x8030000D		//(0x8030000D)Seed Code error
#define  ERR_CALCULATE              	0x8030000E		//(0x8030000E)Calculate error
#define  ERR_NO_OPEN					0x8030000F		//(0x8030000F)Ry_Open must precede this operation
#define  ERR_OPEN_OVERFLOW          	0x80300010		//(0x80300010)Too many open dongles (>16)
#define  ERR_NOMORE						0x80300011		//(0x80300011)No more dongle
#define  ERR_NEED_FIND					0x80300012		//(0x80300012)No Find before FindNext
#define  ERR_DECREASE					0x80300013		//(0x80300013)Decrease error
#define  ERR_AR_BADCOMMAND				0x80300014		//(0x80300014)Arithmetic instruction error
#define  ERR_AR_UNKNOWN_OPCODE			0x80300015		//(0x80300015)Arithmetic operator error
#define  ERR_AR_WRONGBEGIN				0x80300016		//(0x80300016)A constant. cannot be in the first instruction
#define  ERR_AR_WRONG_END				0x80300017		//(0x80300017)A constant. cannot be in the last instruction 
#define  ERR_AR_VALUEOVERFLOW			0x80300018		//(0x80300018)Const number > 63

#define  ERR_UNKNOWN					0x8030ffff		//(0x8030FFFF)Unknown error 

#define  ERR_RECEIVE_NULL				0x80300100		//(0x80300100)Parallel port can not recieve data.
#define  ERR_PRNPORT_BUSY				0x80300101		//(0x80300101)Parallel port is busy.


//Error code for Net login

#define  ERR_NET_LOGINAGAIN				0x803003E9		//A module can only be opened once by the same process.  
#define  ERR_NET_NETERROR				0x803003EA		//Network error.
#define	 ERR_NET_LOGIN					0x803003EB		//Too many users are logged on.
#define	 ERR_NET_INVALIDHANDLE			0x803003EC		//Invalid handle, this handle might have been closed.
#define	 ERR_NET_BADHARDWARE			0x803003ED		//Defective hardware 
#define	 ERR_NET_REFUSE					0x803003EE		//Client dll modified, service refused request.
#define	 ERR_NET_BADSERVER				0x803003EF		//Nrsvr.exe modified, service is invalid.





//Error code for network

#define ERR_INIT_SOCK					0x803007D1		//Error when initializing.
#define ERR_NOSUCHPROTO					0x803007D2		//No such protocol.
#define ERR_UDPSOCKCREATE				0x803007D3		//UDP error when creating socket.
#define ERR_UDPSETBROADCAST				0x803007D4		//UDP error when setting broadcast.
#define ERR_UDPBINDFAILED				0x803007D5		//UDP error when binding.
#define ERR_SVRCALLBACKNULL				0x803007D6		//Server call back null.
#define ERR_TCPSOCKCREATE				0x803007D7		//TCP error when creating socket.
#define ERR_TCPBINDFAILED				0x803007D8		//TCP error when binding.
#define ERR_TCPLISTENFAILED				0x803007D9		//TCP error when listening.
#define ERR_NOSUCHSEARCH				0x803007DA		//No such search mode.
#define ERR_UDPSEND						0x803007DC		//UDP error when sending.
#define ERR_UDPTIMEOUT					0x803007DD		//UDP timeout error when waiting.
#define ERR_UDPRECV						0x803007DE		//UDP error when receiving.
#define	ERR_TCPCONNECT					0x803007DF		//TCP error when connecting to server.
#define ERR_TCPSENDTIMEOUT				0x803007E0		//TCP time out error when sending.
#define	ERR_TCPSEND						0x803007E1		//TCP error when sending.
#define ERR_TCPRECVTIMEOUT				0x803007E2		//TCP time out error when receiving.
#define	ERR_TCPRECV						0x803007E3		//TCP error when receiving.
#define ERR_IPXSOCKCREATE				0x803007E4		//IPX error when creating socket.
#define ERR_IPXSETBROADCAST				0x803007E5		//IPX error when setting broadcast.
#define	ERR_IPXSEND						0x803007E6		//IPX error when sending data. 
#define	ERR_IPXRECV						0x803007E7		//IPX error when receiving data.
#define ERR_IPXBIND						0x803007E8		//IPX error when binding.
#define ERR_NBSRESET					0x803007E9		//NetBIOS error when initializing.
#define ERR_NBSADDNAME					0x803007EA		//NetBIOS error when adding name.
#define ERR_NBSSEND						0x803007EB		//NetBIOS error when sending data.
#define ERR_NBSRECV						0x803007EC		//NetBIOS error when receiving data.




