From cd8c32521df8ffd6264b3f1d7f1e401da2c593f7 Mon Sep 17 00:00:00 2001 From: KIT! Date: Thu, 25 Apr 2024 14:24:06 +0200 Subject: [PATCH] Bad fix for bad code Avoids an error when multiple smartcard readers are connected. This should just be refactored like i did on the aimeio-smartcard repo but i don't have the motivation to merge that in right now so... it'll do ! --- src/cardreader_plugin/SmartCard/scard.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cardreader_plugin/SmartCard/scard.c b/src/cardreader_plugin/SmartCard/scard.c index e97380b..4643b08 100644 --- a/src/cardreader_plugin/SmartCard/scard.c +++ b/src/cardreader_plugin/SmartCard/scard.c @@ -292,9 +292,12 @@ bool scard_init() { printError("%s (%s): Failed SCardDisconnect: 0x%08X\n", __func__, module, lRet); } - else{ + else + { printInfo("%s (%s): Disconnected from reader: %s, this is expected behavior\n", __func__, module, reader); } + + break; } // If we have at least two readers, assign readers to slots as necessary. @@ -333,6 +336,7 @@ bool scard_init() reader_name_slots[1] = (LPTSTR)HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, sizeof(TCHAR) * (readerNameLen + 1)); memcpy(reader_name_slots[1], &reader[0], (size_t)(readerNameLen + 1)); } + break; } if (reader_name_slots[0])