19#include <freerdp/config.h>
23#include <winpr/path.h>
24#include <winpr/cmdline.h>
25#include <winpr/winsock.h>
27#include <winpr/tools/makecert.h>
29#include <freerdp/server/shadow.h>
30#include <freerdp/settings.h>
32#include <freerdp/log.h>
33#define TAG SERVER_TAG("shadow")
35int main(
int argc,
char** argv)
40 {
"log-filters", COMMAND_LINE_VALUE_REQUIRED,
"<tag>:<level>[,<tag>:<level>[,...]]",
41 nullptr,
nullptr, -1,
nullptr,
"Set logger filters, see wLog(7) for details" },
42 {
"log-level", COMMAND_LINE_VALUE_REQUIRED,
"[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]",
43 nullptr,
nullptr, -1,
nullptr,
"Set the default log level, see wLog(7) for details" },
44 {
"port", COMMAND_LINE_VALUE_REQUIRED,
"<number>",
nullptr,
nullptr, -1,
nullptr,
46 {
"ipc-socket", COMMAND_LINE_VALUE_REQUIRED,
"<ipc-socket>",
nullptr,
nullptr, -1,
nullptr,
47 "Server IPC socket" },
48 {
"bind-address", COMMAND_LINE_VALUE_REQUIRED,
"<bind-address>[,<another address>, ...]",
49 nullptr,
nullptr, -1,
nullptr,
50 "An address to bind to. Use '[<ipv6>]' for IPv6 addresses, e.g. '[::1]' for "
52 {
"server-side-cursor", COMMAND_LINE_VALUE_BOOL,
nullptr,
nullptr,
nullptr, -1,
nullptr,
53 "hide mouse cursor in RDP client." },
54 {
"monitors", COMMAND_LINE_VALUE_OPTIONAL,
"<0,1,2...>",
nullptr,
nullptr, -1,
nullptr,
55 "Select or list monitors" },
56 {
"max-connections", COMMAND_LINE_VALUE_REQUIRED,
"<number>",
nullptr,
nullptr, -1,
nullptr,
57 "maximum connections allowed to server, 0 to deactivate" },
58 {
"mouse-relative", COMMAND_LINE_VALUE_BOOL,
nullptr,
nullptr,
nullptr, -1,
nullptr,
59 "enable support for relative mouse events" },
60 {
"rect", COMMAND_LINE_VALUE_REQUIRED,
"<x,y,w,h>",
nullptr,
nullptr, -1,
nullptr,
61 "Select rectangle within monitor to share" },
62 {
"auth", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
63 "Clients must authenticate" },
64 {
"remote-guard", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueFalse,
nullptr, -1,
nullptr,
65 "Remote credential guard" },
66 {
"restricted-admin", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
68 {
"vmconnect", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueFalse,
69 nullptr, -1,
nullptr,
"Hyper-V console server (bind on vsock://1)" },
70 {
"may-view", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
71 "Clients may view without prompt" },
72 {
"may-interact", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
73 "Clients may interact without prompt" },
74 {
"sec", COMMAND_LINE_VALUE_REQUIRED,
"<rdp|tls|nla|ext>",
nullptr,
nullptr, -1,
nullptr,
75 "force specific protocol security" },
76 {
"sec-rdp", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
77 "rdp protocol security" },
78 {
"sec-tls", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
79 "tls protocol security" },
80 {
"sec-nla", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
81 "nla protocol security" },
82 {
"sec-ext", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueFalse,
nullptr, -1,
nullptr,
83 "nla extended protocol security" },
84 {
"sam-file", COMMAND_LINE_VALUE_REQUIRED,
"<file>",
nullptr,
nullptr, -1,
nullptr,
85 "NTLM SAM file for NLA authentication" },
86 {
"keytab", COMMAND_LINE_VALUE_REQUIRED,
"<file>",
nullptr,
nullptr, -1,
nullptr,
87 "Kerberos keytab file for NLA authentication" },
88 {
"ccache", COMMAND_LINE_VALUE_REQUIRED,
"<file>",
nullptr,
nullptr, -1,
nullptr,
89 "Kerberos host ccache file for NLA authentication" },
90 {
"tls-secrets-file", COMMAND_LINE_VALUE_REQUIRED,
"<file>",
nullptr,
nullptr, -1,
nullptr,
91 "file where tls secrets shall be stored" },
92 {
"nsc", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
94 {
"rfx", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
95 "Allow RFX surface bits" },
96 {
"gfx", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
97 "Allow GFX pipeline" },
98 {
"gfx-progressive", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
99 "Allow GFX progressive codec" },
100 {
"gfx-rfx", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
101 "Allow GFX RFX codec" },
102 {
"gfx-planar", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
103 "Allow GFX planar codec" },
104 {
"gfx-avc420", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
105 "Allow GFX AVC420 codec" },
106 {
"gfx-avc444", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueTrue,
nullptr, -1,
nullptr,
107 "Allow GFX AVC444 codec" },
108 {
"bitmap-compat", COMMAND_LINE_VALUE_BOOL,
nullptr, BoolValueFalse,
nullptr, -1,
nullptr,
109 "Limit BitmapUpdate to 1 rectangle (fixes broken windows 11 24H2 clients)" },
110 {
"version", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_VERSION,
nullptr,
nullptr,
111 nullptr, -1,
nullptr,
"Print version" },
112 {
"buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG,
nullptr,
nullptr,
113 nullptr, -1,
nullptr,
"Print the build configuration" },
114 {
"help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP,
nullptr,
nullptr,
nullptr, -1,
116 {
nullptr, 0,
nullptr,
nullptr,
nullptr, -1,
nullptr,
nullptr }
119 shadow_subsystem_set_entry_builtin(
nullptr);
121 rdpShadowServer* server = shadow_server_new();
126 WLog_ERR(TAG,
"Server new failed");
131 rdpSettings* settings = server->settings;
132 WINPR_ASSERT(settings);
159 if ((status = shadow_server_parse_command_line(server, argc, argv, shadow_args)) < 0)
161 status = shadow_server_command_line_status_print(server, argc, argv, status, shadow_args);
165 if ((status = shadow_server_init(server)) < 0)
167 WLog_ERR(TAG,
"Server initialization failed.");
171 if ((status = shadow_server_start(server)) < 0)
173 WLog_ERR(TAG,
"Failed to start server.");
179 MSG msg = WINPR_C_ARRAY_INIT;
180 while (GetMessage(&msg, 0, 0, 0))
182 TranslateMessage(&msg);
183 DispatchMessage(&msg);
188 (void)WaitForSingleObject(server->thread, INFINITE);
190 if (!GetExitCodeThread(server->thread, &dwExitCode))
193 status = (int)dwExitCode;
196 shadow_server_uninit(server);
197 shadow_server_free(server);
FREERDP_API BOOL freerdp_settings_set_uint32(rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id, UINT32 val)
Sets a UINT32 settings value.
FREERDP_API BOOL freerdp_settings_set_bool(rdpSettings *settings, FreeRDP_Settings_Keys_Bool id, BOOL val)
Sets a BOOL settings value.