tabby-rdp 0.6.0-rc.2 → 0.6.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0-rc.4
4
+
5
+ **Added**
6
+ - A default-off **Relax drawing order checks** option for FreeRDP, with overrides in RDP profiles and configured
7
+ desktops. It accepts drawing orders a server or PAM proxy did not announce, which may help diagnose black screens.
8
+ The option applies on reconnect and does not change IronRDP.
9
+
10
+ ## 0.6.0-rc.3
11
+
12
+ **Added**
13
+ - A PDU trace for diagnosing picture problems (issue #115): while the diagnostic log is on, each desktop also writes
14
+ `<log name>.otlp.json`, an OpenTelemetry trace of every RDP PDU that passed the plugin's proxy (X.224, MCS, share
15
+ control and data, fast-path updates, the static channels, and inside drdynvc the display control and graphics
16
+ pipeline commands, ZGFX-decompressed), with what this side did with them (H.264 access units handed to the browser's
17
+ decoder and their latency, the canvas resized and drawn, resize requests), grouped into spans: the connection, each
18
+ activation, each resize until a frame at the new size is acknowledged, each graphics frame until its acknowledgement,
19
+ each H.264 access unit. Structure and sizes only: no credentials, keystrokes, clipboard or bitmap data. A D3 viewer
20
+ (`tools/pdu-trace/index.html`) lays the flow out in lanes and checks each resize; `tools/pdu-trace/from-log.mjs`
21
+ converts an older debug log. New suites: `test/unit/pdu-trace.ts`, `test/unit/zgfx.ts`, `npm test -- pdu-trace`.
22
+ - The same resizes with the FreeRDP client, for comparison: `TRD_TEST_CLIENT=freerdp npm test -- pdu-trace` reads
23
+ the graphics commands from FreeRDP's own log (`tools/pdu-trace/from-freerdp-log.mjs`), which the helper now writes
24
+ when `WLOG_*` is set in Tabby's environment, and `TRD_FREERDP_PIPELINE=1` puts FreeRDP on the graphics pipeline
25
+ for Windows desktops too (it uses bitmaps there otherwise).
26
+ - `npm test -- fps`: frame pacing under motion (testufo.com in Edge on a Windows desktop): the server's frame rate,
27
+ the client's, and with IronRDP where each frame's time goes (decoder, canvas, acknowledgement) from the trace.
28
+
29
+ **Fixed**
30
+ - Tearing after a live resize with IronRDP on Windows (issue #115): stale pieces of the old picture, black bars at the
31
+ old edge and a garbled taskbar. The trace shows Windows repainting a resized desktop from the bitmap cache, which
32
+ IronRDP cleared on `ResetGraphics` (IronRDP patch 58, upstream [#2011](https://github.com/Devolutions/IronRDP/pull/2011)),
33
+ and a tile column that its Progressive decoder never painted because the server had moved the tiles to a new codec
34
+ context (patch 59, upstream [#2117](https://github.com/Devolutions/IronRDP/pull/2117)). Six resizes in three runs
35
+ against Windows Server 2025 now settle without any of it; the `pdu-trace` suite checks the flow and the picture.
36
+
3
37
  ## 0.6.0-rc.2
4
38
 
5
39
  **Changed**
@@ -38,6 +38,18 @@ After sleep or a network change the desktop reconnects by itself, with growing p
38
38
 
39
39
  **Sharpness › Retina** renders at your screen's device pixels, with the remote's scale set to match. Video (H.264) is used when the remote sends it: Windows does, GNOME only with a hardware encoder (VA-API or NVENC). **Show connection status** shows the frame rate, the round trip and how the picture comes.
40
40
 
41
+ <a id="performance"></a>
42
+
43
+ ## The picture is slow, or the frame rate is low
44
+
45
+ Start with the server. A Windows session renders at about 30 frames a second by default, and no client shows more than the session renders: open [testufo.com](https://testufo.com) in a browser inside the session and read its own frame-rate readout. To raise the cap, set `DWMFRAMEINTERVAL` (DWORD, 15 for 60 fps) under `HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations` on the server and start a new session. With H.264 on the server (Group Policy "Prioritize H.264/AVC 444 graphics mode for Remote Desktop Connections") IronRDP hands each frame to the browser's hardware decoder, which takes a few milliseconds; without it the server sends ClearCodec and RemoteFX Progressive, which cost more per frame. **Show connection status** (Settings › Remote Desktop) shows the frame rate and the bytes as they arrive. Its frame rate counts server frames for IronRDP and paint batches for FreeRDP, so the two numbers aren't comparable with each other; compare each with the readout inside the session instead. If it still feels slow, the PDU trace (below) shows per frame whether the time goes to the decoder, the canvas or waiting for the server.
46
+
47
+ <a id="trace"></a>
48
+
49
+ ## Reporting a picture problem (tearing, a stale picture after a resize)
50
+
51
+ Turn on **Settings › Remote Desktop › Settings › Diagnostics › Write a log file** (Debug), reproduce the problem, then open the log folder: next to the desktop's `.log` is a `.otlp.json`, the PDU trace: every RDP PDU of the connection with its time, what the browser's H.264 decoder did with each picture, and when the canvas was resized and drawn, grouped by resize and by frame. Open it in the viewer at `tools/pdu-trace/index.html` from the repository (drop the file on it) to see the flow of a resize and the checks on it, and attach it to a report along with the log. Neither file holds passwords, keystrokes, clipboard or picture data; both hold the desktop's name and address. See [tools/pdu-trace/README.md](tools/pdu-trace/README.md).
52
+
41
53
  <a id="sound"></a>
42
54
 
43
55
  ## No sound, or the microphone isn't heard
@@ -53,6 +53,7 @@ const vms_1 = require("./vms");
53
53
  const sessionLog_1 = require("./sessionLog");
54
54
  const updates_1 = require("./updates");
55
55
  const diagnosticLog_1 = require("./diagnosticLog");
56
+ const pduTrace_1 = require("./pduTrace");
56
57
  const hostCompat_1 = require("./hostCompat");
57
58
  const unshowable_1 = require("./unshowable");
58
59
  /**
@@ -238,6 +239,14 @@ class DesktopSession {
238
239
  this.log = new sessionLog_1.SessionLog();
239
240
  /** The log file written for a bug report, while the diagnostic log setting is on (see diagnosticLog.ts). */
240
241
  this.diagnostics = null;
242
+ /** The PDU trace of the connection, while the diagnostic log is on (see pduTrace.ts): written as traceFile. */
243
+ this.trace = null;
244
+ this.traceFile = null;
245
+ /** Where this connection went (host:port), for the trace's resource attributes. */
246
+ this.traceDestination = '';
247
+ /** Stops watching the canvas for the trace. */
248
+ this.traceStop = null;
249
+ this.traceSaving = Promise.resolve();
241
250
  /** What the remote display was last set to. */
242
251
  this.remoteSize = null;
243
252
  this.remote = null;
@@ -507,6 +516,10 @@ class DesktopSession {
507
516
  picture = copy;
508
517
  }
509
518
  });
519
+ clean(() => this.traceStop?.());
520
+ this.traceStop = null;
521
+ this.trace?.local('plugin', 'Connection.Ended');
522
+ clean(() => { void this.saveTrace(); });
510
523
  this.connectionDisposers.splice(0).forEach(clean);
511
524
  clean(() => this.indicator?.setActive(false));
512
525
  clean(() => this.ui?.shutdown());
@@ -561,6 +574,35 @@ class DesktopSession {
561
574
  this.proxy?.close();
562
575
  this.overlay.remove();
563
576
  void this.diagnostics?.close();
577
+ void this.saveTrace();
578
+ }
579
+ /**
580
+ * Writes the PDU trace next to the diagnostic log file, as OTLP/JSON (see PduTrace.toOtlp), for the user alone:
581
+ * at the end of each connection, when the desktop closes, and every two minutes meanwhile (see watchTrace).
582
+ * Writes go one after another.
583
+ */
584
+ saveTrace() {
585
+ const trace = this.trace;
586
+ const file = this.traceFile;
587
+ if (!trace || !file) {
588
+ return Promise.resolve();
589
+ }
590
+ const versions = process.versions;
591
+ const meta = {
592
+ pluginVersion: (0, updates_1.installedVersion)(), desktop: this.spec.name, destination: this.traceDestination, client: this.client ?? '',
593
+ graphics: this.graphics, platform: `${process.platform} ${os.release()}`, electron: versions.electron,
594
+ };
595
+ this.traceSaving = this.traceSaving.then(async () => {
596
+ try {
597
+ const json = JSON.stringify(trace.toOtlp(meta));
598
+ await fs.promises.mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
599
+ await fs.promises.writeFile(file, json, { mode: 0o600 });
600
+ }
601
+ catch (error) {
602
+ this.log.push(`pdu trace: not written: ${error?.message ?? error}`);
603
+ }
604
+ });
605
+ return this.traceSaving;
564
606
  }
565
607
  }
566
608
  exports.DesktopSession = DesktopSession;
@@ -2350,6 +2392,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
2350
2392
  headerMinWidth: this.headerSize(store.headerMinWidth),
2351
2393
  headerMinHeight: this.headerSize(store.headerMinHeight),
2352
2394
  client: (0, rdpClient_1.rdpClient)(store.client),
2395
+ relaxOrderChecks: store.relaxOrderChecks === true,
2353
2396
  resize: ['live', 'reconnect', 'off'].includes(store.resize) ? store.resize : 'live',
2354
2397
  sharpness: store.sharpness === 'retina' ? 'retina' : 'standard',
2355
2398
  desk: store.desk === true,
@@ -2577,6 +2620,7 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
2577
2620
  }
2578
2621
  applySize(session, size) {
2579
2622
  session.log.push(`resize: ${size.width}x${size.height} @${size.scale}%`);
2623
+ session.trace?.local('plugin', 'Resize.Requested', { width: size.width, height: size.height, scale: size.scale, mode: this.settingsFor(session).resize });
2580
2624
  const before = session.remoteSize;
2581
2625
  session.remoteSize = size;
2582
2626
  if (session.spec.kind !== 'gnome') {
@@ -3044,6 +3088,35 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3044
3088
  // The status lines carry a stamp of their own already.
3045
3089
  session.log.tee = line => diagnostics.line('plugin', line.replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z /, ''));
3046
3090
  session.log.push(`diagnostics: writing ${diagnostics.file}`);
3091
+ // The PDU trace goes with the log, as OTLP/JSON (see pduTrace.ts and tools/pdu-trace).
3092
+ session.trace = new pduTrace_1.PduTrace();
3093
+ session.traceFile = diagnostics.file.replace(/\.log$/, '') + '.otlp.json';
3094
+ session.log.push(`pdu trace: writing ${session.traceFile}`);
3095
+ }
3096
+ /**
3097
+ * The PDU trace's view of this side while the connection lasts: the canvas (its size and each region drawn),
3098
+ * and a save of the trace every two minutes, so that a crash keeps most of it.
3099
+ */
3100
+ watchTrace(session) {
3101
+ const trace = session.trace;
3102
+ if (!trace) {
3103
+ return;
3104
+ }
3105
+ // IronRDP reveals its canvas asynchronously: look again for a moment.
3106
+ let attempts = 20;
3107
+ const watch = () => {
3108
+ const canvas = session.state === 'connected' ? session.canvas() : null;
3109
+ if (canvas) {
3110
+ session.traceStop?.();
3111
+ session.traceStop = trace.watchCanvas(canvas);
3112
+ }
3113
+ else if (attempts-- > 0) {
3114
+ setTimeout(watch, 100);
3115
+ }
3116
+ };
3117
+ watch();
3118
+ const timer = setInterval(() => { void session.saveTrace(); }, 120_000);
3119
+ session.onConnectionEnd(() => clearInterval(timer));
3047
3120
  }
3048
3121
  /** Where the diagnostic log files go (see diagnosticLog.ts). */
3049
3122
  logFolder() {
@@ -3292,6 +3365,15 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3292
3365
  // certificate authorities (see checkTrusted). One behind an SSH host goes by that host's
3293
3366
  // names, which its certificate can't be checked against: trusted on first use.
3294
3367
  serverName: target.direct ? serverNameOf(asked.host) : undefined,
3368
+ // The PDU trace reads the relayed stream (see pduTrace.ts), while the diagnostic log is on.
3369
+ tap: session.trace ? (direction, data, kind) => {
3370
+ if (kind === 'x224') {
3371
+ session.trace?.x224(direction, data);
3372
+ }
3373
+ else {
3374
+ session.trace?.stream(direction, data);
3375
+ }
3376
+ } : undefined,
3295
3377
  });
3296
3378
  // The desktop was closed while the proxy started: closing it found no proxy, and nothing else would.
3297
3379
  if (!alive()) {
@@ -3917,6 +3999,8 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3917
3999
  signal.addEventListener('abort', stop, { once: true });
3918
4000
  session.onConnectionEnd(stop);
3919
4001
  session.log.push(`client: ${rdpClient_1.RDP_CLIENT_LABELS.freerdp}`);
4002
+ const relaxOrderChecks = spec.relaxOrderChecks ?? this.settingsFor(session).relaxOrderChecks;
4003
+ session.log.push(`FreeRDP drawing order checks: ${relaxOrderChecks ? 'relaxed' : 'strict'}`);
3920
4004
  session.log.push('FreeRDP preview: clipboard, audio, microphone and shared folders are unavailable');
3921
4005
  session.clipboard = 'off';
3922
4006
  const [domain, username] = /^([^\\]+)\\(.+)$/.exec(endpoint.credentials.username)?.slice(1) ?? [endpoint.domain ?? spec.domain ?? '', endpoint.credentials.username];
@@ -3927,9 +4011,12 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3927
4011
  const info = await native.connect({
3928
4012
  host: serverNameOf(spec.id === desktops_1.OWN_DESKTOP ? target.hostname ?? target.label : endpoint.host),
3929
4013
  username, password: endpoint.credentials.password, domain, ...size,
3930
- // GNOME requires the pipeline. Windows uses FreeRDP's native bitmap decoder in this first build.
3931
- pipeline: spec.kind === 'gnome',
4014
+ // GNOME requires the pipeline. Windows uses FreeRDP's native bitmap decoder in this first build;
4015
+ // TRD_FREERDP_PIPELINE=1 in Tabby's environment turns the pipeline on there too, for a diagnosis that
4016
+ // compares the two clients on the same path (test/suites/pdu-trace.ts).
4017
+ pipeline: spec.kind === 'gnome' || process.env.TRD_FREERDP_PIPELINE === '1',
3932
4018
  autologon: spec.kind === 'xrdp',
4019
+ relaxOrderChecks,
3933
4020
  open: async (abort) => {
3934
4021
  const stream = gateway ? await this.throughGateway(target, spec, session, gateway, endpoint, abort) : await target.openTcp(endpoint.host, endpoint.port);
3935
4022
  if (abort.aborted) {
@@ -3988,6 +4075,8 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
3988
4075
  this.watchSize(pane, session);
3989
4076
  session.state = 'connected';
3990
4077
  session.log.push(`connected: ${size.width}x${size.height}`);
4078
+ session.trace?.local('plugin', 'Connected', { width: size.width, height: size.height });
4079
+ this.watchTrace(session);
3991
4080
  session.status('');
3992
4081
  this.tip(pane, session);
3993
4082
  this.labelOnFocus(pane, session);
@@ -4077,11 +4166,12 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
4077
4166
  const [domain, username] = /^([^\\]+)\\(.+)$/.exec(credentials.username)?.slice(1) ?? [endpoint.domain ?? spec.domain ?? '', credentials.username];
4078
4167
  session.status(spec.id === desktops_1.OWN_DESKTOP ? `Connecting to ${target.label}…`
4079
4168
  : target.direct ? `Connecting to ${spec.name}…` : `Connecting to ${spec.name} via ${target.label}…`);
4169
+ // The name the server is signed in to as: the SSH host's for its own desktop, and for its VMs' consoles.
4170
+ session.traceDestination = `${spec.id === desktops_1.OWN_DESKTOP || spec.hyperv ? target.hostname ?? target.label : endpoint.host}:${endpoint.port}`;
4080
4171
  const config = session.ui.configBuilder()
4081
4172
  .withUsername(username)
4082
4173
  .withPassword(credentials.password)
4083
- // The name the server is signed in to as: the SSH host's for its own desktop, and for its VMs' consoles.
4084
- .withDestination(`${spec.id === desktops_1.OWN_DESKTOP || spec.hyperv ? target.hostname ?? target.label : endpoint.host}:${endpoint.port}`)
4174
+ .withDestination(session.traceDestination)
4085
4175
  .withProxyAddress(session.proxy.url)
4086
4176
  .withServerDomain(domain)
4087
4177
  .withAuthToken(session.proxy.token)
@@ -4112,7 +4202,8 @@ let RemoteDesktopService = RemoteDesktopService_1 = class RemoteDesktopService {
4112
4202
  // The vendor owns surface retirement and all resource accounting; its public option bounds the
4113
4203
  // browser decoders without wrapping away lifecycle notifications (see h264.ts).
4114
4204
  session.h264 = (0, h264_1.createH264Decoder)(rdp.WebCodecsH264Decoder, { onFailure: (reason) => session.log.push(`h264: failed: ${reason}`) });
4115
- config.withExtension(rdp.h264Decoder(session.h264));
4205
+ // Traced: each access unit handed to the browser's decoder and what came back (see pduTrace.ts).
4206
+ config.withExtension(rdp.h264Decoder(session.trace ? session.trace.wrapH264Decoder(session.h264) : session.h264));
4116
4207
  }
4117
4208
  // GNOME Remote Desktop requires the graphics pipeline. Windows (and xrdp) do better with bitmaps than with
4118
4209
  // the pipeline without H.264; with H.264, Windows streams what changes a lot (video) as video. A build
@@ -55,6 +55,11 @@ function askDesktop(pane, options) {
55
55
  </select>
56
56
  <select class="form-control" name="client" aria-label="RDP client" title="RDP client. Applies on the next connection."></select>
57
57
  <div class="text-muted small">FreeRDP preview: display and input; clipboard, sound and shared folders are unavailable.</div>` + `
58
+ <select class="form-control" name="relaxOrderChecks" aria-label="Relax drawing order checks (FreeRDP)" title="For a black screen or unannounced drawing order from a server or PAM proxy. Applies on the next FreeRDP connection.">
59
+ <option value="">Drawing order checks: as in Settings</option>
60
+ <option value="on">Relax drawing order checks (FreeRDP)</option>
61
+ <option value="off">Keep strict drawing order checks</option>
62
+ </select>` + `
58
63
  <select class="form-control" name="account" title="Saved accounts are added in Settings › Remote Desktop › Accounts"></select>
59
64
  <input class="form-control" name="username" placeholder="User name (optional; asked when connecting)" spellcheck="false">
60
65
  <input class="form-control" name="domain" placeholder="Domain (optional)" spellcheck="false">` + `
@@ -87,6 +92,7 @@ function askDesktop(pane, options) {
87
92
  const client = field('client');
88
93
  client.append(new Option('RDP client: as in Settings', ''), ...Object.entries(rdpClient_1.RDP_CLIENT_LABELS).map(([id, label]) => new Option(label, id)));
89
94
  client.value = (0, rdpClient_1.ownRDPClient)(initial.client) ?? '';
95
+ field('relaxOrderChecks').value = initial.relaxOrderChecks === true ? 'on' : initial.relaxOrderChecks === false ? 'off' : '';
90
96
  // A VM saved from the host's list is xrdp on the host's word (see xrdpFromHost), which is a choice of its own here:
91
97
  // kept as long as it is chosen, so that the desktop still asks before signing in without NLA. Any kind picked is
92
98
  // the user's, xrdp included.
@@ -213,8 +219,10 @@ function askDesktop(pane, options) {
213
219
  gatewayAccount: gatewayText && gatewayAccount.value || undefined,
214
220
  clipboard: clipboard.value || undefined,
215
221
  client: (0, rdpClient_1.ownRDPClient)(client.value),
222
+ relaxOrderChecks: field('relaxOrderChecks').value === 'on' ? true
223
+ : field('relaxOrderChecks').value === 'off' ? false : undefined,
216
224
  };
217
- for (const key of ['username', 'domain', 'account', 'wake', 'gateway', 'gatewayAccount', 'clipboard', 'client']) {
225
+ for (const key of ['username', 'domain', 'account', 'wake', 'gateway', 'gatewayAccount', 'clipboard', 'client', 'relaxOrderChecks']) {
218
226
  if (entry[key] === undefined) {
219
227
  delete entry[key];
220
228
  }
package/dist/desktops.js CHANGED
@@ -60,7 +60,8 @@ function specOf(extra) {
60
60
  // Its own clipboard sharing, or none (the setting's).
61
61
  const clipboard = (0, clipboard_1.ownClipboard)(extra?.clipboard);
62
62
  const client = (0, rdpClient_1.ownRDPClient)(extra?.client);
63
- const own = { ...clipboard ? { clipboard } : {}, ...client ? { client } : {} };
63
+ const own = { ...clipboard ? { clipboard } : {}, ...client ? { client } : {},
64
+ ...typeof extra?.relaxOrderChecks === 'boolean' ? { relaxOrderChecks: extra.relaxOrderChecks } : {} };
64
65
  const hyperv = (0, hyperv_1.vmId)(extra?.hyperv);
65
66
  if (hyperv) {
66
67
  return hyperVSpec(hyperv, configText(extra.name) || hyperv, {
package/dist/freerdp.js CHANGED
@@ -11,6 +11,7 @@ exports.hasFreeRDP = hasFreeRDP;
11
11
  exports.helperStopped = helperStopped;
12
12
  exports.ipcFrame = ipcFrame;
13
13
  exports.numbers = numbers;
14
+ exports.freeRDPStart = freeRDPStart;
14
15
  exports.freeRDPRelay = freeRDPRelay;
15
16
  exports.decodeNativeFrame = decodeNativeFrame;
16
17
  const child_process_1 = require("child_process");
@@ -32,8 +33,11 @@ function freeRDPAuthorities(authorities) {
32
33
  }
33
34
  function helperEnvironment() {
34
35
  // The helper needs OS paths/locale, not the parent app's API keys or the test runner's passwords.
36
+ // WLOG_*: FreeRDP's own logging, for a diagnosis (see tools/pdu-trace/README.md): the helper keeps its log off
37
+ // unless these ask for a channel's log into a file (WLOG_APPENDER=FILE); its console stays the IPC's.
35
38
  const keys = ['PATH', 'HOME', 'USERPROFILE', 'APPDATA', 'LOCALAPPDATA', 'SystemRoot', 'WINDIR', 'TEMP', 'TMP', 'TMPDIR',
36
- 'LANG', 'LC_ALL', 'TZ', 'OPENSSL_CONF'];
39
+ 'LANG', 'LC_ALL', 'TZ', 'OPENSSL_CONF', 'WLOG_FILTER', 'WLOG_APPENDER', 'WLOG_FILEAPPENDER_OUTPUT_FILE_PATH',
40
+ 'WLOG_FILEAPPENDER_OUTPUT_FILE_NAME', 'WLOG_PREFIX'];
37
41
  return { ...Object.fromEntries(keys.filter(key => process.env[key] !== undefined).map(key => [key, process.env[key]])),
38
42
  OPENSSL_MODULES: (0, path_1.dirname)(nativeHelperPath()) };
39
43
  }
@@ -114,6 +118,18 @@ function numbers(...values) {
114
118
  values.forEach((v, i) => out.writeUInt32BE(v >>> 0, i * 4));
115
119
  return out;
116
120
  }
121
+ /** The native helper's IPC 3 start message: six strings followed by six uint32 fields. */
122
+ function freeRDPStart(options, relay) {
123
+ const strings = [options.host, options.username, options.password, options.domain, '', relay.token];
124
+ const fields = strings.map(value => {
125
+ if (value.includes('\0')) {
126
+ throw new Error('FreeRDP settings cannot contain a null character');
127
+ }
128
+ const text = Buffer.from(value);
129
+ return Buffer.concat([numbers(text.length), text]);
130
+ });
131
+ return Buffer.concat([...fields, numbers(relay.port, options.width, options.height, +options.pipeline, +!!options.autologon, +!!options.relaxOrderChecks)]);
132
+ }
117
133
  /** Only a process holding the per-attempt token can open the SSH channel or gateway connection. */
118
134
  async function freeRDPRelay(open) {
119
135
  const token = (0, crypto_1.randomBytes)(32).toString('hex');
@@ -270,15 +286,7 @@ class FreeRDPProcess {
270
286
  }
271
287
  await new Promise((resolve, reject) => child.stdin.write(ipcFrame('A', authorities.subarray(at, at + 64 * 1024)), error => error ? reject(error) : resolve()));
272
288
  }
273
- const strings = [options.host, options.username, options.password, options.domain, '', this.relay.token];
274
- const fields = strings.map(value => {
275
- if (value.includes('\0')) {
276
- throw new Error('FreeRDP settings cannot contain a null character');
277
- }
278
- const text = Buffer.from(value);
279
- return Buffer.concat([numbers(text.length), text]);
280
- });
281
- this.send('S', Buffer.concat([...fields, numbers(this.relay.port, options.width, options.height, +options.pipeline, +!!options.autologon)]));
289
+ this.send('S', freeRDPStart(options, this.relay));
282
290
  }
283
291
  catch (error) {
284
292
  this.fail(error);