libvhdi

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 4 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

libvhdi

libvhdi is a pure Go library for reading VHD and VHDX virtual disk images.

It is designed to be easy to embed in forensic tools, analysis pipelines, and any application that needs to inspect the contents of virtual hard disk files without an external C dependency.

Features

  • Pure Go (no CGO dependency)
  • Root import API: github.com/aoiflux/libvhdi
  • VHD format support:
    • Fixed disks
    • Dynamic (sparse) disks
    • Differencing (child) disks
  • VHDX format support:
    • Fixed disks
    • Dynamic (sparse) disks
    • Differencing (child) disks
    • Partial block reads via sector bitmap (state-7 blocks)
  • Automatic format detection (Open, OpenFile)
  • Automatic differencing parent chain resolution, verified against the identity recorded in each child — no manual SetParent wiring
  • Sector-granular differencing resolution: partially-written blocks are resolved against the parent chain per sector, not per block
  • Size derived from the reader; no explicit length needed for *os.File, *bytes.Reader, io.SectionReader or fs.File
  • Sparse-aware extent mapping (Extents), reporting holes and per-sector provenance through a differencing chain
  • Virtual-to-file offset resolution (VirtualToFileOffset)
  • io.ReaderAt-compatible decoded stream for random-access reads
  • VHDX log replay into a read-only in-memory overlay, so a captured image reads as its last committed state without being modified
  • Fails closed on missing parents, unreplayable logs and malformed headers rather than substituting zeroes
  • Hardware-accelerated CRC-32C (Castagnoli via SSE4.2 on x86) for VHDX
  • Bulk BAT reads — single ReadAt call for the full allocation table

Install

go get github.com/aoiflux/libvhdi

Quick Start

Open any VHD or VHDX file
package main

import (
	"fmt"
	"log"

	libvhdi "github.com/aoiflux/libvhdi"
)

func main() {
	disk, err := libvhdi.OpenFile("disk.vhdx")
	if err != nil {
		log.Fatal(err)
	}
	defer disk.Close()

	fmt.Printf("format       : %v\n", disk.Format())
	fmt.Printf("virtual_size : %d bytes\n", disk.Size())
	fmt.Printf("block_size   : %d bytes\n", disk.BlockSize())
	fmt.Printf("sector_size  : %d bytes\n", disk.SectorSize())
	fmt.Printf("identifier   : %s\n", disk.GUIDString())

	buf := make([]byte, 512)
	n, err := disk.ReadAt(buf, 0)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("read %d bytes from offset 0\n", n)
}
Open from an io.ReaderAt

Open detects the format and derives the size from the reader, so no explicit length is needed for anything exposing Size, Stat or Seek — which covers *os.File, *bytes.Reader, io.SectionReader and fs.File:

f, err := os.Open("disk.vhdx")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

disk, err := libvhdi.Open(f, nil)
if err != nil {
    log.Fatal(err)
}
defer disk.Close()

A bare io.ReaderAt exposing none of those must supply the size explicitly for VHD images. VHDX locates every structure from fixed offsets and needs no size:

disk, err := libvhdi.Open(r, &libvhdi.Options{Size: totalBytes})
Differencing chains resolve themselves

OpenFileWith searches the image's own directory for the parents a differencing chain names, verifying each against the identifier and virtual size recorded in its child. Opening only the newest disk yields a correct contiguous device:

disk, err := libvhdi.OpenFileWith("snapshot-3.vhdx", nil)
if err != nil {
    log.Fatal(err)
}
defer disk.Close() // closes the parents it opened, too

if disk.NeedsParent() {
    // Best-effort by default: the chain is incomplete, and reads that need the
    // missing parent return ErrParentRequired rather than zeroes.
    log.Printf("incomplete chain: %v", disk.ParentResolveError())
}
fmt.Printf("chain depth: %d\n", disk.ChainDepth())

Set Options.RequireParentChain to make an unresolvable parent a hard error at open, or supply a custom Options.ParentResolver to search elsewhere:

disk, err := libvhdi.OpenFileWith("snapshot-3.vhdx", &libvhdi.Options{
    ParentResolver:     libvhdi.DirParentResolver("/evidence/base-images"),
    RequireParentChain: true,
})

FSParentResolver resolves against an fs.FS, and ParentResolverFunc adapts any function for chains held in a database, object store or acquisition format.

Manual parent wiring
f, err := os.Open("disk.vhd")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

fi, _ := f.Stat()
disk, err := libvhdi.OpenVHD(f, fi.Size())
if err != nil {
    log.Fatal(err)
}
defer disk.Close()
Differencing disk parent chaining
parent, err := libvhdi.OpenFile("base.vhdx")
if err != nil {
    log.Fatal(err)
}
defer parent.Close()

child, err := libvhdi.OpenFile("snapshot.vhdx")
if err != nil {
    log.Fatal(err)
}
defer child.Close()

if err := child.SetParent(parent); err != nil {
    log.Fatal(err)
}

// Reads now transparently fall back to parent for unallocated blocks.
buf := make([]byte, 512)
child.ReadAt(buf, 0)
Sparse-aware acquisition with extents

Extents reports which ranges of the disk are backed by real data and which are holes, so an imaging tool reads only what exists instead of reading and writing megabytes of zeroes:

extents, err := disk.AllExtents()
if err != nil {
    log.Fatal(err)
}
for _, e := range extents {
    switch e.Kind {
    case libvhdi.ExtentZero:
        out.Seek(e.Length, io.SeekCurrent) // hole: skip it
    case libvhdi.ExtentMapped:
        buf := make([]byte, e.Length)
        disk.ReadAt(buf, e.VirtualOffset)
        out.Write(buf)
    case libvhdi.ExtentUnresolved:
        log.Printf("cannot account for [%d, %d): %s", e.VirtualOffset, e.End(), e.Path)
    }
}

total, _ := disk.MappedBytes() // how much actually has to be read

For a differencing chain each mapped extent also says which disk supplies it, resolved per sector, so a partially-written block reports alternating child and parent runs:

for _, e := range extents {
    if e.Kind == libvhdi.ExtentMapped {
        fmt.Printf("virtual %d..%d <- %s +%d (chain depth %d)
",
            e.VirtualOffset, e.End(), e.Path, e.FileOffset, e.ChainIndex)
    }
}

ChainIndex is 0 for the disk you opened, 1 for its parent, and so on. This is provenance VirtualToFileOffset cannot express, since a single file offset cannot describe bytes coming from several files.

Virtual-to-file offset resolution
virtualOffset := int64(0)
fileOffset, mapped, err := disk.VirtualToFileOffset(virtualOffset)
if err != nil {
    log.Fatal(err)
}
if mapped {
    fmt.Printf("virtual %d → file %d\n", virtualOffset, fileOffset)
} else {
    fmt.Println("region is sparse / parent-backed")
}

API

Open functions
Function Description
Open(r io.ReaderAt, opts *Options) (*Disk, error) Auto-detect format, derive size from the reader, resolve parent chains
OpenFileWith(path string, opts *Options) (*Disk, error) As above, by path; defaults to resolving parents from the image's dir
OpenFile(path string) (*Disk, error) Auto-detect format and open a VHD or VHDX file by path
OpenVHD(r io.ReaderAt, fileSize int64) (*Disk, error) Open a VHD image from an io.ReaderAt
OpenVHDX(r io.ReaderAt, fileSize int64) (*Disk, error) Open a VHDX image from an io.ReaderAt
Options

The zero value is safe. Every field that relaxes a check is named so that false is the strict setting.

type Options struct {
    ParentResolver          ParentResolver // locate parents; nil disables auto-resolution
    Size                    int64          // explicit image size; 0 derives from the reader
    MaxChainDepth           int            // 0 means DefaultMaxChainDepth (32)
    AllowParentGUIDMismatch bool           // skip parent identity verification
    RequireParentChain      bool           // fail at open if the chain is incomplete
    AllowDirtyImage         bool           // open a VHDX with an unreplayed log
}

type ParentResolver interface {
    ResolveParent(req ParentRequest) (ParentSource, error)
}

func DirParentResolver(dirs ...string) ParentResolver
func FSParentResolver(fsys fs.FS) ParentResolver
Errors
ErrParentRequired  // read resolved to a parent that is not attached
ErrParentNotFound  // resolver exhausted its search
ErrParentMismatch  // located image is not the parent the child records
ErrChainTooDeep    // chain exceeds MaxChainDepth
ErrChainCycle      // chain refers back to a disk already in it
ErrSizeUnknown     // size neither derivable nor supplied
ErrDirtyImage      // VHDX log could not be replayed; image may be stale
ErrCorruptImage    // headers are inconsistent or describe structures the file cannot hold
Disk methods
type Disk struct { /* ... */ }

func (d *Disk) ReadAt(p []byte, offset int64) (int, error)
func (d *Disk) Close() error

func (d *Disk) Size() uint64
func (d *Disk) Format() types.FileFormat
func (d *Disk) DiskType() types.DiskType
func (d *Disk) BlockSize() uint32
func (d *Disk) SectorSize() uint32
func (d *Disk) IsDifferencing() bool
func (d *Disk) HasLog() bool
func (d *Disk) LogReplayed() bool
func (d *Disk) IsDirty() bool
func (d *Disk) LogReplayStats() (LogReplayStats, bool)
func (d *Disk) GUIDString() string
func (d *Disk) Identifier() [16]byte
func (d *Disk) Path() string

// Differencing disks
func (d *Disk) ParentFilename() string
func (d *Disk) ParentIdentifier() [16]byte
func (d *Disk) ParentLocators() []types.ParentLocatorEntry
func (d *Disk) SetParent(parent *Disk) error
func (d *Disk) NeedsParent() bool
func (d *Disk) Parent() *Disk
func (d *Disk) ChainDepth() int
func (d *Disk) Chain() []ChainEntry
func (d *Disk) ChainComplete() bool
func (d *Disk) ParentResolveError() error

// Offset resolution
func (d *Disk) VirtualToFileOffset(virtualOffset int64) (fileOffset int64, mapped bool, err error)

// Extent mapping
func (d *Disk) Extents(virtualOffset, length int64) ([]Extent, error)
func (d *Disk) AllExtents() ([]Extent, error)
func (d *Disk) MappedBytes() (int64, error)
type Extent struct {
    VirtualOffset int64      // start in the virtual disk address space
    Length        int64
    Kind          ExtentKind // ExtentZero, ExtentMapped or ExtentUnresolved
    FileOffset    int64      // offset within the backing file, if mapped
    ChainIndex    int        // 0 = this disk, 1 = its parent, ...
    Path          string     // backing file, for provenance
}

func (e Extent) End() int64

ReadAt exposes the fully decoded logical stream at any byte offset. Reads are clamped to the virtual disk size: a request straddling the end of the device returns the available bytes and io.EOF.

For dynamic disks, unallocated regions read as zeroes. For differencing disks, resolution happens at sector granularity in both formats: a partially-written block carries a sector bitmap, and sectors whose bit is clear are served from the parent chain rather than zero-filled. VHDX PAYLOAD_BLOCK_NOT_PRESENT (state 0) resolves wholly to the parent, while UNDEFINED, ZERO and UNMAPPED read as zeroes.

Differencing disks fail closed. Reading one before attaching a parent with SetParent returns ErrParentRequired — zeroes would be indistinguishable from genuine disk contents. Use NeedsParent to check.

VirtualToFileOffset translates a byte offset in the virtual disk's address space to the corresponding byte offset in the .vhd / .vhdx backing file. Returns mapped = false for sparse, unallocated, or parent-backed regions.

Format and DiskType constants
const (
    FormatUnknown = types.FileFormatUnknown
    FormatVHD     = types.FileFormatVHD
    FormatVHDX    = types.FileFormatVHDX
)

const (
    DiskTypeFixed        = types.DiskTypeFixed
    DiskTypeDynamic      = types.DiskTypeDynamic
    DiskTypeDifferential = types.DiskTypeDifferential
)

Included Example Programs

1) Partition table and filesystem detection
go run ./examples/offsets [flags] <disk.vhd|disk.vhdx>

Auto-detects partition tables (MBR, GPT) using libtable and probes for filesystems (NTFS, FAT, exFAT, ext2/3/4, HFS+). When an ext2/3/4 filesystem is found, superblock details are printed via libext.

Optional flags:

  • -pt-offset <bytes> — byte offset where partition table parsing starts (default 0)
  • -verbose-detect — print all detection attempts
  • -dump-sectors N — hex dump first N sectors (512 bytes each) from the decoded stream
  • -map-first-mib N — print a per-MiB virtual-to-file mapping table for the first N MiB

Example output on a dynamic VHDX containing an ext4 root filesystem:

file             : disk.vhdx
format           : VHDX
disk_type        : dynamic
virtual_size     : 1.00 TB
block_size       : 1.00 MB
sector_size      : 512 bytes
identifier       : 43efe041-6fc7-42eb-89a1-085575a361c3

Filesystem detected at virtual offset 0: ext2/3/4 (no partition table)
Filesystem backing file offset: 12582912

--- filesystem info (libext) ---
  kind             : ext4
  uuid             : 08c19b1f-c199-4750-bffc-7e6ff300e6db
  block_size       : 4096 bytes
  inode_size       : 256 bytes
  total_blocks     : 268435456
  free_blocks      : 255846154
  total_inodes     : 67108864
  free_inodes      : 66600919
  groups           : 8192
  last_mount_time  : 2026-05-01 22:36:06 UTC
  last_write_time  : 2026-05-01 22:41:15 UTC
  last_mounted_at  : /distro
  mount_count      : 40 / 65535
  features         : ...
---

Package Structure

Package Description
github.com/aoiflux/libvhdi Root API — OpenFile, Disk, format/type constants
reader VirtualDisk implementation, open functions, parent chaining
bat VHD and VHDX Block Allocation Table parsers
block Virtual-to-physical block readers for VHD and VHDX
diff Differencing disk resolver (parent chain read-through)
metadata VHDX metadata table and region table parsing
types Data structure definitions, constants, GUIDs
internal/vhdxlog VHDX log parsing and read-only replay overlay
internal/binaryutil Endian-aware parsing utilities, checksums

Robustness

The library is read-only and never writes to an image.

Structures read from an image are cross-checked before they drive any allocation or read: block counts, table offsets and region sizes must be internally consistent and must fit within the file. Malformed input produces an error wrapping ErrCorruptImage rather than a panic or an oversized allocation.

Checksums are verified per format, and the two formats do not share an algorithm: VHD footers and dynamic disk headers use the specification's one's-complement byte sum, while VHDX headers, region tables and metadata use CRC-32C.

A VHDX image whose active header carries a log GUID holds journalled writes that may not have reached their final locations, so its block allocation table and metadata can describe an earlier state than the last committed one. The log is replayed into an in-memory overlay before anything else is parsed, so the disk presents the committed state while the file on disk stays byte-identical — a forensic copy is never modified.

A log whose entries do not form a complete, consecutively numbered sequence is refused with ErrDirtyImage rather than partially applied, since replaying part of a transaction could produce a state the writer never committed. Options.AllowDirtyImage reads such an image as-is instead.

if disk.HasLog() {
    if stats, ok := disk.LogReplayStats(); ok {
        // How much of the image was still in flight when it was captured.
        log.Printf("replayed %d entries over %d sectors", stats.Entries, stats.Sectors)
    }
}
Method Meaning
HasLog() the image carries journalled writes
LogReplayed() the log was replayed; reads show the committed state
IsDirty() carries a log that was not replayed; may be stale

ReadAt on a Disk is safe for concurrent use when the underlying io.ReaderAt is, which holds for *os.File and *bytes.Reader. This is tested rather than merely asserted: reader/concurrent_test.go runs many goroutines against one Disk across the block reader, differencing chains, VHDX partial blocks and the log replay overlay, and requires every result to match a single-threaded reference. Extent mapping is safe alongside reads too.

Recording provenance for an evidence item means naming every file involved:

for _, link := range disk.Chain() {
    fmt.Printf("%d: %s  %s  differencing=%v log=%v
",
        link.Index, link.Path, link.GUIDString(), link.IsDifferencing, link.HasLog)
}
if !disk.ChainComplete() {
    log.Printf("chain incomplete: %v", disk.ParentResolveError())
}

Development

Run all tests:

go test ./...
go test -race ./...

Fuzz the parsers. FuzzVHDXStructures splices fuzzer bytes into the header, region table, metadata and BAT of a valid image and repairs the checksums, so the budget goes on field values instead of payload bytes no parser reads:

go test ./reader/          -run '^$' -fuzz FuzzOpen           -fuzztime 60s
go test ./reader/          -run '^$' -fuzz FuzzVHDFooter      -fuzztime 60s
go test ./reader/          -run '^$' -fuzz FuzzVHDXStructures -fuzztime 60s
go test ./internal/vhdxlog -run '^$' -fuzz FuzzAnalyze        -fuzztime 60s

Test images are generated in-process by the builders in reader/vhdfixture_test.go and reader/vhdxfixture_test.go, so the repository carries no binary fixtures. They are written to the published specifications rather than to whatever the current parser accepts, which is what surfaced the VHD checksum defect fixed in v0.2.0.

Validating against real images

Synthetic fixtures cannot prove agreement with what other implementations emit — a parser and a fixture written by the same author can be wrong together. Two generators produce a corpus of real images with raw ground truth:

qemu-img, no elevation required. qemu can create VHD and VHDX, so a known raw pattern is converted into an image and the pattern becomes the ground truth:

# Needs only qemu-img on PATH (scoop install qemu / winget install qemu).
pwsh -File scripts/gen-corpus-qemu.ps1 -OutputDir C:\corpus

$env:LIBVHDI_CORPUS = "C:\corpus"
go test ./reader/ -run TestCorpus -v

This covers both subformats in both formats, VHDX block sizes from 1 MB to 32 MB, CHS-rounded VHD sizes, block-unaligned virtual sizes, all-sparse disks and a 512 MB disk. All of it decodes byte for byte. See the 0.6.0 changelog entry for the results, including the one place where this library and qemu disagree and why this library is the conformant one.

Hyper-V, requires elevation. scripts/gen-corpus.ps1 drives New-VHD, which is the only route to a producer-generated differencing chain — qemu-img reports "Backing file not supported" for both formats. Chain correctness otherwise rests on the spec-derived fixtures.

The corpus tests compare the decoded stream byte for byte and probe block and sector boundaries with random-access reads. They skip when LIBVHDI_CORPUS is unset, and TestCorpusHarnessSelfCheck keeps the harness itself covered where the tooling is absent.

Documentation

Overview

Package libvhdi provides a pure-Go implementation of the VHD and VHDX virtual disk format support.

This package implements read support for the VHD (Virtual Hard Disk) and VHDX (Virtual Hard Disk v2) formats, written against the Microsoft VHD Image Format Specification and the VHDX Format Specification. It is an independent implementation and shares no code with any C library.

Supported features:

  • VHD fixed, dynamic and differencing disks
  • VHDX fixed, dynamic and differencing disks
  • Sector-granular differencing resolution across a parent chain
  • Automatic parent chain resolution, verified against each child's metadata
  • VHDX log replay into a read-only in-memory overlay
  • Sparse-aware extent mapping with per-link provenance
  • Per-format checksum verification

Reads are read-only throughout: no code path writes to an image, and log replay is applied to an overlay so a forensic copy stays byte-identical.

Example usage:

disk, err := libvhdi.OpenFile("disk.vhd")
if err != nil {
	log.Fatal(err)
}
defer disk.Close()

buf := make([]byte, 512)
n, err := disk.ReadAt(buf, 0)
if err != nil {
	log.Fatal(err)
}

Index

Constants

View Source
const (
	// Version is the current library version
	Version = "0.6.0"

	// Author information
	Author = "aoiflux"
)

Version information

View Source
const (
	FormatUnknown = types.FileFormatUnknown
	FormatVHD     = types.FileFormatVHD
	FormatVHDX    = types.FileFormatVHDX
)

FileFormat constants (re-exported for convenience).

View Source
const (
	DiskTypeFixed        = types.DiskTypeFixed
	DiskTypeDynamic      = types.DiskTypeDynamic
	DiskTypeDifferential = types.DiskTypeDifferential
)

DiskType constants (re-exported for convenience).

View Source
const (
	// ExtentZero has no backing bytes anywhere in the chain and reads as zeroes.
	ExtentZero = reader.ExtentZero

	// ExtentMapped is backed by a contiguous run of bytes in one of the files.
	ExtentMapped = reader.ExtentMapped

	// ExtentUnresolved resolves to a parent that is not attached.
	ExtentUnresolved = reader.ExtentUnresolved
)

Extent kinds.

View Source
const DefaultMaxChainDepth = reader.DefaultMaxChainDepth

DefaultMaxChainDepth bounds how many disks a differencing chain may contain.

Variables

View Source
var (
	// ErrParentRequired is returned when a read on a differencing disk resolves
	// to a parent that has not been attached. Differencing disks fail closed:
	// silently returning zeroes would be indistinguishable from genuine disk
	// contents.
	ErrParentRequired = reader.ErrParentRequired

	// ErrParentNotFound is returned when a resolver exhausted its search
	// without locating the parent image.
	ErrParentNotFound = reader.ErrParentNotFound

	// ErrParentMismatch is returned when a located image does not match the
	// parent identity recorded in the child.
	ErrParentMismatch = reader.ErrParentMismatch

	// ErrChainTooDeep is returned when a parent chain exceeds the configured
	// maximum depth.
	ErrChainTooDeep = reader.ErrChainTooDeep

	// ErrChainCycle is returned when a parent chain refers back to a disk
	// already in the chain.
	ErrChainCycle = reader.ErrChainCycle

	// ErrSizeUnknown is returned when an image's size can neither be derived
	// from the reader nor was supplied via Options.Size.
	ErrSizeUnknown = reader.ErrSizeUnknown

	// ErrCorruptImage is returned when an image's headers are inconsistent or
	// describe structures that do not fit the file.
	ErrCorruptImage = reader.ErrCorruptImage

	// ErrDirtyImage is returned when a VHDX log cannot be replayed, so the
	// image may not reflect its last committed state. Set
	// Options.AllowDirtyImage to read it anyway.
	ErrDirtyImage = reader.ErrDirtyImage
)

Errors reported when opening or reading a disk.

Functions

This section is empty.

Types

type ChainEntry

type ChainEntry = reader.ChainEntry

ChainEntry describes one disk in a differencing chain: the set of files that together constitute the device, which is what an evidence record must name.

type Disk

type Disk = reader.VirtualDisk

Disk represents an open VHD or VHDX virtual disk. Implements io.ReaderAt.

func Open

func Open(r io.ReaderAt, opts *Options) (*Disk, error)

Open opens a VHD or VHDX image from r, detecting the format automatically and deriving the image size from the reader when possible.

Readers exposing Size, Stat or Seek are all handled, covering *os.File, *bytes.Reader, *strings.Reader, io.SectionReader and fs.File. A bare io.ReaderAt with none of those must set Options.Size for VHD images; VHDX locates every structure from fixed offsets and needs no size.

When opts.ParentResolver is set, differencing parent chains are resolved automatically, so the caller gets a correct contiguous device with no manual SetParent wiring. opts may be nil.

func OpenFile

func OpenFile(path string) (*Disk, error)

OpenFile opens a VHD or VHDX virtual disk file by path. Format detection is automatic. The caller must call disk.Close() when done.

func OpenFileWith

func OpenFileWith(path string, opts *Options) (*Disk, error)

OpenFileWith opens a VHD or VHDX file by path with explicit options.

When opts.ParentResolver is nil it defaults to searching the image's own directory, which is where a differencing chain's parents conventionally live.

func OpenVHD

func OpenVHD(r io.ReaderAt, fileSize int64) (*Disk, error)

OpenVHD opens a VHD disk from an io.ReaderAt of the given total file size.

func OpenVHDX

func OpenVHDX(r io.ReaderAt, fileSize int64) (*Disk, error)

OpenVHDX opens a VHDX disk from an io.ReaderAt of the given total file size.

type Extent

type Extent = reader.Extent

Extent describes a contiguous run of the virtual disk and what backs it, so a caller can read only what is mapped and skip sparse regions. For a differencing chain each mapped extent also identifies which disk supplies it.

type ExtentKind

type ExtentKind = reader.ExtentKind

ExtentKind says what backs an Extent.

type LogReplayStats

type LogReplayStats = reader.LogReplayStats

LogReplayStats describes what a VHDX log replay applied.

type Options

type Options = reader.Options

Options controls how a disk is opened. The zero value is safe: parent GUIDs are verified, and differencing disks with no parent fail closed on read.

type ParentRequest

type ParentRequest = reader.ParentRequest

Parent resolution types. A ParentResolver locates the parent image of a differencing disk; DirParentResolver and FSParentResolver cover the common cases.

type ParentResolver

type ParentResolver = reader.ParentResolver

Parent resolution types. A ParentResolver locates the parent image of a differencing disk; DirParentResolver and FSParentResolver cover the common cases.

func DirParentResolver

func DirParentResolver(dirs ...string) ParentResolver

DirParentResolver returns a ParentResolver that searches the child's own directory first, then each supplied directory.

func FSParentResolver

func FSParentResolver(fsys fs.FS) ParentResolver

FSParentResolver returns a ParentResolver that searches an fs.FS.

type ParentResolverFunc

type ParentResolverFunc = reader.ParentResolverFunc

Parent resolution types. A ParentResolver locates the parent image of a differencing disk; DirParentResolver and FSParentResolver cover the common cases.

type ParentSource

type ParentSource = reader.ParentSource

Parent resolution types. A ParentResolver locates the parent image of a differencing disk; DirParentResolver and FSParentResolver cover the common cases.

Directories

Path Synopsis
Package bat provides Block Allocation Table (BAT) parsing and lookup logic.
Package bat provides Block Allocation Table (BAT) parsing and lookup logic.
Package block provides block-level reading and decompression logic for virtual disks.
Package block provides block-level reading and decompression logic for virtual disks.
Package diff implements differencing (child) disk resolution over a parent chain.
Package diff implements differencing (child) disk resolution over a parent chain.
examples
open command
open prints metadata and geometry information for a VHD or VHDX virtual disk image.
open prints metadata and geometry information for a VHD or VHDX virtual disk image.
readat command
readat reads bytes from a VHD or VHDX virtual disk at a given offset and hex-dumps them.
readat reads bytes from a VHD or VHDX virtual disk at a given offset and hex-dumps them.
internal
binaryutil
Package binaryutil provides endian-aware binary parsing utilities for the vhdi library.
Package binaryutil provides endian-aware binary parsing utilities for the vhdi library.
vhdxlog
Package vhdxlog parses and replays the VHDX log.
Package vhdxlog parses and replays the VHDX log.
Package metadata provides metadata extraction and decoding for VHDX files.
Package metadata provides metadata extraction and decoding for VHDX files.
VHD Dynamic Disk Header Parser
VHD Dynamic Disk Header Parser
Package types defines all data structures, enums, and constants for the libvhdi library.
Package types defines all data structures, enums, and constants for the libvhdi library.

Jump to

Keyboard shortcuts

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