pub struct RegKey { /* private fields */ }
Expand description
The safe representation of a Windows registry key.
Implementations§
Source§impl RegKey
impl RegKey
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>
pub fn delete_self(self, is_recursive: bool) -> Result<(), Error>
pub fn value<S>(&self, value_name: S) -> Result<Data, Error>
pub fn delete_value<S>(&self, value_name: S) -> Result<(), Error>
pub fn set_value<S>(&self, value_name: S, data: &Data) -> Result<(), Error>
Sourcepub fn keys(&self) -> Keys<'_> ⓘ
pub fn keys(&self) -> Keys<'_> ⓘ
Examples found in repository?
More examples
examples/private-hive.rs (line 16)
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}
pub fn values(&self) -> Values<'_> ⓘ
pub fn open_current_user(sec: Security) -> Result<RegKey, Error>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RegKey
impl RefUnwindSafe for RegKey
impl !Send for RegKey
impl !Sync for RegKey
impl Unpin for RegKey
impl UnwindSafe for RegKey
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