Using the DISM API
The Deployment Image Servicing and Management (DISM) API allows you to build customized solutions on the DISM platform. You can use the DISM API to install, uninstall, configure, and update Windows features, packages, and drivers in a Windows image. DISM can be used to manage and service Windows images in either the Windows image (.wim) file format or virtual hard drive (.vhd, .vhdx) files.
In this section:
You must install the Windows® Assessment and Deployment Kit (Windows ADK) on your development computer in order to create DISM API applications.
DISM API binary files. The DISM API files are available in all Windows® 8 operating systems. You can also run DISM API applications on any Windows operating system that is supported by the Windows ADK. You must install the Windows ADK in order to run DISM API applications on these operating systems. For more information about supported operating systems, see the Windows® Assessment and Deployment Kit (Windows ADK) Technical Reference.
A Windows image. You will need a supported Windows image file type, .wim, .vhd, or .vhdx, or an online installation of Windows to use the DISMAPI for servicing and management. Some operations are not valid on online images. For more information, see the DISM API Reference.
Supported Target Images
The Windows image file that you are servicing on your host computer can be a .wim file, a .vhd or .vhdx file, or an online installation of Windows. Additionally, cross-architecture servicing is supported. You can service an x64 image from an x86 system or an x64 system. You can service an x86 image from an x64 system or an x86 system.
All DISMAPI functions can be performed on Windows® 8 and Windows Server® 2012 target images. To see if a function can be performed on other target images, see the Requirements section of the function reference topic in the DISM API Reference.
Memory management. Certain DISM API functions return structures or arrays of structures. These structures are returned to the user as a pointer to an object on the heap. The heap memory is allocated by the DISM API. The client must call the DismDelete Function to ensure that this memory is released.
Mounting a VHD with the DiskPart tool. When possible, you should use the DISM API to mount and unmount images you want to service within the DISM framework. Using another tool, such as the DiskPart tool, to mount and unmount the image can have unexpected effects.
File paths. All paths accepted by DISM API functions can be relative or absolute. As a best practice, limit the length of file paths. File paths that are too long or exceed the maximum length limitation for Windows will cause failures in DISM.
Matching calls to open and close sessions. Always release a DISM Session by using the DismCloseSession Function before calling the DismShutdown Function. You can also unmount the image with the DismUnmountImage Function after closing the session and before calling the DismShutdown Function.
Other DISM tools
For more information about the DISM platform and other ways to access the servicing and management functionality, see the DISM Technical Reference in the Windows® Assessment and Deployment Kit (Windows ADK) Technical Reference. You can also use the DISM.exe tool in the Windows ADK to capture an image as a .wim file.