├── NEWS ├── dpkg ├── compat ├── source │ └── format ├── libvhdi.install ├── libvhdi-python3.install ├── libvhdi-tools.install ├── libvhdi-dev.install ├── changelog.in ├── rules ├── copyright └── control ├── tests ├── data │ ├── parent_locator_entry.1 │ ├── metadata_table_header.1 │ ├── file_footer.1 │ ├── image_header.1 │ ├── region_table.1 │ ├── region_table_entry.1 │ ├── dynamic_disk_header.1 │ ├── metadata_table_entry.1 │ ├── parent_locator_header.1 │ ├── region_table_header.1 │ └── file_identifier.1 ├── lsan.suppressions ├── build.sh ├── pkgbuild.sh ├── runtests.sh ├── vhdi_test_libvhdi.h ├── vhdi_test_libcpath.h ├── vhdi_test_libcerror.h ├── vhdi_test_libcnotify.h ├── vhdi_test_libclocale.h ├── vhdi_test_unused.h ├── syncsharedlibs.sh ├── vhdi_test_memory.h ├── vhdi_test_libbfio.h ├── vhdi_test_libuna.h ├── vhdi_test_libcthreads.h ├── test_manpage.sh ├── vhdi_test_functions.h ├── vhdi_test_getopt.h └── runtests.py ├── po ├── ChangeLog ├── POTFILES.in └── Makevars.in ├── AUTHORS ├── pyproject.toml ├── manuals ├── Makefile.am └── vhdiinfo.1 ├── tox.ini ├── common ├── Makefile.am ├── config_borlandc.h ├── config_msc.h └── common.h ├── .codecov.yml ├── include ├── Makefile.am └── libvhdi │ ├── extern.h │ ├── features.h.in │ └── definitions.h.in ├── setup.cfg.in ├── synctestdata.sh ├── .github └── workflows │ ├── build_freebsd.yml │ ├── build_macos.yml │ ├── build_shared.yml │ └── build_ossfuzz.yml ├── README ├── libvhdi.pc.in ├── synctestdata.ps1 ├── m4 └── tests.m4 ├── ossfuzz ├── Makefile.am ├── ossfuzz_libvhdi.h ├── ossfuzz_libbfio.h └── file_fuzzer.cc ├── pyvhdi ├── pyvhdi_libvhdi.h ├── pyvhdi_guid.h ├── Makefile.am ├── pyvhdi_libfguid.h ├── pyvhdi_unused.h ├── pyvhdi_libcerror.h ├── pyvhdi_libclocale.h ├── pyvhdi_libbfio.h ├── pyvhdi_integer.h ├── pyvhdi_error.h ├── pyvhdi_disk_types.h ├── pyvhdi.h └── pyvhdi_python.h ├── vhditools ├── vhditools_libvhdi.h ├── vhditools_i18n.h ├── vhditools_libcpath.h ├── vhditools_libfguid.h ├── vhditools_libcerror.h ├── vhditools_output.h ├── vhditools_libcnotify.h ├── vhditools_libclocale.h ├── vhditools_unused.h ├── vhditools_libcdata.h ├── byte_size_string.h ├── vhditools_libbfio.h ├── vhditools_libuna.h ├── vhditools_signal.h ├── vhditools_getopt.h ├── info_handle.h └── Makefile.am ├── libvhdi ├── libvhdi.rc.in ├── libvhdi_extern.h ├── libvhdi_i18n.h ├── libvhdi_unused.h ├── libvhdi_libfguid.h ├── vhdi_file_information.h ├── libvhdi_libcerror.h ├── libvhdi_libfcache.h ├── libvhdi_libcnotify.h ├── libvhdi_libclocale.h ├── libvhdi_types.h ├── libvhdi_checksum.h ├── libvhdi_libcdata.h ├── libvhdi_libfdata.h ├── libvhdi_notify.h ├── libvhdi_libbfio.h ├── libvhdi_i18n.c ├── libvhdi_sector_range_descriptor.h ├── libvhdi_libuna.h ├── libvhdi_metadata_table_header.h ├── libvhdi_parent_locator_header.h ├── libvhdi_region_table_header.h ├── libvhdi_error.h ├── libvhdi_region_type_identifier.h ├── libvhdi.c ├── libvhdi_metadata_table_entry.h ├── libvhdi_libcthreads.h ├── libvhdi_region_table_entry.h ├── libvhdi_file_information.h ├── libvhdi_debug.h ├── vhdi_parent_locator.h ├── libvhdi_io_handle.h ├── vhdi_region_table.h ├── vhdi_metadata_table.h ├── libvhdi_region_table.h ├── libvhdi_parent_locator.h ├── libvhdi_support.h ├── libvhdi_metadata_item_identifier.h ├── libvhdi_metadata_table.h └── vhdi_image_header.h ├── libvhdi.nuspec ├── runtests.ps1 ├── syncdokan.ps1 ├── ChangeLog ├── acinclude.m4 ├── libvhdi.ini ├── msvscpp └── Makefile.am └── Makefile.am /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dpkg/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /dpkg/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /dpkg/libvhdi.install: -------------------------------------------------------------------------------- 1 | usr/lib/*-*/lib*.so.* 2 | -------------------------------------------------------------------------------- /tests/data/parent_locator_entry.1: -------------------------------------------------------------------------------- 1 | PlL -------------------------------------------------------------------------------- /dpkg/libvhdi-python3.install: -------------------------------------------------------------------------------- 1 | /usr/lib/python3* 2 | -------------------------------------------------------------------------------- /tests/lsan.suppressions: -------------------------------------------------------------------------------- 1 | leak:/lib*/libpython* 2 | -------------------------------------------------------------------------------- /dpkg/libvhdi-tools.install: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/share/man/man1 3 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-10-30 gettextize 2 | -------------------------------------------------------------------------------- /tests/data/metadata_table_header.1: -------------------------------------------------------------------------------- 1 | metadata -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files which contain translatable strings. 2 | -------------------------------------------------------------------------------- /tests/data/file_footer.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvhdi/HEAD/tests/data/file_footer.1 -------------------------------------------------------------------------------- /tests/data/image_header.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvhdi/HEAD/tests/data/image_header.1 -------------------------------------------------------------------------------- /tests/data/region_table.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvhdi/HEAD/tests/data/region_table.1 -------------------------------------------------------------------------------- /tests/data/region_table_entry.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvhdi/HEAD/tests/data/region_table_entry.1 -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Acknowledgements: libvhdi 2 | 3 | Copyright (C) 2012-2025, Joachim Metz 4 | 5 | -------------------------------------------------------------------------------- /tests/data/dynamic_disk_header.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvhdi/HEAD/tests/data/dynamic_disk_header.1 -------------------------------------------------------------------------------- /tests/data/metadata_table_entry.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvhdi/HEAD/tests/data/metadata_table_entry.1 -------------------------------------------------------------------------------- /tests/data/parent_locator_header.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvhdi/HEAD/tests/data/parent_locator_header.1 -------------------------------------------------------------------------------- /tests/data/region_table_header.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvhdi/HEAD/tests/data/region_table_header.1 -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | -------------------------------------------------------------------------------- /dpkg/libvhdi-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/* 2 | usr/lib/*-*/lib*.a 3 | usr/lib/*-*/lib*.so 4 | usr/lib/*-*/pkgconfig/* 5 | usr/share/man/man3 6 | -------------------------------------------------------------------------------- /dpkg/changelog.in: -------------------------------------------------------------------------------- 1 | libvhdi (@VERSION@-1) unstable; urgency=low 2 | 3 | * Auto-generated 4 | 5 | -- Joachim Metz @DPKG_DATE@ 6 | -------------------------------------------------------------------------------- /manuals/Makefile.am: -------------------------------------------------------------------------------- 1 | man_MANS = \ 2 | vhdiinfo.1 \ 3 | libvhdi.3 4 | 5 | EXTRA_DIST = \ 6 | vhdiinfo.1 \ 7 | libvhdi.3 8 | 9 | DISTCLEANFILES = \ 10 | Makefile \ 11 | Makefile.in 12 | 13 | -------------------------------------------------------------------------------- /tests/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to build from source 3 | # 4 | # Version: 20201121 5 | 6 | set -e 7 | 8 | ./synclibs.sh --use-head 9 | ./autogen.sh 10 | ./configure "$@" 11 | make > /dev/null 12 | 13 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py3{10,11,12,13,14} 3 | 4 | [testenv] 5 | usedevelop = True 6 | pip_pre = True 7 | passenv = 8 | CFLAGS 9 | CPPFLAGS 10 | INCLUDE 11 | LDFLAGS 12 | LIB 13 | deps = 14 | build 15 | setuptools >= 65 16 | wheel 17 | commands = 18 | python -m build --no-isolation --outdir=dist --wheel 19 | python -m pip install --no-index --find-links=dist libvhdi-python 20 | python tests/runtests.py 21 | -------------------------------------------------------------------------------- /common/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I../include -I$(top_srcdir)/include 3 | 4 | EXTRA_DIST = \ 5 | byte_stream.h \ 6 | common.h \ 7 | config.h \ 8 | config_borlandc.h \ 9 | config_msc.h \ 10 | config_winapi.h \ 11 | file_stream.h \ 12 | memory.h \ 13 | narrow_string.h \ 14 | system_string.h \ 15 | types.h \ 16 | types.h.in \ 17 | wide_string.h 18 | 19 | DISTCLEANFILES = \ 20 | config.h \ 21 | types.h \ 22 | Makefile \ 23 | Makefile.in 24 | 25 | -------------------------------------------------------------------------------- /tests/pkgbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to build a MacOS pkg 3 | # 4 | # Version: 20241015 5 | 6 | set -e 7 | 8 | make install DESTDIR=${PWD}/osx-pkg 9 | mkdir -p ${PWD}/osx-pkg/usr/share/doc/libvhdi 10 | cp AUTHORS COPYING COPYING.LESSER NEWS README ${PWD}/osx-pkg/usr/share/doc/libvhdi 11 | 12 | VERSION=`sed '5!d; s/^ \[//;s/\],$//' configure.ac` 13 | pkgbuild --root osx-pkg --identifier com.github.libyal.libvhdi --version ${VERSION} --ownership recommended ../libvhdi-${VERSION}.pkg 14 | 15 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | range: 70...100 5 | status: 6 | project: true 7 | patch: true 8 | changes: false 9 | ignore: 10 | - "libbfio/*" 11 | - "libcdata/*" 12 | - "libcerror/*" 13 | - "libcfile/*" 14 | - "libclocale/*" 15 | - "libcnotify/*" 16 | - "libcpath/*" 17 | - "libcsplit/*" 18 | - "libcthreads/*" 19 | - "libfcache/*" 20 | - "libfdata/*" 21 | - "libfguid/*" 22 | - "libuna/*" 23 | - "tests/*" 24 | -------------------------------------------------------------------------------- /tests/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to run tests 3 | # 4 | # Version: 20201121 5 | 6 | if test -f ${PWD}/libvhdi/.libs/libvhdi.1.dylib && test -f ./pyvhdi/.libs/pyvhdi.so; 7 | then 8 | install_name_tool -change /usr/local/lib/libvhdi.1.dylib ${PWD}/libvhdi/.libs/libvhdi.1.dylib ./pyvhdi/.libs/pyvhdi.so; 9 | fi 10 | 11 | make check CHECK_WITH_STDERR=1; 12 | RESULT=$?; 13 | 14 | if test ${RESULT} -ne 0 && test -f tests/test-suite.log; 15 | then 16 | cat tests/test-suite.log; 17 | fi 18 | exit ${RESULT}; 19 | 20 | -------------------------------------------------------------------------------- /tests/data/file_identifier.1: -------------------------------------------------------------------------------- 1 | vhdxfileMicrosoft Windows 10.0.19041.0 -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | include_HEADERS = \ 2 | libvhdi.h 3 | 4 | pkginclude_HEADERS = \ 5 | libvhdi/codepage.h \ 6 | libvhdi/definitions.h \ 7 | libvhdi/error.h \ 8 | libvhdi/extern.h \ 9 | libvhdi/features.h \ 10 | libvhdi/types.h 11 | 12 | EXTRA_DIST = \ 13 | libvhdi.h.in \ 14 | libvhdi/definitions.h.in \ 15 | libvhdi/features.h.in \ 16 | libvhdi/types.h.in 17 | 18 | DISTCLEANFILES = \ 19 | libvhdi.h \ 20 | libvhdi/definitions.h \ 21 | libvhdi/features.h \ 22 | libvhdi/types.h \ 23 | Makefile \ 24 | Makefile.in 25 | 26 | -------------------------------------------------------------------------------- /setup.cfg.in: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = libvhdi-python 3 | version = @VERSION@ 4 | description = Python bindings module for libvhdi 5 | long_description = Python bindings module for libvhdi 6 | long_description_content_type = text/plain 7 | author = Joachim Metz 8 | author_email = joachim.metz@gmail.com 9 | license = GNU Lesser General Public License v3 or later (LGPLv3+) 10 | license_files = COPYING* 11 | classifiers = 12 | Development Status :: 3 - Alpha 13 | Programming Language :: Python 14 | 15 | [options] 16 | python_requires = >=3.10 17 | -------------------------------------------------------------------------------- /synctestdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script that synchronizes the local test data 3 | # 4 | # Version: 20251217 5 | 6 | REPOSITORY="log2timeline/dfvfs"; 7 | TEST_DATA_PATH="test_data"; 8 | TEST_SET="public"; 9 | TEST_INPUT_DIRECTORY="tests/input"; 10 | TEST_FILES="ext2.vhd ext2.vhdx"; 11 | 12 | mkdir -p "${TEST_INPUT_DIRECTORY}/${TEST_SET}"; 13 | 14 | for TEST_FILE in ${TEST_FILES}; 15 | do 16 | URL="https://raw.githubusercontent.com/${REPOSITORY}/refs/heads/main/${TEST_DATA_PATH}/${TEST_FILE}"; 17 | 18 | curl -L -o "${TEST_INPUT_DIRECTORY}/${TEST_SET}/${TEST_FILE}" ${URL}; 19 | done 20 | 21 | -------------------------------------------------------------------------------- /.github/workflows/build_freebsd.yml: -------------------------------------------------------------------------------- 1 | # Build from source on FreeBSD. 2 | name: build_freebsd 3 | on: [push] 4 | permissions: read-all 5 | jobs: 6 | build_freebsd: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v5 10 | - name: Building from source 11 | id: build_freebsd 12 | uses: vmactions/freebsd-vm@v1 13 | with: 14 | usesh: true 15 | mem: 4096 16 | # Note that the test scripts require bash 17 | prepare: | 18 | pkg install -y autoconf automake bash fusefs-libs gettext git libtool pkgconf 19 | run: | 20 | tests/build.sh 21 | tests/runtests.sh 22 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | libvhdi is a library to access the Virtual Hard Disk image format. 2 | 3 | Project information: 4 | 5 | * Status: alpha 6 | * Licence: LGPLv3+ 7 | 8 | Read supported formats: 9 | 10 | * Virtual Hard Disk version 1 (VHD) 11 | * Virtual Hard Disk version 2 (VHDX) 12 | 13 | Supported image types: 14 | 15 | * Fixed-size hard disk image 16 | * Dynamic-size (or sparse) hard disk image 17 | * Differential (or differencing) hard disk image 18 | * Note that an undo disk image (.vud) is also a differential image 19 | 20 | For more information see: 21 | 22 | * Project documentation: https://github.com/libyal/libvhdi/wiki/Home 23 | * How to build from source: https://github.com/libyal/libvhdi/wiki/Building 24 | 25 | -------------------------------------------------------------------------------- /libvhdi.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libvhdi 7 | Description: Library to access the Virtual Hard Disk (VHD) image format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lvhdi 10 | Libs.private: @ax_libbfio_pc_libs_private@ @ax_libcdata_pc_libs_private@ @ax_libcerror_pc_libs_private@ @ax_libcfile_pc_libs_private@ @ax_libclocale_pc_libs_private@ @ax_libcnotify_pc_libs_private@ @ax_libcpath_pc_libs_private@ @ax_libcsplit_pc_libs_private@ @ax_libcthreads_pc_libs_private@ @ax_libfcache_pc_libs_private@ @ax_libfdata_pc_libs_private@ @ax_libfguid_pc_libs_private@ @ax_libuna_pc_libs_private@ @ax_pthread_pc_libs_private@ 11 | Cflags: -I${includedir} 12 | 13 | -------------------------------------------------------------------------------- /synctestdata.ps1: -------------------------------------------------------------------------------- 1 | # Script that synchronizes the local test data 2 | # 3 | # Version: 20251217 4 | 5 | $Repository = "log2timeline/dfvfs" 6 | $TestDataPath = "test_data" 7 | $TestSet = "public" 8 | $TestInputDirectory = "tests/input" 9 | $TestFiles = "ext2.vhd ext2.vhdx" 10 | 11 | If (-Not (Test-Path ${TestInputDirectory})) 12 | { 13 | New-Item -Name ${TestInputDirectory} -ItemType "directory" | Out-Null 14 | } 15 | If (-Not (Test-Path "${TestInputDirectory}\${TestSet}")) 16 | { 17 | New-Item -Name "${TestInputDirectory}\${TestSet}" -ItemType "directory" | Out-Null 18 | } 19 | ForEach ($TestFile in ${TestFiles} -split " ") 20 | { 21 | $Url = "https://raw.githubusercontent.com/${Repository}/refs/heads/main/${TestDataPath}/${TestFile}" 22 | 23 | Invoke-WebRequest -Uri ${Url} -OutFile "${TestInputDirectory}\${TestSet}\${TestFile}" 24 | } 25 | 26 | -------------------------------------------------------------------------------- /dpkg/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment for debhelper verbose output. 5 | # export DH_VERBOSE=1 6 | 7 | export SKIP_PYTHON_TESTS=1 8 | 9 | %: 10 | dh $@ --buildsystem=autoconf --with=autoreconf,python3 11 | 12 | .PHONY: override_dh_auto_configure 13 | override_dh_auto_configure: 14 | dh_auto_configure -- --enable-python CFLAGS="-g" 15 | 16 | .PHONY: override_dh_install 17 | override_dh_install: 18 | dh_install --fail-missing -X.la -X/pyvhdi.a 19 | 20 | .PHONY: override_dh_missing 21 | override_dh_missing: 22 | dh_missing -X.la -X/pyvhdi.a --fail-missing 23 | 24 | .PHONY: override_dh_strip 25 | override_dh_strip: 26 | ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS))) 27 | dh_strip -plibvhdi --dbg-package=libvhdi-dbg 28 | dh_strip -plibvhdi-tools --dbg-package=libvhdi-tools-dbg 29 | dh_strip -plibvhdi-python3 --dbg-package=libvhdi-python3-dbg 30 | endif 31 | 32 | -------------------------------------------------------------------------------- /m4/tests.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for testing 2 | dnl 3 | dnl Version: 20200712 4 | 5 | dnl Function to detect if tests dependencies are available 6 | AC_DEFUN([AX_TESTS_CHECK_LOCAL], 7 | [AC_CHECK_HEADERS([dlfcn.h]) 8 | 9 | AC_CHECK_FUNCS([fmemopen getopt mkstemp setenv tzset unlink]) 10 | 11 | AC_CHECK_LIB( 12 | dl, 13 | dlsym) 14 | 15 | AS_IF( 16 | [test "x$lt_cv_prog_gnu_ld" = xyes && test "x$ac_cv_lib_dl_dlsym" = xyes], 17 | [AC_DEFINE( 18 | [HAVE_GNU_DL_DLSYM], 19 | [1], 20 | [Define to 1 if dlsym function is available in GNU dl.]) 21 | ]) 22 | ]) 23 | 24 | dnl Function to detect if OSS-Fuzz build environment is available 25 | AC_DEFUN([AX_TESTS_CHECK_OSSFUZZ], 26 | [AM_CONDITIONAL( 27 | HAVE_LIB_FUZZING_ENGINE, 28 | [test "x${LIB_FUZZING_ENGINE}" != x]) 29 | AC_SUBST( 30 | [LIB_FUZZING_ENGINE], 31 | ["${LIB_FUZZING_ENGINE}"]) 32 | ]) 33 | 34 | -------------------------------------------------------------------------------- /common/config_borlandc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration for the Borland/CodeGear C++ Builder compiler 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _CONFIG_BORLANDC_H ) 23 | #define _CONFIG_BORLANDC_H 24 | 25 | #endif /* !defined( _CONFIG_BORLANDC_H ) */ 26 | 27 | -------------------------------------------------------------------------------- /ossfuzz/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_LIB_FUZZING_ENGINE 2 | AM_CPPFLAGS = \ 3 | -I../include -I$(top_srcdir)/include \ 4 | -I../common -I$(top_srcdir)/common \ 5 | @LIBCERROR_CPPFLAGS@ \ 6 | @LIBCDATA_CPPFLAGS@ \ 7 | @LIBCLOCALE_CPPFLAGS@ \ 8 | @LIBCNOTIFY_CPPFLAGS@ \ 9 | @LIBUNA_CPPFLAGS@ \ 10 | @LIBCFILE_CPPFLAGS@ \ 11 | @LIBCPATH_CPPFLAGS@ \ 12 | @LIBBFIO_CPPFLAGS@ 13 | 14 | bin_PROGRAMS = \ 15 | file_fuzzer 16 | 17 | file_fuzzer_SOURCES = \ 18 | file_fuzzer.cc \ 19 | ossfuzz_libbfio.h \ 20 | ossfuzz_libvhdi.h 21 | 22 | file_fuzzer_LDADD = \ 23 | @LIB_FUZZING_ENGINE@ \ 24 | @LIBBFIO_LIBADD@ \ 25 | @LIBCPATH_LIBADD@ \ 26 | @LIBCFILE_LIBADD@ \ 27 | @LIBUNA_LIBADD@ \ 28 | @LIBCDATA_LIBADD@ \ 29 | ../libvhdi/libvhdi.la \ 30 | @LIBCNOTIFY_LIBADD@ \ 31 | @LIBCLOCALE_LIBADD@ \ 32 | @LIBCERROR_LIBADD@ \ 33 | @LIBINTL@ 34 | endif 35 | 36 | DISTCLEANFILES = \ 37 | Makefile \ 38 | Makefile.in 39 | 40 | splint-local: 41 | @echo "Running splint on file_fuzzer ..." 42 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(file_fuzzer_SOURCES) 43 | 44 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libvhdi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libvhdi header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _OSSFUZZ_LIBVHDI_H ) 23 | #define _OSSFUZZ_LIBVHDI_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _OSSFUZZ_LIBVHDI_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_libvhdi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal libvhdi header 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_LIBVHDI_H ) 23 | #define _PYVHDI_LIBVHDI_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _PYVHDI_LIBVHDI_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /tests/vhdi_test_libvhdi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libvhdi header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_LIBVHDI_H ) 23 | #define _VHDI_TEST_LIBVHDI_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _VHDI_TEST_LIBVHDI_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /vhditools/vhditools_libvhdi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libvhdi header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBVHDI_H ) 23 | #define _VHDITOOLS_LIBVHDI_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _VHDITOOLS_LIBVHDI_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /dpkg/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: libvhdi 3 | Source: https://github.com/libyal/libvhdi 4 | 5 | Files: * 6 | Copyright: 2012-2025, Joachim Metz 7 | License: LGPL-3.0+ 8 | 9 | License: LGPL-3.0+ 10 | This package is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU Lesser General Public 12 | License as published by the Free Software Foundation; either 13 | version 3 of the License, or (at your option) any later version. 14 | . 15 | This package is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | . 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | . 23 | On Debian systems, the complete text of the GNU Lesser General 24 | Public License can be found in "/usr/share/common-licenses/LGPL-3". 25 | 26 | -------------------------------------------------------------------------------- /.github/workflows/build_macos.yml: -------------------------------------------------------------------------------- 1 | # Build from source. 2 | name: build_macos 3 | on: [push, pull_request] 4 | permissions: read-all 5 | jobs: 6 | build_macos: 7 | runs-on: ${{ matrix.os }} 8 | strategy: 9 | matrix: 10 | include: 11 | - os: macos-14 12 | configure_options: '' 13 | - os: macos-15 14 | configure_options: '' 15 | - os: macos-15-intel 16 | configure_options: '' 17 | - os: macos-26 18 | configure_options: '' 19 | steps: 20 | - uses: actions/checkout@v5 21 | - name: Install build dependencies 22 | run: | 23 | brew update -q 24 | brew install -q autoconf automake gettext gnu-sed libtool pkg-config || true 25 | brew link --force gettext 26 | ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize 27 | - name: Download test data 28 | run: | 29 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 30 | - name: Building from source 31 | env: 32 | CC: ${{ matrix.compiler }} 33 | run: | 34 | tests/build.sh ${{ matrix.configure_options }} 35 | - name: Run tests 36 | run: | 37 | tests/runtests.sh 38 | -------------------------------------------------------------------------------- /.github/workflows/build_shared.yml: -------------------------------------------------------------------------------- 1 | # Build from source with libyal dependencies as shared libraries. 2 | name: build_shared 3 | on: 4 | push: 5 | branches: [main] 6 | permissions: read-all 7 | jobs: 8 | build_shared_ubuntu: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | include: 13 | - architecture: 'x64' 14 | compiler: 'gcc' 15 | configure_options: '' 16 | - architecture: 'x64' 17 | compiler: 'gcc' 18 | configure_options: '--enable-wide-character-type' 19 | steps: 20 | - uses: actions/checkout@v5 21 | - name: Install build dependencies 22 | run: | 23 | sudo apt-get -y install autoconf automake autopoint build-essential git libfuse3-dev libtool pkg-config 24 | - name: Download test data 25 | run: | 26 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 27 | - name: Prepare shared libraries 28 | run: | 29 | tests/syncsharedlibs.sh --use-head 30 | - name: Building from source 31 | env: 32 | CC: ${{ matrix.compiler }} 33 | run: | 34 | tests/build.sh ${{ matrix.configure_options }} 35 | - name: Run tests 36 | run: | 37 | tests/runtests.sh 38 | -------------------------------------------------------------------------------- /libvhdi/libvhdi.rc.in: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef GCC_WINDRES 4 | VS_VERSION_INFO VERSIONINFO 5 | #else 6 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 7 | #endif 8 | FILEVERSION 1,0,0,0 9 | PRODUCTVERSION 1,0,0,0 10 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 11 | #ifdef _DEBUG 12 | FILEFLAGS 0x1L 13 | #else 14 | FILEFLAGS 0x0L 15 | #endif 16 | FILEOS VOS__WINDOWS32 17 | FILETYPE VFT_DLL 18 | FILESUBTYPE 0x0L 19 | BEGIN 20 | BLOCK "StringFileInfo" 21 | BEGIN 22 | BLOCK "040904E4" 23 | BEGIN 24 | VALUE "FileDescription", "Library to access the Virtual Hard Disk (VHD) image format\0" 25 | VALUE "FileVersion", "@VERSION@" "\0" 26 | VALUE "InternalName", "libvhdi.dll\0" 27 | VALUE "LegalCopyright", "(C) 2012-2025, Joachim Metz \0" 28 | VALUE "OriginalFilename", "libvhdi.dll\0" 29 | VALUE "ProductName", "libvhdi\0" 30 | VALUE "ProductVersion", "@VERSION@" "\0" 31 | VALUE "Comments", "For more information visit https://github.com/libyal/libvhdi/\0" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x0409, 1200 37 | END 38 | END 39 | -------------------------------------------------------------------------------- /common/config_msc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration for the Microsoft Visual Studio C++ compiler 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _CONFIG_MSC_H ) 23 | #define _CONFIG_MSC_H 24 | 25 | /* Disable warning C4127: conditional expression is constant 26 | */ 27 | #pragma warning( disable : 4127 ) 28 | 29 | /* Disable warning C4201: nonstandard extension used : nameless struct/union 30 | */ 31 | #pragma warning( disable : 4201 ) 32 | 33 | #endif /* !defined( _CONFIG_MSC_H ) */ 34 | 35 | -------------------------------------------------------------------------------- /.github/workflows/build_ossfuzz.yml: -------------------------------------------------------------------------------- 1 | # Build OSSFuzz fuzz targets from source. 2 | name: build_ossfuzz 3 | on: 4 | push: 5 | branches: [main] 6 | permissions: read-all 7 | jobs: 8 | build_ossfuzz: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | include: 13 | - architecture: 'x64' 14 | compiler: 'gcc' 15 | configure_options: '' 16 | steps: 17 | - name: Install build dependencies 18 | run: | 19 | sudo apt-get -y install git 20 | - uses: actions/checkout@v5 21 | with: 22 | repository: google/oss-fuzz 23 | path: oss-fuzz 24 | - name: Build OSSFuzz fuzz targets 25 | working-directory: oss-fuzz 26 | run: | 27 | mkdir -p projects/libvhdi 28 | cp projects/libyal/build.sh projects/libvhdi/ 29 | cp projects/libyal/project.yaml projects/libvhdi/ 30 | head -n 20 projects/libyal/Dockerfile > projects/libvhdi/Dockerfile 31 | echo "RUN git clone --depth 1 https://github.com/libyal/libvhdi.git libvhdi" >> projects/libvhdi/Dockerfile 32 | tail -n 3 projects/libyal/Dockerfile >> projects/libvhdi/Dockerfile 33 | python3 infra/helper.py build_image --pull libvhdi 34 | python3 infra/helper.py build_fuzzers --sanitizer address libvhdi 35 | python3 infra/helper.py check_build libvhdi 36 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_guid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GUID functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_GUID_H ) 23 | #define _PYVHDI_GUID_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvhdi_python.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | PyObject *pyvhdi_string_new_from_guid( 35 | const uint8_t *guid_buffer, 36 | size_t guid_buffer_size ); 37 | 38 | #if defined( __cplusplus ) 39 | } 40 | #endif 41 | 42 | #endif /* !defined( _PYVHDI_GUID_H ) */ 43 | 44 | -------------------------------------------------------------------------------- /libvhdi.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | libvhdi 5 | 20251220 6 | Joachim Metz 7 | joachimmetz 8 | LGPL-3.0-or-later 9 | https://github.com/libyal/libvhdi 10 | false 11 | libvhdi 12 | Library to access the Virtual Hard Disk (VHD) image format 13 | Release of libvhdi 20251220 14 | Copyright (C) 2012-2025 15 | native 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /pyvhdi/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_PYTHON 2 | AM_CFLAGS = \ 3 | -I../include -I$(top_srcdir)/include \ 4 | -I../common -I$(top_srcdir)/common \ 5 | @LIBCERROR_CPPFLAGS@ \ 6 | @LIBCDATA_CPPFLAGS@ \ 7 | @LIBCLOCALE_CPPFLAGS@ \ 8 | @LIBCSPLIT_CPPFLAGS@ \ 9 | @LIBUNA_CPPFLAGS@ \ 10 | @LIBCFILE_CPPFLAGS@ \ 11 | @LIBCPATH_CPPFLAGS@ \ 12 | @LIBBFIO_CPPFLAGS@ \ 13 | @LIBFGUID_CPPFLAGS@ \ 14 | @LIBVHDI_DLL_IMPORT@ 15 | 16 | pyexec_LTLIBRARIES = pyvhdi.la 17 | 18 | pyvhdi_la_SOURCES = \ 19 | pyvhdi.c pyvhdi.h \ 20 | pyvhdi_disk_types.c pyvhdi_disk_types.h \ 21 | pyvhdi_error.c pyvhdi_error.h \ 22 | pyvhdi_file.c pyvhdi_file.h \ 23 | pyvhdi_file_object_io_handle.c pyvhdi_file_object_io_handle.h \ 24 | pyvhdi_guid.c pyvhdi_guid.h \ 25 | pyvhdi_integer.c pyvhdi_integer.h \ 26 | pyvhdi_libbfio.h \ 27 | pyvhdi_libcerror.h \ 28 | pyvhdi_libclocale.h \ 29 | pyvhdi_libfguid.h \ 30 | pyvhdi_libvhdi.h \ 31 | pyvhdi_python.h \ 32 | pyvhdi_unused.h 33 | 34 | pyvhdi_la_LIBADD = \ 35 | @LIBCERROR_LIBADD@ \ 36 | ../libvhdi/libvhdi.la \ 37 | @LIBCDATA_LIBADD@ \ 38 | @LIBCLOCALE_LIBADD@ \ 39 | @LIBCSPLIT_LIBADD@ \ 40 | @LIBUNA_LIBADD@ \ 41 | @LIBCFILE_LIBADD@ \ 42 | @LIBCPATH_LIBADD@ \ 43 | @LIBBFIO_LIBADD@ \ 44 | @LIBFGUID_LIBADD@ 45 | 46 | pyvhdi_la_CPPFLAGS = $(PYTHON_CPPFLAGS) 47 | pyvhdi_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) 48 | 49 | endif 50 | 51 | DISTCLEANFILES = \ 52 | Makefile \ 53 | Makefile.in 54 | 55 | -------------------------------------------------------------------------------- /vhditools/vhditools_i18n.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Internationalization (i18n) functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_I18N_H ) 23 | #define _VHDITOOLS_I18N_H 24 | 25 | #include 26 | 27 | #if defined( HAVE_LIBINTL_H ) 28 | #include 29 | #endif 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | /* TODO for now do nothing i18n-like 36 | #define _( string ) \ 37 | gettext( string ) 38 | */ 39 | 40 | #define _( string ) \ 41 | string 42 | 43 | #if defined( __cplusplus ) 44 | } 45 | #endif 46 | 47 | #endif /* !defined( _VHDITOOLS_I18N_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /common/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common include file 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _COMMON_H ) 23 | #define _COMMON_H 24 | 25 | #if defined( HAVE_CONFIG_H ) 26 | #include "config.h" 27 | #endif 28 | 29 | /* Include the Borland/CodeGear C++ Builder compiler specific configuration 30 | */ 31 | #if defined( __BORLANDC__ ) 32 | #include "config_borlandc.h" 33 | 34 | /* Include the Microsoft Visual Studio C++ compiler specific configuration 35 | */ 36 | #elif defined( _MSC_VER ) 37 | #include "config_msc.h" 38 | #endif 39 | 40 | #include "config_winapi.h" 41 | 42 | #endif /* !defined( _COMMON_H ) */ 43 | 44 | -------------------------------------------------------------------------------- /runtests.ps1: -------------------------------------------------------------------------------- 1 | # Script that runs the tests 2 | # 3 | # Version: 20220103 4 | 5 | $ExitSuccess = 0 6 | $ExitFailure = 1 7 | $ExitIgnore = 77 8 | 9 | Set-Location -Path "tests" 10 | 11 | $Result = ${ExitSuccess} 12 | 13 | $Lines = Get-Content "Makefile.am" 14 | $InTests = $FALSE 15 | 16 | Foreach (${Line} in ${Lines}) 17 | { 18 | If (${InTests}) 19 | { 20 | If (-Not ${Line}) 21 | { 22 | ${InTests} = $FALSE 23 | 24 | Continue 25 | } 26 | ${Line} = ${Line}.TrimStart() 27 | 28 | If (${Line}.EndsWith(" \")) 29 | { 30 | ${Line} = ${Line}.Substring(0, ${Line}.Length - 2) 31 | } 32 | If (-Not (${Line}.EndsWith(".sh"))) 33 | { 34 | Continue 35 | } 36 | ${Line} = ${Line}.Substring(0, ${Line}.Length - 3) 37 | ${Line} = ".\${Line}.ps1" 38 | 39 | Try 40 | { 41 | Invoke-Expression ${Line} 42 | } 43 | Catch 44 | { 45 | $LastExitCode = ${ExitIgnore} 46 | } 47 | If (${LastExitCode} -eq ${ExitFailure}) 48 | { 49 | $Result = ${ExitFailure} 50 | Write-Host "FAIL" -foreground Red -nonewline 51 | } 52 | ElseIf (${LastExitCode} -eq ${ExitIgnore}) 53 | { 54 | Write-Host "SKIP" -foreground Cyan -nonewline 55 | } 56 | Else 57 | { 58 | Write-Host "PASS" -foreground Green -nonewline 59 | } 60 | Write-Host ": ${Line}" 61 | } 62 | ElseIf (${Line}.StartsWith("TESTS = ")) 63 | { 64 | ${InTests} = $TRUE 65 | } 66 | } 67 | 68 | Set-Location -Path ".." 69 | 70 | Exit ${Result} 71 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_libfguid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfguid header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_LIBFGUID_H ) 23 | #define _PYVHDI_LIBFGUID_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFGUID for local use of libfguid 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFGUID ) 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #else 36 | 37 | /* If libtool DLL support is enabled set LIBFGUID_DLL_IMPORT 38 | * before including libfguid.h 39 | */ 40 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 41 | #define LIBFGUID_DLL_IMPORT 42 | #endif 43 | 44 | #include 45 | 46 | #endif 47 | 48 | #endif /* !defined( _PYVHDI_LIBFGUID_H ) */ 49 | 50 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal extern definition 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_INTERNAL_EXTERN_H ) 23 | #define _LIBVHDI_INTERNAL_EXTERN_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBVHDI for local use of libvhdi 28 | */ 29 | #if !defined( HAVE_LOCAL_LIBVHDI ) 30 | 31 | #include 32 | 33 | #if defined( __CYGWIN__ ) || defined( __MINGW32__ ) 34 | #define LIBVHDI_EXTERN_VARIABLE extern 35 | #else 36 | #define LIBVHDI_EXTERN_VARIABLE LIBVHDI_EXTERN 37 | #endif 38 | 39 | #else 40 | #define LIBVHDI_EXTERN /* extern */ 41 | #define LIBVHDI_EXTERN_VARIABLE extern 42 | 43 | #endif /* !defined( HAVE_LOCAL_LIBVHDI ) */ 44 | 45 | #endif /* !defined( _LIBVHDI_INTERNAL_EXTERN_H ) */ 46 | 47 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_UNUSED_H ) 23 | #define _PYVHDI_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( PYVHDI_ATTRIBUTE_UNUSED ) 28 | #if defined( __GNUC__ ) && __GNUC__ >= 3 29 | #define PYVHDI_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 30 | #else 31 | #define PYVHDI_ATTRIBUTE_UNUSED 32 | #endif 33 | #endif 34 | 35 | #if defined( _MSC_VER ) 36 | #define PYVHDI_UNREFERENCED_PARAMETER( parameter ) \ 37 | UNREFERENCED_PARAMETER( parameter ); 38 | #else 39 | #define PYVHDI_UNREFERENCED_PARAMETER( parameter ) \ 40 | /* parameter */ 41 | #endif 42 | 43 | #endif /* !defined( _PYVHDI_UNUSED_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /tests/vhdi_test_libcpath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcpath header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_LIBCPATH_H ) 23 | #define _VHDI_TEST_LIBCPATH_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCPATH for local use of libcpath 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCPATH ) 30 | 31 | #include 32 | #include 33 | 34 | #else 35 | 36 | /* If libtool DLL support is enabled set LIBCPATH_DLL_IMPORT 37 | * before including libcpath.h 38 | */ 39 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 40 | #define LIBCPATH_DLL_IMPORT 41 | #endif 42 | 43 | #include 44 | 45 | #endif /* defined( HAVE_LOCAL_LIBCPATH ) */ 46 | 47 | #endif /* !defined( _VHDI_TEST_LIBCPATH_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_i18n.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Internationalization (i18n) functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_I18N_H ) 23 | #define _LIBVHDI_I18N_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( HAVE_LIBINTL_H ) && defined( ENABLE_NLS ) 29 | #include 30 | #endif 31 | 32 | #include "libvhdi_libcerror.h" 33 | 34 | /* TODO 35 | #include 36 | 37 | #define _( string ) \ 38 | dgettext( "libvhdi", string ) 39 | */ 40 | #define _( string ) \ 41 | string 42 | 43 | #if defined( __cplusplus ) 44 | extern "C" { 45 | #endif 46 | 47 | int libvhdi_i18n_initialize( 48 | libcerror_error_t **error ); 49 | 50 | #if defined( __cplusplus ) 51 | } 52 | #endif 53 | 54 | #endif /* !defined( _LIBVHDI_I18N_H ) */ 55 | 56 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_UNUSED_H ) 23 | #define _LIBVHDI_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( LIBVHDI_ATTRIBUTE_UNUSED ) 28 | #if defined( __GNUC__ ) && __GNUC__ >= 3 29 | #define LIBVHDI_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 30 | #else 31 | #define LIBVHDI_ATTRIBUTE_UNUSED 32 | #endif 33 | #endif 34 | 35 | #if defined( _MSC_VER ) 36 | #define LIBVHDI_UNREFERENCED_PARAMETER( parameter ) \ 37 | UNREFERENCED_PARAMETER( parameter ); 38 | #else 39 | #define LIBVHDI_UNREFERENCED_PARAMETER( parameter ) \ 40 | /* parameter */ 41 | #endif 42 | 43 | #endif /* !defined( _LIBVHDI_UNUSED_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /include/libvhdi/extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The extern definition 3 | * 4 | * This header should be included in header files that export or import 5 | * library functions 6 | * 7 | * Copyright (C) 2012-2025, Joachim Metz 8 | * 9 | * Refer to AUTHORS for acknowledgements. 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | */ 24 | 25 | #if !defined( _LIBVHDI_EXTERN_H ) 26 | #define _LIBVHDI_EXTERN_H 27 | 28 | /* To export functions from the libvhdi DLL define LIBVHDI_DLL_EXPORT 29 | * To import functions from the libvhdi DLL define LIBVHDI_DLL_IMPORT 30 | * Otherwise use default extern statement 31 | */ 32 | #if defined( LIBVHDI_DLL_EXPORT ) 33 | #define LIBVHDI_EXTERN __declspec(dllexport) 34 | 35 | #elif defined( LIBVHDI_DLL_IMPORT ) 36 | #define LIBVHDI_EXTERN extern __declspec(dllimport) 37 | 38 | #else 39 | #define LIBVHDI_EXTERN extern 40 | 41 | #endif 42 | 43 | #endif /* !defined( _LIBVHDI_EXTERN_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libfguid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfguid header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBFGUID_H ) 23 | #define _LIBVHDI_LIBFGUID_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFGUID for local use of libfguid 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFGUID ) 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #else 36 | 37 | /* If libtool DLL support is enabled set LIBFGUID_DLL_IMPORT 38 | * before including libfguid.h 39 | */ 40 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 41 | #define LIBFGUID_DLL_IMPORT 42 | #endif 43 | 44 | #include 45 | 46 | #endif /* defined( HAVE_LOCAL_LIBFGUID ) */ 47 | 48 | #endif /* !defined( _LIBVHDI_LIBFGUID_H ) */ 49 | 50 | -------------------------------------------------------------------------------- /vhditools/vhditools_libcpath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcpath header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBCPATH_H ) 23 | #define _VHDITOOLS_LIBCPATH_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCPATH for local use of libcpath 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCPATH ) 30 | 31 | #include 32 | #include 33 | 34 | #else 35 | 36 | /* If libtool DLL support is enabled set LIBCPATH_DLL_IMPORT 37 | * before including libcpath.h 38 | */ 39 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 40 | #define LIBCPATH_DLL_IMPORT 41 | #endif 42 | 43 | #include 44 | 45 | #endif /* defined( HAVE_LOCAL_LIBCPATH ) */ 46 | 47 | #endif /* !defined( _VHDITOOLS_LIBCPATH_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /libvhdi/vhdi_file_information.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The file information definition of a Virtual Hard Disk version 2 (VHDX) file 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_FILE_INFORMATION_H ) 23 | #define _VHDI_FILE_INFORMATION_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vhdi_file_information vhdi_file_information_t; 33 | 34 | struct vhdi_file_information 35 | { 36 | /* The signature 37 | * Consists of 8 bytes 38 | * Consists of: vhdxfile 39 | */ 40 | uint8_t signature[ 8 ]; 41 | 42 | /* The creator 43 | * Consists of 512 bytes 44 | */ 45 | uint8_t creator[ 512 ]; 46 | }; 47 | 48 | #if defined( __cplusplus ) 49 | } 50 | #endif 51 | 52 | #endif /* !defined( _VHDI_FILE_INFORMATION_H ) */ 53 | 54 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_LIBCERROR_H ) 23 | #define _PYVHDI_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _PYVHDI_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBCERROR_H ) 23 | #define _LIBVHDI_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _LIBVHDI_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /syncdokan.ps1: -------------------------------------------------------------------------------- 1 | # Script that synchronizes dokan 2 | # 3 | # Version: 20190810 4 | 5 | Param ( 6 | [switch]$UseHead = $false, 7 | [switch]$UseLegacyVersion = $false 8 | ) 9 | 10 | $Git = "git" 11 | 12 | If (${UseLegacyVersion}) 13 | { 14 | # Patched version of dokan 0.6.0 15 | $GitUrl = "https://github.com/joachimmetz/dokan.git" 16 | $Destination = "..\dokan" 17 | } 18 | Else 19 | { 20 | $GitUrl = "https://github.com/dokan-dev/dokany.git" 21 | $Destination = "..\dokany" 22 | } 23 | 24 | # PowerShell will raise NativeCommandError if git writes to stdout or stderr 25 | # therefore 2>&1 is added and the output is stored in a variable. 26 | $Output = Invoke-Expression -Command "${Git} clone ${GitUrl} ${Destination} 2>&1" 27 | 28 | Push-Location ${Destination} 29 | 30 | Try 31 | { 32 | $Output = Invoke-Expression -Command "${Git} fetch --quiet --all --tags --prune 2>&1" 33 | 34 | $LatestTag = Invoke-Expression -Command "${Git} describe --tags --abbrev=0 2>&1" 35 | 36 | If (${LatestTag} -and -not ${UseHead}) 37 | { 38 | Write-Host "Synchronizing: dokan from ${GitUrl} tag ${LatestTag}" 39 | 40 | $Output = Invoke-Expression -Command "${Git} checkout --quiet tags/${LatestTag} 2>&1" 41 | } 42 | Else 43 | { 44 | Write-Host "Synchronizing: dokan from ${GitUrl} HEAD" 45 | } 46 | If (-Not ${UseLegacyVersion}) 47 | { 48 | # AppVeyor does not come with platform toolset version 142 49 | ((Get-Content -Path "..\dokany\dokan\dokan.vcxproj" -Raw) -Replace 'v142','v141') | Set-Content -Path "..\dokany\dokan\dokan.vcxproj" 50 | } 51 | } 52 | Finally 53 | { 54 | Pop-Location 55 | } 56 | 57 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libfcache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfcache header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBFCACHE_H ) 23 | #define _LIBVHDI_LIBFCACHE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFCACHE for local use of libfcache 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFCACHE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBFCACHE_DLL_IMPORT 39 | * before including libfcache.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBFCACHE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBFCACHE ) */ 48 | 49 | #endif /* !defined( _LIBVHDI_LIBFCACHE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /vhditools/vhditools_libfguid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfguid header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBFGUID_H ) 23 | #define _VHDITOOLS_LIBFGUID_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFGUID for local use of libfguid 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFGUID ) 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #else 36 | 37 | /* If libtool DLL support is enabled set LIBFGUID_DLL_IMPORT 38 | * before including libfguid.h 39 | */ 40 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 41 | #define LIBFGUID_DLL_IMPORT 42 | #endif 43 | 44 | #include 45 | 46 | #endif /* defined( HAVE_LOCAL_LIBFGUID ) */ 47 | 48 | #endif /* !defined( _VHDITOOLS_LIBFGUID_H ) */ 49 | 50 | -------------------------------------------------------------------------------- /tests/vhdi_test_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_LIBCERROR_H ) 23 | #define _VHDI_TEST_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _VHDI_TEST_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBCNOTIFY_H ) 23 | #define _LIBVHDI_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _LIBVHDI_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_LIBCLOCALE_H ) 23 | #define _PYVHDI_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _PYVHDI_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBCLOCALE_H ) 23 | #define _LIBVHDI_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _LIBVHDI_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/vhdi_test_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_LIBCNOTIFY_H ) 23 | #define _VHDI_TEST_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _VHDI_TEST_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/vhdi_test_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_LIBCLOCALE_H ) 23 | #define _VHDI_TEST_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _VHDI_TEST_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal type definitions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_INTERNAL_TYPES_H ) 23 | #define _LIBVHDI_INTERNAL_TYPES_H 24 | 25 | #include 26 | #include 27 | 28 | /* Define HAVE_LOCAL_LIBVHDI for local use of libvhdi 29 | * The definitions in are copied here 30 | * for local use of libvhdi 31 | */ 32 | #if defined( HAVE_LOCAL_LIBVHDI ) 33 | 34 | /* The following type definitions hide internal data structures 35 | */ 36 | #if defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) 37 | typedef struct libvhdi_file {} libvhdi_file_t; 38 | 39 | #else 40 | typedef intptr_t libvhdi_file_t; 41 | 42 | #endif /* defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) */ 43 | 44 | #endif /* defined( HAVE_LOCAL_LIBVHDI ) */ 45 | 46 | #endif /* !defined( _LIBVHDI_INTERNAL_TYPES_H ) */ 47 | 48 | -------------------------------------------------------------------------------- /manuals/vhdiinfo.1: -------------------------------------------------------------------------------- 1 | .Dd March 9, 2019 2 | .Dt vhdiinfo 3 | .Os libvhdi 4 | .Sh NAME 5 | .Nm vhdiinfo 6 | .Nd determines information about a Virtual Hard Disk (VHD) image file 7 | .Sh SYNOPSIS 8 | .Nm vhdiinfo 9 | .Op Fl hvV 10 | .Ar source 11 | .Sh DESCRIPTION 12 | .Nm vhdiinfo 13 | is a utility to determine information about a Virtual Hard Disk (VHD) image file 14 | .Pp 15 | .Nm vhdiinfo 16 | is part of the 17 | .Nm libvhdi 18 | package. 19 | .Nm libvhdi 20 | is a library to access the Virtual Hard Disk (VHD) image format 21 | .Pp 22 | .Ar source 23 | is the source file. 24 | .Pp 25 | The options are as follows: 26 | .Bl -tag -width Ds 27 | .It Fl h 28 | shows this help 29 | .It Fl v 30 | verbose output to stderr 31 | .It Fl V 32 | print version 33 | .El 34 | .Sh ENVIRONMENT 35 | None 36 | .Sh FILES 37 | None 38 | .Sh EXAMPLES 39 | .Bd -literal 40 | # vhdiinfo differential.vhd 41 | vhdiinfo 20130512 42 | 43 | Virtual Hard Disk (VHD) image information: 44 | Format: 1.0 45 | Disk type: Differential 46 | Media size: 536870912 bytes 47 | Identifier: 5577d188-a753-4a80-800a-c627f764c304 48 | Parent identifier: 44421587-1b53-4972-9ceb-9a31e1618e5b 49 | Parent filename: dynamic.vhd 50 | 51 | .Ed 52 | .Sh DIAGNOSTICS 53 | Errors, verbose and debug output are printed to stderr when verbose output \-v is enabled. 54 | Verbose and debug output are only printed when enabled at compilation. 55 | .Sh BUGS 56 | Please report bugs of any kind to or on the project website: 57 | https://github.com/libyal/libvhdi/ 58 | .Sh AUTHOR 59 | These man pages were written by Joachim Metz. 60 | .Sh COPYRIGHT 61 | Copyright (C) 2012-2025, Joachim Metz . 62 | .Sh SEE ALSO 63 | -------------------------------------------------------------------------------- /vhditools/vhditools_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBCERROR_H ) 23 | #define _VHDITOOLS_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _VHDITOOLS_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /vhditools/vhditools_output.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common output functions for the vhditools 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_OUTPUT_H ) 23 | #define _VHDITOOLS_OUTPUT_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "vhditools_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int vhditools_output_initialize( 36 | int stdio_mode, 37 | libcerror_error_t **error ); 38 | 39 | void vhditools_output_copyright_fprint( 40 | FILE *stream ); 41 | 42 | void vhditools_output_version_fprint( 43 | FILE *stream, 44 | const char *program ); 45 | 46 | void vhditools_output_version_detailed_fprint( 47 | FILE *stream, 48 | const char *program ); 49 | 50 | #if defined( __cplusplus ) 51 | } 52 | #endif 53 | 54 | #endif /* !defined( _VHDITOOLS_OUTPUT_H ) */ 55 | 56 | -------------------------------------------------------------------------------- /vhditools/vhditools_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBCNOTIFY_H ) 23 | #define _VHDITOOLS_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _VHDITOOLS_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | TODO 2 | * add VHDX block state sanity checks 3 | * move parent identifier and filename to IO handle ? 4 | * validated checksums 5 | * add VHDX log (journal) support 6 | * debug print timestamps 7 | * improve test coverage 8 | 9 | Tests: 10 | * Test concurrent read from diff image and parent 11 | * Add verify test 12 | 13 | * debug 14 | - print creator application 15 | - print creator host system 16 | - print disk geometry 17 | * what about geometry and disk size calculation 18 | * read backup file footer of dynamic disk 19 | 20 | 20130922 21 | * updated msvscpp files 22 | * removed libfvalue 23 | * see `git log' for more recent change log 24 | 25 | 20130916 26 | * updated dependencies 27 | * worked on libcthreads build support 28 | * code clean up 29 | 30 | 20130831 31 | * updated dependencies 32 | 33 | 20130514 34 | * changes in parent functions 35 | 36 | 20130512 37 | * updated dependencies 38 | * changes to macosx files 39 | * worked on Python bindings 40 | * worked on debug output 41 | * worked on differential image support 42 | * worked on Dokan support 43 | 44 | 20130501 45 | * vhdimount: worked on differential images support 46 | 47 | 20121209 48 | * changes for fdata refactor 49 | 50 | 20121208 51 | * changes for fdata refactor 52 | 53 | 20121202 54 | * changes for fdata refactor 55 | 56 | 20121201 57 | * updated dependencies 58 | 59 | 20120929 60 | * updated dependencies 61 | 62 | 20120922 63 | * code clean up 64 | 65 | 20120920 66 | * updated dependencies 67 | 68 | 20120918 69 | * added support for fixed disk image 70 | 71 | 20120917 72 | * fix for debian rules file 73 | 74 | 20120914 75 | * fix for bitmap size, needs to be a multitude of sector size 76 | 77 | 20120913 78 | * initial version 79 | 80 | -------------------------------------------------------------------------------- /vhditools/vhditools_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBCLOCALE_H ) 23 | #define _VHDITOOLS_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _VHDITOOLS_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | dnl Checks for required headers and functions 2 | dnl 3 | dnl Version: 20200713 4 | 5 | dnl Function to detect if libvhdi dependencies are available 6 | AC_DEFUN([AX_LIBVHDI_CHECK_LOCAL], 7 | [dnl Check for internationalization functions in libvhdi/libvhdi_i18n.c 8 | AC_CHECK_FUNCS([bindtextdomain]) 9 | ]) 10 | 11 | dnl Function to detect if vhditools dependencies are available 12 | AC_DEFUN([AX_VHDITOOLS_CHECK_LOCAL], 13 | [AC_CHECK_HEADERS([signal.h sys/signal.h unistd.h]) 14 | 15 | AC_CHECK_FUNCS([close getopt setvbuf]) 16 | 17 | AS_IF( 18 | [test "x$ac_cv_func_close" != xyes], 19 | [AC_MSG_FAILURE( 20 | [Missing function: close], 21 | [1]) 22 | ]) 23 | 24 | dnl Headers included in vhditools/vhdimount.c 25 | AC_CHECK_HEADERS([errno.h sys/time.h]) 26 | 27 | dnl Functions included in vhditools/mount_file_system.c and vhditools/mount_file_entry.c 28 | AS_IF( 29 | [test "x$ac_cv_enable_winapi" = xno], 30 | [AC_CHECK_FUNCS([clock_gettime getegid geteuid time]) 31 | ]) 32 | ]) 33 | 34 | dnl Function to check if DLL support is needed 35 | AC_DEFUN([AX_LIBVHDI_CHECK_DLL_SUPPORT], 36 | [AS_IF( 37 | [test "x$enable_shared" = xyes && test "x$ac_cv_enable_static_executables" = xno], 38 | [AS_CASE( 39 | [$host], 40 | [*cygwin* | *mingw* | *msys*], 41 | [AC_DEFINE( 42 | [HAVE_DLLMAIN], 43 | [1], 44 | [Define to 1 to enable the DllMain function.]) 45 | AC_SUBST( 46 | [HAVE_DLLMAIN], 47 | [1]) 48 | 49 | AC_SUBST( 50 | [LIBVHDI_DLL_EXPORT], 51 | ["-DLIBVHDI_DLL_EXPORT"]) 52 | 53 | AC_SUBST( 54 | [LIBVHDI_DLL_IMPORT], 55 | ["-DLIBVHDI_DLL_IMPORT"]) 56 | ]) 57 | ]) 58 | ]) 59 | 60 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_checksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Checksum functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_CHECKSUM_H ) 23 | #define _LIBVHDI_CHECKSUM_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcerror.h" 29 | #include "libvhdi_extern.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | LIBVHDI_EXTERN_VARIABLE \ 36 | uint32_t libvhdi_checksum_crc32_table[ 256 ]; 37 | 38 | LIBVHDI_EXTERN_VARIABLE \ 39 | int libvhdi_checksum_crc32_table_computed; 40 | 41 | void libvhdi_checksum_initialize_crc32_table( 42 | uint32_t polynomial ); 43 | 44 | int libvhdi_checksum_calculate_crc32( 45 | uint32_t *checksum, 46 | const uint8_t *buffer, 47 | size_t size, 48 | uint32_t initial_value, 49 | libcerror_error_t **error ); 50 | 51 | #if defined( __cplusplus ) 52 | } 53 | #endif 54 | 55 | #endif /* !defined( _LIBVHDI_CHECKSUM_H ) */ 56 | 57 | -------------------------------------------------------------------------------- /tests/vhdi_test_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_UNUSED_H ) 23 | #define _VHDI_TEST_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( VHDI_TEST_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define VHDI_TEST_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define VHDI_TEST_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( VHDI_TEST_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define VHDI_TEST_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define VHDI_TEST_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _VHDI_TEST_UNUSED_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_LIBBFIO_H ) 23 | #define _PYVHDI_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 52 | 53 | #endif /* !defined( _PYVHDI_LIBBFIO_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /vhditools/vhditools_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_UNUSED_H ) 23 | #define _VHDITOOLS_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( VHDITOOLS_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define VHDITOOLS_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define VHDITOOLS_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( VHDITOOLS_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define VHDITOOLS_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define VHDITOOLS_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _VHDITOOLS_UNUSED_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /include/libvhdi/features.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Features of libvhdi 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_FEATURES_H ) 23 | #define _LIBVHDI_FEATURES_H 24 | 25 | /* The libvhdi type support features 26 | */ 27 | #if defined( WINAPI ) || @HAVE_WIDE_CHARACTER_TYPE@ 28 | #define LIBVHDI_HAVE_WIDE_CHARACTER_TYPE 1 29 | #endif 30 | 31 | #if defined( WINAPI ) || @HAVE_MULTI_THREAD_SUPPORT@ 32 | #define LIBVHDI_HAVE_MULTI_THREAD_SUPPORT 1 33 | #endif 34 | 35 | #if defined( HAVE_LIBBFIO ) || ( !defined( WINAPI ) && @HAVE_LIBBFIO@ ) 36 | #define LIBVHDI_HAVE_BFIO 1 37 | #endif 38 | 39 | #if !defined( LIBVHDI_DEPRECATED ) 40 | #if defined( __GNUC__ ) && __GNUC__ >= 3 41 | #define LIBVHDI_DEPRECATED __attribute__ ((__deprecated__)) 42 | #elif defined( _MSC_VER ) 43 | #define LIBVHDI_DEPRECATED __declspec(deprecated) 44 | #else 45 | #define LIBVHDI_DEPRECATED 46 | #endif 47 | #endif 48 | 49 | #endif /* !defined( _LIBVHDI_FEATURES_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libcdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcdata header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBCDATA_H ) 23 | #define _LIBVHDI_LIBCDATA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCDATA for local use of libcdata 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCDATA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBCDATA_DLL_IMPORT 43 | * before including libcdata.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBCDATA_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #endif /* defined( HAVE_LOCAL_LIBCDATA ) */ 52 | 53 | #endif /* !defined( _LIBVHDI_LIBCDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libfdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfdata header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBFDATA_H ) 23 | #define _LIBVHDI_LIBFDATA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFDATA for local use of libfdata 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFDATA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBFDATA_DLL_IMPORT 43 | * before including libfdata.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBFDATA_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #endif /* defined( HAVE_LOCAL_LIBFDATA ) */ 52 | 53 | #endif /* !defined( _LIBVHDI_LIBFDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_integer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Integer functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_INTEGER_H ) 23 | #define _PYVHDI_INTEGER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvhdi_libcerror.h" 29 | #include "pyvhdi_python.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | PyObject *pyvhdi_integer_signed_new_from_64bit( 36 | int64_t value_64bit ); 37 | 38 | PyObject *pyvhdi_integer_unsigned_new_from_64bit( 39 | uint64_t value_64bit ); 40 | 41 | int pyvhdi_integer_signed_copy_to_64bit( 42 | PyObject *integer_object, 43 | int64_t *value_64bit, 44 | libcerror_error_t **error ); 45 | 46 | int pyvhdi_integer_unsigned_copy_to_64bit( 47 | PyObject *integer_object, 48 | uint64_t *value_64bit, 49 | libcerror_error_t **error ); 50 | 51 | #if defined( __cplusplus ) 52 | } 53 | #endif 54 | 55 | #endif /* !defined( _PYVHDI_INTEGER_H ) */ 56 | 57 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_ERROR_H ) 23 | #define _PYVHDI_ERROR_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvhdi_libcerror.h" 29 | #include "pyvhdi_python.h" 30 | 31 | #define PYVHDI_ERROR_STRING_SIZE 2048 32 | 33 | #if defined( __cplusplus ) 34 | extern "C" { 35 | #endif 36 | 37 | void pyvhdi_error_fetch( 38 | libcerror_error_t **error, 39 | int error_domain, 40 | int error_code, 41 | const char *format_string, 42 | ... ); 43 | 44 | void pyvhdi_error_fetch_and_raise( 45 | PyObject *exception_object, 46 | const char *format_string, 47 | ... ); 48 | 49 | void pyvhdi_error_raise( 50 | libcerror_error_t *error, 51 | PyObject *exception_object, 52 | const char *format_string, 53 | ... ); 54 | 55 | #if defined( __cplusplus ) 56 | } 57 | #endif 58 | 59 | #endif /* !defined( _PYVHDI_ERROR_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /vhditools/vhditools_libcdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcdata header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBCDATA_H ) 23 | #define _VHDITOOLS_LIBCDATA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCDATA for local use of libcdata 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCDATA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBCDATA_DLL_IMPORT 43 | * before including libcdata.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBCDATA_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #endif /* defined( HAVE_LOCAL_LIBCDATA ) */ 52 | 53 | #endif /* !defined( _VHDITOOLS_LIBCDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /vhditools/byte_size_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Byte size string functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _BYTE_SIZE_STRING_H ) 23 | #define _BYTE_SIZE_STRING_H 24 | 25 | #include 26 | #include 27 | 28 | #include "vhditools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | enum BYTE_SIZE_STRING_UNITS 35 | { 36 | BYTE_SIZE_STRING_UNIT_MEGABYTE = 1000, 37 | BYTE_SIZE_STRING_UNIT_MEBIBYTE = 1024 38 | }; 39 | 40 | int byte_size_string_create( 41 | system_character_t *byte_size_string, 42 | size_t byte_size_string_length, 43 | uint64_t size, 44 | int units, 45 | libcerror_error_t **error ); 46 | 47 | int byte_size_string_convert( 48 | const system_character_t *byte_size_string, 49 | size_t byte_size_string_length, 50 | uint64_t *size, 51 | libcerror_error_t **error ); 52 | 53 | #if defined( __cplusplus ) 54 | } 55 | #endif 56 | 57 | #endif /* !defined( _BYTE_SIZE_STRING_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /tests/syncsharedlibs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script that synchronizes the shared library dependencies 3 | # 4 | # Version: 20201121 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | 9 | GIT_URL_PREFIX="https://github.com/libyal"; 10 | SHARED_LIBS="libcerror libcthreads libcdata libclocale libcnotify libcsplit libuna libcfile libcpath libbfio libfcache libfdata libfguid"; 11 | 12 | USE_HEAD=""; 13 | 14 | if test "$1" = "--use-head"; 15 | then 16 | USE_HEAD="--use-head"; 17 | fi 18 | 19 | OLDIFS=$IFS; 20 | IFS=" "; 21 | 22 | for SHARED_LIB in ${SHARED_LIBS}; 23 | do 24 | GIT_URL="${GIT_URL_PREFIX}/${SHARED_LIB}.git"; 25 | 26 | git clone --quiet ${GIT_URL} ${SHARED_LIB}-$$; 27 | 28 | if ! test -d ${SHARED_LIB}-$$; 29 | then 30 | echo "Unable to git clone: ${GIT_URL}"; 31 | 32 | IFS=$OLDIFS; 33 | 34 | exit ${EXIT_FAILURE}; 35 | fi 36 | (cd ${SHARED_LIB}-$$ && git fetch --quiet --all --tags --prune) 37 | 38 | LATEST_TAG=`cd ${SHARED_LIB}-$$ && git describe --tags --abbrev=0`; 39 | 40 | if test -n ${LATEST_TAG} && test -z ${USE_HEAD}; 41 | then 42 | echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} tag ${LATEST_TAG}"; 43 | 44 | (cd ${SHARED_LIB}-$$ && git checkout --quiet tags/${LATEST_TAG}); 45 | else 46 | echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} HEAD"; 47 | fi 48 | 49 | (cd ${SHARED_LIB}-$$ && ./synclibs.sh ${USE_HEAD} && ./autogen.sh); 50 | 51 | CONFIGURE_OPTIONS=""; 52 | 53 | (cd ${SHARED_LIB}-$$ && ./configure --help | grep -- '--enable-wide-character-type' > /dev/null); 54 | 55 | if test $? -eq 0; 56 | then 57 | CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-wide-character-type"; 58 | fi 59 | 60 | (cd ${SHARED_LIB}-$$ && ./configure --prefix=/usr ${CONFIGURE_OPTIONS} && make && sudo make install); 61 | 62 | rm -rf ${SHARED_LIB}-$$; 63 | done 64 | 65 | IFS=$OLDIFS; 66 | 67 | exit ${EXIT_SUCCESS}; 68 | 69 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_notify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Notification functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_NOTIFY_H ) 23 | #define _LIBVHDI_NOTIFY_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "libvhdi_extern.h" 30 | #include "libvhdi_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBVHDI ) 37 | 38 | LIBVHDI_EXTERN \ 39 | void libvhdi_notify_set_verbose( 40 | int verbose ); 41 | 42 | LIBVHDI_EXTERN \ 43 | int libvhdi_notify_set_stream( 44 | FILE *stream, 45 | libcerror_error_t **error ); 46 | 47 | LIBVHDI_EXTERN \ 48 | int libvhdi_notify_stream_open( 49 | const char *filename, 50 | libcerror_error_t **error ); 51 | 52 | LIBVHDI_EXTERN \ 53 | int libvhdi_notify_stream_close( 54 | libcerror_error_t **error ); 55 | 56 | #endif /* !defined( HAVE_LOCAL_LIBVHDI ) */ 57 | 58 | #if defined( __cplusplus ) 59 | } 60 | #endif 61 | 62 | #endif /* !defined( _LIBVHDI_NOTIFY_H ) */ 63 | 64 | -------------------------------------------------------------------------------- /libvhdi.ini: -------------------------------------------------------------------------------- 1 | [project] 2 | name: "libvhdi" 3 | status: "alpha" 4 | year_of_creation: "2012" 5 | data_format: "Virtual Hard Disk (VHD) image" 6 | documentation_url: "https://github.com/libyal/libvhdi/tree/main/documentation" 7 | features: ["debug_output", "nuget", "ossfuzz", "python_bindings", "tools"] 8 | 9 | [library] 10 | description: "Library to access the Virtual Hard Disk (VHD) image format" 11 | features: ["pthread", "wide_character_type"] 12 | public_types: ["file"] 13 | 14 | [tools] 15 | build_dependencies: ["fuse"] 16 | description: "Several tools for reading Virtual Hard Disk (VHD) image files" 17 | names: ["vhdiinfo", "vhdimount"] 18 | 19 | [info_tool] 20 | source_description: "a Virtual Hard Disk (VHD) image file" 21 | source_type: "image" 22 | 23 | [mount_tool] 24 | features: ["parent"] 25 | file_entry_type: "file" 26 | file_entry_type_size_value: "media_size" 27 | mounted_description: "a device file that provides the RAW storage media data contained in the VHDI image" 28 | source: "image.vhd" 29 | source_description: "a VHD image" 30 | source_description_long: "a Virtual Hard Disk (VHD) image file" 31 | source_type: "image" 32 | 33 | [troubleshooting] 34 | example: "vhdiinfo image.vhd" 35 | 36 | [development] 37 | features: ["pytsk3"] 38 | main_object: "file" 39 | main_object_filename: "image.vhd" 40 | main_object_size: "media_size" 41 | 42 | [test_data] 43 | repository: "log2timeline/dfvfs" 44 | files: ["ext2.vhd", "ext2.vhdx"] 45 | 46 | [tests] 47 | profiles: ["libvhdi", "pyvhdi", "vhdiinfo"] 48 | info_tool_options_per_profile: [""] 49 | info_tool_profiles: ["vhdiinfo"] 50 | example_filename1: "image1.vhd" 51 | example_filename2: "image2.vhd" 52 | 53 | [coverity] 54 | scan_token: "ZQp5VYDMrMz7Ca0f7uA0InFbCoYhD2RmbHpUnOyAs+8tUXsl3ZKWqZJEvc+1qOdr+N+dEUv0/6TOxJZxydhhB+ardayWxIk8RCjBW7twBeZvSt1nNW8VUfwc2ZCNMoeKvqMQcaWa1cG7Joo8TTEvzPbWJnSxaadhlgfSaCWaR0A=" 55 | 56 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_disk_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Python object definition of the libvhdi disk types 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_DISK_TYPES_H ) 23 | #define _PYVHDI_DISK_TYPES_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvhdi_libvhdi.h" 29 | #include "pyvhdi_python.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct pyvhdi_disk_types pyvhdi_disk_types_t; 36 | 37 | struct pyvhdi_disk_types 38 | { 39 | /* Python object initialization 40 | */ 41 | PyObject_HEAD 42 | }; 43 | 44 | extern PyTypeObject pyvhdi_disk_types_type_object; 45 | 46 | int pyvhdi_disk_types_init_type( 47 | PyTypeObject *type_object ); 48 | 49 | PyObject *pyvhdi_disk_types_new( 50 | void ); 51 | 52 | int pyvhdi_disk_types_init( 53 | pyvhdi_disk_types_t *definitions_object ); 54 | 55 | void pyvhdi_disk_types_free( 56 | pyvhdi_disk_types_t *definitions_object ); 57 | 58 | #if defined( __cplusplus ) 59 | } 60 | #endif 61 | 62 | #endif /* !defined( _PYVHDI_DISK_TYPES_H ) */ 63 | 64 | -------------------------------------------------------------------------------- /tests/vhdi_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory allocation functions for testing 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_MEMORY_H ) 23 | #define _VHDI_TEST_MEMORY_H 24 | 25 | #include 26 | 27 | #if defined( __cplusplus ) 28 | extern "C" { 29 | #endif 30 | 31 | #if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __loongarch__ ) && !defined( __mips__ ) && !defined( __riscv ) && !defined( __sparc__ ) && !defined( HAVE_ASAN ) 32 | #define HAVE_VHDI_TEST_MEMORY 1 33 | #endif 34 | 35 | #if defined( HAVE_VHDI_TEST_MEMORY ) 36 | 37 | extern int vhdi_test_malloc_attempts_before_fail; 38 | 39 | extern int vhdi_test_memcpy_attempts_before_fail; 40 | 41 | extern int vhdi_test_memset_attempts_before_fail; 42 | 43 | extern int vhdi_test_realloc_attempts_before_fail; 44 | 45 | #endif /* defined( HAVE_VHDI_TEST_MEMORY ) */ 46 | 47 | #if defined( __cplusplus ) 48 | } 49 | #endif 50 | 51 | #endif /* !defined( _VHDI_TEST_MEMORY_H ) */ 52 | 53 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBBFIO_H ) 23 | #define _LIBVHDI_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _LIBVHDI_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /tests/vhdi_test_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_LIBBFIO_H ) 23 | #define _VHDI_TEST_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _VHDI_TEST_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_i18n.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Internationalization (i18n) functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #if defined( HAVE_LIBINTL_H ) && defined( ENABLE_NLS ) 26 | #include 27 | #endif 28 | 29 | #include "libvhdi_i18n.h" 30 | #include "libvhdi_libcerror.h" 31 | 32 | static int libvhdi_i18n_initialized = 0; 33 | 34 | /* Initializes library internationalization functions 35 | */ 36 | int libvhdi_i18n_initialize( 37 | libcerror_error_t **error ) 38 | { 39 | static char *function = "libvhdi_i18n_initialize"; 40 | 41 | if( libvhdi_i18n_initialized == 0 ) 42 | { 43 | #if defined( HAVE_BINDTEXTDOMAIN ) && defined( LOCALEDIR ) 44 | if( bindtextdomain( 45 | "libvhdi", 46 | LOCALEDIR ) == NULL ) 47 | { 48 | libcerror_error_set( 49 | error, 50 | LIBCERROR_ERROR_DOMAIN_RUNTIME, 51 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, 52 | "%s: unable to bind text domain.", 53 | function ); 54 | 55 | return( -1 ); 56 | } 57 | #endif /* defined( HAVE_BINDTEXTDOMAIN ) && defined( LOCALEDIR ) */ 58 | 59 | libvhdi_i18n_initialized = 1; 60 | } 61 | return( 1 ); 62 | } 63 | 64 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_sector_range_descriptor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Sector range descriptor functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_SECTOR_RANGE_DESCRIPTOR_H ) 23 | #define _LIBVHDI_SECTOR_RANGE_DESCRIPTOR_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvhdi_sector_range_descriptor libvhdi_sector_range_descriptor_t; 35 | 36 | struct libvhdi_sector_range_descriptor 37 | { 38 | /* The start offset 39 | */ 40 | off64_t start_offset; 41 | 42 | /* The end offset 43 | */ 44 | off64_t end_offset; 45 | 46 | /* The flags 47 | */ 48 | uint32_t flags; 49 | }; 50 | 51 | int libvhdi_sector_range_descriptor_initialize( 52 | libvhdi_sector_range_descriptor_t **sector_range_descriptor, 53 | libcerror_error_t **error ); 54 | 55 | int libvhdi_sector_range_descriptor_free( 56 | libvhdi_sector_range_descriptor_t **sector_range_descriptor, 57 | libcerror_error_t **error ); 58 | 59 | #if defined( __cplusplus ) 60 | } 61 | #endif 62 | 63 | #endif /* !defined( _LIBVHDI_SECTOR_RANGE_DESCRIPTOR_H ) */ 64 | 65 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBUNA_H ) 23 | #define _LIBVHDI_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _LIBVHDI_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _OSSFUZZ_LIBBFIO_H ) 23 | #define _OSSFUZZ_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _OSSFUZZ_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /tests/vhdi_test_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_LIBUNA_H ) 23 | #define _VHDI_TEST_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _VHDI_TEST_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /vhditools/vhditools_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBBFIO_H ) 23 | #define _VHDITOOLS_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _VHDITOOLS_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /po/Makevars.in: -------------------------------------------------------------------------------- 1 | # Makefile variables for PO directory in any package using GNU gettext. 2 | 3 | # Usually the message domain is the same as the package name. 4 | DOMAIN = @PACKAGE@ 5 | 6 | # These two variables depend on the location of this directory. 7 | subdir = po 8 | top_builddir = .. 9 | 10 | # These options get passed to xgettext. 11 | XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ 12 | 13 | # This is the copyright holder that gets inserted into the header of the 14 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 15 | # package. (Note that the msgstr strings, extracted from the package's 16 | # sources, belong to the copyright holder of the package.) Translators are 17 | # expected to transfer the copyright for their translations to this person 18 | # or entity, or to disclaim their copyright. The empty string stands for 19 | # the public domain; in this case the translators are expected to disclaim 20 | # their copyright. 21 | COPYRIGHT_HOLDER = Joachim Metz 22 | 23 | # This is the email address or URL to which the translators shall report 24 | # bugs in the untranslated strings: 25 | # - Strings which are not entire sentences, see the maintainer guidelines 26 | # in the GNU gettext documentation, section 'Preparing Strings'. 27 | # - Strings which use unclear terms or require additional context to be 28 | # understood. 29 | # - Strings which make invalid assumptions about notation of date, time or 30 | # money. 31 | # - Pluralisation problems. 32 | # - Incorrect English spelling. 33 | # - Incorrect formatting. 34 | # It can be your email address, or a mailing list address where translators 35 | # can write to without being subscribed, or the URL of a web page through 36 | # which the translators can contact you. 37 | MSGID_BUGS_ADDRESS = @PACKAGE_BUGREPORT@ 38 | 39 | # This is the list of locale categories, beyond LC_MESSAGES, for which the 40 | # message catalogs shall be used. It is usually empty. 41 | EXTRA_LOCALE_CATEGORIES = 42 | 43 | # Additional make targets. 44 | sources splint: 45 | 46 | -------------------------------------------------------------------------------- /tests/vhdi_test_libcthreads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal libcthreads header 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_LIBCTHREADS_H ) 23 | #define _VHDI_TEST_LIBCTHREADS_H 24 | 25 | #include 26 | 27 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBVHDI ) 28 | 29 | /* Define HAVE_LOCAL_LIBCTHREADS for local use of libcthreads 30 | */ 31 | #if defined( HAVE_LOCAL_LIBCTHREADS ) 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #else 45 | 46 | /* If libtool DLL support is enabled set LIBCTHREADS_DLL_IMPORT 47 | * before including libcthreads.h 48 | */ 49 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 50 | #define LIBCTHREADS_DLL_IMPORT 51 | #endif 52 | 53 | #include 54 | 55 | #endif 56 | 57 | #endif /* defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBVHDI ) */ 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /vhditools/vhditools_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_LIBUNA_H ) 23 | #define _VHDITOOLS_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _VHDITOOLS_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_metadata_table_header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Metadata table header functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_METADATA_TABLE_HEADER_H ) 23 | #define _LIBVHDI_METADATA_TABLE_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvhdi_metadata_table_header libvhdi_metadata_table_header_t; 35 | 36 | struct libvhdi_metadata_table_header 37 | { 38 | /* The number of entries 39 | */ 40 | uint16_t number_of_entries; 41 | }; 42 | 43 | int libvhdi_metadata_table_header_initialize( 44 | libvhdi_metadata_table_header_t **metadata_table_header, 45 | libcerror_error_t **error ); 46 | 47 | int libvhdi_metadata_table_header_free( 48 | libvhdi_metadata_table_header_t **metadata_table_header, 49 | libcerror_error_t **error ); 50 | 51 | int libvhdi_metadata_table_header_read_data( 52 | libvhdi_metadata_table_header_t *metadata_table_header, 53 | const uint8_t *data, 54 | size_t data_size, 55 | libcerror_error_t **error ); 56 | 57 | #if defined( __cplusplus ) 58 | } 59 | #endif 60 | 61 | #endif /* !defined( _LIBVHDI_METADATA_TABLE_HEADER_H ) */ 62 | 63 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_parent_locator_header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Parent locator header functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_PARENT_LOCATOR_HEADER_H ) 23 | #define _LIBVHDI_PARENT_LOCATOR_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvhdi_parent_locator_header libvhdi_parent_locator_header_t; 35 | 36 | struct libvhdi_parent_locator_header 37 | { 38 | /* The number of entries 39 | */ 40 | uint32_t number_of_entries; 41 | }; 42 | 43 | int libvhdi_parent_locator_header_initialize( 44 | libvhdi_parent_locator_header_t **parent_locator_header, 45 | libcerror_error_t **error ); 46 | 47 | int libvhdi_parent_locator_header_free( 48 | libvhdi_parent_locator_header_t **parent_locator_header, 49 | libcerror_error_t **error ); 50 | 51 | int libvhdi_parent_locator_header_read_data( 52 | libvhdi_parent_locator_header_t *parent_locator_header, 53 | const uint8_t *data, 54 | size_t data_size, 55 | libcerror_error_t **error ); 56 | 57 | #if defined( __cplusplus ) 58 | } 59 | #endif 60 | 61 | #endif /* !defined( _LIBVHDI_PARENT_LOCATOR_HEADER_H ) */ 62 | 63 | -------------------------------------------------------------------------------- /tests/test_manpage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Tests man pages. 3 | # 4 | # Version: 20240413 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | EXIT_IGNORE=77; 9 | 10 | run_test() 11 | { 12 | local INPUT_FILE=$1; 13 | local RESULT=0 14 | 15 | TEST_NAME=`basename ${INPUT_FILE}`; 16 | echo -n "Testing man with input: ${TEST_NAME}"; 17 | 18 | LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings -E UTF-8 -l -Tutf8 -Z ${INPUT_FILE} > /dev/null 2> ${TMPDIR}/${TEST_NAME}.warnings; 19 | RESULT=$?; 20 | 21 | # For now line break warnings are ignored. 22 | if test -f ${TMPDIR}/${TEST_NAME}.warnings; 23 | then 24 | sed "/can't break line/ d" -i ${TMPDIR}/${TEST_NAME}.warnings; 25 | fi 26 | if test -s ${TMPDIR}/${TEST_NAME}.warnings; 27 | then 28 | RESULT=${EXIT_FAILURE}; 29 | fi 30 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 31 | then 32 | echo " (FAIL)"; 33 | else 34 | echo " (PASS)"; 35 | fi 36 | if test -s ${TMPDIR}/${TEST_NAME}.warnings; 37 | then 38 | cat ${TMPDIR}/${TEST_NAME}.warnings; 39 | fi 40 | return ${RESULT}; 41 | } 42 | 43 | if test "${OSTYPE}" = "msys"; 44 | then 45 | exit ${EXIT_IGNORE}; 46 | fi 47 | 48 | TEST_DIRECTORY=`dirname $0`; 49 | 50 | TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; 51 | 52 | if ! test -f "${TEST_RUNNER}"; 53 | then 54 | echo "Missing test runner: ${TEST_RUNNER}"; 55 | 56 | exit ${EXIT_FAILURE}; 57 | fi 58 | 59 | source ${TEST_RUNNER}; 60 | 61 | assert_availability_binary man; 62 | 63 | RESULT=${EXIT_IGNORE}; 64 | 65 | TMPDIR="tmp$$"; 66 | 67 | rm -rf ${TMPDIR}; 68 | mkdir ${TMPDIR}; 69 | 70 | MANUALS_PATH="../manuals"; 71 | 72 | if ! test -d ${MANUALS_PATH}; 73 | then 74 | MANUALS_PATH="manuals"; 75 | fi 76 | 77 | if ! test -d ${MANUALS_PATH}; 78 | then 79 | echo "Manuals directory not found."; 80 | 81 | exit ${EXIT_IGNORE}; 82 | fi 83 | 84 | for INPUT_FILE in ${MANUALS_PATH}/*.[13]; 85 | do 86 | run_test "${INPUT_FILE}"; 87 | RESULT=$?; 88 | 89 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 90 | then 91 | break; 92 | fi 93 | done 94 | 95 | rm -rf ${TMPDIR}; 96 | 97 | exit ${RESULT}; 98 | 99 | -------------------------------------------------------------------------------- /vhditools/vhditools_signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Signal handling functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_SIGNAL_H ) 23 | #define _VHDITOOLS_SIGNAL_H 24 | 25 | #include 26 | #include 27 | 28 | #include "vhditools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | #if !defined( HAVE_SIGNAL_H ) && !defined( WINAPI ) 35 | #error missing signal functions 36 | #endif 37 | 38 | #if defined( WINAPI ) 39 | typedef unsigned long vhditools_signal_t; 40 | 41 | #else 42 | typedef int vhditools_signal_t; 43 | 44 | #endif /* defined( WINAPI ) */ 45 | 46 | #if defined( WINAPI ) 47 | 48 | BOOL WINAPI vhditools_signal_handler( 49 | vhditools_signal_t signal ); 50 | 51 | #if defined( _MSC_VER ) 52 | 53 | void vhditools_signal_initialize_memory_debug( 54 | void ); 55 | 56 | #endif /* defined( _MSC_VER ) */ 57 | 58 | #endif /* defined( WINAPI ) */ 59 | 60 | int vhditools_signal_attach( 61 | void (*signal_handler)( vhditools_signal_t ), 62 | libcerror_error_t **error ); 63 | 64 | int vhditools_signal_detach( 65 | libcerror_error_t **error ); 66 | 67 | #if defined( __cplusplus ) 68 | } 69 | #endif 70 | 71 | #endif /* !defined( _VHDITOOLS_SIGNAL_H ) */ 72 | 73 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_region_table_header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Region table header functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_REGION_TABLE_HEADER_H ) 23 | #define _LIBVHDI_REGION_TABLE_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvhdi_region_table_header libvhdi_region_table_header_t; 35 | 36 | struct libvhdi_region_table_header 37 | { 38 | /* The checksum 39 | */ 40 | uint32_t checksum; 41 | 42 | /* The number of entries 43 | */ 44 | uint32_t number_of_entries; 45 | }; 46 | 47 | int libvhdi_region_table_header_initialize( 48 | libvhdi_region_table_header_t **region_table_header, 49 | libcerror_error_t **error ); 50 | 51 | int libvhdi_region_table_header_free( 52 | libvhdi_region_table_header_t **region_table_header, 53 | libcerror_error_t **error ); 54 | 55 | int libvhdi_region_table_header_read_data( 56 | libvhdi_region_table_header_t *region_table_header, 57 | const uint8_t *data, 58 | size_t data_size, 59 | libcerror_error_t **error ); 60 | 61 | #if defined( __cplusplus ) 62 | } 63 | #endif 64 | 65 | #endif /* !defined( _LIBVHDI_REGION_TABLE_HEADER_H ) */ 66 | 67 | -------------------------------------------------------------------------------- /tests/vhdi_test_functions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Functions for testing 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_FUNCTIONS_H ) 23 | #define _VHDI_TEST_FUNCTIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #include "vhdi_test_libbfio.h" 29 | #include "vhdi_test_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int vhdi_test_get_narrow_source( 36 | const system_character_t *source, 37 | char *narrow_string, 38 | size_t narrow_string_size, 39 | libcerror_error_t **error ); 40 | 41 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 42 | 43 | int vhdi_test_get_wide_source( 44 | const system_character_t *source, 45 | wchar_t *wide_string, 46 | size_t wide_string_size, 47 | libcerror_error_t **error ); 48 | 49 | #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ 50 | 51 | int vhdi_test_open_file_io_handle( 52 | libbfio_handle_t **file_io_handle, 53 | uint8_t *data, 54 | size_t data_size, 55 | libcerror_error_t **error ); 56 | 57 | int vhdi_test_close_file_io_handle( 58 | libbfio_handle_t **file_io_handle, 59 | libcerror_error_t **error ); 60 | 61 | #if defined( __cplusplus ) 62 | } 63 | #endif 64 | 65 | #endif /* !defined( _VHDI_TEST_FUNCTIONS_H ) */ 66 | 67 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_INTERNAL_ERROR_H ) 23 | #define _LIBVHDI_INTERNAL_ERROR_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #if !defined( HAVE_LOCAL_LIBVHDI ) 30 | #include 31 | #endif 32 | 33 | #include "libvhdi_extern.h" 34 | 35 | #if defined( __cplusplus ) 36 | extern "C" { 37 | #endif 38 | 39 | #if !defined( HAVE_LOCAL_LIBVHDI ) 40 | 41 | LIBVHDI_EXTERN \ 42 | void libvhdi_error_free( 43 | libvhdi_error_t **error ); 44 | 45 | LIBVHDI_EXTERN \ 46 | int libvhdi_error_fprint( 47 | libvhdi_error_t *error, 48 | FILE *stream ); 49 | 50 | LIBVHDI_EXTERN \ 51 | int libvhdi_error_sprint( 52 | libvhdi_error_t *error, 53 | char *string, 54 | size_t size ); 55 | 56 | LIBVHDI_EXTERN \ 57 | int libvhdi_error_backtrace_fprint( 58 | libvhdi_error_t *error, 59 | FILE *stream ); 60 | 61 | LIBVHDI_EXTERN \ 62 | int libvhdi_error_backtrace_sprint( 63 | libvhdi_error_t *error, 64 | char *string, 65 | size_t size ); 66 | 67 | #endif /* !defined( HAVE_LOCAL_LIBVHDI ) */ 68 | 69 | #if defined( __cplusplus ) 70 | } 71 | #endif 72 | 73 | #endif /* !defined( _LIBVHDI_INTERNAL_ERROR_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /tests/vhdi_test_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_TEST_GETOPT_H ) 23 | #define _VHDI_TEST_GETOPT_H 24 | 25 | #include 26 | #include 27 | 28 | /* unistd.h is included here to export getopt, optarg, optind and optopt 29 | */ 30 | #if defined( HAVE_UNISTD_H ) 31 | #include 32 | #endif 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | #if defined( HAVE_GETOPT ) 39 | #define vhdi_test_getopt( argument_count, argument_values, options_string ) \ 40 | getopt( argument_count, argument_values, options_string ) 41 | 42 | #else 43 | 44 | #if !defined( __CYGWIN__ ) 45 | extern int optind; 46 | extern system_character_t *optarg; 47 | extern system_integer_t optopt; 48 | 49 | #else 50 | int optind; 51 | system_character_t *optarg; 52 | system_integer_t optopt; 53 | 54 | #endif /* !defined( __CYGWIN__ ) */ 55 | 56 | system_integer_t vhdi_test_getopt( 57 | int argument_count, 58 | system_character_t * const argument_values[], 59 | const system_character_t *options_string ); 60 | 61 | #endif /* defined( HAVE_GETOPT ) */ 62 | 63 | #if defined( __cplusplus ) 64 | } 65 | #endif 66 | 67 | #endif /* !defined( _VHDI_TEST_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /vhditools/vhditools_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDITOOLS_GETOPT_H ) 23 | #define _VHDITOOLS_GETOPT_H 24 | 25 | #include 26 | #include 27 | 28 | /* unistd.h is included here to export getopt, optarg, optind and optopt 29 | */ 30 | #if defined( HAVE_UNISTD_H ) 31 | #include 32 | #endif 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | #if defined( HAVE_GETOPT ) 39 | #define vhditools_getopt( argument_count, argument_values, options_string ) \ 40 | getopt( argument_count, argument_values, options_string ) 41 | 42 | #else 43 | 44 | #if !defined( __CYGWIN__ ) 45 | extern int optind; 46 | extern system_character_t *optarg; 47 | extern system_integer_t optopt; 48 | 49 | #else 50 | int optind; 51 | system_character_t *optarg; 52 | system_integer_t optopt; 53 | 54 | #endif /* !defined( __CYGWIN__ ) */ 55 | 56 | system_integer_t vhditools_getopt( 57 | int argument_count, 58 | system_character_t * const argument_values[], 59 | const system_character_t *options_string ); 60 | 61 | #endif /* defined( HAVE_GETOPT ) */ 62 | 63 | #if defined( __cplusplus ) 64 | } 65 | #endif 66 | 67 | #endif /* !defined( _VHDITOOLS_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_region_type_identifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Region type identifier functions 3 | * 4 | * Copyright (C) 2010-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_REGION_TYPE_IDENTIFIER_H ) 23 | #define _LIBVHDI_REGION_TYPE_IDENTIFIER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_extern.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | /* The region type identifier is stored as a little endian GUID 35 | */ 36 | typedef struct libvhdi_region_type_identifier_definition libvhdi_region_type_identifier_definition_t; 37 | 38 | struct libvhdi_region_type_identifier_definition 39 | { 40 | /* The identifier 41 | */ 42 | uint8_t *identifier; 43 | 44 | /* The description 45 | */ 46 | const char *description; 47 | }; 48 | 49 | LIBVHDI_EXTERN_VARIABLE \ 50 | uint8_t libvhdi_region_type_identifier_block_allocation_table[ 16 ]; 51 | 52 | LIBVHDI_EXTERN_VARIABLE \ 53 | uint8_t libvhdi_region_type_identifier_metadata_table[ 16 ]; 54 | 55 | #if defined( HAVE_DEBUG_OUTPUT ) 56 | 57 | const char *libvhdi_region_type_identifier_get_description( 58 | const uint8_t *region_type_identifier ); 59 | 60 | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ 61 | 62 | #if defined( __cplusplus ) 63 | } 64 | #endif 65 | 66 | #endif /* !defined( _LIBVHDI_REGION_TYPE_IDENTIFIER_H ) */ 67 | 68 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Python bindings module for libvhdi (pyvhdi) 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_H ) 23 | #define _PYVHDI_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvhdi_python.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | PyObject *pyvhdi_get_version( 35 | PyObject *self, 36 | PyObject *arguments ); 37 | 38 | PyObject *pyvhdi_check_file_signature( 39 | PyObject *self, 40 | PyObject *arguments, 41 | PyObject *keywords ); 42 | 43 | PyObject *pyvhdi_check_file_signature_file_object( 44 | PyObject *self, 45 | PyObject *arguments, 46 | PyObject *keywords ); 47 | 48 | PyObject *pyvhdi_open_new_file( 49 | PyObject *self, 50 | PyObject *arguments, 51 | PyObject *keywords ); 52 | 53 | PyObject *pyvhdi_open_new_file_with_file_object( 54 | PyObject *self, 55 | PyObject *arguments, 56 | PyObject *keywords ); 57 | 58 | #if PY_MAJOR_VERSION >= 3 59 | PyMODINIT_FUNC PyInit_pyvhdi( 60 | void ); 61 | #else 62 | PyMODINIT_FUNC initpyvhdi( 63 | void ); 64 | #endif 65 | 66 | #if defined( __cplusplus ) 67 | } 68 | #endif 69 | 70 | #endif /* !defined( _PYVHDI_H ) */ 71 | 72 | -------------------------------------------------------------------------------- /libvhdi/libvhdi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library to access the Virtual Hard Disk (VHD) image format 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | 24 | #if defined( WINAPI ) 25 | #include 26 | #endif 27 | 28 | #include "libvhdi_unused.h" 29 | 30 | /* Define HAVE_LOCAL_LIBVHDI for local use of libvhdi 31 | */ 32 | #if !defined( HAVE_LOCAL_LIBVHDI ) 33 | 34 | #if defined( WINAPI ) && defined( HAVE_DLLMAIN ) 35 | 36 | #if defined( _MANAGED ) 37 | #pragma managed( push, off ) 38 | #endif 39 | 40 | /* Defines the entry point for the DLL 41 | */ 42 | BOOL WINAPI DllMain( 43 | HINSTANCE hinstDLL, 44 | DWORD fdwReason, 45 | LPVOID lpvReserved ) 46 | { 47 | LIBVHDI_UNREFERENCED_PARAMETER( lpvReserved ) 48 | 49 | switch( fdwReason ) 50 | { 51 | case DLL_PROCESS_ATTACH: 52 | DisableThreadLibraryCalls( 53 | hinstDLL ); 54 | break; 55 | 56 | case DLL_THREAD_ATTACH: 57 | break; 58 | 59 | case DLL_THREAD_DETACH: 60 | break; 61 | 62 | case DLL_PROCESS_DETACH: 63 | break; 64 | } 65 | return( TRUE ); 66 | } 67 | 68 | /* Function that indicates the library is a DLL 69 | * Returns 1 70 | */ 71 | int libvhdi_is_dll( 72 | void ) 73 | { 74 | return( 1 ); 75 | } 76 | 77 | #endif /* defined( WINAPI ) && defined( HAVE_DLLMAIN ) */ 78 | 79 | #endif /* !defined( HAVE_LOCAL_LIBVHDI ) */ 80 | 81 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_metadata_table_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Metadata table entry functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_METADATA_TABLE_ENTRY_H ) 23 | #define _LIBVHDI_METADATA_TABLE_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvhdi_metadata_table_entry libvhdi_metadata_table_entry_t; 35 | 36 | struct libvhdi_metadata_table_entry 37 | { 38 | /* The item identifier 39 | */ 40 | uint8_t item_identifier[ 16 ]; 41 | 42 | /* The item offset 43 | */ 44 | uint32_t item_offset; 45 | 46 | /* The item size 47 | */ 48 | uint32_t item_size; 49 | }; 50 | 51 | int libvhdi_metadata_table_entry_initialize( 52 | libvhdi_metadata_table_entry_t **metadata_table_entry, 53 | libcerror_error_t **error ); 54 | 55 | int libvhdi_metadata_table_entry_free( 56 | libvhdi_metadata_table_entry_t **metadata_table_entry, 57 | libcerror_error_t **error ); 58 | 59 | int libvhdi_metadata_table_entry_read_data( 60 | libvhdi_metadata_table_entry_t *metadata_table_entry, 61 | const uint8_t *data, 62 | size_t data_size, 63 | libcerror_error_t **error ); 64 | 65 | #if defined( __cplusplus ) 66 | } 67 | #endif 68 | 69 | #endif /* !defined( _LIBVHDI_METADATA_TABLE_ENTRY_H ) */ 70 | 71 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_libcthreads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcthreads header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_LIBCTHREADS_H ) 23 | #define _LIBVHDI_LIBCTHREADS_H 24 | 25 | #include 26 | 27 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBVHDI ) 28 | #define HAVE_LIBVHDI_MULTI_THREAD_SUPPORT 29 | #endif 30 | 31 | #if defined( HAVE_LIBVHDI_MULTI_THREAD_SUPPORT ) 32 | 33 | /* Define HAVE_LOCAL_LIBCTHREADS for local use of libcthreads 34 | */ 35 | #if defined( HAVE_LOCAL_LIBCTHREADS ) 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #else 49 | 50 | /* If libtool DLL support is enabled set LIBCTHREADS_DLL_IMPORT 51 | * before including libcthreads.h 52 | */ 53 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 54 | #define LIBCTHREADS_DLL_IMPORT 55 | #endif 56 | 57 | #include 58 | 59 | #endif /* defined( HAVE_LOCAL_LIBCTHREADS ) */ 60 | 61 | #endif /* defined( HAVE_LIBVHDI_MULTI_THREAD_SUPPORT ) */ 62 | 63 | #endif /* !defined( _LIBVHDI_LIBCTHREADS_H ) */ 64 | 65 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_region_table_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Region table entry functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_REGION_TABLE_ENTRY_H ) 23 | #define _LIBVHDI_REGION_TABLE_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvhdi_region_table_entry libvhdi_region_table_entry_t; 35 | 36 | struct libvhdi_region_table_entry 37 | { 38 | /* The type identifier 39 | */ 40 | uint8_t type_identifier[ 16 ]; 41 | 42 | /* The data offset 43 | */ 44 | uint64_t data_offset; 45 | 46 | /* The data size 47 | */ 48 | uint32_t data_size; 49 | 50 | /* The is required flag 51 | */ 52 | uint32_t is_required_flag; 53 | }; 54 | 55 | int libvhdi_region_table_entry_initialize( 56 | libvhdi_region_table_entry_t **region_table_entry, 57 | libcerror_error_t **error ); 58 | 59 | int libvhdi_region_table_entry_free( 60 | libvhdi_region_table_entry_t **region_table_entry, 61 | libcerror_error_t **error ); 62 | 63 | int libvhdi_region_table_entry_read_data( 64 | libvhdi_region_table_entry_t *region_table_entry, 65 | const uint8_t *data, 66 | size_t data_size, 67 | libcerror_error_t **error ); 68 | 69 | #if defined( __cplusplus ) 70 | } 71 | #endif 72 | 73 | #endif /* !defined( _LIBVHDI_REGION_TABLE_ENTRY_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_file_information.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File information functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_FILE_INFORMATION_H ) 23 | #define _LIBVHDI_FILE_INFORMATION_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libbfio.h" 29 | #include "libvhdi_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct libvhdi_file_information libvhdi_file_information_t; 36 | 37 | struct libvhdi_file_information 38 | { 39 | /* The creator 40 | */ 41 | uint8_t creator[ 512 ]; 42 | }; 43 | 44 | int libvhdi_file_information_initialize( 45 | libvhdi_file_information_t **file_information, 46 | libcerror_error_t **error ); 47 | 48 | int libvhdi_file_information_free( 49 | libvhdi_file_information_t **file_information, 50 | libcerror_error_t **error ); 51 | 52 | int libvhdi_file_information_read_data( 53 | libvhdi_file_information_t *file_information, 54 | const uint8_t *data, 55 | size_t data_size, 56 | libcerror_error_t **error ); 57 | 58 | int libvhdi_file_information_read_file_io_handle( 59 | libvhdi_file_information_t *file_information, 60 | libbfio_handle_t *file_io_handle, 61 | off64_t file_offset, 62 | libcerror_error_t **error ); 63 | 64 | #if defined( __cplusplus ) 65 | } 66 | #endif 67 | 68 | #endif /* !defined( _LIBVHDI_FILE_INFORMATION_H ) */ 69 | 70 | -------------------------------------------------------------------------------- /vhditools/info_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Info handle 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _INFO_HANDLE_H ) 23 | #define _INFO_HANDLE_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "vhditools_libcerror.h" 30 | #include "vhditools_libcnotify.h" 31 | #include "vhditools_libvhdi.h" 32 | 33 | #if defined( __cplusplus ) 34 | extern "C" { 35 | #endif 36 | 37 | typedef struct info_handle info_handle_t; 38 | 39 | struct info_handle 40 | { 41 | /* The input 42 | */ 43 | libvhdi_file_t *input; 44 | 45 | /* The notification output stream 46 | */ 47 | FILE *notify_stream; 48 | }; 49 | 50 | int info_handle_initialize( 51 | info_handle_t **info_handle, 52 | libcerror_error_t **error ); 53 | 54 | int info_handle_free( 55 | info_handle_t **info_handle, 56 | libcerror_error_t **error ); 57 | 58 | int info_handle_signal_abort( 59 | info_handle_t *info_handle, 60 | libcerror_error_t **error ); 61 | 62 | int info_handle_open_input( 63 | info_handle_t *info_handle, 64 | const system_character_t *filename, 65 | libcerror_error_t **error ); 66 | 67 | int info_handle_close( 68 | info_handle_t *info_handle, 69 | libcerror_error_t **error ); 70 | 71 | int info_handle_input_fprint( 72 | info_handle_t *info_handle, 73 | libcerror_error_t **error ); 74 | 75 | #if defined( __cplusplus ) 76 | } 77 | #endif 78 | 79 | #endif /* !defined( _INFO_HANDLE_H ) */ 80 | 81 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Debug functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_DEBUG_H ) 23 | #define _LIBVHDI_DEBUG_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libbfio.h" 29 | #include "libvhdi_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | #if defined( HAVE_DEBUG_OUTPUT ) 36 | 37 | void libvhdi_debug_print_feature_flags( 38 | uint32_t feature_flags ); 39 | 40 | const char *libvhdi_debug_print_disk_type( 41 | uint32_t disk_type ); 42 | 43 | const char *libvhdi_debug_print_block_state( 44 | uint8_t block_state ); 45 | 46 | int libvhdi_debug_print_guid_value( 47 | const char *function_name, 48 | const char *value_name, 49 | const uint8_t *byte_stream, 50 | size_t byte_stream_size, 51 | int byte_order, 52 | uint32_t string_format_flags, 53 | libcerror_error_t **error ); 54 | 55 | int libvhdi_debug_print_utf16_string_value( 56 | const char *function_name, 57 | const char *value_name, 58 | const uint8_t *byte_stream, 59 | size_t byte_stream_size, 60 | int byte_order, 61 | libcerror_error_t **error ); 62 | 63 | int libvhdi_debug_print_read_offsets( 64 | libbfio_handle_t *file_io_handle, 65 | libcerror_error_t **error ); 66 | 67 | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ 68 | 69 | #if defined( __cplusplus ) 70 | } 71 | #endif 72 | 73 | #endif /* !defined( _LIBVHDI_DEBUG_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /libvhdi/vhdi_parent_locator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The parent locator definitions of a Virtual Hard Disk version 2 (VHDX) file 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_PARENT_LOCATOR_H ) 23 | #define _VHDI_PARENT_LOCATOR_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vhdi_parent_locator_header vhdi_parent_locator_header_t; 33 | 34 | struct vhdi_parent_locator_header 35 | { 36 | /* The type identifier 37 | * Consists of 16 bytes 38 | * Contains a GUID 39 | */ 40 | uint8_t type_identifier[ 16 ]; 41 | 42 | /* Unknown (reserved) 43 | * Consists of 2 bytes 44 | */ 45 | uint8_t unknown1[ 2 ]; 46 | 47 | /* The number of entries 48 | * Consists of 2 bytes 49 | */ 50 | uint8_t number_of_entries[ 2 ]; 51 | }; 52 | 53 | typedef struct vhdi_parent_locator_entry vhdi_parent_locator_entry_t; 54 | 55 | struct vhdi_parent_locator_entry 56 | { 57 | /* The key data offset 58 | * Consists of 4 bytes 59 | */ 60 | uint8_t key_data_offset[ 4 ]; 61 | 62 | /* The value data offset 63 | * Consists of 4 bytes 64 | */ 65 | uint8_t value_data_offset[ 4 ]; 66 | 67 | /* The key data size 68 | * Consists of 2 bytes 69 | */ 70 | uint8_t key_data_size[ 2 ]; 71 | 72 | /* The value data size 73 | * Consists of 2 bytes 74 | */ 75 | uint8_t value_data_size[ 2 ]; 76 | }; 77 | 78 | #if defined( __cplusplus ) 79 | } 80 | #endif 81 | 82 | #endif /* !defined( _VHDI_PARENT_LOCATOR_H ) */ 83 | 84 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_io_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Input/Output (IO) handle functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_IO_HANDLE_H ) 23 | #define _LIBVHDI_IO_HANDLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvhdi_io_handle libvhdi_io_handle_t; 35 | 36 | struct libvhdi_io_handle 37 | { 38 | /* The file type 39 | */ 40 | int file_type; 41 | 42 | /* The disk type 43 | */ 44 | uint32_t disk_type; 45 | 46 | /* The (storage) media size 47 | */ 48 | size64_t media_size; 49 | 50 | /* The (logical) number of bytes per sector 51 | */ 52 | uint32_t bytes_per_sector; 53 | 54 | /* The block size 55 | */ 56 | uint32_t block_size; 57 | 58 | /* Value to indicate if abort was signalled 59 | */ 60 | int abort; 61 | }; 62 | 63 | int libvhdi_io_handle_initialize( 64 | libvhdi_io_handle_t **io_handle, 65 | libcerror_error_t **error ); 66 | 67 | int libvhdi_io_handle_free( 68 | libvhdi_io_handle_t **io_handle, 69 | libcerror_error_t **error ); 70 | 71 | int libvhdi_io_handle_clear( 72 | libvhdi_io_handle_t *io_handle, 73 | libcerror_error_t **error ); 74 | 75 | int libvhdi_io_handle_get_disk_type( 76 | libvhdi_io_handle_t *io_handle, 77 | uint32_t *disk_type, 78 | libcerror_error_t **error ); 79 | 80 | #if defined( __cplusplus ) 81 | } 82 | #endif 83 | 84 | #endif /* !defined( _LIBVHDI_IO_HANDLE_H ) */ 85 | 86 | -------------------------------------------------------------------------------- /dpkg/control: -------------------------------------------------------------------------------- 1 | Source: libvhdi 2 | Priority: extra 3 | Maintainer: Joachim Metz 4 | Build-Depends: debhelper (>= 9), dh-autoreconf, dh-python, pkg-config, python3-dev, python3-setuptools, libfuse-dev 5 | Standards-Version: 4.1.4 6 | Section: libs 7 | Homepage: https://github.com/libyal/libvhdi 8 | Vcs-Git: https://github.com/libyal/libvhdi.git 9 | 10 | Package: libvhdi 11 | Architecture: any 12 | Depends: ${shlibs:Depends}, ${misc:Depends} 13 | Conflicts: libvhdi1 14 | Replaces: libvhdi1 15 | Suggests: libvhdi-dbg 16 | Description: Library to access the Virtual Hard Disk (VHD) image format 17 | libvhdi is a library to access the Virtual Hard Disk (VHD) image format. 18 | 19 | Package: libvhdi-dbg 20 | Architecture: any 21 | Section: debug 22 | Depends: libvhdi (= ${binary:Version}), ${misc:Depends} 23 | Description: Debugging symbols for libvhdi 24 | Debugging symbols for libvhdi. 25 | 26 | Package: libvhdi-dev 27 | Section: libdevel 28 | Architecture: any 29 | Depends: libvhdi (= ${binary:Version}), ${misc:Depends} 30 | Description: Header files and libraries for developing applications for libvhdi 31 | Header files and libraries for developing applications for libvhdi. 32 | 33 | Package: libvhdi-tools 34 | Section: utils 35 | Architecture: any 36 | Depends: libvhdi (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} 37 | Conflicts: libvhdi-utils 38 | Replaces: libvhdi-utils 39 | Description: Several tools for reading Virtual Hard Disk (VHD) image files 40 | Several tools for reading Virtual Hard Disk (VHD) image files. 41 | 42 | Package: libvhdi-tools-dbg 43 | Section: debug 44 | Architecture: any 45 | Depends: libvhdi-tools (= ${binary:Version}), ${misc:Depends} 46 | Description: Debugging symbols for libvhdi-tools 47 | Debugging symbols for libvhdi-tools. 48 | 49 | Package: libvhdi-python3 50 | Section: python 51 | Architecture: any 52 | Depends: libvhdi (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} 53 | Conflicts: python3-libvhdi 54 | Replaces: python3-libvhdi 55 | Suggests: libvhdi-python3-dbg 56 | Description: Python 3 bindings for libvhdi 57 | Python 3 bindings for libvhdi. 58 | 59 | Package: libvhdi-python3-dbg 60 | Section: debug 61 | Architecture: any 62 | Depends: libvhdi-python3 (= ${binary:Version}), ${misc:Depends} 63 | Description: Debugging symbols for libvhdi-python3 64 | Debugging symbols for libvhdi-python3. 65 | 66 | -------------------------------------------------------------------------------- /libvhdi/vhdi_region_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The region table definitions of a Virtual Hard Disk version 2 (VHDX) file 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_REGION_TABLE_H ) 23 | #define _VHDI_REGION_TABLE_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vhdi_region_table_header vhdi_region_table_header_t; 33 | 34 | struct vhdi_region_table_header 35 | { 36 | /* The signature 37 | * Consists of 4 bytes 38 | * Consists of: regi 39 | */ 40 | uint8_t signature[ 4 ]; 41 | 42 | /* The checksum 43 | * Consists of 4 bytes 44 | */ 45 | uint8_t checksum[ 4 ]; 46 | 47 | /* The number of entries 48 | * Consists of 4 bytes 49 | */ 50 | uint8_t number_of_entries[ 4 ]; 51 | 52 | /* Unknown (reserved) 53 | * Consists of 4 bytes 54 | */ 55 | uint8_t unknown1[ 4 ]; 56 | }; 57 | 58 | typedef struct vhdi_region_table_entry vhdi_region_table_entry_t; 59 | 60 | struct vhdi_region_table_entry 61 | { 62 | /* The type identifier 63 | * Consists of 16 bytes 64 | * Contains a GUID 65 | */ 66 | uint8_t type_identifier[ 16 ]; 67 | 68 | /* The data offset 69 | * Consists of 8 bytes 70 | */ 71 | uint8_t data_offset[ 8 ]; 72 | 73 | /* The data size 74 | * Consists of 4 bytes 75 | */ 76 | uint8_t data_size[ 4 ]; 77 | 78 | /* The is required flag 79 | * Consists of 4 bytes 80 | */ 81 | uint8_t is_required_flag[ 4 ]; 82 | }; 83 | 84 | #if defined( __cplusplus ) 85 | } 86 | #endif 87 | 88 | #endif /* !defined( _VHDI_REGION_TABLE_H ) */ 89 | 90 | -------------------------------------------------------------------------------- /msvscpp/Makefile.am: -------------------------------------------------------------------------------- 1 | MSVSCPP_FILES = \ 2 | libbfio/libbfio.vcproj \ 3 | libcdata/libcdata.vcproj \ 4 | libcerror/libcerror.vcproj \ 5 | libcfile/libcfile.vcproj \ 6 | libclocale/libclocale.vcproj \ 7 | libcnotify/libcnotify.vcproj \ 8 | libcpath/libcpath.vcproj \ 9 | libcsplit/libcsplit.vcproj \ 10 | libcthreads/libcthreads.vcproj \ 11 | libfcache/libfcache.vcproj \ 12 | libfdata/libfdata.vcproj \ 13 | libfguid/libfguid.vcproj \ 14 | libuna/libuna.vcproj \ 15 | libvhdi/libvhdi.vcproj \ 16 | pyvhdi/pyvhdi.vcproj \ 17 | vhdi_test_block_allocation_table/vhdi_test_block_allocation_table.vcproj \ 18 | vhdi_test_block_descriptor/vhdi_test_block_descriptor.vcproj \ 19 | vhdi_test_checksum/vhdi_test_checksum.vcproj \ 20 | vhdi_test_dynamic_disk_header/vhdi_test_dynamic_disk_header.vcproj \ 21 | vhdi_test_error/vhdi_test_error.vcproj \ 22 | vhdi_test_file/vhdi_test_file.vcproj \ 23 | vhdi_test_file_footer/vhdi_test_file_footer.vcproj \ 24 | vhdi_test_file_information/vhdi_test_file_information.vcproj \ 25 | vhdi_test_image_header/vhdi_test_image_header.vcproj \ 26 | vhdi_test_io_handle/vhdi_test_io_handle.vcproj \ 27 | vhdi_test_metadata_table/vhdi_test_metadata_table.vcproj \ 28 | vhdi_test_metadata_table_entry/vhdi_test_metadata_table_entry.vcproj \ 29 | vhdi_test_metadata_table_header/vhdi_test_metadata_table_header.vcproj \ 30 | vhdi_test_metadata_values/vhdi_test_metadata_values.vcproj \ 31 | vhdi_test_notify/vhdi_test_notify.vcproj \ 32 | vhdi_test_parent_locator/vhdi_test_parent_locator.vcproj \ 33 | vhdi_test_parent_locator_entry/vhdi_test_parent_locator_entry.vcproj \ 34 | vhdi_test_parent_locator_header/vhdi_test_parent_locator_header.vcproj \ 35 | vhdi_test_region_table/vhdi_test_region_table.vcproj \ 36 | vhdi_test_region_table_entry/vhdi_test_region_table_entry.vcproj \ 37 | vhdi_test_region_table_header/vhdi_test_region_table_header.vcproj \ 38 | vhdi_test_sector_range_descriptor/vhdi_test_sector_range_descriptor.vcproj \ 39 | vhdi_test_support/vhdi_test_support.vcproj \ 40 | vhdi_test_tools_info_handle/vhdi_test_tools_info_handle.vcproj \ 41 | vhdi_test_tools_output/vhdi_test_tools_output.vcproj \ 42 | vhdi_test_tools_signal/vhdi_test_tools_signal.vcproj \ 43 | vhdiinfo/vhdiinfo.vcproj \ 44 | vhdimount/vhdimount.vcproj \ 45 | libvhdi.sln 46 | 47 | EXTRA_DIST = \ 48 | $(MSVSCPP_FILES) 49 | 50 | DISTCLEANFILES = \ 51 | Makefile \ 52 | Makefile.in 53 | 54 | -------------------------------------------------------------------------------- /pyvhdi/pyvhdi_python.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The python header wrapper 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _PYVHDI_PYTHON_H ) 23 | #define _PYVHDI_PYTHON_H 24 | 25 | #include 26 | 27 | #if PY_MAJOR_VERSION < 3 28 | 29 | /* Fix defines in pyconfig.h 30 | */ 31 | #undef _POSIX_C_SOURCE 32 | #undef _XOPEN_SOURCE 33 | 34 | /* Fix defines in pyport.h 35 | */ 36 | #undef HAVE_FSTAT 37 | #undef HAVE_STAT 38 | #undef HAVE_SSIZE_T 39 | #undef HAVE_INT32_T 40 | #undef HAVE_UINT32_T 41 | #undef HAVE_INT64_T 42 | #undef HAVE_UINT64_T 43 | 44 | #endif /* PY_MAJOR_VERSION < 3 */ 45 | 46 | /* Define PY_SSIZE_T_CLEAN to silence: 47 | * DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats 48 | * 49 | * PY_SSIZE_T_CLEAN was introduced in Python 2.5 50 | */ 51 | #define PY_SSIZE_T_CLEAN 52 | 53 | #include 54 | 55 | /* Python compatibility macros 56 | */ 57 | #if !defined( PyMODINIT_FUNC ) 58 | #if PY_MAJOR_VERSION >= 3 59 | #define PyMODINIT_FUNC PyObject * 60 | #else 61 | #define PyMODINIT_FUNC void 62 | #endif 63 | #endif /* !defined( PyMODINIT_FUNC ) */ 64 | 65 | #if !defined( PyVarObject_HEAD_INIT ) 66 | #define PyVarObject_HEAD_INIT( type, size ) \ 67 | PyObject_HEAD_INIT( type ) \ 68 | size, 69 | 70 | #endif /* !defined( PyVarObject_HEAD_INIT ) */ 71 | 72 | #if PY_MAJOR_VERSION >= 3 73 | #define Py_TPFLAGS_HAVE_ITER 0 74 | #endif 75 | 76 | #if !defined( Py_TYPE ) 77 | #define Py_TYPE( object ) \ 78 | ( ( (PyObject *) object )->ob_type ) 79 | 80 | #endif /* !defined( Py_TYPE ) */ 81 | 82 | #endif /* !defined( _PYVHDI_PYTHON_H ) */ 83 | 84 | -------------------------------------------------------------------------------- /libvhdi/vhdi_metadata_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The metadata table definitions of a Virtual Hard Disk version 2 (VHDX) file 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_METADATA_TABLE_H ) 23 | #define _VHDI_METADATA_TABLE_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vhdi_metadata_table_header vhdi_metadata_table_header_t; 33 | 34 | struct vhdi_metadata_table_header 35 | { 36 | /* The signature 37 | * Consists of 8 bytes 38 | * Consists of: metadata 39 | */ 40 | uint8_t signature[ 8 ]; 41 | 42 | /* Unknown (reserved) 43 | * Consists of 2 bytes 44 | */ 45 | uint8_t unknown1[ 2 ]; 46 | 47 | /* The number of entries 48 | * Consists of 2 bytes 49 | */ 50 | uint8_t number_of_entries[ 2 ]; 51 | 52 | /* Unknown (reserved) 53 | * Consists of 20 bytes 54 | */ 55 | uint8_t unknown2[ 20 ]; 56 | }; 57 | 58 | typedef struct vhdi_metadata_table_entry vhdi_metadata_table_entry_t; 59 | 60 | struct vhdi_metadata_table_entry 61 | { 62 | /* The item identifier 63 | * Consists of 16 bytes 64 | * Contains a GUID 65 | */ 66 | uint8_t item_identifier[ 16 ]; 67 | 68 | /* The item offset 69 | * Consists of 4 bytes 70 | */ 71 | uint8_t item_offset[ 4 ]; 72 | 73 | /* The item size 74 | * Consists of 4 bytes 75 | */ 76 | uint8_t item_size[ 4 ]; 77 | 78 | /* Unknown (reserved) 79 | * Consists of 8 bytes 80 | */ 81 | uint8_t unknown1[ 8 ]; 82 | }; 83 | 84 | #if defined( __cplusplus ) 85 | } 86 | #endif 87 | 88 | #endif /* !defined( _VHDI_METADATA_TABLE_H ) */ 89 | 90 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_region_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Region table functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_REGION_TABLE_H ) 23 | #define _LIBVHDI_REGION_TABLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libbfio.h" 29 | #include "libvhdi_libcdata.h" 30 | #include "libvhdi_libcerror.h" 31 | #include "libvhdi_region_table_entry.h" 32 | #include "libvhdi_region_table_header.h" 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | typedef struct libvhdi_region_table libvhdi_region_table_t; 39 | 40 | struct libvhdi_region_table 41 | { 42 | /* The header 43 | */ 44 | libvhdi_region_table_header_t *header; 45 | 46 | /* The entries array 47 | */ 48 | libcdata_array_t *entries_array; 49 | }; 50 | 51 | int libvhdi_region_table_initialize( 52 | libvhdi_region_table_t **region_table, 53 | libcerror_error_t **error ); 54 | 55 | int libvhdi_region_table_free( 56 | libvhdi_region_table_t **region_table, 57 | libcerror_error_t **error ); 58 | 59 | int libvhdi_region_table_read_file_io_handle( 60 | libvhdi_region_table_t *region_table, 61 | libbfio_handle_t *file_io_handle, 62 | off64_t file_offset, 63 | libcerror_error_t **error ); 64 | 65 | int libvhdi_region_table_get_entry_by_type_identifier( 66 | libvhdi_region_table_t *region_table, 67 | const uint8_t *region_type_identifier, 68 | libvhdi_region_table_entry_t **entry, 69 | libcerror_error_t **error ); 70 | 71 | #if defined( __cplusplus ) 72 | } 73 | #endif 74 | 75 | #endif /* !defined( _LIBVHDI_REGION_TABLE_H ) */ 76 | 77 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_parent_locator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Parent locator functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_PARENT_LOCATOR_H ) 23 | #define _LIBVHDI_PARENT_LOCATOR_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libcdata.h" 29 | #include "libvhdi_libcerror.h" 30 | #include "libvhdi_parent_locator_entry.h" 31 | #include "libvhdi_parent_locator_header.h" 32 | 33 | #if defined( __cplusplus ) 34 | extern "C" { 35 | #endif 36 | 37 | typedef struct libvhdi_parent_locator libvhdi_parent_locator_t; 38 | 39 | struct libvhdi_parent_locator 40 | { 41 | /* The header 42 | */ 43 | libvhdi_parent_locator_header_t *header; 44 | 45 | /* The entries array 46 | */ 47 | libcdata_array_t *entries_array; 48 | }; 49 | 50 | int libvhdi_parent_locator_initialize( 51 | libvhdi_parent_locator_t **parent_locator, 52 | libcerror_error_t **error ); 53 | 54 | int libvhdi_parent_locator_free( 55 | libvhdi_parent_locator_t **parent_locator, 56 | libcerror_error_t **error ); 57 | 58 | int libvhdi_parent_locator_read_data( 59 | libvhdi_parent_locator_t *parent_locator, 60 | const uint8_t *data, 61 | size_t data_size, 62 | libcerror_error_t **error ); 63 | 64 | int libvhdi_parent_locator_get_entry_by_utf8_key( 65 | libvhdi_parent_locator_t *parent_locator, 66 | const uint8_t *utf8_string, 67 | size_t utf8_string_length, 68 | libvhdi_parent_locator_entry_t **entry, 69 | libcerror_error_t **error ); 70 | 71 | #if defined( __cplusplus ) 72 | } 73 | #endif 74 | 75 | #endif /* !defined( _LIBVHDI_PARENT_LOCATOR_H ) */ 76 | 77 | -------------------------------------------------------------------------------- /include/libvhdi/definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for libvhdi 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_DEFINITIONS_H ) 23 | #define _LIBVHDI_DEFINITIONS_H 24 | 25 | #include 26 | 27 | #define LIBVHDI_VERSION @VERSION@ 28 | 29 | /* The version string 30 | */ 31 | #define LIBVHDI_VERSION_STRING "@VERSION@" 32 | 33 | /* The access flags definitions 34 | * bit 1 set to 1 for read access 35 | * bit 2 set to 1 for write access 36 | * bit 3-8 not used 37 | */ 38 | enum LIBVHDI_ACCESS_FLAGS 39 | { 40 | LIBVHDI_ACCESS_FLAG_READ = 0x01, 41 | /* Reserved: not supported yet */ 42 | LIBVHDI_ACCESS_FLAG_WRITE = 0x02 43 | }; 44 | 45 | /* The file access macros 46 | */ 47 | #define LIBVHDI_OPEN_READ ( LIBVHDI_ACCESS_FLAG_READ ) 48 | /* Reserved: not supported yet */ 49 | #define LIBVHDI_OPEN_WRITE ( LIBVHDI_ACCESS_FLAG_WRITE ) 50 | /* Reserved: not supported yet */ 51 | #define LIBVHDI_OPEN_READ_WRITE ( LIBVHDI_ACCESS_FLAG_READ | LIBVHDI_ACCESS_FLAG_WRITE ) 52 | 53 | /* The file type definitions 54 | */ 55 | enum LIBVHDI_FILE_TYPES 56 | { 57 | LIBVHDI_FILE_TYPE_UNKNOWN = 0, 58 | /* Virtual Hard Disk version 1 (VHD) file */ 59 | LIBVHDI_FILE_TYPE_VHD = 1, 60 | /* Virtual Hard Disk version 2 (VHDX) file */ 61 | LIBVHDI_FILE_TYPE_VHDX = 2 62 | }; 63 | 64 | /* The Virtual Hard Disk version 1 (VHD) disk type definitions 65 | */ 66 | enum LIBVHDI_DISK_TYPES 67 | { 68 | LIBVHDI_DISK_TYPE_FIXED = 0x00000002UL, 69 | LIBVHDI_DISK_TYPE_DYNAMIC = 0x00000003UL, 70 | LIBVHDI_DISK_TYPE_DIFFERENTIAL = 0x00000004UL 71 | }; 72 | 73 | #endif /* !defined( _LIBVHDI_DEFINITIONS_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Support functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_SUPPORT_H ) 23 | #define _LIBVHDI_SUPPORT_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_extern.h" 29 | #include "libvhdi_libbfio.h" 30 | #include "libvhdi_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBVHDI ) 37 | 38 | LIBVHDI_EXTERN \ 39 | const char *libvhdi_get_version( 40 | void ); 41 | 42 | LIBVHDI_EXTERN \ 43 | int libvhdi_get_access_flags_read( 44 | void ); 45 | 46 | LIBVHDI_EXTERN \ 47 | int libvhdi_get_access_flags_read_write( 48 | void ); 49 | 50 | LIBVHDI_EXTERN \ 51 | int libvhdi_get_access_flags_write( 52 | void ); 53 | 54 | LIBVHDI_EXTERN \ 55 | int libvhdi_get_codepage( 56 | int *codepage, 57 | libcerror_error_t **error ); 58 | 59 | LIBVHDI_EXTERN \ 60 | int libvhdi_set_codepage( 61 | int codepage, 62 | libcerror_error_t **error ); 63 | 64 | #endif /* !defined( HAVE_LOCAL_LIBVHDI ) */ 65 | 66 | LIBVHDI_EXTERN \ 67 | int libvhdi_check_file_signature( 68 | const char *filename, 69 | libcerror_error_t **error ); 70 | 71 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 72 | LIBVHDI_EXTERN \ 73 | int libvhdi_check_file_signature_wide( 74 | const wchar_t *filename, 75 | libcerror_error_t **error ); 76 | #endif 77 | 78 | LIBVHDI_EXTERN \ 79 | int libvhdi_check_file_signature_file_io_handle( 80 | libbfio_handle_t *file_io_handle, 81 | libcerror_error_t **error ); 82 | 83 | #if defined( __cplusplus ) 84 | } 85 | #endif 86 | 87 | #endif /* !defined( _LIBVHDI_SUPPORT_H ) */ 88 | 89 | -------------------------------------------------------------------------------- /tests/runtests.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Script to run Python test scripts. 4 | # 5 | # Version: 20231024 6 | 7 | import glob 8 | import os 9 | import sys 10 | import unittest 11 | 12 | 13 | test_profile = ".pyvhdi" 14 | input_glob = "*" 15 | option_sets = [] 16 | 17 | 18 | def ReadIgnoreList(test_profile): 19 | """Reads the test profile ignore file if it exists. 20 | 21 | Args: 22 | test_profile (str): test profile. 23 | 24 | Returns: 25 | set[str]: ignore list. 26 | """ 27 | ignore_file_path = os.path.join("tests", "input", test_profile, "ignore") 28 | if os.path.isfile(ignore_file_path): 29 | with open(ignore_file_path, "r", encoding="utf-8") as file_object: 30 | return set([line.strip() for line in file_object.readlines()]) 31 | 32 | return set() 33 | 34 | 35 | if __name__ == "__main__": 36 | print(f"Using Python version {sys.version!s}") 37 | 38 | test_loader = unittest.TestLoader() 39 | test_runner = unittest.TextTestRunner(verbosity=2) 40 | 41 | test_scripts = test_loader.discover("tests", pattern="*.py") 42 | 43 | ignore_list = ReadIgnoreList(test_profile) 44 | 45 | test_set = None 46 | source_file = None 47 | 48 | for test_set in glob.glob(os.path.join("tests", "input", "*")): 49 | test_set = test_set.rsplit(os.path.sep, maxsplit=1)[-1] 50 | if not test_set or test_set[0] == '.' or test_set in ignore_list: 51 | continue 52 | 53 | source_files = glob.glob(os.path.join( 54 | "tests", "input", test_set, input_glob)) 55 | if source_files: 56 | source_file = source_files[0] 57 | break 58 | 59 | setattr(unittest, "source", source_file) 60 | 61 | if source_file: 62 | for option_set in option_sets: 63 | test_file = os.path.basename(source_file) 64 | test_options_file_path = os.path.join( 65 | "tests", "input", test_profile, test_set, 66 | f"{test_file:s}.{option_set:s}") 67 | if os.path.isfile(test_options_file_path): 68 | with open(test_options_file_path, "r", encoding="utf-8") as file_object: 69 | lines = [line.strip() for line in file_object.readlines()] 70 | if lines[0] == "# libyal test data options": 71 | for line in lines[1:]: 72 | key, value = line.split("=", maxsplit=1) 73 | if key == 'offset': 74 | value = int(value) 75 | 76 | setattr(unittest, key, value) 77 | 78 | test_results = test_runner.run(test_scripts) 79 | if not test_results.wasSuccessful(): 80 | sys.exit(1) 81 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | SUBDIRS = \ 4 | include \ 5 | common \ 6 | libcerror \ 7 | libcthreads \ 8 | libcdata \ 9 | libclocale \ 10 | libcnotify \ 11 | libcsplit \ 12 | libuna \ 13 | libcfile \ 14 | libcpath \ 15 | libbfio \ 16 | libfcache \ 17 | libfdata \ 18 | libfguid \ 19 | libvhdi \ 20 | vhditools \ 21 | pyvhdi \ 22 | po \ 23 | manuals \ 24 | tests \ 25 | ossfuzz \ 26 | msvscpp 27 | 28 | DPKG_FILES = \ 29 | dpkg/changelog \ 30 | dpkg/changelog.in \ 31 | dpkg/compat \ 32 | dpkg/control \ 33 | dpkg/copyright \ 34 | dpkg/rules \ 35 | dpkg/libvhdi.install \ 36 | dpkg/libvhdi-dev.install \ 37 | dpkg/libvhdi-python3.install \ 38 | dpkg/libvhdi-tools.install \ 39 | dpkg/source/format 40 | 41 | GETTEXT_FILES = \ 42 | config.rpath \ 43 | po/Makevars.in 44 | 45 | PKGCONFIG_FILES = \ 46 | libvhdi.pc.in 47 | 48 | SETUP_PY_FILES = \ 49 | pyproject.toml \ 50 | setup.cfg \ 51 | setup.cfg.in \ 52 | setup.py 53 | 54 | SPEC_FILES = \ 55 | libvhdi.spec \ 56 | libvhdi.spec.in 57 | 58 | EXTRA_DIST = \ 59 | $(DPKG_FILES) \ 60 | $(GETTEXT_FILES) \ 61 | $(PKGCONFIG_FILES) \ 62 | $(SETUP_PY_FILES) \ 63 | $(SPEC_FILES) 64 | 65 | DISTCLEANFILES = \ 66 | config.status \ 67 | config.cache \ 68 | config.log \ 69 | libvhdi.pc \ 70 | libvhdi.spec \ 71 | Makefile \ 72 | Makefile.in \ 73 | po/Makevars 74 | 75 | pkgconfigdir = $(libdir)/pkgconfig 76 | 77 | pkgconfig_DATA = \ 78 | libvhdi.pc 79 | 80 | libtool: 81 | @LIBTOOL_DEPS@ 82 | cd $(srcdir) && $(SHELL) ./config.status --recheck 83 | 84 | lib: library 85 | 86 | library: 87 | (cd $(srcdir)/common && $(MAKE) $(AM_MAKEFLAGS)) 88 | (cd $(srcdir)/libcerror && $(MAKE) $(AM_MAKEFLAGS)) 89 | (cd $(srcdir)/libcthreads && $(MAKE) $(AM_MAKEFLAGS)) 90 | (cd $(srcdir)/libcdata && $(MAKE) $(AM_MAKEFLAGS)) 91 | (cd $(srcdir)/libclocale && $(MAKE) $(AM_MAKEFLAGS)) 92 | (cd $(srcdir)/libcnotify && $(MAKE) $(AM_MAKEFLAGS)) 93 | (cd $(srcdir)/libcsplit && $(MAKE) $(AM_MAKEFLAGS)) 94 | (cd $(srcdir)/libuna && $(MAKE) $(AM_MAKEFLAGS)) 95 | (cd $(srcdir)/libcfile && $(MAKE) $(AM_MAKEFLAGS)) 96 | (cd $(srcdir)/libcpath && $(MAKE) $(AM_MAKEFLAGS)) 97 | (cd $(srcdir)/libbfio && $(MAKE) $(AM_MAKEFLAGS)) 98 | (cd $(srcdir)/libfcache && $(MAKE) $(AM_MAKEFLAGS)) 99 | (cd $(srcdir)/libfdata && $(MAKE) $(AM_MAKEFLAGS)) 100 | (cd $(srcdir)/libfguid && $(MAKE) $(AM_MAKEFLAGS)) 101 | (cd $(srcdir)/libvhdi && $(MAKE) $(AM_MAKEFLAGS)) 102 | (cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS)) 103 | 104 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_metadata_item_identifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Metadata item identifier functions 3 | * 4 | * Copyright (C) 2010-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_METADATA_ITEM_IDENTIFIER_H ) 23 | #define _LIBVHDI_METADATA_ITEM_IDENTIFIER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_extern.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | /* The metadata item identifier is stored as a little endian GUID 35 | */ 36 | typedef struct libvhdi_metadata_item_identifier_definition libvhdi_metadata_item_identifier_definition_t; 37 | 38 | struct libvhdi_metadata_item_identifier_definition 39 | { 40 | /* The identifier 41 | */ 42 | uint8_t *identifier; 43 | 44 | /* The description 45 | */ 46 | const char *description; 47 | }; 48 | 49 | LIBVHDI_EXTERN_VARIABLE \ 50 | uint8_t libvhdi_metadata_item_identifier_file_parameters[ 16 ]; 51 | 52 | LIBVHDI_EXTERN_VARIABLE \ 53 | uint8_t libvhdi_metadata_item_identifier_logical_sector_size[ 16 ]; 54 | 55 | LIBVHDI_EXTERN_VARIABLE \ 56 | uint8_t libvhdi_metadata_item_identifier_parent_locator[ 16 ]; 57 | 58 | LIBVHDI_EXTERN_VARIABLE \ 59 | uint8_t libvhdi_metadata_item_identifier_physical_sector_size[ 16 ]; 60 | 61 | LIBVHDI_EXTERN_VARIABLE \ 62 | uint8_t libvhdi_metadata_item_identifier_virtual_disk_identifier[ 16 ]; 63 | 64 | LIBVHDI_EXTERN_VARIABLE \ 65 | uint8_t libvhdi_metadata_item_identifier_virtual_disk_size[ 16 ]; 66 | 67 | #if defined( HAVE_DEBUG_OUTPUT ) 68 | 69 | const char *libvhdi_metadata_item_identifier_get_description( 70 | const uint8_t *metadata_item_identifier ); 71 | 72 | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ 73 | 74 | #if defined( __cplusplus ) 75 | } 76 | #endif 77 | 78 | #endif /* !defined( _LIBVHDI_METADATA_ITEM_IDENTIFIER_H ) */ 79 | 80 | -------------------------------------------------------------------------------- /libvhdi/libvhdi_metadata_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Metadata table functions 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBVHDI_METADATA_TABLE_H ) 23 | #define _LIBVHDI_METADATA_TABLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvhdi_libbfio.h" 29 | #include "libvhdi_libcdata.h" 30 | #include "libvhdi_libcerror.h" 31 | #include "libvhdi_metadata_table_entry.h" 32 | #include "libvhdi_metadata_table_header.h" 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | typedef struct libvhdi_metadata_table libvhdi_metadata_table_t; 39 | 40 | struct libvhdi_metadata_table 41 | { 42 | /* The header 43 | */ 44 | libvhdi_metadata_table_header_t *header; 45 | 46 | /* The entries array 47 | */ 48 | libcdata_array_t *entries_array; 49 | }; 50 | 51 | int libvhdi_metadata_table_initialize( 52 | libvhdi_metadata_table_t **metadata_table, 53 | libcerror_error_t **error ); 54 | 55 | int libvhdi_metadata_table_free( 56 | libvhdi_metadata_table_t **metadata_table, 57 | libcerror_error_t **error ); 58 | 59 | int libvhdi_metadata_table_read_file_io_handle( 60 | libvhdi_metadata_table_t *metadata_table, 61 | libbfio_handle_t *file_io_handle, 62 | off64_t file_offset, 63 | libcerror_error_t **error ); 64 | 65 | int libvhdi_metadata_table_get_number_of_entries( 66 | libvhdi_metadata_table_t *metadata_table, 67 | int *number_of_entries, 68 | libcerror_error_t **error ); 69 | 70 | int libvhdi_metadata_table_get_entry_by_index( 71 | libvhdi_metadata_table_t *metadata_table, 72 | int entry_index, 73 | libvhdi_metadata_table_entry_t **entry, 74 | libcerror_error_t **error ); 75 | 76 | #if defined( __cplusplus ) 77 | } 78 | #endif 79 | 80 | #endif /* !defined( _LIBVHDI_METADATA_TABLE_H ) */ 81 | 82 | -------------------------------------------------------------------------------- /vhditools/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I../include -I$(top_srcdir)/include \ 3 | -I../common -I$(top_srcdir)/common \ 4 | @LIBCERROR_CPPFLAGS@ \ 5 | @LIBCDATA_CPPFLAGS@ \ 6 | @LIBCLOCALE_CPPFLAGS@ \ 7 | @LIBCNOTIFY_CPPFLAGS@ \ 8 | @LIBCSPLIT_CPPFLAGS@ \ 9 | @LIBUNA_CPPFLAGS@ \ 10 | @LIBCFILE_CPPFLAGS@ \ 11 | @LIBCPATH_CPPFLAGS@ \ 12 | @LIBBFIO_CPPFLAGS@ \ 13 | @LIBFCACHE_CPPFLAGS@ \ 14 | @LIBFDATA_CPPFLAGS@ \ 15 | @LIBFGUID_CPPFLAGS@ \ 16 | @LIBFUSE_CPPFLAGS@ \ 17 | @LIBVHDI_DLL_IMPORT@ 18 | 19 | AM_LDFLAGS = @STATIC_LDFLAGS@ 20 | 21 | bin_PROGRAMS = \ 22 | vhdiinfo \ 23 | vhdimount 24 | 25 | vhdiinfo_SOURCES = \ 26 | byte_size_string.c byte_size_string.h \ 27 | info_handle.c info_handle.h \ 28 | vhdiinfo.c \ 29 | vhditools_getopt.c vhditools_getopt.h \ 30 | vhditools_i18n.h \ 31 | vhditools_libbfio.h \ 32 | vhditools_libcdata.h \ 33 | vhditools_libcerror.h \ 34 | vhditools_libclocale.h \ 35 | vhditools_libcnotify.h \ 36 | vhditools_libfguid.h \ 37 | vhditools_libvhdi.h \ 38 | vhditools_libuna.h \ 39 | vhditools_output.c vhditools_output.h \ 40 | vhditools_signal.c vhditools_signal.h \ 41 | vhditools_unused.h 42 | 43 | vhdiinfo_LDADD = \ 44 | @LIBFGUID_LIBADD@ \ 45 | @LIBCNOTIFY_LIBADD@ \ 46 | @LIBCLOCALE_LIBADD@ \ 47 | ../libvhdi/libvhdi.la \ 48 | @LIBCERROR_LIBADD@ \ 49 | @LIBINTL@ 50 | 51 | vhdimount_SOURCES = \ 52 | mount_dokan.c mount_dokan.h \ 53 | mount_file_entry.c mount_file_entry.h \ 54 | mount_file_system.c mount_file_system.h \ 55 | mount_fuse.c mount_fuse.h \ 56 | mount_handle.c mount_handle.h \ 57 | vhdimount.c \ 58 | vhditools_getopt.c vhditools_getopt.h \ 59 | vhditools_i18n.h \ 60 | vhditools_libbfio.h \ 61 | vhditools_libcdata.h \ 62 | vhditools_libcerror.h \ 63 | vhditools_libclocale.h \ 64 | vhditools_libcnotify.h \ 65 | vhditools_libcpath.h \ 66 | vhditools_libvhdi.h \ 67 | vhditools_libuna.h \ 68 | vhditools_output.c vhditools_output.h \ 69 | vhditools_signal.c vhditools_signal.h \ 70 | vhditools_unused.h 71 | 72 | vhdimount_LDADD = \ 73 | @LIBFUSE_LIBADD@ \ 74 | @LIBCPATH_LIBADD@ \ 75 | @LIBUNA_LIBADD@ \ 76 | @LIBCSPLIT_LIBADD@ \ 77 | @LIBCNOTIFY_LIBADD@ \ 78 | @LIBCLOCALE_LIBADD@ \ 79 | @LIBCDATA_LIBADD@ \ 80 | ../libvhdi/libvhdi.la \ 81 | @LIBCERROR_LIBADD@ \ 82 | @LIBINTL@ 83 | 84 | DISTCLEANFILES = \ 85 | Makefile \ 86 | Makefile.in 87 | 88 | splint-local: 89 | @echo "Running splint on vhdiinfo ..." 90 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(vhdiinfo_SOURCES) 91 | @echo "Running splint on vhdimount ..." 92 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(vhdimount_SOURCES) 93 | 94 | -------------------------------------------------------------------------------- /ossfuzz/file_fuzzer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * OSS-Fuzz target for libvhdi file type 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | /* Note that some of the OSS-Fuzz engines use C++ 26 | */ 27 | extern "C" { 28 | 29 | #include "ossfuzz_libbfio.h" 30 | #include "ossfuzz_libvhdi.h" 31 | 32 | #if !defined( LIBVHDI_HAVE_BFIO ) 33 | 34 | /* Opens a file using a Basic File IO (bfio) handle 35 | * Returns 1 if successful or -1 on error 36 | */ 37 | LIBVHDI_EXTERN \ 38 | int libvhdi_file_open_file_io_handle( 39 | libvhdi_file_t *file, 40 | libbfio_handle_t *file_io_handle, 41 | int access_flags, 42 | libvhdi_error_t **error ); 43 | 44 | #endif /* !defined( LIBVHDI_HAVE_BFIO ) */ 45 | 46 | int LLVMFuzzerTestOneInput( 47 | const uint8_t *data, 48 | size_t size ) 49 | { 50 | libbfio_handle_t *file_io_handle = NULL; 51 | libvhdi_file_t *file = NULL; 52 | 53 | if( libbfio_memory_range_initialize( 54 | &file_io_handle, 55 | NULL ) != 1 ) 56 | { 57 | return( 0 ); 58 | } 59 | if( libbfio_memory_range_set( 60 | file_io_handle, 61 | (uint8_t *) data, 62 | size, 63 | NULL ) != 1 ) 64 | { 65 | goto on_error_libbfio; 66 | } 67 | if( libvhdi_file_initialize( 68 | &file, 69 | NULL ) != 1 ) 70 | { 71 | goto on_error_libbfio; 72 | } 73 | if( libvhdi_file_open_file_io_handle( 74 | file, 75 | file_io_handle, 76 | LIBVHDI_OPEN_READ, 77 | NULL ) != 1 ) 78 | { 79 | goto on_error_libvhdi; 80 | } 81 | libvhdi_file_close( 82 | file, 83 | NULL ); 84 | 85 | on_error_libvhdi: 86 | libvhdi_file_free( 87 | &file, 88 | NULL ); 89 | 90 | on_error_libbfio: 91 | libbfio_handle_free( 92 | &file_io_handle, 93 | NULL ); 94 | 95 | return( 0 ); 96 | } 97 | 98 | } /* extern "C" */ 99 | 100 | -------------------------------------------------------------------------------- /libvhdi/vhdi_image_header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The image header definition of a Virtual Hard Disk version 2 (VHDX) file 3 | * 4 | * Copyright (C) 2012-2025, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _VHDI_IMAGE_HEADER_H ) 23 | #define _VHDI_IMAGE_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vhdi_image_header vhdi_image_header_t; 33 | 34 | struct vhdi_image_header 35 | { 36 | /* The signature 37 | * Consists of 4 bytes 38 | * Consists of: head 39 | */ 40 | uint8_t signature[ 4 ]; 41 | 42 | /* The checksum 43 | * Consists of 4 bytes 44 | */ 45 | uint8_t checksum[ 4 ]; 46 | 47 | /* The sequence number 48 | * Consists of 8 bytes 49 | */ 50 | uint8_t sequence_number[ 8 ]; 51 | 52 | /* The file write identifier 53 | * Consists of 16 bytes 54 | * Contains a GUID 55 | */ 56 | uint8_t file_write_identifier[ 16 ]; 57 | 58 | /* The data write identifier 59 | * Consists of 16 bytes 60 | * Contains a GUID 61 | */ 62 | uint8_t data_write_identifier[ 16 ]; 63 | 64 | /* The log identifier 65 | * Consists of 16 bytes 66 | * Contains a GUID 67 | */ 68 | uint8_t log_identifier[ 16 ]; 69 | 70 | /* The log (journal) format version 71 | * Consists of 2 bytes 72 | */ 73 | uint8_t log_format_version[ 2 ]; 74 | 75 | /* The format version 76 | * Consists of 2 bytes 77 | */ 78 | uint8_t format_version[ 2 ]; 79 | 80 | /* The log (journal) size 81 | * Consists of 4 bytes 82 | */ 83 | uint8_t log_size[ 4 ]; 84 | 85 | /* The log (journal) offset 86 | * Consists of 8 bytes 87 | */ 88 | uint8_t log_offset[ 8 ]; 89 | 90 | /* Unknown (reserved) 91 | * Consists of 4016 bytes 92 | */ 93 | uint8_t unknown1[ 4016 ]; 94 | }; 95 | 96 | #if defined( __cplusplus ) 97 | } 98 | #endif 99 | 100 | #endif /* !defined( _VHDI_IMAGE_HEADER_H ) */ 101 | 102 | --------------------------------------------------------------------------------