Rockey6 Smart For Delphi APIs:

// 1. Search for dongle device(s) connected to the computer
function DIC_Find():int;
// Return value:
// it is < 0, indicating an error code is returned, for details, please see below.
// If it is = 0, no card reader device exists
// If it is >0, the return value is the number of card reader device(s) 

//(Note: Normally, even if the user does not connect any device, the driver program will report the card presence 
//due to the existence of the driver. It is necessary to confirm the real device presence with command DIC_Open.) 
//Suppose that maximum 32 card reader devices can be connected to a computer. 

// ====================================================================

// 2. Open the specified card reader
function  DIC_Open(hic:int;reader_name:pchar ):int;
// Input:
// hic	Card handle,it's a integer value.
// (1)positive value, it is a enumeration value£¬any one of 0, 1, 2, ... return value of DIC_Find(). If reader_name 
//     is not null, card reader name is returned.
// (2)negative value£¬reader_name parameter can not be null£¬DIC_Open will attempt to open the card reader directly 
//     by the device name in reader_name; in case of a virtual device, it is the path directory of the file to be opened. 

// reader_name  name of card reader.
// An input/output parameter, see comments on hic

// Return value:
// >=0				Success, the opened handle is returned
// <0				An error code is returned, for detailed descriptions, please refer to code defined below.
// ====================================================================

// 3. Close the specified card reader
function  DIC_Close(hic:int):int;
// Input:
// hic: Card handle, must be consistent with the hic returned by DIC_Open. 
// Return:
// An error code , for detailed descriptions, please refer to code defined below.

// ====================================================================

// 4. Create virtual IC card file(*virtual card private instruction)
function  DIC_Create(filename:pchar; mfname:pchar;  atr:pchar;  atrlen:WORD):int;
// Input:
// filename:	Path file name to be created 
// mfname:		Main volume name
// atr:			Software developer information 
// atrlen:		Software developer information length

// Return :
// An error code , for detailed descriptions, please refer to code defined below.

// ======================================================================

// 5. Get the dynamic library version
function  DIC_GetVersion(ver:pchar):int;
// Input:
// ver: returns the version number of the dynamic library, the version content is:
//    [V/R]xx.yy
// For example, R01.10 means it is "Real card dynamic library Version 1.10 "
//              R03.02 indicats "Virtual card dynamic library Version 3.02 "

// Return:
//	An error code , for detailed descriptions, please refer to code defined below.

// ======================================================================

// 6. Complete operations on the specified device 
function  DIC_Command( hic:int;  cmd:int; cmddata: pchar):int;
// Input
// hic		Device handle 
// cmd		Specific operation, different constants represent different operations, for details, see below.
// cmddata	Input/output data related to the command£¬see comments on below.

// ======================================================================

// 7. Find a dongle that has specific management code 
function  DIC_Get(xdata:pchar;  p1:int;  p2:int; buffer:pchar ):int;
// Input:
// xdata	Source data buffer
// p1		Mode/shift, if the highest bit is 1£¬it is a mode operation£¬otherwise, it is a user defined shift value
// p2		Return mode / size, the highest 2 bits represent return mode, others indicate the operation size
// buffer	Character type buffer where the data is got

// ====================================================================

// 8. Set data for DIC_Cmd
function  DIC_Set(xdata:pchar;  p1:int;  p2:int; p3:int; buffer:pchar):int;
// Input:
// xdata	Targeted buffer
// p1		Mode/shift, if the highest bit is 1, it is a mode operation£¬otherwise, it is user defined shift value
// p2		Transfer mode/ size, the highest 2 bits specify the transfer mode, others indicate the operation size
// p3		Normally the value that the user needs to store
// buffer	Character type buffer of the source data, it can be NULL
// ====================================================================


// 9. Find a dongle that has specific management code 
function DIC_FindByMgrCode(pMgr:Pointer):int;
// Input:
// pMgrCode	a pointer to DICST_ManagerCode structure
// 
// Return:
// The same as DIC_Find
// 
// ==================================


// Error code ===========================================================

#ifndef SCARD_S_SUCCESS

// Success
const SCARD_S_SUCCESS 					= Longword( $00000000L)

// Internal link check failure
const SCARD_F_INTERNAL_ERROR				= Longword( $80100001L)

// Operation is terminated by user
const SCARD_E_CANCELLED					= Longword( $80100002L)

// Incorrect operation handle
const SCARD_E_INVALID_HANDLE				= Longword( $80100003L)

// Incorrect parameter
const SCARD_E_INVALID_PARAMETER				= Longword( $80100004L)

// Registered startup information lost or invalid 
const SCARD_E_INVALID_TARGET				= Longword( $80100005L)

// Memory not enough for command completion 
const SCARD_E_NO_MEMORY					= Longword( $80100006L)

// Internal overtime
const SCARD_F_WAITED_TOO_LONG				= Longword( $80100007L)

// User specified buffer is too small, not enough for the return data
const SCARD_E_INSUFFICIENT_BUFFER			= Longword( $80100008L)

// Unknown card reader
const SCARD_E_UNKNOWN_READER				= Longword( $80100009L)

// Over user specified time
const SCARD_E_TIMEOUT					= Longword( $8010000AL)

// Card occupied by other connection
const SCARD_E_SHARING_VIOLATION				= Longword( $8010000BL)

// No card in the card reader
const SCARD_E_NO_SMARTCARD				= Longword( $8010000CL)

// Unknown card type
const SCARD_E_UNKNOWN_CARD				= Longword( $8010000DL)

// Card reader can not complete card eject operation
const SCARD_E_CANT_DISPOSE				= Longword( $8010000EL)

// Current card does not support user specified communication protocol
const SCARD_E_PROTO_MISMATCH				= Longword( $8010000FL)

// Card is not ready for receiving commands
const SCARD_E_NOT_READY					= Longword( $80100010L)

// Some variable values are not suitable
const SCARD_E_INVALID_VALUE				= Longword( $80100011L)

// Operation is terminated by system, it may be necessary to log on again or shut down. 
const SCARD_E_SYSTEM_CANCELLED				= Longword( $80100012L)

// Internal communication error
const SCARD_F_COMM_ERROR				= Longword( $80100013L)

// Unknown internal error
const SCARD_F_UNKNOWN_ERROR				= Longword( $80100014L)

// Invalid vendor information
const SCARD_E_INVALID_ATR				= Longword( $80100015L)

// User attempts to terminate some process not available
const SCARD_E_NOT_TRANSACTED				= Longword( $80100016L)

// The specifiied card reader is not ready
const SCARD_E_READER_UNAVAILABLE			= Longword( $80100017L)

// Operation is terminated, service program is allowed to exit
const SCARD_P_SHUTDOWN					= Longword( $80100018L)

// PCI receiving buffer is too small
const SCARD_E_PCI_TOO_SMALL				= Longword( $80100019L)

// Card reader drive does not support the current card reader
const SCARD_E_READER_UNSUPPORTED			= Longword( $8010001AL)

// Card reader driver program can not create an exclusive name, card reader with the same name already exists
const SCARD_E_DUPLICATE_READER				= Longword( $8010001BL)

// Card is not supported by the current card reader
const SCARD_E_CARD_UNSUPPORTED				= Longword( $8010001CL)

// Smart card service is not enabled
const SCARD_E_NO_SERVICE				= Longword( $8010001DL)

// Smart card service is disabled
const SCARD_E_SERVICE_STOPPED				= Longword( $8010001EL)

// Some unexpected smart card error
const SCARD_E_UNEXPECTED				= Longword( $8010001FL)

// Smart card software developer information not accessible
const SCARD_E_ICC_INSTALLATION				= Longword( $80100020L)

// Smart card vendor information not accessible
const SCARD_E_ICC_CREATEORDER				= Longword( $80100021L)

// Current smart card does not support the function user demanded
const SCARD_E_UNSUPPORTED_FEATURE			= Longword( $80100022L)

// The specified directory does not exist
const SCARD_E_DIR_NOT_FOUND				= Longword( $80100023L)

// The specified file does not exist
const SCARD_E_FILE_NOT_FOUND				= Longword( $80100024L)

// The specified directory is no longer a valid directory
const SCARD_E_NO_DIR					= Longword( $80100025L)

// The specified file is no longer a valid file, no file selected
const SCARD_E_NO_FILE					= Longword( $80100026L)

// The file denies any access
const SCARD_E_NO_ACCESS					= Longword( $80100027L)

// Card is full, no more data write
const SCARD_E_WRITE_TOO_MANY				= Longword( $80100028L)

// File pointer error
const SCARD_E_BAD_SEEK					= Longword( $80100029L)

// PIN code error
const SCARD_E_INVALID_CHV				= Longword( $8010002AL)

// An unrecognized error code is returned from smart card service
const SCARD_E_UNKNOWN_RES_MNG				= Longword( $8010002BL)

// The certificate requested does not exist
const SCARD_E_NO_SUCH_CERTIFICATE			= Longword( $8010002CL)

// The certificate requested is not available
const SCARD_E_CERTIFICATE_UNAVAILABLE			= Longword( $8010002DL)

// No card reader found
const SCARD_E_NO_READERS_AVAILABLE			= Longword( $8010002EL)

// Data loss during smart card communication, please try again
const SCARD_E_COMM_DATA_LOST				= Longword( $8010002FL)

// The key file requested does not exist
const SCARD_E_NO_KEY_CONTAINER				= Longword( $80100030L)

// Card reader can not communicate with the card due to software developer information conflict
const SCARD_W_UNSUPPORTED_CARD				= Longword( $80100065L)

// Card does not respond to reset
const SCARD_W_UNRESPONSIVE_CARD				= Longword( $80100066L)

// Card no power
const SCARD_W_UNPOWERED_CARD				= Longword( $80100067L)

// Card is reset, shared information is invalid
const SCARD_W_RESET_CARD				= Longword( $80100068L)

// Card is removed
const SCARD_W_REMOVED_CARD				= Longword( $80100069L)

// Access is denied due to security rules
const SCARD_W_SECURITY_VIOLATION			= Longword( $8010006AL)

// PIN code is not verified, access is denied
const SCARD_W_WRONG_CHV					= Longword( $8010006BL)

// Max. PIN code retry number is reached, access is denied
const SCARD_W_CHV_BLOCKED				= Longword( $8010006CL)

// The last smart card file is reached, no more file available
const SCARD_W_EOF					= Longword( $8010006DL)

// Operation is terminated by user
const SCARD_W_CANCELLED_BY_USER				= Longword( $8010006EL)

// Smart card PIN is not set
const SCARD_W_CARD_NOT_AUTHENTICATED			= Longword( $8010006FL)

// Extended error code  =========================================================

// File already exists
const SCARD_E_FILE_EXISTS			= Longword( $A0100001L)

// Card-resident memory operation error
const SCARD_E_EPROM_ERROR			= Longword( $A0100002L)

// User specified CLA is invalid
const SCARD_E_INVALID_CLA			= Longword( $A0100003L)

// User specified INS is invalid
const SCARD_E_INVALID_INS			= Longword( $A0100004L)

// Virtual machine address out ranged/abnormal 
const SCARD_E_VM_ADDRESS_ERROR			= Longword( $A0100005L)

// 0 division error
const SCARD_E_ZERO_DIVIDE			= Longword( $A0100006L)

// Card is not inserted to the proper place
const SCARD_E_WRONG_POSITION			= Longword( $A0100007L)

// Card is in an unknown status
const SCARD_E_UNKNOWN_STATE			= Longword( $A0100008L)

// Card is not opened
const SCARD_E_CARD_NOT_OPENED			= Longword( $A0100009L)

// Unknown command
const SCARD_E_UNKNOWN_COMMAND			= Longword( $A010000AL)

// Super password reset number is 0
const SCARD_E_ZERO_TRYTIME			= Longword( $A010000BL)

// Too many devices are opened
const SCARD_E_TOO_MANY_DEVICE			= Longword( $A010000CL)

// Invalid instruction.
const	SCARD_E_INVALID_INSTRUCTION		= Longword( $A010000DL)

// card still have more data to return 
const SCARD_W_RESPONSE				= Longword( $A01000FFL)

// returned data length
const RETURN_LENGTH				= Longword( $A0100014)

// Error codes exclusive for virtual devices=================================================

// Virtual card file creation failure
const SCARD_E_FILE_CREATE_FAILED		= Longword( $A0101001L)

// Virtual card file open failure
const SCARD_E_FILE_OPEN_FAILED			= Longword( $A0101002L)

const SCARD_E_FLOAT_NOT_FOUND         		= Longword( $0000e00aL)

//RSA_DES library not found
const SCARD_E_RSADES_NOT_FOUND        		= Longword( $0000e00bL)

const SCARD_E_LIBS_ERROR              		= Longword( $0000e00cL)

const SCARD_E_FLOAT_NOT_FOUND         		= Longword( $0000e00aL)

//RSA_DES library not found
const SCARD_E_RSADES_NOT_FOUND        		= Longword( $0000e00bL)

const SCARD_E_LIBS_ERROR              		= Longword( $0000e00cL)

const SCARD_E_EXTENDFLOAT_NOT_FOUND   		= Longword( $0000e00dL)

//Extended error codes for ROCKEY

//Cannot find ROCKEY
const ROCKEY_K_NOT_FOUND               		= Longword( $F0100001L)

//Search ROCKEY failed	
const ROCKEY_K_QUERY_FAILED            		= Longword( $F0100002L)

//Write ROCKEY failed
const ROCKEY_K_WRITE_FAILED            		= Longword( $F0100003L)

//Read ROCKEY failed
const ROCKEY_K_READ_FAILED            		 = Longword( $F0100004L)