...

Package wim

import "github.com/Microsoft/go-winio/wim"
Overview
Index
Subdirectories

Overview ▾

Package wim implements a WIM file parser.

WIM files are used to distribute Windows file system and container images. They are documented at https://msdn.microsoft.com/en-us/library/windows/desktop/dd861280.aspx.

Constants

File attribute constants from Windows.

const (
    FILE_ATTRIBUTE_READONLY            = 0x00000001
    FILE_ATTRIBUTE_HIDDEN              = 0x00000002
    FILE_ATTRIBUTE_SYSTEM              = 0x00000004
    FILE_ATTRIBUTE_DIRECTORY           = 0x00000010
    FILE_ATTRIBUTE_ARCHIVE             = 0x00000020
    FILE_ATTRIBUTE_DEVICE              = 0x00000040
    FILE_ATTRIBUTE_NORMAL              = 0x00000080
    FILE_ATTRIBUTE_TEMPORARY           = 0x00000100
    FILE_ATTRIBUTE_SPARSE_FILE         = 0x00000200
    FILE_ATTRIBUTE_REPARSE_POINT       = 0x00000400
    FILE_ATTRIBUTE_COMPRESSED          = 0x00000800
    FILE_ATTRIBUTE_OFFLINE             = 0x00001000
    FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000
    FILE_ATTRIBUTE_ENCRYPTED           = 0x00004000
    FILE_ATTRIBUTE_INTEGRITY_STREAM    = 0x00008000
    FILE_ATTRIBUTE_VIRTUAL             = 0x00010000
    FILE_ATTRIBUTE_NO_SCRUB_DATA       = 0x00020000
    FILE_ATTRIBUTE_EA                  = 0x00040000
)

Windows processor architectures.

const (
    PROCESSOR_ARCHITECTURE_INTEL         = 0
    PROCESSOR_ARCHITECTURE_MIPS          = 1
    PROCESSOR_ARCHITECTURE_ALPHA         = 2
    PROCESSOR_ARCHITECTURE_PPC           = 3
    PROCESSOR_ARCHITECTURE_SHX           = 4
    PROCESSOR_ARCHITECTURE_ARM           = 5
    PROCESSOR_ARCHITECTURE_IA64          = 6
    PROCESSOR_ARCHITECTURE_ALPHA64       = 7
    PROCESSOR_ARCHITECTURE_MSIL          = 8
    PROCESSOR_ARCHITECTURE_AMD64         = 9
    PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 10
    PROCESSOR_ARCHITECTURE_NEUTRAL       = 11
    PROCESSOR_ARCHITECTURE_ARM64         = 12
)

type File

File represents a file or directory in a WIM image.

type File struct {
    FileHeader
    Streams []*Stream
    // contains filtered or unexported fields
}

func (*File) Open

func (f *File) Open() (io.ReadCloser, error)

Open returns an io.ReadCloser that can be used to read the file's contents.

func (*File) Readdir

func (f *File) Readdir() ([]*File, error)

Readdir reads the directory entries.

type FileHeader

FileHeader contains file metadata.

type FileHeader struct {
    Name               string
    ShortName          string
    Attributes         uint32
    SecurityDescriptor []byte
    CreationTime       Filetime
    LastAccessTime     Filetime
    LastWriteTime      Filetime
    Hash               SHA1Hash
    Size               int64
    LinkID             int64
    ReparseTag         uint32
    ReparseReserved    uint32
}

func (*FileHeader) IsDir

func (f *FileHeader) IsDir() bool

IsDir returns whether the given file is a directory. It returns false when it is a directory reparse point.

type Filetime

Filetime represents a Windows time.

type Filetime struct {
    LowDateTime  uint32
    HighDateTime uint32
}

func (*Filetime) Time

func (ft *Filetime) Time() time.Time

Time returns the time as time.Time.

func (*Filetime) UnmarshalXML

func (ft *Filetime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML unmarshalls the time from a WIM XML blob.

type Image

Image represents an image within a WIM file.

type Image struct {
    ImageInfo
    // contains filtered or unexported fields
}

func (*Image) Open

func (img *Image) Open() (*File, error)

Open parses the image and returns the root directory.

type ImageInfo

ImageInfo contains information about the image.

type ImageInfo struct {
    Name         string       `xml:"NAME"`
    Index        int          `xml:"INDEX,attr"`
    CreationTime Filetime     `xml:"CREATIONTIME"`
    ModTime      Filetime     `xml:"LASTMODIFICATIONTIME"`
    Windows      *WindowsInfo `xml:"WINDOWS"`
}

type ParseError

ParseError is returned when the WIM cannot be parsed.

type ParseError struct {
    Oper string
    Path string
    Err  error
}

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) Unwrap

func (e *ParseError) Unwrap() error

type Reader

Reader provides functions to read a WIM file.

type Reader struct {
    XMLInfo string   // The XML information about the WIM.
    Image   []*Image // The WIM's images.
    // contains filtered or unexported fields
}

func NewReader

func NewReader(f io.ReaderAt) (*Reader, error)

NewReader returns a Reader that can be used to read WIM file data.

func (*Reader) Close

func (r *Reader) Close() error

Close releases resources associated with the Reader.

type SHA1Hash

SHA1Hash contains the SHA1 hash of a file or stream.

type SHA1Hash [20]byte

type Stream

Stream represents an alternate data stream or reparse point data stream.

type Stream struct {
    StreamHeader
    // contains filtered or unexported fields
}

func (*Stream) Open

func (s *Stream) Open() (io.ReadCloser, error)

Open returns an io.ReadCloser that can be used to read the stream's contents.

type StreamHeader

StreamHeader contains alternate data stream metadata.

type StreamHeader struct {
    Name string
    Hash SHA1Hash
    Size int64
}

type Version

Version represents a Windows build version.

type Version struct {
    Major   int `xml:"MAJOR"`
    Minor   int `xml:"MINOR"`
    Build   int `xml:"BUILD"`
    SPBuild int `xml:"SPBUILD"`
    SPLevel int `xml:"SPLEVEL"`
}

type WindowsInfo

WindowsInfo contains information about the Windows installation in the image.

type WindowsInfo struct {
    Arch             byte     `xml:"ARCH"`
    ProductName      string   `xml:"PRODUCTNAME"`
    EditionID        string   `xml:"EDITIONID"`
    InstallationType string   `xml:"INSTALLATIONTYPE"`
    ProductType      string   `xml:"PRODUCTTYPE"`
    Languages        []string `xml:"LANGUAGES>LANGUAGE"`
    DefaultLanguage  string   `xml:"LANGUAGES>DEFAULT"`
    Version          Version  `xml:"VERSION"`
    SystemRoot       string   `xml:"SYSTEMROOT"`
}

Subdirectories

Name Synopsis
..
lzx Package lzx implements a decompressor for the the WIM variant of the LZX compression algorithm.
validate