- installing or removing the driver is refused unless the services are stopped (or failed), and a service start or restart (and a second driver task) is refused while one runs, so the monitor never vanishes under the bot browser's window - a failed or declined install undoes what that attempt made (device, and the registry value and settings folder when the driver was not ours before); a declined install's 0xE0000243 reads as cancelled; installed means ours with its monitor there - devices are found among all root devices whatever their class: a device whose driver was declined drops out of the display class and was left behind - uninstall keeps the registry value (what makes it ours) until the device and the driver package are gone (a package not in the store, 1168, counts as gone), so a failed removal can be retried - checked on the win-ci VM: a declined install leaves nothing, the next install gives one working device, the uninstall leaves nothing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.6 KiB
Rust
31 lines
1.6 KiB
Rust
//! Installing and removing the virtual monitor's driver through the app's elevated half
|
|
//! (admin.spec.md, "Virtual monitor"). Windows only, with the driver files in `display-driver/` next
|
|
//! to this program and `JARVIS_TEST_VDISPLAY=install` or `uninstall`, or `install-declined` (the
|
|
//! person answers no to Windows' question: the install fails and leaves nothing installed); Windows
|
|
//! asks for the administrator (and on install whether to trust the SignPath Foundation). Elsewhere
|
|
//! it skips.
|
|
//! No test harness: started elevated, this same program is the elevated half.
|
|
|
|
fn main() {
|
|
let args: Vec<String> = std::env::args().collect();
|
|
if let Some(code) = jarvis_app::vdisplay::elevated_main(&args) {
|
|
std::process::exit(code);
|
|
}
|
|
let Ok(action) = std::env::var("JARVIS_TEST_VDISPLAY") else {
|
|
eprintln!("skipped: set JARVIS_TEST_VDISPLAY=install|install-declined|uninstall");
|
|
return;
|
|
};
|
|
let rt = tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap();
|
|
let declined = action == "install-declined";
|
|
let outcome = rt.block_on(jarvis_app::vdisplay::run_elevated(if declined { "install" } else { &action }));
|
|
let status = jarvis_app::vdisplay::status();
|
|
println!("{action}: {outcome:?} -> {status:?}");
|
|
if declined {
|
|
assert!(outcome.is_err(), "a declined install fails");
|
|
} else {
|
|
outcome.expect("the elevated half succeeds");
|
|
}
|
|
assert_eq!(status.installed, action == "install");
|
|
assert!(!status.other, "nothing this app made looks like another program's driver");
|
|
}
|