Commit Graph

2310 Commits

Author SHA1 Message Date
Marc-Andre Moreau 0b6f986698 feat: redirect RDP media, input, graphics, and session state to CEF
Connect the CEF remote device hooks and browser shell to RDP virtual
channels and session state:
- Redirect client cameras over MS-RDPECAM (I420, YUY2, NV12, MJPEG, and
  OpenH264 H.264), microphones over MS-RDPEAI, audio playback over
  RDPSND, WebAuthn ceremonies over MS-RDPEWA, and file clipboard copies
  over CLIPRDR.
- Stream desktop surfaces over MS-RDPEGFX (AVC420 and dirty-region
  fallback), forward MS-RDPEI multitouch and pen contacts, map browser
  cursors to RDP pointer updates, and export Ctrl/Cmd+P pages as PDFs to
  the restricted RDPDR download sink while blocking native print dialogs.
- Forward MS-RDPEL geolocation fixes, client time zones, and desktop
  scale factors through DevTools overrides while isolating the browser
  and renderer processes to UTC by default, and support cookie-based
  auto-reconnect.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-16 12:31:36 -05:00
Marc-Andre Moreau 5abd9254a6 feat: add CEF remote device hooks
Patch CEF and Chromium so the RDP server can feed the browser's camera,
microphone, and WebAuthn authenticator, and paste files through the
process-private clipboard.
The browser never enumerates host capture devices or authenticators,
and desktop capture is always denied.

A device simulator and an end-to-end suite exercise every hook until the
RDPECAM, RDPEAI, RDPEWA, and CLIPRDR file-transfer channels feed them.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-16 12:31:27 -05:00
Marc-Andre Moreau 103f8ca986 feat: isolate and redirect the CEF clipboard
Keep browser clipboard data in memory so remote sessions do not use the
host clipboard. Bridge text, HTML, and images to the RDP client through
CLIPRDR, and require a patched CEF runtime at startup.

Select headless Ozone on Linux and let Rust handle POSIX shutdown so
browser profiles can be cleaned up.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-16 12:31:27 -05:00
Marc-Andre Moreau 2fe396786e feat: add a CEF-based browser server
Render CEF offscreen over RDP and forward browser input to it.
Deliver downloads through a restricted client-side RDPDR sink on
macOS, Linux, and Windows.

Keep the listener on loopback and use a fresh profile for each run.
Clipboard redirection and a production isolation boundary are not
provided.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-16 12:31:27 -05:00
Marc-André Moreau a3537440fa fix(client): keep audio playback enabled for custom rdpsnd channels (#2449)
`build_connector` clears `connector_config.enable_audio_playback` when
the built-in `sound` channel is disabled, which causes `ClientConnector`
to set `ClientInfoFlags::NO_AUDIO_PLAYBACK` even when an embedder
attaches a custom `"rdpsnd"` static channel through
`ConfigBuilder::with_static_channel` or
`ConfigBuilder::with_static_channel_instances`.

Restore `connector.config.enable_audio_playback` after running
`config.extensions.static_channels` when no `"rdpsnd"` static channel
was attached before extensions, `config.connector.enable_audio_playback`
is enabled, and `"rdpsnd"` is registered by an extension (checked via
`get_by_channel_name_key`), and defer attaching the no-op `"rdpsnd"`
RDPDR companion until after extensions when no `"rdpsnd"` channel was
registered.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-16 12:25:30 -05:00
Marc-André Moreau 7ebc617f4a fix(client): treat EOF after ShutdownRequest as graceful disconnect (#2451)
Under [MS-RDPBCGR] §1.3.1.4.2, a server may close the transport
connection after receiving a client-initiated ShutdownRequest PDU
without first sending a ShutdownRequestDenied or MCS Disconnect Provider
Ultimatum PDU. Previously, `active_session` treated the resulting clean
frame-boundary `UnexpectedEof` as a transport read failure, reporting an
error and triggering automatic reconnection when configured. In
addition, sending `RdpInputEvent::Close` through the input channel did
not record `graceful_shutdown_sent`, and continuing to write
non-terminating responses after `ShutdownRequest` could trigger a TCP
reset on in-flight server PDUs after the peer closed.

Record `graceful_shutdown_sent` when `RdpInputEvent::Close` encodes a
`ShutdownRequest` PDU, suppress non-terminating outgoing session writes
once `ShutdownRequest` has been sent, and end the session with
`GracefulDisconnectReason::UserInitiated` when `reader.read_pdu()`
returns `UnexpectedEof` with an empty read buffer after a shutdown
request has been sent. Unsolicited disconnects and truncated frames
continue to be reported as transport errors.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-16 11:51:25 -05:00
Greg Lamberson c759493afa fix(daemon): keep session facts current and complete (#2447)
When an automatic reconnect ends in `Connected`, the server rejected the
cookie and logged on afresh, so the facts reported before belong to a
session this connection didn't return to. The daemon now notes what the
server reports from the moment a reconnect begins and keeps only that
when the reconnect ends this way. A reconnect that ends in
`AutoReconnected` keeps everything as before. After a rejected cookie
the monitor layout reads empty until the server sends one, because the
client passes on the layout from connection setup only on a first
connection.

A Network Characteristics Result carries baseRTT or bandwidth only when
its request type says so (MS-RDPBCGR 2.2.14.1.5). A result that leaves
one out now keeps the value reported before, in the connector's
connect-time measurement and in the daemon's session facts, instead of
erasing it. averageRTT is in every result and always replaces.

The docs now also say that a resize falling back to a new connection
clears the facts, which it already did. The client builds its
connect-time event in place of a single-use helper, and the resize
fallback's facts check has a test of its own.
2026-11-16 10:28:52 -05:00
janost c1dcf654e2 fix(server): end a server disconnect with an ultimatum (#2385)
`ServerEvent::Disconnect` sent its Set Error Info PDU only to a client
that set `RNS_UD_CS_SUPPORT_ERRINFO_PDU`, then closed the socket.
FreeRDP 3 leaves that flag off by default, so Remmina and `xfreerdp3
/auto-reconnect` saw a bare close, took it for a network failure, and
reconnected with their saved credentials about half a second later.

The Disconnect event now always ends with an MCS Disconnect Provider
Ultimatum, reason rn-provider-initiated (MS-RDPBCGR 1.3.1.4.3,
3.1.5.1.1). A client that opted in gets the Set Error Info PDU first, as
before. FreeRDP maps the ultimatum to `ERRINFO_RPC_INITIATED_DISCONNECT`
and stays disconnected.

Tests (testsuite-extra e2e):
-
`a_disconnect_tells_a_client_without_error_info_that_the_server_ended_the_session`:
the IronRDP client, with `RNS_UD_CS_SUPPORT_ERRINFO_PDU` cleared in its
Connect Initial, gets `ServerInitiated`. It fails on master, where the
client gets nothing.
-
`a_disconnect_tells_an_error_info_client_the_reason_before_the_ultimatum`:
a client that opted in gets the reason, then the ultimatum.

I ran the same change in an RDP server built on ironrdp-server. After a
server-side disconnect, Remmina 1.4.43 and `xfreerdp3 /auto-reconnect`
(FreeRDP 3.32.2) both stayed disconnected. Before, both reconnected.

Closes #2384
2026-11-15 22:38:54 -05:00
Rophy Tsai 19ee8f1ab6 fix(server): log a failed connection at INFO (#2393)
`RdpServer::serve` logged every connection that ended with an error at
ERROR, also when the server worked correctly: a port scan, a TCP health
check, a wrong password, or a client that closes the connection. These
are normal events, not server faults, but monitoring that alerts on
ERROR alerted on them.

A failed connection does not stop `serve`, so it is not an error of the
server. `serve` now logs it once at INFO as "Connection ended", with the
peer address and the error attached, whatever the cause. This is what
OpenSSH, TigerVNC and RustDesk do: each logs every connection end at
INFO with its reason, and none of them tries to tell from the error who
caused it. With the peer address in the line, a tool that reads the log
can still find repeated refused logons from one address.

**Upgrade note:** a server fault in a connection, for example a display
handler that fails, is also logged at INFO now. To alert on the errors
that matter to it, an application inspects the error in
`ConnectionHandler::on_disconnected`, which already receives it; its
documentation now says so.

Fixes #2392
2026-11-15 21:56:07 -05:00
Anton Isaiev 16866d1272 fix(rdpdr): announce drive names outside ASCII as UTF-8 (#2383)
A redirected drive whose name has characters outside ASCII was announced
with each of them replaced by `_`, so `їжачок` reached the server as
`______`, and names differing only outside ASCII, such as `Звіт` and
`Опис`, collided. Windows reads DeviceData as 8-bit characters, and
FreeRDP fills it with the UTF-8 bytes of the name: on Windows Server
2025, FreeRDP 3.32.1 with `/drive:їжачок,…` lists the drive as "їжачок
on \<client\>", while the same name sent as UTF-16, as `ironrdp-rdpdr`
0.9.0 does, is refused with `STATUS_UNSUCCESSFUL` on Windows Server 2019
and 2025.

A character outside ASCII now goes as its UTF-8 bytes. None of those
bytes is zero or ASCII, so the name stays null-terminated and cannot
gain a character that MS-RDPEFS 2.2.1.3 forbids; those characters, a
colon before the end and NUL are still replaced with `_`.
PreferredDosName is unchanged. A server that decodes DeviceData in a
code page other than UTF-8 would show such a name as mojibake instead of
underscores.

Fixes #2382
2026-11-15 21:54:48 -05:00
janost 2139aacfd7 fix(egfx): keep ack suspension across graphics reset (#2378)
After a client suspended frame acknowledgements, `resize` and
`resize_with_monitors` ended the suspension along with the pending
frames. The client sends SUSPEND_FRAME_ACKNOWLEDGEMENT once and does not
send it again after RDPGFX_RESET_GRAPHICS_PDU: FreeRDP sends it for the
first frame decoded after CapsConfirm and restarts that count only on
CapsConfirm and channel close. So after a resize the server counted
every new frame as in flight, no acknowledgement came, and once
`max_frames_in_flight` frames were outstanding, backpressure held all
further frames until the channel was reopened.

Clearing pending frames for a graphics reset now keeps the suspension,
along with the frames that can still resume it. A new capability
exchange and a channel close still end it, because the client starts
over after the next CapsConfirm.

Tests in ironrdp-testsuite-core check that frames sent after a reset are
not counted while the suspension holds, that an acknowledgement after
the reset ends it, and that a new CapabilitiesAdvertise or a channel
close also ends it.
2026-11-15 21:50:00 -05:00
Greg Lamberson 151e62eb35 test: set network_characteristics in a web client test (#2446)
The web client's monitor layout test builds a `ConnectionResult` field
by field, so it stopped compiling when `ConnectionResult` gained
`network_characteristics` (#2437), and master's Web Client job fails
with E0063. The test now sets the field to `None`, as for a connection
that reported no connect-time measurement.
2026-11-15 21:46:13 -05:00
brokenlander fe9608b2ab feat(web): add monitor layout extensions (#2423)
The web client sent no Client Monitor Data and only logged the server's
monitor layout, so an application could not span one session across
several screens or learn the layout the server applied.

`monitor_layout` sends up to 16 monitors as Client Monitor Data
(MS-RDPBCGR 2.2.1.3.6), five numbers each: left, top, right and bottom
(both inclusive) and flags.
A valid layout has exactly one primary monitor at (0, 0), ordered
rectangles, and a 200–32,766-pixel virtual desktop in each dimension.
The requested desktop size is derived from the monitor union, overriding
any configured size; an invalid list is logged and ignored.

`monitor_layout_callback` is called in the same form with the layout the
server sends during connection finalization, after a
deactivation-reactivation sequence, and in a Monitor Layout PDU during
the session.
`iron-remote-desktop-rdp` exports `monitorLayout` and
`monitorLayoutCallback`, which take and pass `MonitorRect` objects.
The TypeScript callback exposes only the primary flag.

---------

Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 18:18:01 -05:00
GlassOnTin 6cdd9cc206 fix(pdu): tolerate under-declared VRDP pointer PDU (#1536)
VirtualBox's VRDP server declares `totalLength` as 24 (the Share Control
Header, Share Data Header, 4-byte `TS_POINTER_PDU` prefix, and leading
2-byte `xorBpp` field) on complete slow-path pointer shape updates,
omitting the `TS_COLORPOINTERATTRIBUTE` structure and mask bytes.
Rejecting that mismatch in `ShareControlHeader::decode`, or splitting
the MCS user data at byte 24 as concatenated Share Control PDUs in
`x224::Processor`, drops the session on the first pointer shape update.

Accept `totalLength = 24` on uncompressed `ShareDataPdu::Pointer` PDUs
when `decode_slow_path_pointer` decodes a Color or New pointer attribute
that consumes the entire payload (allowing the optional 1-byte trailing
`pad` field specified in MS-RDPBCGR 2.2.9.1.1.4.4 and 2.2.9.1.1.4.5). In
`x224::Processor`, gate the single-pointer check on
`VRDP_POINTER_DECLARED_LENGTH` across `&data[offset..]` before splitting
concatenated Share Control PDUs; a self-consistent 24-byte Cached
Pointer PDU followed by another PDU still splits normally because
`Cached` is not a pointer shape attribute and trailing PDU bytes fail
the complete-pointer check.

Co-authored-by: GlassOnTin <GlassOnTin@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: GlassOnTin <GlassOnTin@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net>
2026-11-15 18:17:01 -05:00
Marc-André Moreau 865b2aa3b3 feat(server): add validity-guarded clipboard and audio server events (#2443)
Allow clipboard, audio output, and audio input producers to attach a
nonblocking validity predicate to queued server events so events that go
stale behind earlier transport writes do not mutate channel state,
consume `WAVE_KEEP` slots, or write to the connection.

Add channel-targeted `RdpeaiServerMessage::OpenOnChannel` and
`ChangeFormatOnChannel` variants so runtime-created `AUDIO_INPUT`
dynamic channels can be driven by channel ID.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 18:14:01 -05:00
Marc-André Moreau 2e65d08181 feat(rdpdr): send UserLoggedOn and propagate server device-removal errors (#2440)
Send `PAKID_CORE_USER_LOGGEDON` after `ClientCoreCapabilityResponse`
when the client general capability set advertises
`RDPDR_USER_LOGGEDON_PDU` (`[MS-RDPEFS]` §3.3.5.1.5) so clients that
wait for user logon before announcing drives can complete redirection.

Add `RdpdrServerBackend::max_message_size`, `try_on_device_remove`, and
`on_reinitialize` so server backends can bound static-channel reassembly
and fail the channel before tracked device state is discarded on removal
or duplicate initialization.

Expose `CoreCapability::supports_user_logged_on`,
`DeviceAnnounceHeader::device_type`, and
`ClientDriveSetInformationResponse::{device_io_reply, length}` in
`ironrdp_rdpdr::pdu::efs`.

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 17:45:51 -05:00
Marc-André Moreau e05f890d0a feat(server): bound dynamic channel messages and report RDPSND backpressure (#2441)
Cap inbound dynamic virtual channel message reassembly to 64 KiB on
`RdpeiServer` and 256 KiB on `GraphicsPipelineServer`, `GfxDvcBridge`,
and `RdpeaiServer`, and forward RDPEI channel teardown to
`RdpeiHandler::close`.

Bound `TouchFrame`, `TouchEventPdu`, `PenFrame`, and `PenEventPdu`
preallocation against the remaining payload bytes so a 2-byte count
header cannot preallocate more items than the buffer can hold.

Add `RdpsndServerHandler::unconfirmed_waves_changed` and invoke it on
wave transmission and on the first timestamp-valid `WaveConfirm` so
audio producers can track in-flight unconfirmed waves.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 17:45:02 -05:00
HydrogenE7 854b5b927a fix(web): avoid probing clipboard.read() during WebKit initialization (#2396)
## Problem

In `web-client/iron-remote-desktop/src/services/clipboard.service.ts`,
`initClipboard()` checks `navigator.permissions.query({ name:
'clipboard-read' })` and, when that throws, calls `await
navigator.clipboard.read()` in the `catch` block to probe Firefox's
`dom.events.testing.asyncClipboard` preference.

On WebKit (Safari, macOS `WKWebView`, iOS/iPadOS `WKWebView`, and
WebKitGTK), `"clipboard-read"` is not a supported `PermissionName` in
the Permissions API, so `navigator.permissions.query` throws
`TypeError`. Calling `await navigator.clipboard.read()` during
`initClipboard()` (`onMount`) then has two undesirable effects on
WebKit:

1. If transient user activation is active when the component mounts,
WebKit immediately pops up its native floating "Paste" confirmation menu
before the user has even connected or pasted.
2. When that read is dismissed or rejected for lack of transient
activation, `ClipboardApiSupported` is downgraded to `TextOnly`, which
disables `ClipboardItem` (`image/png` and `text/html`) even when
`autoClipboard` polling is disabled (`setEnableAutoClipboard(false)`)
and clipboard transfers are driven manually via
`saveRemoteClipboardData()` / `sendClipboardData()`.

## Solution

- Detect WebKit user agents in the `permissions.query` `catch` path and
skip calling `navigator.clipboard.read()` during `initClipboard()`.
- When `autoClipboard` is enabled on WebKit, fall back to `TextOnly` so
the 100ms background polling loop is not scheduled; when `autoClipboard`
is disabled, keep `ClipboardApiSupported.Full` so manual
`saveRemoteClipboardData()` and `sendClipboardData()` retain full
`ClipboardItem` support (`image/png`, `text/html`, and `text/plain`).
- Add a unit test in `clipboardLifecycle.test.ts` covering WebKit
initialization and manual remote clipboard saving.

## Verification

- `vitest` unit tests in
`web-client/iron-remote-desktop/src/services/clipboardLifecycle.test.ts`
and `readyEvent.test.ts`.
- Tested in macOS `WKWebView` with `setEnableAutoClipboard(false)`.
2026-11-15 17:31:38 -05:00
Marc-André Moreau b456259eaa feat(server): add MS-RDPECAM camera redirection processors (#2445)
Add `EnumerationServer`, `DeviceServer`, and `DesiredCameraFormat` so an
RDP server can negotiate [MS-RDPECAM] protocol versions, track announced
client cameras, and drive per-device dynamic virtual channels.

`DeviceServer` activates the device, selects a color stream, negotiates
an uncompressed or MJPEG format within caller-specified dimension bounds
(or H.264 when explicitly enabled), issues sample credits as frames are
delivered, and stops active streams before deactivating the device on
shutdown or setup/sample failure.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 17:29:08 -05:00
Marc-André Moreau 843d02fa0e feat(server): add MS-RDPEL location channel processor (#2442)
Implement `LocationServer`, `LocationHandler`, and `LocationFix` to
decode client `[MS-RDPEL]` location updates over the
`Microsoft::Windows::RDS::Location` dynamic virtual channel. Reconstruct
`BaseLocation3d`, `Location2dDelta`, and `Location3dDelta` PDUs in exact
integer nanodegrees, bound incoming DVC messages with
`max_message_size`, and invalidate the delta base when an update is
malformed or out of range per `[MS-RDPEL]` section 3.3.5.4.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 17:28:30 -05:00
Aftab Hussain 6217a99ae1 feat(cliprdr): add macOS native clipboard support (#2408)
Closes #359.

## What changed

- Add a macOS `NSPasteboard` native clipboard backend for
`ironrdp-cliprdr-native`:
  - text in both directions
  - image exchange via `CF_DIB`/`CF_DIBV5`
- Finder-native file lists with lazy
`NSFilePresenter`/`NSFileCoordinator` placeholders, including
directories and nested relative paths
- Require a size in remote file descriptors and reject unsafe paths or
descriptors without a size.
- Wire `MacClipboard` into `ironrdp-viewer` on the main thread, with
polling scheduled only while clipboard work is outstanding.
- Harden clipboard ownership and shutdown: remove incomplete
placeholders, let an active Finder copy finish before deleting completed
sources, never delete destination files, and clear the pasteboard only
when it still contains this session's publication.

## Validation

- `cargo test --workspace`
- `cargo check -p ironrdp-cliprdr-native -p ironrdp-viewer`
- `cargo clippy -p ironrdp-cliprdr-native -p ironrdp-viewer
--all-targets --no-deps -- -D warnings`
- `cargo fmt -p ironrdp-cliprdr-native -p ironrdp-viewer -- --check`

Live test on macOS against a Windows RDP host:

- local → remote text, image, and file upload through Finder → Explorer
- remote → local text and file lists
- quit during a phase-1 download, after a completed download, and while
a Finder copy was in progress; the destination was preserved, staging
was removed, and the viewer exited cleanly

The implementation keeps the existing safety defaults: Finder-native
placeholders only, no File Provider/FSKit/FUSE or custom transfer UI, no
automatic local-drive mapping, and clipboard access stays on the main
thread.

---------

Co-authored-by: Marc-Andre Moreau <mamoreau@devolutions.net>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 17:27:06 -05:00
Marc-André Moreau eea9abea75 feat(server): preserve in-flight reactivation input and client timezone (#2439)
A client can have Fast-Path or Slow-Path input frames in flight when the
server starts a Deactivation-Reactivation Sequence.
During `CapabilitiesWaitConfirm`, the acceptor previously expected only
X.224 PDUs and rejected Slow-Path Input PDUs when waiting for Confirm
Active, dropping Fast-Path input and failing reactivation on Slow-Path
input.
Hint RDP framing and buffer both Fast-Path and I/O-channel Slow-Path
input frames alongside virtual-channel traffic in `pending_input_events`
so they replay in arrival order after reactivation completes.

Capture `TS_TIME_ZONE_INFORMATION` from Extended Client Info into
`AcceptorResult::timezone_info`, preserve it across reactivation, and
forward it through `ironrdp_server::ConnectionInfo::timezone_info`.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 17:26:15 -05:00
Marc-André Moreau e6b323657e feat(server): add MS-RDPEWA WebAuthn RPC processor (#2444)
Add `RdpewaServerRpc` and `RdpewaWebAuthnRequest` to drive
server-initiated `[MS-RDPEWA]` (`WebAuthN_Channel`) `IUVPAA`,
`WEB_AUTHN` (`MakeCredential` and `GetAssertion`), and `CANCEL_CUR_OP`
RPCs, bounding inbound DVC messages to 256 KiB and aborting unanswered
ceremonies with `E_ABORT` on channel close, drop, or declined channel
creation via `DvcServerProcessor::creation_failed`.

Order `CborKey` according to CTAP2 section 6 and RFC 8949 section 4.2.3
canonical CBOR (by CBOR major type first, then encoded byte length, then
lexicographically by encoded bytes), align `WebAuthnPara` and
`DeviceInfo` with `[MS-RDPEWA]` wire field names (`requireResident`,
`preferResident`, `attestationPreference`, and lowercase
`manufacturer`/`product` aliases) and user-verification flag constants
(`CTAPCLT_UV_*`), and read top-level `request` bytes for `CancelCurOp`
in `RdpewaClient`.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 17:25:31 -05:00
Marc-André Moreau 555f872f0f feat(agent): report server session facts (#2437)
Retain and expose server-reported session ID, logon status and error,
network characteristics, and monitor layout through `session info` in
human, JSON, or NDJSON format.

Capture connect-time network measurements, clear facts when a server
redirects or a fallback resize starts a new connection, preserve them
across automatic reconnects, and report session information as
unavailable in the ActiveX backend.

Co-authored-by: Greg Lamberson <greg@lamco.io>
Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net>

---------

Co-authored-by: Greg Lamberson <greg@lamco.io>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 17:21:52 -05:00
brokenlander 2760894fb6 feat(web): add desktop scale and color depth (#2421)
The web client always sent a desktop scale factor of 0 and a 16-bit
color depth (32 with `legacy_graphics`). On a high-density screen a
session therefore showed either tiny text, when sized in device pixels,
or a blurry upscaled picture, when sized in CSS pixels.

`desktop_scale_factor` takes the display scale in percent (100 to 500)
and sends it with the desktop size, together with the matching device
scale factor (100, 140 or 180). `color_depth` takes 15, 16, 24 or 32 and
replaces the bitmap color depth, including the one `legacy_graphics`
picks. Values outside those sets are logged and ignored.
`iron-remote-desktop-rdp` exports `desktopScaleFactor` and `colorDepth`.

---------

Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-15 15:47:15 -05:00
shellden-dev db483e40e7 test(core): tie empty V-bar tests to FreeRDP (#2436)
This follows up on the automated review of #2433, which arrived just
before the merge.

I checked FreeRDP's libfreerdp/codec/clear.c at 3.33.1, in
clear_decompress_bands_data. A full V-bar cache hit on an entry it never
stored gets a zero-filled column of the band height (resize_vbar_entry).
A short V-bar cache hit on such an entry has a pixel count of zero, so
the rebuilt column is all band background. The two paths are different
in FreeRDP too, and the decoder already does the same, so there is no
behavior change.

One difference stays: when yOn plus the short V-bar pixel count goes
past the band height, FreeRDP clamps and keeps going, while IronRDP
returns an error. That check was there before #2433, and MS-RDPEGFX
2.2.4.1.1.2.1.1.2 says the short V-bar data MUST NOT exceed the band
below yOn, so I kept it.

The comment in resolve_vbar now says exactly what FreeRDP does, and the
bound check is written with < as the style guide asks.

The tests now have oracle markers: FreeRDP pinned to a commit for the
two empty entry tests, the spec for the cache miss test, and a mutant
guard for the yOn test, because no spec or reference decides that
rejection. The yOn test checks the invalid field, the asserts look only
at the BGR bytes because the alpha byte is IronRDP's own surface
convention, and the bands tests share one stream builder.

Tested with cargo xtask check fmt, lints, tests, typos, locks and
features.

---------

Co-authored-by: Shellden <356462267+shellden-dev@users.noreply.github.com>
2026-11-15 20:19:31 +00:00
Nahum Shalman 7039241118 fix(web): crop pointer margins before scaling (#2427)
The web client scales a pointer larger than 32x32 down to fit, since a
browser falls back to its own cursor near the viewport edge for larger
ones. A server may draw a small pointer in a large, mostly transparent
bitmap: a Linux guest's virtio-gpu cursor is 64x64 with the arrow in its
top-left corner. Scaled whole, the arrow showed at half its size.

The fully transparent margin is now cut off first, keeping the hotspot
inside, so only what shows is scaled, and usually nothing is.

Scaling rounds each side down, so a long, thin pointer such as 64x1
scaled to 32x0, which the resizer refuses, ending the session. A raw
33x1 pointer could already do this, and cropping makes such sizes
reachable from ordinary 64x64 bitmaps, so each scaled side is now at
least one pixel. The scale computation moves to the cursor module so it
can be tested on the host.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 15:08:14 -05:00
meanaverage 7fc8a6fca3 feat(web): audio playback (RDPSND) through an audioPlayback callback (#2020)
## Problem

The web client has no audio output. It only attaches a no-op RDPSND
processor (to satisfy RDPDR's channel dependency when a printer is
redirected), so the remote desktop's sound is discarded.

## Change

- **`iron-remote-desktop-rdp`:** a new `audioPlayback(callback)`
extension. The callback receives `{ type: 'wave', sampleRate, channels,
data }` (interleaved 16-bit little-endian PCM in a `Uint8Array`), `{
type: 'volume', left, right }` (0 to 1) and `{ type: 'close' }`. Playing
it (for example, scheduling Web Audio buffers) is left to the embedding
application, as with the clipboard.
- **`ironrdp-web`:** a `WasmAudioBackend` (`RdpsndClientHandler`)
advertising uncompressed 16-bit PCM (stereo, 48, 44.1 and 22.05 kHz). It
forwards what the server sends to the session loop, which calls the
JavaScript callback. With a callback, `enable_audio_playback` is set in
the client info.
- Windows requires RDPDR to be advertised before it sends RDPSND
traffic, as documented in [MS-RDPEA Appendix
A<1>](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpea/deaaab30-d4d6-473e-ac56-3f76c4f6fb24#Appendix_A_1),
with Windows XP and Server 2003 excepted. Without a printer, a
device-less RDPDR (`NoopRdpdrBackend`) is attached; with one, the
printer's RDPDR serves, and the real RDPSND replaces the no-op one.
- Off by default: without the extension, nothing changes.

## Original validation

- At the original revision, unit tests in
`crates/ironrdp-web/src/audio.rs` covered advertised 16-bit PCM, PCM
data/rate/channel forwarding, the then-present unsupported-format guard,
and volume/close forwarding. The guard and its direct-call test were
intentionally removed in the review follow-up described below.
- `cargo test -p ironrdp-web --lib`: 33 passed. The 19
`clipboard::tests` failures are the same on `master` (they need a
browser for `JsValue`).
- `cargo xtask check fmt`, `cargo clippy -p ironrdp-web --all-targets --
-D warnings` (host and `wasm32-unknown-unknown`), `cargo xtask check
typos`, and `npm run check` in `iron-remote-desktop-rdp`.
- In use: built from `master` with this change, the web client plays
audio from Windows 11. Our end-to-end test plays a system sound inside
the session and checks that PCM with a non-zero peak arrives. GNOME
Remote Desktop 46 also works, together with #2019 (its Training Confirm
check) and the graphics pipeline, which GNOME requires (#1977).

## Rebase validation (October 11, 2026)

Rebased onto upstream `e4143f26306a6639a889d80c1c484ca69c365a8f`. The
session configuration conflict was resolved by retaining upstream's
`SecurityConfig` handling and applying the audio callback setup
alongside it.

Passed with Rust 1.94.1:

- `cargo test --locked -p ironrdp-web --lib audio::tests` — all 4 audio
tests present at that October 11 revision passed.
- `cargo test --locked -p ironrdp-web --lib
standard_rdp_security_overrides_enhanced_security` — existing security
regression test.
- `cargo clippy --locked -p ironrdp-web --all-targets -- -D warnings`,
on the host and with `--target wasm32-unknown-unknown`.
- `cargo xtask check fmt`, `cargo xtask check locks`, and `cargo xtask
check test-settings --base upstream/master --head HEAD`.
- `cargo xtask web check` — WASM/web builds, web package type checks and
lint, and web component tests.
- `npm test` and `npm run lint` in `web-client/iron-remote-desktop-rdp`
— all 117 tests passed.

The live Windows/GNOME playback results above are from the original
validation; live playback was not rerun for this rebase.

## Review follow-up

`e6c0b4f1` documented the Windows RDPDR advertisement requirement and
removed the redundant backend format guard and its direct-call test.
`Rdpsnd` dispatches entries from the negotiated client format list;
unsupported offers are excluded and out-of-range wave indices are
discarded before reaching the backend.

`e0966145` adds tests of all four audio/printer channel combinations,
negotiation through the web audio backend, concrete advertised PCM
formats, separate volume/close forwarding, and the actual
WASM-to-JavaScript callback contract. The WASM tests execute JavaScript
objects and typed arrays under Node and now run in `cargo xtask web
check`.

Passed locally with Rust 1.94.1:

- 6 host audio/channel tests, 9 WASM/Node tests, and 77 RDPSND
integration tests.
- Host and `wasm32-unknown-unknown` Clippy with `-D warnings`.
- `cargo xtask web check`: WASM/web builds, the 9 WASM tests, package
type checks and lint, and 20 component tests.
- 117 RDP TypeScript tests, formatting, typos, lockfile checks, and `git
diff --check`.

These results cover this PR's branch with the follow-up changes, without
a rebase onto current upstream master. Live Windows/GNOME playback was
not rerun; those results remain the original validation above.

## Related work

#904 is an earlier, still-draft implementation that owns Web Audio
playback, buffering and resampling inside Rust/WASM. This PR exposes
PCM, volume and close events through an `audioPlayback(callback)`
extension so the embedding application owns playback and its audio
lifecycle.

_Prepared with AI assistance; the change and validation results were
reviewed._
2026-11-15 15:04:49 -05:00
Nahum Shalman 5baa5e1d0b feat(server): bound clients' channel message sizes (#2430)
None of the channels ironrdp-server attaches sets a message limit
(`SvcProcessor::max_message_size`, `DvcProcessor::max_message_size`), so
a client can make the server keep a message up to its declared 32-bit
length, about 4 GiB, on each static channel and each dynamic channel.

`RdpServerBuilder::with_max_static_channel_message_size` and
`with_max_dynamic_channel_message_size` bound them, for every channel
whose processor sets no limit of its own, including those a
`StaticChannelFactory` or `DynamicChannelFactory` adds. They are
separate because going over them differs. A dynamic channel message over
its limit closes only its channel, for a client that fragments its
messages as MS-RDPEDYC requires. A static channel message over its limit
ends the session, as any static channel error does, and static channels
such as the clipboard carry a whole payload in one message. Each limit
must be at least the largest legitimate message of every channel it
bounds, such as a 65,542-byte EGFX cache import offer on a dynamic
channel. Both are unset by default, leaving messages bounded only by
their declared length.

The builder methods rest on three additions; in each, a processor's own
limit takes precedence:
- `StaticChannelSet::set_max_message_size`, for the channels in a set
and those inserted later;
- `Acceptor::set_max_static_message_size`, which sets that limit on the
acceptor's static channel set;
- `DrdynvcServer::with_max_message_size`, for every dynamic channel.
With it set, the DRDYNVC static channel is bounded at that limit plus
`MAX_CHANNEL_CHUNK_LENGTH` in place of the static limit, which admits
every DRDYNVC PDU a conforming client sends (at most 1,600 bytes,
MS-RDPEDYC 2.2.3.1, 2.2.3.2); without it, the static limit applies to
DRDYNVC too.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 14:28:15 -05:00
Glenn West b17dfc60cc fix(server): pad bitmap tiles to a multiple of 4 instead of refusing odd widths (#2413)
*Stacked on #2410; only the last commit is new here.*

`BitmapEncoder::encode` returns "Width must be a multiple of 4" for any
update whose width is not a multiple of 4 (MS-RDPBCGR 2.2.9.1.1.3.1.2.3
requires a scan width that is), and the session drops. Browser clients
ask
for such sizes: IronRDP's own web client asked for 1567x661 in a Chrome
window.

With 64x64 tiling only the right-edge tile can have an odd width. This
pads
that tile to the next multiple of 4 by repeating its last column. The
destination rectangle stays the real area, so the padding is never
drawn.

Tested in `ironrdp-testsuite-core` (`tests/server/bitmap_update.rs`): a
67x3 update gives tiles whose scan widths are multiples of 4 and that,
decoded,
draw columns 0..=66 exactly once with the update's pixels (the padding
is
never drawn); the tiles proptest now generates any width, not only
multiples
of 4. Without the fix the 67x3 case fails. `ironrdp-viewer` over
RDCleanPath at
1567x661 failed before this change and ran without errors after it.

Co-authored-by: Glenn West <glennswest@neuralcloudcomputing.com>
2026-11-15 14:27:57 -05:00
shellden-dev 50200fd7ee feat(connector)!: report the RDP version the server announced (#2434)
The Server Core Data (MS-RDPBCGR 2.2.1.4.2) carries the RDP version of
the server, but the connector dropped it. A client cannot see that it
talks to an older server, for example xrdp, which announces RDP 5 and
does not apply the desktop scale factor. Then the client cannot adapt
its own settings.

The connector now keeps the version in
ClientConnector::server_rdp_version during the Basic Settings Exchange
and returns it in ConnectionResult::server_rdp_version. In
ConnectionResult it is a plain RdpVersion, because a connection only
gets there after the Server Core Data. If it was never seen,
finalization returns an error.

Tested with connector tests in ironrdp-testsuite-core (the version is
unknown before the Server Core Data, then RDP 5 and RDP 10.7 come back
as announced) and an e2e test in ironrdp-testsuite-extra that connects
to the in-process server and checks the version in ConnectionResult.

BREAKING CHANGE: `ironrdp_connector::ConnectionResult` gains a public
`server_rdp_version` field. Code that builds it with a struct literal
should set it to the version the server announced.

---------

Co-authored-by: Shellden <356462267+shellden-dev@users.noreply.github.com>
2026-11-15 13:32:09 -05:00
Steven Downer 6b32516dde fix(cliprdr): keep a download's lock across local copies (#2399)
Initiating a local file copy released every outgoing lock, so a download
still pulling files from the remote failed as soon as the user copied
files locally. Locks exist to keep File Stream data available after a
clipboard change ([MS-RDPECLIP] 2.2.4.1).

A lock is now kept when a FileContentsRequest under it is still
outstanding, or when its last request or response was within the last 10
seconds, which covers the gap a download leaves between two sequential
requests. A kept lock expires without being reported through
`on_outgoing_locks_expired`, which is for a remote clipboard change and
on which backends such as the daemon abort the download. The timeout
sweep releases it, and reports it through `on_outgoing_locks_cleared`,
once nothing under it is outstanding and it has been quiet for 10
seconds; the transfer timeout and the maximum lock lifetime still bound
it. Idle locks are still unlocked before the FormatList.

A FileContentsResponse now also counts as activity on its lock, so
inactivity is measured from a download's last response rather than its
last request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 13:09:35 -05:00
Glenn West a56d4577c7 fix(server): send RDP 6.0 bitmap updates as 64x64 tiles (#2410)
`BitmapEncoder` sends an update as full-width strips of up to 64 KiB
each.
FreeRDP refuses a planar bitmap wider or taller than its bitmap-update
planar
context, which it sizes to the desktop when connecting. Until
FreeRDP/FreeRDP#13668 it
kept that size when the server resized the desktop through a
deactivation-reactivation, so after a resize to a larger desktop the
first
strip wider than the old desktop disconnected the client
(FreeRDP/FreeRDP#13668
reports "planar->maxWidth 1280 < nSrcWidth 1600" with xrdp). The strips
also
overflow the `u16` row length for widths above 16383 at 32 bpp.

This encodes each update as 64x64 tiles (smaller at the right and bottom
edges), each its own `TS_BITMAP_DATA`. A 64x64 tile fits the planar
context
of any desktop of at least 64x64, whatever size the client sized it for.
Each tile row is read only up to its own pixels, never the full stride,
so a
short last row in the source buffer stays safe.

Tested in `ironrdp-testsuite-core` (`tests/server/bitmap_update.rs`):
updates
go through `UpdateEncoder` for a client without surface commands; every
tile
is at most 64x64, and decoding each tile's bitmap and drawing it
bottom-up at
its destination rectangle paints every pixel of the update exactly once,
with
the update's color. A fixed 136x70 update at (8, 4) and a proptest over
widths, heights and offsets up to the edge of a 65535x65535 desktop.
Without
the fix the fixed case fails. A qemu console served through
`ironrdp-server`
to FreeRDP 3.31 was pixel-exact against qemu's own screendump (720x400).

---------

Co-authored-by: Glenn West <glennswest@neuralcloudcomputing.com>
2026-11-15 09:33:09 -05:00
Glenn West 78d28d6d2c fix(server): send RDP 6.0 bitmaps, not raw surface bits, when no codec is shared (#2411)
When the client and the server share neither RemoteFX nor NSCodec (or
QOI),
the update encoder falls back to `NoneHandler`, which sends uncompressed
surface bits. Real clients that use surface commands (FreeRDP, mstsc,
the
Windows App) then receive raw pixels.

This sends RDP 6.0 compressed bitmap updates instead: every client
decodes
them, and they are lossless. `NoneHandler` and `CodecId` have no other
user
and are removed.

Two RemoteApp tests in `ironrdp-testsuite-core`
(`window_orders_wait_for_all_bitmap_fragments`
and `dropping_completion_while_waiting_for_bitmap_skips_orders`) connect
a client with
`SET_SURFACE_BITS` and no shared codec, and expected surface commands.
They now expect bitmap
updates, and send an incompressible 128x64 update so that it still spans
several fast-path
fragments. Both fail against the encoder before this change.

Measured with FreeRDP 3.31.1 on a 1920x1080 desktop with a 480x320
window
moving at 60 fps, counting bytes on the server's socket with TLS
included:
283 Mbit/s with surface bits, 19.9 Mbit/s with RDP 6.0 bitmaps. That is
14
times less for the same pixels.

FreeRDP accepts these bitmaps at sizes over 64x64 only with the tiling
in
#2410, so the two go together for FreeRDP clients.

---------

Co-authored-by: Glenn West <glennswest@neuralcloudcomputing.com>
2026-11-15 09:32:16 -05:00
Steven Downer 1abf001afc fix(ffi): map EnableFontSmoothing to the font smoothing flag (#2397)
PerformanceFlagsType::EnableFontSmoothing was mapped to
ENABLE_DESKTOP_COMPOSITION (0x100), so a client asking for font
smoothing through the bindings got desktop composition instead, and the
server drew text without smoothing. Only PerformanceFlags::new_default()
set font smoothing (0x80).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 09:31:14 -05:00
Nahum Shalman 6415bba912 fix(web): lay the canvas out as a block (#2428)
An inline canvas sits on a text baseline, so the line it is in runs a
few pixels past it. At 1:1, where the wrapper does not clip, that
overflowed the page and showed scrollbars, though the desktop fit the
window exactly.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 09:19:29 -05:00
shellden-dev 9265fde83f fix(graphics): draw an empty ClearCodec V-bar cache entry instead of failing (#2433)
A ClearCodec bands layer can refer to a V-bar cache entry that the
decoder never stored. Windows servers do this, for example after a cache
reset. The decoder returned an error for the whole update, so text-heavy
regions from Windows hosts stayed unpainted.

FreeRDP reads such an entry as an empty bar and keeps decoding. Now a
full V-bar hit on an empty entry gives a column of zero pixels, and a
short V-bar hit on an empty entry gives zero pixel rows, so the column
is the band background. The yOn bound check still applies.

Tested with new decoder tests in ironrdp-testsuite-core for both cache
hit kinds and the yOn check; the first two fail without the change.

Co-authored-by: Shellden <356462267+shellden-dev@users.noreply.github.com>
2026-11-15 09:18:45 -05:00
brokenlander 6506cc0ed2 feat(web): add performance flags extension (#2422)
The web client always sent IronRDP's default performance flags (no
full-window drag, no menu animations, font smoothing on), so an
application could not ask the server to leave out the wallpaper or the
cursor shadow on a slow link, or keep full-window drag on a fast one.

`performance_flags` takes the `performanceFlags` bitmask of the Extended
Info Packet (MS-RDPBCGR 2.2.1.11.1.1.1) and sends it in place of the
default. Bits the protocol does not define are dropped, and a value that
is not a 32-bit unsigned integer is logged and ignored.
`iron-remote-desktop-rdp` exports `performanceFlags`.
2026-11-15 09:17:32 -05:00
uchouT 7793f5232a refactor(server): remove loop locks and return timer outputs (#2431)
The connection loop runs one selected branch at a time, so the locks and
shared counters that serialized concurrent writers no longer protect
anything. Two timer branches and two connection outputs also still
described driver work instead of what happened on the connection.

- The loop owns its writer: `ConnectionWriter` replaces `SharedWriter`,
with a plain write count instead of a shared atomic. It still checks
cancellation and `is_current` immediately before a write and never
interrupts one that has started.
- The graphics write lock is removed, and the outer driver owns the UDP
transport and lends it to the loop by `&mut`, instead of sharing it
through `Rc<RefCell<_>>`.
- The connection asks its own Advanced Input channel whether it owns the
mouse and emits a single mouse output. The server-wide flag the driver
used to filter legacy mouse events is gone. Ownership ends when DRDYNVC
removes the closed channel.
- A failed Initiate Multitransport Response is reported as
`MultitransportFailed` (MS-RDPBCGR 2.2.15.2, 3.2.5.15.2) rather than as
an instruction to cancel the UDP accept. The driver stops its accept in
response.
- The clipboard timeout and heartbeat branches return frames, and the
loop writes them along with other outputs. A heartbeat is still sent
only after an interval without writes. The write count for the next
interval is taken after the outputs are executed, so a heartbeat does
not suppress the next one.

The README now describes `is_current` and slow writes in terms of event
dispatch and the connection loop instead of locks. Writes still block
the loop until they finish.

Refs #1978

---------

Signed-off-by: uchouT <i@uchout.moe>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 09:08:21 -05:00
Greg Lamberson aa969ce6a7 feat(agent): number frames and add wait-frame (#2418)
A caller driving a session can't tell whether the picture changed
between two requests, and can't wait for it to change. `status` reports
only the frame size, and `screenshot` returns the latest frame whether
or not it's new, so a script has to poll screenshots and compare pixels
to learn that the server drew something.

The daemon now counts the frames it receives in a session. `status`
reports the count as `frame: N`, and the new `wait-frame --after-frame N
[--timeout-ms MS]` prints the same report once a frame with a greater
number arrives. The caller reads N before the action whose result it
waits for, so a frame that arrives before the wait starts still
satisfies it. A wait that ends by its timeout or by the session ending
is an error, so success always means a newer frame.

`Request::WaitFrame` takes tag 42 and replies with `Payload::Status`.
`StatusInfo` gains a trailing optional `frame_number`, which decodes as
absent when the reply ends before it, as the certificate field already
does. The timeout is capped at 60 seconds, as for `rail wait`. The
ActiveX backend reports no frame number and answers the wait as
unavailable.
2026-11-13 22:58:38 -05:00
clintcan e482e340fb fix(server): bound negotiation and authentication with a timeout (#2432)
Everything `RdpServer` does before `accept_finalize` (X.224 negotiation,
the TLS handshake and CredSSP) reads from a client that has not
authenticated yet, and none of it had a timeout. A client that connected
and then sent nothing kept its connection open indefinitely, and under
the default `ConnectionPolicy::Queue`, connections arriving after it
waited behind it. Finalize is already bounded by `FINALIZE_TIMEOUT`
(#1890), and preemption candidates by `CANDIDATE_NEGOTIATION_TIMEOUT`.

This bounds `PendingConnection::negotiate_and_authenticate` with
`NEGOTIATION_TIMEOUT` (60 s), so `run_connection`, `run_connection_with`
and `run_connection_handshake` are all covered. A timeout returns a
`TimedOut` error, like `FINALIZE_TIMEOUT`. Preemption candidates keep
their 10 s.

**Why 60 s:** a client's own credential prompt can fall inside this
phase. With Windows App for macOS we measured 7–11 s from accept to
authentication, and CredSSP over a cellular link took 12.5 s. A
certificate warning doesn't hold the phase open: mstsc and Windows App
close their connection 8–21 s into the dialog and reconnect after the
user answers.

**Tests:** `tests/server/negotiation_timeout.rs` in
`ironrdp-testsuite-core`, both on a paused clock:
- a silent client is still waited on just short of 60 s and is dropped
with the timeout error after it;
- the same through `run_connection_handshake` over real TCP.

Both fail without the bound, and the first also fails with a 30 s bound.

**Checks:** `cargo fmt --all --check`, `cargo clippy -p ironrdp-server
-p ironrdp-testsuite-core --all-targets --all-features -- -D warnings`,
and the server test suite (422 tests).

---------

Co-authored-by: Clint Christopher Canada <clint.canada@clubitech.com>
2026-11-13 22:55:29 -05:00
haefele-octoja 0a79fd2178 build(ffi): mark .NET bindings as AOT-compatible (#2426)
Native AOT and trimmed apps that reference `Devolutions.IronRdp` cannot
tell whether the bindings are safe for them, because the package does
not declare it. The bindings already are: the generated `Raw*` types use
plain `DllImport` calls with pointer and primitive arguments and
`[MarshalAs(UnmanagedType.U1)]` booleans, and `DiplomatWrite` takes
function pointers for two fixed delegate types, which Native AOT
supports.

Setting `IsAotCompatible` turns on the trim, AOT and single-file
analyzers for the project, so a later change that breaks AOT shows up as
a build warning, and marks the assembly as trimmable. The analyzers
report no warnings today.

Co-authored-by: haefele-octoja <267442939+haefele-octoja@users.noreply.github.com>
2026-11-12 14:28:31 -05:00
Yuval Marcus 3c778f779a fix(web): keep clipboard monitoring after a transient NotAllowedError (#2417)
Follow-up to #1162.

### Problem

In Chromium, a single `NotAllowedError` from
`navigator.clipboard.read()` stops local-to-remote clipboard sync until
the page is reloaded.

#1162 added a safety net that stops the 100 ms monitoring loop on the
first `NotAllowedError`, assuming it means the permission is denied or
user activation is missing. The issue is that **Chromium also uses it
for transient failures**.

`read()` checks the focus, requests the permission asynchronously, then
[checks the focus
again](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/modules/clipboard/clipboard_promise.cc).
If the focus was lost in between, the read is rejected with `Document is
not focused.`, even with the permission granted. Switching windows at
the wrong moment is enough to cause this behavior.

The loop also never restarted, so allowing the permission again after
blocking it still required a reload, even within the same session.

### Solution

On `NotAllowedError`:

- Page unfocused, or the `clipboard-read` permission `granted`: the
failure is transient. Report it like any other monitoring error and
**keep polling**.
- Otherwise (`denied`, `prompt`, or the query fails, e.g. Firefox): stop
as before, and start again when the `PermissionStatus` `change` event
reports `granted`. `stopMonitoring()` (session end, `dispose()`) removes
that listener.

The safety net still keeps a denied permission from failing every 100
ms.

### Testing

- Unit tests in `clipboardMonitoring.test.ts` cover: the permission
granted, the page unfocused, granted later, unknown, and no restart
after monitoring stops.
- Manually in Chrome:
  - Clipboard allowed → Block → Allow: sync resumes without a reload.
- `document.hasFocus = () => true` in DevTools, then click into
DevTools: the error is logged once and monitoring continues.
- Clipboard reset to Ask, then the same focus loss before answering the
prompt: monitoring continues, and Chrome prompts once the page has the
focus again.
2026-11-12 11:44:39 -05:00
Marc-André Moreau d5e70f02b6 feat(agent): log off the remote session through the NOW agent (#2308)
Adds `ironrdp-agent session logoff` (alias `ironrdp-agent logoff`). It
ends the user's session on the host instead of leaving it disconnected.
Closes #1855.

## Why NOW and not RDP

RDP has no way for a client to request a logoff:

- The client's Shutdown Request is always denied while a user is logged
on ([MS-RDPBCGR] 3.3.5.4.1).
- MCS Disconnect Provider Ultimatum only disconnects.
- `ERRINFO_LOGOFF_BY_USER` only reports a logoff after the host has done
it.

Devolutions Agent can log the user off from inside the session with
`NOW_SESSION_LOGOFF_MSG`. It advertises `NOW_CAP_SESSION_LOGOFF` and
handles the message with `ExitWindowsEx(EWX_LOGOFF)`.

## Changes

- **`ironrdp-rpc`**: new `Request::Logoff` IPC request (tag 41).
- **`ironrdp-daemon`**: advertises `NOW_CAP_SESSION_LOGOFF` and adds
`OperationManager::session_logoff`. If the host has no NOW agent, or the
agent doesn't support logoff, the request fails with an `unavailable`
error and the session stays connected.
- **`ironrdp-activex`**: the RPC host handles `Request::Logoff` the same
way.
- **`ironrdp-agent`**: the NOW logoff message has no response, so the
command waits up to `--timeout-secs` (default 60) for the session to
end. It succeeds only when the host ends the session with a logoff
reason (`ERRINFO_LOGOFF_BY_USER` or `ERRINFO_RPC_INITIATED_LOGOFF`). It
fails:
- if the session ends for any other reason, since the user's session may
still be running;
- if the session is still connected after the timeout, saying an
application may be blocking sign-out.

  Help text and README are updated.

## Dependencies

- `now-client` is bumped to 0.2.0 and `now-proto-pdu` to 0.5, which add
`NowClientHandle::session_logoff` (Devolutions/now-libraries#123).
- `now-proto-pdu` 0.5 depends on `ironrdp-core` 0.2.1 from crates.io, so
the lockfile carries that version next to the workspace's 0.3.1.

## Testing

- New unit tests:
  - `Request::Logoff` round-trips through the IPC codec.
- Against a mock daemon, the logoff command waits for the session to end
and returns the host's reason.
- `cargo clippy -D warnings` is clean for the touched crates, and `cargo
xtask check fmt` passes.
- Not tested yet against a live host running Devolutions Agent.

## Not included

- A `--server` destination guard like `disconnect --server`.
- A RAIL Execute `logoff.exe` fallback for RemoteApp sessions without
Devolutions Agent.
- Showing logoff support in `now capabilities` output. That needs a new
field on the IPC `NowCapabilities` struct, which is a breaking change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 16:54:19 -05:00
Marc-André Moreau cc63ef7d64 feat: add Windows TermService protocol provider (#2381)
Add a side-by-side WTS protocol provider and companion service to
connect IronRDP clients to authenticated Windows desktops.

Provide an indirect display driver, native desktop capture and input,
clipboard redirection, and native device and dynamic-channel bridges.
Include experimental RemoteApp support, authenticated control IPC, and
Windows deployment, signing, and diagnostics tools. Place the server and
an unsupported MSI packaging prototype under server/termsrv, apart from
the reusable crates.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-09 12:15:44 -05:00
Greg Lamberson 2085a15ae5 test(core): cover the stored license path (#2380)
A client holding a matching license must send it in Client License
Information (MS-RDPELE 3.3.5.3), and no test reached that branch. The
new test reads the message by hand, because LicensePdu doesn't decode
this message type.

The oracle markers now cite what decides each test. No test can show
that the default generator is cryptographically secure, so that's marked
UNTESTED where it's used.
2026-11-09 09:50:16 -05:00
Greg Lamberson 0f4f0026d2 fix(pdu): write EncryptedHWID as BB_DATA_BLOB (#2386)
Client License Information carries its encrypted hardware ID in a
BB_DATA_BLOB: That's the type MS-RDPBCGR 2.2.1.12.1.2 lists for this
message, and the one in the MS-RDPELE 4.3 sample. The encoder wrote
BB_ENCRYPTED_DATA_BLOB, so ClientLicenseInfo::decode, which expects the
right type, rejected the encoder's own output.

A client sending a stored license now writes the type the sample shows.
FreeRDP's server expects BB_ENCRYPTED_DATA_BLOB there, but on a mismatch
it only logs an error and continues.
2026-11-09 09:49:02 -05:00
Greg Lamberson 26f7e4c0c8 fix(pdu): size logon info names in UTF-16 bytes (#2377)
`TS_LOGON_INFO` and `TS_LOGON_INFO_VERSION_2` declare each name's size
in bytes of UTF-16, including the null terminator (MS-RDPBCGR
2.2.10.1.1.1 and 2.2.10.1.1.2). The encoder counted UTF-8 bytes, so a
non-ASCII name got the wrong size. In Version 2 those sizes are how a
reader finds each name, so a wrong domain size also misplaced the user
name.

Version 1 also cut a long name short while declaring its full size,
which this crate's decoder rejects. The encoder now returns an error for
a name that doesn't fit. Version 2 gets the same limits although the
spec sets none, because this crate's decoder and FreeRDP's both apply
them.

Nothing in the workspace sends these structures yet.
2026-11-09 09:48:25 -05:00
Marc-André Moreau 5944d7f7d8 test(core): release decoder before presenter init (#2404)
Release the standalone Media Foundation decoder before creating the
presenter decoder, preventing overlapping transforms from intermittently
dropping the first frame on Windows.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-09 08:39:53 -05:00
uchouT c4b2858e2f refactor(server): return outputs from PDU processing (#2402)
*Stacked on #2401.*

Processing data the client sent wrote responses, called the input and
display backends and aborted tasks itself, so it needed the whole
RdpServer, the writer and the UDP transport.

ConnectionState::dispatch_pdu now processes a TCP frame, and
process_udp_payload a tunnel payload, from the channel IDs, transport
availability and time the driver supplies. They return ConnectionOutput
values: keyboard and mouse input, monitor layouts, TCP and tunnel data,
cancelling the UDP accept, and disconnecting. The client loop executes
them after each select iteration, and the activation backlog through the
same path.

The advanced input channel keeps the mouse events it receives until the
connection takes them after DRDYNVC processing, like the Display Control
layouts, instead of spawning a blocking task per event. Its events are
therefore delivered on the connection's task, in order with the other
input, and still bypass the legacy mouse suppression.

A frame's outputs are written only once the whole frame is processed, so
an error while processing it ends the connection before any of them are
written.

Not in this change:

- The display update, server event, auto-reconnect cookie, heartbeat,
and clipboard timeout branches still write from inside their `select!`
arm; they move to the same output path one at a time in follow-ups.
- Channel processors are still called synchronously and keep their
backend contracts, so this makes the processing entry point free of I/O,
not every channel handler behind it.
- The server-wide event queue and the factory sender contract are
unchanged.
- Reactivation routing (#1512) is unchanged.

UNTESTED: `process_udp_payload` takes the advanced input mouse events
and Display Control layouts after the DRDYNVC processor handles a tunnel
payload, so input from a channel moved onto the UDP tunnel is delivered
in the same iteration instead of waiting for the next DRDYNVC frame over
TCP. Only the TCP path is covered, by
`dynamic_channel_input_reaches_the_connection_outputs`; a change that
drops the call on the tunnel path would delay that input without failing
any test.

Refs #1978

---------

Signed-off-by: uchouT <i@uchout.moe>
2026-11-09 08:39:09 -05:00