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

📄 magcard.h

📁 一个读取ic卡的读卡程序。一个读取ic卡的读卡程序一个读取ic卡的读卡程序
💻 H
📖 第 1 页 / 共 5 页
字号:
int       PASCAL ICCGetATR    (byte*[], unsigned int*,
                                        int ch,int mode);
int       PASCAL ICCGetChipVersion (byte*[], unsigned int*,
                                        int ch,int mode);
int       PASCAL ICCCardActive (int mode,
                                        int ch
                                        );
int       PASCAL ICCCardInitial (
                                        int ch
                                        );
int       PASCAL ICCCheckCard (int ch
                                        );
int       PASCAL ICCReadBinary (struct ICCCommand  * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );

int       PASCAL ICCUpdateBinary (struct ICCCommand  * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCEraseBinary (struct ICCCommand * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCSelectFile (struct ICCCommand * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCVerify (struct ICCCommand * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCReadRecord (struct ICCCommand * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );

int       PASCAL ICCUpdateRecord (struct ICCCommand * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCDeleteRecord (struct ICCCommand * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCCreateFile (struct ICCCommand  * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCDeleteFile (struct ICCCommand  * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCCrypt (struct ICCCommand  * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCDecrease (struct ICCCommand  * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );
int       PASCAL ICCIncrease (struct ICCCommand  * com,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );

int       PASCAL ICCDes (struct ICCCodeBlock  *des,int mode);

int       PASCAL ICCSend (struct ICCApdu  * bl,
                                        struct ICCResponse * res,
                                        struct ICCSecurity * sec,
                                        int ch,int mode
                                        );

#ifdef __cplusplus
}
#endif

/***************************************************************************/
/*                      function modes                                     */
/***************************************************************************/

/* defines for function modes */

#define   ICC_READBINEF        1
#define   ICC_READBIN          0
#define   ICC_WRITEBINEF       1
#define   ICC_WRITEBIN         0
#define   ICC_UPDATEBINEF      ICC_WRITEBINEF
#define   ICC_UPDATEBIN        ICC_WRITEBIN
#define   ICC_ERASEBINEF       1
#define   ICC_ERASEBIN         0
#define   ICC_SELFILEID        0
#define   ICC_SELCHILDDF       1
#define   ICC_SELEF            2
#define   ICC_SELPARENTDF      3
#define   ICC_SELFILENAME      4
#define   ICC_SELFROMMF        8
#define   ICC_SELFROMDF        9
#define   ICC_PINMOD           1
#define   ICC_PINDEL           2
#define   ICC_SECURITYTEST     8
#define   ICC_CHALLENGERESP    9
#define   ICC_READREC          4
#define   ICC_READALLREC       5
#define   ICC_READFIRSTREC     0
#define   ICC_READLASTREC      1
#define   ICC_READNEXTREC      2
#define   ICC_READPREVREC      3
#define   ICC_WRITEUPDATE      4
#define   ICC_WRITEAPPEND      6
#define   ICC_DEL              4
#define   ICC_DELREC           5
#define   ICC_DELFIRSTREC      0
#define   ICC_DELLASTREC       1
#define   ICC_DELNEXTREC       2
#define   ICC_DELPREVREC       3
#define   ICC_CREATEMF        63
#define   ICC_CREATEFILE       0
#define   ICC_CREATEFILESEL    1
#define   ICC_CREATEFILEAFC    2
#define   ICC_CREATEFILESELAFC 3
#define   ICC_DELFILEID        0
#define   ICC_DELCHILDDF       1
#define   ICC_DELEF            2
#define   ICC_DELPARENTDF      3
#define   ICC_DELFILENAME      4
#define   ICC_DELFROMMF        8
#define   ICC_DELFROMDF        9
#define   ICC_EXECUTE          0
#define   ICC_DECREASE         1
#define   ICC_DECREASESEL      2
#define   ICC_INCREASE         3
#define   ICC_INCREASESEL      4

/* defines for cypher modes */

#define   ICC_ECBENCRYPT    0x80
#define   ICC_CBCENCRYPT    0x82
#define   ICC_ECBDECRYPT    0x81
#define   ICC_CBCDECRYPT    0x83
#define   ICC_MACGEN        0x02
#define   ICC_MACVER        0x03

#define   ICC_NONE             0
#define   ICC_DES              1
#define   ICC_EBC              2

/* pass it to 'ICCSetVersion' if you like to perform a OS version adjustment
   automatically while catching smart card's ATR */

#define AUTO                  -1

/***************************************************************************/
/*                        error codes                                      */
/***************************************************************************/

#define OK                     0
#define NOTOK                 -1
#define NOCOMMAND             -2
#define NONACKRETRY           -3
#define NORESYNCRETRY         -4
#define NOSTATE               -5
#define NORESPONSE            -6
#define NOTXCOMMAND           -7
#define NOSEND                -8
#define NOSENDRETRY           -9
#define NOSYNC               -10

#define MACERROR             -11
#define NODATABUFFER         -12

#define NOCARDOSATR          -13
#define CHKSUMERR            -14
#define LENERROR             -15
#define IFSERROR             -16

#define CARDNOTREADY         -17
#define NULLPOINTER          -18
#define NOTSUPPORTED         -19

#define UNKNOWNATR           -20
#define NOCHIPVERSION        -21

/***************************************************************************/
/*                        ICCDES error codes                               */
/***************************************************************************/

#define INVALIDKEY            -1
#define INVALIDLS             -2
#define INVALIDSIGNATURE      -3

#endif /* _CARDOS_H_ */


#ifndef _FC80_32_H_
#define _FC80_32_H_

#define	FAPI	char * FAR PASCAL

#define	MAXBUF	256

//	define Error code
#define err_InDataTooLong			-100
#define err_OutDataTooLong			-101
#define err_InDataLenNotEven		-110
#define err_OutDataLenNotEven		-111
#define err_InDataNotValid			-120
#define err_OutDataNotValid			-121
#define err_InDataOutRange			-130
#define err_OutDataOutRange			-131
#define	err_InDataTooBig			-140
#define	err_OutDataTooBig			-141

#ifdef __cplusplus
extern "C" {
#endif

FAPI f_CardInitial( int ch );
FAPI f_Init( int ch );
FAPI f_Close( int ch );
FAPI f_CheckCard( int ch );
FAPI f_ActiveCard( int actmode, int ch );
FAPI f_GetATR( int ch, int atrmode );
FAPI f_CreateMF( char * fhead, int ch );	//	return
FAPI f_CreateDF( char * fhead, int ch );	//	return
FAPI f_CreateEF( char * fhead, int ch );	//	return
FAPI f_CreateSTCF( char * fhead, int idSTCF, int ch );	//	?? idSTCF
FAPI f_CreatePin( char *fhead, int ch );	//
FAPI f_DeleteFile( char *fname, int delmode, int ch );
FAPI f_SelectFile( char *fname, int selmode, int ch );
FAPI f_UpdateRecord( int idRec, char * istr, int ch, int dmode );
FAPI f_AppendRecord( int idRec, char * istr, int ch, int dmode );
FAPI f_ReadRecord( int idRec, int ch, int dmode );
FAPI f_DeleteRecord( int idRec, int ch );
FAPI f_Decrease( int val, int ch );
FAPI f_Increase( int val, int ch );
FAPI f_Crypt( int idfile, int idcrypt, char * cryptstr, int fcrypt, int ch );
FAPI f_PINVerify( int idpin, char * pinstr, int ch, int pinmode );
FAPI f_PINModify( int idpin, char * pinstr, int ch, int pinmode );
//FAPI f_Des( char * deskey, char * initvec, char * data, int fdes );

#ifdef __cplusplus
}
#endif

#endif  // _FC80_32_H_

#ifndef _H_NBS2000
#define _H_NBS2000

#ifdef __cplusplus
extern "C" {
#endif

int MCAPI
NBS2000_open(int port, int baudRate);

int MCAPI
NBS2000_defineCard(int type, int nLines, int *x, int *y, int *font);

int MCAPI
NBS2000_pickCard();

int MCAPI
NBS2000_acceptCard();

int MCAPI
NBS2000_rejectCard();

int MCAPI
NBS2000_clearCounter();

int MCAPI
NBS2000_begin(int type, int id);

int MCAPI
NBS2000_print(const char *string);

int MCAPI
NBS2000_writeTrack(int track, const char *string);

int MCAPI
NBS2000_end();

int MCAPI
NBS2000_getLastID(int *id);

int MCAPI
NBS2000_close();

#ifdef __cplusplus
}
#endif

#endif

#ifndef _H_RF
#define _H_RF

typedef struct {
	byte order;
	byte sn[4];
	byte group;
	HCONNECTION handle;
} RF_CTX;

#ifdef __cplusplus
extern "C" {
#endif

int MCAPI
RF_Init(RF_CTX *ctx, int port, int baudRate);

int MCAPI
RF_getInfo(RF_CTX *ctx, byte *data);

int MCAPI
RF_beep(RF_CTX *ctx, byte time);

int MCAPI
RF_MIFARE1_halt(RF_CTX *ctx);

int MCAPI
RF_MIFARE1_request(RF_CTX *ctx, byte model);

int MCAPI
RF_MIFARE1_antiColl(RF_CTX *ctx);

int MCAPI
RF_MIFARE1_select(RF_CTX *ctx);

int MCAPI
RF_MIFARE1_authentication(RF_CTX *ctx, byte sector, byte keyType, byte *key);

int MCAPI
RF_MIFARE1_write(RF_CTX *ctx, byte block, byte *data);

int MCAPI
RF_MIFARE1_read(RF_CTX *ctx, byte block, byte *data);

int MCAPI
RF_Final(RF_CTX *ctx);

#ifdef __cplusplus
}
#endif

#endif // _H_RF

#ifndef _H_MCSERVER
#define _H_MCSERVER

#ifdef __cplusplus
extern "C" {
#endif

int MCAPI
MCServer(int port, const char *qs, unsigned second);

#ifdef __cplusplus
    }
#endif

#endif // _H_MCSERVER

#ifndef _H_EI
#define _H_EI

typedef struct {
	HCONNECTION handle;
	uint8 UID[9];
	uint8 useUID;
} EI_CTX;

#ifdef __cplusplus
extern "C" {
#endif

int MCAPI
EI_init(EI_CTX *ctx, int port, int baudRate);

int MCAPI
EI_inventoryMode(EI_CTX *ctx, uint8 *buffer, int *nCards);

int MCAPI
EI_setCard(EI_CTX *ctx, const uint8 *buffer);

int MCAPI
EI_resetCard(EI_CTX *ctx);

int MCAPI
EI_readBlock(EI_CTX *ctx, int iBlock, uint8 *buffer, int *len);

int MCAPI
EI_writeBlock(EI_CTX *ctx, int iBlock, const uint8 *buffer, int len);

int MCAPI
EI_lockBlock(EI_CTX *ctx, int iBlock);

int MCAPI
EI_getSystemInfo(EI_CTX *ctx, uint8 *buffer);

int MCAPI
EI_setBaudRate(EI_CTX *ctx, uint8 *buffer);

int MCAPI
EI_final(EI_CTX *ctx);

#ifdef __cplusplus
}
#endif

#endif // _H_EI

#endif

⌨️ 快捷键说明

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