wim

package
Version: v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

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.

Index

Constants

View Source
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
)

File attribute constants from Windows.

View Source
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
)

Windows processor architectures.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

File represents a file or directory in a WIM image.

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

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
}

FileHeader contains file metadata.

func (*FileHeader) IsDir added in v0.3.1

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 added in v0.3.1

type Filetime struct {
	LowDateTime  uint32
	HighDateTime uint32
}

Filetime represents a Windows time.

func (*Filetime) Time added in v0.3.1

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

Time returns the time as time.Time.

func (*Filetime) UnmarshalXML added in v0.3.1

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

UnmarshalXML unmarshals the time from a WIM XML blob.

type Image

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

Image represents an image within a WIM file.

func (*Image) Open

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

Open parses the image and returns the root directory.

type ImageInfo added in v0.3.1

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

ImageInfo contains information about the image.

type ParseError

type ParseError struct {
	Oper string
	Path string
	Err  error
}

ParseError is returned when the WIM cannot be parsed.

func (*ParseError) Error

func (e *ParseError) Error() string

type Reader

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

Reader provides functions to read a WIM file.

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 added in v0.3.5

func (r *Reader) Close() error

Close releases resources associated with the Reader.

type SHA1Hash

type SHA1Hash [20]byte

SHA1Hash contains the SHA1 hash of a file or stream.

type Stream

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

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

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

type StreamHeader struct {
	Name string
	Hash SHA1Hash
	Size int64
}

StreamHeader contains alternate data stream metadata.

type Version added in v0.3.1

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

Version represents a Windows build version.

type WindowsInfo added in v0.3.1

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"`
}

WindowsInfo contains information about the Windows installation in the image.

Directories

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL