diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c index 9f7579cf7..c1ff2c822 100644 --- a/channels/smartcard/client/smartcard_operations.c +++ b/channels/smartcard/client/smartcard_operations.c @@ -422,7 +422,7 @@ static UINT32 smartcard_GetStatusChangeW(SMARTCARD_DEVICE* smartcard, IRP* irp) CopyMemory(&(rgReaderState->rgbAtr), &(call.rgReaderStates[index].Common.rgbAtr), 36); } - status = ret.ReturnCode = SCardGetStatusChangeW(hContext, (DWORD) call.dwTimeOut, rgReaderStates, (DWORD) call.cReaders); + status = ret.ReturnCode = SCardGetStatusChangeW(hContext, call.dwTimeOut, rgReaderStates, call.cReaders); if (status) return status; @@ -1050,9 +1050,9 @@ void smartcard_irp_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp) smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId); #if 1 - if (/*(ioControlCode != SCARD_IOCTL_TRANSMIT) &&*/ - (ioControlCode != SCARD_IOCTL_GETSTATUSCHANGEA) && - (ioControlCode != SCARD_IOCTL_GETSTATUSCHANGEW)) + //if (/*(ioControlCode != SCARD_IOCTL_TRANSMIT) &&*/ + // (ioControlCode != SCARD_IOCTL_GETSTATUSCHANGEA) && + // (ioControlCode != SCARD_IOCTL_GETSTATUSCHANGEW)) { printf("%s (0x%08X) FileId: %d CompletionId: %d\n", smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId); diff --git a/channels/smartcard/client/smartcard_pack.c b/channels/smartcard/client/smartcard_pack.c index 77662b144..2edfac896 100644 --- a/channels/smartcard/client/smartcard_pack.c +++ b/channels/smartcard/client/smartcard_pack.c @@ -640,6 +640,10 @@ UINT32 smartcard_unpack_hcard_and_disposition_call(SMARTCARD_DEVICE* smartcard, return SCARD_S_SUCCESS; } +static char SMARTCARD_PNP_NOTIFICATION_A[] = "\\\\?PnP?\\Notification"; +static WCHAR SMARTCARD_PNP_NOTIFICATION_W[] = { '\\','\\','?','P','n','P','?', + '\\','N','o','t','i','f','i','c','a','t','i','o','n','\0' }; + UINT32 smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wStream* s, GetStatusChangeA_Call* call) { int index; @@ -739,7 +743,7 @@ UINT32 smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wS return STATUS_INVALID_PARAMETER; } - if (strcmp((char*) readerState->szReader, "\\\\?PnP?\\Notification") == 0) + if (strcmp((char*) readerState->szReader, SMARTCARD_PNP_NOTIFICATION_A) == 0) { readerState->Common.dwCurrentState |= SCARD_STATE_IGNORE; } @@ -848,12 +852,10 @@ UINT32 smartcard_unpack_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, wS return STATUS_INVALID_PARAMETER; } -#if 0 - if (strcmp((char*) readerState->szReader, "\\\\?PnP?\\Notification") == 0) + if (_wcscmp((WCHAR*) readerState->szReader, SMARTCARD_PNP_NOTIFICATION_W) == 0) { readerState->Common.dwCurrentState |= SCARD_STATE_IGNORE; } -#endif } } diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c index 081225216..10f4d3dbe 100644 --- a/winpr/libwinpr/smartcard/smartcard_pcsc.c +++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c @@ -515,7 +515,14 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChangeW(SCARDCONTEXT hContext, status = PCSC_MapErrorCodeToWinSCard(status); for (index = 0; index < cReaders; index++) + { free((void*) rgReaderStatesA[index].szReader); + rgReaderStates[index].pvUserData = rgReaderStatesA[index].pvUserData; + rgReaderStates[index].dwCurrentState = rgReaderStatesA[index].dwCurrentState; + rgReaderStates[index].dwEventState = rgReaderStatesA[index].dwEventState; + rgReaderStates[index].cbAtr = rgReaderStatesA[index].cbAtr; + CopyMemory(&(rgReaderStates[index].rgbAtr), &(rgReaderStatesA[index].rgbAtr), 36); + } free(rgReaderStatesA); }