DismCommitImage function

Commits the changes made to a Windows image in a mounted .wim or .vhd file. The image must be mounted using the DismMountImage.

Syntax

HRESULT WINAPI DismCommitImage(
  _In_     DismSession            Session,
  _In_     DWORD                  Flags,
  _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.

Flags [in]
The commit flags to use for this operation. For more information about mount flags, see DISM API Constants.

CancelEvent [in, optional]
The commit flags to use for this operation. For more information about mount flags, see DISM API Constants.

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.

Returns E_INVALIDARG if the DismSession is invalid or if the DismSession is not associated with a mounted image.

Remarks

The DismCommitImage function does not unmount the image.

Note

DismCommitImage can only be used on an image that is mounted within the DISM infrastructure. It does not apply to images mounted by another tool, such as the DiskPart tool, which are serviced using the DismOpenSession. You must use the DismMountImage to mount an image within the DISM infrastructure.

Example

HRESULT hr = S_OK;
hr = DismCommitImage(Session, 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 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

DismMountImage

DismUnmountImage

DISM API Constants