winreg 0.52.0

Rust bindings to MS Windows Registry API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2023, Igor Shaula
// Licensed under the MIT License <LICENSE or
// http://opensource.org/licenses/MIT>. This file
// may not be copied, modified, or distributed
// except according to those terms.
#![macro_use]

macro_rules! with_key {
    ($k:ident, $path:expr => $b:block) => {{
        let mut path = "Software\\WinRegRsTest".to_owned();
        path.push_str($path);
        let ($k, _disp) = winreg::RegKey::predef(winreg::enums::HKEY_CURRENT_USER)
            .create_subkey(&path).unwrap();
        $b
        winreg::RegKey::predef(winreg::enums::HKEY_CURRENT_USER)
        .delete_subkey_all(path).unwrap();
    }}
}