#include-once

; #INDEX# =======================================================================================================================
; Title .........: DISM_Constants
; AutoIt Version : 3.3.8.1
; Description ...: Constants for DISM API.
; Author(s) .....: André Cut
; ===============================================================================================================================

; #TYPEDEFS# ====================================================================================================================
Global Const $tagSession = "UINT DismSession"
; ===============================================================================================================================

; #CALLBACKS# ===================================================================================================================
; none
 ; ===============================================================================================================================

; #CONSTANTS# ====================================================================================================================
Global Const $DISM_ONLINE_IMAGE = "DISM_{53BFAE52-B167-4E2F-A258-0A37B57FF845}"
Global Const $DISM_SESSION_DEFAULT = 0
Global Const $S_OK = 0

; Mount flags
Global Const $DISM_MOUNT_READWRITE = 0x00000000
Global Const $DISM_MOUNT_READONLY = 0x00000001
Global Const $DISM_MOUNT_OPTIMIZE = 0x00000002
Global Const $DISM_MOUNT_CHECK_INTEGRITY = 0x00000004

; Unmount flags
Global Const $DISM_COMMIT_IMAGE = 0x00000000
Global Const $DISM_DISCARD_IMAGE = 0x00000001

; Commit flags
Global Const $DISM_COMMIT_GENERATE_INTEGRITY = 0x00010000
Global Const $DISM_COMMIT_APPEND = 0x00020000

; Commit flags may also be used with unmount. Use this with unmount flags and you will
; get the commit-specific flags.
Global Const $DISM_COMMIT_MASK = 0xffff0000
; ===============================================================================================================================

; #SUCCESS CODES# ===============================================================================================================
; For online scenario, computer needs to be restarted when the return value is ERROR_SUCCESS_REBOOT_REQUIRED (3010L).
Global Const $ERROR_SUCCESS_REBOOT_REQUIRED = 3010 ;???

; MessageId: DISMAPI_S_RELOAD_IMAGE_SESSION_REQUIRED
; MessageText:
; The DISM session needs to be reloaded.
Global Const $DISMAPI_S_RELOAD_IMAGE_SESSION_REQUIRED = 0x00000001
; ===============================================================================================================================

; #ERROR CODES# =================================================================================================================
; MessageId: DISMAPI_E_DISMAPI_NOT_INITIALIZED
; MessageText:
; DISM API was not initialized for this process

Global Const $DISMAPI_E_DISMAPI_NOT_INITIALIZED = 0xC0040001

; MessageId: DISMAPI_E_SHUTDOWN_IN_PROGRESS
; MessageText:
; A DismSession was being shutdown when another operation was called on it

Global Const $DISMAPI_E_SHUTDOWN_IN_PROGRESS = 0xC0040002

; MessageId: DISMAPI_E_OPEN_SESSION_HANDLES
; MessageText:
; A DismShutdown was called while there were open DismSession handles

Global Const $DISMAPI_E_OPEN_SESSION_HANDLES = 0xC0040003

; MessageId: DISMAPI_E_INVALID_DISM_SESSION
; MessageText:
; An invalid DismSession handle was passed into a DISMAPI function

Global Const $DISMAPI_E_INVALID_DISM_SESSION = 0xC0040004

; MessageId: DISMAPI_E_INVALID_IMAGE_INDEX
; MessageText:
; An invalid image index was specified

Global Const $DISMAPI_E_INVALID_IMAGE_INDEX = 0xC0040005

; MessageId: DISMAPI_E_INVALID_IMAGE_NAME
; MessageText:
; An invalid image name was specified

Global Const $DISMAPI_E_INVALID_IMAGE_NAME = 0xC0040006

; MessageId: DISMAPI_E_UNABLE_TO_UNMOUNT_IMAGE_PATH
; MessageText:
; An image that is not a mounted WIM or mounted VHD was attempted to be unmounted

Global Const $DISMAPI_E_UNABLE_TO_UNMOUNT_IMAGE_PATH = 0xC0040007

; MessageId: DISMAPI_E_LOGGING_DISABLED
; MessageText:
; Failed to gain access to the log file user specified. Logging has been disabled..

Global Const $DISMAPI_E_LOGGING_DISABLED = 0xC0040009

; MessageId: DISMAPI_E_OPEN_HANDLES_UNABLE_TO_UNMOUNT_IMAGE_PATH
; MessageText:
; A DismSession with open handles was attempted to be unmounted

Global Const $DISMAPI_E_OPEN_HANDLES_UNABLE_TO_UNMOUNT_IMAGE_PATH = 0xC004000A

; MessageId: DISMAPI_E_OPEN_HANDLES_UNABLE_TO_MOUNT_IMAGE_PATH
; MessageText:
; A DismSession with open handles was attempted to be mounted

Global Const $DISMAPI_E_OPEN_HANDLES_UNABLE_TO_MOUNT_IMAGE_PATH = 0xC004000B

; MessageId: DISMAPI_E_OPEN_HANDLES_UNABLE_TO_REMOUNT_IMAGE_PATH
; MessageText:
; A DismSession with open handles was attempted to be remounted

Global Const $DISMAPI_E_OPEN_HANDLES_UNABLE_TO_REMOUNT_IMAGE_PATH = 0xC004000C

; MessageId: DISMAPI_E_PARENT_FEATURE_DISABLED
; MessageText:
; One or several parent features are disabled so current feature can not be enabled.
; Solutions:
; 1 Call function DismGetFeatureParent to get all parent features and enable all of them. Or
; 2 Set EnableAll to TRUE when calling function DismEnableFeature

Global Const $DISMAPI_E_PARENT_FEATURE_DISABLED = 0xC004000D

; MessageId: DISMAPI_E_MUST_SPECIFY_ONLINE_IMAGE
; MessageText:
; The offline image specified is the running system. The macro DISM_ONLINE_IMAGE must be used instead

Global Const $DISMAPI_E_MUST_SPECIFY_ONLINE_IMAGE = 0xC004000E

; MessageId: DISMAPI_E_NEEDS_TO_REMOUNT_THE_IMAGE
; MessageText:
; The image needs to be remounted before any servicing operation

Global Const $DISMAPI_E_NEEDS_REMOUNT = 0xC1510114

; MessageId: DISMAPI_E_UNKNOWN_FEATURE
; MessageText:
; The feature is not present in the package

Global Const $DISMAPI_E_UNKNOWN_FEATURE = 0x800F080c

; MessageId: DISMAPI_E_BUSY
; MessageText:
; The current package and feature servicing infrastructure is busy.
; Wait a bit and try the operation again

Global Const $DISMAPI_E_BUSY = 0x800F0902

; MessageId: DISMAPI_E_FILE_NOT_FOUND
; MessageText:
; File not found

Global Const $DISMAPI_E_FILE_NOT_FOUND = 0x80070002

; MessageId: E_INVALIDARG
; MessageText:
; One or more arguments are not valid: e.g. any of the paths are not well-formed, does not exist or are invalid. Or
; the DismSession is invalid or not associated with a mounted image

Global Const $E_INVALIDARG = 0x80070057

; MessageId: CBS_E_INVALID_PACKAGE
; MessageText:
; The current package is invalid

Global Const $CBS_E_INVALID_PACKAGE = 0x800F0805

; MessageId: CBS_E_CANNOT_UNINSTALL
; MessageText:
; Permanent package cannot be uninstalled

Global Const $CBS_E_CANNOT_UNINSTALL = 0x800F0825

; MessageId: DISMAPI_E_INVALID_MOUNT_PATH
; MessageText:
; The assigned mount path is not a valid WIM mount path

Global Const $DISMAPI_E_INVALID_MOUNT_PATH = 0x80070003

; MessageId: DISMAPI_E_UNABLE_TO_UNMOUNT_IMAGE_PROPERLY
; MessageText:
; The directory could not be completely unmounted

Global Const $DISMAPI_E_UNABLE_TO_UNMOUNT_IMAGE_PROPERLY = 0xC1420117

; MessageId: DISMAPI_E_UNABLE_TO_OPEN_IMAGE_PATH
; MessageText:
; Failed to gain access to the mount path

Global Const $DISMAPI_E_UNABLE_TO_OPEN_IMAGE_PATH = 0xC1420127
; ===============================================================================================================================

; #ENUMS# =======================================================================================================================
; DismLogLevel
Global Enum _
   $DismLogErrors, _
   $DismLogErrorsWarnings, _
   $DismLogErrorsWarningsInfo

; DismImageIdentifier
Global Enum _
   $DismImageIndex, _
   $DismImageName

; DismMountMode
Global Enum _
   $DismReadWrite, _
   $DismReadOnly 

; DismImageType
Global Enum _
   $DismImageTypeUnsupported = -1, _
   $DismImageTypeWim, _
   $DismImageTypeVhd

; DismImageBootable
Global Enum _
   $DismImageBootableYes, _
   $DismImageBootableNo, _
   $DismImageBootableUnknown

; DismMountStatus
Global Enum _
   $DismMountStatusOk, _
   $DismMountStatusNeedsRemount, _
   $DismMountStatusInvalid

; DismImageHealthState
Global Enum _
   $DismImageHealthy, _
   $DismImageRepairable, _
   $DismImageNonRepairable

; DismPackageIdentifier
Global Enum _
   $DismPackageNone, _
   $DismPackageName, _
   $DismPackagePath

; DismPackageFeatureState 
Global Enum _
   $DismStateNotPresent, _
   $DismStateUninstallPending, _
   $DismStateStaged, _
   $DismStateResolved, _
   $DismStateRemoved = $DismStateResolved, _
   $DismStateInstalled, _
   $DismStateInstallPending, _
   $DismStateSuperseded, _
   $DismStatePartiallyInstalled

; DismReleaseType 
Global Enum _
   $DismReleaseTypeCriticalUpdate, _
   $DismReleaseTypeDriver, _
   $DismReleaseTypeFeaturePack, _
   $DismReleaseTypeHotfix, _
   $DismReleaseTypeSecurityUpdate, _
   $DismReleaseTypeSoftwareUpdate, _
   $DismReleaseTypeUpdate, _
   $DismReleaseTypeUpdateRollup, _
   $DismReleaseTypeLanguagePack, _
   $DismReleaseTypeFoundation, _
   $DismReleaseTypeServicePack, _
   $DismReleaseTypeProduct, _
   $DismReleaseTypeLocalPack, _
   $DismReleaseTypeOther

; DismRestartType 
Global Enum _
   $DismRestartNo, _
   $DismRestartPossible, _
   $DismRestartRequired

; DismDriverSignature
Global Enum _
   $DismDriverSignatureUnknown, _
   $DismDriverSignatureUnsigned, _
   $DismDriverSignatureSigned

; DismFullyOfflineInstallableType
Global Enum _
   $DismFullyOfflineInstallable, _
   $DismFullyOfflineNotInstallable, _
   $DismFullyOfflineInstallableUndetermined
; ===============================================================================================================================

; #STRUCTS# =====================================================================================================================

Global Const $_tagSYSTEMTIME = "WORD wYear;WORD wMonth;WORD wDayOfWeek;WORD wDay;WORD wHour;WORD wMinute;WORD wSecond;WORD wMilliseconds"

; DismPackage
Global Const $tagDismPackage = "PTR PackageName;INT PackageState;INT ReleaseType;" & $_tagSYSTEMTIME


; DismCustomProperty
Global Const $tagDismCustomProperty = "PTR Name;PTR Value;PTR Path"


; DismFeature
Global Const $tagDismFeature = "PTR FeatureName;INT State"



; DismPackageInfo
Global Const $tagDismPackageInfo = "PTR PackageName;INT PackageState;INT ReleaseType;" & $_tagSYSTEMTIME & ";BOOL Applicable;PTR Copyright;PTR Company;" & $_tagSYSTEMTIME & _
								   ";PTR DisplayName;PTR Description;PTR InstallClient;PTR InstallPackageName;" & $_tagSYSTEMTIME & ";PTR ProductName;PTR ProductVersion;" & _
								   "INT RestartRequired;INT FullyOffline;PTR SupportInformation;PTR CustomProperty;UINT CustomPropertyCount;PTR Feature;UINT FeatureCount"


; DismFeatureInfo
Global Const $tagDismFeatureInfo = "PTR FeatureName;INT FeatureState;PTR DisplayName;PTR Description;INT RestartRequired;PTR CustomProperty;UINT CustomPropertyCount"

; _DismString
Global Const $tagDismString = "PTR Value"

; DismLanguage
Global Const $tagDismLanguage = $tagDismString

; DismWimCustomizedInfo
Global Const $tagDismWimCustomizedInfo = "UINT Size;UINT DirectoryCount;UINT FileCount;" & $_tagSYSTEMTIME & ";" & $_tagSYSTEMTIME



; DismImageInfo
Global Const $tagDismImageInfo = "INT ImageType;UINT ImageIndex;PTR ImageName;PTR ImageDescription;UINT64 ImageSize;UINT Architecture;PTR ProductName;PTR EditionId;PTR InstallationType;" & _
								 "PTR Hal;PTR ProductType;PTR ProductSuite;UINT MajorVersion;UINT MinorVersion;UINT Build;UINT SpBuild;UINT SpLevel;INT Bootable;PTR SystemRoot;" & _
								 "PTR Language;UINT LanguageCount;UINT DefaultLanguageIndex;PTR CustomizedInfo"


; DismMountedImageInfo
Global Const $tagDismMountedImageInfo = "PTR MountPath;PTR ImageFilePath;UINT ImageIndex;INT MountMode;INT MountStatus"


; DismDriverPackage
Global Const $tagDismDriverPackage = "PTR PublishedName;PTR OriginalFileName;BOOL InBox;PTR CatalogFile;PTR ClassName;PTR ClassGuid;PTR ClassDescription;" & _
                                     "BOOL BootCritical;INT DriverSignature;PTR ProviderName;" & $_tagSYSTEMTIME & ";UINT MajorVersion;UINT MinorVersion;UINT Build;UINT Revision"


; DismDriver
Global Const $tagDismDriver = "PTR ManufacturerName;PTR HardwareDescription;PTR HardwareId;WORD Architecture;PTR ServiceName;PTR CompatibleIds;PTR ExcludeIds"
; ===============================================================================================================================

; #STRUCTURE# ===================================================================================================================
; Name...........: $tagWIM_INFO
; Description ...: The WIM_INFO structure contains information retrieved by the WIMGetAttributes function.
; Fields ........: WimPath         - Specifies the full path to the .wim file.
;                  GUID            - Specifies a GUID structure containing the unique identifier for the Windows image (.wim) file.
;                  ImageCount      - Specifies the number of images contained in the .wim file. This value is also returned by the WIMGetImageCount function.
;                  CompressionType - Specifies the method of compression used to compress resources in the .wim file.
;									   | $WIM_COMPRESS_NONE   - Wim does not use file compression.
;									   | $WIM_COMPRESS_XPRESS - Wim uses XPRESS file compression. (fast)
;									   | $WIM_COMPRESS_LZX    - Wim uses LZX file compression. (max)
;                  PartNumber      - Specifies the part number of the current .wim file in a spanned set.
;									 This value should be one, unless the data of the .wim file was originally split by the _WIM_SplitFile function.
;                  TotalParts      - Specifies the total number of .wim file parts in a spanned set.
;									 This value must be one, unless the data of the .wim file was originally split via the _WIM_SplitFile function.
;                  BootIndex       - Specifies the index of the bootable image in the .wim file. If this value is zero, then there are no bootable images available.
;									 To set a bootable image, call the _WIM_SetBootImage function.
;                  WimAttributes   - Specifies how the file is treated and what features will be used.
;								   	   | $WIM_ATTRIBUTE_NORMAL        - The .wim file does not have any other attributes set.
;									   | $WIM_ATTRIBUTE_RESOURCE_ONLY - The .wim file only contains file resources and no images or metadata.
;									   | $WIM_ATTRIBUTE_METADATA_ONLY - The .wim file only contains image resources and XML information.
;									   | $WIM_ATTRIBUTE_VERIFY_DATA   - The .wim file contains integrity data that can be used by the _WIM_CopyFile or _WIM_CreateFile function.
;									   | $WIM_ATTRIBUTE_RP_FIX        - The .wim file contains one or more images where symbolic link or junction path fixup is enabled.
;									   | $WIM_ATTRIBUTE_SPANNED       - The .wim file has been split into multiple pieces via _WIM_SplitFile.
;									   | $WIM_ATTRIBUTE_READONLY      - The .wim file is locked and cannot be modified.
;				   WimFlagsAndAttr - Specifies the flags used during a _WIM_CreateFile function.
;									   | $WIM_FLAG_VERIFY      - Generates data integrity information for new files. Verifies and updates existing files.
;									   | $WIM_FLAG_SHARE_WRITE - Opens the .wim file in a mode that enables simultaneous reading and writing.
; Author ........: Jonathan Holmgren (Homes32)
; Remarks .......:
; ===============================================================================================================================

