Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add 'raw_handle' function and impl 'send' trait for 'RegKey' #18

Merged
merged 1 commit into from
Jun 1, 2018

Conversation

WLBF
Copy link
Contributor

@WLBF WLBF commented May 15, 2018

I was wirting something like:

let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
let reg_key = hklm.open_subkey(r#"SOFTWARE\Microsoft\Windows\CurrentVersion"#).unwrap();

let handle = builder.spawn(move || {
    unsafe {
        let ret = RegNotifyChangeKeyValue(
            reg_key.raw_handle(),
            watch_subtree as i32,
            notify_filter,
            wait_handle.handle(),
            true as i32,
        );
        .....
    }
})?;

I thing add raw_handle function to RegKey allow us use RegKey in ffi programming. Since winapi::shared::minwindef::HKEY is a raw pointer, it should be fine to implement send trait for RegKey.

@gentoo90 gentoo90 merged commit 05f7abb into gentoo90:master Jun 1, 2018
@gentoo90
Copy link
Owner

gentoo90 commented Jun 1, 2018

Thanks! Published to crates.io as 0.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants