DismUnmountImage function

[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

Unmounts a Windows image from a specified location.

Syntax

HRESULT WINAPI DismUnmountImage(
  _In_     PCWSTR                 MountPath,
  _In_     DWORD                  Flags,
  _In_opt_ HANDLE                 CancelEvent,
  _In_opt_ DISM_PROGRESS_CALLBACK Progress,
  _In_opt_ PVOID                  UserData
);

Parameters

MountPath [in]
A relative or absolute path to the mount directory of the image.

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

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.

Remarks

After you use DismCloseSession to end every active DismSession, you can unmount the image using the DismUnmountImage function.

Example

HRESULT hr = S_OK;
hr = DismMountImage(L"C:\\test\\images\\myimage.wim", L"C:\\test\\offline", 1, 
                    NULL, DismImageIndex, DISM_MOUNT_READWRITE, NULL, NULL, NULL);
hr = DismUnmountImage (L"C:\\test\\offline", DISM_COMMIT_IMAGE, NULL, NULL, NULL);

Requirements

Supported host platforms for WIM images:

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 host platforms for VHD images:

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

Requirements

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

DismCloseSession

DismRemountImage