]> vilimpoc.org git repositories - dotfiles/blob - README.md
cf8a85b04a838b0aa3b25e82320667cdd9218d6f
[dotfiles] / README.md
1 # dotfiles
2
3 Windows development-box provisioning scripts.
4
5 `setup-windows.bat` takes a fresh Windows install to a working C++ / native
6 development environment: editors and shells, Python, the Visual Studio
7 toolchain (including the Clang and Windows XP targeting toolsets), the Windows
8 Driver Kit, Rust (rustup, with the stable MSVC toolchain for the host as the
9 default), Android Studio and a per-user Android SDK, Android's `adb`, and a
10 handful of analysis tools (Sysinternals, OpenCppCoverage, BinSkim, the Windows
11 Performance Toolkit). It also sets the box up to be driven remotely: OpenSSH
12 Server plus an rsync build for Windows, which is what makes a throwaway VM
13 reachable from a Linux host.
14
15 **Nothing happens until you have seen the plan.** It first lists every step it
16 can take on this machine and lets you choose which ones to run — see
17 [Choosing what runs](#choosing-what-runs).
18
19 Runs on **x64 and on ARM64** (Windows 11 on Arm), and installs *different things*
20 on each: x64 is the full workstation, ARM64 a lean build box with a single
21 C/C++ compiler. See
22 [Running on ARM64](#running-on-arm64) for what differs and why.
23
24 ## Files
25
26 | File | Purpose |
27 | --- | --- |
28 | `setup-windows.bat` | Entry point. Shows the plan and lets you choose, then runs the winget installs, launches the elevated half and prints its log, then runs the non-elevated script. |
29 | `setup-windows-plan.ps1` | The plan. Run by the batch file before anything else: lists every step for this machine, grouped and numbered, and takes your choice. Run it on its own with `-WhatIf` to preview; add `-HostArch ARM64 -Elevation NOLUA`, or `-VirtualMachine Hyper-V` / `-VirtualMachine none`, to preview another kind of box. |
30 | `setup-windows-steps.ps1` | The catalog the other four read: every step's name, what it does, and where it cannot run and why. Defines functions only; it is dot-sourced, never run. |
31 | `setup-windows-current.ps1` | Asked by the batch file before the Claude Code, NASM and Android Studio installs: is what is on the box already current? Those are the installs that would otherwise run in full every time — see [Re-running](#re-running). |
32 | `setup-windows-no-uac.ps1` | The non-elevated, per-user half: `%USERPROFILE%\.local\bin` (where `claude.exe` lives), WinMerge, BinSkim and upstream LLVM on the user `PATH` (x64 only), the global git config (identity, plus `core.sshCommand`), the native `ninja` pinned ahead of the one Visual Studio bundles, and an architecture audit of everything provisioned. Can also be run directly from an ordinary prompt; it lists its steps and asks first. |
33 | `setup-windows-with-uac.ps1` | The elevated half, started via UAC by the batch file. Enables `ssh-agent`, installs the OpenSSH Client and Server capabilities and starts `sshd`, unpacks the `rsync-windows` release zip for this architecture (`rsync.exe` plus the `ssh.exe` it runs) into `C:\Tools\rsync` on the machine `PATH`, then installs Visual Studio Community with the required components, the WDK, and the Windows Performance Toolkit, and reports whether Intel VTune Profiler is present. Can also be run directly from an Administrator prompt; it lists its steps and asks first. |
34 | `setup-windows-7-test-env.bat` | Prepares a **Windows 7 VM** as a test target driven from the host by `VBoxManage guestcontrol`. Copy it into the guest and run it there; it is idempotent, so re-run it after any snapshot restore. The per-user half needs no UAC (crash-dialog suppression, no screen blanking, a staging directory, the shared folder on `Z:`); the machine-wide half is skipped with a notice unless run elevated inside the guest. It then reports what the box can actually test: DWM composition, printers, audio capture devices. |
35
36 ## Usage
37
38 1. **Edit `setup-windows-no-uac.ps1` first.** The global git identity near the
39    top of the file is empty:
40
41    ```powershell
42    $GitUserName  = ''   # e.g. 'Ada Lovelace'
43    $GitUserEmail = ''   # e.g. 'ada@example.com'
44    ```
45
46    Fill in your own name and email, or leave them empty to keep your identity
47    per-repository - the script skips `user.name` / `user.email` rather than
48    writing a placeholder, and says so. Everything else in that script is set
49    either way.
50
51 2. Run it from a normal (non-elevated) prompt:
52
53    ```bat
54    setup-windows.bat
55    ```
56
57    Before doing anything it prints the plan — every step it can take on this
58    machine, grouped and numbered — and waits:
59
60    ```text
61    Setup plan - nothing has been done yet
62      host:      x64 - the full workstation
63      elevation: not elevated; expect a UAC prompt partway through, for the elevated half
64
65     U  Per-user installs (winget, except Claude Code)
66       [x]  1 ClaudeCode          Claude Code, native installer: irm https://claude.ai/install.ps1 | iex
67       [x]  2 Brave               Brave.Brave
68       ...
69     E  Elevated setup (setup-windows-with-uac.ps1) - one UAC prompt, runs in its own window
70       [x] 25 OpenSshClient       OpenSSH Client capability (ssh.exe, and the libcrypto.dll rsync's ssh.exe needs)
71       ...
72       [x] 29 VisualStudio        Visual Studio 2022 Community, C++: MSVC for x86/x64 + ARM64, SDK 26100 (several GB)
73       ...
74
75      44 of 44 steps selected.
76
77      Enter runs the selected steps. To change them, type step numbers or ranges
78      (3 5-7), step names, or a group letter (U M E C) to switch them on or off;
79      'all' or 'none' for everything; 'q' to quit without doing anything.
80    ```
81
82    Press Enter to run everything marked `[x]`, or switch steps off and on first;
83    the list is redrawn after each change. Steps that cannot run on this machine
84    are shown as `[-]` with the reason and have no number.
85
86    After Enter it runs unattended apart from a single UAC prompt for the
87    elevated half — none at all if you switched every elevated step off. Accept
88    it; declining leaves Visual Studio and the WDK uninstalled, and the script
89    says so.
90
91 3. Restart your shell afterwards so the updated user `PATH` is picked up, and
92    reboot if a step reported that a restart was required.
93
94 ## Choosing what runs
95
96 Arguments to `setup-windows.bat` set the starting point of the plan; you can
97 still adjust it before pressing Enter unless you also pass `-Yes`.
98
99 | | |
100 | --- | --- |
101 | `setup-windows.bat -WhatIf` | Show the plan for this machine and stop. Nothing is changed. |
102 | `setup-windows.bat -Skip VirtualBox,Brave` | Start with those switched off. |
103 | `setup-windows.bat -Only E` | Start with only the elevated half. |
104 | `setup-windows.bat -Yes` | Do not ask: run the plan as it stands. For unattended runs. |
105 | `setup-windows.bat /?` | Usage. |
106
107 - Steps are named as the plan shows them, comma-separated. A group letter works
108   anywhere a name does: `U` per-user installs, `M` machine-wide installs and the
109   WiX pin, `E` the elevated half, `C` per-user configuration and Pillow. A name
110   it does not recognise stops the run before anything happens — a mistyped
111   `-Skip` that was quietly ignored would install exactly what you meant to leave
112   out.
113 - **With no console to ask on** — piped, scheduled, a non-interactive `ssh`
114   command — it prints the plan and stops with exit code 2 unless given `-Yes`.
115   It never assumes yes.
116 - The two halves take `-Only`, `-Skip` and `-Yes` too, and when run on their own
117   print their part of the plan and ask before doing anything, e.g.
118   `.\setup-windows-with-uac.ps1 -Only VisualStudio,Wdk`. From the batch file
119   they are handed exactly what the plan left selected, with `-Yes`, since you
120   were asked already. With nothing selected for a half it is not started — so
121   no UAC prompt is raised for an elevated half with no steps.
122 - Every step is declared once, in `setup-windows-steps.ps1`: its name, what it
123   does, and — with the reason — whether it is x64-only (`-X64Only`), kept off a
124   Windows that is itself a virtual machine (`-NotInVM`), or needs an
125   administrator (`-Admin`). The planner, the batch file and both halves read
126   that one list and check each other: a step the list does not know is refused
127   rather than run, and a selected step that nothing implements fails the run
128   rather than quietly not happening. Adding a step means a row there plus the
129   code that does it, gated on the same name.
130 - Some steps build on others — the WiX pin needs the .NET SDK, the Clang and XP
131   toolsets need Visual Studio. The plan notes it when you switch the
132   prerequisite off, but does not stop you: it may well be installed already.
133
134 ## Re-running
135
136 Every step checks before it acts, so running `setup-windows.bat` again on a
137 provisioned box installs only what is missing or has a newer version out.
138 Nothing is reinstalled at the version it already has. Where a check cannot
139 decide — no network, a version string it does not recognise — it installs as
140 before rather than skipping: a failed check must never be why something is left
141 missing or out of date.
142
143 | step | how it decides |
144 | --- | --- |
145 | winget packages | `winget install` on a package winget can see is installed upgrades it when a newer version exists and otherwise does nothing — winget's own default. `--force`, which would install regardless, is never used. |
146 | `ClaudeCode` | Anthropic's installer always downloads and reinstalls, so `setup-windows-current.ps1` asks first: is `%USERPROFILE%\.local\bin\claude.exe` the latest release — the version the installer's own endpoint names — and the build for this host? Only both skip it. |
147 | `NASM` | Its per-user fallback install registers nothing, so winget cannot see it and would rerun the installer every time. `setup-windows-current.ps1` compares that `nasm.exe` with the version winget offers. A machine-wide NASM is left to winget. |
148 | `Rustup` | Needs no help: rustup registers itself under the manifest's product code and rewrites its version when it updates itself, so winget sees what is really there. |
149 | `AndroidStudio` | Installed only when it is missing. Studio updates itself in the app, and winget's package is marked never to upgrade it; the check keeps winget from installing over a Studio it cannot match to its package, as on a box where Studio was installed some other way. |
150 | `WiX` | Skipped when 5.0.2 is already in the .NET global tool store. |
151 | `OpenSshClient`, `OpenSshServer` | Installed only when the capability is not. |
152 | `Rsync` | The release's `.sha256` is fetched first and compared with the hash recorded when the files were installed (`rsync-windows.sha256`). The zip is downloaded only when they differ or a file is missing. |
153 | `VisualStudio`, `VsClang`, `VsWinXP` | `vswhere -requires` says whether the install already has every component of a pass. A pass with nothing to add does not run the installer, and with nothing to add anywhere the bootstrapper is not even downloaded. The script never updates Visual Studio itself; the Visual Studio Installer does that. |
154 | `Wdk`, `Wpt` | Skipped when the kit, or the toolkit, is already there. |
155 | `BinSkim` | Asks NuGet for the newest stable version before downloading a package well over 100 MB; `nupkg-version.txt` beside the tool records what is installed. |
156 | `RustToolchain` | `rustup toolchain install` updates stable when there is a newer one and otherwise reports it unchanged. |
157 | `AndroidSdk` | The command-line tools are re-downloaded only when Google's package index has a newer revision than the installed one; `android sdk install` updates the platform, build-tools and platform-tools only when they are out of date. A re-run with nothing new takes seconds. |
158 | `Pillow` | `pip install` leaves an installed Pillow alone. It does not upgrade it either. |
159 | the rest | Configuration: `PATH` entries are added only when missing, and settings are written with the values they already have. |
160
161 ## Notes
162
163 - The elevated half writes a transcript to `setup-windows-uac.log` next to the
164   script; the batch file prints it when the elevated window closes. The log is
165   gitignored, as it contains local paths.
166 - **git uses a Win32-OpenSSH client.** `setup-windows-no-uac.ps1` sets
167   `core.sshCommand`. Git for Windows otherwise prefers its own bundled MSYS2
168   `ssh.exe`, which cannot reach the Windows `ssh-agent` service that the elevated
169   half enables - Win32-OpenSSH publishes the agent on a named pipe the MSYS2
170   build does not speak. Without this, keys loaded with `ssh-add` from PowerShell
171   are invisible to `git`, and a push falls back to hunting for a key file and
172   prompting for its passphrase. The value uses forward slashes on purpose: git
173   parses `core.sshCommand` with shell quoting rules, in which a backslash is an
174   escape character.
175 - **Which `ssh.exe` git gets.** `C:\Tools\rsync\ssh.exe` — the fast build the
176   elevated half unpacks — if it is there, `%WINDIR%/System32/OpenSSH/ssh.exe`
177   otherwise. It is the same client with the same `~/.ssh`, agent and
178   `known_hosts`; the difference is the stdin pump, and without it anything git
179   *pushes* is capped at ~17 MB/s. Candidates are tried by **running** them
180   (`ssh -V`), not by `Test-Path`: the fast build needs a `libcrypto.dll` that an
181   image without the OpenSSH Client capability does not have, and a client that
182   will not start should be found here rather than on the next `git push`.
183   This is also why `setup-windows.bat` now runs the elevated half **first** — the
184   fast `ssh.exe` has to exist before the git config step can prefer it. The
185   non-elevated half still runs even when the elevated one failed; it just falls
186   back. Re-run `setup-windows-no-uac.ps1` on its own at any time to re-pick.
187 - All the scripts are safe to re-run: nothing is reinstalled at the version it
188   already has. See [Re-running](#re-running) for how each step decides.
189 - `setup-windows-no-uac.ps1` runs its steps independently: one failing warns and
190   the rest still run, and it exits 1 if any did. The `.bat` reports that and
191   carries on. Use `-Only` / `-Skip` to re-run a subset, e.g.
192   `.\setup-windows-no-uac.ps1 -Skip BinSkim`.
193   Run it **non-elevated**: it writes per-user state (the `HKCU` `PATH`, the
194   `.gitconfig` under `%USERPROFILE%`), so an elevated run would configure the
195   administrator's profile instead. It warns if you do.
196 - **Remote access.** OpenSSH Server is installed from the Windows on-demand
197   capability (10/1809+), set to start automatically, and given an inbound TCP 22
198   firewall rule on *all* profiles — a VM's host-only or bridged adapter is
199   routinely classified Public, which is the usual reason a running `sshd` is
200   unreachable. Windows ships no `rsync`, so a build of it
201   ([nuket/rsync-windows](https://github.com/nuket/rsync-windows)) is installed to
202   `C:\Tools\rsync` and added to the **machine** `PATH`. That last detail matters:
203   the remote end of an `rsync` runs non-interactively, with no login shell, and
204   Win32-OpenSSH builds that environment from the registry `PATH` rather than from
205   a profile. Key auth needs `~/.ssh/authorized_keys` ACL'd to just you and
206   `SYSTEM`; accounts in the Administrators group use
207   `C:\ProgramData\ssh\administrators_authorized_keys` instead.
208 - **rsync brings its own `ssh.exe`.** That release ships as one zip per
209   architecture — `rsync-windows-x86.zip`, `-x64.zip` and `-arm64.zip`, each
210   holding `rsync.exe`, an `ssh.exe`, `COPYING.txt` and `NOTICE-ssh.txt` — and the
211   elevated half picks the zip matching the host, verifies it against the
212   published `.sha256`, unpacks the pair together, then **runs** the unpacked
213   `ssh.exe` and removes it if it will not start. Together is the point:
214   `rsync.exe` prefers an `ssh.exe` sitting in its own directory, and the release
215   builds one because the client Windows ships reads its stdin 3 KB at a time,
216   which holds a transfer *from* the box at ~17 MB/s however fast the link is.
217   Nothing else about it differs — same `~/.ssh`, same `ssh-agent`, same
218   `known_hosts` — and a bare `ssh` still resolves to the in-box client, which
219   sits ahead of `C:\Tools\rsync` on the `PATH`. It links against the
220   `libcrypto.dll` the **OpenSSH Client** capability puts in `System32` (Windows'
221   own LibreSSL, which uses AES-NI) and ships no copy of its own, so the elevated
222   half installs that capability first and falls back to `rsync.exe` alone,
223   warning, on an image that will not offer it.
224 - The `rsync` download follows the `releases/latest/download/` redirect rather
225   than the GitHub API: unauthenticated API calls are rate-limited to 60/hour per
226   IP, which a provisioning run behind a shared NAT can genuinely exhaust. To hold
227   a box on a known build, pin the tag in `$RsyncUrl`
228   (`.../releases/download/<tag>/<asset>`) instead.
229 - Visual Studio is installed in three labelled passes (base workload, Clang/LLVM,
230   XP toolset) so a failure identifies which component group is responsible. On
231   ARM64 only the first runs — the other two are skipped there, each printing why.
232   The last two are optional passes: a failure there warns and provisioning continues,
233   because neither is needed to build with MSVC and losing the whole toolchain
234   over a component you can add later from the installer UI is the worse outcome.
235 - **Which Visual Studio generation.** `$VsChannel` near the VS step picks it —
236   `17` for VS 2022, `18` for VS 2026 — and `$VsEdition` picks Community /
237   Professional / Enterprise. It is **architecture-split by default**: 17 on x64,
238   where the `v141`/XP toolset in the component list is the reason to pin a
239   generation, and 18 on ARM64, where that toolset cannot exist anyway (no
240   ARM64-hosted 14.16 compiler), so nothing holds Arm back to the older one.
241 - **The aka.ms path differs per generation** — VS 2022 is published under
242   `/release/`, VS 2026 under `/stable/`, which `$VsChannelPath` derives. This is
243   not cosmetic: `https://aka.ms/vs/18/release/vs_community.exe` is *not* a 404,
244   it silently redirects to Bing and returns **200 with an HTML body**. A wrong
245   guess there downloads a web page, names it `vs_community.exe`, and fails later
246   at `Start-Process` with something that looks nothing like a bad URL. The step
247   therefore checks the downloaded file starts with an `MZ` header and throws with
248   the URL if it does not.
249 - `Get-VsInstallPath` scopes its `vswhere` query to that generation
250   (`-version "[17.0,18.0)"`). That scoping is load-bearing: a bare
251   `vswhere -products *` returns **every** Visual Studio on the box, newest
252   first, and on a machine that already has VS 2026 the old unscoped lookup handed
253   an 18.x install path to a 17.x bootstrapper as `modify --installPath`, so every
254   pass targeted the wrong product. The step now also lists any other generations
255   it found and states that it left them alone — when none of them matches
256   `$VsChannel` the script is about to fetch a second, largely redundant
257   toolchain, and that should be a visible decision. On ARM64, where `$VsChannel`
258   is 18, an existing VS 2026 **is** the match and gets modified in place rather
259   than duplicated.
260 - **Windows Performance Analyzer is not part of Visual Studio.** VS has its own
261   Performance Profiler, which is a different, `.diagsession`-based tool and
262   cannot open an `.etl`. WPA ships with `xperf` and `wpr` in the Windows
263   Performance Toolkit, which exists in exactly two places: as an optional
264   *feature* of the Windows SDK (`OptionId.WindowsPerformanceToolkit`) and inside
265   the Windows ADK, which bundles the same toolkit. Whether the SDK install that
266   Visual Studio performs selects that feature varies by version, so the elevated
267   half **detects first** — `%ProgramFiles(x86)%\Windows Kits\10\Windows
268   Performance Toolkit`, its 64-bit twin, and the ADK location — and only falls
269   back to `winget install Microsoft.WindowsADK` when nothing is there. It then
270   re-asserts that directory on the machine `PATH` (the toolkit's own installer
271   usually does this, and the Start Menu gets *Windows Kits > Windows Performance
272   Toolkit* shortcuts for WPA and WPR). To install just the toolkit instead of the
273   whole ADK, run the standalone SDK setup with
274   `winsdksetup.exe /features OptionId.WindowsPerformanceToolkit /q`. A newer WPA
275   also exists in the Microsoft Store (`winget install --id 9N0W1B2BXGNZ --source
276   msstore`); it is not installed here because the Store source needs an
277   interactive, signed-in session, which the unattended elevated half does not
278   have.
279 - **Intel VTune Profiler is reported, not installed.** The elevated half prints
280   whether it is on the box, its version, and the path to `vtune.exe`; if it is
281   missing it prints the download page instead (and says so if the CPU is not
282   Intel). Automating the install is not worth it here: the offline installer is a
283   ~750 MB download from a URL carrying a per-release GUID with no "latest"
284   redirect behind it, so every new build would mean editing a hard-coded link,
285   and it is only worth having on Intel silicon since hardware event-based
286   sampling reads Intel PMU counters. It does install unattended if you want it
287   scripted elsewhere:
288
289   ```powershell
290   intel-vtune-<version>_offline.exe -a --silent --cli --eula accept
291   ```
292
293   **Run it from an administrator account, elevated.** Hardware event-based
294   sampling (`uarch-exploration`, `memory-access`, `hotspots -knob
295   sampling-mode=hw`) requires it, and VTune warns about that at the top of every
296   unelevated run. Worth knowing that the failure it gives there is *"cannot
297   recognize the processor"*, which reads like a hardware problem and is not one:
298   the drivers (`sepdrv5`, `sepdal`, `vtss`) are installed and running, and VTune
299   identifies the PMU through them. There is no group to join to get around it —
300   the Linux driver can be handed to a `vtune` group, but on Windows the
301   documented answer is to run as administrator.
302
303 - **Collect traces from an elevated Administrator session. Non-elevated
304   collection was tried here and abandoned.** The attempt was to put one ordinary
305   account into `BUILTIN\Performance Log Users`, which appears in the default
306   security descriptors ETW keeps per provider GUID under
307   `HKLM\SYSTEM\CurrentControlSet\Control\WMI\Security`, and collect without a UAC
308   prompt. It does not survive contact with the real workflow: `xperf -on base`
309   and `wpr -start` drive the *NT Kernel Logger*, reserved for Administrators and
310   LocalSystem, and granting the group `SeSystemProfilePrivilege` ("Profile system
311   performance") plus an explicit ACE for `TRACELOG_ACCESS_KERNEL_LOGGER` on
312   `SystemTraceControlGuid` — all three in place, across a reboot — still answered
313
314   ```text
315   xperf: error: NT Kernel Logger: Access is denied. (0x5).
316   ```
317
318   It is not a check an ACE overrides, and the same wall turned up often enough
319   elsewhere that the whole approach was dropped rather than carried as a
320   half-working path. **Sign in to an administrator account and run `xperf`, `wpr`
321   and VTune from an elevated prompt.** Analysis is the exception and never needed
322   any of this: `wpa.exe` opens an existing `.etl` as a plain user.
323
324   If an earlier revision of these scripts ran on a box, it left that account in
325   the group. Take it back out with:
326
327   ```powershell
328   net localgroup "Performance Log Users" DOMAIN\user /delete
329   ```
330
331   Two revisions also granted the privilege and the ACE. Undo the privilege in
332   `secpol.msc` > Local Policies > User Rights Assignment > "Profile system
333   performance" by removing Performance Log Users. The ACEs sit in the
334   `{9e814aad-3204-11d2-9a82-006008a86939}` value under
335   `HKLM\SYSTEM\CurrentControlSet\Control\WMI\Security`: strip the `LU` entries
336   from that descriptor rather than deleting the value, which also carries entries
337   for SYSTEM, Administrators and two service accounts.
338
339 - **Claude Code is not installed through winget.** Recent releases of
340   `Anthropic.ClaudeCode` are broken through that route, so the batch file runs
341   Anthropic's own installer, `irm https://claude.ai/install.ps1 | iex`: it
342   checks the download against the release manifest's SHA-256 and puts `claude`
343   in `%USERPROFILE%\.local\bin`, per-user. The `LocalBinPath` step in
344   `setup-windows-no-uac.ps1` makes sure that directory is on the user `PATH`
345   (creating it if need be); the installer itself only prints a reminder. Two
346   things are fixed up around it.
347   The script picks its ARM64 or x64 build from `$env:PROCESSOR_ARCHITECTURE`
348   alone, which reads `AMD64` in an emulated x64 shell on ARM64 (see
349   [Detecting the architecture](#detecting-the-architecture)), so the batch file
350   sets that variable from the registry's answer for the installer's process.
351   And the script refuses a 32-bit PowerShell, which is what `powershell` is from a
352   32-bit `cmd.exe`, so it is run through `%SystemRoot%\Sysnative` when that
353   exists. A copy left over from the winget route can shadow the new one on the
354   `PATH`; the step warns if it finds one (`winget uninstall
355   Anthropic.ClaudeCode` removes it), and the architecture audit shows which
356   `claude.exe` wins.
357 - **Rust.** winget installs rustup (`Rustlang.Rustup`, per-user, under
358   `%USERPROFILE%\.cargo` and `.rustup`). Its silent install is
359   `rustup-init -y -q`, which already sets up a stable toolchain for whatever
360   host rustup detects. The `RustToolchain` step in `setup-windows-no-uac.ps1`
361   then pins the answer: `stable-x86_64-pc-windows-msvc` on x64,
362   `stable-aarch64-pc-windows-msvc` on ARM64, installed, made the default, and set
363   as rustup's default host. That matters on ARM64, where an x64 rustup —
364   an older install, or one started from an emulated shell — would otherwise
365   quietly set up an emulated compiler. The `-msvc` toolchains link with the
366   Visual Studio the elevated half installs, but only need it to *build*:
367   installing rustup first is fine, and with `-y` rustup-init just warns that
368   the prerequisites are missing rather than installing a Visual Studio of its
369   own. Re-running the step updates stable. It also resets the default to
370   stable, so leave `RustToolchain` out of the plan if you have chosen another
371   default on purpose. The architecture audit reports the compiler *inside* the
372   toolchain: `.cargo\bin\rustc.exe` is a rustup proxy, so its architecture is
373   rustup's, not the compiler's.
374 - **`adb` and `fastboot`** come from `Google.PlatformTools`, a portable zip that
375   winget unpacks under `%LOCALAPPDATA%\Microsoft\WinGet\Packages` and puts on the
376   user `PATH` (`adb.exe` needs the `AdbWinApi` DLLs beside it). The manifest
377   calls it x64, but every binary in it is 32-bit **x86** — checked on r37.0.1 —
378   and there is no ARM64 build. It runs under WOW64 on x64 and under x86
379   emulation on ARM64, which every Windows on Arm has; the audit lists it as
380   expected. It stays on ARM64 for the same reason `iperf3` does: it is bound by
381   the link to the device, not by the CPU.
382 - **Android Studio and the Android SDK** are separate steps. Studio
383   (`Google.AndroidStudio`) is machine-wide — its installer elevates itself — and
384   is installed only when missing, since it updates itself. The SDK is per-user,
385   in Studio's default `%LOCALAPPDATA%\Android\Sdk` (or wherever `ANDROID_HOME`
386   already points): the command-line tools, platform-tools, and the newest
387   stable platform and build-tools from Google's package index, read at run
388   time. That is what Studio's first-run wizard would set up, and it is enough
389   to build: Gradle fetches whatever else a project asks for. The step sets
390   `ANDROID_HOME`, puts the command-line tools on the user `PATH`, and points
391   `JAVA_HOME` at Studio's bundled JDK for a command-line `gradlew` when there is
392   no `JAVA_HOME` already. The SDK licences are accepted on your behalf — the
393   plan says so before anything runs. Both are x64-only: Studio has no ARM64
394   build, and the SDK's Windows build tools are x86/x64. Three things about
395   the current command-line tools (23.0), found when this step was written:
396   - `sdkmanager` is deprecated. It is now a shim over the new **Android CLI**
397     (`android.exe`), which on first use installs itself into
398     `%USERPROFILE%\.android` — about 90 MB in `bin\`, and a `cli\` folder with
399     its own Java runtime. It also keeps a spool of **usage metrics** there and
400     uploads them; no opt-out was found. The step calls the CLI directly.
401   - **CLI 1.0.16406183 crashes on the way out of every `sdk` command**
402     (`0xC0000409`) on this Windows 10, after the work is done. So the step does
403     not trust its exit code: each package must be present afterwards, and a
404     crash with everything in place is printed as a note, not a failure.
405   - Windows PowerShell 5.1's progress bar made the 148 MB command-line tools
406     download take about ten minutes; with it off, the whole first install took
407     under a minute. The BinSkim download now skips the progress bar for the
408     same reason.
409 - The scripts were extracted from a native Windows project, so the component
410   selection is tuned for that: Spectre-mitigated runtimes, the v141/XP toolset,
411   and driver-kit headers. Trim the component lists in the `.ps1` if you don't
412   need them — each group is a plain array near the top.
413
414 ## Running on ARM64
415
416 All three scripts detect the host architecture and adapt. Nothing needs a flag —
417 run `setup-windows.bat` exactly as on x64.
418
419 **The two architectures deliberately install different things.** x64 is the full
420 workstation; ARM64 is provisioned as a lean build box with a single C/C++
421 compiler. See
422 [ARM64 installs less, on purpose](#arm64-installs-less-on-purpose) below for the
423 list and the reasoning.
424
425 ### Detecting the architecture
426
427 All three scripts read the **machine-level registry value**, not the environment
428 and not `RuntimeInformation.OSArchitecture`. Both of those report the *emulated*
429 architecture inside an emulated x64 process — which is what you get by launching
430 `powershell` or `cmd` from an x64 shell (Git Bash, for one) on an ARM64 box.
431 Measured on this machine, from that emulated shell:
432
433 | source | reports |
434 | --- | --- |
435 | `[RuntimeInformation]::OSArchitecture` | `X64` ✗ |
436 | `%PROCESSOR_ARCHITECTURE%` | `AMD64` ✗ |
437 | `HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment` | `ARM64` ✓ |
438
439 `OSArchitecture` is documented as the *OS's* architecture, and on .NET Core it
440 is; under .NET Framework on Prism it is not. It is kept only as a fallback. This
441 used to be a cosmetic mislabel in a log line — now that the architecture decides
442 which packages are installed at all, reading it wrong provisions the wrong
443 machine.
444
445 > The batch file calls `reg.exe` by full path and parses it **without** piping to
446 > `find`/`findstr`. Both are shadowable by anything earlier on the `PATH`, and a
447 > POSIX `find` turns the whole detection into a silent no-op that leaves the
448 > emulated answer standing. That is not hypothetical; it is how this was found.
449
450 **The build toolchain is fully native.** Visual Studio's ARM64 installer and MSVC
451 are ARM64 binaries, and MSVC cross-compiles every target from an ARM64 host with
452 no emulation in the compiler:
453
454 ```bat
455 cmake -B build -A ARM64   && cmake --build build --config Release   :: native
456 cmake -B build -A x64     && cmake --build build --config Release   :: cross
457 cmake -B build -A Win32   && cmake --build build --config Release   :: cross
458 ```
459
460 **ARM64 uses Visual Studio 2026** (`$VsChannel = 18`) while x64 stays on VS 2022.
461 Nothing forces that split — the Arm box simply has no reason to stay on the older
462 generation, since the `v141`/XP toolset that pins x64 there cannot run on Arm at
463 all — so Arm takes the newer MSVC. Note this is a *default*, not a limitation:
464 VS 2026 does still offer `v141` and `WinXP` as components on x64.
465
466 The base component group now names `VC.Tools.x86.x64` **and** `VC.Tools.ARM64`
467 explicitly instead of relying on `--includeRecommended`, which resolves
468 differently per host: on an ARM64 machine the workload's recommended set is the
469 ARM64-targeting toolchain, and the x64 cross-compiler is *not* implied. Spectre
470 runtimes and ATL are likewise requested for both target families
471 (`VC.ATL.ARM64.Spectre` is a separate component from `VC.ATL.Spectre`).
472
473 ### ARM64 installs less, on purpose
474
475 The ARM64 machine here is a constrained VM, and nearly everything it was
476 installing without a native build was going to run under Prism emulation anyway.
477 The exceptions were individually defensible and collectively a VM full of x64
478 binaries. So the split is now explicit: **ARM64 gets MSVC and nothing that
479 duplicates it or that exists only as an x64 binary.**
480
481 | dropped on ARM64 | where | why |
482 | --- | --- | --- |
483 | `Brave.Brave` | `setup-windows.bat` | no ARM64 build; an emulated browser is the slowest thing on the box, and Edge is in-box and native |
484 | `WinMerge.WinMerge` | `setup-windows.bat` | ARM64 ships as a **machine-scope** installer only, so an unelevated `winget` can install nothing but the emulated x64 build |
485 | `LLVM.LLVM` | `setup-windows.bat` | second Clang, dropped along with VS's `clang-cl` |
486 | `NASM.NASM` | `setup-windows.bat` | x86/x86-64 assembler with no ARM64 target; MSVC's `armasm64.exe` is the native one |
487 | `Google.AndroidGPUInspector` | `setup-windows.bat` | x64-only, and it profiles Android devices rather than anything compiled here |
488 | `OpenCppCoverage` | `setup-windows.bat` | collects coverage by stepping x86/x64 instructions, so it cannot instrument an ARM64 binary at all |
489 | VS Clang/LLVM component | `setup-windows-with-uac.ps1` | see below |
490 | Windows Driver Kit | `setup-windows-with-uac.ps1` | see below |
491 | BinSkim | `setup-windows-no-uac.ps1` | the NuGet package publishes `win-x64` only |
492 | Android Studio (`Google.AndroidStudio`) | `setup-windows.bat` | Google publishes no Windows ARM64 build |
493 | Android SDK | `setup-windows-no-uac.ps1` | its Windows build tools are x86/x64 only, as is Android Studio |
494
495 x64 keeps every one of them. The decision is made in one place,
496 `setup-windows-steps.ps1` (`-X64Only`, with the reason): the plan shows each as
497 `[-]` with that reason, and the run log repeats it where the step would have
498 run, rather than leaving a silent gap.
499
500 **`clang-cl` is dropped by choice, not by limitation.** A native ARM64 `clang-cl`
501 *is* offered on Arm and did work here before the split. Two things establish
502 that: the `VC.Llvm.Clang` VSIX is `productArch=neutral` with no `chip` or
503 `machineArch` restriction, so the Arm installer offers it; and MSVC's
504 `VC\Tools\Llvm` tree is partitioned by **host** architecture, with real ARM64
505 binaries in `ARM64\bin`, which is where `clang-cl.exe` lands:
506
507 | directory | host |
508 | --- | --- |
509 | `VC\Tools\Llvm\bin` | x86 |
510 | `VC\Tools\Llvm\x64\bin` | x64 |
511 | `VC\Tools\Llvm\ARM64\bin` | ARM64 |
512
513 > Watch for a false positive when checking by hand: `VC\Tools\Llvm\*\bin` holds
514 > `clang-format.exe` and `clang-tidy.exe` on **any** host, installed or not —
515 > those ship with the NativeDesktop workload. Their presence does not mean the
516 > compiler is there; look for `clang-cl.exe`.
517
518 Note that the VS installer never uninstalls a component you simply stopped
519 asking for, so a box provisioned before this split keeps its `clang-cl` until it
520 is explicitly removed. The verification step says so and prints the
521 `--remove` line.
522
523 **The WDK is dropped for two reasons, and the second one bites on x64 too.** The
524 ARM64 box builds user-mode software, so it does not need a driver kit — but this
525 particular WDK *cannot* install here regardless. The kit requires the **matching
526 Windows SDK revision**, and revisions are not side-by-side: `Include\10.0.26100.0`
527 is one directory, whichever revision wrote it. VS 2026 installs SDK
528 **26100.7705**; `linkid=2335869` is WDK **26100.6584**, the kit paired with VS
529 2022. `wdksetup.exe /quiet` therefore aborts:
530
531 ```
532 WDK installer exit code: 15605
533 WER: WDK / 10.1.26100.6584 / Install / 0x80070642
534 ```
535
536 `0x642` is `1602`, `ERROR_INSTALL_USEREXIT` — a silent install cancelling itself
537 on a failed prerequisite check. Nothing to do with Arm or emulation; the same
538 pairing fails on x64. If a driver ever does need building against VS 2026, use
539 the kit Microsoft's [supported WDK downloads](https://learn.microsoft.com/en-us/windows-hardware/drivers/other-wdk-downloads)
540 table pairs with it — the 28000.x one — not this link. x64 with VS 2022 has the
541 matched pair, so it installs there.
542
543 **Compiler diversity now lives on the x64 box**, which has room for three
544 toolchains: MSVC, VS's `clang-cl`, and **upstream LLVM** (`winget install
545 LLVM.LLVM`). Upstream runs on its own schedule, is usually several major versions
546 ahead of the Clang VS bundles, and installs to `C:\Program Files\LLVM` rather
547 than inside the VS tree, so the two are genuinely independent. Two Clang majors
548 plus MSVC over the same sources is what catches the bugs a single toolchain
549 agrees with itself about. Watch the `PATH` there: a bare `clang-cl` may resolve
550 to upstream while CMake's `-T ClangCL` keeps using VS's, so pass a full
551 `-DCMAKE_CXX_COMPILER` when it matters.
552
553 **Rust is on both boxes, and native on ARM64.** It is a different language
554 rather than a second C/C++ compiler, so it does not bend the one-compiler rule,
555 and its `-msvc` toolchain links through MSVC's own `link.exe`. The ARM64 box
556 gets `stable-aarch64-pc-windows-msvc`; to build x64 Rust code from there, add
557 the x64 *target* (`rustup target add x86_64-pc-windows-msvc`) rather than an x64
558 host toolchain, which would run emulated.
559
560 What you end up with on ARM64:
561
562 | | On ARM64 |
563 | --- | --- |
564 | **Native ARM64** | Git, Python, .NET SDK, PowerShell, VS Code, Windows Terminal, Sysinternals, Claude Code, CMake, Ninja, the VS installer, **MSVC**, MSBuild, the SDK tools (`rc`, `signtool`), rustup and **Rust** (`stable-aarch64-pc-windows-msvc`), the in-box OpenSSH client, and the Windows Performance Toolkit. |
565 | **Emulated** | `iperf3` (x64; network-bound), `adb` and `fastboot` (x86 — Google ships no other Windows build; bound by the USB/TCP link to the device), and the ADK *installer* (x64; the toolkit it lays down is native). |
566 | **Emulated, minor** | `py.exe` (python.org ships the launcher shim as x86; it execs the native `python.exe`) and `vswhere.exe` (Microsoft ships x86 only; runs once). |
567 | **Not installed** | Brave, WinMerge, upstream LLVM, NASM, Android GPU Inspector, OpenCppCoverage, BinSkim, VS `clang-cl`, the WDK, and the Android SDK — see the table above. |
568 | **Unavailable** | VirtualBox, the Windows 7 x86 test VM, Intel VTune, Android Studio, and the `v141` / Windows XP targeting toolset. |
569
570 ### The architecture audit
571
572 `setup-windows-no-uac.ps1` ends with an **`ArchAudit`** step that reads the PE
573 COFF header of every tool the box provisions and reports what you would actually
574 run, resolved PATH-first. It reads the file itself rather than trusting package
575 metadata — a multi-architecture package (Sysinternals) ships every build in one
576 zip under different names, and an installer's metadata says nothing about which
577 binary landed. Purely informational; it never fails the run. Skip it with
578 `-Skip ArchAudit`.
579
580 Anything emulated with a listed reason prints as expected. Anything emulated
581 *without* one is called out, with a remedy where a native build exists — which is
582 how the `ninja` problem below was found.
583
584 ### Elevation, and the case where there is no prompt
585
586 `setup-windows.bat` works out **once, at the top**, whether this account can
587 elevate, and reports it as `Elevation: ALREADY | PROMPT | NOLUA`:
588
589 | | |
590 | --- | --- |
591 | `ALREADY` | Already elevated. The elevated half runs **directly** — no point asking to elevate what already is. |
592 | `PROMPT` | Not elevated, UAC on. Elevation is requested: an administrator gets a consent prompt, a standard user gets an over-the-shoulder **credential** prompt. |
593 | `NOLUA` | UAC is off machine-wide (`EnableLUA = 0`) **and** this is not an administrator. Elevation is *impossible*, not merely declined. |
594
595 `IsInRole(Administrator)` is false for an admin running unelevated under UAC,
596 which is what makes `ALREADY` mean *actually elevated* rather than *could be*.
597
598 **Why `NOLUA` needs detecting rather than attempting.** `Start-Process -Verb
599 RunAs` is not honest about it. With UAC disabled the `RunAs` verb is **silently
600 ignored**: no prompt appears, the child starts with the caller's own unelevated
601 token, and `Start-Process` reports **exit code 0** as though it had worked. The
602 elevated script then refuses itself on its `#Requires -RunAsAdministrator` line,
603 exits 1, and never reaches its `Start-Transcript` — so there is no log either.
604 Read naively that is indistinguishable from a cancelled UAC prompt, which is
605 exactly what this script used to report, sending you to look for a prompt that
606 could never have appeared.
607
608 Measured on such a box: `Start-Process -Verb RunAs` returned exit 0 while the
609 child reported itself as the *unelevated* calling user.
610
611 **What is skipped when elevation is impossible.** The elevated half, plus four
612 packages that sit in the "per-user" section but are machine-wide installers.
613 They used to fail on every run with opaque codes — `exit 5`
614 (`ERROR_ACCESS_DENIED`) for the .NET SDK, MSI `1603` for CMake and Android GPU
615 Inspector, `exit 1` for OpenCppCoverage, whose installer self-elevates. They are
616 now shown as unavailable in the plan, with the reason, and skipped with one
617 clear line each. None blocks a build: the .NET SDK is
618 only there for the WiX MSI tooling, CMake also ships inside Visual Studio, AGI
619 profiles Android devices, and OpenCppCoverage cannot instrument ARM64 binaries
620 anyway.
621
622 A `NOLUA` run is a **success** (exit 0), not a failure — the per-user half did
623 its job. To finish the box, run it from an administrator account, then re-run
624 `setup-windows-no-uac.ps1` as yourself so the per-user `PATH` and `.gitconfig`
625 land in *your* profile rather than the administrator's.
626
627 Two consequences worth knowing rather than rediscovering:
628
629 - **LLVM does not fail — it relocates.** Its NSIS installer targets
630   `%ProgramFiles%\LLVM`, and when it cannot write there it silently falls back to
631   a per-user directory (observed: `%USERPROFILE%\Documents\LLVM`) while winget
632   still reports *Successfully installed*. The compiler is genuinely there and
633   native; nothing can find it. The `LlvmPath` step looks in that fallback, puts
634   the directory on the user `PATH`, and says so.
635 - **WinMerge silently downgrades to x64.** Upstream publishes ARM64 as a
636   **machine-scope** installer and x64 as a **per-user** one, so an unelevated
637   winget lets its scope preference beat its architecture preference. The batch
638   now asks for `--architecture arm64` first and falls back, so an admin run gets
639   the native build and a standard-user run still gets a working one.
640
641 ### Two gotchas the audit surfaces
642
643 - **Visual Studio bundles an x64 `ninja.exe` even on ARM64.** It matters more
644   than a one-off tool would, because ninja is re-invoked for every edge in the
645   build graph — it is the one place emulation is paid over and over rather than
646   once. `winget install Ninja-build.Ninja` gets the native `ninja-winarm64`
647   build, and the `NinjaPath` step pins its directory to the **front** of the user
648   `PATH`. VS's bundled `cmake.exe` *is* ARM64, so only ninja has this problem.
649
650   On which copy wins inside a Developer Command Prompt: the native one. VS adds
651   its ninja from `Common7\Tools\vsdevcmd\ext\cmake.bat`, which does
652   `set "PATH=%PATH%;...\CMake\bin;...\CMake\Ninja"` — an **append**, so the VS
653   directories land at the very end of the composed `PATH`, behind every machine
654   and user entry. A native ninja anywhere on the user `PATH` already beats it,
655   measured on an ARM64 box. The `NinjaPath` step is therefore insurance rather
656   than the load-bearing fix: winget *appends* its package directory to the user
657   `PATH`, so without it the margin rests on two append orders staying as they
658   are, one of them in a file Microsoft owns and revises.
659 - **Sysinternals ships every architecture in one zip**, and the ARM64 build is
660   not the default-named exe. `ProcessExplorer.zip` contains `procexp.exe` (x86),
661   `procexp64.exe` (x64) and `procexp64a.exe` (**ARM64**) — so run the `*64a.exe`
662   variants; plain `procexp.exe` runs emulated. (`Microsoft.Sysinternals.Suite`
663   has a dedicated `SysinternalsSuite-ARM64.zip` if you prefer the whole set.)
664
665 - **x64 emulation is checked, not assumed.** Everything in the "emulated" row
666   needs Prism, which is present on Windows 11 on Arm but absent on Windows 10 on
667   Arm (x86-only there) and on some Server images. The elevated half tests for
668   `System32\xtajit64.dll` up front and warns, rather than letting the failure
669   surface much later as a binary that will not start.
670 - **VirtualBox is skipped.** There is no ARM64 Windows host build, and the x64
671   one cannot be rescued by emulation: a hypervisor is kernel-mode, and its x64
672   driver will not load on an ARM64 kernel. This is also what makes
673   `setup-windows-7-test-env.bat` unreachable from an ARM64 host — it prepares a
674   Windows 7 *x86* guest, which neither VirtualBox nor Hyper-V on ARM64 can run.
675   (That script itself is unchanged; it runs inside the guest, so it never sees
676   the host architecture.)
677 - **VirtualBox is also skipped inside a virtual machine**, on any architecture.
678   The planner reads the firmware's SMBIOS manufacturer and model
679   (`Win32_ComputerSystem`) and recognises VirtualBox, VMware, Hyper-V (and
680   Azure), QEMU/KVM, Parallels, Xen, EC2 and GCE; the plan's `machine:` line
681   names what it found. It does not use `HypervisorPresent`, which is also true
682   on physical hardware running Hyper-V, WSL2 or VBS. The test VMs belong on the
683   physical host.
684 - **The `v141` / Windows XP toolset is skipped**, and the verification step says
685   `n/a` instead of warning about it. The components are still *listed* in the
686   catalog on Arm, so this is a deliberate skip rather than a hard unavailability
687   — but the 14.16 toolset predates Windows on Arm as a host and ships
688   `HostX86`/`HostX64` compilers only, so the best you could get is an
689   x86-emulated compiler, and XP targeting is not supported from an Arm host.
690   Nothing is lost that this box could have used:
691   Windows XP never ran on ARM64, so the only point of an XP-targeting build here
692   would be producing x86 binaries, which the current toolset does natively via
693   `-A Win32`.
694 - **OpenCppCoverage is no longer installed on ARM64.** Unlike the rest of the
695   emulated row this was a real ceiling rather than a slowdown: it collects
696   coverage by debugging the process under test and stepping x86/x64
697   instructions, so it can cover cross-compiled x86/x64 binaries but **not** an
698   ARM64 one. A coverage tool that cannot cover this machine's own output belongs
699   on the x64 box, which is where it still installs. Run coverage there.
700 - **BinSkim is no longer installed on ARM64 either**, though the reason is
701   weaker: the NuGet package publishes `win-x64` only (its other RIDs are
702   `linux-x64`, `linux-arm64`, `osx-x64`), but BinSkim *reads* PE headers and load
703   configs, so its own architecture is independent of the binaries it analyses —
704   an emulated x64 BinSkim checks ARM64 binaries perfectly well. It went with the
705   rest of the x64-only set to keep the rule simple, not because it was broken.
706   The RID list is still ordered preference on x64, so a future `win-arm64` build
707   would be picked up with no further change.
708 - **`rsync` is native on ARM64 now**, and its `ssh.exe` is still verified by
709   running it. The release publishes an `arm64` asset as of `v3.5.0-gdeeda96f`;
710   both binaries in it are `0xAA64`, and the `ssh.exe` reports
711   `OpenSSH_for_Windows_10.0p2 ... LibreSSL 3.8.2` on this box.
712
713   Before that asset existed, ARM64 took the x64 zip. The `rsync.exe` was fine —
714   a transfer is bounded by the socket, not by emulated CPU — but its `ssh.exe`
715   links against `System32\libcrypto.dll`, which on ARM64 is an **ARM64** binary
716   an x64 process cannot load. It died with `0xC0000135`
717   (`STATUS_DLL_NOT_FOUND`) and had to be deleted on every run. That matters more
718   than it sounds: `rsync.exe` *prefers* an `ssh.exe` in its own directory, so a
719   present-but-broken one does not degrade to the in-box client — it breaks rsync
720   outright, with an error naming a dead remote shell rather than `ssh.exe`.
721
722   The elevated half still runs `ssh -V` after unpacking and **deletes** the
723   binary if it will not start. The check is kept because it is what found that
724   problem, and it still covers a missing or too-old `libcrypto.dll` on any
725   architecture. An x64 `rsync.exe` surviving on an ARM64 box now shows up in the
726   audit as emulation *without* a listed reason, with a remedy pointing at a
727   re-run. The `core.sshCommand` step in the non-elevated half already picked its
728   candidate by running it, and is unchanged.
729 - **Intel VTune reports `n/a`** rather than printing a download link: there is no
730   Windows-on-Arm build, and its value is reading Intel PMU counters. Use the
731   Windows Performance Toolkit (`wpr`/`xperf` to collect, `wpa` to analyse), or
732   Arm Performance Studio / Streamline for Arm PMU sampling.
733 - **NASM is not installed on ARM64.** It assembles x86/x86-64 only — there is no
734   ARM64 target in it and no ARM64 build of it — so it went into the x64-only set
735   with the rest. The ARM64 assembler is `armasm64.exe`, which ships with MSVC.
736   Its installer is also one of the two here that fall back to a per-user
737   directory it never registers (`%LOCALAPPDATA%\bin\NASM`), so `winget uninstall`
738   cannot find it afterwards; the `Uninstall.exe` in that directory is the way out.
739 - **`vswhere` stays under the 32-bit Program Files** on ARM64 too
740   (`%ProgramFiles(x86)%\Microsoft Visual Studio\Installer`), so that path is
741   unchanged. The VS Installer is x86-registered there by contract even though the
742   installer binaries themselves are native.
743 - **The WDK registry probe reads both hives.** `wdksetup.exe` is 32-bit and
744   writes under `WOW6432Node` on x64, but which hive a kit lands in has varied
745   across versions and architectures, and reading only one made an installed WDK
746   look absent — costing a needless multi-GB reinstall on every run.