[smartcard] fix message queuing

the queye key must not be 0
This commit is contained in:
Armin Novak 2023-07-03 20:03:13 +02:00 committed by akallabeth
parent fe987091f4
commit 9af563d4d1

View File

@ -329,14 +329,12 @@ static UINT smartcard_init(DEVICE* device)
*/ */
UINT smartcard_complete_irp(SMARTCARD_DEVICE* smartcard, IRP* irp, BOOL* handled) UINT smartcard_complete_irp(SMARTCARD_DEVICE* smartcard, IRP* irp, BOOL* handled)
{ {
void* key;
WINPR_ASSERT(smartcard); WINPR_ASSERT(smartcard);
WINPR_ASSERT(irp); WINPR_ASSERT(irp);
WINPR_ASSERT(handled); WINPR_ASSERT(handled);
key = (void*)(size_t)irp->CompletionId; uintptr_t key = (uintptr_t)irp->CompletionId + 1;
ListDictionary_Remove(smartcard->rgOutstandingMessages, key); ListDictionary_Remove(smartcard->rgOutstandingMessages, (void*)key);
WINPR_ASSERT(irp->Complete); WINPR_ASSERT(irp->Complete);
*handled = TRUE; *handled = TRUE;
@ -355,7 +353,6 @@ UINT smartcard_complete_irp(SMARTCARD_DEVICE* smartcard, IRP* irp, BOOL* handled
*/ */
static UINT smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp, BOOL* handled) static UINT smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp, BOOL* handled)
{ {
void* key;
LONG status; LONG status;
BOOL asyncIrp = FALSE; BOOL asyncIrp = FALSE;
SMARTCARD_CONTEXT* pContext = NULL; SMARTCARD_CONTEXT* pContext = NULL;
@ -365,9 +362,9 @@ static UINT smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp, BOOL* h
WINPR_ASSERT(irp); WINPR_ASSERT(irp);
WINPR_ASSERT(irp->Complete); WINPR_ASSERT(irp->Complete);
key = (void*)(size_t)irp->CompletionId; uintptr_t key = (uintptr_t)irp->CompletionId + 1;
if (!ListDictionary_Add(smartcard->rgOutstandingMessages, key, irp)) if (!ListDictionary_Add(smartcard->rgOutstandingMessages, (void*)key, irp))
{ {
WLog_ERR(TAG, "ListDictionary_Add failed!"); WLog_ERR(TAG, "ListDictionary_Add failed!");
return ERROR_INTERNAL_ERROR; return ERROR_INTERNAL_ERROR;