Revert "Modified SCardConnect/SCardDisconnect logic to prevent more than one card from being connected to a context. Trying to connect more than once to a context without doing a disconnect can cause a deadlock in the pcsclite daemon (pcscd)."
This reverts commit ed8ea297e7
.
This commit is contained in:
parent
ed8ea297e7
commit
d1c764b374
@ -386,22 +386,9 @@ SCARDCONTEXT PCSC_GetCardContextFromHandle(SCARDHANDLE hCard)
|
||||
return pCard->hContext;
|
||||
}
|
||||
|
||||
BOOL PCSC_IsCardHandleConnected(SCARDCONTEXT hContext)
|
||||
{
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
|
||||
pContext = PCSC_GetCardContextData(hContext);
|
||||
|
||||
if (!pContext)
|
||||
return FALSE;
|
||||
|
||||
return pContext->hCard ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
PCSC_SCARDHANDLE* PCSC_ConnectCardHandle(SCARDCONTEXT hContext, SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
|
||||
pCard = (PCSC_SCARDHANDLE*) calloc(1, sizeof(PCSC_SCARDHANDLE));
|
||||
|
||||
@ -412,10 +399,6 @@ PCSC_SCARDHANDLE* PCSC_ConnectCardHandle(SCARDCONTEXT hContext, SCARDHANDLE hCar
|
||||
|
||||
InitializeCriticalSectionAndSpinCount(&(pCard->lock), 4000);
|
||||
|
||||
pContext = PCSC_GetCardContextData(hContext);
|
||||
|
||||
pContext->hCard = hCard;
|
||||
|
||||
if (!g_CardHandles)
|
||||
g_CardHandles = ListDictionary_New(TRUE);
|
||||
|
||||
@ -427,7 +410,6 @@ PCSC_SCARDHANDLE* PCSC_ConnectCardHandle(SCARDCONTEXT hContext, SCARDHANDLE hCar
|
||||
void PCSC_DisconnectCardHandle(SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
|
||||
pCard = PCSC_GetCardHandleData(hCard);
|
||||
|
||||
@ -436,10 +418,6 @@ void PCSC_DisconnectCardHandle(SCARDHANDLE hCard)
|
||||
|
||||
DeleteCriticalSection(&(pCard->lock));
|
||||
|
||||
pContext = PCSC_GetCardContextData(pCard->hContext);
|
||||
|
||||
pContext->hCard = 0;
|
||||
|
||||
free(pCard);
|
||||
|
||||
if (!g_CardHandles)
|
||||
@ -1619,9 +1597,6 @@ WINSCARDAPI LONG WINAPI PCSC_SCardConnect_Internal(SCARDCONTEXT hContext,
|
||||
if (!g_PCSC.pfnSCardConnect)
|
||||
return SCARD_E_NO_SERVICE;
|
||||
|
||||
if (PCSC_IsCardHandleConnected(hContext))
|
||||
return SCARD_E_SHARING_VIOLATION;
|
||||
|
||||
szReaderPCSC = PCSC_GetReaderNameFromAlias((char*) szReader);
|
||||
|
||||
if (!szReaderPCSC)
|
||||
|
Loading…
Reference in New Issue
Block a user