channels/smartcard: fix GetStatusChangeW

This commit is contained in:
Marc-André Moreau 2014-04-07 12:38:27 -04:00
parent 7b4c44c5ff
commit 21c3fd6093
3 changed files with 17 additions and 8 deletions

View File

@ -422,7 +422,7 @@ static UINT32 smartcard_GetStatusChangeW(SMARTCARD_DEVICE* smartcard, IRP* irp)
CopyMemory(&(rgReaderState->rgbAtr), &(call.rgReaderStates[index].Common.rgbAtr), 36); 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) if (status)
return 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); smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId);
#if 1 #if 1
if (/*(ioControlCode != SCARD_IOCTL_TRANSMIT) &&*/ //if (/*(ioControlCode != SCARD_IOCTL_TRANSMIT) &&*/
(ioControlCode != SCARD_IOCTL_GETSTATUSCHANGEA) && // (ioControlCode != SCARD_IOCTL_GETSTATUSCHANGEA) &&
(ioControlCode != SCARD_IOCTL_GETSTATUSCHANGEW)) // (ioControlCode != SCARD_IOCTL_GETSTATUSCHANGEW))
{ {
printf("%s (0x%08X) FileId: %d CompletionId: %d\n", printf("%s (0x%08X) FileId: %d CompletionId: %d\n",
smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId); smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId);

View File

@ -640,6 +640,10 @@ UINT32 smartcard_unpack_hcard_and_disposition_call(SMARTCARD_DEVICE* smartcard,
return SCARD_S_SUCCESS; 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) UINT32 smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wStream* s, GetStatusChangeA_Call* call)
{ {
int index; int index;
@ -739,7 +743,7 @@ UINT32 smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wS
return STATUS_INVALID_PARAMETER; 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; 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; return STATUS_INVALID_PARAMETER;
} }
#if 0 if (_wcscmp((WCHAR*) readerState->szReader, SMARTCARD_PNP_NOTIFICATION_W) == 0)
if (strcmp((char*) readerState->szReader, "\\\\?PnP?\\Notification") == 0)
{ {
readerState->Common.dwCurrentState |= SCARD_STATE_IGNORE; readerState->Common.dwCurrentState |= SCARD_STATE_IGNORE;
} }
#endif
} }
} }

View File

@ -515,7 +515,14 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChangeW(SCARDCONTEXT hContext,
status = PCSC_MapErrorCodeToWinSCard(status); status = PCSC_MapErrorCodeToWinSCard(status);
for (index = 0; index < cReaders; index++) for (index = 0; index < cReaders; index++)
{
free((void*) rgReaderStatesA[index].szReader); 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); free(rgReaderStatesA);
} }