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

static LONG SCardRemoveContext ( SCARDCONTEXT  hContext  )  [static]

Removes an Application Context from a control vector.

Parameters:
[in] hContext Application Context to be removed.
Returns:
Error code.
Return values:
SCARD_S_SUCCESS Success.
SCARD_E_INVALID_HANDLE The context hContext was not found.

Definition at line 3085 of file winscard_clnt.c.

References BLOCK_STATUS_RESUME, _psContextMap::contextBlockStatus, _psContextMap::dwClientID, _psChannelMap::hCard, _psContextMap::hContext, _psContextMap::mMutex, PCSCLITE_MAX_APPLICATION_CONTEXT_CHANNELS, _psContextMap::psChannelMap, psContextMap, _psChannelMap::readerName, SCardGetContextIndiceTH(), and SHMClientCloseSession().

Referenced by SCardReleaseContext().

{
      LONG  retIndice;

      retIndice = SCardGetContextIndiceTH(hContext);

      if (retIndice == -1)
            return SCARD_E_INVALID_HANDLE;
      else
      {
            int i;

            psContextMap[retIndice].hContext = 0;
            SHMClientCloseSession(psContextMap[retIndice].dwClientID);
            psContextMap[retIndice].dwClientID = 0;
            free(psContextMap[retIndice].mMutex);
            psContextMap[retIndice].mMutex = NULL;
            psContextMap[retIndice].contextBlockStatus = BLOCK_STATUS_RESUME;

            for (i = 0; i < PCSCLITE_MAX_APPLICATION_CONTEXT_CHANNELS; i++)
            {
                  /*
                   * Reset the \c hCard structs to zero
                   */
                  psContextMap[retIndice].psChannelMap[i].hCard = 0;
                  free(psContextMap[retIndice].psChannelMap[i].readerName);
                  psContextMap[retIndice].psChannelMap[i].readerName = NULL;
            }

            return SCARD_S_SUCCESS;
      }
}


Generated by  Doxygen 1.6.0   Back to index