# rustdesk-org/rustdeskidddriver architecture

> Architecture diagram of the GitHub repository rustdesk-org/rustdeskidddriver, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rustdesk-org/rustdeskidddriver
- Repository: https://github.com/rustdesk-org/rustdeskidddriver

## Overview

RustDeskIdd is a Windows indirect-display sample with a console control application and a UMDF/IddCx driver. The user installs the driver and creates its software device, then requests monitor plug-in, plug-out, or mode updates; the app sends these requests through device-control calls, and the driver reports monitor changes to Windows. IddCx also assigns swap chains for frame processing. The sampled source is partial, so internal IOCTL dispatch details and some callback wiring are represented only where documented or evident; frame processing is described as a sample loop, not a completed rendering pipeline.

Main entry points: [`RustDeskIddApp/IddController.c`](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.c) (Device controller), [`RustDeskIddApp/main.c`](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/main.c) (Console controls), [`RustDeskIddDriver/Driver.h`](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.h) (Indirect device context), [`RustDeskIddDriver/Public.h`](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Public.h) (Control IOCTLs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Control application"]
  node_console["Console controls<br/>[main.c]"]
  node_controller["Device controller<br/>[IddController.c]"]
  node_app_api["Controller API<br/>[IddController.h]"]
end

subgraph group_device["Device setup"]
  node_software_device["Software device<br/>[IddController.c]"]
  node_driver_install["Driver install<br/>[IddController.c]"]
end

subgraph group_driver["Display driver"]
  node_ioctl_contract["Control IOCTLs<br/>[Public.h]"]
  node_driver_entry["Driver and device callbacks<br/>[Driver.cpp]"]
  node_device_context["Indirect device context<br/>[Driver.h]"]
  node_monitor_lifecycle["Monitor lifecycle<br/>[Driver.cpp]"]
  node_mode_update["Monitor mode update<br/>[Driver.cpp]"]
end

subgraph group_frames["Frame handling"]
  node_monitor_context["Monitor context<br/>[Driver.h]"]
  node_d3d_device["Render device<br/>[Driver.h]"]
  node_swapchain_processor["Swap-chain processor<br/>[Driver.cpp]"]
end

node_user(("Operator"))
node_windows{{"Windows device services"}}
node_iddcx{{"Windows IddCx"}}

node_user -->|"selects actions"| node_console
node_console -->|"calls controls"| node_controller
node_console -->|"uses declarations"| node_app_api
node_controller -->|"installs or removes"| node_driver_install
node_driver_install -->|"requests driver setup"| node_windows
node_controller -->|"creates or closes"| node_software_device
node_software_device -->|"creates device"| node_windows
node_controller -->|"sends device controls"| node_ioctl_contract
node_ioctl_contract -->|"dispatches controls"| node_driver_entry
node_driver_entry -->|"initializes context"| node_device_context
node_device_context -->|"handles plug requests"| node_monitor_lifecycle
node_device_context -->|"handles mode requests"| node_mode_update
node_monitor_lifecycle -->|"reports monitor arrival"| node_iddcx
node_iddcx -->|"assigns swap chain"| node_monitor_context
node_monitor_context -->|"initializes rendering"| node_d3d_device
node_monitor_context -->|"starts processing"| node_swapchain_processor
node_swapchain_processor -->|"acquires and releases buffers"| node_iddcx
node_mode_update -->|"updates monitor modes"| node_iddcx

click node_console "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/main.c"
click node_controller "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.c"
click node_app_api "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.h"
click node_software_device "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.c"
click node_driver_install "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.c"
click node_ioctl_contract "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Public.h"
click node_driver_entry "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.cpp"
click node_device_context "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.h"
click node_monitor_lifecycle "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.cpp"
click node_mode_update "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.cpp"
click node_monitor_context "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.h"
click node_d3d_device "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.h"
click node_swapchain_processor "https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_console,node_controller,node_app_api toneBlue
class node_software_device,node_driver_install toneAmber
class node_ioctl_contract,node_driver_entry,node_device_context,node_monitor_lifecycle,node_mode_update toneMint
class node_monitor_context,node_d3d_device,node_swapchain_processor toneRose
class node_user,node_windows,node_iddcx toneIndigo
```

## Components

### Control application

- [Console controls](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/main.c): `RustDeskIddApp/main.c`
- [Device controller](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.c): `RustDeskIddApp/IddController.c`
- [Controller API](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.h): `RustDeskIddApp/IddController.h`

### Device setup

- [Software device](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.c): `RustDeskIddApp/IddController.c`
- [Driver install](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddApp/IddController.c): `RustDeskIddApp/IddController.c`

### Display driver

- [Control IOCTLs](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Public.h): `RustDeskIddDriver/Public.h`
- [Driver and device callbacks](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.cpp): `RustDeskIddDriver/Driver.cpp`
- [Indirect device context](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.h): `RustDeskIddDriver/Driver.h`
- [Monitor lifecycle](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.cpp): `RustDeskIddDriver/Driver.cpp`
- [Monitor mode update](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.cpp): `RustDeskIddDriver/Driver.cpp`

### Frame handling

- [Monitor context](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.h): `RustDeskIddDriver/Driver.h`
- [Render device](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.h): `RustDeskIddDriver/Driver.h`
- [Swap-chain processor](https://github.com/rustdesk-org/rustdeskidddriver/blob/main/RustDeskIddDriver/Driver.cpp): `RustDeskIddDriver/Driver.cpp`

### Other components

- **Operator**
- **Windows device services**
- **Windows IddCx**

## Connections

- Operator → Console controls: selects actions
- Console controls → Device controller: calls controls
- Console controls → Controller API: uses declarations
- Device controller → Driver install: installs or removes
- Driver install → Windows device services: requests driver setup
- Device controller → Software device: creates or closes
- Software device → Windows device services: creates device
- Device controller → Control IOCTLs: sends device controls
- Control IOCTLs → Driver and device callbacks: dispatches controls
- Driver and device callbacks → Indirect device context: initializes context
- Indirect device context → Monitor lifecycle: handles plug requests
- Indirect device context → Monitor mode update: handles mode requests
- Monitor lifecycle → Windows IddCx: reports monitor arrival
- Windows IddCx → Monitor context: assigns swap chain
- Monitor context → Render device: initializes rendering
- Monitor context → Swap-chain processor: starts processing
- Swap-chain processor → Windows IddCx: acquires and releases buffers
- Monitor mode update → Windows IddCx: updates monitor modes
