20#include <freerdp/config.h>
26#include <winpr/string.h>
27#include <winpr/file.h>
28#include <winpr/cast.h>
30#include <freerdp/client.h>
31#include <freerdp/client/file.h>
32#include <freerdp/client/cmdline.h>
34#include <freerdp/channels/urbdrc.h>
35#include <freerdp/channels/rdpecam.h>
36#include <freerdp/channels/location.h>
51#include <winpr/wtypes.h>
53#include <winpr/path.h>
54#include <freerdp/log.h>
55#define TAG CLIENT_TAG("common")
59static const BYTE BOM_UTF16_LE[2] = { 0xFF, 0xFE };
63#define RDP_FILE_LINE_FLAG_FORMATTED 0x00000001
65#define RDP_FILE_LINE_FLAG_TYPE_STRING 0x00000010
66#define RDP_FILE_LINE_FLAG_TYPE_INTEGER 0x00000020
81typedef struct rdp_file_line rdpFileLine;
86 LPSTR SelectedMonitors;
87 DWORD MaximizeToCurrentDisplays;
88 DWORD SingleMonInWindowedMode;
92 DWORD DynamicResolution;
93 DWORD EnableSuperSpan;
94 DWORD SuperSpanAccelerationFactor;
100 DWORD DesktopScaleFactor;
104 DWORD DisableCtrlAltDel;
107 DWORD AudioQualityMode;
108 DWORD AudioCaptureMode;
109 DWORD EncodeRedirectedVideoCapture;
110 DWORD RedirectedVideoCaptureEncodingQuality;
111 DWORD VideoPlaybackMode;
113 DWORD ConnectionType;
115 DWORD NetworkAutoDetect;
116 DWORD BandwidthAutoDetect;
118 DWORD PinConnectionBar;
119 DWORD DisplayConnectionBar;
122 DWORD EnableWorkspaceReconnect;
124 DWORD DisableWallpaper;
125 DWORD AllowFontSmoothing;
126 DWORD AllowDesktopComposition;
127 DWORD DisableFullWindowDrag;
128 DWORD DisableMenuAnims;
130 DWORD DisableCursorSetting;
132 DWORD BitmapCacheSize;
133 DWORD BitmapCachePersistEnable;
143 LPSTR AlternateFullAddress;
145 LPSTR UsbDevicesToRedirect;
146 DWORD RedirectDrives;
147 DWORD RedirectPrinters;
148 DWORD RedirectComPorts;
149 DWORD RedirectLocation;
150 DWORD RedirectSmartCards;
151 DWORD RedirectWebauthN;
152 LPSTR RedirectCameras;
153 DWORD RedirectClipboard;
154 DWORD RedirectPosDevices;
155 DWORD RedirectDirectX;
156 DWORD DisablePrinterRedirection;
157 DWORD DisableClipboardRedirection;
159 DWORD ConnectToConsole;
160 DWORD AdministrativeSession;
161 DWORD AutoReconnectionEnabled;
162 DWORD AutoReconnectMaxRetries;
165 DWORD AuthenticationLevel;
166 DWORD PromptCredentialOnce;
167 DWORD PromptForCredentials;
168 DWORD NegotiateSecurityLayer;
169 DWORD EnableCredSSPSupport;
170 DWORD EnableRdsAadAuth;
172 DWORD RemoteApplicationMode;
173 LPSTR LoadBalanceInfo;
175 LPSTR RemoteApplicationName;
176 LPSTR RemoteApplicationIcon;
177 LPSTR RemoteApplicationProgram;
178 LPSTR RemoteApplicationFile;
179 LPSTR RemoteApplicationGuid;
180 LPSTR RemoteApplicationCmdLine;
181 DWORD RemoteApplicationExpandCmdLine;
182 DWORD RemoteApplicationExpandWorkingDir;
183 DWORD DisableConnectionSharing;
184 DWORD DisableRemoteAppCapsCheck;
186 LPSTR AlternateShell;
187 LPSTR ShellWorkingDirectory;
189 LPSTR GatewayHostname;
190 DWORD GatewayUsageMethod;
191 DWORD GatewayProfileUsageMethod;
192 DWORD GatewayCredentialsSource;
194 LPSTR ResourceProvider;
196 LPSTR WvdEndpointPool;
200 LPSTR diagnosticserviceurl;
201 LPSTR hubdiscoverygeourl;
204 DWORD UseRedirectionServerName;
206 LPSTR GatewayAccessToken;
208 LPSTR DrivesToRedirect;
209 LPSTR DevicesToRedirect;
212 LPSTR PreconnectionBlob;
229static const char key_str_username[] =
"username";
230static const char key_str_domain[] =
"domain";
231static const char key_str_password[] =
"password";
232static const char key_str_full_address[] =
"full address";
233static const char key_str_alternate_full_address[] =
"alternate full address";
234static const char key_str_usbdevicestoredirect[] =
"usbdevicestoredirect";
235static const char key_str_camerastoredirect[] =
"camerastoredirect";
236static const char key_str_loadbalanceinfo[] =
"loadbalanceinfo";
237static const char key_str_remoteapplicationname[] =
"remoteapplicationname";
238static const char key_str_remoteapplicationicon[] =
"remoteapplicationicon";
239static const char key_str_remoteapplicationprogram[] =
"remoteapplicationprogram";
240static const char key_str_remoteapplicationfile[] =
"remoteapplicationfile";
241static const char key_str_remoteapplicationguid[] =
"remoteapplicationguid";
242static const char key_str_remoteapplicationcmdline[] =
"remoteapplicationcmdline";
243static const char key_str_alternate_shell[] =
"alternate shell";
244static const char key_str_shell_working_directory[] =
"shell working directory";
245static const char key_str_gatewayhostname[] =
"gatewayhostname";
246static const char key_str_gatewayaccesstoken[] =
"gatewayaccesstoken";
247static const char key_str_resourceprovider[] =
"resourceprovider";
248static const char str_resourceprovider_arm[] =
"arm";
249static const char key_str_kdcproxyname[] =
"kdcproxyname";
250static const char key_str_drivestoredirect[] =
"drivestoredirect";
251static const char key_str_devicestoredirect[] =
"devicestoredirect";
252static const char key_str_winposstr[] =
"winposstr";
253static const char key_str_pcb[] =
"pcb";
254static const char key_str_selectedmonitors[] =
"selectedmonitors";
256static const char key_str_wvd[] =
"wvd endpoint pool";
257static const char key_str_geo[] =
"geo";
258static const char key_str_armpath[] =
"armpath";
259static const char key_str_aadtenantid[] =
"aadtenantid";
261static const char key_str_diagnosticserviceurl[] =
"diagnosticserviceurl";
262static const char key_str_hubdiscoverygeourl[] =
"hubdiscoverygeourl";
264static const char key_str_activityhint[] =
"activityhint";
266static const char key_int_rdgiskdcproxy[] =
"rdgiskdcproxy";
267static const char key_int_use_redirection_server_name[] =
"use redirection server name";
268static const char key_int_gatewaycredentialssource[] =
"gatewaycredentialssource";
269static const char key_int_gatewayprofileusagemethod[] =
"gatewayprofileusagemethod";
270static const char key_int_gatewayusagemethod[] =
"gatewayusagemethod";
271static const char key_int_disableremoteappcapscheck[] =
"disableremoteappcapscheck";
272static const char key_int_disableconnectionsharing[] =
"disableconnectionsharing";
273static const char key_int_remoteapplicationexpandworkingdir[] =
"remoteapplicationexpandworkingdir";
274static const char key_int_remoteapplicationexpandcmdline[] =
"remoteapplicationexpandcmdline";
275static const char key_int_remoteapplicationmode[] =
"remoteapplicationmode";
276static const char key_int_enablecredsspsupport[] =
"enablecredsspsupport";
277static const char key_int_enablerdsaadauth[] =
"enablerdsaadauth";
278static const char key_int_negotiate_security_layer[] =
"negotiate security layer";
279static const char key_int_prompt_for_credentials[] =
"prompt for credentials";
280static const char key_int_promptcredentialonce[] =
"promptcredentialonce";
281static const char key_int_authentication_level[] =
"authentication level";
282static const char key_int_public_mode[] =
"public mode";
283static const char key_int_autoreconnect_max_retries[] =
"autoreconnect max retries";
284static const char key_int_autoreconnection_enabled[] =
"autoreconnection enabled";
285static const char key_int_administrative_session[] =
"administrative session";
286static const char key_int_connect_to_console[] =
"connect to console";
287static const char key_int_disableclipboardredirection[] =
"disableclipboardredirection";
288static const char key_int_disableprinterredirection[] =
"disableprinterredirection";
289static const char key_int_redirectdirectx[] =
"redirectdirectx";
290static const char key_int_redirectposdevices[] =
"redirectposdevices";
291static const char key_int_redirectclipboard[] =
"redirectclipboard";
292static const char key_int_redirectsmartcards[] =
"redirectsmartcards";
293static const char key_int_redirectcomports[] =
"redirectcomports";
294static const char key_int_redirectlocation[] =
"redirectlocation";
295static const char key_int_redirectprinters[] =
"redirectprinters";
296static const char key_int_redirectdrives[] =
"redirectdrives";
297static const char key_int_server_port[] =
"server port";
298static const char key_int_bitmapcachepersistenable[] =
"bitmapcachepersistenable";
299static const char key_int_bitmapcachesize[] =
"bitmapcachesize";
300static const char key_int_disable_cursor_setting[] =
"disable cursor setting";
301static const char key_int_disable_themes[] =
"disable themes";
302static const char key_int_disable_menu_anims[] =
"disable menu anims";
303static const char key_int_disable_full_window_drag[] =
"disable full window drag";
304static const char key_int_allow_desktop_composition[] =
"allow desktop composition";
305static const char key_int_allow_font_smoothing[] =
"allow font smoothing";
306static const char key_int_disable_wallpaper[] =
"disable wallpaper";
307static const char key_int_enableworkspacereconnect[] =
"enableworkspacereconnect";
308static const char key_int_workspaceid[] =
"workspaceid";
309static const char key_int_displayconnectionbar[] =
"displayconnectionbar";
310static const char key_int_pinconnectionbar[] =
"pinconnectionbar";
311static const char key_int_bandwidthautodetect[] =
"bandwidthautodetect";
312static const char key_int_networkautodetect[] =
"networkautodetect";
313static const char key_int_connection_type[] =
"connection type";
314static const char key_int_videoplaybackmode[] =
"videoplaybackmode";
315static const char key_int_redirected_video_capture_encoding_quality[] =
316 "redirected video capture encoding quality";
317static const char key_int_encode_redirected_video_capture[] =
"encode redirected video capture";
318static const char key_int_audiocapturemode[] =
"audiocapturemode";
319static const char key_int_audioqualitymode[] =
"audioqualitymode";
320static const char key_int_audiomode[] =
"audiomode";
321static const char key_int_disable_ctrl_alt_del[] =
"disable ctrl+alt+del";
322static const char key_int_keyboardhook[] =
"keyboardhook";
323static const char key_int_compression[] =
"compression";
324static const char key_int_desktopscalefactor[] =
"desktopscalefactor";
325static const char key_int_session_bpp[] =
"session bpp";
326static const char key_int_desktop_size_id[] =
"desktop size id";
327static const char key_int_desktopheight[] =
"desktopheight";
328static const char key_int_desktopwidth[] =
"desktopwidth";
329static const char key_int_superpanaccelerationfactor[] =
"superpanaccelerationfactor";
330static const char key_int_enablesuperpan[] =
"enablesuperpan";
331static const char key_int_dynamic_resolution[] =
"dynamic resolution";
332static const char key_int_smart_sizing[] =
"smart sizing";
333static const char key_int_span_monitors[] =
"span monitors";
334static const char key_int_screen_mode_id[] =
"screen mode id";
335static const char key_int_singlemoninwindowedmode[] =
"singlemoninwindowedmode";
336static const char key_int_maximizetocurrentdisplays[] =
"maximizetocurrentdisplays";
337static const char key_int_use_multimon[] =
"use multimon";
338static const char key_int_redirectwebauthn[] =
"redirectwebauthn";
340static BOOL utils_str_is_empty(
const char* str)
344 if (strlen(str) == 0)
349static SSIZE_T freerdp_client_rdp_file_add_line(rdpFile* file);
350static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(
const rdpFile* file,
352static void freerdp_client_file_string_check_free(LPSTR str);
354static BOOL freerdp_client_rdp_file_find_integer_entry(rdpFile* file,
const char* name,
355 DWORD** outValue, rdpFileLine** outLine)
359 WINPR_ASSERT(outValue);
360 WINPR_ASSERT(outLine);
365 if (_stricmp(name, key_int_use_multimon) == 0)
366 *outValue = &file->UseMultiMon;
367 else if (_stricmp(name, key_int_maximizetocurrentdisplays) == 0)
368 *outValue = &file->MaximizeToCurrentDisplays;
369 else if (_stricmp(name, key_int_singlemoninwindowedmode) == 0)
370 *outValue = &file->SingleMonInWindowedMode;
371 else if (_stricmp(name, key_int_screen_mode_id) == 0)
372 *outValue = &file->ScreenModeId;
373 else if (_stricmp(name, key_int_span_monitors) == 0)
374 *outValue = &file->SpanMonitors;
375 else if (_stricmp(name, key_int_smart_sizing) == 0)
376 *outValue = &file->SmartSizing;
377 else if (_stricmp(name, key_int_dynamic_resolution) == 0)
378 *outValue = &file->DynamicResolution;
379 else if (_stricmp(name, key_int_enablesuperpan) == 0)
380 *outValue = &file->EnableSuperSpan;
381 else if (_stricmp(name, key_int_superpanaccelerationfactor) == 0)
382 *outValue = &file->SuperSpanAccelerationFactor;
383 else if (_stricmp(name, key_int_desktopwidth) == 0)
384 *outValue = &file->DesktopWidth;
385 else if (_stricmp(name, key_int_desktopheight) == 0)
386 *outValue = &file->DesktopHeight;
387 else if (_stricmp(name, key_int_desktop_size_id) == 0)
388 *outValue = &file->DesktopSizeId;
389 else if (_stricmp(name, key_int_session_bpp) == 0)
390 *outValue = &file->SessionBpp;
391 else if (_stricmp(name, key_int_desktopscalefactor) == 0)
392 *outValue = &file->DesktopScaleFactor;
393 else if (_stricmp(name, key_int_compression) == 0)
394 *outValue = &file->Compression;
395 else if (_stricmp(name, key_int_keyboardhook) == 0)
396 *outValue = &file->KeyboardHook;
397 else if (_stricmp(name, key_int_disable_ctrl_alt_del) == 0)
398 *outValue = &file->DisableCtrlAltDel;
399 else if (_stricmp(name, key_int_audiomode) == 0)
400 *outValue = &file->AudioMode;
401 else if (_stricmp(name, key_int_audioqualitymode) == 0)
402 *outValue = &file->AudioQualityMode;
403 else if (_stricmp(name, key_int_audiocapturemode) == 0)
404 *outValue = &file->AudioCaptureMode;
405 else if (_stricmp(name, key_int_encode_redirected_video_capture) == 0)
406 *outValue = &file->EncodeRedirectedVideoCapture;
407 else if (_stricmp(name, key_int_redirected_video_capture_encoding_quality) == 0)
408 *outValue = &file->RedirectedVideoCaptureEncodingQuality;
409 else if (_stricmp(name, key_int_videoplaybackmode) == 0)
410 *outValue = &file->VideoPlaybackMode;
411 else if (_stricmp(name, key_int_connection_type) == 0)
412 *outValue = &file->ConnectionType;
413 else if (_stricmp(name, key_int_networkautodetect) == 0)
414 *outValue = &file->NetworkAutoDetect;
415 else if (_stricmp(name, key_int_bandwidthautodetect) == 0)
416 *outValue = &file->BandwidthAutoDetect;
417 else if (_stricmp(name, key_int_pinconnectionbar) == 0)
418 *outValue = &file->PinConnectionBar;
419 else if (_stricmp(name, key_int_displayconnectionbar) == 0)
420 *outValue = &file->DisplayConnectionBar;
421 else if (_stricmp(name, key_int_workspaceid) == 0)
422 *outValue = &file->WorkspaceId;
423 else if (_stricmp(name, key_int_enableworkspacereconnect) == 0)
424 *outValue = &file->EnableWorkspaceReconnect;
425 else if (_stricmp(name, key_int_disable_wallpaper) == 0)
426 *outValue = &file->DisableWallpaper;
427 else if (_stricmp(name, key_int_allow_font_smoothing) == 0)
428 *outValue = &file->AllowFontSmoothing;
429 else if (_stricmp(name, key_int_allow_desktop_composition) == 0)
430 *outValue = &file->AllowDesktopComposition;
431 else if (_stricmp(name, key_int_disable_full_window_drag) == 0)
432 *outValue = &file->DisableFullWindowDrag;
433 else if (_stricmp(name, key_int_disable_menu_anims) == 0)
434 *outValue = &file->DisableMenuAnims;
435 else if (_stricmp(name, key_int_disable_themes) == 0)
436 *outValue = &file->DisableThemes;
437 else if (_stricmp(name, key_int_disable_cursor_setting) == 0)
438 *outValue = &file->DisableCursorSetting;
439 else if (_stricmp(name, key_int_bitmapcachesize) == 0)
440 *outValue = &file->BitmapCacheSize;
441 else if (_stricmp(name, key_int_bitmapcachepersistenable) == 0)
442 *outValue = &file->BitmapCachePersistEnable;
443 else if (_stricmp(name, key_int_server_port) == 0)
444 *outValue = &file->ServerPort;
445 else if (_stricmp(name, key_int_redirectdrives) == 0)
446 *outValue = &file->RedirectDrives;
447 else if (_stricmp(name, key_int_redirectprinters) == 0)
448 *outValue = &file->RedirectPrinters;
449 else if (_stricmp(name, key_int_redirectcomports) == 0)
450 *outValue = &file->RedirectComPorts;
451 else if (_stricmp(name, key_int_redirectlocation) == 0)
452 *outValue = &file->RedirectLocation;
453 else if (_stricmp(name, key_int_redirectsmartcards) == 0)
454 *outValue = &file->RedirectSmartCards;
455 else if (_stricmp(name, key_int_redirectclipboard) == 0)
456 *outValue = &file->RedirectClipboard;
457 else if (_stricmp(name, key_int_redirectposdevices) == 0)
458 *outValue = &file->RedirectPosDevices;
459 else if (_stricmp(name, key_int_redirectdirectx) == 0)
460 *outValue = &file->RedirectDirectX;
461 else if (_stricmp(name, key_int_disableprinterredirection) == 0)
462 *outValue = &file->DisablePrinterRedirection;
463 else if (_stricmp(name, key_int_disableclipboardredirection) == 0)
464 *outValue = &file->DisableClipboardRedirection;
465 else if (_stricmp(name, key_int_connect_to_console) == 0)
466 *outValue = &file->ConnectToConsole;
467 else if (_stricmp(name, key_int_administrative_session) == 0)
468 *outValue = &file->AdministrativeSession;
469 else if (_stricmp(name, key_int_autoreconnection_enabled) == 0)
470 *outValue = &file->AutoReconnectionEnabled;
471 else if (_stricmp(name, key_int_autoreconnect_max_retries) == 0)
472 *outValue = &file->AutoReconnectMaxRetries;
473 else if (_stricmp(name, key_int_public_mode) == 0)
474 *outValue = &file->PublicMode;
475 else if (_stricmp(name, key_int_authentication_level) == 0)
476 *outValue = &file->AuthenticationLevel;
477 else if (_stricmp(name, key_int_promptcredentialonce) == 0)
478 *outValue = &file->PromptCredentialOnce;
479 else if ((_stricmp(name, key_int_prompt_for_credentials) == 0))
480 *outValue = &file->PromptForCredentials;
481 else if (_stricmp(name, key_int_negotiate_security_layer) == 0)
482 *outValue = &file->NegotiateSecurityLayer;
483 else if (_stricmp(name, key_int_enablecredsspsupport) == 0)
484 *outValue = &file->EnableCredSSPSupport;
485 else if (_stricmp(name, key_int_enablerdsaadauth) == 0)
486 *outValue = &file->EnableRdsAadAuth;
487 else if (_stricmp(name, key_int_remoteapplicationmode) == 0)
488 *outValue = &file->RemoteApplicationMode;
489 else if (_stricmp(name, key_int_remoteapplicationexpandcmdline) == 0)
490 *outValue = &file->RemoteApplicationExpandCmdLine;
491 else if (_stricmp(name, key_int_remoteapplicationexpandworkingdir) == 0)
492 *outValue = &file->RemoteApplicationExpandWorkingDir;
493 else if (_stricmp(name, key_int_disableconnectionsharing) == 0)
494 *outValue = &file->DisableConnectionSharing;
495 else if (_stricmp(name, key_int_disableremoteappcapscheck) == 0)
496 *outValue = &file->DisableRemoteAppCapsCheck;
497 else if (_stricmp(name, key_int_gatewayusagemethod) == 0)
498 *outValue = &file->GatewayUsageMethod;
499 else if (_stricmp(name, key_int_gatewayprofileusagemethod) == 0)
500 *outValue = &file->GatewayProfileUsageMethod;
501 else if (_stricmp(name, key_int_gatewaycredentialssource) == 0)
502 *outValue = &file->GatewayCredentialsSource;
503 else if (_stricmp(name, key_int_use_redirection_server_name) == 0)
504 *outValue = &file->UseRedirectionServerName;
505 else if (_stricmp(name, key_int_rdgiskdcproxy) == 0)
506 *outValue = &file->RdgIsKdcProxy;
507 else if (_stricmp(name, key_int_redirectwebauthn) == 0)
508 *outValue = &file->RedirectWebauthN;
511 rdpFileLine* line = freerdp_client_rdp_file_find_line_by_name(file, name);
514 if (!(line->flags & RDP_FILE_LINE_FLAG_TYPE_INTEGER))
523static BOOL freerdp_client_rdp_file_find_string_entry(rdpFile* file,
const char* name,
524 LPSTR** outValue, rdpFileLine** outLine)
528 WINPR_ASSERT(outValue);
529 WINPR_ASSERT(outLine);
534 if (_stricmp(name, key_str_username) == 0)
535 *outValue = &file->Username;
536 else if (_stricmp(name, key_str_domain) == 0)
537 *outValue = &file->Domain;
538 else if (_stricmp(name, key_str_password) == 0)
539 *outValue = &file->Password;
540 else if (_stricmp(name, key_str_full_address) == 0)
541 *outValue = &file->FullAddress;
542 else if (_stricmp(name, key_str_alternate_full_address) == 0)
543 *outValue = &file->AlternateFullAddress;
544 else if (_stricmp(name, key_str_usbdevicestoredirect) == 0)
545 *outValue = &file->UsbDevicesToRedirect;
546 else if (_stricmp(name, key_str_camerastoredirect) == 0)
547 *outValue = &file->RedirectCameras;
548 else if (_stricmp(name, key_str_loadbalanceinfo) == 0)
549 *outValue = &file->LoadBalanceInfo;
550 else if (_stricmp(name, key_str_remoteapplicationname) == 0)
551 *outValue = &file->RemoteApplicationName;
552 else if (_stricmp(name, key_str_remoteapplicationicon) == 0)
553 *outValue = &file->RemoteApplicationIcon;
554 else if (_stricmp(name, key_str_remoteapplicationprogram) == 0)
555 *outValue = &file->RemoteApplicationProgram;
556 else if (_stricmp(name, key_str_remoteapplicationfile) == 0)
557 *outValue = &file->RemoteApplicationFile;
558 else if (_stricmp(name, key_str_remoteapplicationguid) == 0)
559 *outValue = &file->RemoteApplicationGuid;
560 else if (_stricmp(name, key_str_remoteapplicationcmdline) == 0)
561 *outValue = &file->RemoteApplicationCmdLine;
562 else if (_stricmp(name, key_str_alternate_shell) == 0)
563 *outValue = &file->AlternateShell;
564 else if (_stricmp(name, key_str_shell_working_directory) == 0)
565 *outValue = &file->ShellWorkingDirectory;
566 else if (_stricmp(name, key_str_gatewayhostname) == 0)
567 *outValue = &file->GatewayHostname;
568 else if (_stricmp(name, key_str_resourceprovider) == 0)
569 *outValue = &file->ResourceProvider;
570 else if (_stricmp(name, key_str_wvd) == 0)
571 *outValue = &file->WvdEndpointPool;
572 else if (_stricmp(name, key_str_geo) == 0)
573 *outValue = &file->geo;
574 else if (_stricmp(name, key_str_armpath) == 0)
575 *outValue = &file->armpath;
576 else if (_stricmp(name, key_str_aadtenantid) == 0)
577 *outValue = &file->aadtenantid;
578 else if (_stricmp(name, key_str_diagnosticserviceurl) == 0)
579 *outValue = &file->diagnosticserviceurl;
580 else if (_stricmp(name, key_str_hubdiscoverygeourl) == 0)
581 *outValue = &file->hubdiscoverygeourl;
582 else if (_stricmp(name, key_str_activityhint) == 0)
583 *outValue = &file->activityhint;
584 else if (_stricmp(name, key_str_gatewayaccesstoken) == 0)
585 *outValue = &file->GatewayAccessToken;
586 else if (_stricmp(name, key_str_kdcproxyname) == 0)
587 *outValue = &file->KdcProxyName;
588 else if (_stricmp(name, key_str_drivestoredirect) == 0)
589 *outValue = &file->DrivesToRedirect;
590 else if (_stricmp(name, key_str_devicestoredirect) == 0)
591 *outValue = &file->DevicesToRedirect;
592 else if (_stricmp(name, key_str_winposstr) == 0)
593 *outValue = &file->WinPosStr;
594 else if (_stricmp(name, key_str_pcb) == 0)
595 *outValue = &file->PreconnectionBlob;
596 else if (_stricmp(name, key_str_selectedmonitors) == 0)
597 *outValue = &file->SelectedMonitors;
600 rdpFileLine* line = freerdp_client_rdp_file_find_line_by_name(file, name);
603 if (!(line->flags & RDP_FILE_LINE_FLAG_TYPE_STRING))
618static BOOL freerdp_client_rdp_file_set_integer(rdpFile* file,
const char* name,
long value)
620 DWORD* targetValue = NULL;
621 rdpFileLine* line = NULL;
622#ifdef DEBUG_CLIENT_FILE
623 WLog_DBG(TAG,
"%s:i:%ld", name, value);
629 if (!freerdp_client_rdp_file_find_integer_entry(file, name, &targetValue, &line))
631 SSIZE_T index = freerdp_client_rdp_file_add_line(file);
634 line = &file->lines[index];
639 *targetValue = (DWORD)value;
646 line->name = _strdup(name);
654 line->iValue = value;
655 line->flags = RDP_FILE_LINE_FLAG_FORMATTED;
656 line->flags |= RDP_FILE_LINE_FLAG_TYPE_INTEGER;
657 line->valueLength = 0;
664static BOOL freerdp_client_parse_rdp_file_integer(rdpFile* file,
const char* name,
670 ivalue = strtol(value, &endptr, 0);
672 if ((endptr == NULL) || (errno != 0) || (endptr == value) || (ivalue > INT32_MAX) ||
673 (ivalue < INT32_MIN))
675 if (file->flags & RDP_FILE_FLAG_PARSE_INT_RELAXED)
677 WLog_WARN(TAG,
"Integer option %s has invalid value %s, using default", name, value);
682 WLog_ERR(TAG,
"Failed to convert RDP file integer option %s [value=%s]", name, value);
687 return freerdp_client_rdp_file_set_integer(file, name, ivalue);
698static BOOL freerdp_client_rdp_file_set_string(rdpFile* file,
const char* name,
const char* value)
700 LPSTR* targetValue = NULL;
701 rdpFileLine* line = NULL;
702#ifdef DEBUG_CLIENT_FILE
703 WLog_DBG(TAG,
"%s:s:%s", name, value);
709 if (!freerdp_client_rdp_file_find_string_entry(file, name, &targetValue, &line))
711 SSIZE_T index = freerdp_client_rdp_file_add_line(file);
714 line = &file->lines[index];
719 *targetValue = _strdup(value);
729 line->name = _strdup(name);
730 line->sValue = _strdup(value);
731 if (!line->name || !line->sValue)
740 line->flags = RDP_FILE_LINE_FLAG_FORMATTED;
741 line->flags |= RDP_FILE_LINE_FLAG_TYPE_STRING;
742 line->valueLength = 0;
749static BOOL freerdp_client_add_option(rdpFile* file,
const char* option)
751 return freerdp_addin_argv_add_argument(file->args, option);
754static SSIZE_T freerdp_client_rdp_file_add_line(rdpFile* file)
756 SSIZE_T index = (SSIZE_T)file->lineCount;
758 while ((file->lineCount + 1) > file->lineSize)
760 size_t new_size = file->lineCount + 2048;
761 rdpFileLine* new_line = (rdpFileLine*)realloc(file->lines, new_size *
sizeof(rdpFileLine));
766 file->lines = new_line;
767 file->lineSize = new_size;
770 ZeroMemory(&(file->lines[file->lineCount]),
sizeof(rdpFileLine));
771 file->lines[file->lineCount].index = (size_t)index;
776static BOOL freerdp_client_parse_rdp_file_string(rdpFile* file,
char* name,
char* value)
778 return freerdp_client_rdp_file_set_string(file, name, value);
781static BOOL freerdp_client_parse_rdp_file_option(rdpFile* file,
const char* option)
783 return freerdp_client_add_option(file, option);
786BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file,
const BYTE* buffer,
size_t size)
788 return freerdp_client_parse_rdp_file_buffer_ex(file, buffer, size, NULL);
791static BOOL trim(
char** strptr)
797 start = str = *strptr;
800 if (!(~((
size_t)str)))
802 end = str + strlen(str) - 1;
804 while (isspace(*str))
807 while ((end > str) && isspace(*end))
814 *strptr = _strdup(str);
816 return *strptr != NULL;
822static BOOL trim_strings(rdpFile* file)
824 if (!trim(&file->Username))
826 if (!trim(&file->Domain))
828 if (!trim(&file->AlternateFullAddress))
830 if (!trim(&file->FullAddress))
832 if (!trim(&file->UsbDevicesToRedirect))
834 if (!trim(&file->RedirectCameras))
836 if (!trim(&file->LoadBalanceInfo))
838 if (!trim(&file->GatewayHostname))
840 if (!trim(&file->GatewayAccessToken))
842 if (!trim(&file->RemoteApplicationName))
844 if (!trim(&file->RemoteApplicationIcon))
846 if (!trim(&file->RemoteApplicationProgram))
848 if (!trim(&file->RemoteApplicationFile))
850 if (!trim(&file->RemoteApplicationGuid))
852 if (!trim(&file->RemoteApplicationCmdLine))
854 if (!trim(&file->AlternateShell))
856 if (!trim(&file->ShellWorkingDirectory))
858 if (!trim(&file->DrivesToRedirect))
860 if (!trim(&file->DevicesToRedirect))
862 if (!trim(&file->DevicesToRedirect))
864 if (!trim(&file->WinPosStr))
866 if (!trim(&file->PreconnectionBlob))
868 if (!trim(&file->KdcProxyName))
870 if (!trim(&file->SelectedMonitors))
873 for (
size_t i = 0; i < file->lineCount; ++i)
875 rdpFileLine* curLine = &file->lines[i];
876 if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_STRING)
878 if (!trim(&curLine->sValue))
886BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file,
const BYTE* buffer,
size_t size,
887 rdp_file_fkt_parse parse)
893 char* context = NULL;
906 if ((buffer[0] == BOM_UTF16_LE[0]) && (buffer[1] == BOM_UTF16_LE[1]))
908 LPCWSTR uc = (LPCWSTR)(&buffer[2]);
909 size = size /
sizeof(WCHAR) - 1;
911 copy = ConvertWCharNToUtf8Alloc(uc, size, NULL);
914 WLog_ERR(TAG,
"Failed to convert RDP file from UCS2 to UTF8");
920 copy = calloc(1, size +
sizeof(BYTE));
925 memcpy(copy, buffer, size);
928 line = strtok_s(copy,
"\r\n", &context);
932 length = strnlen(line, size);
939 if (!freerdp_client_parse_rdp_file_option(file, line))
945 d1 = strchr(line,
':');
951 d2 = strchr(type,
':');
964 if (parse && parse(file->context, name, *type, value))
967 else if (*type ==
'i')
970 if (!freerdp_client_parse_rdp_file_integer(file, name, value))
973 else if (*type ==
's')
976 if (!freerdp_client_parse_rdp_file_string(file, name, value))
979 else if (*type ==
'b')
982 WLog_ERR(TAG,
"Unsupported RDP file binary option %s [value=%s]", name, value);
987 line = strtok_s(NULL,
"\r\n", &context);
990 rc = trim_strings(file);
996BOOL freerdp_client_parse_rdp_file(rdpFile* file,
const char* name)
998 return freerdp_client_parse_rdp_file_ex(file, name, NULL);
1001BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file,
const char* name, rdp_file_fkt_parse parse)
1004 BYTE* buffer = NULL;
1006 size_t read_size = 0;
1007 INT64 file_size = 0;
1008 const char* fname = name;
1013 if (_strnicmp(fname,
"file://", 7) == 0)
1016 fp = winpr_fopen(fname,
"r");
1019 WLog_ERR(TAG,
"Failed to open RDP file %s", name);
1023 (void)_fseeki64(fp, 0, SEEK_END);
1024 file_size = _ftelli64(fp);
1025 (void)_fseeki64(fp, 0, SEEK_SET);
1029 WLog_ERR(TAG,
"RDP file %s is empty", name);
1034 buffer = (BYTE*)malloc((
size_t)file_size + 2);
1042 read_size = fread(buffer, (
size_t)file_size, 1, fp);
1047 read_size = (size_t)file_size;
1054 WLog_ERR(TAG,
"Could not read from RDP file %s", name);
1059 buffer[file_size] =
'\0';
1060 buffer[file_size + 1] =
'\0';
1061 status = freerdp_client_parse_rdp_file_buffer_ex(file, buffer, (
size_t)file_size, parse);
1066static INLINE
void freerdp_client_file_string_reset(
char** target)
1068 WINPR_ASSERT(target);
1069 freerdp_client_file_string_check_free(*target);
1070 *target = (
void*)~((
size_t)NULL);
1073static INLINE BOOL FILE_POPULATE_STRING(
char** _target,
const rdpSettings* _settings,
1074 FreeRDP_Settings_Keys_String _option)
1076 WINPR_ASSERT(_target);
1077 WINPR_ASSERT(_settings);
1080 freerdp_client_file_string_reset(_target);
1083 char* copy = _strdup(str);
1091static char* freerdp_client_channel_args_to_string(
const rdpSettings* settings,
const char* channel,
1094 ADDIN_ARGV* args = freerdp_dynamic_channel_collection_find(settings, channel);
1095 const char* filters[] = { option };
1096 if (!args || (args->argc < 2))
1099 return CommandLineToCommaSeparatedValuesEx(args->argc - 1, args->argv + 1, filters,
1100 ARRAYSIZE(filters));
1103static BOOL rdp_opt_duplicate(
const rdpSettings* _settings, FreeRDP_Settings_Keys_String _id,
1106 WINPR_ASSERT(_settings);
1112 *_key = _strdup(tmp);
1120BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file,
const rdpSettings* settings)
1122 FreeRDP_Settings_Keys_String index = FreeRDP_STRING_UNUSED;
1123 UINT32 LoadBalanceInfoLength = 0;
1124 const char* GatewayHostname = NULL;
1125 char* redirectCameras = NULL;
1127 if (!file || !settings)
1130 if (!FILE_POPULATE_STRING(&file->Domain, settings, FreeRDP_Domain) ||
1131 !FILE_POPULATE_STRING(&file->Username, settings, FreeRDP_Username) ||
1132 !FILE_POPULATE_STRING(&file->Password, settings, FreeRDP_Password) ||
1133 !FILE_POPULATE_STRING(&file->FullAddress, settings, FreeRDP_ServerHostname) ||
1134 !FILE_POPULATE_STRING(&file->AlternateFullAddress, settings, FreeRDP_ServerHostname) ||
1135 !FILE_POPULATE_STRING(&file->AlternateShell, settings, FreeRDP_AlternateShell) ||
1136 !FILE_POPULATE_STRING(&file->DrivesToRedirect, settings, FreeRDP_DrivesToRedirect))
1145 file->DynamicResolution = WINPR_ASSERTING_INT_CAST(
1147 file->VideoPlaybackMode = WINPR_ASSERTING_INT_CAST(
1154 file->ConnectToConsole = WINPR_ASSERTING_INT_CAST(
1156 file->NegotiateSecurityLayer = WINPR_ASSERTING_INT_CAST(
1158 file->EnableCredSSPSupport =
1160 file->EnableRdsAadAuth =
1164 index = FreeRDP_RemoteApplicationWorkingDir;
1166 index = FreeRDP_ShellWorkingDirectory;
1167 if (!FILE_POPULATE_STRING(&file->ShellWorkingDirectory, settings, index))
1174 if (LoadBalanceInfoLength > 0)
1176 const BYTE* LoadBalanceInfo =
1178 file->LoadBalanceInfo = calloc(LoadBalanceInfoLength + 1, 1);
1179 if (!file->LoadBalanceInfo)
1181 memcpy(file->LoadBalanceInfo, LoadBalanceInfo, LoadBalanceInfoLength);
1185 file->AudioMode = AUDIO_MODE_REDIRECT;
1187 file->AudioMode = AUDIO_MODE_PLAY_ON_SERVER;
1189 file->AudioMode = AUDIO_MODE_NONE;
1194 if (GatewayHostname)
1197 freerdp_client_file_string_check_free(file->GatewayHostname);
1198 if (GatewayPort == 443)
1199 file->GatewayHostname = _strdup(GatewayHostname);
1202 int length = _scprintf(
"%s:%" PRIu32, GatewayHostname, GatewayPort);
1206 file->GatewayHostname = (
char*)malloc((
size_t)length + 1);
1207 if (!file->GatewayHostname)
1210 if (sprintf_s(file->GatewayHostname, (
size_t)length + 1,
"%s:%" PRIu32, GatewayHostname,
1214 if (!file->GatewayHostname)
1219 file->ResourceProvider = _strdup(str_resourceprovider_arm);
1221 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdWvdEndpointPool, &file->WvdEndpointPool))
1223 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdGeo, &file->geo))
1225 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdArmpath, &file->armpath))
1227 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdAadtenantid, &file->aadtenantid))
1229 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdDiagnosticserviceurl,
1230 &file->diagnosticserviceurl))
1232 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdHubdiscoverygeourl,
1233 &file->hubdiscoverygeourl))
1235 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdActivityhint, &file->activityhint))
1238 file->AudioCaptureMode =
1240 file->BitmapCachePersistEnable = WINPR_ASSERTING_INT_CAST(
1242 file->Compression = WINPR_ASSERTING_INT_CAST(
1246 file->GatewayCredentialsSource =
1248 file->PromptCredentialOnce = WINPR_ASSERTING_INT_CAST(
1250 file->PromptForCredentials = WINPR_ASSERTING_INT_CAST(
1252 file->RemoteApplicationMode = WINPR_ASSERTING_INT_CAST(
1254 if (!FILE_POPULATE_STRING(&file->GatewayAccessToken, settings, FreeRDP_GatewayAccessToken) ||
1255 !FILE_POPULATE_STRING(&file->RemoteApplicationProgram, settings,
1256 FreeRDP_RemoteApplicationProgram) ||
1257 !FILE_POPULATE_STRING(&file->RemoteApplicationName, settings,
1258 FreeRDP_RemoteApplicationName) ||
1259 !FILE_POPULATE_STRING(&file->RemoteApplicationIcon, settings,
1260 FreeRDP_RemoteApplicationIcon) ||
1261 !FILE_POPULATE_STRING(&file->RemoteApplicationFile, settings,
1262 FreeRDP_RemoteApplicationFile) ||
1263 !FILE_POPULATE_STRING(&file->RemoteApplicationGuid, settings,
1264 FreeRDP_RemoteApplicationGuid) ||
1265 !FILE_POPULATE_STRING(&file->RemoteApplicationCmdLine, settings,
1266 FreeRDP_RemoteApplicationCmdLine))
1268 file->SpanMonitors =
1272 file->AllowDesktopComposition = WINPR_ASSERTING_INT_CAST(
1274 file->AllowFontSmoothing = WINPR_ASSERTING_INT_CAST(
1276 file->DisableWallpaper = WINPR_ASSERTING_INT_CAST(
1278 file->DisableFullWindowDrag = WINPR_ASSERTING_INT_CAST(
1280 file->DisableMenuAnims = WINPR_ASSERTING_INT_CAST(
1282 file->DisableThemes = WINPR_ASSERTING_INT_CAST(
1285 CONNECTION_TYPE_AUTODETECT)
1288 file->NetworkAutoDetect =
1290 file->AutoReconnectionEnabled = WINPR_ASSERTING_INT_CAST(
1292 file->RedirectSmartCards = WINPR_ASSERTING_INT_CAST(
1294 file->RedirectWebauthN = WINPR_ASSERTING_INT_CAST(
1298 freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"device:");
1299 if (redirectCameras)
1302 freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"encode:");
1303 file->EncodeRedirectedVideoCapture = 0;
1306 unsigned long val = 0;
1308 val = strtoul(str, NULL, 0);
1309 if ((val < UINT32_MAX) && (errno == 0))
1310 file->EncodeRedirectedVideoCapture = (UINT32)val;
1314 str = freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"quality:");
1315 file->RedirectedVideoCaptureEncodingQuality = 0;
1318 unsigned long val = 0;
1320 val = strtoul(str, NULL, 0);
1321 if ((val <= 2) && (errno == 0))
1323 file->RedirectedVideoCaptureEncodingQuality = (UINT32)val;
1328 file->RedirectCameras = redirectCameras;
1331 freerdp_client_file_string_reset(&file->RedirectCameras);
1333#ifdef CHANNEL_URBDRC_CLIENT
1335 freerdp_client_channel_args_to_string(settings, URBDRC_CHANNEL_NAME,
"device:");
1337 file->UsbDevicesToRedirect = redirectUsb;
1339 freerdp_client_file_string_reset(&file->UsbDevicesToRedirect);
1342 file->RedirectClipboard =
1349 file->RedirectLocation =
1351 if (!FILE_POPULATE_STRING(&file->DrivesToRedirect, settings, FreeRDP_DrivesToRedirect) ||
1352 !FILE_POPULATE_STRING(&file->PreconnectionBlob, settings, FreeRDP_PreconnectionBlob) ||
1353 !FILE_POPULATE_STRING(&file->KdcProxyName, settings, FreeRDP_KerberosKdcUrl))
1361 size_t size = count * (10 + 1) + 1;
1363 char* str = calloc(size,
sizeof(
char));
1364 for (UINT32 x = 0; x < count; x++)
1366 int rc = _snprintf(&str[offset], size - offset,
"%" PRIu32
",", MonitorIds[x]);
1372 offset += (size_t)rc;
1375 str[offset - 1] =
'\0';
1376 freerdp_client_file_string_check_free(file->SelectedMonitors);
1377 file->SelectedMonitors = str;
1385BOOL freerdp_client_write_rdp_file(
const rdpFile* file,
const char* name, BOOL unicode)
1388 WCHAR* unicodestr = NULL;
1393 const size_t size = freerdp_client_write_rdp_file_buffer(file, NULL, 0);
1396 char* buffer = calloc(size + 1ULL,
sizeof(
char));
1398 if (freerdp_client_write_rdp_file_buffer(file, buffer, size + 1) != size)
1400 WLog_ERR(TAG,
"freerdp_client_write_rdp_file: error writing to output buffer");
1405 FILE* fp = winpr_fopen(name,
"w+b");
1412 unicodestr = ConvertUtf8NToWCharAlloc(buffer, size, &len);
1422 if ((fwrite(BOM_UTF16_LE,
sizeof(BYTE), 2, fp) != 2) ||
1423 (fwrite(unicodestr,
sizeof(WCHAR), len, fp) != len))
1435 if (fwrite(buffer, 1, size, fp) != size)
1444 status = fclose(fp);
1448 return (status == 0) ? TRUE : FALSE;
1451WINPR_ATTR_FORMAT_ARG(3, 4)
1452static SSIZE_T freerdp_client_write_setting_to_buffer(
char** buffer,
size_t* bufferSize,
1453 WINPR_FORMAT_ARG const
char* fmt, ...)
1460 if (!buffer || !bufferSize || !fmt)
1464 bufSize = *bufferSize;
1467 len = vsnprintf(buf, bufSize, fmt, ap);
1476 if (!buf && !bufSize)
1483 if (bufSize >= (
size_t)len)
1485 *bufferSize -= (size_t)len;
1486 buf[len - 1] =
'\n';
1487 *buffer = buf + len;
1495static SSIZE_T write_int_parameters(
const rdpFile* file,
char* buffer,
size_t size)
1504 const struct intentry_t settings[] = {
1505 { key_int_use_multimon, file->UseMultiMon },
1506 { key_int_maximizetocurrentdisplays, file->MaximizeToCurrentDisplays },
1507 { key_int_singlemoninwindowedmode, file->SingleMonInWindowedMode },
1508 { key_int_screen_mode_id, file->ScreenModeId },
1509 { key_int_span_monitors, file->SpanMonitors },
1510 { key_int_smart_sizing, file->SmartSizing },
1511 { key_int_dynamic_resolution, file->DynamicResolution },
1512 { key_int_enablesuperpan, file->EnableSuperSpan },
1513 { key_int_superpanaccelerationfactor, file->SuperSpanAccelerationFactor },
1514 { key_int_desktopwidth, file->DesktopWidth },
1515 { key_int_desktopheight, file->DesktopHeight },
1516 { key_int_desktop_size_id, file->DesktopSizeId },
1517 { key_int_session_bpp, file->SessionBpp },
1518 { key_int_desktopscalefactor, file->DesktopScaleFactor },
1519 { key_int_compression, file->Compression },
1520 { key_int_keyboardhook, file->KeyboardHook },
1521 { key_int_disable_ctrl_alt_del, file->DisableCtrlAltDel },
1522 { key_int_audiomode, file->AudioMode },
1523 { key_int_audioqualitymode, file->AudioQualityMode },
1524 { key_int_audiocapturemode, file->AudioCaptureMode },
1525 { key_int_encode_redirected_video_capture, file->EncodeRedirectedVideoCapture },
1526 { key_int_redirected_video_capture_encoding_quality,
1527 file->RedirectedVideoCaptureEncodingQuality },
1528 { key_int_videoplaybackmode, file->VideoPlaybackMode },
1529 { key_int_connection_type, file->ConnectionType },
1530 { key_int_networkautodetect, file->NetworkAutoDetect },
1531 { key_int_bandwidthautodetect, file->BandwidthAutoDetect },
1532 { key_int_pinconnectionbar, file->PinConnectionBar },
1533 { key_int_displayconnectionbar, file->DisplayConnectionBar },
1534 { key_int_workspaceid, file->WorkspaceId },
1535 { key_int_enableworkspacereconnect, file->EnableWorkspaceReconnect },
1536 { key_int_disable_wallpaper, file->DisableWallpaper },
1537 { key_int_allow_font_smoothing, file->AllowFontSmoothing },
1538 { key_int_allow_desktop_composition, file->AllowDesktopComposition },
1539 { key_int_disable_full_window_drag, file->DisableFullWindowDrag },
1540 { key_int_disable_menu_anims, file->DisableMenuAnims },
1541 { key_int_disable_themes, file->DisableThemes },
1542 { key_int_disable_cursor_setting, file->DisableCursorSetting },
1543 { key_int_bitmapcachesize, file->BitmapCacheSize },
1544 { key_int_bitmapcachepersistenable, file->BitmapCachePersistEnable },
1545 { key_int_server_port, file->ServerPort },
1546 { key_int_redirectdrives, file->RedirectDrives },
1547 { key_int_redirectprinters, file->RedirectPrinters },
1548 { key_int_redirectcomports, file->RedirectComPorts },
1549 { key_int_redirectlocation, file->RedirectLocation },
1550 { key_int_redirectsmartcards, file->RedirectSmartCards },
1551 { key_int_redirectclipboard, file->RedirectClipboard },
1552 { key_int_redirectposdevices, file->RedirectPosDevices },
1553 { key_int_redirectdirectx, file->RedirectDirectX },
1554 { key_int_disableprinterredirection, file->DisablePrinterRedirection },
1555 { key_int_disableclipboardredirection, file->DisableClipboardRedirection },
1556 { key_int_connect_to_console, file->ConnectToConsole },
1557 { key_int_administrative_session, file->AdministrativeSession },
1558 { key_int_autoreconnection_enabled, file->AutoReconnectionEnabled },
1559 { key_int_autoreconnect_max_retries, file->AutoReconnectMaxRetries },
1560 { key_int_public_mode, file->PublicMode },
1561 { key_int_authentication_level, file->AuthenticationLevel },
1562 { key_int_promptcredentialonce, file->PromptCredentialOnce },
1563 { key_int_prompt_for_credentials, file->PromptForCredentials },
1564 { key_int_negotiate_security_layer, file->NegotiateSecurityLayer },
1565 { key_int_enablecredsspsupport, file->EnableCredSSPSupport },
1566 { key_int_enablerdsaadauth, file->EnableRdsAadAuth },
1567 { key_int_remoteapplicationmode, file->RemoteApplicationMode },
1568 { key_int_remoteapplicationexpandcmdline, file->RemoteApplicationExpandCmdLine },
1569 { key_int_remoteapplicationexpandworkingdir, file->RemoteApplicationExpandWorkingDir },
1570 { key_int_disableconnectionsharing, file->DisableConnectionSharing },
1571 { key_int_disableremoteappcapscheck, file->DisableRemoteAppCapsCheck },
1572 { key_int_gatewayusagemethod, file->GatewayUsageMethod },
1573 { key_int_gatewayprofileusagemethod, file->GatewayProfileUsageMethod },
1574 { key_int_gatewaycredentialssource, file->GatewayCredentialsSource },
1575 { key_int_use_redirection_server_name, file->UseRedirectionServerName },
1576 { key_int_rdgiskdcproxy, file->RdgIsKdcProxy },
1577 { key_int_redirectwebauthn, file->RedirectWebauthN }
1580 SSIZE_T totalSize = 0;
1581 for (
size_t x = 0; x < ARRAYSIZE(settings); x++)
1583 const struct intentry_t* cur = &settings[x];
1586 const SSIZE_T res = freerdp_client_write_setting_to_buffer(
1587 &buffer, &size,
"%s:i:%" PRIu32, cur->key, cur->val);
1597static SSIZE_T write_string_parameters(
const rdpFile* file,
char* buffer,
size_t size)
1606 const struct strentry_t settings[] = {
1607 { key_str_username, file->Username },
1608 { key_str_domain, file->Domain },
1609 { key_str_password, file->Password },
1610 { key_str_full_address, file->FullAddress },
1611 { key_str_alternate_full_address, file->AlternateFullAddress },
1612 { key_str_usbdevicestoredirect, file->UsbDevicesToRedirect },
1613 { key_str_camerastoredirect, file->RedirectCameras },
1614 { key_str_loadbalanceinfo, file->LoadBalanceInfo },
1615 { key_str_remoteapplicationname, file->RemoteApplicationName },
1616 { key_str_remoteapplicationicon, file->RemoteApplicationIcon },
1617 { key_str_remoteapplicationprogram, file->RemoteApplicationProgram },
1618 { key_str_remoteapplicationfile, file->RemoteApplicationFile },
1619 { key_str_remoteapplicationguid, file->RemoteApplicationGuid },
1620 { key_str_remoteapplicationcmdline, file->RemoteApplicationCmdLine },
1621 { key_str_alternate_shell, file->AlternateShell },
1622 { key_str_shell_working_directory, file->ShellWorkingDirectory },
1623 { key_str_gatewayhostname, file->GatewayHostname },
1624 { key_str_resourceprovider, file->ResourceProvider },
1625 { key_str_wvd, file->WvdEndpointPool },
1626 { key_str_geo, file->geo },
1627 { key_str_armpath, file->armpath },
1628 { key_str_aadtenantid, file->aadtenantid },
1629 { key_str_diagnosticserviceurl, file->diagnosticserviceurl },
1630 { key_str_hubdiscoverygeourl, file->hubdiscoverygeourl },
1631 { key_str_activityhint, file->activityhint },
1632 { key_str_gatewayaccesstoken, file->GatewayAccessToken },
1633 { key_str_kdcproxyname, file->KdcProxyName },
1634 { key_str_drivestoredirect, file->DrivesToRedirect },
1635 { key_str_devicestoredirect, file->DevicesToRedirect },
1636 { key_str_winposstr, file->WinPosStr },
1637 { key_str_pcb, file->PreconnectionBlob },
1638 { key_str_selectedmonitors, file->SelectedMonitors }
1641 SSIZE_T totalSize = 0;
1642 for (
size_t x = 0; x < ARRAYSIZE(settings); x++)
1644 const struct strentry_t* cur = &settings[x];
1645 if (~(
size_t)(cur->val))
1647 const SSIZE_T res = freerdp_client_write_setting_to_buffer(&buffer, &size,
"%s:s:%s",
1648 cur->key, cur->val);
1658static SSIZE_T write_custom_parameters(
const rdpFile* file,
char* buffer,
size_t size)
1662 SSIZE_T totalSize = 0;
1664 for (
size_t i = 0; i < file->lineCount; ++i)
1667 const rdpFileLine* curLine = &file->lines[i];
1669 if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_INTEGER)
1670 res = freerdp_client_write_setting_to_buffer(&buffer, &size,
"%s:i:%" PRIu32,
1671 curLine->name, (UINT32)curLine->iValue);
1672 else if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_STRING)
1673 res = freerdp_client_write_setting_to_buffer(&buffer, &size,
"%s:s:%s", curLine->name,
1683size_t freerdp_client_write_rdp_file_buffer(
const rdpFile* file,
char* buffer,
size_t size)
1685 size_t totalSize = 0;
1691 if ((!buffer || !size) && (buffer || size))
1695 const SSIZE_T intsize = write_int_parameters(file, buffer, size);
1698 totalSize += (size_t)intsize;
1703 const SSIZE_T stringsize = write_string_parameters(file, buffer, size);
1706 totalSize += (size_t)stringsize;
1708 buffer += stringsize;
1711 const SSIZE_T customsize = write_custom_parameters(file, buffer, size);
1714 totalSize += (size_t)customsize;
1718static ADDIN_ARGV* rdp_file_to_args(
const char* channel,
const char* values)
1722 ADDIN_ARGV* args = freerdp_addin_argv_new(0, NULL);
1725 if (!freerdp_addin_argv_add_argument(args, channel))
1728 p = CommandLineParseCommaSeparatedValues(values, &count);
1729 for (
size_t x = 0; x < count; x++)
1732 const char* val = p[x];
1733 const size_t len = strlen(val) + 8;
1734 char* str = calloc(len,
sizeof(
char));
1738 (void)_snprintf(str, len,
"device:%s", val);
1739 rc = freerdp_addin_argv_add_argument(args, str);
1744 CommandLineParserFree(p);
1748 CommandLineParserFree(p);
1749 freerdp_addin_argv_free(args);
1753BOOL freerdp_client_populate_settings_from_rdp_file(
const rdpFile* file, rdpSettings* settings)
1755 BOOL setDefaultConnectionType = TRUE;
1757 if (!file || !settings)
1760 if (~((
size_t)file->Domain))
1766 if (~((
size_t)file->Username))
1769 char* domain = NULL;
1771 if (!freerdp_parse_username(file->Username, &user, &domain))
1777 if (!(~((
size_t)file->Domain)) && domain)
1787 if (~((
size_t)file->Password))
1794 const char* address = NULL;
1798 if (~((
size_t)file->AlternateFullAddress))
1799 address = file->AlternateFullAddress;
1800 else if (~((
size_t)file->FullAddress))
1801 address = file->FullAddress;
1808 if (!freerdp_parse_hostname(address, &host, &port))
1824 if (~file->ServerPort)
1830 if (~file->DesktopSizeId)
1832 switch (file->DesktopSizeId)
1865 WLog_WARN(TAG,
"Unsupported 'desktop size id' value %" PRIu32, file->DesktopSizeId);
1870 if (~file->DesktopWidth)
1876 if (~file->DesktopHeight)
1882 if (~file->SessionBpp)
1888 if (~file->ConnectToConsole)
1891 file->ConnectToConsole != 0))
1895 if (~file->AdministrativeSession)
1898 file->AdministrativeSession != 0))
1902 if (~file->NegotiateSecurityLayer)
1905 file->NegotiateSecurityLayer != 0))
1909 if (~file->EnableCredSSPSupport)
1912 file->EnableCredSSPSupport != 0))
1916 if (~file->EnableRdsAadAuth)
1922 if (~((
size_t)file->AlternateShell))
1928 if (~((
size_t)file->ShellWorkingDirectory))
1931 FreeRDP_Settings_Keys_String targetId =
1932 (~file->RemoteApplicationMode && file->RemoteApplicationMode != 0)
1933 ? FreeRDP_RemoteApplicationWorkingDir
1934 : FreeRDP_ShellWorkingDirectory;
1940 if (~file->ScreenModeId)
1955 (file->ScreenModeId == 2) ? TRUE : FALSE))
1959 if (~(file->SmartSizing))
1962 (file->SmartSizing == 1) ? TRUE : FALSE))
1973 if (((~(file->DesktopWidth) && ~(file->DesktopHeight)) || ~(file->DesktopSizeId)) &&
1974 (file->SmartSizing == 1))
1977 file->DesktopWidth))
1980 file->DesktopHeight))
1985 if (~((
size_t)file->LoadBalanceInfo))
1987 const size_t len = strlen(file->LoadBalanceInfo);
1989 file->LoadBalanceInfo, len))
1993 if (~file->AuthenticationLevel)
2010 file->AuthenticationLevel))
2014 if (~file->ConnectionType)
2016 if (!freerdp_set_connection_type(settings, file->ConnectionType))
2018 setDefaultConnectionType = FALSE;
2021 if (~file->AudioMode)
2023 switch (file->AudioMode)
2025 case AUDIO_MODE_REDIRECT:
2031 case AUDIO_MODE_PLAY_ON_SERVER:
2037 case AUDIO_MODE_NONE:
2047 if (~file->AudioCaptureMode)
2053 if (~file->Compression)
2056 file->Compression != 0))
2060 if (~((
size_t)file->GatewayHostname))
2065 if (!freerdp_parse_hostname(file->GatewayHostname, &host, &port))
2080 if (~((
size_t)file->ResourceProvider))
2082 if (_stricmp(file->ResourceProvider, str_resourceprovider_arm) == 0)
2089 if (~((
size_t)file->WvdEndpointPool))
2092 file->WvdEndpointPool))
2096 if (~((
size_t)file->geo))
2102 if (~((
size_t)file->armpath))
2108 if (~((
size_t)file->aadtenantid))
2115 if (~((
size_t)file->diagnosticserviceurl))
2118 file->diagnosticserviceurl))
2122 if (~((
size_t)file->hubdiscoverygeourl))
2125 file->hubdiscoverygeourl))
2129 if (~((
size_t)file->activityhint))
2132 file->activityhint))
2136 if (~((
size_t)file->GatewayAccessToken))
2139 file->GatewayAccessToken))
2143 if (~file->GatewayUsageMethod)
2149 if (~file->PromptCredentialOnce)
2152 file->PromptCredentialOnce != 0))
2156 if (~file->PromptForCredentials)
2159 file->PromptForCredentials != 0))
2163 if (~file->RemoteApplicationMode)
2166 file->RemoteApplicationMode != 0))
2170 if (~((
size_t)file->RemoteApplicationProgram))
2173 file->RemoteApplicationProgram))
2177 if (~((
size_t)file->RemoteApplicationName))
2180 file->RemoteApplicationName))
2184 if (~((
size_t)file->RemoteApplicationIcon))
2187 file->RemoteApplicationIcon))
2191 if (~((
size_t)file->RemoteApplicationFile))
2194 file->RemoteApplicationFile))
2198 if (~((
size_t)file->RemoteApplicationGuid))
2201 file->RemoteApplicationGuid))
2205 if (~((
size_t)file->RemoteApplicationCmdLine))
2208 file->RemoteApplicationCmdLine))
2212 if (~file->SpanMonitors)
2218 if (~file->UseMultiMon)
2224 if (~file->AllowFontSmoothing)
2227 file->AllowFontSmoothing != 0))
2231 if (~file->DisableWallpaper)
2234 file->DisableWallpaper != 0))
2238 if (~file->DisableFullWindowDrag)
2241 file->DisableFullWindowDrag != 0))
2245 if (~file->DisableMenuAnims)
2248 file->DisableMenuAnims != 0))
2252 if (~file->DisableThemes)
2258 if (~file->AllowDesktopComposition)
2261 file->AllowDesktopComposition != 0))
2265 if (~file->BitmapCachePersistEnable)
2268 file->BitmapCachePersistEnable != 0))
2272 if (~file->DisableRemoteAppCapsCheck)
2275 file->DisableRemoteAppCapsCheck != 0))
2279 if (~file->BandwidthAutoDetect)
2281 if (file->BandwidthAutoDetect != 0)
2283 if ((~file->NetworkAutoDetect) && (file->NetworkAutoDetect == 0))
2286 "Got networkautodetect:i:%" PRIu32
" and bandwidthautodetect:i:%" PRIu32
2287 ". Correcting to networkautodetect:i:1",
2288 file->NetworkAutoDetect, file->BandwidthAutoDetect);
2290 "Add networkautodetect:i:1 to your RDP file to eliminate this warning.");
2293 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2295 setDefaultConnectionType = FALSE;
2298 (file->BandwidthAutoDetect != 0) ||
2299 (file->NetworkAutoDetect != 0)))
2303 if (~file->NetworkAutoDetect)
2305 if (file->NetworkAutoDetect != 0)
2307 if ((~file->BandwidthAutoDetect) && (file->BandwidthAutoDetect == 0))
2310 "Got networkautodetect:i:%" PRIu32
" and bandwidthautodetect:i:%" PRIu32
2311 ". Correcting to bandwidthautodetect:i:1",
2312 file->NetworkAutoDetect, file->BandwidthAutoDetect);
2314 TAG,
"Add bandwidthautodetect:i:1 to your RDP file to eliminate this warning.");
2317 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2320 setDefaultConnectionType = FALSE;
2323 (file->BandwidthAutoDetect != 0) ||
2324 (file->NetworkAutoDetect != 0)))
2328 if (~file->AutoReconnectionEnabled)
2331 file->AutoReconnectionEnabled != 0))
2335 if (~file->AutoReconnectMaxRetries)
2338 file->AutoReconnectMaxRetries))
2342 if (~file->RedirectSmartCards)
2345 file->RedirectSmartCards != 0))
2349 if (~file->RedirectWebauthN)
2352 file->RedirectWebauthN != 0))
2356 if (~file->RedirectClipboard)
2359 file->RedirectClipboard != 0))
2363 if (~file->RedirectPrinters)
2366 file->RedirectPrinters != 0))
2370 if (~file->RedirectDrives)
2376 if (~file->RedirectPosDevices)
2379 file->RedirectComPorts != 0) ||
2381 file->RedirectComPorts != 0))
2385 if (~file->RedirectComPorts)
2388 file->RedirectComPorts != 0) ||
2390 file->RedirectComPorts != 0))
2394 if (~file->RedirectLocation && (file->RedirectLocation != 0))
2400 freerdp_client_add_dynamic_channel(settings, count, (
const char*
const*)ptr);
2401 CommandLineParserFree(ptr);
2406 if (~file->RedirectDirectX)
2411 if ((~((
size_t)file->DevicesToRedirect)) && !utils_str_is_empty(file->DevicesToRedirect))
2441 if ((~((
size_t)file->DrivesToRedirect)) && !utils_str_is_empty(file->DrivesToRedirect))
2444 file->DrivesToRedirect))
2448 if ((~((
size_t)file->RedirectCameras)) && !utils_str_is_empty(file->RedirectCameras))
2450#if defined(CHANNEL_RDPECAM_CLIENT)
2454 const char*
const* cc;
2456 ADDIN_ARGV* args = rdp_file_to_args(RDPECAM_DVC_CHANNEL_NAME, file->RedirectCameras);
2461 if (~file->EncodeRedirectedVideoCapture)
2463 char encode[64] = { 0 };
2464 (void)_snprintf(encode,
sizeof(encode),
"encode:%" PRIu32,
2465 file->EncodeRedirectedVideoCapture);
2466 if (!freerdp_addin_argv_add_argument(args, encode))
2469 if (~file->RedirectedVideoCaptureEncodingQuality)
2471 char quality[64] = { 0 };
2472 (void)_snprintf(quality,
sizeof(quality),
"quality:%" PRIu32,
2473 file->RedirectedVideoCaptureEncodingQuality);
2474 if (!freerdp_addin_argv_add_argument(args, quality))
2480 status = freerdp_client_add_dynamic_channel(
2481 settings, WINPR_ASSERTING_INT_CAST(
size_t, args->argc), cnv.cc);
2482 freerdp_addin_argv_free(args);
2488 "This build does not support [MS-RDPECAM] camera redirection channel. Ignoring '%s'",
2489 key_str_camerastoredirect);
2493 if ((~((
size_t)file->UsbDevicesToRedirect)) && !utils_str_is_empty(file->UsbDevicesToRedirect))
2495#ifdef CHANNEL_URBDRC_CLIENT
2499 const char*
const* cc;
2501 ADDIN_ARGV* args = rdp_file_to_args(URBDRC_CHANNEL_NAME, file->UsbDevicesToRedirect);
2505 const BOOL status = freerdp_client_add_dynamic_channel(
2506 settings, WINPR_ASSERTING_INT_CAST(
size_t, args->argc), cnv.cc);
2507 freerdp_addin_argv_free(args);
2512 "This build does not support [MS-RDPEUSB] usb redirection channel. Ignoring '%s'",
2513 key_str_usbdevicestoredirect);
2517 if (~file->KeyboardHook)
2523 if (~(
size_t)file->SelectedMonitors)
2526 char** ptr = CommandLineParseCommaSeparatedValues(file->SelectedMonitors, &count);
2527 UINT32* list = NULL;
2531 CommandLineParserFree(ptr);
2535 if (!list && (count > 0))
2537 CommandLineParserFree(ptr);
2540 for (
size_t x = 0; x < count; x++)
2542 unsigned long val = 0;
2544 val = strtoul(ptr[x], NULL, 0);
2545 if ((val >= UINT32_MAX) && (errno != 0))
2547 CommandLineParserFree(ptr);
2551 list[x] = (UINT32)val;
2553 CommandLineParserFree(ptr);
2556 if (~file->DynamicResolution)
2558 const BOOL val = file->DynamicResolution != 0;
2565 if (~file->DesktopScaleFactor)
2568 file->DesktopScaleFactor))
2572 if (~file->VideoPlaybackMode)
2574 if (file->VideoPlaybackMode != 0)
2591 if (~((
size_t)file->PreconnectionBlob))
2594 file->PreconnectionBlob) ||
2599 if (~((
size_t)file->KdcProxyName))
2605 if (~((
size_t)file->RdgIsKdcProxy))
2608 file->RdgIsKdcProxy != 0))
2612 if (file->args->argc > 1)
2614 WCHAR* ConnectionFile =
2617 if (freerdp_client_settings_parse_command_line(settings, file->args->argc, file->args->argv,
2620 free(ConnectionFile);
2626 free(ConnectionFile);
2631 if (setDefaultConnectionType)
2633 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2640static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(
const rdpFile* file,
const char* name)
2642 BOOL bFound = FALSE;
2643 rdpFileLine* line = NULL;
2645 for (
size_t index = 0; index < file->lineCount; index++)
2647 line = &(file->lines[index]);
2649 if (line->flags & RDP_FILE_LINE_FLAG_FORMATTED)
2651 if (_stricmp(name, line->name) == 0)
2659 return (bFound) ? line : NULL;
2668int freerdp_client_rdp_file_set_string_option(rdpFile* file,
const char* name,
const char* value)
2670 return freerdp_client_rdp_file_set_string(file, name, value);
2673const char* freerdp_client_rdp_file_get_string_option(
const rdpFile* file,
const char* name)
2675 LPSTR* value = NULL;
2676 rdpFileLine* line = NULL;
2678 rdpFile* wfile = WINPR_CAST_CONST_PTR_AWAY(file, rdpFile*);
2679 if (freerdp_client_rdp_file_find_string_entry(wfile, name, &value, &line))
2681 if (value && ~(
size_t)(*value))
2684 return line->sValue;
2690int freerdp_client_rdp_file_set_integer_option(rdpFile* file,
const char* name,
int value)
2692 return freerdp_client_rdp_file_set_integer(file, name, value);
2695int freerdp_client_rdp_file_get_integer_option(
const rdpFile* file,
const char* name)
2697 DWORD* value = NULL;
2698 rdpFileLine* line = NULL;
2700 rdpFile* wfile = WINPR_CAST_CONST_PTR_AWAY(file, rdpFile*);
2701 if (freerdp_client_rdp_file_find_integer_entry(wfile, name, &value, &line))
2703 if (value && ~(*value))
2704 return WINPR_ASSERTING_INT_CAST(
int, *value);
2706 return (
int)line->iValue;
2712static void freerdp_client_file_string_check_free(LPSTR str)
2718rdpFile* freerdp_client_rdp_file_new(
void)
2720 return freerdp_client_rdp_file_new_ex(0);
2723rdpFile* freerdp_client_rdp_file_new_ex(DWORD flags)
2725 rdpFile* file = (rdpFile*)calloc(1,
sizeof(rdpFile));
2730 file->flags = flags;
2732 FillMemory(file,
sizeof(rdpFile), 0xFF);
2734 file->lineCount = 0;
2735 file->lineSize = 32;
2736 file->GatewayProfileUsageMethod = 1;
2737 file->lines = (rdpFileLine*)calloc(file->lineSize,
sizeof(rdpFileLine));
2739 file->args = freerdp_addin_argv_new(0, NULL);
2740 if (!file->lines || !file->args)
2743 if (!freerdp_client_add_option(file,
"freerdp"))
2748 WINPR_PRAGMA_DIAG_PUSH
2749 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
2750 freerdp_client_rdp_file_free(file);
2751 WINPR_PRAGMA_DIAG_POP
2754void freerdp_client_rdp_file_free(rdpFile* file)
2758 if (file->lineCount)
2760 for (
size_t i = 0; i < file->lineCount; i++)
2762 free(file->lines[i].name);
2763 free(file->lines[i].sValue);
2768 freerdp_addin_argv_free(file->args);
2770 freerdp_client_file_string_check_free(file->Username);
2771 freerdp_client_file_string_check_free(file->Domain);
2772 freerdp_client_file_string_check_free(file->Password);
2773 freerdp_client_file_string_check_free(file->FullAddress);
2774 freerdp_client_file_string_check_free(file->AlternateFullAddress);
2775 freerdp_client_file_string_check_free(file->UsbDevicesToRedirect);
2776 freerdp_client_file_string_check_free(file->RedirectCameras);
2777 freerdp_client_file_string_check_free(file->SelectedMonitors);
2778 freerdp_client_file_string_check_free(file->LoadBalanceInfo);
2779 freerdp_client_file_string_check_free(file->RemoteApplicationName);
2780 freerdp_client_file_string_check_free(file->RemoteApplicationIcon);
2781 freerdp_client_file_string_check_free(file->RemoteApplicationProgram);
2782 freerdp_client_file_string_check_free(file->RemoteApplicationFile);
2783 freerdp_client_file_string_check_free(file->RemoteApplicationGuid);
2784 freerdp_client_file_string_check_free(file->RemoteApplicationCmdLine);
2785 freerdp_client_file_string_check_free(file->AlternateShell);
2786 freerdp_client_file_string_check_free(file->ShellWorkingDirectory);
2787 freerdp_client_file_string_check_free(file->GatewayHostname);
2788 freerdp_client_file_string_check_free(file->GatewayAccessToken);
2789 freerdp_client_file_string_check_free(file->KdcProxyName);
2790 freerdp_client_file_string_check_free(file->DrivesToRedirect);
2791 freerdp_client_file_string_check_free(file->DevicesToRedirect);
2792 freerdp_client_file_string_check_free(file->WinPosStr);
2793 freerdp_client_file_string_check_free(file->ResourceProvider);
2794 freerdp_client_file_string_check_free(file->WvdEndpointPool);
2795 freerdp_client_file_string_check_free(file->geo);
2796 freerdp_client_file_string_check_free(file->armpath);
2797 freerdp_client_file_string_check_free(file->aadtenantid);
2798 freerdp_client_file_string_check_free(file->diagnosticserviceurl);
2799 freerdp_client_file_string_check_free(file->hubdiscoverygeourl);
2800 freerdp_client_file_string_check_free(file->activityhint);
2805void freerdp_client_rdp_file_set_callback_context(rdpFile* file,
void* context)
2807 file->context = context;
#define LOCATION_CHANNEL_NAME
FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id)
Returns a UINT32 settings value.
FREERDP_API BOOL freerdp_settings_set_string(rdpSettings *settings, FreeRDP_Settings_Keys_String id, const char *param)
Sets a string settings value. The param is copied.
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.
FREERDP_API BOOL freerdp_settings_set_pointer_len(rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id, const void *data, size_t len)
Set a pointer to value data.
FREERDP_API void * freerdp_settings_get_pointer_writable(rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id)
Returns a mutable pointer settings value.
FREERDP_API WCHAR * freerdp_settings_get_string_as_utf16(const rdpSettings *settings, FreeRDP_Settings_Keys_String id, size_t *pCharLen)
Return an allocated UTF16 string.
FREERDP_API BOOL freerdp_set_gateway_usage_method(rdpSettings *settings, UINT32 GatewayUsageMethod)
FREERDP_API BOOL freerdp_settings_set_string_from_utf16(rdpSettings *settings, FreeRDP_Settings_Keys_String id, const WCHAR *param)
Sets a string settings value. The param is converted to UTF-8 and the copy stored.
FREERDP_API const void * freerdp_settings_get_pointer(const rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id)
Returns a immutable pointer settings value.
FREERDP_API BOOL freerdp_settings_set_uint32(rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id, UINT32 param)
Sets a UINT32 settings value.
FREERDP_API const char * freerdp_settings_get_string(const rdpSettings *settings, FreeRDP_Settings_Keys_String id)
Returns a immutable string settings value.
FREERDP_API BOOL freerdp_settings_set_bool(rdpSettings *settings, FreeRDP_Settings_Keys_Bool id, BOOL param)
Sets a BOOL settings value.