This is because applying the image is part of the Windows Imaging API (WIMGAPI), not the DISM API. In particular, the WIMApplyImage function.
For the compact flag, this isn't documented but it is in the headers, defined as WIM_FLAG_APPLY_COMPACT.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have installed the Windows ADK and i'm trying to programmatically reproduce the same call from this command:
dism /apply-image /imagefile:E:\sources\install.esd /index:6 /applydir:F:\
Looking at the DISM API Functions and also directly on the dismapi.h
i'm not finding the right function to use, theres no "DismApplyImage".
The closest is DismMountImage but theres no compact on the flags.
#include <Windows.h>
#include <dismapi.h>
#pragma comment(lib, "dismapi.lib")
int main(int argc, char *argv[])
{
DismLogLevel dwLogLevel = DismLogLevel::DismLogErrors;
HRESULT hr = DismInitialize(dwLogLevel, NULL, NULL);
DismSession session = NULL;
// dism /apply-image /imagefile:E:\sources\install.esd /index:6 /applydir:F:\ /compact"
hr = DismMountDismApplyImageImage(L"E:\sources\install.esd", L"F:\\", 6, L"", DismImageIndex, ?
/*
DismMountImage(
_In_ PCWSTR ImageFilePath,
_In_ PCWSTR MountPath,
_In_ UINT ImageIndex,
_In_opt_ PCWSTR ImageName,
_In_ DismImageIdentifier ImageIdentifier,
_In_ DWORD Flags,
_In_opt_ HANDLE CancelEvent,
_In_opt_ DISM_PROGRESS_CALLBACK Progress,
_In_opt_ PVOID UserData
);
*/
}
This is because applying the image is part of the Windows Imaging API (WIMGAPI), not the DISM API. In particular, the WIMApplyImage function.
For the compact flag, this isn't documented but it is in the headers, defined as WIM_FLAG_APPLY_COMPACT.