function Find-Qa6WdkRoot { param( [string]$ExplicitRoot, [string]$RepoRoot ) $candidates = @( $ExplicitRoot, $env:QA6_WDK_ROOT, (Join-Path $RepoRoot '.tools\wdk\c'), (Join-Path (Split-Path $RepoRoot -Parent) '.research\packages\wdk-10.0.26100.6584\c'), 'C:\Program Files (x86)\Windows Kits\10' ) | Where-Object { $_ } foreach ($candidate in $candidates) { if (-not (Test-Path -LiteralPath $candidate -PathType Container)) { continue } $udeHeader = Get-ChildItem (Join-Path $candidate 'Include') -Recurse ` -File -Filter UdeCx.h -ErrorAction SilentlyContinue | Select-Object -First 1 if ($null -ne $udeHeader) { return (Resolve-Path $candidate).Path } } throw 'UDE WDK not found. Set QA6_WDK_ROOT to the Microsoft.Windows.WDK.x64 package c directory.' } function Find-Qa6WdkVersion { param([string]$WdkRoot) $version = Get-ChildItem (Join-Path $WdkRoot 'Include') -Directory ` -ErrorAction Stop | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'km\ude\1.0\UdeCx.h') } | Sort-Object Name -Descending | Select-Object -First 1 if ($null -eq $version) { throw "No UDE version found under $WdkRoot" } return $version.Name } function Find-Qa6MsvcRoot { $bases = @( 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC', 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC' ) foreach ($base in $bases) { if (Test-Path -LiteralPath $base -PathType Container) { $toolset = Get-ChildItem $base -Directory | Sort-Object Name -Descending | Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'bin\Hostx64\x64\cl.exe') } | Select-Object -First 1 if ($null -ne $toolset) { return $toolset.FullName } } } throw 'Visual Studio 2022 x64 MSVC was not found.' } function Find-Qa6SignTool { param( [string]$WdkRoot, [string]$WdkVersion ) $candidates = @( (Join-Path $WdkRoot "bin\$WdkVersion\x64\signtool.exe"), (Join-Path 'C:\Program Files (x86)\Windows Kits\10' "bin\$WdkVersion\x64\signtool.exe"), (Join-Path 'C:\Program Files\Windows Kits\10' "bin\$WdkVersion\x64\signtool.exe") ) foreach ($candidate in $candidates) { if (Test-Path -LiteralPath $candidate -PathType Leaf) { return $candidate } } throw "x64 SignTool $WdkVersion was not found." }