├── .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 ├── 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 Explorer Thumbnail Cache database format.asciidoc ├── dpkg ├── changelog.in ├── compat ├── control ├── copyright ├── libwtcdb-dev.install ├── libwtcdb-tools.install ├── libwtcdb.install ├── rules └── source │ └── format ├── dtfabric.yaml ├── include ├── Makefile.am ├── libwtcdb.h.in └── libwtcdb │ ├── codepage.h │ ├── definitions.h.in │ ├── error.h │ ├── extern.h │ ├── features.h.in │ └── types.h.in ├── libwtcdb.ini ├── libwtcdb.pc.in ├── libwtcdb.spec.in ├── libwtcdb ├── Makefile.am ├── libwtcdb.c ├── libwtcdb.rc.in ├── libwtcdb_cache_entry.c ├── libwtcdb_cache_entry.h ├── libwtcdb_crc.c ├── libwtcdb_crc.h ├── libwtcdb_debug.c ├── libwtcdb_debug.h ├── libwtcdb_definitions.h.in ├── libwtcdb_error.c ├── libwtcdb_error.h ├── libwtcdb_extern.h ├── libwtcdb_file.c ├── libwtcdb_file.h ├── libwtcdb_file_header.c ├── libwtcdb_file_header.h ├── libwtcdb_index_entry.c ├── libwtcdb_index_entry.h ├── libwtcdb_io_handle.c ├── libwtcdb_io_handle.h ├── libwtcdb_item.c ├── libwtcdb_item.h ├── libwtcdb_libbfio.h ├── libwtcdb_libcdata.h ├── libwtcdb_libcerror.h ├── libwtcdb_libclocale.h ├── libwtcdb_libcnotify.h ├── libwtcdb_libfdatetime.h ├── libwtcdb_libuna.h ├── libwtcdb_notify.c ├── libwtcdb_notify.h ├── libwtcdb_support.c ├── libwtcdb_support.h ├── libwtcdb_types.h ├── libwtcdb_unused.h ├── wtcdb_cache_entry.h ├── wtcdb_file_header.h └── wtcdb_index_entry.h ├── m4 ├── common.m4 ├── libbfio.m4 ├── libcdata.m4 ├── libcerror.m4 ├── libcfile.m4 ├── libclocale.m4 ├── libcnotify.m4 ├── libcpath.m4 ├── libcsplit.m4 ├── libcthreads.m4 ├── libfdatetime.m4 ├── libuna.m4 ├── pthread.m4 ├── tests.m4 └── types.m4 ├── manuals ├── Makefile.am ├── libwtcdb.3 ├── wtcdbexport.1 └── wtcdbinfo.1 ├── msvscpp ├── Makefile.am ├── libbfio │ └── libbfio.vcproj ├── libcdata │ └── libcdata.vcproj ├── libcerror │ └── libcerror.vcproj ├── libcfile │ └── libcfile.vcproj ├── libclocale │ └── libclocale.vcproj ├── libcnotify │ └── libcnotify.vcproj ├── libcpath │ └── libcpath.vcproj ├── libcsplit │ └── libcsplit.vcproj ├── libcthreads │ └── libcthreads.vcproj ├── libfdatetime │ └── libfdatetime.vcproj ├── libuna │ └── libuna.vcproj ├── libwtcdb.sln ├── libwtcdb │ └── libwtcdb.vcproj ├── wtcdb_test_cache_entry │ └── wtcdb_test_cache_entry.vcproj ├── wtcdb_test_crc │ └── wtcdb_test_crc.vcproj ├── wtcdb_test_error │ └── wtcdb_test_error.vcproj ├── wtcdb_test_file │ └── wtcdb_test_file.vcproj ├── wtcdb_test_file_header │ └── wtcdb_test_file_header.vcproj ├── wtcdb_test_index_entry │ └── wtcdb_test_index_entry.vcproj ├── wtcdb_test_io_handle │ └── wtcdb_test_io_handle.vcproj ├── wtcdb_test_item │ └── wtcdb_test_item.vcproj ├── wtcdb_test_notify │ └── wtcdb_test_notify.vcproj ├── wtcdb_test_support │ └── wtcdb_test_support.vcproj ├── wtcdbexport │ └── wtcdbexport.vcproj └── wtcdbinfo │ └── wtcdbinfo.vcproj ├── ossfuzz ├── Makefile.am ├── file_fuzzer.cc ├── ossfuzz_libbfio.h └── ossfuzz_libwtcdb.h ├── po ├── ChangeLog ├── Makevars.in └── POTFILES.in ├── runtests.ps1 ├── runtests.sh ├── synclibs.ps1 ├── synclibs.sh ├── tests ├── Makefile.am ├── build.sh ├── data │ ├── cache_entry.1 │ ├── cache_entry.2 │ ├── file_header.1 │ ├── file_header.2 │ ├── index_entry.1 │ └── index_entry.2 ├── lsan.suppressions ├── pkgbuild.sh ├── runtests.sh ├── syncsharedlibs.sh ├── test_library.ps1 ├── test_library.sh ├── test_manpage.sh ├── test_runner.sh ├── test_wtcdbexport.sh ├── test_wtcdbinfo.ps1 ├── test_wtcdbinfo.sh ├── wtcdb_test_cache_entry.c ├── wtcdb_test_crc.c ├── wtcdb_test_error.c ├── wtcdb_test_file.c ├── wtcdb_test_file_header.c ├── wtcdb_test_functions.c ├── wtcdb_test_functions.h ├── wtcdb_test_getopt.c ├── wtcdb_test_getopt.h ├── wtcdb_test_index_entry.c ├── wtcdb_test_io_handle.c ├── wtcdb_test_item.c ├── wtcdb_test_item_value.c ├── wtcdb_test_libbfio.h ├── wtcdb_test_libcerror.h ├── wtcdb_test_libclocale.h ├── wtcdb_test_libcnotify.h ├── wtcdb_test_libuna.h ├── wtcdb_test_libwtcdb.h ├── wtcdb_test_macros.h ├── wtcdb_test_memory.c ├── wtcdb_test_memory.h ├── wtcdb_test_notify.c ├── wtcdb_test_support.c └── wtcdb_test_unused.h └── wtcdbtools ├── Makefile.am ├── export_handle.c ├── export_handle.h ├── info_handle.c ├── info_handle.h ├── log_handle.c ├── log_handle.h ├── wtcdbexport.c ├── wtcdbinfo.c ├── wtcdbinput.c ├── wtcdbinput.h ├── wtcdbtools_getopt.c ├── wtcdbtools_getopt.h ├── wtcdbtools_i18n.h ├── wtcdbtools_libbfio.h ├── wtcdbtools_libcerror.h ├── wtcdbtools_libcfile.h ├── wtcdbtools_libclocale.h ├── wtcdbtools_libcnotify.h ├── wtcdbtools_libcpath.h ├── wtcdbtools_libfdatetime.h ├── wtcdbtools_libuna.h ├── wtcdbtools_libwtcdb.h ├── wtcdbtools_output.c ├── wtcdbtools_output.h ├── wtcdbtools_signal.c ├── wtcdbtools_signal.h └── wtcdbtools_unused.h /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | precision: 2 3 | round: down 4 | range: 70...100 5 | status: 6 | project: true 7 | patch: true 8 | changes: false 9 | ignore: 10 | - "libbfio/*" 11 | - "libcdata/*" 12 | - "libcerror/*" 13 | - "libcfile/*" 14 | - "libclocale/*" 15 | - "libcnotify/*" 16 | - "libcpath/*" 17 | - "libcsplit/*" 18 | - "libcthreads/*" 19 | - "libfdatetime/*" 20 | - "libuna/*" 21 | - "tests/*" 22 | -------------------------------------------------------------------------------- /.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/libwtcdb 28 | cp projects/libyal/build.sh projects/libwtcdb/ 29 | cp projects/libyal/project.yaml projects/libwtcdb/ 30 | head -n 20 projects/libyal/Dockerfile > projects/libwtcdb/Dockerfile 31 | echo "RUN git clone --depth 1 https://github.com/libyal/libwtcdb.git libwtcdb" >> projects/libwtcdb/Dockerfile 32 | tail -n 3 projects/libyal/Dockerfile >> projects/libwtcdb/Dockerfile 33 | python3 infra/helper.py build_image --pull libwtcdb 34 | python3 infra/helper.py build_fuzzers --sanitizer address libwtcdb 35 | python3 infra/helper.py check_build libwtcdb 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/libwtcdb.h 123 | /include/libwtcdb/definitions.h 124 | /include/libwtcdb/features.h 125 | /include/libwtcdb/types.h 126 | /libwtcdb.pc 127 | /libwtcdb.spec 128 | /libwtcdb/libwtcdb.rc 129 | /libwtcdb/libwtcdb_definitions.h 130 | /wtcdbtools/*.exe 131 | /wtcdbtools/wtcdbexport 132 | /wtcdbtools/wtcdbinfo 133 | /tests/*.exe 134 | /tests/input 135 | /tests/notify_stream.log 136 | /tests/tmp* 137 | /tests/wtcdb_test_cache_entry 138 | /tests/wtcdb_test_crc 139 | /tests/wtcdb_test_error 140 | /tests/wtcdb_test_file 141 | /tests/wtcdb_test_file_header 142 | /tests/wtcdb_test_index_entry 143 | /tests/wtcdb_test_io_handle 144 | /tests/wtcdb_test_item 145 | /tests/wtcdb_test_item_value 146 | /tests/wtcdb_test_notify 147 | /tests/wtcdb_test_support 148 | 149 | # Local library dependencies specific files 150 | /libbfio 151 | /libcdata 152 | /libcerror 153 | /libcfile 154 | /libclocale 155 | /libcnotify 156 | /libcpath 157 | /libcsplit 158 | /libcthreads 159 | /libfdatetime 160 | /libuna 161 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Acknowledgements: libwtcdb 2 | 3 | Copyright (C) 2010-2024, Joachim Metz 4 | 5 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | TODO: 2 | * expose index and cache entry in API 3 | * libwtcdb 4 | - merge libwtcdb_item and libwtcdb_item_values? 5 | * wtcdbinfo 6 | - add info handle 7 | * wtcdbexport 8 | - move file into export handle 9 | * update man pages 10 | 11 | * debug print cache type 12 | * debug print index entry flags 13 | 14 | * wtcdbexport export items in directories using the entry hash as filename 15 | 16 | 20101023 17 | * see `git log' for more recent change log 18 | * created initial version based on libnk2 for the library structure and common code 19 | * worked on cache file format support 20 | 21 | -------------------------------------------------------------------------------- /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 | libfdatetime \ 17 | libwtcdb \ 18 | wtcdbtools \ 19 | po \ 20 | manuals \ 21 | tests \ 22 | ossfuzz \ 23 | msvscpp 24 | 25 | DPKG_FILES = \ 26 | dpkg/changelog \ 27 | dpkg/changelog.in \ 28 | dpkg/compat \ 29 | dpkg/control \ 30 | dpkg/copyright \ 31 | dpkg/rules \ 32 | dpkg/libwtcdb-dev.install \ 33 | dpkg/libwtcdb.install \ 34 | dpkg/libwtcdb-tools.install \ 35 | dpkg/source/format 36 | 37 | GETTEXT_FILES = \ 38 | config.rpath \ 39 | po/Makevars.in 40 | 41 | PKGCONFIG_FILES = \ 42 | libwtcdb.pc.in 43 | 44 | SPEC_FILES = \ 45 | libwtcdb.spec \ 46 | libwtcdb.spec.in 47 | 48 | EXTRA_DIST = \ 49 | $(DPKG_FILES) \ 50 | $(GETTEXT_FILES) \ 51 | $(PKGCONFIG_FILES) \ 52 | $(SPEC_FILES) 53 | 54 | DISTCLEANFILES = \ 55 | config.status \ 56 | config.cache \ 57 | config.log \ 58 | libwtcdb.pc \ 59 | libwtcdb.spec \ 60 | Makefile \ 61 | Makefile.in \ 62 | po/Makevars 63 | 64 | pkgconfigdir = $(libdir)/pkgconfig 65 | 66 | pkgconfig_DATA = \ 67 | libwtcdb.pc 68 | 69 | libtool: @LIBTOOL_DEPS@ 70 | cd $(srcdir) && $(SHELL) ./config.status --recheck 71 | 72 | lib: library 73 | 74 | library: 75 | (cd $(srcdir)/common && $(MAKE) $(AM_MAKEFLAGS)) 76 | (cd $(srcdir)/libcerror && $(MAKE) $(AM_MAKEFLAGS)) 77 | (cd $(srcdir)/libcthreads && $(MAKE) $(AM_MAKEFLAGS)) 78 | (cd $(srcdir)/libcdata && $(MAKE) $(AM_MAKEFLAGS)) 79 | (cd $(srcdir)/libclocale && $(MAKE) $(AM_MAKEFLAGS)) 80 | (cd $(srcdir)/libcnotify && $(MAKE) $(AM_MAKEFLAGS)) 81 | (cd $(srcdir)/libcsplit && $(MAKE) $(AM_MAKEFLAGS)) 82 | (cd $(srcdir)/libuna && $(MAKE) $(AM_MAKEFLAGS)) 83 | (cd $(srcdir)/libcfile && $(MAKE) $(AM_MAKEFLAGS)) 84 | (cd $(srcdir)/libcpath && $(MAKE) $(AM_MAKEFLAGS)) 85 | (cd $(srcdir)/libbfio && $(MAKE) $(AM_MAKEFLAGS)) 86 | (cd $(srcdir)/libfdatetime && $(MAKE) $(AM_MAKEFLAGS)) 87 | (cd $(srcdir)/libwtcdb && $(MAKE) $(AM_MAKEFLAGS)) 88 | (cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS)) 89 | 90 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libwtcdb/891fad59b1a19daf451277b67002ec8c1b4faf5b/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | libwtcdb is a library to access the Windows Explorer thumbnail cache database (WTCDB) format (thumbcache.db). 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/libwtcdb/wiki/Home 17 | * How to build from source: https://github.com/libyal/libwtcdb/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 libwtcdb dependencies are available 6 | AC_DEFUN([AX_LIBWTCDB_CHECK_LOCAL], 7 | [dnl Check for internationalization functions in libwtcdb/libwtcdb_i18n.c 8 | AC_CHECK_FUNCS([bindtextdomain]) 9 | ]) 10 | 11 | dnl Function to detect if wtcdbtools dependencies are available 12 | AC_DEFUN([AX_WTCDBTOOLS_CHECK_LOCAL], 13 | [AC_CHECK_HEADERS([signal.h sys/signal.h unistd.h]) 14 | 15 | AC_CHECK_FUNCS([close getopt setvbuf]) 16 | 17 | AS_IF( 18 | [test "x$ac_cv_func_close" != xyes], 19 | [AC_MSG_FAILURE( 20 | [Missing function: close], 21 | [1]) 22 | ]) 23 | 24 | dnl Headers included in wtcdbtools/log_handle.c 25 | AC_CHECK_HEADERS([stdarg.h varargs.h]) 26 | 27 | AS_IF( 28 | [test "x$ac_cv_header_stdarg_h" != xyes && test "x$ac_cv_header_varargs_h" != xyes], 29 | [AC_MSG_FAILURE( 30 | [Missing headers: stdarg.h and varargs.h], 31 | [1]) 32 | ]) 33 | ]) 34 | 35 | dnl Function to check if DLL support is needed 36 | AC_DEFUN([AX_LIBWTCDB_CHECK_DLL_SUPPORT], 37 | [AS_IF( 38 | [test "x$enable_shared" = xyes && test "x$ac_cv_enable_static_executables" = xno], 39 | [AS_CASE( 40 | [$host], 41 | [*cygwin* | *mingw* | *msys*], 42 | [AC_DEFINE( 43 | [HAVE_DLLMAIN], 44 | [1], 45 | [Define to 1 to enable the DllMain function.]) 46 | AC_SUBST( 47 | [HAVE_DLLMAIN], 48 | [1]) 49 | 50 | AC_SUBST( 51 | [LIBWTCDB_DLL_EXPORT], 52 | ["-DLIBWTCDB_DLL_EXPORT"]) 53 | 54 | AC_SUBST( 55 | [LIBWTCDB_DLL_IMPORT], 56 | ["-DLIBWTCDB_DLL_IMPORT"]) 57 | ]) 58 | ]) 59 | ]) 60 | 61 | -------------------------------------------------------------------------------- /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) 2010-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) 2010-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) 2010-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) 2010-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) 2010-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 | libwtcdb (@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: libwtcdb 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/libwtcdb 8 | Vcs-Git: https://github.com/libyal/libwtcdb.git 9 | 10 | Package: libwtcdb 11 | Architecture: any 12 | Depends: ${shlibs:Depends}, ${misc:Depends} 13 | Conflicts: libwtcdb1 14 | Replaces: libwtcdb1 15 | Suggests: libwtcdb-dbg 16 | Description: Library to access the Windows Explorer thumbnail cache database (WTCDB) format 17 | libwtcdb is a library to access the Windows Explorer thumbnail cache database (WTCDB) format. 18 | 19 | Package: libwtcdb-dbg 20 | Architecture: any 21 | Section: debug 22 | Depends: libwtcdb (= ${binary:Version}), ${misc:Depends} 23 | Description: Debugging symbols for libwtcdb 24 | Debugging symbols for libwtcdb. 25 | 26 | Package: libwtcdb-dev 27 | Section: libdevel 28 | Architecture: any 29 | Depends: libwtcdb (= ${binary:Version}), ${misc:Depends} 30 | Description: Header files and libraries for developing applications for libwtcdb 31 | Header files and libraries for developing applications for libwtcdb. 32 | 33 | Package: libwtcdb-tools 34 | Section: utils 35 | Architecture: any 36 | Depends: libwtcdb (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} 37 | Conflicts: libwtcdb-utils 38 | Replaces: libwtcdb-utils 39 | Description: Several tools for reading Windows Explorer thumbnail cache database (WTCDB) files 40 | Several tools for reading Windows Explorer thumbnail cache database (WTCDB) files. 41 | 42 | Package: libwtcdb-tools-dbg 43 | Section: debug 44 | Architecture: any 45 | Depends: libwtcdb-tools (= ${binary:Version}), ${misc:Depends} 46 | Description: Debugging symbols for libwtcdb-tools 47 | Debugging symbols for libwtcdb-tools. 48 | 49 | -------------------------------------------------------------------------------- /dpkg/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: libwtcdb 3 | Source: https://github.com/libyal/libwtcdb 4 | 5 | Files: * 6 | Copyright: 2010-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/libwtcdb-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/libwtcdb-tools.install: -------------------------------------------------------------------------------- 1 | usr/bin 2 | usr/share/man/man1 3 | -------------------------------------------------------------------------------- /dpkg/libwtcdb.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 -plibwtcdb --dbg-package=libwtcdb-dbg 22 | dh_strip -plibwtcdb-tools --dbg-package=libwtcdb-tools-dbg 23 | endif 24 | 25 | -------------------------------------------------------------------------------- /dpkg/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /dtfabric.yaml: -------------------------------------------------------------------------------- 1 | name: wtcdb 2 | type: format 3 | description: Windows Explorer thumbnail cache database file (thumbcache.db) format 4 | urls: 5 | - 'https://github.com/libyal/libwtcdb/blob/main/documentation/Windows%20Explorer%20Thumbnail%20Cache%20database%20format.asciidoc' 6 | metadata: 7 | authors: ['Joachim Metz '] 8 | year: 2010 9 | attributes: 10 | byte_order: little-endian 11 | layout: 12 | - data_type: cache_file_header 13 | --- 14 | name: byte 15 | type: integer 16 | attributes: 17 | format: unsigned 18 | size: 1 19 | units: bytes 20 | --- 21 | name: uint32 22 | type: integer 23 | attributes: 24 | format: unsigned 25 | size: 4 26 | units: bytes 27 | --- 28 | name: cache_file_header 29 | type: structure 30 | attributes: 31 | byte_order: little-endian 32 | description: File header 33 | members: 34 | - name: signature 35 | type: stream 36 | element_data_type: byte 37 | elements_data_size: 4 38 | value: "CMMM" 39 | - name: format_version 40 | data_type: uint32 41 | - name: cache_type 42 | data_type: uint32 43 | - name: first_cache_entry_offset 44 | data_type: uint32 45 | - name: available_cache_entry_offset 46 | data_type: uint32 47 | - name: number_of_cache_entries 48 | data_type: uint32 49 | --- 50 | name: index_file_header 51 | type: structure 52 | attributes: 53 | byte_order: little-endian 54 | description: File header 55 | members: 56 | - name: signature 57 | type: stream 58 | element_data_type: byte 59 | elements_data_size: 4 60 | value: "IMMM" 61 | - name: format_version 62 | data_type: uint32 63 | - name: unknown1 64 | data_type: uint32 65 | - name: number_of_index_entries_used 66 | data_type: uint32 67 | - name: number_of_index_entries 68 | data_type: uint32 69 | - name: unknown2 70 | data_type: uint32 71 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | include_HEADERS = \ 2 | libwtcdb.h 3 | 4 | pkginclude_HEADERS = \ 5 | libwtcdb/codepage.h \ 6 | libwtcdb/definitions.h \ 7 | libwtcdb/error.h \ 8 | libwtcdb/extern.h \ 9 | libwtcdb/features.h \ 10 | libwtcdb/types.h 11 | 12 | EXTRA_DIST = \ 13 | libwtcdb.h.in \ 14 | libwtcdb/definitions.h.in \ 15 | libwtcdb/features.h.in \ 16 | libwtcdb/types.h.in 17 | 18 | DISTCLEANFILES = \ 19 | libwtcdb.h \ 20 | libwtcdb/definitions.h \ 21 | libwtcdb/features.h \ 22 | libwtcdb/types.h \ 23 | Makefile \ 24 | Makefile.in 25 | 26 | -------------------------------------------------------------------------------- /include/libwtcdb/definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for libwtcdb 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_DEFINITIONS_H ) 23 | #define _LIBWTCDB_DEFINITIONS_H 24 | 25 | #include 26 | 27 | #define LIBWTCDB_VERSION @VERSION@ 28 | 29 | /* The version string 30 | */ 31 | #define LIBWTCDB_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 LIBWTCDB_ACCESS_FLAGS 39 | { 40 | LIBWTCDB_ACCESS_FLAG_READ = 0x01, 41 | /* Reserved: not supported yet */ 42 | LIBWTCDB_ACCESS_FLAG_WRITE = 0x02 43 | }; 44 | 45 | /* The file access macros 46 | */ 47 | #define LIBWTCDB_OPEN_READ ( LIBWTCDB_ACCESS_FLAG_READ ) 48 | /* Reserved: not supported yet */ 49 | #define LIBWTCDB_OPEN_WRITE ( LIBWTCDB_ACCESS_FLAG_WRITE ) 50 | /* Reserved: not supported yet */ 51 | #define LIBWTCDB_OPEN_READ_WRITE ( LIBWTCDB_ACCESS_FLAG_READ | LIBWTCDB_ACCESS_FLAG_WRITE ) 52 | 53 | /* The file types 54 | */ 55 | enum LIBWTCDB_FILE_TYPES 56 | { 57 | LIBWTCDB_FILE_TYPE_CACHE = (uint8_t) 'c', 58 | LIBWTCDB_FILE_TYPE_INDEX_V20 = (uint8_t) 'i', 59 | LIBWTCDB_FILE_TYPE_INDEX_V30 = (uint8_t) 'I' 60 | }; 61 | 62 | #define LIBWTCDB_FILE_TYPE_INDEX LIBWTCDB_FILE_TYPE_INDEX_V20 63 | 64 | #endif /* !defined( _LIBWTCDB_DEFINITIONS_H ) */ 65 | 66 | -------------------------------------------------------------------------------- /include/libwtcdb/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) 2010-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( _LIBWTCDB_EXTERN_H ) 26 | #define _LIBWTCDB_EXTERN_H 27 | 28 | /* To export functions from the libwtcdb DLL define LIBWTCDB_DLL_EXPORT 29 | * To import functions from the libwtcdb DLL define LIBWTCDB_DLL_IMPORT 30 | * Otherwise use default extern statement 31 | */ 32 | #if defined( LIBWTCDB_DLL_EXPORT ) 33 | #define LIBWTCDB_EXTERN __declspec(dllexport) 34 | 35 | #elif defined( LIBWTCDB_DLL_IMPORT ) 36 | #define LIBWTCDB_EXTERN extern __declspec(dllimport) 37 | 38 | #else 39 | #define LIBWTCDB_EXTERN extern 40 | 41 | #endif 42 | 43 | #endif /* !defined( _LIBWTCDB_EXTERN_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /include/libwtcdb/features.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Features of libwtcdb 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_FEATURES_H ) 23 | #define _LIBWTCDB_FEATURES_H 24 | 25 | /* The libwtcdb type support features 26 | */ 27 | #if defined( WINAPI ) || @HAVE_WIDE_CHARACTER_TYPE@ 28 | #define LIBWTCDB_HAVE_WIDE_CHARACTER_TYPE 1 29 | #endif 30 | 31 | #if defined( WINAPI ) || @HAVE_MULTI_THREAD_SUPPORT@ 32 | #define LIBWTCDB_HAVE_MULTI_THREAD_SUPPORT 1 33 | #endif 34 | 35 | #if defined( HAVE_LIBBFIO ) || ( !defined( WINAPI ) && @HAVE_LIBBFIO@ ) 36 | #define LIBWTCDB_HAVE_BFIO 1 37 | #endif 38 | 39 | #if !defined( LIBWTCDB_DEPRECATED ) 40 | #if defined( __GNUC__ ) && __GNUC__ >= 3 41 | #define LIBWTCDB_DEPRECATED __attribute__ ((__deprecated__)) 42 | #elif defined( _MSC_VER ) 43 | #define LIBWTCDB_DEPRECATED __declspec(deprecated) 44 | #else 45 | #define LIBWTCDB_DEPRECATED 46 | #endif 47 | #endif 48 | 49 | #endif /* !defined( _LIBWTCDB_FEATURES_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libwtcdb.ini: -------------------------------------------------------------------------------- 1 | [project] 2 | name: "libwtcdb" 3 | status: "experimental" 4 | year_of_creation: "2010" 5 | data_format: "Windows Explorer thumbnail cache database file (thumbcache.db)" 6 | documentation_url: "https://github.com/libyal/libwtcdb/tree/main/documentation" 7 | features: ["debug_output", "ossfuzz", "tools"] 8 | 9 | [library] 10 | description: "Library to access the Windows Explorer thumbnail cache database (WTCDB) format" 11 | features: ["pthread", "wide_character_type"] 12 | public_types: ["file", "item"] 13 | 14 | [tools] 15 | description: "Several tools for reading Windows Explorer thumbnail cache database (WTCDB) files" 16 | names: ["wtcdbexport", "wtcdbinfo"] 17 | 18 | [troubleshooting] 19 | example: "wtcdbinfo thumbcache_1024.db" 20 | 21 | [development] 22 | main_object: "file" 23 | main_object_filename: "thumbcache_1024.db" 24 | 25 | [tests] 26 | profiles: ["libwtcdb", "wtcdbinfo"] 27 | info_tool_options_per_profile: [""] 28 | info_tool_profiles: ["wtcdbinfo"] 29 | example_filename1: "thumbcache_1024.db" 30 | example_filename2: "thumbcache_idx.db" 31 | 32 | -------------------------------------------------------------------------------- /libwtcdb.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: libwtcdb 7 | Description: Library to access the Windows Explorer thumbnail cache database (WTCDB) format 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lwtcdb 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_libfdatetime_pc_libs_private@ @ax_libuna_pc_libs_private@ 11 | Cflags: -I${includedir} 12 | 13 | -------------------------------------------------------------------------------- /libwtcdb.spec.in: -------------------------------------------------------------------------------- 1 | Name: libwtcdb 2 | Version: @VERSION@ 3 | Release: 1 4 | Summary: Library to access the Windows Explorer thumbnail cache database (WTCDB) 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/libwtcdb 9 | @libwtcdb_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_libfdatetime_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_libfdatetime_spec_build_requires@ @ax_libuna_spec_build_requires@ 11 | 12 | %description -n libwtcdb 13 | Library to access the Windows Explorer thumbnail cache database (WTCDB) format 14 | 15 | %package -n libwtcdb-static 16 | Summary: Library to access the Windows Explorer thumbnail cache database (WTCDB) format 17 | Group: Development/Libraries 18 | Requires: libwtcdb = %{version}-%{release} 19 | 20 | %description -n libwtcdb-static 21 | Static library version of libwtcdb. 22 | 23 | %package -n libwtcdb-devel 24 | Summary: Header files and libraries for developing applications for libwtcdb 25 | Group: Development/Libraries 26 | Requires: libwtcdb = %{version}-%{release} 27 | 28 | %description -n libwtcdb-devel 29 | Header files and libraries for developing applications for libwtcdb. 30 | 31 | %package -n libwtcdb-tools 32 | Summary: Several tools for reading Windows Explorer thumbnail cache database (WTCDB) files 33 | Group: Applications/System 34 | Requires: libwtcdb = %{version}-%{release} 35 | 36 | %description -n libwtcdb-tools 37 | Several tools for reading Windows Explorer thumbnail cache database (WTCDB) 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 libwtcdb 58 | %license COPYING COPYING.LESSER 59 | %doc AUTHORS README 60 | %{_libdir}/*.so.* 61 | 62 | %files -n libwtcdb-static 63 | %license COPYING COPYING.LESSER 64 | %doc AUTHORS README 65 | %{_libdir}/*.a 66 | 67 | %files -n libwtcdb-devel 68 | %license COPYING COPYING.LESSER 69 | %doc AUTHORS README 70 | %{_libdir}/*.so 71 | %{_libdir}/pkgconfig/libwtcdb.pc 72 | %{_includedir}/* 73 | %{_mandir}/man3/* 74 | 75 | %files -n libwtcdb-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 | -------------------------------------------------------------------------------- /libwtcdb/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 | @LIBWTCDB_DLL_EXPORT@ 15 | 16 | lib_LTLIBRARIES = libwtcdb.la 17 | 18 | libwtcdb_la_SOURCES = \ 19 | libwtcdb.c \ 20 | libwtcdb_cache_entry.c libwtcdb_cache_entry.h \ 21 | libwtcdb_crc.c libwtcdb_crc.h \ 22 | libwtcdb_debug.c libwtcdb_debug.h \ 23 | libwtcdb_definitions.h \ 24 | libwtcdb_error.c libwtcdb_error.h \ 25 | libwtcdb_extern.h \ 26 | libwtcdb_file.c libwtcdb_file.h \ 27 | libwtcdb_file_header.c libwtcdb_file_header.h \ 28 | libwtcdb_index_entry.c libwtcdb_index_entry.h \ 29 | libwtcdb_io_handle.c libwtcdb_io_handle.h \ 30 | libwtcdb_item.c libwtcdb_item.h \ 31 | libwtcdb_libbfio.h \ 32 | libwtcdb_libcdata.h \ 33 | libwtcdb_libcerror.h \ 34 | libwtcdb_libclocale.h \ 35 | libwtcdb_libcnotify.h \ 36 | libwtcdb_libfdatetime.h \ 37 | libwtcdb_libuna.h \ 38 | libwtcdb_notify.c libwtcdb_notify.h \ 39 | libwtcdb_support.c libwtcdb_support.h \ 40 | libwtcdb_types.h \ 41 | libwtcdb_unused.h \ 42 | wtcdb_cache_entry.h \ 43 | wtcdb_file_header.h \ 44 | wtcdb_index_entry.h 45 | 46 | libwtcdb_la_LIBADD = \ 47 | @LIBCERROR_LIBADD@ \ 48 | @LIBCDATA_LIBADD@ \ 49 | @LIBCLOCALE_LIBADD@ \ 50 | @LIBCNOTIFY_LIBADD@ \ 51 | @LIBCSPLIT_LIBADD@ \ 52 | @LIBUNA_LIBADD@ \ 53 | @LIBCFILE_LIBADD@ \ 54 | @LIBCPATH_LIBADD@ \ 55 | @LIBBFIO_LIBADD@ \ 56 | @LIBFDATETIME_LIBADD@ 57 | 58 | libwtcdb_la_LDFLAGS = -no-undefined -version-info 1:0:0 59 | 60 | EXTRA_DIST = \ 61 | libwtcdb_definitions.h.in \ 62 | libwtcdb.rc \ 63 | libwtcdb.rc.in 64 | 65 | DISTCLEANFILES = \ 66 | libwtcdb_definitions.h \ 67 | libwtcdb.rc \ 68 | Makefile \ 69 | Makefile.in 70 | 71 | sources-local: $(BUILT_SOURCES) 72 | 73 | splint-local: 74 | @echo "Running splint on libwtcdb ..." 75 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(libwtcdb_la_SOURCES) 76 | 77 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library to access the Windows Explorer thumbnail cache database (WTCDB) format 3 | * 4 | * Copyright (C) 2010-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 "libwtcdb_unused.h" 29 | 30 | /* Define HAVE_LOCAL_LIBWTCDB for local use of libwtcdb 31 | */ 32 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 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 | LIBWTCDB_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 libwtcdb_is_dll( 72 | void ) 73 | { 74 | return( 1 ); 75 | } 76 | 77 | #endif /* defined( WINAPI ) && defined( HAVE_DLLMAIN ) */ 78 | 79 | #endif /* !defined( HAVE_LOCAL_LIBWTCDB ) */ 80 | 81 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb.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 Explorer thumbnail cache database (WTCDB) format\0" 25 | VALUE "FileVersion", "@VERSION@" "\0" 26 | VALUE "InternalName", "libwtcdb.dll\0" 27 | VALUE "LegalCopyright", "(C) 2010-2024, Joachim Metz \0" 28 | VALUE "OriginalFilename", "libwtcdb.dll\0" 29 | VALUE "ProductName", "libwtcdb\0" 30 | VALUE "ProductVersion", "@VERSION@" "\0" 31 | VALUE "Comments", "For more information visit https://github.com/libyal/libwtcdb/\0" 32 | END 33 | END 34 | BLOCK "VarFileInfo" 35 | BEGIN 36 | VALUE "Translation", 0x0409, 1200 37 | END 38 | END 39 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_cache_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Cache entry functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_CACHE_ENTRY_H ) 23 | #define _LIBWTCDB_CACHE_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_io_handle.h" 29 | #include "libwtcdb_libbfio.h" 30 | #include "libwtcdb_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct libwtcdb_cache_entry libwtcdb_cache_entry_t; 37 | 38 | struct libwtcdb_cache_entry 39 | { 40 | /* The data size 41 | */ 42 | uint32_t data_size; 43 | 44 | /* The hash 45 | */ 46 | uint64_t hash; 47 | 48 | /* The identifier size 49 | */ 50 | uint32_t identifier_size; 51 | 52 | /* The padding size 53 | */ 54 | uint32_t padding_size; 55 | 56 | /* The cached data size 57 | */ 58 | uint32_t cached_data_size; 59 | 60 | /* The identifier 61 | */ 62 | uint8_t *identifier; 63 | 64 | /* The data CRC 65 | */ 66 | uint64_t data_crc; 67 | }; 68 | 69 | int libwtcdb_cache_entry_initialize( 70 | libwtcdb_cache_entry_t **cache_entry, 71 | libcerror_error_t **error ); 72 | 73 | int libwtcdb_cache_entry_free( 74 | libwtcdb_cache_entry_t **cache_entry, 75 | libcerror_error_t **error ); 76 | 77 | int libwtcdb_cache_entry_header_read_data( 78 | libwtcdb_cache_entry_t *cache_entry, 79 | libwtcdb_io_handle_t *io_handle, 80 | const uint8_t *data, 81 | size_t data_size, 82 | libcerror_error_t **error ); 83 | 84 | int libwtcdb_cache_entry_read_file_io_handle( 85 | libwtcdb_cache_entry_t *cache_entry, 86 | libwtcdb_io_handle_t *io_handle, 87 | libbfio_handle_t *file_io_handle, 88 | off64_t file_offset, 89 | libcerror_error_t **error ); 90 | 91 | #if defined( __cplusplus ) 92 | } 93 | #endif 94 | 95 | #endif /* !defined( _LIBWTCDB_CACHE_ENTRY_H ) */ 96 | 97 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CRC-64 functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_CRC_H ) 23 | #define _LIBWTCDB_CRC_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | int libwtcdb_crc64_weak_calculate( 35 | uint64_t *crc64, 36 | const uint8_t *buffer, 37 | size_t size, 38 | uint64_t initial_value, 39 | libcerror_error_t **error ); 40 | 41 | #if defined( __cplusplus ) 42 | } 43 | #endif 44 | 45 | #endif /* !defined( _LIBWTCDB_CRC_H ) */ 46 | 47 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Debug functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_DEBUG_H ) 23 | #define _LIBWTCDB_DEBUG_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_libbfio.h" 29 | #include "libwtcdb_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | #if defined( HAVE_DEBUG_OUTPUT ) 36 | 37 | int libwtcdb_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 libwtcdb_debug_print_utf16_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 byte_order, 52 | libcerror_error_t **error ); 53 | 54 | int libwtcdb_debug_print_read_offsets( 55 | libbfio_handle_t *file_io_handle, 56 | libcerror_error_t **error ); 57 | 58 | #endif /* defined( HAVE_DEBUG_OUTPUT ) */ 59 | 60 | #if defined( __cplusplus ) 61 | } 62 | #endif 63 | 64 | #endif /* !defined( _LIBWTCDB_DEBUG_H ) */ 65 | 66 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_definitions.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal definitions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_INTERNAL_DEFINITIONS_H ) 23 | #define _LIBWTCDB_INTERNAL_DEFINITIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #define LIBWTCDB_ENDIAN_BIG _BYTE_STREAM_ENDIAN_BIG 29 | #define LIBWTCDB_ENDIAN_LITTLE _BYTE_STREAM_ENDIAN_LITTLE 30 | 31 | /* Define HAVE_LOCAL_LIBWTCDB for local use of libwtcdb 32 | */ 33 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 34 | #include 35 | 36 | /* The definitions in are copied here 37 | * for local use of libwtcdb 38 | */ 39 | #else 40 | #define LIBWTCDB_VERSION @VERSION@ 41 | 42 | /* The version string 43 | */ 44 | #define LIBWTCDB_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 LIBWTCDB_ACCESS_FLAGS 52 | { 53 | LIBWTCDB_ACCESS_FLAG_READ = 0x01, 54 | /* Reserved: not supported yet */ 55 | LIBWTCDB_ACCESS_FLAG_WRITE = 0x02 56 | }; 57 | 58 | /* The file access macros 59 | */ 60 | #define LIBWTCDB_OPEN_READ ( LIBWTCDB_ACCESS_FLAG_READ ) 61 | /* Reserved: not supported yet */ 62 | #define LIBWTCDB_OPEN_WRITE ( LIBWTCDB_ACCESS_FLAG_WRITE ) 63 | /* Reserved: not supported yet */ 64 | #define LIBWTCDB_OPEN_READ_WRITE ( LIBWTCDB_ACCESS_FLAG_READ | LIBWTCDB_ACCESS_FLAG_WRITE ) 65 | 66 | /* The file types 67 | */ 68 | enum LIBWTCDB_FILE_TYPES 69 | { 70 | LIBWTCDB_FILE_TYPE_CACHE = (uint8_t) 'c', 71 | LIBWTCDB_FILE_TYPE_INDEX_V20 = (uint8_t) 'i', 72 | LIBWTCDB_FILE_TYPE_INDEX_V30 = (uint8_t) 'I' 73 | }; 74 | 75 | #define LIBWTCDB_FILE_TYPE_INDEX LIBWTCDB_FILE_TYPE_INDEX_V20 76 | 77 | #endif /* !defined( HAVE_LOCAL_LIBWTCDB ) */ 78 | 79 | #endif /* !defined( _LIBWTCDB_INTERNAL_DEFINITIONS_H ) */ 80 | 81 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2010-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 "libwtcdb_error.h" 27 | #include "libwtcdb_libcerror.h" 28 | 29 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 30 | 31 | /* Free an error and its elements 32 | */ 33 | void libwtcdb_error_free( 34 | libwtcdb_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 libwtcdb_error_fprint( 44 | libwtcdb_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 libwtcdb_error_sprint( 61 | libwtcdb_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 libwtcdb_error_backtrace_fprint( 79 | libwtcdb_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 libwtcdb_error_backtrace_sprint( 96 | libwtcdb_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_LIBWTCDB ) */ 111 | 112 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Error functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_INTERNAL_ERROR_H ) 23 | #define _LIBWTCDB_INTERNAL_ERROR_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 30 | #include 31 | #endif 32 | 33 | #include "libwtcdb_extern.h" 34 | 35 | #if defined( __cplusplus ) 36 | extern "C" { 37 | #endif 38 | 39 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 40 | 41 | LIBWTCDB_EXTERN \ 42 | void libwtcdb_error_free( 43 | libwtcdb_error_t **error ); 44 | 45 | LIBWTCDB_EXTERN \ 46 | int libwtcdb_error_fprint( 47 | libwtcdb_error_t *error, 48 | FILE *stream ); 49 | 50 | LIBWTCDB_EXTERN \ 51 | int libwtcdb_error_sprint( 52 | libwtcdb_error_t *error, 53 | char *string, 54 | size_t size ); 55 | 56 | LIBWTCDB_EXTERN \ 57 | int libwtcdb_error_backtrace_fprint( 58 | libwtcdb_error_t *error, 59 | FILE *stream ); 60 | 61 | LIBWTCDB_EXTERN \ 62 | int libwtcdb_error_backtrace_sprint( 63 | libwtcdb_error_t *error, 64 | char *string, 65 | size_t size ); 66 | 67 | #endif /* !defined( HAVE_LOCAL_LIBWTCDB ) */ 68 | 69 | #if defined( __cplusplus ) 70 | } 71 | #endif 72 | 73 | #endif /* !defined( _LIBWTCDB_INTERNAL_ERROR_H ) */ 74 | 75 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_extern.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal extern definition 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_INTERNAL_EXTERN_H ) 23 | #define _LIBWTCDB_INTERNAL_EXTERN_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBWTCDB for local use of libwtcdb 28 | */ 29 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 30 | 31 | #include 32 | 33 | #if defined( __CYGWIN__ ) || defined( __MINGW32__ ) 34 | #define LIBWTCDB_EXTERN_VARIABLE extern 35 | #else 36 | #define LIBWTCDB_EXTERN_VARIABLE LIBWTCDB_EXTERN 37 | #endif 38 | 39 | #else 40 | #define LIBWTCDB_EXTERN /* extern */ 41 | #define LIBWTCDB_EXTERN_VARIABLE extern 42 | 43 | #endif /* !defined( HAVE_LOCAL_LIBWTCDB ) */ 44 | 45 | #endif /* !defined( _LIBWTCDB_INTERNAL_EXTERN_H ) */ 46 | 47 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_INTERNAL_FILE_H ) 23 | #define _LIBWTCDB_INTERNAL_FILE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_extern.h" 29 | #include "libwtcdb_io_handle.h" 30 | #include "libwtcdb_libbfio.h" 31 | #include "libwtcdb_libcdata.h" 32 | #include "libwtcdb_libcerror.h" 33 | #include "libwtcdb_types.h" 34 | 35 | #if defined( __cplusplus ) 36 | extern "C" { 37 | #endif 38 | 39 | typedef struct libwtcdb_internal_file libwtcdb_internal_file_t; 40 | 41 | struct libwtcdb_internal_file 42 | { 43 | /* The entries array 44 | */ 45 | libcdata_array_t *entries; 46 | 47 | /* The entry free function 48 | */ 49 | intptr_t *entry_free_function; 50 | 51 | /* The IO handle 52 | */ 53 | libwtcdb_io_handle_t *io_handle; 54 | 55 | /* The file IO handle 56 | */ 57 | libbfio_handle_t *file_io_handle; 58 | 59 | /* Value to indicate if the file IO handle was created inside the library 60 | */ 61 | uint8_t file_io_handle_created_in_library; 62 | 63 | /* Value to indicate if the file IO handle was opened inside the library 64 | */ 65 | uint8_t file_io_handle_opened_in_library; 66 | }; 67 | 68 | LIBWTCDB_EXTERN \ 69 | int libwtcdb_file_initialize( 70 | libwtcdb_file_t **file, 71 | libcerror_error_t **error ); 72 | 73 | LIBWTCDB_EXTERN \ 74 | int libwtcdb_file_free( 75 | libwtcdb_file_t **file, 76 | libcerror_error_t **error ); 77 | 78 | LIBWTCDB_EXTERN \ 79 | int libwtcdb_file_signal_abort( 80 | libwtcdb_file_t *file, 81 | libcerror_error_t **error ); 82 | 83 | LIBWTCDB_EXTERN \ 84 | int libwtcdb_file_open( 85 | libwtcdb_file_t *file, 86 | const char *filename, 87 | int access_flags, 88 | libcerror_error_t **error ); 89 | 90 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 91 | 92 | LIBWTCDB_EXTERN \ 93 | int libwtcdb_file_open_wide( 94 | libwtcdb_file_t *file, 95 | const wchar_t *filename, 96 | int access_flags, 97 | libcerror_error_t **error ); 98 | 99 | #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ 100 | 101 | LIBWTCDB_EXTERN \ 102 | int libwtcdb_file_open_file_io_handle( 103 | libwtcdb_file_t *file, 104 | libbfio_handle_t *file_io_handle, 105 | int access_flags, 106 | libcerror_error_t **error ); 107 | 108 | LIBWTCDB_EXTERN \ 109 | int libwtcdb_file_close( 110 | libwtcdb_file_t *file, 111 | libcerror_error_t **error ); 112 | 113 | int libwtcdb_file_open_read( 114 | libwtcdb_internal_file_t *internal_file, 115 | libbfio_handle_t *file_io_handle, 116 | libcerror_error_t **error ); 117 | 118 | int libwtcdb_file_read_entries( 119 | libwtcdb_internal_file_t *internal_file, 120 | libbfio_handle_t *file_io_handle, 121 | uint32_t first_entry_offset, 122 | libcerror_error_t **error ); 123 | 124 | LIBWTCDB_EXTERN \ 125 | int libwtcdb_file_get_type( 126 | libwtcdb_file_t *file, 127 | uint8_t *type, 128 | libcerror_error_t **error ); 129 | 130 | LIBWTCDB_EXTERN \ 131 | int libwtcdb_file_get_number_of_items( 132 | libwtcdb_file_t *file, 133 | int *number_of_items, 134 | libcerror_error_t **error ); 135 | 136 | LIBWTCDB_EXTERN \ 137 | int libwtcdb_file_get_item( 138 | libwtcdb_file_t *file, 139 | int item_index, 140 | libwtcdb_item_t **item, 141 | libcerror_error_t **error ); 142 | 143 | #if defined( __cplusplus ) 144 | } 145 | #endif 146 | 147 | #endif /* !defined( _LIBWTCDB_INTERNAL_FILE_H ) */ 148 | 149 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_file_header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File header functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_FILE_HEADER_H ) 23 | #define _LIBWTCDB_FILE_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_libbfio.h" 29 | #include "libwtcdb_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct libwtcdb_file_header libwtcdb_file_header_t; 36 | 37 | struct libwtcdb_file_header 38 | { 39 | /* The file type 40 | */ 41 | uint8_t file_type; 42 | 43 | /* The format version 44 | */ 45 | uint32_t format_version; 46 | 47 | /* The cache type 48 | */ 49 | uint32_t cache_type; 50 | 51 | /* The first entry offset 52 | */ 53 | uint32_t first_entry_offset; 54 | 55 | /* The available cache entry offset 56 | */ 57 | uint32_t available_cache_entry_offset; 58 | 59 | /* The number of entries 60 | */ 61 | uint32_t number_of_entries; 62 | }; 63 | 64 | int libwtcdb_file_header_initialize( 65 | libwtcdb_file_header_t **file_header, 66 | libcerror_error_t **error ); 67 | 68 | int libwtcdb_file_header_free( 69 | libwtcdb_file_header_t **file_header, 70 | libcerror_error_t **error ); 71 | 72 | int libwtcdb_file_header_read_data( 73 | libwtcdb_file_header_t *file_header, 74 | const uint8_t *data, 75 | size_t data_size, 76 | libcerror_error_t **error ); 77 | 78 | int libwtcdb_file_header_read_file_io_handle( 79 | libwtcdb_file_header_t *file_header, 80 | libbfio_handle_t *file_io_handle, 81 | libcerror_error_t **error ); 82 | 83 | #if defined( __cplusplus ) 84 | } 85 | #endif 86 | 87 | #endif /* !defined( _LIBWTCDB_FILE_HEADER_H ) */ 88 | 89 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_index_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Cache entry functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_INDEX_ENTRY_H ) 23 | #define _LIBWTCDB_INDEX_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_io_handle.h" 29 | #include "libwtcdb_libbfio.h" 30 | #include "libwtcdb_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct libwtcdb_index_entry libwtcdb_index_entry_t; 37 | 38 | struct libwtcdb_index_entry 39 | { 40 | /* The data size 41 | */ 42 | uint32_t data_size; 43 | 44 | /* The hash 45 | */ 46 | uint64_t hash; 47 | 48 | /* The modification date and time 49 | */ 50 | uint64_t modification_time; 51 | }; 52 | 53 | int libwtcdb_index_entry_initialize( 54 | libwtcdb_index_entry_t **index_entry, 55 | libcerror_error_t **error ); 56 | 57 | int libwtcdb_index_entry_free( 58 | libwtcdb_index_entry_t **index_entry, 59 | libcerror_error_t **error ); 60 | 61 | int libwtcdb_index_entry_read_data( 62 | libwtcdb_index_entry_t *index_entry, 63 | libwtcdb_io_handle_t *io_handle, 64 | const uint8_t *data, 65 | size_t data_size, 66 | libcerror_error_t **error ); 67 | 68 | int libwtcdb_index_entry_read_file_io_handle( 69 | libwtcdb_index_entry_t *index_entry, 70 | libwtcdb_io_handle_t *io_handle, 71 | libbfio_handle_t *file_io_handle, 72 | off64_t file_offset, 73 | libcerror_error_t **error ); 74 | 75 | #if defined( __cplusplus ) 76 | } 77 | #endif 78 | 79 | #endif /* !defined( _LIBWTCDB_INDEX_ENTRY_H ) */ 80 | 81 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_io_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Input/Output (IO) handle 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_IO_HANDLE_H ) 23 | #define _LIBWTCDB_IO_HANDLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | extern const uint8_t *wtcdb_cache_file_signature; 35 | extern const uint8_t *wtcdb_index_file_signature; 36 | 37 | typedef struct libwtcdb_io_handle libwtcdb_io_handle_t; 38 | 39 | struct libwtcdb_io_handle 40 | { 41 | /* The file type 42 | */ 43 | uint8_t file_type; 44 | 45 | /* The format version 46 | */ 47 | uint32_t format_version; 48 | 49 | /* Value to indicate if abort was signalled 50 | */ 51 | int abort; 52 | }; 53 | 54 | int libwtcdb_io_handle_initialize( 55 | libwtcdb_io_handle_t **io_handle, 56 | libcerror_error_t **error ); 57 | 58 | int libwtcdb_io_handle_free( 59 | libwtcdb_io_handle_t **io_handle, 60 | libcerror_error_t **error ); 61 | 62 | int libwtcdb_io_handle_clear( 63 | libwtcdb_io_handle_t *io_handle, 64 | libcerror_error_t **error ); 65 | 66 | #if defined( __cplusplus ) 67 | } 68 | #endif 69 | 70 | #endif /* !defined( _LIBWTCDB_IO_HANDLE_H ) */ 71 | 72 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_item.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Item functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_INTERNAL_ITEM_H ) 23 | #define _LIBWTCDB_INTERNAL_ITEM_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_extern.h" 29 | #include "libwtcdb_io_handle.h" 30 | #include "libwtcdb_libbfio.h" 31 | #include "libwtcdb_libcerror.h" 32 | #include "libwtcdb_types.h" 33 | 34 | #if defined( __cplusplus ) 35 | extern "C" { 36 | #endif 37 | 38 | typedef struct libwtcdb_internal_item libwtcdb_internal_item_t; 39 | 40 | struct libwtcdb_internal_item 41 | { 42 | /* The IO handle 43 | */ 44 | libwtcdb_io_handle_t *io_handle; 45 | 46 | /* The file IO handle 47 | */ 48 | libbfio_handle_t *file_io_handle; 49 | 50 | /* The entry 51 | */ 52 | intptr_t *entry; 53 | }; 54 | 55 | int libwtcdb_item_initialize( 56 | libwtcdb_item_t **item, 57 | libwtcdb_io_handle_t *io_handle, 58 | libbfio_handle_t *file_io_handle, 59 | intptr_t *entry, 60 | libcerror_error_t **error ); 61 | 62 | LIBWTCDB_EXTERN \ 63 | int libwtcdb_item_free( 64 | libwtcdb_item_t **item, 65 | libcerror_error_t **error ); 66 | 67 | #if defined( __cplusplus ) 68 | } 69 | #endif 70 | 71 | #endif /* !defined( _LIBWTCDB_INTERNAL_ITEM_H ) */ 72 | 73 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_LIBBFIO_H ) 23 | #define _LIBWTCDB_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( _LIBWTCDB_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_libcdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcdata header wrapper 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_LIBCDATA_H ) 23 | #define _LIBWTCDB_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( _LIBWTCDB_LIBCDATA_H ) */ 54 | 55 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_LIBCERROR_H ) 23 | #define _LIBWTCDB_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( _LIBWTCDB_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_LIBCLOCALE_H ) 23 | #define _LIBWTCDB_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( _LIBWTCDB_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_LIBCNOTIFY_H ) 23 | #define _LIBWTCDB_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( _LIBWTCDB_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_libfdatetime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfdatetime header wrapper 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_LIBFDATETIME_H ) 23 | #define _LIBWTCDB_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( _LIBWTCDB_LIBFDATETIME_H ) */ 56 | 57 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_LIBUNA_H ) 23 | #define _LIBWTCDB_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( _LIBWTCDB_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_notify.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Notification functions 3 | * 4 | * Copyright (C) 2010-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 "libwtcdb_libcerror.h" 31 | #include "libwtcdb_libcnotify.h" 32 | #include "libwtcdb_notify.h" 33 | 34 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 35 | 36 | /* Sets the verbose notification 37 | */ 38 | void libwtcdb_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 libwtcdb_notify_set_stream( 49 | FILE *stream, 50 | libcerror_error_t **error ) 51 | { 52 | static char *function = "libwtcdb_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 libwtcdb_notify_stream_open( 75 | const char *filename, 76 | libcerror_error_t **error ) 77 | { 78 | static char *function = "libwtcdb_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 libwtcdb_notify_stream_close( 100 | libcerror_error_t **error ) 101 | { 102 | static char *function = "libwtcdb_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_LIBWTCDB ) */ 120 | 121 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_notify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Notification functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_NOTIFY_H ) 23 | #define _LIBWTCDB_NOTIFY_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "libwtcdb_extern.h" 30 | #include "libwtcdb_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 37 | 38 | LIBWTCDB_EXTERN \ 39 | void libwtcdb_notify_set_verbose( 40 | int verbose ); 41 | 42 | LIBWTCDB_EXTERN \ 43 | int libwtcdb_notify_set_stream( 44 | FILE *stream, 45 | libcerror_error_t **error ); 46 | 47 | LIBWTCDB_EXTERN \ 48 | int libwtcdb_notify_stream_open( 49 | const char *filename, 50 | libcerror_error_t **error ); 51 | 52 | LIBWTCDB_EXTERN \ 53 | int libwtcdb_notify_stream_close( 54 | libcerror_error_t **error ); 55 | 56 | #endif /* !defined( HAVE_LOCAL_LIBWTCDB ) */ 57 | 58 | #if defined( __cplusplus ) 59 | } 60 | #endif 61 | 62 | #endif /* !defined( _LIBWTCDB_NOTIFY_H ) */ 63 | 64 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_support.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Support functions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_SUPPORT_H ) 23 | #define _LIBWTCDB_SUPPORT_H 24 | 25 | #include 26 | #include 27 | 28 | #include "libwtcdb_extern.h" 29 | #include "libwtcdb_libbfio.h" 30 | #include "libwtcdb_libcerror.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | #if !defined( HAVE_LOCAL_LIBWTCDB ) 37 | 38 | LIBWTCDB_EXTERN \ 39 | const char *libwtcdb_get_version( 40 | void ); 41 | 42 | LIBWTCDB_EXTERN \ 43 | int libwtcdb_get_access_flags_read( 44 | void ); 45 | 46 | LIBWTCDB_EXTERN \ 47 | int libwtcdb_check_file_signature( 48 | const char *filename, 49 | libcerror_error_t **error ); 50 | 51 | LIBWTCDB_EXTERN \ 52 | int libwtcdb_get_codepage( 53 | int *codepage, 54 | libcerror_error_t **error ); 55 | 56 | LIBWTCDB_EXTERN \ 57 | int libwtcdb_set_codepage( 58 | int codepage, 59 | libcerror_error_t **error ); 60 | 61 | #endif /* !defined( HAVE_LOCAL_LIBWTCDB ) */ 62 | 63 | LIBWTCDB_EXTERN \ 64 | int libwtcdb_check_file_signature( 65 | const char *filename, 66 | libcerror_error_t **error ); 67 | 68 | #if defined( HAVE_WIDE_CHARACTER_TYPE ) 69 | 70 | LIBWTCDB_EXTERN \ 71 | int libwtcdb_check_file_signature_wide( 72 | const wchar_t *filename, 73 | libcerror_error_t **error ); 74 | 75 | #endif /* defined( HAVE_WIDE_CHARACTER_TYPE ) */ 76 | 77 | LIBWTCDB_EXTERN \ 78 | int libwtcdb_check_file_signature_file_io_handle( 79 | libbfio_handle_t *file_io_handle, 80 | libcerror_error_t **error ); 81 | 82 | #if defined( __cplusplus ) 83 | } 84 | #endif 85 | 86 | #endif /* !defined( _LIBWTCDB_SUPPORT_H ) */ 87 | 88 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal type definitions 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_INTERNAL_TYPES_H ) 23 | #define _LIBWTCDB_INTERNAL_TYPES_H 24 | 25 | #include 26 | #include 27 | 28 | /* Define HAVE_LOCAL_LIBWTCDB for local use of libwtcdb 29 | * The definitions in are copied here 30 | * for local use of libwtcdb 31 | */ 32 | #if defined( HAVE_LOCAL_LIBWTCDB ) 33 | 34 | /* The following type definitions hide internal data structures 35 | */ 36 | #if defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) 37 | typedef struct libwtcdb_file {} libwtcdb_file_t; 38 | typedef struct libwtcdb_item {} libwtcdb_item_t; 39 | 40 | #else 41 | typedef intptr_t libwtcdb_file_t; 42 | typedef intptr_t libwtcdb_item_t; 43 | 44 | #endif /* defined( HAVE_DEBUG_OUTPUT ) && !defined( WINAPI ) */ 45 | 46 | #endif /* defined( HAVE_LOCAL_LIBWTCDB ) */ 47 | 48 | #endif /* !defined( _LIBWTCDB_INTERNAL_TYPES_H ) */ 49 | 50 | -------------------------------------------------------------------------------- /libwtcdb/libwtcdb_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2010-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( _LIBWTCDB_UNUSED_H ) 23 | #define _LIBWTCDB_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( LIBWTCDB_ATTRIBUTE_UNUSED ) 28 | #if defined( __GNUC__ ) && __GNUC__ >= 3 29 | #define LIBWTCDB_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 30 | #else 31 | #define LIBWTCDB_ATTRIBUTE_UNUSED 32 | #endif 33 | #endif 34 | 35 | #if defined( _MSC_VER ) 36 | #define LIBWTCDB_UNREFERENCED_PARAMETER( parameter ) \ 37 | UNREFERENCED_PARAMETER( parameter ); 38 | #else 39 | #define LIBWTCDB_UNREFERENCED_PARAMETER( parameter ) \ 40 | /* parameter */ 41 | #endif 42 | 43 | #endif /* !defined( _LIBWTCDB_UNUSED_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /libwtcdb/wtcdb_file_header.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The file header definition of a Windows Explorer thumbnail cache database file 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_FILE_HEADER_H ) 23 | #define _WTCDB_FILE_HEADER_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct wtcdb_cache_file_header wtcdb_cache_file_header_t; 33 | 34 | struct wtcdb_cache_file_header 35 | { 36 | /* Signature 37 | * Consists of 4 bytes 38 | * Contains CMMM 39 | */ 40 | uint8_t signature[ 4 ]; 41 | 42 | /* Format version 43 | * Consists of 4 bytes 44 | */ 45 | uint8_t format_version[ 4 ]; 46 | 47 | /* Cache type 48 | * Consists of 4 bytes 49 | */ 50 | uint8_t cache_type[ 4 ]; 51 | 52 | /* Offset to the first cache entry 53 | * Consists of 4 bytes 54 | */ 55 | uint8_t first_cache_entry_offset[ 4 ]; 56 | 57 | /* Offset to the (next) available cache entry 58 | * Consists of 4 bytes 59 | */ 60 | uint8_t available_cache_entry_offset[ 4 ]; 61 | 62 | /* Number of cache entries 63 | * Consists of 4 bytes 64 | */ 65 | uint8_t number_of_cache_entries[ 4 ]; 66 | }; 67 | 68 | typedef struct wtcdb_index_file_header_v20 wtcdb_index_file_header_v20_t; 69 | 70 | struct wtcdb_index_file_header_v20 71 | { 72 | /* Signature 73 | * Consists of 4 bytes 74 | * Contains IMMM 75 | */ 76 | uint8_t signature[ 4 ]; 77 | 78 | /* Format version 79 | * Consists of 4 bytes 80 | */ 81 | uint8_t format_version[ 4 ]; 82 | 83 | /* Unknown 84 | * Consists of 4 bytes 85 | */ 86 | uint8_t unknown1[ 4 ]; 87 | 88 | /* The number of index entries used 89 | * Consists of 4 bytes 90 | */ 91 | uint8_t number_of_index_entries_used[ 4 ]; 92 | 93 | /* Total number of index entries 94 | * Consists of 4 bytes 95 | */ 96 | uint8_t number_of_index_entries[ 4 ]; 97 | 98 | /* Unknown 99 | * Consists of 4 bytes 100 | */ 101 | uint8_t unknown2[ 4 ]; 102 | }; 103 | 104 | typedef struct wtcdb_index_file_header_v30 wtcdb_index_file_header_v30_t; 105 | 106 | struct wtcdb_index_file_header_v30 107 | { 108 | /* Unknown 109 | * Consists of 4 bytes 110 | */ 111 | uint8_t unknown1[ 4 ]; 112 | 113 | /* Signature 114 | * Consists of 4 bytes 115 | * Contains IMMM 116 | */ 117 | uint8_t signature[ 4 ]; 118 | 119 | /* Format version 120 | * Consists of 4 bytes 121 | */ 122 | uint8_t format_version[ 4 ]; 123 | 124 | /* Unknown 125 | * Consists of 8 bytes 126 | */ 127 | uint8_t unknown2[ 8 ]; 128 | 129 | /* The number of index entries used 130 | * Consists of 4 bytes 131 | */ 132 | uint8_t number_of_index_entries_used[ 4 ]; 133 | 134 | /* Total number of index entries 135 | * Consists of 4 bytes 136 | */ 137 | uint8_t number_of_index_entries[ 4 ]; 138 | }; 139 | 140 | #if defined( __cplusplus ) 141 | } 142 | #endif 143 | 144 | #endif /* !defined( _WTCDB_FILE_HEADER_H ) */ 145 | 146 | -------------------------------------------------------------------------------- /libwtcdb/wtcdb_index_entry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The index entry definition of a Windows Explorer thumbnail index database file 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_INDEX_ENTRY_H ) 23 | #define _WTCDB_INDEX_ENTRY_H 24 | 25 | #include 26 | #include 27 | 28 | #if defined( __cplusplus ) 29 | extern "C" { 30 | #endif 31 | 32 | typedef struct wtcdb_index_entry_v20 wtcdb_index_entry_v20_t; 33 | 34 | struct wtcdb_index_entry_v20 35 | { 36 | /* The entry hash 37 | * Consists of 8 bytes 38 | */ 39 | uint8_t entry_hash[ 8 ]; 40 | 41 | /* Last modification date and time 42 | * Consists of 8 bytes 43 | * Contains a filetime 44 | */ 45 | uint8_t modification_time[ 8 ]; 46 | 47 | /* Flags 48 | * Consists of 4 bytes 49 | */ 50 | uint8_t flags[ 4 ]; 51 | 52 | /* Cache entry offsets 53 | * Consists of 5 x 4 bytes 54 | */ 55 | uint8_t cache_entry_offsets[ 20 ]; 56 | }; 57 | 58 | typedef struct wtcdb_index_entry_v21 wtcdb_index_entry_v21_t; 59 | 60 | struct wtcdb_index_entry_v21 61 | { 62 | /* The entry hash 63 | * Consists of 8 bytes 64 | */ 65 | uint8_t entry_hash[ 8 ]; 66 | 67 | /* Flags 68 | * Consists of 4 bytes 69 | */ 70 | uint8_t flags[ 4 ]; 71 | 72 | /* Cache entry offsets 73 | * Consists of 5 x 4 bytes 74 | */ 75 | uint8_t cache_entry_offsets[ 20 ]; 76 | }; 77 | 78 | typedef struct wtcdb_index_entry_v30 wtcdb_index_entry_v30_t; 79 | 80 | struct wtcdb_index_entry_v30 81 | { 82 | /* The entry hash 83 | * Consists of 8 bytes 84 | */ 85 | uint8_t entry_hash[ 8 ]; 86 | 87 | /* Flags 88 | * Consists of 8 bytes 89 | */ 90 | uint8_t flags[ 8 ]; 91 | 92 | /* Cache entry offsets 93 | * Consists of 9 x 4 bytes 94 | */ 95 | uint8_t cache_entry_offsets[ 36 ]; 96 | 97 | /* Unknown 98 | * Consists of 4 bytes 99 | */ 100 | uint8_t unknown1[ 4 ]; 101 | }; 102 | 103 | typedef struct wtcdb_index_entry_v31 wtcdb_index_entry_v31_t; 104 | 105 | struct wtcdb_index_entry_v31 106 | { 107 | /* The entry hash 108 | * Consists of 8 bytes 109 | */ 110 | uint8_t entry_hash[ 8 ]; 111 | 112 | /* Flags 113 | * Consists of 8 bytes 114 | */ 115 | uint8_t flags[ 8 ]; 116 | 117 | /* Cache entry offsets 118 | * Consists of 11 x 4 bytes 119 | */ 120 | uint8_t cache_entry_offsets[ 44 ]; 121 | 122 | /* Unknown 123 | * Consists of 4 bytes 124 | */ 125 | uint8_t unknown1[ 4 ]; 126 | }; 127 | 128 | typedef struct wtcdb_index_entry_v32 wtcdb_index_entry_v32_t; 129 | 130 | struct wtcdb_index_entry_v32 131 | { 132 | /* The entry hash 133 | * Consists of 8 bytes 134 | */ 135 | uint8_t entry_hash[ 8 ]; 136 | 137 | /* Flags 138 | * Consists of 8 bytes 139 | */ 140 | uint8_t flags[ 8 ]; 141 | 142 | /* Cache entry offsets 143 | * Consists of 14 x 4 bytes 144 | */ 145 | uint8_t cache_entry_offsets[ 56 ]; 146 | }; 147 | 148 | #if defined( __cplusplus ) 149 | } 150 | #endif 151 | 152 | #endif /* !defined( _WTCDB_INDEX_ENTRY_H ) */ 153 | 154 | -------------------------------------------------------------------------------- /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 | wtcdbexport.1 \ 3 | wtcdbinfo.1 \ 4 | libwtcdb.3 5 | 6 | EXTRA_DIST = \ 7 | wtcdbexport.1 \ 8 | wtcdbinfo.1 \ 9 | libwtcdb.3 10 | 11 | DISTCLEANFILES = \ 12 | Makefile \ 13 | Makefile.in 14 | 15 | -------------------------------------------------------------------------------- /manuals/wtcdbexport.1: -------------------------------------------------------------------------------- 1 | .Dd July 29, 2019 2 | .Dt wtcdbexport 3 | .Os libwtcdb 4 | .Sh NAME 5 | .Nm wtcdbexport 6 | .Nd exports items stored in a Windows Explorer thumbnail cache database (WTCDB) file 7 | .Sh SYNOPSIS 8 | .Nm wtcdbexport 9 | .Op Fl l Ar logfile 10 | .Op Fl t Ar target 11 | .Op Fl hvV 12 | .Ar source 13 | .Sh DESCRIPTION 14 | .Nm wtcdbexport 15 | is a utility to export items stored in a Windows Explorer thumbnail cache database (WTCDB) file 16 | .Pp 17 | .Nm wtcdbexport 18 | is part of the 19 | .Nm libwtcdb 20 | package. 21 | .Nm libwtcdb 22 | is a library to access the Windows Explorer thumbnail cache database (WTCDB) format 23 | .Pp 24 | .Ar source 25 | is the source file. 26 | .Pp 27 | The options are as follows: 28 | .Bl -tag -width Ds 29 | .It Fl h 30 | shows this help 31 | .It Fl l Ar logfile 32 | specify the file in which to log information about the exported items 33 | .It Fl t Ar target 34 | specify the target directory to export to (default is the source filename followed by .export) 35 | .It Fl v 36 | verbose output to stderr 37 | .It Fl V 38 | print version 39 | .El 40 | .Sh ENVIRONMENT 41 | None 42 | .Sh FILES 43 | None 44 | .Sh EXAMPLES 45 | .Bd -literal 46 | # wtcdbexport thumbcache_32.db 47 | wtcdbexport 20101023 48 | .sp 49 | Opening file. 50 | Exporting aliases. 51 | Processing alias 1 out of 1. 52 | .Dl ... 53 | Exporting alias 4 out of 4. 54 | Export completed. 55 | .sp 56 | .Ed 57 | .Sh DIAGNOSTICS 58 | Errors, verbose and debug output are printed to stderr when verbose output \-v is enabled. 59 | Verbose and debug output are only printed when enabled at compilation. 60 | .Sh BUGS 61 | Please report bugs of any kind to or on the project website: 62 | https://github.com/libyal/libwtcdb/ 63 | .Sh AUTHOR 64 | These man pages were written by Joachim Metz. 65 | .Sh COPYRIGHT 66 | Copyright (C) 2010-2024, Joachim Metz . 67 | This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 68 | .Sh SEE ALSO 69 | .Xr wtcdbinfo 1 70 | -------------------------------------------------------------------------------- /manuals/wtcdbinfo.1: -------------------------------------------------------------------------------- 1 | .Dd July 29, 2019 2 | .Dt wtcdbinfo 3 | .Os libwtcdb 4 | .Sh NAME 5 | .Nm wtcdbinfo 6 | .Nd determines information about a Windows Explorer thumbnail cache database (WTCDB) file 7 | .Sh SYNOPSIS 8 | .Nm wtcdbinfo 9 | .Op Fl ahvV 10 | .Ar source 11 | .Sh DESCRIPTION 12 | .Nm wtcdbinfo 13 | is a utility to determine information about a Windows Explorer thumbnail cache database (WTCDB) file 14 | .Pp 15 | .Nm wtcdbinfo 16 | is part of the 17 | .Nm libwtcdb 18 | package. 19 | .Nm libwtcdb 20 | is a library to access the Windows Explorer thumbnail cache database (WTCDB) 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 | # wtcdbinfo thumbcache_32.db 43 | wtcdbinfo 20100912 44 | .sp 45 | Windows Explorer thumbnail cache database 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/libwtcdb/ 55 | .Sh AUTHOR 56 | These man pages were written by Joachim Metz. 57 | .Sh COPYRIGHT 58 | Copyright (C) 2010-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 | .Xr wtcdbexport 1 62 | -------------------------------------------------------------------------------- /msvscpp/Makefile.am: -------------------------------------------------------------------------------- 1 | MSVSCPP_FILES = \ 2 | libbfio/libbfio.vcproj \ 3 | libcdata/libcdata.vcproj \ 4 | libcerror/libcerror.vcproj \ 5 | libcfile/libcfile.vcproj \ 6 | libclocale/libclocale.vcproj \ 7 | libcnotify/libcnotify.vcproj \ 8 | libcpath/libcpath.vcproj \ 9 | libcsplit/libcsplit.vcproj \ 10 | libcthreads/libcthreads.vcproj \ 11 | libfdatetime/libfdatetime.vcproj \ 12 | libuna/libuna.vcproj \ 13 | libwtcdb/libwtcdb.vcproj \ 14 | wtcdb_test_cache_entry/wtcdb_test_cache_entry.vcproj \ 15 | wtcdb_test_crc/wtcdb_test_crc.vcproj \ 16 | wtcdb_test_error/wtcdb_test_error.vcproj \ 17 | wtcdb_test_file/wtcdb_test_file.vcproj \ 18 | wtcdb_test_file_header/wtcdb_test_file_header.vcproj \ 19 | wtcdb_test_index_entry/wtcdb_test_index_entry.vcproj \ 20 | wtcdb_test_io_handle/wtcdb_test_io_handle.vcproj \ 21 | wtcdb_test_item/wtcdb_test_item.vcproj \ 22 | wtcdb_test_notify/wtcdb_test_notify.vcproj \ 23 | wtcdb_test_support/wtcdb_test_support.vcproj \ 24 | wtcdbexport/wtcdbexport.vcproj \ 25 | wtcdbinfo/wtcdbinfo.vcproj \ 26 | libwtcdb.sln 27 | 28 | EXTRA_DIST = \ 29 | $(MSVSCPP_FILES) 30 | 31 | DISTCLEANFILES = \ 32 | Makefile \ 33 | Makefile.in 34 | 35 | -------------------------------------------------------------------------------- /ossfuzz/Makefile.am: -------------------------------------------------------------------------------- 1 | if HAVE_LIB_FUZZING_ENGINE 2 | AM_CPPFLAGS = \ 3 | -I../include -I$(top_srcdir)/include \ 4 | -I../common -I$(top_srcdir)/common \ 5 | @LIBCERROR_CPPFLAGS@ \ 6 | @LIBCDATA_CPPFLAGS@ \ 7 | @LIBCLOCALE_CPPFLAGS@ \ 8 | @LIBCNOTIFY_CPPFLAGS@ \ 9 | @LIBUNA_CPPFLAGS@ \ 10 | @LIBCFILE_CPPFLAGS@ \ 11 | @LIBCPATH_CPPFLAGS@ \ 12 | @LIBBFIO_CPPFLAGS@ 13 | 14 | bin_PROGRAMS = \ 15 | file_fuzzer 16 | 17 | file_fuzzer_SOURCES = \ 18 | file_fuzzer.cc \ 19 | ossfuzz_libbfio.h \ 20 | ossfuzz_libwtcdb.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 | ../libwtcdb/libwtcdb.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 libwtcdb file type 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | /* Note that some of the OSS-Fuzz engines use C++ 26 | */ 27 | extern "C" { 28 | 29 | #include "ossfuzz_libbfio.h" 30 | #include "ossfuzz_libwtcdb.h" 31 | 32 | #if !defined( LIBWTCDB_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 | LIBWTCDB_EXTERN \ 38 | int libwtcdb_file_open_file_io_handle( 39 | libwtcdb_file_t *file, 40 | libbfio_handle_t *file_io_handle, 41 | int access_flags, 42 | libwtcdb_error_t **error ); 43 | 44 | #endif /* !defined( LIBWTCDB_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 | libwtcdb_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( libwtcdb_file_initialize( 68 | &file, 69 | NULL ) != 1 ) 70 | { 71 | goto on_error_libbfio; 72 | } 73 | if( libwtcdb_file_open_file_io_handle( 74 | file, 75 | file_io_handle, 76 | LIBWTCDB_OPEN_READ, 77 | NULL ) != 1 ) 78 | { 79 | goto on_error_libwtcdb; 80 | } 81 | libwtcdb_file_close( 82 | file, 83 | NULL ); 84 | 85 | on_error_libwtcdb: 86 | libwtcdb_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_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2010-2024, Joachim Metz 5 | * 6 | * Refer to AUTHORS for acknowledgements. 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU Lesser General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with this program. If not, see . 20 | */ 21 | 22 | #if !defined( _OSSFUZZ_LIBBFIO_H ) 23 | #define _OSSFUZZ_LIBBFIO_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBBFIO for local use of libbfio 28 | */ 29 | #if defined( HAVE_LOCAL_LIBBFIO ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #else 41 | 42 | /* If libtool DLL support is enabled set LIBBFIO_DLL_IMPORT 43 | * before including libbfio.h 44 | */ 45 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 46 | #define LIBBFIO_DLL_IMPORT 47 | #endif 48 | 49 | #include 50 | 51 | #if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( LIBBFIO_HAVE_MULTI_THREAD_SUPPORT ) 52 | #error Multi-threading support requires libbfio with multi-threading support 53 | #endif 54 | 55 | #endif /* defined( HAVE_LOCAL_LIBBFIO ) */ 56 | 57 | #endif /* !defined( _OSSFUZZ_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /ossfuzz/ossfuzz_libwtcdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libwtcdb header wrapper 3 | * 4 | * Copyright (C) 2010-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_LIBWTCDB_H ) 23 | #define _OSSFUZZ_LIBWTCDB_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _OSSFUZZ_LIBWTCDB_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /po/ChangeLog: -------------------------------------------------------------------------------- 1 | 2016-11-08 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 libfdatetime 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 | -------------------------------------------------------------------------------- /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/cache_entry.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libwtcdb/891fad59b1a19daf451277b67002ec8c1b4faf5b/tests/data/cache_entry.1 -------------------------------------------------------------------------------- /tests/data/cache_entry.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libwtcdb/891fad59b1a19daf451277b67002ec8c1b4faf5b/tests/data/cache_entry.2 -------------------------------------------------------------------------------- /tests/data/file_header.1: -------------------------------------------------------------------------------- 1 | CMMM -------------------------------------------------------------------------------- /tests/data/file_header.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libwtcdb/891fad59b1a19daf451277b67002ec8c1b4faf5b/tests/data/file_header.2 -------------------------------------------------------------------------------- /tests/data/index_entry.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libwtcdb/891fad59b1a19daf451277b67002ec8c1b4faf5b/tests/data/index_entry.1 -------------------------------------------------------------------------------- /tests/data/index_entry.2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libyal/libwtcdb/891fad59b1a19daf451277b67002ec8c1b4faf5b/tests/data/index_entry.2 -------------------------------------------------------------------------------- /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/libwtcdb 10 | cp AUTHORS COPYING COPYING.LESSER NEWS README ${PWD}/osx-pkg/usr/share/doc/libwtcdb 11 | 12 | VERSION=`sed '5!d; s/^ \[//;s/\],$//' configure.ac` 13 | pkgbuild --root osx-pkg --identifier com.github.libyal.libwtcdb --version ${VERSION} --ownership recommended ../libwtcdb-${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}/libwtcdb/.libs/libwtcdb.1.dylib && test -f ./pywtcdb/.libs/pywtcdb.so; 7 | then 8 | install_name_tool -change /usr/local/lib/libwtcdb.1.dylib ${PWD}/libwtcdb/.libs/libwtcdb.1.dylib ./pywtcdb/.libs/pywtcdb.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 libcdata libclocale libcnotify libcsplit libuna libcfile libcpath libbfio libfdatetime"; 11 | 12 | USE_HEAD=""; 13 | 14 | if test "$1" = "--use-head"; 15 | then 16 | USE_HEAD="--use-head"; 17 | fi 18 | 19 | OLDIFS=$IFS; 20 | IFS=" "; 21 | 22 | for SHARED_LIB in ${SHARED_LIBS}; 23 | do 24 | GIT_URL="${GIT_URL_PREFIX}/${SHARED_LIB}.git"; 25 | 26 | git clone --quiet ${GIT_URL} ${SHARED_LIB}-$$; 27 | 28 | if ! test -d ${SHARED_LIB}-$$; 29 | then 30 | echo "Unable to git clone: ${GIT_URL}"; 31 | 32 | IFS=$OLDIFS; 33 | 34 | exit ${EXIT_FAILURE}; 35 | fi 36 | (cd ${SHARED_LIB}-$$ && git fetch --quiet --all --tags --prune) 37 | 38 | LATEST_TAG=`cd ${SHARED_LIB}-$$ && git describe --tags --abbrev=0`; 39 | 40 | if test -n ${LATEST_TAG} && test -z ${USE_HEAD}; 41 | then 42 | echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} tag ${LATEST_TAG}"; 43 | 44 | (cd ${SHARED_LIB}-$$ && git checkout --quiet tags/${LATEST_TAG}); 45 | else 46 | echo "Synchronizing: ${SHARED_LIB} from ${GIT_URL} HEAD"; 47 | fi 48 | 49 | (cd ${SHARED_LIB}-$$ && ./synclibs.sh ${USE_HEAD} && ./autogen.sh); 50 | 51 | CONFIGURE_OPTIONS=""; 52 | 53 | (cd ${SHARED_LIB}-$$ && ./configure --help | grep -- '--enable-wide-character-type' > /dev/null); 54 | 55 | if test $? -eq 0; 56 | then 57 | CONFIGURE_OPTIONS="${CONFIGURE_OPTIONS} --enable-wide-character-type"; 58 | fi 59 | 60 | (cd ${SHARED_LIB}-$$ && ./configure --prefix=/usr ${CONFIGURE_OPTIONS} && make && sudo make install); 61 | 62 | rm -rf ${SHARED_LIB}-$$; 63 | done 64 | 65 | IFS=$OLDIFS; 66 | 67 | exit ${EXIT_SUCCESS}; 68 | 69 | -------------------------------------------------------------------------------- /tests/test_manpage.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Tests man pages. 3 | # 4 | # Version: 20240413 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | EXIT_IGNORE=77; 9 | 10 | run_test() 11 | { 12 | local INPUT_FILE=$1; 13 | local RESULT=0 14 | 15 | TEST_NAME=`basename ${INPUT_FILE}`; 16 | echo -n "Testing man with input: ${TEST_NAME}"; 17 | 18 | LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 man --warnings -E UTF-8 -l -Tutf8 -Z ${INPUT_FILE} > /dev/null 2> ${TMPDIR}/${TEST_NAME}.warnings; 19 | RESULT=$?; 20 | 21 | # For now line break warnings are ignored. 22 | if test -f ${TMPDIR}/${TEST_NAME}.warnings; 23 | then 24 | sed "/can't break line/ d" -i ${TMPDIR}/${TEST_NAME}.warnings; 25 | fi 26 | if test -s ${TMPDIR}/${TEST_NAME}.warnings; 27 | then 28 | RESULT=${EXIT_FAILURE}; 29 | fi 30 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 31 | then 32 | echo " (FAIL)"; 33 | else 34 | echo " (PASS)"; 35 | fi 36 | if test -s ${TMPDIR}/${TEST_NAME}.warnings; 37 | then 38 | cat ${TMPDIR}/${TEST_NAME}.warnings; 39 | fi 40 | return ${RESULT}; 41 | } 42 | 43 | if test "${OSTYPE}" = "msys"; 44 | then 45 | exit ${EXIT_IGNORE}; 46 | fi 47 | 48 | TEST_DIRECTORY=`dirname $0`; 49 | 50 | TEST_RUNNER="${TEST_DIRECTORY}/test_runner.sh"; 51 | 52 | if ! test -f "${TEST_RUNNER}"; 53 | then 54 | echo "Missing test runner: ${TEST_RUNNER}"; 55 | 56 | exit ${EXIT_FAILURE}; 57 | fi 58 | 59 | source ${TEST_RUNNER}; 60 | 61 | assert_availability_binary man; 62 | 63 | RESULT=${EXIT_IGNORE}; 64 | 65 | TMPDIR="tmp$$"; 66 | 67 | rm -rf ${TMPDIR}; 68 | mkdir ${TMPDIR}; 69 | 70 | MANUALS_PATH="../manuals"; 71 | 72 | if ! test -d ${MANUALS_PATH}; 73 | then 74 | MANUALS_PATH="manuals"; 75 | fi 76 | 77 | if ! test -d ${MANUALS_PATH}; 78 | then 79 | echo "Manuals directory not found."; 80 | 81 | exit ${EXIT_IGNORE}; 82 | fi 83 | 84 | for INPUT_FILE in ${MANUALS_PATH}/*.[13]; 85 | do 86 | run_test "${INPUT_FILE}"; 87 | RESULT=$?; 88 | 89 | if test ${RESULT} -ne ${EXIT_SUCCESS}; 90 | then 91 | break; 92 | fi 93 | done 94 | 95 | rm -rf ${TMPDIR}; 96 | 97 | exit ${RESULT}; 98 | 99 | -------------------------------------------------------------------------------- /tests/test_wtcdbexport.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Export tool testing script 3 | # 4 | # Version: 20240413 5 | 6 | EXIT_SUCCESS=0; 7 | EXIT_FAILURE=1; 8 | EXIT_IGNORE=77; 9 | 10 | PROFILES=("wtcdbexport"); 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="../wtcdbtools/wtcdbexport"; 22 | 23 | if ! test -x "${TEST_EXECUTABLE}"; 24 | then 25 | TEST_EXECUTABLE="../wtcdbtools/wtcdbexport.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}" "wtcdbexport" "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}" "wtcdbexport" "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 | 148 | -------------------------------------------------------------------------------- /tests/test_wtcdbinfo.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=("wtcdbinfo"); 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="../wtcdbtools/wtcdbinfo"; 22 | 23 | if ! test -x "${TEST_EXECUTABLE}"; 24 | then 25 | TEST_EXECUTABLE="../wtcdbtools/wtcdbinfo.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}" "wtcdbinfo" "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}" "wtcdbinfo" "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/wtcdb_test_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library error functions test program 3 | * 4 | * Copyright (C) 2010-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 "wtcdb_test_libwtcdb.h" 31 | #include "wtcdb_test_macros.h" 32 | #include "wtcdb_test_unused.h" 33 | 34 | /* Tests the libwtcdb_error_free function 35 | * Returns 1 if successful or 0 if not 36 | */ 37 | int wtcdb_test_error_free( 38 | void ) 39 | { 40 | /* Test invocation of function only 41 | */ 42 | libwtcdb_error_free( 43 | NULL ); 44 | 45 | return( 1 ); 46 | } 47 | 48 | /* Tests the libwtcdb_error_fprint function 49 | * Returns 1 if successful or 0 if not 50 | */ 51 | int wtcdb_test_error_fprint( 52 | void ) 53 | { 54 | /* Test invocation of function only 55 | */ 56 | libwtcdb_error_fprint( 57 | NULL, 58 | NULL ); 59 | 60 | return( 1 ); 61 | } 62 | 63 | /* Tests the libwtcdb_error_sprint function 64 | * Returns 1 if successful or 0 if not 65 | */ 66 | int wtcdb_test_error_sprint( 67 | void ) 68 | { 69 | /* Test invocation of function only 70 | */ 71 | libwtcdb_error_sprint( 72 | NULL, 73 | NULL, 74 | 0 ); 75 | 76 | return( 1 ); 77 | } 78 | 79 | /* Tests the libwtcdb_error_backtrace_fprint function 80 | * Returns 1 if successful or 0 if not 81 | */ 82 | int wtcdb_test_error_backtrace_fprint( 83 | void ) 84 | { 85 | /* Test invocation of function only 86 | */ 87 | libwtcdb_error_backtrace_fprint( 88 | NULL, 89 | NULL ); 90 | 91 | return( 1 ); 92 | } 93 | 94 | /* Tests the libwtcdb_error_backtrace_sprint function 95 | * Returns 1 if successful or 0 if not 96 | */ 97 | int wtcdb_test_error_backtrace_sprint( 98 | void ) 99 | { 100 | /* Test invocation of function only 101 | */ 102 | libwtcdb_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 WTCDB_TEST_ATTRIBUTE_UNUSED, 115 | wchar_t * const argv[] WTCDB_TEST_ATTRIBUTE_UNUSED ) 116 | #else 117 | int main( 118 | int argc WTCDB_TEST_ATTRIBUTE_UNUSED, 119 | char * const argv[] WTCDB_TEST_ATTRIBUTE_UNUSED ) 120 | #endif 121 | { 122 | WTCDB_TEST_UNREFERENCED_PARAMETER( argc ) 123 | WTCDB_TEST_UNREFERENCED_PARAMETER( argv ) 124 | 125 | WTCDB_TEST_RUN( 126 | "libwtcdb_error_free", 127 | wtcdb_test_error_free ); 128 | 129 | WTCDB_TEST_RUN( 130 | "libwtcdb_error_fprint", 131 | wtcdb_test_error_fprint ); 132 | 133 | WTCDB_TEST_RUN( 134 | "libwtcdb_error_sprint", 135 | wtcdb_test_error_sprint ); 136 | 137 | WTCDB_TEST_RUN( 138 | "libwtcdb_error_backtrace_fprint", 139 | wtcdb_test_error_backtrace_fprint ); 140 | 141 | WTCDB_TEST_RUN( 142 | "libwtcdb_error_backtrace_sprint", 143 | wtcdb_test_error_backtrace_sprint ); 144 | 145 | return( EXIT_SUCCESS ); 146 | 147 | on_error: 148 | return( EXIT_FAILURE ); 149 | } 150 | 151 | -------------------------------------------------------------------------------- /tests/wtcdb_test_functions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Functions for testing 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_FUNCTIONS_H ) 23 | #define _WTCDB_TEST_FUNCTIONS_H 24 | 25 | #include 26 | #include 27 | 28 | #include "wtcdb_test_libbfio.h" 29 | #include "wtcdb_test_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int wtcdb_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 wtcdb_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 wtcdb_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 wtcdb_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( _WTCDB_TEST_FUNCTIONS_H ) */ 66 | 67 | -------------------------------------------------------------------------------- /tests/wtcdb_test_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_GETOPT_H ) 23 | #define _WTCDB_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 wtcdb_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 wtcdb_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( _WTCDB_TEST_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /tests/wtcdb_test_item.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Library item type test program 3 | * 4 | * Copyright (C) 2010-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 "wtcdb_test_libcerror.h" 31 | #include "wtcdb_test_libwtcdb.h" 32 | #include "wtcdb_test_macros.h" 33 | #include "wtcdb_test_memory.h" 34 | #include "wtcdb_test_unused.h" 35 | 36 | #include "../libwtcdb/libwtcdb_item.h" 37 | 38 | /* Tests the libwtcdb_item_free function 39 | * Returns 1 if successful or 0 if not 40 | */ 41 | int wtcdb_test_item_free( 42 | void ) 43 | { 44 | libcerror_error_t *error = NULL; 45 | int result = 0; 46 | 47 | /* Test error cases 48 | */ 49 | result = libwtcdb_item_free( 50 | NULL, 51 | &error ); 52 | 53 | WTCDB_TEST_ASSERT_EQUAL_INT( 54 | "result", 55 | result, 56 | -1 ); 57 | 58 | WTCDB_TEST_ASSERT_IS_NOT_NULL( 59 | "error", 60 | error ); 61 | 62 | libcerror_error_free( 63 | &error ); 64 | 65 | return( 1 ); 66 | 67 | on_error: 68 | if( error != NULL ) 69 | { 70 | libcerror_error_free( 71 | &error ); 72 | } 73 | return( 0 ); 74 | } 75 | 76 | #if defined( __GNUC__ ) && !defined( LIBWTCDB_DLL_IMPORT ) 77 | 78 | #endif /* defined( __GNUC__ ) && !defined( LIBWTCDB_DLL_IMPORT ) */ 79 | 80 | /* The main program 81 | */ 82 | #if defined( HAVE_WIDE_SYSTEM_CHARACTER ) 83 | int wmain( 84 | int argc WTCDB_TEST_ATTRIBUTE_UNUSED, 85 | wchar_t * const argv[] WTCDB_TEST_ATTRIBUTE_UNUSED ) 86 | #else 87 | int main( 88 | int argc WTCDB_TEST_ATTRIBUTE_UNUSED, 89 | char * const argv[] WTCDB_TEST_ATTRIBUTE_UNUSED ) 90 | #endif 91 | { 92 | WTCDB_TEST_UNREFERENCED_PARAMETER( argc ) 93 | WTCDB_TEST_UNREFERENCED_PARAMETER( argv ) 94 | 95 | #if defined( __GNUC__ ) && !defined( LIBWTCDB_DLL_IMPORT ) 96 | 97 | /* TODO: add tests for libwtcdb_item_initialize */ 98 | 99 | #endif /* defined( __GNUC__ ) && !defined( LIBWTCDB_DLL_IMPORT ) */ 100 | 101 | WTCDB_TEST_RUN( 102 | "libwtcdb_item_free", 103 | wtcdb_test_item_free ); 104 | 105 | return( EXIT_SUCCESS ); 106 | 107 | on_error: 108 | return( EXIT_FAILURE ); 109 | } 110 | 111 | -------------------------------------------------------------------------------- /tests/wtcdb_test_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_LIBBFIO_H ) 23 | #define _WTCDB_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( _WTCDB_TEST_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /tests/wtcdb_test_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_LIBCERROR_H ) 23 | #define _WTCDB_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( _WTCDB_TEST_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/wtcdb_test_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_LIBCLOCALE_H ) 23 | #define _WTCDB_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( _WTCDB_TEST_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/wtcdb_test_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_LIBCNOTIFY_H ) 23 | #define _WTCDB_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( _WTCDB_TEST_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /tests/wtcdb_test_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_LIBUNA_H ) 23 | #define _WTCDB_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( _WTCDB_TEST_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /tests/wtcdb_test_libwtcdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libwtcdb header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_LIBWTCDB_H ) 23 | #define _WTCDB_TEST_LIBWTCDB_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _WTCDB_TEST_LIBWTCDB_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /tests/wtcdb_test_memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory allocation functions for testing 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_MEMORY_H ) 23 | #define _WTCDB_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( LIBWTCDB_DLL_IMPORT ) && !defined( __arm__ ) && !defined( __clang__ ) && !defined( __CYGWIN__ ) && !defined( __hppa__ ) && !defined( __loongarch__ ) && !defined( __mips__ ) && !defined( __riscv ) && !defined( __sparc__ ) && !defined( HAVE_ASAN ) 32 | #define HAVE_WTCDB_TEST_MEMORY 1 33 | #endif 34 | 35 | #if defined( HAVE_WTCDB_TEST_MEMORY ) 36 | 37 | extern int wtcdb_test_malloc_attempts_before_fail; 38 | 39 | extern int wtcdb_test_memcpy_attempts_before_fail; 40 | 41 | extern int wtcdb_test_memset_attempts_before_fail; 42 | 43 | extern int wtcdb_test_realloc_attempts_before_fail; 44 | 45 | #endif /* defined( HAVE_WTCDB_TEST_MEMORY ) */ 46 | 47 | #if defined( __cplusplus ) 48 | } 49 | #endif 50 | 51 | #endif /* !defined( _WTCDB_TEST_MEMORY_H ) */ 52 | 53 | -------------------------------------------------------------------------------- /tests/wtcdb_test_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2010-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( _WTCDB_TEST_UNUSED_H ) 23 | #define _WTCDB_TEST_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( WTCDB_TEST_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define WTCDB_TEST_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define WTCDB_TEST_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( WTCDB_TEST_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define WTCDB_TEST_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define WTCDB_TEST_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _WTCDB_TEST_UNUSED_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /wtcdbtools/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 | @LIBWTCDB_DLL_IMPORT@ 15 | 16 | AM_LDFLAGS = @STATIC_LDFLAGS@ 17 | 18 | bin_PROGRAMS = \ 19 | wtcdbexport \ 20 | wtcdbinfo 21 | 22 | wtcdbexport_SOURCES = \ 23 | export_handle.c export_handle.h \ 24 | log_handle.c log_handle.h \ 25 | wtcdbexport.c \ 26 | wtcdbtools_getopt.c wtcdbtools_getopt.h \ 27 | wtcdbtools_i18n.h \ 28 | wtcdbtools_libbfio.h \ 29 | wtcdbtools_libcerror.h \ 30 | wtcdbtools_libcfile.h \ 31 | wtcdbtools_libclocale.h \ 32 | wtcdbtools_libcnotify.h \ 33 | wtcdbtools_libcpath.h \ 34 | wtcdbtools_libfdatetime.h \ 35 | wtcdbtools_libuna.h \ 36 | wtcdbtools_libwtcdb.h \ 37 | wtcdbtools_output.c wtcdbtools_output.h \ 38 | wtcdbtools_signal.c wtcdbtools_signal.h \ 39 | wtcdbtools_unused.h 40 | 41 | wtcdbexport_LDADD = \ 42 | @LIBCFILE_LIBADD@ \ 43 | @LIBCPATH_LIBADD@ \ 44 | @LIBUNA_LIBADD@ \ 45 | @LIBCSPLIT_LIBADD@ \ 46 | @LIBCNOTIFY_LIBADD@ \ 47 | @LIBCLOCALE_LIBADD@ \ 48 | ../libwtcdb/libwtcdb.la \ 49 | @LIBCERROR_LIBADD@ \ 50 | @LIBINTL@ 51 | 52 | wtcdbinfo_SOURCES = \ 53 | info_handle.c info_handle.h \ 54 | wtcdbinfo.c \ 55 | wtcdbinput.c wtcdbinput.h \ 56 | wtcdbtools_getopt.c wtcdbtools_getopt.h \ 57 | wtcdbtools_i18n.h \ 58 | wtcdbtools_libbfio.h \ 59 | wtcdbtools_libcerror.h \ 60 | wtcdbtools_libcfile.h \ 61 | wtcdbtools_libclocale.h \ 62 | wtcdbtools_libcnotify.h \ 63 | wtcdbtools_libcpath.h \ 64 | wtcdbtools_libfdatetime.h \ 65 | wtcdbtools_libuna.h \ 66 | wtcdbtools_libwtcdb.h \ 67 | wtcdbtools_output.c wtcdbtools_output.h \ 68 | wtcdbtools_signal.c wtcdbtools_signal.h \ 69 | wtcdbtools_unused.h 70 | 71 | wtcdbinfo_LDADD = \ 72 | @LIBFDATETIME_LIBADD@ \ 73 | @LIBCNOTIFY_LIBADD@ \ 74 | @LIBCLOCALE_LIBADD@ \ 75 | ../libwtcdb/libwtcdb.la \ 76 | @LIBCERROR_LIBADD@ \ 77 | @LIBINTL@ 78 | 79 | DISTCLEANFILES = \ 80 | Makefile \ 81 | Makefile.in 82 | 83 | splint-local: 84 | @echo "Running splint on wtcdbexport ..." 85 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(wtcdbexport_SOURCES) 86 | @echo "Running splint on wtcdbinfo ..." 87 | -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(wtcdbinfo_SOURCES) 88 | 89 | -------------------------------------------------------------------------------- /wtcdbtools/export_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Export handle 3 | * 4 | * Copyright (C) 2010-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( _EXPORT_HANDLE_H ) 23 | #define _EXPORT_HANDLE_H 24 | 25 | #include 26 | #include 27 | 28 | #include "log_handle.h" 29 | #include "wtcdbtools_libcerror.h" 30 | #include "wtcdbtools_libwtcdb.h" 31 | 32 | #if defined( __cplusplus ) 33 | extern "C" { 34 | #endif 35 | 36 | typedef struct export_handle export_handle_t; 37 | 38 | struct export_handle 39 | { 40 | /* The libwtcdb input file 41 | */ 42 | libwtcdb_file_t *input_file; 43 | 44 | /* The target path 45 | */ 46 | system_character_t *target_path; 47 | 48 | /* The target path size 49 | */ 50 | size_t target_path_size; 51 | 52 | /* The items export path 53 | */ 54 | system_character_t *items_export_path; 55 | 56 | /* The items export path size 57 | */ 58 | size_t items_export_path_size; 59 | 60 | /* The notification output stream 61 | */ 62 | FILE *notify_stream; 63 | 64 | /* Value to indicate if abort was signalled 65 | */ 66 | int abort; 67 | }; 68 | 69 | int export_handle_initialize( 70 | export_handle_t **export_handle, 71 | libcerror_error_t **error ); 72 | 73 | int export_handle_free( 74 | export_handle_t **export_handle, 75 | libcerror_error_t **error ); 76 | 77 | int export_handle_signal_abort( 78 | export_handle_t *export_handle, 79 | libcerror_error_t **error ); 80 | 81 | int export_handle_set_target_path( 82 | export_handle_t *export_handle, 83 | const system_character_t *target_path, 84 | libcerror_error_t **error ); 85 | 86 | int export_handle_set_export_path( 87 | export_handle_t *export_handle, 88 | const system_character_t *base_path, 89 | size_t base_path_length, 90 | const system_character_t *suffix, 91 | size_t suffix_length, 92 | system_character_t **export_path, 93 | size_t *export_path_size, 94 | libcerror_error_t **error ); 95 | 96 | int export_handle_create_items_export_path( 97 | export_handle_t *export_handle, 98 | libcerror_error_t **error ); 99 | 100 | int export_handle_open( 101 | export_handle_t *export_handle, 102 | const system_character_t *filename, 103 | libcerror_error_t **error ); 104 | 105 | int export_handle_close( 106 | export_handle_t *export_handle, 107 | libcerror_error_t **error ); 108 | 109 | int export_handle_export_file( 110 | export_handle_t *export_handle, 111 | log_handle_t *log_handle, 112 | libcerror_error_t **error ); 113 | 114 | #if defined( __cplusplus ) 115 | } 116 | #endif 117 | 118 | #endif /* !defined( _EXPORT_HANDLE_H ) */ 119 | 120 | -------------------------------------------------------------------------------- /wtcdbtools/info_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Info handle 3 | * 4 | * Copyright (C) 2010-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 "wtcdbtools_libcerror.h" 30 | #include "wtcdbtools_libwtcdb.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 libwtcdb input file 41 | */ 42 | libwtcdb_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 | int info_handle_initialize( 58 | info_handle_t **info_handle, 59 | libcerror_error_t **error ); 60 | 61 | int info_handle_free( 62 | info_handle_t **info_handle, 63 | libcerror_error_t **error ); 64 | 65 | int info_handle_signal_abort( 66 | info_handle_t *info_handle, 67 | libcerror_error_t **error ); 68 | 69 | int info_handle_set_ascii_codepage( 70 | info_handle_t *info_handle, 71 | const system_character_t *string, 72 | libcerror_error_t **error ); 73 | 74 | int info_handle_open_input( 75 | info_handle_t *info_handle, 76 | const system_character_t *filename, 77 | libcerror_error_t **error ); 78 | 79 | int info_handle_close_input( 80 | info_handle_t *info_handle, 81 | libcerror_error_t **error ); 82 | 83 | int info_handle_filetime_value_fprint( 84 | info_handle_t *info_handle, 85 | const char *value_name, 86 | uint64_t value_64bit, 87 | libcerror_error_t **error ); 88 | 89 | int info_handle_file_fprint( 90 | info_handle_t *info_handle, 91 | libcerror_error_t **error ); 92 | 93 | #if defined( __cplusplus ) 94 | } 95 | #endif 96 | 97 | #endif /* !defined( _INFO_HANDLE_H ) */ 98 | 99 | -------------------------------------------------------------------------------- /wtcdbtools/log_handle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Log handle 3 | * 4 | * Copyright (C) 2010-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( _LOG_HANDLE_H ) 23 | #define _LOG_HANDLE_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "wtcdbtools_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | typedef struct log_handle log_handle_t; 36 | 37 | struct log_handle 38 | { 39 | /* The log stream 40 | */ 41 | FILE *log_stream; 42 | }; 43 | 44 | int log_handle_initialize( 45 | log_handle_t **log_handle, 46 | libcerror_error_t **error ); 47 | 48 | int log_handle_free( 49 | log_handle_t **log_handle, 50 | libcerror_error_t **error ); 51 | 52 | int log_handle_open( 53 | log_handle_t *log_handle, 54 | const system_character_t *filename, 55 | libcerror_error_t **error ); 56 | 57 | int log_handle_close( 58 | log_handle_t *log_handle, 59 | libcerror_error_t **error ); 60 | 61 | void log_handle_printf( 62 | log_handle_t *log_handle, 63 | char *format, 64 | ... ); 65 | 66 | #if defined( __cplusplus ) 67 | } 68 | #endif 69 | 70 | #endif /* !defined( _LOG_HANDLE_H ) */ 71 | 72 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbinput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common input functions for the wtcdbtools 3 | * 4 | * Copyright (C) 2010-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( _WTCDBINPUT_H ) 23 | #define _WTCDBINPUT_H 24 | 25 | #include 26 | #include 27 | 28 | #include "wtcdbtools_libcerror.h" 29 | 30 | #if defined( __cplusplus ) 31 | extern "C" { 32 | #endif 33 | 34 | int wtcdbinput_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( _WTCDBINPUT_H ) */ 44 | 45 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_getopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * GetOpt functions 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_GETOPT_H ) 23 | #define _WTCDBTOOLS_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 wtcdbtools_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 wtcdbtools_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( _WTCDBTOOLS_GETOPT_H ) */ 68 | 69 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_i18n.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Internationalization (i18n) functions 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_I18N_H ) 23 | #define _WTCDBTOOLS_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( _WTCDBTOOLS_I18N_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libbfio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libbfio header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBBFIO_H ) 23 | #define _WTCDBTOOLS_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( _WTCDBTOOLS_LIBBFIO_H ) */ 58 | 59 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libcerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcerror header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBCERROR_H ) 23 | #define _WTCDBTOOLS_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( _WTCDBTOOLS_LIBCERROR_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libcfile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcfile header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBCFILE_H ) 23 | #define _WTCDBTOOLS_LIBCFILE_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCFILE for local use of libcfile 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCFILE ) 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #else 37 | 38 | /* If libtool DLL support is enabled set LIBCFILE_DLL_IMPORT 39 | * before including libcfile.h 40 | */ 41 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 42 | #define LIBCFILE_DLL_IMPORT 43 | #endif 44 | 45 | #include 46 | 47 | #endif /* defined( HAVE_LOCAL_LIBCFILE ) */ 48 | 49 | #endif /* !defined( _WTCDBTOOLS_LIBCFILE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libclocale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libclocale header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBCLOCALE_H ) 23 | #define _WTCDBTOOLS_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( _WTCDBTOOLS_LIBCLOCALE_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libcnotify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcnotify header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBCNOTIFY_H ) 23 | #define _WTCDBTOOLS_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( _WTCDBTOOLS_LIBCNOTIFY_H ) */ 50 | 51 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libcpath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libcpath header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBCPATH_H ) 23 | #define _WTCDBTOOLS_LIBCPATH_H 24 | 25 | #include 26 | 27 | /* Define HAVE_LOCAL_LIBCPATH for local use of libcpath 28 | */ 29 | #if defined( HAVE_LOCAL_LIBCPATH ) 30 | 31 | #include 32 | #include 33 | 34 | #else 35 | 36 | /* If libtool DLL support is enabled set LIBCPATH_DLL_IMPORT 37 | * before including libcpath.h 38 | */ 39 | #if defined( _WIN32 ) && defined( DLL_IMPORT ) && !defined( HAVE_STATIC_EXECUTABLES ) 40 | #define LIBCPATH_DLL_IMPORT 41 | #endif 42 | 43 | #include 44 | 45 | #endif /* defined( HAVE_LOCAL_LIBCPATH ) */ 46 | 47 | #endif /* !defined( _WTCDBTOOLS_LIBCPATH_H ) */ 48 | 49 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libfdatetime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libfdatetime header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBFDATETIME_H ) 23 | #define _WTCDBTOOLS_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( _WTCDBTOOLS_LIBFDATETIME_H ) */ 56 | 57 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libuna.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libuna header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBUNA_H ) 23 | #define _WTCDBTOOLS_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( _WTCDBTOOLS_LIBUNA_H ) */ 60 | 61 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_libwtcdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The libwtcdb header wrapper 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_LIBWTCDB_H ) 23 | #define _WTCDBTOOLS_LIBWTCDB_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | #endif /* !defined( _WTCDBTOOLS_LIBWTCDB_H ) */ 30 | 31 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_output.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Common output functions for the wtcdbtools 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_OUTPUT_H ) 23 | #define _WTCDBTOOLS_OUTPUT_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "wtcdbtools_libcerror.h" 30 | 31 | #if defined( __cplusplus ) 32 | extern "C" { 33 | #endif 34 | 35 | int wtcdbtools_output_initialize( 36 | int stdio_mode, 37 | libcerror_error_t **error ); 38 | 39 | void wtcdbtools_output_copyright_fprint( 40 | FILE *stream ); 41 | 42 | void wtcdbtools_output_version_fprint( 43 | FILE *stream, 44 | const char *program ); 45 | 46 | void wtcdbtools_output_version_detailed_fprint( 47 | FILE *stream, 48 | const char *program ); 49 | 50 | #if defined( __cplusplus ) 51 | } 52 | #endif 53 | 54 | #endif /* !defined( _WTCDBTOOLS_OUTPUT_H ) */ 55 | 56 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_signal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Signal handling functions 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_SIGNAL_H ) 23 | #define _WTCDBTOOLS_SIGNAL_H 24 | 25 | #include 26 | #include 27 | 28 | #include "wtcdbtools_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 wtcdbtools_signal_t; 40 | 41 | #else 42 | typedef int wtcdbtools_signal_t; 43 | 44 | #endif /* defined( WINAPI ) */ 45 | 46 | #if defined( WINAPI ) 47 | 48 | BOOL WINAPI wtcdbtools_signal_handler( 49 | wtcdbtools_signal_t signal ); 50 | 51 | #if defined( _MSC_VER ) 52 | 53 | void wtcdbtools_signal_initialize_memory_debug( 54 | void ); 55 | 56 | #endif /* defined( _MSC_VER ) */ 57 | 58 | #endif /* defined( WINAPI ) */ 59 | 60 | int wtcdbtools_signal_attach( 61 | void (*signal_handler)( wtcdbtools_signal_t ), 62 | libcerror_error_t **error ); 63 | 64 | int wtcdbtools_signal_detach( 65 | libcerror_error_t **error ); 66 | 67 | #if defined( __cplusplus ) 68 | } 69 | #endif 70 | 71 | #endif /* !defined( _WTCDBTOOLS_SIGNAL_H ) */ 72 | 73 | -------------------------------------------------------------------------------- /wtcdbtools/wtcdbtools_unused.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions to silence compiler warnings about unused function attributes/parameters. 3 | * 4 | * Copyright (C) 2010-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( _WTCDBTOOLS_UNUSED_H ) 23 | #define _WTCDBTOOLS_UNUSED_H 24 | 25 | #include 26 | 27 | #if !defined( WTCDBTOOLS_ATTRIBUTE_UNUSED ) 28 | 29 | #if defined( __GNUC__ ) && __GNUC__ >= 3 30 | #define WTCDBTOOLS_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 31 | 32 | #else 33 | #define WTCDBTOOLS_ATTRIBUTE_UNUSED 34 | 35 | #endif /* defined( __GNUC__ ) && __GNUC__ >= 3 */ 36 | 37 | #endif /* !defined( WTCDBTOOLS_ATTRIBUTE_UNUSED ) */ 38 | 39 | #if defined( _MSC_VER ) 40 | #define WTCDBTOOLS_UNREFERENCED_PARAMETER( parameter ) \ 41 | UNREFERENCED_PARAMETER( parameter ); 42 | 43 | #else 44 | #define WTCDBTOOLS_UNREFERENCED_PARAMETER( parameter ) \ 45 | /* parameter */ 46 | 47 | #endif /* defined( _MSC_VER ) */ 48 | 49 | #endif /* !defined( _WTCDBTOOLS_UNUSED_H ) */ 50 | 51 | --------------------------------------------------------------------------------