Documentation ¶
Index ¶
- Constants
- Variables
- func NameChainFromPath(s string) []string
- func PathFromNameChain(names []string) string
- func ValidateName(name string, nameUtf16 []uint16) error
- type Allocator
- func (a *Allocator) Next(index uint32) (uint32, error)
- func (a *Allocator) OpenChain(sectorId uint32, init SectorInit) (*Chain, error)
- func (a *Allocator) SeekToSector(sectorId uint32) (*Sector, error)
- func (a *Allocator) SeekWithinSector(sectorId uint32, offset int64) (*Sector, error)
- func (a *Allocator) SeekWithinSubSector(sectorId uint32, subSectorIndexWithinSector uint32, subSectorLen int64, ...) (*Sector, error)
- func (a *Allocator) Validate() error
- type Chain
- func (c *Chain) IntoSubSector(subSectorIndex uint32, subSectorLen int64, offsetWithin uint64) (*Sector, error)
- func (c *Chain) Len() uint64
- func (c *Chain) NumSectors() uint32
- func (c *Chain) Read(p []byte) (int, error)
- func (c *Chain) ReadAll(p []byte) (int, error)
- func (c *Chain) Seek(offset int64, whence int) (int64, error)
- type Color
- type CompoundFile
- type DirEntry
- type Directory
- type Entries
- type EntriesOrder
- type EntriesStack
- type Entry
- type Header
- type MiniAlloc
- func (a *MiniAlloc) Next(sectorId uint32) (uint32, error)
- func (a *MiniAlloc) OpenMiniChain(sectorId uint32) (*MiniChain, error)
- func (a *MiniAlloc) RootDirEntry() *Entry
- func (a *MiniAlloc) SeekWithinMiniSector(sectorId uint32, offset uint64) (*Sector, error)
- func (a *MiniAlloc) StreamIDForNameChain(names []string) (uint32, error)
- func (a *MiniAlloc) Validate() error
- type MiniChain
- type ObjectType
- type Ordering
- type Sector
- type SectorInit
- type Sectors
- type Stream
- type Validation
- type Version
Constants ¶
View Source
const ( HEADER_LEN int = 512 // length of CFB file header, in bytes DIR_ENTRY_LEN int = 128 // length of directory entry, in bytes NUM_DIFAT_ENTRIES_IN_HEADER int = 109 )
View Source
const ( MINOR_VERSION int = 0x3e BYTE_ORDER_MARK uint16 = 0xfffe MINI_SECTOR_SHIFT uint16 = 6 // 64-byte mini sectors MINI_SECTOR_LEN int = 1 << (MINI_SECTOR_SHIFT) MINI_STREAM_CUTOFF uint32 = 4096 )
View Source
const ( MAX_REGULAR_SECTOR uint32 = 0xfffffffa INVALID_SECTOR uint32 = 0xfffffffb DIFAT_SECTOR uint32 = 0xfffffffc FAT_SECTOR uint32 = 0xfffffffd END_OF_CHAIN uint32 = 0xfffffffe FREE_SECTOR uint32 = 0xffffffff )
Constants for FAT entries:
View Source
const ( ROOT_DIR_NAME = "Root Entry" OBJ_TYPE_UNALLOCATED uint8 = 0 OBJ_TYPE_STORAGE uint8 = 1 OBJ_TYPE_STREAM uint8 = 2 OBJ_TYPE_ROOT uint8 = 5 COLOR_RED uint8 = 0 COLOR_BLACK uint8 = 1 ROOT_STREAM_ID uint32 = 0 MAX_REGULAR_STREAM_ID uint32 = 0xfffffffa NO_STREAM uint32 = 0xffffffff )
Constants for directory entries:
View Source
const BUFFER_SIZE uint32 = 8192
View Source
const MAX_NAME_LEN int = 31
Variables ¶
View Source
var (
ErrorInvalidCFB = errors.New("invalid cfb file")
)
View Source
var MAGIC_NUMBER = []byte{0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1}
Constants for CFB file header values:
Functions ¶
func NameChainFromPath ¶ added in v0.1.1
func PathFromNameChain ¶ added in v0.1.1
func ValidateName ¶
Types ¶
type Allocator ¶
type Allocator struct { Sectors *Sectors DifatSectorIds []uint32 Difat []uint32 Fat []uint32 Validation Validation }
func NewAllocator ¶
func (*Allocator) OpenChain ¶ added in v0.1.1
func (a *Allocator) OpenChain(sectorId uint32, init SectorInit) (*Chain, error)
func (*Allocator) SeekWithinSector ¶
func (*Allocator) SeekWithinSubSector ¶ added in v0.1.1
type Chain ¶
type Chain struct { Allocator *Allocator SectorInit SectorInit SectorIds []uint32 OffsetFromStart uint64 }
func NewChain ¶
func NewChain(allocator *Allocator, startingSectorId uint32, init SectorInit) (*Chain, error)
func (*Chain) IntoSubSector ¶ added in v0.1.1
func (*Chain) NumSectors ¶
type CompoundFile ¶
type CompoundFile struct { Reader io.ReadSeeker Header *Header Directory *Directory MiniAlloc *MiniAlloc }
func Open ¶
func Open(reader io.ReadSeeker, validation Validation) (*CompoundFile, error)
func (*CompoundFile) Exists ¶ added in v0.1.1
func (c *CompoundFile) Exists(path string) (bool, error)
func (*CompoundFile) IsStream ¶ added in v0.1.1
func (c *CompoundFile) IsStream(path string) (bool, error)
func (*CompoundFile) OpenStream ¶ added in v0.1.1
func (c *CompoundFile) OpenStream(path string) (*Stream, error)
func (*CompoundFile) RootEntry ¶ added in v0.1.1
func (c *CompoundFile) RootEntry() *Entry
type DirEntry ¶
type DirEntry struct { Name string ObjType ObjectType Color Color LeftSibling uint32 RightSibling uint32 Child uint32 CLSID uuid.UUID StateBits uint32 CreationTime uint64 ModifiedTime uint64 StartingSector uint32 StreamSize uint64 }
func NewDirEntry ¶
func NewDirEntry(name string, objType ObjectType, timestamp uint64) *DirEntry
func ReadDirEntry ¶
func ReadDirEntry(reader io.ReadSeeker, version Version, validation Validation) (*DirEntry, error)
type Directory ¶
func NewDirectory ¶
func (*Directory) RootDirEntry ¶
func (*Directory) RootStorageEntries ¶ added in v0.1.1
Returns an iterator over the entries within the root storage object.
func (*Directory) StreamIDForNameChain ¶ added in v0.1.1
type Entries ¶ added in v0.1.1
type Entries struct { Order EntriesOrder Directory *Directory Stack []*EntriesStack }
func NewEntries ¶ added in v0.1.1
func NewEntries(order EntriesOrder, directory *Directory, parentPath string, start uint32) *Entries
func (*Entries) StackLeftSpine ¶ added in v0.1.1
type EntriesOrder ¶ added in v0.1.1
type EntriesOrder int
const ( EntriesNonRecursive EntriesOrder = iota EntriesPreorder )
type EntriesStack ¶ added in v0.1.1
type Entry ¶ added in v0.1.1
type MiniAlloc ¶
func NewMiniAlloc ¶
func (*MiniAlloc) OpenMiniChain ¶ added in v0.1.1
func (*MiniAlloc) RootDirEntry ¶ added in v0.1.1
func (*MiniAlloc) SeekWithinMiniSector ¶ added in v0.1.1
func (*MiniAlloc) StreamIDForNameChain ¶ added in v0.1.1
type MiniChain ¶ added in v0.1.1
func NewMiniChain ¶ added in v0.1.1
type ObjectType ¶
type ObjectType int
const ( ObjUnallocated ObjectType = iota ObjStorage ObjStream ObjRoot )
func ObjectFromByte ¶
func ObjectFromByte(b byte) ObjectType
func (ObjectType) AsByte ¶
func (o ObjectType) AsByte() byte
type SectorInit ¶
type SectorInit int
const ( SectorInitZero SectorInit = iota SectorInitFat SectorInitDifat SectorInitDir )
func (SectorInit) Initialize ¶
func (s SectorInit) Initialize(sector *Sectors)
type Sectors ¶ added in v0.1.1
func NewSectors ¶ added in v0.1.1
func NewSectors(v Version, bufferLength int64, reader io.ReadSeeker) *Sectors
func (*Sectors) SeekToSector ¶ added in v0.1.1
type Stream ¶
type Stream struct { CompoundFile *CompoundFile StreamId uint32 TotalLen uint64 Buffer []byte Position uint64 Cap uint64 OffsetFromStart uint64 }
func (*Stream) CurrentPosition ¶ added in v0.1.1
type Validation ¶
type Validation int
const ( ValidationPermissive Validation = iota ValidationStrict Validation = iota )
func (Validation) IsStrict ¶
func (v Validation) IsStrict() bool
type Version ¶
type Version int
func VersionNumber ¶
func (Version) DirEntriesPerSector ¶
Returns the number of directory entries per sector in this version.
func (Version) SectorLenMask ¶
Returns the bitmask used for reading stream lengths in this version.
func (Version) SectorShift ¶
Returns the sector shift used in this version.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.