@@ -48,25 +48,55 @@ jobs:
4848 choco install visualstudio2022-workload-vctools -y
4949 if ($LASTEXITCODE -ne 0) { exit 1 }
5050
51- choco install windowsdriverkit11 -y
52- if ($LASTEXITCODE -ne 0) { exit 1 }
53-
5451 choco install innosetup -y
5552 if ($LASTEXITCODE -ne 0) { exit 1 }
5653
54+ - name : Install Windows SDK + WDK (required for WDF/UMDF headers)
55+ shell : pwsh
56+ run : |
57+ $ErrorActionPreference = "Stop"
58+
59+ function Ensure-WingetPackage([string]$Id) {
60+ Write-Output "Checking $Id..."
61+ $listed = (winget list --id $Id -e | Out-String)
62+ if ($listed -match [regex]::Escape($Id)) {
63+ Write-Output "✅ $Id already installed"
64+ return
65+ }
66+
67+ Write-Output "Installing $Id via winget..."
68+ winget install --source winget --exact --id $Id --accept-package-agreements --accept-source-agreements --silent
69+ if ($LASTEXITCODE -ne 0) {
70+ Write-Error "❌ winget install failed for $Id (exit code $LASTEXITCODE)"
71+ exit $LASTEXITCODE
72+ }
73+ Write-Output "✅ Installed $Id"
74+ }
75+
76+ winget --version
77+
78+ # Install matching SDK + WDK (per Microsoft guidance).
79+ # Update these IDs if you intentionally move to another kit version.
80+ Ensure-WingetPackage "Microsoft.WindowsSDK.10.0.26100"
81+ Ensure-WingetPackage "Microsoft.WindowsWDK.10.0.26100"
82+
5783 - name : Detect Windows Kits version (WDF/UMDF headers)
5884 shell : pwsh
5985 run : |
60- $kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits"
61- if (-not (Test-Path $kitsRoot)) {
86+ $kitsRoot = $null
87+ try {
88+ $kitsRoot = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction Stop).KitsRoot10
89+ } catch {
90+ $kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\"
91+ }
92+
93+ if (-not $kitsRoot -or -not (Test-Path $kitsRoot)) {
6294 Write-Error "Windows Kits root not found: $kitsRoot"
6395 exit 1
6496 }
6597
6698 $includeRoots =
67- Get-ChildItem -Path $kitsRoot -Directory |
68- ForEach-Object { Join-Path $_.FullName "Include" } |
69- Where-Object { Test-Path $_ }
99+ @((Join-Path $kitsRoot "Include")) | Where-Object { Test-Path $_ }
70100
71101 if (-not $includeRoots -or $includeRoots.Count -eq 0) {
72102 Write-Error "No Windows Kits Include directories found under: $kitsRoot"
0 commit comments