mirror of
https://github.com/Devolutions/IronRDP.git
synced 2026-11-24 01:04:51 +00:00
master
187 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8232d12c55 |
feat(rdpeai): add native microphone capture (#2481)
Capture microphone audio through the RDPEAI dynamic channel and queue outgoing packets with ordered control replies. Expose polling and shutdown through the native audio session, and stop capture if the bounded uplink overflows. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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> |
||
|
|
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> |
||
|
|
b482f56c55 |
build(ffi): pin diplomat to Devolutions 0.17.0-devo.1 (#2353)
Moves the .NET bindings to Diplomat [`0.17.0-devo.1`](https://github.com/Devolutions/diplomat/releases/tag/0.17.0-devo.1): upstream 0.17.0 plus [rust-diplomat/diplomat#1315](https://github.com/rust-diplomat/diplomat/pull/1315), which keeps an argument alive when another argument may store it. Nothing here stores an argument, so only the shared runtime files (`BorrowLease.cs`, `RustHandle.cs`) change in the regenerated bindings. No generated method changes. Tested locally on Windows: regenerated bindings, .NET build and the .NET tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e0949e671e |
feat(ffi): expose RDPEI touch input (#2283)
Lets .NET consumers send touch and pen input over the MS-RDPEI dynamic channel (`Microsoft::Windows::RDS::Input`), which the `ironrdp-rdpei` crate and `ActiveStage` already implement but the FFI did not expose. `ClientConnector.WithDynamicChannelRdpei(maxTouchContacts, showTouchVisuals)` attaches the client, advertising protocol version 2, which covers touch and pen. `TouchFrameBuilder` wraps `rdpei::contact::TouchFrameBuilder` so toolkits push per-contact events with a `TouchPhase` and desktop coordinates; `PenFrameBuilder` does the same for one pen with a `PenPhase` (hovering, touching, out of range, canceled) and optional `PenAttributes` (buttons, pressure, rotation, tilt), both on the crate's contact state machine so contact ids, `contactFlags` and frame timing are derived natively. `ActiveStage.RdpeiInputState` reports what the channel accepts; `ActiveStage.EncodeRdpeiTouch(builder)` and `EncodeRdpeiPen(builder)` return the next frame to write, at most 32767 frames per call with the remainder kept pending, or null when nothing is pending, and they throw and keep the frames pending while the channel is not ready or suspended or the event fails to encode. `ActiveStage.EncodeRdpeiDismissHovering(contactId)` encodes `RDPINPUT_DISMISS_HOVERING_CONTACT_PDU`. Multipen injection is not requested, so pen frames use `deviceId` 0. The .NET smoke tests open the channel against scripted DRDYNVC and SC_READY PDUs and decode the encoded touch, pen and dismiss-hovering PDUs against MS-RDPEI 2.2.3.3, 2.2.3.7 and 2.2.3.6, including the split of more than 32767 pending frames. |
||
|
|
4982320bff |
perf(ffi): size PDUs from the header and add buffered, sync and cancellable Framed reads (#2289)
`Framed.ReadPdu` copied the whole buffer into a new array on every `FindSize` call. An active-stage PDU announces its length in its first bytes (four for TPKT, at most three for fast-path), so `Framed` now probes only the first four buffered bytes into a reusable array; `ReadByHint` keeps the full copy because connection-time PDUs are few and small. New members, alongside the existing ones: - `ReadPdu(CancellationToken)`, and `CancellationToken` overloads of `ReadExact` and both `ReadByHint`. - `TryReadBufferedPdu(out (Action, byte[]))`: takes the next PDU when it is already buffered, without reading the stream, so a consumer can flush rendering only when nothing more is pending. - `ReadPduSync()`: a blocking read for a dedicated read thread. A cancelled read stops waiting but leaves the stream read in flight; the next read, asynchronous or synchronous, finishes it first, so bytes are neither lost nor read twice. Every read reports a stream that ends before the PDU is complete as `IronRdpLibException(EndOfFile)`, where `ReadExact` and `ReadByHint` threw a plain `Exception`. `Connection.Connect`, `RDCleanPathConnection.ConnectRDCleanPath`/`ConnectVmConnectRDCleanPath` and `Connection.SingleSequenceStep` take an optional `CancellationToken` and pass it to the hint reads, the TCP connect and the TLS handshake. Consumers: - The Avalonia example cancels the connection sequence and the read loop through one token on window close or session end, and uses `TryReadBufferedPdu` to present the bitmap only once no further PDU is buffered, so a burst of updates draws once. - `ConnectExample` uses the cancellable read with a timeout instead of `Task.WhenAny`, which left a read pending. - Devolutions/IronSessions `RdpSession` uses `TryReadBufferedPdu` to flush rendering only when the socket is quiet, `ReadPdu(CancellationToken)` for disconnect and timeout, the cancellable `ReadByHint` during the connection sequence, and `ReadPduSync` for a dedicated read thread on Mono (Android/iOS), where awaiting every read hopped pool threads. `ReadPduSync` has no consumer in this repository on purpose: the examples are async end to end. `ffi/INTENT.md` records the probe width, the `ReadByHint` split, the EOF policy and the read regime. Smoke tests cover header-only sizing for TPKT and both fast-path length encodings, several PDUs in one read, a partial PDU left buffered, the sync read across split reads, EOF inside a PDU body on every read path, and a cancelled read whose in-flight stream read the next read finishes. |
||
|
|
cd6c224335 |
feat(ffi): encode fast-path input without the active stage (#2288)
`ActiveStage.ProcessFastpathInput` was the only way for a .NET client to turn input events into wire bytes, and it takes the stage and the image, so input handlers had to share the lock that the PDU decode loop holds. On a busy screen the UI thread waited on frame decoding for every mouse move. Encoding needs no session state: `ironrdp_session::encode_fastpath_input` chunks the events into Fast-Path Input PDUs, and `ActiveStage::process_fastpath_input` reuses it, so its output is unchanged. The .NET binding exposes it as `FastPathInputEventIterator.Encode()`, which returns the PDUs for one `InputDatabase.Apply` as a `VecU8` ready for `Framed.Write`, without touching an `ActiveStage` or `DecodedImage`. `ProcessFastpathInput` stays for clients with software pointer rendering, which also redraws the pointer in the image. The Avalonia example sends input through `Encode()` unless software pointer rendering is on, and the README states which calls no longer need the stage lock. |
||
|
|
851747a1c7 |
feat(ffi): expose display control readiness and capabilities (#2285)
`ActiveStage.EncodedResize` returns `null` until the Display Control channel has received the server's capabilities, and the .NET binding gave a client no way to tell when that happens, so clients polled or retried blindly. Add `ActiveStage.DisplayControlState` (`Unavailable`, `Pending`, `Ready`) and `ActiveStage.DisplayControlCapabilities` (`MaxNumMonitors`, `MaxMonitorArea`), wrapping `ironrdp_session::ActiveStage::display_control_ready` and `display_control_capabilities`. A client checks the state after each `Process` call and sends its first resize once it becomes `Ready`. `display_control_ready` now takes `&self`, which Diplomat requires for a getter; it never needed `&mut self`. |
||
|
|
3c196765a4 |
feat(ffi): expose preconnection PDU encoding (#2284)
Add `PreconnectionBlob` to the .NET bindings with `NewV1(id)`, `NewV2(id, payload)` and `Encode()`, so a client can write an MS-RDPEPS preconnection PDU on the TCP stream before the X.224 Connection Request without hand-rolling the wire format. Gateways and Hyper-V VMConnect listeners select the RDP source from this PDU; a plain Windows 3389 listener does not accept one. The encoder is `ironrdp_pdu::pcb::PreconnectionBlob`, so cchPCB counts the UTF-16 null terminator and `Encode()` returns the bytes as an owned `VecU8`. The type is not `IDisposable` because it is a small value-like object. |
||
|
|
27b8a31df6 |
chore(release): prepare for Devolutions.IronRdp v2026.10.28.0 (#2282)
Bumps the NuGet package to **2026.10.28.0** (package `2026.10.28`), same as #2146. Heads up, this one's breaking for .NET callers: the bindings moved to Diplomat 0.16 (#2165) and now hand back owned data instead of borrowed views (#2167). It also ships RemoteFX on by default (#2242) and the render/`Framed` perf work (#2168, #2169, #2170). After merge, publish with the **Publish NuGet package** workflow (`workflow_dispatch`, dry-run = false). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a495fbc369 |
perf(ffi): redraw only the damaged rectangle (#2170)
On every graphics update the Avalonia example allocated a full-frame array, copied the whole framebuffer into it, cleared the whole bitmap and copied the whole frame again. It ignored the rectangle that the update reports. Copy just that rectangle with `CopyRectInto` into a buffer kept across frames, under the stage lock. Then copy it into the bitmap using the bitmap's real row length. The whole frame is copied only when the image size changes, and the bitmap is recreated outside the lock. A failed render now logs why. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
cf40ba53e8 |
perf(ffi): stop reallocating on every Framed read (#2169)
`Framed` created a native `IronRdpPdu` on every `ReadPdu` loop, a new array on every socket read, and rebuilt its whole remaining buffer with LINQ after every PDU. Create one `IronRdpPdu` per `ReadPdu` call instead of one per loop. Keep one read buffer per `Framed`, append the bytes read as a span, and drop consumed bytes with `RemoveRange`. The buffer list is now updated in place, so `GetInner` returns the live buffer rather than a snapshot that later reads replace. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> |
||
|
|
3e42406f76 |
perf(ffi): copy only the damaged rectangle (#2168)
C# callers could only read the framebuffer whole, so every graphics update copied the full frame even when a few pixels changed. The update already says which rectangle changed. Add `DecodedImage.CopyRectInto(rect, buffer, stride)`. It copies the rows of that rectangle into the caller's buffer at the same position, without allocating. Inverted rectangles, rectangles past the image and short buffers return an error instead of panicking. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> |
||
|
|
ab029ff7d1 |
feat(connector)!: let the client choose the RDP version it announces (#2115)
Let clients choose the RDP version announced in GCC Client Core Data through `ironrdp_connector::Config::rdp_version` and `ironrdp_client::config::ConfigBuilder::with_rdp_version`. The builder defaults to `RdpVersion::V5_PLUS`, preserving existing behavior. Relative mouse input still raises the announced version to at least RDP 10.12, as required by [MS-RDPBCGR sections 2.2.1.3.2 and 2.2.7.1.6](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-rdpbcgr/b3bc76ae-9ee5-454f-b197-ede845ca69cc), without lowering a newer configured version. Update the Progressive reset test to the current tile helper signature so workspace tests compile after rebasing. BREAKING CHANGE: `ironrdp_connector::Config` gains a public `rdp_version` field. Existing struct literals should set it to `RdpVersion::V5_PLUS` to preserve behavior. --------- Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> |
||
|
|
d28a214c94 |
fix(ffi)!: return owned data, not borrowed views (#2167)
`DecodedImage`, `DecodedPointer` and `ActiveStageOutput` own the framebuffer, the pointer bitmap and response payloads, which are large native allocations the garbage collector does not see. That is the first condition in `ffi/INTENT.md` for being `IDisposable`. They handed out views that borrow from them, which the new .NET generator refuses for disposable types, and every caller copied the bytes into a managed array right away anyway. - `ActiveStageOutput.ResponseFrame`/`WindowingOrders` and `DecodedPointer.Data` return an owned `VecU8`, which has the same `Size`/`Fill` members as the old view. - `DecodedImage.Data` is replaced by `DataSize` and `FillData(byte[])`. They copy the framebuffer once into the caller's buffer, and a larger buffer is fine. The three types are now `IDisposable`, and `ffi/README.md` lists them. The Avalonia example disposes the image it replaces on reactivation, and both examples dispose each output and response frame they read. BREAKING CHANGE: `DecodedImage.Data` is removed, use `DataSize` and `FillData`. `ResponseFrame`, `WindowingOrders` and `DecodedPointer.Data` now return `VecU8` instead of `BytesSlice`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> |
||
|
|
d69ab8cc60 |
perf(ffi): offer RemoteFX when no bitmap config is set (#2242)
`ConfigBuilder.build()` always passed `bitmap: None` ([config.rs](https://github.com/Devolutions/IronRDP/blob/0de13342/ffi/src/connector/config.rs#L231)), so .NET clients never offered a codec and the server fell back to near-raw bitmaps. On a 1080p video-like load that's ~6.5 MB a frame, and the server just starts skipping frames ("insufficient network"). Now, when no bitmap config is set, `build()` uses the same default as the native client: 32-bit, lossy, default codecs (RemoteFX here, since the FFI doesn't build QOI). A config set through `bitmap_config` is used instead of being ignored. Lab numbers (IT-HELP-AGENT → IT-HELP-DC, Avalonia example, video-like load, frame rate from the server's `RemoteFX Graphics` counters, 1024x768 VM, 5 alternating runs each): | | master | this PR | |---|---|---| | server output fps (median) | 12.8 | 18.7 | | frames skipped/s, network | 3.0 | 0 | | bandwidth | 23.8 MB/s | 5.6 MB/s | | client VM CPU | 33.6% | 14.1% | Also checked the screen by eye: desktop text and the video pattern both render fine. Not in here on purpose: bulk compression and EGFX, those are follow-ups. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e3affd83c5 |
build(ffi)!: move to Diplomat 0.16.1-devo.2 (#2165)
The .NET bindings were generated by Diplomat 0.7 from a personal fork, years behind upstream. Move to the protected `Devolutions/diplomat` tag that IronVNC and picky-rs already use, with the same xtask pinning and install flow. Rust side: - pin `diplomat` and `diplomat-runtime` to tag `0.16.1-devo.2` and drop the `[patch.crates-io]` entry for the old fork; its zero-length slice fix is upstream now, since slice parameters go through `DiplomatSlice`, which maps a null pointer to an empty slice - `opaque_mut` on the 20 types that are mutated through `&mut`, named lifetimes on borrowed returns, `DiplomatWriteable` renamed to `DiplomatWrite`, and no explicit `Clone`/`Copy` on bridge enums - move `dotnet-interop-conf.toml` to the `lib_name` + `[dotnet]` layout Tooling: xtask installs `diplomat-tool` from the tag with Rust 1.96.0, because the tag does not build with the workspace toolchain. It records the source and version so a tool from another tag is never reused, checks that the tool and the ffi crate use the same tag, and calls the tool by absolute path. The `ffi` CI job caches those records with the binary, so a cache hit does not reinstall the tool. The library and examples use properties instead of the removed `GetX()`/`SetX()` methods. `ffi/README.md` gains a migration section with these steps. BREAKING CHANGE: for consumers of `Devolutions.IronRdp`: - `GetX()`/`SetX()` methods that duplicated a property are removed - the `&mut` getters on `ClientConnectorState` and `CredsspSequenceInitResult` are methods only - `IronRdpErrorKind.IO` and `WrongOS` are now `Io` and `WrongOs` - `Position`, `MultitransportRequest` and `NetworkCharacteristics` are structs with public fields instead of classes with properties - the `Devolutions.IronRdp.Raw` namespace is internal, and the public `AsFFI()` methods and raw-pointer constructors are removed - `DiplomatWriteable`, `DiplomatOpaqueException` and the `IronRdpError.ToDisplay(DiplomatWriteable)` overload are removed - `IronRdpException` is no longer `partial` - only the ten types listed in `ffi/README.md` are `IDisposable`; every other type, such as `Config`, `InclusiveRectangle` and `ClientConnector`, is released by its finalizer and no longer has `Dispose()` - overlapping calls on one native object now throw, such as calling `ActiveStage` from the PDU loop and an input handler at once, or using a `CredsspSequence` while its `CredsspProcessGenerator` is alive Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
98413f16cc |
feat(activex)!: broaden mstscax compatibility (#2211)
Hosts written against Microsoft's mstscax control (RDM, MsRdpEx, scripting hosts, mstsc-style shells) still hit members that IronRDP's ActiveX control left unimplemented. A comparison against mstscax.dll 10.0.26100 (its embedded MSTSCLib type library, AdvancedSettings vtable and property handlers) identified the most-used gaps; this change closes six of them. Late-bound Automation: every published MSTSCLib member of the control and of the Advanced, Secured, Transport and RemoteProgram settings objects is reachable through `IDispatch` by name and DISPID, with arguments coerced to the published Automation types and calls routed to the existing vtable slots through `DispCallFunc`. The control also implements `IProvideClassInfo2`, `IQuickActivate` and `IPersistPropertyBag`/`IPersistPropertyBag2`. No type library is created or registered, so `GetTypeInfo` still returns `E_NOTIMPL`. Events: the control raises `OnRequestContainerMinimize`, `OnLogonError`, `OnUserNameAcquired`, `OnNetworkStatusChanged`, `OnRemoteProgramDisplayed`, `OnRemoteWindowDisplayed`, `OnIdleTimeoutNotification`, `OnFocusReleased` and `OnMouseInputModeChanged` with mstscax's argument layout, and the modern facade gains `OnNetworkStatusChanged` and `OnKeyCombinationPressed`. Events without an IronRDP source stay unraised and are documented. Keyboard and input policy: the `HotKey*` and focus-release hotkeys, `AcceleratorPassthrough`, `SasSequence`, `DisableCtrlAltDel`, `DoubleClickDetect` and `RelativeMouseMode` follow mstscax defaults, and the extended properties `AllowRelativeMouseMode`, `IgnoreServerGeneratedMouseMoves`, `IgnoreClientSideMouseInput`, `DisableFullScreenHotkey` and `AllowSasSequenceTransmission` are honored. Relative pointer input is sent only when the server's Input Capability Set allows it, and the client then advertises `RNS_UD_CS_RELATIVE_MOUSE_INPUT` with RDP version 10.12, the lowest version for which servers honor it. AdvancedSettings compatibility: deprecated slots that mstscax answers with `S_FALSE` now do the same instead of failing with `E_NOTIMPL`, and `overallConnectionTimeout`, `singleConnectionTimeout`, `shutdownTimeout`, `MinutesToIdleTimeout` and `CanAutoReconnect` are wired to the client. Extended settings and `.rdp` properties: `IMsRdpExtendedSettings` accepts the mstscax names that map to IronRDP behavior (desktop and device scale, physical size and orientation, selected monitors, audio devices, location, touch, manual clipboard sync, `RemoteSessionId` and others) and documents the rest. The connector can advertise physical size, orientation, device scale and Client Monitor Extended Data (only when it describes every monitor of Client Monitor Data), and the `.rdp` mapping reads `session bpp`, `devicescalefactor`, `connection type`, `redirectsmartcards` and `redirectlocation`. `IMsRdpClientShell` and publisher trust: `MsRdpClientShell` returns a working `.rdp` record store. Its `Launch` applies the records to the owning control and connects in-process instead of starting `mstsc.exe`, subject to the `DisableClientLaunchingFromActiveXControl` policy. `ApplySettings` verifies signed `.rdp` files with the Windows client's format and policies, and `ShowRedirectionWarningDialog`, `RedirectionWarningType`, `WarnAboutPrinterRedirection`, `LaunchedViaClientShellInterface` and `PublisherCertificateChain` drive a fail-closed consent prompt before connecting. A signed file whose signature no longer matches is rejected, where Windows downgrades it to an unverifiable publisher. Save Session Info logon errors now decode NTSTATUS failure types ([MS-RDPBCGR] 2.2.10.1.1.4.1.1), which previously ended the session with a decode error, and relative mouse fast-path events now carry their body. The FFI reports the new session outputs as `ActiveStageOutputType::LogonErrors` (17) and `ActiveStageOutputType::SessionId` (18), after the existing `WindowSurfaceUpdates` (15) and `ServerRedirection` (16). 🤖 Generated with [Claude Code](https://claude.com/claude-code) BREAKING CHANGE: `ironrdp_session::ActiveStageOutput` and `ironrdp_session::x224::ProcessorOutput` gain `LogonErrors` and `SessionId` variants; `ironrdp_client::rdp::RdpOutputEvent` gains `ServerInputFlags`, `LogonError`, `NetworkCharacteristics` and `RemoteSessionId` variants; `ironrdp_connector::Config` and `ironrdp_client::config::ChannelConfig` have new public fields; `ironrdp_pdu::rdp::session_info::LogonErrorNotificationType` gains an `NtStatus(u32)` variant and is no longer `#[repr(u32)]`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6e54d5e9ec |
feat(egfx)!: composite surfaces mapped to RemoteApp windows (#2197)
With the graphics pipeline in a RemoteApp session, Windows servers present each application window from its own surface through MapSurfaceToWindow or MapSurfaceToScaledWindow (MS-RDPEGFX 2.2.2.20 and 2.2.2.23). The client only forwarded these PDUs to handler callbacks, so nothing those surfaces drew reached the windows. The compositor now records window mappings and, at each EndFrame, materializes dirty regions of window-mapped surfaces into window updates: the RAIL window ID, the presented size and the changed region in window coordinates, scaled when the server asks for a different target size. GraphicsPipelineClient::drain_window_updates exposes them, the session emits ActiveStageOutput::WindowSurfaceUpdates and the client forwards RdpOutputEvent::WindowSurfaceUpdates. A mapping the client cannot present, such as a mapped area larger than its surface, is ignored and the surface keeps its previous mapping; FreeRDP also refuses oversized mappings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) BREAKING CHANGE: ActiveStageOutput and RdpOutputEvent have a new WindowSurfaceUpdates variant, and the .NET ActiveStageOutputType enum gains WindowSurfaceUpdates. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f5ec943588 |
fix(pdu)!: tolerate icon flags without an icon in window orders (#2210)
The typed windowing order decoder rejected a window order that set WINDOW_ORDER_FIELD_ICON_BIG or ICON_OVERLAY without an icon or cached icon. Those flags carry no data and only qualify an icon, the previous validator tolerated them, and a decode error ends the session, so such an order from a server now disconnected the client. The decoder ignores the two flags when no icon is present and decodes the order as a window state order. The complete slow-path Orders update framing, including its updateType field, moves into ironrdp-pdu as encode_slow_path_windowing_orders_update and slow_path_windowing_orders_update_size, which the .NET binding and the daemon's RAIL event byte count now share. The Orders update is cited as MS-RDPBCGR 2.2.9.1.1.3.1 with MS-RDPEGDI 2.2.2.1. 🤖 Generated with [Claude Code](https://claude.com/claude-code) BREAKING CHANGE: encode_slow_path_windowing_orders and slow_path_windowing_orders_size are replaced by encode_slow_path_windowing_orders_update and slow_path_windowing_orders_update_size, which include updateType. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
485657a6ec |
feat!: follow server redirection to the target host (#2208)
An RD Connection Broker sends a Server Redirection PDU to move a client to the session host that holds or will hold its session. IronRDP rejected the PDU as an unexpected share control PDU, so a client could not connect to an RDS farm through its broker. The PDU layer decodes and encodes the Server Redirection Packet with every optional field, the target net addresses and the Base64 target certificate container, in both its Enhanced Security variant (share control type PDUTYPE_SERVER_REDIR_PKT) and its Standard Security variant. The Client Info PDU can carry an opaque password cookie verbatim, as FreeRDP sends it. The connector recognizes the PDU during capabilities exchange and connection finalization and ends in a `Redirected` state instead of failing; `connect_finalize` returns a `ConnectionOutcome` that is either `Connected` or `Redirected`. The session reports a redirection received later as `ActiveStageOutput::ServerRedirection`. PDUs marked LB_NOREDIRECT are ignored. `ironrdp-client` now always advertises redirection support in the Client Cluster Data and follows a redirection for every front-end: it closes the connection, emits `RdpOutputEvent::ServerRedirected` and reconnects with the load-balancing information as the X.224 routing token, the session ID in the cluster data, the password cookie in the Client Info PDU and the redirected user name and domain. Transport, TLS and CredSSP settings are kept. A direct connection tries the target addresses first, like mstsc, and authenticates the FQDN; `use redirection server name` (ActiveX `UseRedirectionServerName`) or a gateway puts the names first. A target certificate reported by the broker is accepted under strict validation, a TsvUrl mismatch aborts, and at most 8 redirections are followed. RDSTLS-encrypted passwords are refused as unsupported. `ironrdp-server` gains a redirection handle that sends the PDU to the active client and waits for it to disconnect, and reports the routing token, redirected session ID and password cookie of an incoming connection. The FFI exposes the redirection outcome to .NET. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2bc793ef3f |
feat(pdu)!: decode RemoteApp windowing orders into typed structs (#2195)
Windowing Alternate Secondary Drawing Orders (MS-RDPERP 2.2.1.3) were only validated and forwarded as raw bytes, so every RemoteApp front-end re-parsed them by hand and ignored what it did not parse: icons, cached icons, window shapes, visibility regions, notification icons, the active window and the z-order. ironrdp-pdu now decodes each order into a typed WindowOrder, NotifyIconOrder or DesktopOrder, including TS_ICON_INFO and TS_CACHED_ICON_INFO, and encodes them back. ActiveStageOutput and the client's RdpOutputEvent carry the decoded orders instead of a slow-path update. The ActiveX control consumes the typed orders in place of its own parser, and the .NET binding still exposes a slow-path Orders update by re-encoding them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) BREAKING CHANGE: ActiveStageOutput::WindowingOrders and RdpOutputEvent::WindowingOrders now hold Vec<WindowingOrder>, and the ironrdp_pdu::window decoding functions return owned typed orders. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
18ec4a045e |
refactor(ffi): mark the IDisposable bridge types (#2164)
The Diplomat version we are moving to makes `IDisposable` opt-in. Without the attribute, a generated wrapper only has a finalizer. Mark the types that `ffi/INTENT.md` says are disposable: - operating-system resources: `ActiveStage`, whose DVC pipe proxies own named-pipe worker threads, and `WinCliprdr`, which owns the clipboard window - large buffers the garbage collector cannot see: `ActiveStageOutputIterator`, `VecU8`, `WriteBuf`, and the clipboard payloads `ClipboardMessage`, `ClipboardSvcMessage`, `FormatDataResponse` and `FfiFileContentsResponse` `DvcPipeProxyMessage` stays unmarked: sending one moves its payload out, so nothing large is left behind. Also mark `CredsspProcessGenerator`. None of the three conditions names it, but it holds `&mut` of its `CredsspSequence`, and the sequence rejects every other call until the generator is released. Releasing it costs nothing. `DecodedImage`, `DecodedPointer` and `ActiveStageOutput` also qualify, but they hand out borrows that outlive the call, which the new generator refuses for disposable types; a later change returns owned data so they can be marked too. The pinned 0.7 macro strips `#[diplomat::attr]`, so this changes no generated code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
b9d1400033 |
feat(cliprdr): transfer files through the Windows clipboard (#2179)
Adds clipboard file transfer, in both directions, to the Windows clipboard backend (`WinClipboard`), and stops it advertising formats it can't deliver. ActiveX and `ironrdp-client` get the feature as is; the .NET FFI gets it through new bindings, opt-in. ## Backend (`feat(cliprdr)`) **Remote to local.** When the remote format list has `FileGroupDescriptorW`, an OLE data object goes on the clipboard (`OleSetClipboard`). It offers `FileGroupDescriptorW` and one `FileContents` `IStream` per file (`lindex`), plus the other remote formats. - Streams read through `FileContents` RANGE requests carrying the `clipDataId` of the lock `Cliprdr` took for that list, so a paste keeps working after the remote clipboard changes, until the lock is released. Files over 4 GiB work. - OLE needs an STA: this is only enabled when `WinClipboard` is created on one. COM is never initialized on a thread that has none. - The objects are not agile and run on the clipboard thread. A stream read blocks it like `WM_RENDERFORMAT` handling already does (30 s timeout, chunks up to 1 MiB with read-ahead). Backend events arriving during a wait are now queued instead of dropped. **Local to remote.** `CF_HDROP` paths (directories walked into relative paths), or another application's virtual files (`FileGroupDescriptorW` + `FileContents`), are offered with `SendInitiateFileCopy` once the channel is ready. The remote's SIZE/RANGE requests are served, from the lock snapshot when a `clipDataId` is given. **Capabilities.** The backend now negotiates `STREAM_FILECLIP_ENABLED`, `FILECLIP_NO_FILE_PATHS`, `CAN_LOCK_CLIPDATA` and `HUGE_FILE_SUPPORT_ENABLED`. **Format filtering.** Handle-based formats (`CF_BITMAP`, `CF_ENHMETAFILE`, `CF_METAFILEPICT`, `CF_PALETTE`), private ranges, local paths and shell items (`CF_HDROP`, `FileNameW`, `Shell IDList Array`) and OLE storage formats are no longer advertised in either direction. Images still go through as `CF_DIB`, which Windows synthesizes. **Request validation.** `ironrdp-client` treats a rejected clipboard request as session-fatal, so the backend checks what it sends against the rules `Cliprdr` enforces: file list indexes, range bounds, huge-file positions, and released locks. **Also fixed.** The window subclass state leaked on drop, and `WM_DESTROY` freed it while `WM_NCDESTROY` could still use it. ## Viewer (`fix(viewer)`) Without a backend factory, `ironrdp-client` created `WinClipboard` on the RDP thread, which runs a tokio runtime and no Windows message loop, so clipboard redirection never worked in the viewer (no clipboard events, no backend wake-ups, no STA for OLE). The viewer now initializes OLE and creates the clipboard, with file transfer, on its winit thread and hands the factory to `RdpClient`. ## .NET FFI (`feat(ffi)`) - `ActiveStage.SubmitClipboardMessage` hands any backend message to the clipboard channel, file transfer included, and returns the frame to send. - `ActiveStage.DriveClipboardTimeouts` expires clipboard locks and file transfers. - `WinCliprdr.NewWithFileTransfer(bool)` opts in. `WinCliprdr.New()` keeps file transfer off, so existing consumers that only route the three original message types don't receive new ones. - `WinCliprdr.NextClipboardMessageTimeout(ms)` lets a loop wake up to drive the timeouts. - The Avalonia example opts in, submits every message through `SubmitClipboardMessage`, drives the timeouts, and logs a failed clipboard operation instead of stopping clipboard handling. Only the four affected generated files are included. ## Testing - `cargo xtask check fmt`, `check lints` and `check locks` pass. - 12 unit tests in `cliprdr_native::windows`: format filtering, file list building, file contents serving, range sizing, descriptor round-trips. - 6 tests in `cliprdr_native::windows_live` run a `CliprdrClient` over `WinClipboard` against an in-memory `CliprdrServer` on the real Windows clipboard. They are opt-in with `IRONRDP_WIN_CLIPBOARD_LIVE=1`, because they replace the clipboard and briefly open an Explorer window. All pass locally: - Explorer pastes remote folders and files, contents checked byte for byte. - A 5 GiB remote file is read through OLE past 4 GiB. - Remote handle and path formats are not offered locally. - Local folders reach the remote, both at connect time and when copied mid-session. - Local image formats are filtered. - Virtual files from another session reach the remote. - .NET: the solution builds and the smoke tests pass (9/9, one new). - End to end with `ironrdp-viewer` against a Windows 11 server (rdpclip): capabilities negotiated as `STREAM_FILECLIP_ENABLED | FILECLIP_NO_FILE_PATHS | CAN_LOCK_CLIPDATA | HUGE_FILE_SUPPORT_ENABLED`. A local folder (nested directories, an empty directory, an empty file, a 5 MiB random file) copied in Explorer was pasted into Explorer in the session, served under rdpclip's lock. Copying it back in the session and pasting it into a local Explorer window gave byte-identical files (SHA-256). Not verified by hand: ActiveX and the Avalonia example against a real server. ## Notes for review - This conflicts with #2175 in `MainWindow.axaml.cs` and the generated `ActiveStage` files. The clipboard loop body here is a single `SubmitClipboardMessage` call, so the merge only needs #2175's `WithActiveStage(...)` wrapper around it; the generated files can be regenerated. - Running the extra test suite locally may need `CMAKE` pointed at Visual Studio 2026's bundled CMake: `libopus_sys` fails with older CMake versions that lack the "Visual Studio 18 2026" generator. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b735d190dd |
feat(ffi): redirect smartcards through WinSCard on Windows (#2175)
## Problem `ClientConnector.WithStaticChannelRdpdr` in the .NET FFI announces a smartcard device backed by `NoopRdpdrBackend`. That backend's `handle_scard_call` returned no messages, so the client never completed any MS-RDPESC IOCTL the server sent (EstablishContext, ListReaders, GetStatusChange, ...). Server-side WinSCard calls in the session hung, which can stall logon and UAC prompts that check for readers. `ironrdp-client` attaches the same backend when RDPDR is enabled with no native backend. ## Fix **The noop backend answers every smartcard call.** It replies with the return structure the server expects for that IOCTL, with `ReturnCode = SCARD_E_NO_SERVICE` and `IoStatus = STATUS_SUCCESS`, as MS-RDPESC 3.1.4 requires for smart card errors. Shared helpers in `ironrdp-rdpdr` build these replies, and the Windows backend now uses them too: - `ScardCall::error_response` builds the completion for a failed call. An IOCTL with no known return structure gets `STATUS_UNSUCCESSFUL` and no output, as in FreeRDP; this path is unreachable today. - `esc::complete_call` replies `STATUS_BUFFER_TOO_SMALL` when the structure does not fit the server's output buffer, so the server retries with a larger one (3.2.5.2). - Error returns zero every field besides `ReturnCode` (2.2.3): empty context and handle (`ScardContext::empty`, `ScardHandle::empty`), NULL buffers, and no reader states (kept on `SCARD_E_TIMEOUT`, as FreeRDP does). This also fixes failure replies in the Windows backend (Connect, Transmit, Reconnect, GetTransmitCount, GetDeviceTypeId). **Real WinSCard redirection in the FFI on Windows.** `WithStaticChannelRdpdr` now backs the smartcard with the WinSCard passthrough from `ironrdp-rdpdr-native`, the same backend the viewer and ActiveX use. Other platforms keep the noop backend. The native backend runs blocking calls (GetStatusChange, Connect, Transmit, ...) on worker threads, and their completions only reach the server through `Rdpdr::poll_deferred_messages`. So: - `ActiveStage.Process` sends deferred RDPDR completions after each frame, as `ironrdp-client` does, except after `DeactivateAll` or `Terminate`. - New `ActiveStage.PollRdpdrDeferred()` returns them while the server is idle. Hosts should call it about every 50 ms, serialized with their other `ActiveStage` calls. - The Avalonia example polls every 50 ms from its read loop, and starts the next read only after the current frame's outputs are handled, so reactivation reads are not raced. The existing .NET API is unchanged; `PollRdpdrDeferred` is an addition. The regenerated bindings only add the new method and doc comments. ## Related PRs This PR builds on #2161 and #2162, both now merged into master: - #2161 makes `Framed.Write` safe for concurrent writers, which the example's 50 ms poll relies on. - #2162 locks every `ActiveStage` call in the Avalonia example. This PR only adds the RDPDR poll, the read-ordering fix and a null guard in `SendFastpath` on top of it. ## Testing - Testsuite tests send an EstablishContext IOCTL through `Rdpdr` with the noop backend, cover the `STATUS_BUFFER_TOO_SMALL` and no-structure paths, and check that error replies for eight call types are all zero after `ReturnCode`. - `cargo test` passes for `ironrdp-rdpdr`, `ironrdp-rdpdr-native` and the testsuite's rdpdr tests. - `cargo xtask check fmt`, `cargo xtask check locks`, `cargo xtask ffi build` and `cargo xtask ffi bindings` (which builds the .NET library) pass, and the Avalonia example builds. - Clippy with `-D warnings` is clean on `ironrdp-rdpdr`, `ironrdp-rdpdr-native`, `ironrdp-testsuite-core` and `ffi`. The full `cargo xtask check lints` could not run locally because the `libopus_sys` CMake build fails on that machine. Not tested: a live session with a reader and card, and building the FFI for non-Windows targets (left to CI). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5a088293c9 |
refactor(ffi): annotate Diplomat accessors (#2163)
The Diplomat version we are moving to no longer turns `get_*`/`set_*` methods into C# properties from a config prefix. Each accessor needs its own attribute, or the property silently disappears from the bindings. Annotate every accessor that the current bindings expose as a property: 86 getters and 19 setters. The nine `&mut self` getters are left as methods, because the new generator refuses getters that take `&mut self`. The pinned 0.7 macro strips `#[diplomat::attr]`, so this changes no generated code. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
db0a45a03c |
fix(ffi): lock ActiveStage in the Avalonia example (#2162)
The example calls into `ActiveStage` and `DecodedImage` from the PDU loop, the clipboard loop and the UI thread without any lock, so two `&mut` borrows of the same native object can be live at once. The next Diplomat runtime turns this into an "Another borrow is already active" exception, which would end the session loop. Take one lock around each native call on the stage or the image, through a `WithStageLock` helper, and route the five input handlers through one `SendFastpath` helper. The lock is never held across an `await` or a dispatcher call, so it cannot deadlock with the UI thread. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
549fc050dc |
fix(ffi): use an async lock for Framed writes (#2161)
`Framed.Write` held a `Mutex` across `await _stream.WriteAsync(...)`. That broke in three ways: - A `Mutex` must be released by the thread that took it. Without a synchronization context, the code after the `await` can run on another thread, so `ReleaseMutex` threw `ApplicationException`. - A `Mutex` lets its owning thread enter again, so two writes started from one thread were not serialized at all. - `WaitOne` blocked the calling thread, such as the Avalonia UI thread, while another thread held the lock. Use a `SemaphoreSlim` with `WaitAsync`, which has no thread affinity, is not re-entrant, and does not block a thread while it waits. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
3a3c27d3a8 |
fix(ffi): dispose CredSSP generator before reuse (#2160)
`ProcessTsRequest` returns a generator that holds an exclusive borrow of the CredSSP sequence. The CredSSP loop left it alive and then called `HandleProcessResult` on the same sequence, so two `&mut` borrows of it were live at once. Dispose the generator as soon as it has produced the client state. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
a1d824f0ea |
fix(ffi): stop panicking on larger output buffers (#2159)
`VecU8`, `BytesSlice` and `U32Slice` checked that the output buffer was not too small, then called `copy_from_slice` on the whole buffer. Any buffer larger than the data passed the check and panicked, which aborts the host process across the FFI boundary. `WriteBuf.ReadIntoBuf` had no check at all: a larger buffer panicked the same way, and a shorter one silently got only the start of the data. Copy into the front of the buffer, leave the rest untouched, and fail when the buffer is too small. The four methods now share one `fill_prefix` helper. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
8aa19d03ef |
test: add .NET smoke tests for the FFI bindings (#2158)
The .NET bindings had no runtime test, only a compile check. Upcoming Diplomat work changes how the generated wrappers hold native handles, so a regression would only show up in a consumer app. Add a small console test runner, in the same style as IronVNC's, that exercises the bindings without a network: image data, byte buffers, error mapping, PDU sizing, config validation, and the first X.224 exchange of the connector. Run it in the FFI CI job. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
aa237eb6a0 |
docs(ffi): define .NET binding intent (#2157)
The Diplomat version we are moving to makes `IDisposable` opt-in per opaque type and rejects overlapping calls that mutate an object, so the bindings need rules for disposal and concurrency. Adopt the disposal rule IronVNC already follows: a type is `IDisposable` only when it owns a large allocation the garbage collector cannot see, a scarce or externally observable resource, or a borrowing view of a disposable type. Also record that no opaque type with a lifetime touches borrowed data when dropped, since .NET finalizers run in no deterministic order. These two sections are a verbatim copy of IronVNC `ffi/src/INTENT.md` at 5c3ea3d5. Add a concurrency section: the generated code rejects only overlapping calls that mutate an object, the hand-written layer locks fragile places such as `Framed`, and otherwise a consumer makes one call at a time on each native object. The file sits in `ffi/` so it covers both the Rust bridge and the C# layer under `ffi/dotnet/`. It states where the bindings are going, not where they are: some of today's code does not follow it yet, and follow-up changes bring that code in line. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com> |
||
|
|
df977e1206 |
fix(ffi): invert no_audio_playback mapping in connector config (#2172)
`ConfigBuilder::build` in the FFI copied `no_audio_playback` straight into `enable_audio_playback`, so setting "no audio playback" to true enabled playback and false disabled it. The mapping is now inverted (`!no_audio_playback.unwrap_or(false)`). When the flag is set, `INFO_NOAUDIOPLAYBACK` is sent in the Client Info PDU, asking the server not to play audio on the client. The default (field unset) is unchanged: playback enabled. The FFI currently exposes no setter for this field, so the bug was latent; this fixes the mapping ahead of any setter being added. No unit test: the `ffi` crate has no config-building test pattern. Checks: `cargo xtask check fmt` and `cargo clippy -p ffi --all-targets -- -D warnings` pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
9be90a7674 |
feat(session)!: answer bandwidth measurements during the session (#2012)
The session answered RTT requests on the message channel but ignored continuous Bandwidth Measure Start and Stop. A shared `AutoDetectResponder` now answers them. - A continuous reliable Start opens or resets a window. Received TCP frames contribute their complete length when no RDP Security Header is present, including fast-path and TPKT/X224/MCS framing. Where a Security Header is present, only bytes following it count. - Results use the measured elapsed time with a 1 ms floor and saturating counters. A missing or untimed window returns 1 ms and zero bytes. - Connect-time requests belong to the connection sequence handled by `ironrdp-connector` and are ignored here. Lossy-tunnel requests are not answered on the main connection. BREAKING CHANGE: `ActiveStage::process` and `x224::Processor::process` take a `received_at: Option<MonotonicInstant>` argument, matching `ironrdp_connector::Sequence::step`. Pass the time the transport read the frame, such as `Framed::last_read_at()`; with `None`, bandwidth results report 0 kbps. The native client, web client, FFI and examples pass their arrival time. Co-authored-by: AKolenda <testedemail2222@gmail.com> Co-authored-by: Benoît CORTIER <git.divisible626@passmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> |
||
|
|
d4c2fec346 |
chore(release): prepare for Devolutions.IronRdp v2026.10.19.0 (#2146)
Bumps the NuGet package version to **2026.10.19.0** (package
`2026.10.19`), as in #1048.
First package since 2025.12.4 to ship:
- the `ios-arm64` + `iossimulator-arm64` framework slices with
single-slice selection (
|
||
|
|
b81c7e3bbb |
fix(ffi): resolve the iOS framework at run time (#2145)
## Problem
The generated raw layer declares a bare
`[DllImport("DevolutionsIronRdp")]`. iOS is the only target that ships
the native code inside a framework bundle rather than a loose dylib, and
no default probing permutation resolves a path inside one, so P/Invoke
binding fails with a `DllNotFoundException` whose entire message is
`DevolutionsIronRdp`.
This is invisible under full AOT, which emits direct native calls and
never probes. It fails wherever binding happens at run time: the
simulator's JIT and any consumer running with `UseInterpreter=true`.
## Change
- **`NativeLibraryResolver.cs`** (new, hand-written outside
`Generated/`, which `cargo xtask ffi` wipes) - registers a
`DllImportResolver` for this assembly via `[ModuleInitializer]`, so
consumers need no setup. Gated to iOS; tries the framework's `@rpath`
install name, then the absolute path under the app bundle's
`Frameworks/`, then falls back to `GetMainProgramHandle()` for the
statically-linked / already-loaded case. That fallback probes a known
export first, so a genuinely missing library is still reported as a
`DllNotFoundException` naming it rather than as a per-symbol
`EntryPointNotFoundException` from an unrelated call later.
- `CA2255` (module initializers in libraries) is suppressed with
justification: the DllImports are spread across the generated `Raw*`
types with no shared static-constructor chokepoint, and requiring
consumers to call an initializer is the coupling this removes.
No packaging/CI change: master already ships `ios-arm64` +
`iossimulator-arm64` as separate frameworks with single-slice selection
(#9d206a3d) — that just hasn't been released since 2025.12.4, whose
`runtimes/ios` fat binary is arm64-device + x86_64-simulator only and
cannot load on an Apple-silicon simulator.
## Verification
Built both slices locally (`aarch64-apple-ios`, `aarch64-apple-ios-sim`
with the simulator `SDKROOT`, `production-ffi` profile), bundled them as
frameworks exactly as the workflow does, packed `Devolutions.IronRdp`
from this branch, and referenced it from an Avalonia iOS app
(`net10.0-ios`, `iossimulator-arm64`, `UseInterpreter=true`) on an
iPhone 16 Pro simulator:
```
[ironrdp-probe] bare-name TryLoad (expected False): False
[ironrdp-probe] FFI call succeeded: IronRDP native library loaded via Devolutions.IronRdp resolver
```
(`ConfigBuilder.New()` → `Build()` executes Rust code, including its
config validation.) No device available here; the device slice is the
same code path under AOT, which never probes.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
||
|
|
62246b364a | build(connector)!: update sspi to 0.23 and picky to rc.26 (#2080) | ||
|
|
5bdb67980c |
feat(connector)!: expose SUPPORT_DYN_VC_GFX_PROTOCOL early-cap flag for EGFX clients (#1237)
Currently, `early_capability_flags` in the GCC core data is built from a fixed set in `connection.rs`. Clients that want to use the Graphics Pipeline Extension (MS-RDPEGFX) — by attaching a `DvcClientProcessor` for `Microsoft::Windows::RDS::Graphics` — have no way to set `SUPPORT_DYN_VC_GFX_PROTOCOL` without forking the connector, and modern Windows servers won't open the EGFX channel unless the client advertises support. This PR adds an opt-in `Config.support_dyn_vc_gfx_protocol: bool` (default `false`). When set, the flag is OR'd into `early_capability_flags` alongside the existing `WANT_32_BPP_SESSION` conditional. Existing consumers are unaffected; the doc comment includes a safety note that setting this without an EGFX implementation will cause Windows to stop sending legacy bitmap updates, leaving the desktop blank. Used downstream by [Haven](https://github.com/GlassHaven/Haven) (an Android RDP/VNC client) which implements EGFX with ClearCodec + RemoteFxProgressive decoders; this lets us drop a vendored fork of `ironrdp-connector` we currently carry just for this one flag. Default `false` to preserve current behaviour. `cargo check --workspace` clean — six other in-tree `Config { … }` builders updated with the default-false field. --------- Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net> |
||
|
|
36a848e085 |
fix(connector)!: count the auto-detect header, and only answer connect-time (#1559)
## Summary - The Network Characteristics Byte Count store was incremented by the payload length alone, so every counted Bandwidth Measure message was reported 8 bytes short. - [MS-RDPBCGR] 3.2.5.14 says to increment it "by the value specified in the **payloadLength** field plus the size of the header fields (8 bytes)", on each Bandwidth Measure Payload and on the 0x002B Stop. 2.2.14.1.3 pins that 8 by requiring `headerLength` to be 0x08. - The Start and Stop arms now check the request type rather than matching every variant. ## Those two increments are the whole of the connect-time byte count Worth stating, because 3.2.5.14 also contains a rule that counts every byte received while a window is open, and it's easy to assume it applies here. It doesn't. That rule belongs to the 0x0014 and 0x0114 Starts, which are the reliable and lossy UDP variants. Connect-time is 0x1014, and its step list says only to clear the stores and start the timer. So on this path the Payload and Stop increments are the entire count, and no framing-layer accumulation is needed. ## Why the request-type check is required, not tidying 2.2.14.1.4 sets `headerLength` to 0x08 for the 0x002B Stop and 0x06 otherwise. A fixed 8-byte addend is therefore only correct once the type is known, which makes the check part of the byte-count fix rather than separate from it. It has two further effects that are worth having. A continuous-detection Start no longer opens a connect-time window, and a continuous Stop is no longer answered with a connect-time result on the main channel when 3.2.5.14 routes those to a multitransport channel under a different procedure. That procedure also requires a sequence-number correlation on the 0x0629 Stop which this phase does not track, so ignoring is the conservative response. This overlaps the automated reviewer's fifth finding on #1530, which suggested exactly this narrowing. I'd offered there to fold it into that PR or take it separately; the conditional header size settled it, since the byte count is wrong without it. ## This is deliberately not FreeRDP's arithmetic FreeRDP counts the whole PDU length at the framing layer, `bandwidthMeasureByteCount += length` in `libfreerdp/core/rdp.c` after `rdp_read_header`, for any window including connect-time, and then adds `payloadLength` again in `libfreerdp/core/autodetect.c` for the Payload and the Stop. On the connect-time path that counts the payload twice and adds framing bytes the spec doesn't ask for. I went with the spec rather than the reference here. The reported figure is an informational QoS hint and the server proceeds on receipt either way, so there's no interop cost to being correct. The divergence is called out in a comment at the helper so nobody later "fixes" it toward FreeRDP. ## Depends on #1530 Stacked. #1530 introduces the bandwidth window state (`connect_time_bw_started_at`, `connect_time_bw_bytes`) that this counts into; on master there's nothing to accumulate. The branch carries #1530's commits, so it builds and tests on its own, and the merge order is #1530 then this. Because it carries them, the diff shown here is cumulative. This pull request's own change is 3 files, +180/-21: `crates/ironrdp-connector/src/connection.rs`, `crates/ironrdp-connector/src/lib.rs` and one connector test. The size label is computed on the cumulative diff, so it counts #1530's four commits too. Raised by the automated reviewer on #1530, where the prescribed fix is the arithmetic used here. ## The reported byte count is measurement-gated Worth stating for consumers, because it is a deliberate deviation. 3.2.5.14 states the Bandwidth Measure Payload increment unconditionally. Here the Payload bytes are accumulated only while a window is open, which means a driver that reports no arrival times never counts them and its Results carry the Stop's own payload alone against the untimed floor. A full count paired with a `timeDelta` the client never measured yields a bandwidth figure that grows with whatever the server chose to send, so this under-reports rather than over-reports. The practical consequence is that a server acting on 3.3.5.14 will pick conservative bandwidth-dependent settings for such a client. Of the drivers in tree only the FFI connector is in that position. ## Breaking changes Two, both in `ironrdp-connector`, and `cargo semver-checks -p ironrdp-connector --baseline-rev master` reports exactly these two and nothing else: - `Sequence::step` takes a third parameter, `received_at: Option<MonotonicInstant>`. This breaks every external implementor and every caller of the trait. `step_no_input` keeps its signature and passes `None`. - `ClientConnector` gains two private fields, `connect_time_bw_started_at` and `connect_time_bw_bytes`, so the struct is no longer constructible by literal downstream. The clock stays in the driver because a sequence must not read one, which is what keeps the sans-I/O invariant intact. A defaulted trait method would avoid the signature break but would let an implementor override only the old entry point and silently never receive an arrival time, so the required parameter is the safer of the two. ## Validation - `cargo xtask check fmt/lints/tests/typos/locks` all pass on the pinned toolchain, plus `cargo xtask wasm check`, with `fuzz/` built before the lock check. - Four existing expectations move by exactly 8 per counted message: 3584 to 3608 (two Payloads and a Stop), 512 to 520 (one Stop), and two at 1536 to 1552 (a Payload and a Stop each), the second of which is the window-reset test #1530 added after this branch was first filed. A fifth, 4096 to 4104, went with the redundant test #1530 dropped in review. - Two tests added for the guards: continuous Start, Payload and Stop produce no reply and leave the phase running; and a connect-time Stop arriving after a continuous Start reports the untimed floor against its own payload alone, since the continuous Start opened no window. - Eleven connect-time auto-detect tests pass. |
||
|
|
6a499faece |
feat(connector)!: pass frame arrival time into Sequence::step (#1530)
## Summary - Connect-time bandwidth measurement needs to know when bytes arrived, and nothing in the sans-I/O layer could tell it. #1465, now merged, answers the server's Bandwidth Measure Stop with a nominal interval for exactly that reason: the connector has no way to observe the real one. - Introduce `MonotonicInstant`, a millisecond counter with an arbitrary epoch, and make `Option<MonotonicInstant>` a required parameter of `Sequence::step`. The I/O drivers already know when a read completed, so `Framed` records the arrival time of each read and hands it to the state machine. A driver with no clock passes `None`. - With arrival times available, measure for real: a Bandwidth Measure Start opens a window, Payload messages accumulate their byte counts, and Stop reports the elapsed time between its own arrival and the Start's. #1465 has merged, so this applies directly to master and carries no merge-order dependency. That PR was the FreeRDP unblock on its own; this is the design change behind it, split out at @CBenoit's suggestion in review. ## Why the clock lives in the driver Two reasons, both of which rule out having the sequence read a clock itself. `std::time::Instant::now` panics on `wasm32-unknown-unknown`, and `ironrdp-connector` compiles for it. `ironrdp-web` reaches `ironrdp-async` through `ironrdp-futures`, so the clock read is `cfg`'d there too: the wasm arm returns `None` rather than panicking on the first socket read. More fundamentally, a sequence that timestamps its own entry measures how fast it drained an already-filled buffer, not how long the bytes took to arrive. `Framed` stamps the actual socket read, so a PDU served entirely from `buf` correctly reports the read that filled it. ## Why the parameter is an Option Three situations look alike at the Stop and are not alike, and collapsing them produces a worse figure than the nominal one #1465 sends. A Stop with no preceding Start has no window to time. A window whose Start, Payload and Stop arrived in one socket read carries the same instant on all three, so the elapsed time rounds down to zero; TCP coalescing makes this the common case on a fast link, because the connect-time payload is small. And a driver with no clock reports nothing at any point, which is not a measurement of zero but the absence of one. Only the middle case is a measurement. Making the parameter `Option<MonotonicInstant>` is what keeps it distinguishable: a window opens only when the Start carried a reading, so a driver with no clock opens none, accumulates nothing, and answers the Stop with its own payload alone. A window that was timed reports every byte per [MS-RDPBCGR] 3.2.5.14, including when the elapsed time floors to 1 ms, because the bytes really did arrive inside that millisecond. Both untimed cases report a 1 ms floor rather than 0, since a server computing `byteCount * 8 / timeDelta` divides by it. There is no `MonotonicInstant::ZERO`. An earlier revision used it as both the clock's origin and the "did not measure" sentinel, which is precisely what made the wasm32 and FFI drivers indistinguishable from a fast link: they would have paired a full byte count with an interval the client never measured, and the reported bandwidth would have grown with however much payload the server chose to send. ## Breaking change `Sequence::step` takes an `Option<MonotonicInstant>`. Implementors must add the parameter; callers driving a sequence by hand must supply an arrival time or switch to `step_no_input`, which passes `None` for them. All 8 in-tree implementors and the call sites across `ironrdp-acceptor`, `ironrdp-async`, `ironrdp-blocking`, `ironrdp-client`, `ironrdp-web` and `ffi` are updated here. `Framed::last_read_at` returns `Option<MonotonicInstant>`. ## MonotonicInstant now lives in ironrdp-core Also folded in here: ironrdp-rdpeudp independently defined its own MonotonicInstant, identical in spirit to this PR's but not in API (it carries as_millis and saturating_add, this one didn't), so a reading from one driver could never be handed to the other. Issue #140 asked for these to converge on one type in ironrdp-core, which both crates already depend on. Moved the fuller rdpeudp version into ironrdp-core and re-exported it from both existing paths. Not filed separately: there was nothing to migrate out of ironrdp-connector until this PR introduced its copy, so this is the first point where the duplication exists to fix. No call site outside the two definitions changes, both ironrdp_connector::MonotonicInstant and ironrdp_rdpeudp::MonotonicInstant keep working unchanged, and it's non-breaking on its own (the connector's version gains as_millis/saturating_add/Add<Duration>, which it didn't have before). ## Stacked on this #1559 is stacked on this pull request and carries its three commits, so the merge order is this one then #1559. Landing this shrinks #1559's diff to its own change, 2 files and +149/-15 in `connection.rs` plus one connector test. #1559 counts the 8-byte auto-detect header into the byte count introduced here, and narrows the Start and Stop arms to the connect-time request type. Both come from the automated reviewer's findings on this pull request. ## Why this is one PR The automation flags this as size/XL and asks for it to be split. The three commits here do not separate into reviewable pull requests. The first changes the `Sequence::step` signature, and every implementor and caller moves with it: connector, acceptor, async, blocking, client, web, the FFI and the tests. That is 19 of the 23 files and +474/-116 on its own, and a pull request holding the trait change without them does not build. The second exists because of the review on the first. It distinguishes a window that was never timed from one measured as zero, which is the fix for the finding that a wasm or FFI client would otherwise report a fabricated bandwidth. Splitting it out means filing the first commit with a defect already raised against it. The third is the tests for both. Stacked pull requests are the remedy the note suggests, and it adds that they require every branch to live in this repository. This branch is on a fork, so that path is closed. ## Validation - `cargo xtask check fmt/typos/lints/tests/locks` all pass on the pinned toolchain, `fuzz/` built before the lock check. - `cargo xtask wasm check` passes. Worth stating separately: this is the gate that catches the `Instant::now` hazard above, since the workspace default target never compiles that crate for wasm. - Six new tests in `crates/ironrdp-testsuite-core/tests/connector/autodetect.rs`: the interval and byte count match what the driver observed across a Start/Payload/Stop window; several Payload messages accumulate across a timed window; a window delivered in one read floors the interval with every byte still counted; a driver reporting no arrival times answers with the Stop payload alone; a Stop with no preceding Start is answered with the floor; and a second Start clears both stores and restarts the timer, which 3.2.5.14 requires and which nothing else covered. - Four more in a new `crates/ironrdp-testsuite-core/tests/async_framed.rs` covering `Framed::last_read_at` itself, since the tests above feed `Sequence::step` hand-picked instants and would stay green if the driver stopped stamping reads. They pin that an unread `Framed` reports no arrival, that each socket read advances the stamp, that PDUs sharing a read share its stamp rather than being stamped when the caller drains them, and that a `Framed` rebuilt around leftover bytes reports no arrival for them, which is the case `ironrdp-tokio`'s split and unsplit helpers produce. Each was checked by planting the corresponding regression and confirming the test fails. - Those live in `ironrdp-testsuite-core` rather than inline because `ironrdp-async` sets `[lib] test = false`, so an inline `#[cfg(test)]` module would compile and never run. This adds `ironrdp-async` as a dev-dependency of `ironrdp-testsuite-core`. |
||
|
|
c74e7c5c94 |
fix(pdu)!: accept the full documented range of Client Core Data keyboardType values (#1689)
## Summary KeyboardType (TS_UD_CS_CORE's keyboardType field, MS-RDPBCGR 2.2.1.3.2) was a closed enum covering discriminants 1 through 7, transcribed from the field's other documentation in 2.2.7.1.6 (TS_INPUT_CAPABILITYSET), which omits value 8 (Korean keyboard). The table this type actually decodes against, 2.2.1.3.2, documents 1 through 8. Any client outside the narrower range, including every genuine Korean keyboard, had its whole Client Core Data parse hard rejected before the connection started. Converted KeyboardType to a repr(transparent) struct KeyboardType(pub u32) with named constants for the eight documented values, mirroring RdpVersion one field above it in the same struct, and made decode infallible at all three sites that previously disagreed with each other: gcc::core_data::client hard rejected, rdp::capability_sets::input silently dropped to None, and ironrdp-activex's COM setter returned E_INVALIDARG. FreeRDP hit the identical gap in its own documentation-only enum until a two-line fix (FreeRDP#11035). Neither FreeRDP nor xrdp gate connection admission on this field at all; both decode it as a raw integer. Windows' own GetKeyboardType additionally documents 0x51 for generic HID keyboards, which a narrower fix adding only Korean would not survive. Marked as breaking since KeyboardType's public shape changes for any downstream consumer of ironrdp-pdu outside this workspace. Note that cargo-semver-checks in this repo's PR automation only runs against the facade ironrdp crate, which will not see a break confined to ironrdp-pdu's own API, so the automated breaking-change label may not apply here even though this is a real one. ## Validation cargo xtask check fmt/lints/tests/typos/locks all pass. Extended ironrdp-activex's existing inline COM boundary test to cover value 8 round tripping and a negative value still being rejected. |
||
|
|
063efcdc30 |
feat(activex): negotiate monitor topology (#1675)
Negotiate the client monitor layout from UseMultimon and expose the confirmed remote topology through the ActiveX compatibility interface. Advertise Monitor Layout PDU support whenever Extended Client Data is negotiated, and forward layouts from activation, active sessions, and reactivation so advertised support does not terminate sessions. Keep fallback reporting truthful when servers do not honor the request, while preserving single-monitor resize behavior and blocking multi-monitor resizing. Do not send Client Monitor Extended Data; per-monitor DPI and orientation remain unavailable. |
||
|
|
34d7b31dc5 |
feat(activex): support automatic reconnect (#1662)
Support automatic reconnect through the ActiveX control with bounded host-approved retries after transport loss. Reuse ARC cookies only for resumed sessions, reject server ARC status failures, and report success after active-session traffic. --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> |
||
|
|
205fe038cc |
feat: wire MS-RDPEAI capture into Windows client and ActiveX (#1642)
Add the client MS-RDPEAI capture path on top of hardened RDPSND playback: connector CFG + static channel wiring, CPAL PCM capture backend, ironrdp-client --audio-capture, and ActiveX AudioCaptureRedirectionMode. PCM capture only accepts encode formats that match the Open capture stream, rejects non-16-bit capture (Data PDU size contract), and gates the capture backend behind ironrdp-rdpsnd-native/capture. Depends on #1648 (playback). |
||
|
|
ab48c6cb8c |
feat(client): add RemoteApp channel support (#1637)
Configure and negotiate RAIL connections, then route its static channel through the portable client with bounded request queues and server control events. |
||
|
|
0c3fbe78b4 |
feat: forward negotiated windowing orders (#1631)
Preserve Window List support during activation. Forward validated orders through ActiveStage and the raw FFI output. Desktop and web consumers retain their existing behavior. |
||
|
|
5c1816244e |
feat(rdcleanpath): support Hyper-V connection ordering (#1505)
Hyper-V over RDCleanPath needs PCB → TLS on the proxy, then CredSSP → X.224 on the client. Ordinary RDCleanPath stays X.224-first. Still VERSION_1 with the same DER fields. An explicit VMConnect request carries a Unicode PCB payload in `preconnection_blob` with no X.224; the proxy encodes the binary PCB. Generic PCB requests keep their existing X.224-first behavior. Gateway reference implementation: [Devolutions/devolutions-gateway#1372](https://github.com/Devolutions/devolutions-gateway/pull/1372) Checked locally: Rust builds, formatting, Svelte typecheck, and .NET build. Real nested Hyper-V E2E through Gateway: Native rendered 18 frames, Avalonia connected and rendered its first frame, and Web rendered a non-empty 1280×720 canvas. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Marc-André Moreau <mamoreau@devolutions.net> |
||
|
|
3818b48037 |
fix(session): batch Fast-Path input events (#1630)
Keep outgoing Fast-Path input frames within the 255-event protocol limit and preserve their order across FFI. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> |