mirror of https://github.com/FreeRDP/FreeRDP
channels/smartcard: refactoring
This commit is contained in:
parent
89ad7638e4
commit
308e32ccb9
|
@ -1,13 +1,8 @@
|
|||
|
||||
set(OPTION_DEFAULT OFF)
|
||||
set(OPTION_CLIENT_DEFAULT OFF)
|
||||
set(OPTION_CLIENT_DEFAULT ON)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
|
||||
if(WITH_PCSC)
|
||||
set(OPTION_CLIENT_DEFAULT ON)
|
||||
set(OPTION_SERVER_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
define_channel_options(NAME "smartcard" TYPE "device"
|
||||
DESCRIPTION "Smart Card Virtual Channel Extension"
|
||||
SPECIFICATIONS "[MS-RDPESC]"
|
||||
|
|
|
@ -22,8 +22,6 @@ set(${MODULE_PREFIX}_SRCS
|
|||
smartcard_main.h
|
||||
smartcard_operations.c)
|
||||
|
||||
include_directories(${PCSC_INCLUDE_DIR})
|
||||
|
||||
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DeviceServiceEntry")
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
|
||||
|
@ -36,13 +34,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
|||
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
|
||||
MONOLITHIC ${MONOLITHIC_BUILD}
|
||||
MODULE winpr
|
||||
MODULES winpr-crt winpr-synch winpr-thread winpr-interlocked)
|
||||
|
||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${PCSC_LIBRARIES})
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND ${MODULE_PREFIX}_LIBS winscard)
|
||||
endif()
|
||||
MODULES winpr-crt winpr-synch winpr-thread winpr-interlocked winpr-utils)
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
#include <winpr/crt.h>
|
||||
#include <winpr/smartcard.h>
|
||||
|
||||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/utils/debug.h>
|
||||
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
#include "smartcard_main.h"
|
||||
|
@ -61,7 +58,6 @@ static void smartcard_process_irp(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
|
||||
default:
|
||||
fprintf(stderr, "MajorFunction 0x%X unexpected for smartcards.", irp->MajorFunction);
|
||||
DEBUG_WARN("Smartcard MajorFunction 0x%X not supported.", irp->MajorFunction);
|
||||
irp->IoStatus = STATUS_NOT_SUPPORTED;
|
||||
irp->Complete(irp);
|
||||
break;
|
||||
|
@ -114,10 +110,10 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
|||
SMARTCARD_DEVICE* smartcard;
|
||||
|
||||
device = (RDPDR_SMARTCARD*) pEntryPoints->device;
|
||||
|
||||
name = device->Name;
|
||||
path = device->Path;
|
||||
|
||||
/* TODO: check if server supports sc redirect (version 5.1) */
|
||||
smartcard = (SMARTCARD_DEVICE*) calloc(1, sizeof(SMARTCARD_DEVICE));
|
||||
|
||||
if (!smartcard)
|
||||
|
@ -149,6 +145,8 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
|||
smartcard->name = name;
|
||||
}
|
||||
|
||||
smartcard->log = WLog_Get("com.freerdp.channel.smartcard.client");
|
||||
|
||||
smartcard->IrpQueue = MessageQueue_New(NULL);
|
||||
smartcard->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) smartcard_thread_func,
|
||||
smartcard, CREATE_SUSPENDED, NULL);
|
||||
|
|
|
@ -21,26 +21,49 @@
|
|||
#ifndef FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H
|
||||
#define FREERDP_CHANNEL_SMARTCARD_CLIENT_MAIN_H
|
||||
|
||||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/utils/debug.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/wlog.h>
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/smartcard.h>
|
||||
#include <winpr/collections.h>
|
||||
|
||||
struct _COMPLETIONIDINFO
|
||||
{
|
||||
UINT32 ID;
|
||||
BOOL duplicate;
|
||||
};
|
||||
typedef struct _COMPLETIONIDINFO COMPLETIONIDINFO;
|
||||
/* [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 */
|
||||
|
||||
struct _SMARTCARD_DEVICE
|
||||
{
|
||||
DEVICE device;
|
||||
|
||||
wLog* log;
|
||||
|
||||
char* name;
|
||||
char* path;
|
||||
|
||||
|
@ -52,12 +75,6 @@ struct _SMARTCARD_DEVICE
|
|||
};
|
||||
typedef struct _SMARTCARD_DEVICE SMARTCARD_DEVICE;
|
||||
|
||||
#ifdef WITH_DEBUG_SCARD
|
||||
#define DEBUG_SCARD(fmt, ...) DEBUG_CLASS(SCARD, fmt, ## __VA_ARGS__)
|
||||
#else
|
||||
#define DEBUG_SCARD(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
BOOL smartcard_async_op(IRP* irp);
|
||||
void smartcard_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -183,5 +183,12 @@ WINPR_API VOID _IoDeleteDeviceEx(PDEVICE_OBJECT_EX DeviceObject);
|
|||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Extended API
|
||||
*/
|
||||
|
||||
#define ACCESS_FROM_CTL_CODE(ctrlCode) ((DWORD)((ctrlCode >> 14) & 0x3))
|
||||
#define FUNCTION_FROM_CTL_CODE(ctrlCode) ((DWORD)((ctrlCode >> 2) & 0xFFF))
|
||||
|
||||
#endif /* WINPR_IO_H */
|
||||
|
||||
|
|
Loading…
Reference in New Issue