mirror of https://github.com/FreeRDP/FreeRDP
commit
039e24bf48
|
@ -514,19 +514,19 @@ typedef struct
|
|||
*/
|
||||
static UINT handle_hotplug(rdpdrPlugin* rdpdr)
|
||||
{
|
||||
struct dirent* pDirent;
|
||||
DIR* pDir;
|
||||
char fullpath[PATH_MAX];
|
||||
struct dirent* pDirent = NULL;
|
||||
char fullpath[PATH_MAX] = { 0 };
|
||||
char* szdir = (char*)"/Volumes";
|
||||
struct stat buf;
|
||||
hotplug_dev dev_array[MAX_USB_DEVICES];
|
||||
int count;
|
||||
DEVICE_DRIVE_EXT* device_ext;
|
||||
struct stat buf = { 0 };
|
||||
hotplug_dev dev_array[MAX_USB_DEVICES] = { 0 };
|
||||
int count = 0;
|
||||
DEVICE_DRIVE_EXT* device_ext = NULL;
|
||||
ULONG_PTR* keys = NULL;
|
||||
int size = 0;
|
||||
UINT error;
|
||||
UINT error = ERROR_INTERNAL_ERROR;
|
||||
UINT32 ids[1];
|
||||
pDir = opendir(szdir);
|
||||
|
||||
DIR* pDir = opendir(szdir);
|
||||
|
||||
if (pDir == NULL)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <winpr/assert.h>
|
||||
#include <winpr/wtypes.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/wlog.h>
|
||||
|
@ -199,8 +200,11 @@ static BOOL rdpear_send_payload(RDPEAR_PLUGIN* rdpear, IWTSVirtualChannelCallbac
|
|||
goto out;
|
||||
|
||||
const size_t unencodedLen = Stream_GetPosition(unencodedContent);
|
||||
if (unencodedLen > ULONG_MAX)
|
||||
|
||||
#if UINT32_MAX < SIZE_MAX
|
||||
if (unencodedLen > UINT32_MAX)
|
||||
goto out;
|
||||
#endif
|
||||
|
||||
SecBuffer inBuffer = { (ULONG)unencodedLen, SECBUFFER_DATA, Stream_Buffer(unencodedContent) };
|
||||
|
||||
|
@ -223,8 +227,10 @@ static BOOL rdpear_send_payload(RDPEAR_PLUGIN* rdpear, IWTSVirtualChannelCallbac
|
|||
Stream_Write(finalStream, cryptedBuffer.pvBuffer, cryptedBuffer.cbBuffer);
|
||||
|
||||
const size_t pos = Stream_GetPosition(finalStream);
|
||||
if (pos > ULONG_MAX)
|
||||
#if UINT32_MAX < SIZE_MAX
|
||||
if (pos > UINT32_MAX)
|
||||
goto out;
|
||||
#endif
|
||||
|
||||
UINT status =
|
||||
callback->channel->Write(callback->channel, (ULONG)pos, Stream_Buffer(finalStream), NULL);
|
||||
|
|
|
@ -54,8 +54,10 @@ void mac_set_view_size(rdpContext *context, MRDPView *view);
|
|||
|
||||
if (freerdp_settings_get_bool(settings, FreeRDP_Fullscreen))
|
||||
{
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, screenFrame.size.width);
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, screenFrame.size.height);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth,
|
||||
screenFrame.size.width);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight,
|
||||
screenFrame.size.height);
|
||||
}
|
||||
|
||||
PubSub_SubscribeConnectionResult(context->pubSub, AppDelegate_ConnectionResultEventHandler);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return NSApplicationMain(argc, argv);
|
||||
}
|
||||
|
|
|
@ -264,16 +264,19 @@ static BOOL wf_pre_connect(freerdp* instance)
|
|||
|
||||
if (desktopWidth != freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth))
|
||||
{
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, desktopWidth);
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, desktopWidth))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (desktopHeight != freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight))
|
||||
{
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, desktopHeight);
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, desktopHeight))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rc = freerdp_keyboard_init(freerdp_settings_get_uint32(settings, FreeRDP_KeyboardLayout));
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_KeyboardLayout, rc);
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_KeyboardLayout, rc))
|
||||
return FALSE;
|
||||
PubSub_SubscribeChannelConnected(instance->context->pubSub, wf_OnChannelConnectedEventHandler);
|
||||
PubSub_SubscribeChannelDisconnected(instance->context->pubSub,
|
||||
wf_OnChannelDisconnectedEventHandler);
|
||||
|
@ -1338,7 +1341,8 @@ static BOOL wfreerdp_client_new(freerdp* instance, rdpContext* context)
|
|||
instance->AuthenticateEx = wf_authenticate_ex;
|
||||
|
||||
#ifdef WITH_WINDOWS_CERT_STORE
|
||||
freerdp_settings_set_bool(context->settings, FreeRDP_CertificateCallbackPreferPEM, TRUE);
|
||||
if (!freerdp_settings_set_bool(context->settings, FreeRDP_CertificateCallbackPreferPEM, TRUE))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
if (!wfc->isConsole)
|
||||
|
|
|
@ -360,8 +360,9 @@ static void wf_send_resize(wfContext* wfc)
|
|||
{
|
||||
WLog_ERR("", "SendMonitorLayout failed.");
|
||||
}
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_SmartSizingWidth, targetWidth);
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_SmartSizingHeight, targetHeight);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_SmartSizingWidth, targetWidth);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_SmartSizingHeight,
|
||||
targetHeight);
|
||||
}
|
||||
wfc->lastSentDate = GetTickCount64();
|
||||
}
|
||||
|
@ -725,7 +726,7 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
|
|||
{
|
||||
HMENU hMenu = GetSystemMenu(wfc->hwnd, FALSE);
|
||||
const BOOL rc = freerdp_settings_get_bool(settings, FreeRDP_SmartSizing);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_SmartSizing, !rc);
|
||||
(void)freerdp_settings_set_bool(settings, FreeRDP_SmartSizing, !rc);
|
||||
CheckMenuItem(hMenu, SYSCOMMAND_ID_SMARTSIZING,
|
||||
freerdp_settings_get_bool(settings, FreeRDP_SmartSizing)
|
||||
? MF_CHECKED
|
||||
|
@ -778,7 +779,8 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
|
|||
case WM_SETFOCUS:
|
||||
DEBUG_KBD("getting focus %X", hWnd);
|
||||
|
||||
freerdp_settings_set_bool(wfc->common.context.settings, FreeRDP_SuspendInput, FALSE);
|
||||
(void)freerdp_settings_set_bool(wfc->common.context.settings, FreeRDP_SuspendInput,
|
||||
FALSE);
|
||||
|
||||
if (alt_ctrl_down())
|
||||
g_flipping_in = TRUE;
|
||||
|
@ -788,7 +790,8 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
|
|||
break;
|
||||
|
||||
case WM_KILLFOCUS:
|
||||
freerdp_settings_set_bool(wfc->common.context.settings, FreeRDP_SuspendInput, TRUE);
|
||||
(void)freerdp_settings_set_bool(wfc->common.context.settings, FreeRDP_SuspendInput,
|
||||
TRUE);
|
||||
|
||||
if (g_focus_hWnd == hWnd && wfc && !wfc->fullscreen)
|
||||
{
|
||||
|
|
|
@ -254,21 +254,28 @@ static BOOL freerdp_client_settings_post_process(rdpSettings* settings)
|
|||
* that the rdp file also triggers this functionality */
|
||||
if (freerdp_settings_get_bool(settings, FreeRDP_SpanMonitors))
|
||||
{
|
||||
freerdp_settings_set_bool(settings, FreeRDP_UseMultimon, TRUE);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_Fullscreen, TRUE);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_UseMultimon, TRUE))
|
||||
goto out_error;
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_Fullscreen, TRUE))
|
||||
goto out_error;
|
||||
}
|
||||
else if (freerdp_settings_get_bool(settings, FreeRDP_UseMultimon))
|
||||
{
|
||||
freerdp_settings_set_bool(settings, FreeRDP_Fullscreen, TRUE);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_Fullscreen, TRUE))
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
/* deal with the smartcard / smartcard logon stuff */
|
||||
if (freerdp_settings_get_bool(settings, FreeRDP_SmartcardLogon))
|
||||
{
|
||||
freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, TRUE);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_RedirectSmartCards, TRUE);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_DeviceRedirection, TRUE);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_PasswordIsSmartcardPin, TRUE);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, TRUE))
|
||||
goto out_error;
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSmartCards, TRUE))
|
||||
goto out_error;
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_DeviceRedirection, TRUE))
|
||||
goto out_error;
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_PasswordIsSmartcardPin, TRUE))
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -4195,9 +4195,12 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
|
|||
else
|
||||
compatibility = freerdp_client_detect_command_line(argc - 1, &argv[1], &flags);
|
||||
|
||||
freerdp_settings_set_string(settings, FreeRDP_ProxyHostname, NULL);
|
||||
freerdp_settings_set_string(settings, FreeRDP_ProxyUsername, NULL);
|
||||
freerdp_settings_set_string(settings, FreeRDP_ProxyPassword, NULL);
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_ProxyHostname, NULL))
|
||||
return -1;
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_ProxyUsername, NULL))
|
||||
return -1;
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_ProxyPassword, NULL))
|
||||
return -1;
|
||||
|
||||
if (compatibility)
|
||||
{
|
||||
|
@ -4644,7 +4647,8 @@ static int freerdp_client_settings_parse_command_line_arguments_int(
|
|||
}
|
||||
CommandLineSwitchCase(arg, "disable-output")
|
||||
{
|
||||
freerdp_settings_set_bool(settings, FreeRDP_DeactivateClientDecoding, enable);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_DeactivateClientDecoding, enable))
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "home-drive")
|
||||
{
|
||||
|
|
|
@ -309,8 +309,8 @@ out_free:
|
|||
{
|
||||
[_params setInt:size.width forKey:@"width"];
|
||||
[_params setInt:size.height forKey:@"height"];
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, size.width);
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, size.height);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, size.width);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, size.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ out_free:
|
|||
if (freerdp_settings_get_uint32(settings, FreeRDP_ColorDepth) <= 16)
|
||||
{
|
||||
const UINT32 w = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth) & (~1);
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, w);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, w);
|
||||
}
|
||||
|
||||
[self performSelectorInBackground:@selector(runSession) withObject:nil];
|
||||
|
|
|
@ -793,10 +793,13 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* WINPR_RESTRICT clear,
|
|||
if ((y + count) > vBarPixelCount)
|
||||
count = (vBarPixelCount > y) ? (vBarPixelCount - y) : 0;
|
||||
|
||||
while (count--)
|
||||
if (count > 0)
|
||||
{
|
||||
FreeRDPWriteColor(dstBuffer, clear->format, colorBkg);
|
||||
dstBuffer += FreeRDPGetBytesPerPixel(clear->format);
|
||||
while (count--)
|
||||
{
|
||||
FreeRDPWriteColor(dstBuffer, clear->format, colorBkg);
|
||||
dstBuffer += FreeRDPGetBytesPerPixel(clear->format);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -836,12 +839,15 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* WINPR_RESTRICT clear,
|
|||
y = vBarYOn + vBarShortPixelCount;
|
||||
count = (vBarPixelCount > y) ? (vBarPixelCount - y) : 0;
|
||||
|
||||
while (count--)
|
||||
if (count > 0)
|
||||
{
|
||||
if (!FreeRDPWriteColor(dstBuffer, clear->format, colorBkg))
|
||||
return FALSE;
|
||||
while (count--)
|
||||
{
|
||||
if (!FreeRDPWriteColor(dstBuffer, clear->format, colorBkg))
|
||||
return FALSE;
|
||||
|
||||
dstBuffer += FreeRDPGetBytesPerPixel(clear->format);
|
||||
dstBuffer += FreeRDPGetBytesPerPixel(clear->format);
|
||||
}
|
||||
}
|
||||
|
||||
vBarEntry->count = vBarPixelCount;
|
||||
|
|
|
@ -1141,7 +1141,9 @@ static INLINE INT16 progressive_rfx_srl_read(RFX_PROGRESSIVE_UPGRADE_STATE* WINP
|
|||
mag++;
|
||||
}
|
||||
|
||||
return sign ? -1 * mag : mag;
|
||||
if (mag > INT16_MAX)
|
||||
mag = INT16_MAX;
|
||||
return (INT16)(sign ? -1 * mag : mag);
|
||||
}
|
||||
|
||||
static INLINE int
|
||||
|
|
|
@ -833,9 +833,9 @@ void freerdp_dynamic_channel_collection_free(rdpSettings* settings)
|
|||
}
|
||||
|
||||
free(settings->DynamicChannelArray);
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DynamicChannelArraySize, 0);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_DynamicChannelArraySize, 0);
|
||||
settings->DynamicChannelArray = NULL;
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DynamicChannelCount, 0);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_DynamicChannelCount, 0);
|
||||
}
|
||||
|
||||
void freerdp_capability_buffer_free(rdpSettings* settings)
|
||||
|
@ -968,37 +968,41 @@ void freerdp_performance_flags_make(rdpSettings* settings)
|
|||
|
||||
if (freerdp_settings_get_bool(settings, FreeRDP_DisableThemes))
|
||||
PerformanceFlags |= PERF_DISABLE_THEMING;
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_PerformanceFlags, PerformanceFlags);
|
||||
(void)freerdp_settings_set_uint32(settings, FreeRDP_PerformanceFlags, PerformanceFlags);
|
||||
}
|
||||
|
||||
void freerdp_performance_flags_split(rdpSettings* settings)
|
||||
{
|
||||
freerdp_settings_set_bool(settings, FreeRDP_AllowFontSmoothing,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) &
|
||||
PERF_ENABLE_FONT_SMOOTHING)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_AllowDesktopComposition,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) &
|
||||
PERF_ENABLE_DESKTOP_COMPOSITION)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
freerdp_settings_set_bool(
|
||||
(void)freerdp_settings_set_bool(
|
||||
settings, FreeRDP_AllowFontSmoothing,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) &
|
||||
PERF_ENABLE_FONT_SMOOTHING)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
(void)freerdp_settings_set_bool(
|
||||
settings, FreeRDP_AllowDesktopComposition,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) &
|
||||
PERF_ENABLE_DESKTOP_COMPOSITION)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
(void)freerdp_settings_set_bool(
|
||||
settings, FreeRDP_DisableWallpaper,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) & PERF_DISABLE_WALLPAPER)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_DisableFullWindowDrag,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) &
|
||||
PERF_DISABLE_FULLWINDOWDRAG)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_DisableMenuAnims,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) &
|
||||
PERF_DISABLE_MENUANIMATIONS)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
freerdp_settings_set_bool(
|
||||
(void)freerdp_settings_set_bool(
|
||||
settings, FreeRDP_DisableFullWindowDrag,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) &
|
||||
PERF_DISABLE_FULLWINDOWDRAG)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
(void)freerdp_settings_set_bool(
|
||||
settings, FreeRDP_DisableMenuAnims,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) &
|
||||
PERF_DISABLE_MENUANIMATIONS)
|
||||
? TRUE
|
||||
: FALSE);
|
||||
(void)freerdp_settings_set_bool(
|
||||
settings, FreeRDP_DisableThemes,
|
||||
(freerdp_settings_get_uint32(settings, FreeRDP_PerformanceFlags) & PERF_DISABLE_THEMING)
|
||||
? TRUE
|
||||
|
|
|
@ -326,12 +326,12 @@ void freerdp_settings_free_keys(rdpSettings* dst, BOOL cleanup)
|
|||
switch (cur->type)
|
||||
{
|
||||
case FREERDP_SETTINGS_TYPE_STRING: /* strings */
|
||||
freerdp_settings_set_string_copy_(dst, (FreeRDP_Settings_Keys_String)cur->id, NULL,
|
||||
0, cleanup);
|
||||
(void)freerdp_settings_set_string_copy_(dst, (FreeRDP_Settings_Keys_String)cur->id,
|
||||
NULL, 0, cleanup);
|
||||
break;
|
||||
case FREERDP_SETTINGS_TYPE_POINTER: /* pointer */
|
||||
freerdp_settings_set_pointer_len(dst, (FreeRDP_Settings_Keys_Pointer)cur->id, NULL,
|
||||
0);
|
||||
(void)freerdp_settings_set_pointer_len(dst, (FreeRDP_Settings_Keys_Pointer)cur->id,
|
||||
NULL, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,8 +362,11 @@ static BOOL rdp_apply_bitmap_capability_set(rdpSettings* settings, const rdpSett
|
|||
WINPR_ASSERT(src);
|
||||
|
||||
if (!settings->ServerMode)
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth,
|
||||
freerdp_settings_get_uint32(src, FreeRDP_ColorDepth));
|
||||
{
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth,
|
||||
freerdp_settings_get_uint32(src, FreeRDP_ColorDepth)))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!src->DesktopResize)
|
||||
settings->DesktopResize = FALSE;
|
||||
|
|
|
@ -644,7 +644,7 @@ static BOOL rdp_read_info_string(rdpSettings* settings, FreeRDP_Settings_Keys_St
|
|||
if (terminator.w != L'\0')
|
||||
{
|
||||
WLog_ERR(TAG, "protocol error: Domain must be null terminated");
|
||||
freerdp_settings_set_string(settings, id, NULL);
|
||||
(void)freerdp_settings_set_string(settings, id, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1519,7 +1519,7 @@ BOOL WINAPI FreeRDP_WTSVirtualChannelRead(HANDLE hChannelHandle, ULONG TimeOut,
|
|||
|
||||
if (messageCtx->offset >= messageCtx->length)
|
||||
{
|
||||
MessageQueue_Peek(channel->queue, &message, TRUE);
|
||||
(void)MessageQueue_Peek(channel->queue, &message, TRUE);
|
||||
peer_channel_queue_free_message(&message);
|
||||
}
|
||||
|
||||
|
|
|
@ -800,8 +800,10 @@ rdpSettings* freerdp_settings_new(DWORD flags)
|
|||
goto out_fail;
|
||||
settings->OrderSupport = calloc(1, 32);
|
||||
|
||||
freerdp_settings_set_uint16(settings, FreeRDP_TLSMinVersion, TLS1_VERSION);
|
||||
freerdp_settings_set_uint16(settings, FreeRDP_TLSMaxVersion, 0);
|
||||
if (!freerdp_settings_set_uint16(settings, FreeRDP_TLSMinVersion, TLS1_VERSION))
|
||||
goto out_fail;
|
||||
if (!freerdp_settings_set_uint16(settings, FreeRDP_TLSMaxVersion, 0))
|
||||
goto out_fail;
|
||||
|
||||
if (!settings->OrderSupport)
|
||||
goto out_fail;
|
||||
|
|
|
@ -1353,8 +1353,8 @@ static BOOL is_accepted(rdpTls* tls, const rdpCertificate* cert)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
freerdp_settings_set_string(settings, keyAccepted, NULL);
|
||||
freerdp_settings_set_uint32(settings, keyLength, 0);
|
||||
(void)freerdp_settings_set_string(settings, keyAccepted, NULL);
|
||||
(void)freerdp_settings_set_uint32(settings, keyLength, 0);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -161,23 +161,19 @@ static char* rdtk_font_load_descriptor_file(const char* filename, size_t* pSize)
|
|||
if (!fp)
|
||||
return NULL;
|
||||
|
||||
_fseeki64(fp, 0, SEEK_END);
|
||||
if (_fseeki64(fp, 0, SEEK_END) != 0)
|
||||
goto fail;
|
||||
fileSize.i64 = _ftelli64(fp);
|
||||
_fseeki64(fp, 0, SEEK_SET);
|
||||
if (_fseeki64(fp, 0, SEEK_SET) != 0)
|
||||
goto fail;
|
||||
|
||||
if (fileSize.i64 < 1)
|
||||
{
|
||||
(void)fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
uint8_t* buffer = (uint8_t*)malloc(fileSize.s + 2);
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
(void)fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
size_t readSize = fread(buffer, fileSize.s, 1, fp);
|
||||
if (readSize == 0)
|
||||
|
@ -198,6 +194,10 @@ static char* rdtk_font_load_descriptor_file(const char* filename, size_t* pSize)
|
|||
buffer[fileSize.s + 1] = '\0';
|
||||
*pSize = fileSize.s;
|
||||
return (char*)buffer;
|
||||
|
||||
fail:
|
||||
(void)fclose(fp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int rdtk_font_convert_descriptor_code_to_utf8(const char* str, uint8_t* utf8)
|
||||
|
|
|
@ -113,11 +113,11 @@ static void mf_peer_rdpsnd_activated(RdpsndServerContext* context)
|
|||
mf_rdpsnd_derive_buffer_size(recorderState.queue, &recorderState.dataFormat, 0.05,
|
||||
&recorderState.bufferByteSize);
|
||||
|
||||
for (int i = 0; i < SND_NUMBUFFERS; ++i)
|
||||
for (size_t x = 0; x < SND_NUMBUFFERS; ++x)
|
||||
{
|
||||
AudioQueueAllocateBuffer(recorderState.queue, recorderState.bufferByteSize,
|
||||
&recorderState.buffers[i]);
|
||||
AudioQueueEnqueueBuffer(recorderState.queue, recorderState.buffers[i], 0, NULL);
|
||||
&recorderState.buffers[x]);
|
||||
AudioQueueEnqueueBuffer(recorderState.queue, recorderState.buffers[x], 0, NULL);
|
||||
}
|
||||
|
||||
recorderState.currentPacket = 0;
|
||||
|
@ -141,7 +141,7 @@ BOOL mf_peer_rdpsnd_init(mfPeerContext* context)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL mf_peer_rdpsnd_stop()
|
||||
BOOL mf_peer_rdpsnd_stop(void)
|
||||
{
|
||||
recorderState.isRunning = false;
|
||||
AudioQueueStop(recorderState.queue, true);
|
||||
|
|
|
@ -1764,7 +1764,7 @@ static void pf_channel_rdpdr_server_context_free(InterceptContextMapEntry* base)
|
|||
if (!entry)
|
||||
return;
|
||||
|
||||
WTSVirtualChannelClose(entry->handle);
|
||||
(void)WTSVirtualChannelClose(entry->handle);
|
||||
pf_channel_rdpdr_common_context_free(&entry->common);
|
||||
ArrayList_Free(entry->blockedDevices);
|
||||
free(entry);
|
||||
|
|
|
@ -702,31 +702,36 @@ static BOOL pf_client_should_retry_without_nla(pClientContext* pc)
|
|||
return config->ClientTlsSecurity || config->ClientRdpSecurity;
|
||||
}
|
||||
|
||||
static void pf_client_set_security_settings(pClientContext* pc)
|
||||
static BOOL pf_client_set_security_settings(pClientContext* pc)
|
||||
{
|
||||
rdpSettings* settings = NULL;
|
||||
const proxyConfig* config = NULL;
|
||||
|
||||
WINPR_ASSERT(pc);
|
||||
WINPR_ASSERT(pc->pdata);
|
||||
settings = pc->context.settings;
|
||||
rdpSettings* settings = pc->context.settings;
|
||||
WINPR_ASSERT(settings);
|
||||
config = pc->pdata->config;
|
||||
const proxyConfig* config = pc->pdata->config;
|
||||
WINPR_ASSERT(config);
|
||||
|
||||
freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, config->ClientRdpSecurity);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, config->ClientTlsSecurity);
|
||||
freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, config->ClientNlaSecurity);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, config->ClientRdpSecurity))
|
||||
return FALSE;
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, config->ClientTlsSecurity))
|
||||
return FALSE;
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, config->ClientNlaSecurity))
|
||||
return FALSE;
|
||||
|
||||
if (pf_client_use_proxy_smartcard_auth(settings))
|
||||
{
|
||||
/* Smartcard authentication requires smartcard redirection to be enabled */
|
||||
freerdp_settings_set_bool(settings, FreeRDP_RedirectSmartCards, TRUE);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RedirectSmartCards, TRUE))
|
||||
return FALSE;
|
||||
|
||||
/* Reset username/domain, we will get that info later from the sc cert */
|
||||
freerdp_settings_set_string(settings, FreeRDP_Username, NULL);
|
||||
freerdp_settings_set_string(settings, FreeRDP_Domain, NULL);
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_Username, NULL))
|
||||
return FALSE;
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_Domain, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL pf_client_connect_without_nla(pClientContext* pc)
|
||||
|
@ -774,7 +779,9 @@ static BOOL pf_client_connect(freerdp* instance)
|
|||
freerdp_settings_get_string(settings, FreeRDP_Username),
|
||||
freerdp_settings_get_string(settings, FreeRDP_Domain));
|
||||
|
||||
pf_client_set_security_settings(pc);
|
||||
if (!pf_client_set_security_settings(pc))
|
||||
return FALSE;
|
||||
|
||||
if (pf_client_should_retry_without_nla(pc))
|
||||
retry = pc->allow_next_conn_failure = TRUE;
|
||||
|
||||
|
|
|
@ -515,24 +515,23 @@ int win_shadow_wds_wnd_init(winShadowSubsystem* subsystem)
|
|||
|
||||
int win_shadow_wds_init(winShadowSubsystem* subsystem)
|
||||
{
|
||||
int status;
|
||||
HRESULT hr;
|
||||
DWORD dwCookie;
|
||||
long left, top;
|
||||
long right, bottom;
|
||||
long width, height;
|
||||
IUnknown* pUnknown;
|
||||
rdpSettings* settings;
|
||||
BSTR bstrAuthString;
|
||||
BSTR bstrGroupName;
|
||||
BSTR bstrPassword;
|
||||
BSTR bstrPropertyName;
|
||||
int status = -1;
|
||||
|
||||
long left = 0;
|
||||
long top = 0;
|
||||
long right = 0;
|
||||
long bottom = 0;
|
||||
BSTR bstrAuthString = NULL;
|
||||
BSTR bstrGroupName = NULL;
|
||||
BSTR bstrPassword = NULL;
|
||||
BSTR bstrPropertyName = NULL;
|
||||
VARIANT varPropertyValue;
|
||||
rdpAssistanceFile* file;
|
||||
IConnectionPoint* pCP;
|
||||
IConnectionPointContainer* pCPC;
|
||||
rdpAssistanceFile* file = NULL;
|
||||
IConnectionPoint* pCP = NULL;
|
||||
IConnectionPointContainer* pCPC = NULL;
|
||||
|
||||
win_shadow_wds_wnd_init(subsystem);
|
||||
hr = OleInitialize(NULL);
|
||||
HRESULT hr = OleInitialize(NULL);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -557,7 +556,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
|
|||
return -1;
|
||||
}
|
||||
|
||||
pUnknown = (IUnknown*)subsystem->pSharingSession;
|
||||
IUnknown* pUnknown = (IUnknown*)subsystem->pSharingSession;
|
||||
hr = pUnknown->lpVtbl->QueryInterface(pUnknown, &IID_IConnectionPointContainer, (void**)&pCPC);
|
||||
|
||||
if (FAILED(hr))
|
||||
|
@ -577,7 +576,7 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
|
|||
return -1;
|
||||
}
|
||||
|
||||
dwCookie = 0;
|
||||
DWORD dwCookie = 0;
|
||||
subsystem->pSessionEvents = &Shadow_IRDPSessionEvents;
|
||||
subsystem->pSessionEvents->lpVtbl->AddRef(subsystem->pSessionEvents);
|
||||
hr = pCP->lpVtbl->Advise(pCP, (IUnknown*)subsystem->pSessionEvents, &dwCookie);
|
||||
|
@ -605,8 +604,8 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
|
|||
return -1;
|
||||
}
|
||||
|
||||
width = right - left;
|
||||
height = bottom - top;
|
||||
long width = right - left;
|
||||
long height = bottom - top;
|
||||
WLog_INFO(
|
||||
TAG,
|
||||
"GetDesktopSharedRect(): left: %ld top: %ld right: %ld bottom: %ld width: %ld height: %ld",
|
||||
|
@ -765,13 +764,19 @@ int win_shadow_wds_init(winShadowSubsystem* subsystem)
|
|||
return status;
|
||||
}
|
||||
|
||||
settings = subsystem->shw->settings;
|
||||
status = freerdp_assistance_populate_settings_from_assistance_file(file, settings);
|
||||
freerdp_settings_set_string(settings, FreeRDP_Domain, "RDP");
|
||||
freerdp_settings_set_string(settings, FreeRDP_Username, "Shadow");
|
||||
freerdp_settings_set_bool(settings, FreeRDP_AutoLogonEnabled, TRUE);
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, width);
|
||||
freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, height);
|
||||
rdpSetting* settings = subsystem->shw->settings;
|
||||
if (!freerdp_assistance_populate_settings_from_assistance_file(file, settings))
|
||||
return -1;
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_Domain, "RDP"))
|
||||
return -1;
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_Username, "Shadow"))
|
||||
return -1;
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_AutoLogonEnabled, TRUE))
|
||||
return -1;
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopWidth, width))
|
||||
return -1;
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_DesktopHeight, height))
|
||||
return -1;
|
||||
status = win_shadow_rdp_start(subsystem);
|
||||
|
||||
if (status < 0)
|
||||
|
|
|
@ -746,14 +746,21 @@ static BOOL shadow_client_logon(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTIT
|
|||
goto fail;
|
||||
|
||||
if (user)
|
||||
freerdp_settings_set_string(settings, FreeRDP_Username, user);
|
||||
{
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_Username, user))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (domain)
|
||||
freerdp_settings_set_string(settings, FreeRDP_Domain, domain);
|
||||
|
||||
{
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_Domain, domain))
|
||||
goto fail;
|
||||
}
|
||||
if (password)
|
||||
freerdp_settings_set_string(settings, FreeRDP_Password, password);
|
||||
|
||||
{
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_Password, password))
|
||||
goto fail;
|
||||
}
|
||||
rc = TRUE;
|
||||
fail:
|
||||
free(user);
|
||||
|
@ -959,9 +966,12 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
|
|||
h264 =
|
||||
(shadow_encoder_prepare(client->encoder, FREERDP_CODEC_AVC420 | FREERDP_CODEC_AVC444) >= 0);
|
||||
#else
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444v2, FALSE);
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444, FALSE);
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264, FALSE);
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444v2, FALSE))
|
||||
return rc;
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444, FALSE))
|
||||
return rc;
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264, FALSE))
|
||||
return rc;
|
||||
#endif
|
||||
|
||||
/* Request full screen update for new gfx channel */
|
||||
|
@ -1019,25 +1029,38 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
|
|||
|
||||
flags = pdu.capsSet->flags;
|
||||
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444v2, FALSE);
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444, FALSE);
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444v2, FALSE))
|
||||
return rc;
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444, FALSE))
|
||||
return rc;
|
||||
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxThinClient,
|
||||
(flags & RDPGFX_CAPS_FLAG_THINCLIENT) ? TRUE : FALSE);
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxSmallCache,
|
||||
(flags & RDPGFX_CAPS_FLAG_SMALL_CACHE) ? TRUE : FALSE);
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxThinClient,
|
||||
(flags & RDPGFX_CAPS_FLAG_THINCLIENT) ? TRUE
|
||||
: FALSE))
|
||||
return rc;
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxSmallCache,
|
||||
(flags & RDPGFX_CAPS_FLAG_SMALL_CACHE) ? TRUE
|
||||
: FALSE))
|
||||
return rc;
|
||||
|
||||
#ifndef WITH_GFX_H264
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264, FALSE);
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264, FALSE))
|
||||
return rc;
|
||||
pdu.capsSet->flags &= ~RDPGFX_CAPS_FLAG_AVC420_ENABLED;
|
||||
#else
|
||||
|
||||
if (h264)
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264,
|
||||
(flags & RDPGFX_CAPS_FLAG_AVC420_ENABLED) ? TRUE
|
||||
: FALSE);
|
||||
{
|
||||
if (!freerdp_settings_set_bool(
|
||||
clientSettings, FreeRDP_GfxH264,
|
||||
(flags & RDPGFX_CAPS_FLAG_AVC420_ENABLED) ? TRUE : FALSE))
|
||||
return rc;
|
||||
}
|
||||
else
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264, FALSE);
|
||||
{
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264, FALSE))
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
return shadow_client_send_caps_confirm(context, client, &pdu);
|
||||
|
@ -1058,14 +1081,21 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
|
|||
pdu.capsSet = ∩︀
|
||||
flags = pdu.capsSet->flags;
|
||||
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444v2, FALSE);
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444, FALSE);
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264, FALSE);
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444v2, FALSE))
|
||||
return rc;
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxAVC444, FALSE))
|
||||
return rc;
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxH264, FALSE))
|
||||
return rc;
|
||||
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxThinClient,
|
||||
(flags & RDPGFX_CAPS_FLAG_THINCLIENT) ? TRUE : FALSE);
|
||||
freerdp_settings_set_bool(clientSettings, FreeRDP_GfxSmallCache,
|
||||
(flags & RDPGFX_CAPS_FLAG_SMALL_CACHE) ? TRUE : FALSE);
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxThinClient,
|
||||
(flags & RDPGFX_CAPS_FLAG_THINCLIENT) ? TRUE
|
||||
: FALSE))
|
||||
return rc;
|
||||
if (!freerdp_settings_set_bool(clientSettings, FreeRDP_GfxSmallCache,
|
||||
(flags & RDPGFX_CAPS_FLAG_SMALL_CACHE) ? TRUE
|
||||
: FALSE))
|
||||
return rc;
|
||||
|
||||
return shadow_client_send_caps_confirm(context, client, &pdu);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,19 @@
|
|||
|
||||
static const char bind_address[] = "bind-address,";
|
||||
|
||||
#define fail_at(arg, rc) fail_at_((arg), (rc), __FILE__, __func__, __LINE__)
|
||||
static int fail_at_(const COMMAND_LINE_ARGUMENT_A* arg, int rc, const char* file, const char* fkt,
|
||||
size_t line)
|
||||
{
|
||||
const DWORD level = WLOG_ERROR;
|
||||
wLog* log = WLog_Get(TAG);
|
||||
if (WLog_IsLevelActive(log, level))
|
||||
WLog_PrintMessage(log, WLOG_MESSAGE_TEXT, level, line, file, fkt,
|
||||
"Command line parsing failed at '%s' value '%s' [%d]", arg->Name,
|
||||
arg->Value, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int shadow_server_print_command_line_help(int argc, char** argv,
|
||||
COMMAND_LINE_ARGUMENT_A* largs)
|
||||
{
|
||||
|
@ -184,7 +197,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
long val = strtol(arg->Value, NULL, 0);
|
||||
|
||||
if ((errno != 0) || (val <= 0) || (val > UINT16_MAX))
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
|
||||
server->port = (DWORD)val;
|
||||
}
|
||||
|
@ -192,11 +205,11 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
{
|
||||
/* /bind-address is incompatible */
|
||||
if (server->ipcSocket)
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
server->ipcSocket = _strdup(arg->Value);
|
||||
|
||||
if (!server->ipcSocket)
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "bind-address")
|
||||
{
|
||||
|
@ -204,15 +217,15 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
size_t len = strlen(arg->Value) + sizeof(bind_address);
|
||||
/* /ipc-socket is incompatible */
|
||||
if (server->ipcSocket)
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
server->ipcSocket = calloc(len, sizeof(CHAR));
|
||||
|
||||
if (!server->ipcSocket)
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
|
||||
rc = _snprintf(server->ipcSocket, len, "%s%s", bind_address, arg->Value);
|
||||
if ((rc < 0) || ((size_t)rc != len - 1))
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "may-view")
|
||||
{
|
||||
|
@ -228,7 +241,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
unsigned long val = strtoul(arg->Value, NULL, 0);
|
||||
|
||||
if ((errno != 0) || (val > UINT32_MAX))
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
server->maxClientsConnected = val;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "rect")
|
||||
|
@ -242,7 +255,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
char* str = _strdup(arg->Value);
|
||||
|
||||
if (!str)
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
|
||||
tok[0] = p = str;
|
||||
p = strchr(p + 1, ',');
|
||||
|
@ -250,7 +263,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
if (!p)
|
||||
{
|
||||
free(str);
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
|
||||
*p++ = '\0';
|
||||
|
@ -260,7 +273,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
if (!p)
|
||||
{
|
||||
free(str);
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
|
||||
*p++ = '\0';
|
||||
|
@ -270,7 +283,7 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
if (!p)
|
||||
{
|
||||
free(str);
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
|
||||
*p++ = '\0';
|
||||
|
@ -299,11 +312,11 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
free(str);
|
||||
|
||||
if ((x < 0) || (y < 0) || (w < 1) || (h < 1) || (errno != 0))
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
|
||||
if ((x > UINT16_MAX) || (y > UINT16_MAX) || (x + w > UINT16_MAX) ||
|
||||
(y + h > UINT16_MAX))
|
||||
return -1;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
server->subRect.left = (UINT16)x;
|
||||
server->subRect.top = (UINT16)y;
|
||||
server->subRect.right = (UINT16)(x + w);
|
||||
|
@ -318,162 +331,164 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
|
|||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteCredentialGuard,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "sec")
|
||||
{
|
||||
if (strcmp("rdp", arg->Value) == 0) /* Standard RDP */
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, TRUE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_UseRdpSecurityLayer, TRUE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
else if (strcmp("tls", arg->Value) == 0) /* TLS */
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, TRUE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
else if (strcmp("nla", arg->Value) == 0) /* NLA */
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, TRUE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
else if (strcmp("ext", arg->Value) == 0) /* NLA Extended */
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity, FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity, TRUE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_ERR(TAG, "unknown protocol security: %s", arg->Value);
|
||||
return fail_at(arg, COMMAND_LINE_ERROR_UNEXPECTED_VALUE);
|
||||
}
|
||||
}
|
||||
CommandLineSwitchCase(arg, "sec-rdp")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RdpSecurity,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "sec-tls")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_TlsSecurity,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "sec-nla")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_NlaSecurity,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "sec-ext")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_ExtSecurity,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "sam-file")
|
||||
{
|
||||
freerdp_settings_set_string(settings, FreeRDP_NtlmSamFile, arg->Value);
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_NtlmSamFile, arg->Value))
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "log-level")
|
||||
{
|
||||
wLog* root = WLog_GetRoot();
|
||||
|
||||
if (!WLog_SetStringLogLevel(root, arg->Value))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "log-filters")
|
||||
{
|
||||
if (!WLog_AddStringLogFilters(arg->Value))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "nsc")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "rfx")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "gfx")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_SupportGraphicsPipeline,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "gfx-progressive")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxProgressive,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "gfx-rfx")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "gfx-planar")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxPlanar, arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "gfx-avc420")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxH264, arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "gfx-avc444")
|
||||
{
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxAVC444v2,
|
||||
arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
if (!freerdp_settings_set_bool(settings, FreeRDP_GfxAVC444, arg->Value ? TRUE : FALSE))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "keytab")
|
||||
{
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_KerberosKeytab, arg->Value))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "ccache")
|
||||
{
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_KerberosCache, arg->Value))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchCase(arg, "tls-secrets-file")
|
||||
{
|
||||
if (!freerdp_settings_set_string(settings, FreeRDP_TlsSecretsFile, arg->Value))
|
||||
return COMMAND_LINE_ERROR;
|
||||
return fail_at(arg, COMMAND_LINE_ERROR);
|
||||
}
|
||||
CommandLineSwitchDefault(arg)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ int TestInterlockedAccess(int argc, char* argv[])
|
|||
/* InterlockedDecrement */
|
||||
|
||||
for (int index = 0; index < 10; index++)
|
||||
InterlockedDecrement(Addend);
|
||||
(void)InterlockedDecrement(Addend);
|
||||
|
||||
if (*Addend != 0)
|
||||
{
|
||||
|
|
|
@ -244,7 +244,7 @@ VOID LeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
|||
}
|
||||
else
|
||||
{
|
||||
InterlockedDecrement(&lpCriticalSection->LockCount);
|
||||
(void)InterlockedDecrement(&lpCriticalSection->LockCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ void winpr_backtrace_symbols_fd(void* buffer, int fd)
|
|||
return;
|
||||
|
||||
for (size_t i = 0; i < used; i++)
|
||||
_write(fd, lines[i], (unsigned)strnlen(lines[i], UINT32_MAX));
|
||||
(void)_write(fd, lines[i], (unsigned)strnlen(lines[i], UINT32_MAX));
|
||||
free(lines);
|
||||
}
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue