Returns `Ok(true)` if DISM reports a reboot is required (HRESULT 3010).
(&self, name: &str)
| 458 | |
| 459 | /// Returns `Ok(true)` if DISM reports a reboot is required (HRESULT 3010). |
| 460 | pub fn add_capability(&self, name: &str) -> Result<bool, String> { |
| 461 | let add_cap = self.api.add_capability |
| 462 | .ok_or_else(|| t!("dism.capabilitiesNotSupported").to_string())?; |
| 463 | |
| 464 | let wide_name = to_wide_null(name); |
| 465 | let hr = unsafe { |
| 466 | add_cap( |
| 467 | self.handle, |
| 468 | wide_name.as_ptr(), |
| 469 | 0, // LimitAccess = FALSE |
| 470 | std::ptr::null(), // SourcePaths |
| 471 | 0, // SourcePathCount |
| 472 | std::ptr::null_mut(), // CancelEvent |
| 473 | std::ptr::null_mut(), // Progress |
| 474 | std::ptr::null_mut(), // UserData |
| 475 | ) |
| 476 | }; |
| 477 | if hr < 0 { |
| 478 | return Err(t!("dism.addCapabilityFailed", name = name, hr = format!("0x{:08X}", hr as u32)).to_string()); |
| 479 | } |
| 480 | Ok(hr == ERROR_SUCCESS_REBOOT_REQUIRED) |
| 481 | } |
| 482 | |
| 483 | /// Returns `Ok(true)` if DISM reports a reboot is required (HRESULT 3010). |
| 484 | pub fn remove_capability(&self, name: &str) -> Result<bool, String> { |
no test coverage detected