Skip to main content

Overview

The GetIddCx utility (IddCxVersionQuery.cpp) provides functionality to determine the Indirect Display Driver Class eXtension (IddCx) version available on a given Windows system based on its build number.

Purpose

IddCx is the framework used for developing indirect display drivers in Windows. Different Windows versions support different IddCx versions, which provide varying capabilities and APIs. This utility helps:
  • Identify the IddCx version available on the current system
  • Map Windows build numbers to corresponding IddCx versions
  • Verify IddCx availability before driver initialization

Core Data Structures

IddCxVersionInfo

Stores version information for a specific Windows build:
struct IddCxVersionInfo {
    std::string windowsVersion;  // Friendly Windows version name
    std::string iddcxVersion;    // IddCx version string (e.g., "1.10")
    ULONG versionValue;          // Hexadecimal version value (e.g., 0x1A00)
};

Version Mapping

The utility maintains a comprehensive map of Windows build numbers to IddCx versions:
Windows VersionBuild NumberIddCx VersionVersion Value
Windows 11 24H2261001.100x1A80
Windows 11 23H2226311.100x1A00
Windows 11 22H2226211.90x1900
Windows 11 21H2220001.80x1800
Windows 10 22H2190451.50x1500
Windows 10 21H2190441.50x1500
Windows 10 20H2190421.50x1500
Windows 10 RS5177631.30x1300
Windows 10 Creators Update150631.20x1200
Windows 10 Anniversary Update143931.00x1000

Key Functions

GetWindowsBuildNumber

Retrieves the current Windows build number using the native RtlGetVersion function:
DWORD GetWindowsBuildNumber();
Returns: Current Windows build number, or 0 on failure. Implementation Details:
  • Uses ntdll.dll and RtlGetVersion to bypass version lies
  • More reliable than deprecated GetVersionEx API
  • Returns actual build number without manifesting
Example:
DWORD buildNumber = GetWindowsBuildNumber();
if (buildNumber == 0) {
    // Error: Could not retrieve build number
}

GetIddCxVersionFromBuild

Maps a Windows build number to its corresponding IddCx version information:
IddCxVersionInfo GetIddCxVersionFromBuild(DWORD buildNumber);
Parameters:
  • buildNumber: Windows build number to query
Returns: IddCxVersionInfo structure with version details, or unknown version info if build is not recognized. Algorithm:
  1. Attempts exact match lookup in version map
  2. Falls back to finding the closest lower build number
  3. Returns unknown version info if build predates IddCx (< 14393)
Example:
DWORD buildNumber = 22621;  // Windows 11 22H2
IddCxVersionInfo info = GetIddCxVersionFromBuild(buildNumber);
// info.windowsVersion = "Windows 11 22H2"
// info.iddcxVersion = "1.9"
// info.versionValue = 0x1900

Runtime Version Detection

In the driver code, you can query the actual IddCx version at runtime using the IddCx API:
void LogIddCxVersion() {
    IDARG_OUT_GETVERSION outArgs;
    NTSTATUS status = IddCxGetVersion(&outArgs);
    
    if (NT_SUCCESS(status)) {
        // outArgs.IddCxVersion contains the runtime version
        char versionStr[16];
        sprintf_s(versionStr, "0x%lx", outArgs.IddCxVersion);
        vddlog("i", ("IDDCX Version: " + std::string(versionStr)).c_str());
    }
}

Usage in Driver

The version information is critical for:
  1. Feature Detection: Conditionally enabling features based on IddCx version
  2. API Compatibility: Using version-specific callbacks and structures
  3. Diagnostics: Logging version information for troubleshooting
Example - Conditional Feature Enablement:
if (IDD_IS_FUNCTION_AVAILABLE(IddCxSwapChainReleaseAndAcquireBuffer2)) {
    // Use IddCx 1.4+ API
    IDARG_OUT_RELEASEANDACQUIREBUFFER2 Buffer = {};
    hr = IddCxSwapChainReleaseAndAcquireBuffer2(m_hSwapChain, &BufferInArgs, &Buffer);
} else {
    // Fallback to IddCx 1.0 API
    IDARG_OUT_RELEASEANDACQUIREBUFFER Buffer = {};
    hr = IddCxSwapChainReleaseAndAcquireBuffer(m_hSwapChain, &Buffer);
}

IddCx Version History

Key features introduced in each version:
  • 1.0 (Windows 10 Anniversary Update): Initial IddCx release
  • 1.2 (Windows 10 Creators Update): Enhanced mode enumeration
  • 1.3 (Windows 10 RS3+): Improved cursor support
  • 1.4 (Windows 10 19H1): SwapChainReleaseAndAcquireBuffer2 API
  • 1.5 (Windows 10 20H1): Enhanced diagnostics
  • 1.8 (Windows 11 21H2): HDR metadata support
  • 1.9 (Windows 11 22H2): MonitorQueryTargetModes2
  • 1.10 (Windows 11 23H2+): Gamma ramp and advanced color support

References

Build docs developers (and LLMs) love