Skip to content

Commit

Permalink
Added EnableFeature overloads without package name/path. (#134)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Rexwinkel <[email protected]>
  • Loading branch information
markrexwinkel and markrexwinkel authored Sep 27, 2021
1 parent 9de7001 commit 2b9a276
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/Microsoft.Dism/DismApi.EnableFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,64 @@ public static void EnableFeatureByPackagePath(DismSession session, string featur
EnableFeature(session, featureName, packagePath, DismPackageIdentifier.Path, limitAccess, enableAll, sourcePaths, progressCallback, userData);
}

/// <summary>
/// Enables a feature from the specified package path.
/// </summary>
/// <param name="session">A valid DISM Session. The DISM Session must be associated with an image. You can associate a session with an image by using the DismOpenSession Function.</param>
/// <param name="featureName">The name of the feature that is being enabled. To enable more than one feature, separate each feature name with a semicolon.</param>
/// <param name="limitAccess">Specifies whether Windows Update (WU) should be contacted as a source location for downloading files if none are found in other specified locations. Before checking WU, DISM will check for the files in the SourcePaths provided and in any locations specified in the registry by group policy. If the files required to enable the feature are still present on the computer, this flag is ignored.</param>
/// <param name="enableAll">Specifies whether to enable all dependencies of the feature. If the specified feature or any one of its dependencies cannot be enabled, none of them will be changed from their existing state.</param>
/// <exception cref="DismException">When a failure occurs.</exception>
public static void EnableFeature(DismSession session, string featureName, bool limitAccess, bool enableAll)
{
EnableFeature(session, featureName, null, DismPackageIdentifier.None, limitAccess, enableAll, null, null, null);
}

/// <summary>
/// Enables a feature from the specified package path.
/// </summary>
/// <param name="session">A valid DISM Session. The DISM Session must be associated with an image. You can associate a session with an image by using the DismOpenSession Function.</param>
/// <param name="featureName">The name of the feature that is being enabled. To enable more than one feature, separate each feature name with a semicolon.</param>
/// <param name="limitAccess">Specifies whether Windows Update (WU) should be contacted as a source location for downloading files if none are found in other specified locations. Before checking WU, DISM will check for the files in the SourcePaths provided and in any locations specified in the registry by group policy. If the files required to enable the feature are still present on the computer, this flag is ignored.</param>
/// <param name="enableAll">Specifies whether to enable all dependencies of the feature. If the specified feature or any one of its dependencies cannot be enabled, none of them will be changed from their existing state.</param>
/// <param name="sourcePaths">A list of source locations to check for files needed to enable the feature.</param>
/// <exception cref="DismException">When a failure occurs.</exception>
public static void EnableFeature(DismSession session, string featureName, bool limitAccess, bool enableAll, List<string> sourcePaths)
{
EnableFeature(session, featureName, null, DismPackageIdentifier.None, limitAccess, enableAll, sourcePaths, null, null);
}

/// <summary>
/// Enables a feature from the specified package path.
/// </summary>
/// <param name="session">A valid DISM Session. The DISM Session must be associated with an image. You can associate a session with an image by using the DismOpenSession Function.</param>
/// <param name="featureName">The name of the feature that is being enabled. To enable more than one feature, separate each feature name with a semicolon.</param>
/// <param name="limitAccess">Specifies whether Windows Update (WU) should be contacted as a source location for downloading files if none are found in other specified locations. Before checking WU, DISM will check for the files in the SourcePaths provided and in any locations specified in the registry by group policy. If the files required to enable the feature are still present on the computer, this flag is ignored.</param>
/// <param name="enableAll">Specifies whether to enable all dependencies of the feature. If the specified feature or any one of its dependencies cannot be enabled, none of them will be changed from their existing state.</param>
/// <param name="sourcePaths">A list of source locations to check for files needed to enable the feature.</param>
/// <param name="progressCallback">A progress callback method to invoke when progress is made.</param>
/// <exception cref="DismException">When a failure occurs.</exception>
public static void EnableFeature(DismSession session, string featureName, bool limitAccess, bool enableAll, List<string> sourcePaths, Microsoft.Dism.DismProgressCallback progressCallback)
{
EnableFeature(session, featureName, null, DismPackageIdentifier.None, limitAccess, enableAll, sourcePaths, progressCallback, null);
}

/// <summary>
/// Enables a feature from the specified package path.
/// </summary>
/// <param name="session">A valid DISM Session. The DISM Session must be associated with an image. You can associate a session with an image by using the DismOpenSession Function.</param>
/// <param name="featureName">The name of the feature that is being enabled. To enable more than one feature, separate each feature name with a semicolon.</param>
/// <param name="limitAccess">Specifies whether Windows Update (WU) should be contacted as a source location for downloading files if none are found in other specified locations. Before checking WU, DISM will check for the files in the SourcePaths provided and in any locations specified in the registry by group policy. If the files required to enable the feature are still present on the computer, this flag is ignored.</param>
/// <param name="enableAll">Specifies whether to enable all dependencies of the feature. If the specified feature or any one of its dependencies cannot be enabled, none of them will be changed from their existing state.</param>
/// <param name="sourcePaths">A list of source locations to check for files needed to enable the feature.</param>
/// <param name="progressCallback">A progress callback method to invoke when progress is made.</param>
/// <param name="userData">Optional user data to pass to the DismProgressCallback method.</param>
/// <exception cref="DismException">When a failure occurs.</exception>
public static void EnableFeature(DismSession session, string featureName, bool limitAccess, bool enableAll, List<string> sourcePaths, Microsoft.Dism.DismProgressCallback progressCallback, object userData)
{
EnableFeature(session, featureName, null, DismPackageIdentifier.None, limitAccess, enableAll, sourcePaths, progressCallback, userData);
}

/// <summary>
/// Enables a feature from the specified package path.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.Dism/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ static Microsoft.Dism.DismApi.EnableFeatureByPackagePath(Microsoft.Dism.DismSess
static Microsoft.Dism.DismApi.EnableFeatureByPackagePath(Microsoft.Dism.DismSession session, string featureName, string packagePath, bool limitAccess, bool enableAll, System.Collections.Generic.List<string> sourcePaths) -> void
static Microsoft.Dism.DismApi.EnableFeatureByPackagePath(Microsoft.Dism.DismSession session, string featureName, string packagePath, bool limitAccess, bool enableAll, System.Collections.Generic.List<string> sourcePaths, Microsoft.Dism.DismProgressCallback progressCallback) -> void
static Microsoft.Dism.DismApi.EnableFeatureByPackagePath(Microsoft.Dism.DismSession session, string featureName, string packagePath, bool limitAccess, bool enableAll, System.Collections.Generic.List<string> sourcePaths, Microsoft.Dism.DismProgressCallback progressCallback, object userData) -> void
static Microsoft.Dism.DismApi.EnableFeature(Microsoft.Dism.DismSession session, string featureName, bool limitAccess, bool enableAll) -> void
static Microsoft.Dism.DismApi.EnableFeature(Microsoft.Dism.DismSession session, string featureName, bool limitAccess, bool enableAll, System.Collections.Generic.List<string> sourcePaths) -> void
static Microsoft.Dism.DismApi.EnableFeature(Microsoft.Dism.DismSession session, string featureName, bool limitAccess, bool enableAll, System.Collections.Generic.List<string> sourcePaths, Microsoft.Dism.DismProgressCallback progressCallback) -> void
static Microsoft.Dism.DismApi.EnableFeature(Microsoft.Dism.DismSession session, string featureName, bool limitAccess, bool enableAll, System.Collections.Generic.List<string> sourcePaths, Microsoft.Dism.DismProgressCallback progressCallback, object userData) -> void
static Microsoft.Dism.DismApi.GetCapabilities(Microsoft.Dism.DismSession session) -> Microsoft.Dism.DismCapabilityCollection
static Microsoft.Dism.DismApi.GetCapabilityInfo(Microsoft.Dism.DismSession session, string capabilityName) -> Microsoft.Dism.DismCapabilityInfo
static Microsoft.Dism.DismApi.GetDriverInfo(Microsoft.Dism.DismSession session, string driverPath) -> Microsoft.Dism.DismDriverCollection
Expand Down

0 comments on commit 2b9a276

Please sign in to comment.