1. Overview
The scanner_engine.cpp file coordinates partition parsing, lost-partition discovery, filesystem probes, signature scans and health checks.
This is an implementation file. It contains executable logic for the subsystem, including parsing, I/O, validation, recovery flow, or graphical behavior declared by the corresponding interface.
Its paired source or interface file is scanner_engine.hpp.
Primary responsibilities:
- Open the selected source
- Collect source and health metadata
- Parse known partitions
- Search for lost filesystems
- Detect encrypted volumes and file signatures
- Build a unified scan report
2. File Identity and Scope
- Source path:
src/scanner_engine.cpp - Language: C++
- File role: implementation file
- Physical lines: 204
- Non-empty lines: 167
- SHA-256:
a89a7738581d97d87e4bc11826c3880c48b647b4e9bb749bf8a204ba5d957c3d
The declarations in this file use the global namespace.
3. Dependencies
3.1 Project Headers
scanner_engine.hppdisk_reader.hppi18n.hpppartition_parser.hppsignature_scanner.hpplost_partition_finder.hppntfs_probe.hppfilesystem_probes.hppdevice_health_probe.hpp
These dependencies define the file’s compile-time integration with the recovery engine, GTK interface, on-disk format decoders, operating-system services, or C++ standard library.
4. Declared Types
No class, structure, or enumeration definition is declared directly in this file.
5. Constants and Configuration Values
No preprocessor or compile-time constants were detected as top-level declarations in this file.
5.1 Operational Strings, Paths, Formats, or Commands
The following code literals are operationally relevant and may identify filesystem paths, helper commands, formats, signatures, or subsystem labels:
ntfs_probe.hppValidating NTFS metadataScan cancelled during NTFS probe.Validating ext4, Btrfs, FAT32, exFAT
6. Data Members and Persistent State
No class data members are declared directly in this file, or the file primarily implements methods declared elsewhere.
7. API and Function Inventory
The following callable interfaces or definitions were detected:
void emit_progress(const ScannerEngine::ProgressCallback&cb,const std::string&stage,const std::string&detail,uint64_t processed,uint64_t total,double fraction)– Implements the operation identified by this API and updates or returns the associated state.bool check_cancel(const std::function<bool()>&cancel_cb)– Implements the operation identified by this API and updates or returns the associated state.ScanReport ScannerEngine::run_scan(const std::string&input_path,ProgressCallback progress_cb,std::function<bool()> cancel_cb)– Implements the operation identified by this API and updates or returns the associated state.
8. Operational Flow
The subsystem represented by this file normally participates in the following flow:
- Open the selected source.
- Collect source and health metadata.
- Parse known partitions.
- Search for lost filesystems.
- Detect encrypted volumes and file signatures.
- Build a unified scan report.
- Expose or execute the detected APIs:
emit_progress, check_cancel, run_scan. - Return explicit results, progress data, recovered records, or diagnostics to the calling layer.
9. Validation and Error Handling
- Errors are propagated through Boolean results, error strings, logs, exceptions, or status records depending on the API.
- Byte offsets, sizes and lengths must be validated before arithmetic and before every read to avoid overflow and out-of-bounds access.
- On-disk structures are accepted only after validating signatures, magic values and structural constraints.
- Input and output paths require existence checks, permission handling and safe destination construction.
10. Runtime, Concurrency, and Resource Management
- Deterministic behavior: callers depend on explicit return values and stable data structures to distinguish successful recovery from partial or invalid results.
11. Security and Data-Recovery Considerations
- Recovery code should prefer read-only source access and avoid writing to the original damaged medium.
- Raw devices and image files are treated as untrusted binary input; every offset and length must remain bounded by the source size.
12. Implementation Considerations
- The implementation should remain aligned with declarations in the paired header and preserve documented return-value semantics.
- Large-device arithmetic uses 64-bit values; additions and multiplications should be checked before use as offsets or allocation sizes.
13. Integration with the Recovery Pipeline
- The file belongs to the orchestration layer between the UI and low-level parsers.
- It aggregates progress, results and diagnostics from multiple modules.
- It should preserve cancellation and completion semantics across thread boundaries.
14. Licensing and Provenance
No explicit copyright or software-license statement was detected in the opening section of this individual file. Distribution terms should therefore be verified against the project-level license and repository metadata.
The SHA-256 value in this document can be used to associate the generated documentation with the exact source version analyzed.
