20 #include <freerdp/config.h>
26 #include <winpr/string.h>
27 #include <winpr/file.h>
29 #include <freerdp/client.h>
30 #include <freerdp/client/file.h>
31 #include <freerdp/client/cmdline.h>
33 #include <freerdp/channels/urbdrc.h>
34 #include <freerdp/channels/rdpecam.h>
35 #include <freerdp/channels/location.h>
50 #include <winpr/wtypes.h>
51 #include <winpr/crt.h>
52 #include <winpr/path.h>
53 #include <freerdp/log.h>
54 #define TAG CLIENT_TAG("common")
58 static const BYTE BOM_UTF16_LE[2] = { 0xFF, 0xFE };
62 #define RDP_FILE_LINE_FLAG_FORMATTED 0x00000001
64 #define RDP_FILE_LINE_FLAG_TYPE_STRING 0x00000010
65 #define RDP_FILE_LINE_FLAG_TYPE_INTEGER 0x00000020
80 typedef struct rdp_file_line rdpFileLine;
85 LPSTR SelectedMonitors;
86 DWORD MaximizeToCurrentDisplays;
87 DWORD SingleMonInWindowedMode;
91 DWORD DynamicResolution;
92 DWORD EnableSuperSpan;
93 DWORD SuperSpanAccelerationFactor;
99 DWORD DesktopScaleFactor;
103 DWORD DisableCtrlAltDel;
106 DWORD AudioQualityMode;
107 DWORD AudioCaptureMode;
108 DWORD EncodeRedirectedVideoCapture;
109 DWORD RedirectedVideoCaptureEncodingQuality;
110 DWORD VideoPlaybackMode;
112 DWORD ConnectionType;
114 DWORD NetworkAutoDetect;
115 DWORD BandwidthAutoDetect;
117 DWORD PinConnectionBar;
118 DWORD DisplayConnectionBar;
121 DWORD EnableWorkspaceReconnect;
123 DWORD DisableWallpaper;
124 DWORD AllowFontSmoothing;
125 DWORD AllowDesktopComposition;
126 DWORD DisableFullWindowDrag;
127 DWORD DisableMenuAnims;
129 DWORD DisableCursorSetting;
131 DWORD BitmapCacheSize;
132 DWORD BitmapCachePersistEnable;
142 LPSTR AlternateFullAddress;
144 LPSTR UsbDevicesToRedirect;
145 DWORD RedirectDrives;
146 DWORD RedirectPrinters;
147 DWORD RedirectComPorts;
148 DWORD RedirectLocation;
149 DWORD RedirectSmartCards;
150 DWORD RedirectWebauthN;
151 LPSTR RedirectCameras;
152 DWORD RedirectClipboard;
153 DWORD RedirectPosDevices;
154 DWORD RedirectDirectX;
155 DWORD DisablePrinterRedirection;
156 DWORD DisableClipboardRedirection;
158 DWORD ConnectToConsole;
159 DWORD AdministrativeSession;
160 DWORD AutoReconnectionEnabled;
161 DWORD AutoReconnectMaxRetries;
164 DWORD AuthenticationLevel;
165 DWORD PromptCredentialOnce;
166 DWORD PromptForCredentials;
167 DWORD NegotiateSecurityLayer;
168 DWORD EnableCredSSPSupport;
169 DWORD EnableRdsAadAuth;
171 DWORD RemoteApplicationMode;
172 LPSTR LoadBalanceInfo;
174 LPSTR RemoteApplicationName;
175 LPSTR RemoteApplicationIcon;
176 LPSTR RemoteApplicationProgram;
177 LPSTR RemoteApplicationFile;
178 LPSTR RemoteApplicationGuid;
179 LPSTR RemoteApplicationCmdLine;
180 DWORD RemoteApplicationExpandCmdLine;
181 DWORD RemoteApplicationExpandWorkingDir;
182 DWORD DisableConnectionSharing;
183 DWORD DisableRemoteAppCapsCheck;
185 LPSTR AlternateShell;
186 LPSTR ShellWorkingDirectory;
188 LPSTR GatewayHostname;
189 DWORD GatewayUsageMethod;
190 DWORD GatewayProfileUsageMethod;
191 DWORD GatewayCredentialsSource;
193 LPSTR ResourceProvider;
195 LPSTR WvdEndpointPool;
199 LPSTR diagnosticserviceurl;
200 LPSTR hubdiscoverygeourl;
203 DWORD UseRedirectionServerName;
205 LPSTR GatewayAccessToken;
207 LPSTR DrivesToRedirect;
208 LPSTR DevicesToRedirect;
211 LPSTR PreconnectionBlob;
228 static const char key_str_username[] =
"username";
229 static const char key_str_domain[] =
"domain";
230 static const char key_str_password[] =
"password";
231 static const char key_str_full_address[] =
"full address";
232 static const char key_str_alternate_full_address[] =
"alternate full address";
233 static const char key_str_usbdevicestoredirect[] =
"usbdevicestoredirect";
234 static const char key_str_camerastoredirect[] =
"camerastoredirect";
235 static const char key_str_loadbalanceinfo[] =
"loadbalanceinfo";
236 static const char key_str_remoteapplicationname[] =
"remoteapplicationname";
237 static const char key_str_remoteapplicationicon[] =
"remoteapplicationicon";
238 static const char key_str_remoteapplicationprogram[] =
"remoteapplicationprogram";
239 static const char key_str_remoteapplicationfile[] =
"remoteapplicationfile";
240 static const char key_str_remoteapplicationguid[] =
"remoteapplicationguid";
241 static const char key_str_remoteapplicationcmdline[] =
"remoteapplicationcmdline";
242 static const char key_str_alternate_shell[] =
"alternate shell";
243 static const char key_str_shell_working_directory[] =
"shell working directory";
244 static const char key_str_gatewayhostname[] =
"gatewayhostname";
245 static const char key_str_gatewayaccesstoken[] =
"gatewayaccesstoken";
246 static const char key_str_resourceprovider[] =
"resourceprovider";
247 static const char str_resourceprovider_arm[] =
"arm";
248 static const char key_str_kdcproxyname[] =
"kdcproxyname";
249 static const char key_str_drivestoredirect[] =
"drivestoredirect";
250 static const char key_str_devicestoredirect[] =
"devicestoredirect";
251 static const char key_str_winposstr[] =
"winposstr";
252 static const char key_str_pcb[] =
"pcb";
253 static const char key_str_selectedmonitors[] =
"selectedmonitors";
255 static const char key_str_wvd[] =
"wvd endpoint pool";
256 static const char key_str_geo[] =
"geo";
257 static const char key_str_armpath[] =
"armpath";
258 static const char key_str_aadtenantid[] =
"aadtenantid";
260 static const char key_str_diagnosticserviceurl[] =
"diagnosticserviceurl";
261 static const char key_str_hubdiscoverygeourl[] =
"hubdiscoverygeourl";
263 static const char key_str_activityhint[] =
"activityhint";
265 static const char key_int_rdgiskdcproxy[] =
"rdgiskdcproxy";
266 static const char key_int_use_redirection_server_name[] =
"use redirection server name";
267 static const char key_int_gatewaycredentialssource[] =
"gatewaycredentialssource";
268 static const char key_int_gatewayprofileusagemethod[] =
"gatewayprofileusagemethod";
269 static const char key_int_gatewayusagemethod[] =
"gatewayusagemethod";
270 static const char key_int_disableremoteappcapscheck[] =
"disableremoteappcapscheck";
271 static const char key_int_disableconnectionsharing[] =
"disableconnectionsharing";
272 static const char key_int_remoteapplicationexpandworkingdir[] =
"remoteapplicationexpandworkingdir";
273 static const char key_int_remoteapplicationexpandcmdline[] =
"remoteapplicationexpandcmdline";
274 static const char key_int_remoteapplicationmode[] =
"remoteapplicationmode";
275 static const char key_int_enablecredsspsupport[] =
"enablecredsspsupport";
276 static const char key_int_enablerdsaadauth[] =
"enablerdsaadauth";
277 static const char key_int_negotiate_security_layer[] =
"negotiate security layer";
278 static const char key_int_prompt_for_credentials[] =
"prompt for credentials";
279 static const char key_int_promptcredentialonce[] =
"promptcredentialonce";
280 static const char key_int_authentication_level[] =
"authentication level";
281 static const char key_int_public_mode[] =
"public mode";
282 static const char key_int_autoreconnect_max_retries[] =
"autoreconnect max retries";
283 static const char key_int_autoreconnection_enabled[] =
"autoreconnection enabled";
284 static const char key_int_administrative_session[] =
"administrative session";
285 static const char key_int_connect_to_console[] =
"connect to console";
286 static const char key_int_disableclipboardredirection[] =
"disableclipboardredirection";
287 static const char key_int_disableprinterredirection[] =
"disableprinterredirection";
288 static const char key_int_redirectdirectx[] =
"redirectdirectx";
289 static const char key_int_redirectposdevices[] =
"redirectposdevices";
290 static const char key_int_redirectclipboard[] =
"redirectclipboard";
291 static const char key_int_redirectsmartcards[] =
"redirectsmartcards";
292 static const char key_int_redirectcomports[] =
"redirectcomports";
293 static const char key_int_redirectlocation[] =
"redirectlocation";
294 static const char key_int_redirectprinters[] =
"redirectprinters";
295 static const char key_int_redirectdrives[] =
"redirectdrives";
296 static const char key_int_server_port[] =
"server port";
297 static const char key_int_bitmapcachepersistenable[] =
"bitmapcachepersistenable";
298 static const char key_int_bitmapcachesize[] =
"bitmapcachesize";
299 static const char key_int_disable_cursor_setting[] =
"disable cursor setting";
300 static const char key_int_disable_themes[] =
"disable themes";
301 static const char key_int_disable_menu_anims[] =
"disable menu anims";
302 static const char key_int_disable_full_window_drag[] =
"disable full window drag";
303 static const char key_int_allow_desktop_composition[] =
"allow desktop composition";
304 static const char key_int_allow_font_smoothing[] =
"allow font smoothing";
305 static const char key_int_disable_wallpaper[] =
"disable wallpaper";
306 static const char key_int_enableworkspacereconnect[] =
"enableworkspacereconnect";
307 static const char key_int_workspaceid[] =
"workspaceid";
308 static const char key_int_displayconnectionbar[] =
"displayconnectionbar";
309 static const char key_int_pinconnectionbar[] =
"pinconnectionbar";
310 static const char key_int_bandwidthautodetect[] =
"bandwidthautodetect";
311 static const char key_int_networkautodetect[] =
"networkautodetect";
312 static const char key_int_connection_type[] =
"connection type";
313 static const char key_int_videoplaybackmode[] =
"videoplaybackmode";
314 static const char key_int_redirected_video_capture_encoding_quality[] =
315 "redirected video capture encoding quality";
316 static const char key_int_encode_redirected_video_capture[] =
"encode redirected video capture";
317 static const char key_int_audiocapturemode[] =
"audiocapturemode";
318 static const char key_int_audioqualitymode[] =
"audioqualitymode";
319 static const char key_int_audiomode[] =
"audiomode";
320 static const char key_int_disable_ctrl_alt_del[] =
"disable ctrl+alt+del";
321 static const char key_int_keyboardhook[] =
"keyboardhook";
322 static const char key_int_compression[] =
"compression";
323 static const char key_int_desktopscalefactor[] =
"desktopscalefactor";
324 static const char key_int_session_bpp[] =
"session bpp";
325 static const char key_int_desktop_size_id[] =
"desktop size id";
326 static const char key_int_desktopheight[] =
"desktopheight";
327 static const char key_int_desktopwidth[] =
"desktopwidth";
328 static const char key_int_superpanaccelerationfactor[] =
"superpanaccelerationfactor";
329 static const char key_int_enablesuperpan[] =
"enablesuperpan";
330 static const char key_int_dynamic_resolution[] =
"dynamic resolution";
331 static const char key_int_smart_sizing[] =
"smart sizing";
332 static const char key_int_span_monitors[] =
"span monitors";
333 static const char key_int_screen_mode_id[] =
"screen mode id";
334 static const char key_int_singlemoninwindowedmode[] =
"singlemoninwindowedmode";
335 static const char key_int_maximizetocurrentdisplays[] =
"maximizetocurrentdisplays";
336 static const char key_int_use_multimon[] =
"use multimon";
337 static const char key_int_redirectwebauthn[] =
"redirectwebauthn";
339 static BOOL utils_str_is_empty(
const char* str)
343 if (strlen(str) == 0)
348 static SSIZE_T freerdp_client_rdp_file_add_line(rdpFile* file);
349 static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(
const rdpFile* file,
351 static void freerdp_client_file_string_check_free(LPSTR str);
353 static BOOL freerdp_client_rdp_file_find_integer_entry(rdpFile* file,
const char* name,
354 DWORD** outValue, rdpFileLine** outLine)
358 WINPR_ASSERT(outValue);
359 WINPR_ASSERT(outLine);
364 if (_stricmp(name, key_int_use_multimon) == 0)
365 *outValue = &file->UseMultiMon;
366 else if (_stricmp(name, key_int_maximizetocurrentdisplays) == 0)
367 *outValue = &file->MaximizeToCurrentDisplays;
368 else if (_stricmp(name, key_int_singlemoninwindowedmode) == 0)
369 *outValue = &file->SingleMonInWindowedMode;
370 else if (_stricmp(name, key_int_screen_mode_id) == 0)
371 *outValue = &file->ScreenModeId;
372 else if (_stricmp(name, key_int_span_monitors) == 0)
373 *outValue = &file->SpanMonitors;
374 else if (_stricmp(name, key_int_smart_sizing) == 0)
375 *outValue = &file->SmartSizing;
376 else if (_stricmp(name, key_int_dynamic_resolution) == 0)
377 *outValue = &file->DynamicResolution;
378 else if (_stricmp(name, key_int_enablesuperpan) == 0)
379 *outValue = &file->EnableSuperSpan;
380 else if (_stricmp(name, key_int_superpanaccelerationfactor) == 0)
381 *outValue = &file->SuperSpanAccelerationFactor;
382 else if (_stricmp(name, key_int_desktopwidth) == 0)
383 *outValue = &file->DesktopWidth;
384 else if (_stricmp(name, key_int_desktopheight) == 0)
385 *outValue = &file->DesktopHeight;
386 else if (_stricmp(name, key_int_desktop_size_id) == 0)
387 *outValue = &file->DesktopSizeId;
388 else if (_stricmp(name, key_int_session_bpp) == 0)
389 *outValue = &file->SessionBpp;
390 else if (_stricmp(name, key_int_desktopscalefactor) == 0)
391 *outValue = &file->DesktopScaleFactor;
392 else if (_stricmp(name, key_int_compression) == 0)
393 *outValue = &file->Compression;
394 else if (_stricmp(name, key_int_keyboardhook) == 0)
395 *outValue = &file->KeyboardHook;
396 else if (_stricmp(name, key_int_disable_ctrl_alt_del) == 0)
397 *outValue = &file->DisableCtrlAltDel;
398 else if (_stricmp(name, key_int_audiomode) == 0)
399 *outValue = &file->AudioMode;
400 else if (_stricmp(name, key_int_audioqualitymode) == 0)
401 *outValue = &file->AudioQualityMode;
402 else if (_stricmp(name, key_int_audiocapturemode) == 0)
403 *outValue = &file->AudioCaptureMode;
404 else if (_stricmp(name, key_int_encode_redirected_video_capture) == 0)
405 *outValue = &file->EncodeRedirectedVideoCapture;
406 else if (_stricmp(name, key_int_redirected_video_capture_encoding_quality) == 0)
407 *outValue = &file->RedirectedVideoCaptureEncodingQuality;
408 else if (_stricmp(name, key_int_videoplaybackmode) == 0)
409 *outValue = &file->VideoPlaybackMode;
410 else if (_stricmp(name, key_int_connection_type) == 0)
411 *outValue = &file->ConnectionType;
412 else if (_stricmp(name, key_int_networkautodetect) == 0)
413 *outValue = &file->NetworkAutoDetect;
414 else if (_stricmp(name, key_int_bandwidthautodetect) == 0)
415 *outValue = &file->BandwidthAutoDetect;
416 else if (_stricmp(name, key_int_pinconnectionbar) == 0)
417 *outValue = &file->PinConnectionBar;
418 else if (_stricmp(name, key_int_displayconnectionbar) == 0)
419 *outValue = &file->DisplayConnectionBar;
420 else if (_stricmp(name, key_int_workspaceid) == 0)
421 *outValue = &file->WorkspaceId;
422 else if (_stricmp(name, key_int_enableworkspacereconnect) == 0)
423 *outValue = &file->EnableWorkspaceReconnect;
424 else if (_stricmp(name, key_int_disable_wallpaper) == 0)
425 *outValue = &file->DisableWallpaper;
426 else if (_stricmp(name, key_int_allow_font_smoothing) == 0)
427 *outValue = &file->AllowFontSmoothing;
428 else if (_stricmp(name, key_int_allow_desktop_composition) == 0)
429 *outValue = &file->AllowDesktopComposition;
430 else if (_stricmp(name, key_int_disable_full_window_drag) == 0)
431 *outValue = &file->DisableFullWindowDrag;
432 else if (_stricmp(name, key_int_disable_menu_anims) == 0)
433 *outValue = &file->DisableMenuAnims;
434 else if (_stricmp(name, key_int_disable_themes) == 0)
435 *outValue = &file->DisableThemes;
436 else if (_stricmp(name, key_int_disable_cursor_setting) == 0)
437 *outValue = &file->DisableCursorSetting;
438 else if (_stricmp(name, key_int_bitmapcachesize) == 0)
439 *outValue = &file->BitmapCacheSize;
440 else if (_stricmp(name, key_int_bitmapcachepersistenable) == 0)
441 *outValue = &file->BitmapCachePersistEnable;
442 else if (_stricmp(name, key_int_server_port) == 0)
443 *outValue = &file->ServerPort;
444 else if (_stricmp(name, key_int_redirectdrives) == 0)
445 *outValue = &file->RedirectDrives;
446 else if (_stricmp(name, key_int_redirectprinters) == 0)
447 *outValue = &file->RedirectPrinters;
448 else if (_stricmp(name, key_int_redirectcomports) == 0)
449 *outValue = &file->RedirectComPorts;
450 else if (_stricmp(name, key_int_redirectlocation) == 0)
451 *outValue = &file->RedirectLocation;
452 else if (_stricmp(name, key_int_redirectsmartcards) == 0)
453 *outValue = &file->RedirectSmartCards;
454 else if (_stricmp(name, key_int_redirectclipboard) == 0)
455 *outValue = &file->RedirectClipboard;
456 else if (_stricmp(name, key_int_redirectposdevices) == 0)
457 *outValue = &file->RedirectPosDevices;
458 else if (_stricmp(name, key_int_redirectdirectx) == 0)
459 *outValue = &file->RedirectDirectX;
460 else if (_stricmp(name, key_int_disableprinterredirection) == 0)
461 *outValue = &file->DisablePrinterRedirection;
462 else if (_stricmp(name, key_int_disableclipboardredirection) == 0)
463 *outValue = &file->DisableClipboardRedirection;
464 else if (_stricmp(name, key_int_connect_to_console) == 0)
465 *outValue = &file->ConnectToConsole;
466 else if (_stricmp(name, key_int_administrative_session) == 0)
467 *outValue = &file->AdministrativeSession;
468 else if (_stricmp(name, key_int_autoreconnection_enabled) == 0)
469 *outValue = &file->AutoReconnectionEnabled;
470 else if (_stricmp(name, key_int_autoreconnect_max_retries) == 0)
471 *outValue = &file->AutoReconnectMaxRetries;
472 else if (_stricmp(name, key_int_public_mode) == 0)
473 *outValue = &file->PublicMode;
474 else if (_stricmp(name, key_int_authentication_level) == 0)
475 *outValue = &file->AuthenticationLevel;
476 else if (_stricmp(name, key_int_promptcredentialonce) == 0)
477 *outValue = &file->PromptCredentialOnce;
478 else if ((_stricmp(name, key_int_prompt_for_credentials) == 0))
479 *outValue = &file->PromptForCredentials;
480 else if (_stricmp(name, key_int_negotiate_security_layer) == 0)
481 *outValue = &file->NegotiateSecurityLayer;
482 else if (_stricmp(name, key_int_enablecredsspsupport) == 0)
483 *outValue = &file->EnableCredSSPSupport;
484 else if (_stricmp(name, key_int_enablerdsaadauth) == 0)
485 *outValue = &file->EnableRdsAadAuth;
486 else if (_stricmp(name, key_int_remoteapplicationmode) == 0)
487 *outValue = &file->RemoteApplicationMode;
488 else if (_stricmp(name, key_int_remoteapplicationexpandcmdline) == 0)
489 *outValue = &file->RemoteApplicationExpandCmdLine;
490 else if (_stricmp(name, key_int_remoteapplicationexpandworkingdir) == 0)
491 *outValue = &file->RemoteApplicationExpandWorkingDir;
492 else if (_stricmp(name, key_int_disableconnectionsharing) == 0)
493 *outValue = &file->DisableConnectionSharing;
494 else if (_stricmp(name, key_int_disableremoteappcapscheck) == 0)
495 *outValue = &file->DisableRemoteAppCapsCheck;
496 else if (_stricmp(name, key_int_gatewayusagemethod) == 0)
497 *outValue = &file->GatewayUsageMethod;
498 else if (_stricmp(name, key_int_gatewayprofileusagemethod) == 0)
499 *outValue = &file->GatewayProfileUsageMethod;
500 else if (_stricmp(name, key_int_gatewaycredentialssource) == 0)
501 *outValue = &file->GatewayCredentialsSource;
502 else if (_stricmp(name, key_int_use_redirection_server_name) == 0)
503 *outValue = &file->UseRedirectionServerName;
504 else if (_stricmp(name, key_int_rdgiskdcproxy) == 0)
505 *outValue = &file->RdgIsKdcProxy;
506 else if (_stricmp(name, key_int_redirectwebauthn) == 0)
507 *outValue = &file->RedirectWebauthN;
510 rdpFileLine* line = freerdp_client_rdp_file_find_line_by_name(file, name);
513 if (!(line->flags & RDP_FILE_LINE_FLAG_TYPE_INTEGER))
522 static BOOL freerdp_client_rdp_file_find_string_entry(rdpFile* file,
const char* name,
523 LPSTR** outValue, rdpFileLine** outLine)
527 WINPR_ASSERT(outValue);
528 WINPR_ASSERT(outLine);
533 if (_stricmp(name, key_str_username) == 0)
534 *outValue = &file->Username;
535 else if (_stricmp(name, key_str_domain) == 0)
536 *outValue = &file->Domain;
537 else if (_stricmp(name, key_str_password) == 0)
538 *outValue = &file->Password;
539 else if (_stricmp(name, key_str_full_address) == 0)
540 *outValue = &file->FullAddress;
541 else if (_stricmp(name, key_str_alternate_full_address) == 0)
542 *outValue = &file->AlternateFullAddress;
543 else if (_stricmp(name, key_str_usbdevicestoredirect) == 0)
544 *outValue = &file->UsbDevicesToRedirect;
545 else if (_stricmp(name, key_str_camerastoredirect) == 0)
546 *outValue = &file->RedirectCameras;
547 else if (_stricmp(name, key_str_loadbalanceinfo) == 0)
548 *outValue = &file->LoadBalanceInfo;
549 else if (_stricmp(name, key_str_remoteapplicationname) == 0)
550 *outValue = &file->RemoteApplicationName;
551 else if (_stricmp(name, key_str_remoteapplicationicon) == 0)
552 *outValue = &file->RemoteApplicationIcon;
553 else if (_stricmp(name, key_str_remoteapplicationprogram) == 0)
554 *outValue = &file->RemoteApplicationProgram;
555 else if (_stricmp(name, key_str_remoteapplicationfile) == 0)
556 *outValue = &file->RemoteApplicationFile;
557 else if (_stricmp(name, key_str_remoteapplicationguid) == 0)
558 *outValue = &file->RemoteApplicationGuid;
559 else if (_stricmp(name, key_str_remoteapplicationcmdline) == 0)
560 *outValue = &file->RemoteApplicationCmdLine;
561 else if (_stricmp(name, key_str_alternate_shell) == 0)
562 *outValue = &file->AlternateShell;
563 else if (_stricmp(name, key_str_shell_working_directory) == 0)
564 *outValue = &file->ShellWorkingDirectory;
565 else if (_stricmp(name, key_str_gatewayhostname) == 0)
566 *outValue = &file->GatewayHostname;
567 else if (_stricmp(name, key_str_resourceprovider) == 0)
568 *outValue = &file->ResourceProvider;
569 else if (_stricmp(name, key_str_wvd) == 0)
570 *outValue = &file->WvdEndpointPool;
571 else if (_stricmp(name, key_str_geo) == 0)
572 *outValue = &file->geo;
573 else if (_stricmp(name, key_str_armpath) == 0)
574 *outValue = &file->armpath;
575 else if (_stricmp(name, key_str_aadtenantid) == 0)
576 *outValue = &file->aadtenantid;
577 else if (_stricmp(name, key_str_diagnosticserviceurl) == 0)
578 *outValue = &file->diagnosticserviceurl;
579 else if (_stricmp(name, key_str_hubdiscoverygeourl) == 0)
580 *outValue = &file->hubdiscoverygeourl;
581 else if (_stricmp(name, key_str_activityhint) == 0)
582 *outValue = &file->activityhint;
583 else if (_stricmp(name, key_str_gatewayaccesstoken) == 0)
584 *outValue = &file->GatewayAccessToken;
585 else if (_stricmp(name, key_str_kdcproxyname) == 0)
586 *outValue = &file->KdcProxyName;
587 else if (_stricmp(name, key_str_drivestoredirect) == 0)
588 *outValue = &file->DrivesToRedirect;
589 else if (_stricmp(name, key_str_devicestoredirect) == 0)
590 *outValue = &file->DevicesToRedirect;
591 else if (_stricmp(name, key_str_winposstr) == 0)
592 *outValue = &file->WinPosStr;
593 else if (_stricmp(name, key_str_pcb) == 0)
594 *outValue = &file->PreconnectionBlob;
595 else if (_stricmp(name, key_str_selectedmonitors) == 0)
596 *outValue = &file->SelectedMonitors;
599 rdpFileLine* line = freerdp_client_rdp_file_find_line_by_name(file, name);
602 if (!(line->flags & RDP_FILE_LINE_FLAG_TYPE_STRING))
617 static BOOL freerdp_client_rdp_file_set_integer(rdpFile* file,
const char* name,
long value)
619 DWORD* targetValue = NULL;
620 rdpFileLine* line = NULL;
621 #ifdef DEBUG_CLIENT_FILE
622 WLog_DBG(TAG,
"%s:i:%ld", name, value);
628 if (!freerdp_client_rdp_file_find_integer_entry(file, name, &targetValue, &line))
630 SSIZE_T index = freerdp_client_rdp_file_add_line(file);
633 line = &file->lines[index];
638 *targetValue = (DWORD)value;
645 line->name = _strdup(name);
653 line->iValue = value;
654 line->flags = RDP_FILE_LINE_FLAG_FORMATTED;
655 line->flags |= RDP_FILE_LINE_FLAG_TYPE_INTEGER;
656 line->valueLength = 0;
663 static BOOL freerdp_client_parse_rdp_file_integer(rdpFile* file,
const char* name,
669 ivalue = strtol(value, &endptr, 0);
671 if ((endptr == NULL) || (errno != 0) || (endptr == value) || (ivalue > INT32_MAX) ||
672 (ivalue < INT32_MIN))
674 if (file->flags & RDP_FILE_FLAG_PARSE_INT_RELAXED)
676 WLog_WARN(TAG,
"Integer option %s has invalid value %s, using default", name, value);
681 WLog_ERR(TAG,
"Failed to convert RDP file integer option %s [value=%s]", name, value);
686 return freerdp_client_rdp_file_set_integer(file, name, ivalue);
697 static BOOL freerdp_client_rdp_file_set_string(rdpFile* file,
const char* name,
const char* value)
699 LPSTR* targetValue = NULL;
700 rdpFileLine* line = NULL;
701 #ifdef DEBUG_CLIENT_FILE
702 WLog_DBG(TAG,
"%s:s:%s", name, value);
708 if (!freerdp_client_rdp_file_find_string_entry(file, name, &targetValue, &line))
710 SSIZE_T index = freerdp_client_rdp_file_add_line(file);
713 line = &file->lines[index];
718 *targetValue = _strdup(value);
728 line->name = _strdup(name);
729 line->sValue = _strdup(value);
730 if (!line->name || !line->sValue)
739 line->flags = RDP_FILE_LINE_FLAG_FORMATTED;
740 line->flags |= RDP_FILE_LINE_FLAG_TYPE_STRING;
741 line->valueLength = 0;
748 static BOOL freerdp_client_add_option(rdpFile* file,
const char* option)
750 return freerdp_addin_argv_add_argument(file->args, option);
753 static SSIZE_T freerdp_client_rdp_file_add_line(rdpFile* file)
755 SSIZE_T index = (SSIZE_T)file->lineCount;
757 while ((file->lineCount + 1) > file->lineSize)
760 rdpFileLine* new_line = NULL;
761 new_size = file->lineSize * 2;
762 new_line = (rdpFileLine*)realloc(file->lines, new_size *
sizeof(rdpFileLine));
767 file->lines = new_line;
768 file->lineSize = new_size;
771 ZeroMemory(&(file->lines[file->lineCount]),
sizeof(rdpFileLine));
772 file->lines[file->lineCount].index = (size_t)index;
777 static BOOL freerdp_client_parse_rdp_file_string(rdpFile* file,
char* name,
char* value)
779 return freerdp_client_rdp_file_set_string(file, name, value);
782 static BOOL freerdp_client_parse_rdp_file_option(rdpFile* file,
const char* option)
784 return freerdp_client_add_option(file, option);
787 BOOL freerdp_client_parse_rdp_file_buffer(rdpFile* file,
const BYTE* buffer,
size_t size)
789 return freerdp_client_parse_rdp_file_buffer_ex(file, buffer, size, NULL);
792 static BOOL trim(
char** strptr)
798 start = str = *strptr;
801 if (!(~((
size_t)str)))
803 end = str + strlen(str) - 1;
805 while (isspace(*str))
808 while ((end > str) && isspace(*end))
815 *strptr = _strdup(str);
817 return *strptr != NULL;
823 static BOOL trim_strings(rdpFile* file)
825 if (!trim(&file->Username))
827 if (!trim(&file->Domain))
829 if (!trim(&file->AlternateFullAddress))
831 if (!trim(&file->FullAddress))
833 if (!trim(&file->UsbDevicesToRedirect))
835 if (!trim(&file->RedirectCameras))
837 if (!trim(&file->LoadBalanceInfo))
839 if (!trim(&file->GatewayHostname))
841 if (!trim(&file->GatewayAccessToken))
843 if (!trim(&file->RemoteApplicationName))
845 if (!trim(&file->RemoteApplicationIcon))
847 if (!trim(&file->RemoteApplicationProgram))
849 if (!trim(&file->RemoteApplicationFile))
851 if (!trim(&file->RemoteApplicationGuid))
853 if (!trim(&file->RemoteApplicationCmdLine))
855 if (!trim(&file->AlternateShell))
857 if (!trim(&file->ShellWorkingDirectory))
859 if (!trim(&file->DrivesToRedirect))
861 if (!trim(&file->DevicesToRedirect))
863 if (!trim(&file->DevicesToRedirect))
865 if (!trim(&file->WinPosStr))
867 if (!trim(&file->PreconnectionBlob))
869 if (!trim(&file->KdcProxyName))
871 if (!trim(&file->SelectedMonitors))
874 for (
size_t i = 0; i < file->lineCount; ++i)
876 rdpFileLine* curLine = &file->lines[i];
877 if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_STRING)
879 if (!trim(&curLine->sValue))
887 BOOL freerdp_client_parse_rdp_file_buffer_ex(rdpFile* file,
const BYTE* buffer,
size_t size,
888 rdp_file_fkt_parse parse)
894 char* context = NULL;
907 if ((buffer[0] == BOM_UTF16_LE[0]) && (buffer[1] == BOM_UTF16_LE[1]))
909 LPCWSTR uc = (LPCWSTR)(&buffer[2]);
910 size = size /
sizeof(WCHAR) - 1;
912 copy = ConvertWCharNToUtf8Alloc(uc, size, NULL);
915 WLog_ERR(TAG,
"Failed to convert RDP file from UCS2 to UTF8");
921 copy = calloc(1, size +
sizeof(BYTE));
926 memcpy(copy, buffer, size);
929 line = strtok_s(copy,
"\r\n", &context);
933 length = strnlen(line, size);
940 if (!freerdp_client_parse_rdp_file_option(file, line))
946 d1 = strchr(line,
':');
952 d2 = strchr(type,
':');
965 if (parse && parse(file->context, name, *type, value))
968 else if (*type ==
'i')
971 if (!freerdp_client_parse_rdp_file_integer(file, name, value))
974 else if (*type ==
's')
977 if (!freerdp_client_parse_rdp_file_string(file, name, value))
980 else if (*type ==
'b')
983 WLog_ERR(TAG,
"Unsupported RDP file binary option %s [value=%s]", name, value);
988 line = strtok_s(NULL,
"\r\n", &context);
991 rc = trim_strings(file);
997 BOOL freerdp_client_parse_rdp_file(rdpFile* file,
const char* name)
999 return freerdp_client_parse_rdp_file_ex(file, name, NULL);
1002 BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file,
const char* name, rdp_file_fkt_parse parse)
1005 BYTE* buffer = NULL;
1007 size_t read_size = 0;
1008 INT64 file_size = 0;
1009 const char* fname = name;
1014 if (_strnicmp(fname,
"file://", 7) == 0)
1017 fp = winpr_fopen(fname,
"r");
1020 WLog_ERR(TAG,
"Failed to open RDP file %s", name);
1024 (void)_fseeki64(fp, 0, SEEK_END);
1025 file_size = _ftelli64(fp);
1026 (void)_fseeki64(fp, 0, SEEK_SET);
1030 WLog_ERR(TAG,
"RDP file %s is empty", name);
1035 buffer = (BYTE*)malloc((
size_t)file_size + 2);
1043 read_size = fread(buffer, (
size_t)file_size, 1, fp);
1048 read_size = (size_t)file_size;
1055 WLog_ERR(TAG,
"Could not read from RDP file %s", name);
1060 buffer[file_size] =
'\0';
1061 buffer[file_size + 1] =
'\0';
1062 status = freerdp_client_parse_rdp_file_buffer_ex(file, buffer, (
size_t)file_size, parse);
1067 static INLINE BOOL FILE_POPULATE_STRING(
char** _target,
const rdpSettings* _settings,
1068 FreeRDP_Settings_Keys_String _option)
1070 WINPR_ASSERT(_target);
1071 WINPR_ASSERT(_settings);
1074 freerdp_client_file_string_check_free(*_target);
1075 *_target = (
void*)~((
size_t)NULL);
1078 *_target = _strdup(str);
1085 static char* freerdp_client_channel_args_to_string(
const rdpSettings* settings,
const char* channel,
1088 ADDIN_ARGV* args = freerdp_dynamic_channel_collection_find(settings, channel);
1089 const char* filters[] = { option };
1090 if (!args || (args->argc < 2))
1093 return CommandLineToCommaSeparatedValuesEx(args->argc - 1, args->argv + 1, filters,
1094 ARRAYSIZE(filters));
1097 static BOOL rdp_opt_duplicate(
const rdpSettings* _settings, FreeRDP_Settings_Keys_String _id,
1100 WINPR_ASSERT(_settings);
1106 *_key = _strdup(tmp);
1114 BOOL freerdp_client_populate_rdp_file_from_settings(rdpFile* file,
const rdpSettings* settings)
1116 FreeRDP_Settings_Keys_String index = FreeRDP_STRING_UNUSED;
1117 UINT32 LoadBalanceInfoLength = 0;
1118 const char* GatewayHostname = NULL;
1119 char* redirectCameras = NULL;
1121 if (!file || !settings)
1124 if (!FILE_POPULATE_STRING(&file->Domain, settings, FreeRDP_Domain) ||
1125 !FILE_POPULATE_STRING(&file->Username, settings, FreeRDP_Username) ||
1126 !FILE_POPULATE_STRING(&file->Password, settings, FreeRDP_Password) ||
1127 !FILE_POPULATE_STRING(&file->FullAddress, settings, FreeRDP_ServerHostname) ||
1128 !FILE_POPULATE_STRING(&file->AlternateFullAddress, settings, FreeRDP_ServerHostname) ||
1129 !FILE_POPULATE_STRING(&file->AlternateShell, settings, FreeRDP_AlternateShell) ||
1130 !FILE_POPULATE_STRING(&file->DrivesToRedirect, settings, FreeRDP_DrivesToRedirect))
1147 file->NegotiateSecurityLayer =
1153 index = FreeRDP_RemoteApplicationWorkingDir;
1155 index = FreeRDP_ShellWorkingDirectory;
1156 if (!FILE_POPULATE_STRING(&file->ShellWorkingDirectory, settings, index))
1163 if (LoadBalanceInfoLength > 0)
1165 const BYTE* LoadBalanceInfo =
1167 file->LoadBalanceInfo = calloc(LoadBalanceInfoLength + 1, 1);
1168 if (!file->LoadBalanceInfo)
1170 memcpy(file->LoadBalanceInfo, LoadBalanceInfo, LoadBalanceInfoLength);
1174 file->AudioMode = AUDIO_MODE_REDIRECT;
1176 file->AudioMode = AUDIO_MODE_PLAY_ON_SERVER;
1178 file->AudioMode = AUDIO_MODE_NONE;
1183 if (GatewayHostname)
1186 freerdp_client_file_string_check_free(file->GatewayHostname);
1187 if (GatewayPort == 443)
1188 file->GatewayHostname = _strdup(GatewayHostname);
1191 int length = _scprintf(
"%s:%" PRIu32, GatewayHostname, GatewayPort);
1195 file->GatewayHostname = (
char*)malloc((
size_t)length + 1);
1196 if (!file->GatewayHostname)
1199 if (sprintf_s(file->GatewayHostname, (
size_t)length + 1,
"%s:%" PRIu32, GatewayHostname,
1203 if (!file->GatewayHostname)
1208 file->ResourceProvider = _strdup(str_resourceprovider_arm);
1210 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdWvdEndpointPool, &file->WvdEndpointPool))
1212 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdGeo, &file->geo))
1214 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdArmpath, &file->armpath))
1216 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdAadtenantid, &file->aadtenantid))
1218 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdDiagnosticserviceurl,
1219 &file->diagnosticserviceurl))
1221 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdHubdiscoverygeourl,
1222 &file->hubdiscoverygeourl))
1224 if (!rdp_opt_duplicate(settings, FreeRDP_GatewayAvdActivityhint, &file->activityhint))
1228 file->BitmapCachePersistEnable =
1233 file->GatewayCredentialsSource =
1235 file->PromptCredentialOnce =
1238 file->RemoteApplicationMode =
1240 if (!FILE_POPULATE_STRING(&file->GatewayAccessToken, settings, FreeRDP_GatewayAccessToken) ||
1241 !FILE_POPULATE_STRING(&file->RemoteApplicationProgram, settings,
1242 FreeRDP_RemoteApplicationProgram) ||
1243 !FILE_POPULATE_STRING(&file->RemoteApplicationName, settings,
1244 FreeRDP_RemoteApplicationName) ||
1245 !FILE_POPULATE_STRING(&file->RemoteApplicationIcon, settings,
1246 FreeRDP_RemoteApplicationIcon) ||
1247 !FILE_POPULATE_STRING(&file->RemoteApplicationFile, settings,
1248 FreeRDP_RemoteApplicationFile) ||
1249 !FILE_POPULATE_STRING(&file->RemoteApplicationGuid, settings,
1250 FreeRDP_RemoteApplicationGuid) ||
1251 !FILE_POPULATE_STRING(&file->RemoteApplicationCmdLine, settings,
1252 FreeRDP_RemoteApplicationCmdLine))
1256 file->AllowDesktopComposition =
1260 file->DisableFullWindowDrag =
1265 CONNECTION_TYPE_AUTODETECT)
1268 file->NetworkAutoDetect =
1270 file->AutoReconnectionEnabled =
1276 freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"device:");
1277 if (redirectCameras)
1280 freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"encode:");
1281 file->EncodeRedirectedVideoCapture = 0;
1284 unsigned long val = 0;
1286 val = strtoul(str, NULL, 0);
1287 if ((val < UINT32_MAX) && (errno == 0))
1288 file->EncodeRedirectedVideoCapture = (UINT32)val;
1292 str = freerdp_client_channel_args_to_string(settings, RDPECAM_DVC_CHANNEL_NAME,
"quality:");
1293 file->RedirectedVideoCaptureEncodingQuality = 0;
1296 unsigned long val = 0;
1298 val = strtoul(str, NULL, 0);
1299 if ((val <= 2) && (errno == 0))
1301 file->RedirectedVideoCaptureEncodingQuality = (UINT32)val;
1306 file->RedirectCameras = redirectCameras;
1308 #ifdef CHANNEL_URBDRC_CLIENT
1310 freerdp_client_channel_args_to_string(settings, URBDRC_CHANNEL_NAME,
"device:");
1312 file->UsbDevicesToRedirect = redirectUsb;
1315 file->RedirectClipboard =
1322 file->RedirectLocation =
1324 if (!FILE_POPULATE_STRING(&file->DrivesToRedirect, settings, FreeRDP_DrivesToRedirect) ||
1325 !FILE_POPULATE_STRING(&file->PreconnectionBlob, settings, FreeRDP_PreconnectionBlob) ||
1326 !FILE_POPULATE_STRING(&file->KdcProxyName, settings, FreeRDP_KerberosKdcUrl))
1334 size_t size = count * (10 + 1) + 1;
1336 char* str = calloc(size,
sizeof(
char));
1337 for (UINT32 x = 0; x < count; x++)
1339 int rc = _snprintf(&str[offset], size - offset,
"%" PRIu32
",", MonitorIds[x]);
1345 offset += (size_t)rc;
1348 str[offset - 1] =
'\0';
1349 freerdp_client_file_string_check_free(file->SelectedMonitors);
1350 file->SelectedMonitors = str;
1358 BOOL freerdp_client_write_rdp_file(
const rdpFile* file,
const char* name, BOOL unicode)
1361 WCHAR* unicodestr = NULL;
1366 const size_t size = freerdp_client_write_rdp_file_buffer(file, NULL, 0);
1369 char* buffer = calloc(size + 1ULL,
sizeof(
char));
1371 if (freerdp_client_write_rdp_file_buffer(file, buffer, size + 1) != size)
1373 WLog_ERR(TAG,
"freerdp_client_write_rdp_file: error writing to output buffer");
1378 FILE* fp = winpr_fopen(name,
"w+b");
1385 unicodestr = ConvertUtf8NToWCharAlloc(buffer, size, &len);
1395 if ((fwrite(BOM_UTF16_LE,
sizeof(BYTE), 2, fp) != 2) ||
1396 (fwrite(unicodestr,
sizeof(WCHAR), len, fp) != len))
1408 if (fwrite(buffer, 1, size, fp) != size)
1417 status = fclose(fp);
1421 return (status == 0) ? TRUE : FALSE;
1424 WINPR_ATTR_FORMAT_ARG(3, 4)
1425 static SSIZE_T freerdp_client_write_setting_to_buffer(
char** buffer,
size_t* bufferSize,
1426 WINPR_FORMAT_ARG const
char* fmt, ...)
1433 if (!buffer || !bufferSize || !fmt)
1437 bufSize = *bufferSize;
1440 len = vsnprintf(buf, bufSize, fmt, ap);
1449 if (!buf && !bufSize)
1456 if (bufSize >= (
size_t)len)
1458 *bufferSize -= (size_t)len;
1459 buf[len - 1] =
'\n';
1460 *buffer = buf + len;
1468 size_t freerdp_client_write_rdp_file_buffer(
const rdpFile* file,
char* buffer,
size_t size)
1470 size_t totalSize = 0;
1476 if ((!buffer || !size) && (buffer || size))
1479 #define WRITE_SETTING_(fmt_, ...) \
1481 SSIZE_T res = freerdp_client_write_setting_to_buffer(&buffer, &size, fmt_, __VA_ARGS__); \
1484 totalSize += (size_t)res; \
1487 #define WRITE_SETTING_INT(key_, param_) \
1491 WRITE_SETTING_("%s:i:%" PRIu32, key_, param_) \
1494 #define WRITE_SETTING_STR(key_, param_) \
1497 if (~(size_t)(param_)) \
1498 WRITE_SETTING_("%s:s:%s", key_, param_) \
1502 WRITE_SETTING_INT(key_int_use_multimon, file->UseMultiMon);
1503 WRITE_SETTING_INT(key_int_maximizetocurrentdisplays, file->MaximizeToCurrentDisplays);
1504 WRITE_SETTING_INT(key_int_singlemoninwindowedmode, file->SingleMonInWindowedMode);
1505 WRITE_SETTING_INT(key_int_screen_mode_id, file->ScreenModeId);
1506 WRITE_SETTING_INT(key_int_span_monitors, file->SpanMonitors);
1507 WRITE_SETTING_INT(key_int_smart_sizing, file->SmartSizing);
1508 WRITE_SETTING_INT(key_int_dynamic_resolution, file->DynamicResolution);
1509 WRITE_SETTING_INT(key_int_enablesuperpan, file->EnableSuperSpan);
1510 WRITE_SETTING_INT(key_int_superpanaccelerationfactor, file->SuperSpanAccelerationFactor);
1511 WRITE_SETTING_INT(key_int_desktopwidth, file->DesktopWidth);
1512 WRITE_SETTING_INT(key_int_desktopheight, file->DesktopHeight);
1513 WRITE_SETTING_INT(key_int_desktop_size_id, file->DesktopSizeId);
1514 WRITE_SETTING_INT(key_int_session_bpp, file->SessionBpp);
1515 WRITE_SETTING_INT(key_int_desktopscalefactor, file->DesktopScaleFactor);
1516 WRITE_SETTING_INT(key_int_compression, file->Compression);
1517 WRITE_SETTING_INT(key_int_keyboardhook, file->KeyboardHook);
1518 WRITE_SETTING_INT(key_int_disable_ctrl_alt_del, file->DisableCtrlAltDel);
1519 WRITE_SETTING_INT(key_int_audiomode, file->AudioMode);
1520 WRITE_SETTING_INT(key_int_audioqualitymode, file->AudioQualityMode);
1521 WRITE_SETTING_INT(key_int_audiocapturemode, file->AudioCaptureMode);
1522 WRITE_SETTING_INT(key_int_encode_redirected_video_capture, file->EncodeRedirectedVideoCapture);
1523 WRITE_SETTING_INT(key_int_redirected_video_capture_encoding_quality,
1524 file->RedirectedVideoCaptureEncodingQuality);
1525 WRITE_SETTING_INT(key_int_videoplaybackmode, file->VideoPlaybackMode);
1526 WRITE_SETTING_INT(key_int_connection_type, file->ConnectionType);
1527 WRITE_SETTING_INT(key_int_networkautodetect, file->NetworkAutoDetect);
1528 WRITE_SETTING_INT(key_int_bandwidthautodetect, file->BandwidthAutoDetect);
1529 WRITE_SETTING_INT(key_int_pinconnectionbar, file->PinConnectionBar);
1530 WRITE_SETTING_INT(key_int_displayconnectionbar, file->DisplayConnectionBar);
1531 WRITE_SETTING_INT(key_int_workspaceid, file->WorkspaceId);
1532 WRITE_SETTING_INT(key_int_enableworkspacereconnect, file->EnableWorkspaceReconnect);
1533 WRITE_SETTING_INT(key_int_disable_wallpaper, file->DisableWallpaper);
1534 WRITE_SETTING_INT(key_int_allow_font_smoothing, file->AllowFontSmoothing);
1535 WRITE_SETTING_INT(key_int_allow_desktop_composition, file->AllowDesktopComposition);
1536 WRITE_SETTING_INT(key_int_disable_full_window_drag, file->DisableFullWindowDrag);
1537 WRITE_SETTING_INT(key_int_disable_menu_anims, file->DisableMenuAnims);
1538 WRITE_SETTING_INT(key_int_disable_themes, file->DisableThemes);
1539 WRITE_SETTING_INT(key_int_disable_cursor_setting, file->DisableCursorSetting);
1540 WRITE_SETTING_INT(key_int_bitmapcachesize, file->BitmapCacheSize);
1541 WRITE_SETTING_INT(key_int_bitmapcachepersistenable, file->BitmapCachePersistEnable);
1542 WRITE_SETTING_INT(key_int_server_port, file->ServerPort);
1543 WRITE_SETTING_INT(key_int_redirectdrives, file->RedirectDrives);
1544 WRITE_SETTING_INT(key_int_redirectprinters, file->RedirectPrinters);
1545 WRITE_SETTING_INT(key_int_redirectcomports, file->RedirectComPorts);
1546 WRITE_SETTING_INT(key_int_redirectlocation, file->RedirectLocation);
1547 WRITE_SETTING_INT(key_int_redirectsmartcards, file->RedirectSmartCards);
1548 WRITE_SETTING_INT(key_int_redirectclipboard, file->RedirectClipboard);
1549 WRITE_SETTING_INT(key_int_redirectposdevices, file->RedirectPosDevices);
1550 WRITE_SETTING_INT(key_int_redirectdirectx, file->RedirectDirectX);
1551 WRITE_SETTING_INT(key_int_disableprinterredirection, file->DisablePrinterRedirection);
1552 WRITE_SETTING_INT(key_int_disableclipboardredirection, file->DisableClipboardRedirection);
1553 WRITE_SETTING_INT(key_int_connect_to_console, file->ConnectToConsole);
1554 WRITE_SETTING_INT(key_int_administrative_session, file->AdministrativeSession);
1555 WRITE_SETTING_INT(key_int_autoreconnection_enabled, file->AutoReconnectionEnabled);
1556 WRITE_SETTING_INT(key_int_autoreconnect_max_retries, file->AutoReconnectMaxRetries);
1557 WRITE_SETTING_INT(key_int_public_mode, file->PublicMode);
1558 WRITE_SETTING_INT(key_int_authentication_level, file->AuthenticationLevel);
1559 WRITE_SETTING_INT(key_int_promptcredentialonce, file->PromptCredentialOnce);
1560 WRITE_SETTING_INT(key_int_prompt_for_credentials, file->PromptForCredentials);
1561 WRITE_SETTING_INT(key_int_negotiate_security_layer, file->NegotiateSecurityLayer);
1562 WRITE_SETTING_INT(key_int_enablecredsspsupport, file->EnableCredSSPSupport);
1563 WRITE_SETTING_INT(key_int_enablerdsaadauth, file->EnableRdsAadAuth);
1564 WRITE_SETTING_INT(key_int_remoteapplicationmode, file->RemoteApplicationMode);
1565 WRITE_SETTING_INT(key_int_remoteapplicationexpandcmdline, file->RemoteApplicationExpandCmdLine);
1566 WRITE_SETTING_INT(key_int_remoteapplicationexpandworkingdir,
1567 file->RemoteApplicationExpandWorkingDir);
1568 WRITE_SETTING_INT(key_int_disableconnectionsharing, file->DisableConnectionSharing);
1569 WRITE_SETTING_INT(key_int_disableremoteappcapscheck, file->DisableRemoteAppCapsCheck);
1570 WRITE_SETTING_INT(key_int_gatewayusagemethod, file->GatewayUsageMethod);
1571 WRITE_SETTING_INT(key_int_gatewayprofileusagemethod, file->GatewayProfileUsageMethod);
1572 WRITE_SETTING_INT(key_int_gatewaycredentialssource, file->GatewayCredentialsSource);
1573 WRITE_SETTING_INT(key_int_use_redirection_server_name, file->UseRedirectionServerName);
1574 WRITE_SETTING_INT(key_int_rdgiskdcproxy, file->RdgIsKdcProxy);
1575 WRITE_SETTING_INT(key_int_redirectwebauthn, file->RedirectWebauthN);
1578 WRITE_SETTING_STR(key_str_username, file->Username);
1579 WRITE_SETTING_STR(key_str_domain, file->Domain);
1580 WRITE_SETTING_STR(key_str_password, file->Password);
1581 WRITE_SETTING_STR(key_str_full_address, file->FullAddress);
1582 WRITE_SETTING_STR(key_str_alternate_full_address, file->AlternateFullAddress);
1583 WRITE_SETTING_STR(key_str_usbdevicestoredirect, file->UsbDevicesToRedirect);
1584 WRITE_SETTING_STR(key_str_camerastoredirect, file->RedirectCameras);
1585 WRITE_SETTING_STR(key_str_loadbalanceinfo, file->LoadBalanceInfo);
1586 WRITE_SETTING_STR(key_str_remoteapplicationname, file->RemoteApplicationName);
1587 WRITE_SETTING_STR(key_str_remoteapplicationicon, file->RemoteApplicationIcon);
1588 WRITE_SETTING_STR(key_str_remoteapplicationprogram, file->RemoteApplicationProgram);
1589 WRITE_SETTING_STR(key_str_remoteapplicationfile, file->RemoteApplicationFile);
1590 WRITE_SETTING_STR(key_str_remoteapplicationguid, file->RemoteApplicationGuid);
1591 WRITE_SETTING_STR(key_str_remoteapplicationcmdline, file->RemoteApplicationCmdLine);
1592 WRITE_SETTING_STR(key_str_alternate_shell, file->AlternateShell);
1593 WRITE_SETTING_STR(key_str_shell_working_directory, file->ShellWorkingDirectory);
1594 WRITE_SETTING_STR(key_str_gatewayhostname, file->GatewayHostname);
1595 WRITE_SETTING_STR(key_str_resourceprovider, file->ResourceProvider);
1596 WRITE_SETTING_STR(key_str_wvd, file->WvdEndpointPool);
1597 WRITE_SETTING_STR(key_str_geo, file->geo);
1598 WRITE_SETTING_STR(key_str_armpath, file->armpath);
1599 WRITE_SETTING_STR(key_str_aadtenantid, file->aadtenantid);
1600 WRITE_SETTING_STR(key_str_diagnosticserviceurl, file->diagnosticserviceurl);
1601 WRITE_SETTING_STR(key_str_hubdiscoverygeourl, file->hubdiscoverygeourl);
1602 WRITE_SETTING_STR(key_str_activityhint, file->activityhint);
1603 WRITE_SETTING_STR(key_str_gatewayaccesstoken, file->GatewayAccessToken);
1604 WRITE_SETTING_STR(key_str_kdcproxyname, file->KdcProxyName);
1605 WRITE_SETTING_STR(key_str_drivestoredirect, file->DrivesToRedirect);
1606 WRITE_SETTING_STR(key_str_devicestoredirect, file->DevicesToRedirect);
1607 WRITE_SETTING_STR(key_str_winposstr, file->WinPosStr);
1608 WRITE_SETTING_STR(key_str_pcb, file->PreconnectionBlob);
1609 WRITE_SETTING_STR(key_str_selectedmonitors, file->SelectedMonitors);
1612 for (
size_t i = 0; i < file->lineCount; ++i)
1615 const rdpFileLine* curLine = &file->lines[i];
1617 if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_INTEGER)
1618 res = freerdp_client_write_setting_to_buffer(&buffer, &size,
"%s:i:%" PRIu32,
1619 curLine->name, (UINT32)curLine->iValue);
1620 else if (curLine->flags & RDP_FILE_LINE_FLAG_TYPE_STRING)
1621 res = freerdp_client_write_setting_to_buffer(&buffer, &size,
"%s:s:%s", curLine->name,
1626 totalSize += (size_t)res;
1632 static ADDIN_ARGV* rdp_file_to_args(
const char* channel,
const char* values)
1636 ADDIN_ARGV* args = freerdp_addin_argv_new(0, NULL);
1639 if (!freerdp_addin_argv_add_argument(args, channel))
1642 p = CommandLineParseCommaSeparatedValues(values, &count);
1643 for (
size_t x = 0; x < count; x++)
1646 const char* val = p[x];
1647 const size_t len = strlen(val) + 8;
1648 char* str = calloc(len,
sizeof(
char));
1652 (void)_snprintf(str, len,
"device:%s", val);
1653 rc = freerdp_addin_argv_add_argument(args, str);
1658 CommandLineParserFree(p);
1662 CommandLineParserFree(p);
1663 freerdp_addin_argv_free(args);
1667 BOOL freerdp_client_populate_settings_from_rdp_file(
const rdpFile* file, rdpSettings* settings)
1669 BOOL setDefaultConnectionType = TRUE;
1671 if (!file || !settings)
1674 if (~((
size_t)file->Domain))
1680 if (~((
size_t)file->Username))
1683 char* domain = NULL;
1685 if (!freerdp_parse_username(file->Username, &user, &domain))
1691 if (!(~((
size_t)file->Domain)) && domain)
1701 if (~((
size_t)file->Password))
1708 const char* address = NULL;
1712 if (~((
size_t)file->AlternateFullAddress))
1713 address = file->AlternateFullAddress;
1714 else if (~((
size_t)file->FullAddress))
1715 address = file->FullAddress;
1722 if (!freerdp_parse_hostname(address, &host, &port))
1738 if (~file->ServerPort)
1744 if (~file->DesktopSizeId)
1746 switch (file->DesktopSizeId)
1779 WLog_WARN(TAG,
"Unsupported 'desktop size id' value %" PRIu32, file->DesktopSizeId);
1784 if (~file->DesktopWidth)
1790 if (~file->DesktopHeight)
1796 if (~file->SessionBpp)
1802 if (~file->ConnectToConsole)
1805 file->ConnectToConsole != 0))
1809 if (~file->AdministrativeSession)
1812 file->AdministrativeSession != 0))
1816 if (~file->NegotiateSecurityLayer)
1819 file->NegotiateSecurityLayer != 0))
1823 if (~file->EnableCredSSPSupport)
1826 file->EnableCredSSPSupport != 0))
1830 if (~file->EnableRdsAadAuth)
1836 if (~((
size_t)file->AlternateShell))
1842 if (~((
size_t)file->ShellWorkingDirectory))
1845 FreeRDP_Settings_Keys_String targetId =
1846 (~file->RemoteApplicationMode && file->RemoteApplicationMode != 0)
1847 ? FreeRDP_RemoteApplicationWorkingDir
1848 : FreeRDP_ShellWorkingDirectory;
1854 if (~file->ScreenModeId)
1869 (file->ScreenModeId == 2) ? TRUE : FALSE))
1873 if (~(file->SmartSizing))
1876 (file->SmartSizing == 1) ? TRUE : FALSE))
1887 if (((~(file->DesktopWidth) && ~(file->DesktopHeight)) || ~(file->DesktopSizeId)) &&
1888 (file->SmartSizing == 1))
1891 file->DesktopWidth))
1894 file->DesktopHeight))
1899 if (~((
size_t)file->LoadBalanceInfo))
1901 const size_t len = strlen(file->LoadBalanceInfo);
1903 file->LoadBalanceInfo, len))
1907 if (~file->AuthenticationLevel)
1924 file->AuthenticationLevel))
1928 if (~file->ConnectionType)
1930 if (!freerdp_set_connection_type(settings, file->ConnectionType))
1932 setDefaultConnectionType = FALSE;
1935 if (~file->AudioMode)
1937 switch (file->AudioMode)
1939 case AUDIO_MODE_REDIRECT:
1945 case AUDIO_MODE_PLAY_ON_SERVER:
1951 case AUDIO_MODE_NONE:
1961 if (~file->AudioCaptureMode)
1967 if (~file->Compression)
1970 file->Compression != 0))
1974 if (~((
size_t)file->GatewayHostname))
1979 if (!freerdp_parse_hostname(file->GatewayHostname, &host, &port))
1994 if (~((
size_t)file->ResourceProvider))
1996 if (_stricmp(file->ResourceProvider, str_resourceprovider_arm) == 0)
2003 if (~((
size_t)file->WvdEndpointPool))
2006 file->WvdEndpointPool))
2010 if (~((
size_t)file->geo))
2016 if (~((
size_t)file->armpath))
2022 if (~((
size_t)file->aadtenantid))
2029 if (~((
size_t)file->diagnosticserviceurl))
2032 file->diagnosticserviceurl))
2036 if (~((
size_t)file->hubdiscoverygeourl))
2039 file->hubdiscoverygeourl))
2043 if (~((
size_t)file->activityhint))
2046 file->activityhint))
2050 if (~((
size_t)file->GatewayAccessToken))
2053 file->GatewayAccessToken))
2057 if (~file->GatewayUsageMethod)
2063 if (~file->PromptCredentialOnce)
2066 file->PromptCredentialOnce != 0))
2070 if (~file->PromptForCredentials)
2073 file->PromptForCredentials != 0))
2077 if (~file->RemoteApplicationMode)
2080 file->RemoteApplicationMode != 0))
2084 if (~((
size_t)file->RemoteApplicationProgram))
2087 file->RemoteApplicationProgram))
2091 if (~((
size_t)file->RemoteApplicationName))
2094 file->RemoteApplicationName))
2098 if (~((
size_t)file->RemoteApplicationIcon))
2101 file->RemoteApplicationIcon))
2105 if (~((
size_t)file->RemoteApplicationFile))
2108 file->RemoteApplicationFile))
2112 if (~((
size_t)file->RemoteApplicationGuid))
2115 file->RemoteApplicationGuid))
2119 if (~((
size_t)file->RemoteApplicationCmdLine))
2122 file->RemoteApplicationCmdLine))
2126 if (~file->SpanMonitors)
2132 if (~file->UseMultiMon)
2138 if (~file->AllowFontSmoothing)
2141 file->AllowFontSmoothing != 0))
2145 if (~file->DisableWallpaper)
2148 file->DisableWallpaper != 0))
2152 if (~file->DisableFullWindowDrag)
2155 file->DisableFullWindowDrag != 0))
2159 if (~file->DisableMenuAnims)
2162 file->DisableMenuAnims != 0))
2166 if (~file->DisableThemes)
2172 if (~file->AllowDesktopComposition)
2175 file->AllowDesktopComposition != 0))
2179 if (~file->BitmapCachePersistEnable)
2182 file->BitmapCachePersistEnable != 0))
2186 if (~file->DisableRemoteAppCapsCheck)
2189 file->DisableRemoteAppCapsCheck != 0))
2193 if (~file->BandwidthAutoDetect)
2195 if (file->BandwidthAutoDetect != 0)
2197 if ((~file->NetworkAutoDetect) && (file->NetworkAutoDetect == 0))
2200 "Got networkautodetect:i:%" PRIu32
" and bandwidthautodetect:i:%" PRIu32
2201 ". Correcting to networkautodetect:i:1",
2202 file->NetworkAutoDetect, file->BandwidthAutoDetect);
2204 "Add networkautodetect:i:1 to your RDP file to eliminate this warning.");
2207 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2209 setDefaultConnectionType = FALSE;
2212 (file->BandwidthAutoDetect != 0) ||
2213 (file->NetworkAutoDetect != 0)))
2217 if (~file->NetworkAutoDetect)
2219 if (file->NetworkAutoDetect != 0)
2221 if ((~file->BandwidthAutoDetect) && (file->BandwidthAutoDetect == 0))
2224 "Got networkautodetect:i:%" PRIu32
" and bandwidthautodetect:i:%" PRIu32
2225 ". Correcting to bandwidthautodetect:i:1",
2226 file->NetworkAutoDetect, file->BandwidthAutoDetect);
2228 TAG,
"Add bandwidthautodetect:i:1 to your RDP file to eliminate this warning.");
2231 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2234 setDefaultConnectionType = FALSE;
2237 (file->BandwidthAutoDetect != 0) ||
2238 (file->NetworkAutoDetect != 0)))
2242 if (~file->AutoReconnectionEnabled)
2245 file->AutoReconnectionEnabled != 0))
2249 if (~file->AutoReconnectMaxRetries)
2252 file->AutoReconnectMaxRetries))
2256 if (~file->RedirectSmartCards)
2259 file->RedirectSmartCards != 0))
2263 if (~file->RedirectWebauthN)
2266 file->RedirectWebauthN != 0))
2270 if (~file->RedirectClipboard)
2273 file->RedirectClipboard != 0))
2277 if (~file->RedirectPrinters)
2280 file->RedirectPrinters != 0))
2284 if (~file->RedirectDrives)
2290 if (~file->RedirectPosDevices)
2293 file->RedirectComPorts != 0) ||
2295 file->RedirectComPorts != 0))
2299 if (~file->RedirectComPorts)
2302 file->RedirectComPorts != 0) ||
2304 file->RedirectComPorts != 0))
2308 if (~file->RedirectLocation && (file->RedirectLocation != 0))
2314 freerdp_client_add_dynamic_channel(settings, count, (
const char*
const*)ptr);
2315 CommandLineParserFree(ptr);
2320 if (~file->RedirectDirectX)
2325 if ((~((
size_t)file->DevicesToRedirect)) && !utils_str_is_empty(file->DevicesToRedirect))
2355 if ((~((
size_t)file->DrivesToRedirect)) && !utils_str_is_empty(file->DrivesToRedirect))
2358 file->DrivesToRedirect))
2362 if ((~((
size_t)file->RedirectCameras)) && !utils_str_is_empty(file->RedirectCameras))
2364 #if defined(CHANNEL_RDPECAM_CLIENT)
2370 ADDIN_ARGV* args = rdp_file_to_args(RDPECAM_DVC_CHANNEL_NAME, file->RedirectCameras);
2375 if (~file->EncodeRedirectedVideoCapture)
2377 char encode[64] = { 0 };
2378 (void)_snprintf(encode,
sizeof(encode),
"encode:%" PRIu32,
2379 file->EncodeRedirectedVideoCapture);
2380 if (!freerdp_addin_argv_add_argument(args, encode))
2383 if (~file->RedirectedVideoCaptureEncodingQuality)
2385 char quality[64] = { 0 };
2386 (void)_snprintf(quality,
sizeof(quality),
"quality:%" PRIu32,
2387 file->RedirectedVideoCaptureEncodingQuality);
2388 if (!freerdp_addin_argv_add_argument(args, quality))
2394 status = freerdp_client_add_dynamic_channel(settings, args->argc, cnv.cc);
2395 freerdp_addin_argv_free(args);
2401 "This build does not support [MS-RDPECAM] camera redirection channel. Ignoring '%s'",
2402 key_str_camerastoredirect);
2406 if ((~((
size_t)file->UsbDevicesToRedirect)) && !utils_str_is_empty(file->UsbDevicesToRedirect))
2408 #ifdef CHANNEL_URBDRC_CLIENT
2414 ADDIN_ARGV* args = rdp_file_to_args(URBDRC_CHANNEL_NAME, file->UsbDevicesToRedirect);
2418 const BOOL status = freerdp_client_add_dynamic_channel(settings, args->argc, cnv.cc);
2419 freerdp_addin_argv_free(args);
2424 "This build does not support [MS-RDPEUSB] usb redirection channel. Ignoring '%s'",
2425 key_str_usbdevicestoredirect);
2429 if (~file->KeyboardHook)
2435 if (~(
size_t)file->SelectedMonitors)
2438 char** ptr = CommandLineParseCommaSeparatedValues(file->SelectedMonitors, &count);
2439 UINT32* list = NULL;
2443 CommandLineParserFree(ptr);
2447 if (!list && (count > 0))
2449 CommandLineParserFree(ptr);
2452 for (
size_t x = 0; x < count; x++)
2454 unsigned long val = 0;
2456 val = strtoul(ptr[x], NULL, 0);
2457 if ((val >= UINT32_MAX) && (errno != 0))
2459 CommandLineParserFree(ptr);
2463 list[x] = (UINT32)val;
2465 CommandLineParserFree(ptr);
2468 if (~file->DynamicResolution)
2470 const BOOL val = file->DynamicResolution != 0;
2480 if (~file->DesktopScaleFactor)
2483 file->DesktopScaleFactor))
2487 if (~file->VideoPlaybackMode)
2489 if (file->VideoPlaybackMode != 0)
2506 if (~((
size_t)file->PreconnectionBlob))
2509 file->PreconnectionBlob) ||
2514 if (~((
size_t)file->KdcProxyName))
2520 if (~((
size_t)file->RdgIsKdcProxy))
2523 file->RdgIsKdcProxy != 0))
2527 if (file->args->argc > 1)
2529 WCHAR* ConnectionFile =
2532 if (freerdp_client_settings_parse_command_line(settings, file->args->argc, file->args->argv,
2535 free(ConnectionFile);
2541 free(ConnectionFile);
2546 if (setDefaultConnectionType)
2548 if (!freerdp_set_connection_type(settings, CONNECTION_TYPE_AUTODETECT))
2555 static rdpFileLine* freerdp_client_rdp_file_find_line_by_name(
const rdpFile* file,
const char* name)
2557 BOOL bFound = FALSE;
2558 rdpFileLine* line = NULL;
2560 for (
size_t index = 0; index < file->lineCount; index++)
2562 line = &(file->lines[index]);
2564 if (line->flags & RDP_FILE_LINE_FLAG_FORMATTED)
2566 if (_stricmp(name, line->name) == 0)
2574 return (bFound) ? line : NULL;
2583 int freerdp_client_rdp_file_set_string_option(rdpFile* file,
const char* name,
const char* value)
2585 return freerdp_client_rdp_file_set_string(file, name, value);
2588 const char* freerdp_client_rdp_file_get_string_option(
const rdpFile* file,
const char* name)
2590 LPSTR* value = NULL;
2591 rdpFileLine* line = NULL;
2593 rdpFile* wfile = WINPR_CAST_CONST_PTR_AWAY(file, rdpFile*);
2594 if (freerdp_client_rdp_file_find_string_entry(wfile, name, &value, &line))
2596 if (value && ~(
size_t)(*value))
2599 return line->sValue;
2605 int freerdp_client_rdp_file_set_integer_option(rdpFile* file,
const char* name,
int value)
2607 return freerdp_client_rdp_file_set_integer(file, name, value);
2610 int freerdp_client_rdp_file_get_integer_option(
const rdpFile* file,
const char* name)
2612 DWORD* value = NULL;
2613 rdpFileLine* line = NULL;
2615 rdpFile* wfile = WINPR_CAST_CONST_PTR_AWAY(file, rdpFile*);
2616 if (freerdp_client_rdp_file_find_integer_entry(wfile, name, &value, &line))
2618 if (value && ~(*value))
2621 return (
int)line->iValue;
2627 static void freerdp_client_file_string_check_free(LPSTR str)
2633 rdpFile* freerdp_client_rdp_file_new(
void)
2635 return freerdp_client_rdp_file_new_ex(0);
2638 rdpFile* freerdp_client_rdp_file_new_ex(DWORD flags)
2640 rdpFile* file = (rdpFile*)calloc(1,
sizeof(rdpFile));
2645 file->flags = flags;
2647 FillMemory(file,
sizeof(rdpFile), 0xFF);
2649 file->lineCount = 0;
2650 file->lineSize = 32;
2651 file->GatewayProfileUsageMethod = 1;
2652 file->lines = (rdpFileLine*)calloc(file->lineSize,
sizeof(rdpFileLine));
2654 file->args = freerdp_addin_argv_new(0, NULL);
2655 if (!file->lines || !file->args)
2658 if (!freerdp_client_add_option(file,
"freerdp"))
2663 WINPR_PRAGMA_DIAG_PUSH
2664 WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
2665 freerdp_client_rdp_file_free(file);
2666 WINPR_PRAGMA_DIAG_POP
2669 void freerdp_client_rdp_file_free(rdpFile* file)
2673 if (file->lineCount)
2675 for (
size_t i = 0; i < file->lineCount; i++)
2677 free(file->lines[i].name);
2678 free(file->lines[i].sValue);
2683 freerdp_addin_argv_free(file->args);
2685 freerdp_client_file_string_check_free(file->Username);
2686 freerdp_client_file_string_check_free(file->Domain);
2687 freerdp_client_file_string_check_free(file->Password);
2688 freerdp_client_file_string_check_free(file->FullAddress);
2689 freerdp_client_file_string_check_free(file->AlternateFullAddress);
2690 freerdp_client_file_string_check_free(file->UsbDevicesToRedirect);
2691 freerdp_client_file_string_check_free(file->RedirectCameras);
2692 freerdp_client_file_string_check_free(file->SelectedMonitors);
2693 freerdp_client_file_string_check_free(file->LoadBalanceInfo);
2694 freerdp_client_file_string_check_free(file->RemoteApplicationName);
2695 freerdp_client_file_string_check_free(file->RemoteApplicationIcon);
2696 freerdp_client_file_string_check_free(file->RemoteApplicationProgram);
2697 freerdp_client_file_string_check_free(file->RemoteApplicationFile);
2698 freerdp_client_file_string_check_free(file->RemoteApplicationGuid);
2699 freerdp_client_file_string_check_free(file->RemoteApplicationCmdLine);
2700 freerdp_client_file_string_check_free(file->AlternateShell);
2701 freerdp_client_file_string_check_free(file->ShellWorkingDirectory);
2702 freerdp_client_file_string_check_free(file->GatewayHostname);
2703 freerdp_client_file_string_check_free(file->GatewayAccessToken);
2704 freerdp_client_file_string_check_free(file->KdcProxyName);
2705 freerdp_client_file_string_check_free(file->DrivesToRedirect);
2706 freerdp_client_file_string_check_free(file->DevicesToRedirect);
2707 freerdp_client_file_string_check_free(file->WinPosStr);
2708 freerdp_client_file_string_check_free(file->ResourceProvider);
2709 freerdp_client_file_string_check_free(file->WvdEndpointPool);
2710 freerdp_client_file_string_check_free(file->geo);
2711 freerdp_client_file_string_check_free(file->armpath);
2712 freerdp_client_file_string_check_free(file->aadtenantid);
2713 freerdp_client_file_string_check_free(file->diagnosticserviceurl);
2714 freerdp_client_file_string_check_free(file->hubdiscoverygeourl);
2715 freerdp_client_file_string_check_free(file->activityhint);
2720 void freerdp_client_rdp_file_set_callback_context(rdpFile* file,
void* context)
2722 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.