You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(installer): replace raw FFI with winreg crate for registry access
The zero-dependency pattern made sense for vite_trampoline (copied 5-10
times as shim files) but not for a single downloadable installer where
readability matters more. Switch from 225 lines of unsafe raw Win32 FFI
to ~80 lines of safe Rust using the winreg crate (~50-100 KB after LTO).
WM_SETTINGCHANGE broadcast still uses a single raw FFI call since
winreg doesn't wrap SendMessageTimeoutW.
Note: Windows registry access uses raw FFI (~0 KB overhead) instead of the `winreg` crate, following the same zero-dependency pattern as `vite_trampoline`.
467
-
468
471
Use `opt-level = "z"` (optimize for size) in package profile override, matching the trampoline approach.
469
472
470
473
## Alternatives Considered
@@ -490,12 +493,12 @@ Like rustup, make `vp.exe` detect when called as `vp-setup.exe` and switch to in
490
493
491
494
Embed the PowerShell script in a self-extracting exe. Fragile, still requires PowerShell runtime.
492
495
493
-
### 4. Use `winreg` Crate vs Raw FFI for PATH (Decision: Raw FFI)
496
+
### 4. Use `winreg` Crate vs Raw FFI for PATH (Decision: `winreg`)
- Raw Win32 FFI: Zero external dependencies, matches `vite_trampoline` pattern, slightly more code
498
+
- `winreg` crate: Higher-level safe API, ~50-100 KB after LTO, significantly less code (~80 lines vs ~225 lines)
499
+
- Raw Win32 FFI: Zero dependencies but 225 lines of unsafe code with manual UTF-16 encoding and registry choreography
497
500
- PowerShell subprocess: Proven in `install.ps1` but adds process spawn overhead and PowerShell dependency
498
-
- Decision: Use raw FFI for direct registry access — keeps the installer dependency-free for Win32 operations, consistent with the trampoline's approach
501
+
- Decision: Use `winreg` for registry access — the zero-dependency pattern makes sense for `vite_trampoline` (copied 5-10 times as shims) but not for a single downloadable installer where readability matters more. `WM_SETTINGCHANGE` broadcast still uses a single raw FFI call since `winreg` doesn't wrap it.
0 commit comments