Logo Search packages:      
Sourcecode: pcsc-lite version File versions

LONG SCardIsValidContext ( SCARDCONTEXT  hContext  ) 

Check if a SCARDCONTEXT is valid.

Call this function to determine whether a smart card context handle is still valid. After a smart card context handle has been set by SCardEstablishContext(), it may become not valid if the resource manager service has been shut down.

Parameters:
[in] hContext Connection context to the PC/SC Resource Manager.
Returns:
Error code.
Return values:
SCARD_S_SUCCESS Successful (SCARD_S_SUCCESS)
SCARD_E_INVALID_HANDLE Invalid Handle (SCARD_E_INVALID_HANDLE)
 SCARDCONTEXT hContext;
 LONG rv;
 ...
 rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
 rv = SCardIsValidContext(hContext);

Definition at line 3507 of file winscard_clnt.c.

References SCARD_E_INVALID_HANDLE, SCARD_S_SUCCESS, SCardCheckDaemonAvailability(), and SCardGetContextIndice().

{
      LONG rv;
      LONG dwContextIndex;

      PROFILE_START

      rv = SCARD_S_SUCCESS;

      /* Check if the _same_ server is running */
      rv = SCardCheckDaemonAvailability();
      if (rv != SCARD_S_SUCCESS)
            return rv;

      /*
       * Make sure this context has been opened
       */
      dwContextIndex = SCardGetContextIndice(hContext);
      if (dwContextIndex == -1)
            rv = SCARD_E_INVALID_HANDLE;

      PROFILE_END(rv)

      return rv;
}


Generated by  Doxygen 1.6.0   Back to index