├── .codecov.yml ├── .github └── workflows │ ├── build.yml │ ├── build_freebsd.yml │ ├── build_ossfuzz.yml │ └── build_shared.yml ├── .gitignore ├── AUTHORS ├── COPYING ├── COPYING.LESSER ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── acinclude.m4 ├── agdbtools ├── Makefile.am ├── agdbinfo.c ├── agdbinput.c ├── agdbinput.h ├── agdbtools_getopt.c ├── agdbtools_getopt.h ├── agdbtools_i18n.h ├── agdbtools_libagdb.h ├── agdbtools_libbfio.h ├── agdbtools_libcerror.h ├── agdbtools_libclocale.h ├── agdbtools_libcnotify.h ├── agdbtools_libfdatetime.h ├── agdbtools_libuna.h ├── agdbtools_output.c ├── agdbtools_output.h ├── agdbtools_signal.c ├── agdbtools_signal.h ├── agdbtools_unused.h ├── info_handle.c └── info_handle.h ├── 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 └── Windows SuperFetch (DB) format.asciidoc ├── dpkg ├── changelog.in ├── compat ├── control ├── copyright ├── libagdb-dev.install ├── libagdb-tools.install ├── libagdb.install ├── rules └── source │ └── format ├── include ├── Makefile.am ├── libagdb.h.in └── libagdb │ ├── codepage.h │ ├── definitions.h.in │ ├── error.h │ ├── extern.h │ ├── features.h.in │ └── types.h.in ├── libagdb.ini ├── libagdb.pc.in ├── libagdb.spec.in ├── libagdb ├── Makefile.am ├── agdb_file_header.h ├── agdb_file_information.h ├── agdb_source_information.h ├── agdb_volume_information.h ├── libagdb.c ├── libagdb.rc.in ├── libagdb_codepage.h ├── libagdb_compressed_block.c ├── libagdb_compressed_block.h ├── libagdb_compressed_blocks_stream.c ├── libagdb_compressed_blocks_stream.h ├── libagdb_compressed_blocks_stream_data_handle.c ├── libagdb_compressed_blocks_stream_data_handle.h ├── libagdb_compressed_file_header.c ├── libagdb_compressed_file_header.h ├── libagdb_debug.c ├── libagdb_debug.h ├── libagdb_definitions.h.in ├── libagdb_error.c ├── libagdb_error.h ├── libagdb_extern.h ├── libagdb_file.c ├── libagdb_file.h ├── libagdb_file_information.c ├── libagdb_file_information.h ├── libagdb_hash.c ├── libagdb_hash.h ├── libagdb_io_handle.c ├── libagdb_io_handle.h ├── libagdb_libbfio.h ├── libagdb_libcdata.h ├── libagdb_libcerror.h ├── libagdb_libclocale.h ├── libagdb_libcnotify.h ├── libagdb_libfcache.h ├── libagdb_libfdata.h ├── libagdb_libfdatetime.h ├── libagdb_libfwnt.h ├── libagdb_libuna.h ├── libagdb_notify.c ├── libagdb_notify.h ├── libagdb_source_information.c ├── libagdb_source_information.h ├── libagdb_support.c ├── libagdb_support.h ├── libagdb_types.h ├── libagdb_unused.h ├── libagdb_volume_information.c └── libagdb_volume_information.h ├── m4 ├── common.m4 ├── libbfio.m4 ├── libcdata.m4 ├── libcerror.m4 ├── libcfile.m4 ├── libclocale.m4 ├── libcnotify.m4 ├── libcpath.m4 ├── libcsplit.m4 ├── libcthreads.m4 ├── libfcache.m4 ├── libfdata.m4 ├── libfdatetime.m4 ├── libfwnt.m4 ├── libuna.m4 ├── pthread.m4 ├── tests.m4 └── types.m4 ├── manuals ├── Makefile.am ├── agdbinfo.1 └── libagdb.3 ├── msvscpp ├── Makefile.am ├── agdb_test_compressed_block │ └── agdb_test_compressed_block.vcproj ├── agdb_test_compressed_blocks_stream_data_handle │ └── agdb_test_compressed_blocks_stream_data_handle.vcproj ├── agdb_test_compressed_file_header │ └── agdb_test_compressed_file_header.vcproj ├── agdb_test_error │ └── agdb_test_error.vcproj ├── agdb_test_file │ └── agdb_test_file.vcproj ├── agdb_test_file_information │ └── agdb_test_file_information.vcproj ├── agdb_test_io_handle │ └── agdb_test_io_handle.vcproj ├── agdb_test_notify │ └── agdb_test_notify.vcproj ├── agdb_test_source_information │ └── agdb_test_source_information.vcproj ├── agdb_test_support │ └── agdb_test_support.vcproj ├── agdb_test_tools_info_handle │ └── agdb_test_tools_info_handle.vcproj ├── agdb_test_tools_output │ └── agdb_test_tools_output.vcproj ├── agdb_test_tools_signal │ └── agdb_test_tools_signal.vcproj ├── agdb_test_volume_information │ └── agdb_test_volume_information.vcproj ├── agdbinfo │ └── agdbinfo.vcproj ├── libagdb.sln ├── libagdb │ └── libagdb.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 ├── libfwnt │ └── libfwnt.vcproj └── libuna │ └── libuna.vcproj ├── ossfuzz ├── Makefile.am ├── file_fuzzer.cc ├── ossfuzz_libagdb.h └── ossfuzz_libbfio.h ├── po ├── ChangeLog ├── Makevars.in └── POTFILES.in ├── runtests.ps1 ├── runtests.sh ├── synclibs.ps1 ├── synclibs.sh ├── synctestdata.ps1 ├── synctestdata.sh └── tests ├── Makefile.am ├── agdb_test_compressed_block.c ├── agdb_test_compressed_blocks_stream_data_handle.c ├── agdb_test_compressed_file_header.c ├── agdb_test_error.c ├── agdb_test_file.c ├── agdb_test_file_information.c ├── agdb_test_functions.c ├── agdb_test_functions.h ├── agdb_test_getopt.c ├── agdb_test_getopt.h ├── agdb_test_io_handle.c ├── agdb_test_libagdb.h ├── agdb_test_libbfio.h ├── agdb_test_libcerror.h ├── agdb_test_libclocale.h ├── agdb_test_libcnotify.h ├── agdb_test_libfdata.h ├── agdb_test_libuna.h ├── agdb_test_macros.h ├── agdb_test_memory.c ├── agdb_test_memory.h ├── agdb_test_notify.c ├── agdb_test_source_information.c ├── agdb_test_support.c ├── agdb_test_tools_info_handle.c ├── agdb_test_tools_output.c ├── agdb_test_tools_signal.c ├── agdb_test_unused.h ├── agdb_test_volume_information.c ├── build.sh ├── data ├── file_information.1 └── volume_information.1 ├── lsan.suppressions ├── pkgbuild.sh ├── runtests.sh ├── syncsharedlibs.sh ├── test_agdbinfo.ps1 ├── test_agdbinfo.sh ├── test_library.ps1 ├── test_library.sh ├── test_manpage.sh ├── test_runner.sh ├── test_tools.ps1 └── test_tools.sh /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | range: 70...100 5 | status: 6 | project: true 7 | patch: true 8 | changes: false 9 | ignore: 10 | - "libbfio/*" 11 | - "libcdata/*" 12 | - "libcerror/*" 13 | - "libcfile/*" 14 | - "libclocale/*" 15 | - "libcnotify/*" 16 | - "libcpath/*" 17 | - "libcsplit/*" 18 | - "libcthreads/*" 19 | - "libfcache/*" 20 | - "libfdata/*" 21 | - "libfdatetime/*" 22 | - "libfwnt/*" 23 | - "libuna/*" 24 | - "tests/*" 25 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # Build from source. 2 | name: build 3 | on: [push, pull_request] 4 | permissions: read-all 5 | jobs: 6 | build_ubuntu: 7 | runs-on: ubuntu-22.04 8 | strategy: 9 | matrix: 10 | include: 11 | - architecture: 'x86' 12 | compiler: 'clang' 13 | configure_options: '' 14 | - architecture: 'x64' 15 | compiler: 'clang' 16 | configure_options: '' 17 | - architecture: 'x86' 18 | compiler: 'gcc' 19 | configure_options: '' 20 | - architecture: 'x64' 21 | compiler: 'gcc' 22 | configure_options: '' 23 | - architecture: 'x64' 24 | compiler: 'gcc' 25 | configure_options: '--enable-wide-character-type' 26 | - architecture: 'x64' 27 | compiler: 'gcc' 28 | configure_options: '--enable-static-executables=yes --enable-multi-threading-support=no' 29 | steps: 30 | - uses: actions/checkout@v4 31 | - name: Install build dependencies 32 | run: | 33 | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config 34 | - name: Download test data 35 | run: | 36 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 37 | - name: Building from source 38 | env: 39 | CC: ${{ matrix.compiler }} 40 | run: | 41 | tests/build.sh ${{ matrix.configure_options }} 42 | - name: Run tests 43 | run: | 44 | tests/runtests.sh 45 | build_dist: 46 | runs-on: ubuntu-22.04 47 | strategy: 48 | matrix: 49 | include: 50 | - architecture: 'x64' 51 | compiler: 'gcc' 52 | configure_options: '' 53 | steps: 54 | - uses: actions/checkout@v4 55 | - name: Install build dependencies 56 | run: | 57 | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config 58 | - name: Download test data 59 | run: | 60 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 61 | - name: Building from source 62 | env: 63 | CC: ${{ matrix.compiler }} 64 | run: | 65 | tests/build.sh ${{ matrix.configure_options }} 66 | - name: Run tests 67 | run: | 68 | make distcheck 69 | coverage_ubuntu: 70 | runs-on: ubuntu-22.04 71 | strategy: 72 | matrix: 73 | include: 74 | - architecture: 'x86' 75 | compiler: 'gcc' 76 | configure_options: '--enable-wide-character-type' 77 | - architecture: 'x64' 78 | compiler: 'gcc' 79 | configure_options: '--enable-wide-character-type' 80 | steps: 81 | - uses: actions/checkout@v4 82 | - name: Install build dependencies 83 | run: | 84 | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config 85 | - name: Download test data 86 | run: | 87 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 88 | - name: Building from source 89 | env: 90 | CC: ${{ matrix.compiler }} 91 | run: | 92 | tests/build.sh ${{ matrix.configure_options }} --enable-shared=no CFLAGS="--coverage -O0" CPPFLAGS="-DOPTIMIZATION_DISABLED" LDFLAGS="--coverage" 93 | - name: Run tests 94 | run: | 95 | make check CHECK_WITH_STDERR=1 SKIP_TOOLS_END_TO_END_TESTS=1 96 | - name: Generate coverage data 97 | run: | 98 | for DIRECTORY in `find . -maxdepth 1 -type d`; do \ 99 | (cd ${DIRECTORY} && find . -maxdepth 1 -name \*.gcno -type f -exec gcov -pb {} \;) \ 100 | done 101 | - name: Upload coverage report to Codecov 102 | uses: codecov/codecov-action@v4 103 | with: 104 | name: linux-${{ matrix.architecture }}-gcc-no-optimization 105 | token: ${{ secrets.CODECOV_TOKEN }} 106 | -------------------------------------------------------------------------------- /.github/workflows/build_freebsd.yml: -------------------------------------------------------------------------------- 1 | # Build from source on FreeBSD. 2 | name: build_freebsd 3 | on: [push] 4 | permissions: read-all 5 | jobs: 6 | build_freebsd: 7 | runs-on: ubuntu-22.04 8 | steps: 9 | - uses: actions/checkout@v4 10 | - name: Building from source 11 | id: build_freebsd 12 | uses: vmactions/freebsd-vm@v1 13 | with: 14 | usesh: true 15 | mem: 4096 16 | # Note that the test scripts require bash 17 | prepare: | 18 | pkg install -y autoconf automake bash gettext git libtool pkgconf 19 | run: | 20 | tests/build.sh 21 | tests/runtests.sh 22 | -------------------------------------------------------------------------------- /.github/workflows/build_ossfuzz.yml: -------------------------------------------------------------------------------- 1 | # Build OSSFuzz fuzz targets from source. 2 | name: build_ossfuzz 3 | on: 4 | push: 5 | branches: [main] 6 | permissions: read-all 7 | jobs: 8 | build_ossfuzz: 9 | runs-on: ubuntu-22.04 10 | strategy: 11 | matrix: 12 | include: 13 | - architecture: 'x64' 14 | compiler: 'gcc' 15 | configure_options: '' 16 | steps: 17 | - name: Install build dependencies 18 | run: | 19 | sudo apt-get -y install git 20 | - uses: actions/checkout@v4 21 | with: 22 | repository: google/oss-fuzz 23 | path: oss-fuzz 24 | - name: Build OSSFuzz fuzz targets 25 | working-directory: oss-fuzz 26 | run: | 27 | mkdir -p projects/libagdb 28 | cp projects/libyal/build.sh projects/libagdb/ 29 | cp projects/libyal/project.yaml projects/libagdb/ 30 | head -n 20 projects/libyal/Dockerfile > projects/libagdb/Dockerfile 31 | echo "RUN git clone --depth 1 https://github.com/libyal/libagdb.git libagdb" >> projects/libagdb/Dockerfile 32 | tail -n 3 projects/libyal/Dockerfile >> projects/libagdb/Dockerfile 33 | python3 infra/helper.py build_image --pull libagdb 34 | python3 infra/helper.py build_fuzzers --sanitizer address libagdb 35 | python3 infra/helper.py check_build libagdb 36 | -------------------------------------------------------------------------------- /.github/workflows/build_shared.yml: -------------------------------------------------------------------------------- 1 | # Build from source with libyal dependencies as shared libraries. 2 | name: build_shared 3 | on: 4 | push: 5 | branches: [main] 6 | permissions: read-all 7 | jobs: 8 | build_shared_ubuntu: 9 | runs-on: ubuntu-22.04 10 | strategy: 11 | matrix: 12 | include: 13 | - architecture: 'x64' 14 | compiler: 'gcc' 15 | configure_options: '--enable-wide-character-type' 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Install build dependencies 19 | run: | 20 | sudo apt-get -y install autoconf automake autopoint build-essential git libtool pkg-config 21 | - name: Download test data 22 | run: | 23 | if test -x "synctestdata.sh"; then ./synctestdata.sh; fi 24 | - name: Prepare shared libraries 25 | run: | 26 | tests/syncsharedlibs.sh --use-head 27 | - name: Building from source 28 | env: 29 | CC: ${{ matrix.compiler }} 30 | run: | 31 | tests/build.sh ${{ matrix.configure_options }} 32 | - name: Run tests 33 | run: | 34 | tests/runtests.sh 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Files to ignore by git 2 | # 3 | # Version: 20231119 4 | 5 | # Generic auto-generated build files 6 | *~ 7 | *.a 8 | *.gcda 9 | *.gcno 10 | *.gcov 11 | *.la 12 | *.lai 13 | *.lib 14 | *.lineno 15 | *.lo 16 | *.log 17 | *.loT 18 | *.o 19 | *.obj 20 | *.Plo 21 | *.Po 22 | *.so 23 | *.so.[0-9][0-9]* 24 | *.so.[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]* 25 | *.swp 26 | *.Tpo 27 | *.trs 28 | *.whl 29 | /*.egg-info/ 30 | __pycache__ 31 | .deps 32 | .dirstamp 33 | .libs 34 | .tox 35 | INSTALL 36 | Makefile 37 | Makefile.bcc 38 | Makefile.in 39 | stamp-h[1-9] 40 | 41 | # Specific auto-generated build files 42 | /ABOUT-NLS 43 | /aclocal.m4 44 | /autom4te.cache/ 45 | /build 46 | /compile 47 | /confdefs.h 48 | /config.cache 49 | /config.guess 50 | /config.log 51 | /config.rpath 52 | /config.status 53 | /config.sub 54 | /configure 55 | /conftest.c 56 | /depcomp 57 | /dist 58 | /install-sh 59 | /libtool 60 | /ltmain.sh 61 | /m4/codeset.m4 62 | /m4/extern-inline.m4 63 | /m4/fcntl-o.m4 64 | /m4/gettext.m4 65 | /m4/glibc21.m4 66 | /m4/glibc2.m4 67 | /m4/host-cpu-c-abi.m4 68 | /m4/iconv.m4 69 | /m4/intdiv0.m4 70 | /m4/intldir.m4 71 | /m4/intl.m4 72 | /m4/intlmacosx.m4 73 | /m4/intmax.m4 74 | /m4/inttypes_h.m4 75 | /m4/inttypes-pri.m4 76 | /m4/lcmessage.m4 77 | /m4/lib-ld.m4 78 | /m4/lib-link.m4 79 | /m4/lib-prefix.m4 80 | /m4/libtool.m4 81 | /m4/lock.m4 82 | /m4/longlong.m4 83 | /m4/lt~obsolete.m4 84 | /m4/ltoptions.m4 85 | /m4/ltsugar.m4 86 | /m4/ltversion.m4 87 | /m4/nls.m4 88 | /m4/pkg.m4 89 | /m4/po.m4 90 | /m4/printf-posix.m4 91 | /m4/progtest.m4 92 | /m4/size_max.m4 93 | /m4/stdint_h.m4 94 | /m4/threadlib.m4 95 | /m4/uintmax_t.m4 96 | /m4/visibility.m4 97 | /m4/wchar_t.m4 98 | /m4/wint_t.m4 99 | /m4/xsize.m4 100 | /MANIFEST 101 | /missing 102 | /po/boldquot.sed 103 | /po/en@boldquot.header 104 | /po/en@quot.header 105 | /po/insert-header.sin 106 | /po/Makefile.in.in 107 | /po/Makevars 108 | /po/Makevars.template 109 | /po/POTFILES 110 | /po/quot.sed 111 | /po/remove-potcdate.sed 112 | /po/remove-potcdate.sin 113 | /po/Rules-quot 114 | /test-driver 115 | /ylwrap 116 | 117 | # Project specific files 118 | /common/config.h 119 | /common/config.h.in 120 | /common/types.h 121 | /dpkg/changelog 122 | /include/libagdb.h 123 | /include/libagdb/definitions.h 124 | /include/libagdb/features.h 125 | /include/libagdb/types.h 126 | /libagdb.pc 127 | /libagdb.spec 128 | /libagdb/libagdb.rc 129 | /libagdb/libagdb_definitions.h 130 | /agdbtools/*.exe 131 | /agdbtools/agdbinfo 132 | /tests/*.exe 133 | /tests/agdb_test_compressed_block 134 | /tests/agdb_test_compressed_blocks_stream_data_handle 135 | /tests/agdb_test_compressed_file_header 136 | /tests/agdb_test_error 137 | /tests/agdb_test_file 138 | /tests/agdb_test_file_information 139 | /tests/agdb_test_io_handle 140 | /tests/agdb_test_notify 141 | /tests/agdb_test_source_information 142 | /tests/agdb_test_support 143 | /tests/agdb_test_tools_info_handle 144 | /tests/agdb_test_tools_output 145 | /tests/agdb_test_tools_signal 146 | /tests/agdb_test_volume_information 147 | /tests/input 148 | /tests/notify_stream.log 149 | /tests/tmp* 150 | 151 | # Local library dependencies specific files 152 | /libbfio 153 | /libcdata 154 | /libcerror 155 | /libcfile 156 | /libclocale 157 | /libcnotify 158 | /libcpath 159 | /libcsplit 160 | /libcthreads 161 | /libfcache 162 | /libfdata 163 | /libfdatetime 164 | /libfwnt 165 | /libuna 166 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Acknowledgements: libagdb 2 | 3 | Copyright (C) 2014-2024, Joachim Metz 4 | 5 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | TODO: 2 | * Fix compression support 3 | * Add MAM file support 4 | * change structures to a common 32-bit and 64-bit structure? 5 | * API / info handle add 6 | - volume device path 7 | - volume creation time 8 | * agdbinfo 9 | * add python bindings 10 | * update manuals: agdbinfo.1 11 | 12 | 20140415 13 | * Initial version based on libmdmp 14 | * see `git log' for more recent change log 15 | 16 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | SUBDIRS = \ 4 | include \ 5 | common \ 6 | libcerror \ 7 | libcthreads \ 8 | libcdata \ 9 | libclocale \ 10 | libcnotify \ 11 | libcsplit \ 12 | libuna \ 13 | libcfile \ 14 | libcpath \ 15 | libbfio \ 16 | libfcache \ 17 | libfdata \ 18 | libfdatetime \ 19 | libfwnt \ 20 | libagdb \ 21 | agdbtools \ 22 | po \ 23 | manuals \ 24 | tests \ 25 | ossfuzz \ 26 | msvscpp 27 | 28 | DPKG_FILES = \ 29 | dpkg/changelog \ 30 | dpkg/changelog.in \ 31 | dpkg/compat \ 32 | dpkg/control \ 33 | dpkg/copyright \ 34 | dpkg/rules \ 35 | dpkg/libagdb-dev.install \ 36 | dpkg/libagdb.install \ 37 | dpkg/libagdb-tools.install \ 38 | dpkg/source/format 39 | 40 | GETTEXT_FILES = \ 41 | config.rpath \ 42 | po/Makevars.in 43 | 44 | PKGCONFIG_FILES = \ 45 | libagdb.pc.in 46 | 47 | SPEC_FILES = \ 48 | libagdb.spec \ 49 | libagdb.spec.in 50 | 51 | EXTRA_DIST = \ 52 | $(DPKG_FILES) \ 53 | $(GETTEXT_FILES) \ 54 | $(PKGCONFIG_FILES) \ 55 | $(SPEC_FILES) 56 | 57 | DISTCLEANFILES = \ 58 | config.status \ 59 | config.cache \ 60 | config.log \ 61 | libagdb.pc \ 62 | libagdb.spec \ 63 | Makefile \ 64 | Makefile.in \ 65 | po/Makevars 66 | 67 | pkgconfigdir = $(libdir)/pkgconfig 68 | 69 | pkgconfig_DATA = \ 70 | libagdb.pc 71 | 72 | libtool: @LIBTOOL_DEPS@ 73 | cd $(srcdir) && $(SHELL) ./config.status --recheck 74 | 75 | lib: library 76 | 77 | library: 78 | (cd $(srcdir)/common && $(MAKE) $(AM_MAKEFLAGS)) 79 | (cd $(srcdir)/libcerror && $(MAKE) $(AM_MAKEFLAGS)) 80 | (cd $(srcdir)/libcthreads && $(MAKE) $(AM_MAKEFLAGS)) 81 | (cd $(srcdir)/libcdata && $(MAKE) $(AM_MAKEFLAGS)) 82 | (cd $(srcdir)/libclocale && $(MAKE) $(AM_MAKEFLAGS)) 83 | (cd $(srcdir)/libcnotify && $(MAKE) $(AM_MAKEFLAGS)) 84 | (cd $(srcdir)/libcsplit && $(MAKE) $(AM_MAKEFLAGS)) 85 | (cd $(srcdir)/libuna && $(MAKE) $(AM_MAKEFLAGS)) 86 | (cd $(srcdir)/libcfile && $(MAKE) $(AM_MAKEFLAGS)) 87 | (cd $(srcdir)/libcpath && $(MAKE) $(AM_MAKEFLAGS)) 88 | (cd $(srcdir)/libbfio && $(MAKE) $(AM_MAKEFLAGS)) 89 | (cd $(srcdir)/libfcache && $(MAKE) $(AM_MAKEFLAGS)) 90 | (cd $(srcdir)/libfdata && $(MAKE) $(AM_MAKEFLAGS)) 91 | (cd $(srcdir)/libfdatetime && $(MAKE) $(AM_MAKEFLAGS)) 92 | (cd $(srcdir)/libfwnt && $(MAKE) $(AM_MAKEFLAGS)) 93 | (cd $(srcdir)/libagdb && $(MAKE) $(AM_MAKEFLAGS)) 94 | (cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS)) 95 | 96 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libagdb/43389aefc12e2cad99a899ad4e8a5598d4f09081/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | libagdb is a library to access the SuperFetch database format. 2 | 3 | Note that this project currently only focuses on the analysis of the format. 4 | 5 | Project information: 6 | 7 | * Status: experimental 8 | * Licence: LGPLv3+ 9 | 10 | Planned: 11 | 12 | * Finish library 13 | 14 | For more information see: 15 | 16 | * Project documentation: https://github.com/libyal/libagdb/wiki/Home 17 | * How to build from source: https://github.com/libyal/libagdb/wiki/Building 18 | 19 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | dnl Checks for required headers and functions 2 | dnl 3 | dnl Version: 20200713 4 | 5 | dnl Function to detect if libagdb dependencies are available 6 | AC_DEFUN([AX_LIBAGDB_CHECK_LOCAL], 7 | [dnl Check for internationalization functions in libagdb/libagdb_i18n.c 8 | AC_CHECK_FUNCS([bindtextdomain]) 9 | ]) 10 | 11 | dnl Function to detect if agdbtools dependencies are available 12 | AC_DEFUN([AX_AGDBTOOLS_CHECK_LOCAL], 13 | [AC_CHECK_HEADERS([signal.h sys/signal.h unistd.h]) 14 | 15 | AC_CHECK_FUNCS([close getopt setvbuf]) 16 | 17 | AS_IF( 18 | [test "x$ac_cv_func_close" != xyes], 19 | [AC_MSG_FAILURE( 20 | [Missing function: close], 21 | [1]) 22 | ]) 23 | ]) 24 | 25 | dnl Function to check if DLL support is needed 26 | AC_DEFUN([AX_LIBAGDB_CHECK_DLL_SUPPORT], 27 | [AS_IF( 28 | [test "x$enable_shared" = xyes && test "x$ac_cv_enable_static_executables" = xno], 29 | [AS_CASE( 30 | [$host], 31 | [*cygwin* | *mingw* | *msys*], 32 | [AC_DEFINE( 33 | [HAVE_DLLMAIN], 34 | [1], 35 | [Define to 1 to enable the DllMain function.]) 36 | AC_SUBST( 37 | [HAVE_DLLMAIN], 38 | [1]) 39 | 40 | AC_SUBST( 41 | [LIBAGDB_DLL_EXPORT], 42 | ["-DLIBAGDB_DLL_EXPORT"]) 43 | 44 | AC_SUBST( 45 | [LIBAGDB_DLL_IMPORT], 46 | ["-DLIBAGDB_DLL_IMPORT"]) 47 | ]) 48 | ]) 49 | ]) 50 | 51 | -------------------------------------------------------------------------------- /agdbtools/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I../include -I$(top_srcdir)/include \ 3 | -I../common -I$(top_srcdir)/common \ 4 | @LIBCERROR_CPPFLAGS@ \ 5 | @LIBCDATA_CPPFLAGS@ \ 6 | @LIBCLOCALE_CPPFLAGS@ \ 7 | @LIBCNOTIFY_CPPFLAGS@ \ 8 | @LIBCSPLIT_CPPFLAGS@ \ 9 | @LIBUNA_CPPFLAGS@ \ 10 | @LIBCFILE_CPPFLAGS@ \ 11 | @LIBCPATH_CPPFLAGS@ \ 12 | @LIBBFIO_CPPFLAGS@ \ 13 | @LIBFDATETIME_CPPFLAGS@ \ 14 | @LIBAGDB_DLL_IMPORT@ 15 | 16 | AM_LDFLAGS = @STATIC_LDFLAGS@ 17 | 18 | bin_PROGRAMS = \ 19 | agdbinfo 20 | 21 | agdbinfo_SOURCES = \ 22 | agdbinfo.c \ 23 | agdbinput.c agdbinput.h \ 24 | agdbtools_getopt.c agdbtools_getopt.h \ 25 | agdbtools_i18n.h \ 26 | agdbtools_libagdb.h \ 27 | agdbtools_libbfio.h \ 28 | agdbtools_libcerror.h \ 29 | agdbtools_libclocale.h \ 30 | agdbtools_libcnotify.h \ 31 | agdbtools_libfdatetime.h \ 32 | agdbtools_libuna.h \ 33 | agdbtools_output.c agdbtools_output.h \ 34 | agdbtools_unused.h \ 35 | info_handle.c info_handle.h 36 | 37 | agdbinfo_LDADD = \ 38 | @LIBFDATETIME_LIBADD@ \ 39 | ../libagdb/libagdb.la \ 40 | @LIBCNOTIFY_LIBADD@ \ 41 | @LIBCLOCALE_LIBADD@ \ 42 | @LIBCERROR_LIBADD@ \ 43 | @LIBINTL@ 44 | 45 | DISTCLEANFILES = \ 46 | Makefile \ 47 | Makefile.in 48 | 49 | splint-local: 50 | @echo "Running splint on agdbinfo ..." 51 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(agdbinfo_SOURCES) 52 | 53 | -------------------------------------------------------------------------------- /agdbtools/agdbinput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common input functions for the agdbtools 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBINPUT_H ) 23 | #define _AGDBINPUT_H 24 | 25 | #include 26 | #include 27 | 28 | #include "agdbtools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | int agdbinput_determine_ascii_codepage( 35 | const system_character_t *string, 36 | int *ascii_codepage, 37 | libcerror_error_t **error ); 38 | 39 | #if defined( __cplusplus ) 40 | } 41 | #endif 42 | 43 | #endif /* !defined( _AGDBINPUT_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_GETOPT_H ) 23 | #define _AGDBTOOLS_GETOPT_H 24 | 25 | #include 26 | #include 27 | 28 | /* unistd.h is included here to export getopt, optarg, optind and optopt 29 | */ 30 | #if defined( HAVE_UNISTD_H ) 31 | #include 32 | #endif 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | #if defined( HAVE_GETOPT ) 39 | #define agdbtools_getopt( argument_count, argument_values, options_string ) \ 40 | getopt( argument_count, argument_values, options_string ) 41 | 42 | #else 43 | 44 | #if !defined( __CYGWIN__ ) 45 | extern int optind; 46 | extern system_character_t *optarg; 47 | extern system_integer_t optopt; 48 | 49 | #else 50 | int optind; 51 | system_character_t *optarg; 52 | system_integer_t optopt; 53 | 54 | #endif /* !defined( __CYGWIN__ ) */ 55 | 56 | system_integer_t agdbtools_getopt( 57 | int argument_count, 58 | system_character_t * const argument_values[], 59 | const system_character_t *options_string ); 60 | 61 | #endif /* defined( HAVE_GETOPT ) */ 62 | 63 | #if defined( __cplusplus ) 64 | } 65 | #endif 66 | 67 | #endif /* !defined( _AGDBTOOLS_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_i18n.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Internationalization (i18n) functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_I18N_H ) 23 | #define _AGDBTOOLS_I18N_H 24 | 25 | #include 26 | 27 | #if defined( HAVE_LIBINTL_H ) 28 | #include 29 | #endif 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | /* TODO for now do nothing i18n-like 36 | #define _( string ) \ 37 | gettext( string ) 38 | */ 39 | 40 | #define _( string ) \ 41 | string 42 | 43 | #if defined( __cplusplus ) 44 | } 45 | #endif 46 | 47 | #endif /* !defined( _AGDBTOOLS_I18N_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_libagdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libagdb header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_LIBAGDB_H ) 23 | #define _AGDBTOOLS_LIBAGDB_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _AGDBTOOLS_LIBAGDB_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_LIBBFIO_H ) 23 | #define _AGDBTOOLS_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _AGDBTOOLS_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_LIBCERROR_H ) 23 | #define _AGDBTOOLS_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _AGDBTOOLS_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_LIBCLOCALE_H ) 23 | #define _AGDBTOOLS_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _AGDBTOOLS_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_LIBCNOTIFY_H ) 23 | #define _AGDBTOOLS_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _AGDBTOOLS_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_libfdatetime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfdatetime header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_LIBFDATETIME_H ) 23 | #define _AGDBTOOLS_LIBFDATETIME_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFDATETIME for local use of libfdatetime 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFDATETIME ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #else 43 | 44 | /* If libtool DLL support is enabled set LIBFDATETIME_DLL_IMPORT 45 | * before including libfdatetime.h 46 | */ 47 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 48 | #define LIBFDATETIME_DLL_IMPORT 49 | #endif 50 | 51 | #include 52 | 53 | #endif /* defined( HAVE_LOCAL_LIBFDATETIME ) */ 54 | 55 | #endif /* !defined( _AGDBTOOLS_LIBFDATETIME_H ) */ 56 | 57 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_LIBUNA_H ) 23 | #define _AGDBTOOLS_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _AGDBTOOLS_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_output.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common output functions for the agdbtools 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_OUTPUT_H ) 23 | #define _AGDBTOOLS_OUTPUT_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "agdbtools_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int agdbtools_output_initialize( 36 | int stdio_mode, 37 | libcerror_error_t **error ); 38 | 39 | void agdbtools_output_copyright_fprint( 40 | FILE *stream ); 41 | 42 | void agdbtools_output_version_fprint( 43 | FILE *stream, 44 | const char *program ); 45 | 46 | void agdbtools_output_version_detailed_fprint( 47 | FILE *stream, 48 | const char *program ); 49 | 50 | #if defined( __cplusplus ) 51 | } 52 | #endif 53 | 54 | #endif /* !defined( _AGDBTOOLS_OUTPUT_H ) */ 55 | 56 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Signal handling functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_SIGNAL_H ) 23 | #define _AGDBTOOLS_SIGNAL_H 24 | 25 | #include 26 | #include 27 | 28 | #include "agdbtools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | #if !defined( HAVE_SIGNAL_H ) && !defined( WINAPI ) 35 | #error missing signal functions 36 | #endif 37 | 38 | #if defined( WINAPI ) 39 | typedef unsigned long agdbtools_signal_t; 40 | 41 | #else 42 | typedef int agdbtools_signal_t; 43 | 44 | #endif /* defined( WINAPI ) */ 45 | 46 | #if defined( WINAPI ) 47 | 48 | BOOL WINAPI agdbtools_signal_handler( 49 | agdbtools_signal_t signal ); 50 | 51 | #if defined( _MSC_VER ) 52 | 53 | void agdbtools_signal_initialize_memory_debug( 54 | void ); 55 | 56 | #endif /* defined( _MSC_VER ) */ 57 | 58 | #endif /* defined( WINAPI ) */ 59 | 60 | int agdbtools_signal_attach( 61 | void (*signal_handler)( agdbtools_signal_t ), 62 | libcerror_error_t **error ); 63 | 64 | int agdbtools_signal_detach( 65 | libcerror_error_t **error ); 66 | 67 | #if defined( __cplusplus ) 68 | } 69 | #endif 70 | 71 | #endif /* !defined( _AGDBTOOLS_SIGNAL_H ) */ 72 | 73 | -------------------------------------------------------------------------------- /agdbtools/agdbtools_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDBTOOLS_UNUSED_H ) 23 | #define _AGDBTOOLS_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( AGDBTOOLS_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define AGDBTOOLS_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define AGDBTOOLS_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( AGDBTOOLS_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define AGDBTOOLS_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define AGDBTOOLS_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _AGDBTOOLS_UNUSED_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /agdbtools/info_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Info handle 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _INFO_HANDLE_H ) 23 | #define _INFO_HANDLE_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "agdbtools_libagdb.h" 30 | #include "agdbtools_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct info_handle info_handle_t; 37 | 38 | struct info_handle 39 | { 40 | /* The libagdb input file 41 | */ 42 | libagdb_file_t *input_file; 43 | 44 | /* The ascii codepage 45 | */ 46 | int ascii_codepage; 47 | 48 | /* The notification output stream 49 | */ 50 | FILE *notify_stream; 51 | 52 | /* Value to indicate if abort was signalled 53 | */ 54 | int abort; 55 | }; 56 | 57 | const char *info_handle_get_stream_type( 58 | uint32_t stream_type ); 59 | 60 | int info_handle_initialize( 61 | info_handle_t **info_handle, 62 | libcerror_error_t **error ); 63 | 64 | int info_handle_free( 65 | info_handle_t **info_handle, 66 | libcerror_error_t **error ); 67 | 68 | int info_handle_signal_abort( 69 | info_handle_t *info_handle, 70 | libcerror_error_t **error ); 71 | 72 | int info_handle_set_ascii_codepage( 73 | info_handle_t *info_handle, 74 | const system_character_t *string, 75 | libcerror_error_t **error ); 76 | 77 | int info_handle_open_input( 78 | info_handle_t *info_handle, 79 | const system_character_t *filename, 80 | libcerror_error_t **error ); 81 | 82 | int info_handle_close_input( 83 | info_handle_t *info_handle, 84 | libcerror_error_t **error ); 85 | 86 | int info_handle_file_fprint( 87 | info_handle_t *info_handle, 88 | libcerror_error_t **error ); 89 | 90 | #if defined( __cplusplus ) 91 | } 92 | #endif 93 | 94 | #endif /* !defined( _INFO_HANDLE_H ) */ 95 | 96 | -------------------------------------------------------------------------------- /autogen.ps1: -------------------------------------------------------------------------------- 1 | # Script to generate the necessary files for a msvscpp build 2 | # 3 | # Version: 20240306 4 | 5 | $WinFlex = "..\win_flex_bison\win_flex.exe" 6 | $WinBison = "..\win_flex_bison\win_bison.exe" 7 | 8 | $Library = Get-Content -Path configure.ac | select -skip 3 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } 9 | $Version = Get-Content -Path configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } 10 | $Prefix = ${Library}.Substring(3) 11 | 12 | Get-Content -Path "include\${Library}.h.in" | Out-File -Encoding ascii "include\${Library}.h" 13 | Get-Content -Path "include\${Library}\definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "include\${Library}\definitions.h" 14 | Get-Content -Path "include\${Library}\features.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } | Out-File -Encoding ascii "include\${Library}\features.h" 15 | Get-Content -Path "include\${Library}\types.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } | Out-File -Encoding ascii "include\${Library}\types.h" 16 | Get-Content -Path "common\types.h.in" | % { $_ -Replace "@PACKAGE@","${Library}" } | Out-File -Encoding ascii "common\types.h" 17 | Get-Content -Path "${Library}\${Library}_definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Library}\${Library}_definitions.h" 18 | Get-Content -Path "${Library}\${Library}.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Library}\${Library}.rc" 19 | 20 | If (Test-Path "setup.cfg.in") 21 | { 22 | Get-Content -Path "setup.cfg.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "setup.cfg" 23 | } 24 | 25 | If (Test-Path "${Prefix}.net") 26 | { 27 | Get-Content -Path "${Prefix}.net\${Prefix}.net.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Prefix}.net\${Prefix}.net.rc" 28 | } 29 | 30 | $NamePrefix = "" 31 | 32 | ForEach (${Library} in Get-ChildItem -Directory -Path "lib*") 33 | { 34 | ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l") 35 | { 36 | $OutputFile = ${DirectoryElement} -Replace ".l$",".c" 37 | 38 | $NamePrefix = Split-Path -path ${DirectoryElement} -leaf 39 | $NamePrefix = ${NamePrefix} -Replace ".l$","_" 40 | 41 | Write-Host "Running: ${WinFlex} -Cf ${DirectoryElement}" 42 | 43 | # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr 44 | # therefore 2>&1 is added and the output is stored in a variable. 45 | $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" 46 | Write-Host ${Output} 47 | 48 | # Moving manually since `win_flex -o filename' does not provide the expected behavior. 49 | Move-Item "lex.yy.c" ${OutputFile} -force 50 | } 51 | 52 | ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.y") 53 | { 54 | $OutputFile = ${DirectoryElement} -Replace ".y$",".c" 55 | 56 | Write-Host "Running: ${WinBison} -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement}" 57 | 58 | # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr 59 | # therefore 2>&1 is added and the output is stored in a variable. 60 | $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" 61 | Write-Host ${Output} 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to generate ./configure using the autotools 3 | # 4 | # Version: 20230405 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | 9 | BINDIR="/usr/bin"; 10 | 11 | if ! test -x "${BINDIR}/aclocal"; 12 | then 13 | BINDIR="/usr/local/bin"; 14 | fi 15 | if ! test -x "${BINDIR}/aclocal"; 16 | then 17 | BINDIR="/usr/local/bin"; 18 | fi 19 | if ! test -x "${BINDIR}/aclocal"; 20 | then 21 | # Default location of MacPorts installed binaries. 22 | BINDIR="/opt/local/bin"; 23 | fi 24 | if ! test -x "${BINDIR}/aclocal"; 25 | then 26 | # Default location of 32-bit MSYS2-MinGW installed binaries. 27 | BINDIR="/mingw32/bin"; 28 | fi 29 | if ! test -x "${BINDIR}/aclocal"; 30 | then 31 | # Default location of 64-bit MSYS2-MinGW installed binaries. 32 | BINDIR="/mingw64/bin"; 33 | fi 34 | 35 | if ! test -x "${BINDIR}/aclocal"; 36 | then 37 | echo "Unable to find autotools"; 38 | 39 | exit ${EXIT_FAILURE}; 40 | fi 41 | 42 | ACLOCAL="${BINDIR}/aclocal"; 43 | AUTOCONF="${BINDIR}/autoconf"; 44 | AUTOHEADER="${BINDIR}/autoheader"; 45 | AUTOMAKE="${BINDIR}/automake"; 46 | AUTOPOINT="${BINDIR}/autopoint"; 47 | AUTORECONF="${BINDIR}/autoreconf"; 48 | LIBTOOLIZE="${BINDIR}/libtoolize"; 49 | PKGCONFIG="${BINDIR}/pkg-config"; 50 | 51 | if test "${OSTYPE}" = "msys"; 52 | then 53 | # Work-around for autopoint failing to detect gettext version 54 | # using func_trace (which is not available) on MSYS by writing 55 | # the gettext version to intl/VERSION. 56 | if ! test -d intl; 57 | then 58 | mkdir intl; 59 | fi 60 | GETTEXT_VERSION=`gettext --version | head -n1 | sed 's/^.* //'`; 61 | 62 | echo "gettext-${GETTEXT_VERSION}" > intl/VERSION; 63 | 64 | elif ! test -x "${PKGCONFIG}"; 65 | then 66 | if test "${BINDIR}" != "/usr/bin"; 67 | then 68 | # On OpenBSD most of the autotools are located in 69 | # /usr/local/bin while pkg-config is located in /usr/bin 70 | PKGCONFIG="/usr/bin/pkg-config"; 71 | fi 72 | if ! test -x "${PKGCONFIG}"; 73 | then 74 | echo "Unable to find: pkg-config"; 75 | 76 | exit ${EXIT_FAILURE}; 77 | fi 78 | fi 79 | 80 | if test -x "${AUTORECONF}"; 81 | then 82 | ${AUTORECONF} --force --install 83 | if test $? -ne 0; 84 | then 85 | exit $?; 86 | fi 87 | else 88 | if ! test -x "${ACLOCAL}"; 89 | then 90 | echo "Unable to find: aclocal"; 91 | 92 | exit ${EXIT_FAILURE}; 93 | fi 94 | 95 | if ! test -x "${AUTOCONF}"; 96 | then 97 | echo "Unable to find: autoconf"; 98 | 99 | exit ${EXIT_FAILURE}; 100 | fi 101 | 102 | if ! test -x "${AUTOHEADER}"; 103 | then 104 | echo "Unable to find: autoheader"; 105 | 106 | exit ${EXIT_FAILURE}; 107 | fi 108 | 109 | if ! test -x "${AUTOMAKE}"; 110 | then 111 | echo "Unable to find: automake"; 112 | 113 | exit ${EXIT_FAILURE}; 114 | fi 115 | 116 | if ! test -x "${AUTOPOINT}"; 117 | then 118 | echo "Unable to find: autopoint"; 119 | 120 | exit ${EXIT_FAILURE}; 121 | fi 122 | 123 | if ! test -x "${LIBTOOLIZE}"; 124 | then 125 | echo "Unable to find: libtoolize"; 126 | 127 | exit ${EXIT_FAILURE}; 128 | fi 129 | 130 | ${AUTOPOINT} --force; 131 | if test $? -ne 0; 132 | then 133 | exit $?; 134 | fi 135 | 136 | ${ACLOCAL} --force --install -I m4; 137 | if test $? -ne 0; 138 | then 139 | exit $?; 140 | fi 141 | 142 | ${LIBTOOLIZE} --force; 143 | if test $? -ne 0; 144 | then 145 | exit $?; 146 | fi 147 | 148 | ${AUTOHEADER} --force; 149 | if test $? -ne 0; 150 | then 151 | exit $?; 152 | fi 153 | 154 | ${AUTOCONF} --force; 155 | if test $? -ne 0; 156 | then 157 | exit $?; 158 | fi 159 | 160 | ${AUTOMAKE} --force --add-missing; 161 | if test $? -ne 0; 162 | then 163 | exit $?; 164 | fi 165 | 166 | fi 167 | 168 | exit ${EXIT_SUCCESS}; 169 | 170 | -------------------------------------------------------------------------------- /common/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I../include -I$(top_srcdir)/include 3 | 4 | EXTRA_DIST = \ 5 | byte_stream.h \ 6 | common.h \ 7 | config.h \ 8 | config_borlandc.h \ 9 | config_msc.h \ 10 | config_winapi.h \ 11 | file_stream.h \ 12 | memory.h \ 13 | narrow_string.h \ 14 | system_string.h \ 15 | types.h \ 16 | types.h.in \ 17 | wide_string.h 18 | 19 | DISTCLEANFILES = \ 20 | config.h \ 21 | types.h \ 22 | Makefile \ 23 | Makefile.in 24 | 25 | -------------------------------------------------------------------------------- /common/common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common include file 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _COMMON_H ) 23 | #define _COMMON_H 24 | 25 | #if defined( HAVE_CONFIG_H ) 26 | #include "config.h" 27 | #endif 28 | 29 | /* Include the Borland/CodeGear C++ Builder compiler specific configuration 30 | */ 31 | #if defined( __BORLANDC__ ) 32 | #include "config_borlandc.h" 33 | 34 | /* Include the Microsoft Visual Studio C++ compiler specific configuration 35 | */ 36 | #elif defined( _MSC_VER ) 37 | #include "config_msc.h" 38 | #endif 39 | 40 | #include "config_winapi.h" 41 | 42 | #endif /* !defined( _COMMON_H ) */ 43 | 44 | -------------------------------------------------------------------------------- /common/config_borlandc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration for the Borland/CodeGear C++ Builder compiler 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _CONFIG_BORLANDC_H ) 23 | #define _CONFIG_BORLANDC_H 24 | 25 | #endif /* !defined( _CONFIG_BORLANDC_H ) */ 26 | 27 | -------------------------------------------------------------------------------- /common/config_msc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration for the Microsoft Visual Studio C++ compiler 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _CONFIG_MSC_H ) 23 | #define _CONFIG_MSC_H 24 | 25 | /* Disable warning C4127: conditional expression is constant 26 | */ 27 | #pragma warning( disable : 4127 ) 28 | 29 | /* Disable warning C4201: nonstandard extension used : nameless struct/union 30 | */ 31 | #pragma warning( disable : 4201 ) 32 | 33 | #endif /* !defined( _CONFIG_MSC_H ) */ 34 | 35 | -------------------------------------------------------------------------------- /common/config_winapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration file for WINAPI 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _CONFIG_WINAPI_H ) 23 | #define _CONFIG_WINAPI_H 24 | 25 | /* Define the earliest supported WINAPI version 26 | #define WINVER 0x0501 27 | */ 28 | 29 | /* If necessary make sure WINAPI is defined 30 | */ 31 | #if defined( HAVE_WINDOWS_H ) || defined( __BORLANDC__ ) || defined( _MSC_VER ) 32 | #include 33 | #endif 34 | 35 | #if defined( WINAPI ) 36 | 37 | /* Define to the address where bug reports for this package should be sent. 38 | */ 39 | #define PACKAGE_BUGREPORT "joachim.metz@gmail.com" 40 | 41 | /* Define the size of the integer for WINAPI 42 | */ 43 | #if !defined( SIZEOF_INT ) 44 | #define SIZEOF_INT 4 45 | #endif 46 | 47 | /* Define the size of size_t for WINAPI 48 | * Do not define when pyconfig.h has been included via python.h 49 | */ 50 | #if !defined( HAVE_PYCONFIG_H ) 51 | 52 | #if !defined( SIZEOF_SIZE_T ) 53 | #if __WORDSIZE == 64 54 | #define SIZEOF_SIZE_T 8 55 | #else 56 | #define SIZEOF_SIZE_T 4 57 | #endif 58 | #endif 59 | 60 | #endif /* !defined( HAVE_PYCONFIG_H ) */ 61 | 62 | /* Define the size of the wide character for WINAPI 63 | */ 64 | #if !defined( SIZEOF_WCHAR_T ) 65 | #define SIZEOF_WCHAR_T 2 66 | #endif 67 | 68 | /* Enable the DllMain function 69 | */ 70 | #define HAVE_DLLMAIN 1 71 | 72 | /* Enable verbose output 73 | #define HAVE_VERBOSE_OUTPUT 1 74 | */ 75 | 76 | /* Enable debug output 77 | #define HAVE_DEBUG_OUTPUT 1 78 | */ 79 | 80 | /* Enable both the narrow and wide character functions 81 | */ 82 | #if !defined( HAVE_WIDE_CHARACTER_TYPE ) 83 | #define HAVE_WIDE_CHARACTER_TYPE 1 84 | #endif 85 | 86 | /* If not controlled by config.h enable multi-thread support 87 | */ 88 | #if !defined( HAVE_CONFIG_H ) && !defined( HAVE_MULTI_THREAD_SUPPORT ) 89 | #define HAVE_MULTI_THREAD_SUPPORT 1 90 | #endif 91 | 92 | #endif /* defined( WINAPI ) */ 93 | 94 | #endif /* !defined( _CONFIG_WINAPI_H ) */ 95 | 96 | -------------------------------------------------------------------------------- /common/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _MEMORY_H ) 23 | #define _MEMORY_H 24 | 25 | #include "common.h" 26 | 27 | #if defined( HAVE_GLIB_H ) 28 | #include 29 | #endif 30 | 31 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 32 | #include 33 | #endif 34 | 35 | #if defined( HAVE_STRING_H ) || defined( WINAPI ) 36 | #include 37 | #endif 38 | 39 | #if defined( __cplusplus ) 40 | extern "C" { 41 | #endif 42 | 43 | /* Note that 128 MiB is an arbitrary selected upper limit here 44 | */ 45 | #define MEMORY_MAXIMUM_ALLOCATION_SIZE \ 46 | ( 128 * 1024 * 1024 ) 47 | 48 | /* Memory allocation 49 | */ 50 | #if defined( HAVE_GLIB_H ) 51 | #define memory_allocate( size ) \ 52 | g_malloc( (gsize) size ) 53 | 54 | #elif defined( WINAPI ) 55 | #define memory_allocate( size ) \ 56 | HeapAlloc( GetProcessHeap(), 0, (SIZE_T) size ) 57 | 58 | #elif defined( HAVE_MALLOC ) 59 | #define memory_allocate( size ) \ 60 | malloc( size ) 61 | #endif 62 | 63 | #define memory_allocate_structure( type ) \ 64 | (type *) memory_allocate( sizeof( type ) ) 65 | 66 | #define memory_allocate_structure_as_value( type ) \ 67 | (intptr_t *) memory_allocate( sizeof( type ) ) 68 | 69 | /* Memory reallocation 70 | */ 71 | #if defined( HAVE_GLIB_H ) 72 | #define memory_reallocate( buffer, size ) \ 73 | g_realloc( (gpointer) buffer, (gsize) size ) 74 | 75 | #elif defined( WINAPI ) 76 | /* HeapReAlloc does not allocate empty (NULL) buffers as realloc does 77 | */ 78 | #define memory_reallocate( buffer, size ) \ 79 | ( buffer == NULL ) ? \ 80 | HeapAlloc( GetProcessHeap(), 0, (SIZE_T) size ) : \ 81 | HeapReAlloc( GetProcessHeap(), 0, (LPVOID) buffer, (SIZE_T) size ) 82 | 83 | #elif defined( HAVE_REALLOC ) 84 | #define memory_reallocate( buffer, size ) \ 85 | realloc( (void *) buffer, size ) 86 | #endif 87 | 88 | /* Memory free 89 | */ 90 | #if defined( HAVE_GLIB_H ) 91 | #define memory_free( buffer ) \ 92 | g_free( (gpointer) buffer ) 93 | 94 | #elif defined( WINAPI ) 95 | #define memory_free( buffer ) \ 96 | ( buffer == NULL ) ? TRUE : HeapFree( GetProcessHeap(), 0, (LPVOID) buffer ) 97 | 98 | #elif defined( HAVE_FREE ) 99 | #define memory_free( buffer ) \ 100 | free( (void *) buffer ) 101 | #endif 102 | 103 | /* Memory compare 104 | */ 105 | #if defined( HAVE_MEMCMP ) || defined( WINAPI ) 106 | #define memory_compare( buffer1, buffer2, size ) \ 107 | memcmp( (const void *) buffer1, (const void *) buffer2, size ) 108 | #endif 109 | 110 | /* Memory copy 111 | */ 112 | #if defined( HAVE_MEMCPY ) || defined( WINAPI ) 113 | #define memory_copy( destination, source, count ) \ 114 | memcpy( (void *) destination, (void *) source, count ) 115 | #endif 116 | 117 | /* Memory set 118 | */ 119 | #if defined( HAVE_MEMSET ) || defined( WINAPI ) 120 | #define memory_set( buffer, value, count ) \ 121 | memset( (void *) buffer, (int) value, count ) 122 | #endif 123 | 124 | #if defined( __cplusplus ) 125 | } 126 | #endif 127 | 128 | #endif /* !defined( _MEMORY_H ) */ 129 | 130 | -------------------------------------------------------------------------------- /dpkg/changelog.in: -------------------------------------------------------------------------------- 1 | libagdb (@VERSION@-1) unstable; urgency=low 2 | 3 | * Auto-generated 4 | 5 | -- Joachim Metz @DPKG_DATE@ 6 | -------------------------------------------------------------------------------- /dpkg/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /dpkg/control: -------------------------------------------------------------------------------- 1 | Source: libagdb 2 | Priority: extra 3 | Maintainer: Joachim Metz 4 | Build-Depends: debhelper (>= 9), dh-autoreconf, pkg-config 5 | Standards-Version: 4.1.4 6 | Section: libs 7 | Homepage: https://github.com/libyal/libagdb 8 | Vcs-Git: https://github.com/libyal/libagdb.git 9 | 10 | Package: libagdb 11 | Architecture: any 12 | Depends: ${shlibs:Depends}, ${misc:Depends} 13 | Conflicts: libagdb1 14 | Replaces: libagdb1 15 | Suggests: libagdb-dbg 16 | Description: Library to access the Windows SuperFetch database (AGDB) file format 17 | libagdb is a library to access the Windows SuperFetch database (AGDB) file format. 18 | 19 | Package: libagdb-dbg 20 | Architecture: any 21 | Section: debug 22 | Depends: libagdb (= ${binary:Version}), ${misc:Depends} 23 | Description: Debugging symbols for libagdb 24 | Debugging symbols for libagdb. 25 | 26 | Package: libagdb-dev 27 | Section: libdevel 28 | Architecture: any 29 | Depends: libagdb (= ${binary:Version}), ${misc:Depends} 30 | Description: Header files and libraries for developing applications for libagdb 31 | Header files and libraries for developing applications for libagdb. 32 | 33 | Package: libagdb-tools 34 | Section: utils 35 | Architecture: any 36 | Depends: libagdb (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} 37 | Conflicts: libagdb-utils 38 | Replaces: libagdb-utils 39 | Description: Several tools for reading Windows SuperFetch database (AGDB) files 40 | Several tools for reading Windows SuperFetch database (AGDB) files. 41 | 42 | Package: libagdb-tools-dbg 43 | Section: debug 44 | Architecture: any 45 | Depends: libagdb-tools (= ${binary:Version}), ${misc:Depends} 46 | Description: Debugging symbols for libagdb-tools 47 | Debugging symbols for libagdb-tools. 48 | 49 | -------------------------------------------------------------------------------- /dpkg/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: libagdb 3 | Source: https://github.com/libyal/libagdb 4 | 5 | Files: * 6 | Copyright: 2014-2024, Joachim Metz 7 | License: LGPL-3.0+ 8 | 9 | License: LGPL-3.0+ 10 | This package is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU Lesser General Public 12 | License as published by the Free Software Foundation; either 13 | version 3 of the License, or (at your option) any later version. 14 | . 15 | This package is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | Lesser General Public License for more details. 19 | . 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see . 22 | . 23 | On Debian systems, the complete text of the GNU Lesser General 24 | Public License can be found in "/usr/share/common-licenses/LGPL-3". 25 | 26 | -------------------------------------------------------------------------------- /dpkg/libagdb-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/* 2 | usr/lib/*-*/lib*.a 3 | usr/lib/*-*/lib*.so 4 | usr/lib/*-*/pkgconfig/* 5 | usr/share/man/man3 6 | -------------------------------------------------------------------------------- /dpkg/libagdb-tools.install: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/share/man/man1 3 | -------------------------------------------------------------------------------- /dpkg/libagdb.install: -------------------------------------------------------------------------------- 1 | usr/lib/*-*/lib*.so.* 2 | -------------------------------------------------------------------------------- /dpkg/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # Uncomment for debhelper verbose output. 5 | # export DH_VERBOSE=1 6 | 7 | %: 8 | dh $@ --buildsystem=autoconf --with=autoreconf 9 | 10 | .PHONY: override_dh_auto_configure 11 | override_dh_auto_configure: 12 | dh_auto_configure -- CFLAGS="-g" 13 | 14 | .PHONY: override_dh_install 15 | override_dh_install: 16 | dh_install --fail-missing -X.la 17 | 18 | .PHONY: override_dh_strip 19 | override_dh_strip: 20 | ifeq (,$(filter nostrip,$(DEB_BUILD_OPTIONS))) 21 | dh_strip -plibagdb --dbg-package=libagdb-dbg 22 | dh_strip -plibagdb-tools --dbg-package=libagdb-tools-dbg 23 | endif 24 | 25 | -------------------------------------------------------------------------------- /dpkg/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | include_HEADERS = \ 2 | libagdb.h 3 | 4 | pkginclude_HEADERS = \ 5 | libagdb/codepage.h \ 6 | libagdb/definitions.h \ 7 | libagdb/error.h \ 8 | libagdb/extern.h \ 9 | libagdb/features.h \ 10 | libagdb/types.h 11 | 12 | EXTRA_DIST = \ 13 | libagdb.h.in \ 14 | libagdb/definitions.h.in \ 15 | libagdb/features.h.in \ 16 | libagdb/types.h.in 17 | 18 | DISTCLEANFILES = \ 19 | libagdb.h \ 20 | libagdb/definitions.h \ 21 | libagdb/features.h \ 22 | libagdb/types.h \ 23 | Makefile \ 24 | Makefile.in 25 | 26 | -------------------------------------------------------------------------------- /include/libagdb/definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for libagdb 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_DEFINITIONS_H ) 23 | #define _LIBAGDB_DEFINITIONS_H 24 | 25 | #include 26 | 27 | #define LIBAGDB_VERSION @VERSION@ 28 | 29 | /* The version string 30 | */ 31 | #define LIBAGDB_VERSION_STRING "@VERSION@" 32 | 33 | /* The access flags definitions 34 | * bit 1 set to 1 for read access 35 | * bit 2 set to 1 for write access 36 | * bit 3-8 not used 37 | */ 38 | enum LIBAGDB_ACCESS_FLAGS 39 | { 40 | LIBAGDB_ACCESS_FLAG_READ = 0x01, 41 | /* Reserved: not supported yet */ 42 | LIBAGDB_ACCESS_FLAG_WRITE = 0x02 43 | }; 44 | 45 | /* The file access macros 46 | */ 47 | #define LIBAGDB_OPEN_READ ( LIBAGDB_ACCESS_FLAG_READ ) 48 | /* Reserved: not supported yet */ 49 | #define LIBAGDB_OPEN_WRITE ( LIBAGDB_ACCESS_FLAG_WRITE ) 50 | /* Reserved: not supported yet */ 51 | #define LIBAGDB_OPEN_READ_WRITE ( LIBAGDB_ACCESS_FLAG_READ | LIBAGDB_ACCESS_FLAG_WRITE ) 52 | 53 | /* The file type definitions 54 | */ 55 | enum LIBAGDB_FILE_TYPES 56 | { 57 | LIBAGDB_FILE_TYPE_UNCOMPRESSED = 1, 58 | LIBAGDB_FILE_TYPE_COMPRESSED_VISTA = 2, 59 | LIBAGDB_FILE_TYPE_COMPRESSED_WINDOWS7 = 3, 60 | LIBAGDB_FILE_TYPE_COMPRESSED_WINDOWS8 = 4 61 | }; 62 | 63 | #endif /* !defined( _LIBAGDB_DEFINITIONS_H ) */ 64 | 65 | -------------------------------------------------------------------------------- /include/libagdb/extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The extern definition 3 | * 4 | * This header should be included in header files that export or import 5 | * library functions 6 | * 7 | * Copyright (C) 2014-2024, Joachim Metz 8 | * 9 | * Refer to AUTHORS for acknowledgements. 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public License 22 | * along with this program. If not, see . 23 | */ 24 | 25 | #if !defined( _LIBAGDB_EXTERN_H ) 26 | #define _LIBAGDB_EXTERN_H 27 | 28 | /* To export functions from the libagdb DLL define LIBAGDB_DLL_EXPORT 29 | * To import functions from the libagdb DLL define LIBAGDB_DLL_IMPORT 30 | * Otherwise use default extern statement 31 | */ 32 | #if defined( LIBAGDB_DLL_EXPORT ) 33 | #define LIBAGDB_EXTERN __declspec(dllexport) 34 | 35 | #elif defined( LIBAGDB_DLL_IMPORT ) 36 | #define LIBAGDB_EXTERN extern __declspec(dllimport) 37 | 38 | #else 39 | #define LIBAGDB_EXTERN extern 40 | 41 | #endif 42 | 43 | #endif /* !defined( _LIBAGDB_EXTERN_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /include/libagdb/features.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Features of libagdb 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_FEATURES_H ) 23 | #define _LIBAGDB_FEATURES_H 24 | 25 | /* The libagdb type support features 26 | */ 27 | #if defined( WINAPI ) || @HAVE_WIDE_CHARACTER_TYPE@ 28 | #define LIBAGDB_HAVE_WIDE_CHARACTER_TYPE 1 29 | #endif 30 | 31 | #if defined( WINAPI ) || @HAVE_MULTI_THREAD_SUPPORT@ 32 | #define LIBAGDB_HAVE_MULTI_THREAD_SUPPORT 1 33 | #endif 34 | 35 | #if defined( HAVE_LIBBFIO ) || ( !defined( WINAPI ) && @HAVE_LIBBFIO@ ) 36 | #define LIBAGDB_HAVE_BFIO 1 37 | #endif 38 | 39 | #if !defined( LIBAGDB_DEPRECATED ) 40 | #if defined( __GNUC__ ) && __GNUC__ >= 3 41 | #define LIBAGDB_DEPRECATED __attribute__ ((__deprecated__)) 42 | #elif defined( _MSC_VER ) 43 | #define LIBAGDB_DEPRECATED __declspec(deprecated) 44 | #else 45 | #define LIBAGDB_DEPRECATED 46 | #endif 47 | #endif 48 | 49 | #endif /* !defined( _LIBAGDB_FEATURES_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libagdb.ini: -------------------------------------------------------------------------------- 1 | [project] 2 | description: "libagdb is a library to access the SuperFetch database format." 3 | name: "libagdb" 4 | status: "experimental" 5 | year_of_creation: "2014" 6 | documentation_url: "https://github.com/libyal/libagdb/tree/main/documentation" 7 | features: ["debug_output", "ossfuzz", "tools"] 8 | 9 | [library] 10 | description: "Library to access the Windows SuperFetch database (AGDB) file format" 11 | features: ["pthread", "wide_character_type"] 12 | public_types: ["file", "file_information", "source_information", "volume_information"] 13 | 14 | [tools] 15 | description: "Several tools for reading Windows SuperFetch database (AGDB) files" 16 | names: ["agdbinfo"] 17 | 18 | [info_tool] 19 | source_description: "a Windows SuperFetch database file" 20 | source_type: "file" 21 | 22 | [troubleshooting] 23 | example: "agdbinfo AgRobust.db" 24 | 25 | [tests] 26 | profiles: ["libagdb", "agdbinfo"] 27 | info_tool_options_per_profile: [""] 28 | info_tool_profiles: ["agdbinfo"] 29 | example_filename1: "AgRobust.db" 30 | example_filename2: "AgGlGlobalHistory.db" 31 | 32 | -------------------------------------------------------------------------------- /libagdb.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libagdb 7 | Description: Library to access the Windows SuperFetch database (AGDB) file format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lagdb 10 | Libs.private: @ax_libbfio_pc_libs_private@ @ax_libcdata_pc_libs_private@ @ax_libcerror_pc_libs_private@ @ax_libcfile_pc_libs_private@ @ax_libclocale_pc_libs_private@ @ax_libcnotify_pc_libs_private@ @ax_libcpath_pc_libs_private@ @ax_libcsplit_pc_libs_private@ @ax_libcthreads_pc_libs_private@ @ax_libfcache_pc_libs_private@ @ax_libfdata_pc_libs_private@ @ax_libfdatetime_pc_libs_private@ @ax_libfwnt_pc_libs_private@ @ax_libuna_pc_libs_private@ @ax_pthread_pc_libs_private@ 11 | Cflags: -I${includedir} 12 | 13 | -------------------------------------------------------------------------------- /libagdb.spec.in: -------------------------------------------------------------------------------- 1 | Name: libagdb 2 | Version: @VERSION@ 3 | Release: 1 4 | Summary: Library to access the Windows SuperFetch database (AGDB) file format 5 | Group: System Environment/Libraries 6 | License: LGPL-3.0-or-later 7 | Source: %{name}-%{version}.tar.gz 8 | URL: https://github.com/libyal/libagdb 9 | @libagdb_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_libfwnt_spec_requires@ @ax_libuna_spec_requires@ 10 | 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_libfwnt_spec_build_requires@ @ax_libuna_spec_build_requires@ 11 | 12 | %description -n libagdb 13 | Library to access the Windows SuperFetch database (AGDB) file format 14 | 15 | %package -n libagdb-static 16 | Summary: Library to access the Windows SuperFetch database (AGDB) file format 17 | Group: Development/Libraries 18 | Requires: libagdb = %{version}-%{release} 19 | 20 | %description -n libagdb-static 21 | Static library version of libagdb. 22 | 23 | %package -n libagdb-devel 24 | Summary: Header files and libraries for developing applications for libagdb 25 | Group: Development/Libraries 26 | Requires: libagdb = %{version}-%{release} 27 | 28 | %description -n libagdb-devel 29 | Header files and libraries for developing applications for libagdb. 30 | 31 | %package -n libagdb-tools 32 | Summary: Several tools for reading Windows SuperFetch database (AGDB) files 33 | Group: Applications/System 34 | Requires: libagdb = %{version}-%{release} 35 | 36 | %description -n libagdb-tools 37 | Several tools for reading Windows SuperFetch database (AGDB) files 38 | 39 | %prep 40 | %setup -q 41 | 42 | %build 43 | %configure --prefix=/usr --libdir=%{_libdir} --mandir=%{_mandir} 44 | make %{?_smp_mflags} 45 | 46 | %install 47 | rm -rf %{buildroot} 48 | %make_install 49 | 50 | %clean 51 | rm -rf %{buildroot} 52 | 53 | %post -p /sbin/ldconfig 54 | 55 | %postun -p /sbin/ldconfig 56 | 57 | %files -n libagdb 58 | %license COPYING COPYING.LESSER 59 | %doc AUTHORS README 60 | %{_libdir}/*.so.* 61 | 62 | %files -n libagdb-static 63 | %license COPYING COPYING.LESSER 64 | %doc AUTHORS README 65 | %{_libdir}/*.a 66 | 67 | %files -n libagdb-devel 68 | %license COPYING COPYING.LESSER 69 | %doc AUTHORS README 70 | %{_libdir}/*.so 71 | %{_libdir}/pkgconfig/libagdb.pc 72 | %{_includedir}/* 73 | %{_mandir}/man3/* 74 | 75 | %files -n libagdb-tools 76 | %license COPYING COPYING.LESSER 77 | %doc AUTHORS README 78 | %{_bindir}/* 79 | %{_mandir}/man1/* 80 | 81 | %changelog 82 | * @SPEC_DATE@ Joachim Metz @VERSION@-1 83 | - Auto-generated 84 | 85 | -------------------------------------------------------------------------------- /libagdb/Makefile.am: -------------------------------------------------------------------------------- 1 | AM_CPPFLAGS = \ 2 | -I../include -I$(top_srcdir)/include \ 3 | -I../common -I$(top_srcdir)/common \ 4 | @LIBCERROR_CPPFLAGS@ \ 5 | @LIBCTHREADS_CPPFLAGS@ \ 6 | @LIBCDATA_CPPFLAGS@ \ 7 | @LIBCLOCALE_CPPFLAGS@ \ 8 | @LIBCNOTIFY_CPPFLAGS@ \ 9 | @LIBCSPLIT_CPPFLAGS@ \ 10 | @LIBUNA_CPPFLAGS@ \ 11 | @LIBCFILE_CPPFLAGS@ \ 12 | @LIBCPATH_CPPFLAGS@ \ 13 | @LIBBFIO_CPPFLAGS@ \ 14 | @LIBFCACHE_CPPFLAGS@ \ 15 | @LIBFDATA_CPPFLAGS@ \ 16 | @LIBFDATETIME_CPPFLAGS@ \ 17 | @LIBFWNT_CPPFLAGS@ \ 18 | @PTHREAD_CPPFLAGS@ \ 19 | @LIBAGDB_DLL_EXPORT@ 20 | 21 | lib_LTLIBRARIES = libagdb.la 22 | 23 | libagdb_la_SOURCES = \ 24 | agdb_file_header.h \ 25 | agdb_file_information.h \ 26 | agdb_source_information.h \ 27 | agdb_volume_information.h \ 28 | libagdb.c \ 29 | libagdb_codepage.h \ 30 | libagdb_compressed_block.c libagdb_compressed_block.h \ 31 | libagdb_compressed_blocks_stream.c libagdb_compressed_blocks_stream.h \ 32 | libagdb_compressed_blocks_stream_data_handle.c libagdb_compressed_blocks_stream_data_handle.h \ 33 | libagdb_compressed_file_header.c libagdb_compressed_file_header.h \ 34 | libagdb_debug.c libagdb_debug.h \ 35 | libagdb_definitions.h \ 36 | libagdb_error.c libagdb_error.h \ 37 | libagdb_extern.h \ 38 | libagdb_file.c libagdb_file.h \ 39 | libagdb_file_information.c libagdb_file_information.h \ 40 | libagdb_hash.c libagdb_hash.h \ 41 | libagdb_io_handle.c libagdb_io_handle.h \ 42 | libagdb_libbfio.h \ 43 | libagdb_libcdata.h \ 44 | libagdb_libcerror.h \ 45 | libagdb_libclocale.h \ 46 | libagdb_libcnotify.h \ 47 | libagdb_libfcache.h \ 48 | libagdb_libfdata.h \ 49 | libagdb_libfdatetime.h \ 50 | libagdb_libfwnt.h \ 51 | libagdb_libuna.h \ 52 | libagdb_notify.c libagdb_notify.h \ 53 | libagdb_source_information.c libagdb_source_information.h \ 54 | libagdb_support.c libagdb_support.h \ 55 | libagdb_types.h \ 56 | libagdb_unused.h \ 57 | libagdb_volume_information.c libagdb_volume_information.h 58 | 59 | libagdb_la_LIBADD = \ 60 | @LIBCERROR_LIBADD@ \ 61 | @LIBCTHREADS_LIBADD@ \ 62 | @LIBCDATA_LIBADD@ \ 63 | @LIBCLOCALE_LIBADD@ \ 64 | @LIBCNOTIFY_LIBADD@ \ 65 | @LIBCSPLIT_LIBADD@ \ 66 | @LIBUNA_LIBADD@ \ 67 | @LIBCFILE_LIBADD@ \ 68 | @LIBCPATH_LIBADD@ \ 69 | @LIBBFIO_LIBADD@ \ 70 | @LIBFCACHE_LIBADD@ \ 71 | @LIBFDATA_LIBADD@ \ 72 | @LIBFDATETIME_LIBADD@ \ 73 | @LIBFWNT_LIBADD@ \ 74 | @PTHREAD_LIBADD@ 75 | 76 | libagdb_la_LDFLAGS = -no-undefined -version-info 1:0:0 77 | 78 | EXTRA_DIST = \ 79 | libagdb_definitions.h.in \ 80 | libagdb.rc \ 81 | libagdb.rc.in 82 | 83 | DISTCLEANFILES = \ 84 | libagdb_definitions.h \ 85 | libagdb.rc \ 86 | Makefile \ 87 | Makefile.in 88 | 89 | sources-local: $(BUILT_SOURCES) 90 | 91 | splint-local: 92 | @echo "Running splint on libagdb ..." 93 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(libagdb_la_SOURCES) 94 | 95 | -------------------------------------------------------------------------------- /libagdb/agdb_volume_information.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The volume information definitions of a Windows SuperFetch database file 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_VOLUME_INFORMATION_H ) 23 | #define _AGDB_VOLUME_INFORMATION_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct agdb_volume_information_56 agdb_volume_information_56_t; 33 | 34 | struct agdb_volume_information_56 35 | { 36 | /* Unknown 37 | * Consists of 4 bytes 38 | */ 39 | uint8_t unknown1[ 4 ]; 40 | 41 | /* Unknown 42 | * Consists of 4 bytes 43 | */ 44 | uint8_t unknown2[ 4 ]; 45 | 46 | /* The number of files 47 | * Consists of 4 bytes 48 | */ 49 | uint8_t number_of_files[ 4 ]; 50 | 51 | /* Unknown 52 | * Consists of 4 bytes 53 | */ 54 | uint8_t unknown3[ 4 ]; 55 | 56 | /* Unknown 57 | * Consists of 8 bytes 58 | */ 59 | uint8_t unknown4[ 8 ]; 60 | 61 | /* The (volume) creation time 62 | * Consists of 8 bytes 63 | */ 64 | uint8_t creation_time[ 8 ]; 65 | 66 | /* The (volume) serial number 67 | * Consists of 4 bytes 68 | */ 69 | uint8_t serial_number[ 4 ]; 70 | 71 | /* Unknown 72 | * Consists of 4 bytes 73 | */ 74 | uint8_t unknown5[ 4 ]; 75 | 76 | /* Unknown 77 | * Consists of 4 bytes 78 | */ 79 | uint8_t unknown6[ 4 ]; 80 | 81 | /* The (volume) device path number of characters 82 | * Consists of 2 bytes 83 | */ 84 | uint8_t device_path_number_of_characters[ 2 ]; 85 | 86 | /* Unknown 87 | * Consists of 2 bytes 88 | */ 89 | uint8_t unknown7[ 2 ]; 90 | 91 | /* Unknown 92 | * Consists of 8 bytes 93 | */ 94 | uint8_t unknown9[ 8 ]; 95 | }; 96 | 97 | typedef struct agdb_volume_information_72 agdb_volume_information_72_t; 98 | 99 | struct agdb_volume_information_72 100 | { 101 | /* Unknown 102 | * Consists of 8 bytes 103 | */ 104 | uint8_t unknown1[ 8 ]; 105 | 106 | /* Unknown 107 | * Consists of 8 bytes 108 | */ 109 | uint8_t unknown2[ 8 ]; 110 | 111 | /* The number of files 112 | * Consists of 4 bytes 113 | */ 114 | uint8_t number_of_files[ 4 ]; 115 | 116 | /* Unknown 117 | * Consists of 4 bytes 118 | */ 119 | uint8_t unknown3[ 4 ]; 120 | 121 | /* Unknown 122 | * Consists of 8 bytes 123 | */ 124 | uint8_t unknown4[ 8 ]; 125 | 126 | /* The (volume) creation time 127 | * Consists of 8 bytes 128 | */ 129 | uint8_t creation_time[ 8 ]; 130 | 131 | /* The (volume) serial number 132 | * Consists of 4 bytes 133 | */ 134 | uint8_t serial_number[ 4 ]; 135 | 136 | /* Unknown 137 | * Consists of 4 bytes 138 | */ 139 | uint8_t unknown5[ 4 ]; 140 | 141 | /* Unknown 142 | * Consists of 8 bytes 143 | */ 144 | uint8_t unknown6[ 8 ]; 145 | 146 | /* The (volume) device path number of characters 147 | * Consists of 2 bytes 148 | */ 149 | uint8_t device_path_number_of_characters[ 2 ]; 150 | 151 | /* Unknown 152 | * Consists of 2 bytes 153 | */ 154 | uint8_t unknown7[ 2 ]; 155 | 156 | /* Unknown 157 | * Consists of 4 bytes 158 | */ 159 | uint8_t unknown8[ 4 ]; 160 | 161 | /* Unknown 162 | * Consists of 8 bytes 163 | */ 164 | uint8_t unknown9[ 8 ]; 165 | }; 166 | 167 | #if defined( __cplusplus ) 168 | } 169 | #endif 170 | 171 | #endif /* !defined( _AGDB_VOLUME_INFORMATION_H ) */ 172 | 173 | -------------------------------------------------------------------------------- /libagdb/libagdb.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library to access the Windows SuperFetch database (AGDB) file format 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | 24 | #if defined( WINAPI ) 25 | #include 26 | #endif 27 | 28 | #include "libagdb_unused.h" 29 | 30 | /* Define HAVE_LOCAL_LIBAGDB for local use of libagdb 31 | */ 32 | #if !defined( HAVE_LOCAL_LIBAGDB ) 33 | 34 | #if defined( WINAPI ) && defined( HAVE_DLLMAIN ) 35 | 36 | #if defined( _MANAGED ) 37 | #pragma managed( push, off ) 38 | #endif 39 | 40 | /* Defines the entry point for the DLL 41 | */ 42 | BOOL WINAPI DllMain( 43 | HINSTANCE hinstDLL, 44 | DWORD fdwReason, 45 | LPVOID lpvReserved ) 46 | { 47 | LIBAGDB_UNREFERENCED_PARAMETER( lpvReserved ) 48 | 49 | switch( fdwReason ) 50 | { 51 | case DLL_PROCESS_ATTACH: 52 | DisableThreadLibraryCalls( 53 | hinstDLL ); 54 | break; 55 | 56 | case DLL_THREAD_ATTACH: 57 | break; 58 | 59 | case DLL_THREAD_DETACH: 60 | break; 61 | 62 | case DLL_PROCESS_DETACH: 63 | break; 64 | } 65 | return( TRUE ); 66 | } 67 | 68 | /* Function that indicates the library is a DLL 69 | * Returns 1 70 | */ 71 | int libagdb_is_dll( 72 | void ) 73 | { 74 | return( 1 ); 75 | } 76 | 77 | #endif /* defined( WINAPI ) && defined( HAVE_DLLMAIN ) */ 78 | 79 | #endif /* !defined( HAVE_LOCAL_LIBAGDB ) */ 80 | 81 | -------------------------------------------------------------------------------- /libagdb/libagdb.rc.in: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef GCC_WINDRES 4 | VS_VERSION_INFO VERSIONINFO 5 | #else 6 | VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE 7 | #endif 8 | FILEVERSION 1,0,0,0 9 | PRODUCTVERSION 1,0,0,0 10 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 11 | #ifdef _DEBUG 12 | FILEFLAGS 0x1L 13 | #else 14 | FILEFLAGS 0x0L 15 | #endif 16 | FILEOS VOS__WINDOWS32 17 | FILETYPE VFT_DLL 18 | FILESUBTYPE 0x0L 19 | BEGIN 20 | BLOCK "StringFileInfo" 21 | BEGIN 22 | BLOCK "040904E4" 23 | BEGIN 24 | VALUE "FileDescription", "Library to access the Windows SuperFetch database (AGDB) file format\0" 25 | VALUE "FileVersion", "@VERSION@" "\0" 26 | VALUE "InternalName", "libagdb.dll\0" 27 | VALUE "LegalCopyright", "(C) 2014-2024, Joachim Metz \0" 28 | VALUE "OriginalFilename", "libagdb.dll\0" 29 | VALUE "ProductName", "libagdb\0" 30 | VALUE "ProductVersion", "@VERSION@" "\0" 31 | VALUE "Comments", "For more information visit https://github.com/libyal/libagdb/\0" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x0409, 1200 37 | END 38 | END 39 | -------------------------------------------------------------------------------- /libagdb/libagdb_codepage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Codepage functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_INTERNAL_CODEPAGE_H ) 23 | #define _LIBAGDB_INTERNAL_CODEPAGE_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | /* Define HAVE_LOCAL_LIBAGDB for local use of libagdb 33 | * The definitions in are copied here 34 | * for local use of libagdb 35 | */ 36 | #if !defined( HAVE_LOCAL_LIBAGDB ) 37 | 38 | #include 39 | 40 | #else 41 | 42 | /* The codepage definitions 43 | */ 44 | enum LIBAGDB_CODEPAGES 45 | { 46 | LIBAGDB_CODEPAGE_ASCII = 20127, 47 | 48 | LIBAGDB_CODEPAGE_ISO_8859_1 = 28591, 49 | LIBAGDB_CODEPAGE_ISO_8859_2 = 28592, 50 | LIBAGDB_CODEPAGE_ISO_8859_3 = 28593, 51 | LIBAGDB_CODEPAGE_ISO_8859_4 = 28594, 52 | LIBAGDB_CODEPAGE_ISO_8859_5 = 28595, 53 | LIBAGDB_CODEPAGE_ISO_8859_6 = 28596, 54 | LIBAGDB_CODEPAGE_ISO_8859_7 = 28597, 55 | LIBAGDB_CODEPAGE_ISO_8859_8 = 28598, 56 | LIBAGDB_CODEPAGE_ISO_8859_9 = 28599, 57 | LIBAGDB_CODEPAGE_ISO_8859_10 = 28600, 58 | LIBAGDB_CODEPAGE_ISO_8859_11 = 28601, 59 | LIBAGDB_CODEPAGE_ISO_8859_13 = 28603, 60 | LIBAGDB_CODEPAGE_ISO_8859_14 = 28604, 61 | LIBAGDB_CODEPAGE_ISO_8859_15 = 28605, 62 | LIBAGDB_CODEPAGE_ISO_8859_16 = 28606, 63 | 64 | LIBAGDB_CODEPAGE_KOI8_R = 20866, 65 | LIBAGDB_CODEPAGE_KOI8_U = 21866, 66 | 67 | LIBAGDB_CODEPAGE_WINDOWS_874 = 874, 68 | LIBAGDB_CODEPAGE_WINDOWS_932 = 932, 69 | LIBAGDB_CODEPAGE_WINDOWS_936 = 936, 70 | LIBAGDB_CODEPAGE_WINDOWS_949 = 949, 71 | LIBAGDB_CODEPAGE_WINDOWS_950 = 950, 72 | LIBAGDB_CODEPAGE_WINDOWS_1250 = 1250, 73 | LIBAGDB_CODEPAGE_WINDOWS_1251 = 1251, 74 | LIBAGDB_CODEPAGE_WINDOWS_1252 = 1252, 75 | LIBAGDB_CODEPAGE_WINDOWS_1253 = 1253, 76 | LIBAGDB_CODEPAGE_WINDOWS_1254 = 1254, 77 | LIBAGDB_CODEPAGE_WINDOWS_1255 = 1255, 78 | LIBAGDB_CODEPAGE_WINDOWS_1256 = 1256, 79 | LIBAGDB_CODEPAGE_WINDOWS_1257 = 1257, 80 | LIBAGDB_CODEPAGE_WINDOWS_1258 = 1258 81 | }; 82 | 83 | #endif /* !defined( HAVE_LOCAL_LIBAGDB ) */ 84 | 85 | #if defined( __cplusplus ) 86 | } 87 | #endif 88 | 89 | #endif /* !defined( _LIBAGDB_INTERNAL_CODEPAGE_H ) */ 90 | 91 | -------------------------------------------------------------------------------- /libagdb/libagdb_compressed_block.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Compressed block functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_COMPRESSED_BLOCK_H ) 23 | #define _LIBAGDB_COMPRESSED_BLOCK_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_io_handle.h" 29 | #include "libagdb_libcerror.h" 30 | #include "libagdb_libfcache.h" 31 | #include "libagdb_libfdata.h" 32 | 33 | #if defined( __cplusplus ) 34 | extern "C" { 35 | #endif 36 | 37 | typedef struct libagdb_compressed_block libagdb_compressed_block_t; 38 | 39 | struct libagdb_compressed_block 40 | { 41 | /* The data 42 | */ 43 | uint8_t *data; 44 | 45 | /* The data size 46 | */ 47 | size_t data_size; 48 | }; 49 | 50 | int libagdb_compressed_block_initialize( 51 | libagdb_compressed_block_t **compressed_block, 52 | size_t data_size, 53 | libcerror_error_t **error ); 54 | 55 | int libagdb_compressed_block_free( 56 | libagdb_compressed_block_t **compressed_block, 57 | libcerror_error_t **error ); 58 | 59 | int libagdb_compressed_block_read( 60 | libagdb_compressed_block_t *compressed_block, 61 | libagdb_io_handle_t *io_handle, 62 | libbfio_handle_t *file_io_handle, 63 | off64_t compressed_block_offset, 64 | size_t compressed_block_size, 65 | libcerror_error_t **error ); 66 | 67 | int libagdb_compressed_block_read_element_data( 68 | libagdb_io_handle_t *io_handle, 69 | libbfio_handle_t *file_io_handle, 70 | libfdata_list_element_t *element, 71 | libfcache_cache_t *cache, 72 | int element_file_index, 73 | off64_t compressed_block_offset, 74 | size64_t compressed_block_size, 75 | uint32_t compressed_block_flags, 76 | uint8_t read_flags, 77 | libcerror_error_t **error ); 78 | 79 | #if defined( __cplusplus ) 80 | } 81 | #endif 82 | 83 | #endif /* !defined( _LIBAGDB_COMPRESSED_BLOCK_H ) */ 84 | 85 | -------------------------------------------------------------------------------- /libagdb/libagdb_compressed_blocks_stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The compressed blocks stream functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_COMPRESSED_BLOCKS_STREAM_H ) 23 | #define _LIBAGDB_COMPRESSED_BLOCKS_STREAM_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_libcerror.h" 29 | #include "libagdb_libfcache.h" 30 | #include "libagdb_libfdata.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | int libagdb_compressed_blocks_stream_initialize( 37 | libfdata_stream_t **compressed_blocks_stream, 38 | libfdata_list_t *compressed_blocks_list, 39 | libfcache_cache_t *compressed_blocks_cache, 40 | libcerror_error_t **error ); 41 | 42 | #if defined( __cplusplus ) 43 | } 44 | #endif 45 | 46 | #endif /* !defined( _LIBAGDB_COMPRESSED_BLOCKS_STREAM_H ) */ 47 | 48 | -------------------------------------------------------------------------------- /libagdb/libagdb_compressed_blocks_stream_data_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The compressed blocks stream data handle functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_COMPRESSED_BLOCKS_STREAM_DATA_HANDLE_H ) 23 | #define _LIBAGDB_COMPRESSED_BLOCKS_STREAM_DATA_HANDLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_libcerror.h" 29 | #include "libagdb_libfcache.h" 30 | #include "libagdb_libfdata.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct libagdb_compressed_blocks_stream_data_handle libagdb_compressed_blocks_stream_data_handle_t; 37 | 38 | struct libagdb_compressed_blocks_stream_data_handle 39 | { 40 | /* The current offset 41 | */ 42 | off64_t current_offset; 43 | 44 | /* The compressed blocks list 45 | */ 46 | libfdata_list_t *compressed_blocks_list; 47 | 48 | /* The compressed blocks cache 49 | */ 50 | libfcache_cache_t *compressed_blocks_cache; 51 | }; 52 | 53 | int libagdb_compressed_blocks_stream_data_handle_initialize( 54 | libagdb_compressed_blocks_stream_data_handle_t **data_handle, 55 | libcerror_error_t **error ); 56 | 57 | int libagdb_compressed_blocks_stream_data_handle_free( 58 | libagdb_compressed_blocks_stream_data_handle_t **data_handle, 59 | libcerror_error_t **error ); 60 | 61 | ssize_t libagdb_compressed_blocks_stream_data_handle_read_segment_data( 62 | libagdb_compressed_blocks_stream_data_handle_t *data_handle, 63 | intptr_t *file_io_handle, 64 | int segment_index, 65 | int segment_file_index, 66 | uint8_t *segment_data, 67 | size_t segment_data_size, 68 | uint32_t segment_flags, 69 | uint8_t read_flags, 70 | libcerror_error_t **error ); 71 | 72 | off64_t libagdb_compressed_blocks_stream_data_handle_seek_segment_offset( 73 | libagdb_compressed_blocks_stream_data_handle_t *data_handle, 74 | intptr_t *file_io_handle, 75 | int segment_index, 76 | int segment_file_index, 77 | off64_t segment_offset, 78 | libcerror_error_t **error ); 79 | 80 | #if defined( __cplusplus ) 81 | } 82 | #endif 83 | 84 | #endif /* !defined( _LIBAGDB_COMPRESSED_BLOCKS_STREAM_DATA_HANDLE_H ) */ 85 | 86 | -------------------------------------------------------------------------------- /libagdb/libagdb_compressed_file_header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Compressed file header functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_COMPRESSED_FILE_HEADER_H ) 23 | #define _LIBAGDB_COMPRESSED_FILE_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_libbfio.h" 29 | #include "libagdb_libcerror.h" 30 | #include "libagdb_libfdata.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct libagdb_compressed_file_header libagdb_compressed_file_header_t; 37 | 38 | struct libagdb_compressed_file_header 39 | { 40 | /* The file type 41 | */ 42 | uint8_t file_type; 43 | 44 | /* The file size 45 | */ 46 | size64_t file_size; 47 | 48 | /* The uncompressed block size 49 | */ 50 | uint32_t uncompressed_block_size; 51 | 52 | /* The uncompressed data size 53 | */ 54 | uint32_t uncompressed_data_size; 55 | }; 56 | 57 | int libagdb_compressed_file_header_initialize( 58 | libagdb_compressed_file_header_t **compressed_file_header, 59 | libcerror_error_t **error ); 60 | 61 | int libagdb_compressed_file_header_free( 62 | libagdb_compressed_file_header_t **compressed_file_header, 63 | libcerror_error_t **error ); 64 | 65 | int libagdb_compressed_file_header_read_data( 66 | libagdb_compressed_file_header_t *compressed_file_header, 67 | const uint8_t *data, 68 | size_t data_size, 69 | libcerror_error_t **error ); 70 | 71 | int libagdb_compressed_file_header_read_file_io_handle( 72 | libagdb_compressed_file_header_t *compressed_file_header, 73 | libbfio_handle_t *file_io_handle, 74 | libcerror_error_t **error ); 75 | 76 | #if defined( __cplusplus ) 77 | } 78 | #endif 79 | 80 | #endif /* !defined( _LIBAGDB_COMPRESSED_FILE_HEADER_H ) */ 81 | 82 | -------------------------------------------------------------------------------- /libagdb/libagdb_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Debug functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_DEBUG_H ) 23 | #define _LIBAGDB_DEBUG_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_libbfio.h" 29 | #include "libagdb_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | #if defined( HAVE_DEBUG_OUTPUT ) 36 | 37 | int libagdb_debug_print_filetime_value( 38 | const char *function_name, 39 | const char *value_name, 40 | const uint8_t *byte_stream, 41 | size_t byte_stream_size, 42 | int byte_order, 43 | uint32_t string_format_flags, 44 | libcerror_error_t **error ); 45 | 46 | int libagdb_debug_print_string_value( 47 | const char *function_name, 48 | const char *value_name, 49 | const uint8_t *byte_stream, 50 | size_t byte_stream_size, 51 | int ascii_codepage, 52 | libcerror_error_t **error ); 53 | 54 | int libagdb_debug_print_utf16_string_value( 55 | const char *function_name, 56 | const char *value_name, 57 | const uint8_t *byte_stream, 58 | size_t byte_stream_size, 59 | int byte_order, 60 | libcerror_error_t **error ); 61 | 62 | int libagdb_debug_print_read_offsets( 63 | libbfio_handle_t *file_io_handle, 64 | libcerror_error_t **error ); 65 | 66 | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ 67 | 68 | #if defined( __cplusplus ) 69 | } 70 | #endif 71 | 72 | #endif /* !defined( _LIBAGDB_DEBUG_H ) */ 73 | 74 | -------------------------------------------------------------------------------- /libagdb/libagdb_definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal definitions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_INTERNAL_DEFINITIONS_H ) 23 | #define _LIBAGDB_INTERNAL_DEFINITIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #define LIBAGDB_ENDIAN_BIG _BYTE_STREAM_ENDIAN_BIG 29 | #define LIBAGDB_ENDIAN_LITTLE _BYTE_STREAM_ENDIAN_LITTLE 30 | 31 | /* Define HAVE_LOCAL_LIBAGDB for local use of libagdb 32 | */ 33 | #if !defined( HAVE_LOCAL_LIBAGDB ) 34 | #include 35 | 36 | /* The definitions in are copied here 37 | * for local use of libagdb 38 | */ 39 | #else 40 | #define LIBAGDB_VERSION @VERSION@ 41 | 42 | /* The version string 43 | */ 44 | #define LIBAGDB_VERSION_STRING "@VERSION@" 45 | 46 | /* The access flags definitions 47 | * bit 1 set to 1 for read access 48 | * bit 2 set to 1 for write access 49 | * bit 3-8 not used 50 | */ 51 | enum LIBAGDB_ACCESS_FLAGS 52 | { 53 | LIBAGDB_ACCESS_FLAG_READ = 0x01, 54 | /* Reserved: not supported yet */ 55 | LIBAGDB_ACCESS_FLAG_WRITE = 0x02 56 | }; 57 | 58 | /* The file access macros 59 | */ 60 | #define LIBAGDB_OPEN_READ ( LIBAGDB_ACCESS_FLAG_READ ) 61 | /* Reserved: not supported yet */ 62 | #define LIBAGDB_OPEN_WRITE ( LIBAGDB_ACCESS_FLAG_WRITE ) 63 | /* Reserved: not supported yet */ 64 | #define LIBAGDB_OPEN_READ_WRITE ( LIBAGDB_ACCESS_FLAG_READ | LIBAGDB_ACCESS_FLAG_WRITE ) 65 | 66 | /* The file type definitions 67 | */ 68 | enum LIBAGDB_FILE_TYPES 69 | { 70 | LIBAGDB_FILE_TYPE_UNCOMPRESSED = 1, 71 | LIBAGDB_FILE_TYPE_COMPRESSED_VISTA = 2, 72 | LIBAGDB_FILE_TYPE_COMPRESSED_WINDOWS7 = 3, 73 | LIBAGDB_FILE_TYPE_COMPRESSED_WINDOWS8 = 4 74 | }; 75 | 76 | #endif 77 | 78 | #define LIBAGDB_MAXIMUM_CACHE_ENTRIES_COMPRESSED_BLOCKS 8 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /libagdb/libagdb_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "libagdb_error.h" 27 | #include "libagdb_libcerror.h" 28 | 29 | #if !defined( HAVE_LOCAL_LIBAGDB ) 30 | 31 | /* Free an error and its elements 32 | */ 33 | void libagdb_error_free( 34 | libagdb_error_t **error ) 35 | { 36 | libcerror_error_free( 37 | (libcerror_error_t **) error ); 38 | } 39 | 40 | /* Prints a descriptive string of the error to the stream 41 | * Returns the number of printed characters if successful or -1 on error 42 | */ 43 | int libagdb_error_fprint( 44 | libagdb_error_t *error, 45 | FILE *stream ) 46 | { 47 | int print_count = 0; 48 | 49 | print_count = libcerror_error_fprint( 50 | (libcerror_error_t *) error, 51 | stream ); 52 | 53 | return( print_count ); 54 | } 55 | 56 | /* Prints a descriptive string of the error to the string 57 | * The end-of-string character is not included in the return value 58 | * Returns the number of printed characters if successful or -1 on error 59 | */ 60 | int libagdb_error_sprint( 61 | libagdb_error_t *error, 62 | char *string, 63 | size_t size ) 64 | { 65 | int print_count = 0; 66 | 67 | print_count = libcerror_error_sprint( 68 | (libcerror_error_t *) error, 69 | string, 70 | size ); 71 | 72 | return( print_count ); 73 | } 74 | 75 | /* Prints a backtrace of the error to the stream 76 | * Returns the number of printed characters if successful or -1 on error 77 | */ 78 | int libagdb_error_backtrace_fprint( 79 | libagdb_error_t *error, 80 | FILE *stream ) 81 | { 82 | int print_count = 0; 83 | 84 | print_count = libcerror_error_backtrace_fprint( 85 | (libcerror_error_t *) error, 86 | stream ); 87 | 88 | return( print_count ); 89 | } 90 | 91 | /* Prints a backtrace of the error to the string 92 | * The end-of-string character is not included in the return value 93 | * Returns the number of printed characters if successful or -1 on error 94 | */ 95 | int libagdb_error_backtrace_sprint( 96 | libagdb_error_t *error, 97 | char *string, 98 | size_t size ) 99 | { 100 | int print_count = 0; 101 | 102 | print_count = libcerror_error_backtrace_sprint( 103 | (libcerror_error_t *) error, 104 | string, 105 | size ); 106 | 107 | return( print_count ); 108 | } 109 | 110 | #endif /* !defined( HAVE_LOCAL_LIBAGDB ) */ 111 | 112 | -------------------------------------------------------------------------------- /libagdb/libagdb_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_INTERNAL_ERROR_H ) 23 | #define _LIBAGDB_INTERNAL_ERROR_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #if !defined( HAVE_LOCAL_LIBAGDB ) 30 | #include 31 | #endif 32 | 33 | #include "libagdb_extern.h" 34 | 35 | #if defined( __cplusplus ) 36 | extern "C" { 37 | #endif 38 | 39 | #if !defined( HAVE_LOCAL_LIBAGDB ) 40 | 41 | LIBAGDB_EXTERN \ 42 | void libagdb_error_free( 43 | libagdb_error_t **error ); 44 | 45 | LIBAGDB_EXTERN \ 46 | int libagdb_error_fprint( 47 | libagdb_error_t *error, 48 | FILE *stream ); 49 | 50 | LIBAGDB_EXTERN \ 51 | int libagdb_error_sprint( 52 | libagdb_error_t *error, 53 | char *string, 54 | size_t size ); 55 | 56 | LIBAGDB_EXTERN \ 57 | int libagdb_error_backtrace_fprint( 58 | libagdb_error_t *error, 59 | FILE *stream ); 60 | 61 | LIBAGDB_EXTERN \ 62 | int libagdb_error_backtrace_sprint( 63 | libagdb_error_t *error, 64 | char *string, 65 | size_t size ); 66 | 67 | #endif /* !defined( HAVE_LOCAL_LIBAGDB ) */ 68 | 69 | #if defined( __cplusplus ) 70 | } 71 | #endif 72 | 73 | #endif /* !defined( _LIBAGDB_INTERNAL_ERROR_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /libagdb/libagdb_extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal extern definition 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_INTERNAL_EXTERN_H ) 23 | #define _LIBAGDB_INTERNAL_EXTERN_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBAGDB for local use of libagdb 28 | */ 29 | #if !defined( HAVE_LOCAL_LIBAGDB ) 30 | 31 | #include 32 | 33 | #if defined( __CYGWIN__ ) || defined( __MINGW32__ ) 34 | #define LIBAGDB_EXTERN_VARIABLE extern 35 | #else 36 | #define LIBAGDB_EXTERN_VARIABLE LIBAGDB_EXTERN 37 | #endif 38 | 39 | #else 40 | #define LIBAGDB_EXTERN /* extern */ 41 | #define LIBAGDB_EXTERN_VARIABLE extern 42 | 43 | #endif /* !defined( HAVE_LOCAL_LIBAGDB ) */ 44 | 45 | #endif /* !defined( _LIBAGDB_INTERNAL_EXTERN_H ) */ 46 | 47 | -------------------------------------------------------------------------------- /libagdb/libagdb_file_information.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File information functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_INTERNAL_FILE_INFORMATION_H ) 23 | #define _LIBAGDB_INTERNAL_FILE_INFORMATION_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_extern.h" 29 | #include "libagdb_io_handle.h" 30 | #include "libagdb_libbfio.h" 31 | #include "libagdb_libcerror.h" 32 | #include "libagdb_libfcache.h" 33 | #include "libagdb_libfdata.h" 34 | #include "libagdb_types.h" 35 | 36 | #if defined( __cplusplus ) 37 | extern "C" { 38 | #endif 39 | 40 | typedef struct libagdb_internal_file_information libagdb_internal_file_information_t; 41 | 42 | struct libagdb_internal_file_information 43 | { 44 | /* The file path 45 | */ 46 | uint8_t *path; 47 | 48 | /* The file path size 49 | */ 50 | uint32_t path_size; 51 | 52 | /* The number of entries 53 | */ 54 | uint32_t number_of_entries; 55 | }; 56 | 57 | int libagdb_file_information_initialize( 58 | libagdb_file_information_t **file_information, 59 | libcerror_error_t **error ); 60 | 61 | LIBAGDB_EXTERN \ 62 | int libagdb_file_information_free( 63 | libagdb_file_information_t **file_information, 64 | libcerror_error_t **error ); 65 | 66 | int libagdb_internal_file_information_free( 67 | libagdb_internal_file_information_t **internal_file_information, 68 | libcerror_error_t **error ); 69 | 70 | int libagdb_internal_file_information_read_data( 71 | libagdb_internal_file_information_t *internal_file_information, 72 | libagdb_io_handle_t *io_handle, 73 | const uint8_t *data, 74 | size_t data_size, 75 | libcerror_error_t **error ); 76 | 77 | int libagdb_internal_file_information_read_path_data( 78 | libagdb_internal_file_information_t *internal_file_information, 79 | const uint8_t *data, 80 | size_t data_size, 81 | libcerror_error_t **error ); 82 | 83 | ssize_t libagdb_internal_file_information_read_file_io_handle( 84 | libagdb_internal_file_information_t *internal_file_information, 85 | libagdb_io_handle_t *io_handle, 86 | libfdata_stream_t *data_stream, 87 | libbfio_handle_t *file_io_handle, 88 | off64_t file_offset, 89 | uint32_t file_index, 90 | libcerror_error_t **error ); 91 | 92 | LIBAGDB_EXTERN \ 93 | int libagdb_file_information_get_utf8_path_size( 94 | libagdb_file_information_t *file_information, 95 | size_t *utf8_string_size, 96 | libcerror_error_t **error ); 97 | 98 | LIBAGDB_EXTERN \ 99 | int libagdb_file_information_get_utf8_path( 100 | libagdb_file_information_t *file_information, 101 | uint8_t *utf8_string, 102 | size_t utf8_string_size, 103 | libcerror_error_t **error ); 104 | 105 | LIBAGDB_EXTERN \ 106 | int libagdb_file_information_get_utf16_path_size( 107 | libagdb_file_information_t *file_information, 108 | size_t *utf16_string_size, 109 | libcerror_error_t **error ); 110 | 111 | LIBAGDB_EXTERN \ 112 | int libagdb_file_information_get_utf16_path( 113 | libagdb_file_information_t *file_information, 114 | uint16_t *utf16_string, 115 | size_t utf16_string_size, 116 | libcerror_error_t **error ); 117 | 118 | #if defined( __cplusplus ) 119 | } 120 | #endif 121 | 122 | #endif /* !defined( _LIBAGDB_INTERNAL_FILE_INFORMATION_H ) */ 123 | 124 | -------------------------------------------------------------------------------- /libagdb/libagdb_hash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Hash functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "libagdb_hash.h" 26 | #include "libagdb_libcerror.h" 27 | 28 | /* Calculates the hash of the data 29 | * Returns 1 if successful or -1 on error 30 | */ 31 | int libagdb_hash_calculate( 32 | uint32_t *hash_value, 33 | const uint8_t *data, 34 | size_t data_size, 35 | libcerror_error_t **error ) 36 | { 37 | static char *function = "libagdb_hash_calculate"; 38 | size_t data_offset = 0; 39 | uint32_t value_32bit = 0; 40 | 41 | if( hash_value == NULL ) 42 | { 43 | libcerror_error_set( 44 | error, 45 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, 46 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, 47 | "%s: invalid hash value.", 48 | function ); 49 | 50 | return( -1 ); 51 | } 52 | if( data == NULL ) 53 | { 54 | libcerror_error_set( 55 | error, 56 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, 57 | LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE, 58 | "%s: invalid data.", 59 | function ); 60 | 61 | return( -1 ); 62 | } 63 | if( data_size > (size_t) SSIZE_MAX ) 64 | { 65 | libcerror_error_set( 66 | error, 67 | LIBCERROR_ERROR_DOMAIN_ARGUMENTS, 68 | LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM, 69 | "%s: invalid data size value exceeds maximum.", 70 | function ); 71 | 72 | return( -1 ); 73 | } 74 | *hash_value = 0x00004cb2fUL; 75 | 76 | for( data_offset = 0; 77 | ( data_offset + 8 ) < data_size; 78 | data_offset += 8 ) 79 | { 80 | value_32bit = data[ data_offset + 1 ]; 81 | value_32bit *= 0x25; 82 | value_32bit += data[ data_offset + 2 ]; 83 | value_32bit *= 0x25; 84 | value_32bit += data[ data_offset + 3 ]; 85 | value_32bit *= 0x25; 86 | value_32bit += data[ data_offset + 4 ]; 87 | value_32bit *= 0x25; 88 | value_32bit += data[ data_offset + 5 ]; 89 | value_32bit *= 0x25; 90 | value_32bit += data[ data_offset + 6 ]; 91 | value_32bit *= 0x25; 92 | 93 | value_32bit += 0x1a617d0dUL * data[ data_offset ]; 94 | 95 | *hash_value = value_32bit - ( 0x2fe8ed1fUL * *hash_value ) + data[ data_offset + 7 ]; 96 | } 97 | while( data_offset < data_size ) 98 | { 99 | *hash_value *= 0x25; 100 | *hash_value += data[ data_offset++ ]; 101 | } 102 | return( 1 ); 103 | } 104 | 105 | -------------------------------------------------------------------------------- /libagdb/libagdb_hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hash functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_HASH_H ) 23 | #define _LIBAGDB_HASH_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | int libagdb_hash_calculate( 35 | uint32_t *hash_value, 36 | const uint8_t *data, 37 | size_t data_size, 38 | libcerror_error_t **error ); 39 | 40 | #if defined( __cplusplus ) 41 | } 42 | #endif 43 | 44 | #endif /* !defined( _LIBAGDB_HASH_H ) */ 45 | 46 | -------------------------------------------------------------------------------- /libagdb/libagdb_io_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Input/Output (IO) handle functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_IO_HANDLE_H ) 23 | #define _LIBAGDB_IO_HANDLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_libbfio.h" 29 | #include "libagdb_libcerror.h" 30 | #include "libagdb_libfcache.h" 31 | #include "libagdb_libfdata.h" 32 | 33 | #if defined( __cplusplus ) 34 | extern "C" { 35 | #endif 36 | 37 | extern const char *agdb_mem_file_signature_vista; 38 | extern const char *agdb_mem_file_signature_win7; 39 | extern const char *agdb_mam_file_signature_win8; 40 | 41 | typedef struct libagdb_io_handle libagdb_io_handle_t; 42 | 43 | struct libagdb_io_handle 44 | { 45 | /* The file type 46 | */ 47 | uint8_t file_type; 48 | 49 | /* The file size 50 | */ 51 | size64_t file_size; 52 | 53 | /* The uncompressed block size 54 | */ 55 | uint32_t uncompressed_block_size; 56 | 57 | /* The uncompressed data size 58 | */ 59 | uint32_t uncompressed_data_size; 60 | 61 | /* The database type 62 | */ 63 | uint32_t database_type; 64 | 65 | /* The volume information entry size 66 | */ 67 | uint32_t volume_information_entry_size; 68 | 69 | /* The file information entry size 70 | */ 71 | uint32_t file_information_entry_size; 72 | 73 | /* The source information entry size 74 | */ 75 | uint32_t source_information_entry_size; 76 | 77 | /* The file information sub entry type 1 size 78 | */ 79 | uint32_t file_information_sub_entry_type1_size; 80 | 81 | /* The file information sub entry type 2 size 82 | */ 83 | uint32_t file_information_sub_entry_type2_size; 84 | 85 | /* Value to indicate if abort was signalled 86 | */ 87 | int abort; 88 | }; 89 | 90 | int libagdb_io_handle_initialize( 91 | libagdb_io_handle_t **io_handle, 92 | libcerror_error_t **error ); 93 | 94 | int libagdb_io_handle_free( 95 | libagdb_io_handle_t **io_handle, 96 | libcerror_error_t **error ); 97 | 98 | int libagdb_io_handle_clear( 99 | libagdb_io_handle_t *io_handle, 100 | libcerror_error_t **error ); 101 | 102 | int libagdb_io_handle_read_compressed_blocks( 103 | libagdb_io_handle_t *io_handle, 104 | libbfio_handle_t *file_io_handle, 105 | libfdata_list_t *compressed_blocks_list, 106 | libcerror_error_t **error ); 107 | 108 | int libagdb_io_handle_read_uncompressed_file_header( 109 | libagdb_io_handle_t *io_handle, 110 | libfdata_stream_t *uncompressed_data_stream, 111 | libbfio_handle_t *file_io_handle, 112 | off64_t *volumes_information_offset, 113 | uint32_t *number_of_volumes, 114 | uint32_t *number_of_sources, 115 | libcerror_error_t **error ); 116 | 117 | ssize_t libagdb_io_handle_read_segment_data( 118 | intptr_t *data_handle, 119 | intptr_t *file_io_handle, 120 | int segment_index, 121 | int segment_file_index, 122 | uint8_t *segment_data, 123 | size_t segment_data_size, 124 | uint32_t segment_flags, 125 | uint8_t read_flags, 126 | libcerror_error_t **error ); 127 | 128 | off64_t libagdb_io_handle_seek_segment_offset( 129 | intptr_t *data_handle, 130 | intptr_t *file_io_handle, 131 | int segment_index, 132 | int segment_file_index, 133 | off64_t segment_offset, 134 | libcerror_error_t **error ); 135 | 136 | #if defined( __cplusplus ) 137 | } 138 | #endif 139 | 140 | #endif /* !defined( _LIBAGDB_IO_HANDLE_H ) */ 141 | 142 | -------------------------------------------------------------------------------- /libagdb/libagdb_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBBFIO_H ) 23 | #define _LIBAGDB_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _LIBAGDB_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /libagdb/libagdb_libcdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcdata header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBCDATA_H ) 23 | #define _LIBAGDB_LIBCDATA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCDATA for local use of libcdata 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCDATA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBCDATA_DLL_IMPORT 43 | * before including libcdata.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBCDATA_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #endif /* defined( HAVE_LOCAL_LIBCDATA ) */ 52 | 53 | #endif /* !defined( _LIBAGDB_LIBCDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /libagdb/libagdb_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBCERROR_H ) 23 | #define _LIBAGDB_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _LIBAGDB_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libagdb/libagdb_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBCLOCALE_H ) 23 | #define _LIBAGDB_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _LIBAGDB_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libagdb/libagdb_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBCNOTIFY_H ) 23 | #define _LIBAGDB_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _LIBAGDB_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libagdb/libagdb_libfcache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfcache header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBFCACHE_H ) 23 | #define _LIBAGDB_LIBFCACHE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFCACHE for local use of libfcache 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFCACHE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBFCACHE_DLL_IMPORT 39 | * before including libfcache.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBFCACHE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBFCACHE ) */ 48 | 49 | #endif /* !defined( _LIBAGDB_LIBFCACHE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libagdb/libagdb_libfdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfdata header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBFDATA_H ) 23 | #define _LIBAGDB_LIBFDATA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFDATA for local use of libfdata 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFDATA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBFDATA_DLL_IMPORT 43 | * before including libfdata.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBFDATA_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #endif /* defined( HAVE_LOCAL_LIBFDATA ) */ 52 | 53 | #endif /* !defined( _LIBAGDB_LIBFDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /libagdb/libagdb_libfdatetime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfdatetime header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBFDATETIME_H ) 23 | #define _LIBAGDB_LIBFDATETIME_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFDATETIME for local use of libfdatetime 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFDATETIME ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #else 43 | 44 | /* If libtool DLL support is enabled set LIBFDATETIME_DLL_IMPORT 45 | * before including libfdatetime.h 46 | */ 47 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 48 | #define LIBFDATETIME_DLL_IMPORT 49 | #endif 50 | 51 | #include 52 | 53 | #endif /* defined( HAVE_LOCAL_LIBFDATETIME ) */ 54 | 55 | #endif /* !defined( _LIBAGDB_LIBFDATETIME_H ) */ 56 | 57 | -------------------------------------------------------------------------------- /libagdb/libagdb_libfwnt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfwnt header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBFWNT_H ) 23 | #define _LIBAGDB_LIBFWNT_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFWNT for local use of libfwnt 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFWNT ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #else 45 | 46 | /* If libtool DLL support is enabled set LIBFWNT_DLL_IMPORT 47 | * before including libfwnt.h 48 | */ 49 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 50 | #define LIBFWNT_DLL_IMPORT 51 | #endif 52 | 53 | #include 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBFWNT ) */ 56 | 57 | #endif /* !defined( _LIBAGDB_LIBFWNT_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /libagdb/libagdb_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_LIBUNA_H ) 23 | #define _LIBAGDB_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _LIBAGDB_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /libagdb/libagdb_notify.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Notification functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 27 | #include 28 | #endif 29 | 30 | #include "libagdb_libcerror.h" 31 | #include "libagdb_libcnotify.h" 32 | #include "libagdb_notify.h" 33 | 34 | #if !defined( HAVE_LOCAL_LIBAGDB ) 35 | 36 | /* Sets the verbose notification 37 | */ 38 | void libagdb_notify_set_verbose( 39 | int verbose ) 40 | { 41 | libcnotify_verbose_set( 42 | verbose ); 43 | } 44 | 45 | /* Sets the notification stream 46 | * Returns 1 if successful or -1 on error 47 | */ 48 | int libagdb_notify_set_stream( 49 | FILE *stream, 50 | libcerror_error_t **error ) 51 | { 52 | static char *function = "libagdb_notify_set_stream"; 53 | 54 | if( libcnotify_stream_set( 55 | stream, 56 | error ) != 1 ) 57 | { 58 | libcerror_error_set( 59 | error, 60 | LIBCERROR_ERROR_DOMAIN_RUNTIME, 61 | LIBCERROR_RUNTIME_ERROR_SET_FAILED, 62 | "%s: unable to set stream.", 63 | function ); 64 | 65 | return( -1 ); 66 | } 67 | return( 1 ); 68 | } 69 | 70 | /* Opens the notification stream using a filename 71 | * The stream is opened in append mode 72 | * Returns 1 if successful or -1 on error 73 | */ 74 | int libagdb_notify_stream_open( 75 | const char *filename, 76 | libcerror_error_t **error ) 77 | { 78 | static char *function = "libagdb_notify_stream_open"; 79 | 80 | if( libcnotify_stream_open( 81 | filename, 82 | error ) != 1 ) 83 | { 84 | libcerror_error_set( 85 | error, 86 | LIBCERROR_ERROR_DOMAIN_IO, 87 | LIBCERROR_IO_ERROR_OPEN_FAILED, 88 | "%s: unable to open stream.", 89 | function ); 90 | 91 | return( -1 ); 92 | } 93 | return( 1 ); 94 | } 95 | 96 | /* Closes the notification stream if opened using a filename 97 | * Returns 0 if successful or -1 on error 98 | */ 99 | int libagdb_notify_stream_close( 100 | libcerror_error_t **error ) 101 | { 102 | static char *function = "libagdb_notify_stream_close"; 103 | 104 | if( libcnotify_stream_close( 105 | error ) != 0 ) 106 | { 107 | libcerror_error_set( 108 | error, 109 | LIBCERROR_ERROR_DOMAIN_IO, 110 | LIBCERROR_IO_ERROR_OPEN_FAILED, 111 | "%s: unable to open stream.", 112 | function ); 113 | 114 | return( -1 ); 115 | } 116 | return( 0 ); 117 | } 118 | 119 | #endif /* !defined( HAVE_LOCAL_LIBAGDB ) */ 120 | 121 | -------------------------------------------------------------------------------- /libagdb/libagdb_notify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Notification functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_NOTIFY_H ) 23 | #define _LIBAGDB_NOTIFY_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "libagdb_extern.h" 30 | #include "libagdb_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBAGDB ) 37 | 38 | LIBAGDB_EXTERN \ 39 | void libagdb_notify_set_verbose( 40 | int verbose ); 41 | 42 | LIBAGDB_EXTERN \ 43 | int libagdb_notify_set_stream( 44 | FILE *stream, 45 | libcerror_error_t **error ); 46 | 47 | LIBAGDB_EXTERN \ 48 | int libagdb_notify_stream_open( 49 | const char *filename, 50 | libcerror_error_t **error ); 51 | 52 | LIBAGDB_EXTERN \ 53 | int libagdb_notify_stream_close( 54 | libcerror_error_t **error ); 55 | 56 | #endif /* !defined( HAVE_LOCAL_LIBAGDB ) */ 57 | 58 | #if defined( __cplusplus ) 59 | } 60 | #endif 61 | 62 | #endif /* !defined( _LIBAGDB_NOTIFY_H ) */ 63 | 64 | -------------------------------------------------------------------------------- /libagdb/libagdb_source_information.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Source information functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_INTERNAL_EXECUTABLE_INFORMATION_H ) 23 | #define _LIBAGDB_INTERNAL_EXECUTABLE_INFORMATION_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_extern.h" 29 | #include "libagdb_io_handle.h" 30 | #include "libagdb_libbfio.h" 31 | #include "libagdb_libcerror.h" 32 | #include "libagdb_libfcache.h" 33 | #include "libagdb_libfdata.h" 34 | #include "libagdb_types.h" 35 | 36 | #if defined( __cplusplus ) 37 | extern "C" { 38 | #endif 39 | 40 | typedef struct libagdb_internal_source_information libagdb_internal_source_information_t; 41 | 42 | struct libagdb_internal_source_information 43 | { 44 | /* The executable filename 45 | */ 46 | uint8_t executable_filename[ 16 ]; 47 | 48 | /* The executable filename size 49 | */ 50 | uint32_t executable_filename_size; 51 | }; 52 | 53 | int libagdb_source_information_initialize( 54 | libagdb_source_information_t **source_information, 55 | libcerror_error_t **error ); 56 | 57 | LIBAGDB_EXTERN \ 58 | int libagdb_source_information_free( 59 | libagdb_source_information_t **source_information, 60 | libcerror_error_t **error ); 61 | 62 | int libagdb_internal_source_information_free( 63 | libagdb_internal_source_information_t **internal_source_information, 64 | libcerror_error_t **error ); 65 | 66 | ssize_t libagdb_source_information_read( 67 | libagdb_internal_source_information_t *internal_source_information, 68 | libagdb_io_handle_t *io_handle, 69 | libfdata_stream_t *uncompressed_data_stream, 70 | libbfio_handle_t *file_io_handle, 71 | uint32_t source_information_index, 72 | off64_t file_offset, 73 | libcerror_error_t **error ); 74 | 75 | int libagdb_source_information_read_data( 76 | libagdb_internal_source_information_t *internal_source_information, 77 | libagdb_io_handle_t *io_handle, 78 | const uint8_t *data, 79 | size_t data_size, 80 | uint32_t *number_of_entries, 81 | libcerror_error_t **error ); 82 | 83 | LIBAGDB_EXTERN \ 84 | int libagdb_source_information_get_utf8_executable_filename_size( 85 | libagdb_source_information_t *source_information, 86 | size_t *utf8_string_size, 87 | libcerror_error_t **error ); 88 | 89 | LIBAGDB_EXTERN \ 90 | int libagdb_source_information_get_utf8_executable_filename( 91 | libagdb_source_information_t *source_information, 92 | uint8_t *utf8_string, 93 | size_t utf8_string_size, 94 | libcerror_error_t **error ); 95 | 96 | LIBAGDB_EXTERN \ 97 | int libagdb_source_information_get_utf16_executable_filename_size( 98 | libagdb_source_information_t *source_information, 99 | size_t *utf16_string_size, 100 | libcerror_error_t **error ); 101 | 102 | LIBAGDB_EXTERN \ 103 | int libagdb_source_information_get_utf16_executable_filename( 104 | libagdb_source_information_t *source_information, 105 | uint16_t *utf16_string, 106 | size_t utf16_string_size, 107 | libcerror_error_t **error ); 108 | 109 | #if defined( __cplusplus ) 110 | } 111 | #endif 112 | 113 | #endif /* !defined( _LIBAGDB_INTERNAL_EXECUTABLE_INFORMATION_H ) */ 114 | 115 | -------------------------------------------------------------------------------- /libagdb/libagdb_support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Support functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_SUPPORT_H ) 23 | #define _LIBAGDB_SUPPORT_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libagdb_extern.h" 29 | #include "libagdb_libbfio.h" 30 | #include "libagdb_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBAGDB ) 37 | 38 | LIBAGDB_EXTERN \ 39 | const char *libagdb_get_version( 40 | void ); 41 | 42 | LIBAGDB_EXTERN \ 43 | int libagdb_get_access_flags_read( 44 | void ); 45 | 46 | LIBAGDB_EXTERN \ 47 | int libagdb_get_codepage( 48 | int *codepage, 49 | libcerror_error_t **error ); 50 | 51 | LIBAGDB_EXTERN \ 52 | int libagdb_set_codepage( 53 | int codepage, 54 | libcerror_error_t **error ); 55 | 56 | #endif /* !defined( HAVE_LOCAL_LIBAGDB ) */ 57 | 58 | LIBAGDB_EXTERN \ 59 | int libagdb_check_file_signature( 60 | const char *filename, 61 | libcerror_error_t **error ); 62 | 63 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 64 | 65 | LIBAGDB_EXTERN \ 66 | int libagdb_check_file_signature_wide( 67 | const wchar_t *filename, 68 | libcerror_error_t **error ); 69 | 70 | #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ 71 | 72 | LIBAGDB_EXTERN \ 73 | int libagdb_check_file_signature_file_io_handle( 74 | libbfio_handle_t *file_io_handle, 75 | libcerror_error_t **error ); 76 | 77 | #if defined( __cplusplus ) 78 | } 79 | #endif 80 | 81 | #endif /* !defined( _LIBAGDB_SUPPORT_H ) */ 82 | 83 | -------------------------------------------------------------------------------- /libagdb/libagdb_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal type definitions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_INTERNAL_TYPES_H ) 23 | #define _LIBAGDB_INTERNAL_TYPES_H 24 | 25 | #include 26 | #include 27 | 28 | /* Define HAVE_LOCAL_LIBAGDB for local use of libagdb 29 | * The definitions in are copied here 30 | * for local use of libagdb 31 | */ 32 | #if defined( HAVE_LOCAL_LIBAGDB ) 33 | 34 | /* The following type definitions hide internal data structures 35 | */ 36 | #if defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) 37 | typedef struct libagdb_file {} libagdb_file_t; 38 | typedef struct libagdb_file_information {} libagdb_file_information_t; 39 | typedef struct libagdb_source_information {} libagdb_source_information_t; 40 | typedef struct libagdb_volume_information {} libagdb_volume_information_t; 41 | 42 | #else 43 | typedef intptr_t libagdb_file_t; 44 | typedef intptr_t libagdb_file_information_t; 45 | typedef intptr_t libagdb_source_information_t; 46 | typedef intptr_t libagdb_volume_information_t; 47 | 48 | #endif /* defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) */ 49 | 50 | #endif /* defined( HAVE_LOCAL_LIBAGDB ) */ 51 | 52 | #endif /* !defined( _LIBAGDB_INTERNAL_TYPES_H ) */ 53 | 54 | -------------------------------------------------------------------------------- /libagdb/libagdb_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _LIBAGDB_UNUSED_H ) 23 | #define _LIBAGDB_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( LIBAGDB_ATTRIBUTE_UNUSED ) 28 | #if defined( __GNUC__ ) && __GNUC__ >= 3 29 | #define LIBAGDB_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 30 | #else 31 | #define LIBAGDB_ATTRIBUTE_UNUSED 32 | #endif 33 | #endif 34 | 35 | #if defined( _MSC_VER ) 36 | #define LIBAGDB_UNREFERENCED_PARAMETER( parameter ) \ 37 | UNREFERENCED_PARAMETER( parameter ); 38 | #else 39 | #define LIBAGDB_UNREFERENCED_PARAMETER( parameter ) \ 40 | /* parameter */ 41 | #endif 42 | 43 | #endif /* !defined( _LIBAGDB_UNUSED_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /m4/pthread.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for pthread 2 | dnl 3 | dnl Version: 20240513 4 | 5 | dnl Function to detect if pthread is available 6 | AC_DEFUN([AX_PTHREAD_CHECK_LIB], 7 | [AS_IF( 8 | [test "x$ac_cv_enable_shared_libs" = xno || test "x$ac_cv_with_pthread" = xno], 9 | [ac_cv_pthread=no], 10 | [ac_cv_pthread=check 11 | dnl Check if parameters were provided 12 | dnl For both --with-pthread which returns "yes" and --with-pthread= which returns "" 13 | dnl treat them as auto-detection. 14 | AS_IF( 15 | [test "x$ac_cv_with_pthread" != x && test "x$ac_cv_with_pthread" != xauto-detect && test "x$ac_cv_with_pthread" != xyes], 16 | [AX_CHECK_LIB_DIRECTORY_EXISTS([pthread])]) 17 | ]) 18 | 19 | AS_IF( 20 | [test "x$ac_cv_pthread" = xcheck], 21 | [dnl Check for headers 22 | AC_CHECK_HEADERS([pthread.h]) 23 | 24 | AS_IF( 25 | [test "x$ac_cv_header_pthread_h" = xno], 26 | [ac_cv_pthread=no], 27 | [ac_cv_pthread=yes 28 | 29 | AX_CHECK_LIB_FUNCTIONS( 30 | [pthread], 31 | [pthread], 32 | [[pthread_create], 33 | [pthread_exit], 34 | [pthread_join], 35 | [pthread_cond_init], 36 | [pthread_cond_destroy], 37 | [pthread_cond_broadcast], 38 | [pthread_cond_signal], 39 | [pthread_cond_wait], 40 | [pthread_mutex_init], 41 | [pthread_mutex_destroy], 42 | [pthread_mutex_lock], 43 | [pthread_mutex_trylock], 44 | [pthread_mutex_unlock], 45 | [pthread_rwlock_init], 46 | [pthread_rwlock_destroy], 47 | [pthread_rwlock_rdlock], 48 | [pthread_rwlock_wrlock], 49 | [pthread_rwlock_unlock]]) 50 | 51 | ac_cv_pthread_LIBADD="-lpthread" 52 | ]) 53 | 54 | AX_CHECK_LIB_DIRECTORY_MSG_ON_FAILURE([pthread]) 55 | ]) 56 | 57 | AS_IF( 58 | [test "x$ac_cv_pthread" = xpthread], 59 | [AC_DEFINE( 60 | [HAVE_PTHREAD], 61 | [1], 62 | [Define to 1 if you have the 'pthread' library (-lpthread).]) 63 | ]) 64 | 65 | AS_IF( 66 | [test "x$ac_cv_pthread" != xno], 67 | [AC_SUBST( 68 | [HAVE_PTHREAD], 69 | [1]) ], 70 | [AC_SUBST( 71 | [HAVE_PTHREAD], 72 | [0]) 73 | ]) 74 | ]) 75 | 76 | dnl Function to detect how to enable pthread 77 | AC_DEFUN([AX_PTHREAD_CHECK_ENABLE], 78 | [AX_COMMON_ARG_WITH( 79 | [pthread], 80 | [pthread], 81 | [search for pthread in includedir and libdir or in the specified DIR, or no if not to use pthread], 82 | [auto-detect], 83 | [DIR]) 84 | 85 | dnl Check for a shared library version 86 | AX_PTHREAD_CHECK_LIB 87 | 88 | AS_IF( 89 | [test "x$ac_cv_pthread_CPPFLAGS" != "x"], 90 | [AC_SUBST( 91 | [PTHREAD_CPPFLAGS], 92 | [$ac_cv_pthread_CPPFLAGS]) 93 | ]) 94 | AS_IF( 95 | [test "x$ac_cv_pthread_LIBADD" != "x"], 96 | [AC_SUBST( 97 | [PTHREAD_LIBADD], 98 | [$ac_cv_pthread_LIBADD]) 99 | ]) 100 | 101 | AS_IF( 102 | [test "x$ac_cv_pthread" = xpthread], 103 | [AC_SUBST( 104 | [ax_pthread_pc_libs_private], 105 | [-lpthread]) 106 | ]) 107 | ]) 108 | 109 | -------------------------------------------------------------------------------- /m4/tests.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for testing 2 | dnl 3 | dnl Version: 20200712 4 | 5 | dnl Function to detect if tests dependencies are available 6 | AC_DEFUN([AX_TESTS_CHECK_LOCAL], 7 | [AC_CHECK_HEADERS([dlfcn.h]) 8 | 9 | AC_CHECK_FUNCS([fmemopen getopt mkstemp setenv tzset unlink]) 10 | 11 | AC_CHECK_LIB( 12 | dl, 13 | dlsym) 14 | 15 | AS_IF( 16 | [test "x$lt_cv_prog_gnu_ld" = xyes && test "x$ac_cv_lib_dl_dlsym" = xyes], 17 | [AC_DEFINE( 18 | [HAVE_GNU_DL_DLSYM], 19 | [1], 20 | [Define to 1 if dlsym function is available in GNU dl.]) 21 | ]) 22 | ]) 23 | 24 | dnl Function to detect if OSS-Fuzz build environment is available 25 | AC_DEFUN([AX_TESTS_CHECK_OSSFUZZ], 26 | [AM_CONDITIONAL( 27 | HAVE_LIB_FUZZING_ENGINE, 28 | [test "x${LIB_FUZZING_ENGINE}" != x]) 29 | AC_SUBST( 30 | [LIB_FUZZING_ENGINE], 31 | ["${LIB_FUZZING_ENGINE}"]) 32 | ]) 33 | 34 | -------------------------------------------------------------------------------- /m4/types.m4: -------------------------------------------------------------------------------- 1 | dnl Functions for type definitions 2 | dnl 3 | dnl Version: 20180727 4 | 5 | dnl Function to detect if type definitions are available 6 | AC_DEFUN([AX_TYPES_CHECK_LOCAL], 7 | [AS_IF( 8 | [test "x$ac_cv_enable_winapi" = xyes], 9 | [ac_cv_enable_wide_character_type=yes]) 10 | 11 | AS_IF( 12 | [test "x$ac_cv_enable_wide_character_type" = xyes], 13 | [AC_DEFINE( 14 | [HAVE_WIDE_CHARACTER_TYPE], 15 | [1], 16 | [Define to 1 if wide character type should be used.]) 17 | AC_SUBST( 18 | [HAVE_WIDE_CHARACTER_TYPE], 19 | [1]) ], 20 | [AC_SUBST( 21 | [HAVE_WIDE_CHARACTER_TYPE], 22 | [0]) 23 | ]) 24 | 25 | AC_CHECK_HEADERS([sys/types.h inttypes.h stdint.h wchar.h]) 26 | 27 | AS_IF( 28 | [test "x$ac_cv_header_sys_types_h" = xyes], 29 | [AC_SUBST( 30 | [HAVE_SYS_TYPES_H], 31 | [1])], 32 | [AC_SUBST( 33 | [HAVE_SYS_TYPES_H], 34 | [0]) 35 | ]) 36 | 37 | AS_IF( 38 | [test "x$ac_cv_header_inttypes_h" = xyes], 39 | [AC_SUBST( 40 | [HAVE_INTTYPES_H], 41 | [1])], 42 | [AC_SUBST( 43 | [HAVE_INTTYPES_H], 44 | [0]) 45 | ]) 46 | 47 | AS_IF( 48 | [test "x$ac_cv_header_stdint_h" = xyes], 49 | [AC_SUBST( 50 | [HAVE_STDINT_H], 51 | [1])], 52 | [AC_SUBST( 53 | [HAVE_STDINT_H], 54 | [0]) 55 | ]) 56 | 57 | AS_IF( 58 | [test "x$ac_cv_header_wchar_h" = xyes], 59 | [AC_SUBST( 60 | [HAVE_WCHAR_H], 61 | [1]) ], 62 | [AC_SUBST( 63 | [HAVE_WCHAR_H], 64 | [0]) 65 | ]) 66 | 67 | AC_TYPE_MODE_T 68 | AC_TYPE_OFF_T 69 | AC_TYPE_SIZE_T 70 | 71 | AC_CHECK_TYPE( 72 | [size32_t], 73 | [AC_SUBST( 74 | [HAVE_SIZE32_T], 75 | [1])], 76 | [AC_SUBST( 77 | [HAVE_SIZE32_T], 78 | [0]) 79 | ]) 80 | 81 | AC_CHECK_TYPE( 82 | [ssize32_t], 83 | [AC_SUBST( 84 | [HAVE_SSIZE32_T], 85 | [1])], 86 | [AC_SUBST( 87 | [HAVE_SSIZE32_T], 88 | [0]) 89 | ]) 90 | 91 | AC_CHECK_TYPE( 92 | [size64_t], 93 | [AC_SUBST( 94 | [HAVE_SIZE64_T], 95 | [1])], 96 | [AC_SUBST( 97 | [HAVE_SIZE64_T], 98 | [0]) 99 | ]) 100 | 101 | AC_CHECK_TYPE( 102 | [ssize64_t], 103 | [AC_SUBST( 104 | [HAVE_SSIZE64_T], 105 | [1])], 106 | [AC_SUBST( 107 | [HAVE_SSIZE64_T], 108 | [0]) 109 | ]) 110 | 111 | AC_CHECK_TYPE( 112 | [off64_t], 113 | [AC_SUBST( 114 | [HAVE_OFF64_T], 115 | [1])], 116 | [AC_SUBST( 117 | [HAVE_OFF64_T], 118 | [0]) 119 | ]) 120 | 121 | AC_CHECK_TYPE([ssize_t]) 122 | AC_CHECK_TYPE([u64]) 123 | 124 | AC_CHECK_SIZEOF([int]) 125 | AC_CHECK_SIZEOF([long]) 126 | AC_CHECK_SIZEOF([off_t]) 127 | AC_CHECK_SIZEOF([size_t]) 128 | 129 | AS_IF( 130 | [test "x$ac_cv_header_wchar_h" = xyes], 131 | [AC_CHECK_SIZEOF([wchar_t])]) 132 | ]) 133 | 134 | -------------------------------------------------------------------------------- /manuals/Makefile.am: -------------------------------------------------------------------------------- 1 | man_MANS = \ 2 | agdbinfo.1 \ 3 | libagdb.3 4 | 5 | EXTRA_DIST = \ 6 | agdbinfo.1 \ 7 | libagdb.3 8 | 9 | DISTCLEANFILES = \ 10 | Makefile \ 11 | Makefile.in 12 | 13 | -------------------------------------------------------------------------------- /manuals/agdbinfo.1: -------------------------------------------------------------------------------- 1 | .Dd April 12, 2019 2 | .Dt agdbinfo 3 | .Os libagdb 4 | .Sh NAME 5 | .Nm agdbinfo 6 | .Nd determines information about a Windows SuperFetch database file 7 | .Sh SYNOPSIS 8 | .Nm agdbinfo 9 | .Op Fl ahvV 10 | .Ar source 11 | .Sh DESCRIPTION 12 | .Nm agdbinfo 13 | is a utility to determine information about a Windows SuperFetch database file 14 | .Pp 15 | .Nm agdbinfo 16 | is part of the 17 | .Nm libagdb 18 | package. 19 | .Nm libagdb 20 | is a library to access the Windows SuperFetch database file format 21 | .Pp 22 | .Ar source 23 | is the source file. 24 | .Pp 25 | The options are as follows: 26 | .Bl -tag -width Ds 27 | .It Fl a 28 | shows allocation information 29 | .It Fl h 30 | shows this help 31 | .It Fl v 32 | verbose output to stderr 33 | .It Fl V 34 | print version 35 | .El 36 | .Sh ENVIRONMENT 37 | None 38 | .Sh FILES 39 | None 40 | .Sh EXAMPLES 41 | .Bd -literal 42 | # agdbinfo WERC843.tmp.agdb 43 | agdbinfo 20140402 44 | .sp 45 | Windows SuperFetch database file information: 46 | ... 47 | .sp 48 | .Ed 49 | .Sh DIAGNOSTICS 50 | Errors, verbose and debug output are printed to stderr when verbose output \-v is enabled. 51 | Verbose and debug output are only printed when enabled at compilation. 52 | .Sh BUGS 53 | Please report bugs of any kind to or on the project website: 54 | https://github.com/libyal/libagdb/ 55 | .Sh AUTHOR 56 | These man pages were written by Joachim Metz. 57 | .Sh COPYRIGHT 58 | Copyright (C) 2014-2024, Joachim Metz . 59 | This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 60 | .Sh SEE ALSO 61 | -------------------------------------------------------------------------------- /msvscpp/Makefile.am: -------------------------------------------------------------------------------- 1 | MSVSCPP_FILES = \ 2 | agdb_test_compressed_block/agdb_test_compressed_block.vcproj \ 3 | agdb_test_compressed_blocks_stream_data_handle/agdb_test_compressed_blocks_stream_data_handle.vcproj \ 4 | agdb_test_compressed_file_header/agdb_test_compressed_file_header.vcproj \ 5 | agdb_test_error/agdb_test_error.vcproj \ 6 | agdb_test_file/agdb_test_file.vcproj \ 7 | agdb_test_file_information/agdb_test_file_information.vcproj \ 8 | agdb_test_io_handle/agdb_test_io_handle.vcproj \ 9 | agdb_test_notify/agdb_test_notify.vcproj \ 10 | agdb_test_source_information/agdb_test_source_information.vcproj \ 11 | agdb_test_support/agdb_test_support.vcproj \ 12 | agdb_test_tools_info_handle/agdb_test_tools_info_handle.vcproj \ 13 | agdb_test_tools_output/agdb_test_tools_output.vcproj \ 14 | agdb_test_tools_signal/agdb_test_tools_signal.vcproj \ 15 | agdb_test_volume_information/agdb_test_volume_information.vcproj \ 16 | agdbinfo/agdbinfo.vcproj \ 17 | libagdb/libagdb.vcproj \ 18 | libbfio/libbfio.vcproj \ 19 | libcdata/libcdata.vcproj \ 20 | libcerror/libcerror.vcproj \ 21 | libcfile/libcfile.vcproj \ 22 | libclocale/libclocale.vcproj \ 23 | libcnotify/libcnotify.vcproj \ 24 | libcpath/libcpath.vcproj \ 25 | libcsplit/libcsplit.vcproj \ 26 | libcthreads/libcthreads.vcproj \ 27 | libfcache/libfcache.vcproj \ 28 | libfdata/libfdata.vcproj \ 29 | libfdatetime/libfdatetime.vcproj \ 30 | libfwnt/libfwnt.vcproj \ 31 | libuna/libuna.vcproj \ 32 | libagdb.sln 33 | 34 | EXTRA_DIST = \ 35 | $(MSVSCPP_FILES) 36 | 37 | DISTCLEANFILES = \ 38 | Makefile \ 39 | Makefile.in 40 | 41 | -------------------------------------------------------------------------------- /ossfuzz/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_LIB_FUZZING_ENGINE 2 | AM_CPPFLAGS = \ 3 | -I../include -I$(top_srcdir)/include \ 4 | -I../common -I$(top_srcdir)/common \ 5 | @LIBCERROR_CPPFLAGS@ \ 6 | @LIBCDATA_CPPFLAGS@ \ 7 | @LIBCLOCALE_CPPFLAGS@ \ 8 | @LIBCNOTIFY_CPPFLAGS@ \ 9 | @LIBUNA_CPPFLAGS@ \ 10 | @LIBCFILE_CPPFLAGS@ \ 11 | @LIBCPATH_CPPFLAGS@ \ 12 | @LIBBFIO_CPPFLAGS@ 13 | 14 | bin_PROGRAMS = \ 15 | file_fuzzer 16 | 17 | file_fuzzer_SOURCES = \ 18 | file_fuzzer.cc \ 19 | ossfuzz_libagdb.h \ 20 | ossfuzz_libbfio.h 21 | 22 | file_fuzzer_LDADD = \ 23 | @LIB_FUZZING_ENGINE@ \ 24 | @LIBBFIO_LIBADD@ \ 25 | @LIBCPATH_LIBADD@ \ 26 | @LIBCFILE_LIBADD@ \ 27 | @LIBUNA_LIBADD@ \ 28 | @LIBCDATA_LIBADD@ \ 29 | ../libagdb/libagdb.la \ 30 | @LIBCNOTIFY_LIBADD@ \ 31 | @LIBCLOCALE_LIBADD@ \ 32 | @LIBCERROR_LIBADD@ \ 33 | @LIBINTL@ 34 | endif 35 | 36 | DISTCLEANFILES = \ 37 | Makefile \ 38 | Makefile.in 39 | 40 | splint-local: 41 | @echo "Running splint on file_fuzzer ..." 42 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(file_fuzzer_SOURCES) 43 | 44 | -------------------------------------------------------------------------------- /ossfuzz/file_fuzzer.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * OSS-Fuzz target for libagdb file type 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | /* Note that some of the OSS-Fuzz engines use C++ 26 | */ 27 | extern "C" { 28 | 29 | #include "ossfuzz_libagdb.h" 30 | #include "ossfuzz_libbfio.h" 31 | 32 | #if !defined( LIBAGDB_HAVE_BFIO ) 33 | 34 | /* Opens a file using a Basic File IO (bfio) handle 35 | * Returns 1 if successful or -1 on error 36 | */ 37 | LIBAGDB_EXTERN \ 38 | int libagdb_file_open_file_io_handle( 39 | libagdb_file_t *file, 40 | libbfio_handle_t *file_io_handle, 41 | int access_flags, 42 | libagdb_error_t **error ); 43 | 44 | #endif /* !defined( LIBAGDB_HAVE_BFIO ) */ 45 | 46 | int LLVMFuzzerTestOneInput( 47 | const uint8_t *data, 48 | size_t size ) 49 | { 50 | libbfio_handle_t *file_io_handle = NULL; 51 | libagdb_file_t *file = NULL; 52 | 53 | if( libbfio_memory_range_initialize( 54 | &file_io_handle, 55 | NULL ) != 1 ) 56 | { 57 | return( 0 ); 58 | } 59 | if( libbfio_memory_range_set( 60 | file_io_handle, 61 | (uint8_t *) data, 62 | size, 63 | NULL ) != 1 ) 64 | { 65 | goto on_error_libbfio; 66 | } 67 | if( libagdb_file_initialize( 68 | &file, 69 | NULL ) != 1 ) 70 | { 71 | goto on_error_libbfio; 72 | } 73 | if( libagdb_file_open_file_io_handle( 74 | file, 75 | file_io_handle, 76 | LIBAGDB_OPEN_READ, 77 | NULL ) != 1 ) 78 | { 79 | goto on_error_libagdb; 80 | } 81 | libagdb_file_close( 82 | file, 83 | NULL ); 84 | 85 | on_error_libagdb: 86 | libagdb_file_free( 87 | &file, 88 | NULL ); 89 | 90 | on_error_libbfio: 91 | libbfio_handle_free( 92 | &file_io_handle, 93 | NULL ); 94 | 95 | return( 0 ); 96 | } 97 | 98 | } /* extern "C" */ 99 | 100 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libagdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libagdb header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _OSSFUZZ_LIBAGDB_H ) 23 | #define _OSSFUZZ_LIBAGDB_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _OSSFUZZ_LIBAGDB_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _OSSFUZZ_LIBBFIO_H ) 23 | #define _OSSFUZZ_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _OSSFUZZ_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-11-01 gettextize 2 | -------------------------------------------------------------------------------- /po/Makevars.in: -------------------------------------------------------------------------------- 1 | # Makefile variables for PO directory in any package using GNU gettext. 2 | 3 | # Usually the message domain is the same as the package name. 4 | DOMAIN = @PACKAGE@ 5 | 6 | # These two variables depend on the location of this directory. 7 | subdir = po 8 | top_builddir = .. 9 | 10 | # These options get passed to xgettext. 11 | XGETTEXT_OPTIONS = --keyword=_ --keyword=N_ 12 | 13 | # This is the copyright holder that gets inserted into the header of the 14 | # $(DOMAIN).pot file. Set this to the copyright holder of the surrounding 15 | # package. (Note that the msgstr strings, extracted from the package's 16 | # sources, belong to the copyright holder of the package.) Translators are 17 | # expected to transfer the copyright for their translations to this person 18 | # or entity, or to disclaim their copyright. The empty string stands for 19 | # the public domain; in this case the translators are expected to disclaim 20 | # their copyright. 21 | COPYRIGHT_HOLDER = Joachim Metz 22 | 23 | # This is the email address or URL to which the translators shall report 24 | # bugs in the untranslated strings: 25 | # - Strings which are not entire sentences, see the maintainer guidelines 26 | # in the GNU gettext documentation, section 'Preparing Strings'. 27 | # - Strings which use unclear terms or require additional context to be 28 | # understood. 29 | # - Strings which make invalid assumptions about notation of date, time or 30 | # money. 31 | # - Pluralisation problems. 32 | # - Incorrect English spelling. 33 | # - Incorrect formatting. 34 | # It can be your email address, or a mailing list address where translators 35 | # can write to without being subscribed, or the URL of a web page through 36 | # which the translators can contact you. 37 | MSGID_BUGS_ADDRESS = @PACKAGE_BUGREPORT@ 38 | 39 | # This is the list of locale categories, beyond LC_MESSAGES, for which the 40 | # message catalogs shall be used. It is usually empty. 41 | EXTRA_LOCALE_CATEGORIES = 42 | 43 | # Additional make targets. 44 | sources splint: 45 | 46 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # List of source files which contain translatable strings. 2 | -------------------------------------------------------------------------------- /runtests.ps1: -------------------------------------------------------------------------------- 1 | # Script that runs the tests 2 | # 3 | # Version: 20220103 4 | 5 | $ExitSuccess = 0 6 | $ExitFailure = 1 7 | $ExitIgnore = 77 8 | 9 | Set-Location -Path "tests" 10 | 11 | $Result = ${ExitSuccess} 12 | 13 | $Lines = Get-Content "Makefile.am" 14 | $InTests = $FALSE 15 | 16 | Foreach (${Line} in ${Lines}) 17 | { 18 | If (${InTests}) 19 | { 20 | If (-Not ${Line}) 21 | { 22 | ${InTests} = $FALSE 23 | 24 | Continue 25 | } 26 | ${Line} = ${Line}.TrimStart() 27 | 28 | If (${Line}.EndsWith(" \")) 29 | { 30 | ${Line} = ${Line}.Substring(0, ${Line}.Length - 2) 31 | } 32 | If (-Not (${Line}.EndsWith(".sh"))) 33 | { 34 | Continue 35 | } 36 | ${Line} = ${Line}.Substring(0, ${Line}.Length - 3) 37 | ${Line} = ".\${Line}.ps1" 38 | 39 | Try 40 | { 41 | Invoke-Expression ${Line} 42 | } 43 | Catch 44 | { 45 | $LastExitCode = ${ExitIgnore} 46 | } 47 | If (${LastExitCode} -eq ${ExitFailure}) 48 | { 49 | $Result = ${ExitFailure} 50 | Write-Host "FAIL" -foreground Red -nonewline 51 | } 52 | ElseIf (${LastExitCode} -eq ${ExitIgnore}) 53 | { 54 | Write-Host "SKIP" -foreground Cyan -nonewline 55 | } 56 | Else 57 | { 58 | Write-Host "PASS" -foreground Green -nonewline 59 | } 60 | Write-Host ": ${Line}" 61 | } 62 | ElseIf (${Line}.StartsWith("TESTS = ")) 63 | { 64 | ${InTests} = $TRUE 65 | } 66 | } 67 | 68 | Set-Location -Path ".." 69 | 70 | Exit ${Result} 71 | -------------------------------------------------------------------------------- /synclibs.ps1: -------------------------------------------------------------------------------- 1 | # Script that synchronizes the local library dependencies 2 | # 3 | # Version: 20180125 4 | 5 | Param ( 6 | [switch]$UseHead = $false 7 | ) 8 | 9 | $GitUrlPrefix = "https://github.com/libyal" 10 | $LocalLibs = "libbfio libcdata libcerror libcfile libclocale libcnotify libcpath libcsplit libcthreads libfcache libfdata libfdatetime libfwnt libuna" 11 | $LocalLibs = ${LocalLibs} -split " " 12 | 13 | $Git = "git" 14 | $WinFlex = "..\win_flex_bison\win_flex.exe" 15 | $WinBison = "..\win_flex_bison\win_bison.exe" 16 | 17 | ForEach (${LocalLib} in ${LocalLibs}) 18 | { 19 | # Split will return an array of a single empty string when LocalLibs is empty. 20 | If (-Not (${LocalLib})) 21 | { 22 | Continue 23 | } 24 | $GitUrl = "${GitUrlPrefix}/${LocalLib}.git" 25 | 26 | # PowerShell will raise NativeCommandError if git writes to stdout or stderr 27 | # therefore 2>&1 is added and the output is stored in a variable. 28 | $Output = Invoke-Expression -Command "${Git} clone ${GitUrl} ${LocalLib}-${pid} 2>&1" 29 | 30 | Push-Location "${LocalLib}-${pid}" 31 | 32 | Try 33 | { 34 | $Output = Invoke-Expression -Command "${Git} fetch --quiet --all --tags --prune 2>&1" 35 | 36 | $LatestTag = Invoke-Expression -Command "${Git} describe --tags --abbrev=0 2>&1" 37 | 38 | If (${LatestTag} -and -not ${UseHead}) 39 | { 40 | Write-Host "Synchronizing: ${LocalLib} from ${GitUrl} tag ${LatestTag}" 41 | 42 | $Output = Invoke-Expression -Command "${Git} checkout --quiet tags/${LatestTag} 2>&1" 43 | } 44 | Else 45 | { 46 | Write-Host "Synchronizing: ${LocalLib} from ${GitUrl} HEAD" 47 | } 48 | } 49 | Finally 50 | { 51 | Pop-Location 52 | } 53 | If (Test-Path ${LocalLib}-${pid}) 54 | { 55 | $LocalLibVersion = Get-Content -Path ${LocalLib}-${pid}\configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } 56 | 57 | If (Test-Path ${LocalLib}) 58 | { 59 | Remove-Item -Path ${LocalLib} -Force -Recurse 60 | } 61 | New-Item -ItemType directory -Path ${LocalLib} -Force | Out-Null 62 | 63 | If (Test-Path ${LocalLib}) 64 | { 65 | Copy-Item -Path ${LocalLib}-${pid}\${LocalLib}\*.[chly] -Destination ${LocalLib}\ 66 | Get-Content -Path ${LocalLib}-${pid}\${LocalLib}\${LocalLib}_definitions.h.in | % { $_ -Replace "@VERSION@",${LocalLibVersion} } > ${LocalLib}\${LocalLib}_definitions.h 67 | } 68 | Remove-Item -Path ${LocalLib}-${pid} -Force -Recurse 69 | 70 | $NamePrefix = "" 71 | 72 | ForEach (${DirectoryElement} in Get-ChildItem -Path "${LocalLib}\*.l") 73 | { 74 | $OutputFile = ${DirectoryElement} -Replace ".l$",".c" 75 | 76 | $NamePrefix = Split-Path -path ${DirectoryElement} -leaf 77 | $NamePrefix = ${NamePrefix} -Replace "^${LocalLib}_","" 78 | $NamePrefix = ${NamePrefix} -Replace ".l$","_" 79 | 80 | # PowerShell will raise NativeCommandError if win_flex writes to stdout or stderr 81 | # therefore 2>&1 is added and the output is stored in a variable. 82 | $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" 83 | Write-Host ${Output} 84 | 85 | # Moving manually sicne win_flex -o does not provide the expected behavior. 86 | Move-Item "lex.yy.c" ${OutputFile} -force 87 | } 88 | 89 | ForEach (${DirectoryElement} in Get-ChildItem -Path "${LocalLib}\*.y") 90 | { 91 | $OutputFile = ${DirectoryElement} -Replace ".y$",".c" 92 | 93 | # PowerShell will raise NativeCommandError if win_bison writes to stdout or stderr 94 | # therefore 2>&1 is added and the output is stored in a variable. 95 | $Output = Invoke-Expression -Command "& '${WinBison}' -d -v -l -p ${NamePrefix} -o ${OutputFile} ${DirectoryElement} 2>&1" 96 | Write-Host ${Output} 97 | } 98 | } 99 | } 100 | 101 | -------------------------------------------------------------------------------- /synctestdata.ps1: -------------------------------------------------------------------------------- 1 | # Script that synchronizes the local test data 2 | # 3 | # Version: 20230709 4 | 5 | $TestSet = "public" 6 | $TestInputDirectory = "tests/input" 7 | $TestFiles = "AgGlGlobalHistory.db" 8 | 9 | If (-Not (Test-Path ${TestInputDirectory})) 10 | { 11 | New-Item -Name ${TestInputDirectory} -ItemType "directory" | Out-Null 12 | } 13 | If (-Not (Test-Path "${TestInputDirectory}\${TestSet}")) 14 | { 15 | New-Item -Name "${TestInputDirectory}\${TestSet}" -ItemType "directory" | Out-Null 16 | } 17 | ForEach ($TestFile in ${TestFiles} -split " ") 18 | { 19 | $Url = "https://github.com/log2timeline/plaso/blob/main/test_data/${TestFile}?raw=true" 20 | 21 | Invoke-WebRequest -Uri ${Url} -OutFile "${TestInputDirectory}\${TestSet}\${TestFile}" 22 | } 23 | 24 | -------------------------------------------------------------------------------- /synctestdata.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script that synchronizes the local test data 3 | # 4 | # Version: 20161009 5 | 6 | TEST_SET="public"; 7 | TEST_INPUT_DIRECTORY="tests/input"; 8 | TEST_FILES="AgGlGlobalHistory.db"; 9 | 10 | mkdir -p "${TEST_INPUT_DIRECTORY}/${TEST_SET}"; 11 | 12 | for TEST_FILE in ${TEST_FILES}; 13 | do 14 | URL="https://github.com/log2timeline/plaso/blob/main/test_data/${TEST_FILE}?raw=true"; 15 | 16 | curl -L -o "${TEST_INPUT_DIRECTORY}/${TEST_SET}/${TEST_FILE}" ${URL}; 17 | done 18 | 19 | -------------------------------------------------------------------------------- /tests/agdb_test_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library error functions test program 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 27 | #include 28 | #endif 29 | 30 | #include "agdb_test_libagdb.h" 31 | #include "agdb_test_macros.h" 32 | #include "agdb_test_unused.h" 33 | 34 | /* Tests the libagdb_error_free function 35 | * Returns 1 if successful or 0 if not 36 | */ 37 | int agdb_test_error_free( 38 | void ) 39 | { 40 | /* Test invocation of function only 41 | */ 42 | libagdb_error_free( 43 | NULL ); 44 | 45 | return( 1 ); 46 | } 47 | 48 | /* Tests the libagdb_error_fprint function 49 | * Returns 1 if successful or 0 if not 50 | */ 51 | int agdb_test_error_fprint( 52 | void ) 53 | { 54 | /* Test invocation of function only 55 | */ 56 | libagdb_error_fprint( 57 | NULL, 58 | NULL ); 59 | 60 | return( 1 ); 61 | } 62 | 63 | /* Tests the libagdb_error_sprint function 64 | * Returns 1 if successful or 0 if not 65 | */ 66 | int agdb_test_error_sprint( 67 | void ) 68 | { 69 | /* Test invocation of function only 70 | */ 71 | libagdb_error_sprint( 72 | NULL, 73 | NULL, 74 | 0 ); 75 | 76 | return( 1 ); 77 | } 78 | 79 | /* Tests the libagdb_error_backtrace_fprint function 80 | * Returns 1 if successful or 0 if not 81 | */ 82 | int agdb_test_error_backtrace_fprint( 83 | void ) 84 | { 85 | /* Test invocation of function only 86 | */ 87 | libagdb_error_backtrace_fprint( 88 | NULL, 89 | NULL ); 90 | 91 | return( 1 ); 92 | } 93 | 94 | /* Tests the libagdb_error_backtrace_sprint function 95 | * Returns 1 if successful or 0 if not 96 | */ 97 | int agdb_test_error_backtrace_sprint( 98 | void ) 99 | { 100 | /* Test invocation of function only 101 | */ 102 | libagdb_error_backtrace_sprint( 103 | NULL, 104 | NULL, 105 | 0 ); 106 | 107 | return( 1 ); 108 | } 109 | 110 | /* The main program 111 | */ 112 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 113 | int wmain( 114 | int argc AGDB_TEST_ATTRIBUTE_UNUSED, 115 | wchar_t * const argv[] AGDB_TEST_ATTRIBUTE_UNUSED ) 116 | #else 117 | int main( 118 | int argc AGDB_TEST_ATTRIBUTE_UNUSED, 119 | char * const argv[] AGDB_TEST_ATTRIBUTE_UNUSED ) 120 | #endif 121 | { 122 | AGDB_TEST_UNREFERENCED_PARAMETER( argc ) 123 | AGDB_TEST_UNREFERENCED_PARAMETER( argv ) 124 | 125 | AGDB_TEST_RUN( 126 | "libagdb_error_free", 127 | agdb_test_error_free ); 128 | 129 | AGDB_TEST_RUN( 130 | "libagdb_error_fprint", 131 | agdb_test_error_fprint ); 132 | 133 | AGDB_TEST_RUN( 134 | "libagdb_error_sprint", 135 | agdb_test_error_sprint ); 136 | 137 | AGDB_TEST_RUN( 138 | "libagdb_error_backtrace_fprint", 139 | agdb_test_error_backtrace_fprint ); 140 | 141 | AGDB_TEST_RUN( 142 | "libagdb_error_backtrace_sprint", 143 | agdb_test_error_backtrace_sprint ); 144 | 145 | return( EXIT_SUCCESS ); 146 | 147 | on_error: 148 | return( EXIT_FAILURE ); 149 | } 150 | 151 | -------------------------------------------------------------------------------- /tests/agdb_test_functions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Functions for testing 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_FUNCTIONS_H ) 23 | #define _AGDB_TEST_FUNCTIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #include "agdb_test_libbfio.h" 29 | #include "agdb_test_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int agdb_test_get_narrow_source( 36 | const system_character_t *source, 37 | char *narrow_string, 38 | size_t narrow_string_size, 39 | libcerror_error_t **error ); 40 | 41 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 42 | 43 | int agdb_test_get_wide_source( 44 | const system_character_t *source, 45 | wchar_t *wide_string, 46 | size_t wide_string_size, 47 | libcerror_error_t **error ); 48 | 49 | #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ 50 | 51 | int agdb_test_open_file_io_handle( 52 | libbfio_handle_t **file_io_handle, 53 | uint8_t *data, 54 | size_t data_size, 55 | libcerror_error_t **error ); 56 | 57 | int agdb_test_close_file_io_handle( 58 | libbfio_handle_t **file_io_handle, 59 | libcerror_error_t **error ); 60 | 61 | #if defined( __cplusplus ) 62 | } 63 | #endif 64 | 65 | #endif /* !defined( _AGDB_TEST_FUNCTIONS_H ) */ 66 | 67 | -------------------------------------------------------------------------------- /tests/agdb_test_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_GETOPT_H ) 23 | #define _AGDB_TEST_GETOPT_H 24 | 25 | #include 26 | #include 27 | 28 | /* unistd.h is included here to export getopt, optarg, optind and optopt 29 | */ 30 | #if defined( HAVE_UNISTD_H ) 31 | #include 32 | #endif 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | #if defined( HAVE_GETOPT ) 39 | #define agdb_test_getopt( argument_count, argument_values, options_string ) \ 40 | getopt( argument_count, argument_values, options_string ) 41 | 42 | #else 43 | 44 | #if !defined( __CYGWIN__ ) 45 | extern int optind; 46 | extern system_character_t *optarg; 47 | extern system_integer_t optopt; 48 | 49 | #else 50 | int optind; 51 | system_character_t *optarg; 52 | system_integer_t optopt; 53 | 54 | #endif /* !defined( __CYGWIN__ ) */ 55 | 56 | system_integer_t agdb_test_getopt( 57 | int argument_count, 58 | system_character_t * const argument_values[], 59 | const system_character_t *options_string ); 60 | 61 | #endif /* defined( HAVE_GETOPT ) */ 62 | 63 | #if defined( __cplusplus ) 64 | } 65 | #endif 66 | 67 | #endif /* !defined( _AGDB_TEST_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /tests/agdb_test_libagdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libagdb header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_LIBAGDB_H ) 23 | #define _AGDB_TEST_LIBAGDB_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _AGDB_TEST_LIBAGDB_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /tests/agdb_test_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_LIBBFIO_H ) 23 | #define _AGDB_TEST_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _AGDB_TEST_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /tests/agdb_test_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_LIBCERROR_H ) 23 | #define _AGDB_TEST_LIBCERROR_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCERROR for local use of libcerror 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCERROR ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCERROR_DLL_IMPORT 39 | * before including libcerror.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCERROR_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCERROR ) */ 48 | 49 | #endif /* !defined( _AGDB_TEST_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/agdb_test_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_LIBCLOCALE_H ) 23 | #define _AGDB_TEST_LIBCLOCALE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCLOCALE for local use of libclocale 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCLOCALE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCLOCALE_DLL_IMPORT 39 | * before including libclocale.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCLOCALE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCLOCALE ) */ 48 | 49 | #endif /* !defined( _AGDB_TEST_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/agdb_test_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_LIBCNOTIFY_H ) 23 | #define _AGDB_TEST_LIBCNOTIFY_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCNOTIFY for local use of libcnotify 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCNOTIFY ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCNOTIFY_DLL_IMPORT 39 | * before including libcnotify.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 42 | #define LIBCNOTIFY_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCNOTIFY ) */ 48 | 49 | #endif /* !defined( _AGDB_TEST_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/agdb_test_libfdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfdata header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_LIBFDATA_H ) 23 | #define _AGDB_TEST_LIBFDATA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBFDATA for local use of libfdata 28 | */ 29 | #if defined( HAVE_LOCAL_LIBFDATA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBFDATA_DLL_IMPORT 43 | * before including libfdata.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 46 | #define LIBFDATA_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #endif /* defined( HAVE_LOCAL_LIBFDATA ) */ 52 | 53 | #endif /* !defined( _AGDB_TEST_LIBFDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /tests/agdb_test_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_LIBUNA_H ) 23 | #define _AGDB_TEST_LIBUNA_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBUNA for local use of libuna 28 | */ 29 | #if defined( HAVE_LOCAL_LIBUNA ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #else 47 | 48 | /* If libtool DLL support is enabled set LIBUNA_DLL_IMPORT 49 | * before including libuna.h 50 | */ 51 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) 52 | #define LIBUNA_DLL_IMPORT 53 | #endif 54 | 55 | #include 56 | 57 | #endif /* defined( HAVE_LOCAL_LIBUNA ) */ 58 | 59 | #endif /* !defined( _AGDB_TEST_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /tests/agdb_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory allocation functions for testing 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_MEMORY_H ) 23 | #define _AGDB_TEST_MEMORY_H 24 | 25 | #include 26 | 27 | #if defined( __cplusplus ) 28 | extern "C" { 29 | #endif 30 | 31 | #if defined( HAVE_GNU_DL_DLSYM ) && defined( __GNUC__ ) && !defined( LIBAGDB_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __loongarch__ ) && !defined( __mips__ ) && !defined( __riscv ) && !defined( __sparc__ ) && !defined( HAVE_ASAN ) 32 | #define HAVE_AGDB_TEST_MEMORY 1 33 | #endif 34 | 35 | #if defined( HAVE_AGDB_TEST_MEMORY ) 36 | 37 | extern int agdb_test_malloc_attempts_before_fail; 38 | 39 | extern int agdb_test_memcpy_attempts_before_fail; 40 | 41 | extern int agdb_test_memset_attempts_before_fail; 42 | 43 | extern int agdb_test_realloc_attempts_before_fail; 44 | 45 | #endif /* defined( HAVE_AGDB_TEST_MEMORY ) */ 46 | 47 | #if defined( __cplusplus ) 48 | } 49 | #endif 50 | 51 | #endif /* !defined( _AGDB_TEST_MEMORY_H ) */ 52 | 53 | -------------------------------------------------------------------------------- /tests/agdb_test_tools_output.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Tools output functions test program 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | #if defined( HAVE_IO_H ) || defined( WINAPI ) 29 | #include 30 | #endif 31 | 32 | #if defined( HAVE_STDLIB_H ) || defined( WINAPI ) 33 | #include 34 | #endif 35 | 36 | #include "agdb_test_libcerror.h" 37 | #include "agdb_test_macros.h" 38 | #include "agdb_test_unused.h" 39 | 40 | #include "../agdbtools/agdbtools_output.h" 41 | 42 | /* Tests the agdbtools_output_initialize function 43 | * Returns 1 if successful or 0 if not 44 | */ 45 | int agdb_test_tools_output_initialize( 46 | void ) 47 | { 48 | libcerror_error_t *error = NULL; 49 | int result = 0; 50 | 51 | result = agdbtools_output_initialize( 52 | _IONBF, 53 | &error ); 54 | 55 | AGDB_TEST_ASSERT_EQUAL_INT( 56 | "result", 57 | result, 58 | 1 ); 59 | 60 | AGDB_TEST_ASSERT_IS_NULL( 61 | "error", 62 | error ); 63 | 64 | return( 1 ); 65 | 66 | on_error: 67 | if( error != NULL ) 68 | { 69 | libcerror_error_free( 70 | &error ); 71 | } 72 | return( 0 ); 73 | } 74 | 75 | /* The main program 76 | */ 77 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 78 | int wmain( 79 | int argc AGDB_TEST_ATTRIBUTE_UNUSED, 80 | wchar_t * const argv[] AGDB_TEST_ATTRIBUTE_UNUSED ) 81 | #else 82 | int main( 83 | int argc AGDB_TEST_ATTRIBUTE_UNUSED, 84 | char * const argv[] AGDB_TEST_ATTRIBUTE_UNUSED ) 85 | #endif 86 | { 87 | AGDB_TEST_UNREFERENCED_PARAMETER( argc ) 88 | AGDB_TEST_UNREFERENCED_PARAMETER( argv ) 89 | 90 | AGDB_TEST_RUN( 91 | "agdbtools_output_initialize", 92 | agdb_test_tools_output_initialize ) 93 | 94 | /* TODO add tests for agdbtools_output_copyright_fprint */ 95 | 96 | /* TODO add tests for agdbtools_output_version_fprint */ 97 | 98 | /* TODO add tests for agdbtools_output_version_detailed_fprint */ 99 | 100 | return( EXIT_SUCCESS ); 101 | 102 | on_error: 103 | return( EXIT_FAILURE ); 104 | } 105 | 106 | -------------------------------------------------------------------------------- /tests/agdb_test_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2014-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _AGDB_TEST_UNUSED_H ) 23 | #define _AGDB_TEST_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( AGDB_TEST_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define AGDB_TEST_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define AGDB_TEST_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( AGDB_TEST_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define AGDB_TEST_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define AGDB_TEST_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _AGDB_TEST_UNUSED_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to build from source 3 | # 4 | # Version: 20201121 5 | 6 | set -e 7 | 8 | ./synclibs.sh --use-head 9 | ./autogen.sh 10 | ./configure "$@" 11 | make > /dev/null 12 | 13 | -------------------------------------------------------------------------------- /tests/data/file_information.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libagdb/43389aefc12e2cad99a899ad4e8a5598d4f09081/tests/data/file_information.1 -------------------------------------------------------------------------------- /tests/data/volume_information.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libagdb/43389aefc12e2cad99a899ad4e8a5598d4f09081/tests/data/volume_information.1 -------------------------------------------------------------------------------- /tests/lsan.suppressions: -------------------------------------------------------------------------------- 1 | leak:/lib*/libpython* 2 | -------------------------------------------------------------------------------- /tests/pkgbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to build a MacOS pkg 3 | # 4 | # Version: 20201121 5 | 6 | set -e 7 | 8 | make install DESTDIR=${PWD}/osx-pkg 9 | mkdir -p ${PWD}/osx-pkg/usr/share/doc/libagdb 10 | cp AUTHORS COPYING COPYING.LESSER NEWS README ${PWD}/osx-pkg/usr/share/doc/libagdb 11 | 12 | VERSION=`sed '5!d; s/^ \[//;s/\],$//' configure.ac` 13 | pkgbuild --root osx-pkg --identifier com.github.libyal.libagdb --version ${VERSION} --ownership recommended ../libagdb-${VERSION}.pkg 14 | 15 | -------------------------------------------------------------------------------- /tests/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script to run tests 3 | # 4 | # Version: 20201121 5 | 6 | if test -f ${PWD}/libagdb/.libs/libagdb.1.dylib && test -f ./pyagdb/.libs/pyagdb.so; 7 | then 8 | install_name_tool -change /usr/local/lib/libagdb.1.dylib ${PWD}/libagdb/.libs/libagdb.1.dylib ./pyagdb/.libs/pyagdb.so; 9 | fi 10 | 11 | make check CHECK_WITH_STDERR=1; 12 | RESULT=$?; 13 | 14 | if test ${RESULT} -ne 0 && test -f tests/test-suite.log; 15 | then 16 | cat tests/test-suite.log; 17 | fi 18 | exit ${RESULT}; 19 | 20 | -------------------------------------------------------------------------------- /tests/syncsharedlibs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Script that synchronizes the shared library dependencies 3 | # 4 | # Version: 20201121 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | 9 | GIT_URL_PREFIX="https://github.com/libyal"; 10 | SHARED_LIBS="libcerror libcthreads libcdata libclocale libcnotify libcsplit libuna libcfile libcpath libbfio libfcache libfdata libfdatetime libfwnt"; 11 | 12 | USE_HEAD=""; 13 | 14 | if test "$1" = "--use-head"; 15 | then 16 | USE_HEAD="--use-head"; 17 | fi 18 | 19 | OLDIFS=$IFS; 20 | IFS=" "; 21 | 22 | for SHARED_LIB in ${SHARED_LIBS}; 23 | do 24 | GIT_URL="${GIT_URL_PREFIX}/${SHARED_LIB}.git"; 25 | 26 | git clone --quiet ${GIT_URL} ${SHARED_LIB}-$$; 27 | 28 | if ! test -d ${SHARED_LIB}-$$; 29 | then 30 | echo "Unable to git clone: ${GIT_URL}"; 31 | 32 | IFS=$OLDIFS; 33 | 34 | exit ${EXIT_FAILURE}; 35 | fi 36 | (cd ${SHARED_LIB}-$$ && git fetch --quiet --all --tags --prune) 37 | 38 | LATEST_TAG=`cd ${SHARED_LIB}-$$ && git describe --tags --abbrev=0`; 39 | 40 | if test -n ${LATEST_TAG} && test -z ${USE_HEAD}; 41 | then 42 | echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} tag ${LATEST_TAG}"; 43 | 44 | (cd ${SHARED_LIB}-$$ && git checkout --quiet tags/${LATEST_TAG}); 45 | else 46 | echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} HEAD"; 47 | fi 48 | 49 | (cd ${SHARED_LIB}-$$ && ./synclibs.sh ${USE_HEAD} && ./autogen.sh); 50 | 51 | CONFIGURE_OPTIONS=""; 52 | 53 | (cd ${SHARED_LIB}-$$ && ./configure --help | grep -- '--enable-wide-character-type' > /dev/null); 54 | 55 | if test $? -eq 0; 56 | then 57 | CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-wide-character-type"; 58 | fi 59 | 60 | (cd ${SHARED_LIB}-$$ && ./configure --prefix=/usr ${CONFIGURE_OPTIONS} && make && sudo make install); 61 | 62 | rm -rf ${SHARED_LIB}-$$; 63 | done 64 | 65 | IFS=$OLDIFS; 66 | 67 | exit ${EXIT_SUCCESS}; 68 | 69 | -------------------------------------------------------------------------------- /tests/test_agdbinfo.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Info tool testing script 3 | # 4 | # Version: 20240413 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | EXIT_IGNORE=77; 9 | 10 | PROFILES=("agdbinfo"); 11 | OPTIONS_PER_PROFILE=(""); 12 | OPTION_SETS=(); 13 | 14 | INPUT_GLOB="*"; 15 | 16 | if test -n "${SKIP_TOOLS_TESTS}" || test -n "${SKIP_TOOLS_END_TO_END_TESTS}"; 17 | then 18 | exit ${EXIT_IGNORE}; 19 | fi 20 | 21 | TEST_EXECUTABLE="../agdbtools/agdbinfo"; 22 | 23 | if ! test -x "${TEST_EXECUTABLE}"; 24 | then 25 | TEST_EXECUTABLE="../agdbtools/agdbinfo.exe"; 26 | fi 27 | 28 | if ! test -x "${TEST_EXECUTABLE}"; 29 | then 30 | echo "Missing test executable: ${TEST_EXECUTABLE}"; 31 | 32 | exit ${EXIT_FAILURE}; 33 | fi 34 | 35 | TEST_DIRECTORY=`dirname $0`; 36 | 37 | TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; 38 | 39 | if ! test -f "${TEST_RUNNER}"; 40 | then 41 | echo "Missing test runner: ${TEST_RUNNER}"; 42 | 43 | exit ${EXIT_FAILURE}; 44 | fi 45 | 46 | source ${TEST_RUNNER}; 47 | 48 | if ! test -d "input"; 49 | then 50 | echo "Test input directory not found."; 51 | 52 | exit ${EXIT_IGNORE}; 53 | fi 54 | RESULT=`ls input/* | tr ' ' '\n' | wc -l`; 55 | 56 | if test ${RESULT} -eq ${EXIT_SUCCESS}; 57 | then 58 | echo "No files or directories found in the test input directory"; 59 | 60 | exit ${EXIT_IGNORE}; 61 | fi 62 | 63 | for PROFILE_INDEX in ${!PROFILES[*]}; 64 | do 65 | TEST_PROFILE=${PROFILES[${PROFILE_INDEX}]}; 66 | 67 | TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "input" "${TEST_PROFILE}"); 68 | 69 | IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}"); 70 | 71 | IFS=" " read -a PROFILE_OPTIONS <<< ${OPTIONS_PER_PROFILE[${PROFILE_INDEX}]}; 72 | 73 | RESULT=${EXIT_SUCCESS}; 74 | 75 | for TEST_SET_INPUT_DIRECTORY in input/*; 76 | do 77 | if ! test -d "${TEST_SET_INPUT_DIRECTORY}"; 78 | then 79 | continue; 80 | fi 81 | TEST_SET=`basename ${TEST_SET_INPUT_DIRECTORY}`; 82 | 83 | if check_for_test_set_in_ignore_list "${TEST_SET}" "${IGNORE_LIST}"; 84 | then 85 | continue; 86 | fi 87 | TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}"); 88 | 89 | RESULT=${EXIT_SUCCESS}; 90 | 91 | if test -f "${TEST_SET_DIRECTORY}/files"; 92 | then 93 | IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"); 94 | else 95 | IFS="" read -a INPUT_FILES <<< $(ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}); 96 | fi 97 | for INPUT_FILE in "${INPUT_FILES[@]}"; 98 | do 99 | TESTED_WITH_OPTIONS=0; 100 | 101 | for OPTION_SET in ${OPTION_SETS[@]}; 102 | do 103 | TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); 104 | 105 | if test -f ${TEST_DATA_OPTION_FILE}; 106 | then 107 | TESTED_WITH_OPTIONS=1; 108 | 109 | IFS=" " read -a OPTIONS <<< $(read_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); 110 | 111 | run_test_on_input_file "${TEST_SET_DIRECTORY}" "agdbinfo" "with_stdout_reference" "${OPTION_SET}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${PROFILE_OPTIONS[@]}" "${OPTIONS[@]}"; 112 | RESULT=$?; 113 | 114 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 115 | then 116 | break; 117 | fi 118 | fi 119 | done 120 | 121 | if test ${TESTED_WITH_OPTIONS} -eq 0; 122 | then 123 | run_test_on_input_file "${TEST_SET_DIRECTORY}" "agdbinfo" "with_stdout_reference" "" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${PROFILE_OPTIONS[@]}"; 124 | RESULT=$?; 125 | fi 126 | 127 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 128 | then 129 | break; 130 | fi 131 | done 132 | 133 | # Ignore failures due to corrupted data. 134 | if test "${TEST_SET}" = "corrupted"; 135 | then 136 | RESULT=${EXIT_SUCCESS}; 137 | fi 138 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 139 | then 140 | break; 141 | fi 142 | done 143 | done 144 | 145 | exit ${RESULT}; 146 | 147 | -------------------------------------------------------------------------------- /tests/test_manpage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Tests man pages. 3 | # 4 | # Version: 20240413 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | EXIT_IGNORE=77; 9 | 10 | run_test() 11 | { 12 | local INPUT_FILE=$1; 13 | local RESULT=0 14 | 15 | TEST_NAME=`basename ${INPUT_FILE}`; 16 | echo -n "Testing man with input: ${TEST_NAME}"; 17 | 18 | LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings -E UTF-8 -l -Tutf8 -Z ${INPUT_FILE} > /dev/null 2> ${TMPDIR}/${TEST_NAME}.warnings; 19 | RESULT=$?; 20 | 21 | # For now line break warnings are ignored. 22 | if test -f ${TMPDIR}/${TEST_NAME}.warnings; 23 | then 24 | sed "/can't break line/ d" -i ${TMPDIR}/${TEST_NAME}.warnings; 25 | fi 26 | if test -s ${TMPDIR}/${TEST_NAME}.warnings; 27 | then 28 | RESULT=${EXIT_FAILURE}; 29 | fi 30 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 31 | then 32 | echo " (FAIL)"; 33 | else 34 | echo " (PASS)"; 35 | fi 36 | if test -s ${TMPDIR}/${TEST_NAME}.warnings; 37 | then 38 | cat ${TMPDIR}/${TEST_NAME}.warnings; 39 | fi 40 | return ${RESULT}; 41 | } 42 | 43 | if test "${OSTYPE}" = "msys"; 44 | then 45 | exit ${EXIT_IGNORE}; 46 | fi 47 | 48 | TEST_DIRECTORY=`dirname $0`; 49 | 50 | TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; 51 | 52 | if ! test -f "${TEST_RUNNER}"; 53 | then 54 | echo "Missing test runner: ${TEST_RUNNER}"; 55 | 56 | exit ${EXIT_FAILURE}; 57 | fi 58 | 59 | source ${TEST_RUNNER}; 60 | 61 | assert_availability_binary man; 62 | 63 | RESULT=${EXIT_IGNORE}; 64 | 65 | TMPDIR="tmp$$"; 66 | 67 | rm -rf ${TMPDIR}; 68 | mkdir ${TMPDIR}; 69 | 70 | MANUALS_PATH="../manuals"; 71 | 72 | if ! test -d ${MANUALS_PATH}; 73 | then 74 | MANUALS_PATH="manuals"; 75 | fi 76 | 77 | if ! test -d ${MANUALS_PATH}; 78 | then 79 | echo "Manuals directory not found."; 80 | 81 | exit ${EXIT_IGNORE}; 82 | fi 83 | 84 | for INPUT_FILE in ${MANUALS_PATH}/*.[13]; 85 | do 86 | run_test "${INPUT_FILE}"; 87 | RESULT=$?; 88 | 89 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 90 | then 91 | break; 92 | fi 93 | done 94 | 95 | rm -rf ${TMPDIR}; 96 | 97 | exit ${RESULT}; 98 | 99 | --------------------------------------------------------------------------------