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

Function QueryInfoKey

crates/vm/src/stdlib/winreg.rs:613–646  ·  view source on GitHub ↗
(key: HKEYArg, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

611
612 #[pyfunction]
613 fn QueryInfoKey(key: HKEYArg, vm: &VirtualMachine) -> PyResult<PyRef<PyTuple>> {
614 let key = key.0;
615 let mut lpcsubkeys: u32 = 0;
616 let mut lpcvalues: u32 = 0;
617 let mut lpftlastwritetime: Foundation::FILETIME = unsafe { core::mem::zeroed() };
618 let err = unsafe {
619 Registry::RegQueryInfoKeyW(
620 key,
621 core::ptr::null_mut(),
622 core::ptr::null_mut(),
623 0 as _,
624 &mut lpcsubkeys,
625 core::ptr::null_mut(),
626 core::ptr::null_mut(),
627 &mut lpcvalues,
628 core::ptr::null_mut(),
629 core::ptr::null_mut(),
630 core::ptr::null_mut(),
631 &mut lpftlastwritetime,
632 )
633 };
634
635 if err != 0 {
636 return Err(vm.new_os_error(format!("error code: {err}")));
637 }
638 let l: u64 = (lpftlastwritetime.dwHighDateTime as u64) << 32
639 | lpftlastwritetime.dwLowDateTime as u64;
640 let tup: Vec<PyObjectRef> = vec![
641 vm.ctx.new_int(lpcsubkeys).into(),
642 vm.ctx.new_int(lpcvalues).into(),
643 vm.ctx.new_int(l).into(),
644 ];
645 Ok(vm.ctx.new_tuple(tup))
646 }
647
648 #[pyfunction]
649 fn QueryValue(key: HKEYArg, sub_key: Option<String>, vm: &VirtualMachine) -> PyResult<String> {

Callers 4

_write_test_dataMethod · 0.85
_delete_test_dataMethod · 0.85
test_changing_valueMethod · 0.85
test_long_keyMethod · 0.85

Calls 3

new_os_errorMethod · 0.80
ErrClass · 0.50
new_tupleMethod · 0.45

Tested by 4

_write_test_dataMethod · 0.68
_delete_test_dataMethod · 0.68
test_changing_valueMethod · 0.68
test_long_keyMethod · 0.68