Creating a DISM Application
You can develop applications by using the DISM API on any computer where you have installed the Windows Assessment and Deployment Kit (Windows ADK).
Setting up the development environment
Add the path to DismApi.lib as an additional dependency in the linker input properties of your project.
By default, DismApi.lib is installed with the Windows ADK at C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment and Imaging Tools\SDKs\DismApi\Lib\.
Add the path to DismApi.h to the resource properties of your project.
By default, DismApi.h is installed with the Windows ADK at C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment and Imaging Tools\SDKs\DismApi\Include\.
Include the DISM API header file, DismApi.h, in your code.
Required DISM API functions
To service an offline image, use the DismMountImage Function to map the contents of the image to a directory on your local computer before opening a DISM session.
You can associate an offline or online Windows image with a DISMSession by calling the DismOpenSession Function. All servicing and repair operations on images are performed by using a DISMSession. All APIs that operate on an image accept a DismSession as their first parameter. You can call the DismCloseSession Function to release a DismSession and then call the DismUnmountImage Function if you are finished using the offline image.
Some operations do not require a DISM session. These include the DismGetImageInfo Function, DismGetMountedImageInfo Function, DismRemountImage Function, DismCleanupMountpoints Function, DismGetLastErrorMessage Function, and DismDelete Function. These operations can be used at any point after the DismInitialize Function has been called.
For an example of a basic DISM application, see DISM API Samples.
Use paired DISM APIs to open and close processes
To start a DISM process, call the DismInitialize Function.
If you are using an offline image, call the DismMountImage Function.
You can call any functions that do not require a DISM session, such as DismGetMountedImageInfo Function, after you have started the process with the DismInitialize function.
You can now perform any image management or servicing operations that use a DISM session, such as the DismAddPackage Function.
For more information about available functions, see DISM API Functions.
Save your changes by using the DismCommitImage Function.
If you have any open sessions, use the DismCloseSession Function for each one to release the session and free the allocated memory.
If you are finished using an offline image, call the DismUnmountImage Function to remove the mounted image from your local computer.
To close the process, use the DismShutdown Function.