PC/SC Guide
Prox–DU & Prox–SU
www.gemalto.com
DOC119811A Public Use Page 55/129
SCardDisconnect Function
The SCardDisconnect function terminates a connection previously opened between the
calling application and a smart card in the target reader.
Syntax:
LONG WINAPI SCardDisconnect(
__in SCARDHANDLE hCard,
__in DWORD dwDisposition
);
Parameters:
hCard [in]
Reference value obtained from a previous call to SCardConnect.
dwDisposition [in]
Action to take on the card in the connected reader on close:
SCARD_LEAVE_CARD: Do not do anything special.
SCARD_RESET_CARD: Reset the card.
SCARD_UNPOWER_CARD: Power down the card.
SCARD_EJECT_CARD: Eject the card.
Return Value:
This function returns different values depending on whether it succeeds or fails:
Success: SCARD_S_SUCCESS.
Failure: An error code. For more information, see Smart Card Return Values.
Remarks:
If an application (which previously called SCardConnect) exits without calling
SCardDisconnect, the card is automatically reset.
The SCardDisconnect function is a smart card and reader access function. For more
information on other access functions, see Smart Card and Reader Access Functions.
Examples:
The following example terminates the specified smart card connection. The example
assumes that lReturn is a variable of type LONG, and that hCardHandle is a valid handle
received from a previous call to SCardConnect.
lReturn = SCardDisconnect(hCardHandle,
SCARD_LEAVE_CARD);
if ( SCARD_S_SUCCESS != lReturn )
{
printf("Failed SCardDisconnect\n");
exit(1); // Or other appropriate action.
}