Updated Windows SDK locator script to make it more resilient to x86 vs x64 environments.

This commit is contained in:
Alexandre Zollinger Chohfi 2021-07-29 15:37:41 -07:00
Родитель 7b49dae015
Коммит 4691738d0c
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -82,6 +82,16 @@ function Test-RegistryPathAndValue {
catch {
}
try {
$path = $path -replace "HKLM:\\SOFTWARE\\", "HKLM:\\SOFTWARE\\WOW6432Node\\"
if (Test-Path $path) {
Get-ItemProperty -Path $path | Select-Object -ExpandProperty $value -ErrorAction Stop | Out-Null
return $true
}
}
catch {
}
return $false
}
@ -100,6 +110,11 @@ function Test-InstallWindowsSdk([string] $WindowsSDKVersion) {
if (Test-RegistryPathAndValue -Path $WindowsSDKInstalledRegPath -Value "$WindowsSDKOptions") {
# It appears we have what we need. Double check the disk
$sdkRoot = Get-ItemProperty -Path $WindowsSDKRegPath | Select-Object -ExpandProperty $WindowsSDKRegRootKey
if (!$sdkRoot) {
$WindowsSDKRegPath = $WindowsSDKRegPath -replace "HKLM:\\SOFTWARE\\", "HKLM:\\SOFTWARE\\WOW6432Node\\"
$sdkRoot = Get-ItemProperty -Path $WindowsSDKRegPath | Select-Object -ExpandProperty $WindowsSDKRegRootKey
}
if ($sdkRoot) {
if (Test-Path $sdkRoot) {
$refPath = Join-Path $sdkRoot "References\$WindowsSDKVersion"