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

static LONG SCardAddContext ( SCARDCONTEXT  hContext,
DWORD  dwClientID 
) [static]

Adds an Application Context to the vector psContextMap.

Functions for managing instances of SCardEstablishContext These functions keep track of Context handles and associate the blocking variable contextBlockStatus to an hContext

Parameters:
[in] hContext Application Context ID.
[in] dwClientID Client connection ID.
Returns:
Error code.
Return values:
SCARD_S_SUCCESS Success.
SCARD_E_NO_MEMORY There is no free slot to store hContext.

Definition at line 3005 of file winscard_clnt.c.

References BLOCK_STATUS_RESUME, _psContextMap::contextBlockStatus, _psContextMap::dwClientID, _psContextMap::hContext, _psContextMap::mMutex, PCSCLITE_MAX_APPLICATION_CONTEXTS, psContextMap, and SYS_MutexInit().

Referenced by SCardEstablishContextTH().

{
      int i;

      for (i = 0; i < PCSCLITE_MAX_APPLICATION_CONTEXTS; i++)
      {
            if (psContextMap[i].hContext == 0)
            {
                  psContextMap[i].hContext = hContext;
                  psContextMap[i].dwClientID = dwClientID;
                  psContextMap[i].contextBlockStatus = BLOCK_STATUS_RESUME;
                  psContextMap[i].mMutex = malloc(sizeof(PCSCLITE_MUTEX));
                  SYS_MutexInit(psContextMap[i].mMutex);
                  return SCARD_S_SUCCESS;
            }
      }

      return SCARD_E_NO_MEMORY;
}


Generated by  Doxygen 1.6.0   Back to index