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

Function CreateKeyEx

crates/vm/src/stdlib/winreg.rs:339–364  ·  view source on GitHub ↗
(args: CreateKeyExArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

337
338 #[pyfunction]
339 fn CreateKeyEx(args: CreateKeyExArgs, vm: &VirtualMachine) -> PyResult<PyHkey> {
340 let wide_sub_key = args.sub_key.to_wide_with_nul();
341 let mut res: Registry::HKEY = core::ptr::null_mut();
342 let err = unsafe {
343 let key = args.key.hkey.load();
344 Registry::RegCreateKeyExW(
345 key,
346 wide_sub_key.as_ptr(),
347 args.reserved,
348 core::ptr::null(),
349 Registry::REG_OPTION_NON_VOLATILE,
350 args.access,
351 core::ptr::null(),
352 &mut res,
353 core::ptr::null_mut(),
354 )
355 };
356 if err == 0 {
357 Ok(PyHkey {
358 #[allow(clippy::arc_with_non_send_sync)]
359 hkey: AtomicHKEY::new(res),
360 })
361 } else {
362 Err(vm.new_os_error(format!("error code: {err}")))
363 }
364 }
365
366 #[pyfunction]
367 fn CloseKey(hkey: PyRef<PyHkey>, vm: &VirtualMachine) -> PyResult<()> {

Callers 4

_test_named_argsMethod · 0.85
test_reflectionMethod · 0.85

Calls 6

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

Tested by 4

_test_named_argsMethod · 0.68
test_reflectionMethod · 0.68