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.
This commit is contained in:
Mike Rodriguez committed 2026-01-08 14:01:46 -08:00
1 parent 7290cd6d87
commit 642ee285ff
3 files changed
+52 -12

No files matched your search

@@ -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"
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
@@ -38,9 +38,6 @@
<ClCompile Include="Driver.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\..\Downloads\wudfwdm.h">
<DeploymentContent>true</DeploymentContent>
</ClInclude>
<ClInclude Include="Driver.h" />
<ClInclude Include="Trace.h" />
</ItemGroup>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
@@ -30,9 +30,6 @@
<ClInclude Include="Trace.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\Downloads\wudfwdm.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Driver.cpp">