Fixed duplicate loading of smartcard and printers.
This commit is contained in:
parent
4f22682ed2
commit
dccf40c2bc
@ -4,6 +4,7 @@
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2014 Norbert Federa <norbert.federa@thincast.com>
|
||||
* Copyright 2016 Armin Novak <armin.novak@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -1311,7 +1312,7 @@ int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv,
|
||||
}
|
||||
|
||||
static BOOL freerdp_client_detect_command_line(int argc, char** argv,
|
||||
DWORD* flags, BOOL ignoreUnknown)
|
||||
DWORD* flags, BOOL ignoreUnknown)
|
||||
{
|
||||
int old_cli_status;
|
||||
int old_cli_count;
|
||||
@ -2508,28 +2509,34 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
|
||||
{
|
||||
RDPDR_SMARTCARD* smartcard;
|
||||
|
||||
smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD));
|
||||
if (!freerdp_device_collection_find_type(settings, RDPDR_DTYP_SMARTCARD))
|
||||
{
|
||||
smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD));
|
||||
|
||||
if (!smartcard)
|
||||
return FALSE;
|
||||
if (!smartcard)
|
||||
return FALSE;
|
||||
|
||||
smartcard->Type = RDPDR_DTYP_SMARTCARD;
|
||||
if (!freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard))
|
||||
return FALSE;
|
||||
smartcard->Type = RDPDR_DTYP_SMARTCARD;
|
||||
if (!freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->RedirectPrinters)
|
||||
{
|
||||
RDPDR_PRINTER* printer;
|
||||
|
||||
printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER));
|
||||
if (!freerdp_device_collection_find_type(settings, RDPDR_DTYP_PRINT))
|
||||
{
|
||||
printer = (RDPDR_PRINTER*) calloc(1, sizeof(RDPDR_PRINTER));
|
||||
|
||||
if (!printer)
|
||||
return FALSE;
|
||||
if (!printer)
|
||||
return FALSE;
|
||||
|
||||
printer->Type = RDPDR_DTYP_PRINT;
|
||||
if (!freerdp_device_collection_add(settings, (RDPDR_DEVICE*) printer))
|
||||
return FALSE;
|
||||
printer->Type = RDPDR_DTYP_PRINT;
|
||||
if (!freerdp_device_collection_add(settings, (RDPDR_DEVICE*) printer))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->RedirectClipboard)
|
||||
|
@ -4,6 +4,7 @@
|
||||
*
|
||||
* Copyright 2009-2011 Jay Sorg
|
||||
* Copyright 2010-2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2016 Armin Novak <armin.novak@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -1435,6 +1436,7 @@ FREERDP_API int freerdp_addin_replace_argument_value(ADDIN_ARGV* args, char* pre
|
||||
|
||||
FREERDP_API BOOL freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device);
|
||||
FREERDP_API RDPDR_DEVICE* freerdp_device_collection_find(rdpSettings* settings, const char* name);
|
||||
FREERDP_API RDPDR_DEVICE* freerdp_device_collection_find_type(rdpSettings* settings, UINT32 type);
|
||||
FREERDP_API RDPDR_DEVICE* freerdp_device_clone(RDPDR_DEVICE* device);
|
||||
FREERDP_API void freerdp_device_collection_free(rdpSettings* settings);
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Settings Management
|
||||
*
|
||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
* Copyright 2016 Armin Novak <armin.novak@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -208,6 +209,22 @@ RDPDR_DEVICE* freerdp_device_collection_find(rdpSettings* settings, const char*
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RDPDR_DEVICE* freerdp_device_collection_find_type(rdpSettings* settings, UINT32 type)
|
||||
{
|
||||
UINT32 index;
|
||||
RDPDR_DEVICE* device;
|
||||
|
||||
for (index = 0; index < settings->DeviceCount; index++)
|
||||
{
|
||||
device = (RDPDR_DEVICE*) settings->DeviceArray[index];
|
||||
|
||||
if (device->Type == type)
|
||||
return device;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RDPDR_DEVICE* freerdp_device_clone(RDPDR_DEVICE* device)
|
||||
{
|
||||
if (device->Type == RDPDR_DTYP_FILESYSTEM)
|
||||
|
Loading…
Reference in New Issue
Block a user