Skip to content

Commit e3924ae

Browse files
Detect and use correct Windows SDK version in CI builds
Added steps to both build-and-sign-sequential.yml and ci-validation.yml workflows to dynamically detect the installed Windows Kits version and set the appropriate MSBuild properties for WindowsSdkDir and WindowsTargetPlatformVersion. This ensures the correct SDK is used for driver builds, improving reliability across environments. Also simplified the SignPath submission step condition.
1 parent 0a31eaa commit e3924ae

2 files changed

Lines changed: 85 additions & 7 deletions

File tree

.github/workflows/build-and-sign-sequential.yml

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,45 @@ jobs:
4747
Write-Output "Ensuring Windows Driver Kit is installed (Chocolatey: windowsdriverkit11)..."
4848
choco install windowsdriverkit11 -y --no-progress
4949
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
50+
51+
- name: Detect Windows Kits version (UMDF headers)
52+
shell: pwsh
53+
run: |
54+
$ErrorActionPreference = "Stop"
55+
56+
$kitsRoot = $null
57+
try {
58+
$kitsRoot = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction Stop).KitsRoot10
59+
} catch {
60+
$kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\"
61+
}
62+
63+
if (-not $kitsRoot -or -not (Test-Path $kitsRoot)) {
64+
throw "Windows Kits root not found: $kitsRoot"
65+
}
66+
67+
$includeRoot = Join-Path $kitsRoot "Include"
68+
if (-not (Test-Path $includeRoot)) {
69+
throw "Windows Kits Include directory not found: $includeRoot"
70+
}
71+
72+
$candidates =
73+
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
74+
Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } |
75+
Sort-Object -Property Name -Descending
76+
77+
$best = $candidates | Select-Object -First 1
78+
if (-not $best) {
79+
throw "Could not find wdf\\umdf\\wudfwdm.h under: $includeRoot"
80+
}
81+
82+
$kitVersion = $best.Name
83+
$windowsSdkDir = $kitsRoot
84+
85+
Write-Output "Using WindowsTargetPlatformVersion: $kitVersion"
86+
Write-Output "Using WindowsSdkDir: $windowsSdkDir"
87+
"WINDOWS_TARGET_PLATFORM_VERSION=$kitVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
88+
"WINDOWS_SDK_DIR=$windowsSdkDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
5089
5190
- name: Setup .NET
5291
uses: actions/setup-dotnet@v4
@@ -65,7 +104,7 @@ jobs:
65104
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
66105
if (Test-Path $vddSln) {
67106
Write-Output "Found VDD solution: $vddSln"
68-
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /verbosity:minimal
107+
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
69108
if ($LASTEXITCODE -eq 0) {
70109
Write-Output "✅ ARM64 VDD build completed successfully"
71110
@@ -99,7 +138,7 @@ jobs:
99138
Write-Output "Building ARM64 VAD with validation disabled..."
100139
101140
# Build with validation disabled to avoid x86 tool conflicts with ARM64 outputs
102-
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=ARM64 /p:EnableInfVerif=false /p:RunApiValidator=false /verbosity:minimal
141+
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
103142
104143
if ($LASTEXITCODE -eq 0) {
105144
Write-Output "✅ ARM64 VAD build completed successfully!"
@@ -127,7 +166,7 @@ jobs:
127166
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
128167
if (Test-Path $vddSln) {
129168
Write-Output "Found VDD solution: $vddSln"
130-
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal
169+
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
131170
if ($LASTEXITCODE -eq 0) {
132171
Write-Output "✅ x64 VDD build completed successfully"
133172
@@ -156,7 +195,7 @@ jobs:
156195
$vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln"
157196
if (Test-Path $vadSln) {
158197
Write-Output "Found VAD solution: $vadSln"
159-
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal
198+
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
160199
if ($LASTEXITCODE -eq 0) {
161200
Write-Output "✅ x64 VAD build completed successfully"
162201
@@ -436,7 +475,7 @@ jobs:
436475

437476
# STEP 8: Submit to SignPath
438477
- name: "Step 8: Submit to SignPath"
439-
if: github.event.inputs.skip_signing != 'true' && secrets.SIGNPATH_API_TOKEN != '' && vars.SIGNPATH_ORG_ID != '' && vars.SIGNPATH_PROJECT_SLUG != '' && vars.SIGNPATH_POLICY_SLUG != '' && steps.upload_for_signpath.outputs.artifact-id != ''
478+
if: github.event.inputs.skip_signing != 'true' && steps.upload_for_signpath.outputs.artifact-id != ''
440479
id: signpath_request
441480
uses: signpath/github-action-submit-signing-request@v1
442481
with:

.github/workflows/ci-validation.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,45 @@ jobs:
3434
choco install windowsdriverkit11 -y --no-progress
3535
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
3636
37+
- name: Detect Windows Kits version (UMDF headers)
38+
shell: pwsh
39+
run: |
40+
$ErrorActionPreference = "Stop"
41+
42+
$kitsRoot = $null
43+
try {
44+
$kitsRoot = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction Stop).KitsRoot10
45+
} catch {
46+
$kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\"
47+
}
48+
49+
if (-not $kitsRoot -or -not (Test-Path $kitsRoot)) {
50+
throw "Windows Kits root not found: $kitsRoot"
51+
}
52+
53+
$includeRoot = Join-Path $kitsRoot "Include"
54+
if (-not (Test-Path $includeRoot)) {
55+
throw "Windows Kits Include directory not found: $includeRoot"
56+
}
57+
58+
$candidates =
59+
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
60+
Where-Object { Test-Path (Join-Path $_.FullName "wdf\umdf\wudfwdm.h") } |
61+
Sort-Object -Property Name -Descending
62+
63+
$best = $candidates | Select-Object -First 1
64+
if (-not $best) {
65+
throw "Could not find wdf\\umdf\\wudfwdm.h under: $includeRoot"
66+
}
67+
68+
$kitVersion = $best.Name
69+
$windowsSdkDir = $kitsRoot
70+
71+
Write-Output "Using WindowsTargetPlatformVersion: $kitVersion"
72+
Write-Output "Using WindowsSdkDir: $windowsSdkDir"
73+
"WINDOWS_TARGET_PLATFORM_VERSION=$kitVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
74+
"WINDOWS_SDK_DIR=$windowsSdkDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
75+
3776
- name: Setup Node.js
3877
uses: actions/setup-node@v4
3978
with:
@@ -51,7 +90,7 @@ jobs:
5190
Write-Output "Performing quick VDD compilation check..."
5291
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
5392
if (-not (Test-Path $vddSln)) { throw "VDD solution file not found at: $vddSln" }
54-
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal /target:Build
93+
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 /target:Build
5594
5695
- name: Quick VAD Compilation Check
5796
shell: pwsh
@@ -60,7 +99,7 @@ jobs:
6099
Write-Output "Performing quick VAD compilation check..."
61100
$vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln"
62101
if (-not (Test-Path $vadSln)) { throw "VAD solution file not found at: $vadSln" }
63-
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal /target:Build
102+
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 /target:Build
64103
65104
- name: Checkout Virtual Driver Control Repository
66105
uses: actions/checkout@v4

0 commit comments

Comments
 (0)