Del via


DismAddCapability function

Adds a capability to an image.

Syntax

HRESULT WINAPI DismAddCapability(
  _In_     DismSession             Session,
  _In_     PCWSTR                  Name,
  _In_     BOOL                    LimitAccess,
  _In_     PCWSTR*                 SourcePaths,
  _In_opt_ UINT                    SourcePathCount,
  _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.

Name [in]
The name of the capability that is being added.

LimitAccess [in]
The flag indicates whether WU/WSUS should be contacted as a source location for downloading the payload of a capability. If payload of the capability to be added exists, the flag is ignored.

SourcePaths [in]
A list of source locations. The function shall look up removed payload files from the locations specified in SourcePaths, and if not found, continue the search by contacting WU/WSUS depending on parameter LimitAccess.

SourcePathCount [in, optional]
The count of entries in SourcePaths.

CancelEvent [in, optional]
This is a handle to an event for cancellation.

Progress [in, optional]
Pointer to a client defined callback function to report progress.

UserData [in, optional]
User defined custom data. This will be passed back to the user through the callback.

Return value

Returns S_OK on success.

Remarks

Use this function to add a capability.

Example

HRESULT hr = S_OK;
hr = DismAddCapability(Session, L“Language.Basic~~~en-US~0.0.1.0”, TRUE, NULL, 0, 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 10, Windows Server 2016
Minimum supported client Windows 10 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Header DismAPI.h
Library DismAPI.lib
DLL DismAPI.dll

See also

DismAddDriver

DismEnableFeature

DismGetPackages

DismGetPackageInfo

DismRemovePackage

DismPackage

DismPackageInfo

DismPackageFeatureState