[1166] | 1 | /**
|
---|
| 2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 3 | * This file is part of the mingw-w64 runtime package.
|
---|
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
| 5 | */
|
---|
| 6 | #ifndef _NTDDSCRD_H2_
|
---|
| 7 | #define _NTDDSCRD_H2_
|
---|
| 8 |
|
---|
| 9 | #include <_mingw_unicode.h>
|
---|
| 10 |
|
---|
| 11 | #ifdef __cplusplus
|
---|
| 12 | extern "C" {
|
---|
| 13 | #endif
|
---|
| 14 |
|
---|
| 15 | #ifndef BASETYPES
|
---|
| 16 | #define BASETYPES
|
---|
| 17 | typedef unsigned __LONG32 ULONG;
|
---|
| 18 | typedef ULONG *PULONG;
|
---|
| 19 | typedef unsigned short USHORT;
|
---|
| 20 | typedef USHORT *PUSHORT;
|
---|
| 21 | typedef unsigned char UCHAR;
|
---|
| 22 | typedef UCHAR *PUCHAR;
|
---|
| 23 | typedef char *PSZ;
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
| 26 | #ifdef _WINSCARD_H_
|
---|
| 27 | typedef WORD UWORD;
|
---|
| 28 | #else
|
---|
| 29 | typedef ULONG DWORD;
|
---|
| 30 | typedef UCHAR BYTE;
|
---|
| 31 | #endif
|
---|
| 32 |
|
---|
| 33 | #ifndef DEVICE_TYPE_SMARTCARD
|
---|
| 34 | #define FILE_DEVICE_SMARTCARD 0x00000031
|
---|
| 35 | #else
|
---|
| 36 | #if 0x00000031!=FILE_DEVICE_SMARTCARD
|
---|
| 37 | #error Incorrect smart card device definition
|
---|
| 38 | #endif
|
---|
| 39 | #endif
|
---|
| 40 |
|
---|
| 41 | #define SCARD_ATR_LENGTH 33
|
---|
| 42 |
|
---|
| 43 | #define SCARD_PROTOCOL_UNDEFINED 0x00000000
|
---|
| 44 | #define SCARD_PROTOCOL_T0 0x00000001
|
---|
| 45 | #define SCARD_PROTOCOL_T1 0x00000002
|
---|
| 46 | #define SCARD_PROTOCOL_RAW 0x00010000
|
---|
| 47 | #define SCARD_PROTOCOL_Tx (SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1)
|
---|
| 48 | #define SCARD_PROTOCOL_DEFAULT 0x80000000
|
---|
| 49 | #define SCARD_PROTOCOL_OPTIMAL 0x00000000
|
---|
| 50 |
|
---|
| 51 | #define SCARD_POWER_DOWN 0
|
---|
| 52 | #define SCARD_COLD_RESET 1
|
---|
| 53 | #define SCARD_WARM_RESET 2
|
---|
| 54 |
|
---|
| 55 | #define SCARD_CTL_CODE(code) CTL_CODE(FILE_DEVICE_SMARTCARD,(code),METHOD_BUFFERED,FILE_ANY_ACCESS)
|
---|
| 56 |
|
---|
| 57 | #define IOCTL_SMARTCARD_POWER SCARD_CTL_CODE(1)
|
---|
| 58 | #define IOCTL_SMARTCARD_GET_ATTRIBUTE SCARD_CTL_CODE(2)
|
---|
| 59 | #define IOCTL_SMARTCARD_SET_ATTRIBUTE SCARD_CTL_CODE(3)
|
---|
| 60 | #define IOCTL_SMARTCARD_CONFISCATE SCARD_CTL_CODE(4)
|
---|
| 61 | #define IOCTL_SMARTCARD_TRANSMIT SCARD_CTL_CODE(5)
|
---|
| 62 | #define IOCTL_SMARTCARD_EJECT SCARD_CTL_CODE(6)
|
---|
| 63 | #define IOCTL_SMARTCARD_SWALLOW SCARD_CTL_CODE(7)
|
---|
| 64 |
|
---|
| 65 | #define IOCTL_SMARTCARD_IS_PRESENT SCARD_CTL_CODE(10)
|
---|
| 66 | #define IOCTL_SMARTCARD_IS_ABSENT SCARD_CTL_CODE(11)
|
---|
| 67 | #define IOCTL_SMARTCARD_SET_PROTOCOL SCARD_CTL_CODE(12)
|
---|
| 68 | #define IOCTL_SMARTCARD_GET_STATE SCARD_CTL_CODE(14)
|
---|
| 69 | #define IOCTL_SMARTCARD_GET_LAST_ERROR SCARD_CTL_CODE(15)
|
---|
| 70 | #define IOCTL_SMARTCARD_GET_PERF_CNTR SCARD_CTL_CODE(16)
|
---|
| 71 |
|
---|
| 72 | #define MAXIMUM_ATTR_STRING_LENGTH 32
|
---|
| 73 | #define MAXIMUM_SMARTCARD_READERS 10
|
---|
| 74 |
|
---|
| 75 | #define SCARD_ATTR_VALUE(Class,Tag) ((((ULONG)(Class)) << 16) | ((ULONG)(Tag)))
|
---|
| 76 |
|
---|
| 77 | #define SCARD_CLASS_VENDOR_INFO 1
|
---|
| 78 | #define SCARD_CLASS_COMMUNICATIONS 2
|
---|
| 79 | #define SCARD_CLASS_PROTOCOL 3
|
---|
| 80 | #define SCARD_CLASS_POWER_MGMT 4
|
---|
| 81 | #define SCARD_CLASS_SECURITY 5
|
---|
| 82 | #define SCARD_CLASS_MECHANICAL 6
|
---|
| 83 | #define SCARD_CLASS_VENDOR_DEFINED 7
|
---|
| 84 | #define SCARD_CLASS_IFD_PROTOCOL 8
|
---|
| 85 | #define SCARD_CLASS_ICC_STATE 9
|
---|
| 86 | #define SCARD_CLASS_PERF 0x7ffe
|
---|
| 87 | #define SCARD_CLASS_SYSTEM 0x7fff
|
---|
| 88 |
|
---|
| 89 | #define SCARD_ATTR_VENDOR_NAME SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO,0x0100)
|
---|
| 90 | #define SCARD_ATTR_VENDOR_IFD_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO,0x0101)
|
---|
| 91 | #define SCARD_ATTR_VENDOR_IFD_VERSION SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO,0x0102)
|
---|
| 92 | #define SCARD_ATTR_VENDOR_IFD_SERIAL_NO SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_INFO,0x0103)
|
---|
| 93 | #define SCARD_ATTR_CHANNEL_ID SCARD_ATTR_VALUE(SCARD_CLASS_COMMUNICATIONS,0x0110)
|
---|
| 94 | #define SCARD_ATTR_PROTOCOL_TYPES SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL,0x0120)
|
---|
| 95 |
|
---|
| 96 | #define SCARD_ATTR_DEFAULT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL,0x0121)
|
---|
| 97 | #define SCARD_ATTR_MAX_CLK SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL,0x0122)
|
---|
| 98 | #define SCARD_ATTR_DEFAULT_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL,0x0123)
|
---|
| 99 | #define SCARD_ATTR_MAX_DATA_RATE SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL,0x0124)
|
---|
| 100 | #define SCARD_ATTR_MAX_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_PROTOCOL,0x0125)
|
---|
| 101 |
|
---|
| 102 | #define SCARD_ATTR_POWER_MGMT_SUPPORT SCARD_ATTR_VALUE(SCARD_CLASS_POWER_MGMT,0x0131)
|
---|
| 103 | #define SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY,0x0140)
|
---|
| 104 | #define SCARD_ATTR_USER_AUTH_INPUT_DEVICE SCARD_ATTR_VALUE(SCARD_CLASS_SECURITY,0x0142)
|
---|
| 105 | #define SCARD_ATTR_CHARACTERISTICS SCARD_ATTR_VALUE(SCARD_CLASS_MECHANICAL,0x0150)
|
---|
| 106 |
|
---|
| 107 | #define SCARD_ATTR_CURRENT_PROTOCOL_TYPE SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0201)
|
---|
| 108 | #define SCARD_ATTR_CURRENT_CLK SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0202)
|
---|
| 109 | #define SCARD_ATTR_CURRENT_F SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0203)
|
---|
| 110 | #define SCARD_ATTR_CURRENT_D SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0204)
|
---|
| 111 | #define SCARD_ATTR_CURRENT_N SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0205)
|
---|
| 112 | #define SCARD_ATTR_CURRENT_W SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0206)
|
---|
| 113 | #define SCARD_ATTR_CURRENT_IFSC SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0207)
|
---|
| 114 | #define SCARD_ATTR_CURRENT_IFSD SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0208)
|
---|
| 115 | #define SCARD_ATTR_CURRENT_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x0209)
|
---|
| 116 | #define SCARD_ATTR_CURRENT_CWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x020a)
|
---|
| 117 | #define SCARD_ATTR_CURRENT_EBC_ENCODING SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x020b)
|
---|
| 118 | #define SCARD_ATTR_EXTENDED_BWT SCARD_ATTR_VALUE(SCARD_CLASS_IFD_PROTOCOL,0x020c)
|
---|
| 119 |
|
---|
| 120 | #define SCARD_ATTR_ICC_PRESENCE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE,0x0300)
|
---|
| 121 | #define SCARD_ATTR_ICC_INTERFACE_STATUS SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE,0x0301)
|
---|
| 122 | #define SCARD_ATTR_CURRENT_IO_STATE SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE,0x0302)
|
---|
| 123 | #define SCARD_ATTR_ATR_STRING SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE,0x0303)
|
---|
| 124 | #define SCARD_ATTR_ICC_TYPE_PER_ATR SCARD_ATTR_VALUE(SCARD_CLASS_ICC_STATE,0x0304)
|
---|
| 125 |
|
---|
| 126 | #define SCARD_ATTR_ESC_RESET SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED,0xA000)
|
---|
| 127 | #define SCARD_ATTR_ESC_CANCEL SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED,0xA003)
|
---|
| 128 | #define SCARD_ATTR_ESC_AUTHREQUEST SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED,0xA005)
|
---|
| 129 | #define SCARD_ATTR_MAXINPUT SCARD_ATTR_VALUE(SCARD_CLASS_VENDOR_DEFINED,0xA007)
|
---|
| 130 |
|
---|
| 131 | #define SCARD_ATTR_DEVICE_UNIT SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM,0x0001)
|
---|
| 132 | #define SCARD_ATTR_DEVICE_IN_USE SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM,0x0002)
|
---|
| 133 | #define SCARD_ATTR_DEVICE_FRIENDLY_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM,0x0003)
|
---|
| 134 | #define SCARD_ATTR_DEVICE_SYSTEM_NAME_A SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM,0x0004)
|
---|
| 135 | #define SCARD_ATTR_DEVICE_FRIENDLY_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM,0x0005)
|
---|
| 136 | #define SCARD_ATTR_DEVICE_SYSTEM_NAME_W SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM,0x0006)
|
---|
| 137 | #define SCARD_ATTR_SUPRESS_T1_IFS_REQUEST SCARD_ATTR_VALUE(SCARD_CLASS_SYSTEM,0x0007)
|
---|
| 138 |
|
---|
| 139 | #define SCARD_PERF_NUM_TRANSMISSIONS SCARD_ATTR_VALUE(SCARD_CLASS_PERF,0x0001)
|
---|
| 140 | #define SCARD_PERF_BYTES_TRANSMITTED SCARD_ATTR_VALUE(SCARD_CLASS_PERF,0x0002)
|
---|
| 141 | #define SCARD_PERF_TRANSMISSION_TIME SCARD_ATTR_VALUE(SCARD_CLASS_PERF,0x0003)
|
---|
| 142 |
|
---|
| 143 | #define SCARD_ATTR_DEVICE_FRIENDLY_NAME __MINGW_NAME_UAW(SCARD_ATTR_DEVICE_FRIENDLY_NAME)
|
---|
| 144 | #define SCARD_ATTR_DEVICE_SYSTEM_NAME __MINGW_NAME_UAW(SCARD_ATTR_DEVICE_SYSTEM_NAME)
|
---|
| 145 |
|
---|
| 146 | #define SCARD_T0_HEADER_LENGTH 7
|
---|
| 147 | #define SCARD_T0_CMD_LENGTH 5
|
---|
| 148 |
|
---|
| 149 | #define SCARD_T1_PROLOGUE_LENGTH 3
|
---|
| 150 | #define SCARD_T1_EPILOGUE_LENGTH 2
|
---|
| 151 | #define SCARD_T1_MAX_IFS 254
|
---|
| 152 |
|
---|
| 153 | #define SCARD_UNKNOWN 0
|
---|
| 154 | #define SCARD_ABSENT 1
|
---|
| 155 | #define SCARD_PRESENT 2
|
---|
| 156 | #define SCARD_SWALLOWED 3
|
---|
| 157 | #define SCARD_POWERED 4
|
---|
| 158 | #define SCARD_NEGOTIABLE 5
|
---|
| 159 | #define SCARD_SPECIFIC 6
|
---|
| 160 |
|
---|
| 161 | typedef struct _SCARD_IO_REQUEST {
|
---|
| 162 | DWORD dwProtocol;
|
---|
| 163 | DWORD cbPciLength;
|
---|
| 164 | } SCARD_IO_REQUEST,*PSCARD_IO_REQUEST,*LPSCARD_IO_REQUEST;
|
---|
| 165 | typedef const SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
|
---|
| 166 |
|
---|
| 167 | typedef struct {
|
---|
| 168 | BYTE
|
---|
| 169 | bCla,bIns,bP1,bP2,bP3;
|
---|
| 170 | } SCARD_T0_COMMAND,*LPSCARD_T0_COMMAND;
|
---|
| 171 |
|
---|
| 172 | typedef struct {
|
---|
| 173 | SCARD_IO_REQUEST ioRequest;
|
---|
| 174 | BYTE bSw1,bSw2;
|
---|
| 175 | __C89_NAMELESS union {
|
---|
| 176 | SCARD_T0_COMMAND CmdBytes;
|
---|
| 177 | BYTE rgbHeader[5];
|
---|
| 178 | };
|
---|
| 179 | } SCARD_T0_REQUEST;
|
---|
| 180 |
|
---|
| 181 | typedef SCARD_T0_REQUEST *PSCARD_T0_REQUEST,*LPSCARD_T0_REQUEST;
|
---|
| 182 |
|
---|
| 183 | typedef struct {
|
---|
| 184 | SCARD_IO_REQUEST ioRequest;
|
---|
| 185 | } SCARD_T1_REQUEST;
|
---|
| 186 | typedef SCARD_T1_REQUEST *PSCARD_T1_REQUEST,*LPSCARD_T1_REQUEST;
|
---|
| 187 |
|
---|
| 188 | #define SCARD_READER_SWALLOWS 0x00000001
|
---|
| 189 | #define SCARD_READER_EJECTS 0x00000002
|
---|
| 190 | #define SCARD_READER_CONFISCATES 0x00000004
|
---|
| 191 |
|
---|
| 192 | #define SCARD_READER_TYPE_SERIAL 0x01
|
---|
| 193 | #define SCARD_READER_TYPE_PARALELL 0x02
|
---|
| 194 | #define SCARD_READER_TYPE_KEYBOARD 0x04
|
---|
| 195 | #define SCARD_READER_TYPE_SCSI 0x08
|
---|
| 196 | #define SCARD_READER_TYPE_IDE 0x10
|
---|
| 197 | #define SCARD_READER_TYPE_USB 0x20
|
---|
| 198 | #define SCARD_READER_TYPE_PCMCIA 0x40
|
---|
| 199 | #define SCARD_READER_TYPE_VENDOR 0xF0
|
---|
| 200 |
|
---|
| 201 | #ifdef __cplusplus
|
---|
| 202 | }
|
---|
| 203 | #endif
|
---|
| 204 | #endif
|
---|