cfb

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ByteOrder = []byte{0xFE, 0xFF}

ByteOrder - This field MUST be set to 0xFFFE. This field is a byte order mark for all integer fields, specifying little-endian byte order.

View Source
var DIFSECT = []byte{0xFC, 0xFF, 0xFF, 0xFF}

DIFSECT - Specifies a DIFAT sector in the FAT.

View Source
var DefaultDIFATEntries = uint32(109)

DefaultDIFATEntries -Number FAT locations in DIFAT

View Source
var ENDOFCHAIN = []byte{0xFE, 0xFF, 0xFF, 0xFF}

ENDOFCHAIN - End of a linked chain of sectors.

View Source
var EntrySize = 128

EntrySize - Directory array entry length

View Source
var FATSECT = []byte{0xFD, 0xFF, 0xFF, 0xFF}

FATSECT - Specifies a FAT sector in the FAT.

View Source
var FREESECT = []byte{0xFF, 0xFF, 0xFF, 0xFF}

FREESECT - Specifies an unallocated sector in the FAT, Mini FAT, or DIFAT

View Source
var HeaderSignature = []byte{0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1}

HeaderSignature Identification signature for the compound file structure, and MUST be set to the value ...

View Source
var MajorVersion = [][]byte{MajorVersion3, MajorVersion4}

MajorVersion -Version number for breaking changes. This field MUST be set to either 0x0003 (version 3) or 0x0004 (version 4).

View Source
var MajorVersion3 = []byte{0x03, 0x00}

MajorVersion3 - Version number sign fot version 3

View Source
var MajorVersion4 = []byte{0x04, 0x00}

MajorVersion4 - Version number sign fot version 4

View Source
var MiniSectorShift = []byte{0x06, 0x00}

MiniSectorShift - This field MUST be set to 0x0009, or 0x000c, depending on the Major Version field. This field specifies the sector size of the compound file as a power of 2.

View Source
var MiniStreamCutoffSize = []byte{0x00, 0x10, 0x00, 0x00}

MiniStreamCutoffSize - This integer field MUST be set to 0x00001000. This field specifies the maximum size of a user-defined data stream that is allocated from the mini FAT and mini stream, and that cutoff is 4,096 bytes. Any user-defined data stream that is greater than or equal to this cutoff size must be allocated as normal sectors from the FAT.

View Source
var NumberDirectorySectorsForMajorVersion3 = []byte{0x00, 0x00, 0x00, 0x00}

NumberDirectorySectorsForMajorVersion3 - If Major Version is 3, the Number of Directory Sectors MUST be zero.

View Source
var Reserved = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

Reserved - This field MUST be set to all zeroes.

View Source
var SectorShiftForMajorVersion3 = []byte{0x09, 0x00}

SectorShiftForMajorVersion3 - If Major Version is 3, the Sector Shift MUST be 0x0009, specifying a sector size of 512 bytes.

View Source
var SectorShiftForMajorVersion4 = []byte{0x0C, 0x00}

SectorShiftForMajorVersion4 - If Major Version is 4, the Sector Shift MUST be 0x000C, specifying a sector size of 4096 bytes.

Functions

This section is empty.

Types

type Cfb

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

Cfb - Compound File Binary

func OpenFile

func OpenFile(filename string) (cfb Cfb, err error)

OpenFile - Open document from the file

func OpenReader

func OpenReader(reader io.ReadSeeker) (cfb Cfb, err error)

OpenReader - Open document from the reader

func (*Cfb) GetDirs

func (cfb *Cfb) GetDirs() []*Directory

GetDirs - Get a list of directories

func (*Cfb) OpenObject

func (cfb *Cfb) OpenObject(object *Directory, root *Directory) (reader io.ReadSeeker, err error)

OpenObject - Get object stream

type Directory

type Directory struct {
	DirectoryEntryName       [64]byte
	DirectoryEntryNameLength [2]byte
	ObjectType               byte
	ColorFlag                [1]byte
	LeftSiblingID            [4]byte
	RightSiblingID           [4]byte
	ChildID                  [4]byte
	CLSID                    [16]byte
	StateBits                [4]byte
	CreationTime             [8]byte
	ModifiedTime             [8]byte
	StartingSectorLocation   [4]byte
	StreamSize               [8]byte
}

Directory - Compound File Directory Entry

func (*Directory) GetStartingSectorLocation

func (d *Directory) GetStartingSectorLocation() uint32

GetStartingSectorLocation - The start sector of the object

func (*Directory) GetStreamSize

func (d *Directory) GetStreamSize() uint32

GetStreamSize - Object size

func (*Directory) Name

func (d *Directory) Name() string

Name - Directory Name

type Header struct {
	HeaderSignature              [8]byte
	HeaderCLSID                  [16]byte
	MinorVersion                 [2]byte
	MajorVersion                 [2]byte
	ByteOrder                    [2]byte
	SectorShift                  [2]byte
	MiniSectorShift              [2]byte
	Reserved                     [6]byte
	NumberDirectorySectors       [4]byte
	NumberFATSectors             [4]byte
	FirstDirectorySectorLocation [4]byte
	TransactionSignatureNumber   [4]byte
	MiniStreamCutoffSize         [4]byte
	FirstMiniFATSectorLocation   [4]byte
	NumberMiniFATSectors         [4]byte
	FirstDIFATSectorLocation     [4]byte
	NumberDIFATSectors           [4]byte
	DIFAT                        [3584]byte
}

Header - The Compound File Header structure

type Sector

type Sector struct {
	SectorSize uint32
	Data       []byte
}

Sector struct

func NewMiniFatSector

func NewMiniFatSector(header *Header) Sector

NewMiniFatSector - Create new Sector struct for MiniFat

func NewSector

func NewSector(header *Header) Sector

NewSector - Create new Sector struct fot FAT

Jump to

Keyboard shortcuts

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