# DisplayFlow IDD Driver Integration Guide ## Overview To achieve a true "Virtual Display" (where Windows thinks a monitor is connected but it's just software), we need to compile and install a **User-Mode Driver Framework (UMDF) Indirect Display Driver (IDD)**. We will use the **Microsoft Indirect Display Driver Sample** as a base and modify it to send frames to our shared memory. ## Prerequisites 1. **Visual Studio 2019/2022** with "Desktop development with C++". 2. **Windows Driver Kit (WDK)** compatible with your VS version. * Download: [https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) ## Steps ### 1. Download the Sample Clone the Windows Driver Samples repository: ```bash git clone https://github.com/microsoft/Windows-driver-samples.git cd video/IndirectDisplay/IddCxMonitorDriver ``` ### 2. Integrate DisplayFlow Code Copy the following files from `demo/windows_driver/src/` to the driver project folder (`IddCxMonitorDriver`): * `IddProducer.h` * `IddProducer.cpp` ### 3. Modify Project Settings 1. Open the solution `IddCxMonitorDriver.sln` in Visual Studio. 2. Right-click project -> **Add** -> **Existing Item** -> Select `IddProducer.h` and `IddProducer.cpp`. 3. Ensure `IddProducer.cpp` is not using precompiled headers (Right-click file -> Properties -> C/C++ -> Precompiled Headers -> **Not Using Precompiled Headers**). ### 4. Modify `IndirectDevice.cpp` (or `SwapChainProcessor.cpp`) Find the logic where the driver processes frames. In the sample, this is typically in the `SwapChainProcessor` class (or inside `IndirectDevice::Run`). 1. **Include Header**: ```cpp #include "IddProducer.h" ``` 2. **Add Member**: Add `IddProducer m_Producer;` to the class that handles the swap chain. 3. **Initialize**: In the initialization phase (before the loop): ```cpp m_Producer.Initialize(); ``` 4. **Process Frame**: Inside the frame loop, after acquiring the `ID3D11Texture2D*` (Surface), map it and submit it. * *Note*: The surface from `IddCx` is usually not CPU readable. You must copy it to a **Staging Texture** first. * Refer to `demo/windows_driver/src/SwapChainProcessor_Example.cpp` for the logic. ### 5. Build and Install 1. Build the solution (Platform: x64, Configuration: Release). 2. Locate the output files (`.dll`, `.inf`, `.cat`). 3. **Install Certificate**: The driver is self-signed. You must install the test certificate to `Trusted Root Certification Authorities` and `Trusted Publishers`. 4. **Install Driver**: * Open Device Manager. * Action -> Add legacy hardware. * Install from Disk -> Point to `.inf` file. * Select "IddCx Monitor Driver". ### 6. Verification Once installed, Windows should show a new display. `DisplayFlow` sender (Consumer) should automatically pick up the frames from the Shared Memory (if running with `--source=idd`).