Skip to content

refactor(rdpeusb): seperate raw and validated InternalIoControl#1403

Merged
Benoît Cortier (CBenoit) merged 1 commit into
Devolutions:masterfrom
uchouT:refactor/internal_ioctl
Jul 2, 2026
Merged

refactor(rdpeusb): seperate raw and validated InternalIoControl#1403
Benoît Cortier (CBenoit) merged 1 commit into
Devolutions:masterfrom
uchouT:refactor/internal_ioctl

Conversation

@uchouT

Copy link
Copy Markdown
Contributor

Keep INTERNAL_IO_CONTROL as a lossless wire representation so unknown IOCTL codes and buffer fields remain decodable.

Convert raw PDUs into supported backend requests at the state-machine boundary. This centralizes semantic validation and makes invalid outbound requests unrepresentable.

Copilot AI review requested due to automatic review settings July 2, 2026 11:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors RDPEUSB INTERNAL_IO_CONTROL handling to keep the wire PDU (InternalIoControl) as a lossless representation (decoding unknown IOCTL codes and variable buffers), and to centralize semantic validation at the state-machine boundary via conversion into a backend-facing request type.

Changes:

  • Relax InternalIoControl PDU decode/encode to preserve raw ioctl_code, input_buffer, and output_buffer_size without rejecting unknown values.
  • Replace backend-facing InternalIoControlPacket from a raw-parameter struct to a validated enum, and move validation into TryFrom<InternalIoControl>.
  • Remove server-side validation of internal IO control request buffers/sizes and rely on the validated packet->PDU conversion.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
crates/ironrdp-rdpeusb/src/server.rs Removes local INTERNAL_IO_CONTROL validation and uses PDU output size for pending-IO bookkeeping.
crates/ironrdp-rdpeusb/src/pdu/usb_dev/mod.rs Makes InternalIoControl wire type lossless (raw IOCTL + variable buffer) and adjusts size checks/encoding.
crates/ironrdp-rdpeusb/src/io/mod.rs Introduces validated InternalIoControlPacket enum and conversion/validation from raw PDU.
crates/ironrdp-rdpeusb/src/client.rs Converts incoming InternalIoControl PDUs to validated backend packets via try_into().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ironrdp-rdpeusb/src/pdu/usb_dev/mod.rs
Comment thread crates/ironrdp-rdpeusb/src/pdu/usb_dev/mod.rs
Comment thread crates/ironrdp-rdpeusb/src/io/mod.rs
Keep INTERNAL_IO_CONTROL as a lossless wire representation so unknown
IOCTL codes and buffer fields remain decodable.

Convert raw PDUs into supported backend requests at the state-machine
boundary. This centralizes semantic validation and makes invalid
outbound requests unrepresentable.

Signed-off-by: uchouT <i@uchout.moe>
@uchouT uchouT (uchouT) force-pushed the refactor/internal_ioctl branch from 56eff67 to 2af5d70 Compare July 2, 2026 11:45

@CBenoit Benoît Cortier (CBenoit) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

@CBenoit Benoît Cortier (CBenoit) merged commit 069786c into Devolutions:master Jul 2, 2026
22 checks passed
@uchouT uchouT (uchouT) deleted the refactor/internal_ioctl branch July 2, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants