fix channel/smartcard: remove SCardAddReaderName

SCardAddReaderName isn't part of the SCard API.

Note: removing this also removes the possibility to redirect single
smartcard readers with /smartcard:READERNAME. However this features
wasn't implemented in a general way and will be re-added as part of
the smart card channel directly.
This commit is contained in:
Bernhard Miklautz 2017-12-11 14:31:19 +01:00
parent 1e6fea7fa7
commit e3d45c4580
6 changed files with 4 additions and 89 deletions

View File

@ -708,14 +708,6 @@ UINT DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
Stream_Write(smartcard->device.data, "SCARD", 6);
status = SCardAddReaderName(&smartcard->thread, (LPSTR) device->Name);
if (status != SCARD_S_SUCCESS)
{
WLog_ERR(TAG, "Failed to add reader name!");
goto error_device_data;
}
smartcard->IrpQueue = MessageQueue_New(NULL);
if (!smartcard->IrpQueue)

View File

@ -789,8 +789,6 @@ WINSCARDAPI LONG WINAPI SCardListReadersWithDeviceInstanceIdW(SCARDCONTEXT hCont
WINSCARDAPI LONG WINAPI SCardAudit(SCARDCONTEXT hContext, DWORD dwEvent);
WINSCARDAPI LONG WINAPI SCardAddReaderName(HANDLE* key, LPSTR readerName);
#ifdef UNICODE
#define SCardListReaderGroups SCardListReaderGroupsW
#define SCardListReaders SCardListReadersW
@ -1045,8 +1043,6 @@ typedef LONG(WINAPI* fnSCardListReadersWithDeviceInstanceIdW)(SCARDCONTEXT hCont
typedef LONG(WINAPI* fnSCardAudit)(SCARDCONTEXT hContext, DWORD dwEvent);
typedef LONG(WINAPI* fnSCardAddReaderName)(HANDLE* key, LPSTR readerName);
struct _SCardApiFunctionTable
{
DWORD dwVersion;
@ -1128,7 +1124,6 @@ struct _SCardApiFunctionTable
fnSCardListReadersWithDeviceInstanceIdA pfnSCardListReadersWithDeviceInstanceIdA;
fnSCardListReadersWithDeviceInstanceIdW pfnSCardListReadersWithDeviceInstanceIdW;
fnSCardAudit pfnSCardAudit;
fnSCardAddReaderName pfnSCardAddReaderName;
};
typedef struct _SCardApiFunctionTable SCardApiFunctionTable;

View File

@ -507,11 +507,6 @@ WINSCARDAPI LONG WINAPI SCardAudit(SCARDCONTEXT hContext, DWORD dwEvent)
SCARDAPI_STUB_CALL_LONG(SCardAudit, hContext, dwEvent);
}
WINSCARDAPI LONG WINAPI SCardAddReaderName(HANDLE* key, LPSTR readerName)
{
SCARDAPI_STUB_CALL_LONG(SCardAddReaderName, key, readerName);
}
/**
* Extended API
*/

View File

@ -156,7 +156,6 @@ static wArrayList* g_Readers = NULL;
static wListDictionary* g_CardHandles = NULL;
static wListDictionary* g_CardContexts = NULL;
static wListDictionary* g_MemoryBlocks = NULL;
static wListDictionary* g_ReadersNames = NULL;
char SMARTCARD_PNP_NOTIFICATION_A[] = "\\\\?PnP?\\Notification";
@ -754,38 +753,6 @@ char* PCSC_GetReaderAliasFromName(char* namePCSC)
return nameWinSCard;
}
int PCSC_RedirectReader(char* readerName)
{
char* name;
ULONG_PTR* readers;
int i, nbReaders;
nbReaders = ListDictionary_GetKeys(g_ReadersNames, &readers);
for (i = 0; i < nbReaders; i++)
{
name = ListDictionary_GetItemValue(g_ReadersNames, (void*) readers[i]);
if (name)
{
if (strcmp(name, "") == 0)
{
return 1;
}
if (strncmp(readerName, name, strlen(readerName)) == 0)
{
return 1;
}
}
else
{
return 2;
}
}
return 0;
}
char* PCSC_ConvertReaderNamesToWinSCard(const char* names, LPDWORD pcchReaders)
{
int ret = 0;
@ -813,18 +780,8 @@ char* PCSC_ConvertReaderNamesToWinSCard(const char* names, LPDWORD pcchReaders)
if (nameWinSCard)
{
length = strlen(nameWinSCard);
ret = PCSC_RedirectReader(nameWinSCard);
if (ret == 1)
{
CopyMemory(q, nameWinSCard, length);
endReaderName = TRUE;
}
else if (ret == 2)
{
CopyMemory(q, nameWinSCard, length);
allReaders = TRUE;
}
CopyMemory(q, nameWinSCard, length);
allReaders = TRUE;
free(nameWinSCard);
}
@ -2808,27 +2765,6 @@ WINSCARDAPI LONG WINAPI PCSC_SCardAudit(SCARDCONTEXT hContext, DWORD dwEvent)
return 0;
}
WINSCARDAPI LONG WINAPI PCSC_SCardAddReaderName(HANDLE* key, LPSTR readerName)
{
LONG status = SCARD_S_SUCCESS;
int count = 0;
if (!g_ReadersNames)
{
g_ReadersNames = ListDictionary_New(TRUE);
if (!g_ReadersNames)
return SCARD_E_NO_SERVICE;
}
count = ListDictionary_Count(g_ReadersNames);
if (!ListDictionary_Add(g_ReadersNames, key, readerName))
return SCARD_E_NO_SERVICE;
return status;
}
#ifdef __MACOSX__
unsigned int determineMacOSXVersion(void)
{
@ -3038,8 +2974,7 @@ SCardApiFunctionTable PCSC_SCardApiFunctionTable =
PCSC_SCardGetReaderDeviceInstanceIdW, /* SCardGetReaderDeviceInstanceIdW */
PCSC_SCardListReadersWithDeviceInstanceIdA, /* SCardListReadersWithDeviceInstanceIdA */
PCSC_SCardListReadersWithDeviceInstanceIdW, /* SCardListReadersWithDeviceInstanceIdW */
PCSC_SCardAudit, /* SCardAudit */
PCSC_SCardAddReaderName /* SCardAddReaderName */
PCSC_SCardAudit /* SCardAudit */
};
PSCardApiFunctionTable PCSC_GetSCardApiFunctionTable(void)

View File

@ -155,7 +155,6 @@ struct _PCSCFunctionTable
PCSC_LPDWORD pcbAttrLen);
PCSC_LONG(* pfnSCardSetAttrib)(SCARDHANDLE hCard, PCSC_DWORD dwAttrId, LPCBYTE pbAttr,
PCSC_DWORD cbAttrLen);
PCSC_LONG(* pfnSCardAddReaderName)(HANDLE* key, LPSTR readerName);
};
typedef struct _PCSCFunctionTable PCSCFunctionTable;

View File

@ -111,8 +111,7 @@ SCardApiFunctionTable WinSCard_SCardApiFunctionTable =
NULL, /* SCardGetReaderDeviceInstanceIdW */
NULL, /* SCardListReadersWithDeviceInstanceIdA */
NULL, /* SCardListReadersWithDeviceInstanceIdW */
NULL, /* SCardAudit */
NULL /* SCardAddReaderName */
NULL /* SCardAudit */
};
PSCardApiFunctionTable WinSCard_GetSCardApiFunctionTable(void)