(key: PyRef<PyHkey>, sub_key: String, vm: &VirtualMachine)
| 370 | |
| 371 | #[pyfunction] |
| 372 | fn DeleteKey(key: PyRef<PyHkey>, sub_key: String, vm: &VirtualMachine) -> PyResult<()> { |
| 373 | let wide_sub_key = sub_key.to_wide_with_nul(); |
| 374 | let res = unsafe { Registry::RegDeleteKeyW(key.hkey.load(), wide_sub_key.as_ptr()) }; |
| 375 | if res == 0 { |
| 376 | Ok(()) |
| 377 | } else { |
| 378 | Err(vm.new_os_error(format!("error code: {res}"))) |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | #[pyfunction] |
| 383 | fn DeleteValue(key: PyRef<PyHkey>, value: Option<String>, vm: &VirtualMachine) -> PyResult<()> { |