#ifndef _WINSCARD_H_
#define _WINSCARD_H_
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#include <wtypes.h>
#include <winioctl.h>
#include "winsmcrd.h"
#ifndef SCARD_S_SUCCESS
#include "SCardErr.h"
#endif
#include <winapifamily.h>
#ifdef __cplusplus
extern
"C"
{
#endif
#if _MSC_VER >= 1200
#pragma warning(push)
#pragma warning(disable:4820) // padding added after data member
#endif
#pragma warning(disable:
4820
)
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#ifndef _LPCBYTE_DEFINED
#define _LPCBYTE_DEFINED
typedef
const
*
;
#endif
#ifndef _LPCVOID_DEFINED
#define _LPCVOID_DEFINED
typedef const VOID *LPCVOID;
#endif
#ifndef WINSCARDAPI
#define WINSCARDAPI
#endif
#ifndef WINSCARDDATA
#define WINSCARDDATA __declspec(dllimport)
#endif
#if !defined(_M_CEE_PURE)
WINSCARDDATA extern const SCARD_IO_REQUEST
__declspec
(dllimport)
extern
const
,
,
;
#define SCARD_PCI_T0 (&g_rgSCardT0Pci)
#define SCARD_PCI_T1 (&g_rgSCardT1Pci)
#define SCARD_PCI_RAW (&g_rgSCardRawPci)
#endif
typedef
;
typedef
*
, *
;
typedef
;
typedef
*
, *
;
#define SCARD_AUTOALLOCATE (DWORD)(-1)
#define SCARD_SCOPE_USER 0 // The context is a user context, and any
#define SCARD_SCOPE_TERMINAL 1 // The context is that of the current terminal,
#define SCARD_SCOPE_SYSTEM 2 // The context is the system context, and any
extern WINSCARDAPI LONG WINAPI
(
_Reserved_ LPCVOID pvReserved1,
_Reserved_ LPCVOID pvReserved2,
_Out_ LPSCARDCONTEXT phContext);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext);
#define SCARD_ALL_READERS TEXT("SCard$AllReaders\000")
#define SCARD_DEFAULT_READERS TEXT("SCard$DefaultReaders\000")
#define SCARD_LOCAL_READERS TEXT("SCard$LocalReaders\000")
#define SCARD_SYSTEM_READERS TEXT("SCard$SystemReaders\000")
#define SCARD_PROVIDER_PRIMARY 1 // Primary Provider Id
#define SCARD_PROVIDER_CSP 2 // Crypto Service Provider Id
#define SCARD_PROVIDER_KSP 3 // Key Storage Provider Id
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Out_writes_opt_(*pcchGroups) _Post_ _NullNull_terminated_ LPSTR mszGroups,
_Inout_ LPDWORD pcchGroups);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Out_writes_opt_(*pcchGroups) _Post_ _NullNull_terminated_ LPWSTR mszGroups,
_Inout_ LPDWORD pcchGroups);
#ifdef UNICODE
#define SCardListReaderGroups SCardListReaderGroupsW
#else
#define SCardListReaderGroups SCardListReaderGroupsA
#endif // !UNICODE
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_opt_ LPCSTR mszGroups,
_When_(_Old_(*pcchReaders) == SCARD_AUTOALLOCATE, _At_((LPSTR *)mszReaders, _Outptr_result_buffer_maybenull_(*pcchReaders) _At_(*_Curr_, _Post_z_ _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchReaders) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchReaders) _Post_ _NullNull_terminated_)
,
_Inout_ LPDWORD pcchReaders);
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_opt_ LPCWSTR mszGroups,
_When_(_Old_(*pcchReaders) == SCARD_AUTOALLOCATE, _At_((LPWSTR *)mszReaders, _Outptr_result_buffer_maybenull_(*pcchReaders) _At_(*_Curr_, _Post_z_ _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchReaders) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchReaders) _Post_ _NullNull_terminated_)
,
_Inout_ LPDWORD pcchReaders);
#ifdef UNICODE
#define SCardListReaders SCardListReadersW
#else
#define SCardListReaders SCardListReadersA
#endif // !UNICODE
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_reads_opt_(cguidInterfaceCount) LPCGUID rgquidInterfaces,
_In_ DWORD cguidInterfaceCount,
_When_(_Old_(*pcchCards) == SCARD_AUTOALLOCATE, _At_((LPSTR *)mszCards, _Outptr_result_buffer_maybenull_(*pcchCards) _At_(*_Curr_, _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchCards) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchCards) _Post_ _NullNull_terminated_)
*
,
_Inout_ LPDWORD pcchCards);
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_reads_opt_(cguidInterfaceCount) LPCGUID rgquidInterfaces,
_In_ DWORD cguidInterfaceCount,
_When_(_Old_(*pcchCards) == SCARD_AUTOALLOCATE, _At_((LPWSTR *)mszCards, _Outptr_result_buffer_maybenull_(*pcchCards) _At_(*_Curr_, _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchCards) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchCards) _Post_ _NullNull_terminated_)
*
,
_Inout_ LPDWORD pcchCards);
#ifdef UNICODE
#define SCardListCards SCardListCardsW
#else
#define SCardListCards SCardListCardsA
#endif // !UNICODE
#define SCardListCardTypes SCardListCards
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Out_ LPGUID pguidInterfaces,
_Inout_ LPDWORD pcguidInterfaces);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Out_ LPGUID pguidInterfaces,
_Inout_ LPDWORD pcguidInterfaces);
#ifdef UNICODE
#define SCardListInterfaces SCardListInterfacesW
#else
#define SCardListInterfaces SCardListInterfacesA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Out_ LPGUID pguidProviderId);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Out_ LPGUID pguidProviderId);
#ifdef UNICODE
#define SCardGetProviderId SCardGetProviderIdW
#else
#define SCardGetProviderId SCardGetProviderIdA
#endif // !UNICODE
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
SCardGetCardTypeProviderNameA
(
_In_ SCARDCONTEXT hContext,
_When_(_Old_(*pcchProvider) == SCARD_AUTOALLOCATE, _At_((LPSTR *)szProvider, _Outptr_result_buffer_all_(*pcchProvider)))
_When_(_Old_(*pcchProvider) != SCARD_AUTOALLOCATE, _Out_writes_to_(*pcchProvider, *pcchProvider) _Post_z_)
*
,
_Inout_ LPDWORD pcchProvider);
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
SCardGetCardTypeProviderNameW
(
_In_ SCARDCONTEXT hContext,
_When_(_Old_(*pcchProvider) == SCARD_AUTOALLOCATE, _At_((LPWSTR *)szProvider, _Outptr_result_buffer_all_(*pcchProvider)))
_When_(_Old_(*pcchProvider) != SCARD_AUTOALLOCATE, _Out_writes_to_(*pcchProvider, *pcchProvider) _Post_z_)
*
,
_Inout_ LPDWORD pcchProvider);
#ifdef UNICODE
#define SCardGetCardTypeProviderName SCardGetCardTypeProviderNameW
#else
#define SCardGetCardTypeProviderName SCardGetCardTypeProviderNameA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
SCardIntroduceReaderGroupA
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szGroupName);
extern WINSCARDAPI LONG WINAPI
SCardIntroduceReaderGroupW
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szGroupName);
#ifdef UNICODE
#define SCardIntroduceReaderGroup SCardIntroduceReaderGroupW
#else
#define SCardIntroduceReaderGroup SCardIntroduceReaderGroupA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szGroupName);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szGroupName);
#ifdef UNICODE
#define SCardForgetReaderGroup SCardForgetReaderGroupW
#else
#define SCardForgetReaderGroup SCardForgetReaderGroupA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szReaderName,
_In_ LPCSTR szDeviceName);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szReaderName,
_In_ LPCWSTR szDeviceName);
#ifdef UNICODE
#define SCardIntroduceReader SCardIntroduceReaderW
#else
#define SCardIntroduceReader SCardIntroduceReaderA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szReaderName);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szReaderName);
#ifdef UNICODE
#define SCardForgetReader SCardForgetReaderW
#else
#define SCardForgetReader SCardForgetReaderA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szReaderName,
_In_ LPCSTR szGroupName);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szReaderName,
_In_ LPCWSTR szGroupName);
#ifdef UNICODE
#define SCardAddReaderToGroup SCardAddReaderToGroupW
#else
#define SCardAddReaderToGroup SCardAddReaderToGroupA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
SCardRemoveReaderFromGroupA
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szReaderName,
_In_ LPCSTR szGroupName);
extern WINSCARDAPI LONG WINAPI
SCardRemoveReaderFromGroupW
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szReaderName,
_In_ LPCWSTR szGroupName);
#ifdef UNICODE
#define SCardRemoveReaderFromGroup SCardRemoveReaderFromGroupW
#else
#define SCardRemoveReaderFromGroup SCardRemoveReaderFromGroupA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_opt_ LPCGUID pguidPrimaryProvider,
_In_opt_ LPCGUID rgguidInterfaces,
_In_ DWORD dwInterfaceCount,
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_opt_ LPCGUID pguidPrimaryProvider,
_In_opt_ LPCGUID rgguidInterfaces,
_In_ DWORD dwInterfaceCount,
#ifdef UNICODE
#define SCardIntroduceCardType SCardIntroduceCardTypeW
#else
#define SCardIntroduceCardType SCardIntroduceCardTypeA
#endif // !UNICODE
#define PCSCardIntroduceCardType(hContext, szCardName, pbAtr, pbAtrMask, cbAtrLen, pguidPrimaryProvider, rgguidInterfaces, dwInterfaceCount) \
SCardIntroduceCardType(hContext, szCardName, pguidPrimaryProvider, rgguidInterfaces, dwInterfaceCount, pbAtr, pbAtrMask, cbAtrLen)
extern WINSCARDAPI LONG WINAPI
SCardSetCardTypeProviderNameA
(
_In_ SCARDCONTEXT hContext,
extern WINSCARDAPI LONG WINAPI
SCardSetCardTypeProviderNameW
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szProvider);
#ifdef UNICODE
#define SCardSetCardTypeProviderName SCardSetCardTypeProviderNameW
#else
#define SCardSetCardTypeProviderName SCardSetCardTypeProviderNameA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szCardName);
#ifdef UNICODE
#define SCardForgetCardType SCardForgetCardTypeW
#else
#define SCardForgetCardType SCardForgetCardTypeA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
#if (NTDDI_VERSION >= NTDDI_WINXP)
extern WINSCARDAPI HANDLE WINAPI
(
void
);
extern WINSCARDAPI void WINAPI
(
void
);
#endif // (NTDDI_VERSION >= NTDDI_WINXP)
typedef
struct
{
;
;
;
;
;
[
36
];
}
, *
, *
;
typedef
struct
{
;
;
;
;
;
[
36
];
}
, *
, *
;
#ifdef UNICODE
typedef
;
typedef
;
typedef
;
#else
typedef SCARD_READERSTATEA SCARD_READERSTATE;
typedef PSCARD_READERSTATEA PSCARD_READERSTATE;
typedef LPSCARD_READERSTATEA LPSCARD_READERSTATE;
#endif // UNICODE
#define SCARD_READERSTATE_A SCARD_READERSTATEA
#define SCARD_READERSTATE_W SCARD_READERSTATEW
#define PSCARD_READERSTATE_A PSCARD_READERSTATEA
#define PSCARD_READERSTATE_W PSCARD_READERSTATEW
#define LPSCARD_READERSTATE_A LPSCARD_READERSTATEA
#define LPSCARD_READERSTATE_W LPSCARD_READERSTATEW
#define SCARD_STATE_UNAWARE 0x00000000 // The application is unaware of the
#define SCARD_STATE_IGNORE 0x00000001 // The application requested that
#define SCARD_STATE_CHANGED 0x00000002 // This implies that there is a
#define SCARD_STATE_UNKNOWN 0x00000004 // This implies that the given
#define SCARD_STATE_UNAVAILABLE 0x00000008 // This implies that the actual
#define SCARD_STATE_EMPTY 0x00000010 // This implies that there is not
#define SCARD_STATE_PRESENT 0x00000020 // This implies that there is a card
#define SCARD_STATE_ATRMATCH 0x00000040 // This implies that there is a card
#define SCARD_STATE_EXCLUSIVE 0x00000080 // This implies that the card in the
#define SCARD_STATE_INUSE 0x00000100 // This implies that the card in the
#define SCARD_STATE_MUTE 0x00000200 // This implies that the card in the
#define SCARD_STATE_UNPOWERED 0x00000400 // This implies that the card in the
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Inout_ LPSCARD_READERSTATEA rgReaderStates,
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Inout_ LPSCARD_READERSTATEW rgReaderStates,
#ifdef UNICODE
#define SCardLocateCards SCardLocateCardsW
#else
#define SCardLocateCards SCardLocateCardsA
#endif // !UNICODE
#if (NTDDI_VERSION >= NTDDI_WINXP)
typedef
struct
{
;
[
36
];
[
36
];
}
, *
, *
;
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPSCARD_ATRMASK rgAtrMasks,
_Inout_ LPSCARD_READERSTATEA rgReaderStates,
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPSCARD_ATRMASK rgAtrMasks,
_Inout_ LPSCARD_READERSTATEW rgReaderStates,
#ifdef UNICODE
#define SCardLocateCardsByATR SCardLocateCardsByATRW
#else
#define SCardLocateCardsByATR SCardLocateCardsByATRA
#endif // !UNICODE
#endif // (NTDDI_VERSION >= NTDDI_WINXP)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Inout_ LPSCARD_READERSTATEA rgReaderStates,
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_Inout_ LPSCARD_READERSTATEW rgReaderStates,
#ifdef UNICODE
#define SCardGetStatusChange SCardGetStatusChangeW
#else
#define SCardGetStatusChange SCardGetStatusChangeA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext);
#define SCARD_SHARE_EXCLUSIVE 1 // This application is not willing to share this
#define SCARD_SHARE_SHARED 2 // This application is willing to share this
#define SCARD_SHARE_DIRECT 3 // This application demands direct control of
#define SCARD_LEAVE_CARD 0 // Don't do anything special on close
#define SCARD_RESET_CARD 1 // Reset the card on close
#define SCARD_UNPOWER_CARD 2 // Power down the card on close
#define SCARD_EJECT_CARD 3 // Eject the card on close
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ DWORD dwPreferredProtocols,
_Out_ LPSCARDHANDLE phCard,
_Out_ LPDWORD pdwActiveProtocol);
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ DWORD dwPreferredProtocols,
_Out_ LPSCARDHANDLE phCard,
_Out_ LPDWORD pdwActiveProtocol);
#ifdef UNICODE
#define SCardConnect SCardConnectW
#else
#define SCardConnect SCardConnectA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ DWORD dwPreferredProtocols,
_In_ DWORD dwInitialization,
_Out_opt_ LPDWORD pdwActiveProtocol);
extern WINSCARDAPI LONG WINAPI
(
_In_ DWORD dwDisposition);
extern WINSCARDAPI LONG WINAPI
(
extern WINSCARDAPI LONG WINAPI
(
_In_ DWORD dwDisposition);
extern WINSCARDAPI LONG WINAPI
(
extern WINSCARDAPI LONG WINAPI
(
_Out_ LPDWORD pdwProtocol,
_Out_writes_bytes_(*pcbAtrLen) LPBYTE pbAtr,
_Inout_ LPDWORD pcbAtrLen);
extern WINSCARDAPI LONG WINAPI
(
_When_(_Old_(*pcchReaderLen) == SCARD_AUTOALLOCATE, _At_((LPSTR *)mszReaderNames, _Outptr_result_buffer_maybenull_(*pcchReaderLen) _At_(*_Curr_, _Post_z_ _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchReaderLen) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchReaderLen) _Post_ _NullNull_terminated_)
,
_Inout_opt_ LPDWORD pcchReaderLen,
_Out_opt_ LPDWORD pdwState,
_Out_opt_ LPDWORD pdwProtocol,
_When_(_Old_(*pcbAtrLen) == SCARD_AUTOALLOCATE, _At_((LPBYTE *)pbAtr, _Outptr_result_buffer_maybenull_(*pcbAtrLen) _At_(*_Curr_, _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcbAtrLen) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcbAtrLen) _Post_ _NullNull_terminated_)
,
_Inout_opt_ LPDWORD pcbAtrLen);
extern WINSCARDAPI LONG WINAPI
(
_When_(_Old_(*pcchReaderLen) == SCARD_AUTOALLOCATE, _At_((LPWSTR *)mszReaderNames, _Outptr_result_buffer_maybenull_(*pcchReaderLen) _At_(*_Curr_, _Post_z_ _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchReaderLen) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchReaderLen) _Post_ _NullNull_terminated_)
,
_Inout_opt_ LPDWORD pcchReaderLen,
_Out_opt_ LPDWORD pdwState,
_Out_opt_ LPDWORD pdwProtocol,
_When_(_Old_(*pcbAtrLen) == SCARD_AUTOALLOCATE, _At_((LPBYTE *)pbAtr, _Outptr_result_buffer_maybenull_(*pcbAtrLen) _At_(*_Curr_, _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcbAtrLen) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcbAtrLen) _Post_ _NullNull_terminated_)
,
_Inout_opt_ LPDWORD pcbAtrLen);
#ifdef UNICODE
#define SCardStatus SCardStatusW
#else
#define SCardStatus SCardStatusA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ LPCSCARD_IO_REQUEST pioSendPci,
_In_reads_bytes_(cbSendLength) LPCBYTE pbSendBuffer,
_Inout_opt_ LPSCARD_IO_REQUEST pioRecvPci,
_Out_writes_bytes_(*pcbRecvLength) LPBYTE pbRecvBuffer,
_Inout_ LPDWORD pcbRecvLength);
#if (NTDDI_VERSION >= NTDDI_VISTA)
extern WINSCARDAPI LONG WINAPI
(
_Out_ LPDWORD pcTransmitCount);
#endif // (NTDDI_VERSION >= NTDDI_VISTA)
extern WINSCARDAPI LONG WINAPI
(
_In_ DWORD dwControlCode,
_In_reads_bytes_(cbInBufferSize) LPCVOID lpInBuffer,
_In_ DWORD cbInBufferSize,
_Out_writes_bytes_(cbOutBufferSize) LPVOID lpOutBuffer,
_In_ DWORD cbOutBufferSize,
_Out_ LPDWORD lpBytesReturned);
extern WINSCARDAPI LONG WINAPI
(
_Out_writes_bytes_opt_(*pcbAttrLen) LPBYTE pbAttr,
_Inout_ LPDWORD pcbAttrLen);
#define SCardGetReaderCapabilities SCardGetAttrib
extern WINSCARDAPI LONG WINAPI
(
_In_reads_bytes_(cbAttrLen) LPCBYTE pbAttr,
#define SCardSetReaderCapabilities SCardSetAttrib
#define SC_DLG_MINIMAL_UI 0x01
#define SC_DLG_NO_UI 0x02
#define SC_DLG_FORCE_UI 0x04
#define SCERR_NOCARDNAME 0x4000
#define SCERR_NOGUIDS 0x8000
typedef SCARDHANDLE (WINAPI *LPOCNCONNPROCA) (_In_ SCARDCONTEXT, _In_ LPSTR, _In_ LPSTR, _In_ PVOID);
typedef
(
__stdcall
*
) (
,
,
,
);
typedef SCARDHANDLE (WINAPI *LPOCNCONNPROCW) (_In_ SCARDCONTEXT, _In_ LPWSTR, _In_ LPWSTR, _In_ PVOID);
typedef
(
__stdcall
*
) (
,
,
,
);
#ifdef UNICODE
#define LPOCNCONNPROC LPOCNCONNPROCW
#else
#define LPOCNCONNPROC LPOCNCONNPROCA
#endif // !UNICODE
typedef BOOL (WINAPI *LPOCNCHKPROC) (_In_ SCARDCONTEXT, _In_ SCARDHANDLE, _In_ PVOID);
typedef
(
__stdcall
*
) (
,
,
);
typedef void (WINAPI *LPOCNDSCPROC) (_In_ SCARDCONTEXT, _In_ SCARDHANDLE, _In_ PVOID);
typedef
void
(
__stdcall
*
) (
,
,
);
typedef
struct
{
;
;
;
;
;
;
;
;
;
;
;
;
;
}
OPENCARD_SEARCH_CRITERIAA
, *
POPENCARD_SEARCH_CRITERIAA
, *
LPOPENCARD_SEARCH_CRITERIAA
;
typedef
struct
{
;
;
;
;
;
;
;
;
;
;
;
;
;
}
OPENCARD_SEARCH_CRITERIAW
, *
POPENCARD_SEARCH_CRITERIAW
, *
LPOPENCARD_SEARCH_CRITERIAW
;
#ifdef UNICODE
typedef
OPENCARD_SEARCH_CRITERIAW
;
typedef
POPENCARD_SEARCH_CRITERIAW
POPENCARD_SEARCH_CRITERIA
;
typedef
LPOPENCARD_SEARCH_CRITERIAW
LPOPENCARD_SEARCH_CRITERIA
;
#else
typedef OPENCARD_SEARCH_CRITERIAA OPENCARD_SEARCH_CRITERIA;
typedef POPENCARD_SEARCH_CRITERIAA POPENCARD_SEARCH_CRITERIA;
typedef LPOPENCARD_SEARCH_CRITERIAA LPOPENCARD_SEARCH_CRITERIA;
#endif // UNICODE
typedef
struct
{
;
;
;
;
;
;
;
POPENCARD_SEARCH_CRITERIAA
;
;
;
;
;
;
;
;
;
;
;
}
, *
, *
;
typedef
struct
{
;
;
;
;
;
;
;
POPENCARD_SEARCH_CRITERIAW
;
;
;
;
;
;
;
;
;
;
;
}
, *
, *
;
#ifdef UNICODE
typedef
;
typedef
;
typedef
;
#else
typedef OPENCARDNAME_EXA OPENCARDNAME_EX;
typedef POPENCARDNAME_EXA POPENCARDNAME_EX;
typedef LPOPENCARDNAME_EXA LPOPENCARDNAME_EX;
#endif // UNICODE
#define OPENCARDNAMEA_EX OPENCARDNAME_EXA
#define OPENCARDNAMEW_EX OPENCARDNAME_EXW
#define POPENCARDNAMEA_EX POPENCARDNAME_EXA
#define POPENCARDNAMEW_EX POPENCARDNAME_EXW
#define LPOPENCARDNAMEA_EX LPOPENCARDNAME_EXA
#define LPOPENCARDNAMEW_EX LPOPENCARDNAME_EXW
#define SCARD_READER_SEL_AUTH_PACKAGE ((DWORD)-629)
typedef
enum
{
RSR_MATCH_TYPE_READER_AND_CONTAINER
=
1
,
RSR_MATCH_TYPE_SERIAL_NUMBER
,
}
READER_SEL_REQUEST_MATCH_TYPE
;
typedef
struct
{
;
;
READER_SEL_REQUEST_MATCH_TYPE
;
#pragma warning(push)
#pragma warning(disable:
4201
)
union
{
struct
{
;
;
;
;
dwDesiredCardModuleVersion
;
;
}
ReaderAndContainerParameter
;
struct
{
;
;
dwDesiredCardModuleVersion
;
}
;
#pragma warning(pop)
}
, *
;
typedef
struct
{
;
;
;
;
}
, *
;
extern WINSCARDAPI LONG WINAPI
(
extern WINSCARDAPI LONG WINAPI
(
#ifdef UNICODE
#define SCardUIDlgSelectCard SCardUIDlgSelectCardW
#else
#define SCardUIDlgSelectCard SCardUIDlgSelectCardA
#endif // !UNICODE
typedef
struct
{
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
}
, *
, *
;
typedef
struct
{
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
}
, *
, *
;
#ifdef UNICODE
typedef
;
typedef
;
typedef
;
#else
typedef OPENCARDNAMEA OPENCARDNAME;
typedef POPENCARDNAMEA POPENCARDNAME;
typedef LPOPENCARDNAMEA LPOPENCARDNAME;
#endif // UNICODE
#define OPENCARDNAME_A OPENCARDNAMEA
#define OPENCARDNAME_W OPENCARDNAMEW
#define POPENCARDNAME_A POPENCARDNAMEA
#define POPENCARDNAME_W POPENCARDNAMEW
#define LPOPENCARDNAME_A LPOPENCARDNAMEA
#define LPOPENCARDNAME_W LPOPENCARDNAMEW
extern WINSCARDAPI LONG WINAPI
(
);
extern WINSCARDAPI LONG WINAPI
(
);
#ifdef UNICODE
#define GetOpenCardName GetOpenCardNameW
#else
#define GetOpenCardName GetOpenCardNameA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
void
);
#if (NTDDI_VERSION >= NTDDI_VISTA)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ UUID *CardIdentifier,
_In_ DWORD FreshnessCounter,
_Out_writes_bytes_(*DataLen) PBYTE Data,
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ UUID *CardIdentifier,
_In_ DWORD FreshnessCounter,
_Out_writes_bytes_(*DataLen) PBYTE Data,
#ifdef UNICODE
#define SCardReadCache SCardReadCacheW
#else
#define SCardReadCache SCardReadCacheA
#endif // !UNICODE
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ UUID *CardIdentifier,
_In_ DWORD FreshnessCounter,
_In_reads_bytes_(DataLen) PBYTE Data,
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ UUID *CardIdentifier,
_In_ DWORD FreshnessCounter,
_In_reads_bytes_(DataLen) PBYTE Data,
#ifdef UNICODE
#define SCardWriteCache SCardWriteCacheW
#else
#define SCardWriteCache SCardWriteCacheA
#endif // !UNICODE
#endif // (NTDDI_VERSION >= NTDDI_VISTA)
#if (NTDDI_VERSION >= NTDDI_WIN8)
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szReaderName,
_When_(_Old_(*pcbIcon) == SCARD_AUTOALLOCATE, _At_((LPBYTE *)pbIcon, _Outptr_result_bytebuffer_all_maybenull_(*pcbIcon)))
_When_(_Old_(*pcbIcon) != SCARD_AUTOALLOCATE, _Out_writes_bytes_to_(*pcbIcon, *pcbIcon) _Post_z_)
,
_Inout_ LPDWORD pcbIcon);
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szReaderName,
_When_(_Old_(*pcbIcon) == SCARD_AUTOALLOCATE, _At_((LPBYTE *)pbIcon, _Outptr_result_bytebuffer_all_maybenull_(*pcbIcon)))
_When_(_Old_(*pcbIcon) != SCARD_AUTOALLOCATE, _Out_writes_bytes_to_(*pcbIcon, *pcbIcon) _Post_z_)
,
_Inout_ LPDWORD pcbIcon);
#ifdef UNICODE
#define SCardGetReaderIcon SCardGetReaderIconW
#else
#define SCardGetReaderIcon SCardGetReaderIconA
#endif // !UNICODE
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szReaderName,
_Inout_ LPDWORD pdwDeviceTypeId);
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szReaderName,
_Inout_ LPDWORD pdwDeviceTypeId);
#ifdef UNICODE
#define SCardGetDeviceTypeId SCardGetDeviceTypeIdW
#else
#define SCardGetDeviceTypeId SCardGetDeviceTypeIdA
#endif // !UNICODE
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
SCardGetReaderDeviceInstanceIdA
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szReaderName,
_When_(_Old_(*pcchDeviceInstanceId) == SCARD_AUTOALLOCATE, _At_((LPSTR *)szDeviceInstanceId, _Outptr_result_buffer_maybenull_(*pcchDeviceInstanceId) _At_(*_Curr_, _Post_z_ _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchDeviceInstanceId) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchDeviceInstanceId) _Post_ _NullNull_terminated_)
,
_Inout_ LPDWORD pcchDeviceInstanceId);
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
SCardGetReaderDeviceInstanceIdW
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szReaderName,
_When_(_Old_(*pcchDeviceInstanceId) == SCARD_AUTOALLOCATE, _At_((LPWSTR *)szDeviceInstanceId, _Outptr_result_buffer_maybenull_(*pcchDeviceInstanceId) _At_(*_Curr_, _Post_z_ _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchDeviceInstanceId) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchDeviceInstanceId) _Post_ _NullNull_terminated_)
,
_Inout_ LPDWORD pcchDeviceInstanceId);
#ifdef UNICODE
#define SCardGetReaderDeviceInstanceId SCardGetReaderDeviceInstanceIdW
#else
#define SCardGetReaderDeviceInstanceId SCardGetReaderDeviceInstanceIdA
#endif // !UNICODE
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
SCardListReadersWithDeviceInstanceIdA
(
_In_ SCARDCONTEXT hContext,
_In_ LPCSTR szDeviceInstanceId,
_When_(_Old_(*pcchReaders) == SCARD_AUTOALLOCATE, _At_((LPSTR *)mszReaders, _Outptr_result_buffer_maybenull_(*pcchReaders) _At_(*_Curr_, _Post_z_ _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchReaders) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchReaders) _Post_ _NullNull_terminated_)
,
_Inout_ LPDWORD pcchReaders);
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
SCardListReadersWithDeviceInstanceIdW
(
_In_ SCARDCONTEXT hContext,
_In_ LPCWSTR szDeviceInstanceId,
_When_(_Old_(*pcchReaders) == SCARD_AUTOALLOCATE, _At_((LPWSTR *)mszReaders, _Outptr_result_buffer_maybenull_(*pcchReaders) _At_(*_Curr_, _Post_z_ _Post_ _NullNull_terminated_)))
_When_(_Old_(*pcchReaders) != SCARD_AUTOALLOCATE, _Out_writes_opt_(*pcchReaders) _Post_ _NullNull_terminated_)
,
_Inout_ LPDWORD pcchReaders);
#ifdef UNICODE
#define SCardListReadersWithDeviceInstanceId SCardListReadersWithDeviceInstanceIdW
#else
#define SCardListReadersWithDeviceInstanceId SCardListReadersWithDeviceInstanceIdA
#endif // !UNICODE
#define SCARD_AUDIT_CHV_FAILURE 0x0 // A smart card holder verification (CHV)
#define SCARD_AUDIT_CHV_SUCCESS 0x1 // A smart card holder verification (CHV)
_Success_(return == SCARD_S_SUCCESS)
extern WINSCARDAPI LONG WINAPI
(
_In_ SCARDCONTEXT hContext,
#endif // (NTDDI_VERSION >= NTDDI_WIN8)
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
#if _MSC_VER >= 1200
#pragma warning(pop)
#endif
#ifdef __cplusplus
}
#endif
#endif // _WINSCARD_H_