#[non_exhaustive]pub enum Hive {
ClassesRoot,
CurrentConfig,
CurrentUser,
CurrentUserLocalSettings,
LocalMachine,
PerformanceData,
Users,
}Expand description
All hives of the Windows Registry. Start here to get to a registry key.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl Hive
impl Hive
pub fn open<P>(&self, path: P, sec: Security) -> Result<RegKey, Error>
pub fn write<P>(&self, file_path: P) -> Result<(), Error>
pub fn create<P>(&self, path: P, sec: Security) -> Result<RegKey, Error>
pub fn delete<P>(&self, path: P, is_recursive: bool) -> Result<(), Error>
Sourcepub fn load_file<P: AsRef<Path>>(
file_path: P,
sec: Security,
) -> Result<RegKey, Error>
pub fn load_file<P: AsRef<Path>>( file_path: P, sec: Security, ) -> Result<RegKey, Error>
Examples found in repository?
More examples
examples/private-hive.rs (lines 10-13)
4fn main() -> Result<(), windows::core::Error> {
5 let mut token = HANDLE::default();
6 unsafe { OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &mut token)? };
7
8 set_privilege(token, SE_RESTORE_NAME)?;
9 set_privilege(token, SE_BACKUP_NAME)?;
10 let hive_key = Hive::load_file(
11 r"C:\Users\Default\NTUSER.DAT",
12 Security::Read | Security::Write,
13 )
14 .unwrap();
15
16 let keys: Vec<_> = hive_key.keys().map(|k| k.unwrap().to_string()).collect();
17
18 println!("{:?}", keys);
19 Ok(())
20}Trait Implementations§
impl Copy for Hive
Auto Trait Implementations§
impl Freeze for Hive
impl RefUnwindSafe for Hive
impl Send for Hive
impl Sync for Hive
impl Unpin for Hive
impl UnwindSafe for Hive
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more