CimMountImage function (cimfs.h)

Mounts the named image from the location specified by cimPath as a volume with the volume GUID specified by volumeId.


HRESULT CimMountImage(
  PCWSTR                imageContainingPath,
  PCWSTR                imageName,
  CIM_MOUNT_IMAGE_FLAGS mountImageFlags,
  const GUID            *volumeId



Type: PCWSTR The directory that will contain the image created. The caller must have FILE_ADD_FILE and FILE_LIST_DIRECTORY access rights.


Type: PCWSTR Provides the name of an existing image within the same imageContainingPath that will be mounted.




Type: GUID* Provides a GUID to be used as the volume GUID of the mounted volume.

Return value

HRESULT E_INVALIDARG – The caller specified an invalid flag. HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) – the image path is not found. HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) – imageName is not found at the path specified. E_ACCESSEDDENIED – The caller does not have access the image or does not have access to mount a volume. HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) – A volume is already mounted with the volume GUID specified.


The mounted volume can be accessed at its volume GUID path as defined by the system. This path is in the form \?\Volume{GUID}. Mounting the volume allows the image created to be verified using the Windows file system APIs such as CreateFile, FindFirstFile/FindNextFile, GetFileAttributesEx and others.

The image cannot be overwritten while it is mounted.


Minimum supported client Windows 10, version 2004 (10.0; Build 19041)
Minimum supported server Windows Server, version 2004 (10.0; Build 19041)
Header cimfs.h