Documentation ¶
Overview ¶
Package dism provides an interface to the Deployment Image Servicing and Management (DISM).
Index ¶
- Constants
- func DismAddCapability(Session uint32, Name *uint16, LimitAccess bool, SourcePaths **uint16, ...) (e error)
- func DismAddDriver(Session uint32, DriverPath *uint16, ForceUnsigned bool) (e error)
- func DismAddPackage(Session uint32, PackagePath *uint16, IgnoreCheck bool, PreventPending bool, ...) (e error)
- func DismApplyUnattend(Session uint32, UnattendFile *uint16, SingleSession bool) (e error)
- func DismCloseSession(Session uint32) (e error)
- func DismDisableFeature(Session uint32, FeatureName *uint16, PackageName *uint16, RemovePayload bool, ...) (e error)
- func DismEnableFeature(Session uint32, FeatureName *uint16, Identifier *uint16, ...) (e error)
- func DismInitialize(LogLevel DismLogLevel, LogFilePath *uint16, ScratchDirectory *uint16) (e error)
- func DismOpenSession(ImagePath *uint16, WindowsDirectory *uint16, SystemDrive *uint16, ...) (e error)
- func DismRemoveCapability(Session uint32, Name *uint16, CancelEvent *windows.Handle, ...) (e error)
- func DismRemoveDriver(Session uint32, DriverPath *uint16) (e error)
- func DismRemovePackage(Session uint32, Identifier *uint16, PackageIdentifier *DismPackageIdentifier, ...) (e error)
- func DismShutdown() (e error)
- type DismLogLevel
- type DismPackageIdentifier
- type Session
- func (s Session) AddCapability(name string, limitAccess bool, sourcePaths string, sourcePathsCount uint32, ...) error
- func (s Session) AddPackage(packagePath string, ignoreCheck bool, preventPending bool, ...) error
- func (s Session) Close() error
- func (s Session) DisableFeature(feature string, optPackageName string, cancelEvent *windows.Handle, ...) error
- func (s Session) EnableFeature(feature string, optIdentifier string, ...) error
- func (s Session) RemoveCapability(name string, cancelEvent *windows.Handle, progressCallback unsafe.Pointer) error
- func (s Session) RemovePackage(identifier string, packageIdentifier *DismPackageIdentifier, ...) error
Constants ¶
const ( DISM_ONLINE_IMAGE = "DISM_{53BFAE52-B167-4E2F-A258-0A37B57FF845}" DISM_MOUNT_READWRITE = 0x00000000 DISM_MOUNT_READONLY = 0x00000001 DISM_MOUNT_OPTIMIZE = 0x00000002 DISM_MOUNT_CHECK_INTEGRITY = 0x00000004 DISMAPI_S_RELOAD_IMAGE_SESSION_REQUIRED syscall.Errno = 0x00000001 )
API Constants Ref https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dism-api-constants
Variables ¶
This section is empty.
Functions ¶
func DismAddCapability ¶
func DismAddDriver ¶
func DismAddPackage ¶
func DismApplyUnattend ¶
func DismCloseSession ¶
func DismDisableFeature ¶
func DismEnableFeature ¶
func DismInitialize ¶
func DismInitialize(LogLevel DismLogLevel, LogFilePath *uint16, ScratchDirectory *uint16) (e error)
func DismOpenSession ¶
func DismRemoveCapability ¶
func DismRemoveDriver ¶
func DismRemovePackage ¶
func DismShutdown ¶
func DismShutdown() (e error)
Types ¶
type DismLogLevel ¶
type DismLogLevel uint32
DismLogLevel specifies the kind of information that is reported in the log file. Ref: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dismloglevel-enumeration
const ( // DismLogErrors logs only errors. DismLogErrors DismLogLevel = 0 // DismLogErrorsWarnings logs errors and warnings. DismLogErrorsWarnings DismLogLevel = 1 // DismLogErrorsWarningsInfo logs errors, warnings, and additional information. DismLogErrorsWarningsInfo DismLogLevel = 2 )
type DismPackageIdentifier ¶
type DismPackageIdentifier uint32
DismPackageIdentifier specifies whether a package is identified by name or by file path.
const ( // DismPackageNone indicates that no package is specified. DismPackageNone DismPackageIdentifier = iota // DismPackageName indicates that the package is identified by its name. DismPackageName // DismPackagePath indicates that the package is specified by its path. DismPackagePath )
type Session ¶
type Session struct { Handle *uint32 // contains filtered or unexported fields }
Session holds a dism session. You must call Close() to free up the session upon completion.
func OpenSession ¶
func OpenSession(imagePath, optWindowsDir, optSystemDrive string, logLevel DismLogLevel, optLogFilePath, optScratchDir string) (Session, error)
OpenSession opens a DISM session. The session can be used for subsequent DISM calls.
Don't forget to call Close() on the returned Session object.
Example, modifying the online image:
dism.OpenSession(dism.DISM_ONLINE_IMAGE, "", "", dism.DismLogErrorsWarningsInfo, "", "")
Ref: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/disminitialize-function Ref: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dismopensession-function
func (Session) AddCapability ¶
func (s Session) AddCapability( name string, limitAccess bool, sourcePaths string, sourcePathsCount uint32, cancelEvent *windows.Handle, progressCallback unsafe.Pointer, ) error
AddCapability adds a Windows capability from an image.
Ref: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dismaddcapability
func (Session) AddPackage ¶
func (s Session) AddPackage( packagePath string, ignoreCheck bool, preventPending bool, cancelEvent *windows.Handle, progressCallback unsafe.Pointer, ) error
AddPackage adds Windows packages(s) to an image.
Ref: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dismaddpackage-function
func (Session) Close ¶
Close closes the session and shuts down dism. This must be called prior to exiting.
func (Session) DisableFeature ¶
func (s Session) DisableFeature( feature string, optPackageName string, cancelEvent *windows.Handle, progressCallback unsafe.Pointer, ) error
DisableFeature disables Windows Feature(s).
To disable multiple features, separate each feature name with a semicolon.
May return the error windows.ERROR_SUCCESS_REBOOT_REQUIRED if a reboot is required to complete the operation.
Example, disabling a feature:
s.DisableFeature("SMB1Protocol", "", nil, nil)
func (Session) EnableFeature ¶
func (s Session) EnableFeature( feature string, optIdentifier string, optPackageIdentifier *DismPackageIdentifier, enableAll bool, cancelEvent *windows.Handle, progressCallback unsafe.Pointer, ) error
EnableFeature enables Windows Feature(s).
To enable multiple features, separate each feature name with a semicolon.
May return the error windows.ERROR_SUCCESS_REBOOT_REQUIRED if a reboot is required to complete the operation.
Example, enabling a feature, including all dependencies:
s.EnableFeature("SMB1Protocol", "", nil, true, nil, nil)
func (Session) RemoveCapability ¶
func (s Session) RemoveCapability( name string, cancelEvent *windows.Handle, progressCallback unsafe.Pointer, ) error
RemoveCapability removes a Windows capability from an image.
Ref: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/dism/dismremovecapability
func (Session) RemovePackage ¶
func (s Session) RemovePackage( identifier string, packageIdentifier *DismPackageIdentifier, cancelEvent *windows.Handle, progressCallback unsafe.Pointer, ) error
RemovePackage removes Windows packages(s) from an image.