windows_erg/registry/
types.rs1use windows::Win32::System::Registry::*;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum Hive {
8 ClassesRoot,
10 CurrentUser,
12 LocalMachine,
14 Users,
16 CurrentConfig,
18}
19
20impl Hive {
21 pub(crate) fn as_hkey(&self) -> HKEY {
22 match self {
23 Hive::ClassesRoot => HKEY_CLASSES_ROOT,
24 Hive::CurrentUser => HKEY_CURRENT_USER,
25 Hive::LocalMachine => HKEY_LOCAL_MACHINE,
26 Hive::Users => HKEY_USERS,
27 Hive::CurrentConfig => HKEY_CURRENT_CONFIG,
28 }
29 }
30
31 pub(crate) fn as_short_name(&self) -> &'static str {
32 match self {
33 Hive::ClassesRoot => "HKCR",
34 Hive::CurrentUser => "HKCU",
35 Hive::LocalMachine => "HKLM",
36 Hive::Users => "HKU",
37 Hive::CurrentConfig => "HKCC",
38 }
39 }
40}
41
42#[derive(Debug, Clone, Copy, PartialEq, Eq)]
44pub enum Access {
45 Read,
47 Write,
49 ReadWrite,
51 AllAccess,
53}
54
55impl Access {
56 pub(crate) fn to_sam_flags(self) -> u32 {
57 match self {
58 Access::Read => KEY_READ.0,
59 Access::Write => KEY_WRITE.0,
60 Access::ReadWrite => KEY_READ.0 | KEY_WRITE.0,
61 Access::AllAccess => KEY_ALL_ACCESS.0,
62 }
63 }
64}
65
66#[derive(Debug, Clone, Copy, PartialEq, Eq)]
68pub(crate) enum Wow64View {
69 Key32,
71 Key64,
73}
74
75impl Wow64View {
76 pub(crate) fn to_sam_flags(self) -> u32 {
77 match self {
78 Wow64View::Key32 => 0x0200, Wow64View::Key64 => 0x0100, }
81 }
82}