MCPcopy Create free account
hub / github.com/PowerShell/DSC / disable_feature

Method disable_feature

resources/dism_dsc/src/dism.rs:346–363  ·  view source on GitHub ↗

Returns `Ok(true)` if DISM reports a reboot is required (HRESULT 3010).

(&self, feature_name: &str, remove_payload: bool)

Source from the content-addressed store, hash-verified

344
345 /// Returns `Ok(true)` if DISM reports a reboot is required (HRESULT 3010).
346 pub fn disable_feature(&self, feature_name: &str, remove_payload: bool) -> Result<bool, String> {
347 let wide_name = to_wide_null(feature_name);
348 let hr = unsafe {
349 (self.api.disable_feature)(
350 self.handle,
351 wide_name.as_ptr(),
352 std::ptr::null(), // PackageName
353 i32::from(remove_payload), // RemovePayload
354 std::ptr::null_mut(), // CancelEvent
355 std::ptr::null_mut(), // Progress
356 std::ptr::null_mut(), // UserData
357 )
358 };
359 if hr < 0 {
360 return Err(t!("dism.disableFeatureFailed", name = feature_name, hr = format!("0x{:08X}", hr as u32)).to_string());
361 }
362 Ok(hr == ERROR_SUCCESS_REBOOT_REQUIRED)
363 }
364
365 pub fn get_all_feature_basics(&self) -> Result<Vec<(String, i32)>, String> {
366 let mut features_ptr: *mut DismFeature = std::ptr::null_mut();

Callers 1

handle_setFunction · 0.80

Calls 1

to_wide_nullFunction · 0.85

Tested by

no test coverage detected