⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ld_reader.h

📁 读卡器编程实例------Reader programming examples
💻 H
📖 第 1 页 / 共 4 页
字号:
short DllExport			read_AT881604_status
						(
							unsigned char	hd_no,
							char			key_type,
							char			zone_No,
							char			card_type,
							char			*status
						);

short DllExport			change_codekey_AT881604
						(
							unsigned char	hd_no,
							char			key_type,
							char			zone_No,
							char			card_type,
							char			*user_key,
							char			key_len,
							char			*status
						);

short DllExport			ReadVersionPad(unsigned char hd_no, unsigned char *data);

short DllExport			ReadSerialPad(unsigned char hComHandle, unsigned int *puiRetLen, char *pcBuf);

/*********************************** 文件操作A*********************************/
short DllExport			update_black
						(
							unsigned char	hd_no,
							unsigned char	*filename,
							unsigned short	DelNum,
							unsigned short	DelLen,
							unsigned char	*DelData,
							unsigned short	AddNum,
							unsigned short	AddLen,
							unsigned char	*AddData,
							unsigned short	*RetNum
						);

short DllExport			search_black
						(
							unsigned char	hd_no,
							unsigned char	*filename,
							unsigned char	*Data,
							unsigned char	DataLen
						);

short DllExport			freerec_pad_file(unsigned char hd_no, short *recnum);

short DllExport			del_pad_file(unsigned char hd_no, unsigned char *filename, unsigned char *authdata);

short DllExport			close_pad_file(unsigned char hd_no, unsigned char *filename);

short DllExport			del_rec_pad_file
						(
							unsigned char	hd_no,
							unsigned char	*filename,
							unsigned char	*Data,
							unsigned char	Datalen
						);

short DllExport			write_pad_file
						(
							unsigned char	hd_no,
							unsigned char	*filename,
							short			recno,
							unsigned char	len,
							unsigned char	*Data
						);

short DllExport			read_pad_file
						(
							unsigned char	hd_no,
							unsigned char	*filename,
							short			startrec,
							short			recnum,
							short			*retlen,
							unsigned char	*result
						);

short DllExport			open_pad_file
						(
							unsigned char	hd_no,
							unsigned char	*filename,
							unsigned char	mode,
							unsigned char	auth_data[8]
						);

short DllExport			get_file_header(unsigned char hd_no, unsigned char *filename, struct PAD_FILE_STRU *file);

short DllExport			create_pad_file
						(
							unsigned char		hd_no,
							unsigned char		*filename,
							union PAD_FILE_ACC	acc,
							unsigned char		BlackListLen,
							unsigned char		auth_data[8]
						);

short DllExport			init_pad_file
						(
							unsigned char		hd_no,
							union PAD_FILE_ACC	acc,
							unsigned char		ubRec_len,
							unsigned char		ubaMAC[4]
						);

void DllExport			GetErrorMessage(short err_code, char *message);
short DllExport			TestCommuSpeed(unsigned char hd_no, unsigned char BufferLen, unsigned char *Buffer);

short DllExport			SetMode7100(unsigned char hComHandle, char cMode);

/*
   char PD_load_master_key(char key_id, char *s);
   char PD_select_master_key ( char key_id );
   char PD_load_workkey ( char *s );
   char PD_load_mac_key ( char * s );
   char PD_load_mac_data (  char *s1, char *s2, unsigned char l );
   char PD_load_card_no ( char *s );
   char PD_read_pinpad ( char len, char disp_mode, char encrypt_mode, char *s );
   */
#ifndef _POS_
short DllExport			SetPosPort(unsigned char PosPort);
char DllExport			display_pinpad(char *string);
char DllExport			load_master_key(char key_id, char *s);
char DllExport			select_master_key(char key_id);
char DllExport			load_workkey(char *s);
char DllExport			load_card_no(char *s);
char DllExport			read_pinpad(char len, char disp_mode, char encrypt_mode, char *s);
char DllExport			user_encrypt(char *s1, char *s2);
char DllExport			load_mac_key(char *s);
char DllExport			load_mac_data(char *s1, char *s2, unsigned char l);
char DllExport			user_des(char key_id, char *in, char *out);
char DllExport			check_key(char key_id);
char DllExport			display_752(char line, char *string);
char DllExport			display_730(char line, char *string);
char DllExport			reset_pinpad(void);

uchar DllExport			EA_ucGetPinVer(uchar ucType, char *szBuf);
uchar DllExport			EA_ucLoadKey(uchar ucType, uchar ucID, uchar ucLen, char *pcBuf);
uchar DllExport			EA_ucSelectKey(uchar ucType, uchar ucID);
uchar DllExport			EA_ucCheckKeyNew(uchar ucType, uchar ucID);
uchar DllExport			EA_ucUserEncryptNew(uchar ucInLen, char *szInBuf, uchar *pucOutLen, char *pcOutBuf);
uchar DllExport			EA_ucReadPinpadNew(uchar ucLen, uchar ucDisp, uchar ucEncrypt, uchar *pucOutLen, char *szBuf);
uchar DllExport EA_ucResetPinpad(void);
uchar DllExport EA_ucLoadCardNo(char *pcBuf);
uchar DllExport EA_ucDispPinpad(uchar ucLine,char *pcBuf);
uchar DllExport EA_ucLoadMacData(uint uiLen,uchar *pucInBuf,uchar *pucOutBuf);
uchar DllExport EA_ucUserDes(uchar ucKeyID, uchar *pucInBuf, uchar *pucOutBuf);
uchar DllExport EA_ucCheckKey(uchar ucType, uchar ucKeyID);
uchar DllExport EA_ucSetMacData(uchar ucLenIn, uchar *pucDataIn);
uchar DllExport EA_ucGetMacResult(uchar *pucDataOut);
uchar DllExport EA_vPinpadBeep(unsigned short usTimesMs);

#endif

/**********************************************************************
  S02新增函数(用于PAD03V3.4以后版本)
 **********************************************************************/
short DllExport			SetTrack(unsigned char hComHandle, uchar ucTrk1Mode);

short DllExport			OpenMagcard
						(
							unsigned char	hComHandle,
							uchar			ucMode,
							uint			uiTimeOut,
							DevHandle		*phMagHandle,
							uchar			*ucStatus
						);

short DllExport			CloseMagcard(unsigned char hComHandle, DevHandle *phMagHandle, uchar *ucStatus);

short DllExport			Recard
						(
							unsigned char	hComHandle,
							DevHandle		hMagHandle,
							uchar			ucLine,
							uchar			ucMode,
							ET_MAGCARD		*ptTrk2,
							ET_MAGCARD		*ptTrk3,
							uchar			*ucStatus
						);

short DllExport			StartTrackIn(unsigned char hComHandle, DevHandle hMagHandle, uchar *ucStatus);

short DllExport			TrackIn
						(
							unsigned char	hComHandle,
							DevHandle		hMagHandle,
							ET_MAGCARD		*ptTrk2,
							ET_MAGCARD		*ptTrk3,
							uchar			*ucStatus
						);

short DllExport			ReadPara(unsigned char hComHandle, uint uiOffset, uint uiLen, uint *puiRetLen, char *pcBuf);

short DllExport			WritePara(unsigned char hComHandle, uint uiOffset, uint uiLen, char *pcBuf);

short DllExport			GetPosDot(char *cstr, unsigned char *ucDotBufLen, unsigned char *pucDotBuf);

short DllExport			power_up_AT24C04(unsigned char hd_no, char *status);

short DllExport			write_AT24C04(unsigned char hd_no, short addr, short len, char *out);

short DllExport			read_AT24C04(unsigned char hd_no, unsigned short addr, unsigned short len, char *out);

int						GetCardInfo
						(
							unsigned char	hd_no,
							unsigned char	ucMode,
							unsigned char	*ucStatus,
							unsigned int	*puiRetLen,
							unsigned char	*pucRetBuf
						);
#ifdef __cplusplus
}
#endif
#define READ_VERSION		0x00	/* Read Version */
#define SELECT_CARD			0x20	/* Select IC card type */
#define CHECK_SECURITY		0x21	/* Check user code */
#define ERASE_ZONE			0x22	/* Erase application zone */
#define READ_CARD			0x23	/* Reading datas from card */
#define WRITE_CARD			0x24	/* Writing '0' in card */
#define ERASE_WORD			0x25	/* Writing '1' word by word */
#define FUSE_BLOWN			0x26	/* Fuse2 blown */
#define POWER_UP			0x10	/* Power up */
#define POWER_DOWN			0x11	/* Power down */
#define LED_DISP			0x2a	/* LED display for STAR-717 or SATR-727 */
#define WAIT_CARD_IN		0x2b	/* Wait card in and power up, used for STAR-717 */
#define READ_KEY_CODE		0x2c	/* Read Code From STAR-272 */
#define READ_KEY			0x2d	/* Read key from STAR-727 */
#define PROTECT_WRITE_4428	0x27	/* Used for SLE_4428 */
#define PROTECT_READ_4428	0x28	/* Used for SLE_4428 */
#define PUSH_CARD			0x30	/* FOR 727 PUSH CARD */
#define BUZZER				0x31	/* buzzer for STAR-727 */
#define CLS					0x32	/* clear start-727 screen */
#define INIT_CODE			0x33	/* clear start-727 screen */

#define DOWNLOAD_750KEY		0x41
#define READ_750DATA		0x42
#define WRITE_750DATA		0x43
#define DISP_750			0x44
#define CHECK_750KEY		0x45
#define INITIALIZE_CODE		0x46

/**************************************************************************
  CODES OPERATION  CARTE
 ***************************************************************************/
#define ICCCO_ENTR			0xDA
#define ICCCO_SORT			0xDB
#define ICCCO_POWER_ON		0x6E
#define ICCCO_POWER_DOWN	0x4D

/*  some const */
#define MAXLEN				530		/*the buffer len*/
#define MAX_RESPOND_DELAY	1000	/*1000ms*/
#define ACK					0x60	/* Acknowledge      */
#define NACK				0xE0	/* No acknowledge   */
#define ETX					0x03	/* End character    */
#define COM_ERROR			0xa2	/* Communication error */

/**************************************************************************
  Error code of HANDLER interface
 ***************************************************************************/
#define ICCER_OK		0			/* 01h Ok */
#define ICCER_UN		1			/* 01h (unavailable) the session is not available */
#define ICCER_PE		2			/* 02h (parameter error)one or more invail parameters */
#define ICCER_AC		3			/* 03h (already connected) reader already connected*/
#define ICCER_WE		4			/* 04h (write error) transmission impossible*/
#define ICCER_NC		5			/* 05h (not connected) the reader is not connected */
#define ICCER_MP		6			/* 06h (message pending) a message has been received and must be read */
#define ICCER_ME		7			/* 07h (message error) the message received is not in a vaild format*/
#define ICCER_NM		8			/* 08h (no message) no message received */
#define ICCER_ND		9			/* 09h (not disconnected) the reader is not disconnected */
#define ICCER_DRV		10			/* 0Ah (driver error) unmanaged error on COM driver */
#define ICCER_MEM		11			/* 0Bh (memory error)unmangaged error on a memory operation */
#define ICCER_ESC		12			/* 0Ch operation code nEscape not supported */
#define ICCER_NO_FILE	13			/* No open file found */

#define ICCER_IH		101			/* 65h (invalid handle) there is no session corresponding to this handle */
#define ICCER_UNR		102			/* 66h (unavailable resource) the item resource does not exist */
#define ICCER_OE		103			/* 67h (open error) opning of session impossible(link problem) */
#define ICCER_NMS		104			/* 68h (no more session avalaible) no more memory resources for a session */
#define ICCER_RB		105			/* 69h (ressource busy) the item is already reserved */
#define ICCER_SB		106			/* 6Ah (session busy) an operation is in progress in this session */
#define ICCER_IOP		107			/* 6Bh (illegal operation) the operation requested is not possible on tjis item */
#define ICCER_NMR		108			/* 6Ch (no message received) the operation has not yet terminated */
#define ICCER_AD		109			/* 6Dh (access denied) access impossible: the is no longer powered up */
#define ICCER_SI		110			/* 6Eh (session idle) no operation in progress */
#define ICCER_SL		111			/* 6Fh (session locked) session disableled by priority session */
#define ICCER_TX		112			/* 70h (Transmit error) transmission error (returned by ICCHRead) */
#define ICCER_SCR		113			/* 71h (smart card removed) Removal of card detected by HANDLER */
#define ICCER_AMEM		114			/* 72h (memory error) erreur d'allocation m俶oire */
#define ICCER_PIP		115			/* 73h (Pipe error) erreur de communication inter-process */

#define ICCEV_CXERR		1			/* connection impossible */
#define ICCEV_CXEOF		2			/* connection made */
#define ICCEV_TXHOLD	4			/* transmission disabled */
#define ICCEV_TXERR		8			/* transmission error */
#define ICCEV_RXERR		16			/* recption error */
#define ICCEV_PRERR		32			/* protocol error */
#define ICCEV_RXEOF		64			/* message received (possibly empty) */
#define ICCEV_RXTO		128			/* reception time_out */
#define ICCEV_UN		256			/* the session does not exist (no longer exists ?) */
#define ICCEV_SC		0x4000		/* change of state of ICCEV_CP since the last call */
#define ICCEV_CP		0x8000		/* card present if 1, missing if 0 */

#define MAKEDWORD(a, b) ((DWORD) (a) | ((DWORD) (b)) << 16)
#define MAKEBYTE(a, b)	((BYTE) (a) | ((BYTE) (b)) << 4)

/**************************************************************************
 *		       Codes return by the function
 **************************************************************************/
#define ICCE_OK					0	/* operation performed */
#define ICCE_RESET				210 /* RESET order not performed */
#define ICCE_IN					211 /* incorrect input parameter */
#define ICCE_OUTZ				212 /* Overflow of zone (Address out of range) */
#define ICCE_RETRY				213 /* Retry impossible in write */
#define ICCE_NTROUV				214 /* Search failed */
#define ICCE_SAT				215 /* card full */
#define ICCE_BLOQ				216 /* card disabled */
#define ICCE_SEL				217 /* selection of zone failed */
#define ICCE_DEB				218 /* not enough space */
#define ICCE_NULL				219 /* Session not open */
#define ICCE_MSK				220 /* Card  not supported by the LIBRARY */
#define ICCE_SPE				221 /* Order not supported by this order */
#define ICCE_ES					222 /* Card or line status incorrect (MED abnormal,not 0,0xE7) */
#define ICCE_LINK				223 /* Error in connection with reader */
#define ICCE_1CF				224 /* 1 false code submitted to card */
#define ICCE_2CF				225 /* 2 false code submitted to card */
#define ICCE_DEBLOQ				226 /* Submission of false cardholder code during a re-enable */
#define ICCE_OKAR				227 /* Operation OK but with a retry in write */
#define ICCE_TZI				228 /* Secrect file too small for a change of PIN code(TB card only) */
#define ICCE_MEM				229 /* Memory allocation error */
#define ICCE_EX					230 /* Exceptional error */
#define ICCE_ZONE				231 /* Order not support in the entity selected */
#define ICCE_CTX				232 /* No more context available  */
#define ESC_KEY_PRESS			238

#define NOT_STARDRAGON_READER	0xc0

/**************************************************************************
 *		     Iitialization  orders
 **************************************************************************/
#ifdef __cplusplus
extern "C"
{						//Used for C++
#endif
WORD DllExport	iCC_CardPresence
	(				/* Activation of a card presence test */
		HICC hGEM,	/* Reference of card session */
		LPWORD wPcMask
	);

/**************************************************************************
 *       		 CPU Card Library
 *
 *   Only used for STAR-710 IC Card Reader which support most of the existing
 * asynchronous(T=0 protocol) cards
 *
 *   The following Interface Library has developed to support T=0 cards
 * in such a way that it appears transparent for the application.This has
 * been achieved by implementint the Application Protocol Data Unit(APDU)
 * structure specified by ISO7816-4 standard.
 **************************************************************************/

/******************************************************************************
 *             The struct of return status code
 ******************************************************************************/
typedef struct
{
	BYTE	me1;	/* 1st card status word */
	BYTE	me2;	/* 2nd card status word */
	WORD	MED;	/* reader status */
}
STATUS, FAR * LPSTATUS;

/**************************************************************************
  Reader  status
  00		Command executed correctly
  03		Byte receive error(with NACK message)
  04      	unknown instruction
  05		LRC error (with NACK message)
  08		Length dose not match received length (with NACK message)

  A0		Card not supported by STAR-710
  A2		"Dumb" card (with power up instruction)
  A3		Transferred byte parity error, card commuction error
  E2              "Dumb" card (with instruction other than power up)
  E7		WARNING if me1=90 or me2=0 ,reader sends this status
 **************************************************************************/
WORD DllExport Read_Version(HICC hiCC, LPBYTE data);
WORD DllExport Read_Serial(HICC hiCC, unsigned char *data);
WORD DllExport SetReadTimeout(short hCT, unsigned long timeout);
WORD DllExport InitSerialPort(LPSTR lpName, LPHICC handfile, unsigned long baud_rate);

WORD DllExport iCC_Open
	(				/* Opening of a session,allocation of memory and I/O resources */
		//HWND hWnd,            /* Reserved for future use */
        LPSTR lpName,	/* Points to character string containing item name */
		LPHICC hGEM
	);	/* Reference of card session */

WORD DllExport iCC_Close( /* Closure of session and release of resources allocated */ HICC hGEM);	/* Reference of card session */

WORD DllExport iCCOpen_term(LPSTR lpName, LPHICC hicc);

WORD DllExport Apdu
			(
				HICC		hGEM,
				BYTE		Cla,
				BYTE		INS,
				WORD		P1P2,
				BYTE		Lc,
				LPBYTE		Message,
				BYTE		Le,
				LPBYTE		Reponse,
				LPSTATUS	status
			);

WORD DllExport ICCOpen(short FAR *hCT, char FAR *port_name, unsigned mode);

WORD DllExport ICCOpenPort(short *hCT, char *port_name, unsigned modei, unsigned long baud_rate);

WORD DllExport ICCClose(short hCT);

WORD DllExport ICCCreatHandle(LPHICC hCard, short hCT, unsigned dest);

WORD DllExport ICCCloseHandle(HICC hCard);

WORD DllExport ICCCardIn(HICC hCard);

WORD DllExport ICCPowerDown(HICC hCard);

WORD DllExport ICCReset(HICC hCard, LPBYTE Respon, unsigned short FAR *lRep);

WORD DllExport ICCExchange
			(
				HICC				hCard,
				unsigned char		CLA,
				unsigned char		INS,
				unsigned char		P1,
				unsigned char		P2,
				unsigned char		Lc,
				unsigned char FAR	*in,
				unsigned char		Le,
				unsigned char FAR	*out,
				unsigned char FAR	*len,
				unsigned short FAR	*status
			);

WORD DllExport ICCIncoming
			(
				HICC			hCard,
				unsigned char	CLA,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -