diff --git a/channels/smartcard/client/smartcard_main.c b/channels/smartcard/client/smartcard_main.c index 84ee58174..abc823822 100644 --- a/channels/smartcard/client/smartcard_main.c +++ b/channels/smartcard/client/smartcard_main.c @@ -255,7 +255,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) smartcard->log = WLog_Get("com.freerdp.channel.smartcard.client"); - WLog_SetLogLevel(smartcard->log, WLOG_DEBUG); + //WLog_SetLogLevel(smartcard->log, WLOG_DEBUG); smartcard->IrpQueue = MessageQueue_New(NULL); smartcard->OutstandingIrps = ListDictionary_New(TRUE); diff --git a/channels/smartcard/client/smartcard_operations.c b/channels/smartcard/client/smartcard_operations.c index 191d84aa6..64f41a26a 100644 --- a/channels/smartcard/client/smartcard_operations.c +++ b/channels/smartcard/client/smartcard_operations.c @@ -1010,7 +1010,7 @@ void smartcard_irp_device_control(SMARTCARD_DEVICE* smartcard, IRP* irp) WLog_Print(smartcard->log, WLOG_DEBUG, "%s (0x%08X) FileId: %d CompletionId: %d", smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId); -#if 1 +#if 0 printf("%s (0x%08X) FileId: %d CompletionId: %d\n", smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, irp->FileId, irp->CompletionId); #endif diff --git a/client/common/cmdline.c b/client/common/cmdline.c index 4ce1e1cde..50c033b4d 100644 --- a/client/common/cmdline.c +++ b/client/common/cmdline.c @@ -297,6 +297,9 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p if (count < 3) return -1; + settings->RedirectDrives = TRUE; + settings->DeviceRedirection = TRUE; + drive = (RDPDR_DRIVE*) calloc(1, sizeof(RDPDR_DRIVE)); if (!drive) @@ -311,7 +314,6 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p drive->Path = _strdup(params[2]); freerdp_device_collection_add(settings, (RDPDR_DEVICE*) drive); - settings->DeviceRedirection = TRUE; return 1; } @@ -322,21 +324,26 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p if (count < 1) return -1; - printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER)); - - if (!printer) - return -1; - - printer->Type = RDPDR_DTYP_PRINT; + settings->RedirectPrinters = TRUE; + settings->DeviceRedirection = TRUE; if (count > 1) - printer->Name = _strdup(params[1]); + { + printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER)); - if (count > 2) - printer->DriverName = _strdup(params[2]); + if (!printer) + return -1; - freerdp_device_collection_add(settings, (RDPDR_DEVICE*) printer); - settings->DeviceRedirection = TRUE; + printer->Type = RDPDR_DTYP_PRINT; + + if (count > 1) + printer->Name = _strdup(params[1]); + + if (count > 2) + printer->DriverName = _strdup(params[2]); + + freerdp_device_collection_add(settings, (RDPDR_DEVICE*) printer); + } return 1; } @@ -347,21 +354,26 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p if (count < 1) return -1; - smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD)); - - if (!smartcard) - return -1; - - smartcard->Type = RDPDR_DTYP_SMARTCARD; + settings->RedirectSmartCards = TRUE; + settings->DeviceRedirection = TRUE; if (count > 1) - smartcard->Name = _strdup(params[1]); + { + smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD)); - if (count > 2) - smartcard->Path = _strdup(params[2]); + if (!smartcard) + return -1; - freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard); - settings->DeviceRedirection = TRUE; + smartcard->Type = RDPDR_DTYP_SMARTCARD; + + if (count > 1) + smartcard->Name = _strdup(params[1]); + + if (count > 2) + smartcard->Path = _strdup(params[2]); + + freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard); + } return 1; } @@ -372,6 +384,9 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p if (count < 1) return -1; + settings->RedirectSerialPorts = TRUE; + settings->DeviceRedirection = TRUE; + serial = (RDPDR_SERIAL*) calloc(1, sizeof(RDPDR_SERIAL)); if (!serial) @@ -386,7 +401,6 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p serial->Path = _strdup(params[2]); freerdp_device_collection_add(settings, (RDPDR_DEVICE*) serial); - settings->DeviceRedirection = TRUE; return 1; } @@ -397,6 +411,9 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p if (count < 1) return -1; + settings->RedirectParallelPorts = TRUE; + settings->DeviceRedirection = TRUE; + parallel = (RDPDR_PARALLEL*) calloc(1, sizeof(RDPDR_PARALLEL)); if (!parallel) @@ -411,7 +428,6 @@ int freerdp_client_add_device_channel(rdpSettings* settings, int count, char** p parallel->Path = _strdup(params[2]); freerdp_device_collection_add(settings, (RDPDR_DEVICE*) parallel); - settings->DeviceRedirection = TRUE; return 1; } @@ -1861,13 +1877,17 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) settings->SupportHeartbeatPdu || settings->SupportMultitransport) { - settings->DeviceRedirection = TRUE; /* these RDP 8 features require rdpdr to be registered */ + settings->DeviceRedirection = TRUE; /* these RDP8 features require rdpdr to be registered */ + } + + if (settings->RedirectDrives || settings->RedirectHomeDrive || settings->RedirectSerialPorts + || settings->RedirectSmartCards || settings->RedirectPrinters) + { + settings->DeviceRedirection = TRUE; /* All of these features require rdpdr */ } if (settings->RedirectDrives) { - settings->DeviceRedirection = TRUE; - if (!freerdp_device_collection_find(settings, "drive")) { char* params[3]; @@ -1882,8 +1902,6 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) if (settings->RedirectHomeDrive) { - settings->DeviceRedirection = TRUE; - if (!freerdp_device_collection_find(settings, "drive")) { char* params[3]; @@ -1911,6 +1929,32 @@ int freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings) } } + if (settings->RedirectSmartCards) + { + RDPDR_SMARTCARD* smartcard; + + smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD)); + + if (!smartcard) + return -1; + + smartcard->Type = RDPDR_DTYP_SMARTCARD; + freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard); + } + + if (settings->RedirectPrinters) + { + RDPDR_PRINTER* printer; + + printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER)); + + if (!printer) + return -1; + + printer->Type = RDPDR_DTYP_PRINT; + freerdp_device_collection_add(settings, (RDPDR_DEVICE*) printer); + } + if (settings->RedirectClipboard) { if (!freerdp_static_channel_collection_find(settings, "cliprdr")) diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c index 419d74f10..dfc38f818 100644 --- a/winpr/libwinpr/smartcard/smartcard_pcsc.c +++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c @@ -486,7 +486,7 @@ char* PCSC_ConvertReaderNameToWinSCard(const char* name) sprintf_s(nameWinSCard, size, "%.*s %d", length, p, index); - printf("Smart Card Reader Name Alias: %s -> %s\n", p, nameWinSCard); + //printf("Smart Card Reader Name Alias: %s -> %s\n", p, nameWinSCard); return nameWinSCard; }