[emu,scard] smartcard emulation cleanup

* Fix readability-non-const-parameter (disable lint, API requires these
  to be non const)
* Return an appropriate error for functions returning
  SCARD_E_UNSUPPORTED_FEATURE if there is a parameter wrong
* Remove unused functions
This commit is contained in:
akallabeth 2024-09-03 12:11:35 +02:00
parent 5a4a1a40ad
commit 42b078a59d
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -204,30 +204,6 @@ static void scard_context_free(void* context)
free(ctx);
}
static BOOL char_compare(const void* a, const void* b)
{
const CHAR* wa = a;
const CHAR* wb = b;
if (!a && !b)
return TRUE;
if (!a || !b)
return FALSE;
return strcmp(wa, wb) == 0;
}
static BOOL wchar_compare(const void* a, const void* b)
{
const WCHAR* wa = a;
const WCHAR* wb = b;
if (!a && !b)
return TRUE;
if (!a || !b)
return FALSE;
return _wcscmp(wa, wb) == 0;
}
static SCardContext* scard_context_new(void)
{
SCardContext* ctx = calloc(1, sizeof(SCardContext));
@ -247,7 +223,7 @@ static SCardContext* scard_context_new(void)
ctx->cache = HashTable_New(FALSE);
if (!ctx->cache)
goto fail;
else if (!HashTable_SetupForStringData(ctx->cache, FALSE))
if (!HashTable_SetupForStringData(ctx->cache, FALSE))
goto fail;
else
{
@ -483,9 +459,9 @@ LONG WINAPI Emulate_SCardIsValidContext(SmartcardEmulationContext* smartcard, SC
return status;
}
LONG WINAPI Emulate_SCardListReaderGroupsA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPSTR mszGroups,
LPDWORD pcchGroups)
LONG WINAPI Emulate_SCardListReaderGroupsA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
LPSTR mszGroups /* NOLINT(readability-non-const-parameter) */, LPDWORD pcchGroups)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -496,7 +472,8 @@ LONG WINAPI Emulate_SCardListReaderGroupsA(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(pcchGroups);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardListReaderGroupsA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -505,9 +482,9 @@ LONG WINAPI Emulate_SCardListReaderGroupsA(SmartcardEmulationContext* smartcard,
return status;
}
LONG WINAPI Emulate_SCardListReaderGroupsW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPWSTR mszGroups,
LPDWORD pcchGroups)
LONG WINAPI Emulate_SCardListReaderGroupsW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
LPWSTR mszGroups /* NOLINT(readability-non-const-parameter) */, LPDWORD pcchGroups)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -518,7 +495,8 @@ LONG WINAPI Emulate_SCardListReaderGroupsW(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(pcchGroups);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardListReaderGroupsW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -609,7 +587,9 @@ LONG WINAPI Emulate_SCardListReadersW(SmartcardEmulationContext* smartcard, SCAR
LONG WINAPI Emulate_SCardListCardsA(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
LPCBYTE pbAtr, LPCGUID rgquidInterfaces,
DWORD cguidInterfaceCount, CHAR* mszCards, LPDWORD pcchCards)
DWORD cguidInterfaceCount,
CHAR* mszCards /* NOLINT(readability-non-const-parameter) */,
LPDWORD pcchCards /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -623,7 +603,8 @@ LONG WINAPI Emulate_SCardListCardsA(SmartcardEmulationContext* smartcard, SCARDC
WINPR_UNUSED(pcchCards);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardListCardsA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -634,7 +615,9 @@ LONG WINAPI Emulate_SCardListCardsA(SmartcardEmulationContext* smartcard, SCARDC
LONG WINAPI Emulate_SCardListCardsW(SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext,
LPCBYTE pbAtr, LPCGUID rgquidInterfaces,
DWORD cguidInterfaceCount, WCHAR* mszCards, LPDWORD pcchCards)
DWORD cguidInterfaceCount,
WCHAR* mszCards /* NOLINT(readability-non-const-parameter) */,
LPDWORD pcchCards /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -648,7 +631,8 @@ LONG WINAPI Emulate_SCardListCardsW(SmartcardEmulationContext* smartcard, SCARDC
WINPR_UNUSED(pcchCards);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardListCardsW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -657,9 +641,9 @@ LONG WINAPI Emulate_SCardListCardsW(SmartcardEmulationContext* smartcard, SCARDC
return status;
}
LONG WINAPI Emulate_SCardListInterfacesA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szCard,
LPGUID pguidInterfaces, LPDWORD pcguidInterfaces)
LONG WINAPI Emulate_SCardListInterfacesA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCard,
LPGUID pguidInterfaces, LPDWORD pcguidInterfaces /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -671,7 +655,8 @@ LONG WINAPI Emulate_SCardListInterfacesA(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(pcguidInterfaces);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardListInterfacesA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -680,9 +665,9 @@ LONG WINAPI Emulate_SCardListInterfacesA(SmartcardEmulationContext* smartcard,
return status;
}
LONG WINAPI Emulate_SCardListInterfacesW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szCard,
LPGUID pguidInterfaces, LPDWORD pcguidInterfaces)
LONG WINAPI Emulate_SCardListInterfacesW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCard,
LPGUID pguidInterfaces, LPDWORD pcguidInterfaces /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -694,7 +679,8 @@ LONG WINAPI Emulate_SCardListInterfacesW(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(pcguidInterfaces);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardListInterfacesW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -715,7 +701,8 @@ LONG WINAPI Emulate_SCardGetProviderIdA(SmartcardEmulationContext* smartcard, SC
WINPR_UNUSED(pguidProviderId);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardGetProviderIdA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -736,7 +723,8 @@ LONG WINAPI Emulate_SCardGetProviderIdW(SmartcardEmulationContext* smartcard, SC
WINPR_UNUSED(pguidProviderId);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardGetProviderIdW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -745,10 +733,10 @@ LONG WINAPI Emulate_SCardGetProviderIdW(SmartcardEmulationContext* smartcard, SC
return status;
}
LONG WINAPI Emulate_SCardGetCardTypeProviderNameA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szCardName,
DWORD dwProviderId, CHAR* szProvider,
LPDWORD pcchProvider)
LONG WINAPI Emulate_SCardGetCardTypeProviderNameA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szCardName,
DWORD dwProviderId, CHAR* szProvider /* NOLINT(readability-non-const-parameter) */,
LPDWORD pcchProvider /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -761,7 +749,8 @@ LONG WINAPI Emulate_SCardGetCardTypeProviderNameA(SmartcardEmulationContext* sma
WINPR_UNUSED(pcchProvider);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardGetCardTypeProviderNameA } status: %s (0x%08" PRIX32 ")",
@ -770,10 +759,10 @@ LONG WINAPI Emulate_SCardGetCardTypeProviderNameA(SmartcardEmulationContext* sma
return status;
}
LONG WINAPI Emulate_SCardGetCardTypeProviderNameW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szCardName,
DWORD dwProviderId, WCHAR* szProvider,
LPDWORD pcchProvider)
LONG WINAPI Emulate_SCardGetCardTypeProviderNameW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szCardName,
DWORD dwProviderId, WCHAR* szProvider /* NOLINT(readability-non-const-parameter) */,
LPDWORD pcchProvider /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -786,7 +775,8 @@ LONG WINAPI Emulate_SCardGetCardTypeProviderNameW(SmartcardEmulationContext* sma
WINPR_UNUSED(pcchProvider);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardGetCardTypeProviderNameW } status: %s (0x%08" PRIX32 ")",
@ -806,7 +796,8 @@ LONG WINAPI Emulate_SCardIntroduceReaderGroupA(SmartcardEmulationContext* smartc
WINPR_UNUSED(szGroupName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardIntroduceReaderGroupA } status: %s (0x%08" PRIX32 ")",
@ -826,7 +817,8 @@ LONG WINAPI Emulate_SCardIntroduceReaderGroupW(SmartcardEmulationContext* smartc
WINPR_UNUSED(szGroupName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardIntroduceReaderGroupW } status: %s (0x%08" PRIX32 ")",
@ -846,7 +838,8 @@ LONG WINAPI Emulate_SCardForgetReaderGroupA(SmartcardEmulationContext* smartcard
WINPR_UNUSED(szGroupName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardForgetReaderGroupA } status: %s (0x%08" PRIX32 ")",
@ -866,7 +859,8 @@ LONG WINAPI Emulate_SCardForgetReaderGroupW(SmartcardEmulationContext* smartcard
WINPR_UNUSED(szGroupName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardForgetReaderGroupW } status: %s (0x%08" PRIX32 ")",
@ -890,7 +884,8 @@ LONG WINAPI Emulate_SCardIntroduceReaderA(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(szDeviceName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardIntroduceReaderA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -914,7 +909,8 @@ LONG WINAPI Emulate_SCardIntroduceReaderW(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(szDeviceName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardIntroduceReaderW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -935,7 +931,8 @@ LONG WINAPI Emulate_SCardForgetReaderA(SmartcardEmulationContext* smartcard, SCA
(void*)hContext);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardForgetReaderA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -956,7 +953,8 @@ LONG WINAPI Emulate_SCardForgetReaderW(SmartcardEmulationContext* smartcard, SCA
(void*)hContext);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardForgetReaderW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -980,7 +978,8 @@ LONG WINAPI Emulate_SCardAddReaderToGroupA(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(szGroupName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardAddReaderToGroupA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -1004,7 +1003,8 @@ LONG WINAPI Emulate_SCardAddReaderToGroupW(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(szGroupName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardAddReaderToGroupW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -1028,7 +1028,8 @@ LONG WINAPI Emulate_SCardRemoveReaderFromGroupA(SmartcardEmulationContext* smart
WINPR_UNUSED(szGroupName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardRemoveReaderFromGroupA } status: %s (0x%08" PRIX32 ")",
@ -1052,7 +1053,8 @@ LONG WINAPI Emulate_SCardRemoveReaderFromGroupW(SmartcardEmulationContext* smart
WINPR_UNUSED(szGroupName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardRemoveReaderFromGroupW } status: %s (0x%08" PRIX32 ")",
@ -1081,7 +1083,8 @@ LONG WINAPI Emulate_SCardIntroduceCardTypeA(SmartcardEmulationContext* smartcard
WINPR_UNUSED(cbAtrLen);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardIntroduceCardTypeA } status: %s (0x%08" PRIX32 ")",
@ -1110,7 +1113,8 @@ LONG WINAPI Emulate_SCardIntroduceCardTypeW(SmartcardEmulationContext* smartcard
WINPR_UNUSED(cbAtrLen);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardIntroduceCardTypeW } status: %s (0x%08" PRIX32 ")",
@ -1133,7 +1137,8 @@ LONG WINAPI Emulate_SCardSetCardTypeProviderNameA(SmartcardEmulationContext* sma
WINPR_UNUSED(szProvider);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardSetCardTypeProviderNameA } status: %s (0x%08" PRIX32 ")",
@ -1156,7 +1161,8 @@ LONG WINAPI Emulate_SCardSetCardTypeProviderNameW(SmartcardEmulationContext* sma
WINPR_UNUSED(szProvider);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardSetCardTypeProviderNameW } status: %s (0x%08" PRIX32 ")",
@ -1176,7 +1182,8 @@ LONG WINAPI Emulate_SCardForgetCardTypeA(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(szCardName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardForgetCardTypeA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -1196,7 +1203,8 @@ LONG WINAPI Emulate_SCardForgetCardTypeW(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(szCardName);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardForgetCardTypeW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -1270,7 +1278,8 @@ LONG WINAPI Emulate_SCardLocateCardsA(SmartcardEmulationContext* smartcard, SCAR
WINPR_UNUSED(cReaders);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardLocateCardsA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -1293,7 +1302,8 @@ LONG WINAPI Emulate_SCardLocateCardsW(SmartcardEmulationContext* smartcard, SCAR
WINPR_UNUSED(cReaders);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardLocateCardsW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -1318,7 +1328,8 @@ LONG WINAPI Emulate_SCardLocateCardsByATRA(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(cReaders);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardLocateCardsByATRA } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -1343,7 +1354,8 @@ LONG WINAPI Emulate_SCardLocateCardsByATRW(SmartcardEmulationContext* smartcard,
WINPR_UNUSED(cReaders);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardLocateCardsByATRW } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -2017,9 +2029,10 @@ LONG WINAPI Emulate_SCardGetTransmitCount(SmartcardEmulationContext* smartcard,
return status;
}
LONG WINAPI Emulate_SCardControl(SmartcardEmulationContext* smartcard, SCARDHANDLE hCard,
DWORD dwControlCode, LPCVOID lpInBuffer, DWORD cbInBufferSize,
LPVOID lpOutBuffer, DWORD cbOutBufferSize, LPDWORD lpBytesReturned)
LONG WINAPI Emulate_SCardControl(
SmartcardEmulationContext* smartcard, SCARDHANDLE hCard, DWORD dwControlCode,
LPCVOID lpInBuffer, DWORD cbInBufferSize, LPVOID lpOutBuffer, DWORD cbOutBufferSize,
LPDWORD lpBytesReturned /* NOLINT(readability-non-const-parameter) */)
{
LONG status = scard_handle_valid(smartcard, hCard);
@ -2046,7 +2059,9 @@ LONG WINAPI Emulate_SCardControl(SmartcardEmulationContext* smartcard, SCARDHAND
}
LONG WINAPI Emulate_SCardGetAttrib(SmartcardEmulationContext* smartcard, SCARDHANDLE hCard,
DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)
DWORD dwAttrId,
LPBYTE pbAttr /* NOLINT(readability-non-const-parameter) */,
LPDWORD pcbAttrLen /* NOLINT(readability-non-const-parameter) */)
{
LONG status = scard_handle_valid(smartcard, hCard);
@ -2058,7 +2073,8 @@ LONG WINAPI Emulate_SCardGetAttrib(SmartcardEmulationContext* smartcard, SCARDHA
WINPR_UNUSED(pcbAttrLen);
/* Not required, return not supported */
status = SCARD_F_INTERNAL_ERROR;
if (status == SCARD_S_SUCCESS)
status = SCARD_F_INTERNAL_ERROR;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardGetAttrib } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -2080,7 +2096,8 @@ LONG WINAPI Emulate_SCardSetAttrib(SmartcardEmulationContext* smartcard, SCARDHA
WINPR_UNUSED(cbAttrLen);
/* Not required, return not supported */
status = SCARD_F_INTERNAL_ERROR;
if (status == SCARD_S_SUCCESS)
status = SCARD_F_INTERNAL_ERROR;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardSetAttrib } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status),
@ -2506,10 +2523,10 @@ LONG WINAPI Emulate_SCardGetDeviceTypeIdW(SmartcardEmulationContext* smartcard,
return status;
}
LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCSTR szReaderName,
LPSTR szDeviceInstanceId,
LPDWORD pcchDeviceInstanceId)
LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szReaderName,
LPSTR szDeviceInstanceId /* NOLINT(readability-non-const-parameter) */,
LPDWORD pcchDeviceInstanceId /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -2523,7 +2540,8 @@ LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdA(SmartcardEmulationContext* s
WINPR_UNUSED(pcchDeviceInstanceId);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardGetReaderDeviceInstanceIdA } status: %s (0x%08" PRIX32 ")",
@ -2532,10 +2550,10 @@ LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdA(SmartcardEmulationContext* s
return status;
}
LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext, LPCWSTR szReaderName,
LPWSTR szDeviceInstanceId,
LPDWORD pcchDeviceInstanceId)
LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szReaderName,
LPWSTR szDeviceInstanceId /* NOLINT(readability-non-const-parameter) */,
LPDWORD pcchDeviceInstanceId /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -2549,7 +2567,8 @@ LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdW(SmartcardEmulationContext* s
WINPR_UNUSED(pcchDeviceInstanceId);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardGetReaderDeviceInstanceIdW } status: %s (0x%08" PRIX32 ")",
@ -2558,10 +2577,10 @@ LONG WINAPI Emulate_SCardGetReaderDeviceInstanceIdW(SmartcardEmulationContext* s
return status;
}
LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdA(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCSTR szDeviceInstanceId,
LPSTR mszReaders, LPDWORD pcchReaders)
LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdA(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCSTR szDeviceInstanceId,
LPSTR mszReaders /* NOLINT(readability-non-const-parameter) */,
LPDWORD pcchReaders /* NOLINT(readability-non-const-parameter) */)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -2573,7 +2592,8 @@ LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdA(SmartcardEmulationCont
WINPR_UNUSED(pcchReaders);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardListReadersWithDeviceInstanceIdA } status: %s (0x%08" PRIX32 ")",
@ -2582,10 +2602,9 @@ LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdA(SmartcardEmulationCont
return status;
}
LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdW(SmartcardEmulationContext* smartcard,
SCARDCONTEXT hContext,
LPCWSTR szDeviceInstanceId,
LPWSTR mszReaders, LPDWORD pcchReaders)
LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdW(
SmartcardEmulationContext* smartcard, SCARDCONTEXT hContext, LPCWSTR szDeviceInstanceId,
LPWSTR mszReaders /* NOLINT(readability-non-const-parameter) */, LPDWORD pcchReaders)
{
LONG status = Emulate_SCardIsValidContext(smartcard, hContext);
@ -2597,7 +2616,8 @@ LONG WINAPI Emulate_SCardListReadersWithDeviceInstanceIdW(SmartcardEmulationCont
WINPR_UNUSED(pcchReaders);
/* Not required, return not supported */
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardListReadersWithDeviceInstanceIdW } status: %s (0x%08" PRIX32 ")",
@ -2617,7 +2637,8 @@ LONG WINAPI Emulate_SCardAudit(SmartcardEmulationContext* smartcard, SCARDCONTEX
(void*)hContext);
// TODO: Implement
status = SCARD_E_UNSUPPORTED_FEATURE;
if (status == SCARD_S_SUCCESS)
status = SCARD_E_UNSUPPORTED_FEATURE;
WLog_Print(smartcard->log, smartcard->log_default_level,
"SCardAudit } status: %s (0x%08" PRIX32 ")", SCardGetErrorString(status), status);