From 99c69cde2710a31a156b944ea9e02dd542063976 Mon Sep 17 00:00:00 2001 From: Bernhard Miklautz Date: Mon, 4 Dec 2017 12:17:57 +0100 Subject: [PATCH] fix channel/smartcard: error handling According to MS-RDPESC the smart card channel must set the IoStatus to an NTSTATUS in case a encoding or decoding error happens. The smart card channel did this correctly but the output stream was modified incorrectly causing the smart card remote manager to stop in error cases. --- channels/smartcard/client/smartcard_operations.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c index a34cc0b..b6d5a7d 100644 --- a/channels/smartcard/client/smartcard_operations.c +++ b/channels/smartcard/client/smartcard_operations.c @@ -2022,13 +2022,12 @@ LONG smartcard_irp_device_control_call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OP SCardGetErrorString(result), result); } - irp->IoStatus = 0; + irp->IoStatus = STATUS_SUCCESS; if ((result & 0xC0000000) == 0xC0000000) { /* NTSTATUS error */ irp->IoStatus = (UINT32)result; - Stream_SetPosition(irp->output, RDPDR_DEVICE_IO_RESPONSE_LENGTH); WLog_WARN(TAG, "IRP failure: %s (0x%08"PRIX32"), ntstatus: 0x%08"PRIX32"", smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, result); } -- 2.7.4