Implementation for Smartcard Reader with Pin Pad

This commit is contained in:
Vinche 2014-11-10 23:40:22 +01:00
parent 69766de29f
commit fdb95c712b
3 changed files with 27 additions and 18 deletions

View File

@ -1938,6 +1938,12 @@ UINT32 smartcard_unpack_control_call(SMARTCARD_DEVICE* smartcard, wStream* s, Co
Stream_Read_UINT32(s, call->fpvOutBufferIsNULL); /* fpvOutBufferIsNULL (4 bytes) */
Stream_Read_UINT32(s, call->cbOutBufferSize); /* cbOutBufferSize (4 bytes) */
/*if (call->dwControlCode == 0x00310D4C)
{
printf("Why ?\n");
call->dwControlCode = 0x00313538;
}*/
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
if (status)

View File

@ -1470,7 +1470,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChange_Internal(SCARDCONTEXT hContext
rgReaderStates[i].cbAtr = states[j].cbAtr;
CopyMemory(&(rgReaderStates[i].rgbAtr), &(states[j].rgbAtr), PCSC_MAX_ATR_SIZE);
/**
* Why we should interpret the results of pcsc-lite ScardGetStatusChange ?
* Why we should interpret and modify the results of pcsc-lite ScardGetStatusChange ?
* Should not we just act as a pass-through between the client and the remote smartcard subsystem ?
*/
#if 0
@ -1500,6 +1500,16 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChange_Internal(SCARDCONTEXT hContext
#endif
rgReaderStates[i].dwEventState = states[j].dwEventState;
}
/**
* Why we should interpret and modify the results of pcsc-lite ScardGetStatusChange ?
* Should not we just act as a pass-through between the client and the remote smartcard subsystem ?
*/
#if 0
if ((status == SCARD_S_SUCCESS) && !stateChanged)
status = SCARD_E_TIMEOUT;
else if ((status == SCARD_E_TIMEOUT) && stateChanged)
return SCARD_S_SUCCESS;
#endif
free(states);
free(map);
@ -2093,8 +2103,9 @@ WINSCARDAPI LONG WINAPI PCSC_SCardControl(SCARDHANDLE hCard,
IoCtlAccess = ACCESS_FROM_CTL_CODE(dwControlCode);
IoCtlDeviceType = DEVICE_TYPE_FROM_CTL_CODE(dwControlCode);
if (dwControlCode == PCSC_CM_IOCTL_GET_FEATURE_REQUEST)
if (dwControlCode == PCSC_CM_IOCTL_GET_FEATURE_REQUEST) {
getFeatureRequest = TRUE;
}
if (IoCtlDeviceType == FILE_DEVICE_SMARTCARD)
dwControlCode = PCSC_SCARD_CTL_CODE(IoCtlFunction);
@ -2116,11 +2127,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardControl(SCARDHANDLE hCard,
{
ioCtlValue = _byteswap_ulong(tlv->value);
ioCtlValue -= 0x42000000; /* inverse of PCSC_SCARD_CTL_CODE() */
IoCtlMethod = METHOD_FROM_CTL_CODE(ioCtlValue);
IoCtlFunction = FUNCTION_FROM_CTL_CODE(ioCtlValue);
IoCtlAccess = ACCESS_FROM_CTL_CODE(ioCtlValue);
IoCtlDeviceType = DEVICE_TYPE_FROM_CTL_CODE(ioCtlValue);
ioCtlValue = SCARD_CTL_CODE(IoCtlFunction);
ioCtlValue = SCARD_CTL_CODE(ioCtlValue);
tlv->value = _byteswap_ulong(ioCtlValue);
}
}

View File

@ -78,8 +78,13 @@ typedef long PCSC_LONG;
#define PCSC_SCARD_CTL_CODE(code) (0x42000000 + (code))
#define PCSC_CM_IOCTL_GET_FEATURE_REQUEST SCARD_CTL_CODE(3400)
/**
* pcsc-lite defines SCARD_READERSTATE, SCARD_IO_REQUEST as packed
* on Mac OS X only and uses default packing everywhere else.
*/
#ifdef __APPLE__
#pragma pack(1)
#pragma pack(push, 1)
#endif
typedef struct
@ -100,14 +105,10 @@ typedef struct
} PCSC_SCARD_IO_REQUEST;
#ifdef __APPLE__
#pragma pack()
#pragma pack(pop)
#endif
#if defined(__APPLE__) | defined(sun)
#pragma pack(1)
#else
#pragma pack(push, 1)
#endif
typedef struct
{
@ -116,12 +117,7 @@ typedef struct
UINT32 value;
} PCSC_TLV_STRUCTURE;
#if defined(__APPLE__) | defined(sun)
#pragma pack()
#else
#pragma pack(pop)
#endif
struct _PCSCFunctionTable
{