Compare commits

..

3 Commits
v1.06 ... v1.09

Author SHA1 Message Date
Pete Batard
9c19e1c671 Speed up initial UI display by performing query locale check in stage 1
* UI display should now only be constrained by the time it takes to launch PowerShell
2019-03-18 11:09:54 +00:00
Pete Batard
bc488df01a Remove debug output and fix Readme 2019-03-16 23:48:39 +00:00
Pete Batard
775f80631e Fix x64 detection, Win7 PowerShell 3.0 prompt and other issues
* .Contains() cannot be used with PowerShell 2.0 (Win7 default), which prevents
  the prompt that asks users to install PowerShell 3.0 from being displayed...
* Fix LTR display of Windows Releases for RTL languages.
* $env:PROCESSOR_ARCHITECTURE reports the architecture of the PowerShell runtime
  rather than the one from the OS, meaning that when executed in 32-bit mode on
  a 64-bit system (like with Rufus) it will report X86 instead of AMD64.
  Use [Environment]::Is64BitOperatingSystem instead.
* Closes #5
2019-03-16 23:30:58 +00:00
2 changed files with 20 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
#
# Fido v1.06 - Retail Windows ISO Downloader
# Fido v1.09 - Retail Windows ISO Downloader
# Copyright © 2019 Pete Batard <pete@akeo.ie>
# ConvertTo-ImageSource: Copyright © 2016 Chris Carter
#
@@ -332,7 +332,7 @@ function ConvertTo-ImageSource
# Translate a message string
function Get-Translation([string]$Text)
{
if (-not $English.Contains($Text)) {
if (-not $English -contains $Text) {
Write-Host "Error: '$Text' is not a translatable string"
return "(Untranslated)"
}
@@ -407,6 +407,7 @@ function Get-RandomDate()
$ErrorActionPreference = "Stop"
$dh = 58;
$Stage = 0
$ltrm = ""
$MaxStage = 4
$SessionId = [guid]::NewGuid()
$ExitCode = 100
@@ -437,14 +438,7 @@ if ($LocData -and (-not $LocData.StartsWith("en-US"))) {
}
$Locale = $Localized[0]
}
# Test if the Microsoft servers can handle our locale. If not, fall back to en-US.
$QueryLocale = $Locale
try {
$url = "https://www.microsoft.com/" + $QueryLocale + "/software-download/"
Invoke-WebRequest -UseBasicParsing -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
} catch {
$QueryLocale = "en-US"
}
# Make sure PowerShell 3.0 or later is used (for Invoke-WebRequest)
if ($PSVersionTable.PSVersion.Major -lt 3) {
@@ -512,17 +506,28 @@ $Continue.add_click({
switch ($Stage) {
1 { # Windows Version selection
$XMLForm.Title = Get-Translation($English[12])
Refresh-Control($XMLForm)
# Check if the locale we want is available - Fall back to en-US otherwise
try {
$url = "https://www.microsoft.com/" + $QueryLocale + "/software-download/"
Invoke-WebRequest -UseBasicParsing -MaximumRedirection 0 -UserAgent $UserAgent $url | Out-Null
} catch {
$script:QueryLocale = "en-US"
}
$i = 0
$array = @()
foreach ($Version in $WindowsVersions[$WindowsVersion.SelectedValue.Index]) {
if (($i -ne 0) -and ($Version -is [array])) {
$array += @(New-Object PsObject -Property @{ Release = $Version[0]; Index = $i })
$array += @(New-Object PsObject -Property @{ Release = $ltrm + $Version[0].Replace(")", ")" + $ltrm); Index = $i })
}
$i++
}
$script:WindowsRelease = Add-Entry $Stage "Release" $array
$Back.Content = Get-Translation($English[8])
$XMLForm.Title = $AppTitle
}
2 { # Windows Release selection => Populate Product Edition
@@ -609,6 +614,7 @@ $Continue.add_click({
$SelectedIndex = 0
$array = @()
try {
$Is64 = [Environment]::Is64BitOperatingSystem
$r = Invoke-WebRequest -UserAgent $UserAgent -WebSession $Session $url
if (-not $($r.AllElements | ? {$_.id -eq "expiration-time"})) {
$ErrorMessage = $(GetElementById -Request $r -Id "errorModalMessage").innerText
@@ -632,12 +638,12 @@ $Continue.add_click({
$Type = $json.DownloadType
if ($Type -eq "IsoX64") {
$Type = "x64"
if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") {
if ($Is64) {
$SelectedIndex = $i
}
} elseif ($Type -eq "IsoX86") {
$Type = "x86"
if ($env:PROCESSOR_ARCHITECTURE -eq "X86") {
if (-not $Is64) {
$SelectedIndex = $i
}
}

View File

@@ -19,7 +19,7 @@ As to the reason one might want to download Windows __retail__ ISOs, as opposed
Microsoft's own Media Creation Tool (MCT), this is because it is only with an official retail ISO that one can assert
with complete certainty whether its content has been altered in any way or not. Indeed, retail Microsoft's ISOs are the
only ones you will be able to obtain an official SHA-1 for (from sites [such as this one](https://msdn.rg-adguard.net/public.php))
for instance) allowing you to be 100% certain that the image you are using is non corrupted and safe to use.
allowing you to be 100% certain that the image you are using is non corrupted and safe to use.
This, in turn, offers assurance that the content __YOU__ are using to install your OS, and which it is indeed critical
to validate beforehand if you care about security, does matches bit for bit the one that Microsoft officially released.