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>
52 #include <winpr/crt.h>
53 #include <winpr/path.h>
54 #include <freerdp/log.h>
55 #define TAG CLIENT_TAG("common")
59 static 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
81 typedef 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;
229 static const char key_str_username[] =
"username";
230 static const char key_str_domain[] =
"domain";
231 static const char key_str_password[] =
"password";
232 static const char key_str_full_address[] =
"full address";
233 static const char key_str_alternate_full_address[] =
"alternate full address";
234 static const char key_str_usbdevicestoredirect[] =
"usbdevicestoredirect";
235 static const char key_str_camerastoredirect[] =
"camerastoredirect";
236 static const char key_str_loadbalanceinfo[] =
"loadbalanceinfo";
237 static const char key_str_remoteapplicationname[] =
"remoteapplicationname";
238 static const char key_str_remoteapplicationicon[] =
"remoteapplicationicon";
239 static const char key_str_remoteapplicationprogram[] =
"remoteapplicationprogram";
240 static const char key_str_remoteapplicationfile[] =
"remoteapplicationfile";
241 static const char key_str_remoteapplicationguid[] =
"remoteapplicationguid";
242 static const char key_str_remoteapplicationcmdline[] =
"remoteapplicationcmdline";
243 static const char key_str_alternate_shell[] =
"alternate shell";
244 static const char key_str_shell_working_directory[] =
"shell working directory";
245 static const char key_str_gatewayhostname[] =
"gatewayhostname";
246 static const char key_str_gatewayaccesstoken[] =
"gatewayaccesstoken";
247 static const char key_str_resourceprovider[] =
"resourceprovider";
248 static const char str_resourceprovider_arm[] =
"arm";
249 static const char key_str_kdcproxyname[] =
"kdcproxyname";
250 static const char key_str_drivestoredirect[] =
"drivestoredirect";
251 static const char key_str_devicestoredirect[] =
"devicestoredirect";
252 static const char key_str_winposstr[] =
"winposstr";
253 static const char key_str_pcb[] =
"pcb";
254 static const char key_str_selectedmonitors[] =
"selectedmonitors";
256 static const char key_str_wvd[] =
"wvd endpoint pool";
257 static const char key_str_geo[] =
"geo";
258 static const char key_str_armpath[] =
"armpath";
259 static const char key_str_aadtenantid[] =
"aadtenantid";
261 static const char key_str_diagnosticserviceurl[] =
"diagnosticserviceurl";
262 static const char key_str_hubdiscoverygeourl[] =
"hubdiscoverygeourl";
264 static const char key_str_activityhint[] =
"activityhint";
266 static const char key_int_rdgiskdcproxy[] =
"rdgiskdcproxy";
267 static const char key_int_use_redirection_server_name[] =
"use redirection server name";
268 static const char key_int_gatewaycredentialssource[] =
"gatewaycredentialssource";
269 static const char key_int_gatewayprofileusagemethod[] =
"gatewayprofileusagemethod";
270 static const char key_int_gatewayusagemethod[] =
"gatewayusagemethod";
271 static const char key_int_disableremoteappcapscheck[] =
"disableremoteappcapscheck";
272 static const char key_int_disableconnectionsharing[] =
"disableconnectionsharing";
273 static const char key_int_remoteapplicationexpandworkingdir[] =
"remoteapplicationexpandworkingdir";
274 static const char key_int_remoteapplicationexpandcmdline[] =
"remoteapplicationexpandcmdline";
275 static const char key_int_remoteapplicationmode[] =
"remoteapplicationmode";
276 static const char key_int_enablecredsspsupport[] =
"enablecredsspsupport";
277 static const char key_int_enablerdsaadauth[] =
"enablerdsaadauth";
278 static const char key_int_negotiate_security_layer[] =
"negotiate security layer";
279 static const char key_int_prompt_for_credentials[] =
"prompt for credentials";
280 static const char key_int_promptcredentialonce[] =
"promptcredentialonce";
281 static const char key_int_authentication_level[] =
"authentication level";
282 static const char key_int_public_mode[] =
"public mode";
283 static const char key_int_autoreconnect_max_retries[] =
"autoreconnect max retries";
284 static const char key_int_autoreconnection_enabled[] =
"autoreconnection enabled";
285 static const char key_int_administrative_session[] =
"administrative session";
286 static const char key_int_connect_to_console[] =
"connect to console";
287 static const char key_int_disableclipboardredirection[] =
"disableclipboardredirection";
288 static const char key_int_disableprinterredirection[] =
"disableprinterredirection";
289 static const char key_int_redirectdirectx[] =
"redirectdirectx";
290 static const char key_int_redirectposdevices[] =
"redirectposdevices";
291 static const char key_int_redirectclipboard[] =
"redirectclipboard";
292 static const char key_int_redirectsmartcards[] =
"redirectsmartcards";
293 static const char key_int_redirectcomports[] =
"redirectcomports";
294 static const char key_int_redirectlocation[] =
"redirectlocation";
295 static const char key_int_redirectprinters[] =
"redirectprinters";
296 static const char key_int_redirectdrives[] =
"redirectdrives";
297 static const char key_int_server_port[] =
"server port";
298 static const char key_int_bitmapcachepersistenable[] =
"bitmapcachepersistenable";
299 static const char key_int_bitmapcachesize[] =
"bitmapcachesize";
300 static const char key_int_disable_cursor_setting[] =
"disable cursor setting";
301 static const char key_int_disable_themes[] =
"disable themes";
302 static const char key_int_disable_menu_anims[] =
"disable menu anims";
303 static const char key_int_disable_full_window_drag[] =
"disable full window drag";
304 static const char key_int_allow_desktop_composition[] =
"allow desktop composition";
305 static const char key_int_allow_font_smoothing[] =
"allow font smoothing";
306 static const char key_int_disable_wallpaper[] =
"disable wallpaper";
307 static const char key_int_enableworkspacereconnect[] =
"enableworkspacereconnect";
308 static const char key_int_workspaceid[] =
"workspaceid";
309 static const char key_int_displayconnectionbar[] =
"displayconnectionbar";
310 static const char key_int_pinconnectionbar[] =
"pinconnectionbar";
311 static const char key_int_bandwidthautodetect[] =
"bandwidthautodetect";
312 static const char key_int_networkautodetect[] =
"networkautodetect";
313 static const char key_int_connection_type[] =
"connection type";
314 static const char key_int_videoplaybackmode[] =
"videoplaybackmode";
315 static const char key_int_redirected_video_capture_encoding_quality[] =
316 "redirected video capture encoding quality";
317 static const char key_int_encode_redirected_video_capture[] =
"encode redirected video capture";
318 static const char key_int_audiocapturemode[] =
"audiocapturemode";
319 static const char key_int_audioqualitymode[] =
"audioqualitymode";
320 static const char key_int_audiomode[] =
"audiomode";
321 static const char key_int_disable_ctrl_alt_del[] =
"disable ctrl+alt+del";
322 static const char key_int_keyboardhook[] =
"keyboardhook";
323 static const char key_int_compression[] =
"compression";
324 static const char key_int_desktopscalefactor[] =
"desktopscalefactor";
325 static const char key_int_session_bpp[] =
"session bpp";
326 static const char key_int_desktop_size_id[] =
"desktop size id";
327 static const char key_int_desktopheight[] =
"desktopheight";
328 static const char key_int_desktopwidth[] =
"desktopwidth";
329 static const char key_int_superpanaccelerationfactor[] =
"superpanaccelerationfactor";
330 static const char key_int_enablesuperpan[] =
"enablesuperpan";
331 static const char key_int_dynamic_resolution[] =
"dynamic resolution";
332 static const char key_int_smart_sizing[] =
"smart sizing";
333 static const char key_int_span_monitors[] =
"span monitors";
334 static const char key_int_screen_mode_id[] =
"screen mode id";
335 static const char key_int_singlemoninwindowedmode[] =
"singlemoninwindowedmode";
336 static const char key_int_maximizetocurrentdisplays[] =
"maximizetocurrentdisplays";
337 static const char key_int_use_multimon[] =
"use multimon";
338 static const char key_int_redirectwebauthn[] =
"redirectwebauthn";
340 static BOOL utils_str_is_empty(
const char* str)
344 if (strlen(str) == 0)
349 static SSIZE_T freerdp_client_rdp_file_add_line(rdpFile* file);
350 static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(
const rdpFile* file,
352 static void freerdp_client_file_string_check_free(LPSTR str);
354 static 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))
523 static 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))
618 static 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;
664 static 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);
698 static 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;
749 static BOOL freerdp_client_add_option(rdpFile* file,
const char* option)
751 return freerdp_addin_argv_add_argument(file->args, option);
754 static 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)
761 rdpFileLine* new_line = NULL;
762 new_size = file->lineSize * 2;
763 new_line = (rdpFileLine*)realloc(file->lines, new_size *
sizeof(rdpFileLine));
768 file->lines = new_line;
769 file->lineSize = new_size;
772 ZeroMemory(&(file->lines[file->lineCount]),
sizeof(rdpFileLine));
773 file->lines[file->lineCount].index = (size_t)index;
778 static BOOL freerdp_client_parse_rdp_file_string(rdpFile* file,
char* name,
char* value)
780 return freerdp_client_rdp_file_set_string(file, name, value);
783 static BOOL freerdp_client_parse_rdp_file_option(rdpFile* file,
const char* option)
785 return freerdp_client_add_option(file, option);
788 BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file,
const BYTE* buffer,
size_t size)
790 return freerdp_client_parse_rdp_file_buffer_ex(file, buffer, size, NULL);
793 static BOOL trim(
char** strptr)
799 start = str = *strptr;
802 if (!(~((
size_t)str)))
804 end = str + strlen(str) - 1;
806 while (isspace(*str))
809 while ((end > str) && isspace(*end))
816 *strptr = _strdup(str);
818 return *strptr != NULL;
824 static BOOL trim_strings(rdpFile* file)
826 if (!trim(&file->Username))
828 if (!trim(&file->Domain))
830 if (!trim(&file->AlternateFullAddress))
832 if (!trim(&file->FullAddress))
834 if (!trim(&file->UsbDevicesToRedirect))
836 if (!trim(&file->RedirectCameras))
838 if (!trim(&file->LoadBalanceInfo))
840 if (!trim(&file->GatewayHostname))
842 if (!trim(&file->GatewayAccessToken))
844 if (!trim(&file->RemoteApplicationName))
846 if (!trim(&file->RemoteApplicationIcon))
848 if (!trim(&file->RemoteApplicationProgram))
850 if (!trim(&file->RemoteApplicationFile))
852 if (!trim(&file->RemoteApplicationGuid))
854 if (!trim(&file->RemoteApplicationCmdLine))
856 if (!trim(&file->AlternateShell))
858 if (!trim(&file->ShellWorkingDirectory))
860 if (!trim(&file->DrivesToRedirect))
862 if (!trim(&file->DevicesToRedirect))
864 if (!trim(&file->DevicesToRedirect))
866 if (!trim(&file->WinPosStr))
868 if (!trim(&file->PreconnectionBlob))
870 if (!trim(&file->KdcProxyName))
872 if (!trim(&file->SelectedMonitors))
875 for (
size_t i = 0; i < file->lineCount; ++i)
877 rdpFileLine* curLine = &file->lines[i];
878 if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_STRING)
880 if (!trim(&curLine->sValue))
888 BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file,
const BYTE* buffer,
size_t size,
889 rdp_file_fkt_parse parse)
895 char* context = NULL;
908 if ((buffer[0] == BOM_UTF16_LE[0]) && (buffer[1] == BOM_UTF16_LE[1]))
910 LPCWSTR uc = (LPCWSTR)(&buffer[2]);
911 size = size /
sizeof(WCHAR) - 1;
913 copy = ConvertWCharNToUtf8Alloc(uc, size, NULL);
916 WLog_ERR(TAG,
"Failed to convert RDP file from UCS2 to UTF8");
922 copy = calloc(1, size +
sizeof(BYTE));
927 memcpy(copy, buffer, size);
930 line = strtok_s(copy,
"\r\n", &context);
934 length = strnlen(line, size);
941 if (!freerdp_client_parse_rdp_file_option(file, line))
947 d1 = strchr(line,
':');
953 d2 = strchr(type,
':');
966 if (parse && parse(file->context, name, *type, value))
969 else if (*type ==
'i')
972 if (!freerdp_client_parse_rdp_file_integer(file, name, value))
975 else if (*type ==
's')
978 if (!freerdp_client_parse_rdp_file_string(file, name, value))
981 else if (*type ==
'b')
984 WLog_ERR(TAG,
"Unsupported RDP file binary option %s [value=%s]", name, value);
989 line = strtok_s(NULL,
"\r\n", &context);
992 rc = trim_strings(file);
998 BOOL freerdp_client_parse_rdp_file(rdpFile* file,
const char* name)
1000 return freerdp_client_parse_rdp_file_ex(file, name, NULL);
1003 BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file,
const char* name, rdp_file_fkt_parse parse)
1006 BYTE* buffer = NULL;
1008 size_t read_size = 0;
1009 INT64 file_size = 0;
1010 const char* fname = name;
1015 if (_strnicmp(fname,
"file://", 7) == 0)
1018 fp = winpr_fopen(fname,
"r");
1021 WLog_ERR(TAG,
"Failed to open RDP file %s", name);
1025 (void)_fseeki64(fp, 0, SEEK_END);
1026 file_size = _ftelli64(fp);
1027 (void)_fseeki64(fp, 0, SEEK_SET);
1031 WLog_ERR(TAG,
"RDP file %s is empty", name);
1036 buffer = (BYTE*)malloc((
size_t)file_size + 2);
1044 read_size = fread(buffer, (
size_t)file_size, 1, fp);
1049 read_size = (size_t)file_size;
1056 WLog_ERR(TAG,
"Could not read from RDP file %s", name);
1061 buffer[file_size] =
'\0';
1062 buffer[file_size + 1] =
'\0';
1063 status = freerdp_client_parse_rdp_file_buffer_ex(file, buffer, (
size_t)file_size, parse);
1068 static INLINE BOOL FILE_POPULATE_STRING(
char** _target,
const rdpSettings* _settings,
1069 FreeRDP_Settings_Keys_String _option)
1071 WINPR_ASSERT(_target);
1072 WINPR_ASSERT(_settings);
1075 freerdp_client_file_string_check_free(*_target);
1076 *_target = (
void*)~((
size_t)NULL);
1079 *_target = _strdup(str);
1086 static char* freerdp_client_channel_args_to_string(
const rdpSettings* settings,
const char* channel,
1089 ADDIN_ARGV* args = freerdp_dynamic_channel_collection_find(settings, channel);
1090 const char* filters[] = { option };
1091 if (!args || (args->argc < 2))
1094 return CommandLineToCommaSeparatedValuesEx(args->argc - 1, args->argv + 1, filters,
1095 ARRAYSIZE(filters));
1098 static BOOL rdp_opt_duplicate(
const rdpSettings* _settings, FreeRDP_Settings_Keys_String _id,
1101 WINPR_ASSERT(_settings);
1107 *_key = _strdup(tmp);
1115 BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file,
const rdpSettings* settings)
1117 FreeRDP_Settings_Keys_String index = FreeRDP_STRING_UNUSED;
1118 UINT32 LoadBalanceInfoLength = 0;
1119 const char* GatewayHostname = NULL;
1120 char* redirectCameras = NULL;
1122 if (!file || !settings)
1125 if (!FILE_POPULATE_STRING(&file->Domain, settings, FreeRDP_Domain) ||
1126 !FILE_POPULATE_STRING(&file->Username, settings, FreeRDP_Username) ||
1127 !FILE_POPULATE_STRING(&file->Password, settings, FreeRDP_Password) ||
1128 !FILE_POPULATE_STRING(&file->FullAddress, settings, FreeRDP_ServerHostname) ||
1129 !FILE_POPULATE_STRING(&file->AlternateFullAddress, settings, FreeRDP_ServerHostname) ||
1130 !FILE_POPULATE_STRING(&file->AlternateShell, settings, FreeRDP_AlternateShell) ||
1131 !FILE_POPULATE_STRING(&file->DrivesToRedirect, settings, FreeRDP_DrivesToRedirect))
1140 file->DynamicResolution = WINPR_ASSERTING_INT_CAST(
1142 file->VideoPlaybackMode = WINPR_ASSERTING_INT_CAST(
1149 file->ConnectToConsole = WINPR_ASSERTING_INT_CAST(
1151 file->NegotiateSecurityLayer = WINPR_ASSERTING_INT_CAST(
1153 file->EnableCredSSPSupport =
1155 file->EnableRdsAadAuth =
1159 index = FreeRDP_RemoteApplicationWorkingDir;
1161 index = FreeRDP_ShellWorkingDirectory;
1162 if (!FILE_POPULATE_STRING(&file->ShellWorkingDirectory, settings, index))
1169 if (LoadBalanceInfoLength > 0)
1171 const BYTE* LoadBalanceInfo =
1173 file->LoadBalanceInfo = calloc(LoadBalanceInfoLength + 1, 1);
1174 if (!file->LoadBalanceInfo)
1176 memcpy(file->LoadBalanceInfo, LoadBalanceInfo, LoadBalanceInfoLength);
1180 file->AudioMode = AUDIO_MODE_REDIRECT;
1182 file->AudioMode = AUDIO_MODE_PLAY_ON_SERVER;
1184 file->AudioMode = AUDIO_MODE_NONE;
1189 if (GatewayHostname)
1192 freerdp_client_file_string_check_free(file->GatewayHostname);
1193 if (GatewayPort == 443)
1194 file->GatewayHostname = _strdup(GatewayHostname);
1197 int length = _scprintf(
"%s:%" PRIu32, GatewayHostname, GatewayPort);
1201 file->GatewayHostname = (
char*)malloc((
size_t)length + 1);
1202 if (!file->GatewayHostname)
1205 if (sprintf_s(file->GatewayHostname, (
size_t)length + 1,
"%s:%" PRIu32, GatewayHostname,
1209 if (!file->GatewayHostname)
1214 file->ResourceProvider = _strdup(str_resourceprovider_arm);
1216 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdWvdEndpointPool, &file->WvdEndpointPool))
1218 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdGeo, &file->geo))
1220 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdArmpath, &file->armpath))
1222 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdAadtenantid, &file->aadtenantid))
1224 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdDiagnosticserviceurl,
1225 &file->diagnosticserviceurl))
1227 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdHubdiscoverygeourl,
1228 &file->hubdiscoverygeourl))
1230 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdActivityhint, &file->activityhint))
1233 file->AudioCaptureMode =
1235 file->BitmapCachePersistEnable = WINPR_ASSERTING_INT_CAST(
1237 file->Compression = WINPR_ASSERTING_INT_CAST(
1241 file->GatewayCredentialsSource =
1243 file->PromptCredentialOnce = WINPR_ASSERTING_INT_CAST(
1245 file->PromptForCredentials = WINPR_ASSERTING_INT_CAST(
1247 file->RemoteApplicationMode = WINPR_ASSERTING_INT_CAST(
1249 if (!FILE_POPULATE_STRING(&file->GatewayAccessToken, settings, FreeRDP_GatewayAccessToken) ||
1250 !FILE_POPULATE_STRING(&file->RemoteApplicationProgram, settings,
1251 FreeRDP_RemoteApplicationProgram) ||
1252 !FILE_POPULATE_STRING(&file->RemoteApplicationName, settings,
1253 FreeRDP_RemoteApplicationName) ||
1254 !FILE_POPULATE_STRING(&file->RemoteApplicationIcon, settings,
1255 FreeRDP_RemoteApplicationIcon) ||
1256 !FILE_POPULATE_STRING(&file->RemoteApplicationFile, settings,
1257 FreeRDP_RemoteApplicationFile) ||
1258 !FILE_POPULATE_STRING(&file->RemoteApplicationGuid, settings,
1259 FreeRDP_RemoteApplicationGuid) ||
1260 !FILE_POPULATE_STRING(&file->RemoteApplicationCmdLine, settings,
1261 FreeRDP_RemoteApplicationCmdLine))
1263 file->SpanMonitors =
1267 file->AllowDesktopComposition = WINPR_ASSERTING_INT_CAST(
1269 file->AllowFontSmoothing = WINPR_ASSERTING_INT_CAST(
1271 file->DisableWallpaper = WINPR_ASSERTING_INT_CAST(
1273 file->DisableFullWindowDrag = WINPR_ASSERTING_INT_CAST(
1275 file->DisableMenuAnims = WINPR_ASSERTING_INT_CAST(
1277 file->DisableThemes = WINPR_ASSERTING_INT_CAST(
1280 CONNECTION_TYPE_AUTODETECT)
1283 file->NetworkAutoDetect =
1285 file->AutoReconnectionEnabled = WINPR_ASSERTING_INT_CAST(
1287 file->RedirectSmartCards = WINPR_ASSERTING_INT_CAST(
1289 file->RedirectWebauthN = WINPR_ASSERTING_INT_CAST(
1293 freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"device:");
1294 if (redirectCameras)
1297 freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"encode:");
1298 file->EncodeRedirectedVideoCapture = 0;
1301 unsigned long val = 0;
1303 val = strtoul(str, NULL, 0);
1304 if ((val < UINT32_MAX) && (errno == 0))
1305 file->EncodeRedirectedVideoCapture = (UINT32)val;
1309 str = freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"quality:");
1310 file->RedirectedVideoCaptureEncodingQuality = 0;
1313 unsigned long val = 0;
1315 val = strtoul(str, NULL, 0);
1316 if ((val <= 2) && (errno == 0))
1318 file->RedirectedVideoCaptureEncodingQuality = (UINT32)val;
1323 file->RedirectCameras = redirectCameras;
1325 #ifdef CHANNEL_URBDRC_CLIENT
1327 freerdp_client_channel_args_to_string(settings, URBDRC_CHANNEL_NAME,
"device:");
1329 file->UsbDevicesToRedirect = redirectUsb;
1332 file->RedirectClipboard =
1339 file->RedirectLocation =
1341 if (!FILE_POPULATE_STRING(&file->DrivesToRedirect, settings, FreeRDP_DrivesToRedirect) ||
1342 !FILE_POPULATE_STRING(&file->PreconnectionBlob, settings, FreeRDP_PreconnectionBlob) ||
1343 !FILE_POPULATE_STRING(&file->KdcProxyName, settings, FreeRDP_KerberosKdcUrl))
1351 size_t size = count * (10 + 1) + 1;
1353 char* str = calloc(size,
sizeof(
char));
1354 for (UINT32 x = 0; x < count; x++)
1356 int rc = _snprintf(&str[offset], size - offset,
"%" PRIu32
",", MonitorIds[x]);
1362 offset += (size_t)rc;
1365 str[offset - 1] =
'\0';
1366 freerdp_client_file_string_check_free(file->SelectedMonitors);
1367 file->SelectedMonitors = str;
1375 BOOL freerdp_client_write_rdp_file(
const rdpFile* file,
const char* name, BOOL unicode)
1378 WCHAR* unicodestr = NULL;
1383 const size_t size = freerdp_client_write_rdp_file_buffer(file, NULL, 0);
1386 char* buffer = calloc(size + 1ULL,
sizeof(
char));
1388 if (freerdp_client_write_rdp_file_buffer(file, buffer, size + 1) != size)
1390 WLog_ERR(TAG,
"freerdp_client_write_rdp_file: error writing to output buffer");
1395 FILE* fp = winpr_fopen(name,
"w+b");
1402 unicodestr = ConvertUtf8NToWCharAlloc(buffer, size, &len);
1412 if ((fwrite(BOM_UTF16_LE,
sizeof(BYTE), 2, fp) != 2) ||
1413 (fwrite(unicodestr,
sizeof(WCHAR), len, fp) != len))
1425 if (fwrite(buffer, 1, size, fp) != size)
1434 status = fclose(fp);
1438 return (status == 0) ? TRUE : FALSE;
1441 WINPR_ATTR_FORMAT_ARG(3, 4)
1442 static SSIZE_T freerdp_client_write_setting_to_buffer(
char** buffer,
size_t* bufferSize,
1443 WINPR_FORMAT_ARG const
char* fmt, ...)
1450 if (!buffer || !bufferSize || !fmt)
1454 bufSize = *bufferSize;
1457 len = vsnprintf(buf, bufSize, fmt, ap);
1466 if (!buf && !bufSize)
1473 if (bufSize >= (
size_t)len)
1475 *bufferSize -= (size_t)len;
1476 buf[len - 1] =
'\n';
1477 *buffer = buf + len;
1485 size_t freerdp_client_write_rdp_file_buffer(
const rdpFile* file,
char* buffer,
size_t size)
1487 size_t totalSize = 0;
1493 if ((!buffer || !size) && (buffer || size))
1496 #define WRITE_SETTING_(fmt_, ...) \
1498 SSIZE_T res = freerdp_client_write_setting_to_buffer(&buffer, &size, fmt_, __VA_ARGS__); \
1501 totalSize += (size_t)res; \
1504 #define WRITE_SETTING_INT(key_, param_) \
1508 WRITE_SETTING_("%s:i:%" PRIu32, key_, param_) \
1511 #define WRITE_SETTING_STR(key_, param_) \
1514 if (~(size_t)(param_)) \
1515 WRITE_SETTING_("%s:s:%s", key_, param_) \
1519 WRITE_SETTING_INT(key_int_use_multimon, file->UseMultiMon);
1520 WRITE_SETTING_INT(key_int_maximizetocurrentdisplays, file->MaximizeToCurrentDisplays);
1521 WRITE_SETTING_INT(key_int_singlemoninwindowedmode, file->SingleMonInWindowedMode);
1522 WRITE_SETTING_INT(key_int_screen_mode_id, file->ScreenModeId);
1523 WRITE_SETTING_INT(key_int_span_monitors, file->SpanMonitors);
1524 WRITE_SETTING_INT(key_int_smart_sizing, file->SmartSizing);
1525 WRITE_SETTING_INT(key_int_dynamic_resolution, file->DynamicResolution);
1526 WRITE_SETTING_INT(key_int_enablesuperpan, file->EnableSuperSpan);
1527 WRITE_SETTING_INT(key_int_superpanaccelerationfactor, file->SuperSpanAccelerationFactor);
1528 WRITE_SETTING_INT(key_int_desktopwidth, file->DesktopWidth);
1529 WRITE_SETTING_INT(key_int_desktopheight, file->DesktopHeight);
1530 WRITE_SETTING_INT(key_int_desktop_size_id, file->DesktopSizeId);
1531 WRITE_SETTING_INT(key_int_session_bpp, file->SessionBpp);
1532 WRITE_SETTING_INT(key_int_desktopscalefactor, file->DesktopScaleFactor);
1533 WRITE_SETTING_INT(key_int_compression, file->Compression);
1534 WRITE_SETTING_INT(key_int_keyboardhook, file->KeyboardHook);
1535 WRITE_SETTING_INT(key_int_disable_ctrl_alt_del, file->DisableCtrlAltDel);
1536 WRITE_SETTING_INT(key_int_audiomode, file->AudioMode);
1537 WRITE_SETTING_INT(key_int_audioqualitymode, file->AudioQualityMode);
1538 WRITE_SETTING_INT(key_int_audiocapturemode, file->AudioCaptureMode);
1539 WRITE_SETTING_INT(key_int_encode_redirected_video_capture, file->EncodeRedirectedVideoCapture);
1540 WRITE_SETTING_INT(key_int_redirected_video_capture_encoding_quality,
1541 file->RedirectedVideoCaptureEncodingQuality);
1542 WRITE_SETTING_INT(key_int_videoplaybackmode, file->VideoPlaybackMode);
1543 WRITE_SETTING_INT(key_int_connection_type, file->ConnectionType);
1544 WRITE_SETTING_INT(key_int_networkautodetect, file->NetworkAutoDetect);
1545 WRITE_SETTING_INT(key_int_bandwidthautodetect, file->BandwidthAutoDetect);
1546 WRITE_SETTING_INT(key_int_pinconnectionbar, file->PinConnectionBar);
1547 WRITE_SETTING_INT(key_int_displayconnectionbar, file->DisplayConnectionBar);
1548 WRITE_SETTING_INT(key_int_workspaceid, file->WorkspaceId);
1549 WRITE_SETTING_INT(key_int_enableworkspacereconnect, file->EnableWorkspaceReconnect);
1550 WRITE_SETTING_INT(key_int_disable_wallpaper, file->DisableWallpaper);
1551 WRITE_SETTING_INT(key_int_allow_font_smoothing, file->AllowFontSmoothing);
1552 WRITE_SETTING_INT(key_int_allow_desktop_composition, file->AllowDesktopComposition);
1553 WRITE_SETTING_INT(key_int_disable_full_window_drag, file->DisableFullWindowDrag);
1554 WRITE_SETTING_INT(key_int_disable_menu_anims, file->DisableMenuAnims);
1555 WRITE_SETTING_INT(key_int_disable_themes, file->DisableThemes);
1556 WRITE_SETTING_INT(key_int_disable_cursor_setting, file->DisableCursorSetting);
1557 WRITE_SETTING_INT(key_int_bitmapcachesize, file->BitmapCacheSize);
1558 WRITE_SETTING_INT(key_int_bitmapcachepersistenable, file->BitmapCachePersistEnable);
1559 WRITE_SETTING_INT(key_int_server_port, file->ServerPort);
1560 WRITE_SETTING_INT(key_int_redirectdrives, file->RedirectDrives);
1561 WRITE_SETTING_INT(key_int_redirectprinters, file->RedirectPrinters);
1562 WRITE_SETTING_INT(key_int_redirectcomports, file->RedirectComPorts);
1563 WRITE_SETTING_INT(key_int_redirectlocation, file->RedirectLocation);
1564 WRITE_SETTING_INT(key_int_redirectsmartcards, file->RedirectSmartCards);
1565 WRITE_SETTING_INT(key_int_redirectclipboard, file->RedirectClipboard);
1566 WRITE_SETTING_INT(key_int_redirectposdevices, file->RedirectPosDevices);
1567 WRITE_SETTING_INT(key_int_redirectdirectx, file->RedirectDirectX);
1568 WRITE_SETTING_INT(key_int_disableprinterredirection, file->DisablePrinterRedirection);
1569 WRITE_SETTING_INT(key_int_disableclipboardredirection, file->DisableClipboardRedirection);
1570 WRITE_SETTING_INT(key_int_connect_to_console, file->ConnectToConsole);
1571 WRITE_SETTING_INT(key_int_administrative_session, file->AdministrativeSession);
1572 WRITE_SETTING_INT(key_int_autoreconnection_enabled, file->AutoReconnectionEnabled);
1573 WRITE_SETTING_INT(key_int_autoreconnect_max_retries, file->AutoReconnectMaxRetries);
1574 WRITE_SETTING_INT(key_int_public_mode, file->PublicMode);
1575 WRITE_SETTING_INT(key_int_authentication_level, file->AuthenticationLevel);
1576 WRITE_SETTING_INT(key_int_promptcredentialonce, file->PromptCredentialOnce);
1577 WRITE_SETTING_INT(key_int_prompt_for_credentials, file->PromptForCredentials);
1578 WRITE_SETTING_INT(key_int_negotiate_security_layer, file->NegotiateSecurityLayer);
1579 WRITE_SETTING_INT(key_int_enablecredsspsupport, file->EnableCredSSPSupport);
1580 WRITE_SETTING_INT(key_int_enablerdsaadauth, file->EnableRdsAadAuth);
1581 WRITE_SETTING_INT(key_int_remoteapplicationmode, file->RemoteApplicationMode);
1582 WRITE_SETTING_INT(key_int_remoteapplicationexpandcmdline, file->RemoteApplicationExpandCmdLine);
1583 WRITE_SETTING_INT(key_int_remoteapplicationexpandworkingdir,
1584 file->RemoteApplicationExpandWorkingDir);
1585 WRITE_SETTING_INT(key_int_disableconnectionsharing, file->DisableConnectionSharing);
1586 WRITE_SETTING_INT(key_int_disableremoteappcapscheck, file->DisableRemoteAppCapsCheck);
1587 WRITE_SETTING_INT(key_int_gatewayusagemethod, file->GatewayUsageMethod);
1588 WRITE_SETTING_INT(key_int_gatewayprofileusagemethod, file->GatewayProfileUsageMethod);
1589 WRITE_SETTING_INT(key_int_gatewaycredentialssource, file->GatewayCredentialsSource);
1590 WRITE_SETTING_INT(key_int_use_redirection_server_name, file->UseRedirectionServerName);
1591 WRITE_SETTING_INT(key_int_rdgiskdcproxy, file->RdgIsKdcProxy);
1592 WRITE_SETTING_INT(key_int_redirectwebauthn, file->RedirectWebauthN);
1595 WRITE_SETTING_STR(key_str_username, file->Username);
1596 WRITE_SETTING_STR(key_str_domain, file->Domain);
1597 WRITE_SETTING_STR(key_str_password, file->Password);
1598 WRITE_SETTING_STR(key_str_full_address, file->FullAddress);
1599 WRITE_SETTING_STR(key_str_alternate_full_address, file->AlternateFullAddress);
1600 WRITE_SETTING_STR(key_str_usbdevicestoredirect, file->UsbDevicesToRedirect);
1601 WRITE_SETTING_STR(key_str_camerastoredirect, file->RedirectCameras);
1602 WRITE_SETTING_STR(key_str_loadbalanceinfo, file->LoadBalanceInfo);
1603 WRITE_SETTING_STR(key_str_remoteapplicationname, file->RemoteApplicationName);
1604 WRITE_SETTING_STR(key_str_remoteapplicationicon, file->RemoteApplicationIcon);
1605 WRITE_SETTING_STR(key_str_remoteapplicationprogram, file->RemoteApplicationProgram);
1606 WRITE_SETTING_STR(key_str_remoteapplicationfile, file->RemoteApplicationFile);
1607 WRITE_SETTING_STR(key_str_remoteapplicationguid, file->RemoteApplicationGuid);
1608 WRITE_SETTING_STR(key_str_remoteapplicationcmdline, file->RemoteApplicationCmdLine);
1609 WRITE_SETTING_STR(key_str_alternate_shell, file->AlternateShell);
1610 WRITE_SETTING_STR(key_str_shell_working_directory, file->ShellWorkingDirectory);
1611 WRITE_SETTING_STR(key_str_gatewayhostname, file->GatewayHostname);
1612 WRITE_SETTING_STR(key_str_resourceprovider, file->ResourceProvider);
1613 WRITE_SETTING_STR(key_str_wvd, file->WvdEndpointPool);
1614 WRITE_SETTING_STR(key_str_geo, file->geo);
1615 WRITE_SETTING_STR(key_str_armpath, file->armpath);
1616 WRITE_SETTING_STR(key_str_aadtenantid, file->aadtenantid);
1617 WRITE_SETTING_STR(key_str_diagnosticserviceurl, file->diagnosticserviceurl);
1618 WRITE_SETTING_STR(key_str_hubdiscoverygeourl, file->hubdiscoverygeourl);
1619 WRITE_SETTING_STR(key_str_activityhint, file->activityhint);
1620 WRITE_SETTING_STR(key_str_gatewayaccesstoken, file->GatewayAccessToken);
1621 WRITE_SETTING_STR(key_str_kdcproxyname, file->KdcProxyName);
1622 WRITE_SETTING_STR(key_str_drivestoredirect, file->DrivesToRedirect);
1623 WRITE_SETTING_STR(key_str_devicestoredirect, file->DevicesToRedirect);
1624 WRITE_SETTING_STR(key_str_winposstr, file->WinPosStr);
1625 WRITE_SETTING_STR(key_str_pcb, file->PreconnectionBlob);
1626 WRITE_SETTING_STR(key_str_selectedmonitors, file->SelectedMonitors);
1629 for (
size_t i = 0; i < file->lineCount; ++i)
1632 const rdpFileLine* curLine = &file->lines[i];
1634 if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_INTEGER)
1635 res = freerdp_client_write_setting_to_buffer(&buffer, &size,
"%s:i:%" PRIu32,
1636 curLine->name, (UINT32)curLine->iValue);
1637 else if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_STRING)
1638 res = freerdp_client_write_setting_to_buffer(&buffer, &size,
"%s:s:%s", curLine->name,
1643 totalSize += (size_t)res;
1649 static ADDIN_ARGV* rdp_file_to_args(
const char* channel,
const char* values)
1653 ADDIN_ARGV* args = freerdp_addin_argv_new(0, NULL);
1656 if (!freerdp_addin_argv_add_argument(args, channel))
1659 p = CommandLineParseCommaSeparatedValues(values, &count);
1660 for (
size_t x = 0; x < count; x++)
1663 const char* val = p[x];
1664 const size_t len = strlen(val) + 8;
1665 char* str = calloc(len,
sizeof(
char));
1669 (void)_snprintf(str, len,
"device:%s", val);
1670 rc = freerdp_addin_argv_add_argument(args, str);
1675 CommandLineParserFree(p);
1679 CommandLineParserFree(p);
1680 freerdp_addin_argv_free(args);
1684 BOOL freerdp_client_populate_settings_from_rdp_file(
const rdpFile* file, rdpSettings* settings)
1686 BOOL setDefaultConnectionType = TRUE;
1688 if (!file || !settings)
1691 if (~((
size_t)file->Domain))
1697 if (~((
size_t)file->Username))
1700 char* domain = NULL;
1702 if (!freerdp_parse_username(file->Username, &user, &domain))
1708 if (!(~((
size_t)file->Domain)) && domain)
1718 if (~((
size_t)file->Password))
1725 const char* address = NULL;
1729 if (~((
size_t)file->AlternateFullAddress))
1730 address = file->AlternateFullAddress;
1731 else if (~((
size_t)file->FullAddress))
1732 address = file->FullAddress;
1739 if (!freerdp_parse_hostname(address, &host, &port))
1755 if (~file->ServerPort)
1761 if (~file->DesktopSizeId)
1763 switch (file->DesktopSizeId)
1796 WLog_WARN(TAG,
"Unsupported 'desktop size id' value %" PRIu32, file->DesktopSizeId);
1801 if (~file->DesktopWidth)
1807 if (~file->DesktopHeight)
1813 if (~file->SessionBpp)
1819 if (~file->ConnectToConsole)
1822 file->ConnectToConsole != 0))
1826 if (~file->AdministrativeSession)
1829 file->AdministrativeSession != 0))
1833 if (~file->NegotiateSecurityLayer)
1836 file->NegotiateSecurityLayer != 0))
1840 if (~file->EnableCredSSPSupport)
1843 file->EnableCredSSPSupport != 0))
1847 if (~file->EnableRdsAadAuth)
1853 if (~((
size_t)file->AlternateShell))
1859 if (~((
size_t)file->ShellWorkingDirectory))
1862 FreeRDP_Settings_Keys_String targetId =
1863 (~file->RemoteApplicationMode && file->RemoteApplicationMode != 0)
1864 ? FreeRDP_RemoteApplicationWorkingDir
1865 : FreeRDP_ShellWorkingDirectory;
1871 if (~file->ScreenModeId)
1886 (file->ScreenModeId == 2) ? TRUE : FALSE))
1890 if (~(file->SmartSizing))
1893 (file->SmartSizing == 1) ? TRUE : FALSE))
1904 if (((~(file->DesktopWidth) && ~(file->DesktopHeight)) || ~(file->DesktopSizeId)) &&
1905 (file->SmartSizing == 1))
1908 file->DesktopWidth))
1911 file->DesktopHeight))
1916 if (~((
size_t)file->LoadBalanceInfo))
1918 const size_t len = strlen(file->LoadBalanceInfo);
1920 file->LoadBalanceInfo, len))
1924 if (~file->AuthenticationLevel)
1941 file->AuthenticationLevel))
1945 if (~file->ConnectionType)
1947 if (!freerdp_set_connection_type(settings, file->ConnectionType))
1949 setDefaultConnectionType = FALSE;
1952 if (~file->AudioMode)
1954 switch (file->AudioMode)
1956 case AUDIO_MODE_REDIRECT:
1962 case AUDIO_MODE_PLAY_ON_SERVER:
1968 case AUDIO_MODE_NONE:
1978 if (~file->AudioCaptureMode)
1984 if (~file->Compression)
1987 file->Compression != 0))
1991 if (~((
size_t)file->GatewayHostname))
1996 if (!freerdp_parse_hostname(file->GatewayHostname, &host, &port))
2011 if (~((
size_t)file->ResourceProvider))
2013 if (_stricmp(file->ResourceProvider, str_resourceprovider_arm) == 0)
2020 if (~((
size_t)file->WvdEndpointPool))
2023 file->WvdEndpointPool))
2027 if (~((
size_t)file->geo))
2033 if (~((
size_t)file->armpath))
2039 if (~((
size_t)file->aadtenantid))
2046 if (~((
size_t)file->diagnosticserviceurl))
2049 file->diagnosticserviceurl))
2053 if (~((
size_t)file->hubdiscoverygeourl))
2056 file->hubdiscoverygeourl))
2060 if (~((
size_t)file->activityhint))
2063 file->activityhint))
2067 if (~((
size_t)file->GatewayAccessToken))
2070 file->GatewayAccessToken))
2074 if (~file->GatewayUsageMethod)
2080 if (~file->PromptCredentialOnce)
2083 file->PromptCredentialOnce != 0))
2087 if (~file->PromptForCredentials)
2090 file->PromptForCredentials != 0))
2094 if (~file->RemoteApplicationMode)
2097 file->RemoteApplicationMode != 0))
2101 if (~((
size_t)file->RemoteApplicationProgram))
2104 file->RemoteApplicationProgram))
2108 if (~((
size_t)file->RemoteApplicationName))
2111 file->RemoteApplicationName))
2115 if (~((
size_t)file->RemoteApplicationIcon))
2118 file->RemoteApplicationIcon))
2122 if (~((
size_t)file->RemoteApplicationFile))
2125 file->RemoteApplicationFile))
2129 if (~((
size_t)file->RemoteApplicationGuid))
2132 file->RemoteApplicationGuid))
2136 if (~((
size_t)file->RemoteApplicationCmdLine))
2139 file->RemoteApplicationCmdLine))
2143 if (~file->SpanMonitors)
2149 if (~file->UseMultiMon)
2155 if (~file->AllowFontSmoothing)
2158 file->AllowFontSmoothing != 0))
2162 if (~file->DisableWallpaper)
2165 file->DisableWallpaper != 0))
2169 if (~file->DisableFullWindowDrag)
2172 file->DisableFullWindowDrag != 0))
2176 if (~file->DisableMenuAnims)
2179 file->DisableMenuAnims != 0))
2183 if (~file->DisableThemes)
2189 if (~file->AllowDesktopComposition)
2192 file->AllowDesktopComposition != 0))
2196 if (~file->BitmapCachePersistEnable)
2199 file->BitmapCachePersistEnable != 0))
2203 if (~file->DisableRemoteAppCapsCheck)
2206 file->DisableRemoteAppCapsCheck != 0))
2210 if (~file->BandwidthAutoDetect)
2212 if (file->BandwidthAutoDetect != 0)
2214 if ((~file->NetworkAutoDetect) && (file->NetworkAutoDetect == 0))
2217 "Got networkautodetect:i:%" PRIu32
" and bandwidthautodetect:i:%" PRIu32
2218 ". Correcting to networkautodetect:i:1",
2219 file->NetworkAutoDetect, file->BandwidthAutoDetect);
2221 "Add networkautodetect:i:1 to your RDP file to eliminate this warning.");
2224 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2226 setDefaultConnectionType = FALSE;
2229 (file->BandwidthAutoDetect != 0) ||
2230 (file->NetworkAutoDetect != 0)))
2234 if (~file->NetworkAutoDetect)
2236 if (file->NetworkAutoDetect != 0)
2238 if ((~file->BandwidthAutoDetect) && (file->BandwidthAutoDetect == 0))
2241 "Got networkautodetect:i:%" PRIu32
" and bandwidthautodetect:i:%" PRIu32
2242 ". Correcting to bandwidthautodetect:i:1",
2243 file->NetworkAutoDetect, file->BandwidthAutoDetect);
2245 TAG,
"Add bandwidthautodetect:i:1 to your RDP file to eliminate this warning.");
2248 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2251 setDefaultConnectionType = FALSE;
2254 (file->BandwidthAutoDetect != 0) ||
2255 (file->NetworkAutoDetect != 0)))
2259 if (~file->AutoReconnectionEnabled)
2262 file->AutoReconnectionEnabled != 0))
2266 if (~file->AutoReconnectMaxRetries)
2269 file->AutoReconnectMaxRetries))
2273 if (~file->RedirectSmartCards)
2276 file->RedirectSmartCards != 0))
2280 if (~file->RedirectWebauthN)
2283 file->RedirectWebauthN != 0))
2287 if (~file->RedirectClipboard)
2290 file->RedirectClipboard != 0))
2294 if (~file->RedirectPrinters)
2297 file->RedirectPrinters != 0))
2301 if (~file->RedirectDrives)
2307 if (~file->RedirectPosDevices)
2310 file->RedirectComPorts != 0) ||
2312 file->RedirectComPorts != 0))
2316 if (~file->RedirectComPorts)
2319 file->RedirectComPorts != 0) ||
2321 file->RedirectComPorts != 0))
2325 if (~file->RedirectLocation && (file->RedirectLocation != 0))
2331 freerdp_client_add_dynamic_channel(settings, count, (
const char*
const*)ptr);
2332 CommandLineParserFree(ptr);
2337 if (~file->RedirectDirectX)
2342 if ((~((
size_t)file->DevicesToRedirect)) && !utils_str_is_empty(file->DevicesToRedirect))
2372 if ((~((
size_t)file->DrivesToRedirect)) && !utils_str_is_empty(file->DrivesToRedirect))
2375 file->DrivesToRedirect))
2379 if ((~((
size_t)file->RedirectCameras)) && !utils_str_is_empty(file->RedirectCameras))
2381 #if defined(CHANNEL_RDPECAM_CLIENT)
2385 const char*
const* cc;
2387 ADDIN_ARGV* args = rdp_file_to_args(RDPECAM_DVC_CHANNEL_NAME, file->RedirectCameras);
2392 if (~file->EncodeRedirectedVideoCapture)
2394 char encode[64] = { 0 };
2395 (void)_snprintf(encode,
sizeof(encode),
"encode:%" PRIu32,
2396 file->EncodeRedirectedVideoCapture);
2397 if (!freerdp_addin_argv_add_argument(args, encode))
2400 if (~file->RedirectedVideoCaptureEncodingQuality)
2402 char quality[64] = { 0 };
2403 (void)_snprintf(quality,
sizeof(quality),
"quality:%" PRIu32,
2404 file->RedirectedVideoCaptureEncodingQuality);
2405 if (!freerdp_addin_argv_add_argument(args, quality))
2411 status = freerdp_client_add_dynamic_channel(
2412 settings, WINPR_ASSERTING_INT_CAST(
size_t, args->argc), cnv.cc);
2413 freerdp_addin_argv_free(args);
2419 "This build does not support [MS-RDPECAM] camera redirection channel. Ignoring '%s'",
2420 key_str_camerastoredirect);
2424 if ((~((
size_t)file->UsbDevicesToRedirect)) && !utils_str_is_empty(file->UsbDevicesToRedirect))
2426 #ifdef CHANNEL_URBDRC_CLIENT
2430 const char*
const* cc;
2432 ADDIN_ARGV* args = rdp_file_to_args(URBDRC_CHANNEL_NAME, file->UsbDevicesToRedirect);
2436 const BOOL status = freerdp_client_add_dynamic_channel(
2437 settings, WINPR_ASSERTING_INT_CAST(
size_t, args->argc), cnv.cc);
2438 freerdp_addin_argv_free(args);
2443 "This build does not support [MS-RDPEUSB] usb redirection channel. Ignoring '%s'",
2444 key_str_usbdevicestoredirect);
2448 if (~file->KeyboardHook)
2454 if (~(
size_t)file->SelectedMonitors)
2457 char** ptr = CommandLineParseCommaSeparatedValues(file->SelectedMonitors, &count);
2458 UINT32* list = NULL;
2462 CommandLineParserFree(ptr);
2466 if (!list && (count > 0))
2468 CommandLineParserFree(ptr);
2471 for (
size_t x = 0; x < count; x++)
2473 unsigned long val = 0;
2475 val = strtoul(ptr[x], NULL, 0);
2476 if ((val >= UINT32_MAX) && (errno != 0))
2478 CommandLineParserFree(ptr);
2482 list[x] = (UINT32)val;
2484 CommandLineParserFree(ptr);
2487 if (~file->DynamicResolution)
2489 const BOOL val = file->DynamicResolution != 0;
2499 if (~file->DesktopScaleFactor)
2502 file->DesktopScaleFactor))
2506 if (~file->VideoPlaybackMode)
2508 if (file->VideoPlaybackMode != 0)
2525 if (~((
size_t)file->PreconnectionBlob))
2528 file->PreconnectionBlob) ||
2533 if (~((
size_t)file->KdcProxyName))
2539 if (~((
size_t)file->RdgIsKdcProxy))
2542 file->RdgIsKdcProxy != 0))
2546 if (file->args->argc > 1)
2548 WCHAR* ConnectionFile =
2551 if (freerdp_client_settings_parse_command_line(settings, file->args->argc, file->args->argv,
2554 free(ConnectionFile);
2560 free(ConnectionFile);
2565 if (setDefaultConnectionType)
2567 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2574 static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(
const rdpFile* file,
const char* name)
2576 BOOL bFound = FALSE;
2577 rdpFileLine* line = NULL;
2579 for (
size_t index = 0; index < file->lineCount; index++)
2581 line = &(file->lines[index]);
2583 if (line->flags & RDP_FILE_LINE_FLAG_FORMATTED)
2585 if (_stricmp(name, line->name) == 0)
2593 return (bFound) ? line : NULL;
2602 int freerdp_client_rdp_file_set_string_option(rdpFile* file,
const char* name,
const char* value)
2604 return freerdp_client_rdp_file_set_string(file, name, value);
2607 const char* freerdp_client_rdp_file_get_string_option(
const rdpFile* file,
const char* name)
2609 LPSTR* value = NULL;
2610 rdpFileLine* line = NULL;
2612 rdpFile* wfile = WINPR_CAST_CONST_PTR_AWAY(file, rdpFile*);
2613 if (freerdp_client_rdp_file_find_string_entry(wfile, name, &value, &line))
2615 if (value && ~(
size_t)(*value))
2618 return line->sValue;
2624 int freerdp_client_rdp_file_set_integer_option(rdpFile* file,
const char* name,
int value)
2626 return freerdp_client_rdp_file_set_integer(file, name, value);
2629 int freerdp_client_rdp_file_get_integer_option(
const rdpFile* file,
const char* name)
2631 DWORD* value = NULL;
2632 rdpFileLine* line = NULL;
2634 rdpFile* wfile = WINPR_CAST_CONST_PTR_AWAY(file, rdpFile*);
2635 if (freerdp_client_rdp_file_find_integer_entry(wfile, name, &value, &line))
2637 if (value && ~(*value))
2638 return WINPR_ASSERTING_INT_CAST(
int, *value);
2640 return (
int)line->iValue;
2646 static void freerdp_client_file_string_check_free(LPSTR str)
2652 rdpFile* freerdp_client_rdp_file_new(
void)
2654 return freerdp_client_rdp_file_new_ex(0);
2657 rdpFile* freerdp_client_rdp_file_new_ex(DWORD flags)
2659 rdpFile* file = (rdpFile*)calloc(1,
sizeof(rdpFile));
2664 file->flags = flags;
2666 FillMemory(file,
sizeof(rdpFile), 0xFF);
2668 file->lineCount = 0;
2669 file->lineSize = 32;
2670 file->GatewayProfileUsageMethod = 1;
2671 file->lines = (rdpFileLine*)calloc(file->lineSize,
sizeof(rdpFileLine));
2673 file->args = freerdp_addin_argv_new(0, NULL);
2674 if (!file->lines || !file->args)
2677 if (!freerdp_client_add_option(file,
"freerdp"))
2682 WINPR_PRAGMA_DIAG_PUSH
2683 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
2684 freerdp_client_rdp_file_free(file);
2685 WINPR_PRAGMA_DIAG_POP
2688 void freerdp_client_rdp_file_free(rdpFile* file)
2692 if (file->lineCount)
2694 for (
size_t i = 0; i < file->lineCount; i++)
2696 free(file->lines[i].name);
2697 free(file->lines[i].sValue);
2702 freerdp_addin_argv_free(file->args);
2704 freerdp_client_file_string_check_free(file->Username);
2705 freerdp_client_file_string_check_free(file->Domain);
2706 freerdp_client_file_string_check_free(file->Password);
2707 freerdp_client_file_string_check_free(file->FullAddress);
2708 freerdp_client_file_string_check_free(file->AlternateFullAddress);
2709 freerdp_client_file_string_check_free(file->UsbDevicesToRedirect);
2710 freerdp_client_file_string_check_free(file->RedirectCameras);
2711 freerdp_client_file_string_check_free(file->SelectedMonitors);
2712 freerdp_client_file_string_check_free(file->LoadBalanceInfo);
2713 freerdp_client_file_string_check_free(file->RemoteApplicationName);
2714 freerdp_client_file_string_check_free(file->RemoteApplicationIcon);
2715 freerdp_client_file_string_check_free(file->RemoteApplicationProgram);
2716 freerdp_client_file_string_check_free(file->RemoteApplicationFile);
2717 freerdp_client_file_string_check_free(file->RemoteApplicationGuid);
2718 freerdp_client_file_string_check_free(file->RemoteApplicationCmdLine);
2719 freerdp_client_file_string_check_free(file->AlternateShell);
2720 freerdp_client_file_string_check_free(file->ShellWorkingDirectory);
2721 freerdp_client_file_string_check_free(file->GatewayHostname);
2722 freerdp_client_file_string_check_free(file->GatewayAccessToken);
2723 freerdp_client_file_string_check_free(file->KdcProxyName);
2724 freerdp_client_file_string_check_free(file->DrivesToRedirect);
2725 freerdp_client_file_string_check_free(file->DevicesToRedirect);
2726 freerdp_client_file_string_check_free(file->WinPosStr);
2727 freerdp_client_file_string_check_free(file->ResourceProvider);
2728 freerdp_client_file_string_check_free(file->WvdEndpointPool);
2729 freerdp_client_file_string_check_free(file->geo);
2730 freerdp_client_file_string_check_free(file->armpath);
2731 freerdp_client_file_string_check_free(file->aadtenantid);
2732 freerdp_client_file_string_check_free(file->diagnosticserviceurl);
2733 freerdp_client_file_string_check_free(file->hubdiscoverygeourl);
2734 freerdp_client_file_string_check_free(file->activityhint);
2739 void freerdp_client_rdp_file_set_callback_context(rdpFile* file,
void* context)
2741 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 const void * freerdp_settings_get_pointer(const rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id)
Returns a immutable pointer 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_pointer_len(rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id, const void *data, size_t len)
Set a pointer to value data.
FREERDP_API BOOL freerdp_set_gateway_usage_method(rdpSettings *settings, UINT32 GatewayUsageMethod)
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_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 BOOL freerdp_settings_set_uint32(rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id, UINT32 param)
Sets a UINT32 settings value.
FREERDP_API BOOL freerdp_settings_set_bool(rdpSettings *settings, FreeRDP_Settings_Keys_Bool id, BOOL param)
Sets a BOOL settings value.
FREERDP_API void * freerdp_settings_get_pointer_writable(rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id)
Returns a mutable pointer settings value.