winscard topic

Windows Smartcard APIs

The Smart Card subsystem, used to provide smartcard-aware applications with access to smartcard-related software resources and readers.

Microsoft documentation on smartcard-APIs

Functions

SCardAccessStartedEvent() → Win32Result<HANDLE> winscard
Returns an event handle when an event signals that the smart card resource manager is started.
SCardAddReaderToGroup(int hContext, PCWSTR szReaderName, PCWSTR szGroupName) → int winscard
Adds a reader to a reader group.
SCardAudit(int hContext, int dwEvent) → int winscard
Writes event messages to the Windows application log Microsoft-Windows-SmartCard-Audit/Authentication.
SCardBeginTransaction(int hCard) → int winscard
Starts a transaction.
SCardCancel(int hContext) → int winscard
Terminates all outstanding actions within a specific resource manager context.
SCardConnect(int hContext, PCWSTR szReader, int dwShareMode, int dwPreferredProtocols, Pointer<IntPtr> phCard, Pointer<Uint32> pdwActiveProtocol) → int winscard
Establishes a connection (using a specific resource manager context) between the calling application and a smart card contained by a specific reader.
SCardControl(int hCard, int dwControlCode, Pointer<NativeType> lpInBuffer, int cbInBufferSize, Pointer<NativeType> lpOutBuffer, int cbOutBufferSize, Pointer<Uint32> lpBytesReturned) → int winscard
Gives you direct control of the reader.
SCardDisconnect(int hCard, int dwDisposition) → int winscard
Terminates a connection previously opened between the calling application and a smart card in the target reader.
SCardEndTransaction(int hCard, int dwDisposition) → int winscard
Completes a previously declared transaction, allowing other applications to resume interactions with the card.
SCardEstablishContext(SCARD_SCOPE dwScope, Pointer<IntPtr> phContext) → int winscard
Establishes the resource manager context (the scope) within which database operations are performed.
SCardForgetCardType(int hContext, PCWSTR szCardName) → int winscard
Removes an introduced smart card from the smart card subsystem.
SCardForgetReader(int hContext, PCWSTR szReaderName) → int winscard
Removes a previously introduced reader from control by the smart card subsystem.
SCardForgetReaderGroup(int hContext, PCWSTR szGroupName) → int winscard
Removes a previously introduced smart card reader group from the smart card subsystem.
SCardFreeMemory(int hContext, Pointer<NativeType> pvMem) → int winscard
Releases memory that has been returned from the resource manager using the SCARD_AUTOALLOCATE length designator.
SCardGetAttrib(int hCard, int dwAttrId, Pointer<Uint8>? pbAttr, Pointer<Uint32> pcbAttrLen) → int winscard
Retrieves the current reader attributes for the given handle.
SCardGetCardTypeProviderName(int hContext, PCWSTR szCardName, int dwProviderId, PWSTR szProvider, Pointer<Uint32> pcchProvider) → int winscard
Returns the name of the module (dynamic link library) that contains the provider for a given card name and provider type.
SCardGetDeviceTypeId(int hContext, PCWSTR szReaderName, Pointer<Uint32> pdwDeviceTypeId) → int winscard
Gets the device type identifier of the card reader for the given reader name.
SCardGetProviderId(int hContext, PCWSTR szCard, Pointer<GUID> pguidProviderId) → int winscard
Returns the identifier (GUID) of the primary service provider for a given card.
SCardGetReaderDeviceInstanceId(int hContext, PCWSTR szReaderName, PWSTR? szDeviceInstanceId, Pointer<Uint32> pcchDeviceInstanceId) → int winscard
Gets the device instance identifier of the card reader for the given reader name.
SCardGetReaderIcon(int hContext, PCWSTR szReaderName, Pointer<Uint8> pbIcon, Pointer<Uint32> pcbIcon) → int winscard
Gets an icon of the smart card reader for a given reader's name.
SCardGetStatusChange(int hContext, int dwTimeout, Pointer<SCARD_READERSTATE> rgReaderStates, int cReaders) → int winscard
Blocks execution until the current availability of the cards in a specific set of readers changes.
SCardGetTransmitCount(int hCard, Pointer<Uint32> pcTransmitCount) → int winscard
Retrieves the number of transmit operations that have completed since the specified card reader was inserted.
SCardIntroduceCardType(int hContext, PCWSTR szCardName, Pointer<GUID>? pguidPrimaryProvider, Pointer<GUID>? rgguidInterfaces, int dwInterfaceCount, Pointer<Uint8> pbAtr, Pointer<Uint8> pbAtrMask, int cbAtrLen) → int winscard
Introduces a smart card to the smart card subsystem (for the active user) by adding it to the smart card database.
SCardIntroduceReader(int hContext, PCWSTR szReaderName, PCWSTR szDeviceName) → int winscard
Introduces a new name for an existing smart card reader.
SCardIntroduceReaderGroup(int hContext, PCWSTR szGroupName) → int winscard
Introduces a reader group to the smart card subsystem.
SCardIsValidContext(int hContext) → int winscard
Determines whether a smart card context handle is valid.
SCardListCards(int hContext, Pointer<Uint8>? pbAtr, Pointer<GUID>? rgquidInterfaces, int cguidInterfaceCount, PWSTR? mszCards, Pointer<Uint32> pcchCards) → int winscard
Searches the smart card database and provides a list of named cards previously introduced to the system by the user.
SCardListInterfaces(int hContext, PCWSTR szCard, Pointer<GUID> pguidInterfaces, Pointer<Uint32> pcguidInterfaces) → int winscard
Provides a list of interfaces supplied by a given card.
SCardListReaderGroups(int hContext, PWSTR? mszGroups, Pointer<Uint32> pcchGroups) → int winscard
Provides the list of reader groups that have previously been introduced to the system.
SCardListReaders(int hContext, PCWSTR? mszGroups, PWSTR? mszReaders, Pointer<Uint32> pcchReaders) → int winscard
Provides the list of readers within a set of named reader groups, eliminating duplicates.
SCardListReadersWithDeviceInstanceId(int hContext, PCWSTR szDeviceInstanceId, PWSTR? mszReaders, Pointer<Uint32> pcchReaders) → int winscard
Gets the list of readers that have provided a device instance identifier.
SCardLocateCards(int hContext, PCWSTR mszCards, Pointer<SCARD_READERSTATE> rgReaderStates, int cReaders) → int winscard
Searches the readers listed in the rgReaderStates parameter for a card with an ATR string that matches one of the card names specified in mszCards, returning immediately with the result.
SCardLocateCardsByATR(int hContext, Pointer<SCARD_ATRMASK> rgAtrMasks, int cAtrs, Pointer<SCARD_READERSTATE> rgReaderStates, int cReaders) → int winscard
Searches the readers listed in the rgReaderStates parameter for a card with a name that matches one of the card names contained in one of the SCARD_ATRMASK structures specified by the rgAtrMasks parameter.
SCardReadCache(int hContext, Pointer<GUID> cardIdentifier, int freshnessCounter, PCWSTR lookupName, Pointer<Uint8> data, Pointer<Uint32> dataLen) → int winscard
Retrieves the value portion of a name-value pair from the global cache maintained by the Smart Card Resource Manager.
SCardReconnect(int hCard, int dwShareMode, int dwPreferredProtocols, int dwInitialization, Pointer<Uint32>? pdwActiveProtocol) → int winscard
Reestablishes an existing connection between the calling application and a smart card.
SCardReleaseContext(int hContext) → int winscard
Closes an established resource manager context, freeing any resources allocated under that context, including SCARDHANDLE objects and memory allocated using the SCARD_AUTOALLOCATE length designator.
SCardReleaseStartedEvent() → void winscard
Decrements the reference count for a handle acquired by a previous call to the SCardAccessStartedEvent function.
SCardRemoveReaderFromGroup(int hContext, PCWSTR szReaderName, PCWSTR szGroupName) → int winscard
Removes a reader from an existing reader group.
SCardSetAttrib(int hCard, int dwAttrId, Pointer<Uint8> pbAttr, int cbAttrLen) → int winscard
Sets the given reader attribute for the given handle.
SCardSetCardTypeProviderName(int hContext, PCWSTR szCardName, int dwProviderId, PCWSTR szProvider) → int winscard
Specifies the name of the module (dynamic link library) containing the provider for a given card name and provider type.
SCardStatus(int hCard, PWSTR? mszReaderNames, Pointer<Uint32>? pcchReaderLen, Pointer<Uint32>? pdwState, Pointer<Uint32>? pdwProtocol, Pointer<Uint8>? pbAtr, Pointer<Uint32>? pcbAtrLen) → int winscard
Provides the current status of a smart card in a reader.
SCardTransmit(int hCard, Pointer<SCARD_IO_REQUEST> pioSendPci, Pointer<Uint8> pbSendBuffer, int cbSendLength, Pointer<SCARD_IO_REQUEST>? pioRecvPci, Pointer<Uint8> pbRecvBuffer, Pointer<Uint32> pcbRecvLength) → int winscard
Sends a service request to the smart card and expects to receive data back from the card.
SCardUIDlgSelectCard(Pointer<OPENCARDNAME_EX> param0) → int winscard
Displays the smart card Select Card dialog box.
SCardWriteCache(int hContext, Pointer<GUID> cardIdentifier, int freshnessCounter, PCWSTR lookupName, Pointer<Uint8> data, int dataLen) → int winscard
Writes a name-value pair from a smart card to the global cache maintained by the Smart Card Resource Manager.