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_E_INVALID_HANDLE Invalid hContext handle.
Test:
 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 2967 of file winscard_clnt.c.

References BLOCK_STATUS_RESUME, _psContextMap::contextBlockStatus, psContextMap, and SCardGetContextIndice().

{
      DWORD dwContextIndex;

      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;

      PROFILE_END

      return SCARD_S_SUCCESS;
}


Generated by  Doxygen 1.6.0   Back to index