(path: &str, permission: Security)
| 412 | } |
| 413 | |
| 414 | fn open_regkey(path: &str, permission: Security) -> Result<(RegKey, &str), RegistryError> { |
| 415 | let (hive, subkey) = get_hive_from_path(path)?; |
| 416 | match hive.open(subkey, permission) { |
| 417 | Ok(regkey) => Ok((regkey, subkey)), |
| 418 | // handle NotFound error |
| 419 | Err(key::Error::NotFound(_, _)) => { |
| 420 | Err(RegistryError::RegistryKeyNotFound(path.to_string())) |
| 421 | }, |
| 422 | Err(e) => Err(RegistryError::RegistryKey(e)), |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | fn get_parent_key_path(key_path: &str) -> &str { |
| 427 | match key_path.rfind('\\') { |
no test coverage detected