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.
Value Meaning - 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.
| Return code | Description |
|---|---|
|
SCARD_S_SUCCESS. |
|
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.
}
Requirements
|
Minimum supported client |
Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also