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

Method enable_feature

resources/dism_dsc/src/dism.rs:322–343  ·  view source on GitHub ↗

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

(&self, feature_name: &str)

Source from the content-addressed store, hash-verified

320
321 /// Returns `Ok(true)` if DISM reports a reboot is required (HRESULT 3010).
322 pub fn enable_feature(&self, feature_name: &str) -> Result<bool, String> {
323 let wide_name = to_wide_null(feature_name);
324 let hr = unsafe {
325 (self.api.enable_feature)(
326 self.handle,
327 wide_name.as_ptr(),
328 std::ptr::null(), // Identifier
329 DISM_PACKAGE_NONE, // PackageIdentifier
330 0, // LimitAccess = FALSE
331 std::ptr::null(), // SourcePaths
332 0, // SourcePathCount
333 0, // EnableAll = FALSE
334 std::ptr::null_mut(), // CancelEvent
335 std::ptr::null_mut(), // Progress
336 std::ptr::null_mut(), // UserData
337 )
338 };
339 if hr < 0 {
340 return Err(t!("dism.enableFeatureFailed", name = feature_name, hr = format!("0x{:08X}", hr as u32)).to_string());
341 }
342 Ok(hr == ERROR_SUCCESS_REBOOT_REQUIRED)
343 }
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> {

Callers 1

handle_setFunction · 0.80

Calls 1

to_wide_nullFunction · 0.85

Tested by

no test coverage detected