Merge pull request #2838 from akallabeth/smartcard_no_readers
Added return value checks for smartcard functions.
This commit is contained in:
commit
90b7d42429
@ -651,6 +651,9 @@ LONG smartcard_pack_list_readers_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
UINT32 mszNdrPtr;
|
||||
LONG error;
|
||||
|
||||
if (ret->ReturnCode != SCARD_S_SUCCESS)
|
||||
return ret->ReturnCode;
|
||||
|
||||
mszNdrPtr = (ret->cBytes) ? 0x00020008 : 0;
|
||||
|
||||
if (!Stream_EnsureRemainingCapacity(s, ret->cBytes + 32))
|
||||
@ -661,7 +664,7 @@ LONG smartcard_pack_list_readers_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
|
||||
Stream_Write_UINT32(s, ret->cBytes); /* cBytes (4 bytes) */
|
||||
Stream_Write_UINT32(s, mszNdrPtr); /* mszNdrPtr (4 bytes) */
|
||||
|
||||
|
||||
if (mszNdrPtr)
|
||||
{
|
||||
Stream_Write_UINT32(s, ret->cBytes); /* mszNdrLen (4 bytes) */
|
||||
@ -690,6 +693,17 @@ void smartcard_trace_list_readers_return(SMARTCARD_DEVICE* smartcard, ListReader
|
||||
if (!WLog_IsLevelActive(WLog_Get(TAG), WLOG_DEBUG))
|
||||
return;
|
||||
|
||||
WLog_DBG(TAG, "ListReaders%s_Return {", unicode ? "W" : "A");
|
||||
|
||||
WLog_DBG(TAG, "ReturnCode: %s (0x%08X)",
|
||||
SCardGetErrorString(ret->ReturnCode), ret->ReturnCode);
|
||||
|
||||
if (ret->ReturnCode != SCARD_S_SUCCESS)
|
||||
{
|
||||
WLog_DBG(TAG, "}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (unicode)
|
||||
{
|
||||
length = ret->cBytes / 2;
|
||||
@ -713,11 +727,6 @@ void smartcard_trace_list_readers_return(SMARTCARD_DEVICE* smartcard, ListReader
|
||||
mszA[index] = ',';
|
||||
}
|
||||
|
||||
WLog_DBG(TAG, "ListReaders%s_Return {", unicode ? "W" : "A");
|
||||
|
||||
WLog_DBG(TAG, "ReturnCode: %s (0x%08X)",
|
||||
SCardGetErrorString(ret->ReturnCode), ret->ReturnCode);
|
||||
|
||||
WLog_DBG(TAG, "cBytes: %d msz: %s", ret->cBytes, mszA);
|
||||
|
||||
WLog_DBG(TAG, "}");
|
||||
|
Loading…
Reference in New Issue
Block a user