Repository: libyal/libfsrefs Branch: main Commit: ff13b26839b9 Files: 299 Total size: 1.9 MB Directory structure: gitextract_vkfx4bi5/ ├── .codecov.yml ├── .github/ │ └── workflows/ │ ├── build.yml │ ├── build_freebsd.yml │ ├── build_macos.yml │ ├── build_ossfuzz.yml │ └── build_shared.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/ │ └── Resilient File System (ReFS).asciidoc ├── dpkg/ │ ├── changelog.in │ ├── compat │ ├── control │ ├── copyright │ ├── libfsrefs-dev.install │ ├── libfsrefs-tools.install │ ├── libfsrefs.install │ ├── rules │ └── source/ │ └── format ├── fsrefstools/ │ ├── Makefile.am │ ├── fsrefsinfo.c │ ├── fsrefstools_getopt.c │ ├── fsrefstools_getopt.h │ ├── fsrefstools_i18n.h │ ├── fsrefstools_libbfio.h │ ├── fsrefstools_libcerror.h │ ├── fsrefstools_libclocale.h │ ├── fsrefstools_libcnotify.h │ ├── fsrefstools_libfcache.h │ ├── fsrefstools_libfdata.h │ ├── fsrefstools_libfdatetime.h │ ├── fsrefstools_libfguid.h │ ├── fsrefstools_libfsrefs.h │ ├── fsrefstools_libfwnt.h │ ├── fsrefstools_libuna.h │ ├── fsrefstools_output.c │ ├── fsrefstools_output.h │ ├── fsrefstools_signal.c │ ├── fsrefstools_signal.h │ ├── fsrefstools_unused.h │ ├── info_handle.c │ └── info_handle.h ├── include/ │ ├── Makefile.am │ ├── libfsrefs/ │ │ ├── codepage.h │ │ ├── definitions.h.in │ │ ├── error.h │ │ ├── extern.h │ │ ├── features.h.in │ │ └── types.h.in │ └── libfsrefs.h.in ├── libfsrefs/ │ ├── Makefile.am │ ├── fsrefs_checkpoint.h │ ├── fsrefs_directory_object.h │ ├── fsrefs_metadata_block.h │ ├── fsrefs_ministore_tree.h │ ├── fsrefs_superblock.h │ ├── fsrefs_volume_header.h │ ├── libfsrefs.c │ ├── libfsrefs.rc.in │ ├── libfsrefs_attribute_values.c │ ├── libfsrefs_attribute_values.h │ ├── libfsrefs_block_descriptor.c │ ├── libfsrefs_block_descriptor.h │ ├── libfsrefs_block_reference.c │ ├── libfsrefs_block_reference.h │ ├── libfsrefs_block_tree.c │ ├── libfsrefs_block_tree.h │ ├── libfsrefs_block_tree_node.c │ ├── libfsrefs_block_tree_node.h │ ├── libfsrefs_checkpoint.c │ ├── libfsrefs_checkpoint.h │ ├── libfsrefs_data_run.c │ ├── libfsrefs_data_run.h │ ├── libfsrefs_debug.c │ ├── libfsrefs_debug.h │ ├── libfsrefs_definitions.h.in │ ├── libfsrefs_directory_entry.c │ ├── libfsrefs_directory_entry.h │ ├── libfsrefs_directory_object.c │ ├── libfsrefs_directory_object.h │ ├── libfsrefs_error.c │ ├── libfsrefs_error.h │ ├── libfsrefs_extern.h │ ├── libfsrefs_file_entry.c │ ├── libfsrefs_file_entry.h │ ├── libfsrefs_file_system.c │ ├── libfsrefs_file_system.h │ ├── libfsrefs_io_handle.c │ ├── libfsrefs_io_handle.h │ ├── libfsrefs_libbfio.h │ ├── libfsrefs_libcdata.h │ ├── libfsrefs_libcerror.h │ ├── libfsrefs_libclocale.h │ ├── libfsrefs_libcnotify.h │ ├── libfsrefs_libcthreads.h │ ├── libfsrefs_libfcache.h │ ├── libfsrefs_libfdata.h │ ├── libfsrefs_libfdatetime.h │ ├── libfsrefs_libfguid.h │ ├── libfsrefs_libfwnt.h │ ├── libfsrefs_libuna.h │ ├── libfsrefs_metadata_block_header.c │ ├── libfsrefs_metadata_block_header.h │ ├── libfsrefs_ministore_node.c │ ├── libfsrefs_ministore_node.h │ ├── libfsrefs_node_header.c │ ├── libfsrefs_node_header.h │ ├── libfsrefs_node_record.c │ ├── libfsrefs_node_record.h │ ├── libfsrefs_notify.c │ ├── libfsrefs_notify.h │ ├── libfsrefs_objects_tree.c │ ├── libfsrefs_objects_tree.h │ ├── libfsrefs_superblock.c │ ├── libfsrefs_superblock.h │ ├── libfsrefs_support.c │ ├── libfsrefs_support.h │ ├── libfsrefs_tree_header.c │ ├── libfsrefs_tree_header.h │ ├── libfsrefs_types.h │ ├── libfsrefs_unused.h │ ├── libfsrefs_volume.c │ ├── libfsrefs_volume.h │ ├── libfsrefs_volume_header.c │ └── libfsrefs_volume_header.h ├── libfsrefs.ini ├── libfsrefs.pc.in ├── libfsrefs.spec.in ├── 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 │ ├── libfdatetime.m4 │ ├── libfguid.m4 │ ├── libfusn.m4 │ ├── libfwnt.m4 │ ├── libuna.m4 │ ├── pthread.m4 │ ├── tests.m4 │ └── types.m4 ├── manuals/ │ ├── Makefile.am │ ├── fsrefsinfo.1 │ └── libfsrefs.3 ├── msvscpp/ │ ├── Makefile.am │ ├── fsrefs_test_attribute_values/ │ │ └── fsrefs_test_attribute_values.vcproj │ ├── fsrefs_test_block_descriptor/ │ │ └── fsrefs_test_block_descriptor.vcproj │ ├── fsrefs_test_block_reference/ │ │ └── fsrefs_test_block_reference.vcproj │ ├── fsrefs_test_block_tree/ │ │ └── fsrefs_test_block_tree.vcproj │ ├── fsrefs_test_block_tree_node/ │ │ └── fsrefs_test_block_tree_node.vcproj │ ├── fsrefs_test_checkpoint/ │ │ └── fsrefs_test_checkpoint.vcproj │ ├── fsrefs_test_data_run/ │ │ └── fsrefs_test_data_run.vcproj │ ├── fsrefs_test_directory_entry/ │ │ └── fsrefs_test_directory_entry.vcproj │ ├── fsrefs_test_directory_object/ │ │ └── fsrefs_test_directory_object.vcproj │ ├── fsrefs_test_error/ │ │ └── fsrefs_test_error.vcproj │ ├── fsrefs_test_file_entry/ │ │ └── fsrefs_test_file_entry.vcproj │ ├── fsrefs_test_file_system/ │ │ └── fsrefs_test_file_system.vcproj │ ├── fsrefs_test_io_handle/ │ │ └── fsrefs_test_io_handle.vcproj │ ├── fsrefs_test_metadata_block_header/ │ │ └── fsrefs_test_metadata_block_header.vcproj │ ├── fsrefs_test_ministore_node/ │ │ └── fsrefs_test_ministore_node.vcproj │ ├── fsrefs_test_node_header/ │ │ └── fsrefs_test_node_header.vcproj │ ├── fsrefs_test_node_record/ │ │ └── fsrefs_test_node_record.vcproj │ ├── fsrefs_test_notify/ │ │ └── fsrefs_test_notify.vcproj │ ├── fsrefs_test_objects_tree/ │ │ └── fsrefs_test_objects_tree.vcproj │ ├── fsrefs_test_superblock/ │ │ └── fsrefs_test_superblock.vcproj │ ├── fsrefs_test_support/ │ │ └── fsrefs_test_support.vcproj │ ├── fsrefs_test_tools_info_handle/ │ │ └── fsrefs_test_tools_info_handle.vcproj │ ├── fsrefs_test_tools_output/ │ │ └── fsrefs_test_tools_output.vcproj │ ├── fsrefs_test_tools_signal/ │ │ └── fsrefs_test_tools_signal.vcproj │ ├── fsrefs_test_tree_header/ │ │ └── fsrefs_test_tree_header.vcproj │ ├── fsrefs_test_volume/ │ │ └── fsrefs_test_volume.vcproj │ ├── fsrefs_test_volume_header/ │ │ └── fsrefs_test_volume_header.vcproj │ ├── fsrefsinfo/ │ │ └── fsrefsinfo.vcproj │ ├── 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 │ ├── libfdatetime/ │ │ └── libfdatetime.vcproj │ ├── libfguid/ │ │ └── libfguid.vcproj │ ├── libfsrefs/ │ │ └── libfsrefs.vcproj │ ├── libfsrefs.sln │ ├── libfusn/ │ │ └── libfusn.vcproj │ ├── libfwnt/ │ │ └── libfwnt.vcproj │ └── libuna/ │ └── libuna.vcproj ├── ossfuzz/ │ ├── Makefile.am │ ├── ossfuzz_libbfio.h │ ├── ossfuzz_libfsrefs.h │ └── volume_fuzzer.cc ├── po/ │ ├── ChangeLog │ ├── Makevars.in │ └── POTFILES.in ├── runtests.ps1 ├── runtests.sh ├── synclibs.ps1 ├── synclibs.sh └── tests/ ├── Makefile.am ├── build.sh ├── data/ │ ├── block_descriptor.1 │ ├── block_descriptor.2 │ ├── checkpoint.1 │ ├── checkpoint.2 │ ├── data_run.1 │ ├── node_header.1 │ ├── node_record.1 │ ├── superblock.1 │ ├── superblock.2 │ ├── tree_header.1 │ └── volume_header.1 ├── fsrefs_test_attribute_values.c ├── fsrefs_test_block_descriptor.c ├── fsrefs_test_block_reference.c ├── fsrefs_test_block_tree.c ├── fsrefs_test_block_tree_node.c ├── fsrefs_test_checkpoint.c ├── fsrefs_test_data_run.c ├── fsrefs_test_directory_entry.c ├── fsrefs_test_directory_object.c ├── fsrefs_test_error.c ├── fsrefs_test_file_entry.c ├── fsrefs_test_file_system.c ├── fsrefs_test_functions.c ├── fsrefs_test_functions.h ├── fsrefs_test_getopt.c ├── fsrefs_test_getopt.h ├── fsrefs_test_io_handle.c ├── fsrefs_test_libbfio.h ├── fsrefs_test_libcerror.h ├── fsrefs_test_libclocale.h ├── fsrefs_test_libcnotify.h ├── fsrefs_test_libfsrefs.h ├── fsrefs_test_libuna.h ├── fsrefs_test_macros.h ├── fsrefs_test_memory.c ├── fsrefs_test_memory.h ├── fsrefs_test_metadata_block_header.c ├── fsrefs_test_ministore_node.c ├── fsrefs_test_ministore_tree.c ├── fsrefs_test_node_header.c ├── fsrefs_test_node_record.c ├── fsrefs_test_notify.c ├── fsrefs_test_objects_tree.c ├── fsrefs_test_superblock.c ├── fsrefs_test_support.c ├── fsrefs_test_tools_info_handle.c ├── fsrefs_test_tools_output.c ├── fsrefs_test_tools_signal.c ├── fsrefs_test_tree_header.c ├── fsrefs_test_unused.h ├── fsrefs_test_volume.c ├── fsrefs_test_volume_header.c ├── lsan.suppressions ├── pkgbuild.sh ├── runtests.sh ├── syncsharedlibs.sh ├── test_fsrefsinfo.ps1 ├── test_fsrefsinfo.sh ├── test_library.ps1 ├── test_library.sh ├── test_manpage.sh ├── test_runner.sh ├── test_tools.ps1 └── test_tools.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .codecov.yml ================================================ coverage: precision: 2 round: down range: 70...100 status: project: true patch: true changes: false ignore: - "libbfio/*" - "libcdata/*" - "libcerror/*" - "libcfile/*" - "libclocale/*" - "libcnotify/*" - "libcpath/*" - "libcsplit/*" - "libcthreads/*" - "libfcache/*" - "libfdata/*" - "libfdatetime/*" - "libfguid/*" - "libfusn/*" - "libfwnt/*" - "libuna/*" - "tests/*" ================================================ FILE: .github/workflows/build.yml ================================================ # Build from source. name: build on: [push, pull_request] permissions: read-all jobs: build_ubuntu: runs-on: ubuntu-22.04 strategy: matrix: include: - architecture: 'x86' compiler: 'clang' configure_options: '' - architecture: 'x64' compiler: 'clang' configure_options: '' - architecture: 'x86' compiler: 'gcc' configure_options: '' - architecture: 'x64' compiler: 'gcc' configure_options: '' - architecture: 'x64' compiler: 'gcc' configure_options: '--with-pthread=no' - architecture: 'x64' compiler: 'gcc' configure_options: '--enable-wide-character-type' - architecture: 'x64' compiler: 'gcc' configure_options: '--enable-static-executables=yes --enable-multi-threading-support=no' steps: - uses: actions/checkout@v4 - name: Install build dependencies run: | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config - name: Download test data run: | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi - name: Building from source env: CC: ${{ matrix.compiler }} run: | tests/build.sh ${{ matrix.configure_options }} - name: Run tests run: | tests/runtests.sh build_dist: runs-on: ubuntu-22.04 strategy: matrix: include: - architecture: 'x64' compiler: 'gcc' configure_options: '' steps: - uses: actions/checkout@v4 - name: Install build dependencies run: | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config - name: Download test data run: | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi - name: Building from source env: CC: ${{ matrix.compiler }} run: | tests/build.sh ${{ matrix.configure_options }} - name: Run tests run: | make distcheck coverage_ubuntu: runs-on: ubuntu-22.04 strategy: matrix: include: - architecture: 'x86' compiler: 'gcc' configure_options: '--enable-wide-character-type' - architecture: 'x64' compiler: 'gcc' configure_options: '--enable-wide-character-type' steps: - uses: actions/checkout@v4 - name: Install build dependencies run: | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config - name: Download test data run: | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi - name: Building from source env: CC: ${{ matrix.compiler }} run: | tests/build.sh ${{ matrix.configure_options }} --enable-shared=no CFLAGS="--coverage -O0" CPPFLAGS="-DOPTIMIZATION_DISABLED" LDFLAGS="--coverage" - name: Run tests run: | make check CHECK_WITH_STDERR=1 SKIP_TOOLS_END_TO_END_TESTS=1 - name: Generate coverage data run: | for DIRECTORY in `find . -maxdepth 1 -type d`; do \ (cd ${DIRECTORY} && find . -maxdepth 1 -name \*.gcno -type f -exec gcov -pb {} \;) \ done - name: Upload coverage report to Codecov uses: codecov/codecov-action@v4 with: name: linux-${{ matrix.architecture }}-gcc-no-optimization token: ${{ secrets.CODECOV_TOKEN }} ================================================ FILE: .github/workflows/build_freebsd.yml ================================================ # Build from source on FreeBSD. name: build_freebsd on: [push] permissions: read-all jobs: build_freebsd: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Building from source id: build_freebsd uses: vmactions/freebsd-vm@v1 with: usesh: true mem: 4096 # Note that the test scripts require bash prepare: | pkg install -y autoconf automake bash gettext git libtool pkgconf run: | tests/build.sh tests/runtests.sh ================================================ FILE: .github/workflows/build_macos.yml ================================================ # Build from source. name: build_macos on: [push, pull_request] permissions: read-all jobs: build_macos: runs-on: ${{ matrix.os }} strategy: matrix: include: - os: macos-14 configure_options: '' - os: macos-15 configure_options: '' - os: macos-15-intel configure_options: '' - os: macos-26 configure_options: '' steps: - uses: actions/checkout@v4 - name: Install build dependencies run: | brew update -q brew install -q autoconf automake gettext gnu-sed libtool pkg-config || true brew link --force gettext ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize - name: Download test data run: | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi - name: Building from source env: CC: ${{ matrix.compiler }} run: | tests/build.sh ${{ matrix.configure_options }} - name: Run tests run: | tests/runtests.sh ================================================ FILE: .github/workflows/build_ossfuzz.yml ================================================ # Build OSSFuzz fuzz targets from source. name: build_ossfuzz on: push: branches: [main] permissions: read-all jobs: build_ossfuzz: runs-on: ubuntu-22.04 strategy: matrix: include: - architecture: 'x64' compiler: 'gcc' configure_options: '' steps: - name: Install build dependencies run: | sudo apt-get -y install git - uses: actions/checkout@v4 with: repository: google/oss-fuzz path: oss-fuzz - name: Build OSSFuzz fuzz targets working-directory: oss-fuzz run: | mkdir -p projects/libfsrefs cp projects/libyal/build.sh projects/libfsrefs/ cp projects/libyal/project.yaml projects/libfsrefs/ head -n 20 projects/libyal/Dockerfile > projects/libfsrefs/Dockerfile echo "RUN git clone --depth 1 https://github.com/libyal/libfsrefs.git libfsrefs" >> projects/libfsrefs/Dockerfile tail -n 3 projects/libyal/Dockerfile >> projects/libfsrefs/Dockerfile python3 infra/helper.py build_image --pull libfsrefs python3 infra/helper.py build_fuzzers --sanitizer address libfsrefs python3 infra/helper.py check_build libfsrefs ================================================ FILE: .github/workflows/build_shared.yml ================================================ # Build from source with libyal dependencies as shared libraries. name: build_shared on: push: branches: [main] permissions: read-all jobs: build_shared_ubuntu: runs-on: ubuntu-22.04 strategy: matrix: include: - architecture: 'x64' compiler: 'gcc' configure_options: '' - architecture: 'x64' compiler: 'gcc' configure_options: '--enable-wide-character-type' steps: - uses: actions/checkout@v4 - name: Install build dependencies run: | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config - name: Download test data run: | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi - name: Prepare shared libraries run: | tests/syncsharedlibs.sh --use-head - name: Building from source env: CC: ${{ matrix.compiler }} run: | tests/build.sh ${{ matrix.configure_options }} - name: Run tests run: | tests/runtests.sh ================================================ FILE: .gitignore ================================================ # Files to ignore by git # # Version: 20231119 # Generic auto-generated build files *~ *.a *.gcda *.gcno *.gcov *.la *.lai *.lib *.lineno *.lo *.log *.loT *.o *.obj *.Plo *.Po *.so *.so.[0-9][0-9]* *.so.[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]* *.swp *.Tpo *.trs *.whl /*.egg-info/ __pycache__ .deps .dirstamp .libs .tox INSTALL Makefile Makefile.bcc Makefile.in stamp-h[1-9] # Specific auto-generated build files /ABOUT-NLS /aclocal.m4 /autom4te.cache/ /build /compile /confdefs.h /config.cache /config.guess /config.log /config.rpath /config.status /config.sub /configure /conftest.c /depcomp /dist /install-sh /libtool /ltmain.sh /m4/codeset.m4 /m4/extern-inline.m4 /m4/fcntl-o.m4 /m4/gettext.m4 /m4/glibc21.m4 /m4/glibc2.m4 /m4/host-cpu-c-abi.m4 /m4/iconv.m4 /m4/intdiv0.m4 /m4/intldir.m4 /m4/intl.m4 /m4/intlmacosx.m4 /m4/intmax.m4 /m4/inttypes_h.m4 /m4/inttypes-pri.m4 /m4/lcmessage.m4 /m4/lib-ld.m4 /m4/lib-link.m4 /m4/lib-prefix.m4 /m4/libtool.m4 /m4/lock.m4 /m4/longlong.m4 /m4/lt~obsolete.m4 /m4/ltoptions.m4 /m4/ltsugar.m4 /m4/ltversion.m4 /m4/nls.m4 /m4/pkg.m4 /m4/po.m4 /m4/printf-posix.m4 /m4/progtest.m4 /m4/size_max.m4 /m4/stdint_h.m4 /m4/threadlib.m4 /m4/uintmax_t.m4 /m4/visibility.m4 /m4/wchar_t.m4 /m4/wint_t.m4 /m4/xsize.m4 /MANIFEST /missing /po/boldquot.sed /po/en@boldquot.header /po/en@quot.header /po/insert-header.sin /po/Makefile.in.in /po/Makevars /po/Makevars.template /po/POTFILES /po/quot.sed /po/remove-potcdate.sed /po/remove-potcdate.sin /po/Rules-quot /test-driver /ylwrap # Project specific files /common/config.h /common/config.h.in /common/types.h /dpkg/changelog /include/libfsrefs.h /include/libfsrefs/definitions.h /include/libfsrefs/features.h /include/libfsrefs/types.h /libfsrefs.pc /libfsrefs.spec /libfsrefs/libfsrefs.rc /libfsrefs/libfsrefs_definitions.h /fsrefstools/*.exe /fsrefstools/fsrefsinfo /tests/*.exe /tests/fsrefs_test_attribute_values /tests/fsrefs_test_block_descriptor /tests/fsrefs_test_block_reference /tests/fsrefs_test_block_tree /tests/fsrefs_test_block_tree_node /tests/fsrefs_test_checkpoint /tests/fsrefs_test_data_run /tests/fsrefs_test_directory_entry /tests/fsrefs_test_directory_object /tests/fsrefs_test_error /tests/fsrefs_test_file_entry /tests/fsrefs_test_file_system /tests/fsrefs_test_io_handle /tests/fsrefs_test_metadata_block_header /tests/fsrefs_test_ministore_node /tests/fsrefs_test_ministore_tree /tests/fsrefs_test_node_header /tests/fsrefs_test_node_record /tests/fsrefs_test_notify /tests/fsrefs_test_objects_tree /tests/fsrefs_test_superblock /tests/fsrefs_test_support /tests/fsrefs_test_tools_info_handle /tests/fsrefs_test_tools_output /tests/fsrefs_test_tools_signal /tests/fsrefs_test_tree_header /tests/fsrefs_test_volume /tests/fsrefs_test_volume_header /tests/input /tests/notify_stream.log /tests/tmp* # Local library dependencies specific files /libbfio /libcdata /libcerror /libcfile /libclocale /libcnotify /libcpath /libcsplit /libcthreads /libfcache /libfdata /libfdatetime /libfguid /libfusn /libfwnt /libuna ================================================ FILE: AUTHORS ================================================ Acknowledgements: libfsrefs Copyright (C) 2012-2025, Joachim Metz ================================================ FILE: COPYING ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: COPYING.LESSER ================================================ GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ================================================ FILE: ChangeLog ================================================ TODO Format support * Use checkpoint in determining block offsets * Rename metadata block header to block header ? * Rename metadata block size to page size ? * Use directory object name records in determining directory entries and lookup detailed entry record on demand * Add support for multi node file values ministore tree API * add function to retrieve container size 20141011 * see `git log' for more recent change log * removed README.macosx * updated dependencies * changes for project site move 20140529 * updated dependencies 20140118 * 2014 update * updated dependencies 20131109 * updated dependencies * code clean up 20130915 * code clean up 20130914 * updated dependencies * added libcthreads build support 20130224 * updated dependencies * 2013 update 20120930 * worked on format 20120929 * updated dependencies * worked on format 20120528 * worked on format 20120527 * initial version based on libfsntfs ================================================ FILE: Makefile.am ================================================ ACLOCAL_AMFLAGS = -I m4 SUBDIRS = \ include \ common \ libcerror \ libcthreads \ libcdata \ libclocale \ libcnotify \ libcsplit \ libuna \ libcfile \ libcpath \ libbfio \ libfcache \ libfdata \ libfdatetime \ libfguid \ libfwnt \ libfsrefs \ libfusn \ fsrefstools \ po \ manuals \ tests \ ossfuzz \ msvscpp DPKG_FILES = \ dpkg/changelog \ dpkg/changelog.in \ dpkg/compat \ dpkg/control \ dpkg/copyright \ dpkg/rules \ dpkg/libfsrefs-dev.install \ dpkg/libfsrefs.install \ dpkg/libfsrefs-tools.install \ dpkg/source/format GETTEXT_FILES = \ config.rpath \ po/Makevars.in PKGCONFIG_FILES = \ libfsrefs.pc.in SPEC_FILES = \ libfsrefs.spec \ libfsrefs.spec.in EXTRA_DIST = \ $(DPKG_FILES) \ $(GETTEXT_FILES) \ $(PKGCONFIG_FILES) \ $(SPEC_FILES) DISTCLEANFILES = \ config.status \ config.cache \ config.log \ libfsrefs.pc \ libfsrefs.spec \ Makefile \ Makefile.in \ po/Makevars pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = \ libfsrefs.pc libtool: @LIBTOOL_DEPS@ cd $(srcdir) && $(SHELL) ./config.status --recheck lib: library library: (cd $(srcdir)/common && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libcerror && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libcthreads && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libcdata && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libclocale && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libcnotify && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libcsplit && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libuna && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libcfile && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libcpath && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libbfio && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libfcache && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libfdata && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libfdatetime && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libfguid && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libfwnt && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/libfsrefs && $(MAKE) $(AM_MAKEFLAGS)) (cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS)) ================================================ FILE: NEWS ================================================ ================================================ FILE: README ================================================ libfsrefs is a library to access the Resilient File System (ReFS). Note that this project currently only focuses on the analysis of the format. Project information: * Status: experimental * Licence: LGPLv3+ Read-only supported ReFS formats: * version 1 Unsupported ReFS format features: * ReFS version 2 * ReFS version 3 Planned: * Finish library For more information see: * Project documentation: https://github.com/libyal/libfsrefs/wiki/Home * How to build from source: https://github.com/libyal/libfsrefs/wiki/Building ================================================ FILE: acinclude.m4 ================================================ dnl Checks for required headers and functions dnl dnl Version: 20200713 dnl Function to detect if libfsrefs dependencies are available AC_DEFUN([AX_LIBFSREFS_CHECK_LOCAL], [dnl Check for internationalization functions in libfsrefs/libfsrefs_i18n.c AC_CHECK_FUNCS([bindtextdomain]) ]) dnl Function to detect if fsrefstools dependencies are available AC_DEFUN([AX_FSREFSTOOLS_CHECK_LOCAL], [AC_CHECK_HEADERS([signal.h sys/signal.h unistd.h]) AC_CHECK_FUNCS([close getopt setvbuf]) AS_IF( [test "x$ac_cv_func_close" != xyes], [AC_MSG_FAILURE( [Missing function: close], [1]) ]) ]) dnl Function to check if DLL support is needed AC_DEFUN([AX_LIBFSREFS_CHECK_DLL_SUPPORT], [AS_IF( [test "x$enable_shared" = xyes && test "x$ac_cv_enable_static_executables" = xno], [AS_CASE( [$host], [*cygwin* | *mingw* | *msys*], [AC_DEFINE( [HAVE_DLLMAIN], [1], [Define to 1 to enable the DllMain function.]) AC_SUBST( [HAVE_DLLMAIN], [1]) AC_SUBST( [LIBFSREFS_DLL_EXPORT], ["-DLIBFSREFS_DLL_EXPORT"]) AC_SUBST( [LIBFSREFS_DLL_IMPORT], ["-DLIBFSREFS_DLL_IMPORT"]) ]) ]) ]) ================================================ FILE: appveyor.yml ================================================ environment: matrix: - TARGET: vs2008 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VisualStudioVersion: 9.0 platform: Win32 configuration: Release PYTHON_PATH: "C:\\Python37" - TARGET: vs2010 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VisualStudioVersion: 10.0 platform: Win32 configuration: Release PYTHON_PATH: "C:\\Python37" - TARGET: vs2012 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VisualStudioVersion: 11.0 platform: Win32 configuration: Release PYTHON_PATH: "C:\\Python37" - TARGET: vs2013 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 VisualStudioVersion: 12.0 platform: Win32 configuration: Release PYTHON_PATH: "C:\\Python37" - TARGET: vs2015 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 VisualStudioVersion: 14.0 platform: Win32 configuration: Release PYTHON_PATH: "C:\\Python38" - TARGET: vs2017 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 VisualStudioVersion: 15.0 platform: Win32 configuration: Release PYTHON_PATH: "C:\\Python38" - TARGET: vs2019 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 VisualStudioVersion: 16.0 platform: Win32 configuration: Release PYTHON_PATH: "C:\\Python311" - TARGET: vs2022 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 VisualStudioVersion: 17.0 platform: Win32 configuration: Release PYTHON_PATH: "C:\\Python311" - TARGET: vs2022-vsdebug BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 VisualStudioVersion: 17.0 platform: Win32 configuration: VSDebug PYTHON_PATH: "C:\\Python311" - TARGET: vs2022-x64 BUILD_ENVIRONMENT: msbuild APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 VisualStudioVersion: 17.0 platform: x64 configuration: Release PYTHON_PATH: "C:\\Python311" - TARGET: macos-x64-clang BUILD_ENVIRONMENT: xcode APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma HOMEBREW_NO_INSTALL_CLEANUP: 1 CC: clang CFLAGS: "-I/usr/local/include" LDFLAGS: "-L/usr/local/lib" CONFIGURE_OPTIONS: "" - TARGET: macos-x64-gcc BUILD_ENVIRONMENT: xcode APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma HOMEBREW_NO_INSTALL_CLEANUP: 1 CC: gcc CFLAGS: "-I/usr/local/include" LDFLAGS: "-L/usr/local/lib" CONFIGURE_OPTIONS: "" - TARGET: macos-pkgbuild BUILD_ENVIRONMENT: xcode APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma HOMEBREW_NO_INSTALL_CLEANUP: 1 CONFIGURE_OPTIONS: "--disable-dependency-tracking --prefix=/usr/local --with-pyprefix" - TARGET: cygwin64-gcc BUILD_ENVIRONMENT: cygwin64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 CONFIGURE_OPTIONS: "" - TARGET: cygwin64-gcc-no-optimization BUILD_ENVIRONMENT: cygwin64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 CONFIGURE_OPTIONS: "--enable-shared=no" CFLAGS: "--coverage -O0" CPPFLAGS: "-DOPTIMIZATION_DISABLED" LDFLAGS: "--coverage" - TARGET: cygwin64-gcc-static-executables BUILD_ENVIRONMENT: cygwin64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 CONFIGURE_OPTIONS: "--enable-static-executables" - TARGET: mingw-w64-gcc BUILD_ENVIRONMENT: mingw-w64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 CONFIGURE_OPTIONS: "" - TARGET: mingw-w64-gcc-no-optimization BUILD_ENVIRONMENT: mingw-w64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 CONFIGURE_OPTIONS: "--enable-shared=no" CFLAGS: "--coverage -O0" CPPFLAGS: "-DOPTIMIZATION_DISABLED" LDFLAGS: "--coverage" - TARGET: mingw-w64-gcc-static-executables BUILD_ENVIRONMENT: mingw-w64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 CONFIGURE_OPTIONS: "--enable-static-executables" install: - cmd: if [%BUILD_ENVIRONMENT%]==[msbuild] ( git clone https://github.com/libyal/vstools.git ..\vstools ) - sh: if ( test `uname -s` = "Darwin" && test ${BUILD_ENVIRONMENT} = "python-tox" ) || test ${BUILD_ENVIRONMENT} = "xcode"; then brew untap homebrew/homebrew-cask-versions && brew update -q; fi - sh: if ( test `uname -s` = "Darwin" && test ${BUILD_ENVIRONMENT} = "python-tox" ) || test ${BUILD_ENVIRONMENT} = "xcode"; then brew install -q autoconf automake gettext gnu-sed libtool pkg-config || true; fi - ps: If ($env:BUILD_ENVIRONMENT -eq "cygwin64") { (New-Object Net.WebClient).DownloadFile("https://cygwin.com/setup-x86_64.exe", "C:\\cygwin64\\setup-x86_64.exe") } - cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] ( C:\cygwin64\setup-x86_64.exe -qgnNdO -l C:\cygwin64\var\cache\setup -R c:\cygwin64 -s http://cygwin.mirror.constant.com -P gettext-devel -P wget ) - cmd: if [%BUILD_ENVIRONMENT%]==[mingw-w64] ( C:\msys64\usr\bin\pacman -S --noconfirm --needed autoconf automake gettext-devel libtool make mingw-w64-x86_64-gcc pkg-config ) - ps: If ( ( "cygwin64-gcc-no-optimization", "mingw-w64-gcc-no-optimization" ).Contains( $env:TARGET ) ) { $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile ..\codecov.exe } build_script: - ps: If ($env:BUILD_ENVIRONMENT -eq "msbuild" -or ($env:BUILD_ENVIRONMENT -eq "python-tox" -and $isWindows)) { .\synclibs.ps1; .\autogen.ps1 } - ps: If ($env:TARGET -eq "vs2008") { .\build.ps1 -VisualStudioVersion 2008 -PythonPath $env:PYTHON_PATH -VSToolsOptions "--no-python-dll" } - ps: If ( ( "vs2010", "vs2012", "vs2013", "vs2015" ).Contains( $env:TARGET ) ) { .\build.ps1 -VisualStudioVersion $env:TARGET.Substring(2, 4) -Configuration $env:CONFIGURATION -Platform $env:PLATFORM -PythonPath $env:PYTHON_PATH -VSToolsOptions "--extend-with-x64 --no-python-dll" } - ps: If ( ( "vs2017", "vs2019", "vs2022", "vs2022-vsdebug", "vs2022-x64" ).Contains( $env:TARGET ) ) { .\build.ps1 -VisualStudioVersion $env:TARGET.Substring(2, 4) -Configuration $env:CONFIGURATION -Platform $env:PLATFORM -PythonPath $env:PYTHON_PATH -VSToolsOptions "--extend-with-x64 --no-python-dll --with-dokany" } - sh: if test ${BUILD_ENVIRONMENT} = "xcode"; then export PATH="/usr/local/opt/gettext/bin:$PATH"; export SED="/usr/local/bin/gsed"; tests/build.sh ${CONFIGURE_OPTIONS}; fi - cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] ( xcopy /i /q /s C:\projects\libfsrefs C:\cygwin64\home\appveyor\libfsrefs && C:\cygwin64\bin\bash -e -l -c "cd libfsrefs && wget -q 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O './config.guess' && wget -q 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O './config.sub'" && C:\cygwin64\bin\bash -e -l -c "cd libfsrefs && tests/build.sh ${CONFIGURE_OPTIONS}" ) - cmd: if [%BUILD_ENVIRONMENT%]==[mingw-w64] ( xcopy /i /q /s C:\projects\libfsrefs C:\msys64\home\appveyor\libfsrefs && C:\msys64\usr\bin\bash -e -l -c "cd libfsrefs && tests/build.sh ${CONFIGURE_OPTIONS}" ) test_script: - cmd: rem Run tests - ps: If ($env:BUILD_ENVIRONMENT -eq "msbuild") { .\runtests.ps1 } - sh: if test ${BUILD_ENVIRONMENT} = "xcode" && test ${TARGET} != "macos-pkgbuild"; then tests/runtests.sh; fi - sh: if test ${TARGET} = "macos-pkgbuild"; then tests/pkgbuild.sh; fi - cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] ( C:\cygwin64\bin\bash -l -c "cd libfsrefs && tests/runtests.sh" ) - cmd: if [%BUILD_ENVIRONMENT%]==[mingw-w64] ( C:\msys64\usr\bin\bash -l -c "cd libfsrefs && tests/runtests.sh" ) after_test: - cmd: if [%TARGET%]==[cygwin64-gcc-no-optimization] ( C:\cygwin64\bin\bash -e -l -c "cd libfsrefs && for DIRECTORY in `find . -maxdepth 1 -type d`; do (cd ${DIRECTORY} && find . -maxdepth 1 -name \*.gcno -type f -exec gcov -pb {} \;) done" && C:\projects\codecov.exe -R \cygwin64\home\appveyor\libfsrefs --name %TARGET% ) - cmd: if [%TARGET%]==[mingw-w64-gcc-no-optimization] ( C:\msys64\usr\bin\bash -e -l -c "cd libfsrefs && for DIRECTORY in `find . -maxdepth 1 -type d`; do (cd ${DIRECTORY} && find . -maxdepth 1 -name \*.gcno -type f -exec gcov -pb {} \;) done" && C:\projects\codecov.exe -R \msys64\home\appveyor\libfsrefs --name %TARGET% ) ================================================ FILE: autogen.ps1 ================================================ # Script to generate the necessary files for a msvscpp build # # Version: 20241014 $WinFlex = "..\win_flex_bison\win_flex.exe" $WinBison = "..\win_flex_bison\win_bison.exe" $Library = Get-Content -Path configure.ac | select -skip 3 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } $Version = Get-Content -Path configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } $Prefix = ${Library}.Substring(3) Get-Content -Path "include\${Library}.h.in" | Out-File -Encoding ascii "include\${Library}.h" Get-Content -Path "include\${Library}\definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "include\${Library}\definitions.h" Get-Content -Path "include\${Library}\features.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } | Out-File -Encoding ascii "include\${Library}\features.h" Get-Content -Path "include\${Library}\types.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } | Out-File -Encoding ascii "include\${Library}\types.h" Get-Content -Path "common\types.h.in" | % { $_ -Replace "@PACKAGE@","${Library}" } | Out-File -Encoding ascii "common\types.h" Get-Content -Path "${Library}\${Library}_definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Library}\${Library}_definitions.h" Get-Content -Path "${Library}\${Library}.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Library}\${Library}.rc" If (Test-Path "setup.cfg.in") { Get-Content -Path "setup.cfg.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "setup.cfg" } If (Test-Path "${Prefix}.net") { Get-Content -Path "${Prefix}.net\${Prefix}.net.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Prefix}.net\${Prefix}.net.rc" } $NamePrefix = "" ForEach (${Library} in Get-ChildItem -Directory -Path "lib*") { ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l") { $OutputFile = ${DirectoryElement} -Replace ".l$",".c" $NamePrefix = Split-Path -path ${DirectoryElement} -leaf $NamePrefix = ${NamePrefix} -Replace ".l$","_" Write-Host "Running: ${WinFlex} -Cf ${DirectoryElement}" # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr # therefore 2>&1 is added and the output is stored in a variable. $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" Write-Host ${Output} # Moving manually since `win_flex -o filename' does not provide the expected behavior. Move-Item "lex.yy.c" ${OutputFile} -force } ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.y") { $OutputFile = ${DirectoryElement} -Replace ".y$",".c" Write-Host "Running: ${WinBison} -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement}" # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr # therefore 2>&1 is added and the output is stored in a variable. $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" Write-Host ${Output} } } ================================================ FILE: autogen.sh ================================================ #!/bin/sh # Script to generate configure and Makefile using the autotools. # # Version: 20241013 EXIT_SUCCESS=0; EXIT_FAILURE=1; BINDIR=`which aclocal`; BINDIR=`dirname ${BINDIR}`; if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/usr/bin"; then BINDIR="/usr/bin"; fi if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/usr/local/bin"; then BINDIR="/usr/local/bin"; fi if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/opt/local/bin"; then # Default location of MacPorts installed binaries. BINDIR="/opt/local/bin"; fi if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/opt/homebrew/bin"; then # Default location of Homebrew installed binaries. BINDIR="/opt/homebrew/bin"; fi if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/mingw32/bin"; then # Default location of 32-bit MSYS2-MinGW installed binaries. BINDIR="/mingw32/bin"; fi if ! test -x "${BINDIR}/aclocal" && test "${BINDIR}" != "/mingw64/bin"; then # Default location of 64-bit MSYS2-MinGW installed binaries. BINDIR="/mingw64/bin"; fi if ! test -x "${BINDIR}/aclocal"; then echo "Unable to find autotools"; exit ${EXIT_FAILURE}; fi ACLOCAL="${BINDIR}/aclocal"; AUTOCONF="${BINDIR}/autoconf"; AUTOHEADER="${BINDIR}/autoheader"; AUTOMAKE="${BINDIR}/automake"; AUTOPOINT="${BINDIR}/autopoint"; AUTORECONF="${BINDIR}/autoreconf"; LIBTOOLIZE="${BINDIR}/libtoolize"; PKGCONFIG="${BINDIR}/pkg-config"; if test "${OSTYPE}" = "msys"; then # Work-around for autopoint failing to detect gettext version # using func_trace (which is not available) on MSYS by writing # the gettext version to intl/VERSION. if ! test -d intl; then mkdir intl; fi GETTEXT_VERSION=`gettext --version | head -n1 | sed 's/^.* //'`; echo "gettext-${GETTEXT_VERSION}" > intl/VERSION; elif ! test -x "${PKGCONFIG}"; then if test "${BINDIR}" != "/usr/bin"; then # On OpenBSD most of the autotools are located in # /usr/local/bin while pkg-config is located in /usr/bin PKGCONFIG="/usr/bin/pkg-config"; fi if ! test -x "${PKGCONFIG}"; then echo "Unable to find: pkg-config"; exit ${EXIT_FAILURE}; fi fi if test -x "${AUTORECONF}"; then ${AUTORECONF} --force --install if test $? -ne 0; then exit $?; fi else if ! test -x "${ACLOCAL}"; then echo "Unable to find: aclocal"; exit ${EXIT_FAILURE}; fi if ! test -x "${AUTOCONF}"; then echo "Unable to find: autoconf"; exit ${EXIT_FAILURE}; fi if ! test -x "${AUTOHEADER}"; then echo "Unable to find: autoheader"; exit ${EXIT_FAILURE}; fi if ! test -x "${AUTOMAKE}"; then echo "Unable to find: automake"; exit ${EXIT_FAILURE}; fi if ! test -x "${AUTOPOINT}"; then echo "Unable to find: autopoint"; exit ${EXIT_FAILURE}; fi if ! test -x "${LIBTOOLIZE}"; then echo "Unable to find: libtoolize"; exit ${EXIT_FAILURE}; fi ${AUTOPOINT} --force; if test $? -ne 0; then exit $?; fi ${ACLOCAL} --force --install -I m4; if test $? -ne 0; then exit $?; fi ${LIBTOOLIZE} --force; if test $? -ne 0; then exit $?; fi ${AUTOHEADER} --force; if test $? -ne 0; then exit $?; fi ${AUTOCONF} --force; if test $? -ne 0; then exit $?; fi ${AUTOMAKE} --force --add-missing; if test $? -ne 0; then exit $?; fi fi exit ${EXIT_SUCCESS}; ================================================ FILE: build.ps1 ================================================ # Script that builds libfsrefs # # Version: 20251125 Param ( [string]$Configuration = ${Env:Configuration}, [string]$Platform = ${Env:Platform}, [string]$PlatformToolset = "", [string]$PythonPath = "C:\Python311", [string]$VisualStudioVersion = "", [string]$VSToolsOptions = "--extend-with-x64", [string]$VSToolsPath = "..\vstools" ) $ExitSuccess = 0 $ExitFailure = 1 $Python = "${PythonPath}\python.exe" $Git = "git" $GitUrl = "https://github.com/libyal/vstools.git" $MSVSCppConvert = "${VSToolsPath}\vstools\scripts\msvscpp_convert.py" If (-Not (Test-Path $Python)) { Write-Host "Missing Python: ${Python}" -foreground Red Exit ${ExitFailure} } If (-Not (Test-Path ${VSToolsPath})) { # PowerShell will raise NativeCommandError if git writes to stdout or stderr # therefore 2>&1 is added and the output is stored in a variable. $Output = Invoke-Expression -Command "${Git} clone ${GitUrl} ${VSToolsPath} 2>&1" | %{ "$_" } } Else { Push-Location "${VSToolsPath}" Try { # Make sure vstools are up to date. $Output = Invoke-Expression -Command "${Git} pull 2>&1" | %{ "$_" } } Finally { Pop-Location } } If (-Not (Test-Path ${MSVSCppConvert})) { Write-Host "Missing msvscpp_convert.py: ${MSVSCppConvert}" -foreground Red Exit ${ExitFailure} } If (-Not ${VisualStudioVersion}) { $VisualStudioVersion = "2022" Write-Host "Visual Studio version not set defauting to: ${VisualStudioVersion}" -foreground Red } If ((${VisualStudioVersion} -ne "2008") -And (${VisualStudioVersion} -ne "2010") -And (${VisualStudioVersion} -ne "2012") -And (${VisualStudioVersion} -ne "2013") -And (${VisualStudioVersion} -ne "2015") -And (${VisualStudioVersion} -ne "2017") -And (${VisualStudioVersion} -ne "2019") -And (${VisualStudioVersion} -ne "2022")) { Write-Host "Unsupported Visual Studio version: ${VisualStudioVersion}" -foreground Red Exit ${ExitFailure} } $MSBuild = "" If (${VisualStudioVersion} -eq "2008") { $MSBuild = "C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe" } ElseIf ((${VisualStudioVersion} -eq "2010") -Or (${VisualStudioVersion} -eq "2012")) { $MSBuild = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" } ElseIf (${VisualStudioVersion} -eq "2013") { $MSBuild = "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" } ElseIf (${VisualStudioVersion} -eq "2015") { $MSBuild = "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" } ElseIf (${VisualStudioVersion} -eq "2017") { $Results = Get-ChildItem -Path "C:\Program Files\Microsoft Visual Studio\${VisualStudioVersion}\*\MSBuild\15.0\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force If ($Results.Count -eq 0) { $Results = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\${VisualStudioVersion}\*\MSBuild\15.0\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force } If ($Results.Count -gt 0) { $MSBuild = $Results[0].FullName } } ElseIf (${VisualStudioVersion} -eq "2019" -Or ${VisualStudioVersion} -eq "2022") { $Results = Get-ChildItem -Path "C:\Program Files\Microsoft Visual Studio\${VisualStudioVersion}\*\MSBuild\Current\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force If ($Results.Count -eq 0) { $Results = Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio\${VisualStudioVersion}\*\MSBuild\Current\Bin\MSBuild.exe" -Recurse -ErrorAction SilentlyContinue -Force } If ($Results.Count -gt 0) { $MSBuild = $Results[0].FullName } } If (-Not ${MSBuild}) { Write-Host "Unable to determine path to msbuild.exe" -foreground Red Exit ${ExitFailure} } ElseIf (-Not (Test-Path ${MSBuild})) { Write-Host "Missing msbuild.exe: ${MSBuild}" -foreground Red Exit ${ExitFailure} } If (${VisualStudioVersion} -eq "2008") { $VSSolutionPath = "msvscpp" } Else { $VSSolutionPath = "vs${VisualStudioVersion}" If (-Not (Test-Path "${VSSolutionPath}")) { ${Env:PYTHONPATH} = ${VSToolsPath} Invoke-Expression -Command "& '${Python}' ${MSVSCppConvert} --output-format ${VisualStudioVersion} ${VSToolsOptions} msvscpp\libfsrefs.sln 2>&1" | %{ "$_" } } } $VSSolutionFile = "${VSSolutionPath}\libfsrefs.sln" If (-Not (Test-Path "${VSSolutionFile}")) { Write-Host "Missing Visual Studio ${VisualStudioVersion} solution file: ${VSSolutionFile}" -foreground Red Exit ${ExitFailure} } If (-Not ${Configuration}) { $Configuration = "Release" Write-Host "Configuration not set defauting to: ${Configuration}" } If (-Not ${Platform}) { $Platform = "Win32" Write-Host "Platform not set defauting to: ${Platform}" } $PlatformToolset = "" If (-Not ${PlatformToolset}) { If (${VisualStudioVersion} -eq "2015") { $PlatformToolset = "v140" } ElseIf (${VisualStudioVersion} -eq "2017") { $PlatformToolset = "v141" } ElseIf (${VisualStudioVersion} -eq "2019") { $PlatformToolset = "v142" } ElseIf (${VisualStudioVersion} -eq "2022") { $PlatformToolset = "v143" } Write-Host "PlatformToolset not set defauting to: ${PlatformToolset}" } $MSBuildOptions = "/verbosity:quiet /target:Build /property:Configuration=${Configuration},Platform=${Platform}" If (${PlatformToolset}) { $MSBuildOptions = "${MSBuildOptions} /property:PlatformToolset=${PlatformToolset}" } If (${Env:APPVEYOR} -eq "True") { Invoke-Expression -Command "& '${MSBuild}' ${MSBuildOptions} ${VSSolutionFile} /logger:'C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll' 2>&1" | %{ "$_" } } Else { Invoke-Expression -Command "& '${MSBuild}' ${MSBuildOptions} ${VSSolutionFile} 2>&1" | %{ "$_" } } Exit ${ExitSuccess} ================================================ FILE: common/Makefile.am ================================================ AM_CPPFLAGS = \ -I../include -I$(top_srcdir)/include EXTRA_DIST = \ byte_stream.h \ common.h \ config.h \ config_borlandc.h \ config_msc.h \ config_winapi.h \ file_stream.h \ memory.h \ narrow_string.h \ system_string.h \ types.h \ types.h.in \ wide_string.h DISTCLEANFILES = \ config.h \ types.h \ Makefile \ Makefile.in ================================================ FILE: common/byte_stream.h ================================================ /* * Byte stream functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _BYTE_STREAM_H ) #define _BYTE_STREAM_H #include "common.h" #include "types.h" #if defined( __cplusplus ) extern "C" { #endif #define _BYTE_STREAM_HOST_IS_ENDIAN_BIG ( *((uint32_t *) "\x01\x02\x03\x04" ) == 0x01020304 ) #define _BYTE_STREAM_HOST_IS_ENDIAN_LITTLE ( *((uint32_t *) "\x01\x02\x03\x04" ) == 0x04030201 ) #define _BYTE_STREAM_HOST_IS_ENDIAN_MIDDLE ( *((uint32_t *) "\x01\x02\x03\x04" ) == 0x02010403 ) #define _BYTE_STREAM_ENDIAN_BIG (uint8_t) 'b' #define _BYTE_STREAM_ENDIAN_LITTLE (uint8_t) 'l' #define _BYTE_STREAM_ENDIAN_MIDDLE (uint8_t) 'm' typedef union byte_stream_float32 { float floating_point; uint32_t integer; } byte_stream_float32_t; typedef union byte_stream_float64 { double floating_point; uint64_t integer; } byte_stream_float64_t; #define byte_stream_copy_to_uint16_big_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 0 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; #define byte_stream_copy_to_uint16_little_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 0 ]; #define byte_stream_copy_to_uint24_big_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 0 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 2 ]; #define byte_stream_copy_to_uint24_little_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 2 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 0 ]; #define byte_stream_copy_to_uint32_big_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 0 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 2 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 3 ]; #define byte_stream_copy_to_uint32_little_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 3 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 2 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 0 ]; #define byte_stream_copy_to_uint48_big_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 0 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 2 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 3 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 4 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 5 ]; #define byte_stream_copy_to_uint48_little_endian( byte_stream, value ) \ ( value ) |= ( byte_stream )[ 5 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 4 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 3 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 2 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 0 ]; #define byte_stream_copy_to_uint64_big_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 0 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 2 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 3 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 4 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 5 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 6 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 7 ]; #define byte_stream_copy_to_uint64_little_endian( byte_stream, value ) \ ( value ) = ( byte_stream )[ 7 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 6 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 5 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 4 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 3 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 2 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 1 ]; \ ( value ) <<= 8; \ ( value ) |= ( byte_stream )[ 0 ]; #define byte_stream_copy_from_uint16_big_endian( byte_stream, value ) \ ( byte_stream )[ 0 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint16_little_endian( byte_stream, value ) \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 0 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint24_big_endian( byte_stream, value ) \ ( byte_stream )[ 0 ] = (uint8_t) ( ( ( value ) >> 16 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 2 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint24_little_endian( byte_stream, value ) \ ( byte_stream )[ 2 ] = (uint8_t) ( ( ( value ) >> 16 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 0 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint32_big_endian( byte_stream, value ) \ ( byte_stream )[ 0 ] = (uint8_t) ( ( ( value ) >> 24 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 16 ) & 0x0ff ); \ ( byte_stream )[ 2 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 3 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint32_little_endian( byte_stream, value ) \ ( byte_stream )[ 3 ] = (uint8_t) ( ( ( value ) >> 24 ) & 0x0ff ); \ ( byte_stream )[ 2 ] = (uint8_t) ( ( ( value ) >> 16 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 0 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint48_big_endian( byte_stream, value ) \ ( byte_stream )[ 0 ] = (uint8_t) ( ( ( value ) >> 40 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 32 ) & 0x0ff ); \ ( byte_stream )[ 2 ] = (uint8_t) ( ( ( value ) >> 24 ) & 0x0ff ); \ ( byte_stream )[ 3 ] = (uint8_t) ( ( ( value ) >> 16 ) & 0x0ff ); \ ( byte_stream )[ 4 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 5 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint48_little_endian( byte_stream, value ) \ ( byte_stream )[ 5 ] = (uint8_t) ( ( ( value ) >> 40 ) & 0x0ff ); \ ( byte_stream )[ 4 ] = (uint8_t) ( ( ( value ) >> 32 ) & 0x0ff ); \ ( byte_stream )[ 3 ] = (uint8_t) ( ( ( value ) >> 24 ) & 0x0ff ); \ ( byte_stream )[ 2 ] = (uint8_t) ( ( ( value ) >> 16 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 0 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint64_big_endian( byte_stream, value ) \ ( byte_stream )[ 0 ] = (uint8_t) ( ( ( value ) >> 56 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 48 ) & 0x0ff ); \ ( byte_stream )[ 2 ] = (uint8_t) ( ( ( value ) >> 40 ) & 0x0ff ); \ ( byte_stream )[ 3 ] = (uint8_t) ( ( ( value ) >> 32 ) & 0x0ff ); \ ( byte_stream )[ 4 ] = (uint8_t) ( ( ( value ) >> 24 ) & 0x0ff ); \ ( byte_stream )[ 5 ] = (uint8_t) ( ( ( value ) >> 16 ) & 0x0ff ); \ ( byte_stream )[ 6 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 7 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_copy_from_uint64_little_endian( byte_stream, value ) \ ( byte_stream )[ 7 ] = (uint8_t) ( ( ( value ) >> 56 ) & 0x0ff ); \ ( byte_stream )[ 6 ] = (uint8_t) ( ( ( value ) >> 48 ) & 0x0ff ); \ ( byte_stream )[ 5 ] = (uint8_t) ( ( ( value ) >> 40 ) & 0x0ff ); \ ( byte_stream )[ 4 ] = (uint8_t) ( ( ( value ) >> 32 ) & 0x0ff ); \ ( byte_stream )[ 3 ] = (uint8_t) ( ( ( value ) >> 24 ) & 0x0ff ); \ ( byte_stream )[ 2 ] = (uint8_t) ( ( ( value ) >> 16 ) & 0x0ff ); \ ( byte_stream )[ 1 ] = (uint8_t) ( ( ( value ) >> 8 ) & 0x0ff ); \ ( byte_stream )[ 0 ] = (uint8_t) ( ( value ) & 0x0ff ) #define byte_stream_bit_rotate_left_8bit( byte_stream, number_of_bits ) \ ( ( ( byte_stream ) << ( number_of_bits ) ) | ( ( byte_stream ) >> ( 8 - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_right_8bit( byte_stream, number_of_bits ) \ ( ( ( byte_stream ) >> ( number_of_bits ) ) | ( ( byte_stream ) << ( 8 - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_left_16bit( byte_stream, number_of_bits ) \ ( ( ( byte_stream ) << ( number_of_bits ) ) | ( ( byte_stream ) >> ( 16 - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_right_16bit( byte_stream, number_of_bits ) \ ( ( ( byte_stream ) >> ( number_of_bits ) ) | ( ( byte_stream ) << ( 16 - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_left_32bit( byte_stream, number_of_bits ) \ ( ( ( byte_stream ) << ( number_of_bits ) ) | ( ( byte_stream ) >> ( 32 - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_right_32bit( byte_stream, number_of_bits ) \ ( ( ( byte_stream ) >> ( number_of_bits ) ) | ( ( byte_stream ) << ( 32 - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_left_64bit( byte_stream, number_of_bits ) \ ( ( ( byte_stream ) << ( number_of_bits ) ) | ( ( byte_stream ) >> ( 64 - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_right_64bit( byte_stream, number_of_bits ) \ ( ( ( byte_stream ) >> ( number_of_bits ) ) | ( ( byte_stream ) << ( 64 - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_left( value, number_of_bits ) \ ( ( ( value ) << ( number_of_bits ) ) | ( ( value ) >> ( ( sizeof( value ) << 3 ) - ( number_of_bits ) ) ) ) #define byte_stream_bit_rotate_right( value, number_of_bits ) \ ( ( ( value ) >> ( number_of_bits ) ) | ( ( value ) << ( ( sizeof( value ) << 3 ) - ( number_of_bits ) ) ) ) #if defined( __cplusplus ) } #endif #endif /* !defined( _BYTE_STREAM_H ) */ ================================================ FILE: common/common.h ================================================ /* * Common include file * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _COMMON_H ) #define _COMMON_H #if defined( HAVE_CONFIG_H ) #include "config.h" #endif /* Include the Borland/CodeGear C++ Builder compiler specific configuration */ #if defined( __BORLANDC__ ) #include "config_borlandc.h" /* Include the Microsoft Visual Studio C++ compiler specific configuration */ #elif defined( _MSC_VER ) #include "config_msc.h" #endif #include "config_winapi.h" #endif /* !defined( _COMMON_H ) */ ================================================ FILE: common/config_borlandc.h ================================================ /* * Configuration for the Borland/CodeGear C++ Builder compiler * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _CONFIG_BORLANDC_H ) #define _CONFIG_BORLANDC_H #endif /* !defined( _CONFIG_BORLANDC_H ) */ ================================================ FILE: common/config_msc.h ================================================ /* * Configuration for the Microsoft Visual Studio C++ compiler * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _CONFIG_MSC_H ) #define _CONFIG_MSC_H /* Disable warning C4127: conditional expression is constant */ #pragma warning( disable : 4127 ) /* Disable warning C4201: nonstandard extension used : nameless struct/union */ #pragma warning( disable : 4201 ) #endif /* !defined( _CONFIG_MSC_H ) */ ================================================ FILE: common/config_winapi.h ================================================ /* * Configuration file for WINAPI * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _CONFIG_WINAPI_H ) #define _CONFIG_WINAPI_H /* Define the earliest supported WINAPI version #define WINVER 0x0501 */ /* If necessary make sure WINAPI is defined */ #if defined( HAVE_WINDOWS_H ) || defined( __BORLANDC__ ) || defined( _MSC_VER ) #include #endif #if defined( WINAPI ) /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "joachim.metz@gmail.com" /* Define the size of the integer for WINAPI */ #if !defined( SIZEOF_INT ) #define SIZEOF_INT 4 #endif /* Define the size of size_t for WINAPI * Do not define when pyconfig.h has been included via python.h */ #if !defined( HAVE_PYCONFIG_H ) #if !defined( SIZEOF_SIZE_T ) #if __WORDSIZE == 64 #define SIZEOF_SIZE_T 8 #else #define SIZEOF_SIZE_T 4 #endif #endif #endif /* !defined( HAVE_PYCONFIG_H ) */ /* Define the size of the wide character for WINAPI */ #if !defined( SIZEOF_WCHAR_T ) #define SIZEOF_WCHAR_T 2 #endif /* Enable the DllMain function */ #define HAVE_DLLMAIN 1 /* Enable verbose output #define HAVE_VERBOSE_OUTPUT 1 */ /* Enable debug output #define HAVE_DEBUG_OUTPUT 1 */ /* Enable both the narrow and wide character functions */ #if !defined( HAVE_WIDE_CHARACTER_TYPE ) #define HAVE_WIDE_CHARACTER_TYPE 1 #endif /* If not controlled by config.h enable multi-thread support */ #if !defined( HAVE_CONFIG_H ) && !defined( HAVE_MULTI_THREAD_SUPPORT ) #define HAVE_MULTI_THREAD_SUPPORT 1 #endif #endif /* defined( WINAPI ) */ #endif /* !defined( _CONFIG_WINAPI_H ) */ ================================================ FILE: common/file_stream.h ================================================ /* * FILE stream functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FILE_STREAM_H ) #define _FILE_STREAM_H #include "common.h" #if defined( HAVE_GLIB_H ) #include #include #endif #include #if defined( __cplusplus ) extern "C" { #endif #define FILE_STREAM_OPEN_APPEND "a" #define FILE_STREAM_OPEN_READ "r" #define FILE_STREAM_OPEN_WRITE "w" #if defined( WINAPI ) #define FILE_STREAM_BINARY_OPEN_APPEND "ab" #define FILE_STREAM_BINARY_OPEN_READ "rb" #define FILE_STREAM_BINARY_OPEN_WRITE "wb" #else #define FILE_STREAM_BINARY_OPEN_APPEND "a" #define FILE_STREAM_BINARY_OPEN_READ "r" #define FILE_STREAM_BINARY_OPEN_WRITE "w" #endif /* narrow character FILE stream open */ #if defined( HAVE_GLIB_H ) #define file_stream_open( filename, mode ) \ g_fopen( filename, mode ) #elif defined( HAVE_FOPEN ) || defined( WINAPI ) #define file_stream_open( filename, mode ) \ fopen( filename, mode ) #endif /* wide character FILE stream open */ #if defined( WINAPI ) #define file_stream_open_wide( filename, mode ) \ _wfopen( filename, mode ) #endif /* FILE stream close */ #if defined( HAVE_FCLOSE ) || defined( WINAPI ) #define file_stream_close( stream ) \ fclose( stream ) #endif /* FILE stream read */ #if defined( HAVE_FREAD ) || defined( WINAPI ) #define file_stream_read( stream, data, size ) \ fread( data, 1, size, stream ) #endif /* FILE stream write */ #if defined( HAVE_FWRITE ) || defined( WINAPI ) #define file_stream_write( stream, data, size ) \ fwrite( data, 1, size, stream ) #endif /* FILE stream seek */ #if defined( WINAPI ) #define file_stream_seek_offset( stream, offset, whence ) \ fseek( stream, offset, whence ) #elif defined( HAVE_FSEEKO ) #define file_stream_seek_offset( stream, offset, whence ) \ fseeko( stream, offset, whence ) #elif defined( HAVE_FSEEKO64 ) #define file_stream_seek_offset( stream, offset, whence ) \ fseeko64( stream, offset, whence ) #endif /* End of FILE stream */ #if defined( HAVE_FEOF ) || defined( WINAPI ) #define file_stream_at_end( stream ) \ feof( stream ) #endif /* Get narrow character string from FILE stream */ #if defined( HAVE_FGETS ) || defined( WINAPI ) #define file_stream_get_string( stream, string, size ) \ fgets( string, size, stream ) #endif /* Get wide characters string from FILE stream */ #if defined( HAVE_FGETWS ) || defined( WINAPI ) #define file_stream_get_string_wide( stream, string, size ) \ fgetws( string, size, stream ) #endif /* Variable arguments formatted print to stream function */ #if defined( HAVE_GLIB_H ) #define file_stream_vfprintf( stream, format, ... ) \ g_vfprintf( stream, format, __VA_ARGS__ ) /* Borland BCC previous to version 5.6.0 cannot handle the macro form: MACRO( ... ) */ #elif defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define file_stream_vfprintf \ vfprintf #elif defined( HAVE_VFPRINTF ) || defined( WINAPI ) #define file_stream_vfprintf( stream, format, ... ) \ vfprintf( stream, format, __VA_ARGS__ ) #endif #if defined( __cplusplus ) } #endif #endif /* !defined( _FILE_STREAM_H ) */ ================================================ FILE: common/memory.h ================================================ /* * Memory functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _MEMORY_H ) #define _MEMORY_H #include "common.h" #if defined( HAVE_GLIB_H ) #include #endif #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #if defined( HAVE_STRING_H ) || defined( WINAPI ) #include #endif #if defined( __cplusplus ) extern "C" { #endif /* Note that 128 MiB is an arbitrary selected upper limit here */ #define MEMORY_MAXIMUM_ALLOCATION_SIZE \ ( 128 * 1024 * 1024 ) /* Memory allocation */ #if defined( HAVE_GLIB_H ) #define memory_allocate( size ) \ g_malloc( (gsize) size ) #elif defined( WINAPI ) #define memory_allocate( size ) \ HeapAlloc( GetProcessHeap(), 0, (SIZE_T) size ) #elif defined( HAVE_MALLOC ) #define memory_allocate( size ) \ malloc( size ) #endif #define memory_allocate_structure( type ) \ (type *) memory_allocate( sizeof( type ) ) #define memory_allocate_structure_as_value( type ) \ (intptr_t *) memory_allocate( sizeof( type ) ) /* Memory reallocation */ #if defined( HAVE_GLIB_H ) #define memory_reallocate( buffer, size ) \ g_realloc( (gpointer) buffer, (gsize) size ) #elif defined( WINAPI ) /* HeapReAlloc does not allocate empty (NULL) buffers as realloc does */ #define memory_reallocate( buffer, size ) \ ( buffer == NULL ) ? \ HeapAlloc( GetProcessHeap(), 0, (SIZE_T) size ) : \ HeapReAlloc( GetProcessHeap(), 0, (LPVOID) buffer, (SIZE_T) size ) #elif defined( HAVE_REALLOC ) #define memory_reallocate( buffer, size ) \ realloc( (void *) buffer, size ) #endif /* Memory free */ #if defined( HAVE_GLIB_H ) #define memory_free( buffer ) \ g_free( (gpointer) buffer ) #elif defined( WINAPI ) #define memory_free( buffer ) \ ( buffer == NULL ) ? TRUE : HeapFree( GetProcessHeap(), 0, (LPVOID) buffer ) #elif defined( HAVE_FREE ) #define memory_free( buffer ) \ free( (void *) buffer ) #endif /* Memory compare */ #if defined( HAVE_MEMCMP ) || defined( WINAPI ) #define memory_compare( buffer1, buffer2, size ) \ memcmp( (const void *) buffer1, (const void *) buffer2, size ) #endif /* Memory copy */ #if defined( HAVE_MEMCPY ) || defined( WINAPI ) #define memory_copy( destination, source, count ) \ memcpy( (void *) destination, (void *) source, count ) #endif /* Memory set */ #if defined( HAVE_MEMSET ) || defined( WINAPI ) #define memory_set( buffer, value, count ) \ memset( (void *) buffer, (int) value, count ) #endif #if defined( __cplusplus ) } #endif #endif /* !defined( _MEMORY_H ) */ ================================================ FILE: common/narrow_string.h ================================================ /* * Narrow character string functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _NARROW_STRING_H ) #define _NARROW_STRING_H #include "common.h" #include "memory.h" #include "types.h" #if defined( HAVE_GLIB_H ) #include #endif #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #if defined( HAVE_STRING_H ) || defined( WINAPI ) #include #endif #if defined( __cplusplus ) extern "C" { #endif /* String allocation */ #define narrow_string_allocate( size ) \ (char *) memory_allocate( sizeof( char ) * ( size ) ) /* String reallocation */ #define narrow_string_reallocate( string, size ) \ (char *) memory_reallocate( string, ( sizeof( char ) * ( size ) ) ) /* String length */ #if defined( HAVE_STRLEN ) || defined( WINAPI ) #define narrow_string_length( string ) \ strlen( string ) #endif /* String compare */ #if defined( HAVE_MEMCMP ) || defined( WINAPI ) #define narrow_string_compare( string1, string2, size ) \ memcmp( (void *) string1, (void *) string2, size ) #elif defined( HAVE_STRNCMP ) #define narrow_string_compare( string1, string2, size ) \ strncmp( string1, string2, size ) #endif /* Caseless string compare */ #if defined( HAVE_GLIB_H ) #define narrow_string_compare_no_case( string1, string2, size ) \ g_ascii_strncasecmp( string1, string2, size ) #elif defined( _MSC_VER ) #define narrow_string_compare_no_case( string1, string2, size ) \ _strnicmp( string1, string2, size ) #elif ( defined( WINAPI ) && !defined( __CYGWIN__ ) ) || defined( HAVE_STRNICMP ) #define narrow_string_compare_no_case( string1, string2, size ) \ strnicmp( string1, string2, size ) #elif defined( HAVE_STRNCASECMP ) #define narrow_string_compare_no_case( string1, string2, size ) \ strncasecmp( string1, string2, size ) #elif defined( HAVE_STRCASECMP ) #define narrow_string_compare_no_case( string1, string2, size ) \ strcasecmp( string1, string2 ) #endif /* String copy */ #if defined( HAVE_MEMCPY ) || defined( WINAPI ) #define narrow_string_copy( destination, source, size ) \ (char *) memcpy( (void *) destination, (void *) source, size ) #elif defined( HAVE_STRNCPY ) #define narrow_string_copy( destination, source, size ) \ strncpy( destination, source, size ) #endif /* String character search */ #if defined( HAVE_MEMCHR ) || defined( WINAPI ) #define narrow_string_search_character( string, character, size ) \ (char *) memchr( (void *) string, (int) character, size ) #elif defined( HAVE_STRCHR ) #define narrow_string_search_character( string, character, size ) \ strchr( string, (int) character ) #endif /* String reverse character search */ #if defined( HAVE_MEMRCHR ) && ( HAVE_DECL_MEMRCHR == 1 ) #define narrow_string_search_character_reverse( string, character, size ) \ (char *) memrchr( (void *) string, (int) character, size ) #elif defined( HAVE_STRRCHR ) || defined( WINAPI ) /* (void)(size) is used to suppress unused variable warnings */ #define narrow_string_search_character_reverse( string, character, size ) \ strrchr( string, (int) character ); (void)(size) #endif /* String sub-string search */ #if defined( HAVE_STRSTR ) || defined( WINAPI ) #define narrow_string_search_string( string, substring, size ) \ strstr( string, substring ) #endif /* String formatted print (snprintf) */ #if defined( HAVE_GLIB_H ) #define narrow_string_snprintf( target, size, ... ) \ g_snprintf( target, size, __VA_ARGS__ ) #elif defined( _MSC_VER ) #define narrow_string_snprintf( target, size, ... ) \ sprintf_s( target, size, __VA_ARGS__ ) #elif defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define narrow_string_snprintf \ snprintf #elif defined( HAVE_SNPRINTF ) || defined( WINAPI ) #define narrow_string_snprintf( target, size, ... ) \ snprintf( target, size, __VA_ARGS__ ) #endif /* String input conversion (sscanf) */ #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define narrow_string_sscanf \ sscanf #elif defined( HAVE_SSCANF ) || defined( WINAPI ) #define narrow_string_sscanf( string, format, ... ) \ sscanf( string, format, __VA_ARGS__ ) #endif /* Variable arguments formatted print to string function (vsnprintf) */ #if defined( HAVE_GLIB_H ) #define narrow_string_vsnprintf( string, size, format, ... ) \ g_vsnprintf( string, size, format, __VA_ARGS__ ) #elif defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define narrow_string_vsnprintf \ vsnprintf #elif defined( HAVE_VSNPRINTF ) || defined( WINAPI ) #define narrow_string_vsnprintf( string, size, format, ... ) \ vsnprintf( string, size, format, __VA_ARGS__ ) #endif #if defined( __cplusplus ) } #endif #endif /* !defined( _NARROW_STRING_H ) */ ================================================ FILE: common/system_string.h ================================================ /* * System character string functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _SYSTEM_STRING_H ) #define _SYSTEM_STRING_H #include "common.h" #include "narrow_string.h" #include "types.h" #include "wide_string.h" #if defined( _cplusplus ) extern "C" { #endif #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) #if SIZEOF_WCHAR_T != 2 #error Unsupported wide system character size #endif /* Intermediate version of the macro required * for correct evaluation predefined string */ #define _SYSTEM_STRING_INTERMEDIATE( string ) \ L ## string #define _SYSTEM_STRING( string ) \ _SYSTEM_STRING_INTERMEDIATE( string ) #define system_string_allocate( size ) \ wide_string_allocate( size ) #define system_string_reallocate( string, size ) \ wide_string_reallocate( string, size ) #define system_string_compare( destination, source, size ) \ wide_string_compare( destination, source, size ) #define system_string_compare_no_case( destination, source, size ) \ wide_string_compare_no_case( destination, source, size ) #define system_string_copy( destination, source, size ) \ wide_string_copy( destination, source, size ) #define system_string_length( string ) \ wide_string_length( string ) #define system_string_search_character( string, character, size ) \ wide_string_search_character( string, character, size ) #define system_string_search_character_reverse( string, character, size ) \ wide_string_search_character_reverse( string, character, size ) #define system_string_search_string( string, substring, size ) \ wide_string_search_string( string, substring, size ) #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define system_string_sprintf \ wide_string_snwprintf #else #define system_string_sprintf( string, size, format, ... ) \ wide_string_snwprintf( string, size, format, __VA_ARGS__ ) #endif #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define system_string_vsnprintf \ wide_string_vsnwprintf #else #define system_string_vsnprintf( string, size, format, ... ) \ wide_string_vsnwprintf( string, size, format, __VA_ARGS__ ) #endif #else #define _SYSTEM_STRING( string ) \ string #define system_string_allocate( size ) \ narrow_string_allocate( size ) #define system_string_reallocate( string, size ) \ narrow_string_reallocate( string, size ) #define system_string_compare( destination, source, size ) \ narrow_string_compare( destination, source, size ) #define system_string_compare_no_case( destination, source, size ) \ narrow_string_compare_no_case( destination, source, size ) #define system_string_copy( destination, source, size ) \ narrow_string_copy( destination, source, size ) #define system_string_length( string ) \ narrow_string_length( string ) #define system_string_search_character( string, character, size ) \ narrow_string_search_character( string, character, size ) #define system_string_search_character_reverse( string, character, size ) \ narrow_string_search_character_reverse( string, character, size ) #define system_string_search_string( string, substring, size ) \ narrow_string_search_string( string, substring, size ) #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define system_string_sprintf \ narrow_string_snprintf #else #define system_string_sprintf( string, size, format, ... ) \ narrow_string_snprintf( string, size, format, __VA_ARGS__ ) #endif #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define system_string_vsnprintf \ narrow_string_vsnprintf #else #define system_string_vsnprintf( string, size, format, ... ) \ narrow_string_vsnprintf( string, size, format, __VA_ARGS__ ) #endif #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ /* For backwards compatibility */ #define system_string_vsprintf system_string_vsnprintf #if defined( _cplusplus ) } #endif #endif /* !defined( _SYSTEM_STRING_H ) */ ================================================ FILE: common/types.h.in ================================================ /* * Type and type-support definitions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _TYPES_H ) #define _TYPES_H #include "common.h" #if defined( HAVE_LIMITS_H ) || defined( WINAPI ) #include #endif /* Make sure to include inttypes.h or stdint.h before * PRI definitions are defined */ #include <@PACKAGE@/types.h> #if defined( WINAPI ) && ( defined( _UNICODE ) || defined( UNICODE ) ) #define HAVE_WIDE_SYSTEM_CHARACTER 1 /* The system character type is wide * A system string contains either UTF-16 or UTF-32 */ typedef wchar_t system_character_t; typedef wint_t system_integer_t; #define PRIc_SYSTEM "lc" #define PRIs_SYSTEM "ls" #else /* The system character type is narrow * A system string contains either UTF-8 or extended ASCII with a codepage */ typedef char system_character_t; typedef int system_integer_t; #define PRIc_SYSTEM "c" #define PRIs_SYSTEM "s" #endif /* defined( WINAPI ) && ( defined( _UNICODE ) || defined( UNICODE ) ) */ /* Fallback for systems without PRI definitions * Do not define when pyconfig.h has been included via python.h */ #if !defined( HAVE_PYCONFIG_H ) #if !defined( PRId8 ) #define PRId8 "d" #endif #if !defined( PRId16 ) #define PRId16 "d" #endif #if !defined( PRId32 ) #if defined( WINAPI ) #define PRId32 "I32d" #else #define PRId32 "d" #endif #endif /* !defined( PRId32 ) */ #if !defined( PRId64 ) #if defined( WINAPI ) #define PRId64 "I64d" #elif __WORDSIZE == 64 #define PRId64 "ld" #else #define PRId64 "lld" #endif #endif /* !defined( PRId64 ) */ #if !defined( PRIi8 ) #define PRIi8 "i" #endif #if !defined( PRIi16 ) #define PRIi16 "i" #endif #if !defined( PRIi32 ) #if defined( WINAPI ) #define PRIi32 "I32i" #else #define PRIi32 "i" #endif #endif /* !defined( PRIi32 ) */ #if !defined( PRIi64 ) #if defined( WINAPI ) #define PRIi64 "I64i" #elif __WORDSIZE == 64 #define PRIi64 "li" #else #define PRIi64 "lli" #endif #endif /* !defined( PRIi64 ) */ #if !defined( PRIu8 ) #define PRIu8 "u" #endif #if !defined( PRIu16 ) #define PRIu16 "u" #endif #if !defined( PRIu32 ) #if defined( WINAPI ) #define PRIu32 "I32u" #else #define PRIu32 "u" #endif #endif /* !defined( PRIu32 ) */ #if !defined( PRIu64 ) #if defined( WINAPI ) #define PRIu64 "I64u" #elif __WORDSIZE == 64 #define PRIu64 "lu" #else #define PRIu64 "llu" #endif #endif /* !defined( PRIu64 ) */ #if !defined( PRIo8 ) #define PRIo8 "o" #endif #if !defined( PRIo16 ) #define PRIo16 "o" #endif #if !defined( PRIo32 ) #if defined( WINAPI ) #define PRIo32 "I32o" #else #define PRIo32 "o" #endif #endif /* !defined( PRIo32 ) */ #if !defined( PRIo64 ) #if defined( WINAPI ) #define PRIo64 "I64o" #elif __WORDSIZE == 64 #define PRIo64 "lo" #else #define PRIo64 "llo" #endif #endif /* !defined( PRIo64 ) */ #if !defined( PRIx8 ) #define PRIx8 "x" #endif #if !defined( PRIx16 ) #define PRIx16 "x" #endif #if !defined( PRIx32 ) #if defined( WINAPI ) #define PRIx32 "I32x" #else #define PRIx32 "x" #endif #endif /* !defined( PRIx32 ) */ #if !defined( PRIx64 ) #if defined( WINAPI ) #define PRIx64 "I64x" #elif __WORDSIZE == 64 #define PRIx64 "lx" #else #define PRIx64 "llx" #endif #endif /* !defined( PRIx64 ) */ #endif /* !defined( HAVE_PYCONFIG_H ) */ /* Fallback for systems without printf %jd definition */ #if defined( HAVE_PRINTF_JD ) #define PRIjd "jd" #define PRIji "ji" #define PRIju "ju" #define PRIjx "jx" #elif SIZEOF_OFF_T == 8 #define PRIjd PRId64 #define PRIji PRIi64 #define PRIju PRIu64 #define PRIjx PRIx64 #else #define PRIjd PRId32 #define PRIji PRIi32 #define PRIju PRIu32 #define PRIjx PRIx32 #endif /* defined( HAVE_PRINTF_JD ) */ /* Fallback for systems without printf %zd definition */ #if defined( HAVE_PRINTF_ZD ) #define PRIzd "zd" #define PRIzi "zi" #define PRIzu "zu" #define PRIzx "zx" #elif defined( _MSC_VER ) #define PRIzd "Id" #define PRIzi "Ii" #define PRIzu "Iu" #define PRIzx "Ix" #elif SIZEOF_SIZE_T == 8 #define PRIzd PRId64 #define PRIzi PRIi64 #define PRIzu PRIu64 #define PRIzx PRIx64 #else #define PRIzd PRId32 #define PRIzi PRIi32 #define PRIzu PRIu32 #define PRIzx PRIx32 #endif /* defined( HAVE_PRINTF_ZD ) */ /* Fallback for systems without (U)INTx_MAX definitions */ /* The maximum signed 8-bit integer is 127 (0x7f) */ #if !defined( INT8_MAX ) #define INT8_MAX (0x7f) #endif /* The maximum unsigned 8-bit integer is 256 (0xff) */ #if !defined( UINT8_MAX ) #define UINT8_MAX (0xff) #endif /* The maximum signed 16-bit integer is 32767 (0x7ffff) */ #if !defined( INT16_MAX ) #define INT16_MAX (0x7fff) #endif /* The maximum unsigned 16-bit integer is 65535 (0xffff) */ #if !defined( UINT16_MAX ) #define UINT16_MAX (0xffff) #endif /* The maximum signed 32-bit integer is 2147483647 (0x7fffffff) */ #if !defined( INT32_MAX ) #define INT32_MAX (0x7fffffffL) #endif /* The maximum unsigned 32-bit integer is 4294967295 (0xffffffff) */ #if !defined( UINT32_MAX ) #define UINT32_MAX (0xffffffffUL) #endif /* The minimum signed 64-bit integer is -9223372036854775808 (0x8000000000000000) */ #if !defined( INT64_MIN ) #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define INT64_MIN (0x8000000000000000UL) #else #define INT64_MIN (0x8000000000000000ULL) #endif #endif /* !defined( INT64_MIN ) */ /* The maximum signed 64-bit integer is 9223372036854775807 (0x7fffffffffffffff) */ #if !defined( INT64_MAX ) #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define INT64_MAX (0x7fffffffffffffffUL) #else #define INT64_MAX (0x7fffffffffffffffULL) #endif #endif /* !defined( INT64_MAX ) */ /* The maximum unsigned 64-bit integer is 18446744073709551615 (0xffffffffffffffff) */ #if !defined( UINT64_MAX ) #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define UINT64_MAX (0xffffffffffffffffUL) #else #define UINT64_MAX (0xffffffffffffffffULL) #endif #endif /* !defined( UINT64_MAX ) */ /* The maximum signed integer */ #if !defined( INT_MAX ) #define INT_MAX INT32_MAX #endif /* The maximum unsigned integer */ #if !defined( UINT_MAX ) #define UINT_MAX UINT32_MAX #endif /* The maximum signed long integer */ #if !defined( LONG_MAX ) #define LONG_MAX INT32_MAX #endif /* The maximum unsigned long integer */ #if !defined( ULONG_MAX ) #define ULONG_MAX UINT32_MAX #endif /* The maximum signed size type is platform dependent */ #if !defined( SSIZE_MAX ) #if defined( WINAPI ) #if defined( _WIN64 ) #define SSIZE_MAX INT64_MAX #else #define SSIZE_MAX INT32_MAX #endif #else #if __WORDSIZE == 64 #define SSIZE_MAX INT64_MAX #else #define SSIZE_MAX INT32_MAX #endif #endif /* WINAPI */ #endif /* SSIZE_MAX */ #endif /* !defined( _TYPES_H ) */ ================================================ FILE: common/wide_string.h ================================================ /* * Wide character string functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _WIDE_STRING_H ) #define _WIDE_STRING_H #include "common.h" #include "memory.h" #include "types.h" #if defined( HAVE_WCHAR_H ) || defined( WINAPI ) #include #endif #if defined( __cplusplus ) extern "C" { #endif /* Intermediate version of the macro required * for correct evaluation predefined string */ #define _WIDE_STRING_INTERMEDIATE( string ) \ L ## string #define _WIDE_STRING( string ) \ _WIDE_STRING_INTERMEDIATE( string ) /* String allocation */ #define wide_string_allocate( size ) \ (wchar_t *) memory_allocate( sizeof( wchar_t ) * ( size ) ) /* String reallocation */ #define wide_string_reallocate( string, size ) \ (wchar_t *) memory_reallocate( string, ( sizeof( wchar_t ) * ( size ) ) ) /* String length */ #if defined( HAVE_WCSLEN ) || defined( WINAPI ) #define wide_string_length( string ) \ wcslen( string ) #endif /* String compare */ #if defined( HAVE_WMEMCMP ) #define wide_string_compare( string1, string2, size ) \ wmemcmp( (void *) string1, (void *) string2, size ) #elif defined( HAVE_WCSNCMP ) || defined( WINAPI ) #define wide_string_compare( string1, string2, size ) \ wcsncmp( string1, string2, size ) #endif /* Caseless string compare */ #if defined( _MSC_VER ) || ( defined( __BORLANDC__ ) && ( __BORLANDC__ >= 0x0551 ) ) #define wide_string_compare_no_case( string1, string2, size ) \ _wcsnicmp( string1, string2, size ) #elif ( defined( WINAPI ) && !defined( __CYGWIN__ ) ) || defined( HAVE_WCSNICMP ) #define wide_string_compare_no_case( string1, string2, size ) \ wcsnicmp( string1, string2, size ) #elif defined( HAVE_WCSNCASECMP ) #define wide_string_compare_no_case( string1, string2, size ) \ wcsncasecmp( string1, string2, size ) #elif defined( HAVE_WCSCASECMP ) #define wide_string_compare_no_case( string1, string2, size ) \ wcscasecmp( string1, string2 ) #endif /* String copy */ #if defined( HAVE_WMEMCPY ) #define wide_string_copy( destination, source, size ) \ (wchar_t *) wmemcpy( (void *) destination, (void *) source, size ) #elif defined( HAVE_WCSNCPY ) || defined( WINAPI ) #define wide_string_copy( destination, source, size ) \ wcsncpy( destination, source, size ) #endif /* String character search */ #if defined( HAVE_WMEMCHR ) #define wide_string_search_character( string, character, size ) \ (wchar_t *) wmemchr( (void *) string, (wchar_t) character, size ) #elif defined( HAVE_WCSCHR ) || defined( WINAPI ) #define wide_string_search_character( string, character, size ) \ wcschr( string, (wchar_t) character ) #endif /* String reverse character search */ #if defined( HAVE_WMEMRCHR ) #define wide_string_search_character_reverse( string, character, size ) \ (wchar_t *) wmemrchr( (void *) string, (wchar_t) character, size ) #elif defined( HAVE_WCSRCHR ) || defined( WINAPI ) /* (void)(size) is used to suppress unused variable warnings */ #define wide_string_search_character_reverse( string, character, size ) \ wcsrchr( string, (wchar_t) character ); (void)(size) #endif /* String sub-string search */ #if defined( HAVE_WCSSTR ) || defined( WINAPI ) #define wide_string_search_string( string, substring, size ) \ wcsstr( string, substring ) #endif /* String formatted print (snwprintf) */ #if defined( _MSC_VER ) #define wide_string_snwprintf( target, size, ... ) \ swprintf_s( target, size, __VA_ARGS__ ) #elif defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define wide_string_snwprintf \ snwprintf #elif defined( WINAPI ) #define wide_string_snwprintf( target, size, ... ) \ snwprintf( target, size, __VA_ARGS__ ) #elif defined( HAVE_SWPRINTF ) #define wide_string_snwprintf( target, size, ... ) \ swprintf( target, size, __VA_ARGS__ ) #endif /* Variable arguments formatted print to string function (vsnwprintf) */ #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 ) #define wide_string_vsnwprintf \ _vsnwprintf #elif defined( WINAPI ) #define wide_string_vsnwprintf( string, size, format, ... ) \ _vsnwprintf( string, size, format, __VA_ARGS__ ) #elif defined( HAVE_VSWPRINTF ) #define wide_string_vsnwprintf( string, size, format, ... ) \ vswprintf( string, size, format, __VA_ARGS__ ) #endif #if defined( __cplusplus ) } #endif #endif /* !defined( _WIDE_STRING_H ) */ ================================================ FILE: configure.ac ================================================ AC_PREREQ([2.71]) AC_INIT( [libfsrefs], [20251205], [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( [include/libfsrefs.h.in]) AM_INIT_AUTOMAKE([gnu 1.6 tar-ustar]) AM_EXTRA_RECURSIVE_TARGETS([sources splint]) AC_CONFIG_MACRO_DIR([m4]) dnl Check for host type AC_CANONICAL_HOST dnl Check for libtool DLL support LT_INIT([win32-dll]) dnl Checks for programs AC_PROG_CC AC_PROG_GCC_TRADITIONAL AC_PROG_CXX AC_PROG_MAKE_SET AC_PROG_INSTALL dnl Check for libtool AC_SUBST(LIBTOOL_DEPS) dnl Check for pkg-config AC_PATH_PROG(PKGCONFIG,[pkg-config]) dnl Support of internationalization (i18n) AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION([0.21]) dnl Check for compiler language support AC_C_CONST AC_C_VOLATILE dnl Check for large file support AC_SYS_LARGEFILE dnl Check if shared library support should be disabled AX_COMMON_CHECK_DISABLE_SHARED_LIBS dnl Check if tools should be build as static executables AX_COMMON_CHECK_ENABLE_STATIC_EXECUTABLES dnl Check if WINAPI support should be enabled AX_COMMON_CHECK_ENABLE_WINAPI dnl Check if wide character type should be enabled AX_COMMON_CHECK_ENABLE_WIDE_CHARACTER_TYPE dnl Check if verbose output should be enabled AX_COMMON_CHECK_ENABLE_VERBOSE_OUTPUT dnl Check if debug output should be enabled AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT dnl Check for type definitions AX_TYPES_CHECK_LOCAL dnl Check if common required headers and functions are available AX_COMMON_CHECK_LOCAL dnl Check if libcerror or required headers and functions are available AX_LIBCERROR_CHECK_ENABLE dnl Check if libcthreads or required headers and functions are available AX_LIBCTHREADS_CHECK_ENABLE dnl Check if libcdata or required headers and functions are available AX_LIBCDATA_CHECK_ENABLE dnl Check if libclocale or required headers and functions are available AX_LIBCLOCALE_CHECK_ENABLE dnl Check if libcnotify or required headers and functions are available AX_LIBCNOTIFY_CHECK_ENABLE dnl Check if libcsplit or required headers and functions are available AX_LIBCSPLIT_CHECK_ENABLE dnl Check if libuna or required headers and functions are available AX_LIBUNA_CHECK_ENABLE dnl Check if libcfile or required headers and functions are available AX_LIBCFILE_CHECK_ENABLE dnl Check if libcpath or required headers and functions are available AX_LIBCPATH_CHECK_ENABLE dnl Check if libbfio or required headers and functions are available AX_LIBBFIO_CHECK_ENABLE dnl Check if libfcache or required headers and functions are available AX_LIBFCACHE_CHECK_ENABLE dnl Check if libfdata or required headers and functions are available AX_LIBFDATA_CHECK_ENABLE dnl Check if libfdatetime or required headers and functions are available AX_LIBFDATETIME_CHECK_ENABLE dnl Check if libfguid or required headers and functions are available AX_LIBFGUID_CHECK_ENABLE dnl Check if libfwnt or required headers and functions are available AX_LIBFWNT_CHECK_ENABLE dnl Check if libfsrefs required headers and functions are available AX_LIBFSREFS_CHECK_LOCAL dnl Check if libfusn or required headers and functions are available AX_LIBFUSN_CHECK_ENABLE dnl Check if fsrefstools required headers and functions are available AX_FSREFSTOOLS_CHECK_LOCAL dnl Check if DLL support is needed AX_LIBFSREFS_CHECK_DLL_SUPPORT dnl Check if tests required headers and functions are available AX_TESTS_CHECK_LOCAL AX_TESTS_CHECK_OSSFUZZ dnl Set additional compiler flags CFLAGS="$CFLAGS -Wall"; dnl Check if requires and build requires should be set in spec file AS_IF( [test "x$ac_cv_libcerror" = xyes || test "x$ac_cv_libcthreads" = xyes || test "x$ac_cv_libcdata" = xyes || test "x$ac_cv_libclocale" = xyes || test "x$ac_cv_libcnotify" = xyes || test "x$ac_cv_libcsplit" = xyes || test "x$ac_cv_libuna" = xyes || test "x$ac_cv_libcfile" = xyes || test "x$ac_cv_libcpath" = xyes || test "x$ac_cv_libbfio" = xyes || test "x$ac_cv_libfcache" = xyes || test "x$ac_cv_libfdata" = xyes || test "x$ac_cv_libfdatetime" = xyes || test "x$ac_cv_libfguid" = xyes || test "x$ac_cv_libfwnt" = xyes], [AC_SUBST( [libfsrefs_spec_requires], [Requires:]) ]) AS_IF( [test "x$ac_cv_libfusn" = xyes], [AC_SUBST( [libfsrefs_spec_tools_build_requires], [BuildRequires:]) ]) dnl Set the date for the dpkg files AC_SUBST( [DPKG_DATE], [`date -R 2> /dev/null`]) dnl Set the date for the spec file AC_SUBST( [SPEC_DATE], [`date +"%a %b %e %Y" 2> /dev/null`]) dnl Generate Makefiles AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([include/Makefile]) AC_CONFIG_FILES([common/Makefile]) AC_CONFIG_FILES([libcerror/Makefile]) AC_CONFIG_FILES([libcthreads/Makefile]) AC_CONFIG_FILES([libcdata/Makefile]) AC_CONFIG_FILES([libclocale/Makefile]) AC_CONFIG_FILES([libcnotify/Makefile]) AC_CONFIG_FILES([libcsplit/Makefile]) AC_CONFIG_FILES([libuna/Makefile]) AC_CONFIG_FILES([libcfile/Makefile]) AC_CONFIG_FILES([libcpath/Makefile]) AC_CONFIG_FILES([libbfio/Makefile]) AC_CONFIG_FILES([libfcache/Makefile]) AC_CONFIG_FILES([libfdata/Makefile]) AC_CONFIG_FILES([libfdatetime/Makefile]) AC_CONFIG_FILES([libfguid/Makefile]) AC_CONFIG_FILES([libfwnt/Makefile]) AC_CONFIG_FILES([libfsrefs/Makefile]) AC_CONFIG_FILES([libfusn/Makefile]) AC_CONFIG_FILES([fsrefstools/Makefile]) AC_CONFIG_FILES([po/Makefile.in]) AC_CONFIG_FILES([po/Makevars]) AC_CONFIG_FILES([manuals/Makefile]) AC_CONFIG_FILES([tests/Makefile]) AC_CONFIG_FILES([ossfuzz/Makefile]) AC_CONFIG_FILES([msvscpp/Makefile]) dnl Generate header files AC_CONFIG_FILES([include/libfsrefs.h]) AC_CONFIG_FILES([include/libfsrefs/definitions.h]) AC_CONFIG_FILES([include/libfsrefs/features.h]) AC_CONFIG_FILES([include/libfsrefs/types.h]) AC_CONFIG_FILES([libfsrefs/libfsrefs_definitions.h]) dnl Generate distribution specific files AC_CONFIG_FILES([common/types.h]) AC_CONFIG_FILES([dpkg/changelog]) AC_CONFIG_FILES([libfsrefs/libfsrefs.rc]) AC_CONFIG_FILES([libfsrefs.pc]) AC_CONFIG_FILES([libfsrefs.spec]) dnl Generate a source configuration file AC_CONFIG_HEADERS([common/config.h]) AC_OUTPUT dnl Print a summary AC_MSG_NOTICE([ Building: libcerror support: $ac_cv_libcerror libcthreads support: $ac_cv_libcthreads libcdata support: $ac_cv_libcdata libclocale support: $ac_cv_libclocale libcnotify support: $ac_cv_libcnotify libcsplit support: $ac_cv_libcsplit libuna support: $ac_cv_libuna libcfile support: $ac_cv_libcfile libcpath support: $ac_cv_libcpath libbfio support: $ac_cv_libbfio libfcache support: $ac_cv_libfcache libfdata support: $ac_cv_libfdata libfdatetime support: $ac_cv_libfdatetime libfguid support: $ac_cv_libfguid libfwnt support: $ac_cv_libfwnt libfusn support: $ac_cv_libfusn Features: Multi-threading support: $ac_cv_libcthreads_multi_threading Wide character type support: $ac_cv_enable_wide_character_type fsrefstools are build as static executables: $ac_cv_enable_static_executables Verbose output: $ac_cv_enable_verbose_output Debug output: $ac_cv_enable_debug_output ]); ================================================ FILE: documentation/Resilient File System (ReFS).asciidoc ================================================ = Resilient File System (ReFS) Analysis of the Windows Resilient File System :toc: :toclevels: 4 :numbered!: [abstract] == Summary The Resilient File System (ReFS) was introduced in Windows 8 server pre release, which became Windows 2012 server, and was added to Windows 8.1. ReFS is a new file system to the Windows NT platform. This specification is based on available documentation and was enhanced by analyzing test data. This document is intended as a working document of the data format specification for the libfsrefs project. [preface] == Document information [cols="1,5"] |=== | Author(s): | Joachim Metz | Abstract: | This document contains information about the Resilient File System (ReFS) | Classification: | Public | Keywords: | ReFS, Resilient File System |=== [preface] == License .... Copyright (C) 2012-2023, Joachim Metz . Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". .... [preface] == Revision history [cols="1,1,1,5",options="header"] |=== | Version | Author | Date | Comments | 0.0.1 | J.B. Metz | May 2012 | Initial version. | 0.0.2 | J.B. Metz | September 2012 | Additional information about format. | 0.0.3 | J.B. Metz | November 2013 | Additional information about format. | 0.0.4 | J.B. Metz | June 2023 | Switched to asciidoc format and additional information about format. | 0.0.5 | J.B. Metz | July 2023 | Additional information about format. |=== :numbered: == Overview The Resilient File System (ReFS) was introduced in Windows 8 server pre release, which became Windows 2012 server, and was added to Windows 8.1. ReFS is a new file system to the Windows NT platform. A volume consists of: * a volume header * metadata blocks ** superblock * file and directory data * a copy of the volume header [cols="1,5",options="header"] |=== | Characteristics | Description | Byte order | little-endian | Date and time values | FILETIME in UTC | Character strings | ASCII strings are Single Byte Character (SBC) or Multi Byte Character (MBC) string stored with a codepage. Sometimes referred to as ANSI string representation. + Though technically maybe incorrect, this document will use term (extended) ASCII string. + Unicode strings are stored in UTF-16 little-endian without the byte order mark (BOM). |=== === Versions There are multiple version of ReFS. [cols="1,5",options="header"] |=== | ReFS version | Remarks | 1.1 | Used by Windows 8 (preview) and Windows Server 2012 | 1.2 | Used by Windows 8.1, Windows 10 (1507 to 1607) and Windows Server 2012 R2 | | | 2.0 | Used by Windows Server 2016 (preview) | | | 2.2 | Used by Windows 10 (preview) | | | 3.0 | Used by Windows Server 2016 (preview) | 3.1 | Used by Windows Server 2016 | 3.2 | Used by Windows 10 (1703) | 3.3 | Used by Windows 10 (1709) | 3.4 | Used by Windows 10 (1803) and Windows server 2019 | 3.5 | Used by Windows 11 (preview) | 3.6 | Used by Windows 11 (preview) | 3.7 | Used by Windows 11 and Windows server 2022 |=== === Test version The following version of programs were used to test the information within this document: * Windows 8 * Windows 2012 Server R2 * Windows 2016 Server * Windows 2019 Server == The volume header The volume header is stored at the start of the volume. A copy of volume header is stored at the end of the volume. [NOTE] The size of the partition can be larger then the number of sectors in the volume. The volume header is 512 bytes of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description 4+| _File system recognition structure (FILE_SYSTEM_RECOGNITION_STRUCTURE)_ | 0 | 3 | 0x00 | Boot entry point (or JMP instruction) | 3 | 8 | "ReFS\x00\x00\x00\x00" | File system signature (or file system name) | 11 | 5 | 0x00 | [yellow-background]*Unknown (empty values)* | 16 | 4 | "FSRS" | File system recognition structure identifier | 20 | 2 | 0x200 | [yellow-background]*Unknown (size of file system recognition structure?)* | 22 | 2 | | [yellow-background]*Unknown (checksum of file system recognition structure?)* 4+| | 24 | 8 | | Number of sectors | 32 | 4 | | Sector size | 36 | 4 | | Sectors per cluster block (allocation unit) | 40 | 1 | | Major format version | 41 | 1 | | Minor format version | 42 | 2 | 0x00 | [yellow-background]*Unknown (flags?)* | 44 | 4 | | [yellow-background]*Unknown* | 48 | 8 | 0x00 | [yellow-background]*Unknown (empty values)* | 56 | 8 | | Volume serial number | 64 | 8 | | Container (or band size) | 72 | 440 | 0x00 | [yellow-background]*Unknown (empty values)* |=== [NOTE] Note that currently 4096 and 65536 have been observed as supported cluster block (allocation unit) byte sizes. [NOTE] Note the container size has been first observed in format version 3.4, in previous format versions such as 3.1, which has containers, this value is 0. == Metadata Metadata is stored in one or more blocks (or pages). There are multiple levels of metadata: [cols="1,1,5",options="header"] |=== | Level | Block signature | Description | 0 | "SUPB" | Superblock | 1 | "CHKP" | Checkpoint | 2+ | "MSB+" | Ministore tree (B+-tree) |=== [yellow-background]*TODO: is the metadata block referred to as synchronous ministore (SMS) by Microsoft?* === [[metadata_block_header]]Metadata block header ==== Metadata block header - format version 1 The format version 1 metadata block header is 48 bytes of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | Block number + The block number is relative from the start of the volume | 8 | 8 | | [yellow-background]*Unknown (sequence number?)* | 16 | 8 | 0x00 | [yellow-background]*Unknown (empty values)* | 24 | 8 | | [yellow-background]*Unknown* | 32 | 8 | 0x01 | [yellow-background]*Unknown (flags or level?)* | 40 | 8 | 0x00 | [yellow-background]*Unknown (empty values)* |=== [yellow-background]*TODO: It seems that the data in bytes 8 – 23 is used as an identifier. Level 3 table contains an identifier that matches the data in the corresponding level 4 block.* ==== Metadata block header - format version 3 The format version 3 metadata block header is 80 bytes of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 4 | | Signature | 4 | 4 | 2 | [yellow-background]*Unknown* | 8 | 4 | 0x00 | [yellow-background]*Unknown (empty values)* | 12 | 4 | | [yellow-background]*Unknown (volume signature?)* | 16 | 8 | | [yellow-background]*Unknown (virtual allocator clock?)* | 24 | 8 | | [yellow-background]*Unknown (tree update clock?)* | 32 | 8 | | First block number | 40 | 8 | | Second block number | 48 | 8 | | Third block number | 56 | 8 | | Fourth block number | 64 | 8 | | [yellow-background]*Unknown (table identifier upper 64-bit?)* | 72 | 8 | | [yellow-background]*Unknown (table identifier lower 64-bit?)* |=== [NOTE] In format version 3 the metadata can span multiple metadata blocks. === [[metadata_block_reference]]Metadata block reference ==== Metadata block reference - format version 1 The format version 1 metadata block reference is 24 bytes of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | Block number 4+| _Checkum descriptor_ | 8 | 2 | 0x00 | [yellow-background]*Unknown (empty values)* | 10 | 1 | | Checksum type | 11 | 1 | | Checksum data offset + The offset is relative to the start of the checksum descriptor | 12 | 2 | | Checksum data size | 14 | 2 | 0x00 | [yellow-background]*Unknown (empty values)* | 16 | 8 | | Checksum data |=== ==== Metadata block reference - format version 3 The format version 3 metadata block reference is 48 bytes of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | First block number | 8 | 8 | | Second block number | 16 | 8 | | Third block number | 24 | 8 | | Fourth block number 4+| _Checkum descriptor_ | 32 | 2 | 0x00 | [yellow-background]*Unknown (empty values)* | 34 | 1 | | Checksum type | 35 | 1 | | Checksum data offset + The offset is relative to the start of the checksum descriptor | 36 | 2 | | Checksum data size | 38 | 2 | 0x00 | [yellow-background]*Unknown (empty values)* | 40 | 8 | | Checksum data |=== ==== Checksum type [cols="1,1,5",options="header"] |=== | Value | Identifier | Description | 1 | | CRC-32C (or CRC32-C), which uses the Castagnoli polynomial (0x1edc6f41) | 2 | | CRC64-ECMA-182 + Checksum data size is 8 bytes |=== == Superblock (level 0) metadata The superblock metadata consists of: * <> * Superblock * Checkpoint references data * Self <> === Superblock The superblock is 48 bytes of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 16 | | Volume identifier | 16 | 8 | 0x00 | [yellow-background]*Unknown (empty values)* | 24 | 8 | | [yellow-background]*Unknown (sequence number?)* | 32 | 4 | | Checkpoint references data offset + The offset is relative to the start of the metadata block | 36 | 4 | 2 | [yellow-background]*Unknown (number of checkpoint metadata block numbers?)* | 40 | 4 | | Self (block) reference data offset + The offset is relative to the start of the metadata block | 44 | 4 | | Self (block) reference data size |=== === Checkpoint references data The checkpoint references data is variable of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | number of entries x 8 | | Checkpoint metadata block number |=== == Checkpoint (level 1) metadata The checkpoint metadata consists of: * <> * Superblock * Checkpoint header * Checkpoint trailer * Self < * Ministore tree <> === Checkpoint header The checkpoint header is 16 bytes of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 4 | 0x00 | [yellow-background]*Unknown (empty values)* | 4 | 2 | | Major format version | 6 | 2 | | Minor format version | 8 | 4 | | Self (block) reference data offset + The offset is relative to the start of the metadata block | 12 | 4 | | Self (block) reference data size |=== === Checkpoint trailer ==== Checkpoint trailer - format version 1 The format version 1 checkpoint trailer is variable of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | [yellow-background]*Unknown (sequence number?)* | 8 | 4 | | [yellow-background]*Unknown (checkpoint data size?)* | 12 | 4 | | [yellow-background]*Unknown (seen: 32)* | 16 | 8 | | [yellow-background]*Unknown* | 24 | 4 | | Number of offsets | 28 | number of offset x 4 | | Array of offsets + The offset is relative to the start of the metadata block | ... | ... | 0x00 | [yellow-background]*Unknown (empty values)* |=== ==== Checkpoint trailer - format version 3 The format version 3 checkpoint trailer is variable of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | [yellow-background]*Unknown (sequence number or checkpoint clock?)* | 8 | 8 | | [yellow-background]*Unknown (virtual allocator clock?)* | 16 | 4 | | [yellow-background]*Unknown (oldest log record?)* | 20 | 4 | | [yellow-background]*Unknown* | 24 | 8 | | [yellow-background]*Unknown* | 32 | 8 | | [yellow-background]*Unknown* | 40 | 4 | | [yellow-background]*Unknown (checkpoint data size?)* | 44 | 4 | | [yellow-background]*Unknown (seen: 32)* | 48 | 4 | | Number of offsets | 52 | number of offset x 4 | | Array of offsets + The offset is relative to the start of the metadata block | ... | ... | 0x00 | [yellow-background]*Unknown (empty values)* |=== === Ministore tree block references [cols="1,1,5",options="header"] |=== | Index | Identifier | Description | 0 | | Objects tree | 1 | | Medium allocator tree | 2 | | Container allocator tree | 3 | | Schema tree | 4 | | Parent-child relationship tree | 5 | | Copy of object tree | 6 | | Block reference count tree 3+| _Seen in format version 3_ | 7 | | Container tree | 8 | | Copy of container tree | 9 | | Copy of schema tree | 10 | | Container index tree | 11 | | Integrity state tree | 12 | | Small allocator tree |=== == [[ministore_tree]]Ministore tree (level 2+) metadata The ministore tree metadata consists of: * <> * Node header offset * Optional tree header * Optional header data * Node header * Node records * Unused * Node record offsets [NOTE] Note that in format version 3 the upper 16-bit of the record offsets is set to 0xffff. === Node header offset The node header offset is 4 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 4 | | Node header offset + The offset is relative to the start of the node header offset |=== === Tree header The tree header is 36 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 2 | 40 | Header data offset + The offset is relative to the start of the node header offset | 2 | 2 | | [yellow-background]*Unknown (seen: 0 or 1)* | 4 | 4 | | [yellow-background]*Unknown (seen: 0)* | 8 | 4 | | [yellow-background]*Unknown* | 12 | 4 | | [yellow-background]*Unknown* | 16 | 4 | | [yellow-background]*Unknown (seen: 2)* | 20 | 4 | | [yellow-background]*Unknown (number of branch nodes?)* | 24 | 4 | | [yellow-background]*Unknown* | 28 | 4 | | [yellow-background]*Unknown (number of leaf values?)* | 32 | 4 | | [yellow-background]*Unknown* |=== === Node header The node header is 32 bytes of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 4 | | Data area start offset + The offset is relative to the start of the node header | 4 | 4 | | Data area end offset + The offset is relative to the start of the node header | 8 | 4 | | Unused data size | 12 | 1 | | Node level, where 0 is the level of the leaf values | 13 | 1 | | Node type flags | 14 | 2 | | [yellow-background]*Unknown (empty values)* | 16 | 4 | | Record offsets start offset + The offset is relative to the start of the node information entry | 20 | 4 | | Number of record offsets | 24 | 4 | | Record offsets end offset + The offset is relative to the start of the node information entry or 0 if not set | 28 | 4 | | [yellow-background]*Unknown (empty values)* |=== ==== Node type flags [cols="1,1,5",options="header"] |=== | Value | Identifier | Description | 0x01 | | Is branch (or inner) node | 0x02 | | Is root node | 0x04 | | Is stream node |=== === Node record The node record is variable of size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 4 | | Node record size + Includes the 4 bytes of the size value | 4 | 2 | | Key data offset + The offset is relative to the start of the node record | 6 | 2 | | Key data size | 8 | 2 | | Flags + See section: <> | 10 | 2 | | Value data offset + The offset is relative to the start of the node record | 12 | 2 | | Value data size |=== ==== [[node_record_flags]]Node record flags [cols="1,1,5",options="header"] |=== | Value | Identifier | Description | 0x0002 | | [yellow-background]*Unknown (No key data?)* | 0x0004 | | [yellow-background]*Unknown (Is unallocated (free)?)* | 0x0008 | | Value data contains an embedded Ministore node | | | | 0x0040 | | [yellow-background]*Unknown (Is stream record?)* |=== ==== Branch node record The key of a branch node contains key of the largest value of the corresponding branch. Note that the key of the last branch node can be empty. The value of a branch node contains a <> of the corresponding sub node. == Objects tree The objects tree is a <> that contains object records. === Object record An object record consists of: * key, containing an <> * value, containing a <> that reference the corresponding object <> ==== Object record key The object record key is 16 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | Record key (upper 64-bits), which contains 0-byte values | 8 | 8 | | Record key (lower 64-bits), which contains an <> |=== [NOTE] Note that the record key corresponds to the file system identifier. ==== Object record value - format version 1 The format version 1 object record value is 48 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 24 | | Block reference + See section: <> | 24 | 8 | | [yellow-background]*Unknown* | 32 | 4 | | [yellow-background]*Unknown* | 36 | 4 | | [yellow-background]*Unknown* | 40 | 8 | | [yellow-background]*Unknown (related object identifier?)* |=== ===== Object record value - format version 3 The format version 3 object record value is variable in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | [yellow-background]*Unknown* | 8 | 4 | | [yellow-background]*Unknown* | 12 | 4 | | [yellow-background]*Unknown (size of block reference data?)* | 16 | 4 | | [yellow-background]*Unknown (size of used record data?)* | 20 | 4 | | [yellow-background]*Unknown* | 24 | 4 | | [yellow-background]*Unknown* | 28 | 4 | | [yellow-background]*Unknown* | 32 | 48 | | Block reference + See section: <> | ... | ... | | [yellow-background]*Unknown (remnant data?)* |=== ===== [[object_identifiers]]Object identifiers [cols="1,1,5",options="header"] |=== | Value | Identifier | Description | 0x00000007 | | Upcase object + Introduced in format version 3? | 0x00000008 | | Copy of Upcase object + Introduced in format version 3? | 0x00000009 | | Logfile information object + Introduced in format version 3? | 0x0000000a | | Copy of logfile information object + Introduced in format version 3? | | | | 0x0000000d | | Trash stream object + Introduced in format version 3? | | | | 0x00000500 | | <> | 0x00000501 | | Copy of volume information object + Introduced in format version 3? | | | | 0x00000520 | | <> | | | | 0x00000530 | | | | | | 0x00000540 | | + Introduced in format version 3? | 0x00000541 | | + Introduced in format version 3? | | | | 0x00000600 | REFS_ROOT_DIRECTORY_ID | <> | | | | 0x00000701 | REFS_OBJECT_UNKNOWN_3 | <> + Values 0x00000701 and above are used for sub directories. |=== == Container tree The container tree is a <> that contains container records. [NOTE] Note that the container tree has only been observed with format version 3. === Container record A container record consists of: * key, containing the container (or band) identifier * value, containing information about the container ==== Container record key The container record key is the first 16 bytes of the container record value. ==== Container record value The container record value is 160 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | Container (or band) identifier | 8 | 4 | | [yellow-background]*Unknown* | 12 | 4 | | [yellow-background]*Unknown* | 16 | 4 | | [yellow-background]*Unknown (flags?)* | 20 | 4 | | [yellow-background]*Unknown* | 24 | 8 | | [yellow-background]*Unknown* | 32 | 8 | | [yellow-background]*Unknown (number of unused cluster blocks?)* | 40 | 8 | | [yellow-background]*Unknown* | 48 | 28 | | [yellow-background]*Unknown (empty values)* | 76 | 4 | | [yellow-background]*Unknown* | 80 | 64 | | [yellow-background]*Unknown (empty values)* | 144 | 8 | | Cluster block number | 152 | 8 | | Cluster size + Contains the number of (cluster) blocks |=== == [[directory_object]]Directory object The directory object is a <> that contains multiple directory records. The format of the directory record value is dependent on the record type in the directory record key. A ReFS file system identifier consists of: * 64-bit file identifier or 0 for the directory * 64-bit directory object identifier === Directory record key The directory record key is variable in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 2 | | Record type | 2 | ... | | Data |=== ==== Record types [cols="1,1,5",options="header"] |=== | Value | Identifier | Description | 0x0010 | | Base record | 0x0020 | | Name record | 0x0030 | | Entry record |=== ==== Base record (record type: 0x0010) The directory object base record key is 4 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 2 | 0x0010 | Record type | 2 | 2 | | [yellow-background]*Unknown (seen: 0x0000)* |=== ==== Name record (record type: 0x0020) The directory object name record key is 24 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 2 | 0x0020 | Record type | 2 | 2 | | [yellow-background]*Unknown (seen: 0x8000)* | 4 | 4 | | [yellow-background]*Unknown (empty values?)* | 8 | 8 | | File system identifier (lower 64-bits) | 16 | 8 | | File system identifier (upper 64-bits) |=== The directory object name record value is variable in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | [yellow-background]*Unknown (empty values?)* | 8 | 2 | | [yellow-background]*Unknown (seen: 0x0c)* | 10 | ... | | Name + Contains an UTF-16 little-endian without end-of-string character |=== [NOTE] The name string is not strict UTF-16 since it allows for unpaired surrogates, such as "U+d800" and "U+dc00". ==== Entry record (record type: 0x0030) The directory object entry record key is variable in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 2 | 0x0030 | Record type | 2 | 2 | | Directory entry type + See section: <> | 4 | ... | | Name + Contains an UTF-16 little-endian without end-of-string character |=== [NOTE] The name string is not strict UTF-16 since it allows for unpaired surrogates, such as "U+d800" and "U+dc00". The format of the directory object entry record value is dependent on the directory entry type. ==== [[directory_entry_types]]Directory entry types [cols="1,1,5",options="header"] |=== | Value | Identifier | Description | 0 | | File system metadata file | 1 | | File + See section: <> | 2 | | Directory + See section: <> |=== === [[directory_object_entry_record_directory_values]]Directory object entry record directory values The directory object entry record directory values are 72 bytes in size and consist of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | Directory object identifier + See section: <> | 8 | 8 | | [yellow-background]*Unknown (part of the object identifier?)* | 16 | 8 | | Creation date and time + Contains a FILETIME | 24 | 8 | | Last modification date and time + (Also referred to as last written date and time) + Contains a FILETIME | 32 | 8 | | Entry (or metadata) last modification date and time + Contains a FILETIME | 40 | 8 | | Last access date and time + Contains a FILETIME | 48 | 16 | | [yellow-background]*Unknown (empty values)* | 64 | 4 | | File attribute flags | 68 | 4 | | [yellow-background]*Unknown (empty values)* |=== === [[directory_object_entry_record_file_values]]Directory object entry record file values The directory object entry record file values are variable in size and consist of an embedded Ministore node. The embedded Ministore node contains: * header data * one or more <> [NOTE] Note that although the Ministore node is embedded in the record value it can branch out to other Ministore nodes stored elsewhere. The header data is 128 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | Creation date and time + Contains a FILETIME | 8 | 8 | | Last modification date and time + (Also referred to as last written date and time) + Contains a FILETIME | 16 | 8 | | Entry (or metadata) last modification date and time + Contains a FILETIME | 24 | 8 | | Last access date and time + Contains a FILETIME | 32 | 4 | | File attribute flags | 36 | 4 | | [yellow-background]*Unknown* | 40 | 8 | | File system identifier (lower 64-bits) | 48 | 8 | | File system identifier (upper 64-bits) | 56 | 4 | | [yellow-background]*Unknown* | 60 | 4 | | [yellow-background]*Unknown* | 64 | 8 | | Data size | 72 | 8 | | Allocated (or reserved) data size | 80 | 32 | | [yellow-background]*Unknown* | 112 | 8 | | [yellow-background]*Unknown* | 120 | 8 | | [yellow-background]*Unknown* |=== === [[directory_object_entry_record_attribute]]Attribute record key data of default (or nameless) data attribute .... 00000000: 60 01 00 00 00 00 00 00 80 00 00 00 00 00 `....... ...... .... key data of alternate data attribute .... 00000000: 4a 00 00 00 00 00 00 00 b0 00 00 00 6d 00 79 00 J....... ....m.y. 00000010: 61 00 64 00 73 00 a.d.s. .... [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | [yellow-background]*Unknown* | 8 | 4 | | [yellow-background]*Unknown (attribute type)* | 12 | ... | | Attribute name string + Contains an UTF-16 little-endian without end-of-string character or an end-of-string character if the attribute is nameless |=== [cols="1,1,5",options="header"] |=== | Value | Identifier | Description | 0x10 | $STANDARD_INFORMATION | | 0x30 | $FILENAME | | 0x38 | $DIR_LINK | | 0x40 | $OBJECT_ID | | 0x50 | $OBSOLETE | | 0x60 | $VOLUME_NAME | | 0x70 | $VOLUME_INFO | | 0x80 | $DATA | | 0x90 | $INDEX_ROOT | | 0xa0 | $INDEX_ALLOCATION | | 0xb0 | $NAMED_DATA | | 0xc0 | $REPARSE_POINT | | 0xd0 | $EA_INFORMATION | | 0xe0 | $EA | |=== ==== [[directory_object_entry_record_resident_attribute]]Directory object entry record resident attribute The directory object entry record resident attribute is variable in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 4 | | [yellow-background]*Unknown (seen: 0 resident?)* | 4 | 4 | | (Resident or inline) data offset + The offset is relative to the start of the record value | 8 | 4 | | (Resident or inline) data size | 12 | 4 | | [yellow-background]*Unknown* | 16 | 8 | | [yellow-background]*Unknown* | 24 | 8 | | [yellow-background]*Unknown* | 32 | 8 | | [yellow-background]*Unknown* | 40 | 8 | | [yellow-background]*Unknown* | 32 | 8 | | [yellow-background]*Unknown* | 40 | 4 | | [yellow-background]*Unknown* | 44 | ... | | (Resident or inline) data |=== ==== [[directory_object_entry_record_non_resident_attribute]]Directory object entry record non-resident attribute The directory object entry record non-resident attribute is variable in size and consist of an embedded Ministore node. The embedded Ministore node contains: * header data * zero or more <> The header data is 96 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 4 | | [yellow-background]*Unknown (seen: 1 non-resident?)* | 4 | 8 | | [yellow-background]*Unknown (empty values?)* | 12 | 8 | | Allocated (or reserved) data size | 20 | 8 | | Data size | 28 | 8 | | Valid data size | 36 | 60 | | [yellow-background]*Unknown (empty values?)* |=== === [[directory_object_entry_record_data_run]]Data run record The directory object entry record data run record key is the first 16 bytes of the directory object entry record data run record value. The directory object entry record data run record value is 16 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | Data run logical offset | 8 | 8 | | Data run size + Contains the number of metadata blocks | 16 | 8 | | Data run physical offset + Contains a metadata block number | 24 | 8 | | [yellow-background]*Unknown* |=== == [[file_system_information_object]]File system information object The file system information object is a <> that contains a single file system information record. === File system information record key The file system information record key is variable in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 2 | 0x30 | [yellow-background]*Unknown* | 2 | 2 | 0x01 | [yellow-background]*Unknown* | 4 | ... | "Volume Direct IO File" | String + Contains an UTF-16 little-endian without end-of-string character |=== === File system information record value The file system record value is TODO bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description |=== [yellow-background]*TODO: describe* == [[volume_information_object]]Volume information object The volume information object is a <> that contains multiple volume information records. === Volume information record key The volume information record key is 8 bytes in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | 8 | | Object identifier + See section: <> |=== [cols="1,1,5",options="header"] |=== | Value | Identifier | Description | 0x00000510 | | Volume name record + Comparable to NTFS volume name attribute ($VOLUME_NAME) | | | | 0x00000520 | | [yellow-background]*TODO: describe* | | | | 0x00000530 | | [yellow-background]*TODO: describe* | | | | 0x00000540 | | [yellow-background]*TODO: describe* |=== === Volume name record value The volume name record value is variable in size and consists of: [cols="1,1,1,5",options="header"] |=== | Offset | Size | Value | Description | 0 | ... | | Volume name + Contains an UTF-16 little-endian without end-of-string character |=== :numbered!: [appendix] == References `[BALLENTHIN12]` [cols="1,5",options="header"] |=== | Title: | The Microsoft ReFS On-Disk Layout | Author(s): | Willi Ballenthin | Date: | 2012 | URL: | http://www.williballenthin.com/forensics/refs/index.html |=== `[GREEN13]` [cols="1,5",options="header"] |=== | Title: | Resilient File System (ReFS) - Analysis of the File System found on Windows Server 2012 and Windows 8.1 | Author(s): | Paul K. Green | Version: | 0.6 | Date: | September 2013 | URL: | https://docs.google.com/uc?export=download&id=0B7_P1Njdyx3hdnNtYlpVZ2taaU0 |=== `[PRADE19]` [cols="1,5",options="header"] |=== | Title: | Forensic Analysis of the Resilient File System (ReFS) Version 3.4 | Author(s): | Paul Prade, Tobias Groß, Andreas Dewald | Date: | December 2019 | URL: | https://www.sciencedirect.com/science/article/pii/S266628172030010X |=== `[MSDN]` [cols="1,5",options="header"] |=== | Title: | http://www.williballenthin.com/forensics/refs/index.html | URL: | http://blogs.msdn.com/b/b8/archive/2012/01/16/building-the-next-generation-file-system-for-windows-refs.aspx |=== [cols="1,5",options="header"] |=== | Title: | FILE_SYSTEM_RECOGNITION_STRUCTURE structure | URL: | https://learn.microsoft.com/en-us/windows/win32/fileio/file-system-recognition-structure |=== `[WIKIPEDIA]` [cols="1,5",options="header"] |=== | Title: | Wikipedia: ReFS | URL: | https://en.wikipedia.org/wiki/ReFS |=== [appendix] == GNU Free Documentation License Version 1.3, 3 November 2008 Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. === 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. === 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The "publisher" means any person or entity that distributes copies of the Document to the public. A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. === 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. === 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. === 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. === 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements". === 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. === 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. === 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. === 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it. === 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. === 11. RELICENSING "Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A "Massive Multiauthor Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. "Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ================================================ FILE: dpkg/changelog.in ================================================ libfsrefs (@VERSION@-1) unstable; urgency=low * Auto-generated -- Joachim Metz @DPKG_DATE@ ================================================ FILE: dpkg/compat ================================================ 10 ================================================ FILE: dpkg/control ================================================ Source: libfsrefs Priority: extra Maintainer: Joachim Metz Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config Standards-Version: 4.1.4 Section: libs Homepage: https://github.com/libyal/libfsrefs Vcs-Git: https://github.com/libyal/libfsrefs.git Package: libfsrefs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Conflicts: libfsrefs1 Replaces: libfsrefs1 Suggests: libfsrefs-dbg Description: Library to access the Resiliant File System (ReFS) format libfsrefs is a library to access the Resiliant File System (ReFS) format. Package: libfsrefs-dbg Architecture: any Section: debug Depends: libfsrefs (= ${binary:Version}), ${misc:Depends} Description: Debugging symbols for libfsrefs Debugging symbols for libfsrefs. Package: libfsrefs-dev Section: libdevel Architecture: any Depends: libfsrefs (= ${binary:Version}), ${misc:Depends} Description: Header files and libraries for developing applications for libfsrefs Header files and libraries for developing applications for libfsrefs. Package: libfsrefs-tools Section: utils Architecture: any Depends: libfsrefs (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Conflicts: libfsrefs-utils Replaces: libfsrefs-utils Description: Several tools for reading Resiliant File System (ReFS) volumes Several tools for reading Resiliant File System (ReFS) volumes. Package: libfsrefs-tools-dbg Section: debug Architecture: any Depends: libfsrefs-tools (= ${binary:Version}), ${misc:Depends} Description: Debugging symbols for libfsrefs-tools Debugging symbols for libfsrefs-tools. ================================================ FILE: dpkg/copyright ================================================ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: libfsrefs Source: https://github.com/libyal/libfsrefs Files: * Copyright: 2012-2025, Joachim Metz License: LGPL-3.0+ License: LGPL-3.0+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . . On Debian systems, the complete text of the GNU Lesser General Public License can be found in "/usr/share/common-licenses/LGPL-3". ================================================ FILE: dpkg/libfsrefs-dev.install ================================================ usr/include/* usr/lib/*-*/lib*.a usr/lib/*-*/lib*.so usr/lib/*-*/pkgconfig/* usr/share/man/man3 ================================================ FILE: dpkg/libfsrefs-tools.install ================================================ usr/bin usr/share/man/man1 ================================================ FILE: dpkg/libfsrefs.install ================================================ usr/lib/*-*/lib*.so.* ================================================ FILE: dpkg/rules ================================================ #!/usr/bin/make -f # -*- makefile -*- # Uncomment for debhelper verbose output. # export DH_VERBOSE=1 %: dh $@ --buildsystem=autoconf --with=autoreconf .PHONY: override_dh_auto_configure override_dh_auto_configure: dh_auto_configure -- CFLAGS="-g" .PHONY: override_dh_install override_dh_install: dh_install --fail-missing -X.la .PHONY: override_dh_strip override_dh_strip: ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS))) dh_strip -plibfsrefs --dbg-package=libfsrefs-dbg dh_strip -plibfsrefs-tools --dbg-package=libfsrefs-tools-dbg endif ================================================ FILE: dpkg/source/format ================================================ 3.0 (quilt) ================================================ FILE: fsrefstools/Makefile.am ================================================ AM_CPPFLAGS = \ -I../include -I$(top_srcdir)/include \ -I../common -I$(top_srcdir)/common \ @LIBCERROR_CPPFLAGS@ \ @LIBCDATA_CPPFLAGS@ \ @LIBCLOCALE_CPPFLAGS@ \ @LIBCNOTIFY_CPPFLAGS@ \ @LIBCSPLIT_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ @LIBCFILE_CPPFLAGS@ \ @LIBCPATH_CPPFLAGS@ \ @LIBBFIO_CPPFLAGS@ \ @LIBFCACHE_CPPFLAGS@ \ @LIBFDATA_CPPFLAGS@ \ @LIBFDATETIME_CPPFLAGS@ \ @LIBFGUID_CPPFLAGS@ \ @LIBFWNT_CPPFLAGS@ \ @LIBFSREFS_DLL_IMPORT@ AM_LDFLAGS = @STATIC_LDFLAGS@ bin_PROGRAMS = \ fsrefsinfo fsrefsinfo_SOURCES = \ fsrefsinfo.c \ fsrefstools_getopt.c fsrefstools_getopt.h \ fsrefstools_i18n.h \ fsrefstools_libbfio.h \ fsrefstools_libcerror.h \ fsrefstools_libclocale.h \ fsrefstools_libcnotify.h \ fsrefstools_libfcache.h \ fsrefstools_libfdata.h \ fsrefstools_libfdatetime.h \ fsrefstools_libfguid.h \ fsrefstools_libfsrefs.h \ fsrefstools_libfwnt.h \ fsrefstools_libuna.h \ fsrefstools_output.c fsrefstools_output.h \ fsrefstools_signal.c fsrefstools_signal.h \ fsrefstools_unused.h \ info_handle.c info_handle.h fsrefsinfo_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ \ @LIBINTL@ DISTCLEANFILES = \ Makefile \ Makefile.in splint-local: @echo "Running splint on fsrefsinfo ..." -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(fsrefsinfo_SOURCES) ================================================ FILE: fsrefstools/fsrefsinfo.c ================================================ /* * Shows information obtained from a Resiliant File System (ReFS) volume. * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #if defined( HAVE_IO_H ) || defined( WINAPI ) #include #endif #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #if defined( HAVE_UNISTD_H ) #include #endif #include "fsrefstools_getopt.h" #include "fsrefstools_libcerror.h" #include "fsrefstools_libclocale.h" #include "fsrefstools_libcnotify.h" #include "fsrefstools_libfsrefs.h" #include "fsrefstools_output.h" #include "fsrefstools_signal.h" #include "fsrefstools_unused.h" #include "info_handle.h" enum FSREFSINFO_MODES { FSREFSINFO_MODE_FILE_ENTRY, FSREFSINFO_MODE_FILE_SYSTEM_HIERARCHY, FSREFSINFO_MODE_USN_CHANGE_JOURNAL, FSREFSINFO_MODE_VOLUME }; info_handle_t *fsrefsinfo_info_handle = NULL; int fsrefsinfo_abort = 0; /* Prints usage information */ void usage_fprint( FILE *stream ) { if( stream == NULL ) { return; } fprintf( stream, "Use fsrefsinfo to determine information about a Resiliant\n" " File System (ReFS).\n\n" ); fprintf( stream, "Usage: fsrefsinfo [ -o offset ] [ -hHvV ] source\n\n" ); fprintf( stream, "\tsource: the source file or device\n\n" ); fprintf( stream, "\t-h: shows this help\n" ); fprintf( stream, "\t-H: shows the file system hierarchy\n" ); fprintf( stream, "\t-o: specify the volume offset\n" ); fprintf( stream, "\t-v: verbose output to stderr\n" ); fprintf( stream, "\t-V: print version\n" ); } /* Signal handler for fsrefsinfo */ void fsrefsinfo_signal_handler( fsrefstools_signal_t signal FSREFSTOOLS_ATTRIBUTE_UNUSED ) { libcerror_error_t *error = NULL; static char *function = "fsrefsinfo_signal_handler"; FSREFSTOOLS_UNREFERENCED_PARAMETER( signal ) fsrefsinfo_abort = 1; if( fsrefsinfo_info_handle != NULL ) { if( info_handle_signal_abort( fsrefsinfo_info_handle, &error ) != 1 ) { libcnotify_printf( "%s: unable to signal info handle to abort.\n", function ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } } /* Force stdin to close otherwise any function reading it will remain blocked */ #if defined( WINAPI ) && !defined( __CYGWIN__ ) if( _close( 0 ) != 0 ) #else if( close( 0 ) != 0 ) #endif { libcnotify_printf( "%s: unable to close stdin.\n", function ); } } /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc, wchar_t * const argv[] ) #else int main( int argc, char * const argv[] ) #endif { libfsrefs_error_t *error = NULL; system_character_t *option_volume_offset = NULL; system_character_t *source = NULL; char *program = "fsrefsinfo"; system_integer_t option = 0; uint8_t calculate_md5 = 0; int option_mode = FSREFSINFO_MODE_VOLUME; int verbose = 0; libcnotify_stream_set( stderr, NULL ); libcnotify_verbose_set( 1 ); if( libclocale_initialize( "fsrefstools", &error ) != 1 ) { fprintf( stderr, "Unable to initialize locale values.\n" ); goto on_error; } if( fsrefstools_output_initialize( _IONBF, &error ) != 1 ) { fprintf( stderr, "Unable to initialize output settings.\n" ); goto on_error; } fsrefstools_output_version_fprint( stdout, program ); while( ( option = fsrefstools_getopt( argc, argv, _SYSTEM_STRING( "hHo:vV" ) ) ) != (system_integer_t) -1 ) { switch( option ) { case (system_integer_t) '?': default: fprintf( stderr, "Invalid argument: %" PRIs_SYSTEM "\n", argv[ optind - 1 ] ); usage_fprint( stdout ); return( EXIT_FAILURE ); case (system_integer_t) 'h': usage_fprint( stdout ); return( EXIT_SUCCESS ); case (system_integer_t) 'H': option_mode = FSREFSINFO_MODE_FILE_SYSTEM_HIERARCHY; break; case (system_integer_t) 'o': option_volume_offset = optarg; break; case (system_integer_t) 'v': verbose = 1; break; case (system_integer_t) 'V': fsrefstools_output_copyright_fprint( stdout ); return( EXIT_SUCCESS ); } } if( optind == argc ) { fprintf( stderr, "Missing source file or device.\n" ); usage_fprint( stdout ); return( EXIT_FAILURE ); } source = argv[ optind ]; libcnotify_verbose_set( verbose ); libfsrefs_notify_set_stream( stderr, NULL ); libfsrefs_notify_set_verbose( verbose ); if( info_handle_initialize( &fsrefsinfo_info_handle, calculate_md5, &error ) != 1 ) { fprintf( stderr, "Unable to initialize info handle.\n" ); goto on_error; } if( option_volume_offset != NULL ) { if( info_handle_set_volume_offset( fsrefsinfo_info_handle, option_volume_offset, &error ) != 1 ) { libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); fprintf( stderr, "Unsupported volume offset defaulting to: %" PRIi64 ".\n", fsrefsinfo_info_handle->volume_offset ); } } if( info_handle_open_input( fsrefsinfo_info_handle, source, &error ) != 1 ) { fprintf( stderr, "Unable to open: %" PRIs_SYSTEM ".\n", source ); goto on_error; } switch( option_mode ) { case FSREFSINFO_MODE_FILE_SYSTEM_HIERARCHY: if( info_handle_file_system_hierarchy_fprint( fsrefsinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to print file system hierarchy.\n" ); goto on_error; } break; case FSREFSINFO_MODE_VOLUME: default: if( info_handle_volume_fprint( fsrefsinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to print volume information.\n" ); goto on_error; } break; } if( info_handle_close_input( fsrefsinfo_info_handle, &error ) != 0 ) { fprintf( stderr, "Unable to close info handle.\n" ); goto on_error; } if( info_handle_free( &fsrefsinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to free info handle.\n" ); goto on_error; } return( EXIT_SUCCESS ); on_error: if( error != NULL ) { libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( fsrefsinfo_info_handle != NULL ) { info_handle_free( &fsrefsinfo_info_handle, NULL ); } return( EXIT_FAILURE ); } ================================================ FILE: fsrefstools/fsrefstools_getopt.c ================================================ /* * GetOpt functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefstools_getopt.h" #include "fsrefstools_libcnotify.h" #if !defined( HAVE_GETOPT ) /* The option index * Start with argument 1 (argument 0 is the program name) */ int optind = 1; /* The current option argument */ system_character_t *optarg = NULL; /* Value to indicate the current option */ system_integer_t optopt = 0; /* The next option in a group */ system_character_t *next_option = NULL; /* Get the program options * Function for platforms that do not have the getopt function * Returns the option character processed, or -1 on error, * ? if the option was not in the options string, : if the option argument was missing */ system_integer_t fsrefstools_getopt( int argument_count, system_character_t * const argument_values[], const system_character_t *options_string ) { system_character_t *argument_value = NULL; system_character_t *option_value = NULL; static char *function = "fsrefstools_getopt"; size_t options_string_length = 0; if( next_option != NULL ) { argument_value = next_option; next_option = NULL; } else if( optind >= argument_count ) { return( (system_integer_t) -1 ); } else { argument_value = argument_values[ optind ]; /* Check if the argument value is not an empty string */ if( *argument_value == (system_character_t) '\0' ) { return( (system_integer_t) -1 ); } /* Check if the first character is a option marker '-' */ if( *argument_value != (system_character_t) '-' ) { return( (system_integer_t) -1 ); } argument_value++; /* Check if long options are provided '--' */ if( *argument_value == (system_character_t) '-' ) { optind++; return( (system_integer_t) -1 ); } } options_string_length = system_string_length( options_string ); optopt = *argument_value; option_value = system_string_search_character( options_string, optopt, options_string_length ); argument_value++; /* Check if an argument was specified or that the option was not found * in the option string */ if( ( optopt == (system_integer_t) ':' ) || ( option_value == NULL ) ) { if( *argument_value == (system_character_t) '\0' ) { optind++; } if( ( *options_string != (system_character_t) ':' ) && ( optopt != (system_integer_t) '?' ) ) { libcnotify_printf( "%s: no such option: %" PRIc_SYSTEM ".\n", function, optopt ); } return( (system_integer_t) '?' ); } option_value++; /* Check if no option argument is required */ if( *option_value != (system_character_t) ':' ) { optarg = NULL; if( *argument_value == (system_character_t) '\0' ) { optind++; } else { /* Multiple options are grouped */ next_option = argument_value; } } /* Check if the argument is right after the option flag with no space in between */ else if( *argument_value != (system_character_t) '\0' ) { optarg = argument_value; optind++; } else { optind++; /* Check if the argument was provided as the next argument value */ if( argument_count <= optind ) { if( *option_value == ':' ) { return( (system_integer_t) ':' ); } libcnotify_printf( "%s: option: %" PRIc_SYSTEM " requires an argument.\n", function, optopt ); return( (system_integer_t) '?' ); } optarg = argument_values[ optind ]; optind++; } return( optopt ); } #endif /* !defined( HAVE_GETOPT ) */ ================================================ FILE: fsrefstools/fsrefstools_getopt.h ================================================ /* * GetOpt functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_GETOPT_H ) #define _FSREFSTOOLS_GETOPT_H #include #include /* unistd.h is included here to export getopt, optarg, optind and optopt */ #if defined( HAVE_UNISTD_H ) #include #endif #if defined( __cplusplus ) extern "C" { #endif #if defined( HAVE_GETOPT ) #define fsrefstools_getopt( argument_count, argument_values, options_string ) \ getopt( argument_count, argument_values, options_string ) #else #if !defined( __CYGWIN__ ) extern int optind; extern system_character_t *optarg; extern system_integer_t optopt; #else int optind; system_character_t *optarg; system_integer_t optopt; #endif /* !defined( __CYGWIN__ ) */ system_integer_t fsrefstools_getopt( int argument_count, system_character_t * const argument_values[], const system_character_t *options_string ); #endif /* defined( HAVE_GETOPT ) */ #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFSTOOLS_GETOPT_H ) */ ================================================ FILE: fsrefstools/fsrefstools_i18n.h ================================================ /* * Internationalization (i18n) functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_I18N_H ) #define _FSREFSTOOLS_I18N_H #include #if defined( HAVE_LIBINTL_H ) #include #endif #if defined( __cplusplus ) extern "C" { #endif /* TODO for now do nothing i18n-like #define _( string ) \ gettext( string ) */ #define _( string ) \ string #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFSTOOLS_I18N_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libbfio.h ================================================ /* * The libbfio header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBBFIO_H ) #define _FSREFSTOOLS_LIBBFIO_H #include /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio */ #if defined( HAVE_LOCAL_LIBBFIO ) #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT * before including libbfio.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBBFIO_DLL_IMPORT #endif #include #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) #error Multi-threading support requires libbfio with multi-threading support #endif #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ #endif /* !defined( _FSREFSTOOLS_LIBBFIO_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libcerror.h ================================================ /* * The libcerror header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBCERROR_H ) #define _FSREFSTOOLS_LIBCERROR_H #include /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror */ #if defined( HAVE_LOCAL_LIBCERROR ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT * before including libcerror.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBCERROR_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ #endif /* !defined( _FSREFSTOOLS_LIBCERROR_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libclocale.h ================================================ /* * The libclocale header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBCLOCALE_H ) #define _FSREFSTOOLS_LIBCLOCALE_H #include /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale */ #if defined( HAVE_LOCAL_LIBCLOCALE ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT * before including libclocale.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBCLOCALE_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ #endif /* !defined( _FSREFSTOOLS_LIBCLOCALE_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libcnotify.h ================================================ /* * The libcnotify header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBCNOTIFY_H ) #define _FSREFSTOOLS_LIBCNOTIFY_H #include /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify */ #if defined( HAVE_LOCAL_LIBCNOTIFY ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT * before including libcnotify.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBCNOTIFY_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ #endif /* !defined( _FSREFSTOOLS_LIBCNOTIFY_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libfcache.h ================================================ /* * The libfcache header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBFCACHE_H ) #define _FSREFSTOOLS_LIBFCACHE_H #include /* Define HAVE_LOCAL_LIBFCACHE for local use of libfcache */ #if defined( HAVE_LOCAL_LIBFCACHE ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBFCACHE_DLL_IMPORT * before including libfcache.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBFCACHE_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFCACHE ) */ #endif /* !defined( _FSREFSTOOLS_LIBFCACHE_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libfdata.h ================================================ /* * The libfdata header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBFDATA_H ) #define _FSREFSTOOLS_LIBFDATA_H #include /* Define HAVE_LOCAL_LIBFDATA for local use of libfdata */ #if defined( HAVE_LOCAL_LIBFDATA ) #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBFDATA_DLL_IMPORT * before including libfdata.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBFDATA_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFDATA ) */ #endif /* !defined( _FSREFSTOOLS_LIBFDATA_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libfdatetime.h ================================================ /* * The libfdatetime header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBFDATETIME_H ) #define _FSREFSTOOLS_LIBFDATETIME_H #include /* Define HAVE_LOCAL_LIBFDATETIME for local use of libfdatetime */ #if defined( HAVE_LOCAL_LIBFDATETIME ) #include #include #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBFDATETIME_DLL_IMPORT * before including libfdatetime.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBFDATETIME_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFDATETIME ) */ #endif /* !defined( _FSREFSTOOLS_LIBFDATETIME_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libfguid.h ================================================ /* * The libfguid header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBFGUID_H ) #define _FSREFSTOOLS_LIBFGUID_H #include /* Define HAVE_LOCAL_LIBFGUID for local use of libfguid */ #if defined( HAVE_LOCAL_LIBFGUID ) #include #include #include #else /* If libtool DLL support is enabled set LIBFGUID_DLL_IMPORT * before including libfguid.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBFGUID_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFGUID ) */ #endif /* !defined( _FSREFSTOOLS_LIBFGUID_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libfsrefs.h ================================================ /* * The libfsrefs header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBFSREFS_H ) #define _FSREFSTOOLS_LIBFSREFS_H #include #include #endif /* !defined( _FSREFSTOOLS_LIBFSREFS_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libfwnt.h ================================================ /* * The libfwnt header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBFWNT_H ) #define _FSREFSTOOLS_LIBFWNT_H #include /* Define HAVE_LOCAL_LIBFWNT for local use of libfwnt */ #if defined( HAVE_LOCAL_LIBFWNT ) #include #include #include #include #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBFWNT_DLL_IMPORT * before including libfwnt.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBFWNT_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFWNT ) */ #endif /* !defined( _FSREFSTOOLS_LIBFWNT_H ) */ ================================================ FILE: fsrefstools/fsrefstools_libuna.h ================================================ /* * The libuna header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_LIBUNA_H ) #define _FSREFSTOOLS_LIBUNA_H #include /* Define HAVE_LOCAL_LIBUNA for local use of libuna */ #if defined( HAVE_LOCAL_LIBUNA ) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT * before including libuna.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBUNA_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBUNA ) */ #endif /* !defined( _FSREFSTOOLS_LIBUNA_H ) */ ================================================ FILE: fsrefstools/fsrefstools_output.c ================================================ /* * Common output functions for the fsrefstools * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "fsrefstools_i18n.h" #include "fsrefstools_libbfio.h" #include "fsrefstools_libcerror.h" #include "fsrefstools_libclocale.h" #include "fsrefstools_libcnotify.h" #include "fsrefstools_libfcache.h" #include "fsrefstools_libfdata.h" #include "fsrefstools_libfdatetime.h" #include "fsrefstools_libfguid.h" #include "fsrefstools_libfsrefs.h" #include "fsrefstools_libfwnt.h" #include "fsrefstools_libuna.h" #include "fsrefstools_output.h" /* Initializes output settings * Returns 1 if successful or -1 on error */ int fsrefstools_output_initialize( int stdio_mode, libcerror_error_t **error ) { static char *function = "fsrefstools_output_initialize"; if( ( stdio_mode != _IOFBF ) && ( stdio_mode != _IOLBF ) && ( stdio_mode != _IONBF ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: unsupported standard IO mode.", function ); return( -1 ); } #if !defined( __BORLANDC__ ) if( setvbuf( stdout, NULL, stdio_mode, 0 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set IO mode of stdout.", function ); return( -1 ); } if( setvbuf( stderr, NULL, stdio_mode, 0 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set IO mode of stderr.", function ); return( -1 ); } #endif /* !defined( __BORLANDC__ ) */ return( 1 ); } /* Prints the copyright information */ void fsrefstools_output_copyright_fprint( FILE *stream ) { if( stream == NULL ) { return; } /* TRANSLATORS: This is a proper name. */ fprintf( stream, _( "Copyright (C) 2012-2025, %s.\n" ), _( "Joachim Metz" ) ); fprintf( stream, _( "This is free software; see the source for copying conditions. There is NO\n" "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" ) ); /* TRANSLATORS: The placeholder indicates the bug-reporting address * for this package. Please add _another line_ saying * "Report translation bugs to <...>\n" with the address for translation * bugs (typically your translation team's web or email address). */ fprintf( stream, _( "Report bugs to <%s>.\n" ), PACKAGE_BUGREPORT ); } /* Prints the version information */ void fsrefstools_output_version_fprint( FILE *stream, const char *program ) { if( stream == NULL ) { return; } if( program == NULL ) { return; } fprintf( stream, "%s %s\n\n", program, LIBFSREFS_VERSION_STRING ); } /* Prints the detailed version information */ void fsrefstools_output_version_detailed_fprint( FILE *stream, const char *program ) { if( stream == NULL ) { return; } if( program == NULL ) { return; } fprintf( stream, "%s %s (libfsrefs %s", program, LIBFSREFS_VERSION_STRING, LIBFSREFS_VERSION_STRING ); fprintf( stream, ", libuna %s", LIBUNA_VERSION_STRING ); fprintf( stream, ", libbfio %s", LIBBFIO_VERSION_STRING ); fprintf( stream, ", libfdata %s", LIBFDATA_VERSION_STRING ); fprintf( stream, ", libfdatetime %s", LIBFDATETIME_VERSION_STRING ); fprintf( stream, ", libfguid %s", LIBFGUID_VERSION_STRING ); fprintf( stream, ", libfwnt %s", LIBFWNT_VERSION_STRING ); fprintf( stream, ")\n\n" ); } ================================================ FILE: fsrefstools/fsrefstools_output.h ================================================ /* * Common output functions for the fsrefstools * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_OUTPUT_H ) #define _FSREFSTOOLS_OUTPUT_H #include #include #include #include "fsrefstools_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif int fsrefstools_output_initialize( int stdio_mode, libcerror_error_t **error ); void fsrefstools_output_copyright_fprint( FILE *stream ); void fsrefstools_output_version_fprint( FILE *stream, const char *program ); void fsrefstools_output_version_detailed_fprint( FILE *stream, const char *program ); #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFSTOOLS_OUTPUT_H ) */ ================================================ FILE: fsrefstools/fsrefstools_signal.c ================================================ /* * Signal handling functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #if defined( HAVE_SIGNAL_H ) #include #endif #if defined( _MSC_VER ) #include #endif #include "fsrefstools_libcerror.h" #include "fsrefstools_signal.h" #if defined( WINAPI ) void (*fsrefstools_signal_signal_handler)( fsrefstools_signal_t ) = NULL; /* Signal handler for Ctrl+C or Ctrl+Break signals */ BOOL WINAPI fsrefstools_signal_handler( fsrefstools_signal_t signal ) { static char *function = "fsrefstools_signal_handler"; switch( signal ) { /* use Ctrl+C or Ctrl+Break to simulate SERVICE_CONTROL_STOP in debug mode */ case CTRL_BREAK_EVENT: case CTRL_C_EVENT: if( fsrefstools_signal_signal_handler != NULL ) { fsrefstools_signal_signal_handler( signal ); } return( TRUE ); default: break; } return( FALSE ); } #if defined( _MSC_VER ) /* Initialize memory usage and leakage debugging */ void fsrefstools_signal_initialize_memory_debug( void ) { int flag = 0; /* Get the current state of the flag and store it in a temporary variable */ flag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); /* Turn on client block identifiers and automatic leak detection */ flag |= ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); /* Set the new state for the flag */ _CrtSetDbgFlag( flag ); } #endif /* defined( _MSC_VER ) */ /* Attaches a signal handler for Ctrl+C or Ctrl+Break signals * Returns 1 if successful or -1 on error */ int fsrefstools_signal_attach( void (*signal_handler)( fsrefstools_signal_t ), libcerror_error_t **error ) { static char *function = "fsrefstools_signal_attach"; if( signal_handler == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid signal handler.", function ); return( -1 ); } fsrefstools_signal_signal_handler = signal_handler; if( SetConsoleCtrlHandler( (PHANDLER_ROUTINE) fsrefstools_signal_handler, TRUE ) == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to attach signal handler.", function ); return( -1 ); } if( SetConsoleCtrlHandler( NULL, FALSE ) == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to attach break signal.", function ); return( -1 ); } #if defined( _MSC_VER ) fsrefstools_signal_initialize_memory_debug(); #endif SetErrorMode( SEM_FAILCRITICALERRORS ); #if defined( LOCALE_SUPPORT ) /* Allow subsequent threads to have their own locale. * If the application is single threaded this call has * no practical effect. */ _configthreadlocale( _ENABLE_PER_THREAD_LOCALE ); /* Set the current thread locale to the user default * ANSI code page. */ setlocale( LC_ALL, "" ); /* Set the the code page used by multibyte functions * to use the same code page as the previous call to setlocale. */ _setmbcp( _MB_CP_LOCALE ); #endif /* defined( LOCALE_SUPPORT ) */ return( 1 ); } /* Detaches a signal handler for Ctrl+C or Ctrl+Break signals * Returns 1 if successful or -1 on error */ int fsrefstools_signal_detach( libcerror_error_t **error ) { static char *function = "fsrefstools_signal_detach"; if( SetConsoleCtrlHandler( (PHANDLER_ROUTINE) fsrefstools_signal_handler, FALSE ) == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to detach signal handler.", function ); return( -1 ); } fsrefstools_signal_signal_handler = NULL; return( 1 ); } #else /* Attaches a signal handler for SIGINT * Returns 1 if successful or -1 on error */ int fsrefstools_signal_attach( void (*signal_handler)( fsrefstools_signal_t ), libcerror_error_t **error ) { static char *function = "fsrefstools_signal_attach"; if( signal_handler == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid signal handler.", function ); return( -1 ); } if( signal( SIGINT, signal_handler ) == SIG_ERR ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to attach signal handler.", function ); return( -1 ); } return( 1 ); } /* Detaches a signal handler for SIGINT * Returns 1 if successful or -1 on error */ int fsrefstools_signal_detach( libcerror_error_t **error ) { static char *function = "fsrefstools_signal_detach"; if( signal( SIGINT, SIG_DFL ) == SIG_ERR ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to detach signal handler.", function ); return( -1 ); } return( 1 ); } #endif /* defined( WINAPI ) */ ================================================ FILE: fsrefstools/fsrefstools_signal.h ================================================ /* * Signal handling functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_SIGNAL_H ) #define _FSREFSTOOLS_SIGNAL_H #include #include #include "fsrefstools_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif #if !defined( HAVE_SIGNAL_H ) && !defined( WINAPI ) #error missing signal functions #endif #if defined( WINAPI ) typedef unsigned long fsrefstools_signal_t; #else typedef int fsrefstools_signal_t; #endif /* defined( WINAPI ) */ #if defined( WINAPI ) BOOL WINAPI fsrefstools_signal_handler( fsrefstools_signal_t signal ); #if defined( _MSC_VER ) void fsrefstools_signal_initialize_memory_debug( void ); #endif /* defined( _MSC_VER ) */ #endif /* defined( WINAPI ) */ int fsrefstools_signal_attach( void (*signal_handler)( fsrefstools_signal_t ), libcerror_error_t **error ); int fsrefstools_signal_detach( libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFSTOOLS_SIGNAL_H ) */ ================================================ FILE: fsrefstools/fsrefstools_unused.h ================================================ /* * Definitions to silence compiler warnings about unused function attributes/parameters. * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFSTOOLS_UNUSED_H ) #define _FSREFSTOOLS_UNUSED_H #include #if !defined( FSREFSTOOLS_ATTRIBUTE_UNUSED ) #if defined( __GNUC__ ) && __GNUC__ >= 3 #define FSREFSTOOLS_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #else #define FSREFSTOOLS_ATTRIBUTE_UNUSED #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ #endif /* !defined( FSREFSTOOLS_ATTRIBUTE_UNUSED ) */ #if defined( _MSC_VER ) #define FSREFSTOOLS_UNREFERENCED_PARAMETER( parameter ) \ UNREFERENCED_PARAMETER( parameter ); #else #define FSREFSTOOLS_UNREFERENCED_PARAMETER( parameter ) \ /* parameter */ #endif /* defined( _MSC_VER ) */ #endif /* !defined( _FSREFSTOOLS_UNUSED_H ) */ ================================================ FILE: fsrefstools/info_handle.c ================================================ /* * Info handle * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include #include "fsrefstools_libbfio.h" #include "fsrefstools_libcerror.h" #include "fsrefstools_libclocale.h" #include "fsrefstools_libfsrefs.h" #include "fsrefstools_libuna.h" #include "info_handle.h" #if !defined( LIBFSREFS_HAVE_BFIO ) extern \ int libfsrefs_volume_open_file_io_handle( libfsrefs_volume_t *volume, libbfio_handle_t *file_io_handle, int access_flags, libfsrefs_error_t **error ); #endif /* !defined( LIBFSREFS_HAVE_BFIO ) */ #define INFO_HANDLE_NOTIFY_STREAM stdout /* Copies a string of a decimal value to a 64-bit value * Returns 1 if successful or -1 on error */ int fsrefstools_system_string_copy_from_64_bit_in_decimal( const system_character_t *string, size_t string_size, uint64_t *value_64bit, libcerror_error_t **error ) { static char *function = "fsrefstools_system_string_copy_from_64_bit_in_decimal"; size_t string_index = 0; system_character_t character_value = 0; uint8_t maximum_string_index = 20; int8_t sign = 1; if( string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid string.", function ); return( -1 ); } if( string_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid string size value exceeds maximum.", function ); return( -1 ); } if( value_64bit == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid value 64-bit.", function ); return( -1 ); } *value_64bit = 0; if( string[ string_index ] == (system_character_t) '-' ) { string_index++; maximum_string_index++; sign = -1; } else if( string[ string_index ] == (system_character_t) '+' ) { string_index++; maximum_string_index++; } while( string_index < string_size ) { if( string[ string_index ] == 0 ) { break; } if( string_index > (size_t) maximum_string_index ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_LARGE, "%s: string too large.", function ); return( -1 ); } *value_64bit *= 10; if( ( string[ string_index ] >= (system_character_t) '0' ) && ( string[ string_index ] <= (system_character_t) '9' ) ) { character_value = (system_character_t) ( string[ string_index ] - (system_character_t) '0' ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported character value: %" PRIc_SYSTEM " at index: %d.", function, string[ string_index ], string_index ); return( -1 ); } *value_64bit += character_value; string_index++; } if( sign == -1 ) { *value_64bit *= (uint64_t) -1; } return( 1 ); } /* Creates an info handle * Make sure the value info_handle is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int info_handle_initialize( info_handle_t **info_handle, uint8_t calculate_md5, libcerror_error_t **error ) { static char *function = "info_handle_initialize"; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( *info_handle != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid info handle value already set.", function ); return( -1 ); } *info_handle = memory_allocate_structure( info_handle_t ); if( *info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create info handle.", function ); goto on_error; } if( memory_set( *info_handle, 0, sizeof( info_handle_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear info handle.", function ); goto on_error; } if( libbfio_file_range_initialize( &( ( *info_handle )->input_file_io_handle ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to initialize input file IO handle.", function ); goto on_error; } if( libfsrefs_volume_initialize( &( ( *info_handle )->input_volume ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to initialize input volume.", function ); goto on_error; } ( *info_handle )->calculate_md5 = calculate_md5; ( *info_handle )->notify_stream = INFO_HANDLE_NOTIFY_STREAM; return( 1 ); on_error: if( *info_handle != NULL ) { if( ( *info_handle )->input_file_io_handle != NULL ) { libbfio_handle_free( &( ( *info_handle )->input_file_io_handle ), NULL ); } memory_free( *info_handle ); *info_handle = NULL; } return( -1 ); } /* Frees an info handle * Returns 1 if successful or -1 on error */ int info_handle_free( info_handle_t **info_handle, libcerror_error_t **error ) { static char *function = "info_handle_free"; int result = 1; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( *info_handle != NULL ) { if( libfsrefs_volume_free( &( ( *info_handle )->input_volume ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free input volume.", function ); result = -1; } if( libbfio_handle_free( &( ( *info_handle )->input_file_io_handle ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free input file IO handle.", function ); result = -1; } memory_free( *info_handle ); *info_handle = NULL; } return( result ); } /* Signals the info handle to abort * Returns 1 if successful or -1 on error */ int info_handle_signal_abort( info_handle_t *info_handle, libcerror_error_t **error ) { static char *function = "info_handle_signal_abort"; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } info_handle->abort = 1; if( info_handle->input_volume != NULL ) { if( libfsrefs_volume_signal_abort( info_handle->input_volume, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to signal input volume to abort.", function ); return( -1 ); } } return( 1 ); } /* Sets the bodyfile * Returns 1 if successful or -1 on error */ int info_handle_set_bodyfile( info_handle_t *info_handle, const system_character_t *filename, libcerror_error_t **error ) { static char *function = "info_handle_set_bodyfile"; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( info_handle->bodyfile_stream != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid info handle - bodyfile stream value already set.", function ); return( -1 ); } if( filename == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid filename.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) info_handle->bodyfile_stream = file_stream_open_wide( filename, L"wb" ); #else info_handle->bodyfile_stream = file_stream_open( filename, "wb" ); #endif if( info_handle->bodyfile_stream == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open bodyfile stream.", function ); return( -1 ); } return( 1 ); } /* Sets the volume offset * Returns 1 if successful or -1 on error */ int info_handle_set_volume_offset( info_handle_t *info_handle, const system_character_t *string, libcerror_error_t **error ) { static char *function = "info_handle_set_volume_offset"; size_t string_length = 0; uint64_t value_64bit = 0; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } string_length = system_string_length( string ); if( fsrefstools_system_string_copy_from_64_bit_in_decimal( string, string_length + 1, &value_64bit, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy string to 64-bit decimal.", function ); return( -1 ); } info_handle->volume_offset = (off64_t) value_64bit; return( 1 ); } /* Opens the input * Returns 1 if successful or -1 on error */ int info_handle_open_input( info_handle_t *info_handle, const system_character_t *filename, libcerror_error_t **error ) { static char *function = "info_handle_open_input"; size_t filename_length = 0; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } filename_length = system_string_length( filename ); #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( libbfio_file_range_set_name_wide( info_handle->input_file_io_handle, filename, filename_length, error ) != 1 ) #else if( libbfio_file_range_set_name( info_handle->input_file_io_handle, filename, filename_length, error ) != 1 ) #endif { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open set file name.", function ); return( -1 ); } if( libbfio_file_range_set( info_handle->input_file_io_handle, info_handle->volume_offset, 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open set volume offset.", function ); return( -1 ); } if( libfsrefs_volume_open_file_io_handle( info_handle->input_volume, info_handle->input_file_io_handle, LIBFSREFS_OPEN_READ, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open input volume.", function ); return( -1 ); } return( 1 ); } /* Closes the input * Returns the 0 if succesful or -1 on error */ int info_handle_close_input( info_handle_t *info_handle, libcerror_error_t **error ) { static char *function = "info_handle_close_input"; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( libfsrefs_volume_close( info_handle->input_volume, error ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_CLOSE_FAILED, "%s: unable to close input volume.", function ); return( -1 ); } return( 0 ); } /* Prints a file entry or data stream name * Returns 1 if successful or -1 on error */ int info_handle_name_value_fprint( info_handle_t *info_handle, const system_character_t *value_string, size_t value_string_length, libcerror_error_t **error ) { system_character_t *escaped_value_string = NULL; static char *function = "info_handle_name_value_fprint"; libuna_unicode_character_t unicode_character = 0; size_t escaped_value_string_index = 0; size_t escaped_value_string_size = 0; size_t value_string_index = 0; int print_count = 0; int result = 0; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( value_string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid value string.", function ); return( -1 ); } /* To ensure normalization in the escaped string is handled correctly * it stored in a temporary variable. Note that there is a worst-case of * a 1 to 4 ratio for each escaped character. */ if( value_string_length > (size_t) ( ( SSIZE_MAX - 1 ) / ( sizeof( system_character_t ) * 4 ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid value string length value exceeds maximum.", function ); return( -1 ); } escaped_value_string_size = ( value_string_length * 4 ) + 1; escaped_value_string = (system_character_t *) memory_allocate( sizeof( system_character_t ) * escaped_value_string_size ); if( escaped_value_string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create escaped value string.", function ); goto on_error; } /* Using UCS-2 or RFC 2279 UTF-8 to support unpaired UTF-16 surrogates */ while( value_string_index < value_string_length ) { #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libuna_unicode_character_copy_from_ucs2( &unicode_character, (libuna_utf16_character_t *) value_string, value_string_length, &value_string_index, error ); #else result = libuna_unicode_character_copy_from_utf8_rfc2279( &unicode_character, (libuna_utf8_character_t *) value_string, value_string_length, &value_string_index, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, "%s: unable to copy Unicode character from value string.", function ); goto on_error; } /* Replace: * Control characters ([U+0-U+1f, U+7f-U+9f]) by \x## */ if( ( unicode_character <= 0x1f ) || ( ( unicode_character >= 0x7f ) && ( unicode_character <= 0x9f ) ) ) { print_count = system_string_sprintf( &( escaped_value_string[ escaped_value_string_index ] ), escaped_value_string_size - escaped_value_string_index, "\\x%02" PRIx32 "", unicode_character ); if( print_count < 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, "%s: unable to copy escaped Unicode character to escaped value string.", function ); goto on_error; } escaped_value_string_index += print_count; } /* Replace: * Unicode surrogate characters ([U+d800-U+dfff]) by \u#### * Undefined Unicode characters ([U+fdd0-U+fddf, U+fffe-U+ffff]) by \u#### */ else if( ( ( unicode_character >= 0x0000d800UL ) && ( unicode_character <= 0x0000dfffUL ) ) || ( ( unicode_character >= 0x0000fdd0UL ) && ( unicode_character <= 0x0000fddfUL ) ) || ( ( unicode_character >= 0x0000fffeUL ) && ( unicode_character <= 0x0000ffffUL ) ) ) { print_count = system_string_sprintf( &( escaped_value_string[ escaped_value_string_index ] ), escaped_value_string_size - escaped_value_string_index, "\\u%04" PRIx32 "", unicode_character ); if( print_count < 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, "%s: unable to copy escaped Unicode character to escaped value string.", function ); goto on_error; } escaped_value_string_index += print_count; } /* Replace: * Undefined Unicode characters ([ * U+1fffe-U+1ffff, U+2fffe-U+2ffff, U+3fffe-U+3ffff, U+4fffe-U+4ffff, * U+5fffe-U+5ffff, U+6fffe-U+6ffff, U+7fffe-U+7ffff, U+8fffe-U+8ffff, * U+9fffe-U+9ffff, U+afffe-U+affff, U+bfffe-U+bffff, U+cfffe-U+cffff, * U+dfffe-U+dffff, U+efffe-U+effff, U+ffffe-U+fffff, U+10fffe-U+ffffffff]) by \U######## */ else if( ( ( ( unicode_character & 0x0000ffffUL ) >= 0x0000fffeUL ) && ( ( unicode_character & 0x0000ffffUL ) <= 0x0000ffffUL ) ) || ( unicode_character > 0x0010fffeUL ) ) { print_count = system_string_sprintf( &( escaped_value_string[ escaped_value_string_index ] ), escaped_value_string_size - escaped_value_string_index, "\\U%08" PRIx32 "", unicode_character ); if( print_count < 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, "%s: unable to copy escaped Unicode character to escaped value string.", function ); goto on_error; } escaped_value_string_index += print_count; } else { #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libuna_unicode_character_copy_to_utf16( unicode_character, (libuna_utf16_character_t *) escaped_value_string, escaped_value_string_size, &escaped_value_string_index, error ); #else result = libuna_unicode_character_copy_to_utf8( unicode_character, (libuna_utf8_character_t *) escaped_value_string, escaped_value_string_size, &escaped_value_string_index, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_INPUT_FAILED, "%s: unable to copy Unicode character to escaped value string.", function ); goto on_error; } } } escaped_value_string[ escaped_value_string_index ] = 0; fprintf( info_handle->notify_stream, "%" PRIs_SYSTEM "", escaped_value_string ); memory_free( escaped_value_string ); return( 1 ); on_error: if( escaped_value_string != NULL ) { memory_free( escaped_value_string ); } return( -1 ); } /* Prints file entry as part of the file system hierarchy or to a bodyfile * Returns 1 if successful or -1 on error */ int info_handle_file_entry_fprint( info_handle_t *info_handle, libfsrefs_file_entry_t *file_entry, const system_character_t *path, const system_character_t *file_entry_name, libcerror_error_t **error ) { static char *function = "info_handle_file_entry_fprint"; size_t file_entry_name_length = 0; size_t path_length = 0; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( path == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid path.", function ); return( -1 ); } path_length = system_string_length( path ); if( file_entry_name != NULL ) { file_entry_name_length = system_string_length( file_entry_name ); } if( info_handle_name_value_fprint( info_handle, path, path_length, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print path string.", function ); goto on_error; } if( file_entry_name != NULL ) { if( info_handle_name_value_fprint( info_handle, file_entry_name, file_entry_name_length, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print file entry name string.", function ); goto on_error; } } fprintf( info_handle->notify_stream, "\n" ); return( 1 ); on_error: return( -1 ); } /* Prints file entry information as part of the file system hierarchy * Returns 1 if successful or -1 on error */ int info_handle_file_system_hierarchy_fprint_file_entry( info_handle_t *info_handle, libfsrefs_file_entry_t *file_entry, const system_character_t *path, libcerror_error_t **error ) { libfsrefs_file_entry_t *sub_file_entry = NULL; system_character_t *file_entry_name = NULL; system_character_t *sub_path = NULL; static char *function = "info_handle_file_system_hierarchy_fprint_file_entry"; size_t file_entry_name_size = 0; size_t path_length = 0; size_t sub_path_size = 0; int number_of_sub_file_entries = 0; int result = 0; int sub_file_entry_index = 0; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( path == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid path.", function ); return( -1 ); } path_length = system_string_length( path ); #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libfsrefs_file_entry_get_utf16_name_size( file_entry, &file_entry_name_size, error ); #else result = libfsrefs_file_entry_get_utf8_name_size( file_entry, &file_entry_name_size, error ); #endif if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve file entry name string size.", function ); goto on_error; } if( ( result == 1 ) && ( file_entry_name_size > 0 ) ) { file_entry_name = system_string_allocate( file_entry_name_size ); if( file_entry_name == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create file entry name string.", function ); goto on_error; } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libfsrefs_file_entry_get_utf16_name( file_entry, (uint16_t *) file_entry_name, file_entry_name_size, error ); #else result = libfsrefs_file_entry_get_utf8_name( file_entry, (uint8_t *) file_entry_name, file_entry_name_size, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve file entry name string.", function ); goto on_error; } } if( ( info_handle->bodyfile_stream != NULL ) || ( file_entry_name != NULL ) ) { if( info_handle_file_entry_fprint( info_handle, file_entry, path, file_entry_name, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print file entry.", function ); goto on_error; } } if( libfsrefs_file_entry_get_number_of_sub_file_entries( file_entry, &number_of_sub_file_entries, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of sub file entries.", function ); goto on_error; } if( number_of_sub_file_entries > 0 ) { sub_path_size = path_length + 1; if( file_entry_name != NULL ) { sub_path_size += file_entry_name_size; } sub_path = system_string_allocate( sub_path_size ); if( sub_path == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create sub path.", function ); goto on_error; } if( system_string_copy( sub_path, path, path_length ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to copy path to sub path.", function ); goto on_error; } if( file_entry_name != NULL ) { if( system_string_copy( &( sub_path[ path_length ] ), file_entry_name, file_entry_name_size - 1 ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to copy file entry name to sub path.", function ); goto on_error; } sub_path[ sub_path_size - 2 ] = (system_character_t) LIBFSREFS_SEPARATOR; } sub_path[ sub_path_size - 1 ] = (system_character_t) 0; for( sub_file_entry_index = 0; sub_file_entry_index < number_of_sub_file_entries; sub_file_entry_index++ ) { if( libfsrefs_file_entry_get_sub_file_entry_by_index( file_entry, sub_file_entry_index, &sub_file_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve sub file entry: %d.", function, sub_file_entry_index ); goto on_error; } if( info_handle_file_system_hierarchy_fprint_file_entry( info_handle, sub_file_entry, sub_path, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print file entry: %d information.", function, sub_file_entry_index ); goto on_error; } if( libfsrefs_file_entry_free( &sub_file_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free sub file entry: %d.", function, sub_file_entry_index ); goto on_error; } } if( sub_path != NULL ) { memory_free( sub_path ); sub_path = NULL; } } if( file_entry_name != NULL ) { memory_free( file_entry_name ); file_entry_name = NULL; } return( 1 ); on_error: if( sub_file_entry != NULL ) { libfsrefs_file_entry_free( &sub_file_entry, NULL ); } if( sub_path != NULL ) { memory_free( sub_path ); } if( file_entry_name != NULL ) { memory_free( file_entry_name ); } return( -1 ); } /* Prints the file system hierarchy information * Returns 1 if successful or -1 on error */ int info_handle_file_system_hierarchy_fprint( info_handle_t *info_handle, libcerror_error_t **error ) { libfsrefs_file_entry_t *file_entry = NULL; static char *function = "info_handle_file_system_hierarchy_fprint"; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } if( info_handle->bodyfile_stream == NULL ) { fprintf( info_handle->notify_stream, "Resiliant File System (ReFS) information:\n\n" ); fprintf( info_handle->notify_stream, "File system hierarchy:\n" ); } if( libfsrefs_volume_get_root_directory( info_handle->input_volume, &file_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve root directory file entry.", function ); goto on_error; } if( info_handle_file_system_hierarchy_fprint_file_entry( info_handle, file_entry, _SYSTEM_STRING( "\\" ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print root directory file entry information.", function ); goto on_error; } if( libfsrefs_file_entry_free( &file_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free file entry.", function ); goto on_error; } if( info_handle->bodyfile_stream == NULL ) { fprintf( info_handle->notify_stream, "\n" ); } return( 1 ); on_error: if( file_entry != NULL ) { libfsrefs_file_entry_free( &file_entry, NULL ); } return( -1 ); } /* Prints the volume information * Returns 1 if successful or -1 on error */ int info_handle_volume_fprint( info_handle_t *info_handle, libcerror_error_t **error ) { system_character_t *volume_name = NULL; static char *function = "info_handle_volume_fprint"; size32_t cluster_block_size = 0; size_t volume_name_size = 0; uint64_t serial_number = 0; uint16_t bytes_per_sector = 0; uint8_t major_version = 0; uint8_t minor_version = 0; int result = 0; if( info_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid info handle.", function ); return( -1 ); } fprintf( info_handle->notify_stream, "Resiliant File System (ReFS) information:\n\n" ); fprintf( info_handle->notify_stream, "\nVolume information:\n" ); fprintf( info_handle->notify_stream, "\tName\t\t\t\t:" ); #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libfsrefs_volume_get_utf16_name_size( info_handle->input_volume, &volume_name_size, error ); #else result = libfsrefs_volume_get_utf8_name_size( info_handle->input_volume, &volume_name_size, error ); #endif if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve volume name string size.", function ); goto on_error; } else if( ( result != 0 ) && ( volume_name_size > 0 ) ) { volume_name = system_string_allocate( volume_name_size ); if( volume_name == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create volume name string.", function ); goto on_error; } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libfsrefs_volume_get_utf16_name( info_handle->input_volume, (uint16_t *) volume_name, volume_name_size, error ); #else result = libfsrefs_volume_get_utf8_name( info_handle->input_volume, (uint8_t *) volume_name, volume_name_size, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve volume name string.", function ); goto on_error; } fprintf( info_handle->notify_stream, " %" PRIs_SYSTEM "", volume_name ); memory_free( volume_name ); volume_name = NULL; } fprintf( info_handle->notify_stream, "\n" ); fprintf( info_handle->notify_stream, "\tVersion\t\t\t\t:" ); if( libfsrefs_volume_get_version( info_handle->input_volume, &major_version, &minor_version, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve version.", function ); return( -1 ); } else if( result != 0 ) { fprintf( info_handle->notify_stream, " %" PRIu8 ".%" PRIu8 "", major_version, minor_version ); } fprintf( info_handle->notify_stream, "\n" ); if( libfsrefs_volume_get_serial_number( info_handle->input_volume, &serial_number, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve serial number.", function ); return( -1 ); } fprintf( info_handle->notify_stream, "\tSerial number\t\t\t: %08" PRIx64 "\n", serial_number ); if( libfsrefs_volume_get_bytes_per_sector( info_handle->input_volume, &bytes_per_sector, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve bytes per sector.", function ); return( -1 ); } fprintf( info_handle->notify_stream, "\tBytes per sector\t\t: %" PRIu16 "\n", bytes_per_sector ); if( libfsrefs_volume_get_cluster_block_size( info_handle->input_volume, &cluster_block_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve cluster block size.", function ); return( -1 ); } fprintf( info_handle->notify_stream, "\tCluster block size\t\t: %" PRIu32 "\n", cluster_block_size ); /* TODO */ fprintf( info_handle->notify_stream, "\n" ); return( 1 ); on_error: if( volume_name != NULL ) { memory_free( volume_name ); } return( -1 ); } ================================================ FILE: fsrefstools/info_handle.h ================================================ /* * Info handle * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _INFO_HANDLE_H ) #define _INFO_HANDLE_H #include #include #include #include "fsrefstools_libbfio.h" #include "fsrefstools_libcerror.h" #include "fsrefstools_libfsrefs.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct info_handle info_handle_t; struct info_handle { /* The volume offset */ off64_t volume_offset; /* The libbfio input file IO handle */ libbfio_handle_t *input_file_io_handle; /* The libfsrefs input volume */ libfsrefs_volume_t *input_volume; /* Value to indicate if the MD5 hash should be calculated */ uint8_t calculate_md5; /* The bodyfile output stream */ FILE *bodyfile_stream; /* The notification output stream */ FILE *notify_stream; /* Value to indicate if abort was signalled */ int abort; }; int fsrefstools_system_string_copy_from_64_bit_in_decimal( const system_character_t *string, size_t string_size, uint64_t *value_64bit, libcerror_error_t **error ); int info_handle_initialize( info_handle_t **info_handle, uint8_t calculate_md5, libcerror_error_t **error ); int info_handle_free( info_handle_t **info_handle, libcerror_error_t **error ); int info_handle_signal_abort( info_handle_t *info_handle, libcerror_error_t **error ); int info_handle_set_bodyfile( info_handle_t *info_handle, const system_character_t *filename, libcerror_error_t **error ); int info_handle_set_volume_offset( info_handle_t *info_handle, const system_character_t *string, libcerror_error_t **error ); int info_handle_open_input( info_handle_t *info_handle, const system_character_t *filename, libcerror_error_t **error ); int info_handle_close_input( info_handle_t *info_handle, libcerror_error_t **error ); int info_handle_name_value_fprint( info_handle_t *info_handle, const system_character_t *value_string, size_t value_string_length, libcerror_error_t **error ); int info_handle_file_entry_fprint( info_handle_t *info_handle, libfsrefs_file_entry_t *file_entry, const system_character_t *path, const system_character_t *file_entry_name, libcerror_error_t **error ); int info_handle_file_system_hierarchy_fprint_file_entry( info_handle_t *info_handle, libfsrefs_file_entry_t *file_entry, const system_character_t *path, libcerror_error_t **error ); int info_handle_file_system_hierarchy_fprint( info_handle_t *info_handle, libcerror_error_t **error ); int info_handle_volume_fprint( info_handle_t *info_handle, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _INFO_HANDLE_H ) */ ================================================ FILE: include/Makefile.am ================================================ include_HEADERS = \ libfsrefs.h pkginclude_HEADERS = \ libfsrefs/codepage.h \ libfsrefs/definitions.h \ libfsrefs/error.h \ libfsrefs/extern.h \ libfsrefs/features.h \ libfsrefs/types.h EXTRA_DIST = \ libfsrefs.h.in \ libfsrefs/definitions.h.in \ libfsrefs/features.h.in \ libfsrefs/types.h.in DISTCLEANFILES = \ libfsrefs.h \ libfsrefs/definitions.h \ libfsrefs/features.h \ libfsrefs/types.h \ Makefile \ Makefile.in ================================================ FILE: include/libfsrefs/codepage.h ================================================ /* * Codepage definitions for libfsrefs * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_CODEPAGE_H ) #define _LIBFSREFS_CODEPAGE_H #include #if defined( __cplusplus ) extern "C" { #endif /* The codepage definitions */ enum LIBFSREFS_CODEPAGES { LIBFSREFS_CODEPAGE_ASCII = 20127, LIBFSREFS_CODEPAGE_ISO_8859_1 = 28591, LIBFSREFS_CODEPAGE_ISO_8859_2 = 28592, LIBFSREFS_CODEPAGE_ISO_8859_3 = 28593, LIBFSREFS_CODEPAGE_ISO_8859_4 = 28594, LIBFSREFS_CODEPAGE_ISO_8859_5 = 28595, LIBFSREFS_CODEPAGE_ISO_8859_6 = 28596, LIBFSREFS_CODEPAGE_ISO_8859_7 = 28597, LIBFSREFS_CODEPAGE_ISO_8859_8 = 28598, LIBFSREFS_CODEPAGE_ISO_8859_9 = 28599, LIBFSREFS_CODEPAGE_ISO_8859_10 = 28600, LIBFSREFS_CODEPAGE_ISO_8859_11 = 28601, LIBFSREFS_CODEPAGE_ISO_8859_13 = 28603, LIBFSREFS_CODEPAGE_ISO_8859_14 = 28604, LIBFSREFS_CODEPAGE_ISO_8859_15 = 28605, LIBFSREFS_CODEPAGE_ISO_8859_16 = 28606, LIBFSREFS_CODEPAGE_KOI8_R = 20866, LIBFSREFS_CODEPAGE_KOI8_U = 21866, LIBFSREFS_CODEPAGE_WINDOWS_874 = 874, LIBFSREFS_CODEPAGE_WINDOWS_932 = 932, LIBFSREFS_CODEPAGE_WINDOWS_936 = 936, LIBFSREFS_CODEPAGE_WINDOWS_949 = 949, LIBFSREFS_CODEPAGE_WINDOWS_950 = 950, LIBFSREFS_CODEPAGE_WINDOWS_1250 = 1250, LIBFSREFS_CODEPAGE_WINDOWS_1251 = 1251, LIBFSREFS_CODEPAGE_WINDOWS_1252 = 1252, LIBFSREFS_CODEPAGE_WINDOWS_1253 = 1253, LIBFSREFS_CODEPAGE_WINDOWS_1254 = 1254, LIBFSREFS_CODEPAGE_WINDOWS_1255 = 1255, LIBFSREFS_CODEPAGE_WINDOWS_1256 = 1256, LIBFSREFS_CODEPAGE_WINDOWS_1257 = 1257, LIBFSREFS_CODEPAGE_WINDOWS_1258 = 1258 }; #define LIBFSREFS_CODEPAGE_US_ASCII LIBFSREFS_CODEPAGE_ASCII #define LIBFSREFS_CODEPAGE_ISO_WESTERN_EUROPEAN LIBFSREFS_CODEPAGE_ISO_8859_1 #define LIBFSREFS_CODEPAGE_ISO_CENTRAL_EUROPEAN LIBFSREFS_CODEPAGE_ISO_8859_2 #define LIBFSREFS_CODEPAGE_ISO_SOUTH_EUROPEAN LIBFSREFS_CODEPAGE_ISO_8859_3 #define LIBFSREFS_CODEPAGE_ISO_NORTH_EUROPEAN LIBFSREFS_CODEPAGE_ISO_8859_4 #define LIBFSREFS_CODEPAGE_ISO_CYRILLIC LIBFSREFS_CODEPAGE_ISO_8859_5 #define LIBFSREFS_CODEPAGE_ISO_ARABIC LIBFSREFS_CODEPAGE_ISO_8859_6 #define LIBFSREFS_CODEPAGE_ISO_GREEK LIBFSREFS_CODEPAGE_ISO_8859_7 #define LIBFSREFS_CODEPAGE_ISO_HEBREW LIBFSREFS_CODEPAGE_ISO_8859_8 #define LIBFSREFS_CODEPAGE_ISO_TURKISH LIBFSREFS_CODEPAGE_ISO_8859_9 #define LIBFSREFS_CODEPAGE_ISO_NORDIC LIBFSREFS_CODEPAGE_ISO_8859_10 #define LIBFSREFS_CODEPAGE_ISO_THAI LIBFSREFS_CODEPAGE_ISO_8859_11 #define LIBFSREFS_CODEPAGE_ISO_BALTIC LIBFSREFS_CODEPAGE_ISO_8859_13 #define LIBFSREFS_CODEPAGE_ISO_CELTIC LIBFSREFS_CODEPAGE_ISO_8859_14 #define LIBFSREFS_CODEPAGE_ISO_LATIN_1 LIBFSREFS_CODEPAGE_ISO_8859_1 #define LIBFSREFS_CODEPAGE_ISO_LATIN_2 LIBFSREFS_CODEPAGE_ISO_8859_2 #define LIBFSREFS_CODEPAGE_ISO_LATIN_3 LIBFSREFS_CODEPAGE_ISO_8859_3 #define LIBFSREFS_CODEPAGE_ISO_LATIN_4 LIBFSREFS_CODEPAGE_ISO_8859_4 #define LIBFSREFS_CODEPAGE_ISO_LATIN_5 LIBFSREFS_CODEPAGE_ISO_8859_9 #define LIBFSREFS_CODEPAGE_ISO_LATIN_6 LIBFSREFS_CODEPAGE_ISO_8859_10 #define LIBFSREFS_CODEPAGE_ISO_LATIN_7 LIBFSREFS_CODEPAGE_ISO_8859_13 #define LIBFSREFS_CODEPAGE_ISO_LATIN_8 LIBFSREFS_CODEPAGE_ISO_8859_14 #define LIBFSREFS_CODEPAGE_ISO_LATIN_9 LIBFSREFS_CODEPAGE_ISO_8859_15 #define LIBFSREFS_CODEPAGE_ISO_LATIN_10 LIBFSREFS_CODEPAGE_ISO_8859_16 #define LIBFSREFS_CODEPAGE_KOI8_RUSSIAN LIBFSREFS_CODEPAGE_KOI8_R #define LIBFSREFS_CODEPAGE_KOI8_UKRAINIAN LIBFSREFS_CODEPAGE_KOI8_U #define LIBFSREFS_CODEPAGE_WINDOWS_THAI LIBFSREFS_CODEPAGE_WINDOWS_874 #define LIBFSREFS_CODEPAGE_WINDOWS_JAPANESE LIBFSREFS_CODEPAGE_WINDOWS_932 #define LIBFSREFS_CODEPAGE_WINDOWS_CHINESE_SIMPLIFIED LIBFSREFS_CODEPAGE_WINDOWS_936 #define LIBFSREFS_CODEPAGE_WINDOWS_KOREAN LIBFSREFS_CODEPAGE_WINDOWS_949 #define LIBFSREFS_CODEPAGE_WINDOWS_CHINESE_TRADITIONAL LIBFSREFS_CODEPAGE_WINDOWS_950 #define LIBFSREFS_CODEPAGE_WINDOWS_CENTRAL_EUROPEAN LIBFSREFS_CODEPAGE_WINDOWS_1250 #define LIBFSREFS_CODEPAGE_WINDOWS_CYRILLIC LIBFSREFS_CODEPAGE_WINDOWS_1251 #define LIBFSREFS_CODEPAGE_WINDOWS_WESTERN_EUROPEAN LIBFSREFS_CODEPAGE_WINDOWS_1252 #define LIBFSREFS_CODEPAGE_WINDOWS_GREEK LIBFSREFS_CODEPAGE_WINDOWS_1253 #define LIBFSREFS_CODEPAGE_WINDOWS_TURKISH LIBFSREFS_CODEPAGE_WINDOWS_1254 #define LIBFSREFS_CODEPAGE_WINDOWS_HEBREW LIBFSREFS_CODEPAGE_WINDOWS_1255 #define LIBFSREFS_CODEPAGE_WINDOWS_ARABIC LIBFSREFS_CODEPAGE_WINDOWS_1256 #define LIBFSREFS_CODEPAGE_WINDOWS_BALTIC LIBFSREFS_CODEPAGE_WINDOWS_1257 #define LIBFSREFS_CODEPAGE_WINDOWS_VIETNAMESE LIBFSREFS_CODEPAGE_WINDOWS_1258 #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_CODEPAGE_H ) */ ================================================ FILE: include/libfsrefs/definitions.h.in ================================================ /* * Definitions for libfsrefs * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_DEFINITIONS_H ) #define _LIBFSREFS_DEFINITIONS_H #include #define LIBFSREFS_VERSION @VERSION@ /* The version string */ #define LIBFSREFS_VERSION_STRING "@VERSION@" /* The file access * bit 1 set to 1 for read access * bit 2 set to 1 for write access * bit 3-8 not used */ enum LIBFSREFS_ACCESS_FLAGS { LIBFSREFS_ACCESS_FLAG_READ = 0x01, /* Reserved: not supported yet */ LIBFSREFS_ACCESS_FLAG_WRITE = 0x02 }; /* The file access macros */ #define LIBFSREFS_OPEN_READ ( LIBFSREFS_ACCESS_FLAG_READ ) /* Reserved: not supported yet */ #define LIBFSREFS_OPEN_WRITE ( LIBFSREFS_ACCESS_FLAG_WRITE ) /* Reserved: not supported yet */ #define LIBFSREFS_OPEN_READ_WRITE ( LIBFSREFS_ACCESS_FLAG_READ | LIBFSREFS_ACCESS_FLAG_WRITE ) /* The path segment separator */ #define LIBFSREFS_SEPARATOR '\\' /* The file attribute flags */ enum LIBFSREFS_FILE_ATTRIBUTE_FLAGS { LIBFSREFS_FILE_ATTRIBUTE_FLAG_READ_ONLY = 0x00000001UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_HIDDEN = 0x00000002UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_SYSTEM = 0x00000004UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_DIRECTORY = 0x00000010UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_ARCHIVE = 0x00000020UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_DEVICE = 0x00000040UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_NORMAL = 0x00000080UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_TEMPORARY = 0x00000100UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_SPARSE_FILE = 0x00000200UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_REPARSE_POINT = 0x00000400UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_COMPRESSED = 0x00000800UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_OFFLINE = 0x00001000UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_NOT_CONTENT_INDEXED = 0x00002000UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_ENCRYPTED = 0x00004000UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_VIRTUAL = 0x00010000UL }; #endif /* !defined( _LIBFSREFS_DEFINITIONS_H ) */ ================================================ FILE: include/libfsrefs/error.h ================================================ /* * The error code definitions for libfsrefs * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_ERROR_H ) #define _LIBFSREFS_ERROR_H #include /* External error type definition hides internal structure */ typedef intptr_t libfsrefs_error_t; /* The error domains */ enum LIBFSREFS_ERROR_DOMAINS { LIBFSREFS_ERROR_DOMAIN_ARGUMENTS = (int) 'a', LIBFSREFS_ERROR_DOMAIN_CONVERSION = (int) 'c', LIBFSREFS_ERROR_DOMAIN_COMPRESSION = (int) 'C', LIBFSREFS_ERROR_DOMAIN_IO = (int) 'I', LIBFSREFS_ERROR_DOMAIN_INPUT = (int) 'i', LIBFSREFS_ERROR_DOMAIN_MEMORY = (int) 'm', LIBFSREFS_ERROR_DOMAIN_OUTPUT = (int) 'o', LIBFSREFS_ERROR_DOMAIN_RUNTIME = (int) 'r' }; /* The argument error codes * to signify errors regarding arguments passed to a function */ enum LIBFSREFS_ARGUMENT_ERROR { LIBFSREFS_ARGUMENT_ERROR_GENERIC = 0, /* The argument contains an invalid value */ LIBFSREFS_ARGUMENT_ERROR_INVALID_VALUE = 1, /* The argument contains a value less than zero */ LIBFSREFS_ARGUMENT_ERROR_VALUE_LESS_THAN_ZERO = 2, /* The argument contains a value zero or less */ LIBFSREFS_ARGUMENT_ERROR_VALUE_ZERO_OR_LESS = 3, /* The argument contains a value that exceeds the maximum * for the specific type */ LIBFSREFS_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM = 4, /* The argument contains a value that is too small */ LIBFSREFS_ARGUMENT_ERROR_VALUE_TOO_SMALL = 5, /* The argument contains a value that is too large */ LIBFSREFS_ARGUMENT_ERROR_VALUE_TOO_LARGE = 6, /* The argument contains a value that is out of bounds */ LIBFSREFS_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS = 7, /* The argument contains a value that is not supported */ LIBFSREFS_ARGUMENT_ERROR_UNSUPPORTED_VALUE = 8, /* The argument contains a value that conficts with another argument */ LIBFSREFS_ARGUMENT_ERROR_CONFLICTING_VALUE = 9 }; /* The conversion error codes * to signify errors regarding conversions */ enum LIBFSREFS_CONVERSION_ERROR { LIBFSREFS_CONVERSION_ERROR_GENERIC = 0, /* The conversion failed on the input */ LIBFSREFS_CONVERSION_ERROR_INPUT_FAILED = 1, /* The conversion failed on the output */ LIBFSREFS_CONVERSION_ERROR_OUTPUT_FAILED = 2 }; /* The compression error codes * to signify errors regarding compression */ enum LIBFSREFS_COMPRESSION_ERROR { LIBFSREFS_COMPRESSION_ERROR_GENERIC = 0, /* The compression failed */ LIBFSREFS_COMPRESSION_ERROR_COMPRESS_FAILED = 1, /* The decompression failed */ LIBFSREFS_COMPRESSION_ERROR_DECOMPRESS_FAILED = 2 }; /* The input/output error codes * to signify errors regarding input/output */ enum LIBFSREFS_IO_ERROR { LIBFSREFS_IO_ERROR_GENERIC = 0, /* The open failed */ LIBFSREFS_IO_ERROR_OPEN_FAILED = 1, /* The close failed */ LIBFSREFS_IO_ERROR_CLOSE_FAILED = 2, /* The seek failed */ LIBFSREFS_IO_ERROR_SEEK_FAILED = 3, /* The read failed */ LIBFSREFS_IO_ERROR_READ_FAILED = 4, /* The write failed */ LIBFSREFS_IO_ERROR_WRITE_FAILED = 5, /* Access denied */ LIBFSREFS_IO_ERROR_ACCESS_DENIED = 6, /* The resource is invalid i.e. a missing file */ LIBFSREFS_IO_ERROR_INVALID_RESOURCE = 7, /* The ioctl failed */ LIBFSREFS_IO_ERROR_IOCTL_FAILED = 8, /* The unlink failed */ LIBFSREFS_IO_ERROR_UNLINK_FAILED = 9 }; /* The input error codes * to signify errors regarding handing input data */ enum LIBFSREFS_INPUT_ERROR { LIBFSREFS_INPUT_ERROR_GENERIC = 0, /* The input contains invalid data */ LIBFSREFS_INPUT_ERROR_INVALID_DATA = 1, /* The input contains an unsupported signature */ LIBFSREFS_INPUT_ERROR_SIGNATURE_MISMATCH = 2, /* A checksum in the input did not match */ LIBFSREFS_INPUT_ERROR_CHECKSUM_MISMATCH = 3, /* A value in the input did not match a previously * read value or calculated value */ LIBFSREFS_INPUT_ERROR_VALUE_MISMATCH = 4 }; /* The memory error codes * to signify errors regarding memory */ enum LIBFSREFS_MEMORY_ERROR { LIBFSREFS_MEMORY_ERROR_GENERIC = 0, /* There is insufficient memory available */ LIBFSREFS_MEMORY_ERROR_INSUFFICIENT = 1, /* The memory failed to be copied */ LIBFSREFS_MEMORY_ERROR_COPY_FAILED = 2, /* The memory failed to be set */ LIBFSREFS_MEMORY_ERROR_SET_FAILED = 3 }; /* The output error codes */ enum LIBFSREFS_OUTPUT_ERROR { LIBFSREFS_OUTPUT_ERROR_GENERIC = 0, /* There is insuficient space to write the output */ LIBFSREFS_OUTPUT_ERROR_INSUFFICIENT_SPACE = 1 }; /* The runtime error codes * to signify errors regarding runtime processing */ enum LIBFSREFS_RUNTIME_ERROR { LIBFSREFS_RUNTIME_ERROR_GENERIC = 0, /* The value is missing */ LIBFSREFS_RUNTIME_ERROR_VALUE_MISSING = 1, /* The value was already set */ LIBFSREFS_RUNTIME_ERROR_VALUE_ALREADY_SET = 2, /* The creation and/or initialization of an internal structure failed */ LIBFSREFS_RUNTIME_ERROR_INITIALIZE_FAILED = 3, /* The resize of an internal structure failed */ LIBFSREFS_RUNTIME_ERROR_RESIZE_FAILED = 4, /* The free and/or finalization of an internal structure failed */ LIBFSREFS_RUNTIME_ERROR_FINALIZE_FAILED = 5, /* The value could not be determined */ LIBFSREFS_RUNTIME_ERROR_GET_FAILED = 6, /* The value could not be set */ LIBFSREFS_RUNTIME_ERROR_SET_FAILED = 7, /* The value could not be appended/prepended */ LIBFSREFS_RUNTIME_ERROR_APPEND_FAILED = 8, /* The value could not be copied */ LIBFSREFS_RUNTIME_ERROR_COPY_FAILED = 9, /* The value could not be removed */ LIBFSREFS_RUNTIME_ERROR_REMOVE_FAILED = 10, /* The value could not be printed */ LIBFSREFS_RUNTIME_ERROR_PRINT_FAILED = 11, /* The value was out of bounds */ LIBFSREFS_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS = 12, /* The value exceeds the maximum for its specific type */ LIBFSREFS_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM = 13, /* The value is unsupported */ LIBFSREFS_RUNTIME_ERROR_UNSUPPORTED_VALUE = 14, /* An abort was requested */ LIBFSREFS_RUNTIME_ERROR_ABORT_REQUESTED = 15 }; #endif /* !defined( _LIBFSREFS_ERROR_H ) */ ================================================ FILE: include/libfsrefs/extern.h ================================================ /* * The extern definition * * This header should be included in header files that export or import * library functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_EXTERN_H ) #define _LIBFSREFS_EXTERN_H /* To export functions from the libfsrefs DLL define LIBFSREFS_DLL_EXPORT * To import functions from the libfsrefs DLL define LIBFSREFS_DLL_IMPORT * Otherwise use default extern statement */ #if defined( LIBFSREFS_DLL_EXPORT ) #define LIBFSREFS_EXTERN __declspec(dllexport) #elif defined( LIBFSREFS_DLL_IMPORT ) #define LIBFSREFS_EXTERN extern __declspec(dllimport) #else #define LIBFSREFS_EXTERN extern #endif #endif /* !defined( _LIBFSREFS_EXTERN_H ) */ ================================================ FILE: include/libfsrefs/features.h.in ================================================ /* * Features of libfsrefs * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_FEATURES_H ) #define _LIBFSREFS_FEATURES_H /* The libfsrefs type support features */ #if defined( WINAPI ) || @HAVE_WIDE_CHARACTER_TYPE@ #define LIBFSREFS_HAVE_WIDE_CHARACTER_TYPE 1 #endif #if defined( WINAPI ) || @HAVE_MULTI_THREAD_SUPPORT@ #define LIBFSREFS_HAVE_MULTI_THREAD_SUPPORT 1 #endif #if defined( HAVE_LIBBFIO ) || ( !defined( WINAPI ) && @HAVE_LIBBFIO@ ) #define LIBFSREFS_HAVE_BFIO 1 #endif #if !defined( LIBFSREFS_DEPRECATED ) #if defined( __GNUC__ ) && __GNUC__ >= 3 #define LIBFSREFS_DEPRECATED __attribute__ ((__deprecated__)) #elif defined( _MSC_VER ) #define LIBFSREFS_DEPRECATED __declspec(deprecated) #else #define LIBFSREFS_DEPRECATED #endif #endif #endif /* !defined( _LIBFSREFS_FEATURES_H ) */ ================================================ FILE: include/libfsrefs/types.h.in ================================================ /* * Type definitions for libfsrefs * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_TYPES_H ) #define _LIBFSREFS_TYPES_H #include /* Integer type definitions */ #if ( defined( _MSC_VER ) && ( _MSC_VER < 1600 ) ) || ( defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) ) #ifdef __cplusplus extern "C" { #endif /* Microsoft Visual Studio C++ before Visual Studio 2010 or earlier versions of the Borland C++ Builder * do not support the (u)int#_t type definitions but have __int# definitions instead */ #if !defined( HAVE_INT8_T ) #define HAVE_INT8_T typedef __int8 int8_t; #endif #if !defined( HAVE_UINT8_T ) #define HAVE_UINT8_T typedef unsigned __int8 uint8_t; #endif #if !defined( HAVE_INT16_T ) #define HAVE_INT16_T typedef __int16 int16_t; #endif #if !defined( HAVE_UINT16_T ) #define HAVE_UINT16_T typedef unsigned __int16 uint16_t; #endif #if !defined( HAVE_INT32_T ) #define HAVE_INT32_T typedef __int32 int32_t; #endif #if !defined( HAVE_UINT32_T ) #define HAVE_UINT32_T typedef unsigned __int32 uint32_t; #endif #if !defined( HAVE_INT64_T ) #define HAVE_INT64_T typedef __int64 int64_t; #endif #if !defined( HAVE_UINT64_T ) #define HAVE_UINT64_T typedef unsigned __int64 uint64_t; #endif #ifdef __cplusplus } #endif #elif defined( _MSC_VER ) || defined( __BORLANDC__ ) /* Later versions of Microsoft Visual Studio C++ and Borland C/C++ define the types in */ #include #else #if @HAVE_SYS_TYPES_H@ || defined( HAVE_SYS_TYPES_H ) #include #else #error Missing system type definitions (sys/types.h) #endif /* Type definitions for compilers that have access to * or */ #if @HAVE_INTTYPES_H@ || defined( HAVE_INTTYPES_H ) #include #elif @HAVE_STDINT_H@ || defined( HAVE_STDINT_H ) #include #else #error Missing integer type definitions (inttypes.h, stdint.h) #endif #endif #ifdef __cplusplus extern "C" { #endif #if defined( _MSC_VER ) || ( defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) ) /* Microsoft Visual Studio C++ or earlier versions of the Borland C++ Builder * do not support the ssize_t type definition */ #if !defined( HAVE_SSIZE_T ) #define HAVE_SSIZE_T #if defined( _WIN64 ) typedef __int64 ssize_t; #else typedef __int32 ssize_t; #endif #endif /* !defined( HAVE_SSIZE_T ) */ #endif /* defined( _MSC_VER ) || ( defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) ) */ #if defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) /* Earlier versions of Borland C++ Builder do not support the intptr_t type definition */ #if !defined( HAVE_INTPTR_T ) #define HAVE_INTPTR_T #if defined( _WIN64 ) typedef __int64 intptr_t; #else typedef __int32 intptr_t; #endif #endif /* !defined( HAVE_INTPTR_T ) */ #endif /* defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) */ #if ( !defined( HAVE_SIZE32_T ) && ! @HAVE_SIZE32_T@ ) || HAVE_SIZE32_T == 0 #define HAVE_SIZE32_T 1 typedef uint32_t size32_t; #endif #if ( !defined( HAVE_SSIZE32_T ) && ! @HAVE_SSIZE32_T@ ) || HAVE_SSIZE32_T == 0 #define HAVE_SSIZE32_T 1 typedef int32_t ssize32_t; #endif #if ( !defined( HAVE_SIZE64_T ) && ! @HAVE_SIZE64_T@ ) || HAVE_SIZE64_T == 0 #define HAVE_SIZE64_T 1 typedef uint64_t size64_t; #endif #if ( !defined( HAVE_SSIZE64_T ) && ! @HAVE_SSIZE64_T@ ) || HAVE_SSIZE64_T == 0 #define HAVE_SSIZE64_T 1 typedef int64_t ssize64_t; #endif #if ( !defined( HAVE_OFF64_T ) && ! @HAVE_OFF64_T@ ) || HAVE_OFF64_T == 0 #define HAVE_OFF64_T 1 typedef int64_t off64_t; #endif /* Wide character definition */ #if defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0520 ) #include #elif defined( WINAPI ) #include #elif @HAVE_WCHAR_H@ || defined( HAVE_WCHAR_H ) /* __USE_UNIX98 is required to add swprintf definition */ #if !defined( __USE_UNIX98 ) #define __USE_UNIX98 #define LIBFSREFS_DEFINITION_UNIX98 #endif #include #if defined( LIBFSREFS_DEFINITION_UNIX98 ) #undef __USE_UNIX98 #undef LIBFSREFS_DEFINITION_UNIX98 #endif #endif /* The following type definitions hide internal data structures */ typedef intptr_t libfsrefs_file_entry_t; typedef intptr_t libfsrefs_volume_t; #ifdef __cplusplus } #endif #endif /* !defined( _LIBFSREFS_TYPES_H ) */ ================================================ FILE: include/libfsrefs.h.in ================================================ /* * Library to access the Resiliant File System (ReFS) format * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_H ) #define _LIBFSREFS_H #include #include #include #include #include #include #include #if defined( LIBFSREFS_HAVE_BFIO ) #include #endif #if defined( __cplusplus ) extern "C" { #endif /* ------------------------------------------------------------------------- * Support functions * ------------------------------------------------------------------------- */ /* Returns the library version */ LIBFSREFS_EXTERN \ const char *libfsrefs_get_version( void ); /* Returns the access flags for reading */ LIBFSREFS_EXTERN \ int libfsrefs_get_access_flags_read( void ); /* Retrieves the narrow system string codepage * A value of 0 represents no codepage, UTF-8 encoding is used instead * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_get_codepage( int *codepage, libfsrefs_error_t **error ); /* Sets the narrow system string codepage * A value of 0 represents no codepage, UTF-8 encoding is used instead * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_set_codepage( int codepage, libfsrefs_error_t **error ); /* Determines if a file contains a REFS volume signature * Returns 1 if true, 0 if not or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_check_volume_signature( const char *filename, libfsrefs_error_t **error ); #if defined( LIBFSREFS_HAVE_WIDE_CHARACTER_TYPE ) /* Determines if a file contains a REFS volume signature * Returns 1 if true, 0 if not or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_check_volume_signature_wide( const wchar_t *filename, libfsrefs_error_t **error ); #endif /* defined( LIBFSREFS_HAVE_WIDE_CHARACTER_TYPE ) */ #if defined( LIBFSREFS_HAVE_BFIO ) /* Determines if a file contains a REFS volume signature using a Basic File IO (bfio) handle * Returns 1 if true, 0 if not or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_check_volume_signature_file_io_handle( libbfio_handle_t *file_io_handle, libfsrefs_error_t **error ); #endif /* defined( LIBFSREFS_HAVE_BFIO ) */ /* ------------------------------------------------------------------------- * Notify functions * ------------------------------------------------------------------------- */ /* Sets the verbose notification */ LIBFSREFS_EXTERN \ void libfsrefs_notify_set_verbose( int verbose ); /* Sets the notification stream * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_notify_set_stream( FILE *stream, libfsrefs_error_t **error ); /* Opens the notification stream using a filename * The stream is opened in append mode * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_notify_stream_open( const char *filename, libfsrefs_error_t **error ); /* Closes the notification stream if opened using a filename * Returns 0 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_notify_stream_close( libfsrefs_error_t **error ); /* ------------------------------------------------------------------------- * Error functions * ------------------------------------------------------------------------- */ /* Frees an error */ LIBFSREFS_EXTERN \ void libfsrefs_error_free( libfsrefs_error_t **error ); /* Prints a descriptive string of the error to the stream * Returns the number of printed characters if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_error_fprint( libfsrefs_error_t *error, FILE *stream ); /* Prints a descriptive string of the error to the string * The end-of-string character is not included in the return value * Returns the number of printed characters if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_error_sprint( libfsrefs_error_t *error, char *string, size_t size ); /* Prints a backtrace of the error to the stream * Returns the number of printed characters if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_error_backtrace_fprint( libfsrefs_error_t *error, FILE *stream ); /* Prints a backtrace of the error to the string * The end-of-string character is not included in the return value * Returns the number of printed characters if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_error_backtrace_sprint( libfsrefs_error_t *error, char *string, size_t size ); /* ------------------------------------------------------------------------- * Volume functions * ------------------------------------------------------------------------- */ /* Creates a volume * Make sure the value volume is referencing, is set to NULL * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_initialize( libfsrefs_volume_t **volume, libfsrefs_error_t **error ); /* Frees a volume * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_free( libfsrefs_volume_t **volume, libfsrefs_error_t **error ); /* Signals the volume to abort its current activity * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_signal_abort( libfsrefs_volume_t *volume, libfsrefs_error_t **error ); /* Opens a volume * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_open( libfsrefs_volume_t *volume, const char *filename, int access_flags, libfsrefs_error_t **error ); #if defined( LIBFSREFS_HAVE_WIDE_CHARACTER_TYPE ) /* Opens a volume * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_open_wide( libfsrefs_volume_t *volume, const wchar_t *filename, int access_flags, libfsrefs_error_t **error ); #endif /* defined( LIBFSREFS_HAVE_WIDE_CHARACTER_TYPE ) */ #if defined( LIBFSREFS_HAVE_BFIO ) /* Opens a volume using a Basic File IO (bfio) handle * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_open_file_io_handle( libfsrefs_volume_t *volume, libbfio_handle_t *file_io_handle, int access_flags, libfsrefs_error_t **error ); #endif /* defined( LIBFSREFS_HAVE_BFIO ) */ /* Closes a volume * Returns 0 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_close( libfsrefs_volume_t *volume, libfsrefs_error_t **error ); /* Retrieves the bytes per sector * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_bytes_per_sector( libfsrefs_volume_t *volume, uint16_t *bytes_per_sector, libfsrefs_error_t **error ); /* Retrieves the cluster block size * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_cluster_block_size( libfsrefs_volume_t *volume, size32_t *cluster_block_size, libfsrefs_error_t **error ); /* Retrieves the size of the UTF-8 encoded name * The returned size includes the end of string character * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_utf8_name_size( libfsrefs_volume_t *volume, size_t *utf8_string_size, libfsrefs_error_t **error ); /* Retrieves the UTF-8 encoded name value * The size should include the end of string character * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_utf8_name( libfsrefs_volume_t *volume, uint8_t *utf8_string, size_t utf8_string_size, libfsrefs_error_t **error ); /* Retrieves the size of the UTF-16 encoded name * The returned size includes the end of string character * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_utf16_name_size( libfsrefs_volume_t *volume, size_t *utf16_string_size, libfsrefs_error_t **error ); /* Retrieves the UTF-16 encoded name value * The size should include the end of string character * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_utf16_name( libfsrefs_volume_t *volume, uint16_t *utf16_string, size_t utf16_string_size, libfsrefs_error_t **error ); /* Retrieves the format version * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_version( libfsrefs_volume_t *volume, uint8_t *major_version, uint8_t *minor_version, libfsrefs_error_t **error ); /* Retrieves the serial number * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_serial_number( libfsrefs_volume_t *volume, uint64_t *serial_number, libfsrefs_error_t **error ); /* Retrieves the root directory file entry * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_get_root_directory( libfsrefs_volume_t *volume, libfsrefs_file_entry_t **file_entry, libfsrefs_error_t **error ); /* ------------------------------------------------------------------------- * File entry functions * ------------------------------------------------------------------------- */ /* Frees a file entry * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_free( libfsrefs_file_entry_t **file_entry, libfsrefs_error_t **error ); /* Retrieves the creation date and time * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_creation_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libfsrefs_error_t **error ); /* Retrieves the modification date and time * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_modification_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libfsrefs_error_t **error ); /* Retrieves the access date and time * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_access_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libfsrefs_error_t **error ); /* Retrieves the entry modification date and time * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_entry_modification_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libfsrefs_error_t **error ); /* Retrieves the file attribute flags * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_file_attribute_flags( libfsrefs_file_entry_t *file_entry, uint32_t *file_attribute_flags, libfsrefs_error_t **error ); /* Retrieves the size of the UTF-8 encoded name * This function uses UTF-8 RFC 2279 (or 6-byte UTF-8) to support characters outside Unicode * The returned size includes the end of string character * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_utf8_name_size( libfsrefs_file_entry_t *file_entry, size_t *utf8_string_size, libfsrefs_error_t **error ); /* Retrieves the UTF-8 encoded name * This function uses UTF-8 RFC 2279 (or 6-byte UTF-8) to support characters outside Unicode * The size should include the end of string character * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_utf8_name( libfsrefs_file_entry_t *file_entry, uint8_t *utf8_string, size_t utf8_string_size, libfsrefs_error_t **error ); /* Retrieves the size of the UTF-16 encoded name * This function uses UCS-2 (with surrogates) to support characters outside Unicode * The returned size includes the end of string character * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_utf16_name_size( libfsrefs_file_entry_t *file_entry, size_t *utf16_string_size, libfsrefs_error_t **error ); /* Retrieves the UTF-16 encoded name * This function uses UCS-2 (with surrogates) to support characters outside Unicode * The size should include the end of string character * Returns 1 if successful, 0 if not available or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_utf16_name( libfsrefs_file_entry_t *file_entry, uint16_t *utf16_string, size_t utf16_string_size, libfsrefs_error_t **error ); /* Retrieves the number of sub file entries * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_number_of_sub_file_entries( libfsrefs_file_entry_t *file_entry, int *number_of_sub_file_entries, libfsrefs_error_t **error ); /* Retrieves the sub file entry for the specific index * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_sub_file_entry_by_index( libfsrefs_file_entry_t *file_entry, int sub_file_entry_index, libfsrefs_file_entry_t **sub_file_entry, libfsrefs_error_t **error ); /* Retrieves the size of the default data stream (nameless $DATA attribute) * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_size( libfsrefs_file_entry_t *file_entry, size64_t *size, libfsrefs_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_H ) */ ================================================ FILE: libfsrefs/Makefile.am ================================================ AM_CPPFLAGS = \ -I../include -I$(top_srcdir)/include \ -I../common -I$(top_srcdir)/common \ @LIBCERROR_CPPFLAGS@ \ @LIBCTHREADS_CPPFLAGS@ \ @LIBCDATA_CPPFLAGS@ \ @LIBCLOCALE_CPPFLAGS@ \ @LIBCNOTIFY_CPPFLAGS@ \ @LIBCSPLIT_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ @LIBCFILE_CPPFLAGS@ \ @LIBCPATH_CPPFLAGS@ \ @LIBBFIO_CPPFLAGS@ \ @LIBFCACHE_CPPFLAGS@ \ @LIBFDATA_CPPFLAGS@ \ @LIBFDATETIME_CPPFLAGS@ \ @LIBFGUID_CPPFLAGS@ \ @LIBFWNT_CPPFLAGS@ \ @PTHREAD_CPPFLAGS@ \ @LIBFSREFS_DLL_EXPORT@ lib_LTLIBRARIES = libfsrefs.la libfsrefs_la_SOURCES = \ fsrefs_checkpoint.h \ fsrefs_directory_object.h \ fsrefs_metadata_block.h \ fsrefs_ministore_tree.h \ fsrefs_superblock.h \ fsrefs_volume_header.h \ libfsrefs.c \ libfsrefs_attribute_values.c libfsrefs_attribute_values.h \ libfsrefs_block_descriptor.c libfsrefs_block_descriptor.h \ libfsrefs_block_reference.c libfsrefs_block_reference.h \ libfsrefs_block_tree.c libfsrefs_block_tree.h \ libfsrefs_block_tree_node.c libfsrefs_block_tree_node.h \ libfsrefs_checkpoint.c libfsrefs_checkpoint.h \ libfsrefs_data_run.c libfsrefs_data_run.h \ libfsrefs_debug.c libfsrefs_debug.h \ libfsrefs_definitions.h \ libfsrefs_directory_entry.c libfsrefs_directory_entry.h \ libfsrefs_directory_object.c libfsrefs_directory_object.h \ libfsrefs_error.c libfsrefs_error.h \ libfsrefs_extern.h \ libfsrefs_file_entry.c libfsrefs_file_entry.h \ libfsrefs_file_system.c libfsrefs_file_system.h \ libfsrefs_io_handle.c libfsrefs_io_handle.h \ libfsrefs_libbfio.h \ libfsrefs_libcdata.h \ libfsrefs_libcerror.h \ libfsrefs_libclocale.h \ libfsrefs_libcnotify.h \ libfsrefs_libcthreads.h \ libfsrefs_libfcache.h \ libfsrefs_libfdata.h \ libfsrefs_libfdatetime.h \ libfsrefs_libfguid.h \ libfsrefs_libfwnt.h \ libfsrefs_libuna.h \ libfsrefs_metadata_block_header.c libfsrefs_metadata_block_header.h \ libfsrefs_ministore_node.c libfsrefs_ministore_node.h \ libfsrefs_node_header.c libfsrefs_node_header.h \ libfsrefs_node_record.c libfsrefs_node_record.h \ libfsrefs_notify.c libfsrefs_notify.h \ libfsrefs_objects_tree.c libfsrefs_objects_tree.h \ libfsrefs_superblock.c libfsrefs_superblock.h \ libfsrefs_support.c libfsrefs_support.h \ libfsrefs_tree_header.c libfsrefs_tree_header.h \ libfsrefs_types.h \ libfsrefs_unused.h \ libfsrefs_volume.c libfsrefs_volume.h \ libfsrefs_volume_header.c libfsrefs_volume_header.h libfsrefs_la_LIBADD = \ @LIBCERROR_LIBADD@ \ @LIBCTHREADS_LIBADD@ \ @LIBCDATA_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBBFIO_LIBADD@ \ @LIBFCACHE_LIBADD@ \ @LIBFDATA_LIBADD@ \ @LIBFDATETIME_LIBADD@ \ @LIBFGUID_LIBADD@ \ @LIBFWNT_LIBADD@ \ @PTHREAD_LIBADD@ libfsrefs_la_LDFLAGS = -no-undefined -version-info 1:0:0 EXTRA_DIST = \ libfsrefs_definitions.h.in \ libfsrefs.rc \ libfsrefs.rc.in DISTCLEANFILES = \ libfsrefs_definitions.h \ libfsrefs.rc \ Makefile \ Makefile.in sources-local: $(BUILT_SOURCES) splint-local: @echo "Running splint on libfsrefs ..." -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(libfsrefs_la_SOURCES) ================================================ FILE: libfsrefs/fsrefs_checkpoint.h ================================================ /* * The ReFS checkpoint definition * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_CHECKPOINT_H ) #define _FSREFS_CHECKPOINT_H #include #include #if defined( __cplusplus ) extern "C" { #endif typedef struct fsrefs_checkpoint_header fsrefs_checkpoint_header_t; struct fsrefs_checkpoint_header { /* Unknown * Consists of 4 bytes */ uint8_t unknown1[ 4 ]; /* Major format version * Consists of 2 bytes */ uint8_t major_format_version[ 2 ]; /* Minor format version * Consists of 2 bytes */ uint8_t minor_format_version[ 2 ]; /* Self reference data offset * Consists of 4 bytes */ uint8_t self_reference_data_offset[ 4 ]; /* Self reference data size * Consists of 4 bytes */ uint8_t self_reference_data_size[ 4 ]; }; typedef struct fsrefs_checkpoint_trailer_v1 fsrefs_checkpoint_trailer_v1_t; struct fsrefs_checkpoint_trailer_v1 { /* Unknown * Consists of 8 bytes */ uint8_t unknown2[ 8 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown3[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown4[ 4 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown5[ 8 ]; /* Number of offsets * Consists of 4 bytes */ uint8_t number_of_offsets[ 4 ]; }; typedef struct fsrefs_checkpoint_trailer_v3 fsrefs_checkpoint_trailer_v3_t; struct fsrefs_checkpoint_trailer_v3 { /* Unknown * Consists of 8 bytes */ uint8_t unknown2[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown3[ 8 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown4[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown5[ 4 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown6[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown7[ 8 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown8[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown9[ 4 ]; /* Number of offsets * Consists of 4 bytes */ uint8_t number_of_offsets[ 4 ]; }; #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_CHECKPOINT_H ) */ ================================================ FILE: libfsrefs/fsrefs_directory_object.h ================================================ /* * The ReFS directory object definitions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_DIRECTORY_OBJECT_H ) #define _FSREFS_DIRECTORY_OBJECT_H #include #include #if defined( __cplusplus ) extern "C" { #endif typedef struct fsrefs_attribute_non_resident fsrefs_attribute_non_resident_t; struct fsrefs_attribute_non_resident { /* Unknown * Consists of 4 bytes */ uint8_t unknown1[ 4 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown2[ 8 ]; /* Allocated file data size * Consists of 8 bytes */ uint8_t allocated_data_size[ 8 ]; /* File data size * Consists of 8 bytes */ uint8_t data_size[ 8 ]; /* Valid file data size * Consists of 8 bytes */ uint8_t valid_data_size[ 8 ]; /* Unknown * Consists of 60 bytes */ uint8_t unknown3[ 60 ]; }; typedef struct fsrefs_attribute_resident fsrefs_attribute_resident_t; struct fsrefs_attribute_resident { /* Unknown * Consists of 4 bytes */ uint8_t unknown1[ 4 ]; /* Inline data offset * Consists of 4 bytes */ uint8_t inline_data_offset[ 4 ]; /* Inline data size * Consists of 4 bytes */ uint8_t inline_data_size[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown3[ 4 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown4[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown5[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown6[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown7[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown8[ 8 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown9[ 4 ]; }; typedef struct fsrefs_data_run fsrefs_data_run_t; struct fsrefs_data_run { /* Logical offset * Consists of 8 bytes */ uint8_t logical_offset[ 8 ]; /* Size * Consists of 8 bytes */ uint8_t size[ 8 ]; /* Physical offset * Consists of 8 bytes */ uint8_t physical_offset[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown1[ 8 ]; }; typedef struct fsrefs_directory_values fsrefs_directory_values_t; struct fsrefs_directory_values { /* The object identifier * Consists of 8 bytes */ uint8_t object_identifier[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown1[ 8 ]; /* The creation date and time * Consists of 8 bytes * Contains a FILETIME */ uint8_t creation_time[ 8 ]; /* The last modification date and time * Consists of 8 bytes * Contains a FILETIME */ uint8_t modification_time[ 8 ]; /* The entry last modification date and time * Consists of 8 bytes * Contains a FILETIME */ uint8_t entry_modification_time[ 8 ]; /* The last access date and time * Consists of 8 bytes * Contains a FILETIME */ uint8_t access_time[ 8 ]; /* Unknown * Consists of 16 bytes */ uint8_t unknown2[ 16 ]; /* The file attribute flags * Consists of 4 bytes */ uint8_t file_attribute_flags[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown3[ 4 ]; }; typedef struct fsrefs_file_values fsrefs_file_values_t; struct fsrefs_file_values { /* The creation date and time * Consists of 8 bytes * Contains a FILETIME */ uint8_t creation_time[ 8 ]; /* The last modification date and time * Consists of 8 bytes * Contains a FILETIME */ uint8_t modification_time[ 8 ]; /* The entry last modification date and time * Consists of 8 bytes * Contains a FILETIME */ uint8_t entry_modification_time[ 8 ]; /* The last access date and time * Consists of 8 bytes * Contains a FILETIME */ uint8_t access_time[ 8 ]; /* The file attribute flags * Consists of 4 bytes */ uint8_t file_attribute_flags[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown1[ 4 ]; /* File system identifier (lower 64-bit) * Consists of 8 bytes */ uint8_t identifier_lower[ 8 ]; /* File system identifier (upper 64-bit) * Consists of 4 bytes */ uint8_t identifier_upper[ 8 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown4[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown5[ 4 ]; /* File data size * Consists of 8 bytes */ uint8_t data_size[ 8 ]; /* Allocated file data size * Consists of 8 bytes */ uint8_t allocated_data_size[ 8 ]; /* Unknown * Consists of 32 bytes */ uint8_t unknown6[ 32 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown7[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown8[ 8 ]; }; #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_DIRECTORY_OBJECT_H ) */ ================================================ FILE: libfsrefs/fsrefs_metadata_block.h ================================================ /* * The ReFS metadata block definition * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_METADATA_BLOCK_H ) #define _FSREFS_METADATA_BLOCK_H #include #include #if defined( __cplusplus ) extern "C" { #endif typedef struct fsrefs_metadata_block_header_v1 fsrefs_metadata_block_header_v1_t; struct fsrefs_metadata_block_header_v1 { /* The metadata block number * Consists of 8 bytes */ uint8_t block_number[ 8 ]; /* The sequence number * Consists of 8 bytes */ uint8_t sequence_number[ 8 ]; /* The object identifier * Consists of 16 bytes */ uint8_t object_identifier[ 16 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown1[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown2[ 8 ]; }; typedef struct fsrefs_metadata_block_header_v3 fsrefs_metadata_block_header_v3_t; struct fsrefs_metadata_block_header_v3 { /* The signature * Consists of 4 bytes */ uint8_t signature[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown1[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown2[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown3[ 4 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown4[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown5[ 8 ]; /* The first metadata block number * Consists of 8 bytes */ uint8_t block_number1[ 8 ]; /* The second metadata block number * Consists of 8 bytes */ uint8_t block_number2[ 8 ]; /* The third metadata block number * Consists of 8 bytes */ uint8_t block_number3[ 8 ]; /* The fourth metadata block number * Consists of 8 bytes */ uint8_t block_number4[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown6[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown7[ 8 ]; }; typedef struct fsrefs_metadata_block_reference_v1 fsrefs_metadata_block_reference_v1_t; struct fsrefs_metadata_block_reference_v1 { /* The metadata block number * Consists of 8 bytes */ uint8_t block_number[ 8 ]; /* Unknown * Consists of 2 bytes */ uint8_t unknown1[ 2 ]; /* Checksum type * Consists of 1 byte */ uint8_t checksum_type; /* Checksum data offset * Consists of 1 byte */ uint8_t checksum_data_offset; /* Checksum data size * Consists of 2 bytes */ uint8_t checksum_data_size[ 2 ]; /* Unknown * Consists of 2 bytes */ uint8_t unknown2[ 2 ]; }; typedef struct fsrefs_metadata_block_reference_v3 fsrefs_metadata_block_reference_v3_t; struct fsrefs_metadata_block_reference_v3 { /* The first metadata block number * Consists of 8 bytes */ uint8_t block_number1[ 8 ]; /* The second metadata block number * Consists of 8 bytes */ uint8_t block_number2[ 8 ]; /* The third metadata block number * Consists of 8 bytes */ uint8_t block_number3[ 8 ]; /* The fourth metadata block number * Consists of 8 bytes */ uint8_t block_number4[ 8 ]; /* Unknown * Consists of 2 bytes */ uint8_t unknown1[ 2 ]; /* Checksum type * Consists of 1 byte */ uint8_t checksum_type; /* Checksum data offset * Consists of 1 byte */ uint8_t checksum_data_offset; /* Checksum data size * Consists of 2 bytes */ uint8_t checksum_data_size[ 2 ]; /* Unknown * Consists of 2 bytes */ uint8_t unknown2[ 2 ]; }; #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_METADATA_BLOCK_H ) */ ================================================ FILE: libfsrefs/fsrefs_ministore_tree.h ================================================ /* * The ReFS ministore tree definitions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_MINISTORE_TREE_H ) #define _FSREFS_MINISTORE_TREE_H #include #include #if defined( __cplusplus ) extern "C" { #endif typedef struct fsrefs_ministore_tree_header fsrefs_ministore_tree_header_t; struct fsrefs_ministore_tree_header { /* Table data offset * Consists of 2 bytes */ uint8_t table_data_offset[ 2 ]; /* Unknown * Consists of 2 bytes */ uint8_t unknown1[ 2 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown2[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown3[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown4[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown5[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown6[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown7[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown8[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown9[ 4 ]; }; typedef struct fsrefs_ministore_tree_node_header fsrefs_ministore_tree_node_header_t; struct fsrefs_ministore_tree_node_header { /* Data area start offset * Consists of 4 bytes */ uint8_t data_area_start_offset[ 4 ]; /* Data area end offset * Consists of 4 bytes */ uint8_t data_area_end_offset[ 4 ]; /* Unused data size * Consists of 4 bytes */ uint8_t unused_data_size[ 4 ]; /* Node level * Consists of 1 byte */ uint8_t node_level; /* Node type flags * Consists of 1 byte */ uint8_t node_type_flags; /* Unknown * Consists of 2 bytes */ uint8_t unknown1[ 2 ]; /* Record offsets start offset * Consists of 4 bytes */ uint8_t record_offsets_start_offset[ 4 ]; /* Number of record offsets * Consists of 4 bytes */ uint8_t number_of_record_offsets[ 4 ]; /* Record offsets end offset * Consists of 4 bytes */ uint8_t record_offsets_end_offset[ 4 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown2[ 4 ]; }; typedef struct fsrefs_ministore_tree_node_record fsrefs_ministore_tree_node_record_t; struct fsrefs_ministore_tree_node_record { /* Size * Consists of 4 bytes */ uint8_t size[ 4 ]; /* Key data offset * Consists of 2 bytes */ uint8_t key_data_offset[ 2 ]; /* Key data size * Consists of 2 bytes */ uint8_t key_data_size[ 2 ]; /* Flags * Consists of 2 bytes */ uint8_t flags[ 2 ]; /* Value data offset * Consists of 2 bytes */ uint8_t value_data_offset[ 2 ]; /* Value data size * Consists of 2 bytes */ uint8_t value_data_size[ 2 ]; }; #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_MINISTORE_TREE_H ) */ ================================================ FILE: libfsrefs/fsrefs_superblock.h ================================================ /* * The ReFS superblock definition * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_SUPERBLOCK_H ) #define _FSREFS_SUPERBLOCK_H #include #include #if defined( __cplusplus ) extern "C" { #endif typedef struct fsrefs_superblock fsrefs_superblock_t; struct fsrefs_superblock { /* The volume identifier * Consists of 16 bytes */ uint8_t volume_identifier[ 16 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown1[ 8 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown2[ 8 ]; /* Checkpoints data offset * Consists of 4 bytes */ uint8_t checkpoints_data_offset[ 4 ]; /* Number of checkpoints * Consists of 4 bytes */ uint8_t number_of_checkpoints[ 4 ]; /* Self reference data offset * Consists of 4 bytes */ uint8_t self_reference_data_offset[ 4 ]; /* Self reference data size * Consists of 4 bytes */ uint8_t self_reference_data_size[ 4 ]; }; #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_SUPERBLOCK_H ) */ ================================================ FILE: libfsrefs/fsrefs_volume_header.h ================================================ /* * The ReFS volume header definition * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_VOLUME_HEADER_H ) #define _FSREFS_VOLUME_HEADER_H #include #include #if defined( __cplusplus ) extern "C" { #endif typedef struct fsrefs_volume_header fsrefs_volume_header_t; struct fsrefs_volume_header { /* Unknown * Consists of 3 bytes */ uint8_t unknown1[ 3 ]; /* The file system signature * Consists of 4 bytes * Contains: "ReFS" */ uint8_t file_system_signature[ 4 ]; /* Unknown * Consists of 9 bytes */ uint8_t unknown2[ 9 ]; /* Unknown * Consists of 4 bytes * Contains: "FSRS" */ uint8_t unknown3[ 4 ]; /* Unknown * Consists of 2 bytes */ uint8_t unknown4[ 2 ]; /* Checksum * Consists of 2 bytes */ uint8_t checksum[ 2 ]; /* The number of sectors * Consists of 8 bytes */ uint8_t number_of_sectors[ 8 ]; /* The number of bytes per sector * Consists of 4 bytes */ uint8_t bytes_per_sector[ 4 ]; /* The number of sectors per cluster block * Consists of 4 bytes */ uint8_t sectors_per_cluster_block[ 4 ]; /* Major format version * Consists of 1 byte */ uint8_t major_format_version; /* Minor format version * Consists of 1 byte */ uint8_t minor_format_version; /* Unknown * Consists of 2 bytes */ uint8_t unknown7[ 2 ]; /* Unknown * Consists of 4 bytes */ uint8_t unknown8[ 4 ]; /* Unknown * Consists of 8 bytes */ uint8_t unknown9[ 8 ]; /* Volume serial number * Consists of 8 bytes */ uint8_t volume_serial_number[ 8 ]; /* Container size * Consists of 8 bytes */ uint8_t container_size[ 8 ]; /* Unknown * Consists of 440 bytes */ uint8_t unknown11[ 440 ]; }; #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_VOLUME_HEADER_H ) */ ================================================ FILE: libfsrefs/libfsrefs.c ================================================ /* * Library to access the Resiliant File System (ReFS) format * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #if defined( WINAPI ) #include #endif #include "libfsrefs_unused.h" /* Define HAVE_LOCAL_LIBFSREFS for local use of libfsrefs */ #if !defined( HAVE_LOCAL_LIBFSREFS ) #if defined( WINAPI ) && defined( HAVE_DLLMAIN ) #if defined( _MANAGED ) #pragma managed( push, off ) #endif /* Defines the entry point for the DLL */ BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved ) { LIBFSREFS_UNREFERENCED_PARAMETER( lpvReserved ) switch( fdwReason ) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls( hinstDLL ); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return( TRUE ); } /* Function that indicates the library is a DLL * Returns 1 */ int libfsrefs_is_dll( void ) { return( 1 ); } #endif /* defined( WINAPI ) && defined( HAVE_DLLMAIN ) */ #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ ================================================ FILE: libfsrefs/libfsrefs.rc.in ================================================ #include #ifdef GCC_WINDRES VS_VERSION_INFO VERSIONINFO #else VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE #endif FILEVERSION 1,0,0,0 PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS VOS__WINDOWS32 FILETYPE VFT_DLL FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" BEGIN VALUE "FileDescription", "Library to access the Resiliant File System (ReFS) format\0" VALUE "FileVersion", "@VERSION@" "\0" VALUE "InternalName", "libfsrefs.dll\0" VALUE "LegalCopyright", "(C) 2012-2025, Joachim Metz \0" VALUE "OriginalFilename", "libfsrefs.dll\0" VALUE "ProductName", "libfsrefs\0" VALUE "ProductVersion", "@VERSION@" "\0" VALUE "Comments", "For more information visit https://github.com/libyal/libfsrefs/\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x0409, 1200 END END ================================================ FILE: libfsrefs/libfsrefs_attribute_values.c ================================================ /* * Attribute values functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_attribute_values.h" #include "libfsrefs_data_run.h" #include "libfsrefs_debug.h" #include "libfsrefs_libcdata.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_libfdatetime.h" #include "libfsrefs_libuna.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_node_record.h" #include "fsrefs_directory_object.h" /* Creates a attribute values * Make sure the value attribute_values is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_initialize( libfsrefs_attribute_values_t **attribute_values, libcerror_error_t **error ) { static char *function = "libfsrefs_attribute_values_initialize"; if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( *attribute_values != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid attribute values value already set.", function ); return( -1 ); } *attribute_values = memory_allocate_structure( libfsrefs_attribute_values_t ); if( *attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create attribute values.", function ); goto on_error; } if( memory_set( *attribute_values, 0, sizeof( libfsrefs_attribute_values_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear attribute values.", function ); memory_free( *attribute_values ); *attribute_values = NULL; return( -1 ); } if( libcdata_array_initialize( &( ( *attribute_values )->data_runs_array ), 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create data runs array.", function ); goto on_error; } return( 1 ); on_error: if( *attribute_values != NULL ) { memory_free( *attribute_values ); *attribute_values = NULL; } return( -1 ); } /* Frees a attribute values * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_free( libfsrefs_attribute_values_t **attribute_values, libcerror_error_t **error ) { static char *function = "libfsrefs_attribute_values_free"; int result = 1; if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( *attribute_values != NULL ) { if( libcdata_array_free( &( ( *attribute_values )->data_runs_array ), (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_data_run_free, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free data runs array.", function ); result = -1; } if( ( *attribute_values )->name_data != NULL ) { memory_free( ( *attribute_values )->name_data ); } memory_free( *attribute_values ); *attribute_values = NULL; } return( result ); } /* Reads a non-resident attribute values * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_read_non_resident( libfsrefs_attribute_values_t *attribute_values, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { libfsrefs_data_run_t *data_run = NULL; libfsrefs_ministore_node_t *node = NULL; libfsrefs_node_record_t *node_record = NULL; static char *function = "libfsrefs_attribute_values_read_non_resident"; int entry_index = 0; int number_of_records = 0; int record_index = 0; #if defined( HAVE_DEBUG_OUTPUT ) uint64_t value_64bit = 0; uint32_t value_32bit = 0; #endif if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( libfsrefs_ministore_node_initialize( &node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create non-resident attribute ministore node.", function ); goto on_error; } if( libfsrefs_ministore_node_read_data( node, io_handle, data, data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read non-resident attribute ministore node.", function ); goto on_error; } if( ( node->node_type_flags & 0x03 ) != 0x02 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: invalid non-resident attribute ministore node - unsupported node type flags.", function ); goto on_error; } if( node->header_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid non-resident attribute ministore node - missing header data.", function ); return( -1 ); } if( node->header_data_size != sizeof( fsrefs_attribute_non_resident_t ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid non-resident attribute ministore node - header data size value out of bounds.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { byte_stream_copy_to_uint32_little_endian( ( (fsrefs_attribute_non_resident_t *) node->header_data )->unknown1, value_32bit ); libcnotify_printf( "%s: unknown1\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_non_resident_t *) node->header_data )->unknown2, value_64bit ); libcnotify_printf( "%s: unknown2\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_non_resident_t *) node->header_data )->allocated_data_size, value_64bit ); libcnotify_printf( "%s: allocated data size\t: %" PRIu64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_non_resident_t *) node->header_data )->data_size, value_64bit ); libcnotify_printf( "%s: data size\t\t\t: %" PRIu64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_non_resident_t *) node->header_data )->valid_data_size, value_64bit ); libcnotify_printf( "%s: valid data size\t\t: %" PRIu64 "\n", function, value_64bit ); libcnotify_printf( "%s: unknown3:\n", function ); libcnotify_print_data( ( (fsrefs_attribute_non_resident_t *) node->header_data )->unknown3, 60, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( libfsrefs_ministore_node_get_number_of_records( node, &number_of_records, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of records.", function ); goto on_error; } for( record_index = 0; record_index < number_of_records; record_index++ ) { if( libfsrefs_ministore_node_get_record_by_index( node, record_index, &node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve data run: %d record.", function, record_index ); goto on_error; } if( libfsrefs_data_run_initialize( &data_run, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create data run: %d.", function, record_index ); goto on_error; } if( libfsrefs_data_run_read_data( data_run, io_handle, node_record->value_data, node_record->value_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read data run: %d.", function, record_index ); goto on_error; } if( libcdata_array_append_entry( attribute_values->data_runs_array, &entry_index, (intptr_t *) data_run, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, "%s: unable to append data run: %d to array.", function, record_index ); goto on_error; } data_run = NULL; } if( libfsrefs_ministore_node_free( &node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free non-resident attribute ministore node.", function ); goto on_error; } return( 1 ); on_error: if( data_run != NULL ) { libfsrefs_data_run_free( &data_run, NULL ); } if( node != NULL ) { libfsrefs_ministore_node_free( &node, NULL ); } libcdata_array_empty( attribute_values->data_runs_array, (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_data_run_free, NULL ); return( -1 ); } /* Reads a resident attribute values * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_read_resident( libfsrefs_attribute_values_t *attribute_values, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_attribute_values_read_resident"; uint32_t inline_data_offset = 0; uint32_t inline_data_size = 0; #if defined( HAVE_DEBUG_OUTPUT ) size_t data_offset = 0; uint64_t value_64bit = 0; uint32_t value_32bit = 0; #endif if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < sizeof( fsrefs_attribute_resident_t ) ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: resident attribute data:\n", function ); libcnotify_print_data( data, data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif byte_stream_copy_to_uint32_little_endian( ( (fsrefs_attribute_resident_t *) data )->inline_data_offset, inline_data_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_attribute_resident_t *) data )->inline_data_size, inline_data_size ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { byte_stream_copy_to_uint32_little_endian( ( (fsrefs_attribute_resident_t *) data )->unknown1, value_32bit ); libcnotify_printf( "%s: unknown1\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); libcnotify_printf( "%s: inline data offset\t\t: 0x%08" PRIx32 "\n", function, inline_data_offset ); libcnotify_printf( "%s: inline data size\t\t: %" PRIu32 "\n", function, inline_data_size ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_attribute_resident_t *) data )->unknown3, value_32bit ); libcnotify_printf( "%s: unknown3\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_resident_t *) data )->unknown4, value_64bit ); libcnotify_printf( "%s: unknown4\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_resident_t *) data )->unknown5, value_64bit ); libcnotify_printf( "%s: unknown5\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_resident_t *) data )->unknown6, value_64bit ); libcnotify_printf( "%s: unknown6\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_resident_t *) data )->unknown7, value_64bit ); libcnotify_printf( "%s: unknown7\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_attribute_resident_t *) data )->unknown8, value_64bit ); libcnotify_printf( "%s: unknown8\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_attribute_resident_t *) data )->unknown9, value_32bit ); libcnotify_printf( "%s: unknown9\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( ( inline_data_offset < sizeof( fsrefs_attribute_resident_t ) ) || ( inline_data_offset >= data_size ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid inline data offset value out of bounds.", function ); return( -1 ); } if( inline_data_size > ( data_size - inline_data_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid inline data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: inline data:\n", function ); libcnotify_print_data( &( data[ inline_data_offset ] ), inline_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); data_offset = inline_data_offset + inline_data_size; if( data_offset < data_size ) { libcnotify_printf( "%s: trailing data:\n", function ); libcnotify_print_data( &( data[ data_offset ] ), data_size - data_offset, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ return( 1 ); } /* Reads the attribute values from a ministore node record * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_read_node_record( libfsrefs_attribute_values_t *attribute_values, libfsrefs_io_handle_t *io_handle, libfsrefs_node_record_t *node_record, libcerror_error_t **error ) { static char *function = "libfsrefs_attribute_values_read_node_record"; size_t name_data_size = 0; #if defined( HAVE_DEBUG_OUTPUT ) uint64_t value_64bit = 0; #endif if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( attribute_values->name_data != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid attribute values - namd data value already set.", function ); return( -1 ); } if( node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid node record.", function ); return( -1 ); } if( node_record->key_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid node record - missing key data.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: key data:\n", function ); libcnotify_print_data( node_record->key_data, node_record->key_data_size, 0 ); } #endif if( node_record->key_data_size < 14 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid node record - key data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: key data:\n", function ); libcnotify_print_data( node_record->key_data, node_record->key_data_size, 0 ); } #endif byte_stream_copy_to_uint32_little_endian( &( node_record->key_data[ 8 ] ), attribute_values->attribute_type ); name_data_size = node_record->key_data_size - 12; attribute_values->name_data = (uint8_t *) memory_allocate( sizeof( uint8_t ) * name_data_size ); if( attribute_values->name_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create name data.", function ); goto on_error; } attribute_values->name_data_size = name_data_size; if( memory_copy( attribute_values->name_data, &( node_record->key_data[ 12 ] ), attribute_values->name_data_size ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to copy name data.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { byte_stream_copy_to_uint64_little_endian( &( node_record->key_data[ 0 ] ), value_64bit ); libcnotify_printf( "%s: unknown1\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); libcnotify_printf( "%s: attribute type\t\t: 0x%08" PRIx32 "\n", function, attribute_values->attribute_type ); if( libfsrefs_debug_print_utf16_string_value( function, "name\t\t\t", attribute_values->name_data, attribute_values->name_data_size, LIBUNA_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print UTF-16 string value.", function ); goto on_error; } libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( ( node_record->flags & 0x0008 ) != 0 ) { if( libfsrefs_attribute_values_read_non_resident( attribute_values, io_handle, node_record->value_data, node_record->value_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read non-resident attribute values.", function ); goto on_error; } } else { if( libfsrefs_attribute_values_read_resident( attribute_values, node_record->value_data, node_record->value_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read resident attribute values.", function ); goto on_error; } } return( 1 ); on_error: if( attribute_values->name_data != NULL ) { memory_free( attribute_values->name_data ); attribute_values->name_data = NULL; } attribute_values->name_data_size = 0; libcdata_array_empty( attribute_values->data_runs_array, (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_data_run_free, NULL ); return( -1 ); } /* Retrieves the size of the UTF-8 encoded name * The returned size includes the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_get_utf8_name_size( libfsrefs_attribute_values_t *attribute_values, size_t *utf8_string_size, libcerror_error_t **error ) { static char *function = "libfsrefs_attribute_values_get_utf8_name_size"; if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( libuna_utf8_string_size_from_utf16_stream( attribute_values->name_data, attribute_values->name_data_size, LIBUNA_ENDIAN_LITTLE, utf8_string_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size of UTF-8 name.", function ); return( -1 ); } return( 1 ); } /* Retrieves the UTF-8 encoded name * The size should include the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_get_utf8_name( libfsrefs_attribute_values_t *attribute_values, uint8_t *utf8_string, size_t utf8_string_size, libcerror_error_t **error ) { static char *function = "libfsrefs_attribute_values_get_utf8_name"; if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( libuna_utf8_string_copy_from_utf16_stream( utf8_string, utf8_string_size, attribute_values->name_data, attribute_values->name_data_size, LIBUNA_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve UTF-8 name.", function ); return( -1 ); } return( 1 ); } /* Retrieves the size of the UTF-16 encoded name * The returned size includes the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_get_utf16_name_size( libfsrefs_attribute_values_t *attribute_values, size_t *utf16_string_size, libcerror_error_t **error ) { static char *function = "libfsrefs_attribute_values_get_utf16_name_size"; if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( libuna_utf16_string_size_from_utf16_stream( attribute_values->name_data, attribute_values->name_data_size, LIBUNA_ENDIAN_LITTLE, utf16_string_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size of UTF-16 name.", function ); return( -1 ); } return( 1 ); } /* Retrieves the UTF-16 encoded name * The size should include the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_attribute_values_get_utf16_name( libfsrefs_attribute_values_t *attribute_values, uint16_t *utf16_string, size_t utf16_string_size, libcerror_error_t **error ) { static char *function = "libfsrefs_attribute_values_get_utf16_name"; if( attribute_values == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid attribute values.", function ); return( -1 ); } if( libuna_utf16_string_copy_from_utf16_stream( utf16_string, utf16_string_size, attribute_values->name_data, attribute_values->name_data_size, LIBUNA_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve UTF-16 name.", function ); return( -1 ); } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_attribute_values.h ================================================ /* * Attribute values functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_ATTRIBUTE_VALUES_H ) #define _LIBFSREFS_ATTRIBUTE_VALUES_H #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libcdata.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_node_record.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_attribute_values libfsrefs_attribute_values_t; struct libfsrefs_attribute_values { /* The attribute type */ uint32_t attribute_type; /* The name data */ uint8_t *name_data; /* The name data size */ size_t name_data_size; /* The data runs array */ libcdata_array_t *data_runs_array; }; int libfsrefs_attribute_values_initialize( libfsrefs_attribute_values_t **attribute_values, libcerror_error_t **error ); int libfsrefs_attribute_values_free( libfsrefs_attribute_values_t **attribute_values, libcerror_error_t **error ); int libfsrefs_attribute_values_read_non_resident( libfsrefs_attribute_values_t *attribute_values, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_attribute_values_read_resident( libfsrefs_attribute_values_t *attribute_values, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_attribute_values_read_node_record( libfsrefs_attribute_values_t *attribute_values, libfsrefs_io_handle_t *io_handle, libfsrefs_node_record_t *node_record, libcerror_error_t **error ); int libfsrefs_attribute_values_get_utf8_name_size( libfsrefs_attribute_values_t *attribute_values, size_t *utf8_string_size, libcerror_error_t **error ); int libfsrefs_attribute_values_get_utf8_name( libfsrefs_attribute_values_t *attribute_values, uint8_t *utf8_string, size_t utf8_string_size, libcerror_error_t **error ); int libfsrefs_attribute_values_get_utf16_name_size( libfsrefs_attribute_values_t *attribute_values, size_t *utf16_string_size, libcerror_error_t **error ); int libfsrefs_attribute_values_get_utf16_name( libfsrefs_attribute_values_t *attribute_values, uint16_t *utf16_string, size_t utf16_string_size, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_ATTRIBUTE_VALUES_H ) */ ================================================ FILE: libfsrefs/libfsrefs_block_descriptor.c ================================================ /* * Block descriptor functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include "libfsrefs_block_descriptor.h" #include "libfsrefs_libcerror.h" /* Creates a block descriptor * Make sure the value block_descriptor is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_block_descriptor_initialize( libfsrefs_block_descriptor_t **block_descriptor, libcerror_error_t **error ) { static char *function = "libfsrefs_block_descriptor_initialize"; if( block_descriptor == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block descriptor.", function ); return( -1 ); } if( *block_descriptor != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid block descriptor value already set.", function ); return( -1 ); } *block_descriptor = memory_allocate_structure( libfsrefs_block_descriptor_t ); if( *block_descriptor == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create block descriptor.", function ); goto on_error; } if( memory_set( *block_descriptor, 0, sizeof( libfsrefs_block_descriptor_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear block descriptor.", function ); goto on_error; } return( 1 ); on_error: if( *block_descriptor != NULL ) { memory_free( *block_descriptor ); *block_descriptor = NULL; } return( -1 ); } /* Frees a block descriptor * Returns 1 if successful or -1 on error */ int libfsrefs_block_descriptor_free( libfsrefs_block_descriptor_t **block_descriptor, libcerror_error_t **error ) { static char *function = "libfsrefs_block_descriptor_free"; if( block_descriptor == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block descriptor.", function ); return( -1 ); } if( *block_descriptor != NULL ) { memory_free( *block_descriptor ); *block_descriptor = NULL; } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_block_descriptor.h ================================================ /* * Block descriptor functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_BLOCK_DESCRIPTOR_H ) #define _LIBFSREFS_BLOCK_DESCRIPTOR_H #include #include #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_block_descriptor libfsrefs_block_descriptor_t; struct libfsrefs_block_descriptor { /* The block number */ uint64_t block_number; }; int libfsrefs_block_descriptor_initialize( libfsrefs_block_descriptor_t **block_descriptor, libcerror_error_t **error ); int libfsrefs_block_descriptor_free( libfsrefs_block_descriptor_t **block_descriptor, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_BLOCK_DESCRIPTOR_H ) */ ================================================ FILE: libfsrefs/libfsrefs_block_reference.c ================================================ /* * Block reference functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "fsrefs_metadata_block.h" /* Creates a block reference * Make sure the value block_reference is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_block_reference_initialize( libfsrefs_block_reference_t **block_reference, libcerror_error_t **error ) { static char *function = "libfsrefs_block_reference_initialize"; if( block_reference == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block reference.", function ); return( -1 ); } if( *block_reference != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid block reference value already set.", function ); return( -1 ); } *block_reference = memory_allocate_structure( libfsrefs_block_reference_t ); if( *block_reference == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create block reference.", function ); goto on_error; } if( memory_set( *block_reference, 0, sizeof( libfsrefs_block_reference_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear block reference.", function ); goto on_error; } return( 1 ); on_error: if( *block_reference != NULL ) { memory_free( *block_reference ); *block_reference = NULL; } return( -1 ); } /* Frees a block reference * Returns 1 if successful or -1 on error */ int libfsrefs_block_reference_free( libfsrefs_block_reference_t **block_reference, libcerror_error_t **error ) { static char *function = "libfsrefs_block_reference_free"; if( block_reference == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block reference.", function ); return( -1 ); } if( *block_reference != NULL ) { memory_free( *block_reference ); *block_reference = NULL; } return( 1 ); } /* Reads a block reference * Returns 1 if successful or -1 on error */ int libfsrefs_block_reference_read_data( libfsrefs_block_reference_t *block_reference, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_block_reference_read_data"; size_t block_reference_size = 0; uint16_t checksum_data_size = 0; uint8_t checksum_data_offset = 0; uint8_t checksum_type = 0; #if defined( HAVE_DEBUG_OUTPUT ) size_t data_offset = 0; uint16_t value_16bit = 0; #endif if( block_reference == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block reference.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( io_handle->major_format_version == 1 ) { block_reference_size = sizeof( fsrefs_metadata_block_reference_v1_t ); } else if( io_handle->major_format_version == 3 ) { block_reference_size = sizeof( fsrefs_metadata_block_reference_v3_t ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < block_reference_size ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: block reference data:\n", function ); libcnotify_print_data( data, block_reference_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif if( io_handle->major_format_version == 1 ) { byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_reference_v1_t *) data )->block_number, block_reference->block_numbers[ 0 ] ); checksum_type = ( (fsrefs_metadata_block_reference_v1_t *) data )->checksum_type; checksum_data_offset = ( (fsrefs_metadata_block_reference_v1_t *) data )->checksum_data_offset; byte_stream_copy_to_uint16_little_endian( ( (fsrefs_metadata_block_reference_v1_t *) data )->checksum_data_size, checksum_data_size ); } else if( io_handle->major_format_version == 3 ) { byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_reference_v3_t *) data )->block_number1, block_reference->block_numbers[ 0 ] ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_reference_v3_t *) data )->block_number2, block_reference->block_numbers[ 1 ] ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_reference_v3_t *) data )->block_number3, block_reference->block_numbers[ 2 ] ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_reference_v3_t *) data )->block_number4, block_reference->block_numbers[ 3 ] ); checksum_type = ( (fsrefs_metadata_block_reference_v3_t *) data )->checksum_type; checksum_data_offset = ( (fsrefs_metadata_block_reference_v3_t *) data )->checksum_data_offset; byte_stream_copy_to_uint16_little_endian( ( (fsrefs_metadata_block_reference_v3_t *) data )->checksum_data_size, checksum_data_size ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( io_handle->major_format_version == 1 ) { libcnotify_printf( "%s: block number\t\t\t: %" PRIu64 "\n", function, block_reference->block_numbers[ 0 ] ); } else if( io_handle->major_format_version == 3 ) { libcnotify_printf( "%s: block number1\t\t\t: %" PRIu64 "\n", function, block_reference->block_numbers[ 0 ] ); libcnotify_printf( "%s: block number2\t\t\t: %" PRIu64 "\n", function, block_reference->block_numbers[ 1 ] ); libcnotify_printf( "%s: block number3\t\t\t: %" PRIu64 "\n", function, block_reference->block_numbers[ 2 ] ); libcnotify_printf( "%s: block number4\t\t\t: %" PRIu64 "\n", function, block_reference->block_numbers[ 3 ] ); } if( io_handle->major_format_version == 1 ) { byte_stream_copy_to_uint16_little_endian( ( (fsrefs_metadata_block_reference_v1_t *) data )->unknown1, value_16bit ); } else if( io_handle->major_format_version == 3 ) { byte_stream_copy_to_uint16_little_endian( ( (fsrefs_metadata_block_reference_v3_t *) data )->unknown1, value_16bit ); } libcnotify_printf( "%s: unknown1\t\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); libcnotify_printf( "%s: checksum type\t\t\t: %" PRIu8 "\n", function, checksum_type ); libcnotify_printf( "%s: checksum data offset\t\t: %" PRIu8 "\n", function, checksum_data_offset ); libcnotify_printf( "%s: checksum data size\t\t\t: %" PRIu16 "\n", function, checksum_data_size ); if( io_handle->major_format_version == 1 ) { byte_stream_copy_to_uint16_little_endian( ( (fsrefs_metadata_block_reference_v1_t *) data )->unknown2, value_16bit ); } else if( io_handle->major_format_version == 3 ) { byte_stream_copy_to_uint16_little_endian( ( (fsrefs_metadata_block_reference_v3_t *) data )->unknown2, value_16bit ); } libcnotify_printf( "%s: unknown2\t\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( ( checksum_type != 1 ) && ( checksum_type != 2 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported checksum type: %" PRIu8 ".", function, checksum_type ); return( -1 ); } /* TODO validate checksum data offset */ /* TODO validate checksum data size */ #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( io_handle->major_format_version == 1 ) { data_offset = 8 + checksum_data_offset; } else if( io_handle->major_format_version == 3 ) { data_offset = 32 + checksum_data_offset; } libcnotify_printf( "%s: checksum data:\n", function ); libcnotify_print_data( &( data[ data_offset ] ), checksum_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); /* TODO data_offset += checksum_data_size; if( data_offset < data_size ) { libcnotify_printf( "%s: trailing data:\n", function ); libcnotify_print_data( &( data[ data_offset ] ), data_size - data_offset, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } */ } #endif return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_block_reference.h ================================================ /* * Block reference functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_BLOCK_REFRENCE_H ) #define _LIBFSREFS_BLOCK_REFRENCE_H #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_block_reference libfsrefs_block_reference_t; struct libfsrefs_block_reference { /* The block numbers */ uint64_t block_numbers[ 4 ]; /* The checksum */ uint64_t checksum; /* The block offsets */ off64_t block_offsets[ 4 ]; }; int libfsrefs_block_reference_initialize( libfsrefs_block_reference_t **block_reference, libcerror_error_t **error ); int libfsrefs_block_reference_free( libfsrefs_block_reference_t **block_reference, libcerror_error_t **error ); int libfsrefs_block_reference_read_data( libfsrefs_block_reference_t *block_reference, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_BLOCK_REFRENCE_H ) */ ================================================ FILE: libfsrefs/libfsrefs_block_tree.c ================================================ /* * Block tree functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include "libfsrefs_block_descriptor.h" #include "libfsrefs_block_tree.h" #include "libfsrefs_block_tree_node.h" #include "libfsrefs_definitions.h" #include "libfsrefs_libcdata.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_unused.h" /* Creates a block tree * Make sure the value block_tree is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_block_tree_initialize( libfsrefs_block_tree_t **block_tree, size64_t size, size64_t leaf_value_size, libcerror_error_t **error ) { static char *function = "libfsrefs_block_tree_initialize"; if( block_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree.", function ); return( -1 ); } if( *block_tree != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid block tree value already set.", function ); return( -1 ); } *block_tree = memory_allocate_structure( libfsrefs_block_tree_t ); if( *block_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create block tree.", function ); goto on_error; } if( memory_set( *block_tree, 0, sizeof( libfsrefs_block_tree_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear block tree.", function ); memory_free( *block_tree ); *block_tree = NULL; return( -1 ); } if( libfsrefs_block_tree_node_initialize( &( ( *block_tree )->root_node ), 0, size, leaf_value_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create root node.", function ); goto on_error; } ( *block_tree )->leaf_value_size = leaf_value_size; return( 1 ); on_error: if( *block_tree != NULL ) { memory_free( *block_tree ); *block_tree = NULL; } return( -1 ); } /* Frees a block tree * Returns 1 if successful or -1 on error */ int libfsrefs_block_tree_free( libfsrefs_block_tree_t **block_tree, int (*value_free_function)( intptr_t **value, libcerror_error_t **error ), libcerror_error_t **error ) { static char *function = "libfsrefs_block_tree_free"; int result = 1; if( block_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree.", function ); return( -1 ); } if( *block_tree != NULL ) { if( ( *block_tree )->root_node != NULL ) { if( libfsrefs_block_tree_node_free( &( ( *block_tree )->root_node ), value_free_function, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free root node.", function ); result = -1; } } memory_free( *block_tree ); *block_tree = NULL; } return( result ); } /* Retrieves the block descriptor for a specific offset * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_block_tree_get_block_descriptor_by_offset( libfsrefs_block_tree_t *block_tree, off64_t offset, libfsrefs_block_descriptor_t **block_descriptor, off64_t *block_offset, libcerror_error_t **error ) { libfsrefs_block_descriptor_t *safe_block_descriptor = NULL; libfsrefs_block_tree_node_t *block_tree_node = NULL; static char *function = "libfsrefs_block_tree_get_block_descriptor_by_offset"; off64_t safe_block_offset = 0; if( block_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree.", function ); return( -1 ); } if( block_descriptor == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block descriptor.", function ); return( -1 ); } if( block_offset == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block offset.", function ); return( -1 ); } block_tree_node = block_tree->root_node; while( block_tree_node->is_leaf_node == 0 ) { if( libfsrefs_block_tree_node_get_sub_node_at_offset( block_tree_node, offset, &block_tree_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve sub node at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, offset, offset ); return( -1 ); } if( block_tree_node == NULL ) { return( 0 ); } } if( libfsrefs_block_tree_node_get_leaf_value_at_offset( block_tree_node, offset, &safe_block_descriptor, &safe_block_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve leaf value at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, offset, offset ); return( -1 ); } *block_descriptor = safe_block_descriptor; *block_offset = safe_block_offset; if( safe_block_descriptor == NULL ) { return( 0 ); } return( 1 ); } /* Inserts the block descriptor for a specific offset * Returns 1 if successful, 0 if already set or -1 on error */ int libfsrefs_block_tree_insert_block_descriptor_by_offset( libfsrefs_block_tree_t *block_tree, off64_t offset, libfsrefs_block_descriptor_t *block_descriptor, int *leaf_value_index, libfsrefs_block_tree_node_t **leaf_block_tree_node, libfsrefs_block_descriptor_t **existing_block_descriptor, libcerror_error_t **error ) { libfsrefs_block_descriptor_t *safe_block_descriptor = NULL; libfsrefs_block_tree_node_t *block_tree_node = NULL; libfsrefs_block_tree_node_t *safe_block_tree_node = NULL; libfsrefs_block_tree_node_t *sub_block_tree_node = NULL; static char *function = "libfsrefs_block_tree_insert_block_descriptor_by_offset"; off64_t block_offset = 0; off64_t sub_node_index = 0; off64_t sub_node_offset = 0; if( block_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree.", function ); return( -1 ); } if( leaf_value_index == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid leaf value index.", function ); return( -1 ); } if( leaf_block_tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid leaf block tree node.", function ); return( -1 ); } if( existing_block_descriptor == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid existing block descriptor.", function ); return( -1 ); } safe_block_tree_node = block_tree->root_node; while( safe_block_tree_node->is_leaf_node == 0 ) { if( libfsrefs_block_tree_node_get_sub_node_at_offset( safe_block_tree_node, offset, &block_tree_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve sub node at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, offset, offset ); goto on_error; } if( block_tree_node == NULL ) { sub_node_offset = offset - safe_block_tree_node->start_offset; sub_node_index = sub_node_offset / safe_block_tree_node->sub_node_size; sub_node_offset = safe_block_tree_node->start_offset + ( sub_node_index * safe_block_tree_node->sub_node_size ); if( libfsrefs_block_tree_node_initialize( &sub_block_tree_node, sub_node_offset, safe_block_tree_node->sub_node_size, block_tree->leaf_value_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create sub node.", function ); goto on_error; } if( libfsrefs_block_tree_node_set_sub_node_at_offset( safe_block_tree_node, offset, sub_block_tree_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to set sub node at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, offset, offset ); goto on_error; } block_tree_node = sub_block_tree_node; sub_block_tree_node = NULL; } safe_block_tree_node = block_tree_node; } *leaf_block_tree_node = safe_block_tree_node; if( libfsrefs_block_tree_node_get_leaf_value_at_offset( safe_block_tree_node, offset, &safe_block_descriptor, &block_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve leaf value at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, offset, offset ); goto on_error; } if( safe_block_descriptor != NULL ) { *existing_block_descriptor = safe_block_descriptor; return( 0 ); } if( libfsrefs_block_tree_node_set_leaf_value_at_offset( safe_block_tree_node, offset, block_descriptor, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set leaf value at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, offset, offset ); goto on_error; } *leaf_value_index = (int) ( offset / block_tree->leaf_value_size ); return( 1 ); on_error: if( sub_block_tree_node != NULL ) { libfsrefs_block_tree_node_free( &sub_block_tree_node, NULL, NULL ); } return( -1 ); } ================================================ FILE: libfsrefs/libfsrefs_block_tree.h ================================================ /* * Block tree functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_BLOCK_TREE_H ) #define _LIBFSREFS_BLOCK_TREE_H #include #include #include "libfsrefs_block_descriptor.h" #include "libfsrefs_block_tree_node.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_block_tree libfsrefs_block_tree_t; struct libfsrefs_block_tree { /* The block tree root node */ libfsrefs_block_tree_node_t *root_node; /* The leaf value size */ size64_t leaf_value_size; }; int libfsrefs_block_tree_initialize( libfsrefs_block_tree_t **block_tree, size64_t size, size64_t leaf_value_size, libcerror_error_t **error ); int libfsrefs_block_tree_free( libfsrefs_block_tree_t **block_tree, int (*value_free_function)( intptr_t **value, libcerror_error_t **error ), libcerror_error_t **error ); int libfsrefs_block_tree_get_block_descriptor_by_offset( libfsrefs_block_tree_t *block_tree, off64_t offset, libfsrefs_block_descriptor_t **block_descriptor, off64_t *block_offset, libcerror_error_t **error ); int libfsrefs_block_tree_insert_block_descriptor_by_offset( libfsrefs_block_tree_t *block_tree, off64_t offset, libfsrefs_block_descriptor_t *block_descriptor, int *leaf_value_index, libfsrefs_block_tree_node_t **leaf_block_tree_node, libfsrefs_block_descriptor_t **existing_block_descriptor, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_BLOCK_TREE_H ) */ ================================================ FILE: libfsrefs/libfsrefs_block_tree_node.c ================================================ /* * Block tree node functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include "libfsrefs_block_tree_node.h" #include "libfsrefs_definitions.h" #include "libfsrefs_libcerror.h" /* Creates a block tree node * Make sure the value block_tree_node is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_block_tree_node_initialize( libfsrefs_block_tree_node_t **block_tree_node, off64_t offset, size64_t size, size64_t leaf_value_size, libcerror_error_t **error ) { static char *function = "libfsrefs_block_tree_node_initialize"; size64_t sub_node_size = 0; if( block_tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node.", function ); return( -1 ); } if( *block_tree_node != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid block tree node value already set.", function ); return( -1 ); } if( offset < 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid offset value out of bounds.", function ); return( -1 ); } if( ( size == 0 ) || ( size > (size64_t) ( INT64_MAX - offset ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid size value out of bounds.", function ); return( -1 ); } if( leaf_value_size == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid leaf value size value out of bounds.", function ); return( -1 ); } *block_tree_node = memory_allocate_structure( libfsrefs_block_tree_node_t ); if( *block_tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create block tree node.", function ); goto on_error; } if( memory_set( *block_tree_node, 0, sizeof( libfsrefs_block_tree_node_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear block tree node.", function ); memory_free( *block_tree_node ); *block_tree_node = NULL; return( -1 ); } if( libcdata_array_initialize( &( ( *block_tree_node )->sub_nodes_array ), LIBFSREFS_BLOCK_TREE_NUMBER_OF_SUB_NODES, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create sub nodes array.", function ); goto on_error; } sub_node_size = leaf_value_size; while( ( size / sub_node_size ) > LIBFSREFS_BLOCK_TREE_NUMBER_OF_SUB_NODES ) { sub_node_size *= LIBFSREFS_BLOCK_TREE_NUMBER_OF_SUB_NODES; } ( *block_tree_node )->start_offset = offset; ( *block_tree_node )->end_offset = offset + size; ( *block_tree_node )->size = size; ( *block_tree_node )->sub_node_size = sub_node_size; if( sub_node_size == leaf_value_size ) { ( *block_tree_node )->is_leaf_node = 1; } return( 1 ); on_error: if( *block_tree_node != NULL ) { memory_free( *block_tree_node ); *block_tree_node = NULL; } return( -1 ); } /* Frees a block tree node * Returns 1 if successful or -1 on error */ int libfsrefs_block_tree_node_free( libfsrefs_block_tree_node_t **block_tree_node, int (*value_free_function)( intptr_t **value, libcerror_error_t **error ), libcerror_error_t **error ) { libfsrefs_block_tree_node_t *sub_block_tree_node = NULL; static char *function = "libfsrefs_block_tree_node_free"; int result = 1; int sub_node_index = 0; if( block_tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node.", function ); return( -1 ); } if( *block_tree_node != NULL ) { if( ( *block_tree_node )->is_leaf_node != 0 ) { if( libcdata_array_free( &( ( *block_tree_node )->sub_nodes_array ), value_free_function, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free sub nodes array.", function ); result = -1; } } else { for( sub_node_index = 0; sub_node_index < LIBFSREFS_BLOCK_TREE_NUMBER_OF_SUB_NODES; sub_node_index++ ) { if( libcdata_array_get_entry_by_index( ( *block_tree_node )->sub_nodes_array, sub_node_index, (intptr_t **) &sub_block_tree_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve sub node: %d.", function, sub_node_index ); result = -1; } if( libfsrefs_block_tree_node_free( &sub_block_tree_node, value_free_function, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free sub node: %d.", function, sub_node_index ); result = -1; } } if( libcdata_array_free( &( ( *block_tree_node )->sub_nodes_array ), NULL, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free sub nodes array.", function ); result = -1; } } memory_free( *block_tree_node ); *block_tree_node = NULL; } return( result ); } /* Retrieves the sub node for a specific offset * Returns 1 if successful or -1 on error */ int libfsrefs_block_tree_node_get_sub_node_at_offset( libfsrefs_block_tree_node_t *block_tree_node, off64_t offset, libfsrefs_block_tree_node_t **sub_block_tree_node, libcerror_error_t **error ) { static char *function = "libfsrefs_block_tree_node_get_sub_node_at_offset"; off64_t sub_node_index = 0; if( block_tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node.", function ); return( -1 ); } if( block_tree_node->is_leaf_node != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node - not a branch node.", function ); return( -1 ); } if( ( offset < block_tree_node->start_offset ) || ( offset >= block_tree_node->end_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid offset value out of bounds.", function ); return( -1 ); } sub_node_index = ( offset - block_tree_node->start_offset ) / block_tree_node->sub_node_size; if( ( sub_node_index < 0 ) || ( sub_node_index > (off64_t) INT_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid sub node index value out of bounds.", function ); return( -1 ); } if( libcdata_array_get_entry_by_index( block_tree_node->sub_nodes_array, (int) sub_node_index, (intptr_t **) sub_block_tree_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve sub node: %" PRIi64 ".", function, sub_node_index ); return( -1 ); } return( 1 ); } /* Sets the sub node for a specific offset * Returns 1 if successful or -1 on error */ int libfsrefs_block_tree_node_set_sub_node_at_offset( libfsrefs_block_tree_node_t *block_tree_node, off64_t offset, libfsrefs_block_tree_node_t *sub_block_tree_node, libcerror_error_t **error ) { static char *function = "libfsrefs_block_tree_node_set_sub_node_at_offset"; off64_t sub_node_index = 0; if( block_tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node.", function ); return( -1 ); } if( block_tree_node->is_leaf_node != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node - not a branch node.", function ); return( -1 ); } if( ( offset < block_tree_node->start_offset ) || ( offset >= block_tree_node->end_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid offset value out of bounds.", function ); return( -1 ); } sub_node_index = ( offset - block_tree_node->start_offset ) / block_tree_node->sub_node_size; if( ( sub_node_index < 0 ) || ( sub_node_index > (off64_t) INT_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid sub node index value out of bounds.", function ); return( -1 ); } if( libcdata_array_set_entry_by_index( block_tree_node->sub_nodes_array, (int) sub_node_index, (intptr_t *) sub_block_tree_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set sub node: %" PRIi64 ".", function, sub_node_index ); return( -1 ); } return( 1 ); } /* Retrieves the leaf value for a specific offset * Returns 1 if successful or -1 on error */ int libfsrefs_block_tree_node_get_leaf_value_at_offset( libfsrefs_block_tree_node_t *block_tree_node, off64_t offset, libfsrefs_block_descriptor_t **block_descriptor, off64_t *block_offset, libcerror_error_t **error ) { static char *function = "libfsrefs_block_tree_node_get_leaf_value_at_offset"; off64_t leaf_value_index = 0; off64_t safe_block_offset = 0; if( block_tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node.", function ); return( -1 ); } if( block_tree_node->is_leaf_node == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node - not a leaf node.", function ); return( -1 ); } if( ( offset < block_tree_node->start_offset ) || ( offset >= block_tree_node->end_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid offset value out of bounds.", function ); return( -1 ); } if( block_offset == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block offset.", function ); return( -1 ); } safe_block_offset = offset - block_tree_node->start_offset; leaf_value_index = safe_block_offset / block_tree_node->sub_node_size; if( ( leaf_value_index < 0 ) || ( leaf_value_index > (off64_t) INT_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid leaf value index value out of bounds.", function ); return( -1 ); } if( libcdata_array_get_entry_by_index( block_tree_node->sub_nodes_array, (int) leaf_value_index, (intptr_t **) block_descriptor, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve leaf value: %" PRIi64 ".", function, leaf_value_index ); return( -1 ); } *block_offset = safe_block_offset - ( leaf_value_index * block_tree_node->sub_node_size ); return( 1 ); } /* Sets the leaf value for a specific offset * Returns 1 if successful or -1 on error */ int libfsrefs_block_tree_node_set_leaf_value_at_offset( libfsrefs_block_tree_node_t *block_tree_node, off64_t offset, libfsrefs_block_descriptor_t *block_descriptor, libcerror_error_t **error ) { static char *function = "libfsrefs_block_tree_node_set_leaf_value_at_offset"; off64_t leaf_value_index = 0; if( block_tree_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node.", function ); return( -1 ); } if( block_tree_node->is_leaf_node == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block tree node - not a leaf node.", function ); return( -1 ); } if( ( offset < block_tree_node->start_offset ) || ( offset >= block_tree_node->end_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid offset value out of bounds.", function ); return( -1 ); } leaf_value_index = ( offset - block_tree_node->start_offset ) / block_tree_node->sub_node_size; if( ( leaf_value_index < 0 ) || ( leaf_value_index > (off64_t) INT_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid leaf value index value out of bounds.", function ); return( -1 ); } if( libcdata_array_set_entry_by_index( block_tree_node->sub_nodes_array, (int) leaf_value_index, (intptr_t *) block_descriptor, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set leaf value: %" PRIi64 ".", function, leaf_value_index ); return( -1 ); } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_block_tree_node.h ================================================ /* * Block tree node functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_BLOCK_TREE_NODE_H ) #define _LIBFSREFS_BLOCK_TREE_NODE_H #include #include #include "libfsrefs_block_descriptor.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcdata.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_block_tree_node libfsrefs_block_tree_node_t; struct libfsrefs_block_tree_node { /* The (range) start offset */ off64_t start_offset; /* The (range) end offset */ off64_t end_offset; /* The (range) size */ off64_t size; /* The sub node size */ size64_t sub_node_size; /* Sub branch or leaf nodes array */ libcdata_array_t *sub_nodes_array; /* Value to indicate the node is a leaf node */ uint8_t is_leaf_node; }; int libfsrefs_block_tree_node_initialize( libfsrefs_block_tree_node_t **block_tree_node, off64_t offset, size64_t size, size64_t leaf_value_size, libcerror_error_t **error ); int libfsrefs_block_tree_node_free( libfsrefs_block_tree_node_t **block_tree_node, int (*value_free_function)( intptr_t **value, libcerror_error_t **error ), libcerror_error_t **error ); int libfsrefs_block_tree_node_get_sub_node_at_offset( libfsrefs_block_tree_node_t *block_tree_node, off64_t offset, libfsrefs_block_tree_node_t **sub_block_tree_node, libcerror_error_t **error ); int libfsrefs_block_tree_node_set_sub_node_at_offset( libfsrefs_block_tree_node_t *block_tree_node, off64_t offset, libfsrefs_block_tree_node_t *sub_block_tree_node, libcerror_error_t **error ); int libfsrefs_block_tree_node_get_leaf_value_at_offset( libfsrefs_block_tree_node_t *block_tree_node, off64_t offset, libfsrefs_block_descriptor_t **block_descriptor, off64_t *block_offset, libcerror_error_t **error ); int libfsrefs_block_tree_node_set_leaf_value_at_offset( libfsrefs_block_tree_node_t *block_tree_node, off64_t offset, libfsrefs_block_descriptor_t *block_descriptor, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_BLOCK_TREE_NODE_H ) */ ================================================ FILE: libfsrefs/libfsrefs_checkpoint.c ================================================ /* * Checkpoint (or level 1 metadata) functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_checkpoint.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcdata.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_metadata_block_header.h" #include "fsrefs_checkpoint.h" #include "fsrefs_metadata_block.h" /* Creates a checkpoint * Make sure the value checkpoint is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_checkpoint_initialize( libfsrefs_checkpoint_t **checkpoint, libcerror_error_t **error ) { static char *function = "libfsrefs_checkpoint_initialize"; if( checkpoint == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid checkpoint.", function ); return( -1 ); } if( *checkpoint != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid checkpoint value already set.", function ); return( -1 ); } *checkpoint = memory_allocate_structure( libfsrefs_checkpoint_t ); if( *checkpoint == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create checkpoint.", function ); goto on_error; } if( memory_set( *checkpoint, 0, sizeof( libfsrefs_checkpoint_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear checkpoint.", function ); memory_free( *checkpoint ); *checkpoint = NULL; return( -1 ); } if( libcdata_array_initialize( &( ( *checkpoint )->block_references_array ), 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create block references array.", function ); goto on_error; } return( 1 ); on_error: if( *checkpoint != NULL ) { memory_free( *checkpoint ); *checkpoint = NULL; } return( -1 ); } /* Frees a checkpoint * Returns 1 if successful or -1 on error */ int libfsrefs_checkpoint_free( libfsrefs_checkpoint_t **checkpoint, libcerror_error_t **error ) { static char *function = "libfsrefs_checkpoint_free"; int result = 1; if( checkpoint == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid checkpoint.", function ); return( -1 ); } if( *checkpoint != NULL ) { if( libcdata_array_free( &( ( *checkpoint )->block_references_array ), (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_block_reference_free, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free block references array.", function ); result = -1; } memory_free( *checkpoint ); *checkpoint = NULL; } return( result ); } /* Reads a checkpoint * Returns 1 if successful or -1 on error */ int libfsrefs_checkpoint_read_data( libfsrefs_checkpoint_t *checkpoint, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { libfsrefs_block_reference_t *block_reference = NULL; static char *function = "libfsrefs_checkpoint_read_data"; size_t data_offset = 0; size_t header_size = 0; size_t trailer_size = 0; uint32_t block_reference_offset = 0; uint32_t number_of_offsets = 0; uint32_t offset_index = 0; uint32_t offsets_data_offset = 0; uint32_t self_reference_data_offset = 0; uint32_t self_reference_data_size = 0; int entry_index = 0; #if defined( HAVE_DEBUG_OUTPUT ) uint64_t value_64bit = 0; uint32_t value_32bit = 0; uint16_t value_16bit = 0; #endif if( checkpoint == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid checkpoint.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( io_handle->major_format_version == 1 ) { header_size = sizeof( fsrefs_metadata_block_header_v1_t ); trailer_size = sizeof( fsrefs_checkpoint_trailer_v1_t ); } else if( io_handle->major_format_version == 3 ) { header_size = sizeof( fsrefs_metadata_block_header_v3_t ); trailer_size = sizeof( fsrefs_checkpoint_trailer_v3_t ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < sizeof( fsrefs_checkpoint_header_t ) ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: checkpoint header data:\n", function ); libcnotify_print_data( data, sizeof( fsrefs_checkpoint_header_t ), 0 ); } #endif byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_header_t *) data )->self_reference_data_offset, self_reference_data_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_header_t *) data )->self_reference_data_size, self_reference_data_size ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_header_t *) data )->unknown1, value_32bit ); libcnotify_printf( "%s: unknown1\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_checkpoint_header_t *) data )->major_format_version, value_16bit ); libcnotify_printf( "%s: major format version\t\t\t: %" PRIu16 "\n", function, value_16bit ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_checkpoint_header_t *) data )->minor_format_version, value_16bit ); libcnotify_printf( "%s: minor format version\t\t\t: %" PRIu16 "\n", function, value_16bit ); libcnotify_printf( "%s: self reference data offset\t\t: 0x%08" PRIx32 "\n", function, self_reference_data_offset ); libcnotify_printf( "%s: self reference data size\t\t: %" PRIu32 "\n", function, self_reference_data_size ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ data_offset = sizeof( fsrefs_checkpoint_header_t ); if( ( self_reference_data_offset < ( data_offset + header_size ) ) || ( self_reference_data_offset >= ( data_size + header_size ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid self reference data offset value out of bounds.", function ); goto on_error; } self_reference_data_offset -= header_size; if( ( data_size - data_offset ) < trailer_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: checkpoint trailer data:\n", function ); libcnotify_print_data( &( data[ data_offset ] ), trailer_size, 0 ); } #endif if( io_handle->major_format_version == 1 ) { byte_stream_copy_to_uint64_little_endian( ( (fsrefs_checkpoint_trailer_v1_t *) &( data[ data_offset ] ) )->unknown2, checkpoint->sequence_number ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_trailer_v1_t *) &( data[ data_offset ] ) )->number_of_offsets, number_of_offsets ); } else if( io_handle->major_format_version == 3 ) { byte_stream_copy_to_uint64_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown2, checkpoint->sequence_number ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->number_of_offsets, number_of_offsets ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( io_handle->major_format_version == 1 ) { byte_stream_copy_to_uint64_little_endian( ( (fsrefs_checkpoint_trailer_v1_t *) &( data[ data_offset ] ) )->unknown2, value_64bit ); libcnotify_printf( "%s: unknown2\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_trailer_v1_t *) &( data[ data_offset ] ) )->unknown3, value_32bit ); libcnotify_printf( "%s: unknown3\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_trailer_v1_t *) &( data[ data_offset ] ) )->unknown4, value_32bit ); libcnotify_printf( "%s: unknown4\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_checkpoint_trailer_v1_t *) &( data[ data_offset ] ) )->unknown5, value_64bit ); libcnotify_printf( "%s: unknown5\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); } else if( io_handle->major_format_version == 3 ) { byte_stream_copy_to_uint64_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown2, value_64bit ); libcnotify_printf( "%s: unknown2\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown3, value_64bit ); libcnotify_printf( "%s: unknown3\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown4, value_32bit ); libcnotify_printf( "%s: unknown4\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown5, value_32bit ); libcnotify_printf( "%s: unknown5\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown6, value_64bit ); libcnotify_printf( "%s: unknown6\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown7, value_64bit ); libcnotify_printf( "%s: unknown7\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown8, value_32bit ); libcnotify_printf( "%s: unknown8\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_checkpoint_trailer_v3_t *) &( data[ data_offset ] ) )->unknown9, value_32bit ); libcnotify_printf( "%s: unknown9\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); } libcnotify_printf( "%s: number of offsets\t\t\t: %" PRIu32 "\n", function, number_of_offsets ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ data_offset += trailer_size; if( ( ( data_size - data_offset ) / 4 ) < number_of_offsets ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid number of offsets value out of bounds.", function ); goto on_error; } offsets_data_offset = data_offset; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: offsets data:\n", function ); libcnotify_print_data( &( data[ data_offset ] ), number_of_offsets * 4, 0 ); } #endif data_offset += number_of_offsets * 4; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( self_reference_data_offset > data_offset ) { libcnotify_printf( "%s: unknown4\n", function ); libcnotify_print_data( &( data[ data_offset ] ), (size_t) self_reference_data_offset - data_offset, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ data_offset = self_reference_data_offset; if( ( data_size - data_offset ) < self_reference_data_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid self reference data size value out of bounds.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: self reference data\n", function ); libcnotify_print_data( &( data[ data_offset ] ), self_reference_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); if( libfsrefs_block_reference_initialize( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create block reference.", function ); goto on_error; } if( libfsrefs_block_reference_read_data( block_reference, io_handle, &( data[ data_offset ] ), self_reference_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read block reference.", function ); goto on_error; } if( libfsrefs_block_reference_free( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free block reference.", function ); goto on_error; } } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ for( offset_index = 0; offset_index < number_of_offsets; offset_index++ ) { byte_stream_copy_to_uint32_little_endian( &( data[ offsets_data_offset ] ), block_reference_offset ); offsets_data_offset += 4; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: block reference: %02" PRIu32 " offset\t\t\t: 0x%08" PRIx32 "\n", function, offset_index, block_reference_offset ); } #endif if( ( block_reference_offset < ( data_offset + header_size ) ) || ( block_reference_offset >= ( data_size + header_size ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid block reference offset value out of bounds.", function ); goto on_error; } block_reference_offset -= header_size; if( libfsrefs_block_reference_initialize( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create block reference.", function ); goto on_error; } if( libfsrefs_block_reference_read_data( block_reference, io_handle, &( data[ block_reference_offset ] ), data_size - block_reference_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read block reference.", function ); goto on_error; } if( libcdata_array_append_entry( checkpoint->block_references_array, &entry_index, (intptr_t *) block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, "%s: unable to append block reference to array.", function ); goto on_error; } block_reference = NULL; } return( 1 ); on_error: if( block_reference != NULL ) { libfsrefs_block_reference_free( &block_reference, NULL ); } libcdata_array_empty( checkpoint->block_references_array, (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_block_reference_free, NULL ); return( -1 ); } /* Reads a checkpoint * Returns 1 if successful or -1 on error */ int libfsrefs_checkpoint_read_file_io_handle( libfsrefs_checkpoint_t *checkpoint, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ) { libfsrefs_metadata_block_header_t *metadata_block_header = NULL; uint8_t *metadata_block_data = NULL; static char *function = "libfsrefs_checkpoint_read_file_io_handle"; size_t header_size = 0; ssize_t read_count = 0; if( checkpoint == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid checkpoint.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( io_handle->major_format_version == 1 ) { header_size = sizeof( fsrefs_metadata_block_header_v1_t ); } else if( io_handle->major_format_version == 3 ) { header_size = sizeof( fsrefs_metadata_block_header_v3_t ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } if( ( io_handle->metadata_block_size < header_size ) || ( io_handle->metadata_block_size > MEMORY_MAXIMUM_ALLOCATION_SIZE ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid IO handle - metadata block size value out of bounds.", function ); return( -1 ); } metadata_block_data = (uint8_t *) memory_allocate( io_handle->metadata_block_size ); if( metadata_block_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create metadata block data.", function ); goto on_error; } read_count = libbfio_handle_read_buffer_at_offset( file_io_handle, metadata_block_data, (size_t) io_handle->metadata_block_size, file_offset, error ); if( read_count != (ssize_t) io_handle->metadata_block_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read checkpoint metadata at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, file_offset, file_offset ); goto on_error; } if( libfsrefs_metadata_block_header_initialize( &metadata_block_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create metadata block header.", function ); goto on_error; } if( libfsrefs_metadata_block_header_read_data( metadata_block_header, io_handle, metadata_block_data, header_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read metadata block header at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, file_offset, file_offset ); goto on_error; } file_offset += header_size; if( io_handle->major_format_version == 3 ) { if( memory_compare( metadata_block_header->signature, "CHKP", 4 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: invalid metadata block signature.", function ); goto on_error; } if( metadata_block_header->block_numbers[ 1 ] != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid metadata block header - block number 2 value out of bounds.", function ); goto on_error; } if( metadata_block_header->block_numbers[ 2 ] != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid metadata block header - block number 3 value out of bounds.", function ); goto on_error; } if( metadata_block_header->block_numbers[ 3 ] != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid metadata block header - block number 4 value out of bounds.", function ); goto on_error; } } if( libfsrefs_metadata_block_header_free( &metadata_block_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free metadata block header.", function ); goto on_error; } if( libfsrefs_checkpoint_read_data( checkpoint, io_handle, &( metadata_block_data[ header_size ] ), io_handle->metadata_block_size - header_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read checkpoint metadata.", function ); goto on_error; } memory_free( metadata_block_data ); return( 1 ); on_error: if( metadata_block_header != NULL ) { libfsrefs_metadata_block_header_free( &metadata_block_header, NULL ); } if( metadata_block_data != NULL ) { memory_free( metadata_block_data ); } return( -1 ); } /* Retrieves the number of ministore tree block references * Returns 1 if successful or -1 on error */ int libfsrefs_checkpoint_get_number_of_ministore_tree_block_references( libfsrefs_checkpoint_t *checkpoint, int *number_of_block_references, libcerror_error_t **error ) { static char *function = "libfsrefs_checkpoint_get_number_of_ministore_tree_block_references"; if( checkpoint == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid checkpoint.", function ); return( -1 ); } if( libcdata_array_get_number_of_entries( checkpoint->block_references_array, number_of_block_references, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of entries from block references array.", function ); return( -1 ); } return( 1 ); } /* Retrieves a specific ministore tree block reference * Returns 1 if successful or -1 on error */ int libfsrefs_checkpoint_get_ministore_tree_block_reference_by_index( libfsrefs_checkpoint_t *checkpoint, int block_reference_index, libfsrefs_block_reference_t **block_reference, libcerror_error_t **error ) { static char *function = "libfsrefs_checkpoint_get_ministore_tree_block_reference_by_index"; if( checkpoint == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid checkpoint.", function ); return( -1 ); } if( libcdata_array_get_entry_by_index( checkpoint->block_references_array, block_reference_index, (intptr_t **) block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve entry: %d from block references array.", function, block_reference_index ); return( -1 ); } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_checkpoint.h ================================================ /* * Checkpoint (or level 1 metadata) functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_CHECKPOINT_H ) #define _LIBFSREFS_CHECKPOINT_H #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcdata.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_checkpoint libfsrefs_checkpoint_t; struct libfsrefs_checkpoint { /* The sequence number */ uint64_t sequence_number; /* The (ministore tree) block references array */ libcdata_array_t *block_references_array; }; int libfsrefs_checkpoint_initialize( libfsrefs_checkpoint_t **checkpoint, libcerror_error_t **error ); int libfsrefs_checkpoint_free( libfsrefs_checkpoint_t **checkpoint, libcerror_error_t **error ); int libfsrefs_checkpoint_read_data( libfsrefs_checkpoint_t *checkpoint, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_checkpoint_read_file_io_handle( libfsrefs_checkpoint_t *checkpoint, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ); int libfsrefs_checkpoint_get_number_of_ministore_tree_block_references( libfsrefs_checkpoint_t *checkpoint, int *number_of_block_references, libcerror_error_t **error ); int libfsrefs_checkpoint_get_ministore_tree_block_reference_by_index( libfsrefs_checkpoint_t *checkpoint, int block_reference_index, libfsrefs_block_reference_t **block_reference, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_CHECKPOINT_H ) */ ================================================ FILE: libfsrefs/libfsrefs_data_run.c ================================================ /* * Data run functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_data_run.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "fsrefs_directory_object.h" /* Creates a data run * Make sure the value data_run is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_data_run_initialize( libfsrefs_data_run_t **data_run, libcerror_error_t **error ) { static char *function = "libfsrefs_data_run_initialize"; if( data_run == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid data run.", function ); return( -1 ); } if( *data_run != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid data run value already set.", function ); return( -1 ); } *data_run = memory_allocate_structure( libfsrefs_data_run_t ); if( *data_run == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create data run.", function ); goto on_error; } if( memory_set( *data_run, 0, sizeof( libfsrefs_data_run_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear data run.", function ); goto on_error; } return( 1 ); on_error: if( *data_run != NULL ) { memory_free( *data_run ); *data_run = NULL; } return( -1 ); } /* Frees a data run * Returns 1 if successful or -1 on error */ int libfsrefs_data_run_free( libfsrefs_data_run_t **data_run, libcerror_error_t **error ) { static char *function = "libfsrefs_data_run_free"; if( data_run == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid data run.", function ); return( -1 ); } if( *data_run != NULL ) { memory_free( *data_run ); *data_run = NULL; } return( 1 ); } /* Reads a data run * Returns 1 if successful or -1 on error */ int libfsrefs_data_run_read_data( libfsrefs_data_run_t *data_run, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_data_run_read_data"; #if defined( HAVE_DEBUG_OUTPUT ) uint64_t value_64bit = 0; #endif if( data_run == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid data run.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid IO handle.", function ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( data_size != sizeof( fsrefs_data_run_t ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: data run data:\n", function ); libcnotify_print_data( data, data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { byte_stream_copy_to_uint64_little_endian( ( (fsrefs_data_run_t *) data )->logical_offset, value_64bit ); libcnotify_printf( "%s: logical offset\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_data_run_t *) data )->size, value_64bit ); libcnotify_printf( "%s: size\t\t\t\t\t: %" PRIu64 " blocks\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_data_run_t *) data )->physical_offset, value_64bit ); libcnotify_printf( "%s: physical offset\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_data_run_t *) data )->unknown1, value_64bit ); libcnotify_printf( "%s: unknown1\t\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_data_run.h ================================================ /* * Data run functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_DATA_RUN_H ) #define _LIBFSREFS_DATA_RUN_H #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_data_run libfsrefs_data_run_t; struct libfsrefs_data_run { /* The start block number */ uint64_t start_block_number; /* The number of blocks */ uint64_t number_of_blocks; }; int libfsrefs_data_run_initialize( libfsrefs_data_run_t **data_run, libcerror_error_t **error ); int libfsrefs_data_run_free( libfsrefs_data_run_t **data_run, libcerror_error_t **error ); int libfsrefs_data_run_read_data( libfsrefs_data_run_t *data_run, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_DATA_RUN_H ) */ ================================================ FILE: libfsrefs/libfsrefs_debug.c ================================================ /* * Debug functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include "libfsrefs_debug.h" #include "libfsrefs_definitions.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_libfdatetime.h" #include "libfsrefs_libfguid.h" #include "libfsrefs_libuna.h" #if defined( HAVE_DEBUG_OUTPUT ) /* Prints the file attribute flags */ void libfsrefs_debug_print_file_attribute_flags( uint32_t file_attribute_flags ) { if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_READ_ONLY ) != 0 ) { libcnotify_printf( "\tIs read-only (FILE_ATTRIBUTE_READ_ONLY)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_HIDDEN ) != 0 ) { libcnotify_printf( "\tIs hidden (FILE_ATTRIBUTE_HIDDEN)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_SYSTEM ) != 0 ) { libcnotify_printf( "\tIs system (FILE_ATTRIBUTE_SYSTEM)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_DIRECTORY ) != 0 ) { libcnotify_printf( "\tIs directory (FILE_ATTRIBUTE_DIRECTORY)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_ARCHIVE ) != 0 ) { libcnotify_printf( "\tShould be archived (FILE_ATTRIBUTE_ARCHIVE)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_DEVICE ) != 0 ) { libcnotify_printf( "\tIs device (FILE_ATTRIBUTE_DEVICE)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_NORMAL ) != 0 ) { libcnotify_printf( "\tIs normal (FILE_ATTRIBUTE_NORMAL)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_TEMPORARY ) != 0 ) { libcnotify_printf( "\tIs temporary (FILE_ATTRIBUTE_TEMPORARY)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_SPARSE_FILE ) != 0 ) { libcnotify_printf( "\tIs a sparse file (FILE_ATTRIBUTE_SPARSE_FILE)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_REPARSE_POINT ) != 0 ) { libcnotify_printf( "\tIs a reparse point or symbolic link (FILE_ATTRIBUTE_FLAG_REPARSE_POINT)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_COMPRESSED ) != 0 ) { libcnotify_printf( "\tIs compressed (FILE_ATTRIBUTE_COMPRESSED)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_OFFLINE ) != 0 ) { libcnotify_printf( "\tIs offline (FILE_ATTRIBUTE_OFFLINE)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_NOT_CONTENT_INDEXED ) != 0 ) { libcnotify_printf( "\tContent should not be indexed (FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_ENCRYPTED ) != 0 ) { libcnotify_printf( "\tIs encrypted (FILE_ATTRIBUTE_ENCRYPTED)\n" ); } if( ( file_attribute_flags & LIBFSREFS_FILE_ATTRIBUTE_FLAG_VIRTUAL ) != 0 ) { libcnotify_printf( "\tIs virtual (FILE_ATTRIBUTE_VIRTUAL)\n" ); } if( ( file_attribute_flags & 0x10000000UL ) != 0 ) { libcnotify_printf( "\tIs directory (0x10000000)\n" ); } if( ( file_attribute_flags & 0x20000000UL ) != 0 ) { libcnotify_printf( "\tIs index view (0x20000000)\n" ); } } /* Prints the node record flags */ void libfsrefs_debug_print_node_record_flags( uint16_t node_record_flags ) { if( ( node_record_flags & 0x0008 ) != 0 ) { libcnotify_printf( "\tHas embedded Ministore node (0x0008)\n" ); } } /* Prints the node type flags */ void libfsrefs_debug_print_node_type_flags( uint8_t node_type_flags ) { if( ( node_type_flags & 0x01 ) != 0 ) { libcnotify_printf( "\tIs branch (0x01)\n" ); } if( ( node_type_flags & 0x02 ) != 0 ) { libcnotify_printf( "\tIs root (0x02)\n" ); } if( ( node_type_flags & 0x04 ) != 0 ) { libcnotify_printf( "\tIs stream (0x04)\n" ); } } /* Prints a FILETIME value * Returns 1 if successful or -1 on error */ int libfsrefs_debug_print_filetime_value( const char *function_name, const char *value_name, const uint8_t *byte_stream, size_t byte_stream_size, int byte_order, uint32_t string_format_flags, libcerror_error_t **error ) { char date_time_string[ 32 ]; libfdatetime_filetime_t *filetime = NULL; static char *function = "libfsrefs_debug_print_filetime_value"; if( libfdatetime_filetime_initialize( &filetime, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create filetime.", function ); goto on_error; } if( libfdatetime_filetime_copy_from_byte_stream( filetime, byte_stream, byte_stream_size, byte_order, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy byte stream to filetime.", function ); goto on_error; } if( libfdatetime_filetime_copy_to_utf8_string( filetime, (uint8_t *) date_time_string, 32, string_format_flags, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy filetime to string.", function ); goto on_error; } libcnotify_printf( "%s: %s: %s UTC\n", function_name, value_name, date_time_string ); if( libfdatetime_filetime_free( &filetime, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free filetime.", function ); goto on_error; } return( 1 ); on_error: if( filetime != NULL ) { libfdatetime_filetime_free( &filetime, NULL ); } return( -1 ); } /* Prints a GUID/UUID value * Returns 1 if successful or -1 on error */ int libfsrefs_debug_print_guid_value( const char *function_name, const char *value_name, const uint8_t *byte_stream, size_t byte_stream_size, int byte_order, uint32_t string_format_flags, libcerror_error_t **error ) { system_character_t guid_string[ 48 ]; libfguid_identifier_t *guid = NULL; static char *function = "libfsrefs_debug_print_guid_value"; if( libfguid_identifier_initialize( &guid, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create GUID.", function ); goto on_error; } if( libfguid_identifier_copy_from_byte_stream( guid, byte_stream, byte_stream_size, byte_order, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy byte stream to GUID.", function ); goto on_error; } if( libfguid_identifier_copy_to_utf8_string( guid, (uint8_t *) guid_string, 48, string_format_flags, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_COPY_FAILED, "%s: unable to copy GUID to string.", function ); goto on_error; } libcnotify_printf( "%s: %s: %s\n", function_name, value_name, guid_string ); if( libfguid_identifier_free( &guid, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free GUID.", function ); goto on_error; } return( 1 ); on_error: if( guid != NULL ) { libfguid_identifier_free( &guid, NULL ); } return( -1 ); } /* Prints an UTF-16 string value * Returns 1 if successful or -1 on error */ int libfsrefs_debug_print_utf16_string_value( const char *function_name, const char *value_name, const uint8_t *byte_stream, size_t byte_stream_size, int byte_order, libcerror_error_t **error ) { system_character_t *string = NULL; static char *function = "libfsrefs_debug_print_utf16_string_value"; size_t string_size = 0; int result = 0; if( ( byte_stream == NULL ) || ( byte_stream_size == 0 ) ) { libcnotify_printf( "%s: %s:\n", function_name, value_name ); return( 1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libuna_utf16_string_size_from_utf16_stream( byte_stream, byte_stream_size, byte_order, &string_size, error ); #else result = libuna_utf8_string_size_from_utf16_stream( byte_stream, byte_stream_size, byte_order, &string_size, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to determine size of string.", function ); goto on_error; } if( string_size > ( (size_t) SSIZE_MAX / sizeof( system_character_t ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid string size value exceeds maximum.", function ); goto on_error; } libcnotify_printf( "%s: %s:", function_name, value_name ); if( string_size > 0 ) { string = system_string_allocate( string_size ); if( string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create string.", function ); goto on_error; } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libuna_utf16_string_copy_from_utf16_stream( (libuna_utf16_character_t *) string, string_size, byte_stream, byte_stream_size, byte_order, error ); #else result = libuna_utf8_string_copy_from_utf16_stream( (libuna_utf8_character_t *) string, string_size, byte_stream, byte_stream_size, byte_order, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set string.", function ); goto on_error; } libcnotify_printf( " %s", string ); memory_free( string ); } libcnotify_printf( "\n" ); return( 1 ); on_error: if( string != NULL ) { memory_free( string ); } return( -1 ); } /* Prints the read offsets * Returns 1 if successful or -1 on error */ int libfsrefs_debug_print_read_offsets( libbfio_handle_t *file_io_handle, libcerror_error_t **error ) { static char *function = "libfsrefs_debug_print_read_offsets"; off64_t offset = 0; size64_t size = 0; int number_of_offsets = 0; int offset_iterator = 0; if( file_io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file IO handle.", function ); return( -1 ); } if( libbfio_handle_get_number_of_offsets_read( file_io_handle, &number_of_offsets, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of offsets read.", function ); return( -1 ); } libcnotify_printf( "Offsets read:\n" ); for( offset_iterator = 0; offset_iterator < number_of_offsets; offset_iterator++ ) { if( libbfio_handle_get_offset_read( file_io_handle, offset_iterator, &offset, &size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve offset: %d.", function, ( offset_iterator + 1 ) ); return( -1 ); } libcnotify_printf( "%08" PRIi64 " ( 0x%08" PRIx64 " ) - %08" PRIi64 " ( 0x%08" PRIx64 " ) size: %" PRIu64 "\n", offset, offset, offset + (off64_t) size, offset + (off64_t) size, size ); } libcnotify_printf( "\n" ); return( 1 ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ ================================================ FILE: libfsrefs/libfsrefs_debug.h ================================================ /* * Debug functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_DEBUG_H ) #define _LIBFSREFS_DEBUG_H #include #include #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif #if defined( HAVE_DEBUG_OUTPUT ) void libfsrefs_debug_print_file_attribute_flags( uint32_t file_attribute_flags ); void libfsrefs_debug_print_node_record_flags( uint16_t node_record_flags ); void libfsrefs_debug_print_node_type_flags( uint8_t node_type_flags ); int libfsrefs_debug_print_filetime_value( const char *function_name, const char *value_name, const uint8_t *byte_stream, size_t byte_stream_size, int byte_order, uint32_t string_format_flags, libcerror_error_t **error ); int libfsrefs_debug_print_guid_value( const char *function_name, const char *value_name, const uint8_t *byte_stream, size_t byte_stream_size, int byte_order, uint32_t string_format_flags, libcerror_error_t **error ); int libfsrefs_debug_print_utf16_string_value( const char *function_name, const char *value_name, const uint8_t *byte_stream, size_t byte_stream_size, int byte_order, libcerror_error_t **error ); int libfsrefs_debug_print_read_offsets( libbfio_handle_t *file_io_handle, libcerror_error_t **error ); #endif /* defined( HAVE_DEBUG_OUTPUT ) */ #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_DEBUG_H ) */ ================================================ FILE: libfsrefs/libfsrefs_definitions.h.in ================================================ /* * The internal definitions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_INTERNAL_DEFINITIONS_H ) #define _LIBFSREFS_INTERNAL_DEFINITIONS_H #include #include #define LIBFSREFS_ENDIAN_BIG _BYTE_STREAM_ENDIAN_BIG #define LIBFSREFS_ENDIAN_LITTLE _BYTE_STREAM_ENDIAN_LITTLE /* Define HAVE_LOCAL_LIBFSREFS for local use of libfsrefs */ #if !defined( HAVE_LOCAL_LIBFSREFS ) #include /* The definitions in are copied here * for local use of libfsrefs */ #else #define LIBFSREFS_VERSION @VERSION@ /* The version string */ #define LIBFSREFS_VERSION_STRING "@VERSION@" /* The file access * bit 1 set to 1 for read access * bit 2 set to 1 for write access * bit 3-8 not used */ enum LIBFSREFS_ACCESS_FLAGS { LIBFSREFS_ACCESS_FLAG_READ = 0x01, /* Reserved: not supported yet */ LIBFSREFS_ACCESS_FLAG_WRITE = 0x02 }; /* The file access macros */ #define LIBFSREFS_OPEN_READ ( LIBFSREFS_ACCESS_FLAG_READ ) /* Reserved: not supported yet */ #define LIBFSREFS_OPEN_WRITE ( LIBFSREFS_ACCESS_FLAG_WRITE ) /* Reserved: not supported yet */ #define LIBFSREFS_OPEN_READ_WRITE ( LIBFSREFS_ACCESS_FLAG_READ | LIBFSREFS_ACCESS_FLAG_WRITE ) /* The path segment separator */ #define LIBFSREFS_SEPARATOR '\\' /* The file attribute flags */ enum LIBFSREFS_FILE_ATTRIBUTE_FLAGS { LIBFSREFS_FILE_ATTRIBUTE_FLAG_READ_ONLY = 0x00000001UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_HIDDEN = 0x00000002UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_SYSTEM = 0x00000004UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_DIRECTORY = 0x00000010UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_ARCHIVE = 0x00000020UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_DEVICE = 0x00000040UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_NORMAL = 0x00000080UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_TEMPORARY = 0x00000100UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_SPARSE_FILE = 0x00000200UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_REPARSE_POINT = 0x00000400UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_COMPRESSED = 0x00000800UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_OFFLINE = 0x00001000UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_NOT_CONTENT_INDEXED = 0x00002000UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_ENCRYPTED = 0x00004000UL, LIBFSREFS_FILE_ATTRIBUTE_FLAG_VIRTUAL = 0x00010000UL }; #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ #define LIBFSREFS_BLOCK_TREE_NUMBER_OF_SUB_NODES 256 #endif /* !defined( _LIBFSREFS_INTERNAL_DEFINITIONS_H ) */ ================================================ FILE: libfsrefs/libfsrefs_directory_entry.c ================================================ /* * Directory entry functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_attribute_values.h" #include "libfsrefs_debug.h" #include "libfsrefs_directory_entry.h" #include "libfsrefs_libcdata.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_libfdatetime.h" #include "libfsrefs_libuna.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_node_record.h" #include "fsrefs_directory_object.h" /* Creates a directory entry * Make sure the value directory_entry is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_initialize( libfsrefs_directory_entry_t **directory_entry, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_initialize"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( *directory_entry != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid directory entry value already set.", function ); return( -1 ); } *directory_entry = memory_allocate_structure( libfsrefs_directory_entry_t ); if( *directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create directory entry.", function ); goto on_error; } if( memory_set( *directory_entry, 0, sizeof( libfsrefs_directory_entry_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear directory entry.", function ); memory_free( *directory_entry ); *directory_entry = NULL; return( -1 ); } if( libcdata_array_initialize( &( ( *directory_entry )->attributes_array ), 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create attributes array.", function ); goto on_error; } return( 1 ); on_error: if( *directory_entry != NULL ) { memory_free( *directory_entry ); *directory_entry = NULL; } return( -1 ); } /* Frees a directory entry * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_free( libfsrefs_directory_entry_t **directory_entry, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_free"; int result = 1; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( *directory_entry != NULL ) { if( libcdata_array_free( &( ( *directory_entry )->attributes_array ), (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_attribute_values_free, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free attributes array.", function ); result = -1; } if( ( *directory_entry )->name_data != NULL ) { memory_free( ( *directory_entry )->name_data ); } memory_free( *directory_entry ); *directory_entry = NULL; } return( result ); } /* Reads the directory entry directory values * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_read_directory_values( libfsrefs_directory_entry_t *directory_entry, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_read_directory_values"; #if defined( HAVE_DEBUG_OUTPUT ) uint64_t value_64bit = 0; uint32_t value_32bit = 0; #endif if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( data_size != sizeof( fsrefs_directory_values_t ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: directory values data:\n", function ); libcnotify_print_data( data, data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif byte_stream_copy_to_uint64_little_endian( ( (fsrefs_directory_values_t *) data )->object_identifier, directory_entry->object_identifier ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_directory_values_t *) data )->creation_time, directory_entry->creation_time ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_directory_values_t *) data )->modification_time, directory_entry->modification_time ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_directory_values_t *) data )->entry_modification_time, directory_entry->entry_modification_time ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_directory_values_t *) data )->access_time, directory_entry->access_time ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_directory_values_t *) data )->file_attribute_flags, directory_entry->file_attribute_flags ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: object identifier\t\t: 0x%08" PRIx64 "\n", function, directory_entry->object_identifier ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_directory_values_t *) data )->unknown1, value_64bit ); libcnotify_printf( "%s: unknown1\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); if( libfsrefs_debug_print_filetime_value( function, "creation time\t\t\t", ( (fsrefs_directory_values_t *) data )->creation_time, 8, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print FILETIME value.", function ); return( -1 ); } if( libfsrefs_debug_print_filetime_value( function, "modification time\t\t", ( (fsrefs_directory_values_t *) data )->modification_time, 8, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print FILETIME value.", function ); return( -1 ); } if( libfsrefs_debug_print_filetime_value( function, "entry modification time\t", ( (fsrefs_directory_values_t *) data )->entry_modification_time, 8, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print FILETIME value.", function ); return( -1 ); } if( libfsrefs_debug_print_filetime_value( function, "access time\t\t\t", ( (fsrefs_directory_values_t *) data )->access_time, 8, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print FILETIME value.", function ); return( -1 ); } libcnotify_printf( "%s: unknown2:\n", function ); libcnotify_print_data( ( (fsrefs_directory_values_t *) data )->unknown2, 16, 0 ); libcnotify_printf( "%s: file attribute flags\t\t: 0x%08" PRIx32 "\n", function, directory_entry->file_attribute_flags ); libfsrefs_debug_print_file_attribute_flags( directory_entry->file_attribute_flags ); libcnotify_printf( "\n" ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_directory_values_t *) data )->unknown3, value_32bit ); libcnotify_printf( "%s: unknown3\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ return( 1 ); } /* Reads the directory entry file values * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_read_file_values( libfsrefs_directory_entry_t *directory_entry, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { libfsrefs_attribute_values_t *attribute_values = NULL; libfsrefs_ministore_node_t *node = NULL; libfsrefs_node_record_t *node_record = NULL; static char *function = "libfsrefs_directory_entry_read_file_values"; int entry_index = 0; int number_of_records = 0; int record_index = 0; #if defined( HAVE_DEBUG_OUTPUT ) uint64_t value_64bit = 0; uint32_t value_32bit = 0; #endif if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( libfsrefs_ministore_node_initialize( &node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file values ministore node.", function ); goto on_error; } if( libfsrefs_ministore_node_read_data( node, io_handle, data, data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read file values ministore node.", function ); goto on_error; } if( ( node->node_type_flags & 0x03 ) != 0x02 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: invalid file values ministore node - unsupported node type flags.", function ); goto on_error; } if( node->header_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid file values ministore node - missing header data.", function ); return( -1 ); } if( node->header_data_size != sizeof( fsrefs_file_values_t ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid file values ministore node - header data size value out of bounds.", function ); goto on_error; } byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->creation_time, directory_entry->creation_time ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->modification_time, directory_entry->modification_time ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->entry_modification_time, directory_entry->entry_modification_time ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->access_time, directory_entry->access_time ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_file_values_t *) node->header_data )->file_attribute_flags, directory_entry->file_attribute_flags ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( libfsrefs_debug_print_filetime_value( function, "creation time\t\t", ( (fsrefs_file_values_t *) node->header_data )->creation_time, 8, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print FILETIME value.", function ); goto on_error; } if( libfsrefs_debug_print_filetime_value( function, "modification time\t\t", ( (fsrefs_file_values_t *) node->header_data )->modification_time, 8, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print FILETIME value.", function ); goto on_error; } if( libfsrefs_debug_print_filetime_value( function, "entry modification time\t", ( (fsrefs_file_values_t *) node->header_data )->entry_modification_time, 8, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print FILETIME value.", function ); goto on_error; } if( libfsrefs_debug_print_filetime_value( function, "access time\t\t\t", ( (fsrefs_file_values_t *) node->header_data )->access_time, 8, LIBFDATETIME_ENDIAN_LITTLE, LIBFDATETIME_STRING_FORMAT_TYPE_CTIME | LIBFDATETIME_STRING_FORMAT_FLAG_DATE_TIME_NANO_SECONDS, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print FILETIME value.", function ); goto on_error; } libcnotify_printf( "%s: file attribute flags\t: 0x%08" PRIx32 "\n", function, directory_entry->file_attribute_flags ); libfsrefs_debug_print_file_attribute_flags( directory_entry->file_attribute_flags ); libcnotify_printf( "\n" ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_file_values_t *) node->header_data )->unknown1, value_32bit ); libcnotify_printf( "%s: unknown1\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->identifier_lower, value_64bit ); libcnotify_printf( "%s: identifier (lower 64-bits)\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->identifier_upper, value_64bit ); libcnotify_printf( "%s: identifier (upper 64-bits)\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_file_values_t *) node->header_data )->unknown4, value_32bit ); libcnotify_printf( "%s: unknown4\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_file_values_t *) node->header_data )->unknown5, value_32bit ); libcnotify_printf( "%s: unknown5\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->data_size, value_64bit ); libcnotify_printf( "%s: data size\t\t\t: %" PRIu64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->allocated_data_size, value_64bit ); libcnotify_printf( "%s: allocated data size\t\t: %" PRIu64 "\n", function, value_64bit ); libcnotify_printf( "%s: unknown6:\n", function ); libcnotify_print_data( ( (fsrefs_file_values_t *) node->header_data )->unknown6, 32, 0 ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->unknown7, value_64bit ); libcnotify_printf( "%s: unknown7\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_file_values_t *) node->header_data )->unknown8, value_64bit ); libcnotify_printf( "%s: unknown8\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( libfsrefs_ministore_node_get_number_of_records( node, &number_of_records, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of records.", function ); goto on_error; } if( number_of_records == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported file values ministore node - missing attribute records.", function ); goto on_error; } for( record_index = 0; record_index < number_of_records; record_index++ ) { if( libfsrefs_ministore_node_get_record_by_index( node, record_index, &node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve attribute: %d record.", function, record_index ); goto on_error; } if( libfsrefs_attribute_values_initialize( &attribute_values, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create attribute values: %d.", function, record_index ); goto on_error; } if( libfsrefs_attribute_values_read_node_record( attribute_values, io_handle, node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read attribute values from record: %d.", function, record_index ); goto on_error; } if( libcdata_array_append_entry( directory_entry->attributes_array, &entry_index, (intptr_t *) attribute_values, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, "%s: unable to append attribute values: %d to array.", function, record_index ); goto on_error; } attribute_values = NULL; } if( libfsrefs_ministore_node_free( &node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free file values ministore node.", function ); goto on_error; } return( 1 ); on_error: if( attribute_values != NULL ) { libfsrefs_attribute_values_free( &attribute_values, NULL ); } if( node != NULL ) { libfsrefs_ministore_node_free( &node, NULL ); } libcdata_array_empty( directory_entry->attributes_array, (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_attribute_values_free, NULL ); return( -1 ); } /* Reads the directory entry from a ministore node record * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_read_node_record( libfsrefs_directory_entry_t *directory_entry, libfsrefs_io_handle_t *io_handle, libfsrefs_node_record_t *node_record, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_read_node_record"; size_t name_data_size = 0; #if defined( HAVE_DEBUG_OUTPUT ) uint16_t value_16bit = 0; #endif if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( directory_entry->name_data != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid directory entry - namd data value already set.", function ); return( -1 ); } if( node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid node record.", function ); return( -1 ); } if( node_record->key_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid node record - missing key data.", function ); return( -1 ); } if( node_record->key_data_size < 6 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid node record - key data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: key data:\n", function ); libcnotify_print_data( node_record->key_data, node_record->key_data_size, 0 ); } #endif byte_stream_copy_to_uint16_little_endian( &( node_record->key_data[ 2 ] ), directory_entry->entry_type ); name_data_size = node_record->key_data_size - 4; directory_entry->name_data = (uint8_t *) memory_allocate( sizeof( uint8_t ) * name_data_size ); if( directory_entry->name_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create name data.", function ); goto on_error; } directory_entry->name_data_size = name_data_size; if( memory_copy( directory_entry->name_data, &( node_record->key_data[ 4 ] ), directory_entry->name_data_size ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to copy name data.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { byte_stream_copy_to_uint16_little_endian( &( node_record->key_data[ 0 ] ), value_16bit ); libcnotify_printf( "%s: record type\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); libcnotify_printf( "%s: entry type\t\t\t: 0x%04" PRIx16 "\n", function, directory_entry->entry_type ); if( libfsrefs_debug_print_utf16_string_value( function, "name\t\t\t", directory_entry->name_data, directory_entry->name_data_size, LIBUNA_ENDIAN_LITTLE | LIBUNA_UTF16_STREAM_ALLOW_UNPAIRED_SURROGATE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print UTF-16 string value.", function ); goto on_error; } libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( directory_entry->entry_type == 1 ) { if( libfsrefs_directory_entry_read_file_values( directory_entry, io_handle, node_record->value_data, node_record->value_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read file values.", function ); goto on_error; } } else if( directory_entry->entry_type == 2 ) { if( libfsrefs_directory_entry_read_directory_values( directory_entry, node_record->value_data, node_record->value_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read directory values.", function ); goto on_error; } } return( 1 ); on_error: if( directory_entry->name_data != NULL ) { memory_free( directory_entry->name_data ); directory_entry->name_data = NULL; } directory_entry->name_data_size = 0; libcdata_array_empty( directory_entry->attributes_array, (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_attribute_values_free, NULL ); return( -1 ); } /* Retrieves the object identifier * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_object_identifier( libfsrefs_directory_entry_t *directory_entry, uint64_t *object_identifier, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_object_identifier"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( object_identifier == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid object identifier.", function ); return( -1 ); } *object_identifier = directory_entry->object_identifier; return( 1 ); } /* Retrieves the size of the UTF-8 encoded name * This function uses UTF-8 RFC 2279 (or 6-byte UTF-8) to support characters outside Unicode * The returned size includes the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_utf8_name_size( libfsrefs_directory_entry_t *directory_entry, size_t *utf8_string_size, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_utf8_name_size"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( libuna_utf8_string_size_from_utf16_stream( directory_entry->name_data, directory_entry->name_data_size, LIBUNA_ENDIAN_LITTLE | LIBUNA_UTF16_STREAM_ALLOW_UNPAIRED_SURROGATE, utf8_string_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size of UTF-8 name.", function ); return( -1 ); } return( 1 ); } /* Retrieves the UTF-8 encoded name * This function uses UTF-8 RFC 2279 (or 6-byte UTF-8) to support characters outside Unicode * The size should include the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_utf8_name( libfsrefs_directory_entry_t *directory_entry, uint8_t *utf8_string, size_t utf8_string_size, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_utf8_name"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( libuna_utf8_string_copy_from_utf16_stream( utf8_string, utf8_string_size, directory_entry->name_data, directory_entry->name_data_size, LIBUNA_ENDIAN_LITTLE | LIBUNA_UTF16_STREAM_ALLOW_UNPAIRED_SURROGATE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve UTF-8 name.", function ); return( -1 ); } return( 1 ); } /* Retrieves the size of the UTF-16 encoded name * This function uses UCS-2 (with surrogates) to support characters outside Unicode * The returned size includes the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_utf16_name_size( libfsrefs_directory_entry_t *directory_entry, size_t *utf16_string_size, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_utf16_name_size"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( libuna_utf16_string_size_from_utf16_stream( directory_entry->name_data, directory_entry->name_data_size, LIBUNA_ENDIAN_LITTLE | LIBUNA_UTF16_STREAM_ALLOW_UNPAIRED_SURROGATE, utf16_string_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size of UTF-16 name.", function ); return( -1 ); } return( 1 ); } /* Retrieves the UTF-16 encoded name * This function uses UCS-2 (with surrogates) to support characters outside Unicode * The size should include the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_utf16_name( libfsrefs_directory_entry_t *directory_entry, uint16_t *utf16_string, size_t utf16_string_size, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_utf16_name"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( libuna_utf16_string_copy_from_utf16_stream( utf16_string, utf16_string_size, directory_entry->name_data, directory_entry->name_data_size, LIBUNA_ENDIAN_LITTLE | LIBUNA_UTF16_STREAM_ALLOW_UNPAIRED_SURROGATE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve UTF-16 name.", function ); return( -1 ); } return( 1 ); } /* Retrieves the creation date and time * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_creation_time( libfsrefs_directory_entry_t *directory_entry, uint64_t *filetime, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_creation_time"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( filetime == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid FILETIME.", function ); return( -1 ); } *filetime = directory_entry->creation_time; return( 1 ); } /* Retrieves the (file) modification (last written) date and time * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_modification_time( libfsrefs_directory_entry_t *directory_entry, uint64_t *filetime, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_modification_time"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( filetime == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid FILETIME.", function ); return( -1 ); } *filetime = directory_entry->modification_time; return( 1 ); } /* Retrieves the access date and time * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_access_time( libfsrefs_directory_entry_t *directory_entry, uint64_t *filetime, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_access_time"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( filetime == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid FILETIME.", function ); return( -1 ); } *filetime = directory_entry->access_time; return( 1 ); } /* Retrieves the (file system entry) modification date and time * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_entry_modification_time( libfsrefs_directory_entry_t *directory_entry, uint64_t *filetime, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_entry_modification_time"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( filetime == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid FILETIME.", function ); return( -1 ); } *filetime = directory_entry->entry_modification_time; return( 1 ); } /* Retrieves the file attribute flags * Returns 1 if successful or -1 on error */ int libfsrefs_directory_entry_get_file_attribute_flags( libfsrefs_directory_entry_t *directory_entry, uint32_t *file_attribute_flags, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_entry_get_file_attribute_flags"; if( directory_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory entry.", function ); return( -1 ); } if( file_attribute_flags == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file attribute flags.", function ); return( -1 ); } *file_attribute_flags = directory_entry->file_attribute_flags; return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_directory_entry.h ================================================ /* * Directory entry functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_DIRECTORY_ENTRY_H ) #define _LIBFSREFS_DIRECTORY_ENTRY_H #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libcdata.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_node_record.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_directory_entry libfsrefs_directory_entry_t; struct libfsrefs_directory_entry { /* Object identifier */ uint64_t object_identifier; /* The (file) entry type */ uint16_t entry_type; /* The name data */ uint8_t *name_data; /* The name data size */ size_t name_data_size; /* The creation time */ uint64_t creation_time; /* The modification time */ uint64_t modification_time; /* The access time */ uint64_t access_time; /* The entry modification time */ uint64_t entry_modification_time; /* The file attribute flags */ uint32_t file_attribute_flags; /* The attributes array */ libcdata_array_t *attributes_array; }; int libfsrefs_directory_entry_initialize( libfsrefs_directory_entry_t **directory_entry, libcerror_error_t **error ); int libfsrefs_directory_entry_free( libfsrefs_directory_entry_t **directory_entry, libcerror_error_t **error ); int libfsrefs_directory_entry_read_directory_values( libfsrefs_directory_entry_t *directory_entry, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_directory_entry_read_file_values( libfsrefs_directory_entry_t *directory_entry, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_directory_entry_read_node_record( libfsrefs_directory_entry_t *directory_entry, libfsrefs_io_handle_t *io_handle, libfsrefs_node_record_t *node_record, libcerror_error_t **error ); int libfsrefs_directory_entry_get_object_identifier( libfsrefs_directory_entry_t *directory_entry, uint64_t *object_identifier, libcerror_error_t **error ); int libfsrefs_directory_entry_get_utf8_name_size( libfsrefs_directory_entry_t *directory_entry, size_t *utf8_string_size, libcerror_error_t **error ); int libfsrefs_directory_entry_get_utf8_name( libfsrefs_directory_entry_t *directory_entry, uint8_t *utf8_string, size_t utf8_string_size, libcerror_error_t **error ); int libfsrefs_directory_entry_get_utf16_name_size( libfsrefs_directory_entry_t *directory_entry, size_t *utf16_string_size, libcerror_error_t **error ); int libfsrefs_directory_entry_get_utf16_name( libfsrefs_directory_entry_t *directory_entry, uint16_t *utf16_string, size_t utf16_string_size, libcerror_error_t **error ); int libfsrefs_directory_entry_get_creation_time( libfsrefs_directory_entry_t *directory_entry, uint64_t *filetime, libcerror_error_t **error ); int libfsrefs_directory_entry_get_modification_time( libfsrefs_directory_entry_t *directory_entry, uint64_t *filetime, libcerror_error_t **error ); int libfsrefs_directory_entry_get_access_time( libfsrefs_directory_entry_t *directory_entry, uint64_t *filetime, libcerror_error_t **error ); int libfsrefs_directory_entry_get_entry_modification_time( libfsrefs_directory_entry_t *directory_entry, uint64_t *filetime, libcerror_error_t **error ); int libfsrefs_directory_entry_get_file_attribute_flags( libfsrefs_directory_entry_t *directory_entry, uint32_t *file_attribute_flags, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_DIRECTORY_ENTRY_H ) */ ================================================ FILE: libfsrefs/libfsrefs_directory_object.c ================================================ /* * Directory object functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_block_descriptor.h" #include "libfsrefs_block_reference.h" #include "libfsrefs_block_tree.h" #include "libfsrefs_block_tree_node.h" #include "libfsrefs_directory_entry.h" #include "libfsrefs_directory_object.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_node_record.h" #include "libfsrefs_objects_tree.h" /* Creates a directory object * Make sure the value directory_object is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_directory_object_initialize( libfsrefs_directory_object_t **directory_object, libfsrefs_io_handle_t *io_handle, libfsrefs_objects_tree_t *objects_tree, uint64_t object_identifier, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_object_initialize"; if( directory_object == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory object.", function ); return( -1 ); } if( *directory_object != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid directory object value already set.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( objects_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid objects tree.", function ); return( -1 ); } *directory_object = memory_allocate_structure( libfsrefs_directory_object_t ); if( *directory_object == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create directory object.", function ); goto on_error; } if( memory_set( *directory_object, 0, sizeof( libfsrefs_directory_object_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear directory object.", function ); memory_free( *directory_object ); *directory_object = NULL; return( -1 ); } if( libfsrefs_block_tree_initialize( &( ( *directory_object )->node_block_tree ), io_handle->volume_size, io_handle->metadata_block_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create node block tree.", function ); goto on_error; } if( libcdata_array_initialize( &( ( *directory_object )->directory_entries_array ), 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create directory entries array.", function ); goto on_error; } ( *directory_object )->object_identifier = object_identifier; ( *directory_object )->objects_tree = objects_tree; return( 1 ); on_error: if( *directory_object != NULL ) { if( ( *directory_object )->node_block_tree != NULL ) { libfsrefs_block_tree_free( &( ( *directory_object )->node_block_tree ), (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_block_reference_free, NULL ); } memory_free( *directory_object ); *directory_object = NULL; } return( -1 ); } /* Frees a directory object * Returns 1 if successful or -1 on error */ int libfsrefs_directory_object_free( libfsrefs_directory_object_t **directory_object, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_object_free"; int result = 1; if( directory_object == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory object.", function ); return( -1 ); } if( *directory_object != NULL ) { /* The objects_tree reference is freed elsewhere */ if( libcdata_array_free( &( ( *directory_object )->directory_entries_array ), (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_directory_entry_free, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free directory entries array.", function ); result = -1; } if( libfsrefs_block_tree_free( &( ( *directory_object )->node_block_tree ), (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_block_reference_free, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free node block tree.", function ); result = -1; } if( ( *directory_object )->root_node != NULL ) { if( libfsrefs_ministore_node_free( &( ( *directory_object )->root_node ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free root node.", function ); result = -1; } } memory_free( *directory_object ); *directory_object = NULL; } return( result ); } /* Checks if this is the first time the node block is being read * Returns 1 if successful or -1 on error */ int libfsrefs_directory_object_check_if_node_block_first_read( libfsrefs_directory_object_t *directory_object, libfsrefs_block_tree_t *node_block_tree, uint64_t block_number, off64_t block_offset, libcerror_error_t **error ) { libfsrefs_block_descriptor_t *existing_block_descriptor = NULL; libfsrefs_block_descriptor_t *new_block_descriptor = NULL; libfsrefs_block_tree_node_t *leaf_block_tree_node = NULL; static char *function = "libfsrefs_directory_object_check_if_node_block_first_read"; int leaf_value_index = 0; int result = 0; if( directory_object == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory object.", function ); return( -1 ); } if( libfsrefs_block_descriptor_initialize( &new_block_descriptor, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create block descriptor.", function ); goto on_error; } new_block_descriptor->block_number = block_number; result = libfsrefs_block_tree_insert_block_descriptor_by_offset( node_block_tree, block_offset, new_block_descriptor, &leaf_value_index, &leaf_block_tree_node, &existing_block_descriptor, error ); if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, "%s: unable to insert block descriptor in node block tree.", function ); goto on_error; } else if( result == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid block number: %" PRIu64 " value already exists.", function, block_number ); goto on_error; } new_block_descriptor = NULL; return( 1 ); on_error: if( new_block_descriptor != NULL ) { libfsrefs_block_descriptor_free( &new_block_descriptor, NULL ); } return( -1 ); } /* Reads an directory object * Returns 1 if successful or -1 on error */ int libfsrefs_directory_object_read( libfsrefs_directory_object_t *directory_object, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_object_read"; if( directory_object == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory object.", function ); return( -1 ); } if( directory_object->root_node != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid directory object - root node value already set.", function ); return( -1 ); } if( libfsrefs_objects_tree_get_ministore_tree_by_identifier( directory_object->objects_tree, io_handle, file_io_handle, directory_object->object_identifier, &( directory_object->root_node ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve directory object: 0x%08" PRIx64 " from objects tree.", function, directory_object->object_identifier ); goto on_error; } if( ( directory_object->root_node->node_type_flags & 0x02 ) == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported directory object: 0x%08" PRIx64 " root node - missing is root (0x02) flag.", function, directory_object->object_identifier ); goto on_error; } if( libfsrefs_directory_object_read_node( directory_object, io_handle, file_io_handle, directory_object->root_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read directory object: 0x%08" PRIx64 " root node.", function, directory_object->object_identifier ); goto on_error; } return( 1 ); on_error: libcdata_array_empty( directory_object->directory_entries_array, (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_directory_entry_free, NULL ); return( -1 ); } /* Reads an directory object node * Returns 1 if successful or -1 on error */ int libfsrefs_directory_object_read_node( libfsrefs_directory_object_t *directory_object, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libfsrefs_ministore_node_t *node, libcerror_error_t **error ) { libfsrefs_block_reference_t *block_reference = NULL; libfsrefs_directory_entry_t *directory_entry = NULL; libfsrefs_ministore_node_t *sub_node = NULL; libfsrefs_node_record_t *node_record = NULL; static char *function = "libfsrefs_directory_object_read_node"; uint16_t record_type = 0; int entry_index = 0; int number_of_records = 0; int record_index = 0; if( directory_object == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory object.", function ); return( -1 ); } if( libfsrefs_ministore_node_get_number_of_records( node, &number_of_records, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of records.", function ); return( -1 ); } for( record_index = 0; record_index < number_of_records; record_index++ ) { if( libfsrefs_ministore_node_get_record_by_index( node, record_index, &node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve record: %d.", function, record_index ); return( -1 ); } if( node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: missing record: %d.", function, record_index ); return( -1 ); } if( node_record->key_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid record: %d - missing key data.", function, record_index ); return( -1 ); } if( node_record->key_data_size >= 2 ) { byte_stream_copy_to_uint16_little_endian( node_record->key_data, record_type ); if( record_type != 0x0030 ) { continue; } } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: record: %d key data:\n", function, record_index ); libcnotify_print_data( node_record->key_data, node_record->key_data_size, 0 ); } #endif if( ( node->node_type_flags & 0x01 ) == 0 ) { if( libfsrefs_directory_entry_initialize( &directory_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create directory entry.", function ); goto on_error; } if( libfsrefs_directory_entry_read_node_record( directory_entry, io_handle, node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read directory entry from record: %d.", function, record_index ); goto on_error; } if( libcdata_array_append_entry( directory_object->directory_entries_array, &entry_index, (intptr_t *) directory_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, "%s: unable to append directory entry to array.", function ); goto on_error; } directory_entry = NULL; } else { if( libfsrefs_block_reference_initialize( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create directory object: 0x%08" PRIx64 " sub node block reference: %d.", function, directory_object->object_identifier, record_index ); goto on_error; } if( libfsrefs_block_reference_read_data( block_reference, io_handle, node_record->value_data, node_record->value_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read directory object: 0x%08" PRIx64 " sub node: %d block reference.", function, directory_object->object_identifier, record_index ); goto on_error; } if( libfsrefs_file_system_get_block_offsets( directory_object->objects_tree->file_system, io_handle, block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve irectory object: 0x%08" PRIx64 " sub node: %d block offsets.", function, directory_object->object_identifier, record_index ); goto on_error; } if( libfsrefs_directory_object_check_if_node_block_first_read( directory_object, directory_object->node_block_tree, block_reference->block_numbers[ 0 ], block_reference->block_offsets[ 0 ], error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GENERIC, "%s: unable to check if first read of block number: %" PRIu64 ".", function, block_reference->block_numbers[ 0 ] ); goto on_error; } if( libfsrefs_ministore_node_initialize( &sub_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create directory object: 0x%08" PRIx64 " ministore tree sub node: %d.", function, directory_object->object_identifier, record_index ); goto on_error; } if( libfsrefs_ministore_node_read_file_io_handle( sub_node, io_handle, file_io_handle, block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read directory object: 0x%08" PRIx64 " ministore tree sub node: %d.", function, directory_object->object_identifier, record_index ); goto on_error; } if( libfsrefs_block_reference_free( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free directory object: 0x%08" PRIx64 " sub node: %d block reference.", function, directory_object->object_identifier, record_index ); goto on_error; } if( libfsrefs_directory_object_read_node( directory_object, io_handle, file_io_handle, sub_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read directory object: 0x%08" PRIx64 " sub node: %d.", function, directory_object->object_identifier, record_index ); goto on_error; } if( libfsrefs_ministore_node_free( &sub_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free directory object: 0x%08" PRIx64 " sub node: %d.", function, directory_object->object_identifier, record_index ); goto on_error; } } } return( 1 ); on_error: if( sub_node != NULL ) { libfsrefs_ministore_node_free( &sub_node, NULL ); } if( block_reference != NULL ) { libfsrefs_block_reference_free( &block_reference, NULL ); } if( directory_entry != NULL ) { libfsrefs_directory_entry_free( &directory_entry, NULL ); } libcdata_array_empty( directory_object->directory_entries_array, (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_directory_entry_free, NULL ); return( -1 ); } /* Retrieves the number of directory entries * Returns 1 if successful or -1 on error */ int libfsrefs_directory_object_get_number_of_directory_entries( libfsrefs_directory_object_t *directory_object, int *number_of_directory_entries, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_object_get_number_of_directory_entries"; if( directory_object == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory object.", function ); return( -1 ); } if( directory_object->root_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid ministore node - missing root node.", function ); return( -1 ); } if( libcdata_array_get_number_of_entries( directory_object->directory_entries_array, number_of_directory_entries, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of entries from directory entries array.", function ); return( -1 ); } return( 1 ); } /* Retrieves a specific directory entry * Returns 1 if successful or -1 on error */ int libfsrefs_directory_object_get_directory_entry_by_index( libfsrefs_directory_object_t *directory_object, int directory_entry_index, libfsrefs_directory_entry_t **directory_entry, libcerror_error_t **error ) { static char *function = "libfsrefs_directory_object_get_directory_entry_by_index"; if( directory_object == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid directory object.", function ); return( -1 ); } if( directory_object->root_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid ministore node - missing root node.", function ); return( -1 ); } if( libcdata_array_get_entry_by_index( directory_object->directory_entries_array, directory_entry_index, (intptr_t **) directory_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve entry: %d from directory entries array.", function, directory_entry_index ); return( -1 ); } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_directory_object.h ================================================ /* * Directory object functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_DIRECTORY_OBJECT_H ) #define _LIBFSREFS_DIRECTORY_OBJECT_H #include #include #include "libfsrefs_block_tree.h" #include "libfsrefs_directory_entry.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_objects_tree.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_directory_object libfsrefs_directory_object_t; struct libfsrefs_directory_object { /* Object identifier */ uint64_t object_identifier; /* Objects tree */ libfsrefs_objects_tree_t *objects_tree; /* Ministore root node */ libfsrefs_ministore_node_t *root_node; /* The (Ministore) node block tree */ libfsrefs_block_tree_t *node_block_tree; /* The directory entries array */ libcdata_array_t *directory_entries_array; }; int libfsrefs_directory_object_initialize( libfsrefs_directory_object_t **directory_object, libfsrefs_io_handle_t *io_handle, libfsrefs_objects_tree_t *objects_tree, uint64_t object_identifier, libcerror_error_t **error ); int libfsrefs_directory_object_free( libfsrefs_directory_object_t **directory_object, libcerror_error_t **error ); int libfsrefs_directory_object_check_if_node_block_first_read( libfsrefs_directory_object_t *directory_object, libfsrefs_block_tree_t *node_block_tree, uint64_t block_number, off64_t block_offset, libcerror_error_t **error ); int libfsrefs_directory_object_read( libfsrefs_directory_object_t *directory_object, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libcerror_error_t **error ); int libfsrefs_directory_object_read_node( libfsrefs_directory_object_t *directory_object, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libfsrefs_ministore_node_t *node, libcerror_error_t **error ); int libfsrefs_directory_object_get_number_of_directory_entries( libfsrefs_directory_object_t *directory_object, int *number_of_directory_entries, libcerror_error_t **error ); int libfsrefs_directory_object_get_directory_entry_by_index( libfsrefs_directory_object_t *directory_object, int directory_entry_index, libfsrefs_directory_entry_t **directory_entry, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_DIRECTORY_OBJECT_H ) */ ================================================ FILE: libfsrefs/libfsrefs_error.c ================================================ /* * Error functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include "libfsrefs_error.h" #include "libfsrefs_libcerror.h" #if !defined( HAVE_LOCAL_LIBFSREFS ) /* Free an error and its elements */ void libfsrefs_error_free( libfsrefs_error_t **error ) { libcerror_error_free( (libcerror_error_t **) error ); } /* Prints a descriptive string of the error to the stream * Returns the number of printed characters if successful or -1 on error */ int libfsrefs_error_fprint( libfsrefs_error_t *error, FILE *stream ) { int print_count = 0; print_count = libcerror_error_fprint( (libcerror_error_t *) error, stream ); return( print_count ); } /* Prints a descriptive string of the error to the string * The end-of-string character is not included in the return value * Returns the number of printed characters if successful or -1 on error */ int libfsrefs_error_sprint( libfsrefs_error_t *error, char *string, size_t size ) { int print_count = 0; print_count = libcerror_error_sprint( (libcerror_error_t *) error, string, size ); return( print_count ); } /* Prints a backtrace of the error to the stream * Returns the number of printed characters if successful or -1 on error */ int libfsrefs_error_backtrace_fprint( libfsrefs_error_t *error, FILE *stream ) { int print_count = 0; print_count = libcerror_error_backtrace_fprint( (libcerror_error_t *) error, stream ); return( print_count ); } /* Prints a backtrace of the error to the string * The end-of-string character is not included in the return value * Returns the number of printed characters if successful or -1 on error */ int libfsrefs_error_backtrace_sprint( libfsrefs_error_t *error, char *string, size_t size ) { int print_count = 0; print_count = libcerror_error_backtrace_sprint( (libcerror_error_t *) error, string, size ); return( print_count ); } #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ ================================================ FILE: libfsrefs/libfsrefs_error.h ================================================ /* * Error functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_INTERNAL_ERROR_H ) #define _LIBFSREFS_INTERNAL_ERROR_H #include #include #include #if !defined( HAVE_LOCAL_LIBFSREFS ) #include #endif #include "libfsrefs_extern.h" #if defined( __cplusplus ) extern "C" { #endif #if !defined( HAVE_LOCAL_LIBFSREFS ) LIBFSREFS_EXTERN \ void libfsrefs_error_free( libfsrefs_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_error_fprint( libfsrefs_error_t *error, FILE *stream ); LIBFSREFS_EXTERN \ int libfsrefs_error_sprint( libfsrefs_error_t *error, char *string, size_t size ); LIBFSREFS_EXTERN \ int libfsrefs_error_backtrace_fprint( libfsrefs_error_t *error, FILE *stream ); LIBFSREFS_EXTERN \ int libfsrefs_error_backtrace_sprint( libfsrefs_error_t *error, char *string, size_t size ); #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_INTERNAL_ERROR_H ) */ ================================================ FILE: libfsrefs/libfsrefs_extern.h ================================================ /* * The internal extern definition * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_INTERNAL_EXTERN_H ) #define _LIBFSREFS_INTERNAL_EXTERN_H #include /* Define HAVE_LOCAL_LIBFSREFS for local use of libfsrefs */ #if !defined( HAVE_LOCAL_LIBFSREFS ) #include #if defined( __CYGWIN__ ) || defined( __MINGW32__ ) #define LIBFSREFS_EXTERN_VARIABLE extern #else #define LIBFSREFS_EXTERN_VARIABLE LIBFSREFS_EXTERN #endif #else #define LIBFSREFS_EXTERN /* extern */ #define LIBFSREFS_EXTERN_VARIABLE extern #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ #endif /* !defined( _LIBFSREFS_INTERNAL_EXTERN_H ) */ ================================================ FILE: libfsrefs/libfsrefs_file_entry.c ================================================ /* * File entry functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_directory_entry.h" #include "libfsrefs_directory_object.h" #include "libfsrefs_file_entry.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libuna.h" #include "libfsrefs_objects_tree.h" #include "libfsrefs_types.h" /* Creates file_entry * Make sure the value file_entry is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_file_entry_initialize( libfsrefs_file_entry_t **file_entry, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libfsrefs_objects_tree_t *objects_tree, libfsrefs_directory_entry_t *directory_entry, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_initialize"; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file_entry.", function ); return( -1 ); } if( *file_entry != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid file_entry value already set.", function ); return( -1 ); } internal_file_entry = memory_allocate_structure( libfsrefs_internal_file_entry_t ); if( internal_file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file entry.", function ); goto on_error; } if( memory_set( internal_file_entry, 0, sizeof( libfsrefs_internal_file_entry_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear file entry.", function ); memory_free( internal_file_entry ); return( -1 ); } if( libfsrefs_internal_file_entry_get_directory_object( internal_file_entry, io_handle, file_io_handle, objects_tree, directory_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve directory object.", function ); goto on_error; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_initialize( &( internal_file_entry->read_write_lock ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to initialize read/write lock.", function ); goto on_error; } #endif internal_file_entry->io_handle = io_handle; internal_file_entry->file_io_handle = file_io_handle; internal_file_entry->objects_tree = objects_tree; internal_file_entry->directory_entry = directory_entry; *file_entry = (libfsrefs_file_entry_t *) internal_file_entry; return( 1 ); on_error: if( *file_entry != NULL ) { memory_free( *file_entry ); *file_entry = NULL; } return( -1 ); } /* Frees file_entry * Returns 1 if successful or -1 on error */ int libfsrefs_file_entry_free( libfsrefs_file_entry_t **file_entry, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_free"; int result = 1; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file_entry.", function ); return( -1 ); } if( *file_entry != NULL ) { internal_file_entry = (libfsrefs_internal_file_entry_t *) *file_entry; *file_entry = NULL; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_free( &( internal_file_entry->read_write_lock ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free read/write lock.", function ); result = -1; } #endif if( internal_file_entry->directory_object != NULL ) { if( libfsrefs_directory_object_free( &( internal_file_entry->directory_object ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free directory object.", function ); result = -1; } } memory_free( internal_file_entry ); } return( result ); } /* Retrieves the directory object * Returns 1 if successful or -1 on error */ int libfsrefs_internal_file_entry_get_directory_object( libfsrefs_internal_file_entry_t *internal_file_entry, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libfsrefs_objects_tree_t *objects_tree, libfsrefs_directory_entry_t *directory_entry, libcerror_error_t **error ) { static char *function = "libfsrefs_internal_file_entry_get_directory_object"; uint64_t object_identifier = 0; if( internal_file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } if( internal_file_entry->directory_object != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid file entry - directory object already set.", function ); return( -1 ); } if( directory_entry == NULL ) { object_identifier = 0x00000600UL; } else if ( directory_entry->entry_type != 2 ) { return( 1 ); } else { if( libfsrefs_directory_entry_get_object_identifier( directory_entry, &object_identifier, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size object identifier from directory entry.", function ); goto on_error; } } if( libfsrefs_directory_object_initialize( &( internal_file_entry->directory_object ), io_handle, objects_tree, object_identifier, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create directory object.", function ); goto on_error; } if( libfsrefs_directory_object_read( internal_file_entry->directory_object, io_handle, file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read directory object: 0x%08" PRIx64 ".", function, object_identifier ); goto on_error; } return( 1 ); on_error: if( internal_file_entry->directory_object != NULL ) { libfsrefs_directory_object_free( &( internal_file_entry->directory_object ), NULL ); } return( -1 ); } /* Retrieves the creation date and time * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_creation_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_creation_time"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_creation_time( internal_file_entry->directory_entry, filetime, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve creation time from directory entry.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the (file) modification (last written) date and time * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_modification_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_modification_time"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_modification_time( internal_file_entry->directory_entry, filetime, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve modification time from directory entry.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the access date and time * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_access_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_access_time"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_access_time( internal_file_entry->directory_entry, filetime, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve access time from directory entry.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the (file system entry) modification date and time * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_entry_modification_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_entry_modification_time"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_entry_modification_time( internal_file_entry->directory_entry, filetime, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve entry modification time from directory entry.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the file attribute flags * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_file_attribute_flags( libfsrefs_file_entry_t *file_entry, uint32_t *file_attribute_flags, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_file_attribute_flags"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_file_attribute_flags( internal_file_entry->directory_entry, file_attribute_flags, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve file attribute flags from directory entry.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the size of the UTF-8 encoded name * The returned size includes the end of string character * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_utf8_name_size( libfsrefs_file_entry_t *file_entry, size_t *utf8_string_size, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_utf8_name_size"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_utf8_name_size( internal_file_entry->directory_entry, utf8_string_size, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size of UTF-8 name from directory entry.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the UTF-8 encoded name * The size should include the end of string character * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_utf8_name( libfsrefs_file_entry_t *file_entry, uint8_t *utf8_string, size_t utf8_string_size, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_utf8_name"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_utf8_name( internal_file_entry->directory_entry, utf8_string, utf8_string_size, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve UTF-8 name from directory entry.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the size of the UTF-16 encoded name * The returned size includes the end of string character * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_utf16_name_size( libfsrefs_file_entry_t *file_entry, size_t *utf16_string_size, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_utf16_name_size"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_utf16_name_size( internal_file_entry->directory_entry, utf16_string_size, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size of UTF-16 name from directory.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the UTF-16 encoded name * The size should include the end of string character * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_file_entry_get_utf16_name( libfsrefs_file_entry_t *file_entry, uint16_t *utf16_string, size_t utf16_string_size, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_utf16_name"; int result = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_entry != NULL ) { result = libfsrefs_directory_entry_get_utf16_name( internal_file_entry->directory_entry, utf16_string, utf16_string_size, error ); if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve UTF-16 name from directory entry.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the number of sub file entries * Returns 1 if successful or -1 on error */ int libfsrefs_file_entry_get_number_of_sub_file_entries( libfsrefs_file_entry_t *file_entry, int *number_of_sub_file_entries, libcerror_error_t **error ) { libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_number_of_sub_file_entries"; int result = 1; int safe_number_of_sub_file_entries = 0; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; if( number_of_sub_file_entries == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid number of sub file entries.", function ); return( -1 ); } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_object != NULL ) { if( libfsrefs_directory_object_get_number_of_directory_entries( internal_file_entry->directory_object, &safe_number_of_sub_file_entries, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of directory entries from directory object.", function ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif if( result == 1 ) { *number_of_sub_file_entries = safe_number_of_sub_file_entries; } return( result ); } /* Retrieves the sub file entry for the specific index * Returns 1 if successful or -1 on error */ int libfsrefs_file_entry_get_sub_file_entry_by_index( libfsrefs_file_entry_t *file_entry, int sub_file_entry_index, libfsrefs_file_entry_t **sub_file_entry, libcerror_error_t **error ) { libfsrefs_directory_entry_t *sub_directory_entry = NULL; libfsrefs_internal_file_entry_t *internal_file_entry = NULL; static char *function = "libfsrefs_file_entry_get_sub_file_entry_by_index"; int result = 1; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } internal_file_entry = (libfsrefs_internal_file_entry_t *) file_entry; if( sub_file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid sub file entry.", function ); return( -1 ); } if( *sub_file_entry != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid sub file entry value already set.", function ); return( -1 ); } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( internal_file_entry->directory_object != NULL ) { if( libfsrefs_directory_object_get_directory_entry_by_index( internal_file_entry->directory_object, sub_file_entry_index, &sub_directory_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve directory entry: %d from directory object.", function, sub_file_entry_index ); result = -1; } /* sub_file_entry takes over management of sub_directory_entry */ else if( libfsrefs_file_entry_initialize( sub_file_entry, internal_file_entry->io_handle, internal_file_entry->file_io_handle, internal_file_entry->objects_tree, sub_directory_entry, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create sub file entry: %d.", function, sub_file_entry_index ); result = -1; } } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_file_entry->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } ================================================ FILE: libfsrefs/libfsrefs_file_entry.h ================================================ /* * File entry functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_FILE_ENTRY_H ) #define _LIBFSREFS_FILE_ENTRY_H #include #include #include "libfsrefs_directory_entry.h" #include "libfsrefs_directory_object.h" #include "libfsrefs_extern.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcthreads.h" #include "libfsrefs_objects_tree.h" #include "libfsrefs_types.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_internal_file_entry libfsrefs_internal_file_entry_t; struct libfsrefs_internal_file_entry { /* The IO handle */ libfsrefs_io_handle_t *io_handle; /* The file IO handle */ libbfio_handle_t *file_io_handle; /* The objects tree */ libfsrefs_objects_tree_t *objects_tree; /* The directory entry */ libfsrefs_directory_entry_t *directory_entry; /* The directory object */ libfsrefs_directory_object_t *directory_object; /* The (file) entry type */ uint16_t entry_type; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) /* The read/write lock */ libcthreads_read_write_lock_t *read_write_lock; #endif }; int libfsrefs_file_entry_initialize( libfsrefs_file_entry_t **file_entry, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libfsrefs_objects_tree_t *objects_tree, libfsrefs_directory_entry_t *directory_entry, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_free( libfsrefs_file_entry_t **file_entry, libcerror_error_t **error ); int libfsrefs_internal_file_entry_get_directory_object( libfsrefs_internal_file_entry_t *internal_file_entry, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libfsrefs_objects_tree_t *objects_tree, libfsrefs_directory_entry_t *directory_entry, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_creation_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_modification_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_access_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_entry_modification_time( libfsrefs_file_entry_t *file_entry, uint64_t *filetime, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_file_attribute_flags( libfsrefs_file_entry_t *file_entry, uint32_t *file_attribute_flags, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_utf8_name_size( libfsrefs_file_entry_t *file_entry, size_t *utf8_string_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_utf8_name( libfsrefs_file_entry_t *file_entry, uint8_t *utf8_string, size_t utf8_string_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_utf16_name_size( libfsrefs_file_entry_t *file_entry, size_t *utf16_string_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_utf16_name( libfsrefs_file_entry_t *file_entry, uint16_t *utf16_string, size_t utf16_string_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_number_of_sub_file_entries( libfsrefs_file_entry_t *file_entry, int *number_of_sub_entries, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_sub_file_entry_by_index( libfsrefs_file_entry_t *file_entry, int sub_file_entry_index, libfsrefs_file_entry_t **sub_file_entry, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_file_entry_get_size( libfsrefs_file_entry_t *file_entry, size64_t *size, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_FILE_ENTRY_H ) */ ================================================ FILE: libfsrefs/libfsrefs_file_system.c ================================================ /* * Objects tree functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_checkpoint.h" #include "libfsrefs_file_system.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_superblock.h" /* Creates a file system * Make sure the value file_system is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_file_system_initialize( libfsrefs_file_system_t **file_system, libcerror_error_t **error ) { static char *function = "libfsrefs_file_system_initialize"; if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } if( *file_system != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid file system value already set.", function ); return( -1 ); } *file_system = memory_allocate_structure( libfsrefs_file_system_t ); if( *file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create file system.", function ); goto on_error; } if( memory_set( *file_system, 0, sizeof( libfsrefs_file_system_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear file system.", function ); memory_free( *file_system ); *file_system = NULL; return( -1 ); } return( 1 ); on_error: if( *file_system != NULL ) { memory_free( *file_system ); *file_system = NULL; } return( -1 ); } /* Frees a file system * Returns 1 if successful or -1 on error */ int libfsrefs_file_system_free( libfsrefs_file_system_t **file_system, libcerror_error_t **error ) { static char *function = "libfsrefs_file_system_free"; int result = 1; if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } if( *file_system != NULL ) { if( ( *file_system )->checkpoint != NULL ) { if( libfsrefs_checkpoint_free( &( ( *file_system )->checkpoint ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free checkpoint.", function ); result = -1; } } if( ( *file_system )->superblock != NULL ) { if( libfsrefs_superblock_free( &( ( *file_system )->superblock ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free superblock.", function ); result = -1; } } memory_free( *file_system ); *file_system = NULL; } return( result ); } /* Reads the superblock * Returns 1 if successful or -1 on error */ int libfsrefs_file_system_read_superblock( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ) { static char *function = "libfsrefs_file_system_read_superblock"; if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } if( file_system->superblock != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid file system - superblock value already set.", function ); return( -1 ); } if( libfsrefs_superblock_initialize( &( file_system->superblock ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create superblock.", function ); goto on_error; } if( libfsrefs_superblock_read_file_io_handle( file_system->superblock, io_handle, file_io_handle, file_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read superblock at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, file_offset, file_offset ); goto on_error; } return( 1 ); on_error: if( file_system->superblock != NULL ) { libfsrefs_superblock_free( &( file_system->superblock ), NULL ); } return( -1 ); } /* Reads the checkpoints * Returns 1 if successful or -1 on error */ int libfsrefs_file_system_read_checkpoints( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libcerror_error_t **error ) { libfsrefs_checkpoint_t *primary_checkpoint = NULL; libfsrefs_checkpoint_t *secondary_checkpoint = NULL; static char *function = "libfsrefs_file_system_read_checkpoints"; off64_t checkpoint_offset = 0; if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } if( file_system->superblock == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid file system - missing superblock.", function ); return( -1 ); } if( file_system->checkpoint != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid file system - checkpoint value already set.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } /* TODO support more than 2 checkpoints */ if( libfsrefs_checkpoint_initialize( &primary_checkpoint, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create primary checkpoint.", function ); goto on_error; } checkpoint_offset = file_system->superblock->primary_checkpoint_block_number * io_handle->metadata_block_size; if( libfsrefs_checkpoint_read_file_io_handle( primary_checkpoint, io_handle, file_io_handle, checkpoint_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read primary checkpoint at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, checkpoint_offset, checkpoint_offset ); goto on_error; } if( libfsrefs_checkpoint_initialize( &secondary_checkpoint, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create secondary checkpoint.", function ); goto on_error; } checkpoint_offset = file_system->superblock->secondary_checkpoint_block_number * io_handle->metadata_block_size; if( libfsrefs_checkpoint_read_file_io_handle( secondary_checkpoint, io_handle, file_io_handle, checkpoint_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read secondary checkpoint at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, checkpoint_offset, checkpoint_offset ); goto on_error; } if( primary_checkpoint->sequence_number >= secondary_checkpoint->sequence_number ) { if( libfsrefs_checkpoint_free( &secondary_checkpoint, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free secondary checkpoint.", function ); goto on_error; } file_system->checkpoint = primary_checkpoint; } else { if( libfsrefs_checkpoint_free( &primary_checkpoint, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free primary checkpoint.", function ); goto on_error; } file_system->checkpoint = secondary_checkpoint; } return( 1 ); on_error: if( secondary_checkpoint != NULL ) { libfsrefs_checkpoint_free( &secondary_checkpoint, NULL ); } if( primary_checkpoint != NULL ) { libfsrefs_checkpoint_free( &primary_checkpoint, NULL ); } file_system->checkpoint = NULL; return( -1 ); } /* Reads the container trees * Returns 1 if successful or -1 on error */ int libfsrefs_file_system_read_container_trees( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libcerror_error_t **error ) { libfsrefs_ministore_node_t *root_node = NULL; static char *function = "libfsrefs_file_system_read_container_trees"; if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } if( libfsrefs_file_system_get_ministore_tree( file_system, io_handle, file_io_handle, 7, &root_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve ministore tree: 7 (containers) root node.", function ); goto on_error; } if( ( root_node->node_type_flags & 0x02 ) == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported ministore tree: 7 (containers) root node - missing is root (0x02) flag.", function ); goto on_error; } if( libfsrefs_ministore_node_free( &root_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free ministore tree: 7 (containers) root node.", function ); goto on_error; } if( libfsrefs_file_system_get_ministore_tree( file_system, io_handle, file_io_handle, 8, &root_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve ministore tree: 8 (containers) root node.", function ); goto on_error; } if( ( root_node->node_type_flags & 0x02 ) == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported ministore tree: 8 (containers) root node - missing is root (0x02) flag.", function ); goto on_error; } if( libfsrefs_ministore_node_free( &root_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free ministore tree: 8 (containers) root node.", function ); goto on_error; } return( 1 ); on_error: if( root_node != NULL ) { libfsrefs_ministore_node_free( &root_node, NULL ); } return( -1 ); } /* Resolves the offsets of the block numbers in a block reference * Returns 1 if successful or -1 on error */ int libfsrefs_file_system_get_block_offsets( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libfsrefs_block_reference_t *block_reference, libcerror_error_t **error ) { static char *function = "libfsrefs_file_system_get_block_offsets"; uint64_t block_number = 0; uint64_t container_identifier = 0; uint8_t block_number_index = 0; if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( block_reference == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block reference.", function ); return( -1 ); } for( block_number_index = 0; block_number_index < 4; block_number_index++ ) { block_number = block_reference->block_numbers[ block_number_index ]; if( block_number == 0 ) { break; } if( ( io_handle->container_size != 0 ) && ( block_number > io_handle->container_size ) ) { container_identifier = block_number / io_handle->container_size; block_number %= io_handle->container_size; /* TODO look up container block range */ } block_reference->block_offsets[ block_number_index ] = (off64_t) ( block_number * io_handle->metadata_block_size ); } return( 1 ); } /* Retrieves the number of ministore trees * Returns 1 if successful or -1 on error */ int libfsrefs_file_system_get_number_of_ministore_trees( libfsrefs_file_system_t *file_system, int *number_of_ministore_trees, libcerror_error_t **error ) { static char *function = "libfsrefs_file_system_get_number_of_ministore_trees"; if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } if( libfsrefs_checkpoint_get_number_of_ministore_tree_block_references( file_system->checkpoint, number_of_ministore_trees, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of ministore tree block references from checkpoint.", function ); return( -1 ); } return( 1 ); } /* Retrieves a specific ministore tree * Returns 1 if successful or -1 on error */ int libfsrefs_file_system_get_ministore_tree( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, int ministore_tree_index, libfsrefs_ministore_node_t **root_node, libcerror_error_t **error ) { libfsrefs_block_reference_t *block_reference = NULL; libfsrefs_ministore_node_t *safe_root_node = NULL; static char *function = "libfsrefs_file_system_get_ministore_tree"; if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } if( root_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid root node.", function ); return( -1 ); } if( libfsrefs_checkpoint_get_ministore_tree_block_reference_by_index( file_system->checkpoint, ministore_tree_index, &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve ministore tree: %d block reference from checkpoint.", function, ministore_tree_index ); return( -1 ); } if( libfsrefs_file_system_get_block_offsets( file_system, io_handle, block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve ministore tree: %d block offsets.", function, ministore_tree_index ); goto on_error; } if( libfsrefs_ministore_node_initialize( &safe_root_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create ministore tree: %d root node.", function, ministore_tree_index ); goto on_error; } if( libfsrefs_ministore_node_read_file_io_handle( safe_root_node, io_handle, file_io_handle, block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read ministore tree: %d root node.", function, ministore_tree_index ); goto on_error; } *root_node = safe_root_node; return( 1 ); on_error: if( safe_root_node != NULL ) { libfsrefs_ministore_node_free( &safe_root_node, NULL ); } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_file_system.h ================================================ /* * File system functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_FILE_SYSTEM_H ) #define _LIBFSREFS_FILE_SYSTEM_H #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_checkpoint.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_superblock.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_file_system libfsrefs_file_system_t; struct libfsrefs_file_system { /* The superblock */ libfsrefs_superblock_t *superblock; /* The (latest) checkpoint */ libfsrefs_checkpoint_t *checkpoint; /* The containers (ministore) root node */ libfsrefs_ministore_node_t *containers_root_node; }; int libfsrefs_file_system_initialize( libfsrefs_file_system_t **file_system, libcerror_error_t **error ); int libfsrefs_file_system_free( libfsrefs_file_system_t **file_system, libcerror_error_t **error ); int libfsrefs_file_system_read_superblock( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ); int libfsrefs_file_system_read_checkpoints( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libcerror_error_t **error ); int libfsrefs_file_system_read_container_trees( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libcerror_error_t **error ); int libfsrefs_file_system_get_block_offsets( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libfsrefs_block_reference_t *block_reference, libcerror_error_t **error ); int libfsrefs_file_system_get_number_of_ministore_trees( libfsrefs_file_system_t *file_system, int *number_of_ministore_trees, libcerror_error_t **error ); int libfsrefs_file_system_get_ministore_tree( libfsrefs_file_system_t *file_system, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, int ministore_tree_index, libfsrefs_ministore_node_t **root_node, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_FILE_SYSTEM_H ) */ ================================================ FILE: libfsrefs/libfsrefs_io_handle.c ================================================ /* * Input/Output (IO) handle functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libcerror.h" #include "fsrefs_volume_header.h" const char fsrefs_volume_file_system_signature[ 8 ] = { 'R', 'e', 'F', 'S', 0, 0, 0, 0 }; /* Creates an IO handle * Make sure the value io_handle is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_io_handle_initialize( libfsrefs_io_handle_t **io_handle, libcerror_error_t **error ) { static char *function = "libfsrefs_io_handle_initialize"; if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( *io_handle != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid IO handle value already set.", function ); return( -1 ); } *io_handle = memory_allocate_structure( libfsrefs_io_handle_t ); if( *io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create IO handle.", function ); goto on_error; } if( memory_set( *io_handle, 0, sizeof( libfsrefs_io_handle_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear IO handle.", function ); goto on_error; } return( 1 ); on_error: if( *io_handle != NULL ) { memory_free( *io_handle ); *io_handle = NULL; } return( -1 ); } /* Frees an IO handle * Returns 1 if successful or -1 on error */ int libfsrefs_io_handle_free( libfsrefs_io_handle_t **io_handle, libcerror_error_t **error ) { static char *function = "libfsrefs_io_handle_free"; int result = 1; if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( *io_handle != NULL ) { memory_free( *io_handle ); *io_handle = NULL; } return( result ); } /* Clears the IO handle * Returns 1 if successful or -1 on error */ int libfsrefs_io_handle_clear( libfsrefs_io_handle_t *io_handle, libcerror_error_t **error ) { static char *function = "libfsrefs_io_handle_clear"; if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( memory_set( io_handle, 0, sizeof( libfsrefs_io_handle_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear IO handle.", function ); return( -1 ); } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_io_handle.h ================================================ /* * Input/Output (IO) handle functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_IO_HANDLE_H ) #define _LIBFSREFS_IO_HANDLE_H #include #include #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif extern const char fsrefs_volume_file_system_signature[ 8 ]; typedef struct libfsrefs_io_handle libfsrefs_io_handle_t; struct libfsrefs_io_handle { /* The number of bytes per sector */ uint32_t bytes_per_sector; /* The volume size */ size64_t volume_size; /* The major format version */ uint8_t major_format_version; /* The minor format version */ uint8_t minor_format_version; /* The cluster block size */ size32_t cluster_block_size; /* The metadata block size */ size32_t metadata_block_size; /* The container size */ size64_t container_size; /* Value to indicate if abort was signalled */ int abort; }; int libfsrefs_io_handle_initialize( libfsrefs_io_handle_t **io_handle, libcerror_error_t **error ); int libfsrefs_io_handle_free( libfsrefs_io_handle_t **io_handle, libcerror_error_t **error ); int libfsrefs_io_handle_clear( libfsrefs_io_handle_t *io_handle, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_IO_HANDLE_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libbfio.h ================================================ /* * The libbfio header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBBFIO_H ) #define _LIBFSREFS_LIBBFIO_H #include /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio */ #if defined( HAVE_LOCAL_LIBBFIO ) #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT * before including libbfio.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBBFIO_DLL_IMPORT #endif #include #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) #error Multi-threading support requires libbfio with multi-threading support #endif #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ #endif /* !defined( _LIBFSREFS_LIBBFIO_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libcdata.h ================================================ /* * The libcdata header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBCDATA_H ) #define _LIBFSREFS_LIBCDATA_H #include /* Define HAVE_LOCAL_LIBCDATA for local use of libcdata */ #if defined( HAVE_LOCAL_LIBCDATA ) #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBCDATA_DLL_IMPORT * before including libcdata.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBCDATA_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCDATA ) */ #endif /* !defined( _LIBFSREFS_LIBCDATA_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libcerror.h ================================================ /* * The libcerror header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBCERROR_H ) #define _LIBFSREFS_LIBCERROR_H #include /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror */ #if defined( HAVE_LOCAL_LIBCERROR ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT * before including libcerror.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBCERROR_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ #endif /* !defined( _LIBFSREFS_LIBCERROR_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libclocale.h ================================================ /* * The libclocale header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBCLOCALE_H ) #define _LIBFSREFS_LIBCLOCALE_H #include /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale */ #if defined( HAVE_LOCAL_LIBCLOCALE ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT * before including libclocale.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBCLOCALE_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ #endif /* !defined( _LIBFSREFS_LIBCLOCALE_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libcnotify.h ================================================ /* * The libcnotify header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBCNOTIFY_H ) #define _LIBFSREFS_LIBCNOTIFY_H #include /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify */ #if defined( HAVE_LOCAL_LIBCNOTIFY ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT * before including libcnotify.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBCNOTIFY_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ #endif /* !defined( _LIBFSREFS_LIBCNOTIFY_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libcthreads.h ================================================ /* * The libcthreads header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBCTHREADS_H ) #define _LIBFSREFS_LIBCTHREADS_H #include #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBFSREFS ) #define HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT #endif #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) /* Define HAVE_LOCAL_LIBCTHREADS for local use of libcthreads */ #if defined( HAVE_LOCAL_LIBCTHREADS ) #include #include #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBCTHREADS_DLL_IMPORT * before including libcthreads.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBCTHREADS_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCTHREADS ) */ #endif /* defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) */ #endif /* !defined( _LIBFSREFS_LIBCTHREADS_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libfcache.h ================================================ /* * The libfcache header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBFCACHE_H ) #define _LIBFSREFS_LIBFCACHE_H #include /* Define HAVE_LOCAL_LIBFCACHE for local use of libfcache */ #if defined( HAVE_LOCAL_LIBFCACHE ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBFCACHE_DLL_IMPORT * before including libfcache.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBFCACHE_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFCACHE ) */ #endif /* !defined( _LIBFSREFS_LIBFCACHE_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libfdata.h ================================================ /* * The libfdata header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBFDATA_H ) #define _LIBFSREFS_LIBFDATA_H #include /* Define HAVE_LOCAL_LIBFDATA for local use of libfdata */ #if defined( HAVE_LOCAL_LIBFDATA ) #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBFDATA_DLL_IMPORT * before including libfdata.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBFDATA_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFDATA ) */ #endif /* !defined( _LIBFSREFS_LIBFDATA_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libfdatetime.h ================================================ /* * The libfdatetime header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBFDATETIME_H ) #define _LIBFSREFS_LIBFDATETIME_H #include /* Define HAVE_LOCAL_LIBFDATETIME for local use of libfdatetime */ #if defined( HAVE_LOCAL_LIBFDATETIME ) #include #include #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBFDATETIME_DLL_IMPORT * before including libfdatetime.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBFDATETIME_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFDATETIME ) */ #endif /* !defined( _LIBFSREFS_LIBFDATETIME_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libfguid.h ================================================ /* * The libfguid header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBFGUID_H ) #define _LIBFSREFS_LIBFGUID_H #include /* Define HAVE_LOCAL_LIBFGUID for local use of libfguid */ #if defined( HAVE_LOCAL_LIBFGUID ) #include #include #include #else /* If libtool DLL support is enabled set LIBFGUID_DLL_IMPORT * before including libfguid.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBFGUID_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFGUID ) */ #endif /* !defined( _LIBFSREFS_LIBFGUID_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libfwnt.h ================================================ /* * The libfwnt header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBFWNT_H ) #define _LIBFSREFS_LIBFWNT_H #include /* Define HAVE_LOCAL_LIBFWNT for local use of libfwnt */ #if defined( HAVE_LOCAL_LIBFWNT ) #include #include #include #include #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBFWNT_DLL_IMPORT * before including libfwnt.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBFWNT_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBFWNT ) */ #endif /* !defined( _LIBFSREFS_LIBFWNT_H ) */ ================================================ FILE: libfsrefs/libfsrefs_libuna.h ================================================ /* * The libuna header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_LIBUNA_H ) #define _LIBFSREFS_LIBUNA_H #include /* Define HAVE_LOCAL_LIBUNA for local use of libuna */ #if defined( HAVE_LOCAL_LIBUNA ) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT * before including libuna.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBUNA_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBUNA ) */ #endif /* !defined( _LIBFSREFS_LIBUNA_H ) */ ================================================ FILE: libfsrefs/libfsrefs_metadata_block_header.c ================================================ /* * The REFS metadata block header functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_metadata_block_header.h" #include "fsrefs_metadata_block.h" /* Creates a metadata block header * Make sure the value metadata_block_header is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_metadata_block_header_initialize( libfsrefs_metadata_block_header_t **metadata_block_header, libcerror_error_t **error ) { static char *function = "libfsrefs_metadata_block_header_initialize"; if( metadata_block_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid metadata block header.", function ); return( -1 ); } if( *metadata_block_header != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid metadata block header value already set.", function ); return( -1 ); } *metadata_block_header = memory_allocate_structure( libfsrefs_metadata_block_header_t ); if( *metadata_block_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create metadata block header.", function ); goto on_error; } if( memory_set( *metadata_block_header, 0, sizeof( libfsrefs_metadata_block_header_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear metadata block header.", function ); goto on_error; } return( 1 ); on_error: if( *metadata_block_header != NULL ) { memory_free( *metadata_block_header ); *metadata_block_header = NULL; } return( -1 ); } /* Frees a metadata block header * Returns 1 if successful or -1 on error */ int libfsrefs_metadata_block_header_free( libfsrefs_metadata_block_header_t **metadata_block_header, libcerror_error_t **error ) { static char *function = "libfsrefs_metadata_block_header_free"; if( metadata_block_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid metadata block header.", function ); return( -1 ); } if( *metadata_block_header != NULL ) { memory_free( *metadata_block_header ); *metadata_block_header = NULL; } return( 1 ); } /* Reads the metadata block header * Returns 1 if successful or -1 on error */ int libfsrefs_metadata_block_header_read_data( libfsrefs_metadata_block_header_t *metadata_block_header, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_metadata_block_header_read_data"; size_t header_size = 0; #if defined( HAVE_DEBUG_OUTPUT ) uint64_t value_64bit = 0; uint32_t value_32bit = 0; #endif if( metadata_block_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid metadata block header.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( io_handle->major_format_version == 1 ) { header_size = sizeof( fsrefs_metadata_block_header_v1_t ); } else if( io_handle->major_format_version == 3 ) { header_size = sizeof( fsrefs_metadata_block_header_v3_t ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < header_size ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: metadata block header data:\n", function ); libcnotify_print_data( data, header_size, 0 ); } #endif if( io_handle->major_format_version == 1 ) { byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v1_t *) data )->block_number, metadata_block_header->block_numbers[ 0 ] ); } else if( io_handle->major_format_version == 3 ) { if( memory_copy( metadata_block_header->signature, ( (fsrefs_metadata_block_header_v3_t *) data )->signature, 4 ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to copy signature.", function ); return( -1 ); } byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->block_number1, metadata_block_header->block_numbers[ 0 ] ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->block_number2, metadata_block_header->block_numbers[ 1 ] ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->block_number3, metadata_block_header->block_numbers[ 2 ] ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->block_number4, metadata_block_header->block_numbers[ 3 ] ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( io_handle->major_format_version == 1 ) { libcnotify_printf( "%s: block number\t\t\t: %" PRIu64 "\n", function, metadata_block_header->block_numbers[ 0 ] ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v1_t *) data )->unknown1, value_64bit ); libcnotify_printf( "%s: sequence number\t\t: %" PRIu64 "\n", function, value_64bit ); libcnotify_printf( "%s: object identifier\n", function ); libcnotify_print_data( ( (fsrefs_metadata_block_header_v1_t *) data )->object_identifier, 16, 0 ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v1_t *) data )->unknown1, value_64bit ); libcnotify_printf( "%s: unknown1\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v1_t *) data )->unknown2, value_64bit ); libcnotify_printf( "%s: unknown2\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); libcnotify_printf( "\n" ); } else if( io_handle->major_format_version == 3 ) { libcnotify_printf( "%s: signature\t\t\t: %c%c%c%c\n", function, ( (fsrefs_metadata_block_header_v3_t *) data )->signature[ 0 ], ( (fsrefs_metadata_block_header_v3_t *) data )->signature[ 1 ], ( (fsrefs_metadata_block_header_v3_t *) data )->signature[ 2 ], ( (fsrefs_metadata_block_header_v3_t *) data )->signature[ 3 ] ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->unknown1, value_32bit ); libcnotify_printf( "%s: unknown1\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->unknown2, value_32bit ); libcnotify_printf( "%s: unknown2\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->unknown3, value_32bit ); libcnotify_printf( "%s: unknown3\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->unknown4, value_64bit ); libcnotify_printf( "%s: unknown4\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->unknown5, value_64bit ); libcnotify_printf( "%s: unknown5\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); libcnotify_printf( "%s: block number1\t\t: %" PRIu64 "\n", function, metadata_block_header->block_numbers[ 0 ] ); libcnotify_printf( "%s: block number2\t\t: %" PRIu64 "\n", function, metadata_block_header->block_numbers[ 1 ] ); libcnotify_printf( "%s: block number3\t\t: %" PRIu64 "\n", function, metadata_block_header->block_numbers[ 2 ] ); libcnotify_printf( "%s: block number4\t\t: %" PRIu64 "\n", function, metadata_block_header->block_numbers[ 3 ] ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->unknown6, value_64bit ); libcnotify_printf( "%s: unknown6\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_metadata_block_header_v3_t *) data )->unknown7, value_64bit ); libcnotify_printf( "%s: unknown7\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); libcnotify_printf( "\n" ); } } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ return( 1 ); } /* Reads the metadata block header * Returns 1 if successful or -1 on error */ int libfsrefs_metadata_block_header_read_file_io_handle( libfsrefs_metadata_block_header_t *metadata_block_header, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ) { uint8_t metadata_block_header_data[ sizeof( fsrefs_metadata_block_header_v3_t ) ]; static char *function = "libfsrefs_metadata_block_header_read_file_io_handle"; size_t read_size = 0; ssize_t read_count = 0; if( metadata_block_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid metadata block header.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( io_handle->major_format_version == 1 ) { read_size = sizeof( fsrefs_metadata_block_header_v1_t ); } else if( io_handle->major_format_version == 3 ) { read_size = sizeof( fsrefs_metadata_block_header_v3_t ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: reading metadata block header at offset: %" PRIi64 " (0x%08" PRIx64 ")\n", function, file_offset, file_offset ); } #endif read_count = libbfio_handle_read_buffer_at_offset( file_io_handle, metadata_block_header_data, read_size, file_offset, error ); if( read_count != (ssize_t) read_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read metadata block header data at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, file_offset, file_offset ); return( -1 ); } if( libfsrefs_metadata_block_header_read_data( metadata_block_header, io_handle, metadata_block_header_data, read_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read metadata block header data.", function ); return( -1 ); } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_metadata_block_header.h ================================================ /* * The REFS metadata block header functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_METADATA_BLOCK_HEADER_H ) #define _LIBFSREFS_METADATA_BLOCK_HEADER_H #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_metadata_block_header libfsrefs_metadata_block_header_t; struct libfsrefs_metadata_block_header { /* The signature */ uint8_t signature[ 4 ]; /* The block numbers */ uint64_t block_numbers[ 4 ]; }; int libfsrefs_metadata_block_header_initialize( libfsrefs_metadata_block_header_t **metadata_block_header, libcerror_error_t **error ); int libfsrefs_metadata_block_header_free( libfsrefs_metadata_block_header_t **metadata_block_header, libcerror_error_t **error ); int libfsrefs_metadata_block_header_read_data( libfsrefs_metadata_block_header_t *metadata_block_header, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_metadata_block_header_read_file_io_handle( libfsrefs_metadata_block_header_t *metadata_block_header, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_METADATA_BLOCK_HEADER_H ) */ ================================================ FILE: libfsrefs/libfsrefs_ministore_node.c ================================================ /* * Ministore node (or level 2+ metadata) functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_metadata_block_header.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_node_header.h" #include "libfsrefs_node_record.h" #include "libfsrefs_tree_header.h" #include "fsrefs_metadata_block.h" #include "fsrefs_ministore_tree.h" /* Creates a Ministore node * Make sure the value ministore_node is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_ministore_node_initialize( libfsrefs_ministore_node_t **ministore_node, libcerror_error_t **error ) { static char *function = "libfsrefs_ministore_node_initialize"; if( ministore_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid ministore node.", function ); return( -1 ); } if( *ministore_node != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid ministore node value already set.", function ); return( -1 ); } *ministore_node = memory_allocate_structure( libfsrefs_ministore_node_t ); if( *ministore_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create ministore node.", function ); goto on_error; } if( memory_set( *ministore_node, 0, sizeof( libfsrefs_ministore_node_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear ministore node.", function ); memory_free( *ministore_node ); *ministore_node = NULL; return( -1 ); } if( libcdata_array_initialize( &( ( *ministore_node )->records_array ), 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create records array.", function ); goto on_error; } return( 1 ); on_error: if( *ministore_node != NULL ) { memory_free( *ministore_node ); *ministore_node = NULL; } return( -1 ); } /* Frees a Ministore node * Returns 1 if successful or -1 on error */ int libfsrefs_ministore_node_free( libfsrefs_ministore_node_t **ministore_node, libcerror_error_t **error ) { static char *function = "libfsrefs_ministore_node_free"; int result = 1; if( ministore_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid ministore node.", function ); return( -1 ); } if( *ministore_node != NULL ) { /* The data reference is freed elsewhere */ if( libcdata_array_free( &( ( *ministore_node )->records_array ), (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_node_record_free, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free records array.", function ); result = -1; } if( ( *ministore_node )->internal_data != NULL ) { memory_free( ( *ministore_node )->internal_data ); } memory_free( *ministore_node ); *ministore_node = NULL; } return( result ); } /* Reads a Ministore node * Returns 1 if successful or -1 on error */ int libfsrefs_ministore_node_read_data( libfsrefs_ministore_node_t *ministore_node, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { libfsrefs_node_header_t *node_header = NULL; libfsrefs_node_record_t *node_record = NULL; libfsrefs_tree_header_t *tree_header = NULL; static char *function = "libfsrefs_ministore_node_read_data"; size_t data_offset = 0; size_t record_offsets_data_offset = 0; uint32_t node_header_offset = 0; uint32_t record_data_offset = 0; uint32_t record_data_size = 0; uint32_t record_offsets_index = 0; int entry_index = 0; #if defined( HAVE_DEBUG_OUTPUT ) size_t data_area_start_offset = 0; #endif if( ministore_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid ministore node.", function ); return( -1 ); } if( ministore_node->data != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid ministore_node - data value already set.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( ( io_handle->major_format_version != 1 ) && ( io_handle->major_format_version != 3 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < 4 ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } byte_stream_copy_to_uint32_little_endian( data, node_header_offset ); if( ( node_header_offset < 4 ) || ( node_header_offset >= ( data_size - 4 ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid node header offset value out of bounds.", function ); goto on_error; } data_offset = 4; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: node header offset\t\t\t: 0x%08" PRIx32 "\n", function, node_header_offset ); } #endif if( node_header_offset >= ( data_offset + sizeof( fsrefs_ministore_tree_header_t ) ) ) { if( libfsrefs_tree_header_initialize( &tree_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create tree header.", function ); goto on_error; } if( libfsrefs_tree_header_read_data( tree_header, &( data[ data_offset ] ), data_size - data_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read tree header.", function ); goto on_error; } if( libfsrefs_tree_header_free( &tree_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free tree header.", function ); goto on_error; } data_offset += sizeof( fsrefs_ministore_tree_header_t ); ministore_node->header_data = &( data[ data_offset ] ); ministore_node->header_data_size = node_header_offset - data_offset; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: header data:\n", function ); libcnotify_print_data( ministore_node->header_data, ministore_node->header_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif } data_offset = node_header_offset; if( libfsrefs_node_header_initialize( &node_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create node header.", function ); goto on_error; } if( libfsrefs_node_header_read_data( node_header, &( data[ data_offset ] ), data_size - data_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read node header.", function ); goto on_error; } data_offset += sizeof( fsrefs_ministore_tree_node_header_t ); if( ( node_header->data_area_start_offset < sizeof( fsrefs_ministore_tree_node_header_t ) ) || ( node_header->data_area_start_offset > ( data_size - node_header_offset ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid node header - data area start offset value out of bounds.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { data_area_start_offset = node_header_offset + node_header->data_area_start_offset; if( data_offset < data_area_start_offset ) { libcnotify_printf( "%s: node header trailing data:\n", function ); libcnotify_print_data( &( data[ data_offset ] ), data_area_start_offset - data_offset, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } } #endif if( ( node_header->data_area_end_offset < sizeof( fsrefs_ministore_tree_node_header_t ) ) || ( node_header->data_area_end_offset > ( data_size - node_header_offset ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid node header - data area end offset value out of bounds.", function ); goto on_error; } if( ( node_header->record_offsets_start_offset < sizeof( fsrefs_ministore_tree_node_header_t ) ) || ( node_header->record_offsets_start_offset > ( data_size - node_header_offset ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid node header - record offsets start offset value out of bounds.", function ); goto on_error; } if( node_header->number_of_record_offsets > ( ( data_size - node_header_offset - node_header->record_offsets_start_offset ) / 4 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid node header - number of record offsets entries value out of bounds.", function ); goto on_error; } if( ( node_header->record_offsets_end_offset != 0 ) && ( ( node_header->record_offsets_end_offset < sizeof( fsrefs_ministore_tree_node_header_t ) ) || ( node_header->record_offsets_end_offset > ( data_size - node_header_offset ) ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid node header - record offsets end offset value out of bounds.", function ); goto on_error; } ministore_node->node_type_flags = node_header->node_type_flags; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: ministore node data:\n", function ); libcnotify_print_data( &( data[ node_header_offset ] ), data_size - node_header_offset, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif record_offsets_data_offset = node_header_offset + node_header->record_offsets_start_offset; for( record_offsets_index = 0; record_offsets_index < node_header->number_of_record_offsets; record_offsets_index++ ) { byte_stream_copy_to_uint32_little_endian( &( data[ record_offsets_data_offset ] ), record_data_offset ); record_offsets_data_offset += 4; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( io_handle->major_format_version == 1 ) { libcnotify_printf( "%s: record: %02" PRIu32 " data offset\t\t: 0x%08" PRIx32 "\n", function, record_offsets_index, record_data_offset ); } else if( io_handle->major_format_version == 3 ) { libcnotify_printf( "%s: record: %02" PRIu32 " data offset\t\t: 0x%08" PRIx32 " (0x%08" PRIx32 ")\n", function, record_offsets_index, record_data_offset & 0x0000ffffUL, record_data_offset ); } } #endif if( io_handle->major_format_version == 3 ) { record_data_offset &= 0x0000ffffUL; } if( ( record_data_offset < node_header->data_area_start_offset ) || ( record_data_offset >= node_header->data_area_end_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid record: %" PRIu32 " data offset value out of bounds.", function, record_offsets_index ); goto on_error; } record_data_offset += node_header_offset; byte_stream_copy_to_uint32_little_endian( &( data[ record_data_offset ] ), record_data_size ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: record: %02" PRIu32 " data size\t\t: %" PRIu32 "\n", function, record_offsets_index, record_data_size ); libcnotify_printf( "%s: record: %02" PRIu32 " data:\n", function, record_offsets_index ); libcnotify_print_data( &( data[ record_data_offset ] ), record_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( libfsrefs_node_record_initialize( &node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create record: %" PRIu32 ".", function, record_offsets_index ); goto on_error; } if( libfsrefs_node_record_read_data( node_record, &( data[ record_data_offset ] ), record_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read record: %" PRIu32 ".", function, record_offsets_index ); goto on_error; } if( libcdata_array_append_entry( ministore_node->records_array, &entry_index, (intptr_t *) node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_APPEND_FAILED, "%s: unable to append record: %" PRIu32 " to array.", function, record_offsets_index ); goto on_error; } node_record = NULL; } if( libfsrefs_node_header_free( &node_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free node header.", function ); goto on_error; } ministore_node->data = data; ministore_node->data_size = data_size; return( 1 ); on_error: if( node_record != NULL ) { libfsrefs_node_record_free( &node_record, NULL ); } if( node_header != NULL ) { libfsrefs_node_header_free( &node_header, NULL ); } libcdata_array_empty( ministore_node->records_array, (int (*)(intptr_t **, libcerror_error_t **)) &libfsrefs_node_record_free, NULL ); return( -1 ); } /* Reads a Ministore node * Returns 1 if successful or -1 on error */ int libfsrefs_ministore_node_read_file_io_handle( libfsrefs_ministore_node_t *ministore_node, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libfsrefs_block_reference_t *block_reference, libcerror_error_t **error ) { libfsrefs_metadata_block_header_t *metadata_block_header = NULL; static char *function = "libfsrefs_ministore_node_read_file_io_handle"; size_t header_size = 0; size_t read_size = 0; ssize_t read_count = 0; uint8_t block_number_index = 0; if( ministore_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid ministore node.", function ); return( -1 ); } if( ministore_node->internal_data != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid ministore_node - data value already set.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( block_reference == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid block reference.", function ); return( -1 ); } if( io_handle->major_format_version == 1 ) { header_size = sizeof( fsrefs_metadata_block_header_v1_t ); } else if( io_handle->major_format_version == 3 ) { header_size = sizeof( fsrefs_metadata_block_header_v3_t ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } read_size = io_handle->metadata_block_size; if( read_size == 4096 ) { read_size *= 4; } if( ( read_size < header_size ) || ( read_size > MEMORY_MAXIMUM_ALLOCATION_SIZE ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid IO handle - metadata block size value out of bounds.", function ); return( -1 ); } ministore_node->internal_data = (uint8_t *) memory_allocate( read_size ); if( ministore_node->internal_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create metadata block data.", function ); goto on_error; } for( block_number_index = 0; block_number_index < 4; block_number_index++ ) { if( block_reference->block_numbers[ block_number_index ] == 0 ) { break; } read_count = libbfio_handle_read_buffer_at_offset( file_io_handle, ministore_node->internal_data, io_handle->metadata_block_size, block_reference->block_offsets[ block_number_index ], error ); if( read_count != (ssize_t) io_handle->metadata_block_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read ministore node block: %" PRIu8 " at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, block_number_index, block_reference->block_offsets[ block_number_index ], block_reference->block_offsets[ block_number_index ] ); goto on_error; } } if( libfsrefs_metadata_block_header_initialize( &metadata_block_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create metadata block header.", function ); goto on_error; } if( libfsrefs_metadata_block_header_read_data( metadata_block_header, io_handle, ministore_node->internal_data, header_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read metadata block header at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, block_reference->block_offsets[ 0 ], block_reference->block_offsets[ 0 ] ); goto on_error; } if( io_handle->major_format_version == 3 ) { if( memory_compare( metadata_block_header->signature, "MSB+", 4 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: invalid metadata block signature.", function ); goto on_error; } } if( libfsrefs_metadata_block_header_free( &metadata_block_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free metadata block header.", function ); goto on_error; } if( libfsrefs_ministore_node_read_data( ministore_node, io_handle, &( ministore_node->internal_data[ header_size ] ), read_size - header_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read ministore node.", function ); goto on_error; } return( 1 ); on_error: if( metadata_block_header != NULL ) { libfsrefs_metadata_block_header_free( &metadata_block_header, NULL ); } if( ministore_node->internal_data != NULL ) { memory_free( ministore_node->internal_data ); ministore_node->internal_data = NULL; } ministore_node->data_size = 0; return( -1 ); } /* Retrieves the number of records * Returns 1 if successful or -1 on error */ int libfsrefs_ministore_node_get_number_of_records( libfsrefs_ministore_node_t *ministore_node, int *number_of_records, libcerror_error_t **error ) { static char *function = "libfsrefs_ministore_node_get_number_of_records"; if( ministore_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid ministore node.", function ); return( -1 ); } if( ministore_node->data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid ministore node - missing data.", function ); return( -1 ); } if( libcdata_array_get_number_of_entries( ministore_node->records_array, number_of_records, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of entries from records array.", function ); return( -1 ); } return( 1 ); } /* Retrieves a specific records * Returns 1 if successful or -1 on error */ int libfsrefs_ministore_node_get_record_by_index( libfsrefs_ministore_node_t *ministore_node, int record_index, libfsrefs_node_record_t **node_record, libcerror_error_t **error ) { static char *function = "libfsrefs_ministore_node_get_record_by_index"; if( ministore_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid ministore node.", function ); return( -1 ); } if( ministore_node->data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid ministore node - missing data.", function ); return( -1 ); } if( libcdata_array_get_entry_by_index( ministore_node->records_array, record_index, (intptr_t **) node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve entry: %d from records array.", function, record_index ); return( -1 ); } return( 1 ); } /* Retrieves the record for a specific key * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_ministore_node_get_record_by_key( libfsrefs_ministore_node_t *ministore_node, const uint8_t *key_data, size_t key_data_size, libfsrefs_node_record_t **node_record, libcerror_error_t **error ) { libfsrefs_node_record_t *safe_node_record = NULL; size_t key_data_offset = 0; static char *function = "libfsrefs_ministore_node_get_record_by_key"; int number_of_records = 0; int record_index = 0; int result = 0; if( ministore_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid ministore node.", function ); return( -1 ); } if( ministore_node->data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid ministore node - missing data.", function ); return( -1 ); } if( key_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid key data.", function ); return( -1 ); } if( ( key_data_size == 0 ) || ( key_data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid key data size value out of bounds.", function ); return( -1 ); } if( libcdata_array_get_number_of_entries( ministore_node->records_array, &number_of_records, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of entries from records array.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: requested key data:\n", function ); libcnotify_print_data( key_data, key_data_size, 0 ); } #endif /* TODO add support for branch nodes */ for( record_index = 0; record_index < number_of_records; record_index++ ) { if( libcdata_array_get_entry_by_index( ministore_node->records_array, record_index, (intptr_t **) &safe_node_record, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve entry: %d from records array.", function, record_index ); return( -1 ); } if( safe_node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: missing record: %d.", function, record_index ); return( -1 ); } if( safe_node_record->key_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid record: %d - missing key data.", function, record_index ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: record: %d key data:\n", function, record_index ); libcnotify_print_data( safe_node_record->key_data, safe_node_record->key_data_size, 0 ); } #endif if( key_data_size != safe_node_record->key_data_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid record: %d - key data size mismatch.", function, record_index ); return( -1 ); } key_data_offset = key_data_size; do { key_data_offset--; result = (int) key_data[ key_data_offset ] - (int) safe_node_record->key_data[ key_data_offset ]; if( result != 0 ) { break; } } while( key_data_offset > 0 ); if( result == 0 ) { *node_record = safe_node_record; return( 1 ); } else if( result < 0 ) { break; } } return( 0 ); } ================================================ FILE: libfsrefs/libfsrefs_ministore_node.h ================================================ /* * Ministore node (or level 2+ metadata) functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_MINISTORE_NODE_H ) #define _LIBFSREFS_MINISTORE_NODE_H #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcdata.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_node_record.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_ministore_node libfsrefs_ministore_node_t; struct libfsrefs_ministore_node { /* The data */ uint8_t *internal_data; /* The data */ const uint8_t *data; /* The data size */ size_t data_size; /* The header data */ const uint8_t *header_data; /* The header data size */ size_t header_data_size; /* The records array */ libcdata_array_t *records_array; /* The node type flags */ uint8_t node_type_flags; }; int libfsrefs_ministore_node_initialize( libfsrefs_ministore_node_t **ministore_node, libcerror_error_t **error ); int libfsrefs_ministore_node_free( libfsrefs_ministore_node_t **ministore_node, libcerror_error_t **error ); int libfsrefs_ministore_node_read_data( libfsrefs_ministore_node_t *ministore_node, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_ministore_node_read_file_io_handle( libfsrefs_ministore_node_t *ministore_node, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libfsrefs_block_reference_t *block_reference, libcerror_error_t **error ); int libfsrefs_ministore_node_get_number_of_records( libfsrefs_ministore_node_t *ministore_node, int *number_of_records, libcerror_error_t **error ); int libfsrefs_ministore_node_get_record_by_index( libfsrefs_ministore_node_t *ministore_node, int record_index, libfsrefs_node_record_t **node_record, libcerror_error_t **error ); int libfsrefs_ministore_node_get_record_by_key( libfsrefs_ministore_node_t *ministore_node, const uint8_t *key_data, size_t key_data_size, libfsrefs_node_record_t **node_record, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_MINISTORE_NODE_H ) */ ================================================ FILE: libfsrefs/libfsrefs_node_header.c ================================================ /* * Ministore node header functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_debug.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_node_header.h" #include "fsrefs_ministore_tree.h" /* Creates a node header * Make sure the value node_header is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_node_header_initialize( libfsrefs_node_header_t **node_header, libcerror_error_t **error ) { static char *function = "libfsrefs_node_header_initialize"; if( node_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid node header.", function ); return( -1 ); } if( *node_header != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid node header value already set.", function ); return( -1 ); } *node_header = memory_allocate_structure( libfsrefs_node_header_t ); if( *node_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create node header.", function ); goto on_error; } if( memory_set( *node_header, 0, sizeof( libfsrefs_node_header_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear node header.", function ); goto on_error; } return( 1 ); on_error: if( *node_header != NULL ) { memory_free( *node_header ); *node_header = NULL; } return( -1 ); } /* Frees a node header * Returns 1 if successful or -1 on error */ int libfsrefs_node_header_free( libfsrefs_node_header_t **node_header, libcerror_error_t **error ) { static char *function = "libfsrefs_node_header_free"; if( node_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid node header.", function ); return( -1 ); } if( *node_header != NULL ) { memory_free( *node_header ); *node_header = NULL; } return( 1 ); } /* Reads a node header * Returns 1 if successful or -1 on error */ int libfsrefs_node_header_read_data( libfsrefs_node_header_t *node_header, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_node_header_read_data"; #if defined( HAVE_DEBUG_OUTPUT ) uint32_t value_32bit = 0; uint16_t value_16bit = 0; #endif if( node_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid node header.", function ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < sizeof( fsrefs_ministore_tree_node_header_t ) ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: node header data:\n", function ); libcnotify_print_data( data, sizeof( fsrefs_ministore_tree_node_header_t ), LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_node_header_t *) data )->data_area_start_offset, node_header->data_area_start_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_node_header_t *) data )->data_area_end_offset, node_header->data_area_end_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_node_header_t *) data )->record_offsets_start_offset, node_header->record_offsets_start_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_node_header_t *) data )->number_of_record_offsets, node_header->number_of_record_offsets ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_node_header_t *) data )->record_offsets_end_offset, node_header->record_offsets_end_offset ); node_header->node_type_flags = ( (fsrefs_ministore_tree_node_header_t *) data )->node_type_flags; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: data area start offset\t\t\t: 0x%08" PRIx32 "\n", function, node_header->data_area_start_offset ); libcnotify_printf( "%s: data area end offset\t\t\t: 0x%08" PRIx32 "\n", function, node_header->data_area_end_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_node_header_t *) data )->unused_data_size, value_32bit ); libcnotify_printf( "%s: unused data size\t\t\t: %" PRIu32 "\n", function, value_32bit ); libcnotify_printf( "%s: node level\t\t\t\t: %" PRIu8 "\n", function, ( (fsrefs_ministore_tree_node_header_t *) data )->node_level ); libcnotify_printf( "%s: node type flags\t\t\t: 0x%02" PRIx8 "\n", function, node_header->node_type_flags ); libfsrefs_debug_print_node_type_flags( node_header->node_type_flags ); libcnotify_printf( "\n" ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_ministore_tree_node_header_t *) data )->unknown1, value_16bit ); libcnotify_printf( "%s: unknown1\t\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); libcnotify_printf( "%s: record offsets start offset\t\t: 0x%08" PRIx32 "\n", function, node_header->record_offsets_start_offset ); libcnotify_printf( "%s: number of record offsets\t\t: %" PRIu32 "\n", function, node_header->number_of_record_offsets ); libcnotify_printf( "%s: record offsets end offset\t\t: 0x%08" PRIx32 "\n", function, node_header->record_offsets_end_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_node_header_t *) data )->unknown2, value_32bit ); libcnotify_printf( "%s: unknown2\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_node_header.h ================================================ /* * Ministore node header functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_NODE_HEADER_H ) #define _LIBFSREFS_NODE_HEADER_H #include #include #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_node_header libfsrefs_node_header_t; struct libfsrefs_node_header { /* The data area start offset */ uint32_t data_area_start_offset; /* The data area end offset */ uint32_t data_area_end_offset; /* The record offsets start offset */ uint32_t record_offsets_start_offset; /* The record offsets end offset */ uint32_t record_offsets_end_offset; /* The number of record offsets */ uint32_t number_of_record_offsets; /* The node type flags */ uint8_t node_type_flags; }; int libfsrefs_node_header_initialize( libfsrefs_node_header_t **node_header, libcerror_error_t **error ); int libfsrefs_node_header_free( libfsrefs_node_header_t **node_header, libcerror_error_t **error ); int libfsrefs_node_header_read_data( libfsrefs_node_header_t *node_header, const uint8_t *data, size_t data_size, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_NODE_HEADER_H ) */ ================================================ FILE: libfsrefs/libfsrefs_node_record.c ================================================ /* * Ministore node record functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_debug.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_node_record.h" #include "fsrefs_ministore_tree.h" /* Creates a node record * Make sure the value node_record is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_node_record_initialize( libfsrefs_node_record_t **node_record, libcerror_error_t **error ) { static char *function = "libfsrefs_node_record_initialize"; if( node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid node record.", function ); return( -1 ); } if( *node_record != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid node record value already set.", function ); return( -1 ); } *node_record = memory_allocate_structure( libfsrefs_node_record_t ); if( *node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create node record.", function ); goto on_error; } if( memory_set( *node_record, 0, sizeof( libfsrefs_node_record_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear node record.", function ); goto on_error; } return( 1 ); on_error: if( *node_record != NULL ) { memory_free( *node_record ); *node_record = NULL; } return( -1 ); } /* Frees a node record * Returns 1 if successful or -1 on error */ int libfsrefs_node_record_free( libfsrefs_node_record_t **node_record, libcerror_error_t **error ) { static char *function = "libfsrefs_node_record_free"; if( node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid node record.", function ); return( -1 ); } if( *node_record != NULL ) { /* The key_data and value_data references are freed elsewhere */ memory_free( *node_record ); *node_record = NULL; } return( 1 ); } /* Reads a node record * Returns 1 if successful or -1 on error */ int libfsrefs_node_record_read_data( libfsrefs_node_record_t *node_record, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_node_record_read_data"; size_t data_offset = 0; uint16_t key_data_offset = 0; uint16_t value_data_offset = 0; if( node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid node record.", function ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < sizeof( fsrefs_ministore_tree_node_record_t ) ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: node record data:\n", function ); libcnotify_print_data( data, sizeof( fsrefs_ministore_tree_node_record_t ), LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_node_record_t *) data )->size, node_record->size ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_ministore_tree_node_record_t *) data )->key_data_offset, key_data_offset ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_ministore_tree_node_record_t *) data )->key_data_size, node_record->key_data_size ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_ministore_tree_node_record_t *) data )->flags, node_record->flags ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_ministore_tree_node_record_t *) data )->value_data_offset, value_data_offset ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_ministore_tree_node_record_t *) data )->value_data_size, node_record->value_data_size ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: size\t\t\t\t\t: %" PRIu32 "\n", function, node_record->size ); libcnotify_printf( "%s: key data offset\t\t\t: 0x%04" PRIx16 "\n", function, key_data_offset ); libcnotify_printf( "%s: key data size\t\t\t\t: %" PRIu32 "\n", function, node_record->key_data_size ); libcnotify_printf( "%s: flags\t\t\t\t\t: 0x%04" PRIx16 "\n", function, node_record->flags ); libfsrefs_debug_print_node_record_flags( node_record->flags ); libcnotify_printf( "\n" ); libcnotify_printf( "%s: value data offset\t\t\t: 0x%04" PRIx16 "\n", function, value_data_offset ); libcnotify_printf( "%s: value data size\t\t\t: %" PRIu32 "\n", function, node_record->value_data_size ); libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ data_offset = sizeof( fsrefs_ministore_tree_node_record_t ); if( ( key_data_offset < data_offset ) || ( key_data_offset >= data_size ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid key data offset value out of bounds.", function ); return( -1 ); } if( node_record->key_data_size > ( data_size - key_data_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid key data size value out of bounds.", function ); return( -1 ); } node_record->key_data = &( data[ key_data_offset ] ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: key data:\n", function ); libcnotify_print_data( node_record->key_data, node_record->key_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif if( ( value_data_offset < data_offset ) || ( value_data_offset >= data_size ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid value data offset value out of bounds.", function ); return( -1 ); } if( node_record->value_data_size > ( data_size - value_data_offset ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid value data size value out of bounds.", function ); return( -1 ); } node_record->value_data = &( data[ value_data_offset ] ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: value data:\n", function ); libcnotify_print_data( node_record->value_data, node_record->value_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_node_record.h ================================================ /* * Ministore node record functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_NODE_RECORD_H ) #define _LIBFSREFS_NODE_RECORD_H #include #include #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_node_record libfsrefs_node_record_t; struct libfsrefs_node_record { /* The size */ uint32_t size; /* The flags */ uint16_t flags; /* The key data */ const uint8_t *key_data; /* The key data size */ uint16_t key_data_size; /* The value data */ const uint8_t *value_data; /* The value data size */ uint16_t value_data_size; }; int libfsrefs_node_record_initialize( libfsrefs_node_record_t **node_record, libcerror_error_t **error ); int libfsrefs_node_record_free( libfsrefs_node_record_t **node_record, libcerror_error_t **error ); int libfsrefs_node_record_read_data( libfsrefs_node_record_t *node_record, const uint8_t *data, size_t data_size, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_NODE_RECORD_H ) */ ================================================ FILE: libfsrefs/libfsrefs_notify.c ================================================ /* * Notification functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_notify.h" #if !defined( HAVE_LOCAL_LIBFSREFS ) /* Sets the verbose notification */ void libfsrefs_notify_set_verbose( int verbose ) { libcnotify_verbose_set( verbose ); } /* Sets the notification stream * Returns 1 if successful or -1 on error */ int libfsrefs_notify_set_stream( FILE *stream, libcerror_error_t **error ) { static char *function = "libfsrefs_notify_set_stream"; if( libcnotify_stream_set( stream, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set stream.", function ); return( -1 ); } return( 1 ); } /* Opens the notification stream using a filename * The stream is opened in append mode * Returns 1 if successful or -1 on error */ int libfsrefs_notify_stream_open( const char *filename, libcerror_error_t **error ) { static char *function = "libfsrefs_notify_stream_open"; if( libcnotify_stream_open( filename, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open stream.", function ); return( -1 ); } return( 1 ); } /* Closes the notification stream if opened using a filename * Returns 0 if successful or -1 on error */ int libfsrefs_notify_stream_close( libcerror_error_t **error ) { static char *function = "libfsrefs_notify_stream_close"; if( libcnotify_stream_close( error ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open stream.", function ); return( -1 ); } return( 0 ); } #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ ================================================ FILE: libfsrefs/libfsrefs_notify.h ================================================ /* * Notification functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_NOTIFY_H ) #define _LIBFSREFS_NOTIFY_H #include #include #include #include "libfsrefs_extern.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif #if !defined( HAVE_LOCAL_LIBFSREFS ) LIBFSREFS_EXTERN \ void libfsrefs_notify_set_verbose( int verbose ); LIBFSREFS_EXTERN \ int libfsrefs_notify_set_stream( FILE *stream, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_notify_stream_open( const char *filename, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_notify_stream_close( libcerror_error_t **error ); #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_NOTIFY_H ) */ ================================================ FILE: libfsrefs/libfsrefs_objects_tree.c ================================================ /* * Objects tree functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_file_system.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_node_record.h" #include "libfsrefs_objects_tree.h" /* Creates a objects tree * Make sure the value objects_tree is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_objects_tree_initialize( libfsrefs_objects_tree_t **objects_tree, libfsrefs_file_system_t *file_system, libcerror_error_t **error ) { static char *function = "libfsrefs_objects_tree_initialize"; if( objects_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid objects tree.", function ); return( -1 ); } if( *objects_tree != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid objects tree value already set.", function ); return( -1 ); } if( file_system == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file system.", function ); return( -1 ); } *objects_tree = memory_allocate_structure( libfsrefs_objects_tree_t ); if( *objects_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create objects tree.", function ); goto on_error; } if( memory_set( *objects_tree, 0, sizeof( libfsrefs_objects_tree_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear objects tree.", function ); memory_free( *objects_tree ); *objects_tree = NULL; return( -1 ); } ( *objects_tree )->file_system = file_system; return( 1 ); on_error: if( *objects_tree != NULL ) { memory_free( *objects_tree ); *objects_tree = NULL; } return( -1 ); } /* Frees a objects tree * Returns 1 if successful or -1 on error */ int libfsrefs_objects_tree_free( libfsrefs_objects_tree_t **objects_tree, libcerror_error_t **error ) { static char *function = "libfsrefs_objects_tree_free"; int result = 1; if( objects_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid objects tree.", function ); return( -1 ); } if( *objects_tree != NULL ) { /* The file_system reference is freed elsewhere */ if( ( *objects_tree )->root_node != NULL ) { if( libfsrefs_ministore_node_free( &( ( *objects_tree )->root_node ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free root node.", function ); result = -1; } } memory_free( *objects_tree ); *objects_tree = NULL; } return( result ); } /* Reads an objects tree * Returns 1 if successful or -1 on error */ int libfsrefs_objects_tree_read( libfsrefs_objects_tree_t *objects_tree, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libcerror_error_t **error ) { static char *function = "libfsrefs_objects_tree_read"; if( objects_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid objects tree.", function ); return( -1 ); } if( objects_tree->root_node != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid objects tree - root node value already set.", function ); return( -1 ); } if( libfsrefs_file_system_get_ministore_tree( objects_tree->file_system, io_handle, file_io_handle, 0, &( objects_tree->root_node ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve ministore tree: 0 (objects).", function ); goto on_error; } if( ( objects_tree->root_node->node_type_flags & 0x02 ) == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported ministore tree: 0 (objects) root node - missing is root (0x02) flag.", function ); goto on_error; } if( ( objects_tree->root_node->node_type_flags & 0x03 ) != 0x02 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: invalid ministore tree: 0 (objects) root node - unsupported node type flags.", function ); goto on_error; } return( 1 ); on_error: if( objects_tree->root_node != NULL ) { libfsrefs_ministore_node_free( &( objects_tree->root_node ), NULL ); } return( -1 ); } /* Retrieves the ministore tree of a specific object identifier * Returns 1 if successful, 0 if not available or -1 on error */ int libfsrefs_objects_tree_get_ministore_tree_by_identifier( libfsrefs_objects_tree_t *objects_tree, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, uint64_t object_identifier, libfsrefs_ministore_node_t **root_node, libcerror_error_t **error ) { uint8_t key_data[ 16 ] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; libfsrefs_block_reference_t *block_reference = NULL; libfsrefs_ministore_node_t *safe_root_node = NULL; libfsrefs_node_record_t *node_record = NULL; static char *function = "libfsrefs_objects_tree_get_ministore_tree_by_identifier"; int result = 0; if( objects_tree == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid objects tree.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( root_node == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid root node.", function ); return( -1 ); } byte_stream_copy_from_uint64_little_endian( &( key_data[ 8 ] ), object_identifier ); result = libfsrefs_ministore_node_get_record_by_key( objects_tree->root_node, key_data, 16, &node_record, error ); if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve identifier: 0x%08" PRIx64 " from objects tree.", function, object_identifier ); goto on_error; } else if( result != 0 ) { if( node_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: missing node record.", function ); return( -1 ); } if( libfsrefs_block_reference_initialize( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create block reference.", function ); goto on_error; } if( libfsrefs_block_reference_read_data( block_reference, io_handle, node_record->value_data, node_record->value_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read block reference.", function ); goto on_error; } if( libfsrefs_file_system_get_block_offsets( objects_tree->file_system, io_handle, block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve block offsets.", function ); goto on_error; } if( libfsrefs_ministore_node_initialize( &safe_root_node, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create object: 0x%08" PRIx64 " ministore tree root node.", function, object_identifier ); goto on_error; } if( libfsrefs_ministore_node_read_file_io_handle( safe_root_node, io_handle, file_io_handle, block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read object: 0x%08" PRIx64 " ministore tree root node.", function, object_identifier ); goto on_error; } if( libfsrefs_block_reference_free( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free block reference.", function ); goto on_error; } *root_node = safe_root_node; } return( result ); on_error: if( safe_root_node != NULL ) { libfsrefs_ministore_node_free( &safe_root_node, NULL ); } if( block_reference != NULL ) { libfsrefs_block_reference_free( &block_reference, NULL ); } return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_objects_tree.h ================================================ /* * Objects tree functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_OBJECTS_TREE_H ) #define _LIBFSREFS_OBJECTS_TREE_H #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_file_system.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_ministore_node.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_objects_tree libfsrefs_objects_tree_t; struct libfsrefs_objects_tree { /* File system */ libfsrefs_file_system_t *file_system; /* Ministore root node */ libfsrefs_ministore_node_t *root_node; }; int libfsrefs_objects_tree_initialize( libfsrefs_objects_tree_t **objects_tree, libfsrefs_file_system_t *file_system, libcerror_error_t **error ); int libfsrefs_objects_tree_free( libfsrefs_objects_tree_t **objects_tree, libcerror_error_t **error ); int libfsrefs_objects_tree_read( libfsrefs_objects_tree_t *objects_tree, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, libcerror_error_t **error ); int libfsrefs_objects_tree_get_ministore_tree_by_identifier( libfsrefs_objects_tree_t *objects_tree, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, uint64_t object_identifier, libfsrefs_ministore_node_t **root_node, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_OBJECTS_TREE_H ) */ ================================================ FILE: libfsrefs/libfsrefs_superblock.c ================================================ /* * Superblock (or level 0 metadata) functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_block_reference.h" #include "libfsrefs_debug.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_libfguid.h" #include "libfsrefs_metadata_block_header.h" #include "libfsrefs_superblock.h" #include "fsrefs_metadata_block.h" #include "fsrefs_superblock.h" /* Creates a superblock * Make sure the value superblock is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_superblock_initialize( libfsrefs_superblock_t **superblock, libcerror_error_t **error ) { static char *function = "libfsrefs_superblock_initialize"; if( superblock == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid superblock.", function ); return( -1 ); } if( *superblock != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid superblock value already set.", function ); return( -1 ); } *superblock = memory_allocate_structure( libfsrefs_superblock_t ); if( *superblock == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create superblock.", function ); goto on_error; } if( memory_set( *superblock, 0, sizeof( libfsrefs_superblock_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear superblock.", function ); goto on_error; } return( 1 ); on_error: if( *superblock != NULL ) { memory_free( *superblock ); *superblock = NULL; } return( -1 ); } /* Frees a uperblock * Returns 1 if successful or -1 on error */ int libfsrefs_superblock_free( libfsrefs_superblock_t **superblock, libcerror_error_t **error ) { static char *function = "libfsrefs_superblock_free"; if( superblock == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid superblock.", function ); return( -1 ); } if( *superblock != NULL ) { memory_free( *superblock ); *superblock = NULL; } return( 1 ); } /* Reads a superblock * Returns 1 if successful or -1 on error */ int libfsrefs_superblock_read_data( libfsrefs_superblock_t *superblock, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_superblock_read_data"; size_t data_offset = 0; size_t header_size = 0; uint32_t checkpoints_data_offset = 0; uint32_t number_of_checkpoints = 0; uint32_t self_reference_data_offset = 0; uint32_t self_reference_data_size = 0; #if defined( HAVE_DEBUG_OUTPUT ) libfsrefs_block_reference_t *block_reference = NULL; uint64_t value_64bit = 0; #endif if( superblock == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid superblock.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( io_handle->major_format_version == 1 ) { header_size = sizeof( fsrefs_metadata_block_header_v1_t ); } else if( io_handle->major_format_version == 3 ) { header_size = sizeof( fsrefs_metadata_block_header_v3_t ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < sizeof( fsrefs_superblock_t ) ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: superblock data:\n", function ); libcnotify_print_data( data, sizeof( fsrefs_superblock_t ), 0 ); } #endif if( memory_copy( superblock->volume_identifier, ( (fsrefs_superblock_t *) data )->volume_identifier, 16 ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to copy volume identifier.", function ); goto on_error; } byte_stream_copy_to_uint32_little_endian( ( (fsrefs_superblock_t *) data )->checkpoints_data_offset, checkpoints_data_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_superblock_t *) data )->number_of_checkpoints, number_of_checkpoints ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_superblock_t *) data )->self_reference_data_offset, self_reference_data_offset ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_superblock_t *) data )->self_reference_data_size, self_reference_data_size ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( libfsrefs_debug_print_guid_value( function, "volume identifier\t\t\t", ( (fsrefs_superblock_t *) data )->volume_identifier, 16, LIBFGUID_ENDIAN_LITTLE, LIBFGUID_STRING_FORMAT_FLAG_USE_LOWER_CASE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print GUID value.", function ); goto on_error; } byte_stream_copy_to_uint64_little_endian( ( (fsrefs_superblock_t *) data )->unknown1, value_64bit ); libcnotify_printf( "%s: unknown1\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_superblock_t *) data )->unknown2, value_64bit ); libcnotify_printf( "%s: unknown2\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); libcnotify_printf( "%s: checkpoints data offset\t\t\t: 0x%08" PRIx32 "\n", function, checkpoints_data_offset ); libcnotify_printf( "%s: number of checkpoints\t\t\t: %" PRIu32 "\n", function, number_of_checkpoints ); libcnotify_printf( "%s: self reference data offset\t\t: 0x%08" PRIx32 "\n", function, self_reference_data_offset ); libcnotify_printf( "%s: self reference data size\t\t: %" PRIu32 "\n", function, self_reference_data_size ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ data_offset = sizeof( fsrefs_superblock_t ); if( ( checkpoints_data_offset < ( data_offset + header_size ) ) || ( checkpoints_data_offset >= ( data_size + header_size ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid checkpoints data offset value out of bounds.", function ); goto on_error; } if( number_of_checkpoints != 2 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported number of checkpoints.", function ); goto on_error; } checkpoints_data_offset -= header_size; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( checkpoints_data_offset > data_offset ) { libcnotify_printf( "%s: unknown3\n", function ); libcnotify_print_data( &( data[ data_offset ] ), (size_t) checkpoints_data_offset - data_offset, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ data_offset = checkpoints_data_offset; if( ( data_size - data_offset ) < 16 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid checkpoints data size value out of bounds.", function ); goto on_error; } byte_stream_copy_to_uint64_little_endian( &( data[ data_offset ] ), superblock->primary_checkpoint_block_number ); data_offset += 8; byte_stream_copy_to_uint64_little_endian( &( data[ data_offset ] ), superblock->secondary_checkpoint_block_number ); data_offset += 8; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: primary checkpoint block number\t\t: %" PRIu64 "\n", function, superblock->primary_checkpoint_block_number ); libcnotify_printf( "%s: secondary checkpoint block number\t: %" PRIu64 "\n", function, superblock->secondary_checkpoint_block_number ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( ( self_reference_data_offset < ( data_offset + header_size ) ) || ( self_reference_data_offset >= ( data_size + header_size ) ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid self reference data offset value out of bounds.", function ); goto on_error; } self_reference_data_offset -= header_size; #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( self_reference_data_offset > data_offset ) { libcnotify_printf( "%s: unknown4\n", function ); libcnotify_print_data( &( data[ data_offset ] ), (size_t) self_reference_data_offset - data_offset, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ data_offset = self_reference_data_offset; if( ( data_size - data_offset ) < self_reference_data_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid self reference data size value out of bounds.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: self reference data\n", function ); libcnotify_print_data( &( data[ data_offset ] ), self_reference_data_size, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); if( libfsrefs_block_reference_initialize( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create block reference.", function ); goto on_error; } if( libfsrefs_block_reference_read_data( block_reference, io_handle, &( data[ data_offset ] ), self_reference_data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read block reference.", function ); goto on_error; } if( libfsrefs_block_reference_free( &block_reference, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free block reference.", function ); goto on_error; } } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ return( 1 ); on_error: #if defined( HAVE_DEBUG_OUTPUT ) if( block_reference != NULL ) { libfsrefs_block_reference_free( &block_reference, NULL ); } #endif return( -1 ); } /* Reads a superblock * Returns 1 if successful or -1 on error */ int libfsrefs_superblock_read_file_io_handle( libfsrefs_superblock_t *superblock, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ) { libfsrefs_metadata_block_header_t *metadata_block_header = NULL; uint8_t *metadata_block_data = NULL; static char *function = "libfsrefs_superblock_read_file_io_handle"; size_t header_size = 0; ssize_t read_count = 0; if( superblock == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid superblock.", function ); return( -1 ); } if( io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid IO handle.", function ); return( -1 ); } if( io_handle->major_format_version == 1 ) { header_size = sizeof( fsrefs_metadata_block_header_v1_t ); } else if( io_handle->major_format_version == 3 ) { header_size = sizeof( fsrefs_metadata_block_header_v3_t ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, io_handle->major_format_version, io_handle->minor_format_version ); return( -1 ); } if( ( io_handle->metadata_block_size < header_size ) || ( io_handle->metadata_block_size > MEMORY_MAXIMUM_ALLOCATION_SIZE ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid IO handle - metadata block size value out of bounds.", function ); return( -1 ); } metadata_block_data = (uint8_t *) memory_allocate( io_handle->metadata_block_size ); if( metadata_block_data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create metadata block data.", function ); goto on_error; } read_count = libbfio_handle_read_buffer_at_offset( file_io_handle, metadata_block_data, (size_t) io_handle->metadata_block_size, file_offset, error ); if( read_count != (ssize_t) io_handle->metadata_block_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read superblock metadata at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, file_offset, file_offset ); goto on_error; } if( libfsrefs_metadata_block_header_initialize( &metadata_block_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create metadata block header.", function ); goto on_error; } if( libfsrefs_metadata_block_header_read_data( metadata_block_header, io_handle, metadata_block_data, header_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read metadata block header at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, file_offset, file_offset ); goto on_error; } file_offset += header_size; if( io_handle->major_format_version == 3 ) { if( memory_compare( metadata_block_header->signature, "SUPB", 4 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: invalid metadata block signature.", function ); goto on_error; } if( metadata_block_header->block_numbers[ 1 ] != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid metadata block header - block number 2 value out of bounds.", function ); goto on_error; } if( metadata_block_header->block_numbers[ 2 ] != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid metadata block header - block number 3 value out of bounds.", function ); goto on_error; } if( metadata_block_header->block_numbers[ 3 ] != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid metadata block header - block number 4 value out of bounds.", function ); goto on_error; } } if( libfsrefs_metadata_block_header_free( &metadata_block_header, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free metadata block header.", function ); goto on_error; } if( libfsrefs_superblock_read_data( superblock, io_handle, &( metadata_block_data[ header_size ] ), io_handle->metadata_block_size - header_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read superblock metadata.", function ); goto on_error; } memory_free( metadata_block_data ); return( 1 ); on_error: if( metadata_block_header != NULL ) { libfsrefs_metadata_block_header_free( &metadata_block_header, NULL ); } if( metadata_block_data != NULL ) { memory_free( metadata_block_data ); } return( -1 ); } ================================================ FILE: libfsrefs/libfsrefs_superblock.h ================================================ /* * Superblock (or level 0 metadata) functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_SUPERBLOCK_H ) #define _LIBFSREFS_SUPERBLOCK_H #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_superblock libfsrefs_superblock_t; struct libfsrefs_superblock { /* The volume identifier */ uint8_t volume_identifier[ 16 ]; /* The primary checkpoint block number */ uint64_t primary_checkpoint_block_number; /* The secondary checkpoint block number */ uint64_t secondary_checkpoint_block_number; }; int libfsrefs_superblock_initialize( libfsrefs_superblock_t **superblock, libcerror_error_t **error ); int libfsrefs_superblock_free( libfsrefs_superblock_t **superblock, libcerror_error_t **error ); int libfsrefs_superblock_read_data( libfsrefs_superblock_t *superblock, libfsrefs_io_handle_t *io_handle, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_superblock_read_file_io_handle( libfsrefs_superblock_t *superblock, libfsrefs_io_handle_t *io_handle, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_SUPERBLOCK_H ) */ ================================================ FILE: libfsrefs/libfsrefs_support.c ================================================ /* * Support functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include "libfsrefs_definitions.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libclocale.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_support.h" #if !defined( HAVE_LOCAL_LIBFSREFS ) /* Returns the library version */ const char *libfsrefs_get_version( void ) { return( (const char *) LIBFSREFS_VERSION_STRING ); } /* Returns the access flags for reading */ int libfsrefs_get_access_flags_read( void ) { return( (int) LIBFSREFS_ACCESS_FLAG_READ ); } /* Retrieves the narrow system string codepage * A value of 0 represents no codepage, UTF-8 encoding is used instead * Returns 1 if successful or -1 on error */ int libfsrefs_get_codepage( int *codepage, libcerror_error_t **error ) { static char *function = "libfsrefs_get_codepage"; if( libclocale_codepage_get( codepage, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve codepage.", function ); return( -1 ); } return( 1 ); } /* Sets the narrow system string codepage * A value of 0 represents no codepage, UTF-8 encoding is used instead * Returns 1 if successful or -1 on error */ int libfsrefs_set_codepage( int codepage, libcerror_error_t **error ) { static char *function = "libfsrefs_set_codepage"; if( libclocale_codepage_set( codepage, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set codepage.", function ); return( -1 ); } return( 1 ); } #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ /* Determines if a file contains a REFS volume signature * Returns 1 if true, 0 if not or -1 on error */ int libfsrefs_check_volume_signature( const char *filename, libcerror_error_t **error ) { libbfio_handle_t *file_io_handle = NULL; static char *function = "libfsrefs_check_volume_signature"; size_t filename_length = 0; int result = 0; if( filename == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid filename.", function ); return( -1 ); } filename_length = narrow_string_length( filename ); if( filename_length == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid filename.", function ); goto on_error; } if( libbfio_file_initialize( &file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file IO handle.", function ); goto on_error; } if( libbfio_file_set_name( file_io_handle, filename, filename_length, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set filename in file IO handle.", function ); goto on_error; } result = libfsrefs_check_volume_signature_file_io_handle( file_io_handle, error ); if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to check file signature using a file handle.", function ); goto on_error; } if( libbfio_handle_free( &file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to free file IO handle.", function ); goto on_error; } return( result ); on_error: if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } return( -1 ); } #if defined( HAVE_WIDE_CHARACTER_TYPE ) /* Determines if a file contains a REFS volume signature * Returns 1 if true, 0 if not or -1 on error */ int libfsrefs_check_volume_signature_wide( const wchar_t *filename, libcerror_error_t **error ) { libbfio_handle_t *file_io_handle = NULL; static char *function = "libfsrefs_check_volume_signature_wide"; size_t filename_length = 0; int result = 0; if( filename == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid filename.", function ); return( -1 ); } filename_length = wide_string_length( filename ); if( filename_length == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid filename.", function ); goto on_error; } if( libbfio_file_initialize( &file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file IO handle.", function ); goto on_error; } if( libbfio_file_set_name_wide( file_io_handle, filename, filename_length, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set filename in file IO handle.", function ); goto on_error; } result = libfsrefs_check_volume_signature_file_io_handle( file_io_handle, error ); if( result == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to check file signature using a file handle.", function ); goto on_error; } if( libbfio_handle_free( &file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to free file IO handle.", function ); goto on_error; } return( result ); on_error: if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } return( -1 ); } #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ /* Determines if an volume contains the REFS file system (check for the REFS signature) using a Basic File IO (bfio) handle * Returns 1 if true, 0 if not or -1 on error */ int libfsrefs_check_volume_signature_file_io_handle( libbfio_handle_t *file_io_handle, libcerror_error_t **error ) { uint8_t signature[ 12 ]; static char *function = "libfsrefs_check_volume_signature_file_io_handle"; ssize_t read_count = 0; int file_io_handle_is_open = 0; if( file_io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file IO handle.", function ); return( -1 ); } file_io_handle_is_open = libbfio_handle_is_open( file_io_handle, error ); if( file_io_handle_is_open == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open file.", function ); goto on_error; } else if( file_io_handle_is_open == 0 ) { if( libbfio_handle_open( file_io_handle, LIBBFIO_OPEN_READ, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open file.", function ); goto on_error; } } read_count = libbfio_handle_read_buffer_at_offset( file_io_handle, signature, 12, 0, error ); if( read_count != 12 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read signature at offset: 0 (0x00000000).", function ); goto on_error; } if( file_io_handle_is_open == 0 ) { if( libbfio_handle_close( file_io_handle, error ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_CLOSE_FAILED, "%s: unable to close file.", function ); goto on_error; } } if( memory_compare( fsrefs_volume_file_system_signature, &( signature[ 3 ] ), 8 ) == 0 ) { return( 1 ); } /* TODO also check sector signature ? */ return( 0 ); on_error: if( file_io_handle_is_open == 0 ) { libbfio_handle_close( file_io_handle, error ); } return( -1 ); } ================================================ FILE: libfsrefs/libfsrefs_support.h ================================================ /* * Support functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_SUPPORT_H ) #define _LIBFSREFS_SUPPORT_H #include #include #include "libfsrefs_extern.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif #if !defined( HAVE_LOCAL_LIBFSREFS ) LIBFSREFS_EXTERN \ const char *libfsrefs_get_version( void ); LIBFSREFS_EXTERN \ int libfsrefs_get_access_flags_read( void ); LIBFSREFS_EXTERN \ int libfsrefs_get_codepage( int *codepage, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_set_codepage( int codepage, libcerror_error_t **error ); #endif /* !defined( HAVE_LOCAL_LIBFSREFS ) */ LIBFSREFS_EXTERN \ int libfsrefs_check_volume_signature( const char *filename, libcerror_error_t **error ); #if defined( HAVE_WIDE_CHARACTER_TYPE ) LIBFSREFS_EXTERN \ int libfsrefs_check_volume_signature_wide( const wchar_t *filename, libcerror_error_t **error ); #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ LIBFSREFS_EXTERN \ int libfsrefs_check_volume_signature_file_io_handle( libbfio_handle_t *file_io_handle, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_SUPPORT_H ) */ ================================================ FILE: libfsrefs/libfsrefs_tree_header.c ================================================ /* * Ministore tree header functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_tree_header.h" #include "fsrefs_ministore_tree.h" /* Creates a tree header * Make sure the value tree_header is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_tree_header_initialize( libfsrefs_tree_header_t **tree_header, libcerror_error_t **error ) { static char *function = "libfsrefs_tree_header_initialize"; if( tree_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid tree header.", function ); return( -1 ); } if( *tree_header != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid tree header value already set.", function ); return( -1 ); } *tree_header = memory_allocate_structure( libfsrefs_tree_header_t ); if( *tree_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create tree header.", function ); goto on_error; } if( memory_set( *tree_header, 0, sizeof( libfsrefs_tree_header_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear tree header.", function ); goto on_error; } return( 1 ); on_error: if( *tree_header != NULL ) { memory_free( *tree_header ); *tree_header = NULL; } return( -1 ); } /* Frees a tree header * Returns 1 if successful or -1 on error */ int libfsrefs_tree_header_free( libfsrefs_tree_header_t **tree_header, libcerror_error_t **error ) { static char *function = "libfsrefs_tree_header_free"; if( tree_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid tree header.", function ); return( -1 ); } if( *tree_header != NULL ) { memory_free( *tree_header ); *tree_header = NULL; } return( 1 ); } /* Reads a tree header * Returns 1 if successful or -1 on error */ int libfsrefs_tree_header_read_data( libfsrefs_tree_header_t *tree_header, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_tree_header_read_data"; #if defined( HAVE_DEBUG_OUTPUT ) uint32_t value_32bit = 0; uint16_t value_16bit = 0; #endif if( tree_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid tree header.", function ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < sizeof( fsrefs_ministore_tree_header_t ) ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: tree header data:\n", function ); libcnotify_print_data( data, sizeof( fsrefs_ministore_tree_header_t ), LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif byte_stream_copy_to_uint16_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->table_data_offset, tree_header->table_data_offset ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: table data offset\t\t\t: 0x%04" PRIx16 "\n", function, tree_header->table_data_offset ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown1, value_16bit ); libcnotify_printf( "%s: unknown1\t\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown2, value_32bit ); libcnotify_printf( "%s: unknown2\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown3, value_32bit ); libcnotify_printf( "%s: unknown3\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown4, value_32bit ); libcnotify_printf( "%s: unknown4\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown5, value_32bit ); libcnotify_printf( "%s: unknown5\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown6, value_32bit ); libcnotify_printf( "%s: unknown6\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown7, value_32bit ); libcnotify_printf( "%s: unknown7\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown8, value_32bit ); libcnotify_printf( "%s: unknown8\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_ministore_tree_header_t *) data )->unknown9, value_32bit ); libcnotify_printf( "%s: unknown9\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_tree_header.h ================================================ /* * Ministore tree header functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_TREE_HEADER_H ) #define _LIBFSREFS_TREE_HEADER_H #include #include #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_tree_header libfsrefs_tree_header_t; struct libfsrefs_tree_header { /* The table data offset */ uint16_t table_data_offset; }; int libfsrefs_tree_header_initialize( libfsrefs_tree_header_t **tree_header, libcerror_error_t **error ); int libfsrefs_tree_header_free( libfsrefs_tree_header_t **tree_header, libcerror_error_t **error ); int libfsrefs_tree_header_read_data( libfsrefs_tree_header_t *tree_header, const uint8_t *data, size_t data_size, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_TREE_HEADER_H ) */ ================================================ FILE: libfsrefs/libfsrefs_types.h ================================================ /* * The internal type definitions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_INTERNAL_TYPES_H ) #define _LIBFSREFS_INTERNAL_TYPES_H #include #include /* Define HAVE_LOCAL_LIBFSREFS for local use of libfsrefs * The definitions in are copied here * for local use of libfsrefs */ #if defined( HAVE_LOCAL_LIBFSREFS ) /* The following type definitions hide internal data structures */ #if defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) typedef struct libfsrefs_file_entry {} libfsrefs_file_entry_t; typedef struct libfsrefs_volume {} libfsrefs_volume_t; #else typedef intptr_t libfsrefs_file_entry_t; typedef intptr_t libfsrefs_volume_t; #endif /* defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) */ #endif /* defined( HAVE_LOCAL_LIBFSREFS ) */ #endif /* !defined( _LIBFSREFS_INTERNAL_TYPES_H ) */ ================================================ FILE: libfsrefs/libfsrefs_unused.h ================================================ /* * Definitions to silence compiler warnings about unused function attributes/parameters. * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_UNUSED_H ) #define _LIBFSREFS_UNUSED_H #include #if !defined( LIBFSREFS_ATTRIBUTE_UNUSED ) #if defined( __GNUC__ ) && __GNUC__ >= 3 #define LIBFSREFS_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #else #define LIBFSREFS_ATTRIBUTE_UNUSED #endif #endif #if defined( _MSC_VER ) #define LIBFSREFS_UNREFERENCED_PARAMETER( parameter ) \ UNREFERENCED_PARAMETER( parameter ); #else #define LIBFSREFS_UNREFERENCED_PARAMETER( parameter ) \ /* parameter */ #endif #endif /* !defined( _LIBFSREFS_UNUSED_H ) */ ================================================ FILE: libfsrefs/libfsrefs_volume.c ================================================ /* * Volume functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include "libfsrefs_block_descriptor.h" #include "libfsrefs_debug.h" #include "libfsrefs_definitions.h" #include "libfsrefs_file_entry.h" #include "libfsrefs_file_system.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_libcthreads.h" #include "libfsrefs_libfcache.h" #include "libfsrefs_libfdata.h" #include "libfsrefs_libuna.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_node_record.h" #include "libfsrefs_objects_tree.h" #include "libfsrefs_volume.h" #include "libfsrefs_volume_header.h" /* Creates a volume * Make sure the value volume is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_volume_initialize( libfsrefs_volume_t **volume, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_initialize"; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } if( *volume != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid volume value already set.", function ); return( -1 ); } internal_volume = memory_allocate_structure( libfsrefs_internal_volume_t ); if( internal_volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create volume.", function ); goto on_error; } if( memory_set( internal_volume, 0, sizeof( libfsrefs_internal_volume_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear volume.", function ); memory_free( internal_volume ); return( -1 ); } if( libfsrefs_io_handle_initialize( &( internal_volume->io_handle ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create IO handle.", function ); goto on_error; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_initialize( &( internal_volume->read_write_lock ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to initialize read/write lock.", function ); goto on_error; } #endif *volume = (libfsrefs_volume_t *) internal_volume; return( 1 ); on_error: if( internal_volume != NULL ) { if( internal_volume->io_handle != NULL ) { libfsrefs_io_handle_free( &( internal_volume->io_handle ), NULL ); } memory_free( internal_volume ); } return( -1 ); } /* Frees a volume * Returns 1 if successful or -1 on error */ int libfsrefs_volume_free( libfsrefs_volume_t **volume, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_free"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } if( *volume != NULL ) { internal_volume = (libfsrefs_internal_volume_t *) *volume; if( internal_volume->file_io_handle != NULL ) { if( libfsrefs_volume_close( *volume, error ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_CLOSE_FAILED, "%s: unable to close volume.", function ); result = -1; } } *volume = NULL; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_free( &( internal_volume->read_write_lock ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free read/write lock.", function ); result = -1; } #endif if( libfsrefs_io_handle_free( &( internal_volume->io_handle ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free IO handle.", function ); result = -1; } memory_free( internal_volume ); } return( result ); } /* Signals the volume to abort its current activity * Returns 1 if successful or -1 on error */ int libfsrefs_volume_signal_abort( libfsrefs_volume_t *volume, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_signal_abort"; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; if( internal_volume->io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid volume - missing IO handle.", function ); return( -1 ); } internal_volume->io_handle->abort = 1; return( 1 ); } /* Opens a volume * Returns 1 if successful or -1 on error */ int libfsrefs_volume_open( libfsrefs_volume_t *volume, const char *filename, int access_flags, libcerror_error_t **error ) { libbfio_handle_t *file_io_handle = NULL; libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_open"; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; if( filename == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid filename.", function ); return( -1 ); } if( ( ( access_flags & LIBFSREFS_ACCESS_FLAG_READ ) == 0 ) && ( ( access_flags & LIBFSREFS_ACCESS_FLAG_WRITE ) == 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: unsupported access flags.", function ); return( -1 ); } if( ( access_flags & LIBFSREFS_ACCESS_FLAG_WRITE ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: write access currently not supported.", function ); return( -1 ); } if( libbfio_file_initialize( &file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file IO handle.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libbfio_handle_set_track_offsets_read( file_io_handle, 1, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set track offsets read in file IO handle.", function ); goto on_error; } #endif if( libbfio_file_set_name( file_io_handle, filename, narrow_string_length( filename ) + 1, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set filename in file IO handle.", function ); goto on_error; } if( libfsrefs_volume_open_file_io_handle( volume, file_io_handle, access_flags, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open volume: %s.", function, filename ); goto on_error; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); goto on_error; } #endif internal_volume->file_io_handle_created_in_library = 1; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); internal_volume->file_io_handle_created_in_library = 0; goto on_error; } #endif return( 1 ); on_error: if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } return( -1 ); } #if defined( HAVE_WIDE_CHARACTER_TYPE ) /* Opens a volume * Returns 1 if successful or -1 on error */ int libfsrefs_volume_open_wide( libfsrefs_volume_t *volume, const wchar_t *filename, int access_flags, libcerror_error_t **error ) { libbfio_handle_t *file_io_handle = NULL; libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_open_wide"; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; if( filename == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid filename.", function ); return( -1 ); } if( ( ( access_flags & LIBFSREFS_ACCESS_FLAG_READ ) == 0 ) && ( ( access_flags & LIBFSREFS_ACCESS_FLAG_WRITE ) == 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: unsupported access flags.", function ); return( -1 ); } if( ( access_flags & LIBFSREFS_ACCESS_FLAG_WRITE ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: write access currently not supported.", function ); return( -1 ); } if( libbfio_file_initialize( &file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file IO handle.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libbfio_handle_set_track_offsets_read( file_io_handle, 1, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set track offsets read in file IO handle.", function ); goto on_error; } #endif if( libbfio_file_set_name_wide( file_io_handle, filename, wide_string_length( filename ) + 1, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set filename in file IO handle.", function ); goto on_error; } if( libfsrefs_volume_open_file_io_handle( volume, file_io_handle, access_flags, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open volume: %ls.", function, filename ); goto on_error; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); goto on_error; } #endif internal_volume->file_io_handle_created_in_library = 1; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); internal_volume->file_io_handle_created_in_library = 0; goto on_error; } #endif return( 1 ); on_error: if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } return( -1 ); } #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ /* Opens a volume using a Basic File IO (bfio) handle * Returns 1 if successful or -1 on error */ int libfsrefs_volume_open_file_io_handle( libfsrefs_volume_t *volume, libbfio_handle_t *file_io_handle, int access_flags, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_open_file_io_handle"; uint8_t file_io_handle_opened_in_library = 0; int bfio_access_flags = 0; int file_io_handle_is_open = 0; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; if( internal_volume->file_io_handle != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid volume - file IO handle already set.", function ); return( -1 ); } if( file_io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file IO handle.", function ); return( -1 ); } if( ( ( access_flags & LIBFSREFS_ACCESS_FLAG_READ ) == 0 ) && ( ( access_flags & LIBFSREFS_ACCESS_FLAG_WRITE ) == 0 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: unsupported access flags.", function ); return( -1 ); } if( ( access_flags & LIBFSREFS_ACCESS_FLAG_WRITE ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE, "%s: write access currently not supported.", function ); return( -1 ); } if( ( access_flags & LIBFSREFS_ACCESS_FLAG_READ ) != 0 ) { bfio_access_flags = LIBBFIO_ACCESS_FLAG_READ; } file_io_handle_is_open = libbfio_handle_is_open( file_io_handle, error ); if( file_io_handle_is_open == -1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open volume.", function ); goto on_error; } else if( file_io_handle_is_open == 0 ) { if( libbfio_handle_open( file_io_handle, bfio_access_flags, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open file IO handle.", function ); goto on_error; } file_io_handle_opened_in_library = 1; } if( libfsrefs_internal_volume_open_read( internal_volume, file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read from file IO handle.", function ); goto on_error; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); goto on_error; } #endif internal_volume->file_io_handle = file_io_handle; internal_volume->file_io_handle_opened_in_library = file_io_handle_opened_in_library; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); internal_volume->file_io_handle = NULL; internal_volume->file_io_handle_opened_in_library = 0; goto on_error; } #endif return( 1 ); on_error: if( file_io_handle_opened_in_library != 0 ) { libbfio_handle_close( file_io_handle, error ); } return( -1 ); } /* Closes a volume * Returns 0 if successful or -1 on error */ int libfsrefs_volume_close( libfsrefs_volume_t *volume, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_close"; int result = 0; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; if( internal_volume->file_io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid volume - missing file IO handle.", function ); return( -1 ); } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } #endif #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { if( internal_volume->file_io_handle_created_in_library != 0 ) { if( libfsrefs_debug_print_read_offsets( internal_volume->file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_PRINT_FAILED, "%s: unable to print the read offsets.", function ); result = -1; } } } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( internal_volume->file_io_handle_opened_in_library != 0 ) { if( libbfio_handle_close( internal_volume->file_io_handle, error ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_CLOSE_FAILED, "%s: unable to close file IO handle.", function ); result = -1; } internal_volume->file_io_handle_opened_in_library = 0; } if( internal_volume->file_io_handle_created_in_library != 0 ) { if( libbfio_handle_free( &( internal_volume->file_io_handle ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free file IO handle.", function ); result = -1; } internal_volume->file_io_handle_created_in_library = 0; } internal_volume->file_io_handle = NULL; if( libfsrefs_io_handle_clear( internal_volume->io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to clear IO handle.", function ); result = -1; } if( internal_volume->volume_header != NULL ) { if( libfsrefs_volume_header_free( &( internal_volume->volume_header ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free volume header.", function ); result = -1; } } if( internal_volume->file_system != NULL ) { if( libfsrefs_file_system_free( &( internal_volume->file_system ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free file system.", function ); result = -1; } } if( internal_volume->objects_tree != NULL ) { if( libfsrefs_objects_tree_free( &( internal_volume->objects_tree ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free objects tree.", function ); result = -1; } } if( internal_volume->volume_information_object != NULL ) { if( libfsrefs_ministore_node_free( &( internal_volume->volume_information_object ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free volume information object.", function ); result = -1; } internal_volume->volume_name_record = NULL; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); return( -1 ); } #endif return( result ); } /* Opens a volume for reading * Returns 1 if successful or -1 on error */ int libfsrefs_internal_volume_open_read( libfsrefs_internal_volume_t *internal_volume, libbfio_handle_t *file_io_handle, libcerror_error_t **error ) { static char *function = "libfsrefs_internal_volume_open_read"; off64_t superblock_offset = 0; int number_of_ministore_trees = 0; if( internal_volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } if( internal_volume->io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid volume - missing IO handle.", function ); return( -1 ); } if( internal_volume->file_system != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid volume - file system value already set.", function ); return( -1 ); } if( internal_volume->objects_tree != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid volume - objects tree value already set.", function ); return( -1 ); } if( internal_volume->volume_header != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid volume - volume header value already set.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "Reading volume header:\n" ); } #endif if( libfsrefs_volume_header_initialize( &( internal_volume->volume_header ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create volume header.", function ); goto on_error; } if( libfsrefs_volume_header_read_file_io_handle( internal_volume->volume_header, file_io_handle, 0, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read volume header at offset: 0 (0x00000000).", function ); goto on_error; } internal_volume->io_handle->bytes_per_sector = internal_volume->volume_header->bytes_per_sector; internal_volume->io_handle->volume_size = internal_volume->volume_header->volume_size; internal_volume->io_handle->major_format_version = internal_volume->volume_header->major_format_version; internal_volume->io_handle->minor_format_version = internal_volume->volume_header->minor_format_version; internal_volume->io_handle->cluster_block_size = internal_volume->volume_header->cluster_block_size; internal_volume->io_handle->metadata_block_size = internal_volume->volume_header->metadata_block_size; internal_volume->io_handle->container_size = internal_volume->volume_header->container_size; if( libfsrefs_file_system_initialize( &( internal_volume->file_system ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file system.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "Reading superblock:\n" ); } #endif superblock_offset = 30 * internal_volume->io_handle->metadata_block_size; if( libfsrefs_file_system_read_superblock( internal_volume->file_system, internal_volume->io_handle, file_io_handle, superblock_offset, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read superblock at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, superblock_offset, superblock_offset ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "Reading checkpoints:\n" ); } #endif if( libfsrefs_file_system_read_checkpoints( internal_volume->file_system, internal_volume->io_handle, file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read checkpoints.", function ); goto on_error; } if( libfsrefs_file_system_get_number_of_ministore_trees( internal_volume->file_system, &number_of_ministore_trees, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve number of ministore trees.", function ); goto on_error; } if( number_of_ministore_trees == 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid number of ministore trees value out of bounds.", function ); goto on_error; } if( number_of_ministore_trees > 8 ) { #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "Reading container trees:\n" ); } #endif if( libfsrefs_file_system_read_container_trees( internal_volume->file_system, internal_volume->io_handle, file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read container trees.", function ); goto on_error; } } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "Reading objects tree\n" ); } #endif if( libfsrefs_objects_tree_initialize( &( internal_volume->objects_tree ), internal_volume->file_system, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create objects tree.", function ); goto on_error; } if( libfsrefs_objects_tree_read( internal_volume->objects_tree, internal_volume->io_handle, file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read objects tree.", function ); goto on_error; } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "Reading volume information object\n" ); } #endif if( libfsrefs_objects_tree_get_ministore_tree_by_identifier( internal_volume->objects_tree, internal_volume->io_handle, file_io_handle, (uint64_t) 0x00000500UL, &( internal_volume->volume_information_object ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve volume information object from objects tree.", function ); goto on_error; } return( 1 ); on_error: if( internal_volume->volume_information_object != NULL ) { libfsrefs_ministore_node_free( &( internal_volume->volume_information_object ), NULL ); } if( internal_volume->objects_tree != NULL ) { libfsrefs_objects_tree_free( &( internal_volume->objects_tree ), NULL ); } if( internal_volume->file_system != NULL ) { libfsrefs_file_system_free( &( internal_volume->file_system ), NULL ); } if( internal_volume->volume_header != NULL ) { libfsrefs_volume_header_free( &( internal_volume->volume_header ), NULL ); } return( -1 ); } /* Retrieves the bytes per sector * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_bytes_per_sector( libfsrefs_volume_t *volume, uint16_t *bytes_per_sector, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_bytes_per_sector"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( libfsrefs_volume_header_get_bytes_per_sector( internal_volume->volume_header, bytes_per_sector, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve bytes per sector.", function ); result = -1; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the cluster block size * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_cluster_block_size( libfsrefs_volume_t *volume, size32_t *cluster_block_size, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_cluster_block_size"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( libfsrefs_volume_header_get_cluster_block_size( internal_volume->volume_header, cluster_block_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve cluster block size.", function ); result = -1; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the volume name record * Returns 1 if successful or -1 on error */ int libfsrefs_internal_volume_get_volume_name_record( libfsrefs_internal_volume_t *internal_volume, libcerror_error_t **error ) { uint8_t key_data[ 8 ]; static char *function = "libfsrefs_internal_volume_get_volume_name_record"; uint64_t object_identifier = 0x00000510UL; if( internal_volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } if( internal_volume->volume_name_record != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid volume - volume name record already set.", function ); return( -1 ); } byte_stream_copy_from_uint64_little_endian( key_data, object_identifier ); if( libfsrefs_ministore_node_get_record_by_key( internal_volume->volume_information_object, key_data, 8, &( internal_volume->volume_name_record ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve identifier: 0x%08" PRIx64 " from volume information object.", function, object_identifier ); return( -1 ); } return( 1 ); } /* Retrieves the size of the UTF-8 encoded name * The returned size includes the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_utf8_name_size( libfsrefs_volume_t *volume, size_t *utf8_string_size, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_utf8_name_size"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } #endif if( internal_volume->volume_name_record == NULL ) { if( libfsrefs_internal_volume_get_volume_name_record( internal_volume, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve volume name record.", function ); result = -1; } } if( internal_volume->volume_name_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid volume - missing volume name record.", function ); result = -1; } else if( libuna_utf8_string_size_from_utf16_stream( internal_volume->volume_name_record->value_data, internal_volume->volume_name_record->value_data_size, LIBUNA_ENDIAN_LITTLE, utf8_string_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size of UTF-8 name from volume name record.", function ); result = -1; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the UTF-8 encoded name value * The size should include the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_utf8_name( libfsrefs_volume_t *volume, uint8_t *utf8_string, size_t utf8_string_size, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_utf8_name"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } #endif if( internal_volume->volume_name_record == NULL ) { if( libfsrefs_internal_volume_get_volume_name_record( internal_volume, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve volume name record.", function ); result = -1; } } if( internal_volume->volume_name_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid volume - missing volume name record.", function ); result = -1; } else if( libuna_utf8_string_copy_from_utf16_stream( utf8_string, utf8_string_size, internal_volume->volume_name_record->value_data, internal_volume->volume_name_record->value_data_size, LIBUNA_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve UTF-8 name from volume name record.", function ); result = -1; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the size of the UTF-16 encoded name * The returned size includes the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_utf16_name_size( libfsrefs_volume_t *volume, size_t *utf16_string_size, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_utf16_name_size"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } #endif if( internal_volume->volume_name_record == NULL ) { if( libfsrefs_internal_volume_get_volume_name_record( internal_volume, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve volume name record.", function ); result = -1; } } if( internal_volume->volume_name_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid volume - missing volume name record.", function ); result = -1; } else if( libuna_utf16_string_size_from_utf16_stream( internal_volume->volume_name_record->value_data, internal_volume->volume_name_record->value_data_size, LIBUNA_ENDIAN_LITTLE, utf16_string_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve size of UTF-16 name from volume name record.", function ); result = -1; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the UTF-16 encoded name value * The size should include the end of string character * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_utf16_name( libfsrefs_volume_t *volume, uint16_t *utf16_string, size_t utf16_string_size, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_utf16_name"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } #endif if( internal_volume->volume_name_record == NULL ) { if( libfsrefs_internal_volume_get_volume_name_record( internal_volume, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve volume name record.", function ); result = -1; } } if( internal_volume->volume_name_record == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid volume - missing volume name record.", function ); result = -1; } else if( libuna_utf16_string_copy_from_utf16_stream( utf16_string, utf16_string_size, internal_volume->volume_name_record->value_data, internal_volume->volume_name_record->value_data_size, LIBUNA_ENDIAN_LITTLE, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve UTF-16 name from volume name record.", function ); result = -1; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the format version * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_version( libfsrefs_volume_t *volume, uint8_t *major_version, uint8_t *minor_version, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_version"; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; if( internal_volume->io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid volume - missing IO handle.", function ); return( -1 ); } if( major_version == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid major version.", function ); return( -1 ); } if( minor_version == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid minor version.", function ); return( -1 ); } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif *major_version = internal_volume->io_handle->major_format_version; *minor_version = internal_volume->io_handle->minor_format_version; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( 1 ); } /* Retrieves the serial number * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_serial_number( libfsrefs_volume_t *volume, uint64_t *serial_number, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_serial_number"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_read( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for reading.", function ); return( -1 ); } #endif if( libfsrefs_volume_header_get_volume_serial_number( internal_volume->volume_header, serial_number, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_GET_FAILED, "%s: unable to retrieve volume serial number.", function ); result = -1; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_read( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for reading.", function ); return( -1 ); } #endif return( result ); } /* Retrieves the root directory file entry * Returns 1 if successful or -1 on error */ int libfsrefs_volume_get_root_directory( libfsrefs_volume_t *volume, libfsrefs_file_entry_t **file_entry, libcerror_error_t **error ) { libfsrefs_internal_volume_t *internal_volume = NULL; static char *function = "libfsrefs_volume_get_root_directory"; int result = 1; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } internal_volume = (libfsrefs_internal_volume_t *) volume; if( file_entry == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file entry.", function ); return( -1 ); } if( *file_entry != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid file entry value already set.", function ); return( -1 ); } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_grab_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to grab read/write lock for writing.", function ); return( -1 ); } #endif if( libfsrefs_file_entry_initialize( file_entry, internal_volume->io_handle, internal_volume->file_io_handle, internal_volume->objects_tree, NULL, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create root directory file entry.", function ); result = -1; } #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) if( libcthreads_read_write_lock_release_for_write( internal_volume->read_write_lock, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to release read/write lock for writing.", function ); return( -1 ); } #endif return( result ); } ================================================ FILE: libfsrefs/libfsrefs_volume.h ================================================ /* * Volume functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_INTERNAL_VOLUME_H ) #define _LIBFSREFS_INTERNAL_VOLUME_H #include #include #include "libfsrefs_extern.h" #include "libfsrefs_file_system.h" #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcthreads.h" #include "libfsrefs_libfcache.h" #include "libfsrefs_libfdata.h" #include "libfsrefs_ministore_node.h" #include "libfsrefs_node_record.h" #include "libfsrefs_objects_tree.h" #include "libfsrefs_types.h" #include "libfsrefs_volume_header.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_internal_volume libfsrefs_internal_volume_t; struct libfsrefs_internal_volume { /* The volume header */ libfsrefs_volume_header_t *volume_header; /* The file system */ libfsrefs_file_system_t *file_system; /* The objects tree */ libfsrefs_objects_tree_t *objects_tree; /* The volume information object */ libfsrefs_ministore_node_t *volume_information_object; /* The volume name record */ libfsrefs_node_record_t *volume_name_record; /* The IO handle */ libfsrefs_io_handle_t *io_handle; /* The file IO handle */ libbfio_handle_t *file_io_handle; /* Value to indicate if the file IO handle was created inside the library */ uint8_t file_io_handle_created_in_library; /* Value to indicate if the file IO handle was opened inside the library */ uint8_t file_io_handle_opened_in_library; #if defined( HAVE_LIBFSREFS_MULTI_THREAD_SUPPORT ) /* The read/write lock */ libcthreads_read_write_lock_t *read_write_lock; #endif }; LIBFSREFS_EXTERN \ int libfsrefs_volume_initialize( libfsrefs_volume_t **volume, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_free( libfsrefs_volume_t **volume, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_signal_abort( libfsrefs_volume_t *volume, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_open( libfsrefs_volume_t *volume, const char *filename, int access_flags, libcerror_error_t **error ); #if defined( HAVE_WIDE_CHARACTER_TYPE ) LIBFSREFS_EXTERN \ int libfsrefs_volume_open_wide( libfsrefs_volume_t *volume, const wchar_t *filename, int access_flags, libcerror_error_t **error ); #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ LIBFSREFS_EXTERN \ int libfsrefs_volume_open_file_io_handle( libfsrefs_volume_t *volume, libbfio_handle_t *file_io_handle, int access_flags, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_close( libfsrefs_volume_t *volume, libcerror_error_t **error ); int libfsrefs_internal_volume_open_read( libfsrefs_internal_volume_t *internal_volume, libbfio_handle_t *file_io_handle, libcerror_error_t **error ); int libfsrefs_internal_volume_get_volume_name_record( libfsrefs_internal_volume_t *internal_volume, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_bytes_per_sector( libfsrefs_volume_t *volume, uint16_t *bytes_per_sector, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_cluster_block_size( libfsrefs_volume_t *volume, size32_t *cluster_block_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_utf8_name_size( libfsrefs_volume_t *volume, size_t *utf8_string_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_utf8_name( libfsrefs_volume_t *volume, uint8_t *utf8_string, size_t utf8_string_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_utf16_name_size( libfsrefs_volume_t *volume, size_t *utf16_string_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_utf16_name( libfsrefs_volume_t *volume, uint16_t *utf16_string, size_t utf16_string_size, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_version( libfsrefs_volume_t *volume, uint8_t *major_version, uint8_t *minor_version, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_serial_number( libfsrefs_volume_t *volume, uint64_t *serial_number, libcerror_error_t **error ); LIBFSREFS_EXTERN \ int libfsrefs_volume_get_root_directory( libfsrefs_volume_t *volume, libfsrefs_file_entry_t **file_entry, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_INTERNAL_VOLUME_H ) */ ================================================ FILE: libfsrefs/libfsrefs_volume_header.c ================================================ /* * The REFS volume header functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include "libfsrefs_io_handle.h" #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #include "libfsrefs_libcnotify.h" #include "libfsrefs_volume_header.h" #include "fsrefs_volume_header.h" /* Creates a volume header * Make sure the value volume_header is referencing, is set to NULL * Returns 1 if successful or -1 on error */ int libfsrefs_volume_header_initialize( libfsrefs_volume_header_t **volume_header, libcerror_error_t **error ) { static char *function = "libfsrefs_volume_header_initialize"; if( volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume header.", function ); return( -1 ); } if( *volume_header != NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET, "%s: invalid volume header value already set.", function ); return( -1 ); } *volume_header = memory_allocate_structure( libfsrefs_volume_header_t ); if( *volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_INSUFFICIENT, "%s: unable to create volume header.", function ); goto on_error; } if( memory_set( *volume_header, 0, sizeof( libfsrefs_volume_header_t ) ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_SET_FAILED, "%s: unable to clear volume header.", function ); goto on_error; } return( 1 ); on_error: if( *volume_header != NULL ) { memory_free( *volume_header ); *volume_header = NULL; } return( -1 ); } /* Frees a volume header * Returns 1 if successful or -1 on error */ int libfsrefs_volume_header_free( libfsrefs_volume_header_t **volume_header, libcerror_error_t **error ) { static char *function = "libfsrefs_volume_header_free"; if( volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume header.", function ); return( -1 ); } if( *volume_header != NULL ) { memory_free( *volume_header ); *volume_header = NULL; } return( 1 ); } /* Reads the volume header * Returns 1 if successful or -1 on error */ int libfsrefs_volume_header_read_data( libfsrefs_volume_header_t *volume_header, const uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "libfsrefs_volume_header_read_data"; uint64_t number_of_sectors = 0; uint32_t sectors_per_cluster_block = 0; #if defined( HAVE_DEBUG_OUTPUT ) uint64_t value_64bit = 0; uint32_t value_32bit = 0; uint16_t value_16bit = 0; #endif if( volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume header.", function ); return( -1 ); } if( data == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_MISSING, "%s: invalid data.", function ); return( -1 ); } if( ( data_size < sizeof( fsrefs_volume_header_t ) ) || ( data_size > (size_t) SSIZE_MAX ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid data size value out of bounds.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: volume header data:\n", function ); libcnotify_print_data( data, sizeof( fsrefs_volume_header_t ), LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif if( memory_compare( ( (fsrefs_volume_header_t *) data )->file_system_signature, fsrefs_volume_file_system_signature, 8 ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: invalid volume system signature.", function ); return( -1 ); } byte_stream_copy_to_uint64_little_endian( ( (fsrefs_volume_header_t *) data )->number_of_sectors, number_of_sectors ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_volume_header_t *) data )->bytes_per_sector, volume_header->bytes_per_sector ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_volume_header_t *) data )->sectors_per_cluster_block, sectors_per_cluster_block ); volume_header->major_format_version = ( (fsrefs_volume_header_t *) data )->major_format_version; volume_header->minor_format_version = ( (fsrefs_volume_header_t *) data )->minor_format_version; byte_stream_copy_to_uint64_little_endian( ( (fsrefs_volume_header_t *) data )->volume_serial_number, volume_header->volume_serial_number ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_volume_header_t *) data )->container_size, volume_header->container_size ); #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: unknown1\n", function ); libcnotify_print_data( ( (fsrefs_volume_header_t *) data )->unknown1, 3, 0 ); libcnotify_printf( "%s: file system signature\t\t: %c%c%c%c\n", function, ( (fsrefs_volume_header_t *) data )->file_system_signature[ 0 ], ( (fsrefs_volume_header_t *) data )->file_system_signature[ 1 ], ( (fsrefs_volume_header_t *) data )->file_system_signature[ 2 ], ( (fsrefs_volume_header_t *) data )->file_system_signature[ 3 ] ); libcnotify_printf( "%s: unknown2\n", function ); libcnotify_print_data( ( (fsrefs_volume_header_t *) data )->unknown2, 9, 0 ); libcnotify_printf( "%s: unknown3\t\t\t\t: %c%c%c%c\n", function, ( (fsrefs_volume_header_t *) data )->unknown3[ 0 ], ( (fsrefs_volume_header_t *) data )->unknown3[ 1 ], ( (fsrefs_volume_header_t *) data )->unknown3[ 2 ], ( (fsrefs_volume_header_t *) data )->unknown3[ 3 ] ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_volume_header_t *) data )->unknown4, value_16bit ); libcnotify_printf( "%s: unknown4\t\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_volume_header_t *) data )->checksum, value_16bit ); libcnotify_printf( "%s: checksum\t\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); libcnotify_printf( "%s: number of sectors\t\t\t: %" PRIu64 "\n", function, number_of_sectors ); libcnotify_printf( "%s: bytes per sector\t\t\t: %" PRIu32 "\n", function, volume_header->bytes_per_sector ); libcnotify_printf( "%s: sectors per cluster block\t\t: %" PRIu32 "\n", function, sectors_per_cluster_block ); libcnotify_printf( "%s: major format version\t\t\t: %" PRIu8 "\n", function, volume_header->major_format_version ); libcnotify_printf( "%s: minor format version\t\t\t: %" PRIu8 "\n", function, volume_header->minor_format_version ); byte_stream_copy_to_uint16_little_endian( ( (fsrefs_volume_header_t *) data )->unknown7, value_16bit ); libcnotify_printf( "%s: unknown7\t\t\t\t: 0x%04" PRIx16 "\n", function, value_16bit ); byte_stream_copy_to_uint32_little_endian( ( (fsrefs_volume_header_t *) data )->unknown8, value_32bit ); libcnotify_printf( "%s: unknown8\t\t\t\t: 0x%08" PRIx32 "\n", function, value_32bit ); byte_stream_copy_to_uint64_little_endian( ( (fsrefs_volume_header_t *) data )->unknown9, value_64bit ); libcnotify_printf( "%s: unknown9\t\t\t\t: 0x%08" PRIx64 "\n", function, value_64bit ); libcnotify_printf( "%s: volume serial number\t\t\t: 0x%08" PRIx64 "\n", function, volume_header->volume_serial_number ); libcnotify_printf( "%s: container size\t\t\t: %" PRIu64 "\n", function, volume_header->container_size ); libcnotify_printf( "%s: unknown11\n", function ); libcnotify_print_data( ( (fsrefs_volume_header_t *) data )->unknown11, 440, LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ if( ( volume_header->bytes_per_sector != 256 ) && ( volume_header->bytes_per_sector != 512 ) && ( volume_header->bytes_per_sector != 1024 ) && ( volume_header->bytes_per_sector != 2048 ) && ( volume_header->bytes_per_sector != 4096 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported bytes per sector: %" PRIu16 ".", function, volume_header->bytes_per_sector ); return( -1 ); } if( number_of_sectors > (size64_t) ( ( UINT64_MAX / volume_header->bytes_per_sector ) + 1 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid number of sectors value out of bounds.", function ); return( -1 ); } volume_header->volume_size = number_of_sectors * volume_header->bytes_per_sector; volume_header->volume_size += volume_header->bytes_per_sector; if( sectors_per_cluster_block > (size32_t) ( UINT32_MAX / volume_header->bytes_per_sector ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid sectors per cluster block value out of bounds.", function ); return( -1 ); } volume_header->cluster_block_size = (size32_t) sectors_per_cluster_block * volume_header->bytes_per_sector; if( ( volume_header->cluster_block_size != 4096 ) && ( volume_header->cluster_block_size != 65536 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported cluster block size: %" PRIu32 ".", function, volume_header->cluster_block_size ); return( -1 ); } if( ( volume_header->major_format_version != 1 ) && ( volume_header->major_format_version != 3 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported format version: %" PRIu8 ".%" PRIu8 ".", function, volume_header->major_format_version, volume_header->minor_format_version ); return( -1 ); } if( volume_header->major_format_version == 1 ) { volume_header->metadata_block_size = 16 * 1024; } else if( volume_header->major_format_version == 3 ) { volume_header->metadata_block_size = volume_header->cluster_block_size; if( volume_header->container_size == 0 ) { volume_header->container_size = 0x4000; } else { volume_header->container_size /= volume_header->cluster_block_size; } } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: cluster block size\t\t\t: %" PRIu32 "\n", function, volume_header->cluster_block_size ); libcnotify_printf( "%s: metadata block size\t\t\t: %" PRIu32 "\n", function, volume_header->metadata_block_size ); libcnotify_printf( "%s: container size\t\t\t: %" PRIu64 " blocks\n", function, volume_header->container_size ); libcnotify_printf( "\n" ); } #endif /* defined( HAVE_DEBUG_OUTPUT ) */ return( 1 ); } /* Reads the volume header * Returns 1 if successful or -1 on error */ int libfsrefs_volume_header_read_file_io_handle( libfsrefs_volume_header_t *volume_header, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ) { uint8_t volume_header_data[ sizeof( fsrefs_volume_header_t ) ]; static char *function = "libfsrefs_volume_header_read_file_io_handle"; ssize_t read_count = 0; if( volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume header.", function ); return( -1 ); } #if defined( HAVE_DEBUG_OUTPUT ) if( libcnotify_verbose != 0 ) { libcnotify_printf( "%s: reading volume header at offset: %" PRIi64 " (0x%08" PRIx64 ")\n", function, file_offset, file_offset ); } #endif read_count = libbfio_handle_read_buffer_at_offset( file_io_handle, volume_header_data, sizeof( fsrefs_volume_header_t ), file_offset, error ); if( read_count != (ssize_t) sizeof( fsrefs_volume_header_t ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read volume header data at offset: %" PRIi64 " (0x%08" PRIx64 ").", function, file_offset, file_offset ); return( -1 ); } if( libfsrefs_volume_header_read_data( volume_header, volume_header_data, sizeof( fsrefs_volume_header_t ), error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_READ_FAILED, "%s: unable to read volume header data.", function ); return( -1 ); } return( 1 ); } /* Retrieves the bytes per sector * Returns 1 if successful or -1 on error */ int libfsrefs_volume_header_get_bytes_per_sector( libfsrefs_volume_header_t *volume_header, uint16_t *bytes_per_sector, libcerror_error_t **error ) { static char *function = "libfsrefs_volume_header_get_bytes_per_sector"; if( volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume header.", function ); return( -1 ); } if( bytes_per_sector == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid bytes per sector.", function ); return( -1 ); } *bytes_per_sector = volume_header->bytes_per_sector; return( 1 ); } /* Retrieves the cluster block size * Returns 1 if successful or -1 on error */ int libfsrefs_volume_header_get_cluster_block_size( libfsrefs_volume_header_t *volume_header, size32_t *cluster_block_size, libcerror_error_t **error ) { static char *function = "libfsrefs_volume_header_get_cluster_block_size"; if( volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume header.", function ); return( -1 ); } if( cluster_block_size == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid cluster block size.", function ); return( -1 ); } *cluster_block_size = volume_header->cluster_block_size; return( 1 ); } /* Retrieves the volume size * Returns 1 if successful or -1 on error */ int libfsrefs_volume_header_get_volume_size( libfsrefs_volume_header_t *volume_header, size64_t *volume_size, libcerror_error_t **error ) { static char *function = "libfsrefs_volume_header_get_volume_size"; if( volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume header.", function ); return( -1 ); } if( volume_size == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume size.", function ); return( -1 ); } *volume_size = volume_header->volume_size; return( 1 ); } /* Retrieves the volume serial number * Returns 1 if successful or -1 on error */ int libfsrefs_volume_header_get_volume_serial_number( libfsrefs_volume_header_t *volume_header, uint64_t *volume_serial_number, libcerror_error_t **error ) { static char *function = "libfsrefs_volume_header_get_volume_serial_number"; if( volume_header == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume header.", function ); return( -1 ); } if( volume_serial_number == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume serial number.", function ); return( -1 ); } *volume_serial_number = volume_header->volume_serial_number; return( 1 ); } ================================================ FILE: libfsrefs/libfsrefs_volume_header.h ================================================ /* * The REFS volume header functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _LIBFSREFS_VOLUME_HEADER_H ) #define _LIBFSREFS_VOLUME_HEADER_H #include #include #include "libfsrefs_libbfio.h" #include "libfsrefs_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif typedef struct libfsrefs_volume_header libfsrefs_volume_header_t; struct libfsrefs_volume_header { /* The number of bytes per sector */ uint32_t bytes_per_sector; /* The volume size */ size64_t volume_size; /* The major format version */ uint8_t major_format_version; /* The minor format version */ uint8_t minor_format_version; /* The volume serial number */ uint64_t volume_serial_number; /* The cluster block size */ size32_t cluster_block_size; /* The metadata block size */ size32_t metadata_block_size; /* The container size */ size64_t container_size; }; int libfsrefs_volume_header_initialize( libfsrefs_volume_header_t **volume_header, libcerror_error_t **error ); int libfsrefs_volume_header_free( libfsrefs_volume_header_t **volume_header, libcerror_error_t **error ); int libfsrefs_volume_header_read_data( libfsrefs_volume_header_t *volume_header, const uint8_t *data, size_t data_size, libcerror_error_t **error ); int libfsrefs_volume_header_read_file_io_handle( libfsrefs_volume_header_t *volume_header, libbfio_handle_t *file_io_handle, off64_t file_offset, libcerror_error_t **error ); int libfsrefs_volume_header_get_bytes_per_sector( libfsrefs_volume_header_t *volume_header, uint16_t *bytes_per_sector, libcerror_error_t **error ); int libfsrefs_volume_header_get_cluster_block_size( libfsrefs_volume_header_t *volume_header, size32_t *cluster_block_size, libcerror_error_t **error ); int libfsrefs_volume_header_get_volume_size( libfsrefs_volume_header_t *volume_header, size64_t *volume_size, libcerror_error_t **error ); int libfsrefs_volume_header_get_volume_serial_number( libfsrefs_volume_header_t *volume_header, uint64_t *volume_serial_number, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _LIBFSREFS_VOLUME_HEADER_H ) */ ================================================ FILE: libfsrefs.ini ================================================ [project] description: "libfsrefs is a library to access the Resilient File System (ReFS)." name: "libfsrefs" status: "experimental" year_of_creation: "2012" documentation_url: "https://github.com/libyal/libfsrefs/tree/main/documentation" features: ["debug_output", "ossfuzz", "tools"] [library] description: "Library to access the Resiliant File System (ReFS) format" features: ["pthread", "wide_character_type"] public_types: ["file_entry", "volume"] [tools] description: "Several tools for reading Resiliant File System (ReFS) volumes" names: ["fsrefsinfo"] [info_tool] source_description: "a Resiliant File System (ReFS) volume" source_type: "volume" [tests] profiles: ["libfsrefs", "fsrefsinfo"] option_sets: ["offset"] info_tool_option_sets: ["offset"] info_tool_options_per_profile: [""] info_tool_profiles: ["fsrefsinfo"] ================================================ FILE: libfsrefs.pc.in ================================================ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: libfsrefs Description: Library to access the Resiliant File System (ReFS) format Version: @VERSION@ Libs: -L${libdir} -lfsrefs 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_libfdatetime_pc_libs_private@ @ax_libfguid_pc_libs_private@ @ax_libfwnt_pc_libs_private@ @ax_libuna_pc_libs_private@ @ax_pthread_pc_libs_private@ Cflags: -I${includedir} ================================================ FILE: libfsrefs.spec.in ================================================ Name: libfsrefs Version: @VERSION@ Release: 1 Summary: Library to access the Resiliant File System (ReFS) format Group: System Environment/Libraries License: LGPL-3.0-or-later Source: %{name}-%{version}.tar.gz URL: https://github.com/libyal/libfsrefs @libfsrefs_spec_requires@ @ax_libbfio_spec_requires@ @ax_libcdata_spec_requires@ @ax_libcerror_spec_requires@ @ax_libcfile_spec_requires@ @ax_libclocale_spec_requires@ @ax_libcnotify_spec_requires@ @ax_libcpath_spec_requires@ @ax_libcsplit_spec_requires@ @ax_libcthreads_spec_requires@ @ax_libfcache_spec_requires@ @ax_libfdata_spec_requires@ @ax_libfdatetime_spec_requires@ @ax_libfguid_spec_requires@ @ax_libfwnt_spec_requires@ @ax_libuna_spec_requires@ BuildRequires: gcc @ax_libbfio_spec_build_requires@ @ax_libcdata_spec_build_requires@ @ax_libcerror_spec_build_requires@ @ax_libcfile_spec_build_requires@ @ax_libclocale_spec_build_requires@ @ax_libcnotify_spec_build_requires@ @ax_libcpath_spec_build_requires@ @ax_libcsplit_spec_build_requires@ @ax_libcthreads_spec_build_requires@ @ax_libfcache_spec_build_requires@ @ax_libfdata_spec_build_requires@ @ax_libfdatetime_spec_build_requires@ @ax_libfguid_spec_build_requires@ @ax_libfwnt_spec_build_requires@ @ax_libuna_spec_build_requires@ %description -n libfsrefs Library to access the Resiliant File System (ReFS) format %package -n libfsrefs-static Summary: Library to access the Resiliant File System (ReFS) format Group: Development/Libraries Requires: libfsrefs = %{version}-%{release} %description -n libfsrefs-static Static library version of libfsrefs. %package -n libfsrefs-devel Summary: Header files and libraries for developing applications for libfsrefs Group: Development/Libraries Requires: libfsrefs = %{version}-%{release} %description -n libfsrefs-devel Header files and libraries for developing applications for libfsrefs. %package -n libfsrefs-tools Summary: Several tools for reading Resiliant File System (ReFS) volumes Group: Applications/System Requires: libfsrefs = %{version}-%{release} @ax_libfusn_spec_requires@ @libfsrefs_spec_tools_build_requires@ @ax_libfusn_spec_build_requires@ %description -n libfsrefs-tools Several tools for reading Resiliant File System (ReFS) volumes %prep %setup -q %build %configure --prefix=/usr --libdir=%{_libdir} --mandir=%{_mandir} make %{?_smp_mflags} %install rm -rf %{buildroot} %make_install %clean rm -rf %{buildroot} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files -n libfsrefs %license COPYING COPYING.LESSER %doc AUTHORS README %{_libdir}/*.so.* %files -n libfsrefs-static %license COPYING COPYING.LESSER %doc AUTHORS README %{_libdir}/*.a %files -n libfsrefs-devel %license COPYING COPYING.LESSER %doc AUTHORS README %{_libdir}/*.so %{_libdir}/pkgconfig/libfsrefs.pc %{_includedir}/* %{_mandir}/man3/* %files -n libfsrefs-tools %license COPYING COPYING.LESSER %doc AUTHORS README %{_bindir}/* %{_mandir}/man1/* %changelog * @SPEC_DATE@ Joachim Metz @VERSION@-1 - Auto-generated ================================================ FILE: m4/common.m4 ================================================ dnl Checks for common headers and functions dnl dnl Version: 20241013 dnl Function to test if a certain feature was disabled AC_DEFUN([AX_COMMON_ARG_DISABLE], [AC_ARG_ENABLE( [$1], [AS_HELP_STRING( [--disable-$1], [$3])], [ac_cv_enable_$2=$enableval], [ac_cv_enable_$2="yes"])dnl AC_CACHE_CHECK( [whether to disable $3], [ac_cv_enable_$2], [ac_cv_enable_$2="yes"])dnl ]) dnl Function to test if a certain feature was enabled AC_DEFUN([AX_COMMON_ARG_ENABLE], [AC_ARG_ENABLE( [$1], [AS_HELP_STRING( [--enable-$1], [$3 @<:@default=$4@:>@])], [ac_cv_enable_$2=$enableval], [ac_cv_enable_$2=$4])dnl AC_CACHE_CHECK( [whether to enable $3], [ac_cv_enable_$2], [ac_cv_enable_$2=$4])dnl ]) dnl Function to test if the location of a certain feature was provided AC_DEFUN([AX_COMMON_ARG_WITH], [AC_ARG_WITH( [$1], [AS_HELP_STRING( [--with-$1[[=$5]]], [$3 @<:@default=$4@:>@])], [ac_cv_with_$2=$withval], [ac_cv_with_$2=$4])dnl AC_CACHE_CHECK( [whether to use $3], [ac_cv_with_$2], [ac_cv_with_$2=$4])dnl ]) dnl Function to detect whether shared library support should be disabled AC_DEFUN([AX_COMMON_CHECK_DISABLE_SHARED_LIBS], [AX_COMMON_ARG_DISABLE( [shared-libs], [shared_libs], [disable shared library support]) ]) dnl Function to detect whether debug output should be enabled AC_DEFUN([AX_COMMON_CHECK_ENABLE_DEBUG_OUTPUT], [AX_COMMON_ARG_ENABLE( [debug-output], [debug_output], [enable debug output], [no]) AS_IF( [test "x$ac_cv_enable_debug_output" != xno ], [AC_DEFINE( [HAVE_DEBUG_OUTPUT], [1], [Define to 1 if debug output should be used.]) ac_cv_enable_debug_output=yes]) ]) dnl Function to detect whether static executables support should be enabled AC_DEFUN([AX_COMMON_CHECK_ENABLE_STATIC_EXECUTABLES], [AX_COMMON_ARG_ENABLE( [static-executables], [static_executables], [build static executables (binaries)], [no]) AS_IF( [test "x$ac_cv_enable_static_executables" != xno], [STATIC_LDFLAGS="-all-static"; AC_SUBST( [STATIC_LDFLAGS]) ac_cv_enable_static_executables=yes enable_shared=no]) ]) dnl Function to detect whether verbose output should be enabled AC_DEFUN([AX_COMMON_CHECK_ENABLE_VERBOSE_OUTPUT], [AX_COMMON_ARG_ENABLE( [verbose-output], [verbose_output], [enable verbose output], [no]) AS_IF( [test "x$ac_cv_enable_verbose_output" != xno ], [AC_DEFINE( [HAVE_VERBOSE_OUTPUT], [1], [Define to 1 if verbose output should be used.]) ac_cv_enable_verbose_output=yes]) ]) dnl Function to detect whether wide character type support should be enabled AC_DEFUN([AX_COMMON_CHECK_ENABLE_WIDE_CHARACTER_TYPE], [AX_COMMON_ARG_ENABLE( [wide-character-type], [wide_character_type], [enable wide character type support], [no]) ]) dnl Function to detect whether WINAPI support should be enabled AC_DEFUN([AX_COMMON_CHECK_ENABLE_WINAPI], [AX_COMMON_ARG_ENABLE( [winapi], [winapi], [enable WINAPI support for cross-compilation], [auto-detect]) AS_IF( [test "x$ac_cv_enable_winapi" = xauto-detect], [ac_common_check_winapi_target_string="$target" AS_IF( [test "x$ac_common_check_winapi_target_string" = x], [ac_common_check_winapi_target_string="$host"]) AS_CASE( [$ac_common_check_winapi_target_string], [*mingw*],[AC_MSG_NOTICE( [detected MinGW enabling WINAPI support for cross-compilation]) ac_cv_enable_winapi=yes], [*msys*],[AC_MSG_NOTICE( [detected MSYS enabling WINAPI support for cross-compilation]) ac_cv_enable_winapi=yes], [*],[ac_cv_enable_winapi=no]) ]) ]) dnl Function to detect whether printf conversion specifier "%jd" is available AC_DEFUN([AX_COMMON_CHECK_FUNC_PRINTF_JD], [AC_MSG_CHECKING( [whether printf supports the conversion specifier "%jd"]) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror" AC_LANG_PUSH(C) dnl First try to see if compilation and linkage without a parameter succeeds AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[printf( "%jd" ); ]] )], [ac_cv_cv_have_printf_jd=no], [ac_cv_cv_have_printf_jd=yes]) dnl Second try to see if compilation and linkage with a parameter succeeds AS_IF( [test "x$ac_cv_cv_have_printf_jd" = xyes], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include #include ]], [[printf( "%jd", (off_t) 10 ); ]] )], [ac_cv_cv_have_printf_jd=yes], [ac_cv_cv_have_printf_jd=no]) ]) dnl Third try to see if the program runs correctly AS_IF( [test "x$ac_cv_cv_have_printf_jd" = xyes], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include #include ]], [[char string[ 3 ]; if( snprintf( string, 3, "%jd", (off_t) 10 ) < 0 ) return( 1 ); if( ( string[ 0 ] != '1' ) || ( string[ 1 ] != '0' ) ) return( 1 ); ]] )], [ac_cv_cv_have_printf_jd=yes], [ac_cv_cv_have_printf_jd=no], [ac_cv_cv_have_printf_jd=undetermined]) ]) AC_LANG_POP(C) CFLAGS="$SAVE_CFLAGS" AS_IF( [test "x$ac_cv_cv_have_printf_jd" = xyes], [AC_MSG_RESULT( [yes]) AC_DEFINE( [HAVE_PRINTF_JD], [1], [Define to 1 whether printf supports the conversion specifier "%jd".]) ], [AC_MSG_RESULT( [$ac_cv_cv_have_printf_jd]) ]) ]) dnl Function to detect whether printf conversion specifier "%zd" is available AC_DEFUN([AX_COMMON_CHECK_FUNC_PRINTF_ZD], [AC_MSG_CHECKING( [whether printf supports the conversion specifier "%zd"]) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror" AC_LANG_PUSH(C) dnl First try to see if compilation and linkage without a parameter succeeds AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[printf( "%zd" ); ]] )], [ac_cv_cv_have_printf_zd=no], [ac_cv_cv_have_printf_zd=yes]) dnl Second try to see if compilation and linkage with a parameter succeeds AS_IF( [test "x$ac_cv_cv_have_printf_zd" = xyes], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include #include ]], [[printf( "%zd", (size_t) 10 ); ]] )], [ac_cv_cv_have_printf_zd=yes], [ac_cv_cv_have_printf_zd=no]) ]) dnl Third try to see if the program runs correctly AS_IF( [test "x$ac_cv_cv_have_printf_zd" = xyes], [AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include #include ]], [[char string[ 3 ]; if( snprintf( string, 3, "%zd", (size_t) 10 ) < 0 ) return( 1 ); if( ( string[ 0 ] != '1' ) || ( string[ 1 ] != '0' ) ) return( 1 ); ]] )], [ac_cv_cv_have_printf_zd=yes], [ac_cv_cv_have_printf_zd=no], [ac_cv_cv_have_printf_zd=undetermined]) ]) AC_LANG_POP(C) CFLAGS="$SAVE_CFLAGS" AS_IF( [test "x$ac_cv_cv_have_printf_zd" = xyes], [AC_MSG_RESULT( [yes]) AC_DEFINE( [HAVE_PRINTF_ZD], [1], [Define to 1 whether printf supports the conversion specifier "%zd".]) ], [AC_MSG_RESULT( [$ac_cv_cv_have_printf_zd]) ]) ]) dnl Function to detect if common dependencies are available AC_DEFUN([AX_COMMON_CHECK_LOCAL], [dnl Headers included in common/common.h AS_IF( [test "x$ac_cv_enable_winapi" = xyes], [AC_CHECK_HEADERS([windows.h]) AS_IF( [test "x$ac_cv_header_windows_h" = xno], [AC_MSG_FAILURE( [Missing header: windows.h header is required to compile with winapi support], [1]) ]) ]) AS_IF( [test "x$ac_cv_enable_winapi" = xno], [AC_CHECK_HEADERS([libintl.h]) ]) dnl Headers included in common/types.h AC_CHECK_HEADERS([limits.h]) dnl Headers included in common/memory.h and common/narrow_string.h AC_CHECK_HEADERS([stdlib.h string.h]) dnl Headers included in common/wide_string.h AC_CHECK_HEADERS([wchar.h wctype.h]) dnl File stream functions used in common/file_stream.h AC_CHECK_FUNCS([fclose feof fgets fopen fread fseeko fseeko64 fwrite vfprintf]) AS_IF( [test "x$ac_cv_func_fclose" != xyes], [AC_MSG_FAILURE( [Missing function: fclose], [1]) ]) AS_IF( [test "x$ac_cv_func_feof" != xyes], [AC_MSG_FAILURE( [Missing function: feof], [1]) ]) AS_IF( [test "x$ac_cv_func_fgets" != xyes], [AC_MSG_FAILURE( [Missing function: fgets], [1]) ]) AS_IF( [test "x$ac_cv_func_fopen" != xyes], [AC_MSG_FAILURE( [Missing function: fopen], [1]) ]) AS_IF( [test "x$ac_cv_func_fread" != xyes], [AC_MSG_FAILURE( [Missing function: fread], [1]) ]) AS_IF( [test "x$ac_cv_func_fseeko" != xyes && test "x$ac_cv_func_fseeko64" != xyes], [AC_MSG_FAILURE( [Missing function: fseeko and fseeko64], [1]) ]) AS_IF( [test "x$ac_cv_func_fwrite" != xyes], [AC_MSG_FAILURE( [Missing function: fwrite], [1]) ]) AS_IF( [test "x$ac_cv_func_vfprintf" != xyes], [AC_MSG_FAILURE( [Missing function: vfprintf], [1]) ]) AS_IF( [test "x$ac_cv_enable_wide_character_type" != xno], [AC_CHECK_FUNCS([fgetws]) AS_IF( [test "x$ac_cv_func_fgetws" != xyes], [AC_MSG_FAILURE( [Missing function: fgetws], [1]) ]) ]) dnl Memory functions used in common/memory.h AC_CHECK_FUNCS([free malloc memcmp memcpy memset realloc]) AS_IF( [test "x$ac_cv_func_free" != xyes], [AC_MSG_FAILURE( [Missing function: free], [1]) ]) AS_IF( [test "x$ac_cv_func_malloc" != xyes], [AC_MSG_FAILURE( [Missing function: malloc], [1]) ]) AS_IF( [test "x$ac_cv_func_memcmp" != xyes], [AC_MSG_FAILURE( [Missing function: memcmp], [1]) ]) AS_IF( [test "x$ac_cv_func_memcpy" != xyes], [AC_MSG_FAILURE( [Missing function: memcpy], [1]) ]) AS_IF( [test "x$ac_cv_func_memset" != xyes], [AC_MSG_FAILURE( [Missing function: memset], [1]) ]) AS_IF( [test "x$ac_cv_func_realloc" != xyes], [AC_MSG_FAILURE( [Missing function: realloc], [1]) ]) dnl Narrow character string functions used in common/narrow_string.h AC_CHECK_FUNCS([memchr memrchr snprintf sscanf strcasecmp strchr strlen strncasecmp strncmp strncpy strnicmp strrchr strstr vsnprintf]) AS_IF( [test "x$ac_cv_func_memchr" != xyes && test "x$ac_cv_func_strchr" != xyes], [AC_MSG_FAILURE( [Missing functions: memchr and strchr], [1]) ]) AS_IF( [test "x$ac_cv_func_memcmp" != xyes && test "x$ac_cv_func_strncmp" != xyes], [AC_MSG_FAILURE( [Missing functions: memcmp and strncmp], [1]) ]) AS_IF( [test "x$ac_cv_func_memcpy" != xyes && test "x$ac_cv_func_strncpy" != xyes], [AC_MSG_FAILURE( [Missing functions: memcpy and strncpy], [1]) ]) AS_IF( [test "x$ac_cv_func_memrchr" = xyes], [AC_CHECK_DECLS([memrchr]) AS_IF( [test "x$ac_cv_decl_memrchr" != xyes], [ac_cv_func_memrchr=no]) ]) AS_IF( [test "x$ac_cv_func_memrchr" != xyes && test "x$ac_cv_func_strrchr" != xyes], [AC_MSG_FAILURE( [Missing functions: strrchr and memrchr], [1]) ]) AS_IF( [test "x$ac_cv_func_snprintf" != xyes], [AC_MSG_FAILURE( [Missing function: snprintf], [1]) ]) AS_IF( [test "x$ac_cv_func_sscanf" != xyes], [AC_MSG_FAILURE( [Missing function: sscanf], [1]) ]) AS_IF( [test "x$ac_cv_func_strlen" != xyes], [AC_MSG_FAILURE( [Missing function: strlen], [1]) ]) AS_IF( [test "x$ac_cv_func_strcasecmp" != xyes && test "x$ac_cv_func_strncasecmp" != xyes && test "x$ac_cv_func_strnicmp" != xyes], [AC_MSG_FAILURE( [Missing functions: strncasecmp, strcasecmp and strnicmp], [1]) ]) AS_IF( [test "x$ac_cv_func_strstr" != xyes], [AC_MSG_FAILURE( [Missing function: strstr], [1]) ]) AS_IF( [test "x$ac_cv_func_vsnprintf" != xyes], [AC_MSG_FAILURE( [Missing function: vsnprintf], [1]) ]) dnl Wide character string functions used in common/wide_string.h AS_IF( [test "x$ac_cv_enable_wide_character_type" != xno], [AC_CHECK_FUNCS([swprintf towlower wcscasecmp wcschr wcslen wcsncasecmp wcsncmp wcsncpy wcsnicmp wcsrchr wcsstr wmemchr wmemcmp wmemcpy wmemrchr]) AS_IF( [test "x$ac_cv_func_swprintf" != xyes], [AC_MSG_FAILURE( [Missing function: swprintf], [1]) ]) AS_IF( [test "x$ac_cv_func_wmemchr" != xyes && test "x$ac_cv_func_wcschr" != xyes], [AC_MSG_FAILURE( [Missing functions: wmemchr and wcschr], [1]) ]) AS_IF( [test "x$ac_cv_func_wmemcmp" != xyes && test "x$ac_cv_func_wcsncmp" != xyes], [AC_MSG_FAILURE( [Missing functions: wmemcmp and wcsncmp], [1]) ]) AS_IF( [test "x$ac_cv_func_wmemcpy" != xyes && test "x$ac_cv_func_wcsncpy" != xyes], [AC_MSG_FAILURE( [Missing functions: wmemcpy and wcsncpy], [1]) ]) AS_IF( [test "x$ac_cv_func_wmemrchr" != xyes && test "x$ac_cv_func_wcsrchr" != xyes], [AC_MSG_FAILURE( [Missing functions: wmemrchr and wcsrchr], [1]) ]) AS_IF( [test "x$ac_cv_func_wcslen" != xyes], [AC_MSG_FAILURE( [Missing function: wcslen], [1]) ]) AS_IF( [test "x$ac_cv_func_wcsncasecmp" != xyes && test "x$ac_cv_func_wcscasecmp" != xyes && test "x$ac_cv_func_wcsnicmp" != xyes && test "x$ac_cv_func_towlower" != xyes], [AC_MSG_FAILURE( [Missing functions: wcsncasecmp, wcscasecmp, wcsnicmp and towlower], [1]) ]) AS_IF( [test "x$ac_cv_func_wcsstr" != xyes], [AC_MSG_FAILURE( [Missing function: wcsstr], [1]) ]) ]) dnl Check for printf conversion specifier support AX_COMMON_CHECK_FUNC_PRINTF_JD AX_COMMON_CHECK_FUNC_PRINTF_ZD ]) dnl Function to test if a library with a specific definition is available AC_DEFUN([AX_CHECK_LIB_DEFINITION], [AC_CACHE_CHECK( [if `$2' is defined], [ac_cv_$1_definition_$2], [AC_LANG_PUSH(C) AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include <$1.h>]], [[int test = $2; return( 0 ); ]] )], [ac_cv_$1_definition_$2=yes], [ac_cv_$1_definition_$2=no]) AC_LANG_POP(C)]) AS_IF( [test "x$ac_cv_$1_definition_$2" != xyes], [ac_cv_$1=no]) ]) dnl Function to test if a library with specific definitions is available AC_DEFUN([AX_CHECK_LIB_DEFINITIONS], [m4_foreach( [definition], [$2], [AX_CHECK_LIB_DEFINITION( [$1], [definition]) ]) ]) dnl Function to test if a library with specific functions is available AC_DEFUN([AX_CHECK_LIB_FUNCTIONS], [m4_foreach( [function], [$3], [AC_CHECK_LIB( [$2], [function], [ac_cv_$1_dummy=yes], [ac_cv_$1=no]) ]) ]) dnl Function to check if an user specified library directory exists AC_DEFUN([AX_CHECK_LIB_DIRECTORY_EXISTS], [AS_IF( [test -d "$ac_cv_with_$1"], [CFLAGS="$CFLAGS -I${ac_cv_with_$1}/include" LDFLAGS="$LDFLAGS -L${ac_cv_with_$1}/lib"], [AC_MSG_FAILURE( [no such directory: $ac_cv_with_$1], [1]) ]) ]) dnl Function to warn if no supported library was found in an user specified directory AC_DEFUN([AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE], [AS_IF( [test "x$ac_cv_$1" != xyes && test "x$ac_cv_with_$1" != x && test "x$ac_cv_with_$1" != xauto-detect && test "x$ac_cv_with_$1" != xyes], [AC_MSG_FAILURE( [unable to find supported $1 in directory: $ac_cv_with_$1], [1]) ]) ]) ================================================ FILE: m4/libbfio.m4 ================================================ dnl Checks for libbfio required headers and functions dnl dnl Version: 20240518 dnl Function to detect if libbfio is available dnl ac_libbfio_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBBFIO_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libbfio" = xno], [ac_cv_libbfio=no], [ac_cv_libbfio=check dnl Check if the directory provided as parameter exists dnl For both --with-libbfio which returns "yes" and --with-libbfio= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libbfio" != x && test "x$ac_cv_with_libbfio" != xauto-detect && test "x$ac_cv_with_libbfio" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libbfio])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libbfio], [libbfio >= 20201125], [ac_cv_libbfio=yes], [ac_cv_libbfio=check]) ]) AS_IF( [test "x$ac_cv_libbfio" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], [AC_CACHE_CHECK( [whether libbfio/features.h defines LIBBFIO_HAVE_WIDE_CHARACTER_TYPE as 1], [ac_cv_header_libbfio_features_h_have_wide_character_type], [AC_LANG_PUSH(C) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[#if !defined( LIBBFIO_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBBFIO_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBBFIO_HAVE_WIDE_CHARACTER_TYPE not defined #endif]] )], [ac_cv_header_libbfio_features_h_have_wide_character_type=yes], [ac_cv_header_libbfio_features_h_have_wide_character_type=no]) AC_LANG_POP(C)], [ac_cv_header_libbfio_features_h_have_wide_character_type=no]) AS_IF( [test "x$ac_cv_header_libbfio_features_h_have_wide_character_type" = xno], [ac_cv_libbfio=no]) ]) AS_IF( [test "x$ac_cv_libbfio" = xyes], [ac_cv_libbfio_CPPFLAGS="$pkg_cv_libbfio_CFLAGS" ac_cv_libbfio_LIBADD="$pkg_cv_libbfio_LIBS"]) ]) AS_IF( [test "x$ac_cv_libbfio" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libbfio.h]) AS_IF( [test "x$ac_cv_header_libbfio_h" = xno], [ac_cv_libbfio=no], [ac_cv_libbfio=yes AX_CHECK_LIB_FUNCTIONS( [libbfio], [bfio], [[libbfio_get_version], [libbfio_handle_free], [libbfio_handle_open], [libbfio_handle_close], [libbfio_handle_exists], [libbfio_handle_read_buffer], [libbfio_handle_read_buffer_at_offset], [libbfio_handle_write_buffer], [libbfio_handle_write_buffer_at_offset], [libbfio_handle_seek_offset], [libbfio_handle_is_open], [libbfio_handle_get_offset], [libbfio_handle_get_size], [libbfio_handle_set_track_offsets_read], [libbfio_handle_get_number_of_offsets_read], [libbfio_handle_get_offset_read], [libbfio_file_initialize], [libbfio_file_get_name_size], [libbfio_file_get_name], [libbfio_file_set_name], [libbfio_pool_initialize], [libbfio_pool_free], [libbfio_pool_clone], [libbfio_pool_get_number_of_handles], [libbfio_pool_get_handle], [libbfio_pool_set_handle], [libbfio_pool_append_handle], [libbfio_pool_remove_handle], [libbfio_pool_get_maximum_number_of_open_handles], [libbfio_pool_set_maximum_number_of_open_handles], [libbfio_pool_open], [libbfio_pool_reopen], [libbfio_pool_close], [libbfio_pool_close_all], [libbfio_pool_read_buffer], [libbfio_pool_read_buffer_at_offset], [libbfio_pool_write_buffer], [libbfio_pool_write_buffer_at_offset], [libbfio_pool_seek_offset], [libbfio_pool_get_offset], [libbfio_pool_get_size], [libbfio_file_pool_open]]) AS_IF( [test "x$ac_cv_enable_wide_character_type" != xno], [AX_CHECK_LIB_FUNCTIONS( [libbfio], [bfio], [[libbfio_file_get_name_size_wide], [libbfio_file_get_name_wide], [libbfio_file_set_name_wide], [libbfio_file_pool_open_wide]]) ]) ac_cv_libbfio_LIBADD="-lbfio"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libbfio]) ]) AS_IF( [test "x$ac_cv_libbfio" = xyes], [AC_DEFINE( [HAVE_LIBBFIO], [1], [Define to 1 if you have the `bfio' library (-lbfio).]) ]) AS_IF( [test "x$ac_cv_libbfio" = xyes], [AC_SUBST( [HAVE_LIBBFIO], [1]) ], [AC_SUBST( [HAVE_LIBBFIO], [0]) ]) ]) dnl Function to detect if libbfio dependencies are available AC_DEFUN([AX_LIBBFIO_CHECK_LOCAL], [dnl No additional checks. ac_cv_libbfio_CPPFLAGS="-I../libbfio -I\$(top_srcdir)/libbfio"; ac_cv_libbfio_LIBADD="../libbfio/libbfio.la"; ac_cv_libbfio=local ]) dnl Function to detect how to enable libbfio AC_DEFUN([AX_LIBBFIO_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libbfio], [libbfio], [search for libbfio in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBBFIO_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libbfio" != xyes], [AX_LIBBFIO_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBBFIO], [1], [Define to 1 if the local version of libbfio is used.]) AC_SUBST( [HAVE_LOCAL_LIBBFIO], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBBFIO], [test "x$ac_cv_libbfio" = xlocal]) AS_IF( [test "x$ac_cv_libbfio_CPPFLAGS" != "x"], [AC_SUBST( [LIBBFIO_CPPFLAGS], [$ac_cv_libbfio_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libbfio_LIBADD" != "x"], [AC_SUBST( [LIBBFIO_LIBADD], [$ac_cv_libbfio_LIBADD]) ]) AS_IF( [test "x$ac_cv_libbfio" = xyes], [AC_SUBST( [ax_libbfio_pc_libs_private], [-lbfio]) ]) AS_IF( [test "x$ac_cv_libbfio" = xyes], [AC_SUBST( [ax_libbfio_spec_requires], [libbfio]) AC_SUBST( [ax_libbfio_spec_build_requires], [libbfio-devel]) ]) ]) ================================================ FILE: m4/libcdata.m4 ================================================ dnl Checks for libcdata required headers and functions dnl dnl Version: 20240514 dnl Function to detect if libcdata is available dnl ac_libcdata_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCDATA_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcdata" = xno], [ac_cv_libcdata=no], [ac_cv_libcdata=check dnl Check if the directory provided as parameter exists dnl For both --with-libcdata which returns "yes" and --with-libcdata= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libcdata" != x && test "x$ac_cv_with_libcdata" != xauto-detect && test "x$ac_cv_with_libcdata" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libcdata])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libcdata], [libcdata >= 20230108], [ac_cv_libcdata=yes], [ac_cv_libcdata=check]) ]) AS_IF( [test "x$ac_cv_libcdata" = xyes], [ac_cv_libcdata_CPPFLAGS="$pkg_cv_libcdata_CFLAGS" ac_cv_libcdata_LIBADD="$pkg_cv_libcdata_LIBS"]) ]) AS_IF( [test "x$ac_cv_libcdata" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcdata.h]) AS_IF( [test "x$ac_cv_header_libcdata_h" = xno], [ac_cv_libcdata=no], [ac_cv_libcdata=yes AX_CHECK_LIB_FUNCTIONS( [libcdata], [cdata], [[libcdata_get_version], [libcdata_array_initialize], [libcdata_array_free], [libcdata_array_empty], [libcdata_array_clone], [libcdata_array_resize], [libcdata_array_reverse], [libcdata_array_get_number_of_entries], [libcdata_array_get_entry_by_index], [libcdata_array_get_entry_by_value], [libcdata_array_set_entry_by_index], [libcdata_array_prepend_entry], [libcdata_array_append_entry], [libcdata_array_insert_entry], [libcdata_array_remove_entry], [libcdata_btree_initialize], [libcdata_btree_free], [libcdata_btree_get_number_of_values], [libcdata_btree_get_value_by_index], [libcdata_btree_get_value_by_value], [libcdata_btree_insert_value], [libcdata_btree_replace_value], [libcdata_btree_remove_value], [libcdata_list_initialize], [libcdata_list_free], [libcdata_list_empty], [libcdata_list_clone], [libcdata_list_get_number_of_elements], [libcdata_list_get_first_element], [libcdata_list_get_last_element], [libcdata_list_get_element_by_index], [libcdata_list_get_value_by_index], [libcdata_list_prepend_element], [libcdata_list_prepend_value], [libcdata_list_append_element], [libcdata_list_append_value], [libcdata_list_insert_element], [libcdata_list_insert_element_with_existing], [libcdata_list_insert_value], [libcdata_list_insert_value_with_existing], [libcdata_list_remove_element], [libcdata_list_element_initialize], [libcdata_list_element_free], [libcdata_list_element_get_value], [libcdata_list_element_set_value], [libcdata_list_element_get_previous_element], [libcdata_list_element_set_previous_element], [libcdata_list_element_get_next_element], [libcdata_list_element_get_elements], [libcdata_list_element_set_elements], [libcdata_range_list_initialize], [libcdata_range_list_free], [libcdata_range_list_empty], [libcdata_range_list_clone], [libcdata_range_list_get_number_of_elements], [libcdata_range_list_insert_range], [libcdata_range_list_insert_range_list], [libcdata_range_list_remove_range], [libcdata_range_list_get_range_by_index], [libcdata_range_list_get_range_at_offset], [libcdata_range_list_range_is_present], [libcdata_range_list_range_has_overlapping_range], [libcdata_range_list_get_spanning_range], [libcdata_tree_node_initialize], [libcdata_tree_node_free], [libcdata_tree_node_empty], [libcdata_tree_node_clone], [libcdata_tree_node_get_value], [libcdata_tree_node_set_value], [libcdata_tree_node_get_parent_node], [libcdata_tree_node_set_parent_node], [libcdata_tree_node_get_previous_node], [libcdata_tree_node_set_previous_node], [libcdata_tree_node_get_next_node], [libcdata_tree_node_set_next_node], [libcdata_tree_node_get_nodes], [libcdata_tree_node_set_nodes], [libcdata_tree_node_append_node], [libcdata_tree_node_append_value], [libcdata_tree_node_insert_node], [libcdata_tree_node_insert_value], [libcdata_tree_node_replace_node], [libcdata_tree_node_remove_node], [libcdata_tree_node_get_number_of_sub_nodes], [libcdata_tree_node_get_sub_node_by_index], [libcdata_tree_node_get_leaf_node_list]]) ac_cv_libcdata_LIBADD="-lcdata"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libcdata]) ]) AS_IF( [test "x$ac_cv_libcdata" = xyes], [AC_DEFINE( [HAVE_LIBCDATA], [1], [Define to 1 if you have the `cdata' library (-lcdata).]) ]) AS_IF( [test "x$ac_cv_libcdata" = xyes], [AC_SUBST( [HAVE_LIBCDATA], [1]) ], [AC_SUBST( [HAVE_LIBCDATA], [0]) ]) ]) dnl Function to detect if libcdata dependencies are available AC_DEFUN([AX_LIBCDATA_CHECK_LOCAL], [dnl No additional checks. ac_cv_libcdata_CPPFLAGS="-I../libcdata -I\$(top_srcdir)/libcdata"; ac_cv_libcdata_LIBADD="../libcdata/libcdata.la"; ac_cv_libcdata=local ]) dnl Function to detect how to enable libcdata AC_DEFUN([AX_LIBCDATA_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libcdata], [libcdata], [search for libcdata in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBCDATA_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libcdata" != xyes], [AX_LIBCDATA_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBCDATA], [1], [Define to 1 if the local version of libcdata is used.]) AC_SUBST( [HAVE_LOCAL_LIBCDATA], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBCDATA], [test "x$ac_cv_libcdata" = xlocal]) AS_IF( [test "x$ac_cv_libcdata_CPPFLAGS" != "x"], [AC_SUBST( [LIBCDATA_CPPFLAGS], [$ac_cv_libcdata_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libcdata_LIBADD" != "x"], [AC_SUBST( [LIBCDATA_LIBADD], [$ac_cv_libcdata_LIBADD]) ]) AS_IF( [test "x$ac_cv_libcdata" = xyes], [AC_SUBST( [ax_libcdata_pc_libs_private], [-lcdata]) ]) AS_IF( [test "x$ac_cv_libcdata" = xyes], [AC_SUBST( [ax_libcdata_spec_requires], [libcdata]) AC_SUBST( [ax_libcdata_spec_build_requires], [libcdata-devel]) ]) ]) ================================================ FILE: m4/libcerror.m4 ================================================ dnl Checks for libcerror required headers and functions dnl dnl Version: 20240513 dnl Function to detect if libcerror is available dnl ac_libcerror_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCERROR_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcerror" = xno], [ac_cv_libcerror=no], [ac_cv_libcerror=check dnl Check if the directory provided as parameter exists dnl For both --with-libcerror which returns "yes" and --with-libcerror= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libcerror" != x && test "x$ac_cv_with_libcerror" != xauto-detect && test "x$ac_cv_with_libcerror" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libcerror])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libcerror], [libcerror >= 20120425], [ac_cv_libcerror=yes], [ac_cv_libcerror=check]) ]) AS_IF( [test "x$ac_cv_libcerror" = xyes], [ac_cv_libcerror_CPPFLAGS="$pkg_cv_libcerror_CFLAGS" ac_cv_libcerror_LIBADD="$pkg_cv_libcerror_LIBS"]) ]) AS_IF( [test "x$ac_cv_libcerror" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcerror.h]) AS_IF( [test "x$ac_cv_header_libcerror_h" = xno], [ac_cv_libcerror=no], [ac_cv_libcerror=yes AX_CHECK_LIB_FUNCTIONS( [libcerror], [cerror], [[libcerror_get_version], [libcerror_error_free], [libcerror_error_set], [libcerror_error_matches], [libcerror_error_fprint], [libcerror_error_sprint], [libcerror_error_backtrace_fprint], [libcerror_error_backtrace_sprint], [libcerror_system_set_error]]) ac_cv_libcerror_LIBADD="-lcerror"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libcerror]) ]) AS_IF( [test "x$ac_cv_libcerror" = xyes], [AC_DEFINE( [HAVE_LIBCERROR], [1], [Define to 1 if you have the `cerror' library (-lcerror).]) ]) AS_IF( [test "x$ac_cv_libcerror" = xyes], [AC_SUBST( [HAVE_LIBCERROR], [1]) ], [AC_SUBST( [HAVE_LIBCERROR], [0]) ]) ]) dnl Function to detect if libcerror dependencies are available AC_DEFUN([AX_LIBCERROR_CHECK_LOCAL], [dnl Headers included in libcerror/libcerror_error.c AC_CHECK_HEADERS([stdarg.h varargs.h]) AS_IF( [test "x$ac_cv_header_stdarg_h" != xyes && test "x$ac_cv_header_varargs_h" != xyes], [AC_MSG_FAILURE( [Missing headers: stdarg.h and varargs.h], [1]) ]) dnl Wide character string functions used in libcerror/libcerror_error.c AS_IF( [test "x$ac_cv_enable_wide_character_type" != xno], [AC_CHECK_FUNCS([wcstombs]) AS_IF( [test "x$ac_cv_func_wcstombs" != xyes], [AC_MSG_FAILURE( [Missing function: wcstombs], [1]) ]) ]) dnl Check for error string functions used in libcerror/libcerror_system.c AC_FUNC_STRERROR_R() AS_IF( [test "x$ac_cv_have_decl_strerror_r" != xyes], [AC_CHECK_FUNCS([strerror]) AS_IF( [test "x$ac_cv_func_strerror" != xyes], [AC_MSG_FAILURE( [Missing functions: strerror_r and strerror], [1]) ]) ]) ac_cv_libcerror_CPPFLAGS="-I../libcerror -I\$(top_srcdir)/libcerror"; ac_cv_libcerror_LIBADD="../libcerror/libcerror.la"; ac_cv_libcerror=local ]) dnl Function to detect how to enable libcerror AC_DEFUN([AX_LIBCERROR_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libcerror], [libcerror], [search for libcerror in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBCERROR_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libcerror" != xyes], [AX_LIBCERROR_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBCERROR], [1], [Define to 1 if the local version of libcerror is used.]) AC_SUBST( [HAVE_LOCAL_LIBCERROR], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBCERROR], [test "x$ac_cv_libcerror" = xlocal]) AS_IF( [test "x$ac_cv_libcerror_CPPFLAGS" != "x"], [AC_SUBST( [LIBCERROR_CPPFLAGS], [$ac_cv_libcerror_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libcerror_LIBADD" != "x"], [AC_SUBST( [LIBCERROR_LIBADD], [$ac_cv_libcerror_LIBADD]) ]) AS_IF( [test "x$ac_cv_libcerror" = xyes], [AC_SUBST( [ax_libcerror_pc_libs_private], [-lcerror]) ]) AS_IF( [test "x$ac_cv_libcerror" = xyes], [AC_SUBST( [ax_libcerror_spec_requires], [libcerror]) AC_SUBST( [ax_libcerror_spec_build_requires], [libcerror-devel]) ]) ]) ================================================ FILE: m4/libcfile.m4 ================================================ dnl Checks for libcfile required headers and functions dnl dnl Version: 20240514 dnl Function to detect if libcfile is available dnl ac_libcfile_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCFILE_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcfile" = xno], [ac_cv_libcfile=no], [ac_cv_libcfile=check dnl Check if the directory provided as parameter exists dnl For both --with-libcfile which returns "yes" and --with-libcfile= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libcfile" != x && test "x$ac_cv_with_libcfile" != xauto-detect && test "x$ac_cv_with_libcfile" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libcfile])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libcfile], [libcfile >= 20160409], [ac_cv_libcfile=yes], [ac_cv_libcfile=check]) ]) AS_IF( [test "x$ac_cv_libcfile" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], [AC_CACHE_CHECK( [whether libcfile/features.h defines LIBCFILE_HAVE_WIDE_CHARACTER_TYPE as 1], [ac_cv_header_libcfile_features_h_have_wide_character_type], [AC_LANG_PUSH(C) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[#if !defined( LIBCFILE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCFILE_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBCFILE_HAVE_WIDE_CHARACTER_TYPE not defined #endif]] )], [ac_cv_header_libcfile_features_h_have_wide_character_type=yes], [ac_cv_header_libcfile_features_h_have_wide_character_type=no]) AC_LANG_POP(C)], [ac_cv_header_libcfile_features_h_have_wide_character_type=no]) AS_IF( [test "x$ac_cv_header_libcfile_features_h_have_wide_character_type" = xno], [ac_cv_libcfile=no]) ]) AS_IF( [test "x$ac_cv_libcfile" = xyes], [ac_cv_libcfile_CPPFLAGS="$pkg_cv_libcfile_CFLAGS" ac_cv_libcfile_LIBADD="$pkg_cv_libcfile_LIBS"]) ]) AS_IF( [test "x$ac_cv_libcfile" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcfile.h]) AS_IF( [test "x$ac_cv_header_libcfile_h" = xno], [ac_cv_libcfile=no], [ac_cv_libcfile=yes AX_CHECK_LIB_FUNCTIONS( [libcfile], [cfile], [[libcfile_get_version], [libcfile_file_initialize], [libcfile_file_free], [libcfile_file_open], [libcfile_file_open_with_error_code], [libcfile_file_close], [libcfile_file_read_buffer], [libcfile_file_read_buffer_with_error_code], [libcfile_file_write_buffer], [libcfile_file_write_buffer_with_error_code], [libcfile_file_seek_offset], [libcfile_file_resize], [libcfile_file_is_open], [libcfile_file_get_offset], [libcfile_file_get_size], [libcfile_file_is_device], [libcfile_file_io_control_read], [libcfile_file_io_control_read_with_error_code], [libcfile_file_exists], [libcfile_file_remove]]) AS_IF( [test "x$ac_cv_enable_wide_character_type" != xno], [AX_CHECK_LIB_FUNCTIONS( [libcfile], [cfile], [[libcfile_file_open_wide], [libcfile_file_open_wide_with_error_code], [libcfile_file_exists_wide], [libcfile_file_remove_wide]]) ]) ac_cv_libcfile_LIBADD="-lcfile"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libcfile]) ]) AS_IF( [test "x$ac_cv_libcfile" = xyes], [AC_DEFINE( [HAVE_LIBCFILE], [1], [Define to 1 if you have the `cfile' library (-lcfile).]) ]) AS_IF( [test "x$ac_cv_libcfile" = xyes], [AC_SUBST( [HAVE_LIBCFILE], [1]) ], [AC_SUBST( [HAVE_LIBCFILE], [0]) ]) ]) dnl Function to detect if posix_fadvise is available AC_DEFUN([AX_LIBCFILE_CHECK_FUNC_POSIX_FADVISE], [AC_CHECK_FUNCS([posix_fadvise]) AS_IF( [test "x$ac_cv_func_posix_fadvise" = xyes], [AC_MSG_CHECKING( [whether posix_fadvise can be linked]) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror" AC_LANG_PUSH(C) AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[#if !defined( POSIX_FADV_SEQUENTIAL ) #define POSIX_FADV_SEQUENTIAL 2 #endif posix_fadvise( 0, 0, 0, POSIX_FADV_SEQUENTIAL )]] )], [ac_cv_func_posix_fadvise=yes], [ac_cv_func_posix_fadvise=no]) AC_LANG_POP(C) CFLAGS="$SAVE_CFLAGS" AS_IF( [test "x$ac_cv_func_posix_fadvise" = xyes], [AC_MSG_RESULT( [yes]) AC_DEFINE( [HAVE_POSIX_FADVISE], [1], [Define to 1 if you have the posix_fadvise function.]) ], [AC_MSG_RESULT( [no]) ]) ]) ]) dnl Function to detect if libcfile dependencies are available AC_DEFUN([AX_LIBCFILE_CHECK_LOCAL], [dnl Headers included in libcfile/libcfile_file.c and libcfile/libcfile_support.c AC_CHECK_HEADERS([errno.h stdio.h sys/stat.h]) dnl Headers included in libcfile/libcfile_file.c AC_CHECK_HEADERS([cygwin/fs.h fcntl.h linux/fs.h sys/disk.h sys/disklabel.h sys/ioctl.h unistd.h]) dnl File input/output functions used in libcfile/libcfile_file.c AC_CHECK_FUNCS([close fstat ftruncate ioctl lseek open read write]) AS_IF( [test "x$ac_cv_func_close" != xyes], [AC_MSG_FAILURE( [Missing function: close], [1]) ]) AX_LIBCFILE_CHECK_FUNC_POSIX_FADVISE AS_IF( [test "x$ac_cv_func_fstat" != xyes], [AC_MSG_FAILURE( [Missing function: fstat], [1]) ]) AS_IF( [test "x$ac_cv_func_ftruncate" != xyes], [AC_MSG_FAILURE( [Missing function: ftruncate], [1]) ]) AS_IF( [test x"$ac_cv_enable_winapi" = xno], [AS_IF( [test "x$ac_cv_func_ioctl" != xyes], [AC_MSG_FAILURE( [Missing function: ioctl], [1]) ]) ]) AS_IF( [test "x$ac_cv_func_lseek" != xyes], [AC_MSG_FAILURE( [Missing function: lseek], [1]) ]) AS_IF( [test "x$ac_cv_func_open" != xyes], [AC_MSG_FAILURE( [Missing function: open], [1]) ]) AS_IF( [test "x$ac_cv_func_read" != xyes], [AC_MSG_FAILURE( [Missing function: read], [1]) ]) AS_IF( [test "x$ac_cv_func_write" != xyes], [AC_MSG_FAILURE( [Missing function: write], [1]) ]) dnl File input/output functions used in libcfile/libcfile_support.c AC_CHECK_FUNCS([stat unlink]) AS_IF( [test "x$ac_cv_func_stat" != xyes], [AC_MSG_FAILURE( [Missing function: stat], [1]) ]) AS_IF( [test "x$ac_cv_func_unlink" != xyes], [AC_MSG_FAILURE( [Missing function: unlink], [1]) ]) ac_cv_libcfile_CPPFLAGS="-I../libcfile -I\$(top_srcdir)/libcfile"; ac_cv_libcfile_LIBADD="../libcfile/libcfile.la"; ac_cv_libcfile=local ]) dnl Function to detect how to enable libcfile AC_DEFUN([AX_LIBCFILE_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libcfile], [libcfile], [search for libcfile in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBCFILE_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libcfile" != xyes], [AX_LIBCFILE_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBCFILE], [1], [Define to 1 if the local version of libcfile is used.]) AC_SUBST( [HAVE_LOCAL_LIBCFILE], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBCFILE], [test "x$ac_cv_libcfile" = xlocal]) AS_IF( [test "x$ac_cv_libcfile_CPPFLAGS" != "x"], [AC_SUBST( [LIBCFILE_CPPFLAGS], [$ac_cv_libcfile_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libcfile_LIBADD" != "x"], [AC_SUBST( [LIBCFILE_LIBADD], [$ac_cv_libcfile_LIBADD]) ]) AS_IF( [test "x$ac_cv_libcfile" = xyes], [AC_SUBST( [ax_libcfile_pc_libs_private], [-lcfile]) ]) AS_IF( [test "x$ac_cv_libcfile" = xyes], [AC_SUBST( [ax_libcfile_spec_requires], [libcfile]) AC_SUBST( [ax_libcfile_spec_build_requires], [libcfile-devel]) ]) ]) ================================================ FILE: m4/libclocale.m4 ================================================ dnl Checks for libclocale required headers and functions dnl dnl Version: 20240513 dnl Function to detect if libclocale is available dnl ac_libclocale_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCLOCALE_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libclocale" = xno], [ac_cv_libclocale=no], [ac_cv_libclocale=check dnl Check if the directory provided as parameter exists dnl For both --with-libclocale which returns "yes" and --with-libclocale= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libclocale" != x && test "x$ac_cv_with_libclocale" != xauto-detect && test "x$ac_cv_with_libclocale" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libclocale])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libclocale], [libclocale >= 20120425], [ac_cv_libclocale=yes], [ac_cv_libclocale=check]) ]) AS_IF( [test "x$ac_cv_libclocale" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], [AC_CACHE_CHECK( [whether libclocale/features.h defines LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE as 1], [ac_cv_header_libclocale_features_h_have_wide_character_type], [AC_LANG_PUSH(C) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[#if !defined( LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBCLOCALE_HAVE_WIDE_CHARACTER_TYPE not defined #endif]] )], [ac_cv_header_libclocale_features_h_have_wide_character_type=yes], [ac_cv_header_libclocale_features_h_have_wide_character_type=no]) AC_LANG_POP(C)], [ac_cv_header_libclocale_features_h_have_wide_character_type=no]) AS_IF( [test "x$ac_cv_header_libclocale_features_h_have_wide_character_type" = xno], [ac_cv_libclocale=no]) ]) AS_IF( [test "x$ac_cv_libclocale" = xyes], [ac_cv_libclocale_CPPFLAGS="$pkg_cv_libclocale_CFLAGS" ac_cv_libclocale_LIBADD="$pkg_cv_libclocale_LIBS"]) ]) AS_IF( [test "x$ac_cv_libclocale" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libclocale.h]) AS_IF( [test "x$ac_cv_header_libclocale_h" = xno], [ac_cv_libclocale=no], [ac_cv_libclocale=yes AX_CHECK_LIB_FUNCTIONS( [libclocale], [clocale], [[libclocale_get_version], [libclocale_codepage], [libclocale_codepage_get], [libclocale_codepage_set], [libclocale_codepage_copy_from_string], [libclocale_locale_get_codepage], [libclocale_locale_get_decimal_point], [libclocale_initialize]]) AS_IF( [test "x$ac_cv_enable_wide_character_type" != xno], [AC_CHECK_LIB( clocale, libclocale_codepage_copy_from_string_wide, [ac_cv_libclocale_dummy=yes], [ac_cv_libclocale=no]) ]) ac_cv_libclocale_LIBADD="-lclocale"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libclocale]) ]) AS_IF( [test "x$ac_cv_libclocale" = xyes], [AC_DEFINE( [HAVE_LIBCLOCALE], [1], [Define to 1 if you have the `clocale' library (-lclocale).]) ]) AS_IF( [test "x$ac_cv_libclocale" = xyes], [AC_SUBST( [HAVE_LIBCLOCALE], [1]) ], [AC_SUBST( [HAVE_LIBCLOCALE], [0]) ]) ]) dnl Function to detect whether nl_langinfo supports CODESET AC_DEFUN([AX_LIBCLOCALE_CHECK_FUNC_LANGINFO_CODESET], [AC_CHECK_FUNCS([nl_langinfo]) AS_IF( [test "x$ac_cv_func_nl_langinfo" = xyes], [AC_CACHE_CHECK( [for nl_langinfo CODESET support], [ac_cv_cv_langinfo_codeset], [AC_LANG_PUSH(C) AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[char* charset = nl_langinfo( CODESET );]] )], [ac_cv_cv_langinfo_codeset=yes], [ac_cv_cv_langinfo_codeset=no]) AC_LANG_POP(C) ]) ], [ac_cv_cv_langinfo_codeset=no]) AS_IF( [test "x$ac_cv_cv_langinfo_codeset" = xyes], [AC_DEFINE( [HAVE_LANGINFO_CODESET], [1], [Define if nl_langinfo has CODESET support.]) ]) ]) dnl Function to detect if libclocale dependencies are available AC_DEFUN([AX_LIBCLOCALE_CHECK_LOCAL], [dnl Headers included in libclocale/libclocale_locale.c AC_CHECK_HEADERS([langinfo.h locale.h]) dnl Check for environment functions in libclocale/libclocale_locale.c AC_CHECK_FUNCS([getenv]) AS_IF( [test "x$ac_cv_func_getenv" != xyes], [AC_MSG_FAILURE( [Missing function: getenv], [1]) ]) dnl Check for localization functions in libclocale/libclocale_locale.c AS_IF( [test "x$ac_cv_enable_winapi" = xno], [AC_CHECK_FUNCS([localeconv]) AS_IF( [test "x$ac_cv_func_localeconv" != xyes], [AC_MSG_FAILURE( [Missing function: localeconv], [1]) ]) ]) AC_CHECK_FUNCS([setlocale]) AS_IF( [test "x$ac_cv_func_setlocale" != xyes], [AC_MSG_FAILURE( [Missing function: setlocale], [1]) ]) AX_LIBCLOCALE_CHECK_FUNC_LANGINFO_CODESET ac_cv_libclocale_CPPFLAGS="-I../libclocale -I\$(top_srcdir)/libclocale"; ac_cv_libclocale_LIBADD="../libclocale/libclocale.la"; ac_cv_libclocale=local ]) dnl Function to detect how to enable libclocale AC_DEFUN([AX_LIBCLOCALE_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libclocale], [libclocale], [search for libclocale in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBCLOCALE_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libclocale" != xyes], [AX_LIBCLOCALE_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBCLOCALE], [1], [Define to 1 if the local version of libclocale is used.]) AC_SUBST( [HAVE_LOCAL_LIBCLOCALE], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBCLOCALE], [test "x$ac_cv_libclocale" = xlocal]) AS_IF( [test "x$ac_cv_libclocale_CPPFLAGS" != "x"], [AC_SUBST( [LIBCLOCALE_CPPFLAGS], [$ac_cv_libclocale_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libclocale_LIBADD" != "x"], [AC_SUBST( [LIBCLOCALE_LIBADD], [$ac_cv_libclocale_LIBADD]) ]) AS_IF( [test "x$ac_cv_libclocale" = xyes], [AC_SUBST( [ax_libclocale_pc_libs_private], [-lclocale]) ]) AS_IF( [test "x$ac_cv_libclocale" = xyes], [AC_SUBST( [ax_libclocale_spec_requires], [libclocale]) AC_SUBST( [ax_libclocale_spec_build_requires], [libclocale-devel]) ]) ]) ================================================ FILE: m4/libcnotify.m4 ================================================ dnl Checks for libcnotify required headers and functions dnl dnl Version: 20240513 dnl Function to detect if libcnotify is available dnl ac_libcnotify_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCNOTIFY_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcnotify" = xno], [ac_cv_libcnotify=no], [ac_cv_libcnotify=check dnl Check if the directory provided as parameter exists dnl For both --with-libcnotify which returns "yes" and --with-libcnotify= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libcnotify" != x && test "x$ac_cv_with_libcnotify" != xauto-detect && test "x$ac_cv_with_libcnotify" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libcnotify])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libcnotify], [libcnotify >= 20120425], [ac_cv_libcnotify=yes], [ac_cv_libcnotify=check]) ]) AS_IF( [test "x$ac_cv_libcnotify" = xyes], [ac_cv_libcnotify_CPPFLAGS="$pkg_cv_libcnotify_CFLAGS" ac_cv_libcnotify_LIBADD="$pkg_cv_libcnotify_LIBS"]) ]) AS_IF( [test "x$ac_cv_libcnotify" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcnotify.h]) AS_IF( [test "x$ac_cv_header_libcnotify_h" = xno], [ac_cv_libcnotify=no], [ac_cv_libcnotify=yes AX_CHECK_LIB_FUNCTIONS( [libcnotify], [cnotify], [[libcnotify_get_version], [libcnotify_printf], [libcnotify_print_data], [libcnotify_print_error_backtrace], [libcnotify_stream_set], [libcnotify_stream_open], [libcnotify_stream_close], [libcnotify_verbose_set]]) ac_cv_libcnotify_LIBADD="-lcnotify"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libcnotify]) ]) AS_IF( [test "x$ac_cv_libcnotify" = xyes], [AC_DEFINE( [HAVE_LIBCNOTIFY], [1], [Define to 1 if you have the `cnotify' library (-lcnotify).]) ]) AS_IF( [test "x$ac_cv_libcnotify" = xyes], [AC_SUBST( [HAVE_LIBCNOTIFY], [1]) ], [AC_SUBST( [HAVE_LIBCNOTIFY], [0]) ]) ]) dnl Function to detect if libcnotify dependencies are available AC_DEFUN([AX_LIBCNOTIFY_CHECK_LOCAL], [dnl Headers included in libcnotify/libcnotify_print.c AC_CHECK_HEADERS([stdarg.h varargs.h]) AS_IF( [test "x$ac_cv_header_stdarg_h" != xyes && test "x$ac_cv_header_varargs_h" != xyes], [AC_MSG_FAILURE( [Missing headers: stdarg.h and varargs.h], [1]) ]) dnl Headers included in libcnotify/libcnotify_stream.c AC_CHECK_HEADERS([errno.h]) ac_cv_libcnotify_CPPFLAGS="-I../libcnotify -I\$(top_srcdir)/libcnotify"; ac_cv_libcnotify_LIBADD="../libcnotify/libcnotify.la"; ac_cv_libcnotify=local ]) dnl Function to detect how to enable libcnotify AC_DEFUN([AX_LIBCNOTIFY_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libcnotify], [libcnotify], [search for libcnotify in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBCNOTIFY_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libcnotify" != xyes], [AX_LIBCNOTIFY_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBCNOTIFY], [1], [Define to 1 if the local version of libcnotify is used.]) AC_SUBST( [HAVE_LOCAL_LIBCNOTIFY], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBCNOTIFY], [test "x$ac_cv_libcnotify" = xlocal]) AS_IF( [test "x$ac_cv_libcnotify_CPPFLAGS" != "x"], [AC_SUBST( [LIBCNOTIFY_CPPFLAGS], [$ac_cv_libcnotify_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libcnotify_LIBADD" != "x"], [AC_SUBST( [LIBCNOTIFY_LIBADD], [$ac_cv_libcnotify_LIBADD]) ]) AS_IF( [test "x$ac_cv_libcnotify" = xyes], [AC_SUBST( [ax_libcnotify_pc_libs_private], [-lcnotify]) ]) AS_IF( [test "x$ac_cv_libcnotify" = xyes], [AC_SUBST( [ax_libcnotify_spec_requires], [libcnotify]) AC_SUBST( [ax_libcnotify_spec_build_requires], [libcnotify-devel]) ]) ]) ================================================ FILE: m4/libcpath.m4 ================================================ dnl Checks for libcpath required headers and functions dnl dnl Version: 20240518 dnl Function to detect if libcpath is available dnl ac_libcpath_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCPATH_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcpath" = xno], [ac_cv_libcpath=no], [ac_cv_libcpath=check dnl Check if the directory provided as parameter exists dnl For both --with-libcpath which returns "yes" and --with-libcpath= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libcpath" != x && test "x$ac_cv_with_libcpath" != xauto-detect && test "x$ac_cv_with_libcpath" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libcpath])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libcpath], [libcpath >= 20180716], [ac_cv_libcpath=yes], [ac_cv_libcpath=check]) ]) AS_IF( [test "x$ac_cv_libcpath" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], [AC_CACHE_CHECK( [whether libcpath/features.h defines LIBCPATH_HAVE_WIDE_CHARACTER_TYPE as 1], [ac_cv_header_libcpath_features_h_have_wide_character_type], [AC_LANG_PUSH(C) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[#if !defined( LIBCPATH_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCPATH_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBCPATH_HAVE_WIDE_CHARACTER_TYPE not defined #endif]] )], [ac_cv_header_libcpath_features_h_have_wide_character_type=yes], [ac_cv_header_libcpath_features_h_have_wide_character_type=no]) AC_LANG_POP(C)], [ac_cv_header_libcpath_features_h_have_wide_character_type=no]) AS_IF( [test "x$ac_cv_header_libcpath_features_h_have_wide_character_type" = xno], [ac_cv_libcpath=no]) ]) AS_IF( [test "x$ac_cv_libcpath" = xyes], [ac_cv_libcpath_CPPFLAGS="$pkg_cv_libcpath_CFLAGS" ac_cv_libcpath_LIBADD="$pkg_cv_libcpath_LIBS"]) ]) AS_IF( [test "x$ac_cv_libcpath" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcpath.h]) AS_IF( [test "x$ac_cv_header_libcpath_h" = xno], [ac_cv_libcpath=no], [ac_cv_libcpath=yes AX_CHECK_LIB_FUNCTIONS( [libcpath], [cpath], [[libcpath_get_version], [libcpath_path_change_directory], [libcpath_path_get_current_working_directory], [libcpath_path_get_full_path], [libcpath_path_get_sanitized_filename], [libcpath_path_get_sanitized_path], [libcpath_path_join], [libcpath_path_make_directory]]) AS_IF( [test "x$ac_cv_enable_wide_character_type" != xno], [AX_CHECK_LIB_FUNCTIONS( [libcpath], [cpath], [[libcpath_path_change_directory_wide], [libcpath_path_get_current_working_directory_wide], [libcpath_path_get_full_path_wide], [libcpath_path_get_sanitized_filename_wide], [libcpath_path_get_sanitized_path_wide], [libcpath_path_join_wide], [libcpath_path_make_directory_wide]]) ]) ac_cv_libcpath_LIBADD="-lcpath"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libcpath]) ]) AS_IF( [test "x$ac_cv_libcpath" = xyes], [AC_DEFINE( [HAVE_LIBCPATH], [1], [Define to 1 if you have the `cpath' library (-lcpath).]) ]) AS_IF( [test "x$ac_cv_libcpath" = xyes], [AC_SUBST( [HAVE_LIBCPATH], [1]) ], [AC_SUBST( [HAVE_LIBCPATH], [0]) ]) ]) dnl Function to detect if mkdir is available dnl Also checks how to use mkdir AC_DEFUN([AX_LIBCPATH_CHECK_FUNC_MKDIR], [AC_CHECK_FUNCS([mkdir]) AS_IF( [test "x$ac_cv_func_mkdir" = xyes], [AC_MSG_CHECKING( [how to use mkdir]) SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror" AC_LANG_PUSH(C) AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include #include ]], [[mkdir( "", 0 )]] )], [AC_MSG_RESULT( [with additional mode argument]) ac_cv_cv_mkdir_mode=yes], [ac_cv_cv_mkdir_mode=no]) AS_IF( [test "x$ac_cv_cv_mkdir_mode" = xno], [AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[mkdir( "" )]] )], [AC_MSG_RESULT( [with single argument]) ac_cv_cv_mkdir=yes], [ac_cv_cv_mkdir=no]) ]) AC_LANG_POP(C) CFLAGS="$SAVE_CFLAGS" AS_IF( [test "x$ac_cv_cv_mkdir_mode" = xno && test "x$ac_cv_cv_mkdir" = xno], [AC_MSG_WARN( [unknown]) ac_cv_func_mkdir=no]) AS_IF( [test "x$ac_cv_func_mkdir" = xyes], [AC_DEFINE( [HAVE_MKDIR], [1], [Define to 1 if you have the mkdir function.]) ]) AS_IF( [test "x$ac_cv_cv_mkdir_mode" = xyes], [AC_DEFINE( [HAVE_MKDIR_MODE], [1], [Define to 1 if you have the mkdir function with a second mode argument.]) ]) ]) AS_IF( [test "x$ac_cv_func_mkdir" = xno], [AC_MSG_FAILURE( [Missing function: mkdir], [1]) ]) ]) dnl Function to detect if libcpath dependencies are available AC_DEFUN([AX_LIBCPATH_CHECK_LOCAL], [dnl Headers included in libcpath/libcpath_path.h AC_CHECK_HEADERS([errno.h sys/stat.h sys/syslimits.h]) dnl Path functions used in libcpath/libcpath_path.h AC_CHECK_FUNCS([chdir getcwd]) AS_IF( [test "x$ac_cv_func_chdir" != xyes], [AC_MSG_FAILURE( [Missing functions: chdir], [1]) ]) AS_IF( [test "x$ac_cv_func_getcwd" != xyes], [AC_MSG_FAILURE( [Missing functions: getcwd], [1]) ]) AX_LIBCPATH_CHECK_FUNC_MKDIR ac_cv_libcpath_CPPFLAGS="-I../libcpath -I\$(top_srcdir)/libcpath"; ac_cv_libcpath_LIBADD="../libcpath/libcpath.la"; ac_cv_libcpath=local ]) dnl Function to detect how to enable libcpath AC_DEFUN([AX_LIBCPATH_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libcpath], [libcpath], [search for libcpath in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBCPATH_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libcpath" != xyes], [AX_LIBCPATH_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBCPATH], [1], [Define to 1 if the local version of libcpath is used.]) AC_SUBST( [HAVE_LOCAL_LIBCPATH], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBCPATH], [test "x$ac_cv_libcpath" = xlocal]) AS_IF( [test "x$ac_cv_libcpath_CPPFLAGS" != "x"], [AC_SUBST( [LIBCPATH_CPPFLAGS], [$ac_cv_libcpath_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libcpath_LIBADD" != "x"], [AC_SUBST( [LIBCPATH_LIBADD], [$ac_cv_libcpath_LIBADD]) ]) AS_IF( [test "x$ac_cv_libcpath" = xyes], [AC_SUBST( [ax_libcpath_pc_libs_private], [-lcpath]) ]) AS_IF( [test "x$ac_cv_libcpath" = xyes], [AC_SUBST( [ax_libcpath_spec_requires], [libcpath]) AC_SUBST( [ax_libcpath_spec_build_requires], [libcpath-devel]) ]) ]) ================================================ FILE: m4/libcsplit.m4 ================================================ dnl Checks for libcsplit required headers and functions dnl dnl Version: 20240513 dnl Function to detect if libcsplit is available dnl ac_libcsplit_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCSPLIT_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcsplit" = xno], [ac_cv_libcsplit=no], [ac_cv_libcsplit=check dnl Check if the directory provided as parameter exists dnl For both --with-libcsplit which returns "yes" and --with-libcsplit= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libcsplit" != x && test "x$ac_cv_with_libcsplit" != xauto-detect && test "x$ac_cv_with_libcsplit" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libcsplit])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libcsplit], [libcsplit >= 20120701], [ac_cv_libcsplit=yes], [ac_cv_libcsplit=check]) ]) AS_IF( [test "x$ac_cv_libcsplit" = xyes && test "x$ac_cv_enable_wide_character_type" != xno], [AC_CACHE_CHECK( [whether libcsplit/features.h defines LIBCSPLIT_HAVE_WIDE_CHARACTER_TYPE as 1], [ac_cv_header_libcsplit_features_h_have_wide_character_type], [AC_LANG_PUSH(C) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include ]], [[#if !defined( LIBCSPLIT_HAVE_WIDE_CHARACTER_TYPE ) || ( LIBCSPLIT_HAVE_WIDE_CHARACTER_TYPE != 1 ) #error LIBCSPLIT_HAVE_WIDE_CHARACTER_TYPE not defined #endif]] )], [ac_cv_header_libcsplit_features_h_have_wide_character_type=yes], [ac_cv_header_libcsplit_features_h_have_wide_character_type=no]) AC_LANG_POP(C)], [ac_cv_header_libcsplit_features_h_have_wide_character_type=no]) AS_IF( [test "x$ac_cv_header_libcsplit_features_h_have_wide_character_type" = xno], [ac_cv_libcsplit=no]) ]) AS_IF( [test "x$ac_cv_libcsplit" = xyes], [ac_cv_libcsplit_CPPFLAGS="$pkg_cv_libcsplit_CFLAGS" ac_cv_libcsplit_LIBADD="$pkg_cv_libcsplit_LIBS"]) ]) AS_IF( [test "x$ac_cv_libcsplit" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcsplit.h]) AS_IF( [test "x$ac_cv_header_libcsplit_h" = xno], [ac_cv_libcsplit=no], [ac_cv_libcsplit=yes AX_CHECK_LIB_FUNCTIONS( [libcsplit], [csplit], [[libcsplit_get_version], [libcsplit_narrow_string_split], [libcsplit_narrow_split_string_free], [libcsplit_narrow_split_string_get_string], [libcsplit_narrow_split_string_get_number_of_segments], [libcsplit_narrow_split_string_get_segment_by_index], [libcsplit_narrow_split_string_set_segment_by_index]]) dnl Wide string functions AS_IF( [test "x$ac_cv_enable_wide_character_type" != xno], [AX_CHECK_LIB_FUNCTIONS( [libcsplit], [csplit], [[libcsplit_wide_string_split], [libcsplit_wide_split_string_free], [libcsplit_wide_split_string_get_string], [libcsplit_wide_split_string_get_number_of_segments], [libcsplit_wide_split_string_get_segment_by_index], [libcsplit_wide_split_string_set_segment_by_index]]) ]) ac_cv_libcsplit_LIBADD="-lcsplit"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libcsplit]) ]) AS_IF( [test "x$ac_cv_libcsplit" = xyes], [AC_DEFINE( [HAVE_LIBCSPLIT], [1], [Define to 1 if you have the `csplit' library (-lcsplit).]) ]) AS_IF( [test "x$ac_cv_libcsplit" = xyes], [AC_SUBST( [HAVE_LIBCSPLIT], [1]) ], [AC_SUBST( [HAVE_LIBCSPLIT], [0]) ]) ]) dnl Function to detect if libcsplit dependencies are available AC_DEFUN([AX_LIBCSPLIT_CHECK_LOCAL], [dnl No additional checks. ac_cv_libcsplit_CPPFLAGS="-I../libcsplit -I\$(top_srcdir)/libcsplit"; ac_cv_libcsplit_LIBADD="../libcsplit/libcsplit.la"; ac_cv_libcsplit=local ]) dnl Function to detect how to enable libcsplit AC_DEFUN([AX_LIBCSPLIT_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libcsplit], [libcsplit], [search for libcsplit in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBCSPLIT_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libcsplit" != xyes], [AX_LIBCSPLIT_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBCSPLIT], [1], [Define to 1 if the local version of libcsplit is used.]) AC_SUBST( [HAVE_LOCAL_LIBCSPLIT], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBCSPLIT], [test "x$ac_cv_libcsplit" = xlocal]) AS_IF( [test "x$ac_cv_libcsplit_CPPFLAGS" != "x"], [AC_SUBST( [LIBCSPLIT_CPPFLAGS], [$ac_cv_libcsplit_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libcsplit_LIBADD" != "x"], [AC_SUBST( [LIBCSPLIT_LIBADD], [$ac_cv_libcsplit_LIBADD]) ]) AS_IF( [test "x$ac_cv_libcsplit" = xyes], [AC_SUBST( [ax_libcsplit_pc_libs_private], [-lcsplit]) ]) AS_IF( [test "x$ac_cv_libcsplit" = xyes], [AC_SUBST( [ax_libcsplit_spec_requires], [libcsplit]) AC_SUBST( [ax_libcsplit_spec_build_requires], [libcsplit-devel]) ]) ]) ================================================ FILE: m4/libcthreads.m4 ================================================ dnl Checks for libcthreads required headers and functions dnl dnl Version: 20240513 dnl Function to detect if libcthreads is available dnl ac_libcthreads_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBCTHREADS_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libcthreads" = xno], [ac_cv_libcthreads=no], [ac_cv_libcthreads=check dnl Check if the directory provided as parameter exists dnl For both --with-libcthreads which returns "yes" and --with-libcthreads= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libcthreads" != x && test "x$ac_cv_with_libcthreads" != xauto-detect && test "x$ac_cv_with_libcthreads" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libcthreads])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libcthreads], [libcthreads >= 20160404], [ac_cv_libcthreads=yes], [ac_cv_libcthreads=check]) ]) AS_IF( [test "x$ac_cv_libcthreads" = xyes], [ac_cv_libcthreads_CPPFLAGS="$pkg_cv_libcthreads_CFLAGS" ac_cv_libcthreads_LIBADD="$pkg_cv_libcthreads_LIBS"]) ]) AS_IF( [test "x$ac_cv_libcthreads" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libcthreads.h]) AS_IF( [test "x$ac_cv_header_libcthreads_h" = xno], [ac_cv_libcthreads=no], [ac_cv_libcthreads=yes AX_CHECK_LIB_FUNCTIONS( [libcthreads], [cthreads], [[libcthreads_get_version], [libcthreads_thread_create], [libcthreads_thread_join], [libcthreads_thread_attributes_initialize], [libcthreads_thread_attributes_free], [libcthreads_condition_initialize], [libcthreads_condition_free], [libcthreads_condition_broadcast], [libcthreads_condition_signal], [libcthreads_condition_wait], [libcthreads_lock_initialize], [libcthreads_lock_free], [libcthreads_lock_grab], [libcthreads_lock_release], [libcthreads_mutex_initialize], [libcthreads_mutex_free], [libcthreads_mutex_grab], [libcthreads_mutex_try_grab], [libcthreads_mutex_release], [libcthreads_read_write_lock_initialize], [libcthreads_read_write_lock_free], [libcthreads_read_write_lock_grab_for_read], [libcthreads_read_write_lock_grab_for_write], [libcthreads_read_write_lock_release_for_read], [libcthreads_read_write_lock_release_for_write], [libcthreads_queue_initialize], [libcthreads_queue_free], [libcthreads_queue_type_pop], [libcthreads_queue_pop], [libcthreads_queue_try_push], [libcthreads_queue_push], [libcthreads_queue_push_sorted], [libcthreads_thread_pool_create], [libcthreads_thread_pool_push], [libcthreads_thread_pool_push_sorted], [libcthreads_thread_pool_join]]) ac_cv_libcthreads_LIBADD="-lcthreads"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libcthreads]) ]) AS_IF( [test "x$ac_cv_libcthreads" = xyes], [AC_DEFINE( [HAVE_LIBCTHREADS], [1], [Define to 1 if you have the `cthreads' library (-lcthreads).]) ]) AS_IF( [test "x$ac_cv_libcthreads" = xyes], [ac_cv_libcthreads_multi_threading=libcthreads], [ac_cv_libcthreads_multi_threading=no]) AS_IF( [test "x$ac_cv_libcthreads" = xyes], [AC_SUBST( [HAVE_LIBCTHREADS], [1]) ], [AC_SUBST( [HAVE_LIBCTHREADS], [0]) ]) ]) dnl Function to detect if libcthreads dependencies are available AC_DEFUN([AX_LIBCTHREADS_CHECK_LOCAL], [AS_IF( [test "x$ac_cv_enable_winapi" = xno], [dnl Check for enabling pthread support AX_PTHREAD_CHECK_ENABLE ac_cv_libcthreads_multi_threading=$ac_cv_pthread], [ac_cv_libcthreads_multi_threading="winapi"]) AS_IF( [test "x$ac_cv_libcthreads_multi_threading" != xno], [ac_cv_libcthreads_CPPFLAGS="-I../libcthreads -I\$(top_srcdir)/libcthreads"; ac_cv_libcthreads_LIBADD="../libcthreads/libcthreads.la"; ac_cv_libcthreads=local], [ac_cv_libcthreads=no]) ]) dnl Function to detect how to enable libcthreads AC_DEFUN([AX_LIBCTHREADS_CHECK_ENABLE], [AX_COMMON_ARG_ENABLE( [multi-threading-support], [multi_threading_support], [enable multi-threading support], [yes]) AX_COMMON_ARG_WITH( [libcthreads], [libcthreads], [search for libcthreads in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) AS_IF( [test "x$ac_cv_enable_multi_threading_support" = xno], [ac_cv_libcthreads="no" ac_cv_libcthreads_multi_threading="no"], [dnl Check for a shared library version AX_LIBCTHREADS_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libcthreads" != xyes], [AX_LIBCTHREADS_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBCTHREADS], [1], [Define to 1 if the local version of libcthreads is used.]) AC_SUBST( [HAVE_LOCAL_LIBCTHREADS], [1]) ]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBCTHREADS], [test "x$ac_cv_libcthreads" = xlocal]) AS_IF( [test "x$ac_cv_libcthreads_CPPFLAGS" != "x"], [AC_SUBST( [LIBCTHREADS_CPPFLAGS], [$ac_cv_libcthreads_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libcthreads_LIBADD" != "x"], [AC_SUBST( [LIBCTHREADS_LIBADD], [$ac_cv_libcthreads_LIBADD]) ]) AS_IF( [test "x$ac_cv_libcthreads" != xno], [AC_DEFINE( [HAVE_MULTI_THREAD_SUPPORT], [1], [Define to 1 if multi thread support should be used.]) AC_SUBST( [HAVE_MULTI_THREAD_SUPPORT], [1]) ], [AC_SUBST( [HAVE_MULTI_THREAD_SUPPORT], [0]) ]) AS_IF( [test "x$ac_cv_libcthreads" = xyes], [AC_SUBST( [ax_libcthreads_pc_libs_private], [-lcthreads]) ]) AS_IF( [test "x$ac_cv_libcthreads" = xyes], [AC_SUBST( [ax_libcthreads_spec_requires], [libcthreads]) AC_SUBST( [ax_libcthreads_spec_build_requires], [libcthreads-devel]) ]) ]) ================================================ FILE: m4/libfcache.m4 ================================================ dnl Checks for libfcache required headers and functions dnl dnl Version: 20240514 dnl Function to detect if libfcache is available dnl ac_libfcache_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBFCACHE_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfcache" = xno], [ac_cv_libfcache=no], [ac_cv_libfcache=check dnl Check if the directory provided as parameter exists dnl For both --with-libfcache which returns "yes" and --with-libfcache= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libfcache" != x && test "x$ac_cv_with_libfcache" != xauto-detect && test "x$ac_cv_with_libfcache" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libfcache])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libfcache], [libfcache >= 20191109], [ac_cv_libfcache=yes], [ac_cv_libfcache=check]) ]) AS_IF( [test "x$ac_cv_libfcache" = xyes], [ac_cv_libfcache_CPPFLAGS="$pkg_cv_libfcache_CFLAGS" ac_cv_libfcache_LIBADD="$pkg_cv_libfcache_LIBS"]) ]) AS_IF( [test "x$ac_cv_libfcache" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libfcache.h]) AS_IF( [test "x$ac_cv_header_libfcache_h" = xno], [ac_cv_libfcache=no], [ac_cv_libfcache=yes AX_CHECK_LIB_FUNCTIONS( [libfcache], [fcache], [[libfcache_get_version], [libfcache_cache_initialize], [libfcache_cache_free], [libfcache_cache_clone], [libfcache_cache_clear], [libfcache_cache_get_number_of_entries], [libfcache_cache_get_number_of_cache_values], [libfcache_cache_clear_value_by_index], [libfcache_cache_get_value_by_identifier], [libfcache_cache_get_value_by_index], [libfcache_cache_set_value_by_identifier], [libfcache_cache_set_value_by_index], [libfcache_cache_value_free], [libfcache_cache_value_clear], [libfcache_cache_value_get_identifier], [libfcache_cache_value_set_identifier], [libfcache_cache_value_get_value], [libfcache_cache_value_set_value], [libfcache_date_time_get_timestamp]]) ac_cv_libfcache_LIBADD="-lfcache"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libfcache]) ]) AS_IF( [test "x$ac_cv_libfcache" = xyes], [AC_DEFINE( [HAVE_LIBFCACHE], [1], [Define to 1 if you have the `fcache' library (-lfcache).]) ]) AS_IF( [test "x$ac_cv_libfcache" = xyes], [AC_SUBST( [HAVE_LIBFCACHE], [1]) ], [AC_SUBST( [HAVE_LIBFCACHE], [0]) ]) ]) dnl Function to detect if libfcache dependencies are available AC_DEFUN([AX_LIBFCACHE_CHECK_LOCAL], [dnl Types used in libfcache/libfcache_date_time.h AC_STRUCT_TM dnl Headers included in libfcache/libfcache_date_time.h AC_CHECK_HEADERS([sys/time.h]) dnl Date and time functions used in libfcache/libfcache_date_time.h AC_CHECK_FUNCS([clock_gettime time]) AS_IF( [test "x$ac_cv_func_time" != xyes], [AC_MSG_FAILURE( [Missing function: time], [1]) ]) ac_cv_libfcache_CPPFLAGS="-I../libfcache -I\$(top_srcdir)/libfcache"; ac_cv_libfcache_LIBADD="../libfcache/libfcache.la"; ac_cv_libfcache=local ]) dnl Function to detect how to enable libfcache AC_DEFUN([AX_LIBFCACHE_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libfcache], [libfcache], [search for libfcache in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBFCACHE_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libfcache" != xyes], [AX_LIBFCACHE_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBFCACHE], [1], [Define to 1 if the local version of libfcache is used.]) AC_SUBST( [HAVE_LOCAL_LIBFCACHE], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBFCACHE], [test "x$ac_cv_libfcache" = xlocal]) AS_IF( [test "x$ac_cv_libfcache_CPPFLAGS" != "x"], [AC_SUBST( [LIBFCACHE_CPPFLAGS], [$ac_cv_libfcache_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libfcache_LIBADD" != "x"], [AC_SUBST( [LIBFCACHE_LIBADD], [$ac_cv_libfcache_LIBADD]) ]) AS_IF( [test "x$ac_cv_libfcache" = xyes], [AC_SUBST( [ax_libfcache_pc_libs_private], [-lfcache]) ]) AS_IF( [test "x$ac_cv_libfcache" = xyes], [AC_SUBST( [ax_libfcache_spec_requires], [libfcache]) AC_SUBST( [ax_libfcache_spec_build_requires], [libfcache-devel]) ]) ]) ================================================ FILE: m4/libfdata.m4 ================================================ dnl Functions for libfdata dnl dnl Version: 20240520 dnl Function to detect if libfdata is available dnl ac_libfdata_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBFDATA_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfdata" = xno], [ac_cv_libfdata=no], [ac_cv_libfdata=check dnl Check if the directory provided as parameter exists dnl For both --with-libfdata which returns "yes" and --with-libfdata= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libfdata" != x && test "x$ac_cv_with_libfdata" != xauto-detect && test "x$ac_cv_with_libfdata" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libfdata])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libfdata], [libfdata >= 20201129], [ac_cv_libfdata=yes], [ac_cv_libfdata=check]) ]) AS_IF( [test "x$ac_cv_libfdata" = xyes], [ac_cv_libfdata_CPPFLAGS="$pkg_cv_libfdata_CFLAGS" ac_cv_libfdata_LIBADD="$pkg_cv_libfdata_LIBS"]) ]) AS_IF( [test "x$ac_cv_libfdata" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libfdata.h]) AS_IF( [test "x$ac_cv_header_libfdata_h" = xno], [ac_cv_libfdata=no], [ac_cv_libfdata=yes AX_CHECK_LIB_FUNCTIONS( [libfdata], [fdata], [[libfdata_get_version], [libfdata_area_initialize], [libfdata_area_free], [libfdata_area_clone], [libfdata_area_empty], [libfdata_area_resize], [libfdata_area_get_number_of_segments], [libfdata_area_get_segment_by_index], [libfdata_area_set_segment_by_index], [libfdata_area_prepend_segment], [libfdata_area_append_segment], [libfdata_area_get_element_data_size], [libfdata_area_get_element_value_at_offset], [libfdata_area_set_element_value_at_offset], [libfdata_area_get_size], [libfdata_list_initialize], [libfdata_list_free], [libfdata_list_clone], [libfdata_list_empty], [libfdata_list_resize], [libfdata_list_reverse], [libfdata_list_get_number_of_elements], [libfdata_list_get_list_element_by_index], [libfdata_list_get_element_by_index], [libfdata_list_set_element_by_index], [libfdata_list_prepend_element], [libfdata_list_append_element], [libfdata_list_append_list], [libfdata_list_is_element_set], [libfdata_list_get_element_mapped_range], [libfdata_list_get_mapped_offset], [libfdata_list_set_mapped_offset], [libfdata_list_get_mapped_size_by_index], [libfdata_list_set_mapped_size_by_index], [libfdata_list_get_element_by_index_with_mapped_size], [libfdata_list_set_element_by_index_with_mapped_size], [libfdata_list_append_element_with_mapped_size], [libfdata_list_get_element_index_at_offset], [libfdata_list_get_list_element_at_offset], [libfdata_list_get_element_at_offset], [libfdata_list_cache_element_value], [libfdata_list_get_element_value_by_index], [libfdata_list_get_element_value_at_offset], [libfdata_list_set_element_value_by_index], [libfdata_list_set_element_value_at_offset], [libfdata_list_get_size], [libfdata_list_element_get_mapped_size], [libfdata_list_element_set_mapped_size], [libfdata_list_element_get_element_value], [libfdata_list_element_set_element_value], [libfdata_list_element_get_mapped_size], [libfdata_list_element_set_mapped_size], [libfdata_list_element_get_element_value], [libfdata_list_element_set_element_value], [libfdata_stream_initialize], [libfdata_stream_free], [libfdata_stream_clone], [libfdata_stream_empty], [libfdata_stream_resize], [libfdata_stream_reverse], [libfdata_stream_get_number_of_segments], [libfdata_stream_get_segment_by_index], [libfdata_stream_set_segment_by_index], [libfdata_stream_prepend_segment], [libfdata_stream_append_segment], [libfdata_stream_set_mapped_size], [libfdata_stream_get_segment_mapped_range], [libfdata_stream_get_segment_index_at_offset], [libfdata_stream_get_segment_at_offset], [libfdata_stream_read_buffer], [libfdata_stream_read_buffer_at_offset], [libfdata_stream_write_buffer], [libfdata_stream_seek_offset], [libfdata_stream_get_offset], [libfdata_stream_get_size], [libfdata_range_list_initialize], [libfdata_range_list_free], [libfdata_range_list_clone], [libfdata_range_list_empty], [libfdata_range_list_get_list_element_at_offset], [libfdata_range_list_get_element_at_offset], [libfdata_range_list_insert_element], [libfdata_range_list_get_element_value_at_offset], [libfdata_range_list_set_element_value_at_offset], [libfdata_vector_initialize], [libfdata_vector_free], [libfdata_vector_clone], [libfdata_vector_empty], [libfdata_vector_resize], [libfdata_vector_get_number_of_segments], [libfdata_vector_get_segment_by_index], [libfdata_vector_set_segment_by_index], [libfdata_vector_prepend_segment], [libfdata_vector_append_segment], [libfdata_vector_get_element_data_size], [libfdata_vector_get_number_of_elements], [libfdata_vector_get_element_index_at_offset], [libfdata_vector_get_element_value_by_index], [libfdata_vector_get_element_value_at_offset], [libfdata_vector_set_element_value_by_index], [libfdata_vector_get_size]]) ac_cv_libfdata_LIBADD="-lfdata"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libfdata]) ]) AS_IF( [test "x$ac_cv_libfdata" = xyes], [AC_DEFINE( [HAVE_LIBFDATA], [1], [Define to 1 if you have the `fdata' library (-lfdata).]) ]) AS_IF( [test "x$ac_cv_libfdata" = xyes], [AC_SUBST( [HAVE_LIBFDATA], [1]) ], [AC_SUBST( [HAVE_LIBFDATA], [0]) ]) ]) dnl Function to detect if libfdata dependencies are available AC_DEFUN([AX_LIBFDATA_CHECK_LOCAL], [dnl No additional checks. ac_cv_libfdata_CPPFLAGS="-I../libfdata -I\$(top_srcdir)/libfdata"; ac_cv_libfdata_LIBADD="../libfdata/libfdata.la"; ac_cv_libfdata=local ]) dnl Function to detect how to enable libfdata AC_DEFUN([AX_LIBFDATA_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libfdata], [libfdata], [search for libfdata in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBFDATA_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libfdata" != xyes], [AX_LIBFDATA_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBFDATA], [1], [Define to 1 if the local version of libfdata is used.]) AC_SUBST( [HAVE_LOCAL_LIBFDATA], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBFDATA], [test "x$ac_cv_libfdata" = xlocal]) AS_IF( [test "x$ac_cv_libfdata_CPPFLAGS" != "x"], [AC_SUBST( [LIBFDATA_CPPFLAGS], [$ac_cv_libfdata_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libfdata_LIBADD" != "x"], [AC_SUBST( [LIBFDATA_LIBADD], [$ac_cv_libfdata_LIBADD]) ]) AS_IF( [test "x$ac_cv_libfdata" = xyes], [AC_SUBST( [ax_libfdata_pc_libs_private], [-lfdata]) ]) AS_IF( [test "x$ac_cv_libfdata" = xyes], [AC_SUBST( [ax_libfdata_spec_requires], [libfdata]) AC_SUBST( [ax_libfdata_spec_build_requires], [libfdata-devel]) ]) ]) ================================================ FILE: m4/libfdatetime.m4 ================================================ dnl Checks for libfdatetime required headers and functions dnl dnl Version: 20240518 dnl Function to detect if libfdatetime is available dnl ac_libfdatetime_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBFDATETIME_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfdatetime" = xno], [ac_cv_libfdatetime=no], [ac_cv_libfdatetime=check dnl Check if the directory provided as parameter exists dnl For both --with-libfdatetime which returns "yes" and --with-libfdatetime= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libfdatetime" != x && test "x$ac_cv_with_libfdatetime" != xauto-detect && test "x$ac_cv_with_libfdatetime" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libfdatetime])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libfdatetime], [libfdatetime >= 20180910], [ac_cv_libfdatetime=yes], [ac_cv_libfdatetime=check]) ]) AS_IF( [test "x$ac_cv_libfdatetime" = xyes], [ac_cv_libfdatetime_CPPFLAGS="$pkg_cv_libfdatetime_CFLAGS" ac_cv_libfdatetime_LIBADD="$pkg_cv_libfdatetime_LIBS"]) ]) AS_IF( [test "x$ac_cv_libfdatetime" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libfdatetime.h]) AS_IF( [test "x$ac_cv_header_libfdatetime_h" = xno], [ac_cv_libfdatetime=no], [ac_cv_libfdatetime=yes AX_CHECK_LIB_FUNCTIONS( [libfdatetime], [fdatetime], [[libfdatetime_get_version], [libfdatetime_fat_date_time_initialize], [libfdatetime_fat_date_time_free], [libfdatetime_fat_date_time_copy_from_byte_stream], [libfdatetime_fat_date_time_copy_from_32bit], [libfdatetime_fat_date_time_copy_to_32bit], [libfdatetime_fat_date_time_copy_to_utf8_string], [libfdatetime_fat_date_time_copy_to_utf8_string_with_index], [libfdatetime_fat_date_time_copy_to_utf16_string], [libfdatetime_fat_date_time_copy_to_utf16_string_with_index], [libfdatetime_fat_date_time_copy_to_utf32_string], [libfdatetime_fat_date_time_copy_to_utf32_string_with_index], [libfdatetime_filetime_initialize], [libfdatetime_filetime_free], [libfdatetime_filetime_copy_from_byte_stream], [libfdatetime_filetime_copy_from_64bit], [libfdatetime_filetime_copy_to_64bit], [libfdatetime_filetime_copy_to_utf8_string], [libfdatetime_filetime_copy_to_utf8_string_with_index], [libfdatetime_filetime_copy_to_utf16_string], [libfdatetime_filetime_copy_to_utf16_string_with_index], [libfdatetime_filetime_copy_to_utf32_string], [libfdatetime_filetime_copy_to_utf32_string_with_index], [libfdatetime_filetime_add], [libfdatetime_floatingtime_initialize], [libfdatetime_floatingtime_free], [libfdatetime_floatingtime_copy_from_byte_stream], [libfdatetime_floatingtime_copy_from_64bit], [libfdatetime_floatingtime_copy_to_64bit], [libfdatetime_floatingtime_copy_to_utf8_string], [libfdatetime_floatingtime_copy_to_utf8_string_with_index], [libfdatetime_floatingtime_copy_to_utf16_string], [libfdatetime_floatingtime_copy_to_utf16_string_with_index], [libfdatetime_floatingtime_copy_to_utf32_string], [libfdatetime_floatingtime_copy_to_utf32_string_with_index], [libfdatetime_hfs_time_initialize], [libfdatetime_hfs_time_free], [libfdatetime_hfs_time_copy_from_byte_stream], [libfdatetime_hfs_time_copy_from_32bit], [libfdatetime_hfs_time_copy_to_32bit], [libfdatetime_hfs_time_copy_to_utf8_string], [libfdatetime_hfs_time_copy_to_utf8_string_with_index], [libfdatetime_hfs_time_copy_to_utf16_string], [libfdatetime_hfs_time_copy_to_utf16_string_with_index], [libfdatetime_hfs_time_copy_to_utf32_string], [libfdatetime_hfs_time_copy_to_utf32_string_with_index], [libfdatetime_nsf_timedate_initialize], [libfdatetime_nsf_timedate_free], [libfdatetime_nsf_timedate_copy_from_byte_stream], [libfdatetime_nsf_timedate_copy_from_64bit], [libfdatetime_nsf_timedate_copy_to_64bit], [libfdatetime_nsf_timedate_copy_to_utf8_string], [libfdatetime_nsf_timedate_copy_to_utf8_string_with_index], [libfdatetime_nsf_timedate_copy_to_utf16_string], [libfdatetime_nsf_timedate_copy_to_utf16_string_with_index], [libfdatetime_nsf_timedate_copy_to_utf32_string], [libfdatetime_nsf_timedate_copy_to_utf32_string_with_index], [libfdatetime_posix_time_initialize], [libfdatetime_posix_time_free], [libfdatetime_posix_time_copy_from_byte_stream], [libfdatetime_posix_time_copy_from_32bit], [libfdatetime_posix_time_copy_to_32bit], [libfdatetime_posix_time_copy_from_64bit], [libfdatetime_posix_time_copy_to_64bit], [libfdatetime_posix_time_copy_to_utf8_string], [libfdatetime_posix_time_copy_to_utf8_string_with_index], [libfdatetime_posix_time_copy_to_utf16_string], [libfdatetime_posix_time_copy_to_utf16_string_with_index], [libfdatetime_posix_time_copy_to_utf32_string], [libfdatetime_posix_time_copy_to_utf32_string_with_index], [libfdatetime_systemetime_initialize], [libfdatetime_systemetime_free], [libfdatetime_systemetime_copy_from_byte_stream], [libfdatetime_systemetime_copy_to_utf8_string], [libfdatetime_systemetime_copy_to_utf8_string_with_index], [libfdatetime_systemetime_copy_to_utf16_string], [libfdatetime_systemetime_copy_to_utf16_string_with_index], [libfdatetime_systemetime_copy_to_utf32_string], [libfdatetime_systemetime_copy_to_utf32_string_with_index]]) ac_cv_libfdatetime_LIBADD="-lfdatetime"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libfdatetime]) ]) AS_IF( [test "x$ac_cv_libfdatetime" = xyes], [AC_DEFINE( [HAVE_LIBFDATETIME], [1], [Define to 1 if you have the `fdatetime' library (-lfdatetime).]) ]) AS_IF( [test "x$ac_cv_libfdatetime" = xyes], [AC_SUBST( [HAVE_LIBFDATETIME], [1]) ], [AC_SUBST( [HAVE_LIBFDATETIME], [0]) ]) ]) dnl Function to detect if libfdatetime dependencies are available AC_DEFUN([AX_LIBFDATETIME_CHECK_LOCAL], [dnl No additional checks. ac_cv_libfdatetime_CPPFLAGS="-I../libfdatetime -I\$(top_srcdir)/libfdatetime"; ac_cv_libfdatetime_LIBADD="../libfdatetime/libfdatetime.la"; ac_cv_libfdatetime=local ]) dnl Function to detect how to enable libfdatetime AC_DEFUN([AX_LIBFDATETIME_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libfdatetime], [libfdatetime], [search for libfdatetime in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) AX_LIBFDATETIME_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libfdatetime" != xyes], [AX_LIBFDATETIME_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBFDATETIME], [1], [Define to 1 if the local version of libfdatetime is used.]) AC_SUBST( [HAVE_LOCAL_LIBFDATETIME], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBFDATETIME], [test "x$ac_cv_libfdatetime" = xlocal]) AS_IF( [test "x$ac_cv_libfdatetime_CPPFLAGS" != "x"], [AC_SUBST( [LIBFDATETIME_CPPFLAGS], [$ac_cv_libfdatetime_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libfdatetime_LIBADD" != "x"], [AC_SUBST( [LIBFDATETIME_LIBADD], [$ac_cv_libfdatetime_LIBADD]) ]) AS_IF( [test "x$ac_cv_libfdatetime" = xyes], [AC_SUBST( [ax_libfdatetime_pc_libs_private], [-lfdatetime]) ]) AS_IF( [test "x$ac_cv_libfdatetime" = xyes], [AC_SUBST( [ax_libfdatetime_spec_requires], [libfdatetime]) AC_SUBST( [ax_libfdatetime_spec_build_requires], [libfdatetime-devel]) ]) ]) ================================================ FILE: m4/libfguid.m4 ================================================ dnl Checks for libfguid required headers and functions dnl dnl Version: 20240519 dnl Function to detect if libfguid is available dnl ac_libfguid_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBFGUID_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfguid" = xno], [ac_cv_libfguid=no], [ac_cv_libfguid=check dnl Check if the directory provided as parameter exists dnl For both --with-libfguid which returns "yes" and --with-libfguid= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libfguid" != x && test "x$ac_cv_with_libfguid" != xauto-detect && test "x$ac_cv_with_libfguid" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libfguid])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libfguid], [libfguid >= 20120426], [ac_cv_libfguid=yes], [ac_cv_libfguid=check]) ]) AS_IF( [test "x$ac_cv_libfguid" = xyes], [ac_cv_libfguid_CPPFLAGS="$pkg_cv_libfguid_CFLAGS" ac_cv_libfguid_LIBADD="$pkg_cv_libfguid_LIBS"]) ]) AS_IF( [test "x$ac_cv_libfguid" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libfguid.h]) AS_IF( [test "x$ac_cv_header_libfguid_h" = xno], [ac_cv_libfguid=no], [ac_cv_libfguid=yes AX_CHECK_LIB_FUNCTIONS( [libfguid], [fguid], [[libfguid_get_version], [libfguid_identifier_initialize], [libfguid_identifier_free], [libfguid_identifier_copy_from_byte_stream], [libfguid_identifier_get_string_size], [libfguid_identifier_copy_to_utf8_string], [libfguid_identifier_copy_to_utf8_string_with_index], [libfguid_identifier_copy_to_utf16_string], [libfguid_identifier_copy_to_utf16_string_with_index], [libfguid_identifier_copy_to_utf32_string], [libfguid_identifier_copy_to_utf32_string_with_index]]) ac_cv_libfguid_LIBADD="-lfguid"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libfguid]) ]) AS_IF( [test "x$ac_cv_libfguid" = xyes], [AC_DEFINE( [HAVE_LIBFGUID], [1], [Define to 1 if you have the `fguid' library (-lfguid).]) ]) AS_IF( [test "x$ac_cv_libfguid" = xyes], [AC_SUBST( [HAVE_LIBFGUID], [1]) ], [AC_SUBST( [HAVE_LIBFGUID], [0]) ]) ]) dnl Function to detect if libfguid dependencies are available AC_DEFUN([AX_LIBFGUID_CHECK_LOCAL], [dnl No additional checks. ac_cv_libfguid_CPPFLAGS="-I../libfguid -I\$(top_srcdir)/libfguid"; ac_cv_libfguid_LIBADD="../libfguid/libfguid.la"; ac_cv_libfguid=local ]) dnl Function to detect how to enable libfguid AC_DEFUN([AX_LIBFGUID_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libfguid], [libfguid], [search for libfguid in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBFGUID_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libfguid" != xyes], [AX_LIBFGUID_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBFGUID], [1], [Define to 1 if the local version of libfguid is used.]) AC_SUBST( [HAVE_LOCAL_LIBFGUID], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBFGUID], [test "x$ac_cv_libfguid" = xlocal]) AS_IF( [test "x$ac_cv_libfguid_CPPFLAGS" != "x"], [AC_SUBST( [LIBFGUID_CPPFLAGS], [$ac_cv_libfguid_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libfguid_LIBADD" != "x"], [AC_SUBST( [LIBFGUID_LIBADD], [$ac_cv_libfguid_LIBADD]) ]) AS_IF( [test "x$ac_cv_libfguid" = xyes], [AC_SUBST( [ax_libfguid_pc_libs_private], [-lfguid]) ]) AS_IF( [test "x$ac_cv_libfguid" = xyes], [AC_SUBST( [ax_libfguid_spec_requires], [libfguid]) AC_SUBST( [ax_libfguid_spec_build_requires], [libfguid-devel]) ]) ]) ================================================ FILE: m4/libfusn.m4 ================================================ dnl Checks for libfusn required headers and functions dnl dnl Version: 20240521 dnl Function to detect if libfusn is available dnl ac_libfusn_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBFUSN_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfusn" = xno], [ac_cv_libfusn=no], [ac_cv_libfusn=check dnl Check if the directory provided as parameter exists dnl For both --with-libfusn which returns "yes" and --with-libfusn= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libfusn" != x && test "x$ac_cv_with_libfusn" != xauto-detect && test "x$ac_cv_with_libfusn" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libfusn])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libfusn], [libfusn >= 20180611], [ac_cv_libfusn=yes], [ac_cv_libfusn=check]) ]) AS_IF( [test "x$ac_cv_libfusn" = xyes], [ac_cv_libfusn_CPPFLAGS="$pkg_cv_libfusn_CFLAGS" ac_cv_libfusn_LIBADD="$pkg_cv_libfusn_LIBS"]) ]) AS_IF( [test "x$ac_cv_libfusn" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libfusn.h]) AS_IF( [test "x$ac_cv_header_libfusn_h" = xno], [ac_cv_libfusn=no], [ac_cv_libfusn=yes AX_CHECK_LIB_FUNCTIONS( [libfusn], [fusn], [[libfusn_get_version], [libfusn_record_initialize], [libfusn_record_free], [libfusn_record_copy_from_byte_stream], [libfusn_record_get_size], [libfusn_record_get_update_time], [libfusn_record_get_file_reference], [libfusn_record_get_parent_file_reference], [libfusn_record_get_update_sequence_number], [libfusn_record_get_update_reason_flags], [libfusn_record_get_update_source_flags], [libfusn_record_get_file_attribute_flags], [libfusn_record_get_utf8_name_size], [libfusn_record_get_utf8_name], [libfusn_record_get_utf16_name_size], [libfusn_record_get_utf16_name]]) ac_cv_libfusn_LIBADD="-lfusn"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libfusn]) ]) AS_IF( [test "x$ac_cv_libfusn" = xyes], [AC_DEFINE( [HAVE_LIBFUSN], [1], [Define to 1 if you have the `fusn' library (-lfusn).]) ]) AS_IF( [test "x$ac_cv_libfusn" = xyes], [AC_SUBST( [HAVE_LIBFUSN], [1]) ], [AC_SUBST( [HAVE_LIBFUSN], [0]) ]) ]) dnl Function to detect if libfusn dependencies are available AC_DEFUN([AX_LIBFUSN_CHECK_LOCAL], [dnl No additional checks. ac_cv_libfusn_CPPFLAGS="-I../libfusn -I\$(top_srcdir)/libfusn"; ac_cv_libfusn_LIBADD="../libfusn/libfusn.la"; ac_cv_libfusn=local ]) dnl Function to detect how to enable libfusn AC_DEFUN([AX_LIBFUSN_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libfusn], [libfusn], [search for libfusn in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBFUSN_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libfusn" != xyes], [AX_LIBFUSN_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBFUSN], [1], [Define to 1 if the local version of libfusn is used.]) AC_SUBST( [HAVE_LOCAL_LIBFUSN], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBFUSN], [test "x$ac_cv_libfusn" = xlocal]) AS_IF( [test "x$ac_cv_libfusn_CPPFLAGS" != "x"], [AC_SUBST( [LIBFUSN_CPPFLAGS], [$ac_cv_libfusn_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libfusn_LIBADD" != "x"], [AC_SUBST( [LIBFUSN_LIBADD], [$ac_cv_libfusn_LIBADD]) ]) AS_IF( [test "x$ac_cv_libfusn" = xyes], [AC_SUBST( [ax_libfusn_pc_libs_private], [-lfusn]) ]) AS_IF( [test "x$ac_cv_libfusn" = xyes], [AC_SUBST( [ax_libfusn_spec_requires], [libfusn]) AC_SUBST( [ax_libfusn_spec_build_requires], [libfusn-devel]) ]) ]) ================================================ FILE: m4/libfwnt.m4 ================================================ dnl Checks for libfwnt required headers and functions dnl dnl Version: 20240519 dnl Function to detect if libfwnt is available dnl ac_libfwnt_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBFWNT_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libfwnt" = xno], [ac_cv_libfwnt=no], [ac_cv_libfwnt=check dnl Check if the directory provided as parameter exists dnl For both --with-libfwnt which returns "yes" and --with-libfwnt= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libfwnt" != x && test "x$ac_cv_with_libfwnt" != xauto-detect && test "x$ac_cv_with_libfwnt" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libfwnt])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libfwnt], [libfwnt >= 20191217], [ac_cv_libfwnt=yes], [ac_cv_libfwnt=check]) ]) AS_IF( [test "x$ac_cv_libfwnt" = xyes], [ac_cv_libfwnt_CPPFLAGS="$pkg_cv_libfwnt_CFLAGS" ac_cv_libfwnt_LIBADD="$pkg_cv_libfwnt_LIBS"]) ]) AS_IF( [test "x$ac_cv_libfwnt" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libfwnt.h]) AS_IF( [test "x$ac_cv_header_libfwnt_h" = xno], [ac_cv_libfwnt=no], [ac_cv_libfwnt=yes AX_CHECK_LIB_FUNCTIONS( [libfwnt], [fwnt], [[libfwnt_get_version], [libfwnt_array_initialize], [libfwnt_security_descriptor_initialize], [libfwnt_security_descriptor_free], [libfwnt_security_descriptor_copy_from_byte_stream], [libfwnt_security_descriptor_get_owner], [libfwnt_security_descriptor_get_group], [libfwnt_security_descriptor_get_discretionary_acl], [libfwnt_security_descriptor_get_system_acl], [libfwnt_security_identifier_initialize], [libfwnt_security_identifier_free], [libfwnt_security_identifier_copy_from_byte_stream], [libfwnt_security_identifier_get_string_size], [libfwnt_security_identifier_copy_to_utf8_string], [libfwnt_security_identifier_copy_to_utf8_string_with_index], [libfwnt_security_identifier_copy_to_utf16_string], [libfwnt_security_identifier_copy_to_utf16_string_with_index], [libfwnt_security_identifier_copy_to_utf32_string], [libfwnt_security_identifier_copy_to_utf32_string_with_index], [libfwnt_access_control_list_free], [libfwnt_access_control_list_get_number_of_entries], [libfwnt_access_control_list_get_entry_by_index], [libfwnt_access_control_entry_free], [libfwnt_access_control_entry_get_type], [libfwnt_access_control_entry_get_flags], [libfwnt_access_control_entry_get_access_mask], [libfwnt_access_control_entry_get_security_identifier], [libfwnt_lznt1_decompress], [libfwnt_lzx_decompress], [libfwnt_lzxpress_decompress], [libfwnt_lzxpress_huffman_decompress]]) ac_cv_libfwnt_LIBADD="-lfwnt"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libfwnt]) ]) AS_IF( [test "x$ac_cv_libfwnt" = xyes], [AC_DEFINE( [HAVE_LIBFWNT], [1], [Define to 1 if you have the `fwnt' library (-lfwnt).]) ]) AS_IF( [test "x$ac_cv_libfwnt" = xyes], [AC_SUBST( [HAVE_LIBFWNT], [1]) ], [AC_SUBST( [HAVE_LIBFWNT], [0]) ]) ]) dnl Function to detect if libfwnt dependencies are available AC_DEFUN([AX_LIBFWNT_CHECK_LOCAL], [dnl No additional checks. ac_cv_libfwnt_CPPFLAGS="-I../libfwnt -I\$(top_srcdir)/libfwnt"; ac_cv_libfwnt_LIBADD="../libfwnt/libfwnt.la"; ac_cv_libfwnt=local ]) dnl Function to detect how to enable libfwnt AC_DEFUN([AX_LIBFWNT_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libfwnt], [libfwnt], [search for libfwnt in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBFWNT_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libfwnt" != xyes], [AX_LIBFWNT_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBFWNT], [1], [Define to 1 if the local version of libfwnt is used.]) AC_SUBST( [HAVE_LOCAL_LIBFWNT], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBFWNT], [test "x$ac_cv_libfwnt" = xlocal]) AS_IF( [test "x$ac_cv_libfwnt_CPPFLAGS" != "x"], [AC_SUBST( [LIBFWNT_CPPFLAGS], [$ac_cv_libfwnt_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libfwnt_LIBADD" != "x"], [AC_SUBST( [LIBFWNT_LIBADD], [$ac_cv_libfwnt_LIBADD]) ]) AS_IF( [test "x$ac_cv_libfwnt" = xyes], [AC_SUBST( [ax_libfwnt_pc_libs_private], [-lfwnt]) ]) AS_IF( [test "x$ac_cv_libfwnt" = xyes], [AC_SUBST( [ax_libfwnt_spec_requires], [libfwnt]) AC_SUBST( [ax_libfwnt_spec_build_requires], [libfwnt-devel]) ]) ]) ================================================ FILE: m4/libuna.m4 ================================================ dnl Checks for libuna or required headers and functions dnl dnl Version: 20240513 dnl Function to detect if libuna is available dnl ac_libuna_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments AC_DEFUN([AX_LIBUNA_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_libuna" = xno], [ac_cv_libuna=no], [ac_cv_libuna=check dnl Check if the directory provided as parameter exists dnl For both --with-libuna which returns "yes" and --with-libuna= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_libuna" != x && test "x$ac_cv_with_libuna" != xauto-detect && test "x$ac_cv_with_libuna" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([libuna])], [dnl Check for a pkg-config file AS_IF( [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libuna], [libuna >= 20230702], [ac_cv_libuna=yes], [ac_cv_libuna=check]) ]) AS_IF( [test "x$ac_cv_libuna" = xyes], [ac_cv_libuna_CPPFLAGS="$pkg_cv_libuna_CFLAGS" ac_cv_libuna_LIBADD="$pkg_cv_libuna_LIBS"]) ]) AS_IF( [test "x$ac_cv_libuna" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([libuna.h]) AS_IF( [test "x$ac_cv_header_libuna_h" = xno], [ac_cv_libuna=no], [ac_cv_libuna=yes AX_CHECK_LIB_FUNCTIONS( [libuna], [una], [[libuna_get_version], [libuna_base16_stream_size_to_byte_stream], [libuna_base16_stream_copy_to_byte_stream], [libuna_base16_stream_size_from_byte_stream], [libuna_base16_stream_copy_from_byte_stream], [libuna_base16_stream_with_index_copy_from_byte_stream], [libuna_base32_quintuplet_copy_from_base32_stream], [libuna_base32_quintuplet_copy_to_base32_stream], [libuna_base32_quintuplet_copy_from_byte_stream], [libuna_base32_quintuplet_copy_to_byte_stream], [libuna_base32_stream_size_to_byte_stream], [libuna_base32_stream_copy_to_byte_stream], [libuna_base32_stream_size_from_byte_stream], [libuna_base32_stream_copy_from_byte_stream], [libuna_base32_stream_with_index_copy_from_byte_stream], [libuna_base64_triplet_copy_from_base64_stream], [libuna_base64_triplet_copy_to_base64_stream], [libuna_base64_triplet_copy_from_byte_stream], [libuna_base64_triplet_copy_to_byte_stream], [libuna_base64_stream_size_to_byte_stream], [libuna_base64_stream_copy_to_byte_stream], [libuna_base64_stream_size_from_byte_stream], [libuna_base64_stream_copy_from_byte_stream], [libuna_base64_stream_with_index_copy_from_byte_stream], [libuna_byte_stream_size_from_utf8], [libuna_byte_stream_copy_from_utf8], [libuna_byte_stream_size_from_utf16], [libuna_byte_stream_copy_from_utf16], [libuna_byte_stream_size_from_utf32], [libuna_byte_stream_copy_from_utf32], [libuna_unicode_character_size_to_byte_stream], [libuna_unicode_character_copy_from_byte_stream], [libuna_unicode_character_copy_to_byte_stream], [libuna_unicode_character_size_to_ucs2], [libuna_unicode_character_copy_from_ucs2], [libuna_unicode_character_copy_to_ucs2], [libuna_unicode_character_size_to_ucs4], [libuna_unicode_character_copy_from_ucs4], [libuna_unicode_character_copy_to_ucs4], [libuna_unicode_character_copy_from_utf7_stream], [libuna_unicode_character_copy_to_utf7_stream], [libuna_unicode_character_size_to_utf8], [libuna_unicode_character_copy_from_utf8], [libuna_unicode_character_copy_to_utf8], [libuna_unicode_character_size_to_utf8_rfc2279], [libuna_unicode_character_copy_from_utf8_rfc2279], [libuna_unicode_character_copy_to_utf8_rfc2279], [libuna_unicode_character_size_to_utf16], [libuna_unicode_character_copy_from_utf16], [libuna_unicode_character_copy_to_utf16], [libuna_unicode_character_copy_from_utf16_stream], [libuna_unicode_character_copy_to_utf16_stream], [libuna_unicode_character_copy_from_utf32], [libuna_unicode_character_copy_to_utf32], [libuna_unicode_character_copy_from_utf32_stream], [libuna_unicode_character_copy_to_utf32_stream], [libuna_utf8_stream_size_from_utf8], [libuna_utf8_stream_copy_from_utf8], [libuna_utf8_stream_size_from_utf16], [libuna_utf8_stream_copy_from_utf16], [libuna_utf8_stream_size_from_utf32], [libuna_utf8_stream_copy_from_utf32], [libuna_utf16_stream_size_from_utf8], [libuna_utf16_stream_copy_from_utf8], [libuna_utf16_stream_size_from_utf16], [libuna_utf16_stream_copy_from_utf16], [libuna_utf16_stream_size_from_utf32], [libuna_utf16_stream_copy_from_utf32], [libuna_utf32_stream_size_from_utf8], [libuna_utf32_stream_copy_from_utf8], [libuna_utf32_stream_size_from_utf16], [libuna_utf32_stream_copy_from_utf16], [libuna_utf32_stream_size_from_utf32], [libuna_utf32_stream_copy_from_utf32], [libuna_utf8_string_size_from_byte_stream], [libuna_utf8_string_copy_from_byte_stream], [libuna_utf8_string_with_index_copy_from_byte_stream], [libuna_utf8_string_compare_with_byte_stream], [libuna_utf8_string_size_from_utf7_stream], [libuna_utf8_string_copy_from_utf7_stream], [libuna_utf8_string_with_index_copy_from_utf7_stream], [libuna_utf8_string_compare_with_utf7_stream], [libuna_utf8_string_size_from_utf8_stream], [libuna_utf8_string_copy_from_utf8_stream], [libuna_utf8_string_with_index_copy_from_utf8_stream], [libuna_utf8_string_compare_with_utf8_stream], [libuna_utf8_string_size_from_utf16], [libuna_utf8_string_copy_from_utf16], [libuna_utf8_string_with_index_copy_from_utf16], [libuna_utf8_string_compare_with_utf16], [libuna_utf8_string_size_from_utf16_stream], [libuna_utf8_string_copy_from_utf16_stream], [libuna_utf8_string_with_index_copy_from_utf16_stream], [libuna_utf8_string_compare_with_utf16_stream], [libuna_utf8_string_size_from_utf32], [libuna_utf8_string_copy_from_utf32], [libuna_utf8_string_with_index_copy_from_utf32], [libuna_utf8_string_compare_with_utf32], [libuna_utf8_string_size_from_utf32_stream], [libuna_utf8_string_copy_from_utf32_stream], [libuna_utf8_string_with_index_copy_from_utf32_stream], [libuna_utf8_string_compare_with_utf32_stream], [libuna_utf8_string_size_from_scsu_stream], [libuna_utf8_string_copy_from_scsu_stream], [libuna_utf8_string_with_index_copy_from_scsu_stream], [libuna_utf16_string_size_from_byte_stream], [libuna_utf16_string_copy_from_byte_stream], [libuna_utf16_string_with_index_copy_from_byte_stream], [libuna_utf16_string_compare_with_byte_stream], [libuna_utf16_string_size_from_utf7_stream], [libuna_utf16_string_copy_from_utf7_stream], [libuna_utf16_string_with_index_copy_from_utf7_stream], [libuna_utf16_string_compare_with_utf7_stream], [libuna_utf16_string_size_from_utf8], [libuna_utf16_string_copy_from_utf8], [libuna_utf16_string_with_index_copy_from_utf8], [libuna_utf16_string_size_from_utf8_stream], [libuna_utf16_string_copy_from_utf8_stream], [libuna_utf16_string_with_index_copy_from_utf8_stream], [libuna_utf16_string_compare_with_utf8_stream], [libuna_utf16_string_size_from_utf16_stream], [libuna_utf16_string_copy_from_utf16_stream], [libuna_utf16_string_with_index_copy_from_utf16_stream], [libuna_utf16_string_compare_with_utf16_stream], [libuna_utf16_string_size_from_utf32], [libuna_utf16_string_copy_from_utf32], [libuna_utf16_string_with_index_copy_from_utf32], [libuna_utf16_string_compare_with_utf32], [libuna_utf16_string_size_from_utf32_stream], [libuna_utf16_string_copy_from_utf32_stream], [libuna_utf16_string_with_index_copy_from_utf32_stream], [libuna_utf16_string_compare_with_utf32_stream], [libuna_utf16_string_size_from_scsu_stream], [libuna_utf16_string_copy_from_scsu_stream], [libuna_utf16_string_with_index_copy_from_scsu_stream], [libuna_utf32_string_size_from_byte_stream], [libuna_utf32_string_copy_from_byte_stream], [libuna_utf32_string_with_index_copy_from_byte_stream], [libuna_utf32_string_compare_with_byte_stream], [libuna_utf32_string_size_from_utf7_stream], [libuna_utf32_string_copy_from_utf7_stream], [libuna_utf32_string_with_index_copy_from_utf7_stream], [libuna_utf32_string_compare_with_utf7_stream], [libuna_utf32_string_size_from_utf8_stream], [libuna_utf32_string_size_from_utf8], [libuna_utf32_string_copy_from_utf8], [libuna_utf32_string_copy_from_utf8_stream], [libuna_utf32_string_with_index_copy_from_utf8_stream], [libuna_utf32_string_compare_with_utf8_stream], [libuna_utf32_string_size_from_utf16], [libuna_utf32_string_copy_from_utf16], [libuna_utf32_string_with_index_copy_from_utf16], [libuna_utf32_string_size_from_utf16_stream], [libuna_utf32_string_copy_from_utf16_stream], [libuna_utf32_string_with_index_copy_from_utf16_stream], [libuna_utf32_string_compare_with_utf16_stream], [libuna_utf32_string_size_from_utf32_stream], [libuna_utf32_string_copy_from_utf32_stream], [libuna_utf32_string_with_index_copy_from_utf32_stream], [libuna_utf32_string_compare_with_utf32_stream], [libuna_utf32_string_size_from_scsu_stream], [libuna_utf32_string_copy_from_scsu_stream], [libuna_utf32_string_with_index_copy_from_scsu_stream]]) AX_CHECK_LIB_DEFINITIONS( [libuna], [[LIBUNA_COMPARE_LESS], [LIBUNA_COMPARE_EQUAL], [LIBUNA_COMPARE_GREATER], [LIBUNA_UTF16_STREAM_ALLOW_UNPAIRED_SURROGATE]]) ac_cv_libuna_LIBADD="-luna"]) ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([libuna]) ]) AS_IF( [test "x$ac_cv_libuna" = xyes], [AC_DEFINE( [HAVE_LIBUNA], [1], [Define to 1 if you have the `una' library (-luna).]) ]) AS_IF( [test "x$ac_cv_libuna" = xyes], [AC_SUBST( [HAVE_LIBUNA], [1]) ], [AC_SUBST( [HAVE_LIBUNA], [0]) ]) ]) dnl Function to detect if libuna dependencies are available AC_DEFUN([AX_LIBUNA_CHECK_LOCAL], [dnl No additional checks. ac_cv_libuna_CPPFLAGS="-I../libuna -I\$(top_srcdir)/libuna"; ac_cv_libuna_LIBADD="../libuna/libuna.la"; ac_cv_libuna=local ]) dnl Function to detect how to enable libuna AC_DEFUN([AX_LIBUNA_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [libuna], [libuna], [search for libuna in includedir and libdir or in the specified DIR, or no if to use local version], [auto-detect], [DIR]) dnl Check for a shared library version AX_LIBUNA_CHECK_LIB dnl Check if the dependencies for the local library version AS_IF( [test "x$ac_cv_libuna" != xyes], [AX_LIBUNA_CHECK_LOCAL AC_DEFINE( [HAVE_LOCAL_LIBUNA], [1], [Define to 1 if the local version of libuna is used.]) AC_SUBST( [HAVE_LOCAL_LIBUNA], [1]) ]) AM_CONDITIONAL( [HAVE_LOCAL_LIBUNA], [test "x$ac_cv_libuna" = xlocal]) AS_IF( [test "x$ac_cv_libuna_CPPFLAGS" != "x"], [AC_SUBST( [LIBUNA_CPPFLAGS], [$ac_cv_libuna_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_libuna_LIBADD" != "x"], [AC_SUBST( [LIBUNA_LIBADD], [$ac_cv_libuna_LIBADD]) ]) AS_IF( [test "x$ac_cv_libuna" = xyes], [AC_SUBST( [ax_libuna_pc_libs_private], [-luna]) ]) AS_IF( [test "x$ac_cv_libuna" = xyes], [AC_SUBST( [ax_libuna_spec_requires], [libuna]) AC_SUBST( [ax_libuna_spec_build_requires], [libuna-devel]) ]) ]) ================================================ FILE: m4/pthread.m4 ================================================ dnl Functions for pthread dnl dnl Version: 20240513 dnl Function to detect if pthread is available AC_DEFUN([AX_PTHREAD_CHECK_LIB], [AS_IF( [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_pthread" = xno], [ac_cv_pthread=no], [ac_cv_pthread=check dnl Check if parameters were provided dnl For both --with-pthread which returns "yes" and --with-pthread= which returns "" dnl treat them as auto-detection. AS_IF( [test "x$ac_cv_with_pthread" != x && test "x$ac_cv_with_pthread" != xauto-detect && test "x$ac_cv_with_pthread" != xyes], [AX_CHECK_LIB_DIRECTORY_EXISTS([pthread])]) ]) AS_IF( [test "x$ac_cv_pthread" = xcheck], [dnl Check for headers AC_CHECK_HEADERS([pthread.h]) AS_IF( [test "x$ac_cv_header_pthread_h" = xno], [ac_cv_pthread=no], [ac_cv_pthread=yes AX_CHECK_LIB_FUNCTIONS( [pthread], [pthread], [[pthread_create], [pthread_exit], [pthread_join], [pthread_cond_init], [pthread_cond_destroy], [pthread_cond_broadcast], [pthread_cond_signal], [pthread_cond_wait], [pthread_mutex_init], [pthread_mutex_destroy], [pthread_mutex_lock], [pthread_mutex_trylock], [pthread_mutex_unlock], [pthread_rwlock_init], [pthread_rwlock_destroy], [pthread_rwlock_rdlock], [pthread_rwlock_wrlock], [pthread_rwlock_unlock]]) ac_cv_pthread_LIBADD="-lpthread" ]) AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([pthread]) ]) AS_IF( [test "x$ac_cv_pthread" = xpthread], [AC_DEFINE( [HAVE_PTHREAD], [1], [Define to 1 if you have the 'pthread' library (-lpthread).]) ]) AS_IF( [test "x$ac_cv_pthread" != xno], [AC_SUBST( [HAVE_PTHREAD], [1]) ], [AC_SUBST( [HAVE_PTHREAD], [0]) ]) ]) dnl Function to detect how to enable pthread AC_DEFUN([AX_PTHREAD_CHECK_ENABLE], [AX_COMMON_ARG_WITH( [pthread], [pthread], [search for pthread in includedir and libdir or in the specified DIR, or no if not to use pthread], [auto-detect], [DIR]) dnl Check for a shared library version AX_PTHREAD_CHECK_LIB AS_IF( [test "x$ac_cv_pthread_CPPFLAGS" != "x"], [AC_SUBST( [PTHREAD_CPPFLAGS], [$ac_cv_pthread_CPPFLAGS]) ]) AS_IF( [test "x$ac_cv_pthread_LIBADD" != "x"], [AC_SUBST( [PTHREAD_LIBADD], [$ac_cv_pthread_LIBADD]) ]) AS_IF( [test "x$ac_cv_pthread" = xpthread], [AC_SUBST( [ax_pthread_pc_libs_private], [-lpthread]) ]) ]) ================================================ FILE: m4/tests.m4 ================================================ dnl Functions for testing dnl dnl Version: 20200712 dnl Function to detect if tests dependencies are available AC_DEFUN([AX_TESTS_CHECK_LOCAL], [AC_CHECK_HEADERS([dlfcn.h]) AC_CHECK_FUNCS([fmemopen getopt mkstemp setenv tzset unlink]) AC_CHECK_LIB( dl, dlsym) AS_IF( [test "x$lt_cv_prog_gnu_ld" = xyes && test "x$ac_cv_lib_dl_dlsym" = xyes], [AC_DEFINE( [HAVE_GNU_DL_DLSYM], [1], [Define to 1 if dlsym function is available in GNU dl.]) ]) ]) dnl Function to detect if OSS-Fuzz build environment is available AC_DEFUN([AX_TESTS_CHECK_OSSFUZZ], [AM_CONDITIONAL( HAVE_LIB_FUZZING_ENGINE, [test "x${LIB_FUZZING_ENGINE}" != x]) AC_SUBST( [LIB_FUZZING_ENGINE], ["${LIB_FUZZING_ENGINE}"]) ]) ================================================ FILE: m4/types.m4 ================================================ dnl Functions for type definitions dnl dnl Version: 20180727 dnl Function to detect if type definitions are available AC_DEFUN([AX_TYPES_CHECK_LOCAL], [AS_IF( [test "x$ac_cv_enable_winapi" = xyes], [ac_cv_enable_wide_character_type=yes]) AS_IF( [test "x$ac_cv_enable_wide_character_type" = xyes], [AC_DEFINE( [HAVE_WIDE_CHARACTER_TYPE], [1], [Define to 1 if wide character type should be used.]) AC_SUBST( [HAVE_WIDE_CHARACTER_TYPE], [1]) ], [AC_SUBST( [HAVE_WIDE_CHARACTER_TYPE], [0]) ]) AC_CHECK_HEADERS([sys/types.h inttypes.h stdint.h wchar.h]) AS_IF( [test "x$ac_cv_header_sys_types_h" = xyes], [AC_SUBST( [HAVE_SYS_TYPES_H], [1])], [AC_SUBST( [HAVE_SYS_TYPES_H], [0]) ]) AS_IF( [test "x$ac_cv_header_inttypes_h" = xyes], [AC_SUBST( [HAVE_INTTYPES_H], [1])], [AC_SUBST( [HAVE_INTTYPES_H], [0]) ]) AS_IF( [test "x$ac_cv_header_stdint_h" = xyes], [AC_SUBST( [HAVE_STDINT_H], [1])], [AC_SUBST( [HAVE_STDINT_H], [0]) ]) AS_IF( [test "x$ac_cv_header_wchar_h" = xyes], [AC_SUBST( [HAVE_WCHAR_H], [1]) ], [AC_SUBST( [HAVE_WCHAR_H], [0]) ]) AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_CHECK_TYPE( [size32_t], [AC_SUBST( [HAVE_SIZE32_T], [1])], [AC_SUBST( [HAVE_SIZE32_T], [0]) ]) AC_CHECK_TYPE( [ssize32_t], [AC_SUBST( [HAVE_SSIZE32_T], [1])], [AC_SUBST( [HAVE_SSIZE32_T], [0]) ]) AC_CHECK_TYPE( [size64_t], [AC_SUBST( [HAVE_SIZE64_T], [1])], [AC_SUBST( [HAVE_SIZE64_T], [0]) ]) AC_CHECK_TYPE( [ssize64_t], [AC_SUBST( [HAVE_SSIZE64_T], [1])], [AC_SUBST( [HAVE_SSIZE64_T], [0]) ]) AC_CHECK_TYPE( [off64_t], [AC_SUBST( [HAVE_OFF64_T], [1])], [AC_SUBST( [HAVE_OFF64_T], [0]) ]) AC_CHECK_TYPE([ssize_t]) AC_CHECK_TYPE([u64]) AC_CHECK_SIZEOF([int]) AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([off_t]) AC_CHECK_SIZEOF([size_t]) AS_IF( [test "x$ac_cv_header_wchar_h" = xyes], [AC_CHECK_SIZEOF([wchar_t])]) ]) ================================================ FILE: manuals/Makefile.am ================================================ man_MANS = \ fsrefsinfo.1 \ libfsrefs.3 EXTRA_DIST = \ fsrefsinfo.1 \ libfsrefs.3 DISTCLEANFILES = \ Makefile \ Makefile.in ================================================ FILE: manuals/fsrefsinfo.1 ================================================ .Dd June 28, 2023 .Dt fsrefsinfo .Os libfsrefs .Sh NAME .Nm fsrefsinfo .Nd determines information about a Resiliant File System (ReFS) .Sh SYNOPSIS .Nm fsrefsinfo .Op Fl ahvV .Va Ar source .Sh DESCRIPTION .Nm fsrefsinfo is a utility to determine information about a Resiliant File System (ReFS) .Pp .Nm fsrefsinfo is part of the .Nm libfsrefs package. .Nm libfsrefs is a library to access the Resiliant File System (ReFS) format .Pp .Ar source is the source file. .Pp The options are as follows: .Bl -tag -width Ds .It Fl a shows allocation information .It Fl h shows this help .It Fl v verbose output to stderr .It Fl V print version .El .Sh ENVIRONMENT None .Sh FILES None .Sh EXAMPLES .Bd -literal # fsrefsinfo /dev/sda1 fsrefsinfo 20130915 Resiliant File System (ReFS) volume information: .Dl ... .Ed .Sh DIAGNOSTICS Errors, verbose and debug output are printed to stderr when verbose output \-v is enabled. Verbose and debug output are only printed when enabled at compilation. .Sh BUGS Please report bugs of any kind to or on the project website: https://github.com/libyal/libfsrefs/ .Sh AUTHOR These man pages were written by Joachim Metz. .Sh COPYRIGHT Copyright 2012-2013, Joachim Metz . This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .Sh SEE ALSO ================================================ FILE: manuals/libfsrefs.3 ================================================ .Dd June 30, 2023 .Dt libfsrefs 3 .Os libfsrefs .Sh NAME .Nm libfsrefs.h .Nd Library to access the Resiliant File System (ReFS) format .Sh SYNOPSIS .In libfsrefs.h .Pp Support functions .Ft const char * .Fn libfsrefs_get_version "void" .Ft int .Fn libfsrefs_get_access_flags_read "void" .Ft int .Fn libfsrefs_get_codepage "int *codepage" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_set_codepage "int codepage" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_check_volume_signature "const char *filename" "libfsrefs_error_t **error" .Pp Available when compiled with wide character string support: .Ft int .Fn libfsrefs_check_volume_signature_wide "const wchar_t *filename" "libfsrefs_error_t **error" .Pp Available when compiled with libbfio support: .Ft int .Fn libfsrefs_check_volume_signature_file_io_handle "libbfio_handle_t *file_io_handle" "libfsrefs_error_t **error" .Pp Notify functions .Ft void .Fn libfsrefs_notify_set_verbose "int verbose" .Ft int .Fn libfsrefs_notify_set_stream "FILE *stream" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_notify_stream_open "const char *filename" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_notify_stream_close "libfsrefs_error_t **error" .Pp Error functions .Ft void .Fn libfsrefs_error_free "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_error_fprint "libfsrefs_error_t *error" "FILE *stream" .Ft int .Fn libfsrefs_error_sprint "libfsrefs_error_t *error" "char *string" "size_t size" .Ft int .Fn libfsrefs_error_backtrace_fprint "libfsrefs_error_t *error" "FILE *stream" .Ft int .Fn libfsrefs_error_backtrace_sprint "libfsrefs_error_t *error" "char *string" "size_t size" .Pp Volume functions .Ft int .Fn libfsrefs_volume_initialize "libfsrefs_volume_t **volume" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_free "libfsrefs_volume_t **volume" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_signal_abort "libfsrefs_volume_t *volume" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_open "libfsrefs_volume_t *volume" "const char *filename" "int access_flags" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_close "libfsrefs_volume_t *volume" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_bytes_per_sector "libfsrefs_volume_t *volume" "uint16_t *bytes_per_sector" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_cluster_block_size "libfsrefs_volume_t *volume" "size32_t *cluster_block_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_utf8_name_size "libfsrefs_volume_t *volume" "size_t *utf8_string_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_utf8_name "libfsrefs_volume_t *volume" "uint8_t *utf8_string" "size_t utf8_string_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_utf16_name_size "libfsrefs_volume_t *volume" "size_t *utf16_string_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_utf16_name "libfsrefs_volume_t *volume" "uint16_t *utf16_string" "size_t utf16_string_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_version "libfsrefs_volume_t *volume" "uint8_t *major_version" "uint8_t *minor_version" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_serial_number "libfsrefs_volume_t *volume" "uint64_t *serial_number" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_volume_get_root_directory "libfsrefs_volume_t *volume" "libfsrefs_file_entry_t **file_entry" "libfsrefs_error_t **error" .Pp Available when compiled with wide character string support: .Ft int .Fn libfsrefs_volume_open_wide "libfsrefs_volume_t *volume" "const wchar_t *filename" "int access_flags" "libfsrefs_error_t **error" .Pp Available when compiled with libbfio support: .Ft int .Fn libfsrefs_volume_open_file_io_handle "libfsrefs_volume_t *volume" "libbfio_handle_t *file_io_handle" "int access_flags" "libfsrefs_error_t **error" .Pp File entry functions .Ft int .Fn libfsrefs_file_entry_free "libfsrefs_file_entry_t **file_entry" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_creation_time "libfsrefs_file_entry_t *file_entry" "uint64_t *filetime" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_modification_time "libfsrefs_file_entry_t *file_entry" "uint64_t *filetime" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_access_time "libfsrefs_file_entry_t *file_entry" "uint64_t *filetime" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_entry_modification_time "libfsrefs_file_entry_t *file_entry" "uint64_t *filetime" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_file_attribute_flags "libfsrefs_file_entry_t *file_entry" "uint32_t *file_attribute_flags" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_utf8_name_size "libfsrefs_file_entry_t *file_entry" "size_t *utf8_string_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_utf8_name "libfsrefs_file_entry_t *file_entry" "uint8_t *utf8_string" "size_t utf8_string_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_utf16_name_size "libfsrefs_file_entry_t *file_entry" "size_t *utf16_string_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_utf16_name "libfsrefs_file_entry_t *file_entry" "uint16_t *utf16_string" "size_t utf16_string_size" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_number_of_sub_file_entries "libfsrefs_file_entry_t *file_entry" "int *number_of_sub_file_entries" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_sub_file_entry_by_index "libfsrefs_file_entry_t *file_entry" "int sub_file_entry_index" "libfsrefs_file_entry_t **sub_file_entry" "libfsrefs_error_t **error" .Ft int .Fn libfsrefs_file_entry_get_size "libfsrefs_file_entry_t *file_entry" "size64_t *size" "libfsrefs_error_t **error" .Sh DESCRIPTION The .Fn libfsrefs_get_version function is used to retrieve the library version. .Sh RETURN VALUES Most of the functions return NULL or \-1 on error, dependent on the return type. For the actual return values see "libfsrefs.h". .Sh ENVIRONMENT None .Sh FILES None .Sh NOTES libfsrefs can be compiled with wide character support (wchar_t). .sp To compile libfsrefs with wide character support use: .Ar ./configure --enable-wide-character-type=yes or define: .Ar _UNICODE or .Ar UNICODE during compilation. .sp .Ar LIBFSREFS_WIDE_CHARACTER_TYPE in libfsrefs/features.h can be used to determine if libfsrefs was compiled with wide character support. .Sh BUGS Please report bugs of any kind on the project issue tracker: https://github.com/libyal/libfsrefs/issues .Sh AUTHOR These man pages are generated from "libfsrefs.h". .Sh COPYRIGHT Copyright (C) 2012-2025, Joachim Metz . .sp This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. .Sh SEE ALSO the libfsrefs.h include file ================================================ FILE: msvscpp/Makefile.am ================================================ MSVSCPP_FILES = \ fsrefs_test_attribute_values/fsrefs_test_attribute_values.vcproj \ fsrefs_test_block_descriptor/fsrefs_test_block_descriptor.vcproj \ fsrefs_test_block_reference/fsrefs_test_block_reference.vcproj \ fsrefs_test_block_tree/fsrefs_test_block_tree.vcproj \ fsrefs_test_block_tree_node/fsrefs_test_block_tree_node.vcproj \ fsrefs_test_checkpoint/fsrefs_test_checkpoint.vcproj \ fsrefs_test_data_run/fsrefs_test_data_run.vcproj \ fsrefs_test_directory_entry/fsrefs_test_directory_entry.vcproj \ fsrefs_test_directory_object/fsrefs_test_directory_object.vcproj \ fsrefs_test_error/fsrefs_test_error.vcproj \ fsrefs_test_file_entry/fsrefs_test_file_entry.vcproj \ fsrefs_test_file_system/fsrefs_test_file_system.vcproj \ fsrefs_test_io_handle/fsrefs_test_io_handle.vcproj \ fsrefs_test_metadata_block_header/fsrefs_test_metadata_block_header.vcproj \ fsrefs_test_ministore_node/fsrefs_test_ministore_node.vcproj \ fsrefs_test_node_header/fsrefs_test_node_header.vcproj \ fsrefs_test_node_record/fsrefs_test_node_record.vcproj \ fsrefs_test_notify/fsrefs_test_notify.vcproj \ fsrefs_test_objects_tree/fsrefs_test_objects_tree.vcproj \ fsrefs_test_superblock/fsrefs_test_superblock.vcproj \ fsrefs_test_support/fsrefs_test_support.vcproj \ fsrefs_test_tools_info_handle/fsrefs_test_tools_info_handle.vcproj \ fsrefs_test_tools_output/fsrefs_test_tools_output.vcproj \ fsrefs_test_tools_signal/fsrefs_test_tools_signal.vcproj \ fsrefs_test_tree_header/fsrefs_test_tree_header.vcproj \ fsrefs_test_volume/fsrefs_test_volume.vcproj \ fsrefs_test_volume_header/fsrefs_test_volume_header.vcproj \ fsrefsinfo/fsrefsinfo.vcproj \ 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 \ libfdatetime/libfdatetime.vcproj \ libfguid/libfguid.vcproj \ libfsrefs/libfsrefs.vcproj \ libfusn/libfusn.vcproj \ libfwnt/libfwnt.vcproj \ libuna/libuna.vcproj \ libfsrefs.sln EXTRA_DIST = \ $(MSVSCPP_FILES) DISTCLEANFILES = \ Makefile \ Makefile.in ================================================ FILE: msvscpp/fsrefs_test_attribute_values/fsrefs_test_attribute_values.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_block_descriptor/fsrefs_test_block_descriptor.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_block_reference/fsrefs_test_block_reference.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_block_tree/fsrefs_test_block_tree.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_block_tree_node/fsrefs_test_block_tree_node.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_checkpoint/fsrefs_test_checkpoint.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_data_run/fsrefs_test_data_run.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_directory_entry/fsrefs_test_directory_entry.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_directory_object/fsrefs_test_directory_object.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_error/fsrefs_test_error.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_file_entry/fsrefs_test_file_entry.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_file_system/fsrefs_test_file_system.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_io_handle/fsrefs_test_io_handle.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_metadata_block_header/fsrefs_test_metadata_block_header.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_ministore_node/fsrefs_test_ministore_node.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_node_header/fsrefs_test_node_header.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_node_record/fsrefs_test_node_record.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_notify/fsrefs_test_notify.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_objects_tree/fsrefs_test_objects_tree.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_superblock/fsrefs_test_superblock.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_support/fsrefs_test_support.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_tools_info_handle/fsrefs_test_tools_info_handle.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_tools_output/fsrefs_test_tools_output.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_tools_signal/fsrefs_test_tools_signal.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_tree_header/fsrefs_test_tree_header.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_volume/fsrefs_test_volume.vcproj ================================================ ================================================ FILE: msvscpp/fsrefs_test_volume_header/fsrefs_test_volume_header.vcproj ================================================ ================================================ FILE: msvscpp/fsrefsinfo/fsrefsinfo.vcproj ================================================ ================================================ FILE: msvscpp/libbfio/libbfio.vcproj ================================================ ================================================ FILE: msvscpp/libcdata/libcdata.vcproj ================================================ ================================================ FILE: msvscpp/libcerror/libcerror.vcproj ================================================ ================================================ FILE: msvscpp/libcfile/libcfile.vcproj ================================================ ================================================ FILE: msvscpp/libclocale/libclocale.vcproj ================================================ ================================================ FILE: msvscpp/libcnotify/libcnotify.vcproj ================================================ ================================================ FILE: msvscpp/libcpath/libcpath.vcproj ================================================ ================================================ FILE: msvscpp/libcsplit/libcsplit.vcproj ================================================ ================================================ FILE: msvscpp/libcthreads/libcthreads.vcproj ================================================ ================================================ FILE: msvscpp/libfcache/libfcache.vcproj ================================================ ================================================ FILE: msvscpp/libfdata/libfdata.vcproj ================================================ ================================================ FILE: msvscpp/libfdatetime/libfdatetime.vcproj ================================================ ================================================ FILE: msvscpp/libfguid/libfguid.vcproj ================================================ ================================================ FILE: msvscpp/libfsrefs/libfsrefs.vcproj ================================================ ================================================ FILE: msvscpp/libfsrefs.sln ================================================  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual C++ Express 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfcache", "libfcache\libfcache.vcproj", "{3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {3FB75558-9168-450F-9FE2-EDB2A08EBE64} = {3FB75558-9168-450F-9FE2-EDB2A08EBE64} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfguid", "libfguid\libfguid.vcproj", "{87BEF2E0-F880-46F6-ADDA-DDBCD4A80B3D}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_attribute_values", "fsrefs_test_attribute_values\fsrefs_test_attribute_values.vcproj", "{10303E16-AE3C-4EC5-9058-40A53F9E6D30}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_block_descriptor", "fsrefs_test_block_descriptor\fsrefs_test_block_descriptor.vcproj", "{86FE2A37-6E20-42C5-AD0E-65C894513B1E}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_block_reference", "fsrefs_test_block_reference\fsrefs_test_block_reference.vcproj", "{6481EBD4-1CE7-4701-B4B2-BD0733B1892E}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_block_tree", "fsrefs_test_block_tree\fsrefs_test_block_tree.vcproj", "{FA1B5333-2889-41C8-B936-B123F8B71D53}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_block_tree_node", "fsrefs_test_block_tree_node\fsrefs_test_block_tree_node.vcproj", "{C68F2739-7E0D-41BC-9126-4F4662B62D2F}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_checkpoint", "fsrefs_test_checkpoint\fsrefs_test_checkpoint.vcproj", "{AF13DDD6-36B7-4589-98EF-113557719D40}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_data_run", "fsrefs_test_data_run\fsrefs_test_data_run.vcproj", "{383E86C0-B064-4E96-8C80-D1BA77232B07}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_directory_entry", "fsrefs_test_directory_entry\fsrefs_test_directory_entry.vcproj", "{47245AB7-7780-46AF-B1E1-895CDCD70B44}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_directory_object", "fsrefs_test_directory_object\fsrefs_test_directory_object.vcproj", "{77FD568A-E194-4119-84E3-F9B780604DFB}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_error", "fsrefs_test_error\fsrefs_test_error.vcproj", "{F4A33415-A38B-4FCE-A9C5-C3298AB0DA31}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_file_entry", "fsrefs_test_file_entry\fsrefs_test_file_entry.vcproj", "{4BDB64CA-2219-4737-B0D9-EEEBCDE526EB}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_file_system", "fsrefs_test_file_system\fsrefs_test_file_system.vcproj", "{F139F66F-812A-4AE5-9950-DA583DF64F90}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_io_handle", "fsrefs_test_io_handle\fsrefs_test_io_handle.vcproj", "{011F4ADF-096E-4B5C-972B-80CA715C06E8}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_metadata_block_header", "fsrefs_test_metadata_block_header\fsrefs_test_metadata_block_header.vcproj", "{0B7CF568-8154-41C0-85E0-182D0172DF69}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_ministore_node", "fsrefs_test_ministore_node\fsrefs_test_ministore_node.vcproj", "{ECFEFE5C-4167-45D6-9888-3AEDF151EE6A}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_node_header", "fsrefs_test_node_header\fsrefs_test_node_header.vcproj", "{99CE5562-ED92-4BCA-AECE-69E98C0F6281}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_node_record", "fsrefs_test_node_record\fsrefs_test_node_record.vcproj", "{E2913BF9-8251-4905-9C3F-259968A95A08}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_notify", "fsrefs_test_notify\fsrefs_test_notify.vcproj", "{C6939822-15BF-4CD9-8DF1-6444B30DF640}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_objects_tree", "fsrefs_test_objects_tree\fsrefs_test_objects_tree.vcproj", "{68271DFE-475D-4987-81D7-AC14C71B6244}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_superblock", "fsrefs_test_superblock\fsrefs_test_superblock.vcproj", "{DFF7AF07-0F74-472D-97FE-BA9A068ABC3F}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_support", "fsrefs_test_support\fsrefs_test_support.vcproj", "{3507BFE7-7504-46F9-B33E-038BDC5EC426}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_tools_info_handle", "fsrefs_test_tools_info_handle\fsrefs_test_tools_info_handle.vcproj", "{65CDD553-456B-4110-B594-87C12AF39B2B}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_tools_output", "fsrefs_test_tools_output\fsrefs_test_tools_output.vcproj", "{5E36F2A8-F375-4777-8D75-FB2C895FA81A}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_tools_signal", "fsrefs_test_tools_signal\fsrefs_test_tools_signal.vcproj", "{08B474B6-F7FE-4FCB-B598-B8C2F664BD88}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_tree_header", "fsrefs_test_tree_header\fsrefs_test_tree_header.vcproj", "{AE26AFAA-85F1-45B7-9F9D-EDCA66642C2C}" ProjectSection(ProjectDependencies) = postProject {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_volume", "fsrefs_test_volume\fsrefs_test_volume.vcproj", "{86CEACC5-A5E8-4664-9332-829C13BD3EB0}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {3FB75558-9168-450F-9FE2-EDB2A08EBE64} = {3FB75558-9168-450F-9FE2-EDB2A08EBE64} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefs_test_volume_header", "fsrefs_test_volume_header\fsrefs_test_volume_header.vcproj", "{6703E278-1803-4BAD-A7B2-1C80E7BC4416}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libclocale", "libclocale\libclocale.vcproj", "{221E4F2C-BB02-4C32-9C3E-95E80CC60574}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbfio", "libbfio\libbfio.vcproj", "{6B3ECD42-FEA0-4920-B1F5-FBB83439A17D}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {3FB75558-9168-450F-9FE2-EDB2A08EBE64} = {3FB75558-9168-450F-9FE2-EDB2A08EBE64} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfdatetime", "libfdatetime\libfdatetime.vcproj", "{F3C93041-4C86-4F58-B22C-336B2A82038A}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcfile", "libcfile\libcfile.vcproj", "{4DC006AE-1CA8-476B-AD2C-F43A8F093E5A}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfwnt", "libfwnt\libfwnt.vcproj", "{25FBF40F-8CE3-4F18-B738-43388FA152C9}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {3FB75558-9168-450F-9FE2-EDB2A08EBE64} = {3FB75558-9168-450F-9FE2-EDB2A08EBE64} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcthreads", "libcthreads\libcthreads.vcproj", "{3FB75558-9168-450F-9FE2-EDB2A08EBE64}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcpath", "libcpath\libcpath.vcproj", "{8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfusn", "libfusn\libfusn.vcproj", "{682153A3-8081-4698-802F-F0E3DA327950}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {F3C93041-4C86-4F58-B22C-336B2A82038A} = {F3C93041-4C86-4F58-B22C-336B2A82038A} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libuna", "libuna\libuna.vcproj", "{1EF1DBEB-344B-45C9-BF06-FE36F5145C27}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfsrefs", "libfsrefs\libfsrefs.vcproj", "{44706D15-A853-489F-B136-57F352800654}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {3FB75558-9168-450F-9FE2-EDB2A08EBE64} = {3FB75558-9168-450F-9FE2-EDB2A08EBE64} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF} = {3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF} {C1E29BED-CD7D-4A41-8DE4-45F7EA4CBFE4} = {C1E29BED-CD7D-4A41-8DE4-45F7EA4CBFE4} {F3C93041-4C86-4F58-B22C-336B2A82038A} = {F3C93041-4C86-4F58-B22C-336B2A82038A} {87BEF2E0-F880-46F6-ADDA-DDBCD4A80B3D} = {87BEF2E0-F880-46F6-ADDA-DDBCD4A80B3D} {25FBF40F-8CE3-4F18-B738-43388FA152C9} = {25FBF40F-8CE3-4F18-B738-43388FA152C9} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcerror", "libcerror\libcerror.vcproj", "{CA038E14-4A24-4E0A-8198-66FCE5D1D48B}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcnotify", "libcnotify\libcnotify.vcproj", "{6A54FAA1-6394-40D7-94F2-2F504C1E8A85}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fsrefsinfo", "fsrefsinfo\fsrefsinfo.vcproj", "{DDF498F3-065E-468C-B3AA-0C538AD45B1E}" ProjectSection(ProjectDependencies) = postProject {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} = {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D} {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} = {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0} {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} = {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A} {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} = {1EF1DBEB-344B-45C9-BF06-FE36F5145C27} {B983F764-6F5A-482E-9E8B-23D68DBC7173} = {B983F764-6F5A-482E-9E8B-23D68DBC7173} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {221E4F2C-BB02-4C32-9C3E-95E80CC60574} = {221E4F2C-BB02-4C32-9C3E-95E80CC60574} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {44706D15-A853-489F-B136-57F352800654} = {44706D15-A853-489F-B136-57F352800654} {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfdata", "libfdata\libfdata.vcproj", "{C1E29BED-CD7D-4A41-8DE4-45F7EA4CBFE4}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {3FB75558-9168-450F-9FE2-EDB2A08EBE64} = {3FB75558-9168-450F-9FE2-EDB2A08EBE64} {6CDB6011-A284-45B9-9043-D79AEC26396C} = {6CDB6011-A284-45B9-9043-D79AEC26396C} {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} = {6A54FAA1-6394-40D7-94F2-2F504C1E8A85} {3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF} = {3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcdata", "libcdata\libcdata.vcproj", "{6CDB6011-A284-45B9-9043-D79AEC26396C}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} {3FB75558-9168-450F-9FE2-EDB2A08EBE64} = {3FB75558-9168-450F-9FE2-EDB2A08EBE64} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcsplit", "libcsplit\libcsplit.vcproj", "{B983F764-6F5A-482E-9E8B-23D68DBC7173}" ProjectSection(ProjectDependencies) = postProject {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} = {CA038E14-4A24-4E0A-8198-66FCE5D1D48B} EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|Win32 = Release|Win32 VSDebug|Win32 = VSDebug|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF}.Release|Win32.ActiveCfg = Release|Win32 {3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF}.Release|Win32.Build.0 = Release|Win32 {3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {3B808C9B-707E-4AD6-80E3-A57B5FA3AFAF}.VSDebug|Win32.Build.0 = VSDebug|Win32 {87BEF2E0-F880-46F6-ADDA-DDBCD4A80B3D}.Release|Win32.ActiveCfg = Release|Win32 {87BEF2E0-F880-46F6-ADDA-DDBCD4A80B3D}.Release|Win32.Build.0 = Release|Win32 {87BEF2E0-F880-46F6-ADDA-DDBCD4A80B3D}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {87BEF2E0-F880-46F6-ADDA-DDBCD4A80B3D}.VSDebug|Win32.Build.0 = VSDebug|Win32 {10303E16-AE3C-4EC5-9058-40A53F9E6D30}.Release|Win32.ActiveCfg = Release|Win32 {10303E16-AE3C-4EC5-9058-40A53F9E6D30}.Release|Win32.Build.0 = Release|Win32 {10303E16-AE3C-4EC5-9058-40A53F9E6D30}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {10303E16-AE3C-4EC5-9058-40A53F9E6D30}.VSDebug|Win32.Build.0 = VSDebug|Win32 {86FE2A37-6E20-42C5-AD0E-65C894513B1E}.Release|Win32.ActiveCfg = Release|Win32 {86FE2A37-6E20-42C5-AD0E-65C894513B1E}.Release|Win32.Build.0 = Release|Win32 {86FE2A37-6E20-42C5-AD0E-65C894513B1E}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {86FE2A37-6E20-42C5-AD0E-65C894513B1E}.VSDebug|Win32.Build.0 = VSDebug|Win32 {6481EBD4-1CE7-4701-B4B2-BD0733B1892E}.Release|Win32.ActiveCfg = Release|Win32 {6481EBD4-1CE7-4701-B4B2-BD0733B1892E}.Release|Win32.Build.0 = Release|Win32 {6481EBD4-1CE7-4701-B4B2-BD0733B1892E}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {6481EBD4-1CE7-4701-B4B2-BD0733B1892E}.VSDebug|Win32.Build.0 = VSDebug|Win32 {FA1B5333-2889-41C8-B936-B123F8B71D53}.Release|Win32.ActiveCfg = Release|Win32 {FA1B5333-2889-41C8-B936-B123F8B71D53}.Release|Win32.Build.0 = Release|Win32 {FA1B5333-2889-41C8-B936-B123F8B71D53}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {FA1B5333-2889-41C8-B936-B123F8B71D53}.VSDebug|Win32.Build.0 = VSDebug|Win32 {C68F2739-7E0D-41BC-9126-4F4662B62D2F}.Release|Win32.ActiveCfg = Release|Win32 {C68F2739-7E0D-41BC-9126-4F4662B62D2F}.Release|Win32.Build.0 = Release|Win32 {C68F2739-7E0D-41BC-9126-4F4662B62D2F}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {C68F2739-7E0D-41BC-9126-4F4662B62D2F}.VSDebug|Win32.Build.0 = VSDebug|Win32 {AF13DDD6-36B7-4589-98EF-113557719D40}.Release|Win32.ActiveCfg = Release|Win32 {AF13DDD6-36B7-4589-98EF-113557719D40}.Release|Win32.Build.0 = Release|Win32 {AF13DDD6-36B7-4589-98EF-113557719D40}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {AF13DDD6-36B7-4589-98EF-113557719D40}.VSDebug|Win32.Build.0 = VSDebug|Win32 {383E86C0-B064-4E96-8C80-D1BA77232B07}.Release|Win32.ActiveCfg = Release|Win32 {383E86C0-B064-4E96-8C80-D1BA77232B07}.Release|Win32.Build.0 = Release|Win32 {383E86C0-B064-4E96-8C80-D1BA77232B07}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {383E86C0-B064-4E96-8C80-D1BA77232B07}.VSDebug|Win32.Build.0 = VSDebug|Win32 {47245AB7-7780-46AF-B1E1-895CDCD70B44}.Release|Win32.ActiveCfg = Release|Win32 {47245AB7-7780-46AF-B1E1-895CDCD70B44}.Release|Win32.Build.0 = Release|Win32 {47245AB7-7780-46AF-B1E1-895CDCD70B44}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {47245AB7-7780-46AF-B1E1-895CDCD70B44}.VSDebug|Win32.Build.0 = VSDebug|Win32 {77FD568A-E194-4119-84E3-F9B780604DFB}.Release|Win32.ActiveCfg = Release|Win32 {77FD568A-E194-4119-84E3-F9B780604DFB}.Release|Win32.Build.0 = Release|Win32 {77FD568A-E194-4119-84E3-F9B780604DFB}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {77FD568A-E194-4119-84E3-F9B780604DFB}.VSDebug|Win32.Build.0 = VSDebug|Win32 {F4A33415-A38B-4FCE-A9C5-C3298AB0DA31}.Release|Win32.ActiveCfg = Release|Win32 {F4A33415-A38B-4FCE-A9C5-C3298AB0DA31}.Release|Win32.Build.0 = Release|Win32 {F4A33415-A38B-4FCE-A9C5-C3298AB0DA31}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {F4A33415-A38B-4FCE-A9C5-C3298AB0DA31}.VSDebug|Win32.Build.0 = VSDebug|Win32 {4BDB64CA-2219-4737-B0D9-EEEBCDE526EB}.Release|Win32.ActiveCfg = Release|Win32 {4BDB64CA-2219-4737-B0D9-EEEBCDE526EB}.Release|Win32.Build.0 = Release|Win32 {4BDB64CA-2219-4737-B0D9-EEEBCDE526EB}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {4BDB64CA-2219-4737-B0D9-EEEBCDE526EB}.VSDebug|Win32.Build.0 = VSDebug|Win32 {F139F66F-812A-4AE5-9950-DA583DF64F90}.Release|Win32.ActiveCfg = Release|Win32 {F139F66F-812A-4AE5-9950-DA583DF64F90}.Release|Win32.Build.0 = Release|Win32 {F139F66F-812A-4AE5-9950-DA583DF64F90}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {F139F66F-812A-4AE5-9950-DA583DF64F90}.VSDebug|Win32.Build.0 = VSDebug|Win32 {011F4ADF-096E-4B5C-972B-80CA715C06E8}.Release|Win32.ActiveCfg = Release|Win32 {011F4ADF-096E-4B5C-972B-80CA715C06E8}.Release|Win32.Build.0 = Release|Win32 {011F4ADF-096E-4B5C-972B-80CA715C06E8}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {011F4ADF-096E-4B5C-972B-80CA715C06E8}.VSDebug|Win32.Build.0 = VSDebug|Win32 {0B7CF568-8154-41C0-85E0-182D0172DF69}.Release|Win32.ActiveCfg = Release|Win32 {0B7CF568-8154-41C0-85E0-182D0172DF69}.Release|Win32.Build.0 = Release|Win32 {0B7CF568-8154-41C0-85E0-182D0172DF69}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {0B7CF568-8154-41C0-85E0-182D0172DF69}.VSDebug|Win32.Build.0 = VSDebug|Win32 {ECFEFE5C-4167-45D6-9888-3AEDF151EE6A}.Release|Win32.ActiveCfg = Release|Win32 {ECFEFE5C-4167-45D6-9888-3AEDF151EE6A}.Release|Win32.Build.0 = Release|Win32 {ECFEFE5C-4167-45D6-9888-3AEDF151EE6A}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {ECFEFE5C-4167-45D6-9888-3AEDF151EE6A}.VSDebug|Win32.Build.0 = VSDebug|Win32 {99CE5562-ED92-4BCA-AECE-69E98C0F6281}.Release|Win32.ActiveCfg = Release|Win32 {99CE5562-ED92-4BCA-AECE-69E98C0F6281}.Release|Win32.Build.0 = Release|Win32 {99CE5562-ED92-4BCA-AECE-69E98C0F6281}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {99CE5562-ED92-4BCA-AECE-69E98C0F6281}.VSDebug|Win32.Build.0 = VSDebug|Win32 {E2913BF9-8251-4905-9C3F-259968A95A08}.Release|Win32.ActiveCfg = Release|Win32 {E2913BF9-8251-4905-9C3F-259968A95A08}.Release|Win32.Build.0 = Release|Win32 {E2913BF9-8251-4905-9C3F-259968A95A08}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {E2913BF9-8251-4905-9C3F-259968A95A08}.VSDebug|Win32.Build.0 = VSDebug|Win32 {C6939822-15BF-4CD9-8DF1-6444B30DF640}.Release|Win32.ActiveCfg = Release|Win32 {C6939822-15BF-4CD9-8DF1-6444B30DF640}.Release|Win32.Build.0 = Release|Win32 {C6939822-15BF-4CD9-8DF1-6444B30DF640}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {C6939822-15BF-4CD9-8DF1-6444B30DF640}.VSDebug|Win32.Build.0 = VSDebug|Win32 {68271DFE-475D-4987-81D7-AC14C71B6244}.Release|Win32.ActiveCfg = Release|Win32 {68271DFE-475D-4987-81D7-AC14C71B6244}.Release|Win32.Build.0 = Release|Win32 {68271DFE-475D-4987-81D7-AC14C71B6244}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {68271DFE-475D-4987-81D7-AC14C71B6244}.VSDebug|Win32.Build.0 = VSDebug|Win32 {DFF7AF07-0F74-472D-97FE-BA9A068ABC3F}.Release|Win32.ActiveCfg = Release|Win32 {DFF7AF07-0F74-472D-97FE-BA9A068ABC3F}.Release|Win32.Build.0 = Release|Win32 {DFF7AF07-0F74-472D-97FE-BA9A068ABC3F}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {DFF7AF07-0F74-472D-97FE-BA9A068ABC3F}.VSDebug|Win32.Build.0 = VSDebug|Win32 {3507BFE7-7504-46F9-B33E-038BDC5EC426}.Release|Win32.ActiveCfg = Release|Win32 {3507BFE7-7504-46F9-B33E-038BDC5EC426}.Release|Win32.Build.0 = Release|Win32 {3507BFE7-7504-46F9-B33E-038BDC5EC426}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {3507BFE7-7504-46F9-B33E-038BDC5EC426}.VSDebug|Win32.Build.0 = VSDebug|Win32 {65CDD553-456B-4110-B594-87C12AF39B2B}.Release|Win32.ActiveCfg = Release|Win32 {65CDD553-456B-4110-B594-87C12AF39B2B}.Release|Win32.Build.0 = Release|Win32 {65CDD553-456B-4110-B594-87C12AF39B2B}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {65CDD553-456B-4110-B594-87C12AF39B2B}.VSDebug|Win32.Build.0 = VSDebug|Win32 {5E36F2A8-F375-4777-8D75-FB2C895FA81A}.Release|Win32.ActiveCfg = Release|Win32 {5E36F2A8-F375-4777-8D75-FB2C895FA81A}.Release|Win32.Build.0 = Release|Win32 {5E36F2A8-F375-4777-8D75-FB2C895FA81A}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {5E36F2A8-F375-4777-8D75-FB2C895FA81A}.VSDebug|Win32.Build.0 = VSDebug|Win32 {08B474B6-F7FE-4FCB-B598-B8C2F664BD88}.Release|Win32.ActiveCfg = Release|Win32 {08B474B6-F7FE-4FCB-B598-B8C2F664BD88}.Release|Win32.Build.0 = Release|Win32 {08B474B6-F7FE-4FCB-B598-B8C2F664BD88}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {08B474B6-F7FE-4FCB-B598-B8C2F664BD88}.VSDebug|Win32.Build.0 = VSDebug|Win32 {AE26AFAA-85F1-45B7-9F9D-EDCA66642C2C}.Release|Win32.ActiveCfg = Release|Win32 {AE26AFAA-85F1-45B7-9F9D-EDCA66642C2C}.Release|Win32.Build.0 = Release|Win32 {AE26AFAA-85F1-45B7-9F9D-EDCA66642C2C}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {AE26AFAA-85F1-45B7-9F9D-EDCA66642C2C}.VSDebug|Win32.Build.0 = VSDebug|Win32 {86CEACC5-A5E8-4664-9332-829C13BD3EB0}.Release|Win32.ActiveCfg = Release|Win32 {86CEACC5-A5E8-4664-9332-829C13BD3EB0}.Release|Win32.Build.0 = Release|Win32 {86CEACC5-A5E8-4664-9332-829C13BD3EB0}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {86CEACC5-A5E8-4664-9332-829C13BD3EB0}.VSDebug|Win32.Build.0 = VSDebug|Win32 {6703E278-1803-4BAD-A7B2-1C80E7BC4416}.Release|Win32.ActiveCfg = Release|Win32 {6703E278-1803-4BAD-A7B2-1C80E7BC4416}.Release|Win32.Build.0 = Release|Win32 {6703E278-1803-4BAD-A7B2-1C80E7BC4416}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {6703E278-1803-4BAD-A7B2-1C80E7BC4416}.VSDebug|Win32.Build.0 = VSDebug|Win32 {221E4F2C-BB02-4C32-9C3E-95E80CC60574}.Release|Win32.ActiveCfg = Release|Win32 {221E4F2C-BB02-4C32-9C3E-95E80CC60574}.Release|Win32.Build.0 = Release|Win32 {221E4F2C-BB02-4C32-9C3E-95E80CC60574}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {221E4F2C-BB02-4C32-9C3E-95E80CC60574}.VSDebug|Win32.Build.0 = VSDebug|Win32 {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D}.Release|Win32.ActiveCfg = Release|Win32 {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D}.Release|Win32.Build.0 = Release|Win32 {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {6B3ECD42-FEA0-4920-B1F5-FBB83439A17D}.VSDebug|Win32.Build.0 = VSDebug|Win32 {F3C93041-4C86-4F58-B22C-336B2A82038A}.Release|Win32.ActiveCfg = Release|Win32 {F3C93041-4C86-4F58-B22C-336B2A82038A}.Release|Win32.Build.0 = Release|Win32 {F3C93041-4C86-4F58-B22C-336B2A82038A}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {F3C93041-4C86-4F58-B22C-336B2A82038A}.VSDebug|Win32.Build.0 = VSDebug|Win32 {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A}.Release|Win32.ActiveCfg = Release|Win32 {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A}.Release|Win32.Build.0 = Release|Win32 {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {4DC006AE-1CA8-476B-AD2C-F43A8F093E5A}.VSDebug|Win32.Build.0 = VSDebug|Win32 {25FBF40F-8CE3-4F18-B738-43388FA152C9}.Release|Win32.ActiveCfg = Release|Win32 {25FBF40F-8CE3-4F18-B738-43388FA152C9}.Release|Win32.Build.0 = Release|Win32 {25FBF40F-8CE3-4F18-B738-43388FA152C9}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {25FBF40F-8CE3-4F18-B738-43388FA152C9}.VSDebug|Win32.Build.0 = VSDebug|Win32 {3FB75558-9168-450F-9FE2-EDB2A08EBE64}.Release|Win32.ActiveCfg = Release|Win32 {3FB75558-9168-450F-9FE2-EDB2A08EBE64}.Release|Win32.Build.0 = Release|Win32 {3FB75558-9168-450F-9FE2-EDB2A08EBE64}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {3FB75558-9168-450F-9FE2-EDB2A08EBE64}.VSDebug|Win32.Build.0 = VSDebug|Win32 {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0}.Release|Win32.ActiveCfg = Release|Win32 {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0}.Release|Win32.Build.0 = Release|Win32 {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {8B79E71C-A5BA-4ABD-9BF6-D3858054F7A0}.VSDebug|Win32.Build.0 = VSDebug|Win32 {682153A3-8081-4698-802F-F0E3DA327950}.Release|Win32.ActiveCfg = Release|Win32 {682153A3-8081-4698-802F-F0E3DA327950}.Release|Win32.Build.0 = Release|Win32 {682153A3-8081-4698-802F-F0E3DA327950}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {682153A3-8081-4698-802F-F0E3DA327950}.VSDebug|Win32.Build.0 = VSDebug|Win32 {1EF1DBEB-344B-45C9-BF06-FE36F5145C27}.Release|Win32.ActiveCfg = Release|Win32 {1EF1DBEB-344B-45C9-BF06-FE36F5145C27}.Release|Win32.Build.0 = Release|Win32 {1EF1DBEB-344B-45C9-BF06-FE36F5145C27}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {1EF1DBEB-344B-45C9-BF06-FE36F5145C27}.VSDebug|Win32.Build.0 = VSDebug|Win32 {44706D15-A853-489F-B136-57F352800654}.Release|Win32.ActiveCfg = Release|Win32 {44706D15-A853-489F-B136-57F352800654}.Release|Win32.Build.0 = Release|Win32 {44706D15-A853-489F-B136-57F352800654}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {44706D15-A853-489F-B136-57F352800654}.VSDebug|Win32.Build.0 = VSDebug|Win32 {CA038E14-4A24-4E0A-8198-66FCE5D1D48B}.Release|Win32.ActiveCfg = Release|Win32 {CA038E14-4A24-4E0A-8198-66FCE5D1D48B}.Release|Win32.Build.0 = Release|Win32 {CA038E14-4A24-4E0A-8198-66FCE5D1D48B}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {CA038E14-4A24-4E0A-8198-66FCE5D1D48B}.VSDebug|Win32.Build.0 = VSDebug|Win32 {6A54FAA1-6394-40D7-94F2-2F504C1E8A85}.Release|Win32.ActiveCfg = Release|Win32 {6A54FAA1-6394-40D7-94F2-2F504C1E8A85}.Release|Win32.Build.0 = Release|Win32 {6A54FAA1-6394-40D7-94F2-2F504C1E8A85}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {6A54FAA1-6394-40D7-94F2-2F504C1E8A85}.VSDebug|Win32.Build.0 = VSDebug|Win32 {DDF498F3-065E-468C-B3AA-0C538AD45B1E}.Release|Win32.ActiveCfg = Release|Win32 {DDF498F3-065E-468C-B3AA-0C538AD45B1E}.Release|Win32.Build.0 = Release|Win32 {DDF498F3-065E-468C-B3AA-0C538AD45B1E}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {DDF498F3-065E-468C-B3AA-0C538AD45B1E}.VSDebug|Win32.Build.0 = VSDebug|Win32 {C1E29BED-CD7D-4A41-8DE4-45F7EA4CBFE4}.Release|Win32.ActiveCfg = Release|Win32 {C1E29BED-CD7D-4A41-8DE4-45F7EA4CBFE4}.Release|Win32.Build.0 = Release|Win32 {C1E29BED-CD7D-4A41-8DE4-45F7EA4CBFE4}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {C1E29BED-CD7D-4A41-8DE4-45F7EA4CBFE4}.VSDebug|Win32.Build.0 = VSDebug|Win32 {6CDB6011-A284-45B9-9043-D79AEC26396C}.Release|Win32.ActiveCfg = Release|Win32 {6CDB6011-A284-45B9-9043-D79AEC26396C}.Release|Win32.Build.0 = Release|Win32 {6CDB6011-A284-45B9-9043-D79AEC26396C}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {6CDB6011-A284-45B9-9043-D79AEC26396C}.VSDebug|Win32.Build.0 = VSDebug|Win32 {B983F764-6F5A-482E-9E8B-23D68DBC7173}.Release|Win32.ActiveCfg = Release|Win32 {B983F764-6F5A-482E-9E8B-23D68DBC7173}.Release|Win32.Build.0 = Release|Win32 {B983F764-6F5A-482E-9E8B-23D68DBC7173}.VSDebug|Win32.ActiveCfg = VSDebug|Win32 {B983F764-6F5A-482E-9E8B-23D68DBC7173}.VSDebug|Win32.Build.0 = VSDebug|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal ================================================ FILE: msvscpp/libfusn/libfusn.vcproj ================================================ ================================================ FILE: msvscpp/libfwnt/libfwnt.vcproj ================================================ ================================================ FILE: msvscpp/libuna/libuna.vcproj ================================================ ================================================ FILE: ossfuzz/Makefile.am ================================================ if HAVE_LIB_FUZZING_ENGINE AM_CPPFLAGS = \ -I../include -I$(top_srcdir)/include \ -I../common -I$(top_srcdir)/common \ @LIBCERROR_CPPFLAGS@ \ @LIBCDATA_CPPFLAGS@ \ @LIBCLOCALE_CPPFLAGS@ \ @LIBCNOTIFY_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ @LIBCFILE_CPPFLAGS@ \ @LIBCPATH_CPPFLAGS@ \ @LIBBFIO_CPPFLAGS@ bin_PROGRAMS = \ volume_fuzzer volume_fuzzer_SOURCES = \ ossfuzz_libbfio.h \ ossfuzz_libfsrefs.h \ volume_fuzzer.cc volume_fuzzer_LDADD = \ @LIB_FUZZING_ENGINE@ \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCERROR_LIBADD@ \ @LIBINTL@ endif DISTCLEANFILES = \ Makefile \ Makefile.in splint-local: @echo "Running splint on volume_fuzzer ..." -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(volume_fuzzer_SOURCES) ================================================ FILE: ossfuzz/ossfuzz_libbfio.h ================================================ /* * The libbfio header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _OSSFUZZ_LIBBFIO_H ) #define _OSSFUZZ_LIBBFIO_H #include /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio */ #if defined( HAVE_LOCAL_LIBBFIO ) #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT * before including libbfio.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) #define LIBBFIO_DLL_IMPORT #endif #include #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) #error Multi-threading support requires libbfio with multi-threading support #endif #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ #endif /* !defined( _OSSFUZZ_LIBBFIO_H ) */ ================================================ FILE: ossfuzz/ossfuzz_libfsrefs.h ================================================ /* * The libfsrefs header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _OSSFUZZ_LIBFSREFS_H ) #define _OSSFUZZ_LIBFSREFS_H #include #include #endif /* !defined( _OSSFUZZ_LIBFSREFS_H ) */ ================================================ FILE: ossfuzz/volume_fuzzer.cc ================================================ /* * OSS-Fuzz target for libfsrefs volume type * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include /* Note that some of the OSS-Fuzz engines use C++ */ extern "C" { #include "ossfuzz_libbfio.h" #include "ossfuzz_libfsrefs.h" #if !defined( LIBFSREFS_HAVE_BFIO ) /* Opens a volume using a Basic File IO (bfio) handle * Returns 1 if successful or -1 on error */ LIBFSREFS_EXTERN \ int libfsrefs_volume_open_file_io_handle( libfsrefs_volume_t *volume, libbfio_handle_t *file_io_handle, int access_flags, libfsrefs_error_t **error ); #endif /* !defined( LIBFSREFS_HAVE_BFIO ) */ int LLVMFuzzerTestOneInput( const uint8_t *data, size_t size ) { libbfio_handle_t *file_io_handle = NULL; libfsrefs_volume_t *volume = NULL; if( libbfio_memory_range_initialize( &file_io_handle, NULL ) != 1 ) { return( 0 ); } if( libbfio_memory_range_set( file_io_handle, (uint8_t *) data, size, NULL ) != 1 ) { goto on_error_libbfio; } if( libfsrefs_volume_initialize( &volume, NULL ) != 1 ) { goto on_error_libbfio; } if( libfsrefs_volume_open_file_io_handle( volume, file_io_handle, LIBFSREFS_OPEN_READ, NULL ) != 1 ) { goto on_error_libfsrefs; } libfsrefs_volume_close( volume, NULL ); on_error_libfsrefs: libfsrefs_volume_free( &volume, NULL ); on_error_libbfio: libbfio_handle_free( &file_io_handle, NULL ); return( 0 ); } } /* extern "C" */ ================================================ FILE: po/ChangeLog ================================================ 2016-11-09 gettextize ================================================ FILE: po/Makevars.in ================================================ # Makefile variables for PO directory in any package using GNU gettext. # Usually the message domain is the same as the package name. DOMAIN = @PACKAGE@ # These two variables depend on the location of this directory. subdir = po top_builddir = .. # These options get passed to xgettext. XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ # This is the copyright holder that gets inserted into the header of the # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding # package. (Note that the msgstr strings, extracted from the package's # sources, belong to the copyright holder of the package.) Translators are # expected to transfer the copyright for their translations to this person # or entity, or to disclaim their copyright. The empty string stands for # the public domain; in this case the translators are expected to disclaim # their copyright. COPYRIGHT_HOLDER = Joachim Metz # This is the email address or URL to which the translators shall report # bugs in the untranslated strings: # - Strings which are not entire sentences, see the maintainer guidelines # in the GNU gettext documentation, section 'Preparing Strings'. # - Strings which use unclear terms or require additional context to be # understood. # - Strings which make invalid assumptions about notation of date, time or # money. # - Pluralisation problems. # - Incorrect English spelling. # - Incorrect formatting. # It can be your email address, or a mailing list address where translators # can write to without being subscribed, or the URL of a web page through # which the translators can contact you. MSGID_BUGS_ADDRESS = @PACKAGE_BUGREPORT@ # This is the list of locale categories, beyond LC_MESSAGES, for which the # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = # Additional make targets. sources splint: ================================================ FILE: po/POTFILES.in ================================================ # List of source files which contain translatable strings. ================================================ FILE: runtests.ps1 ================================================ # Script that runs the tests # # Version: 20220103 $ExitSuccess = 0 $ExitFailure = 1 $ExitIgnore = 77 Set-Location -Path "tests" $Result = ${ExitSuccess} $Lines = Get-Content "Makefile.am" $InTests = $FALSE Foreach (${Line} in ${Lines}) { If (${InTests}) { If (-Not ${Line}) { ${InTests} = $FALSE Continue } ${Line} = ${Line}.TrimStart() If (${Line}.EndsWith(" \")) { ${Line} = ${Line}.Substring(0, ${Line}.Length - 2) } If (-Not (${Line}.EndsWith(".sh"))) { Continue } ${Line} = ${Line}.Substring(0, ${Line}.Length - 3) ${Line} = ".\${Line}.ps1" Try { Invoke-Expression ${Line} } Catch { $LastExitCode = ${ExitIgnore} } If (${LastExitCode} -eq ${ExitFailure}) { $Result = ${ExitFailure} Write-Host "FAIL" -foreground Red -nonewline } ElseIf (${LastExitCode} -eq ${ExitIgnore}) { Write-Host "SKIP" -foreground Cyan -nonewline } Else { Write-Host "PASS" -foreground Green -nonewline } Write-Host ": ${Line}" } ElseIf (${Line}.StartsWith("TESTS = ")) { ${InTests} = $TRUE } } Set-Location -Path ".." Exit ${Result} ================================================ FILE: runtests.sh ================================================ #!/usr/bin/env bash # Script that runs the tests # # Version: 20231119 EXIT_SUCCESS=0; EXIT_FAILURE=1; run_configure_make() { local CONFIGURE_OPTIONS=$@; ./configure ${CONFIGURE_OPTIONS[@]}; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo "Running: './configure' failed"; return ${RESULT}; fi make clean > /dev/null; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo "Running: 'make clean' failed"; return ${RESULT}; fi make > /dev/null; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo "Running: 'make' failed"; return ${RESULT}; fi return ${EXIT_SUCCESS}; } run_configure_make_check() { run_configure_make $@; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then return ${RESULT}; fi make check CHECK_WITH_STDERR=1; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo "Running: 'make check' failed"; if test -f tests/test-suite.log; then cat tests/test-suite.log; fi return ${RESULT}; fi return ${EXIT_SUCCESS}; } run_configure_make_check_with_asan() { local LDCONFIG=`which ldconfig 2> /dev/null`; if test -z ${LDCONFIG} || test ! -x ${LDCONFIG}; then return ${EXIT_SUCCESS}; fi local LIBASAN=`ldconfig -p | grep libasan | sed 's/^.* => //' | sort | tail -n 1`; if test -z ${LIBASAN} || test ! -f ${LIBASAN}; then return ${EXIT_SUCCESS}; fi # Using libasan is platform dependent. export CPPFLAGS="-DHAVE_ASAN"; export CFLAGS="-fno-omit-frame-pointer -fsanitize=address -g"; export LDFLAGS="-fsanitize=address -g"; if test -z ${CC} || test ${CC} != "clang"; then LDFLAGS="${LDFLAGS} -lasan"; fi run_configure_make $@; RESULT=$?; export CPPFLAGS=; export CFLAGS=; export LDFLAGS=; if test ${RESULT} -ne ${EXIT_SUCCESS}; then return ${RESULT}; fi make check CHECK_WITH_ASAN=1 CHECK_WITH_STDERR=1; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo "Running: 'make check' failed"; if test -f tests/test-suite.log; then cat tests/test-suite.log; fi return ${RESULT}; fi return ${RESULT}; } run_configure_make_check_with_coverage() { # Disable optimization so we can hook malloc and realloc. export CPPFLAGS="-DOPTIMIZATION_DISABLED"; export CFLAGS="--coverage -O0"; export LDFLAGS="--coverage"; # Disable creating a shared library so we can hook memset. run_configure_make_check $@; RESULT=$?; export CPPFLAGS=; export CFLAGS=; export LDFLAGS=; return ${RESULT}; } run_configure_make_check_python() { run_configure_make $@; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then return ${RESULT}; fi make check CHECK_WITH_STDERR=1 SKIP_LIBRARY_TESTS=1 SKIP_TOOLS_TESTS=1; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo "Running: 'make check' failed"; if test -f tests/test-suite.log; then cat tests/test-suite.log; fi return ${RESULT}; fi return ${EXIT_SUCCESS}; } run_setup_py_tests() { # Skip this test when running Cygwin on AppVeyor. if test -n "${APPVEYOR}" && test ${TARGET} = "cygwin"; then echo "Running: 'setup.py build' skipped"; return ${EXIT_SUCCESS}; fi PYTHON=$1; ${PYTHON} setup.py build; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo "Running: 'setup.py build' failed"; return ${RESULT}; fi return ${EXIT_SUCCESS}; } PROJECT_NAME=`basename $PWD`; CONFIGURE_HELP=`./configure --help`; echo "${CONFIGURE_HELP}" | grep -- '--enable-wide-character-type' > /dev/null; HAVE_ENABLE_WIDE_CHARACTER_TYPE=$?; echo "${CONFIGURE_HELP}" | grep -- '--enable-verbose-output' > /dev/null; HAVE_ENABLE_VERBOSE_OUTPUT=$?; echo "${CONFIGURE_HELP}" | grep -- '--enable-debug-output' > /dev/null; HAVE_ENABLE_DEBUG_OUTPUT=$?; echo "${CONFIGURE_HELP}" | grep -- '--with-bzip2' > /dev/null; HAVE_WITH_BZIP2=$?; echo "${CONFIGURE_HELP}" | grep -- '--with-libfuse' > /dev/null; HAVE_WITH_LIBFUSE=$?; echo "${CONFIGURE_HELP}" | grep -- '--with-lzma' > /dev/null; HAVE_WITH_LZMA=$?; echo "${CONFIGURE_HELP}" | grep -- '--with-pthread' > /dev/null; HAVE_WITH_PTHREAD=$?; echo "${CONFIGURE_HELP}" | grep -- '--with-openssl' > /dev/null; HAVE_WITH_OPENSSL=$?; echo "${CONFIGURE_HELP}" | grep -- '--with-zlib' > /dev/null; HAVE_WITH_ZLIB=$?; echo "${CONFIGURE_HELP}" | grep -- '--enable-python' > /dev/null; HAVE_ENABLE_PYTHON=$?; echo "${CONFIGURE_HELP}" | grep -- '--enable-static-executables' > /dev/null; HAVE_ENABLE_STATIC_EXECUTABLES=$?; PYTHON_CONFIG=""; if test -x /usr/bin/whereis; then PYTHON_CONFIG=`/usr/bin/whereis python-config | sed 's/^.*:[ ]*//' 2> /dev/null`; fi # Test "./configure && make && make check" without options. run_configure_make_check; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi if test ${HAVE_ENABLE_VERBOSE_OUTPUT} -eq 0 && test ${HAVE_ENABLE_DEBUG_OUTPUT} -eq 0; then # Test "./configure && make && make check" with verbose and debug output. run_configure_make_check "--enable-verbose-output --enable-debug-output"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi fi if test ${HAVE_WITH_PTHREAD} -eq 0 && test ${PROJECT_NAME} != "libcthreads"; then # Test "./configure && make && make check" without multi-threading support. run_configure_make_check "--with-pthread=no"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi fi if test ${HAVE_WITH_ZLIB} -eq 0; then # Test "./configure && make && make check" with fallback zlib implementation. run_configure_make_check "--with-zlib=no"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi fi if test ${HAVE_WITH_OPENSSL} -eq 0; then # Test "./configure && make && make check" with fallback crypto implementation. run_configure_make_check "--with-openssl=no"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi # Test "./configure && make && make check" with OpenSSL non-EVP implementation. run_configure_make_check "--enable-openssl-evp-cipher=no --enable-openssl-evp-md=no"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi # Test "./configure && make && make check" with OpenSSL EVP implementation. run_configure_make_check "--enable-openssl-evp-cipher=yes --enable-openssl-evp-md=yes"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi fi if test ${HAVE_ENABLE_PYTHON} -eq 0 && test -n "${PYTHON_CONFIG}"; then run_configure_make_check_python "--enable-python"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi PYTHON=`which python 2> /dev/null`; if test -f "setup.py" && ! run_setup_py_tests ${PYTHON}; then exit ${EXIT_FAILURE}; fi fi if test ${HAVE_ENABLE_STATIC_EXECUTABLES} -eq 0; then CONFIGURE_OPTIONS="--enable-static-executables --enable-multi-threading-support=no"; if test ${HAVE_WITH_BZIP2} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-bzip2=no"; fi if test ${HAVE_WITH_LIBFUSE} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-libfuse=no"; fi if test ${HAVE_WITH_LZMA} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-lzma=no"; fi if test ${HAVE_WITH_OPENSSL} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-openssl=no"; fi if test ${HAVE_WITH_ZLIB} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-zlib=no"; fi run_configure_make_check ${CONFIGURE_OPTIONS}; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi fi # Run tests with asan. CONFIGURE_OPTIONS=""; if test ${HAVE_ENABLE_WIDE_CHARACTER_TYPE} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-wide-character-type"; fi if test ${HAVE_WITH_BZIP2} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-bzip2=no"; fi if test ${HAVE_WITH_LZMA} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-lzma=no"; fi if test ${HAVE_WITH_OPENSSL} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-openssl=no"; fi if test ${HAVE_WITH_ZLIB} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-zlib=no"; fi if test ${HAVE_ENABLE_PYTHON} -eq 0 && test -n "${PYTHON_CONFIG}"; then # Issue with running the python bindings with asan disabled for now. # CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-python"; CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS}"; fi run_configure_make_check_with_asan ${CONFIGURE_OPTIONS}; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi # Run tests with coverage. CONFIGURE_OPTIONS="--enable-shared=no"; if test ${HAVE_ENABLE_WIDE_CHARACTER_TYPE} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-wide-character-type"; fi if test ${HAVE_WITH_BZIP2} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-bzip2=no"; fi if test ${HAVE_WITH_LZMA} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-lzma=no"; fi if test ${HAVE_WITH_OPENSSL} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-openssl=no"; fi if test ${HAVE_WITH_ZLIB} -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --with-zlib=no"; fi run_configure_make_check_with_coverage ${CONFIGURE_OPTIONS}; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then exit ${EXIT_FAILURE}; fi exit ${EXIT_SUCCESS}; ================================================ FILE: synclibs.ps1 ================================================ # Script that synchronizes the local library dependencies # # Version: 20180125 Param ( [switch]$UseHead = $false ) $GitUrlPrefix = "https://github.com/libyal" $LocalLibs = "libbfio libcdata libcerror libcfile libclocale libcnotify libcpath libcsplit libcthreads libfcache libfdata libfdatetime libfguid libfusn libfwnt libuna" $LocalLibs = ${LocalLibs} -split " " $Git = "git" $WinFlex = "..\win_flex_bison\win_flex.exe" $WinBison = "..\win_flex_bison\win_bison.exe" ForEach (${LocalLib} in ${LocalLibs}) { # Split will return an array of a single empty string when LocalLibs is empty. If (-Not (${LocalLib})) { Continue } $GitUrl = "${GitUrlPrefix}/${LocalLib}.git" # PowerShell will raise NativeCommandError if git writes to stdout or stderr # therefore 2>&1 is added and the output is stored in a variable. $Output = Invoke-Expression -Command "${Git} clone ${GitUrl} ${LocalLib}-${pid} 2>&1" Push-Location "${LocalLib}-${pid}" Try { $Output = Invoke-Expression -Command "${Git} fetch --quiet --all --tags --prune 2>&1" $LatestTag = Invoke-Expression -Command "${Git} describe --tags --abbrev=0 2>&1" If (${LatestTag} -and -not ${UseHead}) { Write-Host "Synchronizing: ${LocalLib} from ${GitUrl} tag ${LatestTag}" $Output = Invoke-Expression -Command "${Git} checkout --quiet tags/${LatestTag} 2>&1" } Else { Write-Host "Synchronizing: ${LocalLib} from ${GitUrl} HEAD" } } Finally { Pop-Location } If (Test-Path ${LocalLib}-${pid}) { $LocalLibVersion = Get-Content -Path ${LocalLib}-${pid}\configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } If (Test-Path ${LocalLib}) { Remove-Item -Path ${LocalLib} -Force -Recurse } New-Item -ItemType directory -Path ${LocalLib} -Force | Out-Null If (Test-Path ${LocalLib}) { Copy-Item -Path ${LocalLib}-${pid}\${LocalLib}\*.[chly] -Destination ${LocalLib}\ Get-Content -Path ${LocalLib}-${pid}\${LocalLib}\${LocalLib}_definitions.h.in | % { $_ -Replace "@VERSION@",${LocalLibVersion} } > ${LocalLib}\${LocalLib}_definitions.h } Remove-Item -Path ${LocalLib}-${pid} -Force -Recurse $NamePrefix = "" ForEach (${DirectoryElement} in Get-ChildItem -Path "${LocalLib}\*.l") { $OutputFile = ${DirectoryElement} -Replace ".l$",".c" $NamePrefix = Split-Path -path ${DirectoryElement} -leaf $NamePrefix = ${NamePrefix} -Replace "^${LocalLib}_","" $NamePrefix = ${NamePrefix} -Replace ".l$","_" # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr # therefore 2>&1 is added and the output is stored in a variable. $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" Write-Host ${Output} # Moving manually sicne win_flex -o does not provide the expected behavior. Move-Item "lex.yy.c" ${OutputFile} -force } ForEach (${DirectoryElement} in Get-ChildItem -Path "${LocalLib}\*.y") { $OutputFile = ${DirectoryElement} -Replace ".y$",".c" # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr # therefore 2>&1 is added and the output is stored in a variable. $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" Write-Host ${Output} } } } ================================================ FILE: synclibs.sh ================================================ #!/bin/sh # Script that synchronizes the local library dependencies # # Version: 20240414 EXIT_SUCCESS=0; EXIT_FAILURE=1; GIT_URL_PREFIX="https://github.com/libyal"; LOCAL_LIBS="libbfio libcdata libcerror libcfile libclocale libcnotify libcpath libcsplit libcthreads libfcache libfdata libfdatetime libfguid libfusn libfwnt libuna"; OLDIFS=$IFS; IFS=" "; for LOCAL_LIB in ${LOCAL_LIBS}; do GIT_URL="${GIT_URL_PREFIX}/${LOCAL_LIB}.git"; git clone --quiet ${GIT_URL} ${LOCAL_LIB}-$$; if ! test -d ${LOCAL_LIB}-$$; then echo "Unable to git clone: ${GIT_URL}"; IFS=$OLDIFS; exit ${EXIT_FAILURE}; fi (cd ${LOCAL_LIB}-$$ && git fetch --quiet --all --tags --prune) LATEST_TAG=`cd ${LOCAL_LIB}-$$ && git describe --tags --abbrev=0`; if test -n ${LATEST_TAG} && test "$1" != "--use-head"; then echo "Synchronizing: ${LOCAL_LIB} from ${GIT_URL} tag ${LATEST_TAG}"; (cd ${LOCAL_LIB}-$$ && git checkout --quiet tags/${LATEST_TAG}); else echo "Synchronizing: ${LOCAL_LIB} from ${GIT_URL} HEAD"; fi rm -rf ${LOCAL_LIB}; mkdir ${LOCAL_LIB}; if ! test -d ${LOCAL_LIB}; then echo "Missing directory: ${LOCAL_LIB}"; IFS=$OLDIFS; exit ${EXIT_FAILURE}; fi LOCAL_LIB_UPPER=`echo "${LOCAL_LIB}" | tr "[a-z]" "[A-Z]"`; # Note that sed on FreeBSD does not support \s hence that we use [[:space:]] instead. LOCAL_LIB_VERSION=`grep -A 2 AC_INIT ${LOCAL_LIB}-$$/configure.ac | tail -n 1 | sed 's/^[[:space:]]*\[\([0-9]*\)\],[[:space:]]*$/\1/'`; LOCAL_LIB_MAKEFILE_AM="${LOCAL_LIB}/Makefile.am"; cp ${LOCAL_LIB}-$$/${LOCAL_LIB}/*.[chly] ${LOCAL_LIB}; cp ${LOCAL_LIB}-$$/${LOCAL_LIB_MAKEFILE_AM} ${LOCAL_LIB_MAKEFILE_AM}; # Make the necessary changes to libyal/Makefile.am SED_SCRIPT="/AM_CPPFLAGS = / { i\\ if HAVE_LOCAL_${LOCAL_LIB_UPPER} } /lib_LTLIBRARIES = / { s/lib_LTLIBRARIES/noinst_LTLIBRARIES/ } /${LOCAL_LIB}\.c/ { d } /${LOCAL_LIB}_la_LIBADD/ { :loop1 /${LOCAL_LIB}_la_LDFLAGS/ { N i\\ endif d } /${LOCAL_LIB}_la_LDFLAGS/ !{ N b loop1 } } /${LOCAL_LIB}_la_LDFLAGS/ { N i\\ endif d } /DISTCLEANFILES = / { n /${LOCAL_LIB}_definitions.h/ { d } }"; echo "${SED_SCRIPT}" >> ${LOCAL_LIB}-$$.sed; sed -i'~' -f ${LOCAL_LIB}-$$.sed ${LOCAL_LIB_MAKEFILE_AM}; rm -f ${LOCAL_LIB}-$$.sed; sed -i'~' "/AM_CPPFLAGS = /,/noinst_LTLIBRARIES = / { N; s/\\\\\\n.@${LOCAL_LIB_UPPER}_DLL_EXPORT@//; P; D; }" ${LOCAL_LIB_MAKEFILE_AM}; sed -i'~' "/${LOCAL_LIB}_definitions.h.in/d" ${LOCAL_LIB_MAKEFILE_AM}; sed -i'~' "/${LOCAL_LIB}\\.rc/d" ${LOCAL_LIB_MAKEFILE_AM}; if test ${LOCAL_LIB} = "libfplist"; then # TODO: make this more generic to strip the last \\ sed -i'~' '/EXTRA_DIST = /,/^$/s/libfplist_xml_scanner.c \\/libfplist_xml_scanner.c/' ${LOCAL_LIB_MAKEFILE_AM}; elif test ${LOCAL_LIB} = "libodraw"; then # TODO: make this more generic to strip the last \\ sed -i'~' '/EXTRA_DIST = /,/^$/s/libodraw_cue_scanner.c \\/libodraw_cue_scanner.c/' ${LOCAL_LIB_MAKEFILE_AM}; else sed -i'~' '/EXTRA_DIST = /,/^$/d' ${LOCAL_LIB_MAKEFILE_AM}; fi SED_SCRIPT="/^$/ { x N /endif$/ { a\\ D } }"; echo "${SED_SCRIPT}" >> ${LOCAL_LIB}-$$.sed; sed -i'~' -f ${LOCAL_LIB}-$$.sed ${LOCAL_LIB_MAKEFILE_AM}; rm -f ${LOCAL_LIB}-$$.sed; # Make the necessary changes to libcfile/Makefile.am if test ${LOCAL_LIB} = "libcfile"; then if ! test -f "m4/libuna.m4"; then sed -i'~' 's?@LIBUNA_CPPFLAGS@?-I../libuna -I$(top_srcdir)/libuna?' ${LOCAL_LIB_MAKEFILE_AM}; fi fi # Make the necessary changes to libfplist/Makefile.am if test ${LOCAL_LIB} = "libfplist"; then if test -f "m4/libfdatetime.m4"; then sed -i'~' '/@LIBFGUID_CPPFLAGS@/{h; s/FGUID/FDATETIME/; p; g;}' ${LOCAL_LIB_MAKEFILE_AM}; fi fi # Make the necessary changes to libfvalue/Makefile.am if test ${LOCAL_LIB} = "libfvalue"; then if ! test -f "m4/libfdatetime.m4"; then sed -i'~' '/@LIBFDATETIME_CPPFLAGS@/d' ${LOCAL_LIB_MAKEFILE_AM}; fi if ! test -f "m4/libfguid.m4"; then sed -i'~' '/@LIBFGUID_CPPFLAGS@/d' ${LOCAL_LIB_MAKEFILE_AM}; fi if ! test -f "m4/libfwnt.m4"; then sed -i'~' '/@LIBFWNT_CPPFLAGS@/d' ${LOCAL_LIB_MAKEFILE_AM}; fi if ! test -f "m4/libuna.m4"; then sed -i'~' '/@LIBUNA_CPPFLAGS@/d' ${LOCAL_LIB_MAKEFILE_AM}; fi fi # Make the necessary changes to libsmraw/Makefile.am if test ${LOCAL_LIB} = "libsmraw"; then if test -f "m4/libfdatetime.m4"; then sed -i'~' '/@LIBFVALUE_CPPFLAGS@/{h; s/FVALUE/FDATETIME/; p; g;}' ${LOCAL_LIB_MAKEFILE_AM}; fi if test -f "m4/libfguid.m4"; then sed -i'~' '/@LIBFVALUE_CPPFLAGS@/{h; s/FVALUE/FGUID/; p; g;}' ${LOCAL_LIB_MAKEFILE_AM}; fi fi # Remove libyal/libyal.c rm -f ${LOCAL_LIB}/${LOCAL_LIB}.c; # Make the necessary changes to libyal/libyal_defitions.h cp ${LOCAL_LIB}-$$/${LOCAL_LIB}/${LOCAL_LIB}_definitions.h.in ${LOCAL_LIB}/${LOCAL_LIB}_definitions.h; sed -i'~' "s/@VERSION@/${LOCAL_LIB_VERSION}/" ${LOCAL_LIB}/${LOCAL_LIB}_definitions.h; rm -rf ${LOCAL_LIB}-$$; done IFS=$OLDIFS; exit ${EXIT_SUCCESS}; ================================================ FILE: tests/Makefile.am ================================================ AUTOMAKE_OPTIONS = subdir-objects AM_CPPFLAGS = \ -I../include -I$(top_srcdir)/include \ -I../common -I$(top_srcdir)/common \ @LIBCERROR_CPPFLAGS@ \ @LIBCTHREADS_CPPFLAGS@ \ @LIBCDATA_CPPFLAGS@ \ @LIBCLOCALE_CPPFLAGS@ \ @LIBCNOTIFY_CPPFLAGS@ \ @LIBCSPLIT_CPPFLAGS@ \ @LIBUNA_CPPFLAGS@ \ @LIBCFILE_CPPFLAGS@ \ @LIBCPATH_CPPFLAGS@ \ @LIBBFIO_CPPFLAGS@ \ @LIBFCACHE_CPPFLAGS@ \ @LIBFDATA_CPPFLAGS@ \ @LIBFDATETIME_CPPFLAGS@ \ @LIBFGUID_CPPFLAGS@ \ @LIBFWNT_CPPFLAGS@ \ @LIBFSREFS_DLL_IMPORT@ TESTS = \ test_library.sh \ test_tools.sh \ test_fsrefsinfo.sh check_SCRIPTS = \ test_fsrefsinfo.sh \ test_library.sh \ test_runner.sh \ test_tools.sh EXTRA_DIST = \ $(check_SCRIPTS) check_PROGRAMS = \ fsrefs_test_attribute_values \ fsrefs_test_block_descriptor \ fsrefs_test_block_reference \ fsrefs_test_block_tree \ fsrefs_test_block_tree_node \ fsrefs_test_checkpoint \ fsrefs_test_data_run \ fsrefs_test_directory_entry \ fsrefs_test_directory_object \ fsrefs_test_error \ fsrefs_test_file_entry \ fsrefs_test_file_system \ fsrefs_test_io_handle \ fsrefs_test_metadata_block_header \ fsrefs_test_ministore_node \ fsrefs_test_node_header \ fsrefs_test_node_record \ fsrefs_test_notify \ fsrefs_test_objects_tree \ fsrefs_test_superblock \ fsrefs_test_support \ fsrefs_test_tools_info_handle \ fsrefs_test_tools_output \ fsrefs_test_tools_signal \ fsrefs_test_tree_header \ fsrefs_test_volume \ fsrefs_test_volume_header fsrefs_test_attribute_values_SOURCES = \ fsrefs_test_attribute_values.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_attribute_values_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_block_descriptor_SOURCES = \ fsrefs_test_block_descriptor.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_block_descriptor_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_block_reference_SOURCES = \ fsrefs_test_block_reference.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_block_reference_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_block_tree_SOURCES = \ fsrefs_test_block_tree.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_block_tree_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_block_tree_node_SOURCES = \ fsrefs_test_block_tree_node.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_block_tree_node_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_checkpoint_SOURCES = \ fsrefs_test_checkpoint.c \ fsrefs_test_functions.c fsrefs_test_functions.h \ fsrefs_test_libbfio.h \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_checkpoint_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_data_run_SOURCES = \ fsrefs_test_data_run.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_data_run_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_directory_entry_SOURCES = \ fsrefs_test_directory_entry.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_directory_entry_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_directory_object_SOURCES = \ fsrefs_test_directory_object.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_directory_object_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_error_SOURCES = \ fsrefs_test_error.c \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_unused.h fsrefs_test_error_LDADD = \ ../libfsrefs/libfsrefs.la fsrefs_test_file_entry_SOURCES = \ fsrefs_test_file_entry.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_file_entry_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ \ @PTHREAD_LIBADD@ fsrefs_test_file_system_SOURCES = \ fsrefs_test_file_system.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_file_system_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_io_handle_SOURCES = \ fsrefs_test_io_handle.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_io_handle_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_metadata_block_header_SOURCES = \ fsrefs_test_functions.c fsrefs_test_functions.h \ fsrefs_test_libbfio.h \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_metadata_block_header.c \ fsrefs_test_unused.h fsrefs_test_metadata_block_header_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_ministore_node_SOURCES = \ fsrefs_test_functions.c fsrefs_test_functions.h \ fsrefs_test_libbfio.h \ fsrefs_test_ministore_node.c \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h fsrefs_test_ministore_node_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_node_header_SOURCES = \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_node_header.c \ fsrefs_test_unused.h fsrefs_test_node_header_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_node_record_SOURCES = \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_node_record.c \ fsrefs_test_unused.h fsrefs_test_node_record_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_notify_SOURCES = \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_notify.c \ fsrefs_test_unused.h fsrefs_test_notify_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_objects_tree_SOURCES = \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_objects_tree.c \ fsrefs_test_unused.h fsrefs_test_objects_tree_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_superblock_SOURCES = \ fsrefs_test_functions.c fsrefs_test_functions.h \ fsrefs_test_libbfio.h \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_superblock.c \ fsrefs_test_unused.h fsrefs_test_superblock_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_support_SOURCES = \ fsrefs_test_functions.c fsrefs_test_functions.h \ fsrefs_test_getopt.c fsrefs_test_getopt.h \ fsrefs_test_libbfio.h \ fsrefs_test_libcerror.h \ fsrefs_test_libclocale.h \ fsrefs_test_libcnotify.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_libuna.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_support.c \ fsrefs_test_unused.h fsrefs_test_support_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_tools_info_handle_SOURCES = \ ../fsrefstools/info_handle.c ../fsrefstools/info_handle.h \ fsrefs_test_libcerror.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_tools_info_handle.c \ fsrefs_test_unused.h fsrefs_test_tools_info_handle_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_tools_output_SOURCES = \ ../fsrefstools/fsrefstools_output.c ../fsrefstools/fsrefstools_output.h \ fsrefs_test_libcerror.h \ fsrefs_test_macros.h \ fsrefs_test_tools_output.c \ fsrefs_test_unused.h fsrefs_test_tools_output_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_tools_signal_SOURCES = \ ../fsrefstools/fsrefstools_signal.c ../fsrefstools/fsrefstools_signal.h \ fsrefs_test_libcerror.h \ fsrefs_test_macros.h \ fsrefs_test_tools_signal.c \ fsrefs_test_unused.h fsrefs_test_tools_signal_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_tree_header_SOURCES = \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_tree_header.c \ fsrefs_test_unused.h fsrefs_test_tree_header_LDADD = \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ fsrefs_test_volume_SOURCES = \ fsrefs_test_functions.c fsrefs_test_functions.h \ fsrefs_test_getopt.c fsrefs_test_getopt.h \ fsrefs_test_libbfio.h \ fsrefs_test_libcerror.h \ fsrefs_test_libclocale.h \ fsrefs_test_libcnotify.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_libuna.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h \ fsrefs_test_volume.c fsrefs_test_volume_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCTHREADS_LIBADD@ \ @LIBCERROR_LIBADD@ \ @PTHREAD_LIBADD@ fsrefs_test_volume_header_SOURCES = \ fsrefs_test_functions.c fsrefs_test_functions.h \ fsrefs_test_libbfio.h \ fsrefs_test_libcerror.h \ fsrefs_test_libfsrefs.h \ fsrefs_test_macros.h \ fsrefs_test_memory.c fsrefs_test_memory.h \ fsrefs_test_unused.h \ fsrefs_test_volume_header.c fsrefs_test_volume_header_LDADD = \ @LIBBFIO_LIBADD@ \ @LIBCPATH_LIBADD@ \ @LIBCFILE_LIBADD@ \ @LIBUNA_LIBADD@ \ @LIBCSPLIT_LIBADD@ \ @LIBCNOTIFY_LIBADD@ \ @LIBCLOCALE_LIBADD@ \ @LIBCDATA_LIBADD@ \ ../libfsrefs/libfsrefs.la \ @LIBCERROR_LIBADD@ DISTCLEANFILES = \ Makefile \ Makefile.in \ notify_stream.log ================================================ FILE: tests/build.sh ================================================ #!/bin/sh # Script to build from source # # Version: 20201121 set -e ./synclibs.sh --use-head ./autogen.sh ./configure "$@" make > /dev/null ================================================ FILE: tests/fsrefs_test_attribute_values.c ================================================ /* * Library attribute_values type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_attribute_values.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_attribute_values_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_attribute_values_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_attribute_values_t *attribute_values = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 2; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_attribute_values_initialize( &attribute_values, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "attribute_values", attribute_values ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_attribute_values_free( &attribute_values, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "attribute_values", attribute_values ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_attribute_values_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); attribute_values = (libfsrefs_attribute_values_t *) 0x12345678UL; result = libfsrefs_attribute_values_initialize( &attribute_values, &error ); attribute_values = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_attribute_values_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_attribute_values_initialize( &attribute_values, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( attribute_values != NULL ) { libfsrefs_attribute_values_free( &attribute_values, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "attribute_values", attribute_values ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_attribute_values_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_attribute_values_initialize( &attribute_values, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( attribute_values != NULL ) { libfsrefs_attribute_values_free( &attribute_values, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "attribute_values", attribute_values ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( attribute_values != NULL ) { libfsrefs_attribute_values_free( &attribute_values, NULL ); } return( 0 ); } /* Tests the libfsrefs_attribute_values_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_attribute_values_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_attribute_values_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_attribute_values_initialize", fsrefs_test_attribute_values_initialize ); FSREFS_TEST_RUN( "libfsrefs_attribute_values_free", fsrefs_test_attribute_values_free ); /* TODO add tests for libfsrefs_attribute_values_read_non_resident */ /* TODO add tests for libfsrefs_attribute_values_read_resident */ /* TODO add tests for libfsrefs_attribute_values_read_node_record */ /* TODO add tests for libfsrefs_attribute_values_get_utf8_name_size */ /* TODO add tests for libfsrefs_attribute_values_get_utf8_name */ /* TODO add tests for libfsrefs_attribute_values_get_utf16_name_size */ /* TODO add tests for libfsrefs_attribute_values_get_utf16_name */ #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_block_descriptor.c ================================================ /* * Library block_descriptor type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_block_descriptor.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_block_descriptor_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_descriptor_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_block_descriptor_t *block_descriptor = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_block_descriptor_initialize( &block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_descriptor", block_descriptor ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_block_descriptor_free( &block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_descriptor", block_descriptor ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_block_descriptor_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); block_descriptor = (libfsrefs_block_descriptor_t *) 0x12345678UL; result = libfsrefs_block_descriptor_initialize( &block_descriptor, &error ); block_descriptor = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_block_descriptor_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_block_descriptor_initialize( &block_descriptor, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( block_descriptor != NULL ) { libfsrefs_block_descriptor_free( &block_descriptor, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_descriptor", block_descriptor ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_block_descriptor_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_block_descriptor_initialize( &block_descriptor, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( block_descriptor != NULL ) { libfsrefs_block_descriptor_free( &block_descriptor, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_descriptor", block_descriptor ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( block_descriptor != NULL ) { libfsrefs_block_descriptor_free( &block_descriptor, NULL ); } return( 0 ); } /* Tests the libfsrefs_block_descriptor_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_descriptor_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_block_descriptor_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_block_descriptor_initialize", fsrefs_test_block_descriptor_initialize ); FSREFS_TEST_RUN( "libfsrefs_block_descriptor_free", fsrefs_test_block_descriptor_free ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_block_reference.c ================================================ /* * Library block_reference type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_block_reference.h" #include "../libfsrefs/libfsrefs_io_handle.h" uint8_t fsrefs_test_block_reference_data1[ 24 ] = { 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x5d, 0x5f, 0xe6, 0x46, 0x0a, 0xde, 0xe1, 0xc4 }; uint8_t fsrefs_test_block_reference_data2[ 44 ] = { 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x04, 0x00, 0x00, 0x00, 0xe2, 0xfb, 0xbe, 0x68 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_block_reference_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_reference_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_block_reference_t *block_reference = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_block_reference_initialize( &block_reference, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_reference", block_reference ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_block_reference_free( &block_reference, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_reference", block_reference ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_block_reference_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); block_reference = (libfsrefs_block_reference_t *) 0x12345678UL; result = libfsrefs_block_reference_initialize( &block_reference, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); block_reference = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_block_reference_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_block_reference_initialize( &block_reference, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( block_reference != NULL ) { libfsrefs_block_reference_free( &block_reference, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_reference", block_reference ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_block_reference_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_block_reference_initialize( &block_reference, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( block_reference != NULL ) { libfsrefs_block_reference_free( &block_reference, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_reference", block_reference ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( block_reference != NULL ) { libfsrefs_block_reference_free( &block_reference, NULL ); } return( 0 ); } /* Tests the libfsrefs_block_reference_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_reference_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_block_reference_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_block_reference_read_data function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_reference_read_data( void ) { libcerror_error_t *error = NULL; libfsrefs_block_reference_t *block_reference = NULL; libfsrefs_io_handle_t *io_handle = NULL; int result = 0; /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; result = libfsrefs_block_reference_initialize( &block_reference, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_reference", block_reference ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_block_reference_read_data( block_reference, io_handle, fsrefs_test_block_reference_data1, 24, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_block_reference_read_data( NULL, io_handle, fsrefs_test_block_reference_data1, 24, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_reference_read_data( block_reference, NULL, fsrefs_test_block_reference_data1, 24, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_reference_read_data( block_reference, io_handle, NULL, 24, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_reference_read_data( block_reference, io_handle, fsrefs_test_block_reference_data1, (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_reference_read_data( block_reference, io_handle, fsrefs_test_block_reference_data1, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: Test error case where data is invalid */ /* Clean up */ result = libfsrefs_block_reference_free( &block_reference, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_reference", block_reference ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 4096; io_handle->major_format_version = 3; result = libfsrefs_block_reference_initialize( &block_reference, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_reference", block_reference ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_block_reference_read_data( block_reference, io_handle, fsrefs_test_block_reference_data2, 44, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up */ result = libfsrefs_block_reference_free( &block_reference, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_reference", block_reference ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( block_reference != NULL ) { libfsrefs_block_reference_free( &block_reference, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_block_reference_initialize", fsrefs_test_block_reference_initialize ); FSREFS_TEST_RUN( "libfsrefs_block_reference_free", fsrefs_test_block_reference_free ); FSREFS_TEST_RUN( "libfsrefs_block_reference_read_data", fsrefs_test_block_reference_read_data ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_block_tree.c ================================================ /* * Library block_tree functions testing program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_block_descriptor.h" #include "../libfsrefs/libfsrefs_block_tree.h" #include "../libfsrefs/libfsrefs_block_tree_node.h" #include "../libfsrefs/libfsrefs_definitions.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_block_tree_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_tree_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_block_tree_t *block_tree = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 2; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test block_tree initialization */ result = libfsrefs_block_tree_initialize( &block_tree, 0x800000000UL, 0x4000, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_tree", block_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_block_tree_free( &block_tree, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_tree", block_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_block_tree_initialize( NULL, 0x800000000UL, 0x4000, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); block_tree = (libfsrefs_block_tree_t *) 0x12345678UL; result = libfsrefs_block_tree_initialize( &block_tree, 0x800000000UL, 0x4000, &error ); block_tree = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_block_tree_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_block_tree_initialize( &block_tree, 0x800000000UL, 0x4000, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( block_tree != NULL ) { libfsrefs_block_tree_free( &block_tree, NULL, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_tree", block_tree ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_block_tree_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_block_tree_initialize( &block_tree, 0x800000000UL, 0x4000, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( block_tree != NULL ) { libfsrefs_block_tree_free( &block_tree, NULL, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_tree", block_tree ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( block_tree != NULL ) { libfsrefs_block_tree_free( &block_tree, NULL, NULL ); } return( 0 ); } /* Tests the libfsrefs_block_tree_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_tree_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_block_tree_free( NULL, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_block_tree_get_block_descriptor_by_offset function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_tree_get_block_descriptor_by_offset( void ) { libcerror_error_t *error = NULL; libfsrefs_block_descriptor_t *block_descriptor = NULL; libfsrefs_block_tree_t *block_tree = NULL; off64_t block_offset = 0; int result = 0; /* Initialize test */ result = libfsrefs_block_tree_initialize( &block_tree, 0x800000000UL, 0x4000, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_tree", block_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_block_tree_get_block_descriptor_by_offset( block_tree, 0, &block_descriptor, &block_offset, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "block_descriptor", block_descriptor ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_block_tree_get_block_descriptor_by_offset( NULL, 0, &block_descriptor, &block_offset, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_tree_get_block_descriptor_by_offset( block_tree, 0, NULL, &block_offset, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_tree_get_block_descriptor_by_offset( block_tree, 0, &block_descriptor, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up */ result = libfsrefs_block_tree_free( &block_tree, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_tree", block_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( block_tree != NULL ) { libfsrefs_block_tree_free( &block_tree, NULL, NULL ); } return( 0 ); } /* Tests the libfsrefs_block_tree_insert_block_descriptor_by_offset function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_tree_insert_block_descriptor_by_offset( void ) { libcerror_error_t *error = NULL; libfsrefs_block_descriptor_t *block_descriptor = NULL; libfsrefs_block_descriptor_t *existing_block_descriptor = NULL; libfsrefs_block_tree_t *block_tree = NULL; libfsrefs_block_tree_node_t *leaf_block_tree_node = NULL; int leaf_value_index = 0; int result = 0; /* Initialize test */ result = libfsrefs_block_tree_initialize( &block_tree, 0x800000000UL, 0x4000, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_tree", block_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_block_descriptor_initialize( &block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_descriptor", block_descriptor ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_block_tree_insert_block_descriptor_by_offset( block_tree, 0, block_descriptor, &leaf_value_index, &leaf_block_tree_node, &existing_block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_EQUAL_INT( "leaf_value_index", leaf_value_index, 0 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "leaf_block_tree_node", leaf_block_tree_node ); FSREFS_TEST_ASSERT_IS_NULL( "existing_block_descriptor", existing_block_descriptor ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_block_tree_insert_block_descriptor_by_offset( block_tree, 0, NULL, &leaf_value_index, &leaf_block_tree_node, &existing_block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_EQUAL_INT( "leaf_value_index", leaf_value_index, 0 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "leaf_block_tree_node", leaf_block_tree_node ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "existing_block_descriptor", existing_block_descriptor ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_block_tree_insert_block_descriptor_by_offset( NULL, 0, block_descriptor, &leaf_value_index, &leaf_block_tree_node, &existing_block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_tree_insert_block_descriptor_by_offset( block_tree, 0, block_descriptor, NULL, &leaf_block_tree_node, &existing_block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_tree_insert_block_descriptor_by_offset( block_tree, 0, block_descriptor, &leaf_value_index, NULL, &existing_block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_block_tree_insert_block_descriptor_by_offset( block_tree, 0, block_descriptor, &leaf_value_index, &leaf_block_tree_node, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up */ result = libfsrefs_block_descriptor_free( &block_descriptor, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_descriptor", block_descriptor ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_block_tree_free( &block_tree, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_tree", block_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( block_descriptor != NULL ) { libfsrefs_block_descriptor_free( &block_descriptor, NULL ); } if( block_tree != NULL ) { libfsrefs_block_tree_free( &block_tree, NULL, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_block_tree_initialize", fsrefs_test_block_tree_initialize ); FSREFS_TEST_RUN( "libfsrefs_block_tree_free", fsrefs_test_block_tree_free ); FSREFS_TEST_RUN( "libfsrefs_block_tree_get_block_descriptor_by_offset", fsrefs_test_block_tree_get_block_descriptor_by_offset ); FSREFS_TEST_RUN( "libfsrefs_block_tree_insert_block_descriptor_by_offset", fsrefs_test_block_tree_insert_block_descriptor_by_offset ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_block_tree_node.c ================================================ /* * Library block_tree_node type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_block_tree_node.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_block_tree_node_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_tree_node_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_block_tree_node_t *block_tree_node = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test block_tree_node initialization */ result = libfsrefs_block_tree_node_initialize( &block_tree_node, 0, 1024, 256, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "block_tree_node", block_tree_node ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_block_tree_node_free( &block_tree_node, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_tree_node", block_tree_node ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_block_tree_node_initialize( NULL, 0, 1024, 256, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); block_tree_node = (libfsrefs_block_tree_node_t *) 0x12345678UL; result = libfsrefs_block_tree_node_initialize( &block_tree_node, 0, 1024, 256, &error ); block_tree_node = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_block_tree_node_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_block_tree_node_initialize( &block_tree_node, 0, 1024, 256, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( block_tree_node != NULL ) { libfsrefs_block_tree_node_free( &block_tree_node, NULL, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_tree_node", block_tree_node ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_block_tree_node_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_block_tree_node_initialize( &block_tree_node, 0, 1024, 256, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( block_tree_node != NULL ) { libfsrefs_block_tree_node_free( &block_tree_node, NULL, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "block_tree_node", block_tree_node ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( block_tree_node != NULL ) { libfsrefs_block_tree_node_free( &block_tree_node, NULL, NULL ); } return( 0 ); } /* Tests the libfsrefs_block_tree_node_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_block_tree_node_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_block_tree_node_free( NULL, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_block_tree_node_initialize", fsrefs_test_block_tree_node_initialize ); FSREFS_TEST_RUN( "libfsrefs_block_tree_node_free", fsrefs_test_block_tree_node_free ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_checkpoint.c ================================================ /* * Library checkpoint type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_functions.h" #include "fsrefs_test_libbfio.h" #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_checkpoint.h" #include "../libfsrefs/libfsrefs_io_handle.h" uint8_t fsrefs_test_checkpoint_data1[ 16384 ] = { 0x86, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x80, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x21, 0xb4, 0x9b, 0xf3, 0x0e, 0x30, 0x1b, 0x04, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x08, 0x82, 0x59, 0x6f, 0xe8, 0x40, 0x91, 0x5c, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x04, 0x58, 0xd4, 0x81, 0xfc, 0x0a, 0x62, 0x63, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0xd4, 0x30, 0x83, 0x51, 0x87, 0xc2, 0xa6, 0x0a, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0xe0, 0x23, 0x95, 0xa9, 0xb7, 0x25, 0x6b, 0x91, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0xf8, 0xa6, 0x9f, 0x06, 0xcc, 0xe8, 0xb8, 0x9e, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x8e, 0x12, 0xdc, 0x1a, 0x4c, 0x39, 0x1a, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t fsrefs_test_checkpoint_data2[ 4096 ] = { 0x43, 0x48, 0x4b, 0x50, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0xa7, 0xe0, 0x68, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x38, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0xd8, 0x02, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x78, 0x04, 0x00, 0x00, 0xe0, 0x04, 0x00, 0x00, 0x48, 0x05, 0x00, 0x00, 0xb0, 0x05, 0x00, 0x00, 0x18, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x04, 0x00, 0x00, 0x00, 0x90, 0xd2, 0xb8, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb3, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x39, 0xd3, 0x02, 0xec, 0xb0, 0x7f, 0x11, 0x95, 0x50, 0xb7, 0x6f, 0x52, 0x84, 0xe5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x5b, 0xea, 0xb6, 0x64, 0xc8, 0xf1, 0x1f, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x07, 0x84, 0x26, 0xf2, 0x04, 0x48, 0x97, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa9, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x5d, 0xd1, 0xc6, 0xb2, 0x3d, 0x32, 0x04, 0xe0, 0x19, 0x00, 0x0c, 0x04, 0x46, 0x4d, 0x73, 0x6c, 0x14, 0x19, 0x58, 0x16, 0xae, 0x11, 0xc2, 0x0c, 0x10, 0xf0, 0x38, 0x52, 0x84, 0xe5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x90, 0x75, 0x50, 0x84, 0xe5, 0xff, 0xff, 0x50, 0x31, 0x99, 0x1c, 0x82, 0xce, 0xff, 0xff, 0x22, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x76, 0xaa, 0xec, 0x05, 0xaa, 0xfb, 0x89, 0xfb, 0x19, 0x00, 0x0c, 0x04, 0x46, 0x4d, 0x73, 0x6c, 0x14, 0x39, 0x50, 0x16, 0xae, 0x11, 0xc2, 0x0c, 0xd0, 0x2c, 0x70, 0x52, 0x84, 0xe5, 0xff, 0xff, 0x22, 0x79, 0x65, 0x73, 0x22, 0x3f, 0x3e, 0x0d, 0x0a, 0x3c, 0x61, 0x73, 0x73, 0x65, 0x6d, 0x62, 0x10, 0x90, 0x75, 0x50, 0x84, 0xe5, 0xff, 0xff, 0x70, 0x0b, 0x8f, 0x1a, 0x82, 0xce, 0xff, 0xff, 0x62, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x74, 0x6a, 0x7e, 0x96, 0x91, 0xd1, 0x55, 0xc4, 0x19, 0x00, 0x3c, 0x04, 0x46, 0x4d, 0x73, 0x6c, 0xc4, 0x74, 0x5e, 0x16, 0xae, 0x11, 0xc2, 0x0c, 0x90, 0x34, 0x71, 0x52, 0x84, 0xe5, 0xff, 0xff, 0x30, 0xe6, 0x73, 0x86, 0x01, 0xf8, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x90, 0x75, 0x50, 0x84, 0xe5, 0xff, 0xff, 0x10, 0x19, 0x9f, 0x1c, 0x82, 0xce, 0xff, 0xff, 0x74, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x95, 0xda, 0xc1, 0x30, 0xc1, 0x7f, 0x86, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x9d, 0x3c, 0x04, 0x72, 0x60, 0x56, 0xba, 0xc9, 0x20, 0xbd, 0x31, 0x66, 0x63, 0xd1, 0xb1, 0xf6, 0x39, 0x23, 0x78, 0xa0, 0xf4, 0x6f, 0x1a, 0xb2, 0xef, 0x6e, 0x22, 0x5f, 0x6c, 0x71, 0xd2, 0xe5, 0x1e, 0xfb, 0x61, 0xb8, 0x1c, 0x0b, 0xc6, 0xe0, 0xb2, 0x56, 0x59, 0x63, 0xad, 0x4f, 0x41, 0x79, 0x07, 0x91, 0x12, 0xe3, 0x85, 0xb6, 0xb3, 0x04, 0x90, 0x75, 0x84, 0xcf, 0xd7, 0x3c, 0x96, 0xe4, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0xc3, 0x0b, 0x89, 0x73, 0x97, 0x1a, 0x2d, 0x67, 0x67, 0xec, 0xcc, 0x95, 0x42, 0xe3, 0x21, 0xc2, 0x75, 0xb7, 0x45, 0xac, 0x4b, 0xa7, 0xab, 0xf4, 0xc2, 0x4c, 0x04, 0x71, 0x8e, 0x83, 0x22, 0xcb, 0x93, 0xa1, 0x98, 0x83, 0x85, 0xb4, 0x9b, 0xe2, 0x1b, 0x0a, 0xb1, 0x35, 0x57, 0x0a, 0x90, 0x32, 0xc6, 0xd4, 0xd4, 0x97, 0x75, 0x14, 0xca, 0xde, 0xa5, 0x00, 0x11, 0x0b, 0x54, 0xf2, 0xe7, 0x2c, 0xaa, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xab, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x8c, 0xb2, 0x03, 0x5f, 0x4b, 0xef, 0x0d, 0x35, 0x48, 0xe6, 0x65, 0x52, 0x84, 0xe5, 0xff, 0xff, 0x58, 0xe6, 0x65, 0x52, 0x84, 0xe5, 0xff, 0xff, 0x58, 0xe6, 0x65, 0x52, 0x84, 0xe5, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x97, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x32, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x3d, 0x20, 0x34, 0x8f, 0x14, 0xa3, 0xbd, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7a, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x28, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x7c, 0x28, 0x2d, 0x3c, 0xd7, 0x27, 0xc1, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x33, 0x78, 0x43, 0x14, 0x81, 0xcd, 0x30, 0x36, 0xa9, 0xb5, 0x06, 0x87, 0xfc, 0xde, 0x92, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00, 0x20, 0x00, 0x64, 0x00, 0x61, 0x00, 0x74, 0x00, 0x61, 0x00, 0x20, 0x00, 0x70, 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x69, 0x00, 0x74, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_checkpoint_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_checkpoint_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_checkpoint_t *checkpoint = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_checkpoint_free( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_checkpoint_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); checkpoint = (libfsrefs_checkpoint_t *) 0x12345678UL; result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); checkpoint = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_checkpoint_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( checkpoint != NULL ) { libfsrefs_checkpoint_free( &checkpoint, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_checkpoint_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( checkpoint != NULL ) { libfsrefs_checkpoint_free( &checkpoint, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( checkpoint != NULL ) { libfsrefs_checkpoint_free( &checkpoint, NULL ); } return( 0 ); } /* Tests the libfsrefs_checkpoint_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_checkpoint_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_checkpoint_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_checkpoint_read_data function * Returns 1 if successful or 0 if not */ int fsrefs_test_checkpoint_read_data( void ) { libcerror_error_t *error = NULL; libfsrefs_checkpoint_t *checkpoint = NULL; libfsrefs_io_handle_t *io_handle = NULL; int result = 0; /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_checkpoint_read_data( checkpoint, io_handle, &( fsrefs_test_checkpoint_data1[ 48 ] ), 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_checkpoint_read_data( NULL, io_handle, &( fsrefs_test_checkpoint_data1[ 48 ] ), 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_checkpoint_read_data( checkpoint, NULL, &( fsrefs_test_checkpoint_data1[ 48 ] ), 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_checkpoint_read_data( checkpoint, io_handle, NULL, 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_checkpoint_read_data( checkpoint, io_handle, &( fsrefs_test_checkpoint_data1[ 48 ] ), (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_checkpoint_read_data( checkpoint, io_handle, &( fsrefs_test_checkpoint_data1[ 48 ] ), 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: Test error case where data is invalid */ /* Clean up */ result = libfsrefs_checkpoint_free( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 4096; io_handle->major_format_version = 3; result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_checkpoint_read_data( checkpoint, io_handle, &( fsrefs_test_checkpoint_data2[ 80 ] ), 4096 - 80, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up */ result = libfsrefs_checkpoint_free( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( checkpoint != NULL ) { libfsrefs_checkpoint_free( &checkpoint, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } /* Tests the libfsrefs_checkpoint_read_file_io_handle function * Returns 1 if successful or 0 if not */ int fsrefs_test_checkpoint_read_file_io_handle( void ) { libbfio_handle_t *file_io_handle = NULL; libcerror_error_t *error = NULL; libfsrefs_checkpoint_t *checkpoint = NULL; libfsrefs_io_handle_t *io_handle = NULL; int result = 0; /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize file IO handle */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_checkpoint_data1, 16384, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_checkpoint_read_file_io_handle( checkpoint, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_checkpoint_read_file_io_handle( NULL, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_checkpoint_read_file_io_handle( checkpoint, NULL, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_checkpoint_read_file_io_handle( checkpoint, io_handle, NULL, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_checkpoint_read_file_io_handle( checkpoint, io_handle, file_io_handle, -1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up file IO handle */ result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test data too small */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_checkpoint_data1, 8, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_checkpoint_read_file_io_handle( checkpoint, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test data invalid */ /* TODO */ /* Clean up */ result = libfsrefs_checkpoint_free( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 4096; io_handle->major_format_version = 3; FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize file IO handle */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_checkpoint_data2, 4096, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_checkpoint_read_file_io_handle( checkpoint, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up file IO handle */ result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up */ result = libfsrefs_checkpoint_free( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } if( checkpoint != NULL ) { libfsrefs_checkpoint_free( &checkpoint, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } /* Tests the libfsrefs_checkpoint_get_number_of_ministore_tree_block_references function * Returns 1 if successful or 0 if not */ int fsrefs_test_checkpoint_get_number_of_ministore_tree_block_references( libfsrefs_checkpoint_t *checkpoint ) { libcerror_error_t *error = NULL; int number_of_ministore_tree_block_references = 0; int result = 0; /* Test regular cases */ result = libfsrefs_checkpoint_get_number_of_ministore_tree_block_references( checkpoint, &number_of_ministore_tree_block_references, &error ); FSREFS_TEST_ASSERT_NOT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_checkpoint_get_number_of_ministore_tree_block_references( NULL, &number_of_ministore_tree_block_references, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_checkpoint_get_number_of_ministore_tree_block_references( checkpoint, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) libcerror_error_t *error = NULL; libfsrefs_checkpoint_t *checkpoint = NULL; libfsrefs_io_handle_t *io_handle = NULL; int result = 0; #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_checkpoint_initialize", fsrefs_test_checkpoint_initialize ); FSREFS_TEST_RUN( "libfsrefs_checkpoint_free", fsrefs_test_checkpoint_free ); FSREFS_TEST_RUN( "libfsrefs_checkpoint_read_data", fsrefs_test_checkpoint_read_data ); FSREFS_TEST_RUN( "libfsrefs_checkpoint_read_file_io_handle", fsrefs_test_checkpoint_read_file_io_handle ); #if !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; result = libfsrefs_checkpoint_initialize( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_checkpoint_read_data( checkpoint, io_handle, &( fsrefs_test_checkpoint_data1[ 48 ] ), 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Run tests */ FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_checkpoint_get_number_of_ministore_tree_block_references", fsrefs_test_checkpoint_get_number_of_ministore_tree_block_references, checkpoint ); /* TODO: add tests for libfsrefs_checkpoint_get_ministore_tree_block_referenceby_index */ /* Clean up */ result = libfsrefs_checkpoint_free( &checkpoint, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "checkpoint", checkpoint ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); #endif /* !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) */ #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); on_error: #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) if( error != NULL ) { libcerror_error_free( &error ); } if( checkpoint != NULL ) { libfsrefs_checkpoint_free( &checkpoint, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_data_run.c ================================================ /* * Library data_run type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_data_run.h" #include "../libfsrefs/libfsrefs_io_handle.h" uint8_t fsrefs_test_data_run_data1[ 32 ] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_data_run_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_data_run_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_data_run_t *data_run = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_data_run_initialize( &data_run, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "data_run", data_run ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_data_run_free( &data_run, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "data_run", data_run ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_data_run_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); data_run = (libfsrefs_data_run_t *) 0x12345678UL; result = libfsrefs_data_run_initialize( &data_run, &error ); data_run = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_data_run_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_data_run_initialize( &data_run, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( data_run != NULL ) { libfsrefs_data_run_free( &data_run, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "data_run", data_run ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_data_run_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_data_run_initialize( &data_run, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( data_run != NULL ) { libfsrefs_data_run_free( &data_run, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "data_run", data_run ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( data_run != NULL ) { libfsrefs_data_run_free( &data_run, NULL ); } return( 0 ); } /* Tests the libfsrefs_data_run_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_data_run_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_data_run_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_data_run_read_data function * Returns 1 if successful or 0 if not */ int fsrefs_test_data_run_read_data( void ) { libcerror_error_t *error = NULL; libfsrefs_data_run_t *data_run = NULL; libfsrefs_io_handle_t *io_handle = NULL; int result = 0; /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; result = libfsrefs_data_run_initialize( &data_run, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "data_run", data_run ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_data_run_read_data( data_run, io_handle, fsrefs_test_data_run_data1, 32, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_data_run_read_data( NULL, io_handle, fsrefs_test_data_run_data1, 32, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_data_run_read_data( data_run, NULL, fsrefs_test_data_run_data1, 32, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_data_run_read_data( data_run, io_handle, NULL, 32, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_data_run_read_data( data_run, io_handle, fsrefs_test_data_run_data1, (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_data_run_read_data( data_run, io_handle, fsrefs_test_data_run_data1, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: Test error case where data is invalid */ /* Clean up */ result = libfsrefs_data_run_free( &data_run, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "data_run", data_run ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( data_run != NULL ) { libfsrefs_data_run_free( &data_run, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_data_run_initialize", fsrefs_test_data_run_initialize ); FSREFS_TEST_RUN( "libfsrefs_data_run_free", fsrefs_test_data_run_free ); FSREFS_TEST_RUN( "libfsrefs_data_run_read_data", fsrefs_test_data_run_read_data ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_directory_entry.c ================================================ /* * Library directory_entry type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_directory_entry.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_directory_entry_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_directory_entry_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_directory_entry_t *directory_entry = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_directory_entry_initialize( &directory_entry, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "directory_entry", directory_entry ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_directory_entry_free( &directory_entry, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "directory_entry", directory_entry ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_directory_entry_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); directory_entry = (libfsrefs_directory_entry_t *) 0x12345678UL; result = libfsrefs_directory_entry_initialize( &directory_entry, &error ); directory_entry = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_directory_entry_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_directory_entry_initialize( &directory_entry, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( directory_entry != NULL ) { libfsrefs_directory_entry_free( &directory_entry, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "directory_entry", directory_entry ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_directory_entry_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_directory_entry_initialize( &directory_entry, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( directory_entry != NULL ) { libfsrefs_directory_entry_free( &directory_entry, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "directory_entry", directory_entry ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( directory_entry != NULL ) { libfsrefs_directory_entry_free( &directory_entry, NULL ); } return( 0 ); } /* Tests the libfsrefs_directory_entry_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_directory_entry_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_directory_entry_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_directory_entry_initialize", fsrefs_test_directory_entry_initialize ); FSREFS_TEST_RUN( "libfsrefs_directory_entry_free", fsrefs_test_directory_entry_free ); /* TODO add tests for libfsrefs_directory_entry_read_directory_values */ /* TODO add tests for libfsrefs_directory_entry_read_file_values */ /* TODO add tests for libfsrefs_directory_entry_read_node_record */ /* TODO add tests for libfsrefs_directory_entry_get_object_identifier */ /* TODO add tests for libfsrefs_directory_entry_get_utf8_name_size */ /* TODO add tests for libfsrefs_directory_entry_get_utf8_name */ /* TODO add tests for libfsrefs_directory_entry_get_utf16_name_size */ /* TODO add tests for libfsrefs_directory_entry_get_utf16_name */ /* TODO add tests for libfsrefs_directory_entry_get_creation_time */ /* TODO add tests for libfsrefs_directory_entry_get_modification_time */ /* TODO add tests for libfsrefs_directory_entry_get_access_time */ /* TODO add tests for libfsrefs_directory_entry_get_entry_modification_time */ /* TODO add tests for libfsrefs_directory_entry_get_file_attribute_flags */ #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_directory_object.c ================================================ /* * Library directory_object type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_directory_object.h" #include "../libfsrefs/libfsrefs_file_system.h" #include "../libfsrefs/libfsrefs_io_handle.h" #include "../libfsrefs/libfsrefs_objects_tree.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_directory_object_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_directory_object_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_directory_object_t *directory_object = NULL; libfsrefs_file_system_t *file_system = NULL; libfsrefs_io_handle_t *io_handle = NULL; libfsrefs_objects_tree_t *objects_tree = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; io_handle->volume_size = 2080374784; result = libfsrefs_file_system_initialize( &file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_system", file_system ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_objects_tree_initialize( &objects_tree, file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "objects_tree", objects_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_directory_object_initialize( &directory_object, io_handle, objects_tree, (uint64_t) 0x00000701UL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "directory_object", directory_object ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_directory_object_free( &directory_object, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "directory_object", directory_object ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_directory_object_initialize( NULL, io_handle, objects_tree, (uint64_t) 0x00000701UL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); directory_object = (libfsrefs_directory_object_t *) 0x12345678UL; result = libfsrefs_directory_object_initialize( &directory_object, io_handle, objects_tree, (uint64_t) 0x00000701UL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); directory_object = NULL; result = libfsrefs_directory_object_initialize( &directory_object, NULL, objects_tree, (uint64_t) 0x00000701UL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_directory_object_initialize( &directory_object, io_handle, NULL, (uint64_t) 0x00000701UL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_directory_object_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_directory_object_initialize( &directory_object, io_handle, objects_tree, (uint64_t) 0x00000701UL, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( directory_object != NULL ) { libfsrefs_directory_object_free( &directory_object, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "directory_object", directory_object ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_directory_object_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_directory_object_initialize( &directory_object, io_handle, objects_tree, (uint64_t) 0x00000701UL, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( directory_object != NULL ) { libfsrefs_directory_object_free( &directory_object, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "directory_object", directory_object ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ /* Clean up */ result = libfsrefs_objects_tree_free( &objects_tree, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "objects_tree", objects_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_file_system_free( &file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "file_system", file_system ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( directory_object != NULL ) { libfsrefs_directory_object_free( &directory_object, NULL ); } if( objects_tree != NULL ) { libfsrefs_objects_tree_free( &objects_tree, NULL ); } if( file_system != NULL ) { libfsrefs_file_system_free( &file_system, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } /* Tests the libfsrefs_directory_object_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_directory_object_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_directory_object_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_directory_object_initialize", fsrefs_test_directory_object_initialize ); FSREFS_TEST_RUN( "libfsrefs_directory_object_free", fsrefs_test_directory_object_free ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_error.c ================================================ /* * Library error functions test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_unused.h" /* Tests the libfsrefs_error_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_error_free( void ) { /* Test invocation of function only */ libfsrefs_error_free( NULL ); return( 1 ); } /* Tests the libfsrefs_error_fprint function * Returns 1 if successful or 0 if not */ int fsrefs_test_error_fprint( void ) { /* Test invocation of function only */ libfsrefs_error_fprint( NULL, NULL ); return( 1 ); } /* Tests the libfsrefs_error_sprint function * Returns 1 if successful or 0 if not */ int fsrefs_test_error_sprint( void ) { /* Test invocation of function only */ libfsrefs_error_sprint( NULL, NULL, 0 ); return( 1 ); } /* Tests the libfsrefs_error_backtrace_fprint function * Returns 1 if successful or 0 if not */ int fsrefs_test_error_backtrace_fprint( void ) { /* Test invocation of function only */ libfsrefs_error_backtrace_fprint( NULL, NULL ); return( 1 ); } /* Tests the libfsrefs_error_backtrace_sprint function * Returns 1 if successful or 0 if not */ int fsrefs_test_error_backtrace_sprint( void ) { /* Test invocation of function only */ libfsrefs_error_backtrace_sprint( NULL, NULL, 0 ); return( 1 ); } /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) FSREFS_TEST_RUN( "libfsrefs_error_free", fsrefs_test_error_free ); FSREFS_TEST_RUN( "libfsrefs_error_fprint", fsrefs_test_error_fprint ); FSREFS_TEST_RUN( "libfsrefs_error_sprint", fsrefs_test_error_sprint ); FSREFS_TEST_RUN( "libfsrefs_error_backtrace_fprint", fsrefs_test_error_backtrace_fprint ); FSREFS_TEST_RUN( "libfsrefs_error_backtrace_sprint", fsrefs_test_error_backtrace_sprint ); return( EXIT_SUCCESS ); on_error: return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_file_entry.c ================================================ /* * Library file_entry type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_file_entry.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_file_entry_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_file_entry_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_file_entry_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* TODO add test for libfsrefs_file_entry_initialize */ FSREFS_TEST_RUN( "libfsrefs_file_entry_free", fsrefs_test_file_entry_free ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_file_system.c ================================================ /* * Library file_system type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_file_system.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_file_system_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_file_system_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_file_system_t *file_system = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_file_system_initialize( &file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_system", file_system ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_file_system_free( &file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "file_system", file_system ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_file_system_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); file_system = (libfsrefs_file_system_t *) 0x12345678UL; result = libfsrefs_file_system_initialize( &file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); file_system = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_file_system_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_file_system_initialize( &file_system, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( file_system != NULL ) { libfsrefs_file_system_free( &file_system, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "file_system", file_system ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_file_system_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_file_system_initialize( &file_system, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( file_system != NULL ) { libfsrefs_file_system_free( &file_system, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "file_system", file_system ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( file_system != NULL ) { libfsrefs_file_system_free( &file_system, NULL ); } return( 0 ); } /* Tests the libfsrefs_file_system_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_file_system_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_file_system_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_file_system_initialize", fsrefs_test_file_system_initialize ); FSREFS_TEST_RUN( "libfsrefs_file_system_free", fsrefs_test_file_system_free ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_functions.c ================================================ /* * Functions for testing * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libbfio.h" #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libclocale.h" #include "fsrefs_test_libuna.h" /* Retrieves source as a narrow string * Returns 1 if successful or -1 on error */ int fsrefs_test_get_narrow_source( const system_character_t *source, char *narrow_string, size_t narrow_string_size, libcerror_error_t **error ) { static char *function = "fsrefs_test_get_narrow_source"; size_t narrow_source_size = 0; size_t source_length = 0; #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int result = 0; #endif if( source == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid source.", function ); return( -1 ); } if( narrow_string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid narrow string.", function ); return( -1 ); } if( narrow_string_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid narrow string size value exceeds maximum.", function ); return( -1 ); } source_length = system_string_length( source ); if( source_length > (size_t) ( SSIZE_MAX - 1 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid source length value out of bounds.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf8_string_size_from_utf32( (libuna_utf32_character_t *) source, source_length + 1, &narrow_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf8_string_size_from_utf16( (libuna_utf16_character_t *) source, source_length + 1, &narrow_source_size, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_byte_stream_size_from_utf32( (libuna_utf32_character_t *) source, source_length + 1, libclocale_codepage, &narrow_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_byte_stream_size_from_utf16( (libuna_utf16_character_t *) source, source_length + 1, libclocale_codepage, &narrow_source_size, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to determine narrow string size.", function ); return( -1 ); } #else narrow_source_size = source_length + 1; #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ if( narrow_string_size < narrow_source_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, "%s: narrow string too small.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf8_string_copy_from_utf32( (libuna_utf8_character_t *) narrow_string, narrow_string_size, (libuna_utf32_character_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf8_string_copy_from_utf16( (libuna_utf8_character_t *) narrow_string, narrow_string_size, (libuna_utf16_character_t *) source, source_length + 1, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_byte_stream_copy_from_utf32( (uint8_t *) narrow_string, narrow_string_size, libclocale_codepage, (libuna_utf32_character_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_byte_stream_copy_from_utf16( (uint8_t *) narrow_string, narrow_string_size, libclocale_codepage, (libuna_utf16_character_t *) source, source_length + 1, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to set narrow string.", function ); return( -1 ); } #else if( system_string_copy( narrow_string, source, source_length ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to set narrow string.", function ); return( -1 ); } narrow_string[ source_length ] = 0; #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ return( 1 ); } #if defined( HAVE_WIDE_CHARACTER_TYPE ) /* Retrieves source as a wide string * Returns 1 if successful or -1 on error */ int fsrefs_test_get_wide_source( const system_character_t *source, wchar_t *wide_string, size_t wide_string_size, libcerror_error_t **error ) { static char *function = "fsrefs_test_get_wide_source"; size_t wide_source_size = 0; size_t source_length = 0; #if !defined( HAVE_WIDE_SYSTEM_CHARACTER ) int result = 0; #endif if( source == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid source.", function ); return( -1 ); } if( wide_string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid wide string.", function ); return( -1 ); } if( wide_string_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid wide string size value exceeds maximum.", function ); return( -1 ); } source_length = system_string_length( source ); if( source_length > (size_t) ( SSIZE_MAX - 1 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid source length value out of bounds.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) wide_source_size = source_length + 1; #else if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_size_from_utf8( (libuna_utf8_character_t *) source, source_length + 1, &wide_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_size_from_utf8( (libuna_utf8_character_t *) source, source_length + 1, &wide_source_size, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_size_from_byte_stream( (uint8_t *) source, source_length + 1, libclocale_codepage, &wide_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_size_from_byte_stream( (uint8_t *) source, source_length + 1, libclocale_codepage, &wide_source_size, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to determine wide string size.", function ); return( -1 ); } #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ if( wide_string_size < wide_source_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, "%s: wide string too small.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( system_string_copy( wide_string, source, source_length ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to set wide string.", function ); return( -1 ); } wide_string[ source_length ] = 0; #else if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_copy_from_utf8( (libuna_utf32_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_copy_from_utf8( (libuna_utf16_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_copy_from_byte_stream( (libuna_utf32_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, libclocale_codepage, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_copy_from_byte_stream( (libuna_utf16_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, libclocale_codepage, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to set wide string.", function ); return( -1 ); } #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ return( 1 ); } #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ /* Copies a string of a decimal value to a 64-bit value * Returns 1 if successful or -1 on error */ int fsrefs_test_system_string_copy_from_64_bit_in_decimal( const system_character_t *string, size_t string_size, uint64_t *value_64bit, libcerror_error_t **error ) { static char *function = "fsrefs_test_system_string_copy_from_64_bit_in_decimal"; size_t string_index = 0; system_character_t character_value = 0; uint8_t maximum_string_index = 20; int8_t sign = 1; if( string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid string.", function ); return( -1 ); } if( string_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid string size value exceeds maximum.", function ); return( -1 ); } if( value_64bit == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid value 64-bit.", function ); return( -1 ); } *value_64bit = 0; if( string[ string_index ] == (system_character_t) '-' ) { string_index++; maximum_string_index++; sign = -1; } else if( string[ string_index ] == (system_character_t) '+' ) { string_index++; maximum_string_index++; } while( string_index < string_size ) { if( string[ string_index ] == 0 ) { break; } if( string_index > (size_t) maximum_string_index ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_LARGE, "%s: string too large.", function ); return( -1 ); } *value_64bit *= 10; if( ( string[ string_index ] >= (system_character_t) '0' ) && ( string[ string_index ] <= (system_character_t) '9' ) ) { character_value = (system_character_t) ( string[ string_index ] - (system_character_t) '0' ); } else { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE, "%s: unsupported character value: %" PRIc_SYSTEM " at index: %d.", function, string[ string_index ], string_index ); return( -1 ); } *value_64bit += character_value; string_index++; } if( sign == -1 ) { *value_64bit *= (uint64_t) -1; } return( 1 ); } /* Creates a file IO handle for test data * Returns 1 if successful or -1 on error */ int fsrefs_test_open_file_io_handle( libbfio_handle_t **file_io_handle, uint8_t *data, size_t data_size, libcerror_error_t **error ) { static char *function = "fsrefs_test_open_file_io_handle"; if( file_io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file IO handle.", function ); return( -1 ); } if( libbfio_memory_range_initialize( file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to create file IO handle.", function ); goto on_error; } if( libbfio_memory_range_set( *file_io_handle, data, data_size, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_SET_FAILED, "%s: unable to set memory range of file IO handle.", function ); goto on_error; } if( libbfio_handle_open( *file_io_handle, LIBBFIO_OPEN_READ, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open file IO handle.", function ); goto on_error; } return( 1 ); on_error: if( *file_io_handle != NULL ) { libbfio_handle_free( file_io_handle, NULL ); } return( -1 ); } /* Closes a file IO handle for test data * Returns 0 if successful or -1 on error */ int fsrefs_test_close_file_io_handle( libbfio_handle_t **file_io_handle, libcerror_error_t **error ) { static char *function = "fsrefs_test_close_file_io_handle"; int result = 0; if( file_io_handle == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid file IO handle.", function ); return( -1 ); } if( libbfio_handle_close( *file_io_handle, error ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_CLOSE_FAILED, "%s: unable to close file IO handle.", function ); result = -1; } if( libbfio_handle_free( file_io_handle, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free file IO handle.", function ); result = -1; } return( result ); } ================================================ FILE: tests/fsrefs_test_functions.h ================================================ /* * Functions for testing * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_FUNCTIONS_H ) #define _FSREFS_TEST_FUNCTIONS_H #include #include #include "fsrefs_test_libbfio.h" #include "fsrefs_test_libcerror.h" #if defined( __cplusplus ) extern "C" { #endif int fsrefs_test_get_narrow_source( const system_character_t *source, char *narrow_string, size_t narrow_string_size, libcerror_error_t **error ); #if defined( HAVE_WIDE_CHARACTER_TYPE ) int fsrefs_test_get_wide_source( const system_character_t *source, wchar_t *wide_string, size_t wide_string_size, libcerror_error_t **error ); #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ int fsrefs_test_system_string_copy_from_64_bit_in_decimal( const system_character_t *string, size_t string_size, uint64_t *value_64bit, libcerror_error_t **error ); int fsrefs_test_open_file_io_handle( libbfio_handle_t **file_io_handle, uint8_t *data, size_t data_size, libcerror_error_t **error ); int fsrefs_test_close_file_io_handle( libbfio_handle_t **file_io_handle, libcerror_error_t **error ); #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_TEST_FUNCTIONS_H ) */ ================================================ FILE: tests/fsrefs_test_getopt.c ================================================ /* * GetOpt functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_getopt.h" #include "fsrefs_test_libcnotify.h" #if !defined( HAVE_GETOPT ) /* The option index * Start with argument 1 (argument 0 is the program name) */ int optind = 1; /* The current option argument */ system_character_t *optarg = NULL; /* Value to indicate the current option */ system_integer_t optopt = 0; /* The next option in a group */ system_character_t *next_option = NULL; /* Get the program options * Function for platforms that do not have the getopt function * Returns the option character processed, or -1 on error, * ? if the option was not in the options string, : if the option argument was missing */ system_integer_t fsrefs_test_getopt( int argument_count, system_character_t * const argument_values[], const system_character_t *options_string ) { system_character_t *argument_value = NULL; system_character_t *option_value = NULL; static char *function = "fsrefs_test_getopt"; size_t options_string_length = 0; if( next_option != NULL ) { argument_value = next_option; next_option = NULL; } else if( optind >= argument_count ) { return( (system_integer_t) -1 ); } else { argument_value = argument_values[ optind ]; /* Check if the argument value is not an empty string */ if( *argument_value == (system_character_t) '\0' ) { return( (system_integer_t) -1 ); } /* Check if the first character is a option marker '-' */ if( *argument_value != (system_character_t) '-' ) { return( (system_integer_t) -1 ); } argument_value++; /* Check if long options are provided '--' */ if( *argument_value == (system_character_t) '-' ) { optind++; return( (system_integer_t) -1 ); } } options_string_length = system_string_length( options_string ); optopt = *argument_value; option_value = system_string_search_character( options_string, optopt, options_string_length ); argument_value++; /* Check if an argument was specified or that the option was not found * in the option string */ if( ( optopt == (system_integer_t) ':' ) || ( option_value == NULL ) ) { if( *argument_value == (system_character_t) '\0' ) { optind++; } if( ( *options_string != (system_character_t) ':' ) && ( optopt != (system_integer_t) '?' ) ) { libcnotify_printf( "%s: no such option: %" PRIc_SYSTEM ".\n", function, optopt ); } return( (system_integer_t) '?' ); } option_value++; /* Check if no option argument is required */ if( *option_value != (system_character_t) ':' ) { optarg = NULL; if( *argument_value == (system_character_t) '\0' ) { optind++; } else { /* Multiple options are grouped */ next_option = argument_value; } } /* Check if the argument is right after the option flag with no space in between */ else if( *argument_value != (system_character_t) '\0' ) { optarg = argument_value; optind++; } else { optind++; /* Check if the argument was provided as the next argument value */ if( argument_count <= optind ) { if( *option_value == ':' ) { return( (system_integer_t) ':' ); } libcnotify_printf( "%s: option: %" PRIc_SYSTEM " requires an argument.\n", function, optopt ); return( (system_integer_t) '?' ); } optarg = argument_values[ optind ]; optind++; } return( optopt ); } #endif /* !defined( HAVE_GETOPT ) */ ================================================ FILE: tests/fsrefs_test_getopt.h ================================================ /* * GetOpt functions * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_GETOPT_H ) #define _FSREFS_TEST_GETOPT_H #include #include /* unistd.h is included here to export getopt, optarg, optind and optopt */ #if defined( HAVE_UNISTD_H ) #include #endif #if defined( __cplusplus ) extern "C" { #endif #if defined( HAVE_GETOPT ) #define fsrefs_test_getopt( argument_count, argument_values, options_string ) \ getopt( argument_count, argument_values, options_string ) #else #if !defined( __CYGWIN__ ) extern int optind; extern system_character_t *optarg; extern system_integer_t optopt; #else int optind; system_character_t *optarg; system_integer_t optopt; #endif /* !defined( __CYGWIN__ ) */ system_integer_t fsrefs_test_getopt( int argument_count, system_character_t * const argument_values[], const system_character_t *options_string ); #endif /* defined( HAVE_GETOPT ) */ #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_TEST_GETOPT_H ) */ ================================================ FILE: tests/fsrefs_test_io_handle.c ================================================ /* * Library io_handle type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_io_handle.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_io_handle_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_io_handle_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_io_handle_t *io_handle = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_io_handle_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); io_handle = (libfsrefs_io_handle_t *) 0x12345678UL; result = libfsrefs_io_handle_initialize( &io_handle, &error ); io_handle = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_io_handle_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_io_handle_initialize( &io_handle, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_io_handle_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_io_handle_initialize( &io_handle, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } /* Tests the libfsrefs_io_handle_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_io_handle_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_io_handle_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_io_handle_clear function * Returns 1 if successful or 0 if not */ int fsrefs_test_io_handle_clear( void ) { libcerror_error_t *error = NULL; libfsrefs_io_handle_t *io_handle = NULL; int result = 0; /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_io_handle_clear( io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_io_handle_clear( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) /* Test libfsrefs_io_handle_clear with memset failing */ fsrefs_test_memset_attempts_before_fail = 0; result = libfsrefs_io_handle_clear( io_handle, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ /* Clean up */ result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_io_handle_initialize", fsrefs_test_io_handle_initialize ); FSREFS_TEST_RUN( "libfsrefs_io_handle_free", fsrefs_test_io_handle_free ); FSREFS_TEST_RUN( "libfsrefs_io_handle_clear", fsrefs_test_io_handle_clear ); /* TODO: add tests for libfsrefs_io_handle_read_volume_header */ #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); on_error: return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_libbfio.h ================================================ /* * The libbfio header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_LIBBFIO_H ) #define _FSREFS_TEST_LIBBFIO_H #include /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio */ #if defined( HAVE_LOCAL_LIBBFIO ) #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT * before including libbfio.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBBFIO_DLL_IMPORT #endif #include #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) #error Multi-threading support requires libbfio with multi-threading support #endif #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ #endif /* !defined( _FSREFS_TEST_LIBBFIO_H ) */ ================================================ FILE: tests/fsrefs_test_libcerror.h ================================================ /* * The libcerror header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_LIBCERROR_H ) #define _FSREFS_TEST_LIBCERROR_H #include /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror */ #if defined( HAVE_LOCAL_LIBCERROR ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT * before including libcerror.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBCERROR_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ #endif /* !defined( _FSREFS_TEST_LIBCERROR_H ) */ ================================================ FILE: tests/fsrefs_test_libclocale.h ================================================ /* * The libclocale header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_LIBCLOCALE_H ) #define _FSREFS_TEST_LIBCLOCALE_H #include /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale */ #if defined( HAVE_LOCAL_LIBCLOCALE ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT * before including libclocale.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBCLOCALE_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ #endif /* !defined( _FSREFS_TEST_LIBCLOCALE_H ) */ ================================================ FILE: tests/fsrefs_test_libcnotify.h ================================================ /* * The libcnotify header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_LIBCNOTIFY_H ) #define _FSREFS_TEST_LIBCNOTIFY_H #include /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify */ #if defined( HAVE_LOCAL_LIBCNOTIFY ) #include #include #include #include #else /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT * before including libcnotify.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBCNOTIFY_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ #endif /* !defined( _FSREFS_TEST_LIBCNOTIFY_H ) */ ================================================ FILE: tests/fsrefs_test_libfsrefs.h ================================================ /* * The libfsrefs header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_LIBFSREFS_H ) #define _FSREFS_TEST_LIBFSREFS_H #include #include #endif /* !defined( _FSREFS_TEST_LIBFSREFS_H ) */ ================================================ FILE: tests/fsrefs_test_libuna.h ================================================ /* * The libuna header wrapper * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_LIBUNA_H ) #define _FSREFS_TEST_LIBUNA_H #include /* Define HAVE_LOCAL_LIBUNA for local use of libuna */ #if defined( HAVE_LOCAL_LIBUNA ) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #else /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT * before including libuna.h */ #if defined( _WIN32 ) && defined( DLL_IMPORT ) #define LIBUNA_DLL_IMPORT #endif #include #endif /* defined( HAVE_LOCAL_LIBUNA ) */ #endif /* !defined( _FSREFS_TEST_LIBUNA_H ) */ ================================================ FILE: tests/fsrefs_test_macros.h ================================================ /* * Macros for testing * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_MACROS_H ) #define _FSREFS_TEST_MACROS_H #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #define FSREFS_TEST_ASSERT_EQUAL_INT( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%d) != %d\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_NOT_EQUAL_INT( name, value, expected_value ) \ if( value == expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%d) == %d\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_GREATER_THAN_INT( name, value, expected_value ) \ if( value <= expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%d) <= %d\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_LESS_THAN_INT( name, value, expected_value ) \ if( value >= expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%d) >= %d\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_INTPTR( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (0x%08x" PRIjx ") != 0x%08x" PRIjx "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_NOT_EQUAL_INTPTR( name, value, expected_value ) \ if( value == expected_value ) \ { \ fprintf( stdout, "%s:%d %s (0x%08x" PRIjx ") == 0x%08x" PRIjx "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_FLOAT( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%f) != %f\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_NOT_EQUAL_FLOAT( name, value, expected_value ) \ if( value == expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%f) == %f\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_SIZE( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIzd ") != %" PRIzd "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_SSIZE( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIzd ") != %" PRIzd "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_NOT_EQUAL_SSIZE( name, value, expected_value ) \ if( value == expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIzd ") == %" PRIzd "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_INT8( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi8 ") != %" PRIi8 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_NOT_EQUAL_INT8( name, value, expected_value ) \ if( value == expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi8 ") == %" PRIi8 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_UINT8( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi8 ") != %" PRIu8 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_LESS_THAN_UINT8( name, value, expected_value ) \ if( value >= expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi8 ") >= %" PRIu8 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_INT16( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi16 ") != %" PRIi16 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_NOT_EQUAL_INT16( name, value, expected_value ) \ if( value == expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi16 ") == %" PRIi16 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_UINT16( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi16 ") != %" PRIu16 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_LESS_THAN_UINT16( name, value, expected_value ) \ if( value >= expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi16 ") >= %" PRIu16 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_INT32( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi32 ") != %" PRIi32 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_NOT_EQUAL_INT32( name, value, expected_value ) \ if( value == expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi32 ") == %" PRIi32 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_UINT32( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIu32 ") != %" PRIu32 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_LESS_THAN_UINT32( name, value, expected_value ) \ if( value >= expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIu32 ") >= %" PRIu32 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_INT64( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi64 ") != %" PRIi64 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_NOT_EQUAL_INT64( name, value, expected_value ) \ if( value == expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIi64 ") == %" PRIi64 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_EQUAL_UINT64( name, value, expected_value ) \ if( value != expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIu64 ") != %" PRIu64 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_LESS_THAN_UINT64( name, value, expected_value ) \ if( value >= expected_value ) \ { \ fprintf( stdout, "%s:%d %s (%" PRIu64 ") >= %" PRIu64 "\n", __FILE__, __LINE__, name, value, expected_value ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_IS_NOT_NULL( name, value ) \ if( value == NULL ) \ { \ fprintf( stdout, "%s:%d %s == NULL\n", __FILE__, __LINE__, name ); \ goto on_error; \ } #define FSREFS_TEST_ASSERT_IS_NULL( name, value ) \ if( value != NULL ) \ { \ fprintf( stdout, "%s:%d %s != NULL\n", __FILE__, __LINE__, name ); \ goto on_error; \ } #define FSREFS_TEST_RUN( name, function ) \ if( function() != 1 ) \ { \ fprintf( stdout, "Unable to run test: %s\n", name ); \ goto on_error; \ } #if !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) #define FSREFS_TEST_RUN_WITH_ARGS( name, function, ... ) \ if( function( __VA_ARGS__ ) != 1 ) \ { \ fprintf( stdout, "Unable to run test: %s\n", name ); \ goto on_error; \ } #endif /* !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) */ #define FSREFS_TEST_FPRINT_ERROR( error ) \ libcerror_error_backtrace_fprint( error, stdout ); #endif /* !defined( _FSREFS_TEST_MACROS_H ) */ ================================================ FILE: tests/fsrefs_test_memory.c ================================================ /* * Memory allocation functions for testing * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) #define __USE_GNU #include #undef __USE_GNU #endif #include "fsrefs_test_memory.h" #if defined( HAVE_FSREFS_TEST_MEMORY ) static void *(*fsrefs_test_real_malloc)(size_t) = NULL; static void *(*fsrefs_test_real_memcpy)(void *, const void *, size_t) = NULL; static void *(*fsrefs_test_real_memset)(void *, int, size_t) = NULL; static void *(*fsrefs_test_real_realloc)(void *, size_t) = NULL; int fsrefs_test_malloc_attempts_before_fail = -1; int fsrefs_test_memcpy_attempts_before_fail = -1; int fsrefs_test_memset_attempts_before_fail = -1; int fsrefs_test_realloc_attempts_before_fail = -1; /* Custom malloc for testing memory error cases * Note this function might fail if compiled with optimation * Returns a pointer to newly allocated data or NULL */ void *malloc( size_t size ) { void *ptr = NULL; if( fsrefs_test_real_malloc == NULL ) { fsrefs_test_real_malloc = dlsym( RTLD_NEXT, "malloc" ); } if( fsrefs_test_malloc_attempts_before_fail == 0 ) { fsrefs_test_malloc_attempts_before_fail = -1; return( NULL ); } else if( fsrefs_test_malloc_attempts_before_fail > 0 ) { fsrefs_test_malloc_attempts_before_fail--; } ptr = fsrefs_test_real_malloc( size ); return( ptr ); } /* Custom memcpy for testing memory error cases * Note this function might fail if compiled with optimation and as a shared libary * Returns a pointer to newly allocated data or NULL */ void *memcpy( void *destination, const void *source, size_t size ) { if( fsrefs_test_real_memcpy == NULL ) { fsrefs_test_real_memcpy = dlsym( RTLD_NEXT, "memcpy" ); } if( fsrefs_test_memcpy_attempts_before_fail == 0 ) { fsrefs_test_memcpy_attempts_before_fail = -1; return( NULL ); } else if( fsrefs_test_memcpy_attempts_before_fail > 0 ) { fsrefs_test_memcpy_attempts_before_fail--; } destination = fsrefs_test_real_memcpy( destination, source, size ); return( destination ); } /* Custom memset for testing memory error cases * Note this function might fail if compiled with optimation and as a shared libary * Returns a pointer to newly allocated data or NULL */ void *memset( void *ptr, int constant, size_t size ) { if( fsrefs_test_real_memset == NULL ) { fsrefs_test_real_memset = dlsym( RTLD_NEXT, "memset" ); } if( fsrefs_test_memset_attempts_before_fail == 0 ) { fsrefs_test_memset_attempts_before_fail = -1; return( NULL ); } else if( fsrefs_test_memset_attempts_before_fail > 0 ) { fsrefs_test_memset_attempts_before_fail--; } ptr = fsrefs_test_real_memset( ptr, constant, size ); return( ptr ); } /* Custom realloc for testing memory error cases * Note this function might fail if compiled with optimation * Returns a pointer to reallocated data or NULL */ void *realloc( void *ptr, size_t size ) { if( fsrefs_test_real_realloc == NULL ) { fsrefs_test_real_realloc = dlsym( RTLD_NEXT, "realloc" ); } if( fsrefs_test_realloc_attempts_before_fail == 0 ) { fsrefs_test_realloc_attempts_before_fail = -1; return( NULL ); } else if( fsrefs_test_realloc_attempts_before_fail > 0 ) { fsrefs_test_realloc_attempts_before_fail--; } ptr = fsrefs_test_real_realloc( ptr, size ); return( ptr ); } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ ================================================ FILE: tests/fsrefs_test_memory.h ================================================ /* * Memory allocation functions for testing * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_MEMORY_H ) #define _FSREFS_TEST_MEMORY_H #include #if defined( __cplusplus ) extern "C" { #endif #if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __loongarch__ ) && !defined( __mips__ ) && !defined( __riscv ) && !defined( __sparc__ ) && !defined( HAVE_ASAN ) #define HAVE_FSREFS_TEST_MEMORY 1 #endif #if defined( HAVE_FSREFS_TEST_MEMORY ) extern int fsrefs_test_malloc_attempts_before_fail; extern int fsrefs_test_memcpy_attempts_before_fail; extern int fsrefs_test_memset_attempts_before_fail; extern int fsrefs_test_realloc_attempts_before_fail; #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ #if defined( __cplusplus ) } #endif #endif /* !defined( _FSREFS_TEST_MEMORY_H ) */ ================================================ FILE: tests/fsrefs_test_metadata_block_header.c ================================================ /* * Library metadata_block_header type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_functions.h" #include "fsrefs_test_libbfio.h" #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_io_handle.h" #include "../libfsrefs/libfsrefs_metadata_block_header.h" uint8_t fsrefs_test_metadata_block_header_data1[ 48 ] = { 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t fsrefs_test_metadata_block_header_data2[ 80 ] = { 0x53, 0x55, 0x50, 0x42, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0xa7, 0xe0, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_metadata_block_header_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_metadata_block_header_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_metadata_block_header_t *metadata_block_header = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_metadata_block_header_initialize( &metadata_block_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "metadata_block_header", metadata_block_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_metadata_block_header_free( &metadata_block_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "metadata_block_header", metadata_block_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_metadata_block_header_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); metadata_block_header = (libfsrefs_metadata_block_header_t *) 0x12345678UL; result = libfsrefs_metadata_block_header_initialize( &metadata_block_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); metadata_block_header = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_metadata_block_header_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_metadata_block_header_initialize( &metadata_block_header, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( metadata_block_header != NULL ) { libfsrefs_metadata_block_header_free( &metadata_block_header, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "metadata_block_header", metadata_block_header ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_metadata_block_header_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_metadata_block_header_initialize( &metadata_block_header, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( metadata_block_header != NULL ) { libfsrefs_metadata_block_header_free( &metadata_block_header, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "metadata_block_header", metadata_block_header ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( metadata_block_header != NULL ) { libfsrefs_metadata_block_header_free( &metadata_block_header, NULL ); } return( 0 ); } /* Tests the libfsrefs_metadata_block_header_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_metadata_block_header_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_metadata_block_header_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_metadata_block_header_read_file_io_handle function * Returns 1 if successful or 0 if not */ int fsrefs_test_metadata_block_header_read_file_io_handle( void ) { libbfio_handle_t *file_io_handle = NULL; libcerror_error_t *error = NULL; libfsrefs_io_handle_t *io_handle = NULL; libfsrefs_metadata_block_header_t *metadata_block_header = NULL; int result = 0; /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_metadata_block_header_initialize( &metadata_block_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "metadata_block_header", metadata_block_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize file IO handle */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_metadata_block_header_data1, 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_metadata_block_header_read_file_io_handle( metadata_block_header, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_metadata_block_header_read_file_io_handle( NULL, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_metadata_block_header_read_file_io_handle( metadata_block_header, NULL, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_metadata_block_header_read_file_io_handle( metadata_block_header, io_handle, NULL, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_metadata_block_header_read_file_io_handle( metadata_block_header, io_handle, file_io_handle, -1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up file IO handle */ result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test data too small */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_metadata_block_header_data1, 8, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_metadata_block_header_read_file_io_handle( metadata_block_header, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test data invalid */ /* TODO result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_metadata_block_header_data1, 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); byte_stream_copy_from_uint64_little_endian( &( fsrefs_test_metadata_block_header_data1[ 3 ] ), 0xffffffffffffffffUL ); result = libfsrefs_metadata_block_header_read_file_io_handle( metadata_block_header, io_handle, file_io_handle, 0, &error ); byte_stream_copy_from_uint64_little_endian( &( fsrefs_test_metadata_block_header_data1[ 3 ] ), 0x0000000053466552UL ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); */ /* Clean up */ result = libfsrefs_metadata_block_header_free( &metadata_block_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "metadata_block_header", metadata_block_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } if( metadata_block_header != NULL ) { libfsrefs_metadata_block_header_free( &metadata_block_header, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_metadata_block_header_initialize", fsrefs_test_metadata_block_header_initialize ); FSREFS_TEST_RUN( "libfsrefs_metadata_block_header_free", fsrefs_test_metadata_block_header_free ); /* TODO: add tests for libfsrefs_metadata_block_header_read_data */ FSREFS_TEST_RUN( "libfsrefs_metadata_block_header_read_file_io_handle", fsrefs_test_metadata_block_header_read_file_io_handle ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_ministore_node.c ================================================ /* * Library ministore_node type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_ministore_node.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_ministore_node_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_ministore_node_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_ministore_node_t *ministore_node = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_ministore_node_initialize( &ministore_node, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "ministore_node", ministore_node ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_ministore_node_free( &ministore_node, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "ministore_node", ministore_node ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_ministore_node_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); ministore_node = (libfsrefs_ministore_node_t *) 0x12345678UL; result = libfsrefs_ministore_node_initialize( &ministore_node, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); ministore_node = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_ministore_node_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_ministore_node_initialize( &ministore_node, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( ministore_node != NULL ) { libfsrefs_ministore_node_free( &ministore_node, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "ministore_node", ministore_node ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_ministore_node_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_ministore_node_initialize( &ministore_node, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( ministore_node != NULL ) { libfsrefs_ministore_node_free( &ministore_node, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "ministore_node", ministore_node ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( ministore_node != NULL ) { libfsrefs_ministore_node_free( &ministore_node, NULL ); } return( 0 ); } /* Tests the libfsrefs_ministore_node_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_ministore_node_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_ministore_node_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_ministore_node_initialize", fsrefs_test_ministore_node_initialize ); FSREFS_TEST_RUN( "libfsrefs_ministore_node_free", fsrefs_test_ministore_node_free ); /* TODO: add tests for libfsrefs_ministore_node_read_data */ /* TODO: add tests for libfsrefs_ministore_node_read_file_io_handle */ #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_ministore_tree.c ================================================ /* * Library ministore_tree type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_ministore_tree.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_ministore_tree_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_ministore_tree_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_ministore_tree_t *ministore_tree = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_ministore_tree_initialize( &ministore_tree, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "ministore_tree", ministore_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_ministore_tree_free( &ministore_tree, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "ministore_tree", ministore_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_ministore_tree_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); ministore_tree = (libfsrefs_ministore_tree_t *) 0x12345678UL; result = libfsrefs_ministore_tree_initialize( &ministore_tree, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); ministore_tree = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_ministore_tree_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_ministore_tree_initialize( &ministore_tree, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( ministore_tree != NULL ) { libfsrefs_ministore_tree_free( &ministore_tree, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "ministore_tree", ministore_tree ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_ministore_tree_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_ministore_tree_initialize( &ministore_tree, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( ministore_tree != NULL ) { libfsrefs_ministore_tree_free( &ministore_tree, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "ministore_tree", ministore_tree ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( ministore_tree != NULL ) { libfsrefs_ministore_tree_free( &ministore_tree, NULL ); } return( 0 ); } /* Tests the libfsrefs_ministore_tree_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_ministore_tree_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_ministore_tree_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_ministore_tree_initialize", fsrefs_test_ministore_tree_initialize ); FSREFS_TEST_RUN( "libfsrefs_ministore_tree_free", fsrefs_test_ministore_tree_free ); /* TODO: add tests for libfsrefs_ministore_tree_read_data */ /* TODO: add tests for libfsrefs_ministore_tree_read_file_io_handle */ #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_node_header.c ================================================ /* * Library node_header type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_node_header.h" uint8_t fsrefs_test_node_header_data1[ 32 ] = { 0x20, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0xb0, 0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x50, 0x35, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x70, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_node_header_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_node_header_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_node_header_t *node_header = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_node_header_initialize( &node_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "node_header", node_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_node_header_free( &node_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "node_header", node_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_node_header_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); node_header = (libfsrefs_node_header_t *) 0x12345678UL; result = libfsrefs_node_header_initialize( &node_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); node_header = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_node_header_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_node_header_initialize( &node_header, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( node_header != NULL ) { libfsrefs_node_header_free( &node_header, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "node_header", node_header ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_node_header_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_node_header_initialize( &node_header, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( node_header != NULL ) { libfsrefs_node_header_free( &node_header, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "node_header", node_header ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( node_header != NULL ) { libfsrefs_node_header_free( &node_header, NULL ); } return( 0 ); } /* Tests the libfsrefs_node_header_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_node_header_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_node_header_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_node_header_read_data function * Returns 1 if successful or 0 if not */ int fsrefs_test_node_header_read_data( void ) { libcerror_error_t *error = NULL; libfsrefs_node_header_t *node_header = NULL; int result = 0; /* Initialize test */ result = libfsrefs_node_header_initialize( &node_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "node_header", node_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_node_header_read_data( node_header, fsrefs_test_node_header_data1, 32, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_node_header_read_data( NULL, fsrefs_test_node_header_data1, 32, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_node_header_read_data( node_header, NULL, 32, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_node_header_read_data( node_header, fsrefs_test_node_header_data1, (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_node_header_read_data( node_header, fsrefs_test_node_header_data1, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: Test error case where data is invalid */ /* Clean up */ result = libfsrefs_node_header_free( &node_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "node_header", node_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( node_header != NULL ) { libfsrefs_node_header_free( &node_header, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_node_header_initialize", fsrefs_test_node_header_initialize ); FSREFS_TEST_RUN( "libfsrefs_node_header_free", fsrefs_test_node_header_free ); FSREFS_TEST_RUN( "libfsrefs_node_header_read_data", fsrefs_test_node_header_read_data ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_node_record.c ================================================ /* * Library node_record type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_node_record.h" uint8_t fsrefs_test_node_record_data1[ 176 ] = { 0xb0, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_node_record_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_node_record_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_node_record_t *node_record = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_node_record_initialize( &node_record, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "node_record", node_record ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_node_record_free( &node_record, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "node_record", node_record ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_node_record_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); node_record = (libfsrefs_node_record_t *) 0x12345678UL; result = libfsrefs_node_record_initialize( &node_record, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); node_record = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_node_record_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_node_record_initialize( &node_record, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( node_record != NULL ) { libfsrefs_node_record_free( &node_record, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "node_record", node_record ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_node_record_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_node_record_initialize( &node_record, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( node_record != NULL ) { libfsrefs_node_record_free( &node_record, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "node_record", node_record ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( node_record != NULL ) { libfsrefs_node_record_free( &node_record, NULL ); } return( 0 ); } /* Tests the libfsrefs_node_record_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_node_record_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_node_record_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_node_record_read_data function * Returns 1 if successful or 0 if not */ int fsrefs_test_node_record_read_data( void ) { libcerror_error_t *error = NULL; libfsrefs_node_record_t *node_record = NULL; int result = 0; /* Initialize test */ result = libfsrefs_node_record_initialize( &node_record, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "node_record", node_record ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_node_record_read_data( node_record, fsrefs_test_node_record_data1, 176, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_node_record_read_data( NULL, fsrefs_test_node_record_data1, 176, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_node_record_read_data( node_record, NULL, 176, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_node_record_read_data( node_record, fsrefs_test_node_record_data1, (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_node_record_read_data( node_record, fsrefs_test_node_record_data1, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: Test error case where data is invalid */ /* Clean up */ result = libfsrefs_node_record_free( &node_record, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "node_record", node_record ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( node_record != NULL ) { libfsrefs_node_record_free( &node_record, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_node_record_initialize", fsrefs_test_node_record_initialize ); FSREFS_TEST_RUN( "libfsrefs_node_record_free", fsrefs_test_node_record_free ); FSREFS_TEST_RUN( "libfsrefs_node_record_read_data", fsrefs_test_node_record_read_data ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_notify.c ================================================ /* * Library notification functions test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_unused.h" /* Tests the libfsrefs_notify_set_verbose function * Returns 1 if successful or 0 if not */ int fsrefs_test_notify_set_verbose( void ) { /* Test invocation of function only */ libfsrefs_notify_set_verbose( 0 ); return( 1 ); } /* Tests the libfsrefs_notify_set_stream function * Returns 1 if successful or 0 if not */ int fsrefs_test_notify_set_stream( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test regular cases */ result = libfsrefs_notify_set_stream( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ /* TODO test libcnotify_stream_set failure */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_notify_stream_open function * Returns 1 if successful or 0 if not */ int fsrefs_test_notify_stream_open( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test regular cases */ result = libfsrefs_notify_stream_open( "notify_stream.log", &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_notify_stream_open( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up */ result = libfsrefs_notify_stream_close( &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_notify_stream_close function * Returns 1 if successful or 0 if not */ int fsrefs_test_notify_stream_close( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test regular cases */ result = libfsrefs_notify_stream_close( &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ /* TODO test libcnotify_stream_close failure */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) FSREFS_TEST_RUN( "libfsrefs_notify_set_verbose", fsrefs_test_notify_set_verbose ) FSREFS_TEST_RUN( "libfsrefs_notify_set_stream", fsrefs_test_notify_set_stream ) FSREFS_TEST_RUN( "libfsrefs_notify_stream_open", fsrefs_test_notify_stream_open ) FSREFS_TEST_RUN( "libfsrefs_notify_stream_close", fsrefs_test_notify_stream_close ) return( EXIT_SUCCESS ); on_error: return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_objects_tree.c ================================================ /* * Library objects_tree type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_file_system.h" #include "../libfsrefs/libfsrefs_objects_tree.h" #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_objects_tree_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_objects_tree_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_file_system_t *file_system = NULL; libfsrefs_objects_tree_t *objects_tree = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Initialize test */ result = libfsrefs_file_system_initialize( &file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_system", file_system ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_objects_tree_initialize( &objects_tree, file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "objects_tree", objects_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_objects_tree_free( &objects_tree, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "objects_tree", objects_tree ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_objects_tree_initialize( NULL, file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); objects_tree = (libfsrefs_objects_tree_t *) 0x12345678UL; result = libfsrefs_objects_tree_initialize( &objects_tree, file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); objects_tree = NULL; result = libfsrefs_objects_tree_initialize( &objects_tree, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_objects_tree_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_objects_tree_initialize( &objects_tree, file_system, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( objects_tree != NULL ) { libfsrefs_objects_tree_free( &objects_tree, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "objects_tree", objects_tree ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_objects_tree_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_objects_tree_initialize( &objects_tree, file_system, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( objects_tree != NULL ) { libfsrefs_objects_tree_free( &objects_tree, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "objects_tree", objects_tree ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ /* Clean up */ result = libfsrefs_file_system_free( &file_system, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "file_system", file_system ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( objects_tree != NULL ) { libfsrefs_objects_tree_free( &objects_tree, NULL ); } if( file_system != NULL ) { libfsrefs_file_system_free( &file_system, NULL ); } return( 0 ); } /* Tests the libfsrefs_objects_tree_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_objects_tree_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_objects_tree_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_objects_tree_initialize", fsrefs_test_objects_tree_initialize ); FSREFS_TEST_RUN( "libfsrefs_objects_tree_free", fsrefs_test_objects_tree_free ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_superblock.c ================================================ /* * Library superblock type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_functions.h" #include "fsrefs_test_libbfio.h" #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_io_handle.h" #include "../libfsrefs/libfsrefs_superblock.h" uint8_t fsrefs_test_superblock_data1[ 16384 ] = { 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xfe, 0x6e, 0x60, 0xd5, 0x34, 0xb0, 0x49, 0x80, 0xef, 0x0b, 0x57, 0x5e, 0xcf, 0x09, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 0x00, 0x00, 0x00, 0x5d, 0x5f, 0xe6, 0x46, 0x0a, 0xde, 0xe1, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t fsrefs_test_superblock_data2[ 4096 ] = { 0x53, 0x55, 0x50, 0x42, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0xa7, 0xe0, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xa0, 0xd1, 0x1d, 0x1d, 0xe0, 0x0d, 0x49, 0x89, 0x0b, 0x09, 0xa5, 0x81, 0xec, 0x35, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x04, 0x00, 0x00, 0x00, 0xe2, 0xfb, 0xbe, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_superblock_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_superblock_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_superblock_t *superblock = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_superblock_initialize( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_superblock_free( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_superblock_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); superblock = (libfsrefs_superblock_t *) 0x12345678UL; result = libfsrefs_superblock_initialize( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); superblock = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_superblock_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_superblock_initialize( &superblock, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( superblock != NULL ) { libfsrefs_superblock_free( &superblock, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_superblock_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_superblock_initialize( &superblock, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( superblock != NULL ) { libfsrefs_superblock_free( &superblock, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( superblock != NULL ) { libfsrefs_superblock_free( &superblock, NULL ); } return( 0 ); } /* Tests the libfsrefs_superblock_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_superblock_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_superblock_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_superblock_read_data function * Returns 1 if successful or 0 if not */ int fsrefs_test_superblock_read_data( void ) { libcerror_error_t *error = NULL; libfsrefs_io_handle_t *io_handle = NULL; libfsrefs_superblock_t *superblock = NULL; int result = 0; /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; result = libfsrefs_superblock_initialize( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_superblock_read_data( superblock, io_handle, &( fsrefs_test_superblock_data1[ 48 ] ), 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_superblock_read_data( NULL, io_handle, &( fsrefs_test_superblock_data1[ 48 ] ), 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_superblock_read_data( superblock, NULL, &( fsrefs_test_superblock_data1[ 48 ] ), 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_superblock_read_data( superblock, io_handle, NULL, 16384 - 48, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_superblock_read_data( superblock, io_handle, &( fsrefs_test_superblock_data1[ 48 ] ), (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_superblock_read_data( superblock, io_handle, &( fsrefs_test_superblock_data1[ 48 ] ), 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: Test error case where data is invalid */ /* Clean up */ result = libfsrefs_superblock_free( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 4096; io_handle->major_format_version = 3; result = libfsrefs_superblock_initialize( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_superblock_read_data( superblock, io_handle, &( fsrefs_test_superblock_data2[ 80 ] ), 4096 - 80, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up */ result = libfsrefs_superblock_free( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( superblock != NULL ) { libfsrefs_superblock_free( &superblock, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } /* Tests the libfsrefs_superblock_read_file_io_handle function * Returns 1 if successful or 0 if not */ int fsrefs_test_superblock_read_file_io_handle( void ) { libbfio_handle_t *file_io_handle = NULL; libcerror_error_t *error = NULL; libfsrefs_io_handle_t *io_handle = NULL; libfsrefs_superblock_t *superblock = NULL; int result = 0; /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 16384; io_handle->major_format_version = 1; FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_superblock_initialize( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize file IO handle */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_superblock_data1, 16384, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_superblock_read_file_io_handle( superblock, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_superblock_read_file_io_handle( NULL, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_superblock_read_file_io_handle( superblock, NULL, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_superblock_read_file_io_handle( superblock, io_handle, NULL, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_superblock_read_file_io_handle( superblock, io_handle, file_io_handle, -1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up file IO handle */ result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test data too small */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_superblock_data1, 8, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_superblock_read_file_io_handle( superblock, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test data invalid */ /* TODO */ /* Clean up */ result = libfsrefs_superblock_free( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize test */ result = libfsrefs_io_handle_initialize( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "io_handle", io_handle ); io_handle->metadata_block_size = 4096; io_handle->major_format_version = 3; FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_superblock_initialize( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize file IO handle */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_superblock_data2, 4096, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_superblock_read_file_io_handle( superblock, io_handle, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up file IO handle */ result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up */ result = libfsrefs_superblock_free( &superblock, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "superblock", superblock ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_io_handle_free( &io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "io_handle", io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } if( superblock != NULL ) { libfsrefs_superblock_free( &superblock, NULL ); } if( io_handle != NULL ) { libfsrefs_io_handle_free( &io_handle, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_superblock_initialize", fsrefs_test_superblock_initialize ); FSREFS_TEST_RUN( "libfsrefs_superblock_free", fsrefs_test_superblock_free ); FSREFS_TEST_RUN( "libfsrefs_superblock_read_data", fsrefs_test_superblock_read_data ); FSREFS_TEST_RUN( "libfsrefs_superblock_read_file_io_handle", fsrefs_test_superblock_read_file_io_handle ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_support.c ================================================ /* * Library support functions test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_functions.h" #include "fsrefs_test_getopt.h" #include "fsrefs_test_libbfio.h" #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #if !defined( LIBFSREFS_HAVE_BFIO ) LIBFSREFS_EXTERN \ int libfsrefs_check_volume_signature_file_io_handle( libbfio_handle_t *file_io_handle, libcerror_error_t **error ); #endif /* !defined( LIBFSREFS_HAVE_BFIO ) */ /* Tests the libfsrefs_get_version function * Returns 1 if successful or 0 if not */ int fsrefs_test_get_version( void ) { const char *version_string = NULL; int result = 0; version_string = libfsrefs_get_version(); result = narrow_string_compare( version_string, LIBFSREFS_VERSION_STRING, 9 ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); return( 1 ); on_error: return( 0 ); } /* Tests the libfsrefs_get_access_flags_read function * Returns 1 if successful or 0 if not */ int fsrefs_test_get_access_flags_read( void ) { int access_flags = 0; access_flags = libfsrefs_get_access_flags_read(); FSREFS_TEST_ASSERT_EQUAL_INT( "access_flags", access_flags, LIBFSREFS_ACCESS_FLAG_READ ); return( 1 ); on_error: return( 0 ); } /* Tests the libfsrefs_get_codepage function * Returns 1 if successful or 0 if not */ int fsrefs_test_get_codepage( void ) { libcerror_error_t *error = NULL; int codepage = 0; int result = 0; result = libfsrefs_get_codepage( &codepage, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_get_codepage( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_set_codepage function * Returns 1 if successful or 0 if not */ int fsrefs_test_set_codepage( void ) { libcerror_error_t *error = NULL; int result = 0; result = libfsrefs_set_codepage( 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_set_codepage( -1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_check_volume_signature function * Returns 1 if successful or 0 if not */ int fsrefs_test_check_volume_signature( const system_character_t *source ) { char narrow_source[ 256 ]; libcerror_error_t *error = NULL; int result = 0; if( source != NULL ) { /* Initialize test */ result = fsrefs_test_get_narrow_source( source, narrow_source, 256, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test check volume signature */ result = libfsrefs_check_volume_signature( narrow_source, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); } /* Test error cases */ result = libfsrefs_check_volume_signature( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_check_volume_signature( "", &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); if( source != NULL ) { #if defined( HAVE_FSREFS_TEST_MEMORY ) /* Test libfsrefs_check_volume_signature with malloc failing in libbfio_file_initialize */ fsrefs_test_malloc_attempts_before_fail = 0; result = libfsrefs_check_volume_signature( narrow_source, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ } return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #if defined( HAVE_WIDE_CHARACTER_TYPE ) /* Tests the libfsrefs_check_volume_signature_wide function * Returns 1 if successful or 0 if not */ int fsrefs_test_check_volume_signature_wide( const system_character_t *source ) { wchar_t wide_source[ 256 ]; libcerror_error_t *error = NULL; int result = 0; if( source != NULL ) { /* Initialize test */ result = fsrefs_test_get_wide_source( source, wide_source, 256, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test check volume signature */ result = libfsrefs_check_volume_signature_wide( wide_source, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); } /* Test error cases */ result = libfsrefs_check_volume_signature_wide( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_check_volume_signature_wide( L"", &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); if( source != NULL ) { #if defined( HAVE_FSREFS_TEST_MEMORY ) /* Test libfsrefs_check_volume_signature_wide with malloc failing in libbfio_file_initialize */ fsrefs_test_malloc_attempts_before_fail = 0; result = libfsrefs_check_volume_signature_wide( wide_source, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ } return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ /* Tests the libfsrefs_check_volume_signature_file_io_handle function * Returns 1 if successful or 0 if not */ int fsrefs_test_check_volume_signature_file_io_handle( const system_character_t *source ) { uint8_t empty_block[ 8192 ]; libbfio_handle_t *file_io_handle = NULL; libcerror_error_t *error = NULL; void *memset_result = NULL; size_t source_length = 0; int result = 0; /* Initialize test */ memset_result = memory_set( empty_block, 0, sizeof( uint8_t ) * 8192 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "memset_result", memset_result ); if( source != NULL ) { /* Initialize test */ result = libbfio_file_initialize( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); source_length = system_string_length( source ); #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libbfio_file_set_name_wide( file_io_handle, source, source_length, &error ); #else result = libbfio_file_set_name( file_io_handle, source, source_length, &error ); #endif FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libbfio_handle_open( file_io_handle, LIBBFIO_OPEN_READ, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test check volume signature */ result = libfsrefs_check_volume_signature_file_io_handle( file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); } /* Test error cases */ result = libfsrefs_check_volume_signature_file_io_handle( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up */ if( source != NULL ) { result = libbfio_handle_close( file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libbfio_handle_free( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); } /* Test check volume signature with data too small */ result = fsrefs_test_open_file_io_handle( &file_io_handle, empty_block, sizeof( uint8_t ) * 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_check_volume_signature_file_io_handle( file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test check volume signature with empty block */ result = fsrefs_test_open_file_io_handle( &file_io_handle, empty_block, sizeof( uint8_t ) * 8192, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_check_volume_signature_file_io_handle( file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } return( 0 ); } /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc, wchar_t * const argv[] ) #else int main( int argc, char * const argv[] ) #endif { libcerror_error_t *error = NULL; system_character_t *option_offset = NULL; system_character_t *source = NULL; system_integer_t option = 0; size_t string_length = 0; off64_t volume_offset = 0; int result = 0; while( ( option = fsrefs_test_getopt( argc, argv, _SYSTEM_STRING( "o:" ) ) ) != (system_integer_t) -1 ) { switch( option ) { case (system_integer_t) '?': default: fprintf( stderr, "Invalid argument: %" PRIs_SYSTEM ".\n", argv[ optind - 1 ] ); return( EXIT_FAILURE ); case (system_integer_t) 'o': option_offset = optarg; break; } } if( optind < argc ) { source = argv[ optind ]; } if( option_offset != NULL ) { string_length = system_string_length( option_offset ); result = fsrefs_test_system_string_copy_from_64_bit_in_decimal( option_offset, string_length + 1, (uint64_t *) &volume_offset, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); } FSREFS_TEST_RUN( "libfsrefs_get_version", fsrefs_test_get_version ); FSREFS_TEST_RUN( "libfsrefs_get_access_flags_read", fsrefs_test_get_access_flags_read ); FSREFS_TEST_RUN( "libfsrefs_get_codepage", fsrefs_test_get_codepage ); FSREFS_TEST_RUN( "libfsrefs_set_codepage", fsrefs_test_set_codepage ); #if !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) if( ( source != NULL ) && ( volume_offset == 0 ) ) { FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_check_volume_signature", fsrefs_test_check_volume_signature, source ); #if defined( HAVE_WIDE_CHARACTER_TYPE ) FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_check_volume_signature_wide", fsrefs_test_check_volume_signature_wide, source ); #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_check_volume_signature_file_io_handle", fsrefs_test_check_volume_signature_file_io_handle, source ); } #endif /* !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) */ return( EXIT_SUCCESS ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_tools_info_handle.c ================================================ /* * Tools info_handle type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../fsrefstools/info_handle.h" /* Tests the info_handle_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_tools_info_handle_initialize( void ) { info_handle_t *info_handle = NULL; libcerror_error_t *error = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = info_handle_initialize( &info_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "info_handle", info_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = info_handle_free( &info_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "info_handle", info_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = info_handle_initialize( NULL, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); info_handle = (info_handle_t *) 0x12345678UL; result = info_handle_initialize( &info_handle, 0, &error ); info_handle = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test info_handle_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = info_handle_initialize( &info_handle, 0, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( info_handle != NULL ) { info_handle_free( &info_handle, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "info_handle", info_handle ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test info_handle_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = info_handle_initialize( &info_handle, 0, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( info_handle != NULL ) { info_handle_free( &info_handle, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "info_handle", info_handle ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( info_handle != NULL ) { info_handle_free( &info_handle, NULL ); } return( 0 ); } /* Tests the info_handle_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_tools_info_handle_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = info_handle_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) FSREFS_TEST_RUN( "info_handle_initialize", fsrefs_test_tools_info_handle_initialize ); FSREFS_TEST_RUN( "info_handle_free", fsrefs_test_tools_info_handle_free ); return( EXIT_SUCCESS ); on_error: return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_tools_output.c ================================================ /* * Tools output functions test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #if defined( HAVE_IO_H ) || defined( WINAPI ) #include #endif #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_unused.h" #include "../fsrefstools/fsrefstools_output.h" /* Tests the fsrefstools_output_initialize and function * Returns 1 if successful or 0 if not */ int fsrefs_test_tools_output_initialize( void ) { libcerror_error_t *error = NULL; int result = 0; result = fsrefstools_output_initialize( _IONBF, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) FSREFS_TEST_RUN( "fsrefstools_output_initialize", fsrefs_test_tools_output_initialize ) /* TODO add tests for fsrefstools_output_copyright_fprint */ /* TODO add tests for fsrefstools_output_version_fprint */ /* TODO add tests for fsrefstools_output_version_detailed_fprint */ return( EXIT_SUCCESS ); on_error: return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_tools_signal.c ================================================ /* * Tools signal functions test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_unused.h" #include "../fsrefstools/fsrefstools_signal.h" void fsrefs_test_tools_signal_handler_function( fsrefstools_signal_t signal FSREFS_TEST_ATTRIBUTE_UNUSED ) { FSREFS_TEST_UNREFERENCED_PARAMETER( signal ) } #if defined( WINAPI ) /* Tests the fsrefstools_signal_handler function * Returns 1 if successful or 0 if not */ int fsrefs_test_tools_signal_handler( void ) { BOOL result = 0; /* Test regular cases */ result = fsrefstools_signal_handler( CTRL_C_EVENT ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, (int) TRUE ); result = fsrefstools_signal_handler( CTRL_LOGOFF_EVENT ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, (int) FALSE ); return( 1 ); on_error: return( 0 ); } #if defined( _MSC_VER ) /* TODO add tests for fsrefstools_signal_initialize_memory_debug */ #endif /* defined( _MSC_VER ) */ #endif /* defined( WINAPI ) */ /* Tests the fsrefstools_signal_attach function * Returns 1 if successful or 0 if not */ int fsrefs_test_tools_signal_attach( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test regular cases */ result = fsrefstools_signal_attach( fsrefs_test_tools_signal_handler_function, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = fsrefstools_signal_attach( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the fsrefstools_signal_detach function * Returns 1 if successful or 0 if not */ int fsrefs_test_tools_signal_detach( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test regular cases */ result = fsrefstools_signal_detach( &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( WINAPI ) FSREFS_TEST_RUN( "fsrefstools_signal_handler", fsrefs_test_tools_signal_handler ) #if defined( _MSC_VER ) /* TODO add tests for fsrefstools_signal_initialize_memory_debug */ #endif /* defined( _MSC_VER ) */ #endif /* defined( WINAPI ) */ FSREFS_TEST_RUN( "fsrefstools_signal_attach", fsrefs_test_tools_signal_attach ) FSREFS_TEST_RUN( "fsrefstools_signal_detach", fsrefs_test_tools_signal_detach ) return( EXIT_SUCCESS ); on_error: return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_tree_header.c ================================================ /* * Library tree_header type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_tree_header.h" uint8_t fsrefs_test_tree_header_data1[ 40 ] = { 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe0, 0x00, 0x00, 0x30, 0xe0, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_tree_header_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_tree_header_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_tree_header_t *tree_header = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_tree_header_initialize( &tree_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "tree_header", tree_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_tree_header_free( &tree_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "tree_header", tree_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_tree_header_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); tree_header = (libfsrefs_tree_header_t *) 0x12345678UL; result = libfsrefs_tree_header_initialize( &tree_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); tree_header = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_tree_header_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_tree_header_initialize( &tree_header, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( tree_header != NULL ) { libfsrefs_tree_header_free( &tree_header, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "tree_header", tree_header ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_tree_header_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_tree_header_initialize( &tree_header, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( tree_header != NULL ) { libfsrefs_tree_header_free( &tree_header, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "tree_header", tree_header ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( tree_header != NULL ) { libfsrefs_tree_header_free( &tree_header, NULL ); } return( 0 ); } /* Tests the libfsrefs_tree_header_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_tree_header_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_tree_header_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_tree_header_read_data function * Returns 1 if successful or 0 if not */ int fsrefs_test_tree_header_read_data( void ) { libcerror_error_t *error = NULL; libfsrefs_tree_header_t *tree_header = NULL; int result = 0; /* Initialize test */ result = libfsrefs_tree_header_initialize( &tree_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "tree_header", tree_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_tree_header_read_data( tree_header, fsrefs_test_tree_header_data1, 40, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_tree_header_read_data( NULL, fsrefs_test_tree_header_data1, 40, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_tree_header_read_data( tree_header, NULL, 40, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_tree_header_read_data( tree_header, fsrefs_test_tree_header_data1, (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_tree_header_read_data( tree_header, fsrefs_test_tree_header_data1, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* TODO: Test error case where data is invalid */ /* Clean up */ result = libfsrefs_tree_header_free( &tree_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "tree_header", tree_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( tree_header != NULL ) { libfsrefs_tree_header_free( &tree_header, NULL ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_tree_header_initialize", fsrefs_test_tree_header_initialize ); FSREFS_TEST_RUN( "libfsrefs_tree_header_free", fsrefs_test_tree_header_free ); FSREFS_TEST_RUN( "libfsrefs_tree_header_read_data", fsrefs_test_tree_header_read_data ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) on_error: return( EXIT_FAILURE ); #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ } ================================================ FILE: tests/fsrefs_test_unused.h ================================================ /* * Definitions to silence compiler warnings about unused function attributes/parameters. * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #if !defined( _FSREFS_TEST_UNUSED_H ) #define _FSREFS_TEST_UNUSED_H #include #if !defined( FSREFS_TEST_ATTRIBUTE_UNUSED ) #if defined( __GNUC__ ) && __GNUC__ >= 3 #define FSREFS_TEST_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) #else #define FSREFS_TEST_ATTRIBUTE_UNUSED #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ #endif /* !defined( FSREFS_TEST_ATTRIBUTE_UNUSED ) */ #if defined( _MSC_VER ) #define FSREFS_TEST_UNREFERENCED_PARAMETER( parameter ) \ UNREFERENCED_PARAMETER( parameter ); #else #define FSREFS_TEST_UNREFERENCED_PARAMETER( parameter ) \ /* parameter */ #endif /* defined( _MSC_VER ) */ #endif /* !defined( _FSREFS_TEST_UNUSED_H ) */ ================================================ FILE: tests/fsrefs_test_volume.c ================================================ /* * Library volume type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_getopt.h" #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libclocale.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_libuna.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) && SIZEOF_WCHAR_T != 2 && SIZEOF_WCHAR_T != 4 #error Unsupported size of wchar_t #endif /* Define to make fsrefs_test_volume generate verbose output #define FSREFS_TEST_VOLUME_VERBOSE */ /* Retrieves source as a narrow string * Returns 1 if successful or -1 on error */ int fsrefs_test_volume_get_narrow_source( const system_character_t *source, char *narrow_string, size_t narrow_string_size, libcerror_error_t **error ) { static char *function = "fsrefs_test_volume_get_narrow_source"; size_t narrow_source_size = 0; size_t source_length = 0; #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int result = 0; #endif if( source == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid source.", function ); return( -1 ); } if( narrow_string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid narrow string.", function ); return( -1 ); } if( narrow_string_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid narrow string size value exceeds maximum.", function ); return( -1 ); } source_length = system_string_length( source ); if( source_length > (size_t) ( SSIZE_MAX - 1 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid source length value out of bounds.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf8_string_size_from_utf32( (libuna_utf32_character_t *) source, source_length + 1, &narrow_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf8_string_size_from_utf16( (libuna_utf16_character_t *) source, source_length + 1, &narrow_source_size, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_byte_stream_size_from_utf32( (libuna_utf32_character_t *) source, source_length + 1, libclocale_codepage, &narrow_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_byte_stream_size_from_utf16( (libuna_utf16_character_t *) source, source_length + 1, libclocale_codepage, &narrow_source_size, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to determine narrow string size.", function ); return( -1 ); } #else narrow_source_size = source_length + 1; #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ if( narrow_string_size < narrow_source_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, "%s: narrow string too small.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf8_string_copy_from_utf32( (libuna_utf8_character_t *) narrow_string, narrow_string_size, (libuna_utf32_character_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf8_string_copy_from_utf16( (libuna_utf8_character_t *) narrow_string, narrow_string_size, (libuna_utf16_character_t *) source, source_length + 1, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_byte_stream_copy_from_utf32( (uint8_t *) narrow_string, narrow_string_size, libclocale_codepage, (libuna_utf32_character_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_byte_stream_copy_from_utf16( (uint8_t *) narrow_string, narrow_string_size, libclocale_codepage, (libuna_utf16_character_t *) source, source_length + 1, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to set narrow string.", function ); return( -1 ); } #else if( system_string_copy( narrow_string, source, source_length ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to set narrow string.", function ); return( -1 ); } narrow_string[ source_length ] = 0; #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ return( 1 ); } #if defined( HAVE_WIDE_CHARACTER_TYPE ) /* Retrieves source as a wide string * Returns 1 if successful or -1 on error */ int fsrefs_test_volume_get_wide_source( const system_character_t *source, wchar_t *wide_string, size_t wide_string_size, libcerror_error_t **error ) { static char *function = "fsrefs_test_volume_get_wide_source"; size_t source_length = 0; size_t wide_source_size = 0; #if !defined( HAVE_WIDE_SYSTEM_CHARACTER ) int result = 0; #endif if( source == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid source.", function ); return( -1 ); } if( wide_string == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid wide string.", function ); return( -1 ); } if( wide_string_size > (size_t) SSIZE_MAX ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, "%s: invalid wide string size value exceeds maximum.", function ); return( -1 ); } source_length = system_string_length( source ); if( source_length > (size_t) ( SSIZE_MAX - 1 ) ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS, "%s: invalid source length value out of bounds.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) wide_source_size = source_length + 1; #else if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_size_from_utf8( (libuna_utf8_character_t *) source, source_length + 1, &wide_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_size_from_utf8( (libuna_utf8_character_t *) source, source_length + 1, &wide_source_size, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_size_from_byte_stream( (uint8_t *) source, source_length + 1, libclocale_codepage, &wide_source_size, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_size_from_byte_stream( (uint8_t *) source, source_length + 1, libclocale_codepage, &wide_source_size, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to determine wide string size.", function ); return( -1 ); } #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ if( wide_string_size < wide_source_size ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_VALUE_TOO_SMALL, "%s: wide string too small.", function ); return( -1 ); } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) if( system_string_copy( wide_string, source, source_length ) == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_MEMORY, LIBCERROR_MEMORY_ERROR_COPY_FAILED, "%s: unable to set wide string.", function ); return( -1 ); } wide_string[ source_length ] = 0; #else if( libclocale_codepage == 0 ) { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_copy_from_utf8( (libuna_utf32_character_t *) wide_string, wide_string_size, (libuna_utf8_character_t *) source, source_length + 1, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_copy_from_utf8( (libuna_utf16_character_t *) wide_string, wide_string_size, (libuna_utf8_character_t *) source, source_length + 1, error ); #endif } else { #if SIZEOF_WCHAR_T == 4 result = libuna_utf32_string_copy_from_byte_stream( (libuna_utf32_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, libclocale_codepage, error ); #elif SIZEOF_WCHAR_T == 2 result = libuna_utf16_string_copy_from_byte_stream( (libuna_utf16_character_t *) wide_string, wide_string_size, (uint8_t *) source, source_length + 1, libclocale_codepage, error ); #endif } if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_CONVERSION, LIBCERROR_CONVERSION_ERROR_GENERIC, "%s: unable to set wide string.", function ); return( -1 ); } #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */ return( 1 ); } #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ /* Creates and opens a source volume * Returns 1 if successful or -1 on error */ int fsrefs_test_volume_open_source( libfsrefs_volume_t **volume, const system_character_t *source, libcerror_error_t **error ) { static char *function = "fsrefs_test_volume_open_source"; int result = 0; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } if( source == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid source.", function ); return( -1 ); } if( libfsrefs_volume_initialize( volume, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED, "%s: unable to initialize volume.", function ); goto on_error; } #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libfsrefs_volume_open_wide( *volume, source, LIBFSREFS_OPEN_READ, error ); #else result = libfsrefs_volume_open( *volume, source, LIBFSREFS_OPEN_READ, error ); #endif if( result != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_OPEN_FAILED, "%s: unable to open volume.", function ); goto on_error; } return( 1 ); on_error: if( *volume != NULL ) { libfsrefs_volume_free( volume, NULL ); } return( -1 ); } /* Closes and frees a source volume * Returns 1 if successful or -1 on error */ int fsrefs_test_volume_close_source( libfsrefs_volume_t **volume, libcerror_error_t **error ) { static char *function = "fsrefs_test_volume_close_source"; int result = 0; if( volume == NULL ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_ARGUMENTS, LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, "%s: invalid volume.", function ); return( -1 ); } if( libfsrefs_volume_close( *volume, error ) != 0 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_IO, LIBCERROR_IO_ERROR_CLOSE_FAILED, "%s: unable to close volume.", function ); result = -1; } if( libfsrefs_volume_free( volume, error ) != 1 ) { libcerror_error_set( error, LIBCERROR_ERROR_DOMAIN_RUNTIME, LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED, "%s: unable to free volume.", function ); result = -1; } return( result ); } /* Tests the libfsrefs_volume_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_volume_t *volume = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_volume_initialize( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_volume_free( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_volume_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); volume = (libfsrefs_volume_t *) 0x12345678UL; result = libfsrefs_volume_initialize( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); volume = NULL; #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_volume_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_volume_initialize( &volume, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( volume != NULL ) { libfsrefs_volume_free( &volume, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_volume_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_volume_initialize( &volume, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( volume != NULL ) { libfsrefs_volume_free( &volume, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( volume != NULL ) { libfsrefs_volume_free( &volume, NULL ); } return( 0 ); } /* Tests the libfsrefs_volume_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_volume_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_volume_open function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_open( const system_character_t *source ) { char narrow_source[ 256 ]; libcerror_error_t *error = NULL; libfsrefs_volume_t *volume = NULL; int result = 0; /* Initialize test */ result = fsrefs_test_volume_get_narrow_source( source, narrow_source, 256, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_volume_initialize( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test open */ result = libfsrefs_volume_open( volume, narrow_source, LIBFSREFS_OPEN_READ, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_volume_open( volume, narrow_source, LIBFSREFS_OPEN_READ, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up */ result = libfsrefs_volume_free( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( volume != NULL ) { libfsrefs_volume_free( &volume, NULL ); } return( 0 ); } #if defined( HAVE_WIDE_CHARACTER_TYPE ) /* Tests the libfsrefs_volume_open_wide function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_open_wide( const system_character_t *source ) { wchar_t wide_source[ 256 ]; libcerror_error_t *error = NULL; libfsrefs_volume_t *volume = NULL; int result = 0; /* Initialize test */ result = fsrefs_test_volume_get_wide_source( source, wide_source, 256, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_volume_initialize( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test open */ result = libfsrefs_volume_open_wide( volume, wide_source, LIBFSREFS_OPEN_READ, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_volume_open_wide( volume, wide_source, LIBFSREFS_OPEN_READ, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up */ result = libfsrefs_volume_free( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( volume != NULL ) { libfsrefs_volume_free( &volume, NULL ); } return( 0 ); } #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ /* Tests the libfsrefs_volume_close function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_close( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_volume_close( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_volume_open and libfsrefs_volume_close functions * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_open_close( const system_character_t *source ) { libcerror_error_t *error = NULL; libfsrefs_volume_t *volume = NULL; int result = 0; /* Initialize test */ result = libfsrefs_volume_initialize( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test open and close */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libfsrefs_volume_open_wide( volume, source, LIBFSREFS_OPEN_READ, &error ); #else result = libfsrefs_volume_open( volume, source, LIBFSREFS_OPEN_READ, &error ); #endif FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_volume_close( volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test open and close a second time to validate clean up on close */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) result = libfsrefs_volume_open_wide( volume, source, LIBFSREFS_OPEN_READ, &error ); #else result = libfsrefs_volume_open( volume, source, LIBFSREFS_OPEN_READ, &error ); #endif FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_volume_close( volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up */ result = libfsrefs_volume_free( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( volume != NULL ) { libfsrefs_volume_free( &volume, NULL ); } return( 0 ); } /* Tests the libfsrefs_volume_signal_abort function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_signal_abort( libfsrefs_volume_t *volume ) { libcerror_error_t *error = NULL; int result = 0; /* Test regular cases */ result = libfsrefs_volume_signal_abort( volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_volume_signal_abort( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_volume_get_utf8_name_size function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_get_utf8_name_size( libfsrefs_volume_t *volume ) { libcerror_error_t *error = NULL; size_t utf8_name_size = 0; int result = 0; int utf8_name_size_is_set = 0; /* Test regular cases */ result = libfsrefs_volume_get_utf8_name_size( volume, &utf8_name_size, &error ); FSREFS_TEST_ASSERT_NOT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); utf8_name_size_is_set = result; /* Test error cases */ result = libfsrefs_volume_get_utf8_name_size( NULL, &utf8_name_size, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); if( utf8_name_size_is_set != 0 ) { result = libfsrefs_volume_get_utf8_name_size( volume, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_volume_get_utf8_name function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_get_utf8_name( libfsrefs_volume_t *volume ) { uint8_t utf8_name[ 512 ]; libcerror_error_t *error = NULL; int result = 0; int utf8_name_is_set = 0; /* Test regular cases */ result = libfsrefs_volume_get_utf8_name( volume, utf8_name, 512, &error ); FSREFS_TEST_ASSERT_NOT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); utf8_name_is_set = result; /* Test error cases */ result = libfsrefs_volume_get_utf8_name( NULL, utf8_name, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); if( utf8_name_is_set != 0 ) { result = libfsrefs_volume_get_utf8_name( volume, NULL, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_get_utf8_name( volume, utf8_name, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_get_utf8_name( volume, utf8_name, (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_volume_get_utf16_name_size function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_get_utf16_name_size( libfsrefs_volume_t *volume ) { libcerror_error_t *error = NULL; size_t utf16_name_size = 0; int result = 0; int utf16_name_size_is_set = 0; /* Test regular cases */ result = libfsrefs_volume_get_utf16_name_size( volume, &utf16_name_size, &error ); FSREFS_TEST_ASSERT_NOT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); utf16_name_size_is_set = result; /* Test error cases */ result = libfsrefs_volume_get_utf16_name_size( NULL, &utf16_name_size, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); if( utf16_name_size_is_set != 0 ) { result = libfsrefs_volume_get_utf16_name_size( volume, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_volume_get_utf16_name function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_get_utf16_name( libfsrefs_volume_t *volume ) { uint16_t utf16_name[ 512 ]; libcerror_error_t *error = NULL; int result = 0; int utf16_name_is_set = 0; /* Test regular cases */ result = libfsrefs_volume_get_utf16_name( volume, utf16_name, 512, &error ); FSREFS_TEST_ASSERT_NOT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); utf16_name_is_set = result; /* Test error cases */ result = libfsrefs_volume_get_utf16_name( NULL, utf16_name, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); if( utf16_name_is_set != 0 ) { result = libfsrefs_volume_get_utf16_name( volume, NULL, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_get_utf16_name( volume, utf16_name, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_get_utf16_name( volume, utf16_name, (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc, wchar_t * const argv[] ) #else int main( int argc, char * const argv[] ) #endif { libcerror_error_t *error = NULL; libfsrefs_volume_t *volume = NULL; system_character_t *source = NULL; system_integer_t option = 0; int result = 0; while( ( option = fsrefs_test_getopt( argc, argv, _SYSTEM_STRING( "" ) ) ) != (system_integer_t) -1 ) { switch( option ) { case (system_integer_t) '?': default: fprintf( stderr, "Invalid argument: %" PRIs_SYSTEM ".\n", argv[ optind - 1 ] ); return( EXIT_FAILURE ); } } if( optind < argc ) { source = argv[ optind ]; } #if defined( HAVE_DEBUG_OUTPUT ) && defined( FSREFS_TEST_VOLUME_VERBOSE ) libfsrefs_notify_set_verbose( 1 ); libfsrefs_notify_set_stream( stderr, NULL ); #endif FSREFS_TEST_RUN( "libfsrefs_volume_initialize", fsrefs_test_volume_initialize ); FSREFS_TEST_RUN( "libfsrefs_volume_free", fsrefs_test_volume_free ); #if !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) if( source != NULL ) { FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_open", fsrefs_test_volume_open, source ); #if defined( HAVE_WIDE_CHARACTER_TYPE ) FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_open_wide", fsrefs_test_volume_open_wide, source ); #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ #if defined( LIBFSREFS_HAVE_BFIO ) /* TODO add test for libfsrefs_volume_open_file_io_handle */ #endif /* defined( LIBFSREFS_HAVE_BFIO ) */ FSREFS_TEST_RUN( "libfsrefs_volume_close", fsrefs_test_volume_close ); FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_open_close", fsrefs_test_volume_open_close, source ); /* Initialize test */ result = fsrefs_test_volume_open_source( &volume, source, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_signal_abort", fsrefs_test_volume_signal_abort, volume ); #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* TODO: add tests for libfsrefs_volume_open_read */ #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_get_utf8_name_size", fsrefs_test_volume_get_utf8_name_size, volume ); FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_get_utf8_name", fsrefs_test_volume_get_utf8_name, volume ); FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_get_utf16_name_size", fsrefs_test_volume_get_utf16_name_size, volume ); FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_get_utf16_name", fsrefs_test_volume_get_utf16_name, volume ); /* Clean up */ result = fsrefs_test_volume_close_source( &volume, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "volume", volume ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); } #endif /* !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) */ return( EXIT_SUCCESS ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( volume != NULL ) { fsrefs_test_volume_close_source( &volume, NULL ); } return( EXIT_FAILURE ); } ================================================ FILE: tests/fsrefs_test_volume_header.c ================================================ /* * Library volume_header type test program * * Copyright (C) 2012-2025, Joachim Metz * * Refer to AUTHORS for acknowledgements. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ #include #include #include #include #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) #include #endif #include "fsrefs_test_functions.h" #include "fsrefs_test_libbfio.h" #include "fsrefs_test_libcerror.h" #include "fsrefs_test_libfsrefs.h" #include "fsrefs_test_macros.h" #include "fsrefs_test_memory.h" #include "fsrefs_test_unused.h" #include "../libfsrefs/libfsrefs_volume_header.h" uint8_t fsrefs_test_volume_header_data1[ 512 ] = { 0x00, 0x00, 0x00, 0x52, 0x65, 0x46, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x53, 0x52, 0x53, 0x00, 0x02, 0x07, 0x34, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdd, 0x45, 0x64, 0x20, 0x65, 0x64, 0x20, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) /* Tests the libfsrefs_volume_header_initialize function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_header_initialize( void ) { libcerror_error_t *error = NULL; libfsrefs_volume_header_t *volume_header = NULL; int result = 0; #if defined( HAVE_FSREFS_TEST_MEMORY ) int number_of_malloc_fail_tests = 1; int number_of_memset_fail_tests = 1; int test_number = 0; #endif /* Test regular cases */ result = libfsrefs_volume_header_initialize( &volume_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_volume_header_free( &volume_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_volume_header_initialize( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); volume_header = (libfsrefs_volume_header_t *) 0x12345678UL; result = libfsrefs_volume_header_initialize( &volume_header, &error ); volume_header = NULL; FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); #if defined( HAVE_FSREFS_TEST_MEMORY ) for( test_number = 0; test_number < number_of_malloc_fail_tests; test_number++ ) { /* Test libfsrefs_volume_header_initialize with malloc failing */ fsrefs_test_malloc_attempts_before_fail = test_number; result = libfsrefs_volume_header_initialize( &volume_header, &error ); if( fsrefs_test_malloc_attempts_before_fail != -1 ) { fsrefs_test_malloc_attempts_before_fail = -1; if( volume_header != NULL ) { libfsrefs_volume_header_free( &volume_header, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } for( test_number = 0; test_number < number_of_memset_fail_tests; test_number++ ) { /* Test libfsrefs_volume_header_initialize with memset failing */ fsrefs_test_memset_attempts_before_fail = test_number; result = libfsrefs_volume_header_initialize( &volume_header, &error ); if( fsrefs_test_memset_attempts_before_fail != -1 ) { fsrefs_test_memset_attempts_before_fail = -1; if( volume_header != NULL ) { libfsrefs_volume_header_free( &volume_header, NULL ); } } else { FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); } } #endif /* defined( HAVE_FSREFS_TEST_MEMORY ) */ return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( volume_header != NULL ) { libfsrefs_volume_header_free( &volume_header, NULL ); } return( 0 ); } /* Tests the libfsrefs_volume_header_free function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_header_free( void ) { libcerror_error_t *error = NULL; int result = 0; /* Test error cases */ result = libfsrefs_volume_header_free( NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } /* Tests the libfsrefs_volume_header_read_data function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_header_read_data( void ) { libcerror_error_t *error = NULL; libfsrefs_volume_header_t *volume_header = NULL; int result = 0; /* Initialize test */ result = libfsrefs_volume_header_initialize( &volume_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_volume_header_read_data( volume_header, fsrefs_test_volume_header_data1, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_volume_header_read_data( NULL, fsrefs_test_volume_header_data1, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_header_read_data( volume_header, NULL, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_header_read_data( volume_header, fsrefs_test_volume_header_data1, (size_t) SSIZE_MAX + 1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_header_read_data( volume_header, fsrefs_test_volume_header_data1, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Test error case where signature is invalid */ byte_stream_copy_from_uint64_little_endian( &( fsrefs_test_volume_header_data1[ 3 ] ), 0xffffffffffffffffUL ); result = libfsrefs_volume_header_read_data( volume_header, fsrefs_test_volume_header_data1, 512, &error ); byte_stream_copy_from_uint64_little_endian( &( fsrefs_test_volume_header_data1[ 3 ] ), 0x0000000053466552UL ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Test error case where bytes per sector is invalid */ byte_stream_copy_from_uint16_little_endian( &( fsrefs_test_volume_header_data1[ 32 ] ), 0xffff ); result = libfsrefs_volume_header_read_data( volume_header, fsrefs_test_volume_header_data1, 512, &error ); byte_stream_copy_from_uint16_little_endian( &( fsrefs_test_volume_header_data1[ 32 ] ), 512 ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up */ result = libfsrefs_volume_header_free( &volume_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( volume_header != NULL ) { libfsrefs_volume_header_free( &volume_header, NULL ); } return( 0 ); } /* Tests the libfsrefs_volume_header_read_file_io_handle function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_header_read_file_io_handle( void ) { libbfio_handle_t *file_io_handle = NULL; libcerror_error_t *error = NULL; libfsrefs_volume_header_t *volume_header = NULL; int result = 0; /* Initialize test */ result = libfsrefs_volume_header_initialize( &volume_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Initialize file IO handle */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_volume_header_data1, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test regular cases */ result = libfsrefs_volume_header_read_file_io_handle( volume_header, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_volume_header_read_file_io_handle( NULL, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_header_read_file_io_handle( volume_header, NULL, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_header_read_file_io_handle( volume_header, file_io_handle, -1, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); /* Clean up file IO handle */ result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test data too small */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_volume_header_data1, 8, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_volume_header_read_file_io_handle( volume_header, file_io_handle, 0, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test data invalid */ result = fsrefs_test_open_file_io_handle( &file_io_handle, fsrefs_test_volume_header_data1, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "file_io_handle", file_io_handle ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); byte_stream_copy_from_uint64_little_endian( &( fsrefs_test_volume_header_data1[ 3 ] ), 0xffffffffffffffffUL ); result = libfsrefs_volume_header_read_file_io_handle( volume_header, file_io_handle, 0, &error ); byte_stream_copy_from_uint64_little_endian( &( fsrefs_test_volume_header_data1[ 3 ] ), 0x0000000053466552UL ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = fsrefs_test_close_file_io_handle( &file_io_handle, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 0 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Clean up */ result = libfsrefs_volume_header_free( &volume_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } if( file_io_handle != NULL ) { libbfio_handle_free( &file_io_handle, NULL ); } if( volume_header != NULL ) { libfsrefs_volume_header_free( &volume_header, NULL ); } return( 0 ); } /* Tests the libfsrefs_volume_header_get_volume_size function * Returns 1 if successful or 0 if not */ int fsrefs_test_volume_header_get_volume_size( libfsrefs_volume_header_t *volume_header ) { libcerror_error_t *error = NULL; size64_t volume_size = 0; int result = 0; /* Test regular cases */ result = libfsrefs_volume_header_get_volume_size( volume_header, &volume_size, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_EQUAL_UINT64( "volume_size", (uint64_t) volume_size, (uint64_t) 1006633472 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Test error cases */ result = libfsrefs_volume_header_get_volume_size( NULL, &volume_size, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); result = libfsrefs_volume_header_get_volume_size( volume_header, NULL, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, -1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "error", error ); libcerror_error_free( &error ); return( 1 ); on_error: if( error != NULL ) { libcerror_error_free( &error ); } return( 0 ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ /* The main program */ #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) int wmain( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, wchar_t * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #else int main( int argc FSREFS_TEST_ATTRIBUTE_UNUSED, char * const argv[] FSREFS_TEST_ATTRIBUTE_UNUSED ) #endif { #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) libcerror_error_t *error = NULL; libfsrefs_volume_header_t *volume_header = NULL; int result = 0; #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ FSREFS_TEST_UNREFERENCED_PARAMETER( argc ) FSREFS_TEST_UNREFERENCED_PARAMETER( argv ) #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) FSREFS_TEST_RUN( "libfsrefs_volume_header_initialize", fsrefs_test_volume_header_initialize ); FSREFS_TEST_RUN( "libfsrefs_volume_header_free", fsrefs_test_volume_header_free ); FSREFS_TEST_RUN( "libfsrefs_volume_header_read_data", fsrefs_test_volume_header_read_data ); FSREFS_TEST_RUN( "libfsrefs_volume_header_read_file_io_handle", fsrefs_test_volume_header_read_file_io_handle ); #if !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) /* Initialize test */ result = libfsrefs_volume_header_initialize( &volume_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NOT_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); result = libfsrefs_volume_header_read_data( volume_header, fsrefs_test_volume_header_data1, 512, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); /* Run tests */ FSREFS_TEST_RUN_WITH_ARGS( "libfsrefs_volume_header_get_volume_size", fsrefs_test_volume_header_get_volume_size, volume_header ); /* Clean up */ result = libfsrefs_volume_header_free( &volume_header, &error ); FSREFS_TEST_ASSERT_EQUAL_INT( "result", result, 1 ); FSREFS_TEST_ASSERT_IS_NULL( "volume_header", volume_header ); FSREFS_TEST_ASSERT_IS_NULL( "error", error ); #endif /* !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) */ #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_SUCCESS ); on_error: #if defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) if( error != NULL ) { libcerror_error_free( &error ); } if( volume_header != NULL ) { libfsrefs_volume_header_free( &volume_header, NULL ); } #endif /* defined( __GNUC__ ) && !defined( LIBFSREFS_DLL_IMPORT ) */ return( EXIT_FAILURE ); } ================================================ FILE: tests/lsan.suppressions ================================================ leak:/lib*/libpython* ================================================ FILE: tests/pkgbuild.sh ================================================ #!/bin/sh # Script to build a MacOS pkg # # Version: 20241015 set -e make install DESTDIR=${PWD}/osx-pkg mkdir -p ${PWD}/osx-pkg/usr/share/doc/libfsrefs cp AUTHORS COPYING COPYING.LESSER NEWS README ${PWD}/osx-pkg/usr/share/doc/libfsrefs VERSION=`sed '5!d; s/^ \[//;s/\],$//' configure.ac` pkgbuild --root osx-pkg --identifier com.github.libyal.libfsrefs --version ${VERSION} --ownership recommended ../libfsrefs-${VERSION}.pkg ================================================ FILE: tests/runtests.sh ================================================ #!/bin/sh # Script to run tests # # Version: 20201121 if test -f ${PWD}/libfsrefs/.libs/libfsrefs.1.dylib && test -f ./pyfsrefs/.libs/pyfsrefs.so; then install_name_tool -change /usr/local/lib/libfsrefs.1.dylib ${PWD}/libfsrefs/.libs/libfsrefs.1.dylib ./pyfsrefs/.libs/pyfsrefs.so; fi make check CHECK_WITH_STDERR=1; RESULT=$?; if test ${RESULT} -ne 0 && test -f tests/test-suite.log; then cat tests/test-suite.log; fi exit ${RESULT}; ================================================ FILE: tests/syncsharedlibs.sh ================================================ #!/bin/sh # Script that synchronizes the shared library dependencies # # Version: 20201121 EXIT_SUCCESS=0; EXIT_FAILURE=1; GIT_URL_PREFIX="https://github.com/libyal"; SHARED_LIBS="libcerror libcthreads libcdata libclocale libcnotify libcsplit libuna libcfile libcpath libbfio libfcache libfdata libfdatetime libfguid libfwnt"; USE_HEAD=""; if test "$1" = "--use-head"; then USE_HEAD="--use-head"; fi OLDIFS=$IFS; IFS=" "; for SHARED_LIB in ${SHARED_LIBS}; do GIT_URL="${GIT_URL_PREFIX}/${SHARED_LIB}.git"; git clone --quiet ${GIT_URL} ${SHARED_LIB}-$$; if ! test -d ${SHARED_LIB}-$$; then echo "Unable to git clone: ${GIT_URL}"; IFS=$OLDIFS; exit ${EXIT_FAILURE}; fi (cd ${SHARED_LIB}-$$ && git fetch --quiet --all --tags --prune) LATEST_TAG=`cd ${SHARED_LIB}-$$ && git describe --tags --abbrev=0`; if test -n ${LATEST_TAG} && test -z ${USE_HEAD}; then echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} tag ${LATEST_TAG}"; (cd ${SHARED_LIB}-$$ && git checkout --quiet tags/${LATEST_TAG}); else echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} HEAD"; fi (cd ${SHARED_LIB}-$$ && ./synclibs.sh ${USE_HEAD} && ./autogen.sh); CONFIGURE_OPTIONS=""; (cd ${SHARED_LIB}-$$ && ./configure --help | grep -- '--enable-wide-character-type' > /dev/null); if test $? -eq 0; then CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-wide-character-type"; fi (cd ${SHARED_LIB}-$$ && ./configure --prefix=/usr ${CONFIGURE_OPTIONS} && make && sudo make install); rm -rf ${SHARED_LIB}-$$; done IFS=$OLDIFS; exit ${EXIT_SUCCESS}; ================================================ FILE: tests/test_fsrefsinfo.ps1 ================================================ # Info tool testing script # # Version: 20230410 $ExitSuccess = 0 $ExitFailure = 1 $ExitIgnore = 77 $Profiles = @("fsrefsinfo") $OptionsPerProfile = @("") $OptionSets = "offset" $InputGlob = "*" Function GetTestExecutablesDirectory { $TestExecutablesDirectory = "" ForEach (${VSDirectory} in ("msvscpp", "vs2008", "vs2010", "vs2012", "vs2013", "vs2015", "vs2017", "vs2019", "vs2022")) { ForEach (${VSConfiguration} in ("Release", "VSDebug")) { ForEach (${VSPlatform} in ("Win32", "x64")) { $TestExecutablesDirectory = "..\${VSDirectory}\${VSConfiguration}\${VSPlatform}" If (Test-Path ${TestExecutablesDirectory}) { Return ${TestExecutablesDirectory} } } $TestExecutablesDirectory = "..\${VSDirectory}\${VSConfiguration}" If (Test-Path ${TestExecutablesDirectory}) { Return ${TestExecutablesDirectory} } } } Return ${TestExecutablesDirectory} } Function ReadIgnoreList { param( [string]$TestProfileDirectory ) $IgnoreFile = "${TestProfileDirectory}\ignore" $IgnoreList = "" If (Test-Path -Path ${IgnoreFile} -PathType "Leaf") { $IgnoreList = Get-Content -Path ${IgnoreFile} | Where {$_ -notmatch '^#.*'} } Return $IgnoreList } $TestExecutablesDirectory = GetTestExecutablesDirectory If (-Not (Test-Path ${TestExecutablesDirectory})) { Write-Host "Missing test executables directory." -foreground Red Exit ${ExitFailure} } $TestExecutable = "${TestExecutablesDirectory}\fsrefsinfo.exe" If (-Not (Test-Path -Path "input")) { Exit ${ExitIgnore} } $Result = ${ExitSuccess} For ($ProfileIndex = 0; $ProfileIndex -le ($Profiles.length - 1); $ProfileIndex += 1) { $TestProfile = $Profiles[$ProfileIndex] $Options = $OptionsPerProfile[$ProfileIndex] $TestProfileDirectory = "input\.${TestProfile}" If (-Not (Test-Path -Path ${TestProfileDirectory} -PathType "Container")) { New-Item -ItemType "directory" -Path ${TestProfileDirectory} | Out-Null } $IgnoreList = ReadIgnoreList ${TestProfileDirectory} # Note that the trailing backtick is needed. Get-ChildItem -Path "input" -Exclude ".*" | ForEach-Object ` { $TestSetDirectory = $_ If (-Not (Test-Path -Path ${TestSetDirectory} -PathType Container)) { Continue } $TestSetName = ${TestSetDirectory}.Name If (${IgnoreList}.Contains(${TestSetName})) { Continue } If (-Not (Test-Path -Path "${TestProfileDirectory}\${TestSetName}" -PathType Container)) { New-Item -Name "${TestProfileDirectory}\${TestSetName}" -ItemType "directory" | Out-Null } If (Test-Path -Path "${TestProfileDirectory}\${TestSetName}\files" -PathType Container) { $InputFiles = Get-content -Path "${TestProfileDirectory}\${TestSetName}\files" } Else { $InputFiles = Get-ChildItem -Path "${TestSetDirectory}\${InputGlob}" } ForEach ($InputFile in ${InputFiles}) { $InputFileName = ${InputFile}.Name $TestedWithOptions = $False $TmpDir = "tmp${PID}" New-Item -Name ${TmpDir} -ItemType "directory" | Out-Null Push-Location ${TmpDir} Try { ForEach ($OptionSet in ${OptionSets} -split " ") { $TestDataOptionFile = "..\${TestProfileDirectory}\${TestSetName}\${InputFileName}.${OptionSet}" If (-Not (Test-Path -Path "${TestDataOptionFile}" -PathType "Leaf")) { Continue } $InputOptions = Get-content -Path "${TestDataOptionFile}" -First 1 $TestLog = "${InputFileName}-${OptionSet}.log" Invoke-Expression "..\${TestExecutable} ${Options} ${InputOptions} ${InputFile} > ${TestLog}" $Result = $LastExitCode If (${Result} -ne ${ExitSuccess}) { Break } $TestedWithOptions = $True } If ((${Result} -eq ${ExitSuccess}) -And (-Not (${TestedWithOptions}))) { $TestLog = "${InputFileName}.log" Invoke-Expression "..\${TestExecutable} ${Options} ${InputFile} > ${TestLog}" $Result = $LastExitCode } If (${Result} -eq ${ExitSuccess}) { # Strip header with version. (Get-Content ${TestLog} | Select-Object -Skip 2) | Set-Content ${TestLog} $StoredTestLog = "..\${TestProfileDirectory}\${TestSetName}\${TestLog}" If (Test-Path -Path ${StoredTestLog} -PathType "Leaf") { $Difference = Compare-Object -ReferenceObject (Get-Content -Path ${StoredTestLog}) -DifferenceObject (Get-Content -Path ${TestLog}) If (${Difference}) { $Result = ${ExitFailure} } } Else { Move-Item -Path ${TestLog} -Destination ${StoredTestLog} } } } Finally { Pop-Location Remove-Item ${TmpDir} -Force -Recurse } } If (${Result} -ne ${ExitSuccess}) { Break } } } Exit ${Result} ================================================ FILE: tests/test_fsrefsinfo.sh ================================================ #!/usr/bin/env bash # Info tool testing script # # Version: 20240413 EXIT_SUCCESS=0; EXIT_FAILURE=1; EXIT_IGNORE=77; PROFILES=("fsrefsinfo"); OPTIONS_PER_PROFILE=(""); OPTION_SETS=("offset"); INPUT_GLOB="*"; if test -n "${SKIP_TOOLS_TESTS}" || test -n "${SKIP_TOOLS_END_TO_END_TESTS}"; then exit ${EXIT_IGNORE}; fi TEST_EXECUTABLE="../fsrefstools/fsrefsinfo"; if ! test -x "${TEST_EXECUTABLE}"; then TEST_EXECUTABLE="../fsrefstools/fsrefsinfo.exe"; fi if ! test -x "${TEST_EXECUTABLE}"; then echo "Missing test executable: ${TEST_EXECUTABLE}"; exit ${EXIT_FAILURE}; fi TEST_DIRECTORY=`dirname $0`; TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; if ! test -f "${TEST_RUNNER}"; then echo "Missing test runner: ${TEST_RUNNER}"; exit ${EXIT_FAILURE}; fi source ${TEST_RUNNER}; if ! test -d "input"; then echo "Test input directory not found."; exit ${EXIT_IGNORE}; fi RESULT=`ls input/* | tr ' ' '\n' | wc -l`; if test ${RESULT} -eq ${EXIT_SUCCESS}; then echo "No files or directories found in the test input directory"; exit ${EXIT_IGNORE}; fi for PROFILE_INDEX in ${!PROFILES[*]}; do TEST_PROFILE=${PROFILES[${PROFILE_INDEX}]}; TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "input" "${TEST_PROFILE}"); IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}"); IFS=" " read -a PROFILE_OPTIONS <<< ${OPTIONS_PER_PROFILE[${PROFILE_INDEX}]}; RESULT=${EXIT_SUCCESS}; for TEST_SET_INPUT_DIRECTORY in input/*; do if ! test -d "${TEST_SET_INPUT_DIRECTORY}"; then continue; fi TEST_SET=`basename ${TEST_SET_INPUT_DIRECTORY}`; if check_for_test_set_in_ignore_list "${TEST_SET}" "${IGNORE_LIST}"; then continue; fi TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}"); RESULT=${EXIT_SUCCESS}; if test -f "${TEST_SET_DIRECTORY}/files"; then IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"); else IFS="" read -a INPUT_FILES <<< $(ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}); fi for INPUT_FILE in "${INPUT_FILES[@]}"; do TESTED_WITH_OPTIONS=0; for OPTION_SET in ${OPTION_SETS[@]}; do TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); if test -f ${TEST_DATA_OPTION_FILE}; then TESTED_WITH_OPTIONS=1; IFS=" " read -a OPTIONS <<< $(read_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); run_test_on_input_file "${TEST_SET_DIRECTORY}" "fsrefsinfo" "with_stdout_reference" "${OPTION_SET}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${PROFILE_OPTIONS[@]}" "${OPTIONS[@]}"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi fi done if test ${TESTED_WITH_OPTIONS} -eq 0; then run_test_on_input_file "${TEST_SET_DIRECTORY}" "fsrefsinfo" "with_stdout_reference" "" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${PROFILE_OPTIONS[@]}"; RESULT=$?; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done # Ignore failures due to corrupted data. if test "${TEST_SET}" = "corrupted"; then RESULT=${EXIT_SUCCESS}; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done done exit ${RESULT}; ================================================ FILE: tests/test_library.ps1 ================================================ # Tests library functions and types. # # Version: 20230410 $ExitSuccess = 0 $ExitFailure = 1 $ExitIgnore = 77 $LibraryTests = "attribute_values block_descriptor block_reference block_tree block_tree_node checkpoint data_run directory_entry directory_object error file_entry file_system io_handle metadata_block_header ministore_node node_header node_record notify objects_tree superblock tree_header volume_header" $LibraryTestsWithInput = "support volume" $OptionSets = "offset" $InputGlob = "*" Function GetTestExecutablesDirectory { $TestExecutablesDirectory = "" ForEach (${VSDirectory} in ("msvscpp", "vs2008", "vs2010", "vs2012", "vs2013", "vs2015", "vs2017", "vs2019", "vs2022")) { ForEach (${VSConfiguration} in ("Release", "VSDebug")) { ForEach (${VSPlatform} in ("Win32", "x64")) { $TestExecutablesDirectory = "..\${VSDirectory}\${VSConfiguration}\${VSPlatform}" If (Test-Path ${TestExecutablesDirectory}) { Return ${TestExecutablesDirectory} } } $TestExecutablesDirectory = "..\${VSDirectory}\${VSConfiguration}" If (Test-Path ${TestExecutablesDirectory}) { Return ${TestExecutablesDirectory} } } } Return ${TestExecutablesDirectory} } Function ReadIgnoreList { param( [string]$TestProfileDirectory ) $IgnoreFile = "${TestProfileDirectory}\ignore" $IgnoreList = "" If (Test-Path -Path ${IgnoreFile} -PathType "Leaf") { $IgnoreList = Get-Content -Path ${IgnoreFile} | Where {$_ -notmatch '^#.*'} } Return $IgnoreList } Function RunTest { param( [string]$TestType ) $TestDescription = "Testing: ${TestName}" $TestExecutable = "${TestExecutablesDirectory}\fsrefs_test_${TestName}.exe" If (-Not (Test-Path -Path ${TestExecutable} -PathType "Leaf")) { Write-Host "${TestDescription} (" -nonewline Write-Host "SKIP" -foreground Cyan -nonewline Write-Host ")" Return ${ExitIgnore} } $Output = Invoke-Expression ${TestExecutable} $Result = ${LastExitCode} If (${Result} -ne ${ExitSuccess}) { Write-Host ${Output} -foreground Red } Write-Host "${TestDescription} (" -nonewline If (${Result} -ne ${ExitSuccess}) { Write-Host "FAIL" -foreground Red -nonewline } Else { Write-Host "PASS" -foreground Green -nonewline } Write-Host ")" Return ${Result} } Function RunTestWithInput { param( [string]$TestType ) $TestDescription = "Testing: ${TestName}" $TestExecutable = "${TestExecutablesDirectory}\fsrefs_test_${TestName}.exe" If (-Not (Test-Path -Path ${TestExecutable} -PathType "Leaf")) { Write-Host "${TestDescription} (" -nonewline Write-Host "SKIP" -foreground Cyan -nonewline Write-Host ")" Return ${ExitIgnore} } $TestProfileDirectory = "input\.libfsrefs" If (-Not (Test-Path -Path ${TestProfileDirectory} -PathType "Container")) { New-Item -ItemType "directory" -Path ${TestProfileDirectory} } $IgnoreList = ReadIgnoreList ${TestProfileDirectory} $Result = ${ExitSuccess} ForEach ($TestSetInputDirectory in Get-ChildItem -Path "input" -Exclude ".*") { If (-Not (Test-Path -Path ${TestSetInputDirectory} -PathType "Container")) { Continue } If (${TestSetInputDirectory} -Contains ${IgnoreList}) { Continue } $TestSetName = ${TestSetInputDirectory}.Name If (Test-Path -Path "${TestProfileDirectory}\${TestSetName}\files" -PathType "Leaf") { $InputFiles = Get-Content -Path "${TestProfileDirectory}\${TestSetName}\files" | Where {$_ -ne ""} } Else { $InputFiles = Get-ChildItem -Path ${TestSetInputDirectory} -Include ${InputGlob} } ForEach ($InputFile in ${InputFiles}) { $TestedWithOptions = $False ForEach ($OptionSet in ${OptionSets} -split " ") { $InputFileName = ${InputFile}.Name $TestDataOptionFile = "${TestProfileDirectory}\${TestSetName}\${InputFileName}.${OptionSet}" If (-Not (Test-Path -Path "${TestDataOptionFile}" -PathType "Leaf")) { Continue } $InputOptions = Get-content -Path "${TestDataOptionFile}" -First 1 $Output = Invoke-Expression "${TestExecutable} ${InputOptions} ${InputFile}" $Result = $LastExitCode If (${Result} -ne ${ExitSuccess}) { Break } $TestedWithOptions = $True } If ((${Result} -eq ${ExitSuccess}) -And (-Not (${TestedWithOptions}))) { $Output = Invoke-Expression "${TestExecutable} ${InputFile}" $Result = ${LastExitCode} } If (${Result} -ne ${ExitSuccess}) { Break } } If (${Result} -ne ${ExitSuccess}) { Break } } If (${Result} -ne ${ExitSuccess}) { Write-Host ${Output} -foreground Red } Write-Host "${TestDescription} (" -nonewline If (${Result} -ne ${ExitSuccess}) { Write-Host "FAIL" -foreground Red -nonewline } Else { Write-Host "PASS" -foreground Green -nonewline } Write-Host ")" Return ${Result} } $TestExecutablesDirectory = GetTestExecutablesDirectory If (-Not (Test-Path ${TestExecutablesDirectory})) { Write-Host "Missing test executables directory." -foreground Red Exit ${ExitFailure} } $Result = ${ExitIgnore} Foreach (${TestName} in ${LibraryTests} -split " ") { # Split will return an array of a single empty string when LibraryTests is empty. If (-Not (${TestName})) { Continue } $Result = RunTest ${TestName} If ((${Result} -ne ${ExitSuccess}) -And (${Result} -ne ${ExitIgnore})) { Break } } Foreach (${TestName} in ${LibraryTestsWithInput} -split " ") { # Split will return an array of a single empty string when LibraryTestsWithInput is empty. If (-Not (${TestName})) { Continue } If (Test-Path -Path "input" -PathType "Container") { $Result = RunTestWithInput ${TestName} } Else { $Result = RunTest ${TestName} } If ((${Result} -ne ${ExitSuccess}) -And (${Result} -ne ${ExitIgnore})) { Break } } Exit ${Result} ================================================ FILE: tests/test_library.sh ================================================ #!/usr/bin/env bash # Tests library functions and types. # # Version: 20240413 EXIT_SUCCESS=0; EXIT_FAILURE=1; EXIT_IGNORE=77; LIBRARY_TESTS="attribute_values block_descriptor block_reference block_tree block_tree_node checkpoint data_run directory_entry directory_object error file_entry file_system io_handle metadata_block_header ministore_node node_header node_record notify objects_tree superblock tree_header volume_header"; LIBRARY_TESTS_WITH_INPUT="support volume"; OPTION_SETS=("offset"); INPUT_GLOB="*"; run_test() { local TEST_NAME=$1; local TEST_DESCRIPTION="Testing: ${TEST_NAME}"; local TEST_EXECUTABLE="./fsrefs_test_${TEST_NAME}"; if ! test -x "${TEST_EXECUTABLE}"; then TEST_EXECUTABLE="${TEST_EXECUTABLE}.exe"; fi # TODO: add support for TEST_PROFILE and OPTION_SETS? run_test_with_arguments "${TEST_DESCRIPTION}" "${TEST_EXECUTABLE}"; local RESULT=$?; return ${RESULT}; } run_test_with_input() { local TEST_NAME=$1; local TEST_DESCRIPTION="Testing: ${TEST_NAME}"; local TEST_EXECUTABLE="./fsrefs_test_${TEST_NAME}"; if ! test -x "${TEST_EXECUTABLE}"; then TEST_EXECUTABLE="${TEST_EXECUTABLE}.exe"; fi if ! test -d "input"; then echo "Test input directory not found."; return ${EXIT_IGNORE}; fi local RESULT=`ls input/* | tr ' ' '\n' | wc -l`; if test ${RESULT} -eq ${EXIT_SUCCESS}; then echo "No files or directories found in the test input directory"; return ${EXIT_IGNORE}; fi local TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "input" "libfsrefs"); local IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}"); RESULT=${EXIT_SUCCESS}; for TEST_SET_INPUT_DIRECTORY in input/*; do if ! test -d "${TEST_SET_INPUT_DIRECTORY}"; then continue; fi if check_for_directory_in_ignore_list "${TEST_SET_INPUT_DIRECTORY}" "${IGNORE_LIST}"; then continue; fi local TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}"); if test -f "${TEST_SET_DIRECTORY}/files"; then IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"); else IFS="" read -a INPUT_FILES <<< $(ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}); fi for INPUT_FILE in "${INPUT_FILES[@]}"; do OPTION_INPUT_FILE="${INPUT_FILE}"; if test "${OSTYPE}" = "msys"; then # A test executable built with MinGW expects a Windows path. INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`; fi local TESTED_WITH_OPTIONS=0; for OPTION_SET in ${OPTION_SETS[@]}; do local TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${OPTION_INPUT_FILE}" "${OPTION_SET}"); if test -f ${TEST_DATA_OPTION_FILE}; then TESTED_WITH_OPTIONS=1; IFS=" " read -a OPTIONS <<< $(read_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SET}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${OPTIONS[@]}"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi fi done if test ${TESTED_WITH_OPTIONS} -eq 0; then run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; RESULT=$?; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done return ${RESULT}; } if test -n "${SKIP_LIBRARY_TESTS}"; then exit ${EXIT_IGNORE}; fi TEST_DIRECTORY=`dirname $0`; TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; if ! test -f "${TEST_RUNNER}"; then echo "Missing test runner: ${TEST_RUNNER}"; exit ${EXIT_FAILURE}; fi source ${TEST_RUNNER}; RESULT=${EXIT_IGNORE}; for TEST_NAME in ${LIBRARY_TESTS}; do run_test "${TEST_NAME}"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done if test ${RESULT} -ne ${EXIT_SUCCESS} && test ${RESULT} -ne ${EXIT_IGNORE}; then exit ${RESULT}; fi for TEST_NAME in ${LIBRARY_TESTS_WITH_INPUT}; do if test -d "input"; then run_test_with_input "${TEST_NAME}"; RESULT=$?; else run_test "${TEST_NAME}"; RESULT=$?; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done exit ${RESULT}; ================================================ FILE: tests/test_manpage.sh ================================================ #!/usr/bin/env bash # Tests man pages. # # Version: 20240413 EXIT_SUCCESS=0; EXIT_FAILURE=1; EXIT_IGNORE=77; run_test() { local INPUT_FILE=$1; local RESULT=0 TEST_NAME=`basename ${INPUT_FILE}`; echo -n "Testing man with input: ${TEST_NAME}"; 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; RESULT=$?; # For now line break warnings are ignored. if test -f ${TMPDIR}/${TEST_NAME}.warnings; then sed "/can't break line/ d" -i ${TMPDIR}/${TEST_NAME}.warnings; fi if test -s ${TMPDIR}/${TEST_NAME}.warnings; then RESULT=${EXIT_FAILURE}; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo " (FAIL)"; else echo " (PASS)"; fi if test -s ${TMPDIR}/${TEST_NAME}.warnings; then cat ${TMPDIR}/${TEST_NAME}.warnings; fi return ${RESULT}; } if test "${OSTYPE}" = "msys"; then exit ${EXIT_IGNORE}; fi TEST_DIRECTORY=`dirname $0`; TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; if ! test -f "${TEST_RUNNER}"; then echo "Missing test runner: ${TEST_RUNNER}"; exit ${EXIT_FAILURE}; fi source ${TEST_RUNNER}; assert_availability_binary man; RESULT=${EXIT_IGNORE}; TMPDIR="tmp$$"; rm -rf ${TMPDIR}; mkdir ${TMPDIR}; MANUALS_PATH="../manuals"; if ! test -d ${MANUALS_PATH}; then MANUALS_PATH="manuals"; fi if ! test -d ${MANUALS_PATH}; then echo "Manuals directory not found."; exit ${EXIT_IGNORE}; fi for INPUT_FILE in ${MANUALS_PATH}/*.[13]; do run_test "${INPUT_FILE}"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done rm -rf ${TMPDIR}; exit ${RESULT}; ================================================ FILE: tests/test_runner.sh ================================================ #!/usr/bin/env bash # Bash functions to run an executable for testing. # # Version: 20231119 # # When CHECK_WITH_ASAN is set to a non-empty value the test executable # is run with asan, otherwise it is run without. # # When CHECK_WITH_GDB is set to a non-empty value the test executable # is run with gdb, otherwise it is run without. # # When CHECK_WITH_STDERR is set to a non-empty value the test executable # is run with error output to stderr. # # When CHECK_WITH_VALGRIND is set to a non-empty value the test executable # is run with valgrind, otherwise it is run without. # # PYTHON is used to determine the Python interpreter. EXIT_SUCCESS=0; EXIT_FAILURE=1; EXIT_IGNORE=77; # Checks the availability of a binary and exits if not available. # # Arguments: # a string containing the name of the binary # assert_availability_binary() { local BINARY=$1; which ${BINARY} > /dev/null 2>&1; if test $? -ne ${EXIT_SUCCESS}; then echo "Missing binary: ${BINARY}"; echo ""; exit ${EXIT_FAILURE}; fi } # Checks the availability of binaries and exits if not available. # # Globals: # CHECK_WITH_GDB # CHECK_WITH_VALGRIND # assert_availability_binaries() { assert_availability_binary cat; assert_availability_binary cut; assert_availability_binary diff; assert_availability_binary file; assert_availability_binary gzip; assert_availability_binary ls; assert_availability_binary readlink; assert_availability_binary sed; assert_availability_binary tr; assert_availability_binary uname; assert_availability_binary wc; assert_availability_binary zcat; if test -n "${CHECK_WITH_GDB}"; then assert_availability_binary gdb; elif test -n "${CHECK_WITH_VALGRIND}"; then assert_availability_binary valgrind; fi } # Checks if the test set is in the ignore list. # # Arguments: # a string containing the test set # a string containing space separated ignore list # # Returns: # an integer containing the exit status to indicate the input directory # was found in the ignore list. # check_for_test_set_in_ignore_list() { local TEST_SET=$1; local IGNORE_LIST=$2; local IFS=" "; for LIST_ELEMENT in ${IGNORE_LIST}; do if test "${LIST_ELEMENT}" = "${TEST_SET}"; then return ${EXIT_SUCCESS}; fi done return ${EXIT_FAILURE}; } # Checks if the input directory is in the ignore list. # # Arguments: # a string containing the path of the test input directory # a string containing space separated ignore list # # Returns: # an integer containing the exit status to indicate the input directory # was found in the ignore list. # check_for_directory_in_ignore_list() { local INPUT_DIRECTORY=$1; local IGNORE_LIST=$2; local INPUT_BASENAME=`basename ${INPUT_DIRECTORY}`; local IFS=" "; for LIST_ELEMENT in ${IGNORE_LIST}; do if test "${LIST_ELEMENT}" = "${INPUT_BASENAME}"; then return ${EXIT_SUCCESS}; fi done return ${EXIT_FAILURE}; } # Searches for the binary variant of the executable in case the test executable # refers to a libtool shell script. # # Arguments: # a string containing the path of the test executable # # Returns: # a string containing the path of the binary variant of the test executable # find_binary_executable() { local TEST_EXECUTABLE=$1; TEST_EXECUTABLE=$( readlink_f "${TEST_EXECUTABLE}" ); # Note that the behavior of `file -bi` is not helpful on Mac OS X. local EXECUTABLE_TYPE=`file -b ${TEST_EXECUTABLE}`; # Check if the test executable is a libtool shell script. # Linux: POSIX shell script, ASCII text executable, with very long lines # Mac OS X: POSIX shell script text executable echo "${EXECUTABLE_TYPE}" | grep "POSIX shell script" > /dev/null 2>&1; RESULT=$?; if test ${RESULT} -eq ${EXIT_SUCCESS}; then local TEST_EXECUTABLE_BASENAME=`basename ${TEST_EXECUTABLE}`; local TEST_EXECUTABLE_DIRNAME=`dirname ${TEST_EXECUTABLE}`; TEST_EXECUTABLE="${TEST_EXECUTABLE_DIRNAME}/.libs/${TEST_EXECUTABLE_BASENAME}"; if test -x ${TEST_EXECUTABLE}; then # Note that the behavior of `file -bi` is not helpful on Mac OS X. EXECUTABLE_TYPE=`file -b ${TEST_EXECUTABLE}`; # Linux: ELF 64-bit LSB executable, x86-64, ... # Mac OS X: Mach-O 64-bit executable x86_64 echo "${EXECUTABLE_TYPE}" | grep "executable" > /dev/null 2>&1; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo "Invalid test executable: ${TEST_EXECUTABLE}"; exit ${EXIT_FAILURE}; fi fi fi echo ${TEST_EXECUTABLE}; } # Searches for the path to the binary variant of the library. # # Arguments: # a string containing the path of the test executable # # Returns: # a string containing the path of the binary variant of the library. # find_binary_library_path() { local TEST_EXECUTABLE=$1; local LIBRARY_NAME=`dirname ${TEST_EXECUTABLE}`; local NAME=`basename ${LIBRARY_NAME}`; if test ${NAME} = ".libs"; then LIBRARY_NAME=`dirname ${LIBRARY_NAME}`; NAME=`basename ${LIBRARY_NAME}`; fi if test ${NAME} = "tests"; then LIBRARY_NAME=`dirname ${LIBRARY_NAME}`; NAME=`basename ${LIBRARY_NAME}`; fi echo ${LIBRARY_NAME} | grep 'tools' > /dev/null 2>&1; if test $? -eq ${EXIT_SUCCESS}; then LIBRARY_NAME=`basename ${LIBRARY_NAME} | sed 's/\(.*\)tools$/lib\1/'`; else LIBRARY_NAME=`basename ${LIBRARY_NAME} | sed 's/^py//' | sed 's/^\([^_]*\)_test_.*$/lib\1/'`; fi TEST_EXECUTABLE=`dirname ${TEST_EXECUTABLE}`; TEST_EXECUTABLE=`dirname ${TEST_EXECUTABLE}`; TEST_EXECUTABLE=`dirname ${TEST_EXECUTABLE}`; local LIBRARY_PATH="${TEST_EXECUTABLE}/${LIBRARY_NAME}/.libs"; if ! test -d "${LIBRARY_PATH}"; then LIBRARY_PATH="../${LIBRARY_NAME}/.libs"; fi echo "${LIBRARY_PATH}"; } # Searches for the path to the binary variant of the Python module # # Arguments: # a string containing the path of the test executable # # Returns: # a string containing the path of the binary variant of the Python module # find_binary_python_module_path() { local TEST_EXECUTABLE=$1; local PYTHON_MODULE_NAME=`basename ${TEST_EXECUTABLE} | sed 's/^py\(.*\)_test_.*$/py\1/'`; TEST_EXECUTABLE=`dirname ${TEST_EXECUTABLE}`; TEST_EXECUTABLE=`dirname ${TEST_EXECUTABLE}`; TEST_EXECUTABLE=`dirname ${TEST_EXECUTABLE}`; local PYTHON_MODULE_PATH="${TEST_EXECUTABLE}/${PYTHON_MODULE_NAME}/.libs"; if ! test -d "${PYTHON_MODULE_PATH}"; then PYTHON_MODULE_PATH="../${PYTHON_MODULE_NAME}/.libs"; fi echo "${PYTHON_MODULE_PATH}"; } # Determines the test data option file. # # Arguments: # a string containing the path of the test set directory # a string containing the path of the test input file # a string containing the name of the test data option set # # Returns: # a string containing the test input files # get_test_data_option_file() { local TEST_SET_DIRECTORY=$1; local INPUT_FILE=$2; local OPTION_SET=$3; local INPUT_NAME=`basename "${INPUT_FILE}"`; local TEST_DATA_OPTION_FILE="${TEST_SET_DIRECTORY}/${INPUT_NAME}.${OPTION_SET}"; echo "${TEST_DATA_OPTION_FILE}"; } # Determines the test profile directory. # The directory is created if it does not exist. # # Arguments: # a string containing the path of the test input directory # a string containing the name of the test profile # # Returns: # a string containing the path of the test profile directory # get_test_profile_directory() { local TEST_INPUT_DIRECTORY=$1; local TEST_PROFILE=$2; local TEST_PROFILE_DIRECTORY="${TEST_INPUT_DIRECTORY}/.${TEST_PROFILE}"; if ! test -d "${TEST_PROFILE_DIRECTORY}"; then mkdir "${TEST_PROFILE_DIRECTORY}"; fi echo "${TEST_PROFILE_DIRECTORY}"; } # Determines the test set directory. # The directory is created if it does not exist. # # Arguments: # a string containing the path of the test profile directory # a string containing the path of the test set input directory # # Returns: # a string containing the path of the test set directory # get_test_set_directory() { local TEST_PROFILE_DIRECTORY=$1; local TEST_SET_INPUT_DIRECTORY=$2; local TEST_SET=`basename ${TEST_SET_INPUT_DIRECTORY}`; local TEST_SET_DIRECTORY="${TEST_PROFILE_DIRECTORY}/${TEST_SET}"; if ! test -d "${TEST_SET_DIRECTORY}"; then mkdir "${TEST_SET_DIRECTORY}"; fi echo "${TEST_SET_DIRECTORY}"; } # Provides a cross-platform variant of "readlink -f" # # Arguments: # a string containing a path # # Returns: # a string containing the path with all symbolic links resolved # readlink_f() { local TARGET="$1" if test -f "${TARGET}"; then while test -L "${TARGET}"; do TARGET=`readlink "${TARGET}"`; done fi local BASENAME=`basename "${TARGET}"`; local DIRNAME=`dirname "${TARGET}"`; DIRNAME=`(cd "${DIRNAME}" && pwd -P)`; echo "${DIRNAME}/${BASENAME}"; } # Reads the test profile ignore file if it exists. # # Arguments: # a string containing the path of the test profile directory # # Returns: # a string containing a space separated ignore list # read_ignore_list() { local TEST_PROFILE_DIRECTORY=$1; local IGNORE_FILE="${TEST_PROFILE_DIRECTORY}/ignore"; local IGNORE_LIST=""; if test -f "${IGNORE_FILE}"; then IGNORE_LIST=`cat ${IGNORE_FILE} | sed '/^#/d' | tr '\n' ' '`; fi echo ${IGNORE_LIST}; } # Reads a test data option file. # # Arguments: # a string containing the path of the test set directory # a string containing the path of the test input file # a string containing the name of the test data option set # # Returns: # a string containing the test data specific options # read_test_data_option_file() { local TEST_SET_DIRECTORY=$1; local INPUT_FILE=$2; local OPTION_SET=$3; local TEST_DATA_OPTION_FILE="${INPUT_FILE}.${OPTION_SET}"; if ! test -f "${TEST_DATA_OPTION_FILE}"; then TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); fi local OPTIONS_STRING=`head -n 1 "${TEST_DATA_OPTION_FILE}" | sed 's/[\r\n]*$//'`; if test "${OPTIONS_STRING}" = "# libyal test data options"; then OPTIONS_STRING=`tail -n +2 "${TEST_DATA_OPTION_FILE}" | sed 's/^offset=/-o/;s/^password=/-p/;s/^recovery_password=/-r/;s/^startup_key=/-s/;s/virtual_address=/-v/' | tr '\n' ' '`; fi echo "${OPTIONS_STRING}"; } # Runs the test with optional arguments. # # Globals: # CHECK_WITH_ASAN # CHECK_WITH_GDB # CHECK_WITH_STDERR # CHECK_WITH_VALGRIND # # Arguments: # a string containing the test description # a string containing the path of the test executable # an array containing the arguments for the test executable # # Returns: # an integer containg the exit status of the test executable # run_test_with_arguments() { local TEST_DESCRIPTION=$1; local TEST_EXECUTABLE=$2; shift 2; local ARGUMENTS=("$@"); if ! test -f "${TEST_EXECUTABLE}"; then echo "Missing test executable: ${TEST_EXECUTABLE}"; echo ""; return ${EXIT_FAILURE}; fi local PLATFORM=`uname -s | sed 's/-.*$//'`; # Note that the behavior of `file -bi` is not helpful on Mac OS X. local EXECUTABLE_TYPE=`file -b ${TEST_EXECUTABLE}`; # Check if the test executable is a Python script. # Linux: Python script, ASCII text executable # Mac OS X: a python script text executable echo "${EXECUTABLE_TYPE}" | grep -i "python script" > /dev/null 2>&1; local IS_PYTHON_SCRIPT=$?; if test ${IS_PYTHON_SCRIPT} -eq 0 && test -z ${PYTHON}; then local PYTHON=`which python 2> /dev/null`; if ! test -x ${PYTHON}; then echo "Missing executable: ${PYTHON}"; exit ${EXIT_FAILURE}; fi fi local RESULT=0; if test -n "${CHECK_WITH_ASAN}"; then local TEST_EXECUTABLE=$( find_binary_executable ${TEST_EXECUTABLE} ); local LIBRARY_PATH=$( find_binary_library_path ${TEST_EXECUTABLE} ); local PYTHON_MODULE_PATH=$( find_binary_python_module_path ${TEST_EXECUTABLE} ); local LSAN_SUPPRESSIONS="lsan.suppressions"; if ! test -f ${LSAN_SUPPRESSIONS}; then LSAN_SUPPRESSIONS="../lsan.suppressions"; fi if test "${PLATFORM}" = "Darwin"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then LSAN_OPTIONS=suppressions="${LSAN_SUPPRESSIONS}" DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else LSAN_OPTIONS=suppressions="${LSAN_SUPPRESSIONS}" DYLD_LIBRARY_PATH="${LIBRARY_PATH}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; fi else local CONFIG_LOG="../config.log"; if ! test -f ${CONFIG_LOG}; then CONFIG_LOG="../../config.log"; fi local CC=`cat ${CONFIG_LOG} | grep -e "^CC=" | sed "s/CC='\\(.*\\)'/\1/"`; local LIBASAN=""; if test -z ${CC} || test ${CC} != "clang"; then local LDCONFIG=`which ldconfig 2> /dev/null`; if test -z ${LDCONFIG} || ! test -x ${LDCONFIG}; then LDCONFIG="/sbin/ldconfig"; fi if test -z ${LDCONFIG} || ! test -x ${LDCONFIG}; then echo "Missing binary: ldconfig"; echo ""; exit ${EXIT_FAILURE}; fi LIBASAN=`${LDCONFIG} -p | grep libasan | sed 's/^.* => //' | sort | tail -n 1`; if ! test -f ${LIBASAN}; then echo "Missing library: ${BINARY}"; echo ""; exit ${EXIT_FAILURE}; fi fi if test ${IS_PYTHON_SCRIPT} -eq 0; then LSAN_OPTIONS=suppressions="${LSAN_SUPPRESSIONS}" LD_PRELOAD="${LIBASAN}" LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else LSAN_OPTIONS=suppressions="${LSAN_SUPPRESSIONS}" LD_PRELOAD="${LIBASAN}" LD_LIBRARY_PATH="${LIBRARY_PATH}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; fi fi elif test -n "${CHECK_WITH_GDB}"; then local TEST_EXECUTABLE=$( find_binary_executable ${TEST_EXECUTABLE} ); local LIBRARY_PATH=$( find_binary_library_path ${TEST_EXECUTABLE} ); local PYTHON_MODULE_PATH=$( find_binary_python_module_path ${TEST_EXECUTABLE} ); if test "${PLATFORM}" = "Darwin"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else DYLD_LIBRARY_PATH="${LIBRARY_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; fi elif test "${PLATFORM}" = "CYGWIN_NT"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then PATH="${LIBRARY_PATH}:${PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else PATH="${LIBRARY_PATH}:${PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; fi else if test ${IS_PYTHON_SCRIPT} -eq 0; then LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else LD_LIBRARY_PATH="${LIBRARY_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; fi fi elif test -n "${CHECK_WITH_VALGRIND}"; then local TEST_EXECUTABLE=$( find_binary_executable ${TEST_EXECUTABLE} ); local LIBRARY_PATH=$( find_binary_library_path ${TEST_EXECUTABLE} ); local PYTHON_MODULE_PATH=$( find_binary_python_module_path ${TEST_EXECUTABLE} ); local VALGRIND_LOG="valgrind.log-$$"; local VALGRIND_OPTIONS=("--tool=memcheck" "--leak-check=full" "--show-leak-kinds=definite,indirect,possible" "--track-origins=yes" "--log-file=${VALGRIND_LOG}"); if test "${PLATFORM}" = "Darwin"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else DYLD_LIBRARY_PATH="${LIBRARY_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; fi elif test "${PLATFORM}" = "CYGWIN_NT"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then PATH="${LIBRARY_PATH}:${PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else PATH="${LIBRARY_PATH}:${PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; fi else if test ${IS_PYTHON_SCRIPT} -eq 0; then LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else LD_LIBRARY_PATH="${LIBRARY_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; fi fi if test ${RESULT} -eq ${EXIT_SUCCESS}; then grep "All heap blocks were freed -- no leaks are possible" ${VALGRIND_LOG} > /dev/null 2>&1; if test $? -ne ${EXIT_SUCCESS}; then # Ignore "still reachable" # Also see: http://valgrind.org/docs/manual/faq.html#faq.deflost grep "definitely lost: 0 bytes in 0 blocks" ${VALGRIND_LOG} > /dev/null 2>&1; RESULT_DIRECTLY_LOST=$?; grep "indirectly lost: 0 bytes in 0 blocks" ${VALGRIND_LOG} > /dev/null 2>&1; RESULT_INDIRECTLY_LOST=$?; grep "possibly lost: 0 bytes in 0 blocks" ${VALGRIND_LOG} > /dev/null 2>&1; RESULT_POSSIBLY_LOST=$?; grep "suppressed: 0 bytes in 0 blocks" ${VALGRIND_LOG} > /dev/null 2>&1; RESULT_SUPPRESSED=$?; if test ${RESULT_DIRECTLY_LOST} -ne ${EXIT_SUCCESS} || test ${RESULT_INDIRECTLY_LOST} -ne ${EXIT_SUCCESS} || test ${RESULT_POSSIBLY_LOST} -ne ${EXIT_SUCCESS} || test ${RESULT_SUPPRESSED} -ne ${EXIT_SUCCESS}; then echo "Memory leakage detected."; cat ${VALGRIND_LOG}; RESULT=${EXIT_FAILURE}; fi fi # Detect valgrind warnings. local NUMBER_OF_LINES=`wc -l ${VALGRIND_LOG} | awk '{ print $1 }'`; if test ${NUMBER_OF_LINES} -ne 15 && test ${NUMBER_OF_LINES} -ne 22; then echo "Unsupported number of lines: ${NUMBER_OF_LINES}"; cat ${VALGRIND_LOG}; RESULT=${EXIT_FAILURE}; fi fi rm -f ${VALGRIND_LOG}; elif test ${IS_PYTHON_SCRIPT} -eq 0; then if ! test -f "${TEST_EXECUTABLE}"; then echo "Invalid test Python script: ${TEST_EXECUTABLE}"; echo ""; return ${EXIT_FAILURE}; fi local TEST_EXECUTABLE=$( find_binary_executable ${TEST_EXECUTABLE} ); local LIBRARY_PATH=$( find_binary_library_path ${TEST_EXECUTABLE} ); local PYTHON_MODULE_PATH=$( find_binary_python_module_path ${TEST_EXECUTABLE} ); if test "${PLATFORM}" = "Darwin"; then if test -n "${CHECK_WITH_STDERR}"; then DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} 2> /dev/null; RESULT=$?; fi elif test "${PLATFORM}" = "CYGWIN_NT"; then if test -n "${CHECK_WITH_STDERR}"; then PATH="${LIBRARY_PATH}:${PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else PATH="${LIBRARY_PATH}:${PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} 2> /dev/null; RESULT=$?; fi else if test -n "${CHECK_WITH_STDERR}"; then LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]}; RESULT=$?; else LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} 2> /dev/null; RESULT=$?; fi fi else if ! test -x "${TEST_EXECUTABLE}"; then echo "Invalid test executable: ${TEST_EXECUTABLE}"; echo ""; return ${EXIT_FAILURE}; fi if test -n "${CHECK_WITH_STDERR}"; then ${TEST_EXECUTABLE} ${ARGUMENTS[@]}; RESULT=$?; else ${TEST_EXECUTABLE} ${ARGUMENTS[@]} 2> /dev/null; RESULT=$?; fi fi if test -n "${TEST_DESCRIPTION}"; then echo -n "${TEST_DESCRIPTION}"; if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo " (FAIL)"; else echo " (PASS)"; fi fi return ${RESULT}; } # Runs the test with an input file and optional arguments. # # Globals: # CHECK_WITH_ASAN # CHECK_WITH_GDB # CHECK_WITH_STDERR # CHECK_WITH_VALGRIND # # Arguments: # a string containing the path of the test executable # a string containing the path of the test input file # an array containing the arguments for the test executable # # Returns: # an integer containg the exit status of the test executable # run_test_with_input_and_arguments() { local TEST_EXECUTABLE=$1; local INPUT_FILE=$2; shift 2; local ARGUMENTS=("$@"); if ! test -f "${TEST_EXECUTABLE}"; then echo "Missing test executable: ${TEST_EXECUTABLE}"; echo ""; return ${EXIT_FAILURE}; fi local PLATFORM=`uname -s | sed 's/-.*$//'`; # Note that the behavior of `file -bi` is not helpful on Mac OS X. local EXECUTABLE_TYPE=`file -b ${TEST_EXECUTABLE}`; # Check if the test executable is a Python script. # Linux: Python script, ASCII text executable # Mac OS X: a python script text executable echo "${EXECUTABLE_TYPE}" | grep -i "python script" > /dev/null 2>&1; local IS_PYTHON_SCRIPT=$?; if test ${IS_PYTHON_SCRIPT} -eq 0 && test -z ${PYTHON}; then local PYTHON=`which python 2> /dev/null`; if ! test -x ${PYTHON}; then echo "Missing executable: ${PYTHON}"; exit ${EXIT_FAILURE}; fi fi local RESULT=0; if test -n "${CHECK_WITH_ASAN}"; then local TEST_EXECUTABLE=$( find_binary_executable ${TEST_EXECUTABLE} ); local LIBRARY_PATH=$( find_binary_library_path ${TEST_EXECUTABLE} ); local PYTHON_MODULE_PATH=$( find_binary_python_module_path ${TEST_EXECUTABLE} ); local LSAN_SUPPRESSIONS="lsan.suppressions"; if ! test -f ${LSAN_SUPPRESSIONS}; then LSAN_SUPPRESSIONS="../lsan.suppressions"; fi if test "${PLATFORM}" = "Darwin"; then # TODO DYLD_INSERT_LIBRARIES=/Library/Developer/CommandLineTools/usr/lib/clang/8.1.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib if test ${IS_PYTHON_SCRIPT} -eq 0; then LSAN_OPTIONS=suppressions="${LSAN_SUPPRESSIONS}" DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else LSAN_OPTIONS=suppressions="${LSAN_SUPPRESSIONS}" DYLD_LIBRARY_PATH="${LIBRARY_PATH}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; fi else local CONFIG_LOG="../config.log"; if ! test -f ${CONFIG_LOG}; then CONFIG_LOG="../../config.log"; fi local CC=`cat ${CONFIG_LOG} | grep -e "^CC=" | sed "s/CC='\\(.*\\)'/\1/"`; local LIBASAN=""; if test -z ${CC} || test ${CC} != "clang"; then local LDCONFIG=`which ldconfig 2> /dev/null`; if test -z ${LDCONFIG} || ! test -x ${LDCONFIG}; then LDCONFIG="/sbin/ldconfig"; fi if test -z ${LDCONFIG} || ! test -x ${LDCONFIG}; then echo "Missing binary: ldconfig"; echo ""; exit ${EXIT_FAILURE}; fi LIBASAN=`${LDCONFIG} -p | grep libasan | sed 's/^.* => //' | sort | tail -n 1`; if ! test -f ${LIBASAN}; then echo "Missing library: ${BINARY}"; echo ""; exit ${EXIT_FAILURE}; fi fi if test ${IS_PYTHON_SCRIPT} -eq 0; then LSAN_OPTIONS=suppressions="${LSAN_SUPPRESSIONS}" LD_PRELOAD="${LIBASAN}" LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else LSAN_OPTIONS=suppressions="${LSAN_SUPPRESSIONS}" LD_PRELOAD="${LIBASAN}" LD_LIBRARY_PATH="${LIBRARY_PATH}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; fi fi elif test -n "${CHECK_WITH_GDB}"; then local TEST_EXECUTABLE=$( find_binary_executable ${TEST_EXECUTABLE} ); local LIBRARY_PATH=$( find_binary_library_path ${TEST_EXECUTABLE} ); local PYTHON_MODULE_PATH=$( find_binary_python_module_path ${TEST_EXECUTABLE} ); if test "${PLATFORM}" = "Darwin"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else DYLD_LIBRARY_PATH="${LIBRARY_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; fi elif test "${PLATFORM}" = "CYGWIN_NT"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then PATH="${LIBRARY_PATH}:${PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else PATH="${LIBRARY_PATH}:${PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; fi else if test ${IS_PYTHON_SCRIPT} -eq 0; then LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else LD_LIBRARY_PATH="${LIBRARY_PATH}" gdb -ex "set non-stop on" -ex "run" -ex "quit" --args "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; fi fi elif test -n "${CHECK_WITH_VALGRIND}"; then local TEST_EXECUTABLE=$( find_binary_executable ${TEST_EXECUTABLE} ); local LIBRARY_PATH=$( find_binary_library_path ${TEST_EXECUTABLE} ); local PYTHON_MODULE_PATH=$( find_binary_python_module_path ${TEST_EXECUTABLE} ); local VALGRIND_LOG="valgrind.log-$$"; local VALGRIND_OPTIONS=("--tool=memcheck" "--leak-check=full" "--show-leak-kinds=definite,indirect,possible" "--track-origins=yes" "--log-file=${VALGRIND_LOG}"); if test "${PLATFORM}" = "Darwin"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else DYLD_LIBRARY_PATH="${LIBRARY_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; fi elif test "${PLATFORM}" = "CYGWIN_NT"; then if test ${IS_PYTHON_SCRIPT} -eq 0; then PATH="${LIBRARY_PATH}:${PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else PATH="${LIBRARY_PATH}:${PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; fi else if test ${IS_PYTHON_SCRIPT} -eq 0; then LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else LD_LIBRARY_PATH="${LIBRARY_PATH}" valgrind ${VALGRIND_OPTIONS[@]} "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; fi fi if test ${RESULT} -eq ${EXIT_SUCCESS}; then grep "All heap blocks were freed -- no leaks are possible" ${VALGRIND_LOG} > /dev/null 2>&1; if test $? -ne ${EXIT_SUCCESS}; then # Ignore "still reachable" # Also see: http://valgrind.org/docs/manual/faq.html#faq.deflost grep "definitely lost: 0 bytes in 0 blocks" ${VALGRIND_LOG} > /dev/null 2>&1; RESULT_DIRECTLY_LOST=$?; grep "indirectly lost: 0 bytes in 0 blocks" ${VALGRIND_LOG} > /dev/null 2>&1; RESULT_INDIRECTLY_LOST=$?; grep "possibly lost: 0 bytes in 0 blocks" ${VALGRIND_LOG} > /dev/null 2>&1; RESULT_POSSIBLY_LOST=$?; grep "suppressed: 0 bytes in 0 blocks" ${VALGRIND_LOG} > /dev/null 2>&1; RESULT_SUPPRESSED=$?; if test ${RESULT_DIRECTLY_LOST} -ne ${EXIT_SUCCESS} || test ${RESULT_INDIRECTLY_LOST} -ne ${EXIT_SUCCESS} || test ${RESULT_POSSIBLY_LOST} -ne ${EXIT_SUCCESS} || test ${RESULT_SUPPRESSED} -ne ${EXIT_SUCCESS}; then echo "Memory leakage detected."; cat ${VALGRIND_LOG}; RESULT=${EXIT_FAILURE}; fi fi # Detect valgrind warnings. local NUMBER_OF_LINES=`wc -l ${VALGRIND_LOG} | awk '{ print $1 }'`; if test ${NUMBER_OF_LINES} -ne 15 && test ${NUMBER_OF_LINES} -ne 22; then echo "Unsupported number of lines: ${NUMBER_OF_LINES}"; cat ${VALGRIND_LOG}; RESULT=${EXIT_FAILURE}; fi fi rm -f ${VALGRIND_LOG}; elif test ${IS_PYTHON_SCRIPT} -eq 0; then if ! test -f "${TEST_EXECUTABLE}"; then echo "Invalid test Python script: ${TEST_EXECUTABLE}"; echo ""; return ${EXIT_FAILURE}; fi local TEST_EXECUTABLE=$( find_binary_executable ${TEST_EXECUTABLE} ); local LIBRARY_PATH=$( find_binary_library_path ${TEST_EXECUTABLE} ); local PYTHON_MODULE_PATH=$( find_binary_python_module_path ${TEST_EXECUTABLE} ); if test "${PLATFORM}" = "Darwin"; then if test -n "${CHECK_WITH_STDERR}"; then DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else DYLD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}" 2> /dev/null; RESULT=$?; fi elif test "${PLATFORM}" = "CYGWIN_NT"; then if test -n "${CHECK_WITH_STDERR}"; then PATH="${LIBRARY_PATH}:${PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else PATH="${LIBRARY_PATH}:${PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}" 2> /dev/null; RESULT=$?; fi else if test -n "${CHECK_WITH_STDERR}"; then LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else LD_LIBRARY_PATH="${LIBRARY_PATH}" PYTHONPATH="${PYTHON_MODULE_PATH}" "${PYTHON}" "${TEST_EXECUTABLE}" ${ARGUMENTS[@]} "${INPUT_FILE}" 2> /dev/null; RESULT=$?; fi fi else if ! test -x "${TEST_EXECUTABLE}"; then echo "Invalid test executable: ${TEST_EXECUTABLE}"; echo ""; return ${EXIT_FAILURE}; fi if test -n "${CHECK_WITH_STDERR}"; then ${TEST_EXECUTABLE} ${ARGUMENTS[@]} "${INPUT_FILE}"; RESULT=$?; else ${TEST_EXECUTABLE} ${ARGUMENTS[@]} "${INPUT_FILE}" 2> /dev/null; RESULT=$?; fi fi return ${RESULT}; } # Runs the test on the input file. # # Note that this function is not intended to be directly invoked # from outside the test runner script. # # Arguments: # a string containing the path of the test set directory # a string containing the description of the test # a string containing the test mode # a string containing the name of the test data option set # a string containing the path of the test executable # a string containing the path of the test input file # an array containing the arguments for the test executable # # Returns: # an integer containg the exit status of the test executable # run_test_on_input_file() { local TEST_SET_DIRECTORY=$1; local TEST_DESCRIPTION=$2; local TEST_MODE=$3; local OPTION_SET=$4; local TEST_EXECUTABLE=$5; local INPUT_FILE=$6; shift 6; local ARGUMENTS=("$@"); local INPUT_NAME=`basename "${INPUT_FILE}"`; local TEST_OUTPUT="${INPUT_NAME}"; if test -n "${OPTION_SET}"; then TEST_OUTPUT="${INPUT_NAME}-${OPTION_SET}"; fi local TMPDIR="tmp$$"; local RESULT=0; rm -rf ${TMPDIR}; mkdir ${TMPDIR}; if test "${TEST_MODE}" = "with_callback"; then test_callback "${TMPDIR}" "${TEST_SET_DIRECTORY}" "${TEST_OUTPUT}" "${TEST_EXECUTABLE}" "${TEST_INPUT}" ${ARGUMENTS[@]}; RESULT=$?; elif test "${TEST_MODE}" = "with_stdout_reference"; then TEST_EXECUTABLE=$( readlink_f "${TEST_EXECUTABLE}" ); if ! test -x ${TEST_EXECUTABLE}; then echo "Invalid test executable: ${TEST_EXECUTABLE}"; echo ""; return ${EXIT_FAILURE}; fi local INPUT_FILE_FULL_PATH=$( readlink_f "${INPUT_FILE}" ); local TEST_LOG="${TEST_OUTPUT}.log"; (cd ${TMPDIR} && run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE_FULL_PATH}" ${ARGUMENTS[@]} > "${TEST_LOG}"); RESULT=$?; # Compare output if test ran successfully. if test ${RESULT} -eq ${EXIT_SUCCESS}; then local TEST_RESULTS="${TMPDIR}/${TEST_LOG}"; local STORED_TEST_RESULTS="${TEST_SET_DIRECTORY}/${TEST_LOG}.gz"; # Strip header with version. sed -i'~' '1,2d' "${TEST_RESULTS}"; if test -f "${STORED_TEST_RESULTS}"; then # Using zcat here since zdiff has issues on Mac OS X. # Note that zcat on Mac OS X requires the input from stdin. zcat < "${STORED_TEST_RESULTS}" | diff "${TEST_RESULTS}" -; RESULT=$?; else gzip "${TEST_RESULTS}"; mv "${TEST_RESULTS}.gz" ${TEST_SET_DIRECTORY}; fi fi else run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]}; RESULT=$?; fi rm -rf ${TMPDIR}; if test -n "${TEST_DESCRIPTION}"; then ARGUMENTS=`echo "${ARGUMENTS[*]}" | tr '\n' ' ' | sed 's/[ ]\$//'`; if test -z "${ARGUMENTS}"; then echo -n "${TEST_DESCRIPTION} with input: ${INPUT_FILE}"; else echo -n "${TEST_DESCRIPTION} with options: '${ARGUMENTS}' and input: ${INPUT_FILE}"; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then echo " (FAIL)"; else echo " (PASS)"; fi fi return ${RESULT}; } ================================================ FILE: tests/test_tools.ps1 ================================================ # Tests tools functions and types. # # Version: 20230410 $ExitSuccess = 0 $ExitFailure = 1 $ExitIgnore = 77 $ToolsTests = "info_handle output signal" $ToolsTestsWithInput = "" $InputGlob = "*" Function GetTestProfileDirectory { param( [string]$TestInputDirectory, [string]$TestProfile ) $TestProfileDirectory = "${TestInputDirectory}\.${TestProfile}" If (-Not (Test-Path -Path ${TestProfileDirectory} -PathType "Container")) { New-Item -ItemType "directory" -Path ${TestProfileDirectory} } Return ${TestProfileDirectory} } Function GetTestSetDirectory { param( [string]$TestProfileDirectory, [string]$TestSetInputDirectory ) $TestSetDirectory = "${TestProfileDirectory}\${TestSetInputDirectory.Basename}" If (-Not (Test-Path -Path ${TestSetDirectory} -PathType "Container")) { New-Item -ItemType "directory" -Path ${TestSetDirectory} } Return ${TestSetDirectory} } Function GetTestExecutablesDirectory { $TestExecutablesDirectory = "" ForEach (${VSDirectory} in ("msvscpp", "vs2008", "vs2010", "vs2012", "vs2013", "vs2015", "vs2017", "vs2019", "vs2022")) { ForEach (${VSConfiguration} in ("Release", "VSDebug")) { ForEach (${VSPlatform} in ("Win32", "x64")) { $TestExecutablesDirectory = "..\${VSDirectory}\${VSConfiguration}\${VSPlatform}" If (Test-Path ${TestExecutablesDirectory}) { Return ${TestExecutablesDirectory} } } $TestExecutablesDirectory = "..\${VSDirectory}\${VSConfiguration}" If (Test-Path ${TestExecutablesDirectory}) { Return ${TestExecutablesDirectory} } } } Return ${TestExecutablesDirectory} } Function ReadIgnoreList { param( [string]$TestProfileDirectory ) $IgnoreFile = "${TestProfileDirectory}\ignore" $IgnoreList = "" If (Test-Path -Path ${IgnoreFile} -PathType "Leaf") { $IgnoreList = Get-Content -Path ${IgnoreFile} | Where {$_ -notmatch '^#.*'} } Return $IgnoreList } Function RunTest { param( [string]$TestType ) $TestDescription = "Testing: ${TestName}" $TestExecutable = "${TestExecutablesDirectory}\fsrefs_test_tools_${TestName}.exe" $Output = Invoke-Expression ${TestExecutable} $Result = ${LastExitCode} If (${Result} -ne ${ExitSuccess}) { Write-Host ${Output} -foreground Red } Write-Host "${TestDescription} " -nonewline If (${Result} -ne ${ExitSuccess}) { Write-Host " (FAIL)" } Else { Write-Host " (PASS)" } Return ${Result} } Function RunTestWithInput { param( [string]$TestType ) $TestDescription = "Testing: ${TestName}" $TestExecutable = "${TestExecutablesDirectory}\fsrefs_test_tools_${TestName}.exe" $TestProfileDirectory = GetTestProfileDirectory "input" "fsrefstools" $IgnoreList = ReadIgnoreList ${TestProfileDirectory} $Result = ${ExitSuccess} ForEach ($TestSetInputDirectory in Get-ChildItem -Path "input" -Exclude ".*") { If (-Not (Test-Path -Path ${TestSetInputDirectory} -PathType "Container")) { Continue } If (${TestSetInputDirectory} -Contains ${IgnoreList}) { Continue } $TestSetDirectory = GetTestSetDirectory ${TestProfileDirectory} ${TestSetInputDirectory} If (Test-Path -Path "${TestSetDirectory}\files" -PathType "Leaf") { $InputFiles = Get-Content -Path "${TestSetDirectory}\files" | Where {$_ -ne ""} } Else { $InputFiles = Get-ChildItem -Path ${TestSetInputDirectory} -Include ${InputGlob} } ForEach ($InputFile in ${InputFiles}) { # TODO: add test option support $Output = Invoke-Expression ${TestExecutable} $Result = ${LastExitCode} If (${Result} -ne ${ExitSuccess}) { Break } } If (${Result} -ne ${ExitSuccess}) { Break } } If (${Result} -ne ${ExitSuccess}) { Write-Host ${Output} -foreground Red } Write-Host "${TestDescription} " -nonewline If (${Result} -ne ${ExitSuccess}) { Write-Host " (FAIL)" } Else { Write-Host " (PASS)" } Return ${Result} } $TestExecutablesDirectory = GetTestExecutablesDirectory If (-Not (Test-Path ${TestExecutablesDirectory})) { Write-Host "Missing test executables directory." -foreground Red Exit ${ExitFailure} } $Result = ${ExitIgnore} Foreach (${TestName} in ${ToolsTests} -split " ") { # Split will return an array of a single empty string when ToolsTests is empty. If (-Not (${TestName})) { Continue } $Result = RunTest ${TestName} If (${Result} -ne ${ExitSuccess}) { Break } } Foreach (${TestName} in ${ToolsTestsWithInput} -split " ") { # Split will return an array of a single empty string when ToolsTestsWithInput is empty. If (-Not (${TestName})) { Continue } If (Test-Path -Path "input" -PathType "Container") { $Result = RunTestWithInput ${TestName} } Else { $Result = RunTest ${TestName} } If (${Result} -ne ${ExitSuccess}) { Break } } Exit ${Result} ================================================ FILE: tests/test_tools.sh ================================================ #!/usr/bin/env bash # Tests tools functions and types. # # Version: 20240413 EXIT_SUCCESS=0; EXIT_FAILURE=1; EXIT_IGNORE=77; TOOLS_TESTS="info_handle output signal"; TOOLS_TESTS_WITH_INPUT=""; OPTION_SETS=("offset"); INPUT_GLOB="*"; run_test() { local TEST_NAME=$1; local TEST_DESCRIPTION="Testing: ${TEST_NAME}"; local TEST_EXECUTABLE="./fsrefs_test_tools_${TEST_NAME}"; if ! test -x "${TEST_EXECUTABLE}"; then TEST_EXECUTABLE="${TEST_EXECUTABLE}.exe"; fi # TODO: add support for TEST_PROFILE and OPTION_SETS? run_test_with_arguments "${TEST_DESCRIPTION}" "${TEST_EXECUTABLE}"; local RESULT=$?; return ${RESULT}; } run_test_with_input() { local TEST_NAME=$1; local TEST_DESCRIPTION="Testing: ${TEST_NAME}"; local TEST_EXECUTABLE="./fsrefs_test_tools_${TEST_NAME}"; if ! test -x "${TEST_EXECUTABLE}"; then TEST_EXECUTABLE="${TEST_EXECUTABLE}.exe"; fi if ! test -d "input"; then echo "Test input directory not found."; return ${EXIT_IGNORE}; fi local RESULT=`ls input/* | tr ' ' '\n' | wc -l`; if test ${RESULT} -eq ${EXIT_SUCCESS}; then echo "No files or directories found in the test input directory"; return ${EXIT_IGNORE}; fi local TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "input" "fsrefstools"); local IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}"); RESULT=${EXIT_SUCCESS}; for TEST_SET_INPUT_DIRECTORY in input/*; do if ! test -d "${TEST_SET_INPUT_DIRECTORY}"; then continue; fi if check_for_directory_in_ignore_list "${TEST_SET_INPUT_DIRECTORY}" "${IGNORE_LIST}"; then continue; fi local TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}"); if test -f "${TEST_SET_DIRECTORY}/files"; then IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"); else IFS="" read -a INPUT_FILES <<< $(ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}); fi for INPUT_FILE in "${INPUT_FILES[@]}"; do OPTION_INPUT_FILE="${INPUT_FILE}"; if test "${OSTYPE}" = "msys"; then # A test executable built with MinGW expects a Windows path. INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`; fi local TESTED_WITH_OPTIONS=0; for OPTION_SET in ${OPTION_SETS[@]}; do local TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${OPTION_INPUT_FILE}" "${OPTION_SET}"); if test -f ${TEST_DATA_OPTION_FILE}; then TESTED_WITH_OPTIONS=1; IFS=" " read -a OPTIONS <<< $(read_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SET}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${OPTIONS[@]}"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi fi done if test ${TESTED_WITH_OPTIONS} -eq 0; then run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; RESULT=$?; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done return ${RESULT}; } if test -n "${SKIP_TOOLS_TESTS}"; then exit ${EXIT_IGNORE}; fi TEST_DIRECTORY=`dirname $0`; TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; if ! test -f "${TEST_RUNNER}"; then echo "Missing test runner: ${TEST_RUNNER}"; exit ${EXIT_FAILURE}; fi source ${TEST_RUNNER}; RESULT=${EXIT_IGNORE}; for TEST_NAME in ${TOOLS_TESTS}; do run_test "${TEST_NAME}"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done if test ${RESULT} -ne ${EXIT_SUCCESS} && test ${RESULT} -ne ${EXIT_IGNORE}; then exit ${RESULT}; fi for TEST_NAME in ${TOOLS_TESTS_WITH_INPUT}; do if test -d "input"; then run_test_with_input "${TEST_NAME}"; RESULT=$?; else run_test "${TEST_NAME}"; RESULT=$?; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; then break; fi done exit ${RESULT};