SCardIsValidContext (Windows CE 5.0)
This function determines whether a smart card context handle is valid.
LONG SCardIsValidContext(SCARDCONTEXThContext );
Parameters
- hContext
[in] Supplies the handle that identifies the resource manager context. The resource manager context can be set by a previous call to SCardEstablishContext.
Return Values
Value | Description |
---|---|
SCARD_S_SUCCESS | hContext is valid. |
SCARD_E_INVALID_HANDLE | hContext is not valid. |
An error value (see Smart Card Error Values for a list of all error values). | Fails |
Remarks
Call this function to determine if a smart card context handle is still valid. Once a smart card context handle has been set by SCardEstablishContext, it may become invalid if the resource manager service has been shut down.
Example Code
// Check the smart card context handle.
// hContext was set previously by SCardEstablishContext.
LONG lReturn;
lReturn = SCardIsValidContext(hContext);
if ( SCARD_S_SUCCESS != lReturn )
{
// Function failed; check return value.
if ( ERROR_INVALID_HANDLE == lReturn )
printf("Handle is invalid\n");
else
{
// Some unexpected error occurred; report and bail out.
printf("Failed SCardIsValidContext - %x\n", lReturn);
exit(1); // Or other appropriate error action.
}
}
else
{
// Handle is valid; proceed as needed.
// ...
}
Requirements
OS Versions: Windows CE .NET 4.1 and later.
Header: Winscard.h.
Link Library: Winscard.lib.
See Also
Send Feedback on this topic to the authors