Removes an image from within a .wim (Windows image) file so it cannot be accessed. However, the file resources are still available for use by the WIMSetReferenceFile function.

	 HANDLE hWim,
	 DWORD  dwImageIndex



[in] The handle to a .wim file returned by the WIMCreateFile function. This handle must have WIM_GENERIC_WRITE access to delete the image. Split .wim files are not supported and the .wim file cannot have any open images.


[in] Specifies the one-based index of the image to delete. A .wim file might have multiple images stored within it.

Return Value

If the function succeeds, then the return value is nonzero.

If the function fails, then the return value is zero. To obtain extended error information, call GetLastError.

If there is only one image in the specified .wim file, then the WIMDeleteImage function will fail and set the LastError to ERROR_ACCESS_DENIED.


You must call the WIMSetTemporaryPath function before calling the WIMDeleteImage function so the image metadata for the image can be extracted and processed from the temporary location.

See Also