Windows x64 native source build, Free File Recovery 8.1.0

The actual build used the existing MSYS2 UCRT64 GCC 16.2.0 (Rev6), make 4.4.1,
binutils, libiconv 1.19-1 and zlib 1.3.2-2. No global software was installed.
Upstream TestDisk 7.2's release archive includes configure/Makefile.in, so no
autoconf, automake, Qt or curses installation is needed. C compilation uses gnu11
because GCC16's newer default rejects some old upstream C constructs.

Official source archives and exact hashes:
  vendor/testdisk-7.2.tar.bz2
  F8343BE20CB4001C5D91A2E3BCD918398F00AE6D8310894A5A9F2FEB813C283F
  https://www.cgsecurity.org/testdisk-7.2.tar.bz2
  Verified against official https://www.cgsecurity.org/testdisk_sha256.txt

  deps/ntfsprogs-2.0.0.tar.gz (original linux-ntfs_2.0.0.orig.tar.gz)
  143F7380D3627B92CEA6F0929D22FC2C28B6BDD09A0E428CF638AE5C5B7C31F0
  https://old-releases.ubuntu.com/ubuntu/pool/universe/l/linux-ntfs/linux-ntfs_2.0.0.orig.tar.gz
  libntfs sources unchanged; added ffr-mingw-compat.h, force-included by compiler
  for POSIX metadata constants and major/minor macros on MinGW. Configured with
  --disable-default-device-io-ops --disable-crypto --disable-shared --enable-static.
  No ntfs repair program or default device backend is used in the shipped engine.

Source ZIP structure should preserve testdisk-7.2/, deps/ntfsprogs-2.0.0/, the
compatibility header, build scripts, patches/, vendor/, redistribution-sources/
and Licenses/. Exclude generated .o/.a/.exe, conftest, QA fixtures and build caches
from the source archive if desired; they can be regenerated.

To rebuild already-modified sources from a matching existing MSYS2 UCRT64 shell:
  export FFR_PYTHON='/c/path/to/windows/python.exe'
  bash build_from_source.sh
This performs no package installation, make install, device probing or scanning.
FFR_TOOLCHAIN_BIN can point build_bridge.py at another compatible UCRT64 bin path.
Only bin/ffr-engine.exe is the native runtime payload. zlib and iconv/libcharset are
explicitly linked from the toolchain's genuine static .a libraries, not .dll.a
import libraries; neither dependency DLL is copied. A baseline upstream photorec.exe
is generated solely for its object set;
do not run or distribute that binary or testdisk.exe with the preview application.

For a pristine upstream source tree, first:
  python apply_engine_patches.py PATH_TO_EXTRACTED_TESTDISK_7_2
The overlay verifies original or already-patched SHA256 before replacing files;
unknown local changes are refused. The unified diff is provided for human review.
New files: src/ffr_main.c, ffr_bridge.h, ffr-engine.manifest and ffr-engine.rc.
Upstream changes: photorec.c finalized-file event; psearchn.c/phbs.c cancellation;
phrecn.c propagate real output status; ntfs_udl.c read-only original-name adapter,
per-record cancellation and bitmap error handling. Original notices are retained.

The final link excludes upstream phmain.o and icon_ph.o. It uses wmain and its own
asInvoker/version resource, avoiding upstream highestAvailable elevation prompts.
The final link explicitly passes libntfs.a, libz.a, libiconv.a, libcharset.a,
-static-libgcc, -lbcrypt and NX/ASLR flags. It does not use ambiguous -lz/-liconv
selection. Before replacing the live build artifact, objdump checks its PE import
table and the build refuses any non-system DLL dependency. A verified candidate
then replaces bin/ffr-engine.exe atomically. Known old adjacent zlib/iconv DLL copies
are removed only when their bytes exactly match the pinned toolchain copies.
bin/Engine-Link-Manifest.json records the final imports and every static input SHA.

License/source delivery still includes the exact MSYS2 libiconv/libcharset and zlib
source packages and their license notices. Preserve all engine sources and the
scripts needed to rebuild/relink with a modified LGPL library; static linkage does
not remove LGPL source/relink requirements. The runtime is a single native EXE,
while the source/build distribution intentionally contains all these inputs.

The tested incremental build log is build-bridge.log. The complete scripted clean
rebuild recipe is supplied but has not been separately rerun after final freeze.
Authenticode signing changes the final EXE hash; the manifest here records the
unsigned native engine before the parent release's signing and packaging stage.

QA scripts are separate from production. test-readonly-backend.py builds a
dedicated host by including the exact C backend and links normal objects; no QA
entry point or bypass is compiled into bin/ffr-engine.exe. That test creates only
its own image under backend-qa, never a physical disk handle.
