channels/smartcard: add clean definitions of packed data structures and RDP smartcard IOCTLs

This commit is contained in:
Marc-André Moreau 2014-04-03 18:47:18 -04:00
parent 308e32ccb9
commit caf1156254
5 changed files with 528 additions and 62 deletions

View File

@ -20,6 +20,8 @@ define_channel_client("smartcard")
set(${MODULE_PREFIX}_SRCS
smartcard_main.c
smartcard_main.h
smartcard_pack.c
smartcard_pack.h
smartcard_operations.c)
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry")

View File

@ -30,33 +30,56 @@
#include <winpr/smartcard.h>
#include <winpr/collections.h>
/* [MS-RDPESC] 3.1.4 */
#define SCARD_IOCTL_ESTABLISH_CONTEXT 0x00090014 /* EstablishContext */
#define SCARD_IOCTL_RELEASE_CONTEXT 0x00090018 /* ReleaseContext */
#define SCARD_IOCTL_IS_VALID_CONTEXT 0x0009001C /* IsValidContext */
#define SCARD_IOCTL_LIST_READER_GROUPS 0x00090020 /* ListReaderGroups */
#define SCARD_IOCTL_LIST_READERS 0x00090028 /* ListReadersA */
#define SCARD_IOCTL_INTRODUCE_READER_GROUP 0x00090050 /* IntroduceReaderGroup */
#define SCARD_IOCTL_FORGET_READER_GROUP 0x00090058 /* ForgetReader */
#define SCARD_IOCTL_INTRODUCE_READER 0x00090060 /* IntroduceReader */
#define SCARD_IOCTL_FORGET_READER 0x00090068 /* IntroduceReader */
#define SCARD_IOCTL_ADD_READER_TO_GROUP 0x00090070 /* AddReaderToGroup */
#define SCARD_IOCTL_REMOVE_READER_FROM_GROUP 0x00090078 /* RemoveReaderFromGroup */
#define SCARD_IOCTL_GET_STATUS_CHANGE 0x000900A0 /* GetStatusChangeA */
#define SCARD_IOCTL_CANCEL 0x000900A8 /* Cancel */
#define SCARD_IOCTL_CONNECT 0x000900AC /* ConnectA */
#define SCARD_IOCTL_RECONNECT 0x000900B4 /* Reconnect */
#define SCARD_IOCTL_DISCONNECT 0x000900B8 /* Disconnect */
#define SCARD_IOCTL_BEGIN_TRANSACTION 0x000900BC /* BeginTransaction */
#define SCARD_IOCTL_END_TRANSACTION 0x000900C0 /* EndTransaction */
#define SCARD_IOCTL_STATE 0x000900C4 /* State */
#define SCARD_IOCTL_STATUS 0x000900C8 /* StatusA */
#define SCARD_IOCTL_TRANSMIT 0x000900D0 /* Transmit */
#define SCARD_IOCTL_CONTROL 0x000900D4 /* Control */
#define SCARD_IOCTL_GETATTRIB 0x000900D8 /* GetAttrib */
#define SCARD_IOCTL_SETATTRIB 0x000900DC /* SetAttrib */
#define SCARD_IOCTL_ACCESS_STARTED_EVENT 0x000900E0 /* SCardAccessStartedEvent */
#define SCARD_IOCTL_LOCATE_CARDS_BY_ATR 0x000900E8 /* LocateCardsByATR */
#define RDP_SCARD_CTL_CODE(code) CTL_CODE(FILE_DEVICE_FILE_SYSTEM, (code), METHOD_BUFFERED, FILE_ANY_ACCESS)
#define SCARD_IOCTL_ESTABLISHCONTEXT RDP_SCARD_CTL_CODE(5) /* SCardEstablishContext */
#define SCARD_IOCTL_RELEASECONTEXT RDP_SCARD_CTL_CODE(6) /* SCardReleaseContext */
#define SCARD_IOCTL_ISVALIDCONTEXT RDP_SCARD_CTL_CODE(7) /* SCardIsValidContext */
#define SCARD_IOCTL_LISTREADERGROUPSA RDP_SCARD_CTL_CODE(8) /* SCardListReaderGroupsA */
#define SCARD_IOCTL_LISTREADERGROUPSW RDP_SCARD_CTL_CODE(9) /* SCardListReaderGroupsW */
#define SCARD_IOCTL_LISTREADERSA RDP_SCARD_CTL_CODE(10) /* SCardListReadersA */
#define SCARD_IOCTL_LISTREADERSW RDP_SCARD_CTL_CODE(11) /* SCardListReadersW */
#define SCARD_IOCTL_INTRODUCEREADERGROUPA RDP_SCARD_CTL_CODE(20) /* SCardIntroduceReaderGroupA */
#define SCARD_IOCTL_INTRODUCEREADERGROUPW RDP_SCARD_CTL_CODE(21) /* SCardIntroduceReaderGroupW */
#define SCARD_IOCTL_FORGETREADERGROUPA RDP_SCARD_CTL_CODE(22) /* SCardForgetReaderGroupA */
#define SCARD_IOCTL_FORGETREADERGROUPW RDP_SCARD_CTL_CODE(23) /* SCardForgetReaderGroupW */
#define SCARD_IOCTL_INTRODUCEREADERA RDP_SCARD_CTL_CODE(24) /* SCardIntroduceReaderA */
#define SCARD_IOCTL_INTRODUCEREADERW RDP_SCARD_CTL_CODE(25) /* SCardIntroduceReaderW */
#define SCARD_IOCTL_FORGETREADERA RDP_SCARD_CTL_CODE(26) /* SCardForgetReaderA */
#define SCARD_IOCTL_FORGETREADERW RDP_SCARD_CTL_CODE(27) /* SCardForgetReaderW */
#define SCARD_IOCTL_ADDREADERTOGROUPA RDP_SCARD_CTL_CODE(28) /* SCardAddReaderToGroupA */
#define SCARD_IOCTL_ADDREADERTOGROUPW RDP_SCARD_CTL_CODE(29) /* SCardAddReaderToGroupW */
#define SCARD_IOCTL_REMOVEREADERFROMGROUPA RDP_SCARD_CTL_CODE(30) /* SCardRemoveReaderFromGroupA */
#define SCARD_IOCTL_REMOVEREADERFROMGROUPW RDP_SCARD_CTL_CODE(31) /* SCardRemoveReaderFromGroupW */
#define SCARD_IOCTL_LOCATECARDSA RDP_SCARD_CTL_CODE(38) /* SCardLocateCardsA */
#define SCARD_IOCTL_LOCATECARDSW RDP_SCARD_CTL_CODE(39) /* SCardLocateCardsW */
#define SCARD_IOCTL_GETSTATUSCHANGEA RDP_SCARD_CTL_CODE(40) /* SCardGetStatusChangeA */
#define SCARD_IOCTL_GETSTATUSCHANGEW RDP_SCARD_CTL_CODE(41) /* SCardGetStatusChangeW */
#define SCARD_IOCTL_CANCEL RDP_SCARD_CTL_CODE(42) /* SCardCancel */
#define SCARD_IOCTL_CONNECTA RDP_SCARD_CTL_CODE(43) /* SCardConnectA */
#define SCARD_IOCTL_CONNECTW RDP_SCARD_CTL_CODE(44) /* SCardConnectW */
#define SCARD_IOCTL_RECONNECT RDP_SCARD_CTL_CODE(45) /* SCardReconnect */
#define SCARD_IOCTL_DISCONNECT RDP_SCARD_CTL_CODE(46) /* SCardDisconnect */
#define SCARD_IOCTL_BEGINTRANSACTION RDP_SCARD_CTL_CODE(47) /* SCardBeginTransaction */
#define SCARD_IOCTL_ENDTRANSACTION RDP_SCARD_CTL_CODE(48) /* SCardEndTransaction */
#define SCARD_IOCTL_STATE RDP_SCARD_CTL_CODE(49) /* SCardState */
#define SCARD_IOCTL_STATUSA RDP_SCARD_CTL_CODE(50) /* SCardStatusA */
#define SCARD_IOCTL_STATUSW RDP_SCARD_CTL_CODE(51) /* SCardStatusW */
#define SCARD_IOCTL_TRANSMIT RDP_SCARD_CTL_CODE(52) /* SCardTransmit */
#define SCARD_IOCTL_CONTROL RDP_SCARD_CTL_CODE(53) /* SCardControl */
#define SCARD_IOCTL_GETATTRIB RDP_SCARD_CTL_CODE(54) /* SCardGetAttrib */
#define SCARD_IOCTL_SETATTRIB RDP_SCARD_CTL_CODE(55) /* SCardSetAttrib */
#define SCARD_IOCTL_ACCESSSTARTEDEVENT RDP_SCARD_CTL_CODE(56) /* SCardAccessStartedEvent */
#define SCARD_IOCTL_LOCATECARDSBYATRA RDP_SCARD_CTL_CODE(58) /* SCardLocateCardsByATRA */
#define SCARD_IOCTL_LOCATECARDSBYATRW RDP_SCARD_CTL_CODE(59) /* SCardLocateCardsByATRW */
#define SCARD_IOCTL_READCACHEA RDP_SCARD_CTL_CODE(60) /* SCardReadCacheA */
#define SCARD_IOCTL_READCACHEW RDP_SCARD_CTL_CODE(61) /* SCardReadCacheW */
#define SCARD_IOCTL_WRITECACHEA RDP_SCARD_CTL_CODE(62) /* SCardWriteCacheA */
#define SCARD_IOCTL_WRITECACHEW RDP_SCARD_CTL_CODE(63) /* SCardWriteCacheW */
#define SCARD_IOCTL_GETTRANSMITCOUNT RDP_SCARD_CTL_CODE(64) /* SCardGetTransmitCount */
#define SCARD_IOCTL_RELEASETARTEDEVENT RDP_SCARD_CTL_CODE(66) /* SCardReleaseStartedEvent */
#define SCARD_IOCTL_GETREADERICON RDP_SCARD_CTL_CODE(67) /* SCardGetReaderIconA */
#define SCARD_IOCTL_GETDEVICETYPEID RDP_SCARD_CTL_CODE(68) /* SCardGetDeviceTypeIdA */
struct _SMARTCARD_DEVICE
{
@ -78,4 +101,6 @@ typedef struct _SMARTCARD_DEVICE SMARTCARD_DEVICE;
BOOL smartcard_async_op(IRP* irp);
void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp);
#include "smartcard_pack.h"
#endif /* FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H */

View File

@ -2108,23 +2108,19 @@ BOOL smartcard_async_op(IRP* irp)
switch (ioctl_code)
{
/* non-blocking events */
case SCARD_IOCTL_ACCESS_STARTED_EVENT:
case SCARD_IOCTL_ESTABLISH_CONTEXT:
case SCARD_IOCTL_RELEASE_CONTEXT:
case SCARD_IOCTL_IS_VALID_CONTEXT:
case SCARD_IOCTL_ACCESSSTARTEDEVENT:
case SCARD_IOCTL_ESTABLISHCONTEXT:
case SCARD_IOCTL_RELEASECONTEXT:
case SCARD_IOCTL_ISVALIDCONTEXT:
return FALSE;
break;
/* async events */
case SCARD_IOCTL_GET_STATUS_CHANGE:
case SCARD_IOCTL_GET_STATUS_CHANGE + 4:
case SCARD_IOCTL_GETSTATUSCHANGEA:
case SCARD_IOCTL_GETSTATUSCHANGEW:
case SCARD_IOCTL_TRANSMIT:
case SCARD_IOCTL_STATUS:
case SCARD_IOCTL_STATUS + 4:
case SCARD_IOCTL_STATUSA:
case SCARD_IOCTL_STATUSW:
return TRUE;
break;
@ -2143,7 +2139,7 @@ void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
UINT32 result_pos;
UINT32 output_len;
UINT32 input_len;
UINT32 ioctl_code;
UINT32 ioControlCode;
UINT32 stream_len;
UINT32 irp_result_pos;
UINT32 output_len_pos;
@ -2159,7 +2155,7 @@ void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
Stream_Read_UINT32(irp->input, output_len);
Stream_Read_UINT32(irp->input, input_len);
Stream_Read_UINT32(irp->input, ioctl_code);
Stream_Read_UINT32(irp->input, ioControlCode);
Stream_Seek(irp->input, 20); /* padding */
@ -2202,37 +2198,37 @@ void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
* that can be read from the current position of irp->input,
* so pass it on ;) */
switch (ioctl_code)
switch (ioControlCode)
{
case SCARD_IOCTL_ESTABLISH_CONTEXT:
case SCARD_IOCTL_ESTABLISHCONTEXT:
result = handle_EstablishContext(smartcard, irp);
break;
case SCARD_IOCTL_IS_VALID_CONTEXT:
case SCARD_IOCTL_ISVALIDCONTEXT:
result = handle_IsValidContext(smartcard, irp);
break;
case SCARD_IOCTL_RELEASE_CONTEXT:
case SCARD_IOCTL_RELEASECONTEXT:
result = handle_ReleaseContext(smartcard, irp);
break;
case SCARD_IOCTL_LIST_READERS:
case SCARD_IOCTL_LISTREADERSA:
result = handle_ListReaders(smartcard, irp, 0);
break;
case SCARD_IOCTL_LIST_READERS + 4:
case SCARD_IOCTL_LISTREADERSW:
result = handle_ListReaders(smartcard, irp, 1);
break;
case SCARD_IOCTL_LIST_READER_GROUPS:
case SCARD_IOCTL_LIST_READER_GROUPS + 4:
case SCARD_IOCTL_LISTREADERGROUPSA:
case SCARD_IOCTL_LISTREADERGROUPSW:
/* typically not used unless list_readers fail */
result = SCARD_F_INTERNAL_ERROR;
break;
case SCARD_IOCTL_GET_STATUS_CHANGE:
case SCARD_IOCTL_GETSTATUSCHANGEA:
result = handle_GetStatusChange(smartcard, irp, 0);
break;
case SCARD_IOCTL_GET_STATUS_CHANGE + 4:
case SCARD_IOCTL_GETSTATUSCHANGEW:
result = handle_GetStatusChange(smartcard, irp, 1);
break;
@ -2240,10 +2236,10 @@ void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
result = handle_Cancel(smartcard, irp);
break;
case SCARD_IOCTL_CONNECT:
case SCARD_IOCTL_CONNECTA:
result = handle_Connect(smartcard, irp, 0);
break;
case SCARD_IOCTL_CONNECT + 4:
case SCARD_IOCTL_CONNECTW:
result = handle_Connect(smartcard, irp, 1);
break;
@ -2255,11 +2251,11 @@ void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
result = handle_Disconnect(smartcard, irp);
break;
case SCARD_IOCTL_BEGIN_TRANSACTION:
case SCARD_IOCTL_BEGINTRANSACTION:
result = handle_BeginTransaction(smartcard, irp);
break;
case SCARD_IOCTL_END_TRANSACTION:
case SCARD_IOCTL_ENDTRANSACTION:
result = handle_EndTransaction(smartcard, irp);
break;
@ -2267,10 +2263,10 @@ void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
result = handle_State(smartcard, irp);
break;
case SCARD_IOCTL_STATUS:
case SCARD_IOCTL_STATUSA:
result = handle_Status(smartcard, irp, 0);
break;
case SCARD_IOCTL_STATUS + 4:
case SCARD_IOCTL_STATUSW:
result = handle_Status(smartcard, irp, 1);
break;
@ -2286,21 +2282,21 @@ void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
result = handle_GetAttrib(smartcard, irp);
break;
case SCARD_IOCTL_ACCESS_STARTED_EVENT:
case SCARD_IOCTL_ACCESSSTARTEDEVENT:
result = handle_AccessStartedEvent(smartcard, irp);
break;
case SCARD_IOCTL_LOCATE_CARDS_BY_ATR:
case SCARD_IOCTL_LOCATECARDSBYATRA:
result = handle_LocateCardsByATR(smartcard, irp, 0);
break;
case SCARD_IOCTL_LOCATE_CARDS_BY_ATR + 4:
case SCARD_IOCTL_LOCATECARDSBYATRW:
result = handle_LocateCardsByATR(smartcard, irp, 1);
break;
default:
result = 0xc0000001;
DEBUG_WARN("scard unknown ioctl 0x%x [%d]\n",
ioctl_code, input_len);
ioControlCode, input_len);
break;
}
@ -2333,5 +2329,4 @@ void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp)
irp->IoStatus = 0;
irp->Complete(irp);
}

View File

@ -0,0 +1,26 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Smart Card Structure Packing
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "smartcard_pack.h"

View File

@ -0,0 +1,418 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Smart Card Structure Packing
*
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_SMARTCARD_CLIENT_PACK_H
#define FREERDP_CHANNEL_SMARTCARD_CLIENT_PACK_H
#include <winpr/crt.h>
#include <winpr/smartcard.h>
/* interface type_scard_pack */
/* [unique][version][uuid] */
typedef struct _REDIR_SCARDCONTEXT
{
/* [range] */ unsigned long cbContext;
/* [size_is][unique] */ BYTE *pbContext;
} REDIR_SCARDCONTEXT;
typedef struct _REDIR_SCARDHANDLE
{
REDIR_SCARDCONTEXT Context;
/* [range] */ unsigned long cbHandle;
/* [size_is] */ BYTE *pbHandle;
} REDIR_SCARDHANDLE;
typedef struct _long_Return
{
long ReturnCode;
} long_Return;
typedef struct _longAndMultiString_Return
{
long ReturnCode;
/* [range] */ unsigned long cBytes;
/* [size_is][unique] */ BYTE *msz;
} ListReaderGroups_Return;
typedef struct _longAndMultiString_Return ListReaders_Return;
typedef struct _Context_Call
{
REDIR_SCARDCONTEXT Context;
} Context_Call;
typedef struct _ContextAndStringA_Call
{
REDIR_SCARDCONTEXT Context;
/* [string] */ const unsigned char *sz;
} ContextAndStringA_Call;
typedef struct _ContextAndStringW_Call
{
REDIR_SCARDCONTEXT Context;
/* [string] */ const WCHAR *sz;
} ContextAndStringW_Call;
typedef struct _ContextAndTwoStringA_Call
{
REDIR_SCARDCONTEXT Context;
/* [string] */ const unsigned char *sz1;
/* [string] */ const unsigned char *sz2;
} ContextAndTwoStringA_Call;
typedef struct _ContextAndTwoStringW_Call
{
REDIR_SCARDCONTEXT Context;
/* [string] */ const WCHAR *sz1;
/* [string] */ const WCHAR *sz2;
} ContextAndTwoStringW_Call;
typedef struct _EstablishContext_Call
{
unsigned long dwScope;
} EstablishContext_Call;
typedef struct _EstablishContext_Return
{
long ReturnCode;
REDIR_SCARDCONTEXT Context;
} EstablishContext_Return;
typedef struct _ListReaderGroups_Call
{
REDIR_SCARDCONTEXT Context;
long fmszGroupsIsNULL;
unsigned long cchGroups;
} ListReaderGroups_Call;
typedef struct _ListReaders_Call
{
REDIR_SCARDCONTEXT Context;
/* [range] */ unsigned long cBytes;
/* [size_is][unique] */ const BYTE *mszGroups;
long fmszReadersIsNULL;
unsigned long cchReaders;
} ListReaders_Call;
typedef struct _ReaderState_Common_Call
{
unsigned long dwCurrentState;
unsigned long dwEventState;
/* [range] */ unsigned long cbAtr;
BYTE rgbAtr[ 36 ];
} ReaderState_Common_Call;
typedef struct _ReaderStateA
{
/* [string] */ const unsigned char *szReader;
ReaderState_Common_Call Common;
} ReaderStateA;
typedef struct _ReaderStateW
{
/* [string] */ const WCHAR *szReader;
ReaderState_Common_Call Common;
} ReaderStateW;
typedef struct _ReaderState_Return
{
unsigned long dwCurrentState;
unsigned long dwEventState;
/* [range] */ unsigned long cbAtr;
BYTE rgbAtr[ 36 ];
} ReaderState_Return;
typedef struct _GetStatusChangeA_Call
{
REDIR_SCARDCONTEXT Context;
/* [range] */ unsigned long cBytes;
/* [size_is] */ const BYTE *mszCards;
/* [range] */ unsigned long cReaders;
/* [size_is] */ ReaderStateA *rgReaderStates;
} GetStatusChangeA_Call;
typedef struct _LocateCardsA_Call
{
REDIR_SCARDCONTEXT Context;
/* [range] */ unsigned long cBytes;
/* [size_is] */ const BYTE *mszCards;
/* [range] */ unsigned long cReaders;
/* [size_is] */ ReaderStateA *rgReaderStates;
} LocateCardsA_Call;
typedef struct _LocateCardsW_Call
{
REDIR_SCARDCONTEXT Context;
/* [range] */ unsigned long cBytes;
/* [size_is] */ const BYTE *mszCards;
/* [range] */ unsigned long cReaders;
/* [size_is] */ ReaderStateW *rgReaderStates;
} LocateCardsW_Call;
typedef struct _LocateCards_ATRMask
{
/* [range] */ unsigned long cbAtr;
BYTE rgbAtr[ 36 ];
BYTE rgbMask[ 36 ];
} LocateCards_ATRMask;
typedef struct _LocateCardsByATRA_Call
{
REDIR_SCARDCONTEXT Context;
/* [range] */ unsigned long cAtrs;
/* [size_is] */ LocateCards_ATRMask *rgAtrMasks;
/* [range] */ unsigned long cReaders;
/* [size_is] */ ReaderStateA *rgReaderStates;
} LocateCardsByATRA_Call;
typedef struct _LocateCardsByATRW_Call
{
REDIR_SCARDCONTEXT Context;
/* [range] */ unsigned long cAtrs;
/* [size_is] */ LocateCards_ATRMask *rgAtrMasks;
/* [range] */ unsigned long cReaders;
/* [size_is] */ ReaderStateW *rgReaderStates;
} LocateCardsByATRW_Call;
typedef struct _GetStatusChange_Return
{
long ReturnCode;
/* [range] */ unsigned long cReaders;
/* [size_is] */ ReaderState_Return *rgReaderStates;
} LocateCards_Return;
typedef struct _GetStatusChange_Return GetStatusChange_Return;
typedef struct _GetStatusChangeW_Call
{
REDIR_SCARDCONTEXT Context;
unsigned long dwTimeOut;
/* [range] */ unsigned long cReaders;
/* [size_is] */ ReaderStateW *rgReaderStates;
} GetStatusChangeW_Call;
typedef struct _Connect_Common
{
REDIR_SCARDCONTEXT Context;
unsigned long dwShareMode;
unsigned long dwPreferredProtocols;
} Connect_Common;
typedef struct _ConnectA_Call
{
/* [string] */ const unsigned char *szReader;
Connect_Common Common;
} ConnectA_Call;
typedef struct _ConnectW_Call
{
/* [string] */ const WCHAR *szReader;
Connect_Common Common;
} ConnectW_Call;
typedef struct _Connect_Return
{
long ReturnCode;
REDIR_SCARDHANDLE hCard;
unsigned long dwActiveProtocol;
} Connect_Return;
typedef struct _Reconnect_Call
{
REDIR_SCARDHANDLE hCard;
unsigned long dwShareMode;
unsigned long dwPreferredProtocols;
unsigned long dwInitialization;
} Reconnect_Call;
typedef struct Reconnect_Return
{
long ReturnCode;
unsigned long dwActiveProtocol;
} Reconnect_Return;
typedef struct _HCardAndDisposition_Call
{
REDIR_SCARDHANDLE hCard;
unsigned long dwDisposition;
} HCardAndDisposition_Call;
typedef struct _State_Call
{
REDIR_SCARDHANDLE hCard;
long fpbAtrIsNULL;
unsigned long cbAtrLen;
} State_Call;
typedef struct _State_Return
{
long ReturnCode;
unsigned long dwState;
unsigned long dwProtocol;
/* [range] */ unsigned long cbAtrLen;
/* [size_is][unique] */ BYTE *rgAtr;
} State_Return;
typedef struct _Status_Call
{
REDIR_SCARDHANDLE hCard;
long fmszReaderNamesIsNULL;
unsigned long cchReaderLen;
unsigned long cbAtrLen;
} Status_Call;
typedef struct _Status_Return
{
long ReturnCode;
/* [range] */ unsigned long cBytes;
/* [size_is][unique] */ BYTE *mszReaderNames;
unsigned long dwState;
unsigned long dwProtocol;
BYTE pbAtr[ 32 ];
/* [range] */ unsigned long cbAtrLen;
} Status_Return;
typedef struct _SCardIO_Request
{
unsigned long dwProtocol;
/* [range] */ unsigned long cbExtraBytes;
/* [size_is][unique] */ BYTE *pbExtraBytes;
} SCardIO_Request;
typedef struct _Transmit_Call
{
REDIR_SCARDHANDLE hCard;
SCardIO_Request ioSendPci;
/* [range] */ unsigned long cbSendLength;
/* [size_is] */ const BYTE *pbSendBuffer;
/* [unique] */ SCardIO_Request *pioRecvPci;
long fpbRecvBufferIsNULL;
unsigned long cbRecvLength;
} Transmit_Call;
typedef struct _Transmit_Return
{
long ReturnCode;
/* [unique] */ SCardIO_Request *pioRecvPci;
/* [range] */ unsigned long cbRecvLength;
/* [size_is][unique] */ BYTE *pbRecvBuffer;
} Transmit_Return;
typedef struct _GetTransmitCount_Call
{
REDIR_SCARDHANDLE hCard;
} GetTransmitCount_Call;
typedef struct _GetTransmitCount_Return
{
long ReturnCode;
unsigned long cTransmitCount;
} GetTransmitCount_Return;
typedef struct _Control_Call
{
REDIR_SCARDHANDLE hCard;
unsigned long dwControlCode;
/* [range] */ unsigned long cbInBufferSize;
/* [size_is][unique] */ const BYTE *pvInBuffer;
long fpvOutBufferIsNULL;
unsigned long cbOutBufferSize;
} Control_Call;
typedef struct _Control_Return
{
long ReturnCode;
/* [range] */ unsigned long cbOutBufferSize;
/* [size_is][unique] */ BYTE *pvOutBuffer;
} Control_Return;
typedef struct _GetAttrib_Call
{
REDIR_SCARDHANDLE hCard;
unsigned long dwAttrId;
long fpbAttrIsNULL;
unsigned long cbAttrLen;
} GetAttrib_Call;
typedef struct _GetAttrib_Return
{
long ReturnCode;
/* [range] */ unsigned long cbAttrLen;
/* [size_is][unique] */ BYTE *pbAttr;
} GetAttrib_Return;
typedef struct _SetAttrib_Call
{
REDIR_SCARDHANDLE hCard;
unsigned long dwAttrId;
/* [range] */ unsigned long cbAttrLen;
/* [size_is] */ const BYTE *pbAttr;
} SetAttrib_Call;
typedef struct _ReadCache_Common
{
REDIR_SCARDCONTEXT Context;
UUID *CardIdentifier;
unsigned long FreshnessCounter;
long fPbDataIsNULL;
unsigned long cbDataLen;
} ReadCache_Common;
typedef struct _ReadCacheA_Call
{
/* [string] */ unsigned char *szLookupName;
ReadCache_Common Common;
} ReadCacheA_Call;
typedef struct _ReadCacheW_Call
{
/* [string] */ WCHAR *szLookupName;
ReadCache_Common Common;
} ReadCacheW_Call;
typedef struct _ReadCache_Return
{
long ReturnCode;
/* [range] */ unsigned long cbDataLen;
/* [size_is][unique] */ BYTE *pbData;
} ReadCache_Return;
typedef struct _WriteCache_Common
{
REDIR_SCARDCONTEXT Context;
UUID *CardIdentifier;
unsigned long FreshnessCounter;
/* [range] */ unsigned long cbDataLen;
/* [size_is][unique] */ BYTE *pbData;
} WriteCache_Common;
typedef struct _WriteCacheA_Call
{
/* [string] */ unsigned char *szLookupName;
WriteCache_Common Common;
} WriteCacheA_Call;
typedef struct _WriteCacheW_Call
{
/* [string] */ WCHAR *szLookupName;
WriteCache_Common Common;
} WriteCacheW_Call;
#endif /* FREERDP_CHANNEL_SMARTCARD_CLIENT_PACK_H */