| 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>> { |