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

LONG SCardCancel ( SCARDCONTEXT  hContext  ) 

This function cancels all pending blocking requests on the SCardGetStatusChange() function.

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 hContext handle (SCARD_E_INVALID_HANDLE)
 SCARDCONTEXT hContext;
 DWORD cReaders;
 SCARD_READERSTATE rgReaderStates;
 LONG rv;
 ...
 rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
 rgReaderStates.szReader = strdup("Reader X");
 rgReaderStates.dwCurrentState = SCARD_STATE_EMPTY;
 ...
 / * Spawn off thread for following function * /
 ...
 rv = SCardGetStatusChange(hContext, 0, rgReaderStates, cReaders);
 rv = SCardCancel(hContext);

Definition at line 3495 of file winscard_clnt.c.

References BLOCK_STATUS_RESUME, _psContextMap::contextBlockStatus, psContextMap, SCARD_E_INVALID_HANDLE, SCARD_F_INTERNAL_ERROR, SCARD_S_SUCCESS, SCardGetContextIndice(), and StatSynchronizeContext().

{
      LONG dwContextIndex;
      LONG rv = SCARD_S_SUCCESS;

      PROFILE_START

      dwContextIndex = SCardGetContextIndice(hContext);
      if (dwContextIndex == -1)
            return SCARD_E_INVALID_HANDLE;

      /*
       * Set the block status for this Context so blocking calls will
       * complete
       */
      psContextMap[dwContextIndex].contextBlockStatus = BLOCK_STATUS_RESUME;

      if (StatSynchronizeContext(hContext))
            rv = SCARD_F_INTERNAL_ERROR;

      PROFILE_END(rv)

      return rv;
}


Generated by  Doxygen 1.6.0   Back to index