retep998/winapi-rs — pull request #23 by gentoo90 (2014-12-17 21:55:48+00:00)
Title: Registry API

- [ ] GetSystemRegistryQuota
- [ ] RegCloseKey
- [ ] RegConnectRegistry
- [ ] RegCopyTree
- [x] RegCreateKeyEx
- [ ] RegCreateKeyTransacted
- [ ] RegDeleteKey
- [ ] RegDeleteKeyEx
- [ ] RegDeleteKeyTransacted
- [ ] RegDeleteKeyValue
- [ ] RegDeleteTree
- [ ] RegDeleteValue
- [ ] RegDisablePredefinedCache
- [ ] RegDisablePredefinedCacheEx
- [ ] RegDisableReflectionKey
- [ ] RegEnableReflectionKey
- [ ] RegEnumKeyEx
- [ ] RegEnumValue
- [ ] RegFlushKey
- [ ] RegGetKeySecurity
- [ ] RegGetValue
- [ ] RegLoadKey
- [ ] RegLoadMUIString
- [ ] RegNotifyChangeKeyValue
- [ ] RegOpenCurrentUser
- [ ] RegOpenKeyEx
- [ ] RegOpenKeyTransacted
- [ ] RegOpenUserClassesRoot
- [ ] RegOverridePredefKey
- [ ] RegQueryInfoKey
- [ ] RegQueryMultipleValues
- [ ] RegQueryReflectionKey
- [ ] RegQueryValueEx
- [ ] RegReplaceKey
- [ ] RegRestoreKey
- [ ] RegSaveKey
- [ ] RegSaveKeyEx
- [ ] RegSetKeyValue
- [ ] RegSetKeySecurity
- [ ] RegSetValueEx
- [ ] RegUnLoadKey

Usage example:
```rust
extern crate winapi;
use std::ptr;

fn main() {
let mut h_key: winapi::HKEY = ptr::null_mut();
let mut disp: winapi::DWORD = 0;

let path_a = "Software\\RegistrySampleRustA\\".to_c_str();
let res_a = unsafe{
winapi::RegCreateKeyExA(
winapi::HKEY_CURRENT_USER,
path_a.as_ptr(),
0,
ptr::null(),
winapi::REG_OPTION_NON_VOLATILE,
winapi::KEY_WRITE,
ptr::null_mut(),
&mut h_key,
&mut disp
)
};
println!("RegCreateKeyExA returned {}, disposition = {}", res_a, disp);

let mut path_w: Vec = "Software\\RegistrySampleRustW\\".utf16_units().collect();
path_w.push(0);
let res_w = unsafe{
winapi::RegCreateKeyExW(
winapi::HKEY_CURRENT_USER,
path_w.as_ptr(),
0,
ptr::null(),
winapi::REG_OPTION_NON_VOLATILE,
winapi::KEY_WRITE,
ptr::null_mut(),
&mut h_key,
&mut disp
)
};
println!("RegCreateKeyExW returned {}, disposition = {}", res_w, disp);
}

```