ole2

package
v0.0.0-...-227fc60 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompoundFileHeader

type CompoundFileHeader struct {
	Signature            [8]byte     // OLE2 signature
	MinorVersion         uint16      // Minor version
	MajorVersion         uint16      // Major version
	ByteOrder            uint16      // Byte order identifier
	SectorSize           uint16      // Sector size (power of 2)
	MiniSectorSize       uint16      // Mini sector size (power of 2)
	Reserved1            uint16      // Reserved field
	Reserved2            uint16      // Reserved field
	NumDirectorySectors  uint32      // Number of directory sectors
	NumFATSectors        uint32      // Number of FAT sectors
	DirectoryFirstSector uint32      // First directory sector
	TransactionSignature uint32      // Transaction signature
	MiniStreamCutoff     uint32      // Mini stream cutoff
	MiniFATFirstSector   uint32      // First mini FAT sector
	NumMiniFATSectors    uint32      // Number of mini FAT sectors
	DIFATFirstSector     uint32      // First DIFAT sector
	NumDIFATSectors      uint32      // Number of DIFAT sectors
	DIFAT                [109]uint32 // First 109 DIFAT entries
}

CompoundFileHeader represents the OLE2 compound file header.

type DirectoryEntry

type DirectoryEntry struct {
	Name         [64]uint16 // UTF-16 encoded name
	NameLength   uint16     // Length of name in bytes
	Type         uint8      // Entry type
	NodeColor    uint8      // Red-black tree node color
	LeftSibling  uint32     // Left sibling directory entry
	RightSibling uint32     // Right sibling directory entry
	Child        uint32     // Child directory entry
	CLSID        [16]byte   // Class ID
	StateBits    uint32     // State bits
	Created      uint64     // Creation time
	Modified     uint64     // Modified time
	StartSector  uint32     // Starting sector
	Size         uint64     // Size in bytes
}

DirectoryEntry represents an OLE2 directory entry.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader provides access to streams within an OLE2 compound file.

func NewReader

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

NewReader initializes an OLE2 reader from an io.ReaderAt.

func (*Reader) ListStreams

func (r *Reader) ListStreams() []string

ListStreams returns the names of all streams in the OLE2 file (for debugging)

func (*Reader) ReadStream

func (r *Reader) ReadStream(name string) ([]byte, error)

ReadStream finds a stream by name and returns its content.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer provides functionality for creating OLE2 compound documents.

func NewWriter

func NewWriter() *Writer

NewWriter creates a new OLE2 writer.

func (*Writer) AddStream

func (w *Writer) AddStream(name string, data []byte)

AddStream adds a stream to the compound document.

func (*Writer) WriteTo

func (w *Writer) WriteTo(writer io.Writer) error

WriteTo writes the complete compound document to the writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL