├── .codecov.yml ├── .github └── workflows │ ├── build.yml │ ├── build_freebsd.yml │ ├── build_ossfuzz.yml │ ├── build_shared.yml │ └── build_wheel.yml ├── .gitignore ├── AUTHORS ├── COPYING ├── COPYING.LESSER ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── acinclude.m4 ├── appveyor.yml ├── autogen.ps1 ├── autogen.sh ├── build.ps1 ├── common ├── Makefile.am ├── byte_stream.h ├── common.h ├── config_borlandc.h ├── config_msc.h ├── config_winapi.h ├── file_stream.h ├── memory.h ├── narrow_string.h ├── system_string.h ├── types.h.in └── wide_string.h ├── configure.ac ├── documentation └── GUID Partition Table (GPT) format.asciidoc ├── dpkg ├── changelog.in ├── compat ├── control ├── copyright ├── libvsgpt-dev.install ├── libvsgpt-python3.install ├── libvsgpt-tools.install ├── libvsgpt.install ├── rules └── source │ └── format ├── include ├── Makefile.am ├── libvsgpt.h.in └── libvsgpt │ ├── codepage.h │ ├── definitions.h.in │ ├── error.h │ ├── extern.h │ ├── features.h.in │ ├── types.h │ └── types.h.in ├── libvsgpt.ini ├── libvsgpt.pc.in ├── libvsgpt.spec.in ├── libvsgpt ├── Makefile.am ├── libvsgpt.c ├── libvsgpt.rc.in ├── libvsgpt_boot_record.c ├── libvsgpt_boot_record.h ├── libvsgpt_checksum.c ├── libvsgpt_checksum.h ├── libvsgpt_chs_address.c ├── libvsgpt_chs_address.h ├── libvsgpt_debug.c ├── libvsgpt_debug.h ├── libvsgpt_definitions.h.in ├── libvsgpt_error.c ├── libvsgpt_error.h ├── libvsgpt_extern.h ├── libvsgpt_io_handle.c ├── libvsgpt_io_handle.h ├── libvsgpt_libbfio.h ├── libvsgpt_libcdata.h ├── libvsgpt_libcerror.h ├── libvsgpt_libclocale.h ├── libvsgpt_libcnotify.h ├── libvsgpt_libcthreads.h ├── libvsgpt_libfcache.h ├── libvsgpt_libfdata.h ├── libvsgpt_libfguid.h ├── libvsgpt_libuna.h ├── libvsgpt_mbr_partition_entry.c ├── libvsgpt_mbr_partition_entry.h ├── libvsgpt_mbr_partition_type.c ├── libvsgpt_mbr_partition_type.h ├── libvsgpt_notify.c ├── libvsgpt_notify.h ├── libvsgpt_partition.c ├── libvsgpt_partition.h ├── libvsgpt_partition_entry.c ├── libvsgpt_partition_entry.h ├── libvsgpt_partition_table_header.c ├── libvsgpt_partition_table_header.h ├── libvsgpt_partition_type_identifier.c ├── libvsgpt_partition_type_identifier.h ├── libvsgpt_partition_values.c ├── libvsgpt_partition_values.h ├── libvsgpt_section_values.c ├── libvsgpt_section_values.h ├── libvsgpt_sector_data.c ├── libvsgpt_sector_data.h ├── libvsgpt_support.c ├── libvsgpt_support.h ├── libvsgpt_types.h ├── libvsgpt_unused.h ├── libvsgpt_volume.c ├── libvsgpt_volume.h ├── vsgpt_boot_record.h ├── vsgpt_mbr_partition_entry.h ├── vsgpt_partition_entry.h └── vsgpt_partition_table.h ├── m4 ├── common.m4 ├── libbfio.m4 ├── libcdata.m4 ├── libcerror.m4 ├── libcfile.m4 ├── libclocale.m4 ├── libcnotify.m4 ├── libcpath.m4 ├── libcsplit.m4 ├── libcthreads.m4 ├── libfcache.m4 ├── libfdata.m4 ├── libfguid.m4 ├── libuna.m4 ├── pthread.m4 ├── python.m4 ├── tests.m4 └── types.m4 ├── manuals ├── Makefile.am ├── libvsgpt.3 └── vsgptinfo.1 ├── msvscpp ├── Makefile.am ├── libbfio │ └── libbfio.vcproj ├── libcdata │ └── libcdata.vcproj ├── libcerror │ └── libcerror.vcproj ├── libcfile │ └── libcfile.vcproj ├── libclocale │ └── libclocale.vcproj ├── libcnotify │ └── libcnotify.vcproj ├── libcpath │ └── libcpath.vcproj ├── libcsplit │ └── libcsplit.vcproj ├── libcthreads │ └── libcthreads.vcproj ├── libfcache │ └── libfcache.vcproj ├── libfdata │ └── libfdata.vcproj ├── libfguid │ └── libfguid.vcproj ├── libuna │ └── libuna.vcproj ├── libvsgpt.sln ├── libvsgpt │ └── libvsgpt.vcproj ├── pyvsgpt │ └── pyvsgpt.vcproj ├── vsgpt_test_boot_record │ └── vsgpt_test_boot_record.vcproj ├── vsgpt_test_checksum │ └── vsgpt_test_checksum.vcproj ├── vsgpt_test_chs_address │ └── vsgpt_test_chs_address.vcproj ├── vsgpt_test_error │ └── vsgpt_test_error.vcproj ├── vsgpt_test_io_handle │ └── vsgpt_test_io_handle.vcproj ├── vsgpt_test_mbr_partition_entry │ └── vsgpt_test_mbr_partition_entry.vcproj ├── vsgpt_test_mbr_partition_type │ └── vsgpt_test_mbr_partition_type.vcproj ├── vsgpt_test_notify │ └── vsgpt_test_notify.vcproj ├── vsgpt_test_partition │ └── vsgpt_test_partition.vcproj ├── vsgpt_test_partition_entry │ └── vsgpt_test_partition_entry.vcproj ├── vsgpt_test_partition_table_header │ └── vsgpt_test_partition_table_header.vcproj ├── vsgpt_test_partition_type_identifier │ └── vsgpt_test_partition_type_identifier.vcproj ├── vsgpt_test_partition_values │ └── vsgpt_test_partition_values.vcproj ├── vsgpt_test_section_values │ └── vsgpt_test_section_values.vcproj ├── vsgpt_test_sector_data │ └── vsgpt_test_sector_data.vcproj ├── vsgpt_test_support │ └── vsgpt_test_support.vcproj ├── vsgpt_test_tools_info_handle │ └── vsgpt_test_tools_info_handle.vcproj ├── vsgpt_test_tools_output │ └── vsgpt_test_tools_output.vcproj ├── vsgpt_test_tools_signal │ └── vsgpt_test_tools_signal.vcproj ├── vsgpt_test_volume │ └── vsgpt_test_volume.vcproj └── vsgptinfo │ └── vsgptinfo.vcproj ├── ossfuzz ├── Makefile.am ├── ossfuzz_libbfio.h ├── ossfuzz_libvsgpt.h ├── partition_fuzzer.cc └── volume_fuzzer.cc ├── po ├── ChangeLog ├── Makevars.in └── POTFILES.in ├── pyproject.toml ├── pyvsgpt ├── Makefile.am ├── pyvsgpt.c ├── pyvsgpt.h ├── pyvsgpt_error.c ├── pyvsgpt_error.h ├── pyvsgpt_file_object_io_handle.c ├── pyvsgpt_file_object_io_handle.h ├── pyvsgpt_guid.c ├── pyvsgpt_guid.h ├── pyvsgpt_integer.c ├── pyvsgpt_integer.h ├── pyvsgpt_libbfio.h ├── pyvsgpt_libcerror.h ├── pyvsgpt_libclocale.h ├── pyvsgpt_libfguid.h ├── pyvsgpt_libvsgpt.h ├── pyvsgpt_partition.c ├── pyvsgpt_partition.h ├── pyvsgpt_partitions.c ├── pyvsgpt_partitions.h ├── pyvsgpt_python.h ├── pyvsgpt_unused.h ├── pyvsgpt_volume.c └── pyvsgpt_volume.h ├── runtests.ps1 ├── runtests.sh ├── setup.cfg.in ├── setup.py ├── synclibs.ps1 ├── synclibs.sh ├── synctestdata.ps1 ├── synctestdata.sh ├── tests ├── Makefile.am ├── build.sh ├── data │ ├── boot_record.1 │ ├── chs_address.1 │ ├── mbr_partition_entry.1 │ ├── partition_entry.1 │ └── partition_table_header.1 ├── lsan.suppressions ├── pkgbuild.sh ├── pyvsgpt_test_partition.py ├── pyvsgpt_test_support.py ├── pyvsgpt_test_volume.py ├── runtests.py ├── runtests.sh ├── syncsharedlibs.sh ├── test_library.ps1 ├── test_library.sh ├── test_manpage.sh ├── test_python_module.sh ├── test_runner.sh ├── test_tools.ps1 ├── test_tools.sh ├── test_vsgptinfo.ps1 ├── test_vsgptinfo.sh ├── vsgpt_test_boot_record.c ├── vsgpt_test_checksum.c ├── vsgpt_test_chs_address.c ├── vsgpt_test_error.c ├── vsgpt_test_functions.c ├── vsgpt_test_functions.h ├── vsgpt_test_getopt.c ├── vsgpt_test_getopt.h ├── vsgpt_test_io_handle.c ├── vsgpt_test_libbfio.h ├── vsgpt_test_libcerror.h ├── vsgpt_test_libclocale.h ├── vsgpt_test_libcnotify.h ├── vsgpt_test_libuna.h ├── vsgpt_test_libvsgpt.h ├── vsgpt_test_macros.h ├── vsgpt_test_mbr_partition_entry.c ├── vsgpt_test_mbr_partition_type.c ├── vsgpt_test_memory.c ├── vsgpt_test_memory.h ├── vsgpt_test_notify.c ├── vsgpt_test_partition.c ├── vsgpt_test_partition_entry.c ├── vsgpt_test_partition_table_header.c ├── vsgpt_test_partition_type_identifier.c ├── vsgpt_test_partition_values.c ├── vsgpt_test_rwlock.c ├── vsgpt_test_rwlock.h ├── vsgpt_test_section_values.c ├── vsgpt_test_sector_data.c ├── vsgpt_test_support.c ├── vsgpt_test_tools_info_handle.c ├── vsgpt_test_tools_output.c ├── vsgpt_test_tools_signal.c ├── vsgpt_test_unused.h └── vsgpt_test_volume.c ├── tox.ini └── vsgpttools ├── Makefile.am ├── info_handle.c ├── info_handle.h ├── vsgptinfo.c ├── vsgpttools_getopt.c ├── vsgpttools_getopt.h ├── vsgpttools_i18n.h ├── vsgpttools_libbfio.h ├── vsgpttools_libcerror.h ├── vsgpttools_libclocale.h ├── vsgpttools_libcnotify.h ├── vsgpttools_libfguid.h ├── vsgpttools_libuna.h ├── vsgpttools_libvsgpt.h ├── vsgpttools_output.c ├── vsgpttools_output.h ├── vsgpttools_signal.c ├── vsgpttools_signal.h └── vsgpttools_unused.h /.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 | -------------------------------------------------------------------------------- /.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-22.04 8 | steps: 9 | - uses: actions/checkout@v4 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 gettext git libtool pkgconf 19 | run: | 20 | tests/build.sh 21 | tests/runtests.sh 22 | -------------------------------------------------------------------------------- /.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-22.04 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@v4 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/libvsgpt 28 | cp projects/libyal/build.sh projects/libvsgpt/ 29 | cp projects/libyal/project.yaml projects/libvsgpt/ 30 | head -n 20 projects/libyal/Dockerfile > projects/libvsgpt/Dockerfile 31 | echo "RUN git clone --depth 1 https://github.com/libyal/libvsgpt.git libvsgpt" >> projects/libvsgpt/Dockerfile 32 | tail -n 3 projects/libyal/Dockerfile >> projects/libvsgpt/Dockerfile 33 | python3 infra/helper.py build_image --pull libvsgpt 34 | python3 infra/helper.py build_fuzzers --sanitizer address libvsgpt 35 | python3 infra/helper.py check_build libvsgpt 36 | -------------------------------------------------------------------------------- /.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-22.04 10 | strategy: 11 | matrix: 12 | include: 13 | - architecture: 'x64' 14 | compiler: 'gcc' 15 | configure_options: '--enable-wide-character-type' 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Install build dependencies 19 | run: | 20 | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config 21 | - name: Download test data 22 | run: | 23 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 24 | - name: Prepare shared libraries 25 | run: | 26 | tests/syncsharedlibs.sh --use-head 27 | - name: Building from source 28 | env: 29 | CC: ${{ matrix.compiler }} 30 | run: | 31 | tests/build.sh ${{ matrix.configure_options }} 32 | - name: Run tests 33 | run: | 34 | tests/runtests.sh 35 | -------------------------------------------------------------------------------- /.github/workflows/build_wheel.yml: -------------------------------------------------------------------------------- 1 | # Build wheel from source using tox. 2 | name: build_wheel 3 | on: [push, pull_request] 4 | permissions: read-all 5 | jobs: 6 | build_wheel: 7 | runs-on: ubuntu-22.04 8 | strategy: 9 | matrix: 10 | include: 11 | - python-version: '3.7' 12 | toxenv: 'py37' 13 | - python-version: '3.8' 14 | toxenv: 'py38' 15 | - python-version: '3.9' 16 | toxenv: 'py39' 17 | - python-version: '3.10' 18 | toxenv: 'py310' 19 | - python-version: '3.11' 20 | toxenv: 'py311' 21 | - python-version: '3.12' 22 | toxenv: 'py312' 23 | steps: 24 | - uses: actions/checkout@v4 25 | - name: Install build dependencies 26 | run: | 27 | sudo add-apt-repository universe && 28 | sudo add-apt-repository -y ppa:deadsnakes/ppa && 29 | sudo apt-get update && 30 | sudo apt-get install -y autoconf automake autopoint build-essential git libtool pkg-config python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python3-distutils python3-pip python3-setuptools 31 | - name: Install tox 32 | run: | 33 | python3 -m pip install tox 34 | - name: Download test data 35 | run: | 36 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 37 | - name: Prepare build 38 | run: | 39 | ./synclibs.sh --use-head && ./autogen.sh && ./configure && make sources >/dev/null 40 | - name: Build Python wheel 41 | run: | 42 | tox -e${{ matrix.toxenv }} 43 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Acknowledgements: libvsgpt 2 | 3 | Copyright (C) 2019-2024, Joachim Metz 4 | 5 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | TODO: 2 | * vsgptinfo show if corruption was detected 3 | * vsgptinfo show detailed corruption information, such as checksum failure in backup partition table? 4 | 5 | 20190223 6 | * see `git log' for more recent change log 7 | * initial version based on libvsmbr 8 | 9 | -------------------------------------------------------------------------------- /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 | libvsgpt \ 20 | vsgpttools \ 21 | pyvsgpt \ 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/libvsgpt.install \ 36 | dpkg/libvsgpt-dev.install \ 37 | dpkg/libvsgpt-python3.install \ 38 | dpkg/libvsgpt-tools.install \ 39 | dpkg/source/format 40 | 41 | GETTEXT_FILES = \ 42 | config.rpath \ 43 | po/Makevars.in 44 | 45 | PKGCONFIG_FILES = \ 46 | libvsgpt.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 | libvsgpt.spec \ 56 | libvsgpt.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 | libvsgpt.pc \ 70 | libvsgpt.spec \ 71 | Makefile \ 72 | Makefile.in \ 73 | po/Makevars 74 | 75 | pkgconfigdir = $(libdir)/pkgconfig 76 | 77 | pkgconfig_DATA = \ 78 | libvsgpt.pc 79 | 80 | libtool: @LIBTOOL_DEPS@ 81 | cd $(srcdir) && $(SHELL) ./config.status --recheck 82 | 83 | lib: library 84 | 85 | library: 86 | (cd $(srcdir)/common && $(MAKE) $(AM_MAKEFLAGS)) 87 | (cd $(srcdir)/libcerror && $(MAKE) $(AM_MAKEFLAGS)) 88 | (cd $(srcdir)/libcthreads && $(MAKE) $(AM_MAKEFLAGS)) 89 | (cd $(srcdir)/libcdata && $(MAKE) $(AM_MAKEFLAGS)) 90 | (cd $(srcdir)/libclocale && $(MAKE) $(AM_MAKEFLAGS)) 91 | (cd $(srcdir)/libcnotify && $(MAKE) $(AM_MAKEFLAGS)) 92 | (cd $(srcdir)/libcsplit && $(MAKE) $(AM_MAKEFLAGS)) 93 | (cd $(srcdir)/libuna && $(MAKE) $(AM_MAKEFLAGS)) 94 | (cd $(srcdir)/libcfile && $(MAKE) $(AM_MAKEFLAGS)) 95 | (cd $(srcdir)/libcpath && $(MAKE) $(AM_MAKEFLAGS)) 96 | (cd $(srcdir)/libbfio && $(MAKE) $(AM_MAKEFLAGS)) 97 | (cd $(srcdir)/libfcache && $(MAKE) $(AM_MAKEFLAGS)) 98 | (cd $(srcdir)/libfdata && $(MAKE) $(AM_MAKEFLAGS)) 99 | (cd $(srcdir)/libfguid && $(MAKE) $(AM_MAKEFLAGS)) 100 | (cd $(srcdir)/libvsgpt && $(MAKE) $(AM_MAKEFLAGS)) 101 | (cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS)) 102 | 103 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvsgpt/f8a5a46ed0ac6bdf482dc79ae0bad5463c03157e/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | libvsgpt is a library to access the GUID Partition Table (GPT) volume system. 2 | 3 | Project information: 4 | 5 | * Status: experimental 6 | * Licence: LGPLv3+ 7 | 8 | For more information see: 9 | 10 | * Project documentation: https://github.com/libyal/libvsgpt/wiki/Home 11 | * How to build from source: https://github.com/libyal/libvsgpt/wiki/Building 12 | 13 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | dnl Checks for required headers and functions 2 | dnl 3 | dnl Version: 20200713 4 | 5 | dnl Function to detect if libvsgpt dependencies are available 6 | AC_DEFUN([AX_LIBVSGPT_CHECK_LOCAL], 7 | [dnl Check for internationalization functions in libvsgpt/libvsgpt_i18n.c 8 | AC_CHECK_FUNCS([bindtextdomain]) 9 | ]) 10 | 11 | dnl Function to detect if vsgpttools dependencies are available 12 | AC_DEFUN([AX_VSGPTTOOLS_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 | 25 | dnl Function to check if DLL support is needed 26 | AC_DEFUN([AX_LIBVSGPT_CHECK_DLL_SUPPORT], 27 | [AS_IF( 28 | [test "x$enable_shared" = xyes && test "x$ac_cv_enable_static_executables" = xno], 29 | [AS_CASE( 30 | [$host], 31 | [*cygwin* | *mingw* | *msys*], 32 | [AC_DEFINE( 33 | [HAVE_DLLMAIN], 34 | [1], 35 | [Define to 1 to enable the DllMain function.]) 36 | AC_SUBST( 37 | [HAVE_DLLMAIN], 38 | [1]) 39 | 40 | AC_SUBST( 41 | [LIBVSGPT_DLL_EXPORT], 42 | ["-DLIBVSGPT_DLL_EXPORT"]) 43 | 44 | AC_SUBST( 45 | [LIBVSGPT_DLL_IMPORT], 46 | ["-DLIBVSGPT_DLL_IMPORT"]) 47 | ]) 48 | ]) 49 | ]) 50 | 51 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /common/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common include file 3 | * 4 | * Copyright (C) 2019-2024, 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 | -------------------------------------------------------------------------------- /common/config_borlandc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration for the Borland/CodeGear C++ Builder compiler 3 | * 4 | * Copyright (C) 2019-2024, 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 | -------------------------------------------------------------------------------- /common/config_msc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration for the Microsoft Visual Studio C++ compiler 3 | * 4 | * Copyright (C) 2019-2024, 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 | -------------------------------------------------------------------------------- /common/config_winapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration file for WINAPI 3 | * 4 | * Copyright (C) 2019-2024, 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_WINAPI_H ) 23 | #define _CONFIG_WINAPI_H 24 | 25 | /* Define the earliest supported WINAPI version 26 | #define WINVER 0x0501 27 | */ 28 | 29 | /* If necessary make sure WINAPI is defined 30 | */ 31 | #if defined( HAVE_WINDOWS_H ) || defined( __BORLANDC__ ) || defined( _MSC_VER ) 32 | #include 33 | #endif 34 | 35 | #if defined( WINAPI ) 36 | 37 | /* Define to the address where bug reports for this package should be sent. 38 | */ 39 | #define PACKAGE_BUGREPORT "joachim.metz@gmail.com" 40 | 41 | /* Define the size of the integer for WINAPI 42 | */ 43 | #if !defined( SIZEOF_INT ) 44 | #define SIZEOF_INT 4 45 | #endif 46 | 47 | /* Define the size of size_t for WINAPI 48 | * Do not define when pyconfig.h has been included via python.h 49 | */ 50 | #if !defined( HAVE_PYCONFIG_H ) 51 | 52 | #if !defined( SIZEOF_SIZE_T ) 53 | #if __WORDSIZE == 64 54 | #define SIZEOF_SIZE_T 8 55 | #else 56 | #define SIZEOF_SIZE_T 4 57 | #endif 58 | #endif 59 | 60 | #endif /* !defined( HAVE_PYCONFIG_H ) */ 61 | 62 | /* Define the size of the wide character for WINAPI 63 | */ 64 | #if !defined( SIZEOF_WCHAR_T ) 65 | #define SIZEOF_WCHAR_T 2 66 | #endif 67 | 68 | /* Enable the DllMain function 69 | */ 70 | #define HAVE_DLLMAIN 1 71 | 72 | /* Enable verbose output 73 | #define HAVE_VERBOSE_OUTPUT 1 74 | */ 75 | 76 | /* Enable debug output 77 | #define HAVE_DEBUG_OUTPUT 1 78 | */ 79 | 80 | /* Enable both the narrow and wide character functions 81 | */ 82 | #if !defined( HAVE_WIDE_CHARACTER_TYPE ) 83 | #define HAVE_WIDE_CHARACTER_TYPE 1 84 | #endif 85 | 86 | /* If not controlled by config.h enable multi-thread support 87 | */ 88 | #if !defined( HAVE_CONFIG_H ) && !defined( HAVE_MULTI_THREAD_SUPPORT ) 89 | #define HAVE_MULTI_THREAD_SUPPORT 1 90 | #endif 91 | 92 | #endif /* defined( WINAPI ) */ 93 | 94 | #endif /* !defined( _CONFIG_WINAPI_H ) */ 95 | 96 | -------------------------------------------------------------------------------- /dpkg/changelog.in: -------------------------------------------------------------------------------- 1 | libvsgpt (@VERSION@-1) unstable; urgency=low 2 | 3 | * Auto-generated 4 | 5 | -- Joachim Metz @DPKG_DATE@ 6 | -------------------------------------------------------------------------------- /dpkg/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /dpkg/control: -------------------------------------------------------------------------------- 1 | Source: libvsgpt 2 | Priority: extra 3 | Maintainer: Joachim Metz 4 | Build-Depends: debhelper (>= 9), dh-autoreconf, dh-python, pkg-config, python3-dev, python3-setuptools 5 | Standards-Version: 4.1.4 6 | Section: libs 7 | Homepage: https://github.com/libyal/libvsgpt 8 | Vcs-Git: https://github.com/libyal/libvsgpt.git 9 | 10 | Package: libvsgpt 11 | Architecture: any 12 | Depends: ${shlibs:Depends}, ${misc:Depends} 13 | Conflicts: libvsgpt1 14 | Replaces: libvsgpt1 15 | Suggests: libvsgpt-dbg 16 | Description: Library to access the GUID Partition Table (GPT) volume system format 17 | libvsgpt is a library to access the GUID Partition Table (GPT) volume system format. 18 | 19 | Package: libvsgpt-dbg 20 | Architecture: any 21 | Section: debug 22 | Depends: libvsgpt (= ${binary:Version}), ${misc:Depends} 23 | Description: Debugging symbols for libvsgpt 24 | Debugging symbols for libvsgpt. 25 | 26 | Package: libvsgpt-dev 27 | Section: libdevel 28 | Architecture: any 29 | Depends: libvsgpt (= ${binary:Version}), ${misc:Depends} 30 | Description: Header files and libraries for developing applications for libvsgpt 31 | Header files and libraries for developing applications for libvsgpt. 32 | 33 | Package: libvsgpt-tools 34 | Section: utils 35 | Architecture: any 36 | Depends: libvsgpt (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} 37 | Conflicts: libvsgpt-utils 38 | Replaces: libvsgpt-utils 39 | Description: Several tools for Several tools for reading GUID Partition Table (GPT) volume systems 40 | Several tools for Several tools for reading GUID Partition Table (GPT) volume systems. 41 | 42 | Package: libvsgpt-tools-dbg 43 | Section: debug 44 | Architecture: any 45 | Depends: libvsgpt-tools (= ${binary:Version}), ${misc:Depends} 46 | Description: Debugging symbols for libvsgpt-tools 47 | Debugging symbols for libvsgpt-tools. 48 | 49 | Package: libvsgpt-python3 50 | Section: python 51 | Architecture: any 52 | Depends: libvsgpt (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} 53 | Conflicts: python3-libvsgpt 54 | Replaces: python3-libvsgpt 55 | Suggests: libvsgpt-python3-dbg 56 | Description: Python 3 bindings for libvsgpt 57 | Python 3 bindings for libvsgpt. 58 | 59 | Package: libvsgpt-python3-dbg 60 | Section: debug 61 | Architecture: any 62 | Depends: libvsgpt-python3 (= ${binary:Version}), ${misc:Depends} 63 | Description: Debugging symbols for libvsgpt-python3 64 | Debugging symbols for libvsgpt-python3. 65 | 66 | -------------------------------------------------------------------------------- /dpkg/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: libvsgpt 3 | Source: https://github.com/libyal/libvsgpt 4 | 5 | Files: * 6 | Copyright: 2019-2024, 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 | -------------------------------------------------------------------------------- /dpkg/libvsgpt-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/libvsgpt-python3.install: -------------------------------------------------------------------------------- 1 | /usr/lib/python3* 2 | -------------------------------------------------------------------------------- /dpkg/libvsgpt-tools.install: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/share/man/man1 3 | -------------------------------------------------------------------------------- /dpkg/libvsgpt.install: -------------------------------------------------------------------------------- 1 | usr/lib/*-*/lib*.so.* 2 | -------------------------------------------------------------------------------- /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/pyvsgpt.a 19 | 20 | .PHONY: override_dh_missing 21 | override_dh_missing: 22 | dh_missing -X.la -X/pyvsgpt.a --fail-missing 23 | 24 | .PHONY: override_dh_strip 25 | override_dh_strip: 26 | ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS))) 27 | dh_strip -plibvsgpt --dbg-package=libvsgpt-dbg 28 | dh_strip -plibvsgpt-tools --dbg-package=libvsgpt-tools-dbg 29 | dh_strip -plibvsgpt-python3 --dbg-package=libvsgpt-python3-dbg 30 | endif 31 | 32 | -------------------------------------------------------------------------------- /dpkg/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | include_HEADERS = \ 2 | libvsgpt.h 3 | 4 | pkginclude_HEADERS = \ 5 | libvsgpt/codepage.h \ 6 | libvsgpt/definitions.h \ 7 | libvsgpt/error.h \ 8 | libvsgpt/extern.h \ 9 | libvsgpt/features.h \ 10 | libvsgpt/types.h 11 | 12 | EXTRA_DIST = \ 13 | libvsgpt.h.in \ 14 | libvsgpt/definitions.h.in \ 15 | libvsgpt/features.h.in \ 16 | libvsgpt/types.h.in 17 | 18 | DISTCLEANFILES = \ 19 | libvsgpt.h \ 20 | libvsgpt/definitions.h \ 21 | libvsgpt/features.h \ 22 | libvsgpt/types.h \ 23 | Makefile \ 24 | Makefile.in 25 | 26 | -------------------------------------------------------------------------------- /include/libvsgpt/definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for libvsgpt 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_DEFINITIONS_H ) 23 | #define _LIBVSGPT_DEFINITIONS_H 24 | 25 | #include 26 | 27 | #define LIBVSGPT_VERSION @VERSION@ 28 | 29 | /* The version string 30 | */ 31 | #define LIBVSGPT_VERSION_STRING "@VERSION@" 32 | 33 | /* The byte order definitions 34 | */ 35 | enum LIBVSGPT_ENDIAN 36 | { 37 | LIBVSGPT_ENDIAN_BIG = (int) 'b', 38 | LIBVSGPT_ENDIAN_LITTLE = (int) 'l', 39 | }; 40 | 41 | /* The access flags definitions 42 | * bit 1 set to 1 for read access 43 | * bit 2 set to 1 for write access 44 | * bit 3-8 not used 45 | */ 46 | enum LIBVSGPT_ACCESS_FLAGS 47 | { 48 | LIBVSGPT_ACCESS_FLAG_READ = 0x01, 49 | /* Reserved: not supported yet */ 50 | LIBVSGPT_ACCESS_FLAG_WRITE = 0x02 51 | }; 52 | 53 | /* The file access macros 54 | */ 55 | #define LIBVSGPT_OPEN_READ ( LIBVSGPT_ACCESS_FLAG_READ ) 56 | /* Reserved: not supported yet */ 57 | #define LIBVSGPT_OPEN_WRITE ( LIBVSGPT_ACCESS_FLAG_WRITE ) 58 | /* Reserved: not supported yet */ 59 | #define LIBVSGPT_OPEN_READ_WRITE ( LIBVSGPT_ACCESS_FLAG_READ | LIBVSGPT_ACCESS_FLAG_WRITE ) 60 | 61 | #endif /* !defined( _LIBVSGPT_DEFINITIONS_H ) */ 62 | 63 | -------------------------------------------------------------------------------- /include/libvsgpt/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) 2019-2024, 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( _LIBVSGPT_EXTERN_H ) 26 | #define _LIBVSGPT_EXTERN_H 27 | 28 | /* To export functions from the libvsgpt DLL define LIBVSGPT_DLL_EXPORT 29 | * To import functions from the libvsgpt DLL define LIBVSGPT_DLL_IMPORT 30 | * Otherwise use default extern statement 31 | */ 32 | #if defined( LIBVSGPT_DLL_EXPORT ) 33 | #define LIBVSGPT_EXTERN __declspec(dllexport) 34 | 35 | #elif defined( LIBVSGPT_DLL_IMPORT ) 36 | #define LIBVSGPT_EXTERN extern __declspec(dllimport) 37 | 38 | #else 39 | #define LIBVSGPT_EXTERN extern 40 | 41 | #endif 42 | 43 | #endif /* !defined( _LIBVSGPT_EXTERN_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /include/libvsgpt/features.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Features of libvsgpt 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_FEATURES_H ) 23 | #define _LIBVSGPT_FEATURES_H 24 | 25 | /* The libvsgpt type support features 26 | */ 27 | #if defined( WINAPI ) || @HAVE_WIDE_CHARACTER_TYPE@ 28 | #define LIBVSGPT_HAVE_WIDE_CHARACTER_TYPE 1 29 | #endif 30 | 31 | #if defined( WINAPI ) || @HAVE_MULTI_THREAD_SUPPORT@ 32 | #define LIBVSGPT_HAVE_MULTI_THREAD_SUPPORT 1 33 | #endif 34 | 35 | #if defined( HAVE_LIBBFIO ) || ( !defined( WINAPI ) && @HAVE_LIBBFIO@ ) 36 | #define LIBVSGPT_HAVE_BFIO 1 37 | #endif 38 | 39 | #if !defined( LIBVSGPT_DEPRECATED ) 40 | #if defined( __GNUC__ ) && __GNUC__ >= 3 41 | #define LIBVSGPT_DEPRECATED __attribute__ ((__deprecated__)) 42 | #elif defined( _MSC_VER ) 43 | #define LIBVSGPT_DEPRECATED __declspec(deprecated) 44 | #else 45 | #define LIBVSGPT_DEPRECATED 46 | #endif 47 | #endif 48 | 49 | #endif /* !defined( _LIBVSGPT_FEATURES_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvsgpt.ini: -------------------------------------------------------------------------------- 1 | [project] 2 | name: "libvsgpt" 3 | status: "experimental" 4 | year_of_creation: "2019" 5 | data_format: "GUID Partition Table (GPT) volume system" 6 | documentation_url: "https://github.com/libyal/libvsgpt/tree/main/documentation" 7 | features: ["debug_output", "ossfuzz", "python_bindings", "tools"] 8 | 9 | [library] 10 | features: ["pthread", "wide_character_type"] 11 | public_types: ["partition", "volume"] 12 | 13 | [tools] 14 | description: "Several tools for Several tools for reading GUID Partition Table (GPT) volume systems" 15 | names: ["vsgptinfo"] 16 | 17 | [tests] 18 | profiles: ["libvsgpt", "pyvsgpt", "vsgptinfo"] 19 | info_tool_options_per_profile: [""] 20 | info_tool_profiles: ["vsgptinfo"] 21 | example_filename1: "image1.raw" 22 | example_filename2: "image2.raw" 23 | 24 | [troubleshooting] 25 | example: "vsgptinfo image.raw" 26 | 27 | [pypi] 28 | appveyor_token: "VHuZiUWgTqTciKE2nsv/LtfTn0/FFkQn3PijGWNGeyvEmSeFTIo3zzMgPoVar566aeHXfGzllwpaaRNOS8kERv5ZbC5rOWWf/8GtZcEm0cFJJGrdkTay795+/9/sS7D+g0GzjUjJYBNLoyWrqZzpvkuxyYQKgi/9iulU4j6xu0D0R5uiNhhs5Knwf85jxgscsVmTm+lYlUL5TQ0RdpMZZosKgdQcv1FPd5PVDot1CWqk6DTCTvomKnWs50+MehAIxoy9nBnPMCmoe0lTAhndvGcUuLvf1Zg4HouzHlbd1Lg=" 29 | 30 | -------------------------------------------------------------------------------- /libvsgpt.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libvsgpt 7 | Description: Library to access the GUID Partition Table (GPT) volume system format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lvsgpt 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 | -------------------------------------------------------------------------------- /libvsgpt/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I../include -I$(top_srcdir)/include \ 3 | -I../common -I$(top_srcdir)/common \ 4 | @LIBCERROR_CPPFLAGS@ \ 5 | @LIBCTHREADS_CPPFLAGS@ \ 6 | @LIBCDATA_CPPFLAGS@ \ 7 | @LIBCLOCALE_CPPFLAGS@ \ 8 | @LIBCNOTIFY_CPPFLAGS@ \ 9 | @LIBCSPLIT_CPPFLAGS@ \ 10 | @LIBUNA_CPPFLAGS@ \ 11 | @LIBCFILE_CPPFLAGS@ \ 12 | @LIBCPATH_CPPFLAGS@ \ 13 | @LIBBFIO_CPPFLAGS@ \ 14 | @LIBFCACHE_CPPFLAGS@ \ 15 | @LIBFDATA_CPPFLAGS@ \ 16 | @LIBFGUID_CPPFLAGS@ \ 17 | @PTHREAD_CPPFLAGS@ \ 18 | @LIBVSGPT_DLL_EXPORT@ 19 | 20 | lib_LTLIBRARIES = libvsgpt.la 21 | 22 | libvsgpt_la_SOURCES = \ 23 | libvsgpt.c \ 24 | libvsgpt_boot_record.c libvsgpt_boot_record.h \ 25 | libvsgpt_checksum.c libvsgpt_checksum.h \ 26 | libvsgpt_chs_address.c libvsgpt_chs_address.h \ 27 | libvsgpt_debug.c libvsgpt_debug.h \ 28 | libvsgpt_definitions.h \ 29 | libvsgpt_error.c libvsgpt_error.h \ 30 | libvsgpt_extern.h \ 31 | libvsgpt_io_handle.c libvsgpt_io_handle.h \ 32 | libvsgpt_libbfio.h \ 33 | libvsgpt_libcdata.h \ 34 | libvsgpt_libcerror.h \ 35 | libvsgpt_libclocale.h \ 36 | libvsgpt_libcnotify.h \ 37 | libvsgpt_libcthreads.h \ 38 | libvsgpt_libfcache.h \ 39 | libvsgpt_libfdata.h \ 40 | libvsgpt_libfguid.h \ 41 | libvsgpt_libuna.h \ 42 | libvsgpt_mbr_partition_entry.c libvsgpt_mbr_partition_entry.h \ 43 | libvsgpt_mbr_partition_type.c libvsgpt_mbr_partition_type.h \ 44 | libvsgpt_notify.c libvsgpt_notify.h \ 45 | libvsgpt_partition.c libvsgpt_partition.h \ 46 | libvsgpt_partition_entry.c libvsgpt_partition_entry.h \ 47 | libvsgpt_partition_table_header.c libvsgpt_partition_table_header.h \ 48 | libvsgpt_partition_type_identifier.c libvsgpt_partition_type_identifier.h \ 49 | libvsgpt_partition_values.c libvsgpt_partition_values.h \ 50 | libvsgpt_section_values.c libvsgpt_section_values.h \ 51 | libvsgpt_sector_data.c libvsgpt_sector_data.h \ 52 | libvsgpt_support.c libvsgpt_support.h \ 53 | libvsgpt_types.h \ 54 | libvsgpt_unused.h \ 55 | libvsgpt_volume.c libvsgpt_volume.h \ 56 | vsgpt_boot_record.h \ 57 | vsgpt_mbr_partition_entry.h \ 58 | vsgpt_partition_entry.h \ 59 | vsgpt_partition_table.h 60 | 61 | libvsgpt_la_LIBADD = \ 62 | @LIBCERROR_LIBADD@ \ 63 | @LIBCTHREADS_LIBADD@ \ 64 | @LIBCDATA_LIBADD@ \ 65 | @LIBCLOCALE_LIBADD@ \ 66 | @LIBCNOTIFY_LIBADD@ \ 67 | @LIBCSPLIT_LIBADD@ \ 68 | @LIBUNA_LIBADD@ \ 69 | @LIBCFILE_LIBADD@ \ 70 | @LIBCPATH_LIBADD@ \ 71 | @LIBBFIO_LIBADD@ \ 72 | @LIBFCACHE_LIBADD@ \ 73 | @LIBFDATA_LIBADD@ \ 74 | @LIBFGUID_LIBADD@ \ 75 | @PTHREAD_LIBADD@ 76 | 77 | libvsgpt_la_LDFLAGS = -no-undefined -version-info 1:0:0 78 | 79 | EXTRA_DIST = \ 80 | libvsgpt_definitions.h.in \ 81 | libvsgpt.rc \ 82 | libvsgpt.rc.in 83 | 84 | DISTCLEANFILES = \ 85 | libvsgpt_definitions.h \ 86 | libvsgpt.rc \ 87 | Makefile \ 88 | Makefile.in 89 | 90 | sources-local: $(BUILT_SOURCES) 91 | 92 | splint-local: 93 | @echo "Running splint on libvsgpt ..." 94 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(libvsgpt_la_SOURCES) 95 | 96 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library to access the GUID Partition Table (GPT) volume system format 3 | * 4 | * Copyright (C) 2019-2024, 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 "libvsgpt_unused.h" 29 | 30 | /* Define HAVE_LOCAL_LIBVSGPT for local use of libvsgpt 31 | */ 32 | #if !defined( HAVE_LOCAL_LIBVSGPT ) 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 | LIBVSGPT_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 libvsgpt_is_dll( 72 | void ) 73 | { 74 | return( 1 ); 75 | } 76 | 77 | #endif /* defined( WINAPI ) && defined( HAVE_DLLMAIN ) */ 78 | 79 | #endif /* !defined( HAVE_LOCAL_LIBVSGPT ) */ 80 | 81 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt.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 GUID Partition Table (GPT) volume system format\0" 25 | VALUE "FileVersion", "@VERSION@" "\0" 26 | VALUE "InternalName", "libvsgpt.dll\0" 27 | VALUE "LegalCopyright", "(C) 2019-2024, Joachim Metz \0" 28 | VALUE "OriginalFilename", "libvsgpt.dll\0" 29 | VALUE "ProductName", "libvsgpt\0" 30 | VALUE "ProductVersion", "@VERSION@" "\0" 31 | VALUE "Comments", "For more information visit https://github.com/libyal/libvsgpt/\0" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x0409, 1200 37 | END 38 | END 39 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_boot_record.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The boot record functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_BOOT_RECORD_H ) 23 | #define _LIBVSGPT_BOOT_RECORD_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libbfio.h" 29 | #include "libvsgpt_libcdata.h" 30 | #include "libvsgpt_libcerror.h" 31 | #include "libvsgpt_mbr_partition_entry.h" 32 | 33 | #if defined( __cplusplus ) 34 | extern "C" { 35 | #endif 36 | 37 | typedef struct libvsgpt_boot_record libvsgpt_boot_record_t; 38 | 39 | struct libvsgpt_boot_record 40 | { 41 | /* The disk identity 42 | */ 43 | uint32_t disk_identity; 44 | 45 | /* The partition entries array 46 | */ 47 | libcdata_array_t *partition_entries; 48 | }; 49 | 50 | int libvsgpt_boot_record_initialize( 51 | libvsgpt_boot_record_t **boot_record, 52 | libcerror_error_t **error ); 53 | 54 | int libvsgpt_boot_record_free( 55 | libvsgpt_boot_record_t **boot_record, 56 | libcerror_error_t **error ); 57 | 58 | int libvsgpt_boot_record_read_data( 59 | libvsgpt_boot_record_t *boot_record, 60 | const uint8_t *data, 61 | size_t data_size, 62 | libcerror_error_t **error ); 63 | 64 | int libvsgpt_boot_record_read_file_io_handle( 65 | libvsgpt_boot_record_t *boot_record, 66 | libbfio_handle_t *file_io_handle, 67 | off64_t file_offset, 68 | libcerror_error_t **error ); 69 | 70 | int libvsgpt_boot_record_get_number_of_partition_entries( 71 | libvsgpt_boot_record_t *boot_record, 72 | int *number_of_partition_entries, 73 | libcerror_error_t **error ); 74 | 75 | int libvsgpt_boot_record_get_partition_entry_by_index( 76 | libvsgpt_boot_record_t *boot_record, 77 | int partition_entry_index, 78 | libvsgpt_mbr_partition_entry_t **partition_entry, 79 | libcerror_error_t **error ); 80 | 81 | #if defined( __cplusplus ) 82 | } 83 | #endif 84 | 85 | #endif /* !defined( _LIBVSGPT_BOOT_RECORD_H ) */ 86 | 87 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_checksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Checksum functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_CHECKSUM_H ) 23 | #define _LIBVSGPT_CHECKSUM_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_extern.h" 29 | #include "libvsgpt_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | LIBVSGPT_EXTERN_VARIABLE \ 36 | uint32_t libvsgpt_checksum_crc32_table[ 256 ]; 37 | 38 | LIBVSGPT_EXTERN_VARIABLE \ 39 | int libvsgpt_checksum_crc32_table_computed; 40 | 41 | void libvsgpt_checksum_initialize_crc32_table( 42 | int ); 43 | 44 | int libvsgpt_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 | int libvsgpt_checksum_calculate_weak_crc32( 52 | uint32_t *checksum, 53 | const uint8_t *buffer, 54 | size_t size, 55 | uint32_t initial_value, 56 | libcerror_error_t **error ); 57 | 58 | #if defined( __cplusplus ) 59 | } 60 | #endif 61 | 62 | #endif /* !defined( _LIBVSGPT_CHECKSUM_H ) */ 63 | 64 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_chs_address.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Cylinder Head Sector (CHS) address functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_CHS_ADDRESS_H ) 23 | #define _LIBVSGPT_CHS_ADDRESS_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvsgpt_chs_address libvsgpt_chs_address_t; 35 | 36 | struct libvsgpt_chs_address 37 | { 38 | /* The cylinder 39 | */ 40 | uint16_t cylinder; 41 | 42 | /* The head 43 | */ 44 | uint8_t head; 45 | 46 | /* The sector 47 | */ 48 | uint8_t sector; 49 | }; 50 | 51 | int libvsgpt_chs_address_initialize( 52 | libvsgpt_chs_address_t **chs_address, 53 | libcerror_error_t **error ); 54 | 55 | int libvsgpt_chs_address_free( 56 | libvsgpt_chs_address_t **chs_address, 57 | libcerror_error_t **error ); 58 | 59 | int libvsgpt_chs_address_copy_from_byte_stream( 60 | libvsgpt_chs_address_t *chs_address, 61 | uint8_t *byte_stream, 62 | size_t byte_stream_size, 63 | uint8_t byte_order, 64 | libcerror_error_t **error ); 65 | 66 | #if defined( __cplusplus ) 67 | } 68 | #endif 69 | 70 | #endif /* !defined( _LIBVSGPT_CHS_ADDRESS_H ) */ 71 | 72 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Debug functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_DEBUG_H ) 23 | #define _LIBVSGPT_DEBUG_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libbfio.h" 29 | #include "libvsgpt_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | #if defined( HAVE_DEBUG_OUTPUT ) 36 | 37 | void libvsgpt_debug_print_mbr_partition_entry_flags( 38 | uint8_t partition_entry_flags ); 39 | 40 | int libvsgpt_debug_print_guid_value( 41 | const char *function_name, 42 | const char *value_name, 43 | const uint8_t *byte_stream, 44 | size_t byte_stream_size, 45 | int byte_order, 46 | uint32_t string_format_flags, 47 | libcerror_error_t **error ); 48 | 49 | int libvsgpt_debug_print_utf16_string_value( 50 | const char *function_name, 51 | const char *value_name, 52 | const uint8_t *byte_stream, 53 | size_t byte_stream_size, 54 | int byte_order, 55 | libcerror_error_t **error ); 56 | 57 | int libvsgpt_debug_print_read_offsets( 58 | libbfio_handle_t *file_io_handle, 59 | libcerror_error_t **error ); 60 | 61 | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ 62 | 63 | #if defined( __cplusplus ) 64 | } 65 | #endif 66 | 67 | #endif /* !defined( _LIBVSGPT_DEBUG_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal definitions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_INTERNAL_DEFINITIONS_H ) 23 | #define _LIBVSGPT_INTERNAL_DEFINITIONS_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBVSGPT for local use of libvsgpt 28 | */ 29 | #if !defined( HAVE_LOCAL_LIBVSGPT ) 30 | #include 31 | 32 | /* The definitions in are copied here 33 | * for local use of libvsgpt 34 | */ 35 | #else 36 | #define LIBVSGPT_VERSION @VERSION@ 37 | 38 | /* The libvsgpt version string 39 | */ 40 | #define LIBVSGPT_VERSION_STRING "@VERSION@" 41 | 42 | /* The endian definitions 43 | */ 44 | #define LIBVSGPT_ENDIAN_BIG _BYTE_STREAM_ENDIAN_BIG 45 | #define LIBVSGPT_ENDIAN_LITTLE _BYTE_STREAM_ENDIAN_LITTLE 46 | 47 | /* The access flags definitions 48 | * bit 1 set to 1 for read access 49 | * bit 2 set to 1 for write access 50 | * bit 3-8 not used 51 | */ 52 | enum LIBVSGPT_ACCESS_FLAGS 53 | { 54 | LIBVSGPT_ACCESS_FLAG_READ = 0x01, 55 | /* Reserved: not supported yet */ 56 | LIBVSGPT_ACCESS_FLAG_WRITE = 0x02 57 | }; 58 | 59 | /* The file access macros 60 | */ 61 | #define LIBVSGPT_OPEN_READ ( LIBVSGPT_ACCESS_FLAG_READ ) 62 | /* Reserved: not supported yet */ 63 | #define LIBVSGPT_OPEN_WRITE ( LIBVSGPT_ACCESS_FLAG_WRITE ) 64 | /* Reserved: not supported yet */ 65 | #define LIBVSGPT_OPEN_READ_WRITE ( LIBVSGPT_ACCESS_FLAG_READ | LIBVSGPT_ACCESS_FLAG_WRITE ) 66 | 67 | #endif /* !defined( HAVE_LOCAL_LIBVSGPT ) */ 68 | 69 | #define LIBVSGPT_MAXIMUM_CACHE_ENTRIES_SECTORS 16 70 | 71 | #define LIBVSGPT_MAXIMUM_RECURSION_DEPTH 256 72 | 73 | #endif /* !defined( _LIBVSGPT_INTERNAL_DEFINITIONS_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_INTERNAL_ERROR_H ) 23 | #define _LIBVSGPT_INTERNAL_ERROR_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #if !defined( HAVE_LOCAL_LIBVSGPT ) 30 | #include 31 | #endif 32 | 33 | #include "libvsgpt_extern.h" 34 | 35 | #if defined( __cplusplus ) 36 | extern "C" { 37 | #endif 38 | 39 | #if !defined( HAVE_LOCAL_LIBVSGPT ) 40 | 41 | LIBVSGPT_EXTERN \ 42 | void libvsgpt_error_free( 43 | libvsgpt_error_t **error ); 44 | 45 | LIBVSGPT_EXTERN \ 46 | int libvsgpt_error_fprint( 47 | libvsgpt_error_t *error, 48 | FILE *stream ); 49 | 50 | LIBVSGPT_EXTERN \ 51 | int libvsgpt_error_sprint( 52 | libvsgpt_error_t *error, 53 | char *string, 54 | size_t size ); 55 | 56 | LIBVSGPT_EXTERN \ 57 | int libvsgpt_error_backtrace_fprint( 58 | libvsgpt_error_t *error, 59 | FILE *stream ); 60 | 61 | LIBVSGPT_EXTERN \ 62 | int libvsgpt_error_backtrace_sprint( 63 | libvsgpt_error_t *error, 64 | char *string, 65 | size_t size ); 66 | 67 | #endif /* !defined( HAVE_LOCAL_LIBVSGPT ) */ 68 | 69 | #if defined( __cplusplus ) 70 | } 71 | #endif 72 | 73 | #endif /* !defined( _LIBVSGPT_INTERNAL_ERROR_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal extern definition 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_INTERNAL_EXTERN_H ) 23 | #define _LIBVSGPT_INTERNAL_EXTERN_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBVSGPT for local use of libvsgpt 28 | */ 29 | #if !defined( HAVE_LOCAL_LIBVSGPT ) 30 | 31 | #include 32 | 33 | #if defined( __CYGWIN__ ) || defined( __MINGW32__ ) 34 | #define LIBVSGPT_EXTERN_VARIABLE extern 35 | #else 36 | #define LIBVSGPT_EXTERN_VARIABLE LIBVSGPT_EXTERN 37 | #endif 38 | 39 | #else 40 | #define LIBVSGPT_EXTERN /* extern */ 41 | #define LIBVSGPT_EXTERN_VARIABLE extern 42 | 43 | #endif /* !defined( HAVE_LOCAL_LIBVSGPT ) */ 44 | 45 | #endif /* !defined( _LIBVSGPT_INTERNAL_EXTERN_H ) */ 46 | 47 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_io_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The IO handle functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_IO_HANDLE_H ) 23 | #define _LIBVSGPT_IO_HANDLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libbfio.h" 29 | #include "libvsgpt_libcdata.h" 30 | #include "libvsgpt_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct libvsgpt_io_handle libvsgpt_io_handle_t; 37 | 38 | struct libvsgpt_io_handle 39 | { 40 | /* The number of bytes per sector 41 | */ 42 | size_t bytes_per_sector; 43 | 44 | /* Value to indicate if abort was signalled 45 | */ 46 | int abort; 47 | }; 48 | 49 | int libvsgpt_io_handle_initialize( 50 | libvsgpt_io_handle_t **io_handle, 51 | libcerror_error_t **error ); 52 | 53 | int libvsgpt_io_handle_free( 54 | libvsgpt_io_handle_t **io_handle, 55 | libcerror_error_t **error ); 56 | 57 | int libvsgpt_io_handle_clear( 58 | libvsgpt_io_handle_t *io_handle, 59 | libcerror_error_t **error ); 60 | 61 | #if defined( __cplusplus ) 62 | } 63 | #endif 64 | 65 | #endif /* !defined( _LIBVSGPT_IO_HANDLE_H ) */ 66 | 67 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBBFIO_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libcdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcdata header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBCDATA_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBCDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBCERROR_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBCLOCALE_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBCNOTIFY_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libcthreads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcthreads header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBCTHREADS_H ) 23 | #define _LIBVSGPT_LIBCTHREADS_H 24 | 25 | #include 26 | 27 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBVSGPT ) 28 | #define HAVE_LIBVSGPT_MULTI_THREAD_SUPPORT 29 | #endif 30 | 31 | #if defined( HAVE_LIBVSGPT_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_LIBVSGPT_MULTI_THREAD_SUPPORT ) */ 62 | 63 | #endif /* !defined( _LIBVSGPT_LIBCTHREADS_H ) */ 64 | 65 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libfcache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfcache header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBFCACHE_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBFCACHE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libfdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfdata header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBFDATA_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBFDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libfguid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfguid header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBFGUID_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBFGUID_H ) */ 49 | 50 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_LIBUNA_H ) 23 | #define _LIBVSGPT_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( _LIBVSGPT_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_mbr_partition_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Master Boot Record (MBR) partition entry functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_MBR_PARTITION_ENTRY_H ) 23 | #define _LIBVSGPT_MBR_PARTITION_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvsgpt_mbr_partition_entry libvsgpt_mbr_partition_entry_t; 35 | 36 | struct libvsgpt_mbr_partition_entry 37 | { 38 | /* The index 39 | */ 40 | uint8_t index; 41 | 42 | /* The flags 43 | */ 44 | uint8_t flags; 45 | 46 | /* The type 47 | */ 48 | uint8_t type; 49 | 50 | /* The start address in LBA 51 | */ 52 | uint32_t start_address_lba; 53 | 54 | /* The number of sectors 55 | */ 56 | uint32_t number_of_sectors; 57 | }; 58 | 59 | int libvsgpt_mbr_partition_entry_initialize( 60 | libvsgpt_mbr_partition_entry_t **partition_entry, 61 | libcerror_error_t **error ); 62 | 63 | int libvsgpt_mbr_partition_entry_free( 64 | libvsgpt_mbr_partition_entry_t **partition_entry, 65 | libcerror_error_t **error ); 66 | 67 | int libvsgpt_mbr_partition_entry_read_data( 68 | libvsgpt_mbr_partition_entry_t *partition_entry, 69 | const uint8_t *data, 70 | size_t data_size, 71 | libcerror_error_t **error ); 72 | 73 | #if defined( __cplusplus ) 74 | } 75 | #endif 76 | 77 | #endif /* !defined( _LIBVSGPT_MBR_PARTITION_ENTRY_H ) */ 78 | 79 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_mbr_partition_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Master Boot Record (MBR) partition type functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_MBR_PARTITION_TYPE_H ) 23 | #define _LIBVSGPT_MBR_PARTITION_TYPE_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | #if defined( HAVE_DEBUG_OUTPUT ) 33 | 34 | typedef struct libvsgpt_mbr_partition_type libvsgpt_mbr_partition_type_t; 35 | 36 | struct libvsgpt_mbr_partition_type 37 | { 38 | /* The type 39 | */ 40 | uint16_t type; 41 | 42 | /* The description 43 | */ 44 | const char *description; 45 | }; 46 | 47 | const char *libvsgpt_mbr_partition_type_get_description( 48 | uint8_t partition_type ); 49 | 50 | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ 51 | 52 | #if defined( __cplusplus ) 53 | } 54 | #endif 55 | 56 | #endif /* !defined( _LIBVSGPT_MBR_PARTITION_TYPE_H ) */ 57 | 58 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_notify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Notification functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_NOTIFY_H ) 23 | #define _LIBVSGPT_NOTIFY_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "libvsgpt_extern.h" 30 | #include "libvsgpt_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBVSGPT ) 37 | 38 | LIBVSGPT_EXTERN \ 39 | void libvsgpt_notify_set_verbose( 40 | int verbose ); 41 | 42 | LIBVSGPT_EXTERN \ 43 | int libvsgpt_notify_set_stream( 44 | FILE *stream, 45 | libcerror_error_t **error ); 46 | 47 | LIBVSGPT_EXTERN \ 48 | int libvsgpt_notify_stream_open( 49 | const char *filename, 50 | libcerror_error_t **error ); 51 | 52 | LIBVSGPT_EXTERN \ 53 | int libvsgpt_notify_stream_close( 54 | libcerror_error_t **error ); 55 | 56 | #endif /* !defined( HAVE_LOCAL_LIBVSGPT ) */ 57 | 58 | #if defined( __cplusplus ) 59 | } 60 | #endif 61 | 62 | #endif /* !defined( _LIBVSGPT_NOTIFY_H ) */ 63 | 64 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_partition_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The partition entry functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_PARTITION_ENTRY_H ) 23 | #define _LIBVSGPT_PARTITION_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvsgpt_partition_entry libvsgpt_partition_entry_t; 35 | 36 | struct libvsgpt_partition_entry 37 | { 38 | /* The type identifier 39 | */ 40 | uint8_t type_identifier[ 16 ]; 41 | 42 | /* The identifier 43 | */ 44 | uint8_t identifier[ 16 ]; 45 | 46 | /* The start block number 47 | */ 48 | uint64_t start_block_number; 49 | 50 | /* The end block number 51 | */ 52 | uint64_t end_block_number; 53 | 54 | /* The attribute flags 55 | */ 56 | uint64_t attribute_flags; 57 | 58 | /* The name 59 | */ 60 | uint8_t name[ 72 ]; 61 | }; 62 | 63 | int libvsgpt_partition_entry_initialize( 64 | libvsgpt_partition_entry_t **partition_entry, 65 | libcerror_error_t **error ); 66 | 67 | int libvsgpt_partition_entry_free( 68 | libvsgpt_partition_entry_t **partition_entry, 69 | libcerror_error_t **error ); 70 | 71 | int libvsgpt_partition_entry_check_for_empty_block( 72 | const uint8_t *data, 73 | size_t data_size, 74 | libcerror_error_t **error ); 75 | 76 | int libvsgpt_partition_entry_read_data( 77 | libvsgpt_partition_entry_t *partition_entry, 78 | const uint8_t *data, 79 | size_t data_size, 80 | libcerror_error_t **error ); 81 | 82 | #if defined( __cplusplus ) 83 | } 84 | #endif 85 | 86 | #endif /* !defined( _LIBVSGPT_PARTITION_ENTRY_H ) */ 87 | 88 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_partition_type_identifier.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Partition type identifier functions 3 | * 4 | * Copyright (C) 2019-2024, 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 | #include 25 | 26 | #include "libvsgpt_libcerror.h" 27 | #include "libvsgpt_partition_type_identifier.h" 28 | 29 | uint8_t libvsgpt_partition_type_identifier_linux_filesystem_data[ 16 ] = { 30 | 0xaf, 0x3d, 0xc6, 0x0f, 0x83, 0x84, 0x72, 0x47, 0x8e, 0x79, 0x3d, 0x69, 0xd8, 0x47, 0x7d, 0xe4 }; 31 | 32 | uint8_t libvsgpt_partition_type_identifier_unknown[ 16 ] = { 33 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 34 | 35 | /* The partition type identifiers 36 | */ 37 | libvsgpt_partition_type_identifier_definition_t libvsgpt_partition_type_identifier_definitions[ ] = { 38 | { libvsgpt_partition_type_identifier_linux_filesystem_data, "Linux filesystem data" }, 39 | 40 | { libvsgpt_partition_type_identifier_unknown, "Unknown" } }; 41 | 42 | /* Retrieves a string containing the description of the folder identifier 43 | */ 44 | const char *libvsgpt_partition_type_identifier_get_description( 45 | const uint8_t *partition_type_identifier ) 46 | { 47 | int iterator = 0; 48 | 49 | if( partition_type_identifier == NULL ) 50 | { 51 | return( "Invalid partition type identifier" ); 52 | } 53 | while( memory_compare( 54 | ( libvsgpt_partition_type_identifier_definitions[ iterator ] ).identifier, 55 | libvsgpt_partition_type_identifier_unknown, 56 | 16 ) != 0 ) 57 | { 58 | if( memory_compare( 59 | ( libvsgpt_partition_type_identifier_definitions[ iterator ] ).identifier, 60 | partition_type_identifier, 61 | 16 ) == 0 ) 62 | { 63 | break; 64 | } 65 | iterator++; 66 | } 67 | return( 68 | ( libvsgpt_partition_type_identifier_definitions[ iterator ] ).description ); 69 | } 70 | 71 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_partition_type_identifier.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Partition type identifier functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_PARTITION_TYPE_IDENTIFIER_H ) 23 | #define _LIBVSGPT_PARTITION_TYPE_IDENTIFIER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_extern.h" 29 | #include "libvsgpt_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct libvsgpt_partition_type_identifier_definition libvsgpt_partition_type_identifier_definition_t; 36 | 37 | struct libvsgpt_partition_type_identifier_definition 38 | { 39 | /* The partition type identifier stored as a little endian GUID 40 | */ 41 | uint8_t *identifier; 42 | 43 | /* The partition type description 44 | */ 45 | const char *description; 46 | }; 47 | 48 | extern uint8_t libvsgpt_partition_type_identifier_linux_filesystem_data[ 16 ]; 49 | 50 | LIBVSGPT_EXTERN \ 51 | const char *libvsgpt_partition_type_identifier_get_description( 52 | const uint8_t *partition_type_identifier ); 53 | 54 | #if defined( __cplusplus ) 55 | } 56 | #endif 57 | 58 | #endif /* !defined( _LIBVSGPT_PARTITION_TYPE_IDENTIFIER_H ) */ 59 | 60 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_partition_values.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The partition values functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_PARTITION_VALUES_H ) 23 | #define _LIBVSGPT_PARTITION_VALUES_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvsgpt_partition_values libvsgpt_partition_values_t; 35 | 36 | struct libvsgpt_partition_values 37 | { 38 | /* The entry index 39 | */ 40 | uint32_t entry_index; 41 | 42 | /* The type identifier 43 | */ 44 | uint8_t type_identifier[ 16 ]; 45 | 46 | /* The identifier 47 | */ 48 | uint8_t identifier[ 16 ]; 49 | 50 | /* The type 51 | */ 52 | uint8_t type; 53 | 54 | /* The offset 55 | */ 56 | off64_t offset; 57 | 58 | /* The size 59 | */ 60 | size64_t size; 61 | }; 62 | 63 | int libvsgpt_partition_values_initialize( 64 | libvsgpt_partition_values_t **partition_values, 65 | libcerror_error_t **error ); 66 | 67 | int libvsgpt_partition_values_free( 68 | libvsgpt_partition_values_t **partition_values, 69 | libcerror_error_t **error ); 70 | 71 | int libvsgpt_partition_values_get_entry_index( 72 | libvsgpt_partition_values_t *partition_values, 73 | uint32_t *entry_index, 74 | libcerror_error_t **error ); 75 | 76 | int libvsgpt_partition_values_get_identifier( 77 | libvsgpt_partition_values_t *partition_values, 78 | uint8_t *guid_data, 79 | size_t guid_data_size, 80 | libcerror_error_t **error ); 81 | 82 | int libvsgpt_partition_values_get_type_identifier( 83 | libvsgpt_partition_values_t *partition_values, 84 | uint8_t *guid_data, 85 | size_t guid_data_size, 86 | libcerror_error_t **error ); 87 | 88 | int libvsgpt_partition_values_get_type( 89 | libvsgpt_partition_values_t *partition_values, 90 | uint8_t *type, 91 | libcerror_error_t **error ); 92 | 93 | int libvsgpt_partition_values_get_offset( 94 | libvsgpt_partition_values_t *partition_values, 95 | off64_t *offset, 96 | libcerror_error_t **error ); 97 | 98 | int libvsgpt_partition_values_get_size( 99 | libvsgpt_partition_values_t *partition_values, 100 | size64_t *size, 101 | libcerror_error_t **error ); 102 | 103 | #if defined( __cplusplus ) 104 | } 105 | #endif 106 | 107 | #endif /* !defined( _LIBVSGPT_PARTITION_VALUES_H ) */ 108 | 109 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_section_values.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The section values functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_SECTION_VALUES_H ) 23 | #define _LIBVSGPT_SECTION_VALUES_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | typedef struct libvsgpt_section_values libvsgpt_section_values_t; 35 | 36 | struct libvsgpt_section_values 37 | { 38 | /* The type 39 | */ 40 | uint8_t type; 41 | 42 | /* The offset 43 | */ 44 | off64_t offset; 45 | 46 | /* The size 47 | */ 48 | size64_t size; 49 | }; 50 | 51 | int libvsgpt_section_values_initialize( 52 | libvsgpt_section_values_t **section_values, 53 | libcerror_error_t **error ); 54 | 55 | int libvsgpt_section_values_free( 56 | libvsgpt_section_values_t **section_values, 57 | libcerror_error_t **error ); 58 | 59 | #if defined( __cplusplus ) 60 | } 61 | #endif 62 | 63 | #endif /* !defined( _LIBVSGPT_SECTION_VALUES_H ) */ 64 | 65 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_sector_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Chunk data functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_SECTOR_DATA_H ) 23 | #define _LIBVSGPT_SECTOR_DATA_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_libbfio.h" 29 | #include "libvsgpt_libcerror.h" 30 | #include "libvsgpt_libfdata.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct libvsgpt_sector_data libvsgpt_sector_data_t; 37 | 38 | struct libvsgpt_sector_data 39 | { 40 | /* The data 41 | */ 42 | uint8_t *data; 43 | 44 | /* The data size 45 | */ 46 | size_t data_size; 47 | }; 48 | 49 | int libvsgpt_sector_data_initialize( 50 | libvsgpt_sector_data_t **sector_data, 51 | size_t data_size, 52 | libcerror_error_t **error ); 53 | 54 | int libvsgpt_sector_data_free( 55 | libvsgpt_sector_data_t **sector_data, 56 | libcerror_error_t **error ); 57 | 58 | int libvsgpt_sector_data_read_file_io_handle( 59 | libvsgpt_sector_data_t *sector_data, 60 | libbfio_handle_t *file_io_handle, 61 | off64_t sector_offset, 62 | libcerror_error_t **error ); 63 | 64 | int libvsgpt_sector_data_read_element_data( 65 | intptr_t *data_handle, 66 | libbfio_handle_t *file_io_handle, 67 | libfdata_vector_t *vector, 68 | libfdata_cache_t *cache, 69 | int element_index, 70 | int element_data_file_index, 71 | off64_t element_data_offset, 72 | size64_t element_data_size, 73 | uint32_t element_data_flags, 74 | uint8_t read_flags, 75 | libcerror_error_t **error ); 76 | 77 | #if defined( __cplusplus ) 78 | } 79 | #endif 80 | 81 | #endif /* !defined( _LIBVSGPT_SECTOR_DATA_H ) */ 82 | 83 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Support functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_SUPPORT_H ) 23 | #define _LIBVSGPT_SUPPORT_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libvsgpt_extern.h" 29 | #include "libvsgpt_libbfio.h" 30 | #include "libvsgpt_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBVSGPT ) 37 | 38 | LIBVSGPT_EXTERN \ 39 | const char *libvsgpt_get_version( 40 | void ); 41 | 42 | LIBVSGPT_EXTERN \ 43 | int libvsgpt_get_access_flags_read( 44 | void ); 45 | 46 | LIBVSGPT_EXTERN \ 47 | int libvsgpt_get_access_flags_read_write( 48 | void ); 49 | 50 | LIBVSGPT_EXTERN \ 51 | int libvsgpt_get_access_flags_write( 52 | void ); 53 | 54 | LIBVSGPT_EXTERN \ 55 | int libvsgpt_get_codepage( 56 | int *codepage, 57 | libcerror_error_t **error ); 58 | 59 | LIBVSGPT_EXTERN \ 60 | int libvsgpt_set_codepage( 61 | int codepage, 62 | libcerror_error_t **error ); 63 | 64 | #endif /* !defined( HAVE_LOCAL_LIBVSGPT ) */ 65 | 66 | LIBVSGPT_EXTERN \ 67 | int libvsgpt_check_volume_signature( 68 | const char *filename, 69 | libcerror_error_t **error ); 70 | 71 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 72 | 73 | LIBVSGPT_EXTERN \ 74 | int libvsgpt_check_volume_signature_wide( 75 | const wchar_t *filename, 76 | libcerror_error_t **error ); 77 | 78 | #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ 79 | 80 | LIBVSGPT_EXTERN \ 81 | int libvsgpt_check_volume_signature_file_io_handle( 82 | libbfio_handle_t *file_io_handle, 83 | libcerror_error_t **error ); 84 | 85 | #if defined( __cplusplus ) 86 | } 87 | #endif 88 | 89 | #endif /* !defined( _LIBVSGPT_SUPPORT_H ) */ 90 | 91 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal type definitions 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_INTERNAL_TYPES_H ) 23 | #define _LIBVSGPT_INTERNAL_TYPES_H 24 | 25 | #include 26 | #include 27 | 28 | /* Define HAVE_LOCAL_LIBVSGPT for local use of libvsgpt 29 | * The definitions in are copied here 30 | * for local use of libvsgpt 31 | */ 32 | #if defined( HAVE_LOCAL_LIBVSGPT ) 33 | 34 | /* The following type definitions hide internal data structures 35 | */ 36 | #if defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) 37 | typedef struct libvsgpt_partition {} libvsgpt_partition_t; 38 | typedef struct libvsgpt_volume {} libvsgpt_volume_t; 39 | 40 | #else 41 | typedef intptr_t libvsgpt_partition_t; 42 | typedef intptr_t libvsgpt_volume_t; 43 | 44 | #endif /* defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) */ 45 | 46 | #endif /* defined( HAVE_LOCAL_LIBVSGPT ) */ 47 | 48 | /* The largest primary (or scalar) available 49 | * supported by a single load and store instruction 50 | */ 51 | typedef unsigned long int libvsgpt_aligned_t; 52 | 53 | #endif /* !defined( _LIBVSGPT_INTERNAL_TYPES_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /libvsgpt/libvsgpt_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2019-2024, 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( _LIBVSGPT_UNUSED_H ) 23 | #define _LIBVSGPT_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( LIBVSGPT_ATTRIBUTE_UNUSED ) 28 | #if defined( __GNUC__ ) && __GNUC__ >= 3 29 | #define LIBVSGPT_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 30 | #else 31 | #define LIBVSGPT_ATTRIBUTE_UNUSED 32 | #endif 33 | #endif 34 | 35 | #if defined( _MSC_VER ) 36 | #define LIBVSGPT_UNREFERENCED_PARAMETER( parameter ) \ 37 | UNREFERENCED_PARAMETER( parameter ); 38 | #else 39 | #define LIBVSGPT_UNREFERENCED_PARAMETER( parameter ) \ 40 | /* parameter */ 41 | #endif 42 | 43 | #endif /* !defined( _LIBVSGPT_UNUSED_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /libvsgpt/vsgpt_boot_record.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Master Boot Record (MBR) boot record definitions 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_BOOT_RECORD_H ) 23 | #define _VSGPT_BOOT_RECORD_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vsgpt_boot_record_classical vsgpt_boot_record_classical_t; 33 | 34 | struct vsgpt_boot_record_classical 35 | { 36 | /* Boot loader 37 | * Consists of 446 bytes 38 | */ 39 | uint8_t boot_loader[ 446 ]; 40 | 41 | /* Partition table 42 | * Consist of 64 bytes 43 | * Contains 4 x 16-byte partition entries 44 | */ 45 | uint8_t partition_entries[ 64 ]; 46 | 47 | /* The boot signature 48 | * Consists of 2 bytes 49 | * Contains 0x55 0xaa 50 | */ 51 | uint8_t boot_signature[ 2 ]; 52 | }; 53 | 54 | typedef struct vsgpt_boot_record_modern vsgpt_boot_record_modern_t; 55 | 56 | struct vsgpt_boot_record_modern 57 | { 58 | /* Boot loader 59 | * Consists of 440 bytes 60 | */ 61 | uint8_t boot_loader[ 440 ]; 62 | 63 | /* Disk identity 64 | * Consists of 4 bytes 65 | */ 66 | uint8_t disk_identity[ 4 ]; 67 | 68 | /* Padding 69 | * Consists of 2 bytes 70 | * Contains 0x00 71 | */ 72 | uint8_t padding[ 2 ]; 73 | 74 | /* Partition table 75 | * Consist of 64 bytes 76 | * Contains 4 x 16-byte partition entries 77 | */ 78 | uint8_t partition_entries[ 64 ]; 79 | 80 | /* The boot signature 81 | * Consists of 2 bytes 82 | * Contains 0x55 0xaa 83 | */ 84 | uint8_t boot_signature[ 2 ]; 85 | }; 86 | 87 | #if defined( __cplusplus ) 88 | } 89 | #endif 90 | 91 | #endif /* !defined( _VSGPT_BOOT_RECORD_H ) */ 92 | 93 | -------------------------------------------------------------------------------- /libvsgpt/vsgpt_mbr_partition_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Master Boot Record (MBR) partition entry definitions 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_MBR_PARTITION_ENTRY_H ) 23 | #define _VSGPT_MBR_PARTITION_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vsgpt_mbr_partition_entry vsgpt_mbr_partition_entry_t; 33 | 34 | struct vsgpt_mbr_partition_entry 35 | { 36 | /* Flags 37 | * Consists of 1 byte 38 | */ 39 | uint8_t flags; 40 | 41 | /* Partition start address in CHS 42 | * Consists of 3 bytes 43 | */ 44 | uint8_t start_address_chs[ 3 ]; 45 | 46 | /* Partition type 47 | * Consists of 1 byte 48 | */ 49 | uint8_t type; 50 | 51 | /* Partition end address in CHS 52 | * Consists of 3 bytes 53 | */ 54 | uint8_t end_address_chs[ 3 ]; 55 | 56 | /* Partition start address in LBA 57 | * Consists of 4 bytes 58 | */ 59 | uint8_t start_address_lba[ 4 ]; 60 | 61 | /* Partition number of sectors 62 | * Consists of 4 bytes 63 | */ 64 | uint8_t number_of_sectors[ 4 ]; 65 | }; 66 | 67 | #if defined( __cplusplus ) 68 | } 69 | #endif 70 | 71 | #endif /* !defined( _VSGPT_MBR_PARTITION_ENTRY_H ) */ 72 | 73 | -------------------------------------------------------------------------------- /libvsgpt/vsgpt_partition_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GUID Partition Table (GPT) partition entry definition 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_PARTITION_ENTRY_H ) 23 | #define _VSGPT_PARTITION_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vsgpt_partition_entry vsgpt_partition_entry_t; 33 | 34 | struct vsgpt_partition_entry 35 | { 36 | /* Partition type identifier 37 | * Consists of 16 bytes 38 | * Contains a GUID 39 | */ 40 | uint8_t type_identifier[ 16 ]; 41 | 42 | /* Partition identifier 43 | * Consists of 16 bytes 44 | * Contains a GUID 45 | */ 46 | uint8_t identifier[ 16 ]; 47 | 48 | /* Partition start block number 49 | * Consists of 8 bytes 50 | */ 51 | uint8_t start_block_number[ 8 ]; 52 | 53 | /* Partition end block number 54 | * Consists of 8 bytes 55 | */ 56 | uint8_t end_block_number[ 8 ]; 57 | 58 | /* Partition attribute flags 59 | * Consists of 8 bytes 60 | */ 61 | uint8_t attribute_flags[ 8 ]; 62 | 63 | /* Partition name 64 | * Consists of 72 bytes 65 | * Contains an UTF-16 little-endian string 66 | */ 67 | uint8_t name[ 72 ]; 68 | }; 69 | 70 | #if defined( __cplusplus ) 71 | } 72 | #endif 73 | 74 | #endif /* !defined( _VSGPT_PARTITION_ENTRY_H ) */ 75 | 76 | -------------------------------------------------------------------------------- /libvsgpt/vsgpt_partition_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GUID Partition Table (GPT) partition table definitions 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_PARTITION_TABLE_H ) 23 | #define _VSGPT_PARTITION_TABLE_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct vsgpt_partition_table_header vsgpt_partition_table_header_t; 33 | 34 | struct vsgpt_partition_table_header 35 | { 36 | /* Signature 37 | * Consists of 8 bytes 38 | * Contains "EFI PART" 39 | */ 40 | uint8_t signature[ 8 ]; 41 | 42 | /* Minor format version 43 | * Consists of 2 bytes 44 | */ 45 | uint8_t minor_format_version[ 2 ]; 46 | 47 | /* Major format version 48 | * Consists of 2 bytes 49 | */ 50 | uint8_t major_format_version[ 2 ]; 51 | 52 | /* Header data size 53 | * Consists of 4 bytes 54 | */ 55 | uint8_t header_data_size[ 4 ]; 56 | 57 | /* Header data checksum 58 | * Consists of 4 bytes 59 | */ 60 | uint8_t header_data_checksum[ 4 ]; 61 | 62 | /* Unknown (reserved) 63 | * Consists of 4 bytes 64 | */ 65 | uint8_t unknown1[ 4 ]; 66 | 67 | /* Partition header block number 68 | * Consists of 8 bytes 69 | */ 70 | uint8_t header_block_number[ 8 ]; 71 | 72 | /* Backup partition header block number 73 | * Consists of 8 bytes 74 | */ 75 | uint8_t backup_header_block_number[ 8 ]; 76 | 77 | /* Partition area start block number 78 | * Consists of 8 bytes 79 | */ 80 | uint8_t area_start_block_number[ 8 ]; 81 | 82 | /* Partition area end block number 83 | * Consists of 8 bytes 84 | */ 85 | uint8_t area_end_block_number[ 8 ]; 86 | 87 | /* Disk identifier 88 | * Consists of 16 bytes 89 | * Contains a GUID 90 | */ 91 | uint8_t disk_identifier[ 16 ]; 92 | 93 | /* Partition entries start block number 94 | * Consists of 8 bytes 95 | */ 96 | uint8_t entries_start_block_number[ 8 ]; 97 | 98 | /* Number of partition entries 99 | * Consists of 4 bytes 100 | */ 101 | uint8_t number_of_entries[ 4 ]; 102 | 103 | /* Partition entry data size 104 | * Consists of 4 bytes 105 | */ 106 | uint8_t entry_data_size[ 4 ]; 107 | 108 | /* Partition entries data checksum 109 | * Consists of 4 bytes 110 | */ 111 | uint8_t entries_data_checksum[ 4 ]; 112 | }; 113 | 114 | #if defined( __cplusplus ) 115 | } 116 | #endif 117 | 118 | #endif /* !defined( _VSGPT_PARTITION_TABLE_H ) */ 119 | 120 | -------------------------------------------------------------------------------- /m4/pthread.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for pthread 2 | dnl 3 | dnl Version: 20240513 4 | 5 | dnl Function to detect if pthread is available 6 | AC_DEFUN([AX_PTHREAD_CHECK_LIB], 7 | [AS_IF( 8 | [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_pthread" = xno], 9 | [ac_cv_pthread=no], 10 | [ac_cv_pthread=check 11 | dnl Check if parameters were provided 12 | dnl For both --with-pthread which returns "yes" and --with-pthread= which returns "" 13 | dnl treat them as auto-detection. 14 | AS_IF( 15 | [test "x$ac_cv_with_pthread" != x && test "x$ac_cv_with_pthread" != xauto-detect && test "x$ac_cv_with_pthread" != xyes], 16 | [AX_CHECK_LIB_DIRECTORY_EXISTS([pthread])]) 17 | ]) 18 | 19 | AS_IF( 20 | [test "x$ac_cv_pthread" = xcheck], 21 | [dnl Check for headers 22 | AC_CHECK_HEADERS([pthread.h]) 23 | 24 | AS_IF( 25 | [test "x$ac_cv_header_pthread_h" = xno], 26 | [ac_cv_pthread=no], 27 | [ac_cv_pthread=yes 28 | 29 | AX_CHECK_LIB_FUNCTIONS( 30 | [pthread], 31 | [pthread], 32 | [[pthread_create], 33 | [pthread_exit], 34 | [pthread_join], 35 | [pthread_cond_init], 36 | [pthread_cond_destroy], 37 | [pthread_cond_broadcast], 38 | [pthread_cond_signal], 39 | [pthread_cond_wait], 40 | [pthread_mutex_init], 41 | [pthread_mutex_destroy], 42 | [pthread_mutex_lock], 43 | [pthread_mutex_trylock], 44 | [pthread_mutex_unlock], 45 | [pthread_rwlock_init], 46 | [pthread_rwlock_destroy], 47 | [pthread_rwlock_rdlock], 48 | [pthread_rwlock_wrlock], 49 | [pthread_rwlock_unlock]]) 50 | 51 | ac_cv_pthread_LIBADD="-lpthread" 52 | ]) 53 | 54 | AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([pthread]) 55 | ]) 56 | 57 | AS_IF( 58 | [test "x$ac_cv_pthread" = xpthread], 59 | [AC_DEFINE( 60 | [HAVE_PTHREAD], 61 | [1], 62 | [Define to 1 if you have the 'pthread' library (-lpthread).]) 63 | ]) 64 | 65 | AS_IF( 66 | [test "x$ac_cv_pthread" != xno], 67 | [AC_SUBST( 68 | [HAVE_PTHREAD], 69 | [1]) ], 70 | [AC_SUBST( 71 | [HAVE_PTHREAD], 72 | [0]) 73 | ]) 74 | ]) 75 | 76 | dnl Function to detect how to enable pthread 77 | AC_DEFUN([AX_PTHREAD_CHECK_ENABLE], 78 | [AX_COMMON_ARG_WITH( 79 | [pthread], 80 | [pthread], 81 | [search for pthread in includedir and libdir or in the specified DIR, or no if not to use pthread], 82 | [auto-detect], 83 | [DIR]) 84 | 85 | dnl Check for a shared library version 86 | AX_PTHREAD_CHECK_LIB 87 | 88 | AS_IF( 89 | [test "x$ac_cv_pthread_CPPFLAGS" != "x"], 90 | [AC_SUBST( 91 | [PTHREAD_CPPFLAGS], 92 | [$ac_cv_pthread_CPPFLAGS]) 93 | ]) 94 | AS_IF( 95 | [test "x$ac_cv_pthread_LIBADD" != "x"], 96 | [AC_SUBST( 97 | [PTHREAD_LIBADD], 98 | [$ac_cv_pthread_LIBADD]) 99 | ]) 100 | 101 | AS_IF( 102 | [test "x$ac_cv_pthread" = xpthread], 103 | [AC_SUBST( 104 | [ax_pthread_pc_libs_private], 105 | [-lpthread]) 106 | ]) 107 | ]) 108 | 109 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /m4/types.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for type definitions 2 | dnl 3 | dnl Version: 20180727 4 | 5 | dnl Function to detect if type definitions are available 6 | AC_DEFUN([AX_TYPES_CHECK_LOCAL], 7 | [AS_IF( 8 | [test "x$ac_cv_enable_winapi" = xyes], 9 | [ac_cv_enable_wide_character_type=yes]) 10 | 11 | AS_IF( 12 | [test "x$ac_cv_enable_wide_character_type" = xyes], 13 | [AC_DEFINE( 14 | [HAVE_WIDE_CHARACTER_TYPE], 15 | [1], 16 | [Define to 1 if wide character type should be used.]) 17 | AC_SUBST( 18 | [HAVE_WIDE_CHARACTER_TYPE], 19 | [1]) ], 20 | [AC_SUBST( 21 | [HAVE_WIDE_CHARACTER_TYPE], 22 | [0]) 23 | ]) 24 | 25 | AC_CHECK_HEADERS([sys/types.h inttypes.h stdint.h wchar.h]) 26 | 27 | AS_IF( 28 | [test "x$ac_cv_header_sys_types_h" = xyes], 29 | [AC_SUBST( 30 | [HAVE_SYS_TYPES_H], 31 | [1])], 32 | [AC_SUBST( 33 | [HAVE_SYS_TYPES_H], 34 | [0]) 35 | ]) 36 | 37 | AS_IF( 38 | [test "x$ac_cv_header_inttypes_h" = xyes], 39 | [AC_SUBST( 40 | [HAVE_INTTYPES_H], 41 | [1])], 42 | [AC_SUBST( 43 | [HAVE_INTTYPES_H], 44 | [0]) 45 | ]) 46 | 47 | AS_IF( 48 | [test "x$ac_cv_header_stdint_h" = xyes], 49 | [AC_SUBST( 50 | [HAVE_STDINT_H], 51 | [1])], 52 | [AC_SUBST( 53 | [HAVE_STDINT_H], 54 | [0]) 55 | ]) 56 | 57 | AS_IF( 58 | [test "x$ac_cv_header_wchar_h" = xyes], 59 | [AC_SUBST( 60 | [HAVE_WCHAR_H], 61 | [1]) ], 62 | [AC_SUBST( 63 | [HAVE_WCHAR_H], 64 | [0]) 65 | ]) 66 | 67 | AC_TYPE_MODE_T 68 | AC_TYPE_OFF_T 69 | AC_TYPE_SIZE_T 70 | 71 | AC_CHECK_TYPE( 72 | [size32_t], 73 | [AC_SUBST( 74 | [HAVE_SIZE32_T], 75 | [1])], 76 | [AC_SUBST( 77 | [HAVE_SIZE32_T], 78 | [0]) 79 | ]) 80 | 81 | AC_CHECK_TYPE( 82 | [ssize32_t], 83 | [AC_SUBST( 84 | [HAVE_SSIZE32_T], 85 | [1])], 86 | [AC_SUBST( 87 | [HAVE_SSIZE32_T], 88 | [0]) 89 | ]) 90 | 91 | AC_CHECK_TYPE( 92 | [size64_t], 93 | [AC_SUBST( 94 | [HAVE_SIZE64_T], 95 | [1])], 96 | [AC_SUBST( 97 | [HAVE_SIZE64_T], 98 | [0]) 99 | ]) 100 | 101 | AC_CHECK_TYPE( 102 | [ssize64_t], 103 | [AC_SUBST( 104 | [HAVE_SSIZE64_T], 105 | [1])], 106 | [AC_SUBST( 107 | [HAVE_SSIZE64_T], 108 | [0]) 109 | ]) 110 | 111 | AC_CHECK_TYPE( 112 | [off64_t], 113 | [AC_SUBST( 114 | [HAVE_OFF64_T], 115 | [1])], 116 | [AC_SUBST( 117 | [HAVE_OFF64_T], 118 | [0]) 119 | ]) 120 | 121 | AC_CHECK_TYPE([ssize_t]) 122 | AC_CHECK_TYPE([u64]) 123 | 124 | AC_CHECK_SIZEOF([int]) 125 | AC_CHECK_SIZEOF([long]) 126 | AC_CHECK_SIZEOF([off_t]) 127 | AC_CHECK_SIZEOF([size_t]) 128 | 129 | AS_IF( 130 | [test "x$ac_cv_header_wchar_h" = xyes], 131 | [AC_CHECK_SIZEOF([wchar_t])]) 132 | ]) 133 | 134 | -------------------------------------------------------------------------------- /manuals/Makefile.am: -------------------------------------------------------------------------------- 1 | man_MANS = \ 2 | libvsgpt.3 \ 3 | vsgptinfo.1 4 | 5 | EXTRA_DIST = \ 6 | libvsgpt.3 \ 7 | vsgptinfo.1 8 | 9 | DISTCLEANFILES = \ 10 | Makefile \ 11 | Makefile.in 12 | 13 | -------------------------------------------------------------------------------- /manuals/vsgptinfo.1: -------------------------------------------------------------------------------- 1 | .Dd July 6, 2020 2 | .Dt vsgptinfo 3 | .Os libvsgpt 4 | .Sh NAME 5 | .Nm vsgptinfo 6 | .Nd determines information about a GUID Partition Table (GPT) volume system 7 | .Sh SYNOPSIS 8 | .Nm vsgptinfo 9 | .Op Fl hvV 10 | .Ar source 11 | .Sh DESCRIPTION 12 | .Nm vsgptinfo 13 | is a utility to determine information about a GUID Partition Table (GPT) volume system 14 | .Pp 15 | .Nm vsgptinfo 16 | is part of the 17 | .Nm libvsgpt 18 | package. 19 | .Nm libvsgpt 20 | is a library to access the GUID Partition Table (GPT) volume system 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 | # vsgptinfo /dev/sda 41 | vsgptinfo 20200706 42 | .sp 43 | GUID Partition Table (GPT) information: 44 | Bytes per sector : 512 45 | Number of partitions : 4 46 | .sp 47 | Partition: 1 48 | Type : 0x00 (Empty) 49 | Offset : 1048576 (0x00100000) 50 | Size : 65024 51 | .sp 52 | Partition: 2 53 | Type : 0x00 (Empty) 54 | Offset : 2097152 (0x00200000) 55 | Size : 65024 56 | .sp 57 | Partition: 3 58 | Type : 0x00 (Empty) 59 | Offset : 3145728 (0x00300000) 60 | Size : 65024 61 | .sp 62 | Partition: 4 63 | Type : 0x00 (Empty) 64 | Offset : 17408 (0x00004400) 65 | Size : 65024 66 | .sp 67 | .Ed 68 | .Sh DIAGNOSTICS 69 | Errors, verbose and debug output are printed to stderr when verbose output \-v is enabled. 70 | Verbose and debug output are only printed when enabled at compilation. 71 | .Sh BUGS 72 | Please report bugs of any kind to or on the project website: 73 | https://github.com/libyal/libvsgpt/ 74 | .Sh AUTHOR 75 | These man pages were written by Joachim Metz. 76 | .Sh COPYRIGHT 77 | Copyright (C) 2019-2024, Joachim Metz . 78 | This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 79 | -------------------------------------------------------------------------------- /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 | libvsgpt/libvsgpt.vcproj \ 16 | pyvsgpt/pyvsgpt.vcproj \ 17 | vsgpt_test_boot_record/vsgpt_test_boot_record.vcproj \ 18 | vsgpt_test_checksum/vsgpt_test_checksum.vcproj \ 19 | vsgpt_test_chs_address/vsgpt_test_chs_address.vcproj \ 20 | vsgpt_test_error/vsgpt_test_error.vcproj \ 21 | vsgpt_test_io_handle/vsgpt_test_io_handle.vcproj \ 22 | vsgpt_test_mbr_partition_entry/vsgpt_test_mbr_partition_entry.vcproj \ 23 | vsgpt_test_mbr_partition_type/vsgpt_test_mbr_partition_type.vcproj \ 24 | vsgpt_test_notify/vsgpt_test_notify.vcproj \ 25 | vsgpt_test_partition/vsgpt_test_partition.vcproj \ 26 | vsgpt_test_partition_entry/vsgpt_test_partition_entry.vcproj \ 27 | vsgpt_test_partition_table_header/vsgpt_test_partition_table_header.vcproj \ 28 | vsgpt_test_partition_type_identifier/vsgpt_test_partition_type_identifier.vcproj \ 29 | vsgpt_test_partition_values/vsgpt_test_partition_values.vcproj \ 30 | vsgpt_test_section_values/vsgpt_test_section_values.vcproj \ 31 | vsgpt_test_sector_data/vsgpt_test_sector_data.vcproj \ 32 | vsgpt_test_support/vsgpt_test_support.vcproj \ 33 | vsgpt_test_tools_info_handle/vsgpt_test_tools_info_handle.vcproj \ 34 | vsgpt_test_tools_output/vsgpt_test_tools_output.vcproj \ 35 | vsgpt_test_tools_signal/vsgpt_test_tools_signal.vcproj \ 36 | vsgpt_test_volume/vsgpt_test_volume.vcproj \ 37 | vsgptinfo/vsgptinfo.vcproj \ 38 | libvsgpt.sln 39 | 40 | EXTRA_DIST = \ 41 | $(MSVSCPP_FILES) 42 | 43 | DISTCLEANFILES = \ 44 | Makefile \ 45 | Makefile.in 46 | 47 | -------------------------------------------------------------------------------- /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 | partition_fuzzer \ 16 | volume_fuzzer 17 | 18 | partition_fuzzer_SOURCES = \ 19 | ossfuzz_libbfio.h \ 20 | ossfuzz_libvsgpt.h \ 21 | partition_fuzzer.cc 22 | 23 | partition_fuzzer_LDADD = \ 24 | @LIB_FUZZING_ENGINE@ \ 25 | @LIBBFIO_LIBADD@ \ 26 | @LIBCPATH_LIBADD@ \ 27 | @LIBCFILE_LIBADD@ \ 28 | @LIBUNA_LIBADD@ \ 29 | @LIBCDATA_LIBADD@ \ 30 | ../libvsgpt/libvsgpt.la \ 31 | @LIBCNOTIFY_LIBADD@ \ 32 | @LIBCLOCALE_LIBADD@ \ 33 | @LIBCERROR_LIBADD@ \ 34 | @LIBINTL@ 35 | 36 | volume_fuzzer_SOURCES = \ 37 | ossfuzz_libbfio.h \ 38 | ossfuzz_libvsgpt.h \ 39 | volume_fuzzer.cc 40 | 41 | volume_fuzzer_LDADD = \ 42 | @LIB_FUZZING_ENGINE@ \ 43 | @LIBBFIO_LIBADD@ \ 44 | @LIBCPATH_LIBADD@ \ 45 | @LIBCFILE_LIBADD@ \ 46 | @LIBUNA_LIBADD@ \ 47 | @LIBCDATA_LIBADD@ \ 48 | ../libvsgpt/libvsgpt.la \ 49 | @LIBCNOTIFY_LIBADD@ \ 50 | @LIBCLOCALE_LIBADD@ \ 51 | @LIBCERROR_LIBADD@ \ 52 | @LIBINTL@ 53 | endif 54 | 55 | DISTCLEANFILES = \ 56 | Makefile \ 57 | Makefile.in 58 | 59 | splint-local: 60 | @echo "Running splint on partition_fuzzer ..." 61 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(partition_fuzzer_SOURCES) 62 | @echo "Running splint on volume_fuzzer ..." 63 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(volume_fuzzer_SOURCES) 64 | 65 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libvsgpt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libvsgpt header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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_LIBVSGPT_H ) 23 | #define _OSSFUZZ_LIBVSGPT_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _OSSFUZZ_LIBVSGPT_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /ossfuzz/volume_fuzzer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * OSS-Fuzz target for libvsgpt volume type 3 | * 4 | * Copyright (C) 2019-2024, 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_libvsgpt.h" 31 | 32 | #if !defined( LIBVSGPT_HAVE_BFIO ) 33 | 34 | /* Opens a volume using a Basic File IO (bfio) handle 35 | * Returns 1 if successful or -1 on error 36 | */ 37 | LIBVSGPT_EXTERN \ 38 | int libvsgpt_volume_open_file_io_handle( 39 | libvsgpt_volume_t *volume, 40 | libbfio_handle_t *file_io_handle, 41 | int access_flags, 42 | libvsgpt_error_t **error ); 43 | 44 | #endif /* !defined( LIBVSGPT_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 | libvsgpt_volume_t *volume = 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( libvsgpt_volume_initialize( 68 | &volume, 69 | NULL ) != 1 ) 70 | { 71 | goto on_error_libbfio; 72 | } 73 | if( libvsgpt_volume_open_file_io_handle( 74 | volume, 75 | file_io_handle, 76 | LIBVSGPT_OPEN_READ, 77 | NULL ) != 1 ) 78 | { 79 | goto on_error_libvsgpt; 80 | } 81 | libvsgpt_volume_close( 82 | volume, 83 | NULL ); 84 | 85 | on_error_libvsgpt: 86 | libvsgpt_volume_free( 87 | &volume, 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 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-11-09 gettextize 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files which contain translatable strings. 2 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel"] 3 | build-backend = "setuptools.build_meta" 4 | 5 | -------------------------------------------------------------------------------- /pyvsgpt/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 | @LIBVSGPT_DLL_IMPORT@ 15 | 16 | pyexec_LTLIBRARIES = pyvsgpt.la 17 | 18 | pyvsgpt_la_SOURCES = \ 19 | pyvsgpt.c pyvsgpt.h \ 20 | pyvsgpt_error.c pyvsgpt_error.h \ 21 | pyvsgpt_file_object_io_handle.c pyvsgpt_file_object_io_handle.h \ 22 | pyvsgpt_guid.c pyvsgpt_guid.h \ 23 | pyvsgpt_integer.c pyvsgpt_integer.h \ 24 | pyvsgpt_libbfio.h \ 25 | pyvsgpt_libcerror.h \ 26 | pyvsgpt_libclocale.h \ 27 | pyvsgpt_libfguid.h \ 28 | pyvsgpt_libvsgpt.h \ 29 | pyvsgpt_partition.c pyvsgpt_partition.h \ 30 | pyvsgpt_partitions.c pyvsgpt_partitions.h \ 31 | pyvsgpt_python.h \ 32 | pyvsgpt_unused.h \ 33 | pyvsgpt_volume.c pyvsgpt_volume.h 34 | 35 | pyvsgpt_la_LIBADD = \ 36 | @LIBCERROR_LIBADD@ \ 37 | ../libvsgpt/libvsgpt.la \ 38 | @LIBCDATA_LIBADD@ \ 39 | @LIBCLOCALE_LIBADD@ \ 40 | @LIBCSPLIT_LIBADD@ \ 41 | @LIBUNA_LIBADD@ \ 42 | @LIBCFILE_LIBADD@ \ 43 | @LIBCPATH_LIBADD@ \ 44 | @LIBBFIO_LIBADD@ \ 45 | @LIBFGUID_LIBADD@ 46 | 47 | pyvsgpt_la_CPPFLAGS = $(PYTHON_CPPFLAGS) 48 | pyvsgpt_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) 49 | 50 | endif 51 | 52 | DISTCLEANFILES = \ 53 | Makefile \ 54 | Makefile.in 55 | 56 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Python bindings module for libvsgpt (pyvsgpt) 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_H ) 23 | #define _PYVSGPT_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvsgpt_python.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | PyObject *pyvsgpt_get_version( 35 | PyObject *self, 36 | PyObject *arguments ); 37 | 38 | PyObject *pyvsgpt_check_volume_signature( 39 | PyObject *self, 40 | PyObject *arguments, 41 | PyObject *keywords ); 42 | 43 | PyObject *pyvsgpt_check_volume_signature_file_object( 44 | PyObject *self, 45 | PyObject *arguments, 46 | PyObject *keywords ); 47 | 48 | PyObject *pyvsgpt_open_new_volume( 49 | PyObject *self, 50 | PyObject *arguments, 51 | PyObject *keywords ); 52 | 53 | PyObject *pyvsgpt_open_new_volume_with_file_object( 54 | PyObject *self, 55 | PyObject *arguments, 56 | PyObject *keywords ); 57 | 58 | #if PY_MAJOR_VERSION >= 3 59 | PyMODINIT_FUNC PyInit_pyvsgpt( 60 | void ); 61 | #else 62 | PyMODINIT_FUNC initpyvsgpt( 63 | void ); 64 | #endif 65 | 66 | #if defined( __cplusplus ) 67 | } 68 | #endif 69 | 70 | #endif /* !defined( _PYVSGPT_H ) */ 71 | 72 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_ERROR_H ) 23 | #define _PYVSGPT_ERROR_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvsgpt_libcerror.h" 29 | #include "pyvsgpt_python.h" 30 | 31 | #define PYVSGPT_ERROR_STRING_SIZE 2048 32 | 33 | #if defined( __cplusplus ) 34 | extern "C" { 35 | #endif 36 | 37 | void pyvsgpt_error_fetch( 38 | libcerror_error_t **error, 39 | int error_domain, 40 | int error_code, 41 | const char *format_string, 42 | ... ); 43 | 44 | void pyvsgpt_error_fetch_and_raise( 45 | PyObject *exception_object, 46 | const char *format_string, 47 | ... ); 48 | 49 | void pyvsgpt_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( _PYVSGPT_ERROR_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_guid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GUID functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_GUID_H ) 23 | #define _PYVSGPT_GUID_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvsgpt_python.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | PyObject *pyvsgpt_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( _PYVSGPT_GUID_H ) */ 43 | 44 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_integer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Integer functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_INTEGER_H ) 23 | #define _PYVSGPT_INTEGER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvsgpt_libcerror.h" 29 | #include "pyvsgpt_python.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | PyObject *pyvsgpt_integer_signed_new_from_64bit( 36 | int64_t value_64bit ); 37 | 38 | PyObject *pyvsgpt_integer_unsigned_new_from_64bit( 39 | uint64_t value_64bit ); 40 | 41 | int pyvsgpt_integer_signed_copy_to_64bit( 42 | PyObject *integer_object, 43 | int64_t *value_64bit, 44 | libcerror_error_t **error ); 45 | 46 | int pyvsgpt_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( _PYVSGPT_INTEGER_H ) */ 56 | 57 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_LIBBFIO_H ) 23 | #define _PYVSGPT_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( _PYVSGPT_LIBBFIO_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_LIBCERROR_H ) 23 | #define _PYVSGPT_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( _PYVSGPT_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_LIBCLOCALE_H ) 23 | #define _PYVSGPT_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( _PYVSGPT_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_libfguid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfguid header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_LIBFGUID_H ) 23 | #define _PYVSGPT_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( _PYVSGPT_LIBFGUID_H ) */ 49 | 50 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_libvsgpt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal libvsgpt header 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_LIBVSGPT_H ) 23 | #define _PYVSGPT_LIBVSGPT_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _PYVSGPT_LIBVSGPT_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_partitions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Python object definition of the sequence and iterator object of partitions 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_PARTITIONS_H ) 23 | #define _PYVSGPT_PARTITIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #include "pyvsgpt_libvsgpt.h" 29 | #include "pyvsgpt_python.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct pyvsgpt_partitions pyvsgpt_partitions_t; 36 | 37 | struct pyvsgpt_partitions 38 | { 39 | /* Python object initialization 40 | */ 41 | PyObject_HEAD 42 | 43 | /* The parent object 44 | */ 45 | PyObject *parent_object; 46 | 47 | /* The get item by index callback function 48 | */ 49 | PyObject* (*get_item_by_index)( 50 | PyObject *parent_object, 51 | int index ); 52 | 53 | /* The current index 54 | */ 55 | int current_index; 56 | 57 | /* The number of items 58 | */ 59 | int number_of_items; 60 | }; 61 | 62 | extern PyTypeObject pyvsgpt_partitions_type_object; 63 | 64 | PyObject *pyvsgpt_partitions_new( 65 | PyObject *parent_object, 66 | PyObject* (*get_item_by_index)( 67 | PyObject *parent_object, 68 | int index ), 69 | int number_of_items ); 70 | 71 | int pyvsgpt_partitions_init( 72 | pyvsgpt_partitions_t *sequence_object ); 73 | 74 | void pyvsgpt_partitions_free( 75 | pyvsgpt_partitions_t *sequence_object ); 76 | 77 | Py_ssize_t pyvsgpt_partitions_len( 78 | pyvsgpt_partitions_t *sequence_object ); 79 | 80 | PyObject *pyvsgpt_partitions_getitem( 81 | pyvsgpt_partitions_t *sequence_object, 82 | Py_ssize_t item_index ); 83 | 84 | PyObject *pyvsgpt_partitions_iter( 85 | pyvsgpt_partitions_t *sequence_object ); 86 | 87 | PyObject *pyvsgpt_partitions_iternext( 88 | pyvsgpt_partitions_t *sequence_object ); 89 | 90 | #if defined( __cplusplus ) 91 | } 92 | #endif 93 | 94 | #endif /* !defined( _PYVSGPT_PARTITIONS_H ) */ 95 | 96 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_python.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The python header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_PYTHON_H ) 23 | #define _PYVSGPT_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( _PYVSGPT_PYTHON_H ) */ 83 | 84 | -------------------------------------------------------------------------------- /pyvsgpt/pyvsgpt_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2019-2024, 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( _PYVSGPT_UNUSED_H ) 23 | #define _PYVSGPT_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( PYVSGPT_ATTRIBUTE_UNUSED ) 28 | #if defined( __GNUC__ ) && __GNUC__ >= 3 29 | #define PYVSGPT_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 30 | #else 31 | #define PYVSGPT_ATTRIBUTE_UNUSED 32 | #endif 33 | #endif 34 | 35 | #if defined( _MSC_VER ) 36 | #define PYVSGPT_UNREFERENCED_PARAMETER( parameter ) \ 37 | UNREFERENCED_PARAMETER( parameter ); 38 | #else 39 | #define PYVSGPT_UNREFERENCED_PARAMETER( parameter ) \ 40 | /* parameter */ 41 | #endif 42 | 43 | #endif /* !defined( _PYVSGPT_UNUSED_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /setup.cfg.in: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = libvsgpt-python 3 | version = @VERSION@ 4 | description = Python bindings module for libvsgpt 5 | long_description = Python bindings module for libvsgpt 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 COPYING.LESSER 11 | classifiers = 12 | Development Status :: 2 - Pre-Alpha 13 | Programming Language :: Python 14 | 15 | [options] 16 | python_requires = >=3.7 17 | -------------------------------------------------------------------------------- /synctestdata.ps1: -------------------------------------------------------------------------------- 1 | # Script that synchronizes the local test data 2 | # 3 | # Version: 20230709 4 | 5 | $TestSet = "public" 6 | $TestInputDirectory = "tests/input" 7 | $TestFiles = "gpt.raw" 8 | 9 | If (-Not (Test-Path ${TestInputDirectory})) 10 | { 11 | New-Item -Name ${TestInputDirectory} -ItemType "directory" | Out-Null 12 | } 13 | If (-Not (Test-Path "${TestInputDirectory}\${TestSet}")) 14 | { 15 | New-Item -Name "${TestInputDirectory}\${TestSet}" -ItemType "directory" | Out-Null 16 | } 17 | ForEach ($TestFile in ${TestFiles} -split " ") 18 | { 19 | $Url = "https://github.com/log2timeline/dfvfs/blob/main/test_data/${TestFile}?raw=true" 20 | 21 | Invoke-WebRequest -Uri ${Url} -OutFile "${TestInputDirectory}\${TestSet}\${TestFile}" 22 | } 23 | 24 | -------------------------------------------------------------------------------- /synctestdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script that synchronizes the local test data 3 | # 4 | # Version: 20161009 5 | 6 | TEST_SET="public"; 7 | TEST_INPUT_DIRECTORY="tests/input"; 8 | TEST_FILES="gpt.raw"; 9 | 10 | mkdir -p "${TEST_INPUT_DIRECTORY}/${TEST_SET}"; 11 | 12 | for TEST_FILE in ${TEST_FILES}; 13 | do 14 | URL="https://github.com/log2timeline/dfvfs/blob/main/test_data/${TEST_FILE}?raw=true"; 15 | 16 | curl -L -o "${TEST_INPUT_DIRECTORY}/${TEST_SET}/${TEST_FILE}" ${URL}; 17 | done 18 | 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/data/boot_record.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvsgpt/f8a5a46ed0ac6bdf482dc79ae0bad5463c03157e/tests/data/boot_record.1 -------------------------------------------------------------------------------- /tests/data/chs_address.1: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /tests/data/mbr_partition_entry.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvsgpt/f8a5a46ed0ac6bdf482dc79ae0bad5463c03157e/tests/data/mbr_partition_entry.1 -------------------------------------------------------------------------------- /tests/data/partition_entry.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvsgpt/f8a5a46ed0ac6bdf482dc79ae0bad5463c03157e/tests/data/partition_entry.1 -------------------------------------------------------------------------------- /tests/data/partition_table_header.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libvsgpt/f8a5a46ed0ac6bdf482dc79ae0bad5463c03157e/tests/data/partition_table_header.1 -------------------------------------------------------------------------------- /tests/lsan.suppressions: -------------------------------------------------------------------------------- 1 | leak:/lib*/libpython* 2 | -------------------------------------------------------------------------------- /tests/pkgbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to build a MacOS pkg 3 | # 4 | # Version: 20201121 5 | 6 | set -e 7 | 8 | make install DESTDIR=${PWD}/osx-pkg 9 | mkdir -p ${PWD}/osx-pkg/usr/share/doc/libvsgpt 10 | cp AUTHORS COPYING COPYING.LESSER NEWS README ${PWD}/osx-pkg/usr/share/doc/libvsgpt 11 | 12 | VERSION=`sed '5!d; s/^ \[//;s/\],$//' configure.ac` 13 | pkgbuild --root osx-pkg --identifier com.github.libyal.libvsgpt --version ${VERSION} --ownership recommended ../libvsgpt-${VERSION}.pkg 14 | 15 | -------------------------------------------------------------------------------- /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 = ".pyvsgpt" 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 | -------------------------------------------------------------------------------- /tests/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to run tests 3 | # 4 | # Version: 20201121 5 | 6 | if test -f ${PWD}/libvsgpt/.libs/libvsgpt.1.dylib && test -f ./pyvsgpt/.libs/pyvsgpt.so; 7 | then 8 | install_name_tool -change /usr/local/lib/libvsgpt.1.dylib ${PWD}/libvsgpt/.libs/libvsgpt.1.dylib ./pyvsgpt/.libs/pyvsgpt.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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/vsgpt_test_functions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Functions for testing 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_FUNCTIONS_H ) 23 | #define _VSGPT_TEST_FUNCTIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #include "vsgpt_test_libbfio.h" 29 | #include "vsgpt_test_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int vsgpt_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 vsgpt_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 vsgpt_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 vsgpt_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( _VSGPT_TEST_FUNCTIONS_H ) */ 66 | 67 | -------------------------------------------------------------------------------- /tests/vsgpt_test_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_GETOPT_H ) 23 | #define _VSGPT_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 vsgpt_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 vsgpt_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( _VSGPT_TEST_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /tests/vsgpt_test_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_LIBBFIO_H ) 23 | #define _VSGPT_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( _VSGPT_TEST_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /tests/vsgpt_test_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_LIBCERROR_H ) 23 | #define _VSGPT_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( _VSGPT_TEST_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/vsgpt_test_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_LIBCLOCALE_H ) 23 | #define _VSGPT_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( _VSGPT_TEST_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/vsgpt_test_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_LIBCNOTIFY_H ) 23 | #define _VSGPT_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( _VSGPT_TEST_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/vsgpt_test_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_LIBUNA_H ) 23 | #define _VSGPT_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( _VSGPT_TEST_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /tests/vsgpt_test_libvsgpt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libvsgpt header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_LIBVSGPT_H ) 23 | #define _VSGPT_TEST_LIBVSGPT_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _VSGPT_TEST_LIBVSGPT_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /tests/vsgpt_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory allocation functions for testing 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_MEMORY_H ) 23 | #define _VSGPT_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( LIBVSGPT_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __loongarch__ ) && !defined( __mips__ ) && !defined( __riscv ) && !defined( __sparc__ ) && !defined( HAVE_ASAN ) 32 | #define HAVE_VSGPT_TEST_MEMORY 1 33 | #endif 34 | 35 | #if defined( HAVE_VSGPT_TEST_MEMORY ) 36 | 37 | extern int vsgpt_test_malloc_attempts_before_fail; 38 | 39 | extern int vsgpt_test_memcpy_attempts_before_fail; 40 | 41 | extern int vsgpt_test_memset_attempts_before_fail; 42 | 43 | extern int vsgpt_test_realloc_attempts_before_fail; 44 | 45 | #endif /* defined( HAVE_VSGPT_TEST_MEMORY ) */ 46 | 47 | #if defined( __cplusplus ) 48 | } 49 | #endif 50 | 51 | #endif /* !defined( _VSGPT_TEST_MEMORY_H ) */ 52 | 53 | -------------------------------------------------------------------------------- /tests/vsgpt_test_partition_type_identifier.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library partition_type_identifier type test program 3 | * 4 | * Copyright (C) 2019-2024, 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 | #include 25 | 26 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 27 | #include 28 | #endif 29 | 30 | #include "vsgpt_test_libvsgpt.h" 31 | #include "vsgpt_test_macros.h" 32 | #include "vsgpt_test_unused.h" 33 | 34 | #include "../libvsgpt/libvsgpt_partition_type_identifier.h" 35 | 36 | #if defined( __GNUC__ ) && !defined( LIBVSGPT_DLL_IMPORT ) 37 | 38 | /* Tests the libvsgpt_partition_type_identifier_get_description function 39 | * Returns 1 if successful or 0 if not 40 | */ 41 | int vsgpt_test_partition_type_identifier_get_description( 42 | void ) 43 | { 44 | uint8_t guid_data[ 16 ]; 45 | 46 | const char *description = NULL; 47 | 48 | /* Test regular cases 49 | */ 50 | description = libvsgpt_partition_type_identifier_get_description( 51 | NULL ); 52 | 53 | VSGPT_TEST_ASSERT_IS_NOT_NULL( 54 | "description", 55 | description ); 56 | 57 | description = libvsgpt_partition_type_identifier_get_description( 58 | guid_data ); 59 | 60 | VSGPT_TEST_ASSERT_IS_NOT_NULL( 61 | "description", 62 | description ); 63 | 64 | return( 1 ); 65 | 66 | on_error: 67 | return( 0 ); 68 | } 69 | 70 | #endif /* defined( __GNUC__ ) && !defined( LIBVSGPT_DLL_IMPORT ) */ 71 | 72 | /* The main program 73 | */ 74 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 75 | int wmain( 76 | int argc VSGPT_TEST_ATTRIBUTE_UNUSED, 77 | wchar_t * const argv[] VSGPT_TEST_ATTRIBUTE_UNUSED ) 78 | #else 79 | int main( 80 | int argc VSGPT_TEST_ATTRIBUTE_UNUSED, 81 | char * const argv[] VSGPT_TEST_ATTRIBUTE_UNUSED ) 82 | #endif 83 | { 84 | VSGPT_TEST_UNREFERENCED_PARAMETER( argc ) 85 | VSGPT_TEST_UNREFERENCED_PARAMETER( argv ) 86 | 87 | #if defined( __GNUC__ ) && !defined( LIBVSGPT_DLL_IMPORT ) 88 | 89 | VSGPT_TEST_RUN( 90 | "libvsgpt_partition_type_identifier_get_description", 91 | vsgpt_test_partition_type_identifier_get_description ); 92 | 93 | #endif /* defined( __GNUC__ ) && !defined( LIBVSGPT_DLL_IMPORT ) */ 94 | 95 | return( EXIT_SUCCESS ); 96 | 97 | #if defined( __GNUC__ ) && !defined( LIBVSGPT_DLL_IMPORT ) 98 | 99 | on_error: 100 | return( EXIT_FAILURE ); 101 | 102 | #endif /* defined( __GNUC__ ) && !defined( LIBVSGPT_DLL_IMPORT ) */ 103 | } 104 | 105 | -------------------------------------------------------------------------------- /tests/vsgpt_test_rwlock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Read/Write lock functions for testing 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_RWLOCK_H ) 23 | #define _VSGPT_TEST_RWLOCK_H 24 | 25 | #include 26 | 27 | #include "vsgpt_test_libvsgpt.h" 28 | 29 | #if defined( __cplusplus ) 30 | extern "C" { 31 | #endif 32 | 33 | #if defined( LIBVSGPT_HAVE_MULTI_THREAD_SUPPORT ) && defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) 34 | #define HAVE_VSGPT_TEST_RWLOCK 1 35 | #endif 36 | 37 | #if defined( HAVE_VSGPT_TEST_RWLOCK ) 38 | 39 | extern int vsgpt_test_pthread_rwlock_init_attempts_before_fail; 40 | 41 | extern int vsgpt_test_pthread_rwlock_destroy_attempts_before_fail; 42 | 43 | extern int vsgpt_test_pthread_rwlock_rdlock_attempts_before_fail; 44 | 45 | extern int vsgpt_test_pthread_rwlock_wrlock_attempts_before_fail; 46 | 47 | extern int vsgpt_test_pthread_rwlock_unlock_attempts_before_fail; 48 | 49 | #endif /* defined( HAVE_VSGPT_TEST_RWLOCK ) */ 50 | 51 | #if defined( __cplusplus ) 52 | } 53 | #endif 54 | 55 | #endif /* !defined( _VSGPT_TEST_RWLOCK_H ) */ 56 | 57 | -------------------------------------------------------------------------------- /tests/vsgpt_test_tools_output.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Tools output functions test program 3 | * 4 | * Copyright (C) 2019-2024, 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 | #include 25 | 26 | #include 27 | 28 | #if defined( HAVE_IO_H ) || defined( WINAPI ) 29 | #include 30 | #endif 31 | 32 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 33 | #include 34 | #endif 35 | 36 | #include "vsgpt_test_libcerror.h" 37 | #include "vsgpt_test_macros.h" 38 | #include "vsgpt_test_unused.h" 39 | 40 | #include "../vsgpttools/vsgpttools_output.h" 41 | 42 | /* Tests the vsgpttools_output_initialize function 43 | * Returns 1 if successful or 0 if not 44 | */ 45 | int vsgpt_test_tools_output_initialize( 46 | void ) 47 | { 48 | libcerror_error_t *error = NULL; 49 | int result = 0; 50 | 51 | result = vsgpttools_output_initialize( 52 | _IONBF, 53 | &error ); 54 | 55 | VSGPT_TEST_ASSERT_EQUAL_INT( 56 | "result", 57 | result, 58 | 1 ); 59 | 60 | VSGPT_TEST_ASSERT_IS_NULL( 61 | "error", 62 | error ); 63 | 64 | return( 1 ); 65 | 66 | on_error: 67 | if( error != NULL ) 68 | { 69 | libcerror_error_free( 70 | &error ); 71 | } 72 | return( 0 ); 73 | } 74 | 75 | /* The main program 76 | */ 77 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 78 | int wmain( 79 | int argc VSGPT_TEST_ATTRIBUTE_UNUSED, 80 | wchar_t * const argv[] VSGPT_TEST_ATTRIBUTE_UNUSED ) 81 | #else 82 | int main( 83 | int argc VSGPT_TEST_ATTRIBUTE_UNUSED, 84 | char * const argv[] VSGPT_TEST_ATTRIBUTE_UNUSED ) 85 | #endif 86 | { 87 | VSGPT_TEST_UNREFERENCED_PARAMETER( argc ) 88 | VSGPT_TEST_UNREFERENCED_PARAMETER( argv ) 89 | 90 | VSGPT_TEST_RUN( 91 | "vsgpttools_output_initialize", 92 | vsgpt_test_tools_output_initialize ) 93 | 94 | /* TODO add tests for vsgpttools_output_copyright_fprint */ 95 | 96 | /* TODO add tests for vsgpttools_output_version_fprint */ 97 | 98 | /* TODO add tests for vsgpttools_output_version_detailed_fprint */ 99 | 100 | return( EXIT_SUCCESS ); 101 | 102 | on_error: 103 | return( EXIT_FAILURE ); 104 | } 105 | 106 | -------------------------------------------------------------------------------- /tests/vsgpt_test_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPT_TEST_UNUSED_H ) 23 | #define _VSGPT_TEST_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( VSGPT_TEST_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define VSGPT_TEST_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define VSGPT_TEST_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( VSGPT_TEST_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define VSGPT_TEST_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define VSGPT_TEST_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _VSGPT_TEST_UNUSED_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = auditwheel,py3{7,8,9,10,11,12} 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 libvsgpt-python 20 | python tests/runtests.py 21 | 22 | [testenv:auditwheel] 23 | usedevelop = True 24 | pip_pre = True 25 | deps = 26 | auditwheel 27 | setuptools >= 65 28 | commands = 29 | python -m auditwheel repair {posargs} 30 | -------------------------------------------------------------------------------- /vsgpttools/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 | @LIBFGUID_CPPFLAGS@ \ 14 | @LIBVSGPT_DLL_IMPORT@ 15 | 16 | AM_LDFLAGS = @STATIC_LDFLAGS@ 17 | 18 | bin_PROGRAMS = \ 19 | vsgptinfo 20 | 21 | vsgptinfo_SOURCES = \ 22 | info_handle.c info_handle.h \ 23 | vsgpttools_getopt.c vsgpttools_getopt.h \ 24 | vsgpttools_i18n.h \ 25 | vsgptinfo.c \ 26 | vsgpttools_libbfio.h \ 27 | vsgpttools_libcerror.h \ 28 | vsgpttools_libclocale.h \ 29 | vsgpttools_libcnotify.h \ 30 | vsgpttools_libfguid.h \ 31 | vsgpttools_libuna.h \ 32 | vsgpttools_libvsgpt.h \ 33 | vsgpttools_output.c vsgpttools_output.h \ 34 | vsgpttools_signal.c vsgpttools_signal.h \ 35 | vsgpttools_unused.h 36 | 37 | vsgptinfo_LDADD = \ 38 | @LIBFGUID_LIBADD@ \ 39 | @LIBUNA_LIBADD@ \ 40 | ../libvsgpt/libvsgpt.la \ 41 | @LIBCNOTIFY_LIBADD@ \ 42 | @LIBCLOCALE_LIBADD@ \ 43 | @LIBCERROR_LIBADD@ \ 44 | @LIBINTL@ 45 | 46 | DISTCLEANFILES = \ 47 | Makefile \ 48 | Makefile.in 49 | 50 | splint-local: 51 | @echo "Running splint on vsgptinfo ..." 52 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(vsgptinfo_SOURCES) 53 | 54 | -------------------------------------------------------------------------------- /vsgpttools/info_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Info handle 3 | * 4 | * Copyright (C) 2019-2024, 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 "vsgpttools_libcerror.h" 30 | #include "vsgpttools_libvsgpt.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct info_handle info_handle_t; 37 | 38 | struct info_handle 39 | { 40 | /* The libvsgpt input volume 41 | */ 42 | libvsgpt_volume_t *input_volume; 43 | 44 | /* The notification output stream 45 | */ 46 | FILE *notify_stream; 47 | 48 | /* Value to indicate if abort was signalled 49 | */ 50 | int abort; 51 | }; 52 | 53 | int info_handle_initialize( 54 | info_handle_t **info_handle, 55 | libcerror_error_t **error ); 56 | 57 | int info_handle_free( 58 | info_handle_t **info_handle, 59 | libcerror_error_t **error ); 60 | 61 | int info_handle_signal_abort( 62 | info_handle_t *info_handle, 63 | libcerror_error_t **error ); 64 | 65 | int info_handle_open_input( 66 | info_handle_t *info_handle, 67 | const system_character_t *filename, 68 | libcerror_error_t **error ); 69 | 70 | int info_handle_close_input( 71 | info_handle_t *info_handle, 72 | libcerror_error_t **error ); 73 | 74 | int info_handle_guid_value_fprint( 75 | info_handle_t *info_handle, 76 | const char *value_name, 77 | const uint8_t *guid_data, 78 | libcerror_error_t **error ); 79 | 80 | int info_handle_partition_type_fprint( 81 | info_handle_t *info_handle, 82 | uint8_t partition_type, 83 | libcerror_error_t **error ); 84 | 85 | int info_handle_partition_fprint( 86 | info_handle_t *info_handle, 87 | libvsgpt_partition_t *partition, 88 | libcerror_error_t **error ); 89 | 90 | int info_handle_partitions_fprint( 91 | info_handle_t *info_handle, 92 | libcerror_error_t **error ); 93 | 94 | #if defined( __cplusplus ) 95 | } 96 | #endif 97 | 98 | #endif /* !defined( _INFO_HANDLE_H ) */ 99 | 100 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_GETOPT_H ) 23 | #define _VSGPTTOOLS_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 vsgpttools_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 vsgpttools_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( _VSGPTTOOLS_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_i18n.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Internationalization (i18n) functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_I18N_H ) 23 | #define _VSGPTTOOLS_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( _VSGPTTOOLS_I18N_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_LIBBFIO_H ) 23 | #define _VSGPTTOOLS_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( _VSGPTTOOLS_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_LIBCERROR_H ) 23 | #define _VSGPTTOOLS_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( _VSGPTTOOLS_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_LIBCLOCALE_H ) 23 | #define _VSGPTTOOLS_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( _VSGPTTOOLS_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_LIBCNOTIFY_H ) 23 | #define _VSGPTTOOLS_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( _VSGPTTOOLS_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_libfguid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfguid header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_LIBFGUID_H ) 23 | #define _VSGPTTOOLS_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( _VSGPTTOOLS_LIBFGUID_H ) */ 49 | 50 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_LIBUNA_H ) 23 | #define _VSGPTTOOLS_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( _VSGPTTOOLS_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_libvsgpt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libvsgpt header wrapper 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_LIBVSGPT_H ) 23 | #define _VSGPTTOOLS_LIBVSGPT_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _VSGPTTOOLS_LIBVSGPT_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_output.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common output functions for the vsgpttools 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_OUTPUT_H ) 23 | #define _VSGPTTOOLS_OUTPUT_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "vsgpttools_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int vsgpttools_output_initialize( 36 | int stdio_mode, 37 | libcerror_error_t **error ); 38 | 39 | void vsgpttools_output_copyright_fprint( 40 | FILE *stream ); 41 | 42 | void vsgpttools_output_version_fprint( 43 | FILE *stream, 44 | const char *program ); 45 | 46 | void vsgpttools_output_version_detailed_fprint( 47 | FILE *stream, 48 | const char *program ); 49 | 50 | #if defined( __cplusplus ) 51 | } 52 | #endif 53 | 54 | #endif /* !defined( _VSGPTTOOLS_OUTPUT_H ) */ 55 | 56 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Signal handling functions 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_SIGNAL_H ) 23 | #define _VSGPTTOOLS_SIGNAL_H 24 | 25 | #include 26 | #include 27 | 28 | #include "vsgpttools_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 vsgpttools_signal_t; 40 | 41 | #else 42 | typedef int vsgpttools_signal_t; 43 | 44 | #endif /* defined( WINAPI ) */ 45 | 46 | #if defined( WINAPI ) 47 | 48 | BOOL WINAPI vsgpttools_signal_handler( 49 | vsgpttools_signal_t signal ); 50 | 51 | #if defined( _MSC_VER ) 52 | 53 | void vsgpttools_signal_initialize_memory_debug( 54 | void ); 55 | 56 | #endif /* defined( _MSC_VER ) */ 57 | 58 | #endif /* defined( WINAPI ) */ 59 | 60 | int vsgpttools_signal_attach( 61 | void (*signal_handler)( vsgpttools_signal_t ), 62 | libcerror_error_t **error ); 63 | 64 | int vsgpttools_signal_detach( 65 | libcerror_error_t **error ); 66 | 67 | #if defined( __cplusplus ) 68 | } 69 | #endif 70 | 71 | #endif /* !defined( _VSGPTTOOLS_SIGNAL_H ) */ 72 | 73 | -------------------------------------------------------------------------------- /vsgpttools/vsgpttools_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2019-2024, 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( _VSGPTTOOLS_UNUSED_H ) 23 | #define _VSGPTTOOLS_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( VSGPTTOOLS_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define VSGPTTOOLS_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define VSGPTTOOLS_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( VSGPTTOOLS_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define VSGPTTOOLS_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define VSGPTTOOLS_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _VSGPTTOOLS_UNUSED_H ) */ 50 | 51 | --------------------------------------------------------------------------------