pcsc-lite 2.3.0
winscard.h
Go to the documentation of this file.
1/*
2 * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
3 *
4 * Copyright (C) 1999-2003
5 * David Corcoran <corcoran@musclecard.com>
6 * Copyright (C) 2002-2018
7 * Ludovic Rousseau <ludovic.rousseau@free.fr>
8 *
9Redistribution and use in source and binary forms, with or without
10modification, are permitted provided that the following conditions
11are met:
12
131. Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
152. Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in the
17 documentation and/or other materials provided with the distribution.
183. The name of the author may not be used to endorse or promote products
19 derived from this software without specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
38#ifndef __winscard_h__
39#define __winscard_h__
40
41#include <pcsclite.h>
42
43#ifdef __cplusplus
44extern "C"
45{
46#endif
47
48#ifndef PCSC_API
49#define PCSC_API
50#endif
51
52 PCSC_API LONG SCardEstablishContext(DWORD dwScope,
53 /*@null@*/ LPCVOID pvReserved1, /*@null@*/ LPCVOID pvReserved2,
54 /*@out@*/ LPSCARDCONTEXT phContext);
55
56 PCSC_API LONG SCardReleaseContext(SCARDCONTEXT hContext);
57
58 PCSC_API LONG SCardIsValidContext(SCARDCONTEXT hContext);
59
60 PCSC_API LONG SCardConnect(SCARDCONTEXT hContext,
61 LPCSTR szReader,
62 DWORD dwShareMode,
63 DWORD dwPreferredProtocols,
64 /*@out@*/ LPSCARDHANDLE phCard, /*@out@*/ LPDWORD pdwActiveProtocol);
65
66 PCSC_API LONG SCardReconnect(SCARDHANDLE hCard,
67 DWORD dwShareMode,
68 DWORD dwPreferredProtocols,
69 DWORD dwInitialization, /*@out@*/ LPDWORD pdwActiveProtocol);
70
71 PCSC_API LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition);
72
73 PCSC_API LONG SCardBeginTransaction(SCARDHANDLE hCard);
74
75 PCSC_API LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition);
76
77 PCSC_API LONG SCardStatus(SCARDHANDLE hCard,
78 /*@null@*/ /*@out@*/ LPSTR mszReaderName,
79 /*@null@*/ /*@out@*/ LPDWORD pcchReaderLen,
80 /*@null@*/ /*@out@*/ LPDWORD pdwState,
81 /*@null@*/ /*@out@*/ LPDWORD pdwProtocol,
82 /*@null@*/ /*@out@*/ LPBYTE pbAtr,
83 /*@null@*/ /*@out@*/ LPDWORD pcbAtrLen);
84
85 PCSC_API LONG SCardGetStatusChange(SCARDCONTEXT hContext,
86 DWORD dwTimeout,
87 SCARD_READERSTATE *rgReaderStates, DWORD cReaders);
88
89 PCSC_API LONG SCardControl(SCARDHANDLE hCard, DWORD dwControlCode,
90 LPCVOID pbSendBuffer, DWORD cbSendLength,
91 /*@out@*/ LPVOID pbRecvBuffer, DWORD cbRecvLength,
92 LPDWORD lpBytesReturned);
93
94 PCSC_API LONG SCardTransmit(SCARDHANDLE hCard,
95 const SCARD_IO_REQUEST *pioSendPci,
96 LPCBYTE pbSendBuffer, DWORD cbSendLength,
97 /*@out@*/ SCARD_IO_REQUEST *pioRecvPci,
98 /*@out@*/ LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength);
99
100 PCSC_API LONG SCardListReaderGroups(SCARDCONTEXT hContext,
101 /*@out@*/ LPSTR mszGroups, LPDWORD pcchGroups);
102
103 PCSC_API LONG SCardListReaders(SCARDCONTEXT hContext,
104 /*@null@*/ /*@out@*/ LPCSTR mszGroups,
105 /*@null@*/ /*@out@*/ LPSTR mszReaders,
106 /*@out@*/ LPDWORD pcchReaders);
107
108 PCSC_API LONG SCardFreeMemory(SCARDCONTEXT hContext, LPCVOID pvMem);
109
110 PCSC_API LONG SCardCancel(SCARDCONTEXT hContext);
111
112 PCSC_API LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId,
113 /*@out@*/ LPBYTE pbAttr, LPDWORD pcbAttrLen);
114
115 PCSC_API LONG SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId,
116 LPCBYTE pbAttr, DWORD cbAttrLen);
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif
123
PCSC_API LONG SCardFreeMemory(SCARDCONTEXT hContext, LPCVOID pvMem)
Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE length ...
Definition libfake.c:206
PCSC_API LONG SCardSetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPCBYTE pbAttr, DWORD cbAttrLen)
Set an attribute of the IFD Handler.
Definition libfake.c:232
PCSC_API LONG SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout, SCARD_READERSTATE *rgReaderStates, DWORD cReaders)
Blocks execution until the current availability of the cards in a specific set of readers changes.
Definition libfake.c:138
PCSC_API LONG SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposition)
Terminates a connection made through SCardConnect().
Definition libfake.c:96
PCSC_API LONG SCardConnect(SCARDCONTEXT hContext, LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
Establishes a connection to the reader specified in * szReader.
Definition libfake.c:66
PCSC_API LONG SCardReleaseContext(SCARDCONTEXT hContext)
Destroys a communication context to the PC/SC Resource Manager.
Definition libfake.c:52
PCSC_API LONG SCardIsValidContext(SCARDCONTEXT hContext)
Check if a SCARDCONTEXT is valid.
Definition libfake.c:59
PCSC_API LONG SCardListReaders(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
Returns a list of currently available readers on the system.
Definition libfake.c:193
PCSC_API LONG SCardTransmit(SCARDHANDLE hCard, const SCARD_IO_REQUEST *pioSendPci, LPCBYTE pbSendBuffer, DWORD cbSendLength, SCARD_IO_REQUEST *pioRecvPci, LPBYTE pbRecvBuffer, LPDWORD pcbRecvLength)
Sends an APDU to the smart card contained in the reader connected to by SCardConnect().
Definition libfake.c:166
PCSC_API LONG SCardListReaderGroups(SCARDCONTEXT hContext, LPSTR mszGroups, LPDWORD pcchGroups)
Returns a list of currently available reader groups on the system.
Definition libfake.c:183
PCSC_API LONG SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
Creates an Application Context to the PC/SC Resource Manager.
Definition libfake.c:40
PCSC_API LONG SCardCancel(SCARDCONTEXT hContext)
Cancels a specific blocking SCardGetStatusChange() function.
Definition libfake.c:214
PCSC_API LONG SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)
Get an attribute from the IFD Handler (reader driver).
Definition libfake.c:221
PCSC_API LONG SCardControl(SCARDHANDLE hCard, DWORD dwControlCode, LPCVOID pbSendBuffer, DWORD cbSendLength, LPVOID pbRecvBuffer, DWORD cbRecvLength, LPDWORD lpBytesReturned)
Sends a command directly to the IFD Handler (reader driver) to be processed by the reader.
Definition libfake.c:150
PCSC_API LONG SCardReconnect(SCARDHANDLE hCard, DWORD dwShareMode, DWORD dwPreferredProtocols, DWORD dwInitialization, LPDWORD pdwActiveProtocol)
Reestablishes a connection to a reader that was previously connected to using SCardConnect().
Definition libfake.c:82
PCSC_API LONG SCardBeginTransaction(SCARDHANDLE hCard)
Establishes a temporary exclusive access mode for doing a series of commands in a transaction.
Definition libfake.c:104
PCSC_API LONG SCardStatus(SCARDHANDLE hCard, LPSTR mszReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
Returns the current status of the reader connected to by hCard.
Definition libfake.c:119
PCSC_API LONG SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition)
Ends a previously begun transaction.
Definition libfake.c:111
This keeps a list of defines for pcsc-lite.
LONG SCARDCONTEXT
hContext returned by SCardEstablishContext()
Definition pcsclite.h:52
LONG SCARDHANDLE
hCard returned by SCardConnect()
Definition pcsclite.h:55
Protocol Control Information (PCI)
Definition pcsclite.h:80