Add registry section
This commit is contained in:
parent
b63927d3ef
commit
e55a254be9
2 changed files with 86 additions and 2 deletions
|
|
@ -56,7 +56,7 @@ use tracing::{debug, info};
|
||||||
|
|
||||||
use crate::diags::{
|
use crate::diags::{
|
||||||
DiagGroup, Type as DiagType, get_diag_type, parse_bcd, parse_bitlocker, parse_chkdsk,
|
DiagGroup, Type as DiagType, get_diag_type, parse_bcd, parse_bitlocker, parse_chkdsk,
|
||||||
parse_dism, parse_system_files,
|
parse_dism, parse_registry_hives, parse_system_files,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct App {
|
pub struct App {
|
||||||
|
|
@ -473,7 +473,23 @@ impl App {
|
||||||
parse_system_files(current_group, task_result.clone());
|
parse_system_files(current_group, task_result.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => (),
|
DiagType::Registry => {
|
||||||
|
if let Some(task_result) = &task.result {
|
||||||
|
match &task.task_type {
|
||||||
|
TaskType::CommandWait(_, cmd_args) => {
|
||||||
|
parse_registry_hives(
|
||||||
|
current_group,
|
||||||
|
task_result.clone(),
|
||||||
|
cmd_args.clone(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DiagType::Unknown => {
|
||||||
|
panic!("This shouldn't happen?");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.action_tx.send(Action::DiagLineUpdate {
|
self.action_tx.send(Action::DiagLineUpdate {
|
||||||
result: current_group.get_pass_fail_warn(),
|
result: current_group.get_pass_fail_warn(),
|
||||||
|
|
|
||||||
|
|
@ -383,6 +383,74 @@ pub fn parse_dism(diag_group: &mut DiagGroup, task_result: TaskResult) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn parse_registry_hives(
|
||||||
|
diag_group: &mut DiagGroup,
|
||||||
|
task_result: TaskResult,
|
||||||
|
cmd_args: Vec<String>,
|
||||||
|
) {
|
||||||
|
if !cfg!(windows) {
|
||||||
|
sleep(Duration::from_millis(500));
|
||||||
|
return ();
|
||||||
|
}
|
||||||
|
let hive = cmd_args.get(2);
|
||||||
|
match task_result {
|
||||||
|
TaskResult::Error(err) => {
|
||||||
|
diag_group.passed.push(false);
|
||||||
|
diag_group.result = String::from("Error");
|
||||||
|
diag_group.logs.push(Log {
|
||||||
|
label: String::from("Registry"),
|
||||||
|
summary: if hive.is_some() {
|
||||||
|
vec![DVLine {
|
||||||
|
line_parts: vec![
|
||||||
|
format!("Registry ({}): ", hive.unwrap()),
|
||||||
|
String::from("Error"),
|
||||||
|
],
|
||||||
|
line_colors: vec![Color::Reset, Color::Red],
|
||||||
|
}]
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
},
|
||||||
|
raw: err,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
TaskResult::Output(stdout, stderr, passed) => {
|
||||||
|
let output_text = if stderr.is_empty() {
|
||||||
|
stdout.clone()
|
||||||
|
} else {
|
||||||
|
format!("{stdout}\n\n{stderr}")
|
||||||
|
};
|
||||||
|
|
||||||
|
if passed {
|
||||||
|
diag_group.passed.push(true);
|
||||||
|
diag_group.result = String::from("OK");
|
||||||
|
diag_group.logs.push(Log {
|
||||||
|
label: String::from("Registry"),
|
||||||
|
summary: Vec::new(),
|
||||||
|
raw: output_text,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
diag_group.passed.push(false);
|
||||||
|
diag_group.result = String::from("Error");
|
||||||
|
diag_group.logs.push(Log {
|
||||||
|
label: String::from("Registry"),
|
||||||
|
summary: if hive.is_some() {
|
||||||
|
vec![DVLine {
|
||||||
|
line_parts: vec![
|
||||||
|
format!("Registry ({}): ", hive.unwrap()),
|
||||||
|
String::from("Error"),
|
||||||
|
],
|
||||||
|
line_colors: vec![Color::Reset, Color::Red],
|
||||||
|
}]
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
},
|
||||||
|
raw: output_text,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn parse_system_files(diag_group: &mut DiagGroup, task_result: TaskResult) {
|
pub fn parse_system_files(diag_group: &mut DiagGroup, task_result: TaskResult) {
|
||||||
if !cfg!(windows) {
|
if !cfg!(windows) {
|
||||||
sleep(Duration::from_millis(500));
|
sleep(Duration::from_millis(500));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue