2325 Commits

Author SHA1 Message Date
brokenlander 79e763a04d feat(web): add H.264 camera frames (#2467)
MJPEG costs several megabits a second for a camera, where H.264 needs
well under one. With the `camera_h264` extension set to true the device
offers H.264 at the four sizes ahead of the four MJPEG ones, so the
server can pick either. The callback's start message now carries the
format the server started: `{ type: 'start', width, height, fps, format
}` with `format` "h264" or "mjpeg".

Every H.264 picture but a key frame depends on the ones before it, so a
dropped frame spoils the picture until the next key frame. A held H.264
frame therefore queues behind any other held frame (at most 30, beyond
which the queue is dropped with a warning), where an MJPEG frame still
replaces the held one. `camera_sample` now returns true when a frame
went out and none is left held. JS asks `camera_wanted` through
`invokeExtension` before it encodes an H.264 frame: it returns the
Sample Requests no held frame answers, plus one, so a frame waits ready
for the server's next request. The server asks for one sample at a time,
so a frame encoded only on request would add the encode and the wait for
the next captured frame to every round trip.

`iron-remote-desktop-rdp` exports `cameraH264` and `cameraWanted`, and
its README documents the format field and the queue. Follows #2463, the
MJPEG camera; together they are the camera item of #2425. It also
carries the three polish items of #2463's third review round, which
landed after the merge: the spelled-out `StreamDescription` in
`offers_one_color_stream`, the INVARIANT on the held frames, and the
reason the uplink frames bytes written on `CameraUplink`.
2026-11-20 15:18:14 -05:00
devolutionsbot 13ccce6e1f chore(agents): sync shared skills (#2234)
Synchronizes configured shared skills from their upstream repositories.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-20 14:53:57 -05:00
Willie Abrams 85e88c2424 fix(egfx): keep no Progressive tile state for surfaces the compositor refused (#2133)
The client decoded RFX Progressive into surfaces the compositor refused.
Nothing was painted, and their tile state grew outside the 256 MiB
budget.

Those updates are now skipped without being parsed. A skipped update
also discards the tile state the surface had before it was refused.

#2085 removed the per-surface CONTEXT flag, so
`ProgressiveDecoder::skip_bitmap` is gone and this PR no longer touches
`ironrdp-graphics`.

Behavior changes:
- A refused surface gets no Progressive `on_bitmap_updated`.
Uncompressed, Planar, ClearCodec, RemoteFX and AVC420 still call it;
Alpha and AVC444 already did not.
- A malformed update to a refused surface is not detected or counted.
- A DIFFERENCE tile after a skipped update fails with
`MissingTileReference` instead of using coefficients from before the
refusal.
- Re-creating a surface at over 16384 px drops its old pixels from the
compositor (3880a754). On master they stayed, so the surface's updates
were still decoded and painted.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 14:53:09 -05:00
Ki Hyun Park 7181054c8c test(core): cover out-of-range RFX quant indexes (#2094)
An out-of-range quantization index in a RemoteFX tile must fail the
frame rather than panic. The decoder in `ironrdp-graphics` returns an
error for one, but the only test covers the Cb index at the
`TileDecoder` level.

The new test decodes through the session `DecodingContext` and covers an
out-of-range Y, Cb and Cr index with one table, and a tileset with no
tables.
2026-11-20 14:51:52 -05:00
Karthik S Kashyap 0eb2d9d6b7 feat: add RDP session replay web component stack (#1216)
Add browser playback of recorded RDP sessions through a
protocol-agnostic Svelte player, an RDP WASM backend, and a demo with
local-file and HTTP range data sources. Consumers provide the
recordings; this does not add a recording mechanism.

Replay requires post-decryption Fast-Path captures. The HTTP demo
validates its index and bounds range requests and playback fetches.

---------

Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-20 14:43:50 -05:00
brokenlander 0cd8e97138 test: give each Windows drive test file its own name (#2484)
The Windows drive tests in `ironrdp-rdpdr-native` name their temporary
files from the process id and the system clock in nanoseconds. The tests
run as parallel threads of one process, so two of them can read the same
clock value and get the same name. CI has hit this twice.
`create_applies_allocation_size_and_deletes_on_close` failed with
`create temporary file: STATUS_OBJECT_NAME_COLLISION` when its
`FILE_CREATE` found the file already there ([run
44021370918](https://github.com/Devolutions/IronRDP/actions/runs/44021370918/job/133831386084)).
`read_response_honors_large_offset` failed on master with `The process
cannot access the file because it is being used by another process`
while another test held the same path open ([run
43918235082](https://github.com/Devolutions/IronRDP/actions/runs/43918235082/job/133478127695)).

`TemporaryFile::new_path` now also takes a number from a per-process
counter, so names cannot repeat within a run, and the process id and the
clock still keep runs apart. `TemporaryDirectory` uses the same helper
and gets the same guarantee.

`temporary_paths_stay_unique_across_parallel_threads` pins the
guarantee: eight threads released together by a barrier each name 500
paths, and all 4,000 must differ. A single thread cannot catch the
collision, since each call takes longer than a clock tick, but threads
running at once can. A Linux stand-in of the old scheme (process id and
clock only) failed that check in 20 of 20 runs with the clock rounded to
Windows' 100 ns tick (348 to 489 repeated names per run), and in 19 of
20 at full nanosecond resolution. With the counter it cannot fail. The
tests in this module only build on Windows, so CI is the run that
exercises them; locally the change was checked with `cargo fmt --all --
--check` and `cargo clippy -p ironrdp-rdpdr-native --tests --target
x86_64-pc-windows-msvc --locked -- -D warnings`.
2026-11-20 13:06:06 -05:00
Richard Markiewicz e62f01c824 feat(ffi): add native audio playback (#2480)
Expose native RDPSND playback through the FFI and .NET bindings so
clients can play remote audio on a selected local output device.
Register static and dynamic playback channels, and join RDPDR without
redirected devices when it is absent so Windows servers can start
playback. Stop playback on demand or when the active stage is disposed.

Linux builds require ALSA development headers and the native library
requires `libasound` at runtime. Android retains its existing API
baseline and does not support native playback.
2026-11-20 12:11:04 -05:00
Greg Lamberson e9e0b1d875 fix(server): wait for the client before closing (#2485)
When the server ended a connection, it closed the socket as soon as it
had written its last PDUs. A client that was still sending, because it
was finishing the connection finalization or was behind on a stream with
the user moving the mouse, had its next data answered with a reset, and
the write after that failed. FreeRDP takes a failed write for a lost
connection, so it never processed the Set Error Info PDU or the MCS
Disconnect Provider Ultimatum already waiting in its buffer, and with
auto-reconnect it came straight back.

On loopback against FreeRDP master (1845130fb5), a refused
auto-reconnect cookie cost 32 refusals in 15 seconds and the reason
arrived once, and a display that failed with an ErrorInfo error cost 639
connections in 20 seconds and the reason never arrived. FreeRDP 3.33.1,
slowed so it fell behind a RemoteFX stream while the mouse moved, lost
the first ServerEvent::Disconnect in three runs out of three.

Shut the stream down at the end of every session and after every error
once the client is accepted, then read and discard what the client still
sends until it closes its side. The wait is bounded: One second after an
error, the bound that path already had, which is enough because those
errors happen before the session streams anything, and five seconds at
the end of a session, matching FINAL_FLUSH_TIMEOUT, because the client
may still be decoding frames. A client that never closes its side holds
the server for that long. Before, the end of a TLS or TLS-offloaded
session and an ErrorInfo error got a shutdown, other errors and plain
connections got none, and nothing waited for the client. With the change
each case above ends after one connection, and the clients closed within
200 ms.
2026-11-20 12:09:21 -05:00
Mathieu Morrissette 63d442e8dd fix(rpc): verify local IPC peer is the same user on connect (#2483)
The local IPC client connects to a predictable, per-user endpoint — a
named pipe on Windows, a Unix socket under `$XDG_RUNTIME_DIR` (or
`/tmp`). The listener restricts the endpoint to the current user, but
until the daemon binds it, another local user can create the endpoint
first and answer the client.

`connect()` now verifies the peer is owned by the current user before
returning, so no request is sent to a foreign-owned endpoint:

- **Windows**: the listener sets the pipe object's owner to the current
user (SDDL `O:`); the client reads the connected pipe's owner via
`GetSecurityInfo` and compares it to its own token SID (`EqualSid`). A
normal user cannot create a kernel object owned by another user's SID,
so an impostor's pipe never matches. The client QoS is pinned to
`SECURITY_IDENTIFICATION` so a server cannot impersonate the client.
- **Unix**: compare `peer_cred()` uid to the effective uid.

A mismatch, or any failure to confirm ownership, fails closed.
Legitimate same-user connections are unaffected.

Tests: same-user round-trip per platform, plus reject unit tests
(Windows owner-SID vs the `Everyone` SID; Unix uid), and an assertion
that the listener sets the pipe owner. The cross-user reject path itself
needs a second local account, so it is covered by manual testing rather
than single-user CI.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 12:20:42 +00:00
HydrogenE7 a8da54ba4d feat(web): enable EGFX pipeline and sync canvas on output resets (#2394)
## Problem

`ironrdp-web` currently leaves `support_dyn_vc_gfx_protocol` disabled
and does not attach `GraphicsPipelineClient` to `DrdynvcClient`, even
though `ActiveStage` in `ironrdp-session` already drains and composites
`GraphicsPipelineClient` output into `DecodedImage`.

In addition, when the server resizes `DecodedImage` through an EGFX
`ResetGraphics` PDU (without a `DeactivateAll` sequence) or completes a
Deactivation-Reactivation Sequence (`DeactivateAll` with a finalized
`desktop_size` that may differ from the client's requested dimensions):

- `ironrdp-web` previously resized the HTML canvas upon receiving
`DeactivateAll` using `requested_resize` before reactivation completed,
so late frames arriving before activation finalized or server-rounded
reactivation dimensions could mismatch the canvas backing store.
- `ResetGraphics` updated `DecodedImage` inside `ActiveStage::process`
without resizing the HTML canvas backing store (`gui.resize`).

## Solution

- Add `ironrdp-egfx` to `ironrdp-web`, attach `GraphicsPipelineClient`
on the `DrdynvcClient` static channel alongside `DisplayControlClient`,
and advertise `support_dyn_vc_gfx_protocol` for non-legacy sessions. The
browser build has no H.264 decoder, so the pipeline filters out the AVC
capability sets and advertises non-AVC V8 capabilities.
- `legacy_graphics` keeps its pre-EGFX behavior as a compatibility
escape hatch: no EGFX advertised or attached, 32-bpp lossless bitmaps,
and no advertised codecs. Modern sessions keep the WAN-friendly 16-bpp
lossy bitmap configuration, which carries the whole session only when
the server does not negotiate the EGFX pipeline.
- Track `framebuffer_size` in `Session::run` and resize `gui`
(`HtmlCanvasElement`) through a shared `sync_canvas` helper whenever
`(image.width(), image.height())` changes — both after
`ActiveStage::process` applies an EGFX `ResetGraphics` and after
`DeactivateAll` finalizes reactivation with the server's new
`desktop_size`.
- Remove the premature pre-reactivation `requested_resize` canvas
resize.

## Verification

- `cargo check --target wasm32-unknown-unknown -p ironrdp-web`
- `cargo test -p ironrdp-egfx --lib` and `cargo test -p
ironrdp-testsuite-core egfx`
- Live browser/WebView sessions against Windows 11 and Linux `xrdp`
servers with EGFX and dynamic resize enabled.
2026-11-20 01:54:31 +00:00
Luc Fauvel 15b4a03ff5 feat(server)!: notify the client of the user logon (#2478)
MS-RDPBCGR 3.3.5.10.1 asks the server to notify the client after the
user has logged on, with a Save Session Info PDU of type INFOTYPE_LOGON,
INFOTYPE_LOGON_LONG or INFOTYPE_LOGON_PLAINNOTIFY. The server sent none,
so clients that wait for it never consider the logon complete: the
Microsoft RDP client raises OnLoginComplete only on such a notification,
and embedders start their post-logon work, including dynamic resolution,
from that event. The auto-reconnect cookie
(INFOTYPE_LOGON_EXTENDED_INFO) does not take its place.

The server now sends the notification once per connection, at its first
activation, before the auto-reconnect cookie and the static channels'
first messages. A client that set INFO_LOGONNOTIFY gets the logged-on
user and domain, in the long form when its General Capability Set has
LONG_CREDENTIALS_SUPPORTED. Any other client gets a plain notification,
as does one whose user the server does not know or whose user name or
domain does not fit the fixed fields of the logon information. The
session ID is the auto-reconnect logon ID, so the notification and the
cookie name the same session, or 0 when the server holds no cookie. A
Deactivation-Reactivation Sequence does not send it again, since the
user does not log on again.

An embedder that activates a connection before the user has logged on,
for instance to draw its own logon screen, can defer the notification
with set_logon_notification_on_request
(with_logon_notification_on_request on the builder) and send
ServerEvent::LogonCompleted, through RdpServerHandle::logon_completed,
once the user has logged on. Each connection is notified at most once.
As with a vouch for the auto-reconnect cookie, the signal belongs to the
connection that was current when it was sent: it carries no connection
identity, and one the server had not read is dropped at the connection
boundary, before the next connection is served, so a producer stops
signalling for a connection before the next one starts.

BREAKING CHANGE: ServerEvent gains the LogonCompleted variant, so an
exhaustive match on ServerEvent needs an arm for it.
2026-11-19 09:59:33 -05:00
Richard Markiewicz 2064ca1c56 feat(ffi): expose direct dynamic virtual channels (#2476)
Let .NET clients use dynamic virtual channels without a named pipe.
Expose open, data, and close events with owned payloads and an endpoint
ID that prevents writes to a reopened channel from using a stale
endpoint. Encode outbound data and close requests through the existing
RDP session, without changing the pipe-proxy API.
2026-11-19 02:24:19 +00:00
brokenlander abfc97b299 feat(web): add camera redirection (#2463)
The web client could not redirect a camera. With the `camera` extension
(a function) it registers the RDCamera_Device_Enumerator channel and one
device, RDCamera_Device_0, named by `camera_name` (default `Browser
camera`), with ironrdp-rdpecam's client at the version the server picks.
The device has one color stream and offers MJPEG only: 640x480 at 30 and
15 fps, 320x240 at 15 fps and 1280x720 at 15 fps, in that order. The
current media type is the first offered until the server selects one,
and stays the last selected across stops.

The browser captures and encodes, so the backend only tells the callback
what the server asked for: `{ type: 'start', width, height, fps }` when
it starts the stream and `{ type: 'stop' }` when it stops the stream,
deactivates the device or closes its channel. A stream restarted in
another format gets a stop before the new start. The page pushes each
frame as one JPEG with `camera_sample` through `invokeExtension`. A
frame answers the oldest pending Sample Request at once and the call
returns true; with no request pending the frame is held, in place of any
older held frame, until the next Sample Request, and the call returns
false, as it does when no stream runs or the server refuses the frame.
The held frame is discarded when the stream stops or restarts, the
device deactivates or the channel closes, so a new stream never gets a
frame of the old size.

`iron-remote-desktop-rdp` exports `camera`, `cameraName` and
`cameraSample`, and its README documents the messages. This is the
camera item of #2425.
2026-11-16 22:03:22 -05:00
Greg Lamberson 6457c5fd28 docs(daemon): drop session info auto-reconnect claims (#2460)
The daemon builds its client without automatic reconnect, so the agent's
help and README and the SessionInfo docs described a cookie-based
reconnect, kept or rejected, that the daemon never makes. They now
describe only the redirect and resize-fallback cases.

The daemon still tracks facts across an automatic reconnect, so that
code holds if the daemon enables it, and its invariant is now written
down on since_reconnecting. The network field cites MS-RDPBCGR
2.2.14.1.5 for the base RTT and bandwidth a result can leave out.
2026-11-16 19:52:37 -05:00
Greg Lamberson f37b37c553 test: cover bandwidth kept across a partial netchar result (#2459)
The connector keeps the bandwidth reported before when a Network
Characteristics Result leaves it out, but no test sent a result without
a bandwidth after one with it, so removing that retention passed every
test. The new test does, mirroring the daemon's test for the same merge.
2026-11-16 19:50:05 -05:00
Greg Lamberson ae12806e50 test: pin that a RAIL wait accepts the timeout cap (#2461)
The daemon caps frame and RAIL waits at the same 60000 ms. Frame waits
are tested at the cap, but RAIL waits only above it, so a RAIL check
that rejected 60000 itself passed every test. The new test sends a RAIL
wait at the cap to a session that already holds an event, so an accepted
wait answers at once.
2026-11-16 19:48:36 -05:00
Rophy Tsai 2588733a1b fix(server): handle input while a large write is in progress (#2312)
The client loop now handles input and other client PDUs while it writes
to a slow client.

- The client loop queues its PDUs on one `OutboundQueue`, and one writer
future writes them in queue order, next to the loop's `select!`. No
branch of the loop waits for the socket, so `read_pdu` is still polled
while a write waits for the link.
- Display updates and server events are taken only when the queue is
empty, so they do not produce faster than the client reads.
- Replies to client PDUs, also those to UDP tunnel payloads, may fill at
most 1 MiB of the queue. Above it, the loop reads no more client PDUs
until the replies are written, so a client that sends requests and does
not read cannot grow server memory. Other PDUs, such as a large frame,
do not count, so input is still read while they are written.
- `ServerEvent::StaticChannelWithCompletion` and
`ServerEvent::DynamicChannelWithCompletion` keep their contract: the PDU
is queued with its completion and permit, the writer checks `is_current`
and cancellation when the PDU's turn to be written comes, and completes
it after the transport write. `ServerEvent::ClipboardWithCompletion`
completes after its PDUs are written, or at once when there are none.
`ServerEvent::WindowingOrders` queues all fragments of a batch as one
PDU and reports `Written` after the transport write. Their docs and the
README no longer mention a writer lock. The `__test` exports
`OutboundQueue` and `QueuedWriter` replace `SharedWriter`.
- When the loop ends, also with an error, it writes what is still queued
(a Deactivate All, a disconnect reason, a reply queued before the error)
within 5 s, then ends the connection.
- A stalled write logs a warning once per client loop; later stalls log
at debug.
- The heartbeat still counts the PDUs written to the transport, not the
PDUs queued.

Tests:
- e2e `input_is_handled_while_a_large_write_is_pending`: a mouse move
reaches the input handler while 16 MiB of EGFX data waits for a client
that does not read. It fails on master.
- e2e `a_client_that_does_not_read_its_replies_is_not_read_further`: the
reply bound.
- e2e `the_final_flush_to_a_client_that_does_not_read_has_a_time_limit`:
the 5 s limit on the final write.
- Property test `queued_pdus_are_written_in_order_and_counted`:
generated PDUs, some queued after `finish`, written to a transport that
fails after a generated byte count; the written bytes, the byte counts
and the write counter match a reference model.
- `static_channel`, `dynamic_channel` and `clipboard_completion` tests:
they queue the events and then run the writer; each keeps its check
(cancellation and invalidation after waiting for the writer, completion
and permit after the whole PDU, no interleaving).

With the test from #2310 (the client reads 1 MiB/s, the server sends 2.5
MiB/s of EGFX data), time until the input handler gets the mouse move:

| Mouse move sent after | master da016ce8 | this PR |
|---|---|---|
| 1 s | 0 ms | 0 ms |
| 3 s | 865 to 3740 ms | 0 ms |
| 5 s | 1744 to 7966 ms | 0 ms |
| 8 s | 4756 to 4960 ms | 0 ms |

Also connected the `server` example with mstsc 10.0.19041.4717 and
FreeRDP 3.32.1: the session ran as before.

Fixes #2310

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net>
2026-11-16 19:31:01 -05:00
brokenlander 24abb00fbb feat(web): add client name and keyboard layout (#2424)
The web client always announced itself as `ironrdp-web` and sent
keyboard layout 0, so every browser session showed the same client name
on the server, and the server always chose its own default input locale.

`client_name` replaces the name in the client core data and in device
redirection; an empty name is ignored. The client core data keeps the
first 15 UTF-16 code units of the name and 31 of the IME file name, and
its encoder now drops a high surrogate that either cut would leave
unpaired. `keyboard_layout` takes a Windows input locale identifier,
such as 0x409, and sends it in both the client core data and the client
Input Capability Set, which should carry the same value; 0 keeps the
server's default, and a value that is not a 32-bit unsigned integer is
logged and ignored. `iron-remote-desktop-rdp` exports `clientName` and
`keyboardLayout`.
2026-11-16 13:07:41 -05:00
Greg Lamberson 8f32942ca4 refactor(daemon): share the frame and RAIL wait cap (#2438)
Frame and RAIL waits now take their 60-second timeout cap from one
constant, so the two limits can't drift apart, and a test on each side
rejects a timeout over it. `Live.frame_number` states its link to the
stored frame as an invariant, and a test runs the output consumer to
check that the two change together.

Nothing pinned how `wait-frame`'s `--after-frame` and `--timeout-ms`
options reach `Request::WaitFrame`, because the end-to-end test gets "no
active session" before the daemon reads either value. A new test runs
the command against a stand-in daemon and checks the exact request it
receives. The stand-in is now a helper that the `status` output test
uses too, and the no-session test's oracle note claims only what it
catches. The daemon's dispatch of a frame wait gets a test of its own,
separate from the timeout case.

The agent README says `wait-frame` needs the daemon backend and that the
ActiveX backend reports no frame number.
2026-11-16 13:06:45 -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