Del via


DismDisableFeature function

Disables a feature in the current image.

Syntax

HRESULT WINAPI DismDisableFeature(
  _In_     DismSession            Session,
  _In_     PCWSTR                 FeatureName,
  _In_opt_ PCWSTR                 PackageName,
  _In_     BOOL                   RemovePayload,
  _In_opt_ HANDLE                 CancelEvent,
  _In_opt_ DISM_PROGRESS_CALLBACK Progress,
  _In_opt_ PVOID                  UserData
);

Parameters

Session [in]
A valid DismSession. The DismSession must be associated with an image. You can associate a session with an image by using the DismOpenSession.

FeatureName [in]
The name of the feature that you want to disable. To disable more than one feature, separate each feature name with a semicolon.

PackageName [in, optional]
Optional. The name of the parent package that the feature is a part of. If no package is specified, then the default Windows Foundation package is used.

RemovePayload [in]
This parameter is not supported starting withWindows 8.1 and Windows Server 2012 R2.

Windows 8 and Windows Server 2012:

A Boolean value specifying whether to remove the files required to enable the feature.

Value Description
TRUE The files are removed.
FALSE The files are not removed.

CancelEvent [in, optional]
Optional. You can set a CancelEvent for this function in order to cancel the operation in progress when signaled by the client. If the CancelEvent is received at a stage when the operation cannot be canceled, the operation will continue and return a success code. If the CancelEvent is received and the operation is canceled, the image state is unknown. You should verify the image state before continuing or discard the changes and start again.

Progress [in, optional]
Optional. A pointer to a client-defined DismProgressCallback.

UserData [in, optional]
Optional. User defined custom data.

Return value

Returns S_OK on success.

Example

HRESULT hr = S_OK;
hr = DismDisableFeature(Session, "WindowsMediaPlayer", NULL, FALSE, NULL, NULL, NULL);

Requirements

Requirement Description
Supported host platforms DISM API can be used on any operating system supported by the Windows Assessment and Deployment Kit (Windows ADK). For more information, see the Windows ADK Technical Reference.
Supported image platforms Windows 7, Windows Server 2008 R2, Windows PE 3.0, Windows 8, Windows Server 2012, Windows Preinstallation Environment (Windows PE) 4.0, Windows 8.1, Windows Server 2012 R2, Windows 10, Windows Server 2016
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Header DismAPI.h
Library DismAPI.lib
DLL DismAPI.dll

See also

DismEnableFeature

DismGetFeatures

DismGetFeatureInfo