{
BOOL shared;
SCARDCONTEXT hSharedContext;
- SCARDCONTEXT hPrivateContext;
};
struct _PCSC_READER
if (!pCard)
return 0;
- return pCard->hPrivateContext;
+ return pCard->hSharedContext;
}
BOOL PCSC_WaitForCardAccess(SCARDCONTEXT hContext, SCARDHANDLE hCard, BOOL shared)
return TRUE;
}
-PCSC_SCARDHANDLE* PCSC_ConnectCardHandle(SCARDCONTEXT hSharedContext, SCARDCONTEXT hPrivateContext, SCARDHANDLE hCard)
+PCSC_SCARDHANDLE* PCSC_ConnectCardHandle(SCARDCONTEXT hSharedContext, SCARDHANDLE hCard)
{
PCSC_SCARDHANDLE* pCard;
PCSC_SCARDCONTEXT* pContext;
return NULL;
pCard->hSharedContext = hSharedContext;
- pCard->hPrivateContext = hPrivateContext;
if (!g_CardHandles)
{
return;
pContext = PCSC_GetCardContextData(pCard->hSharedContext);
- PCSC_SCardReleaseContext_Internal(pCard->hPrivateContext);
free(pCard);
if (!g_CardHandles)
char* szReaderPCSC;
LONG status = SCARD_S_SUCCESS;
PCSC_SCARDHANDLE* pCard = NULL;
- SCARDCONTEXT hPrivateContext = 0;
PCSC_DWORD pcsc_dwShareMode = (PCSC_DWORD) dwShareMode;
PCSC_DWORD pcsc_dwPreferredProtocols = 0;
PCSC_DWORD pcsc_dwActiveProtocol = 0;
access = PCSC_WaitForCardAccess(hContext, 0, shared);
- status = PCSC_SCardEstablishContext_Internal(SCARD_SCOPE_SYSTEM, NULL, NULL, &hPrivateContext);
-
- if (status != SCARD_S_SUCCESS)
- return status;
-
szReaderPCSC = PCSC_GetReaderNameFromAlias((char*) szReader);
if (!szReaderPCSC)
else
pcsc_dwPreferredProtocols = (PCSC_DWORD) PCSC_ConvertProtocolsFromWinSCard(dwPreferredProtocols);
- status = (LONG) g_PCSC.pfnSCardConnect(hPrivateContext, szReaderPCSC,
+ status = (LONG) g_PCSC.pfnSCardConnect(hContext, szReaderPCSC,
pcsc_dwShareMode, pcsc_dwPreferredProtocols, phCard, &pcsc_dwActiveProtocol);
status = PCSC_MapErrorCodeToWinSCard(status);
if (status == SCARD_S_SUCCESS)
{
- pCard = PCSC_ConnectCardHandle(hContext, hPrivateContext, *phCard);
+ pCard = PCSC_ConnectCardHandle(hContext, *phCard);
*pdwActiveProtocol = PCSC_ConvertProtocolsToWinSCard((DWORD) pcsc_dwActiveProtocol);
pCard->shared = shared;
PCSC_WaitForCardAccess(hContext, pCard->hSharedContext, shared);
}
- else
- {
- PCSC_SCardReleaseContext(hPrivateContext);
- }
return status;
}
int PCSC_InitializeSCardApi(void)
{
- DWORD nSize;
-
/* Disable pcsc-lite's (poor) blocking so we can handle it ourselves */
SetEnvironmentVariableA("PCSCLITE_NO_BLOCKING", "1");