1use anyhow::Result;
2use std::sync::Arc;
3use std::time::Duration;
4use tokio::io::{AsyncBufReadExt, BufReader};
5use tokio::net::TcpStream;
6use tokio::time::{sleep, timeout};
7
8use crate::timeouts;
9
10pub async fn wait_for_ssh(host: &str, port: u16, timeout_: Duration) -> Result<()> {
19 let deadline = tokio::time::Instant::now() + timeout_;
20 let mut attempt = 0u32;
21 loop {
22 attempt += 1;
23 match TcpStream::connect((host, port)).await {
24 Ok(stream) => {
25 let mut reader = BufReader::new(stream);
26 let mut banner = String::new();
27 let now = tokio::time::Instant::now();
31 let budget = deadline
32 .saturating_duration_since(now)
33 .min(timeouts::SSH_BANNER_READ_BUDGET);
34 match timeout(budget, reader.read_line(&mut banner)).await {
35 Ok(Ok(_)) if banner.starts_with("SSH-") => {
36 tracing::info!("SSH banner after {attempt} polls: {}", banner.trim());
37 return Ok(());
38 }
39 other => {
40 tracing::debug!("poll {attempt}: no SSH banner yet ({other:?})");
41 }
42 }
43 }
44 Err(e) => {
45 tracing::debug!("SSH poll {attempt} refused: {e:#}");
46 }
47 }
48 let now = tokio::time::Instant::now();
49 if now >= deadline {
50 anyhow::bail!(
51 "timed out waiting for SSH on {host}:{port} after {attempt} polls — likely stuck on a GUI prompt"
52 );
53 }
54 sleep(timeouts::SSH_POLL_INTERVAL.min(deadline.saturating_duration_since(now))).await;
60 }
61}
62
63fn reg_probe_command() -> String {
74 [
75 "echo [SETUP]",
76 "reg query \"HKLM\\SYSTEM\\Setup\" /v SetupType 2>nul",
77 "echo [OOBE]",
78 "reg query \"HKLM\\SYSTEM\\Setup\" /v OOBEInProgress 2>nul",
79 "echo [CBS]",
80 "reg query \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Component Based Servicing\\RebootPending\" 2>nul && echo YES || echo NO",
81 "echo [WU]",
82 "reg query \"HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired\" 2>nul && echo YES || echo NO",
83 "echo [END]",
84 ]
85 .join(" & ")
86}
87
88const KNOWN_MARKERS: &[&str] = &["SETUP", "OOBE", "CBS", "WU", "END"];
92
93fn probe_sections(text: &str) -> Option<std::collections::HashMap<&str, Vec<&str>>> {
94 let mut sections = std::collections::HashMap::new();
95 let mut current: Option<&str> = None;
96 let mut seen_marker = false;
97 for line in text.lines() {
98 let t = line.trim();
99 if t.starts_with('[') && t.ends_with(']') {
100 let name = &t[1..t.len() - 1];
101 if let Some(marker) = KNOWN_MARKERS.iter().find(|m| **m == name) {
102 current = Some(*marker);
103 if *marker != "END" {
104 seen_marker = true;
105 }
106 sections.entry(*marker).or_insert_with(Vec::new);
107 continue;
108 }
109 }
110 if let Some(c) = current {
111 sections.entry(c).or_insert_with(Vec::new).push(t);
112 }
113 }
114 if seen_marker { Some(sections) } else { None }
115}
116
117fn probe_dword(section: &[&str]) -> Option<u32> {
120 section
121 .iter()
122 .find(|l| l.contains("REG_DWORD"))
123 .and_then(|l| l.split_whitespace().last())
124 .and_then(|hex| {
125 let clean = hex
126 .strip_prefix("0x")
127 .or_else(|| hex.strip_prefix("0X"))
128 .unwrap_or(hex);
129 u32::from_str_radix(clean, 16).ok()
130 })
131}
132
133struct AcceptAny;
136
137impl russh::client::Handler for AcceptAny {
138 type Error = anyhow::Error;
139 async fn check_server_key(
140 &mut self,
141 _key: &russh::keys::PublicKeyOrCertificate,
142 ) -> Result<bool, Self::Error> {
143 Ok(true)
146 }
147}
148
149async fn authed_session(
150 host: &str,
151 port: u16,
152 user: &str,
153 pass: &str,
154) -> Result<russh::client::Handle<AcceptAny>> {
155 let config = Arc::new(russh::client::Config::default());
156 let mut session = russh::client::connect(config, (host, port), AcceptAny).await?;
157 session.authenticate_password(user, pass).await?;
158 Ok(session)
159}
160
161pub async fn ssh_exec(host: &str, port: u16, user: &str, pass: &str, cmd: &str) -> Result<String> {
175 let session = authed_session(host, port, user, pass).await?;
176 let mut ch = session.channel_open_session().await?;
177 ch.exec(true, cmd).await?;
178 let (out, err) = tokio::time::timeout(timeouts::SSH_EXEC_DRAIN, async {
182 let mut out = Vec::new();
183 let mut err = Vec::new();
184 while let Some(msg) = ch.wait().await {
185 match msg {
186 russh::ChannelMsg::Data { data } => out.extend_from_slice(&data),
187 russh::ChannelMsg::ExtendedData { data, .. } => err.extend_from_slice(&data),
188 russh::ChannelMsg::ExitStatus { .. } => break,
189 _ => {}
190 }
191 }
192 Ok::<_, anyhow::Error>((out, err))
193 })
194 .await
195 .map_err(|_| {
196 anyhow::anyhow!(
197 "exec timed out after {} s (PowerShell cold-start or hung channel)",
198 timeouts::SSH_EXEC_DRAIN.as_secs()
199 )
200 })??;
201 match loud_stderr_message(&out, &err) {
202 Some(msg) => eprintln!("{msg}"),
203 None if !err.is_empty() => {
204 tracing::debug!("guest stderr: {}", String::from_utf8_lossy(&err).trim())
205 }
206 None => {}
207 }
208 Ok(String::from_utf8_lossy(&out).into_owned())
209}
210
211fn loud_stderr_message(out: &[u8], err: &[u8]) -> Option<String> {
216 let text = String::from_utf8_lossy(err);
217 let text = text.trim();
218 if text.is_empty() || !out.iter().all(|b| b.is_ascii_whitespace()) {
219 return None;
220 }
221 Some(format!("guest command produced no stdout — stderr: {text}"))
222}
223
224fn bcdedit_value_verified(out: &str, key: &str, want: &str) -> bool {
226 out.lines().any(|l| {
227 let l = l.trim().to_ascii_lowercase();
228 l.starts_with(key) && l.ends_with(&want.to_ascii_lowercase())
229 })
230}
231
232pub async fn apply_headless_diet(host: &str, port: u16, user: &str, pass: &str) -> Result<()> {
239 const SERVICES: &str = "'Spooler','WSearch','SysMain','DiagTrack','WerSvc','BITS','DoSvc','wisvc','RetailDemo','MapsBroker','Fax','WbioSrvc','PhoneSvc','RemoteRegistry','lfsvc','XblAuthManager','XblGameSave','dmwappushservice'";
240 let cmd = format!(
241 "powershell -NoProfile -Command \"Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private; {SERVICES}|%{{Set-Service -Name $_ -StartupType Disabled -EA SilentlyContinue}}\""
242 );
243 ssh_exec(host, port, user, pass, &cmd).await?;
244 Ok(())
245}
246
247pub async fn set_recovery_enabled(
256 host: &str,
257 port: u16,
258 user: &str,
259 pass: &str,
260 enabled: bool,
261) -> Result<()> {
262 let val = if enabled { "Yes" } else { "No" };
263 let policy = if enabled {
264 "DisplayAllFailures"
265 } else {
266 "IgnoreAllFailures"
267 };
268 ssh_exec(
269 host,
270 port,
271 user,
272 pass,
273 &format!("bcdedit /set {{current}} recoveryenabled {val}"),
274 )
275 .await?;
276 ssh_exec(
277 host,
278 port,
279 user,
280 pass,
281 &format!("bcdedit /set {{current}} bootstatuspolicy {policy}"),
282 )
283 .await?;
284 let en = ssh_exec(host, port, user, pass, "bcdedit /enum {current}").await?;
285 if !bcdedit_value_verified(&en, "recoveryenabled", val) {
286 anyhow::bail!("recoveryenabled {val} unverified (bcdedit /enum): {en:?}");
287 }
288 if !bcdedit_value_verified(&en, "bootstatuspolicy", policy) {
289 anyhow::bail!("bootstatuspolicy {policy} unverified (bcdedit /enum): {en:?}");
290 }
291 eprintln!(
292 "recovery {val} (Automatic Repair {}, boot status policy {policy}, verified)",
293 if enabled { "kept" } else { "disabled" }
294 );
295 Ok(())
296}
297
298pub async fn set_auto_updates(
305 host: &str,
306 port: u16,
307 user: &str,
308 pass: &str,
309 enabled: bool,
310) -> Result<()> {
311 if enabled {
312 ssh_exec(
313 host,
314 port,
315 user,
316 pass,
317 "sc config wuauserv start= auto & sc start wuauserv",
318 )
319 .await?;
320 let qc = ssh_exec(host, port, user, pass, "sc qc wuauserv").await?;
321 if !qc.contains("AUTO_START") {
322 anyhow::bail!("wuauserv enable unverified (sc qc): {qc:?}");
323 }
324 eprintln!("automatic updates enabled (wuauserv, verified)");
325 } else {
326 ssh_exec(
327 host,
328 port,
329 user,
330 pass,
331 "sc config wuauserv start= disabled & sc stop wuauserv",
332 )
333 .await?;
334 let qc = ssh_exec(host, port, user, pass, "sc qc wuauserv").await?;
335 if !qc.contains("DISABLED") {
336 anyhow::bail!("wuauserv disable unverified (sc qc): {qc:?}");
337 }
338 eprintln!("automatic updates disabled (wuauserv, verified)");
339 }
340 Ok(())
341}
342
343pub async fn change_guest_password(
350 host: &str,
351 port: u16,
352 user: &str,
353 old_pass: &str,
354 new_pass: &str,
355) -> Result<()> {
356 tokio::time::timeout(
359 timeouts::SSH_PASSWORD_ROTATION_BUDGET,
360 ssh_exec(
361 host,
362 port,
363 user,
364 old_pass,
365 &format!("net user {user} \"{new_pass}\""),
366 ),
367 )
368 .await
369 .map_err(|_| anyhow::anyhow!("password change timed out"))??;
370 let verified = tokio::time::timeout(
371 timeouts::SSH_PASSWORD_ROTATION_BUDGET,
372 probe_setup_done(host, port, user, new_pass),
373 )
374 .await
375 .map_err(|_| anyhow::anyhow!("rotated-password login timed out"))??;
376 if !verified.is_ready() {
377 anyhow::bail!("rotated password rejected by guest");
378 }
379 Ok(())
380}
381
382pub const DEFAULT_PTY_TERM: &str = "xterm";
385
386pub async fn interactive_shell(host: &str, port: u16, user: &str, pass: &str) -> Result<()> {
390 use tokio::io::{AsyncReadExt, AsyncWriteExt};
391 let session = authed_session(host, port, user, pass).await?;
392 let mut ch = session.channel_open_session().await?;
393 let mut term_size = crossterm::terminal::size().unwrap_or((80, 24));
399 ch.request_pty(
400 false,
401 DEFAULT_PTY_TERM,
402 term_size.0.into(),
403 term_size.1.into(),
404 0,
405 0,
406 &[],
407 )
408 .await?;
409 ch.request_shell(false).await?;
410 struct RawGuard;
412 impl Drop for RawGuard {
413 fn drop(&mut self) {
414 let _ = crossterm::terminal::disable_raw_mode();
415 }
416 }
417 crossterm::terminal::enable_raw_mode().map_err(|e| {
418 anyhow::anyhow!("raw mode needs a terminal ({e:#}); refusing shell on piped stdio")
419 })?;
420 let _guard = RawGuard;
421 eprintln!("shell open — Ctrl-D or `exit` to leave (Ctrl-C always goes to the guest)");
422 let mut stdin = tokio::io::stdin();
423 let mut stdout = tokio::io::stdout();
424 let mut inbuf = vec![0u8; 1024];
425 let mut resize_tick = tokio::time::interval(std::time::Duration::from_millis(500));
433 loop {
434 tokio::select! {
435 _ = resize_tick.tick() => {
436 let cur = crossterm::terminal::size().unwrap_or(term_size);
437 if cur != term_size {
438 term_size = cur;
439 let _ = ch.window_change(cur.0.into(), cur.1.into(), 0, 0).await;
440 }
441 }
442 r = stdin.read(&mut inbuf) => {
443 let n = r?;
444 if n == 0 {
445 break; }
447 ch.data(&inbuf[..n]).await?;
448 }
449 msg = ch.wait() => {
450 match msg {
451 Some(russh::ChannelMsg::Data { data }) => {
452 stdout.write_all(&data).await?;
453 stdout.flush().await?;
454 }
455 Some(russh::ChannelMsg::ExtendedData { data, .. }) => {
456 stdout.write_all(&data).await?;
457 stdout.flush().await?;
458 }
459 Some(russh::ChannelMsg::ExitStatus { .. }) | None => break,
460 _ => {}
461 }
462 }
463 }
464 }
465 while crossterm::event::poll(std::time::Duration::from_millis(50)).unwrap_or(false) {
469 let _ = crossterm::event::read();
470 }
471 Ok(())
472}
473
474pub async fn prove_interactive_shell(host: &str, port: u16, user: &str, pass: &str) -> Result<()> {
482 const MARKER: &str = "GOLDEN_SHELL_PROBE_READY";
483 let session = authed_session(host, port, user, pass).await?;
484 let mut ch = session.channel_open_session().await?;
485 ch.request_pty(false, DEFAULT_PTY_TERM, 80, 24, 0, 0, &[])
486 .await?;
487 ch.request_shell(false).await?;
488 ch.data(format!("echo {MARKER}\r\n").as_bytes()).await?;
489 tokio::time::timeout(timeouts::READINESS_PROBE_BUDGET, async {
490 let mut seen = Vec::new();
491 loop {
492 match ch.wait().await {
493 Some(russh::ChannelMsg::Data { data })
494 | Some(russh::ChannelMsg::ExtendedData { data, .. }) => {
495 seen.extend_from_slice(&data);
496 if seen.windows(MARKER.len()).any(|w| w == MARKER.as_bytes()) {
497 return Ok::<_, anyhow::Error>(());
498 }
499 }
500 Some(russh::ChannelMsg::ExitStatus { .. }) | None => {
501 anyhow::bail!("shell closed before answering");
502 }
503 _ => {}
504 }
505 }
506 })
507 .await
508 .map_err(|_| {
509 anyhow::anyhow!(
510 "no shell prompt within {} s — interactive logon is not usable",
511 timeouts::READINESS_PROBE_BUDGET.as_secs()
512 )
513 })??;
514 Ok(())
515}
516
517#[derive(Debug, Clone, PartialEq, Eq)]
522pub enum GuestProgress {
523 Ready,
524 Busy(String),
526}
527
528impl GuestProgress {
529 pub fn is_ready(&self) -> bool {
530 matches!(self, GuestProgress::Ready)
531 }
532}
533
534#[derive(Debug)]
538pub struct ProbeOutputBroken(pub String);
539
540impl std::fmt::Display for ProbeOutputBroken {
541 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
542 f.write_str(&self.0)
543 }
544}
545
546impl std::error::Error for ProbeOutputBroken {}
547
548pub async fn probe_setup_done(
559 host: &str,
560 port: u16,
561 user: &str,
562 pass: &str,
563) -> Result<GuestProgress> {
564 let text = ssh_exec(host, port, user, pass, ®_probe_command()).await?;
565 let sections = probe_sections(&text).ok_or_else(|| {
566 anyhow::Error::new(ProbeOutputBroken(format!(
567 "unparseable probe output: {text:?}"
568 )))
569 })?;
570 progress_from_sections(§ions)
571}
572
573fn progress_from_sections(
576 sections: &std::collections::HashMap<&str, Vec<&str>>,
577) -> Result<GuestProgress> {
578 let get = |name: &str| sections.get(name).map(Vec::as_slice).unwrap_or(&[]);
579 let setup = probe_dword(get("SETUP"));
582 let oobe = probe_dword(get("OOBE")).unwrap_or(0);
583 let cbs = get("CBS").contains(&"YES");
584 let wu = get("WU").contains(&"YES");
585 for (name, lines) in [("CBS", get("CBS")), ("WU", get("WU"))] {
588 if !lines.iter().any(|l| *l == "YES" || *l == "NO") {
589 return Err(anyhow::Error::new(ProbeOutputBroken(format!(
590 "probe section {name} has no verdict: {lines:?}"
591 ))));
592 }
593 }
594 if setup == Some(0) && oobe == 0 && !cbs && !wu {
595 return Ok(GuestProgress::Ready);
596 }
597 tracing::debug!("guest probe busy: setup={setup:?} oobe={oobe} cbs={cbs} wu={wu}");
599 Ok(GuestProgress::Busy(pending_description(
600 setup, oobe, cbs, wu,
601 )))
602}
603
604fn pending_description(setup: Option<u32>, oobe: u32, cbs: bool, wu: bool) -> String {
607 let mut parts: Vec<String> = Vec::new();
608 match setup {
609 Some(0) => {}
610 Some(v) => parts.push(format!("Windows Setup in progress (SetupType={v})")),
611 None => parts.push("Setup state unreadable".into()),
612 }
613 if oobe != 0 {
614 parts.push("OOBE pending".into());
615 }
616 if cbs {
617 parts.push("component-servicing reboot pending".into());
618 }
619 if wu {
620 parts.push("Windows Update reboot pending".into());
621 }
622 if parts.is_empty() {
623 parts.push("finishing up".into());
624 }
625 parts.join(", ")
626}
627
628#[cfg(test)]
629mod tests {
630 use super::*;
631
632 #[tokio::test]
633 async fn fast_fail_on_closed_port() {
634 let err = wait_for_ssh("127.0.0.1", 1, Duration::from_millis(100))
635 .await
636 .unwrap_err();
637 assert!(format!("{err:#}").contains("timed out"));
638 }
639
640 #[tokio::test]
641 async fn succeeds_on_ssh_banner() {
642 use tokio::io::AsyncWriteExt;
643 let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
644 let port = listener.local_addr().unwrap().port();
645 tokio::spawn(async move {
646 let (mut sock, _) = listener.accept().await.unwrap();
647 sock.write_all(b"SSH-2.0-OpenSSH_for_Windows_9.5\r\n")
648 .await
649 .unwrap();
650 sleep(Duration::from_secs(5)).await;
652 });
653 wait_for_ssh("127.0.0.1", port, Duration::from_secs(30))
654 .await
655 .unwrap();
656 }
657
658 #[tokio::test]
659 async fn silent_accept_is_not_ready() {
660 let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
663 let port = listener.local_addr().unwrap().port();
664 tokio::spawn(async move {
665 loop {
666 let _ = listener.accept().await;
667 }
668 });
669 let err = wait_for_ssh("127.0.0.1", port, Duration::from_secs(1))
670 .await
671 .unwrap_err();
672 assert!(format!("{err:#}").contains("timed out"));
673 }
674
675 #[tokio::test]
679 #[ignore]
680 async fn live_probe_reports_state() {
681 let state = probe_setup_done("127.0.0.1", 2232, "AdminUser", "P@ssw0rd123!")
682 .await
683 .unwrap();
684 eprintln!("guest setup state: {state:?}");
685 }
686
687 #[tokio::test]
690 #[ignore]
691 async fn live_exec_whoami() {
692 let out = ssh_exec("127.0.0.1", 2232, "AdminUser", "P@ssw0rd123!", "whoami")
693 .await
694 .unwrap();
695 assert!(out.contains("adminuser"), "unexpected whoami: {out:?}");
696 }
697
698 #[test]
699 fn reg_probe_parses_sample_output() {
700 let text = "[SETUP]\n SetupType REG_DWORD 0x0\n[OOBE]\nERROR: The system was unable to find the specified registry key or value.\n[CBS]\nERROR: The system was unable to find the specified registry key or value.\nNO\n[WU]\nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired\nYES\n[END]\n";
703 let sections = probe_sections(text).unwrap();
704 let get = |name: &str| sections.get(name).map(Vec::as_slice).unwrap_or(&[]);
705 assert_eq!(probe_dword(get("SETUP")), Some(0));
706 assert_eq!(probe_dword(get("OOBE")), None);
707 assert!(get("CBS").contains(&"NO"));
708 assert!(get("WU").contains(&"YES"));
709 let busy = "[SETUP]\n SetupType REG_DWORD 0x2\n[OOBE]\n OOBEInProgress REG_DWORD 0x1\n[END]\n";
711 let s2 = probe_sections(busy).unwrap();
712 assert_eq!(
713 probe_dword(s2.get("SETUP").map(Vec::as_slice).unwrap_or(&[])),
714 Some(2)
715 );
716 assert!(probe_sections("garbage\nmore garbage\n").is_none());
718 let cmd = reg_probe_command();
720 assert!(!cmd.contains('\n'));
721 for marker in ["[SETUP]", "[OOBE]", "[CBS]", "[WU]", "[END]"] {
722 assert!(cmd.contains(marker), "missing {marker}");
723 }
724 }
725
726 #[test]
727 fn probe_verdicts_read_as_progress_not_failure() {
728 let ready = "[SETUP]\n SetupType REG_DWORD 0x0\n[OOBE]\n OOBEInProgress REG_DWORD 0x0\n[CBS]\nNO\n[WU]\nNO\n[END]\n";
730 let sections = probe_sections(ready).unwrap();
731 assert!(progress_from_sections(§ions).unwrap().is_ready());
732
733 let mid = "[SETUP]\n SetupType REG_DWORD 0x2\n[OOBE]\n OOBEInProgress REG_DWORD 0x1\n[CBS]\nNO\n[WU]\nNO\n[END]\n";
735 let sections = probe_sections(mid).unwrap();
736 assert_eq!(
737 progress_from_sections(§ions).unwrap(),
738 GuestProgress::Busy("Windows Setup in progress (SetupType=2), OOBE pending".into())
739 );
740
741 let broken = "[SETUP]\n SetupType REG_DWORD 0x0\n[OOBE]\n[CBS]\n[WU]\nNO\n[END]\n";
744 let sections = probe_sections(broken).unwrap();
745 let err = progress_from_sections(§ions).unwrap_err();
746 assert!(
747 err.downcast_ref::<ProbeOutputBroken>().is_some(),
748 "want ProbeOutputBroken, got {err:#}"
749 );
750 }
751
752 #[test]
753 fn probe_command_suppresses_expected_stderr() {
754 let cmd = reg_probe_command();
759 let queries = cmd.matches("reg query").count();
760 assert_eq!(queries, 4, "expected four reg queries: {cmd}");
761 assert_eq!(cmd.matches("2>nul").count(), queries, "unsilenced: {cmd}");
762 }
763
764 #[test]
765 fn stderr_is_loud_only_when_it_changes_the_reading() {
766 let err = b"ERROR: the key does not exist\r\n";
767 assert!(loud_stderr_message(b"", err).is_some());
770 assert!(loud_stderr_message(b"HKEY_LOCAL_MACHINE\\...\r\n", err).is_none());
772 assert!(loud_stderr_message(b"ok", b"").is_none());
773 }
774
775 #[test]
776 fn bcdedit_enum_lines_verify_both_switches() {
777 let enum_out = "Windows Boot Manager\n---------------------\nidentifier {bootmgr}\n\nWindows Boot Loader\n-------------------\nidentifier {current}\npath \\Windows\\System32\\winload.efi\ndescription Windows 11\nrecoveryenabled No\nbootstatuspolicy IgnoreAllFailures\n";
780 assert!(bcdedit_value_verified(enum_out, "recoveryenabled", "No"));
781 assert!(bcdedit_value_verified(
782 enum_out,
783 "bootstatuspolicy",
784 "IgnoreAllFailures"
785 ));
786 assert!(!bcdedit_value_verified(
788 enum_out,
789 "bootstatuspolicy",
790 "DisplayAllFailures"
791 ));
792 assert!(!bcdedit_value_verified(
794 "nrecoveryenabled No\n",
795 "recoveryenabled",
796 "No"
797 ));
798 assert!(!bcdedit_value_verified(
800 "garbage\n",
801 "recoveryenabled",
802 "No"
803 ));
804 }
805}