Repository navigation
feat: list and uninstall Windows apps with raven env apps and raven env uninstall - #70
Conversation
…n env uninstall` Adds `raven env apps [name] [--all]` to list Windows applications registered under `Uninstall` in `system.reg` (`HKLM`, including `Wow6432Node`) and `user.reg` (`HKCU`), hiding system components, sub-updates, and non-removable entries by default. Adds `raven env uninstall <app> [--env <name>] [--quiet] [--remove-entry]` to resolve a registered app by exact name/key or unique substring and run its Windows uninstaller inside the environment's session via `raven run`, removing both files and registry entries. When an uninstaller binary is already missing on disk, `--remove-entry` removes the stale `Uninstall` registry entry directly (offline when stopped, or via `wine reg delete` while a session is running).
`raven env apps` and `raven env uninstall` now run `wine uninstaller
--list` and `--remove <key>` inside the environment instead of reading and
editing system.reg and user.reg themselves.
Wine's uninstaller reads the same Uninstall keys under HKLM, its 32-bit
view and HKCU, leaves out system components, and runs the command a
program registered, or `msiexec /x{key}` for a Windows Installer one.
Going through it removes what the offline reader got wrong: Wine's \x
escapes were not decoded, so a name with an accent no longer matched and
its entry was reported stale; a quoted %VAR% command failed under
`cmd /c`; any `/I...` argument was rewritten to `/X...`; the files were
read while the session's wineserver could still hold newer data; and
`--remove-entry` edited them by hand. When an uninstaller is gone, Wine
offers to take the program off the list, which replaces --remove-entry.
- `raven env apps [name]` prints each program's name and key. A stopped
environment's session is started for it and stopped again afterwards.
The list is written to a file, not a pipe: Wine's services started by
the first program of a session would hold a pipe open.
- `raven env uninstall <name> <app>` takes the environment first, as the
other env subcommands do, and the program by key, exact name or a part
of a name no other program has. --quiet and --remove-entry go: no
uninstaller is reliably silent, and the stale case is Wine's dialog.
- Names are printed with control characters replaced.
Tried on a real environment: the list matched what Wine registered, and
uninstalling a test entry whose UninstallString deletes its own key ran it
and removed it from the list. 254 tests.
- Wine prints `uninstaller --list` in code page 1252, and stops a line at a character 1252 has no match for, gluing the next entry onto it. Only the last two fields of a line are taken now, so such a program is left out instead of lending its key to the next one. 0x80 to 0x9F are read as 1252's characters (’ – ™ €), not Latin-1's control characters, and names have control characters replaced before they are printed. - A key listed twice (HKLM and HKCU) counts as one program, the first Wine lists with it, which is the one `--remove` runs. - When `raven run` cannot start, its own message is part of the error instead of only an exit status. - A listing stops the session it started only if nothing of the user's joined it meanwhile. - `--remove-entry` is back, through `wine reg delete` in the environment, for HKLM, its 32-bit view and HKCU: Wine 11's uninstaller asks whether to take a program whose uninstaller is gone off the list, but deletes the key through a handle it has already closed, so the answer changes nothing. - Help and guide say most uninstallers ask before removing anything, not that all do. Tried on a real environment: an HKCU entry pointing at a missing uninstaller was listed, then taken off the list. 256 tests.
0b3c293 to
01a9f4a
Compare
|
Thank you for this, it covers something people will need. It's merged in a510e06 and shipped in v0.8.0, in a different shape from the one you sent, so here is the reasoning. Wine already ships an
The matching rules are yours: a key, an exact name, or a part of a name no other program has. |
My pleasure! That's wonderful. I wasn't aware that Wine had this option, and your solution is definitely cleaner. Just one thing to bear in mind: in my experience, some Windows applications are installed without an uninstaller. That's why I included the "Remove Entry Only" option as a fallback, so that even if an uninstaller isn't available, the corresponding registry entries can still be removed. I genuinely love your product, and it has become my daily driver. The fact that I can use Windows applications just like native Linux applications, with such seamless integration, is fantastic. Thank you so much for creating such a great product and for all the hard work you've put into it! |
Summary
Adds
raven env appsandraven env uninstallso users can list Windows programs registered in an environment and run their registered uninstallers (cleaning up both files and registry entries):raven env apps [name] [--all]: readsUninstallkeys fromsystem.reg(HKLM, includingWow6432Node) anduser.reg(HKCU), decoding strings,str(1)/str(2),dword, and multi-line UTF-16LEhex(1)/hex(2)values. Filters outSystemComponent=1,ParentKeyName,NoRemove=1, and entries with no uninstaller unless--allis passed.raven env uninstall <app> [--env <name>] [--quiet] [--remove-entry]:.exeuninstall command lines, rewritesMsiExec.exe /I{...}to/X{...}(adding/qnwith--quiet), handles%VAR%viacmd /c, checks thatC:\...uninstaller binaries exist, and runs the uninstaller inside the environment's session viaraven run.--remove-entryis given (e.g. for stale entries whose uninstaller is already missing), deletes theUninstallkey offline fromsystem.reg/user.regwhile stopped or viawine reg deletewhile running.README.mdanddocs/guide/usage.md, and adds unit + CLI integration tests.Verification
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test --locked(all 260 workspace tests passed)