MCPcopy Index your code
hub / github.com/RustPython/RustPython / OpenKey

Function OpenKey

crates/vm/src/stdlib/winreg.rs:589–610  ·  view source on GitHub ↗
(args: OpenKeyArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

587 #[pyfunction]
588 #[pyfunction(name = "OpenKeyEx")]
589 fn OpenKey(args: OpenKeyArgs, vm: &VirtualMachine) -> PyResult<PyHkey> {
590 let wide_sub_key = args.sub_key.to_wide_with_nul();
591 let mut res: Registry::HKEY = core::ptr::null_mut();
592 let err = unsafe {
593 let key = args.key.hkey.load();
594 Registry::RegOpenKeyExW(
595 key,
596 wide_sub_key.as_ptr(),
597 args.reserved,
598 args.access,
599 &mut res,
600 )
601 };
602 if err == 0 {
603 Ok(PyHkey {
604 #[allow(clippy::arc_with_non_send_sync)]
605 hkey: AtomicHKEY::new(res),
606 })
607 } else {
608 Err(os_error_from_windows_code(vm, err as i32))
609 }
610 }
611
612 #[pyfunction]
613 fn QueryInfoKey(key: HKEYArg, vm: &VirtualMachine) -> PyResult<PyRef<PyTuple>> {

Callers 8

delete_registry_treeFunction · 0.90
setup_moduleFunction · 0.90
delete_treeMethod · 0.85
_read_test_dataMethod · 0.85
_delete_test_dataMethod · 0.85
test_reflectionMethod · 0.85

Calls 6

newFunction · 0.85
to_wide_with_nulMethod · 0.80
ErrClass · 0.50
loadMethod · 0.45
as_ptrMethod · 0.45

Tested by 8

delete_registry_treeFunction · 0.72
setup_moduleFunction · 0.72
delete_treeMethod · 0.68
_read_test_dataMethod · 0.68
_delete_test_dataMethod · 0.68
test_reflectionMethod · 0.68