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

Function DeleteValue

crates/vm/src/stdlib/winreg.rs:383–394  ·  view source on GitHub ↗
(key: PyRef<PyHkey>, value: Option<String>, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

381
382 #[pyfunction]
383 fn DeleteValue(key: PyRef<PyHkey>, value: Option<String>, vm: &VirtualMachine) -> PyResult<()> {
384 let wide_value = value.map(|v| v.to_wide_with_nul());
385 let value_ptr = wide_value
386 .as_ref()
387 .map_or(core::ptr::null(), |v| v.as_ptr());
388 let res = unsafe { Registry::RegDeleteValueW(key.hkey.load(), value_ptr) };
389 if res == 0 {
390 Ok(())
391 } else {
392 Err(vm.new_os_error(format!("error code: {res}")))
393 }
394 }
395
396 #[derive(FromArgs, Debug)]
397 struct DeleteKeyExArgs {

Callers 1

_delete_test_dataMethod · 0.85

Calls 7

to_wide_with_nulMethod · 0.80
new_os_errorMethod · 0.80
ErrClass · 0.50
mapMethod · 0.45
as_refMethod · 0.45
as_ptrMethod · 0.45
loadMethod · 0.45

Tested by 1

_delete_test_dataMethod · 0.68