| 1 |
/** |
| 2 |
* This file has no copyright assigned and is placed in the Public Domain. |
| 3 |
* This file is part of the mingw-w64 runtime package. |
| 4 |
* No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 |
*/ |
| 6 |
|
| 7 |
#ifndef _DISMAPI_H_ |
| 8 |
#define _DISMAPI_H_ |
| 9 |
|
| 10 |
#include <winapifamily.h> |
| 11 |
|
| 12 |
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) |
| 13 |
|
| 14 |
#ifdef __cplusplus |
| 15 |
extern "C" |
| 16 |
{ |
| 17 |
#endif |
| 18 |
|
| 19 |
typedef UINT DismSession; |
| 20 |
|
| 21 |
typedef void(CALLBACK *DISM_PROGRESS_CALLBACK)(UINT Current, UINT Total, PVOID UserData); |
| 22 |
|
| 23 |
#define DISM_ONLINE_IMAGE L"DISM_{53BFAE52-B167-4E2F-A258-0A37B57FF845}" |
| 24 |
|
| 25 |
#define DISM_SESSION_DEFAULT 0 |
| 26 |
|
| 27 |
#define DISM_MOUNT_READWRITE 0x00000000 |
| 28 |
#define DISM_MOUNT_READONLY 0x00000001 |
| 29 |
#define DISM_MOUNT_OPTIMIZE 0x00000002 |
| 30 |
#define DISM_MOUNT_CHECK_INTEGRITY 0x00000004 |
| 31 |
|
| 32 |
#define DISM_COMMIT_IMAGE 0x00000000 |
| 33 |
#define DISM_DISCARD_IMAGE 0x00000001 |
| 34 |
|
| 35 |
#define DISM_COMMIT_GENERATE_INTEGRITY 0x00010000 |
| 36 |
#define DISM_COMMIT_APPEND 0x00020000 |
| 37 |
#define DISM_COMMIT_MASK 0xffff0000 |
| 38 |
|
| 39 |
/* https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dism-api-enumerations */ |
| 40 |
|
| 41 |
typedef enum _DismLogLevel |
| 42 |
{ |
| 43 |
DismLogErrors = 0, |
| 44 |
DismLogErrorsWarnings, |
| 45 |
DismLogErrorsWarningsInfo |
| 46 |
} DismLogLevel; |
| 47 |
|
| 48 |
typedef enum _DismImageIdentifier |
| 49 |
{ |
| 50 |
DismImageIndex = 0, |
| 51 |
DismImageName |
| 52 |
} DismImageIdentifier; |
| 53 |
|
| 54 |
typedef enum _DismMountMode |
| 55 |
{ |
| 56 |
DismReadWrite = 0, |
| 57 |
DismReadOnly |
| 58 |
} DismMountMode; |
| 59 |
|
| 60 |
typedef enum _DismImageType |
| 61 |
{ |
| 62 |
DismImageTypeUnsupported = -1, |
| 63 |
DismImageTypeWim = 0, |
| 64 |
DismImageTypeVhd = 1 |
| 65 |
} DismImageType; |
| 66 |
|
| 67 |
typedef enum _DismImageBootable |
| 68 |
{ |
| 69 |
DismImageBootableYes = 0, |
| 70 |
DismImageBootableNo, |
| 71 |
DismImageBootableUnknown |
| 72 |
} DismImageBootable; |
| 73 |
|
| 74 |
typedef enum _DismMountStatus |
| 75 |
{ |
| 76 |
DismMountStatusOk = 0, |
| 77 |
DismMountStatusNeedsRemount, |
| 78 |
DismMountStatusInvalid |
| 79 |
} DismMountStatus; |
| 80 |
|
| 81 |
typedef enum _DismImageHealthState |
| 82 |
{ |
| 83 |
DismImageHealthy = 0, |
| 84 |
DismImageRepairable, |
| 85 |
DismImageNonRepairable |
| 86 |
} DismImageHealthState; |
| 87 |
|
| 88 |
typedef enum _DismPackageIdentifier |
| 89 |
{ |
| 90 |
DismPackageNone = 0, |
| 91 |
DismPackageName, |
| 92 |
DismPackagePath |
| 93 |
} DismPackageIdentifier; |
| 94 |
|
| 95 |
typedef enum _DismPackageFeatureState |
| 96 |
{ |
| 97 |
DismStateNotPresent = 0, |
| 98 |
DismStateUninstallPending, |
| 99 |
DismStateStaged, |
| 100 |
DismStateResolved, |
| 101 |
DismStateRemoved = DismStateResolved, |
| 102 |
DismStateInstalled, |
| 103 |
DismStateInstallPending, |
| 104 |
DismStateSuperseded, |
| 105 |
DismStatePartiallyInstalled |
| 106 |
} DismPackageFeatureState; |
| 107 |
|
| 108 |
typedef enum _DismReleaseType |
| 109 |
{ |
| 110 |
DismReleaseTypeCriticalUpdate = 0, |
| 111 |
DismReleaseTypeDriver, |
| 112 |
DismReleaseTypeFeaturePack, |
| 113 |
DismReleaseTypeHotfix, |
| 114 |
DismReleaseTypeSecurityUpdate, |
| 115 |
DismReleaseTypeSoftwareUpdate, |
| 116 |
DismReleaseTypeUpdate, |
| 117 |
DismReleaseTypeUpdateRollup, |
| 118 |
DismReleaseTypeLanguagePack, |
| 119 |
DismReleaseTypeFoundation, |
| 120 |
DismReleaseTypeServicePack, |
| 121 |
DismReleaseTypeProduct, |
| 122 |
DismReleaseTypeLocalPack, |
| 123 |
DismReleaseTypeOther, |
| 124 |
DismReleaseTypeOnDemandPack |
| 125 |
} DismReleaseType; |
| 126 |
|
| 127 |
typedef enum _DismRestartType |
| 128 |
{ |
| 129 |
DismRestartNo = 0, |
| 130 |
DismRestartPossible, |
| 131 |
DismRestartRequired |
| 132 |
} DismRestartType; |
| 133 |
|
| 134 |
typedef enum _DismDriverSignature |
| 135 |
{ |
| 136 |
DismDriverSignatureUnknown = 0, |
| 137 |
DismDriverSignatureUnsigned = 1, |
| 138 |
DismDriverSignatureSigned = 2 |
| 139 |
} DismDriverSignature; |
| 140 |
|
| 141 |
typedef enum _DismFullyOfflineInstallableType |
| 142 |
{ |
| 143 |
DismFullyOfflineInstallable = 0, |
| 144 |
DismFullyOfflineNotInstallable, |
| 145 |
DismFullyOfflineInstallableUndetermined |
| 146 |
} DismFullyOfflineInstallableType; |
| 147 |
|
| 148 |
/* https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dism-api-structures */ |
| 149 |
|
| 150 |
#pragma pack(push, 1) |
| 151 |
|
| 152 |
typedef struct _DismPackage |
| 153 |
{ |
| 154 |
PCWSTR PackageName; |
| 155 |
DismPackageFeatureState PackageState; |
| 156 |
DismReleaseType ReleaseType; |
| 157 |
SYSTEMTIME InstallTime; |
| 158 |
} DismPackage; |
| 159 |
|
| 160 |
typedef struct _DismCustomProperty |
| 161 |
{ |
| 162 |
PCWSTR Name; |
| 163 |
PCWSTR Value; |
| 164 |
PCWSTR Path; |
| 165 |
} DismCustomProperty; |
| 166 |
|
| 167 |
typedef struct _DismFeature |
| 168 |
{ |
| 169 |
PCWSTR FeatureName; |
| 170 |
DismPackageFeatureState State; |
| 171 |
} DismFeature; |
| 172 |
|
| 173 |
typedef struct _DismCapability |
| 174 |
{ |
| 175 |
PCWSTR Name; |
| 176 |
DismPackageFeatureState State; |
| 177 |
} DismCapability; |
| 178 |
|
| 179 |
typedef struct _DismPackageInfo |
| 180 |
{ |
| 181 |
PCWSTR PackageName; |
| 182 |
DismPackageFeatureState PackageState; |
| 183 |
DismReleaseType ReleaseType; |
| 184 |
SYSTEMTIME InstallTime; |
| 185 |
WINBOOL Applicable; |
| 186 |
PCWSTR Copyright; |
| 187 |
PCWSTR Company; |
| 188 |
SYSTEMTIME CreationTime; |
| 189 |
PCWSTR DisplayName; |
| 190 |
PCWSTR Description; |
| 191 |
PCWSTR InstallClient; |
| 192 |
PCWSTR InstallPackageName; |
| 193 |
SYSTEMTIME LastUpdateTime; |
| 194 |
PCWSTR ProductName; |
| 195 |
PCWSTR ProductVersion; |
| 196 |
DismRestartType RestartRequired; |
| 197 |
DismFullyOfflineInstallableType FullyOffline; |
| 198 |
PCWSTR SupportInformation; |
| 199 |
DismCustomProperty *CustomProperty; |
| 200 |
UINT CustomPropertyCount; |
| 201 |
DismFeature *Feature; |
| 202 |
UINT FeatureCount; |
| 203 |
} DismPackageInfo; |
| 204 |
|
| 205 |
#ifdef __cplusplus |
| 206 |
typedef struct _DismPackageInfoEx : public _DismPackageInfo |
| 207 |
{ |
| 208 |
#else |
| 209 |
typedef struct _DismPackageInfoEx |
| 210 |
{ |
| 211 |
DismPackageInfo; |
| 212 |
#endif |
| 213 |
PCWSTR CapabilityId; |
| 214 |
} DismPackageInfoEx; |
| 215 |
|
| 216 |
typedef struct _DismFeatureInfo |
| 217 |
{ |
| 218 |
PCWSTR FeatureName; |
| 219 |
DismPackageFeatureState FeatureState; |
| 220 |
PCWSTR DisplayName; |
| 221 |
PCWSTR Description; |
| 222 |
DismRestartType RestartRequired; |
| 223 |
DismCustomProperty *CustomProperty; |
| 224 |
UINT CustomPropertyCount; |
| 225 |
} DismFeatureInfo; |
| 226 |
|
| 227 |
typedef struct _DismCapabilityInfo |
| 228 |
{ |
| 229 |
PCWSTR Name; |
| 230 |
DismPackageFeatureState State; |
| 231 |
PCWSTR DisplayName; |
| 232 |
PCWSTR Description; |
| 233 |
DWORD DownloadSize; |
| 234 |
DWORD InstallSize; |
| 235 |
} DismCapabilityInfo; |
| 236 |
|
| 237 |
typedef struct _DismString |
| 238 |
{ |
| 239 |
PCWSTR Value; |
| 240 |
} DismString; |
| 241 |
|
| 242 |
typedef DismString DismLanguage; |
| 243 |
|
| 244 |
typedef struct _DismWimCustomizedInfo |
| 245 |
{ |
| 246 |
UINT Size; |
| 247 |
UINT DirectoryCount; |
| 248 |
UINT FileCount; |
| 249 |
SYSTEMTIME CreatedTime; |
| 250 |
SYSTEMTIME ModifiedTime; |
| 251 |
} DismWimCustomizedInfo; |
| 252 |
|
| 253 |
typedef struct _DismImageInfo |
| 254 |
{ |
| 255 |
DismImageType ImageType; |
| 256 |
UINT ImageIndex; |
| 257 |
PCWSTR ImageName; |
| 258 |
PCWSTR ImageDescription; |
| 259 |
UINT64 ImageSize; |
| 260 |
UINT Architecture; |
| 261 |
PCWSTR ProductName; |
| 262 |
PCWSTR EditionId; |
| 263 |
PCWSTR InstallationType; |
| 264 |
PCWSTR Hal; |
| 265 |
PCWSTR ProductType; |
| 266 |
PCWSTR ProductSuite; |
| 267 |
UINT MajorVersion; |
| 268 |
UINT MinorVersion; |
| 269 |
UINT Build; |
| 270 |
UINT SpBuild; |
| 271 |
UINT SpLevel; |
| 272 |
DismImageBootable Bootable; |
| 273 |
PCWSTR SystemRoot; |
| 274 |
DismLanguage *Language; |
| 275 |
UINT LanguageCount; |
| 276 |
UINT DefaultLanguageIndex; |
| 277 |
VOID *CustomizedInfo; |
| 278 |
} DismImageInfo; |
| 279 |
|
| 280 |
typedef struct _DismMountedImageInfo |
| 281 |
{ |
| 282 |
PCWSTR MountPath; |
| 283 |
PCWSTR ImageFilePath; |
| 284 |
UINT ImageIndex; |
| 285 |
DismMountMode MountMode; |
| 286 |
DismMountStatus MountStatus; |
| 287 |
} DismMountedImageInfo; |
| 288 |
|
| 289 |
typedef struct _DismDriverPackage |
| 290 |
{ |
| 291 |
PCWSTR PublishedName; |
| 292 |
PCWSTR OriginalFileName; |
| 293 |
WINBOOL InBox; |
| 294 |
PCWSTR CatalogFile; |
| 295 |
PCWSTR ClassName; |
| 296 |
PCWSTR ClassGuid; |
| 297 |
PCWSTR ClassDescription; |
| 298 |
WINBOOL BootCritical; |
| 299 |
DismDriverSignature DriverSignature; |
| 300 |
PCWSTR ProviderName; |
| 301 |
SYSTEMTIME Date; |
| 302 |
UINT MajorVersion; |
| 303 |
UINT MinorVersion; |
| 304 |
UINT Build; |
| 305 |
UINT Revision; |
| 306 |
} DismDriverPackage; |
| 307 |
|
| 308 |
typedef struct _DismDriver |
| 309 |
{ |
| 310 |
PCWSTR ManufacturerName; |
| 311 |
PCWSTR HardwareDescription; |
| 312 |
PCWSTR HardwareId; |
| 313 |
UINT Architecture; |
| 314 |
PCWSTR ServiceName; |
| 315 |
PCWSTR CompatibleIds; |
| 316 |
PCWSTR ExcludeIds; |
| 317 |
} DismDriver; |
| 318 |
|
| 319 |
#pragma pack(pop) |
| 320 |
|
| 321 |
/* https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dism-api-functions */ |
| 322 |
|
| 323 |
HRESULT WINAPI DismInitialize (DismLogLevel LogLevel, PCWSTR LogFilePath, PCWSTR ScratchDirectory); |
| 324 |
HRESULT WINAPI DismShutdown (void); |
| 325 |
HRESULT WINAPI DismMountImage (PCWSTR ImageFilePath, PCWSTR MountPath, UINT ImageIndex, PCWSTR ImageName, DismImageIdentifier ImageIdentifier, DWORD Flags, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 326 |
HRESULT WINAPI DismUnmountImage (PCWSTR MountPath, DWORD Flags, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 327 |
HRESULT WINAPI DismOpenSession (PCWSTR ImagePath, PCWSTR WindowsDirectory, PCWSTR SystemDrive, DismSession *Session); |
| 328 |
HRESULT WINAPI DismCloseSession (DismSession Session); |
| 329 |
HRESULT WINAPI DismGetLastErrorMessage (DismString **ErrorMessage); |
| 330 |
HRESULT WINAPI DismRemountImage (PCWSTR MountPath); |
| 331 |
HRESULT WINAPI DismCommitImage (DismSession Session, DWORD Flags, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 332 |
HRESULT WINAPI DismGetImageInfo (PCWSTR ImageFilePath, DismImageInfo **ImageInfo, UINT *Count); |
| 333 |
HRESULT WINAPI DismGetMountedImageInfo (DismMountedImageInfo **MountedImageInfo, UINT *Count); |
| 334 |
HRESULT WINAPI DismCleanupMountpoints (void); |
| 335 |
HRESULT WINAPI DismCheckImageHealth (DismSession Session, WINBOOL ScanImage, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData, DismImageHealthState *ImageHealth); |
| 336 |
HRESULT WINAPI DismRestoreImageHealth (DismSession Session, PCWSTR *SourcePaths, UINT SourcePathCount, WINBOOL LimitAccess, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 337 |
HRESULT WINAPI DismDelete (VOID *DismStructure); |
| 338 |
HRESULT WINAPI DismAddPackage (DismSession Session, PCWSTR PackagePath, WINBOOL IgnoreCheck, WINBOOL PreventPending, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 339 |
HRESULT WINAPI DismRemovePackage (DismSession Session, PCWSTR Identifier, DismPackageIdentifier PackageIdentifier, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 340 |
HRESULT WINAPI DismEnableFeature (DismSession Session, PCWSTR FeatureName, PCWSTR Identifier, DismPackageIdentifier PackageIdentifier, WINBOOL LimitAccess, PCWSTR *SourcePaths, UINT SourcePathCount, WINBOOL EnableAll, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 341 |
HRESULT WINAPI DismDisableFeature (DismSession Session, PCWSTR FeatureName, PCWSTR PackageName, WINBOOL RemovePayload, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 342 |
HRESULT WINAPI DismGetPackages (DismSession Session, DismPackage **Package, UINT *Count); |
| 343 |
HRESULT WINAPI DismGetPackageInfo (DismSession Session, PCWSTR Identifier, DismPackageIdentifier PackageIdentifier, DismPackageInfo **PackageInfo); |
| 344 |
HRESULT WINAPI DismGetPackageInfoEx (DismSession Session, PCWSTR Identifier, DismPackageIdentifier PackageIdentifier, DismPackageInfoEx **PackageInfoEx); |
| 345 |
HRESULT WINAPI DismGetFeatures (DismSession Session, PCWSTR Identifier, DismPackageIdentifier PackageIdentifier, DismFeature **Feature, UINT *Count); |
| 346 |
HRESULT WINAPI DismGetFeatureInfo (DismSession Session, PCWSTR FeatureName, PCWSTR Identifier, DismPackageIdentifier PackageIdentifier, DismFeatureInfo **FeatureInfo); |
| 347 |
HRESULT WINAPI DismGetFeatureParent (DismSession Session, PCWSTR FeatureName, PCWSTR Identifier, DismPackageIdentifier PackageIdentifier, DismFeature **Feature, UINT *Count); |
| 348 |
HRESULT WINAPI DismApplyUnattend (DismSession Session, PCWSTR UnattendFile, WINBOOL SingleSession); |
| 349 |
HRESULT WINAPI DismAddDriver (DismSession Session, PCWSTR DriverPath, WINBOOL ForceUnsigned); |
| 350 |
HRESULT WINAPI DismRemoveDriver (DismSession Session, PCWSTR DriverPath); |
| 351 |
HRESULT WINAPI DismGetDrivers (DismSession Session, WINBOOL AllDrivers, DismDriverPackage **DriverPackage, UINT *Count); |
| 352 |
HRESULT WINAPI DismGetDriverInfo (DismSession Session, PCWSTR DriverPath, DismDriver **Driver, UINT *Count, DismDriverPackage **DriverPackage); |
| 353 |
HRESULT WINAPI DismGetCapabilities (DismSession Session, DismCapability **Capability, UINT *Count); |
| 354 |
HRESULT WINAPI DismGetCapabilityInfo (DismSession Session, PCWSTR Name, DismCapabilityInfo **Info); |
| 355 |
HRESULT WINAPI DismAddCapability (DismSession Session, PCWSTR Name, WINBOOL LimitAccess, PCWSTR *SourcePaths, UINT SourcePathCount, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 356 |
HRESULT WINAPI DismRemoveCapability (DismSession Session, PCWSTR Name, HANDLE CancelEvent, DISM_PROGRESS_CALLBACK Progress, PVOID UserData); |
| 357 |
|
| 358 |
#define DISMAPI_S_RELOAD_IMAGE_SESSION_REQUIRED 0x00000001 |
| 359 |
#define DISMAPI_E_DISMAPI_NOT_INITIALIZED 0xc0040001 |
| 360 |
#define DISMAPI_E_SHUTDOWN_IN_PROGRESS 0xc0040002 |
| 361 |
#define DISMAPI_E_OPEN_SESSION_HANDLES 0xc0040003 |
| 362 |
#define DISMAPI_E_INVALID_DISM_SESSION 0xc0040004 |
| 363 |
#define DISMAPI_E_INVALID_IMAGE_INDEX 0xc0040005 |
| 364 |
#define DISMAPI_E_INVALID_IMAGE_NAME 0xc0040006 |
| 365 |
#define DISMAPI_E_UNABLE_TO_UNMOUNT_IMAGE_PATH 0xc0040007 |
| 366 |
#define DISMAPI_E_LOGGING_DISABLED 0xc0040009 |
| 367 |
#define DISMAPI_E_OPEN_HANDLES_UNABLE_TO_UNMOUNT_IMAGE_PATH 0xc004000a |
| 368 |
#define DISMAPI_E_OPEN_HANDLES_UNABLE_TO_MOUNT_IMAGE_PATH 0xc004000b |
| 369 |
#define DISMAPI_E_OPEN_HANDLES_UNABLE_TO_REMOUNT_IMAGE_PATH 0xc004000c |
| 370 |
#define DISMAPI_E_PARENT_FEATURE_DISABLED 0xc004000d |
| 371 |
#define DISMAPI_E_MUST_SPECIFY_ONLINE_IMAGE 0xc004000e |
| 372 |
#define DISMAPI_E_INVALID_PRODUCT_KEY 0xc004000f |
| 373 |
#define DISMAPI_E_NEEDS_REMOUNT 0xc1510114 |
| 374 |
#define DISMAPI_E_UNKNOWN_FEATURE 0x800f080c |
| 375 |
#define DISMAPI_E_BUSY 0x800f0902 |
| 376 |
|
| 377 |
#ifdef __cplusplus |
| 378 |
} |
| 379 |
#endif |
| 380 |
|
| 381 |
#endif /* WINAPI_PARTITION_DESKTOP */ |
| 382 |
|
| 383 |
#endif /* _DISMAPI_H_ */ |