using System;
using System.Runtime.InteropServices;
using static cn.mineki.Reader.IDCardReader;

namespace cn.mineki.Reader
{
    public class MKReader64
    {
        const String termb_x64 = @"3rd_lib\termb64.dll";

        #region 导入函数
        [DllImport(termb_x64, EntryPoint = "Buzzer", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int Buzzer64(byte beepTime, byte waitTime, byte beepCount);

        [DllImport(termb_x64, EntryPoint = "InitComm", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int InitComm64(ReaderPortNum port);

        [DllImport(termb_x64, EntryPoint = "CloseComm", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int CloseComm64();

        [DllImport(termb_x64, EntryPoint = "Authenticate", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int Authenticate64();

        [DllImport(termb_x64, EntryPoint = "Read_Content", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int Read_Content64(int active);

        [DllImport(termb_x64, EntryPoint = "Read_Content_Path", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int Read_Content_Path64(string path, int active);

        [DllImport(termb_x64, EntryPoint = "GetSAMID", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int GetSAMID64([MarshalAs(UnmanagedType.LPArray)]byte[] id);

        [DllImport(termb_x64, EntryPoint = "TransApduCommand", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int TransApduCommand64(ReaderSlotNum nReaderSlot, [MarshalAs(UnmanagedType.LPArray)]byte[] pSendDatas, int nSendLen, [MarshalAs(UnmanagedType.LPArray)]byte[] pRecvDatas, ref int nRecvLen);

        [DllImport(termb_x64, EntryPoint = "ActivateCard", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ActivateCard64(ReaderSlotNum nReaderSlot, [MarshalAs(UnmanagedType.LPArray)]byte[] pRecvDatas, ref int nRecvLen);

        [DllImport(termb_x64, EntryPoint = "SetAntPower", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int SetAntPower64(int nPowerOn);

        #region ISO7816
        [DllImport(termb_x64, EntryPoint = "ISO7816_CardInsert", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO7816_CardInsert64(ReaderSlotNum nSlot);
        [DllImport(termb_x64, EntryPoint = "ISO7816_CardRemove", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO7816_CardRemove64(ReaderSlotNum nSlot);
        [DllImport(termb_x64, EntryPoint = "ISO7816_TransApdu", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO7816_TransApdu64(ReaderSlotNum nReaderSlot, [MarshalAs(UnmanagedType.LPArray)]byte[] pSendDatas, int nSendLen, [MarshalAs(UnmanagedType.LPArray)]byte[] pRecvDatas, ref int nRecvLen);
        #endregion

        [DllImport(termb_x64, EntryPoint = "ISO14443_TransApdu", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO14443_TransApdu64(ReaderSlotNum nReaderSlot, [MarshalAs(UnmanagedType.LPArray)]byte[] pSendDatas, int nSendLen, [MarshalAs(UnmanagedType.LPArray)]byte[] pRecvDatas, ref int nRecvLen);

        #region 机读旅行证件相关函数
        //---------------------------------------------------------------------------
        [DllImport(termb_x64, EntryPoint = "EPP_GetInfo", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int EPP_GetInfo64(ref EPP_Info pInfo);

        [DllImport(termb_x64, EntryPoint = "EPP_Authentication", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int EPP_Authentication64(string pn, string bod, string eod);

        [DllImport(termb_x64, EntryPoint = "EPP_Read_Content", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int EPP_Read_Content64(int active);

        [DllImport(termb_x64, EntryPoint = "EPP_Read_Content_Path", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int EPP_Read_Content_Path64(string cPath, int active);
        #endregion

        #region 读取银行卡
        //---------------------------------------------------------------------------
        [DllImport(termb_x64, EntryPoint = "BC_Read_Content", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int BC_Read_Content64(ref BC_INFO info);
        #endregion

        #region 读取社保卡
        //---------------------------------------------------------------------------
        [DllImport(termb_x64, EntryPoint = "SSC_Authentication", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int SSC_Authentication64(ReaderSlotNum nReaderSlot);


        [DllImport(termb_x64, EntryPoint = "SSC_Read_Content", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int SSC_Read_Content64(ReaderSlotNum nReaderSlot, ref SSC_INFO info);
        #endregion

        #region 读取电子身份证
        //---------------------------------------------------------------------------
        [DllImport(termb_x64, EntryPoint = "EID_Authentication", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int EID_Authentication64([MarshalAs(UnmanagedType.LPArray)]byte[] byEidCardID);

        [DllImport(termb_x64, EntryPoint = "EID_Read_Content", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int EID_Read_Content64([MarshalAs(UnmanagedType.LPArray)]byte[] byEidCardID);
        #endregion

        #region  ISO15693标签
        [DllImport(termb_x64, EntryPoint = "ISO15693_ReadSingleBlock", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_ReadSingleBlock64(bool readSecSta, int nBlkAddr, [MarshalAs(UnmanagedType.LPArray)]byte[] bufBlockDat, int nSize, ref int bytesBlkDatRead);

        [DllImport(termb_x64, EntryPoint = "ISO15693_WriteSingleBlock", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_WriteSingleBlock64(int blkAddr, [MarshalAs(UnmanagedType.LPArray)]byte[] newBlkData, int bytesToWrite);

        [DllImport(termb_x64, EntryPoint = "ISO15693_ReadMultiBlocks", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_ReadMultiBlocks64(bool readSecSta, int nBlkAddr, int numOfBlksToRead, ref int numOfBlksRead, [MarshalAs(UnmanagedType.LPArray)]byte[] bufBlockDat, int nSize, ref int bytesBlkDatRead);

        [DllImport(termb_x64, EntryPoint = "ISO15693_WriteMultipleBlocks", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_WriteMultipleBlocks64(int blkAddr, int numOfBlks, [MarshalAs(UnmanagedType.LPArray)]byte[] newBlkData, int bytesToWrite);

        [DllImport(termb_x64, EntryPoint = "ISO15693_GetBlockSecStatus", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_GetBlockSecStatus64(int blkAddr, int numOfBlks, [MarshalAs(UnmanagedType.LPArray)]byte[] bufBlkSecs, int nSize, ref int bytesSecRead);

        [DllImport(termb_x64, EntryPoint = "ISO15693_GetSystemInfo", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_GetSystemInfo64([MarshalAs(UnmanagedType.LPArray)]byte[] uid, ref byte dsfid, ref byte afi, ref int blkSize, ref int numOfBloks, ref byte icRef);

        [DllImport(termb_x64, EntryPoint = "ISO15693_LockMultipleBlocks", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_LockMultipleBlocks64(int blkAddr, int numOfBlks);

        [DllImport(termb_x64, EntryPoint = "ISO15693_WriteAFI", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_WriteAFI64(byte afi);

        [DllImport(termb_x64, EntryPoint = "ISO15693_LockAFI", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_LockAFI64();

        [DllImport(termb_x64, EntryPoint = "ISO15693_WriteDSFID", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_WriteDSFID64(byte dsfid);

        [DllImport(termb_x64, EntryPoint = "ISO15693_LockDSFID", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_LockDSFID64();

        [DllImport(termb_x64, EntryPoint = "ISO15693_Inventory", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int ISO15693_Inventory64(byte afi, [MarshalAs(UnmanagedType.LPArray)]byte[] bufUids, int nSize, ref int bytesUidNums);
        #endregion

        #region MIFARE卡相关函数
        //---------------------------------------------------------------------------
        //MIFARE卡相关函数
        //---------------------------------------------------------------------------
        [DllImport(termb_x64, EntryPoint = "MIFARE_Authentication", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int MIFARE_Authentication64(byte bSectorNo, byte[] pbKeyA, byte[] pbKeyB);
        [DllImport(termb_x64, EntryPoint = "MIFARE_ReadData", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int MIFARE_ReadData64(byte bBlock, [MarshalAs(UnmanagedType.LPArray)]byte[] data, int nLen);
        [DllImport(termb_x64, EntryPoint = "MIFARE_WrtieData", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int MIFARE_WrtieData64(byte bBlock, byte[] data, int nLen);
        [DllImport(termb_x64, EntryPoint = "MIFARE_IncrementValue", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int MIFARE_IncrementValue64(byte bBlock, int nValue);
        [DllImport(termb_x64, EntryPoint = "MIFARE_DecrementValue", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int MIFARE_DecrementValue64(byte bBlock, int nValue);
        [DllImport(termb_x64, EntryPoint = "MIFARE_ReadValue", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int MIFARE_ReadValue64(byte bBlock, ref int pnValue);
        [DllImport(termb_x64, EntryPoint = "MIFARE_InitValue", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int MIFARE_InitValue64(byte bBlock, int nValue);
        [DllImport(termb_x64, EntryPoint = "MIFARE_WriteSectorTrailer", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int MIFARE_WriteSectorTrailer64(byte bBlock, byte[] pbKEYA, byte[] pbKEYB, byte[] pbAccessBits);
        #endregion

        #region 第二代居民身份证
        [DllImport(termb_x64, EntryPoint = "GetName2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetName64([MarshalAs(UnmanagedType.LPArray)]byte[] sName, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetSex2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetSex64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetNation2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetNation64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetBornDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetBornDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetAddress2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetAddress64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetIDNo2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetIDNo64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetSignGov2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetSignGov64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetStartDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetStartDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetEndDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetEndDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetNewAddress2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetNewAddress64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetFingerPrint", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFingerPrint64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "MakeIDCardImages", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool MakeIDCardImages64(string sHead,string sIDCardImageFace,string sIDCardImageBack);

        [DllImport(termb_x64, EntryPoint = "GetPhoto", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetPhoto64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        #endregion

        #region 外国人永久居住证
        [DllImport(termb_x64, EntryPoint = "IsFPRIDCard", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int IsFPRIDCard64();//是否是外国人居住证

        [DllImport(termb_x64, EntryPoint = "GetFPR_ENName2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_ENName64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//英文名

        [DllImport(termb_x64, EntryPoint = "GetFPR_SEX2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_SEX64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//性别

        [DllImport(termb_x64, EntryPoint = "GetFPR_IDNo2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_IDNo64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//身份证号

        [DllImport(termb_x64, EntryPoint = "GetFPR_NationCode2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_NationCode64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//国籍代码

        [DllImport(termb_x64, EntryPoint = "GetFPR_Nation2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_Nation64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//国籍代码中文()

        [DllImport(termb_x64, EntryPoint = "GetFPR_CHNName2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_CHNName64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//中文姓名

        [DllImport(termb_x64, EntryPoint = "GetFPR_ValidStartDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_ValidStartDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//证件签发时间

        [DllImport(termb_x64, EntryPoint = "GetFPR_ValidEndDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_ValidEndDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//证件终止时间

        [DllImport(termb_x64, EntryPoint = "GetFPR_Birthday2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_Birthday64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//出生日期

        [DllImport(termb_x64, EntryPoint = "GetFPR_IDVersion2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_IDVersion64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//证件版本号

        [DllImport(termb_x64, EntryPoint = "GetFPR_IssuingAuthorityCode2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_IssuingAuthorityCode64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//当次申请受理机关代码

        [DllImport(termb_x64, EntryPoint = "GetFPR_IDType2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR_IDType64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//证件类型标识
        #endregion

        #region 新版外国人永久居住证相关函数
        [DllImport(termb_x64, EntryPoint = "IsFPR2IDCard", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int IsFPR2IDCard64();//是否是外国人居住证
        [DllImport(termb_x64, EntryPoint = "GetFPR2_CHNName2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_CHNName64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//中文姓名
        [DllImport(termb_x64, EntryPoint = "GetFPR2_SexCode2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_SexCode64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//性别代码
        [DllImport(termb_x64, EntryPoint = "GetFPR2_RenewalTimes2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_RenewalTimes64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//换证次数        
        [DllImport(termb_x64, EntryPoint = "GetFPR2_Birthday2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_Birthday64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_ENName2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_ENName64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_ReserveA2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_ReserveA64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_ValidStartDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_ValidStartDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_ValidEndDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_ValidEndDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_ENNameB2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_ENNameB64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_NationCode2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_NationCode64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_Nation2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_Nation64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_IDType2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_IDType64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_ReserveB2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_ReserveB64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);
        [DllImport(termb_x64, EntryPoint = "GetFPR2_Sex2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_Sex64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);

        [DllImport(termb_x64, EntryPoint = "GetFPR2_IDNo2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetFPR2_IDNo64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//身份证号
        #endregion


        #region 港澳台居民居住证
        //---------------------------------------------------------------------------
        [DllImport(termb_x64, EntryPoint = "IsGATIDCard", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern int IsGATIDCard64();//是否港澳台居民居住证

        [DllImport(termb_x64, EntryPoint = "GetGAT_Name2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_Name64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//姓名

        [DllImport(termb_x64, EntryPoint = "GetGAT_SEX2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_SEX64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//性别

        [DllImport(termb_x64, EntryPoint = "GetGAT_SEXCode2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_SEXCode64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//性别代码

        [DllImport(termb_x64, EntryPoint = "GetGAT_Address2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_Address64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//详细地址

        [DllImport(termb_x64, EntryPoint = "GetGAT_IDNo2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_IDNo64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//公民身份证号码

        [DllImport(termb_x64, EntryPoint = "GetGAT_IssuingAuthority2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_IssuingAuthority64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//签发机关

        [DllImport(termb_x64, EntryPoint = "GetGAT_ValidStartDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_ValidStartDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//有效起始日期

        [DllImport(termb_x64, EntryPoint = "GetGAT_ValidEndDate2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_ValidEndDate64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//有效截至日期

        [DllImport(termb_x64, EntryPoint = "GetGAT_PassportNo2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_PassportNo64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//通行证号码(

        [DllImport(termb_x64, EntryPoint = "GetGAT_IssuanceCount2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_IssuanceCount64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//签发次数

        [DllImport(termb_x64, EntryPoint = "GetGAT_IDType2", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
        public static extern bool GetGAT_IDType64([MarshalAs(UnmanagedType.LPArray)]byte[] sBuf, ref int nLen);//证件类型标识(2B),大写字母J

        #endregion
        #endregion

    }
}
