Skip to content

v49 patch 2

Choose a tag to compare

@ArthurJDurand ArthurJDurand released this 12 Oct 00:22
· 8 commits to main since this release

v49 patch 2 is a safety-critical patch on top of v49 patch 1. It corrects four instances of the same defect class in the safety-check layer — a safety check whose underlying query failed could produce the same result as a check that succeeded with a negative answer, and the guard then proceeded as if the safe state had been positively confirmed. In three of the four cases, a transient query failure could have authorized destructive partition work instead of refusing it. The patch also adds two wrapper helper scripts and three conditionally-visible menu entries for single-machine operators.

ScriptVersion remains 49. ScriptPatchLevel moves from 1 to 2. No fleet-wide rebuild is forced — a machine that ran v49 patch 1 continues on the fast path.

The fail-open corrections

A peer review of the v49 patch 1 pipeline identified the same defect shape in four separate guards. Each is corrected independently, and the .NOTES block now states the principle explicitly so future safety checks are written against it from the start: positively confirm the safe state, or refuse.

  • Native-boot VHDX disk enumeration. The unfiltered disk inventory used -ErrorAction SilentlyContinue. A thrown Get-Disk was indistinguishable from "no other disks present," so the hypervisor-guest verdict — which permits destructive operations — could fire on a machine whose host physical disk was momentarily unenumerable. The enumeration now fails closed; an unreadable BusType on any other disk is treated symmetrically.

  • Post-deletion partition verification (two call sites). Both the deletion loop in Ensure-AdequateRecoveryPartition and Remove-OrphanPartition treated a thrown Get-Partition query as proof the partition was gone. Both sites now enumerate the target disk and confirm the partition's absence with a terminating query; a query failure is treated as "not confirmed removed" and the failure branch runs.

  • WinRE status determination (two call sites). The destructive sequence and the restore transactional replacement both treated any status other than Enabled as "no disable step required." An indeterminate status — reagentc output the parser could not classify — would have skipped both the location-resolution guard and the reagentc /disable step. Both sites now refuse on any status that is neither Enabled nor Disabled.

  • Storage-controller enumeration. Get-StorageControllerDevices returned @($result) in its terminal return; PowerShell collapses an empty array to zero pipeline objects, so the caller received $null and could not distinguish "successfully empty" from "enumeration failed." The applicability gate's $null branch then fired for a successfully-empty enumeration, refusing a candidate on a machine with no SCSIAdapter-class devices. The function now uses return ,$result, and the caller's .Count -eq 0 branch handles the empty case as documented.

These four corrections only change behavior when the underlying query fails. A machine whose queries succeed continues exactly as before.

Wrapper changes

Two new helper scripts ship alongside the wrapper:

  • Check-Update.ps1 — reads the local script version, fetches the remote CHANGELOG.md from the project repository, and compares the two. Read-only, no elevation required. Caches the remote version string for 24 hours; a local version change after a cache hit reflects immediately.
  • Cleanup-Backups.ps1 — interactive cleanup for backup directories. Lists every valid backup with per-backup size and total, and deletes the ones you select after a typed DELETE confirmation. Launched elevated by the wrapper's [C] menu option.

Three wrapper menu entries are now conditional:

  • [8] Restore and [C] Clean up backups appear only when at least one valid backup exists at the default location (C:\Backup\WindowsRE). A single toggle at the top of WinRE-Manager.cmd (HIDE_BACKUP_ACTIONS_WHEN_NONE, default 1) restores the previous always-show behavior.
  • [U] Open releases page appears only when Check-Update.ps1 reports an update is available.

Two wrapper-launcher improvements:

  • The elevated launcher now passes -Wait, so the wrapper menu does not re-render until the elevated process (and any children) has exited. The menu is always fresh on return.
  • The DryRun option now uses a child-process runner: it launches WinRE.ps1 -DryRun, captures the exit code, prints the interpretation legend, and waits for a keypress before returning to the menu. The previous implementation returned to the menu before DryRun had completed.

Also in this release

  • Dead code removed: Get-DriverVersionFromInf was fully implemented but had no call sites. The never-downgrade check reads DISM-populated Version fields directly from Get-WindowsDriver output; the manual INF-parsing version read was scaffold from an earlier iteration.
  • .NOTES wording corrected: the never-downgrade design-invariant bullet said the check compared before injection; the implementation compares after and discards the injected image on a detected downgrade. The wording now matches the code.
  • Check-Update.ps1 cache invalidation. The update-check cache at %TEMP%\WinRE-Manager-remote-version.txt now records the local version that was current when the cache was written, and the checker discards the cache when the local version has since changed. Previously, a machine that upgraded to a newer local version kept reporting Dev build (ahead of release) against the stale cached remote value until the 24-hour cache expired. With the fix, a local upgrade immediately re-fetches the remote value and reports CURRENT or UPDATE as appropriate. The cache file format changes from two fields to three; a legacy two-field cache from an earlier run is treated as invalid and discarded, causing a single re-fetch on first run after the upgrade.

Upgrade notes

  • ScriptVersion remains 49. The SCRIPT component of DesiredStateId is unchanged. No fleet-wide rebuild is forced.
  • ScriptPatchLevel moves from 1 to 2, visible in the startup banner (WinRE Manager Started (v49 patch 2)), in the backup sidecar's ManagerVersion field, and in the provenance marker's ManagerVersion field.
  • The read-only harness moves from v29 to v32 across three separate harness-only moves in this window; none triggers a managed-machine rebuild.
  • The two new helper scripts are optional. When absent, the wrapper hides the corresponding menu entries and continues to function normally.
  • No state file action is required. A machine that ran v49 patch 1 continues on the fast path.

Field verification

The -Action Backup mode was exercised end-to-end on 2026-10-11 (ASUS PRIME H510M-D), capturing a byte-for-byte WIM copy with SHA256 verification and a sidecar. The Foreign-With-Drivers preserve branch was exercised on a machine carrying a third-party driver (ASUS Zenbook 14 UX3405MA, 2026-10-09), and the full destructive rebuild pipeline was exercised on three vendors (Lenovo, HP, Dell) on 2026-10-10.

The four fail-open corrections are code-review fixes on error paths and cannot be exercised by a happy-path run. They are covered by inspection and by the parser self-tests. The complete list of outstanding field-verification items is in the CHANGELOG entry for this release.

Full changelog

See CHANGELOG.md — v49 patch 2 for the per-change detail, the field-verification log, and the migration note.