desktop: read StartupApproved through the registry API, no reg.exe (the security test allows no other programs)

This commit is contained in:
CRTkafa 2026-10-25 21:11:31 +08:00
parent 53845c6dd9
commit d43c95db7e
4 changed files with 18 additions and 22 deletions

View file

@ -146,9 +146,9 @@ fn background_updater_schedule_and_defer() {
#[test]
fn startup_apps_choice_is_read_from_startup_approved() {
use storebound_desktop::startup_approved_off;
let on = "\r\nHKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved\\Run\r\n storebound REG_BINARY 020000000000000000000000\r\n";
let off = "\r\nHKEY_CURRENT_USER\\Run\r\n storebound REG_BINARY 0300000020D1D3B1F0B3DC01\r\n";
assert!(!startup_approved_off(on));
assert!(startup_approved_off(off));
assert!(!startup_approved_off("ERROR: The system was unable to find the specified registry key or value."));
assert!(!startup_approved_off(&[0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
assert!(!startup_approved_off(&[0x06, 0, 0, 0]));
assert!(startup_approved_off(&[0x03, 0, 0, 0, 0x20, 0xD1, 0xD3, 0xB1, 0xF0, 0xB3, 0xDC, 0x01]));
assert!(startup_approved_off(&[0x07]));
assert!(!startup_approved_off(&[]));
}