From 642ee285ffcf9ae30e9f2c0fb62d2dff1290689f Mon Sep 17 00:00:00 2001 From: Mike Rodriguez Date: Thu, 8 Jan 2026 14:01:46 -0800 Subject: [PATCH] Improve Windows Kits detection and project includes Added automatic detection of Windows Kits version and SDK directory in the build workflow, passing them to msbuild for driver builds. Removed manual inclusion of wudfwdm.h from the project files to rely on SDK headers, streamlining build configuration and reducing local dependencies. --- .../workflows/build-and-sign-sequential.yml | 54 +++++++++++++++++-- .../MttVDD/MttVDD.vcxproj | 5 +- .../MttVDD/MttVDD.vcxproj.filters | 5 +- 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-and-sign-sequential.yml b/.github/workflows/build-and-sign-sequential.yml index d5b48a4..4f04670 100644 --- a/.github/workflows/build-and-sign-sequential.yml +++ b/.github/workflows/build-and-sign-sequential.yml @@ -53,6 +53,52 @@ jobs: choco install innosetup -y if ($LASTEXITCODE -ne 0) { exit 1 } + + - name: Detect Windows Kits version (WDF/UMDF headers) + shell: pwsh + run: | + $kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits" + if (-not (Test-Path $kitsRoot)) { + Write-Error "Windows Kits root not found: $kitsRoot" + exit 1 + } + + $includeRoots = + Get-ChildItem -Path $kitsRoot -Directory | + ForEach-Object { Join-Path $_.FullName "Include" } | + Where-Object { Test-Path $_ } + + if (-not $includeRoots -or $includeRoots.Count -eq 0) { + Write-Error "No Windows Kits Include directories found under: $kitsRoot" + exit 1 + } + + $candidates = foreach ($includeRoot in $includeRoots) { + Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue | + Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } | + ForEach-Object { + [PSCustomObject]@{ + Version = $_.Name + IncludeRoot = $includeRoot + } + } + } + + $best = $candidates | Sort-Object -Property Version -Descending | Select-Object -First 1 + $kitVersion = $best.Version + + if (-not $kitVersion) { + Write-Error "Could not find any Windows Kits version containing wdf\umdf\wudfwdm.h under: $kitsRoot" + Write-Output "Discovered Include roots:" + $includeRoots | ForEach-Object { Write-Output ("- " + $_) } + exit 1 + } + + $windowsSdkDir = (Split-Path $best.IncludeRoot -Parent) + "\" + Write-Output "Using WindowsTargetPlatformVersion: $kitVersion" + Write-Output "Using WindowsSdkDir: $windowsSdkDir" + "WINDOWS_TARGET_PLATFORM_VERSION=$kitVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "WINDOWS_SDK_DIR=$windowsSdkDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - name: Setup .NET uses: actions/setup-dotnet@v4 @@ -71,7 +117,7 @@ jobs: $vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln" if (Test-Path $vddSln) { Write-Output "Found VDD solution: $vddSln" - msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /verbosity:minimal + msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal if ($LASTEXITCODE -eq 0) { Write-Output "✅ ARM64 VDD build completed successfully" @@ -105,7 +151,7 @@ jobs: Write-Output "Building ARM64 VAD with validation disabled..." # Build with validation disabled to avoid x86 tool conflicts with ARM64 outputs - msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:EnableInfVerif=false /p:RunApiValidator=false /verbosity:minimal + msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /p:EnableInfVerif=false /p:RunApiValidator=false /verbosity:minimal if ($LASTEXITCODE -eq 0) { Write-Output "✅ ARM64 VAD build completed successfully!" @@ -133,7 +179,7 @@ jobs: $vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln" if (Test-Path $vddSln) { Write-Output "Found VDD solution: $vddSln" - msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal + msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal if ($LASTEXITCODE -eq 0) { Write-Output "✅ x64 VDD build completed successfully" @@ -162,7 +208,7 @@ jobs: $vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln" if (Test-Path $vadSln) { Write-Output "Found VAD solution: $vadSln" - msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal + msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal if ($LASTEXITCODE -eq 0) { Write-Output "✅ x64 VAD build completed successfully" diff --git a/Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj b/Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj index a4f0dc2..a28b6bf 100644 --- a/Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj +++ b/Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj @@ -1,4 +1,4 @@ - + @@ -38,9 +38,6 @@ - - true - diff --git a/Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj.filters b/Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj.filters index 63e6887..804b5c6 100644 --- a/Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj.filters +++ b/Virtual Display Driver (HDR)/MttVDD/MttVDD.vcxproj.filters @@ -1,4 +1,4 @@ - + @@ -30,9 +30,6 @@ Header Files - - Header Files -