Classes | |
| struct | I30Entry |
Public Member Functions | |
| NtfsRecoveryImpl (DiskReader &reader) | |
| bool | recover (uint64_t volume_offset, const std::string &output_dir, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs, std::string &error) |
Private Member Functions | |
| bool | read_boot_sector (uint64_t volume_offset, std::string &error) |
| uint64_t | cluster_to_offset (uint64_t cluster) const |
| bool | read_raw_record (uint64_t record_number, std::vector< unsigned char > &out, std::string &error) |
| bool | apply_fixup (std::vector< unsigned char > &record, std::string &error) |
| bool | read_mft_record (uint64_t record_number, std::vector< unsigned char > &out, std::string &error) |
| bool | read_mft_record_from_mirror (uint64_t record_number, std::vector< unsigned char > &out, std::string &error) |
| std::vector< NtfsDataRun > | parse_runlist (const unsigned char *runlist, size_t max_len, uint64_t start_vcn, bool &has_sparse, bool &malformed) |
| NtfsDataStream & | stream_for (NtfsFileRecordInfo &info, const std::string &name) |
| bool | parse_attribute_list_entries (const unsigned char *value, uint32_t value_len, std::vector< NtfsAttributeListEntry > &out) |
| bool | read_runs_to_buffer (const std::vector< NtfsDataRun > &runs, uint64_t expected_size, std::vector< unsigned char > &out, std::string &error) |
| bool | decode_compressed_stream (const NtfsDataStream &stream, std::vector< unsigned char > &out, std::string &error) |
| bool | process_attributes (uint64_t base_record_number, const std::vector< unsigned char > &record, NtfsFileRecordInfo &info, std::vector< NtfsAttributeListEntry > &attr_list, std::string &error) |
| bool | load_attribute_list_extensions (uint64_t base_record_number, NtfsFileRecordInfo &info, const std::vector< NtfsAttributeListEntry > &attr_list, std::string &error) |
| bool | parse_file_record (uint64_t record_number, const std::vector< unsigned char > &record, NtfsFileRecordInfo &info, std::string &error) |
| void | parse_index_entries (const unsigned char *entries_data, size_t total_size, std::vector< I30Entry > &out) |
| bool | read_indx_block (const std::vector< NtfsDataRun > &runs, uint64_t vcn, uint32_t irs, std::vector< unsigned char > &out, std::string &error) |
| void | walk_i30 (const NtfsFileRecordInfo &dir_info, std::vector< I30Entry > &out_entries, std::vector< std::string > &logs) |
| fs::path | build_relative_path (uint64_t record_number, const std::map< uint64_t, NtfsFileRecordInfo > &records) |
| bool | stream_exportable (const NtfsDataStream &stream) const |
| fs::path | output_path_for_stream (const fs::path &base, const std::string &stream_name) |
| fs::path | unique_path (const fs::path &candidate) |
| void | export_reparse_sidecar (const NtfsFileRecordInfo &info, const fs::path &base_path, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs) |
| void | export_usn_summary_if_needed (const NtfsFileRecordInfo &info, const fs::path &base_path, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs) |
| bool | read_stream_data (const NtfsDataStream &stream, std::vector< unsigned char > &data, std::string &error) |
| void | write_usn_reason_flags (std::ostream &out, uint32_t reason) |
| bool | export_stream (const NtfsDataStream &stream, const fs::path &out_path, std::string &error) |
| void | scan_logfile (const fs::path &out_root, const std::map< uint64_t, NtfsFileRecordInfo > &live_records, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs) |
Static Private Member Functions | |
| static void | merge_runs (std::vector< NtfsDataRun > &dst, const std::vector< NtfsDataRun > &src) |
Private Attributes | |
| DiskReader & | reader_ |
| NtfsVolumeInfo | volume_ |
| std::vector< std::pair< uint64_t, uint64_t > > | mft_ranges_ |
| std::vector< std::pair< uint64_t, uint64_t > > | mftmirr_ranges_ |
Static Private Attributes | |
| static constexpr uint32_t | kLogPageMagicRSTR = 0x52545352u |
| static constexpr uint32_t | kLogPageMagicRCRD = 0x44524352u |
| static constexpr uint16_t | kRedoOpInitFileRecord = 0x0010 |
Definition at line 201 of file ntfs_recovery.cpp.
|
inlineexplicit |
|
inlineprivate |
Definition at line 533 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::le16(), and trs().
Referenced by read_indx_block(), read_mft_record(), read_mft_record_from_mirror(), and scan_logfile().
|
inlineprivate |
Definition at line 1259 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::sanitize_component().
Referenced by recover().
|
inlineprivate |
Definition at line 492 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::cluster_size, volume_, and anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::volume_offset.
Referenced by parse_runlist(), and read_raw_record().
|
inlineprivate |
Definition at line 790 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::cluster_size, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::compression_unit_shift, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::data_size, anonymous_namespace{ntfs_recovery.cpp}::lznt1_decompress(), read_runs_to_buffer(), anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::runs, trs(), and volume_.
Referenced by export_stream(), and read_stream_data().
|
inlineprivate |
Definition at line 1320 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::decode_utf16le_ascii(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::has_reparse_point, anonymous_namespace{ntfs_recovery.cpp}::le16(), anonymous_namespace{ntfs_recovery.cpp}::le32(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::reparse_data, trs(), and unique_path().
Referenced by recover().
|
inlineprivate |
Definition at line 1508 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::compressed, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::data_size, decode_compressed_stream(), read_runs_to_buffer(), anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::resident, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::resident_data, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::runs, and trs().
Referenced by recover(), and scan_logfile().
|
inlineprivate |
Definition at line 1436 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::name, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::streams, trs(), and unique_path().
Referenced by recover().
|
inlineprivate |
Definition at line 1017 of file ntfs_recovery.cpp.
References process_attributes(), and read_mft_record().
Referenced by parse_file_record().
|
inlinestaticprivate |
Definition at line 702 of file ntfs_recovery.cpp.
Referenced by process_attributes().
|
inlineprivate |
Definition at line 1301 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::sanitize_component(), and unique_path().
Referenced by recover().
|
inlineprivate |
Definition at line 729 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsAttributeListEntry::base_reference, anonymous_namespace{ntfs_recovery.cpp}::decode_utf16le_ascii(), anonymous_namespace{ntfs_recovery.cpp}::NtfsAttributeListEntry::instance, anonymous_namespace{ntfs_recovery.cpp}::le16(), anonymous_namespace{ntfs_recovery.cpp}::le32(), anonymous_namespace{ntfs_recovery.cpp}::le64(), anonymous_namespace{ntfs_recovery.cpp}::NtfsAttributeListEntry::name, anonymous_namespace{ntfs_recovery.cpp}::NtfsAttributeListEntry::name_length, anonymous_namespace{ntfs_recovery.cpp}::NtfsAttributeListEntry::name_offset, anonymous_namespace{ntfs_recovery.cpp}::NtfsAttributeListEntry::record_length, anonymous_namespace{ntfs_recovery.cpp}::NtfsAttributeListEntry::start_vcn, and anonymous_namespace{ntfs_recovery.cpp}::NtfsAttributeListEntry::type.
Referenced by process_attributes().
|
inlineprivate |
Definition at line 1039 of file ntfs_recovery.cpp.
References load_attribute_list_extensions(), process_attributes(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::streams, and trs().
Referenced by recover(), and scan_logfile().
|
inlineprivate |
Definition at line 1095 of file ntfs_recovery.cpp.
References NtfsRecoveryImpl::I30Entry::child_record_number, NtfsRecoveryImpl::I30Entry::child_sequence_number, anonymous_namespace{ntfs_recovery.cpp}::decode_utf16le_ascii(), NtfsRecoveryImpl::I30Entry::filename, anonymous_namespace{ntfs_recovery.cpp}::le16(), anonymous_namespace{ntfs_recovery.cpp}::le32(), anonymous_namespace{ntfs_recovery.cpp}::le64(), and NtfsRecoveryImpl::I30Entry::name_namespace.
Referenced by walk_i30().
|
inlineprivate |
Definition at line 641 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::cluster_size, cluster_to_offset(), and volume_.
Referenced by process_attributes().
|
inlineprivate |
Definition at line 846 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::alloc_size, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::attr_flags, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::compressed, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::compression_unit_shift, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::data_size, anonymous_namespace{ntfs_recovery.cpp}::decode_utf16le_ascii(), anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::encrypted, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::has_attribute_list, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::has_reparse_point, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::in_use, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::index_allocation_runs, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::index_record_size, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::index_root_data, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::is_directory, anonymous_namespace{ntfs_recovery.cpp}::le16(), anonymous_namespace{ntfs_recovery.cpp}::le32(), anonymous_namespace{ntfs_recovery.cpp}::le64(), merge_runs(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::name, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::own_sequence_number, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::parent_record_number, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::parent_sequence_number, parse_attribute_list_entries(), parse_runlist(), read_runs_to_buffer(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::reparse_data, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::resident, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::resident_data, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::runs, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::sparse, stream_for(), trs(), and anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::unsupported_layout.
Referenced by load_attribute_list_extensions(), and parse_file_record().
|
inlineprivate |
Definition at line 453 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::bytes_per_sector, anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::cluster_size, anonymous_namespace{ntfs_recovery.cpp}::le16(), anonymous_namespace{ntfs_recovery.cpp}::le64(), anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::mft_lcn, anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::mft_record_size, anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::mftmirr_lcn, DiskReader::read_at(), reader_, anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::sectors_per_cluster, anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::total_sectors, trs(), volume_, and anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::volume_offset.
Referenced by recover().
|
inlineprivate |
Definition at line 1144 of file ntfs_recovery.cpp.
References apply_fixup(), DiskReader::read_at(), and reader_.
Referenced by walk_i30().
|
inlineprivate |
Definition at line 567 of file ntfs_recovery.cpp.
References apply_fixup(), read_mft_record_from_mirror(), read_raw_record(), and trs().
Referenced by load_attribute_list_extensions(), recover(), and scan_logfile().
|
inlineprivate |
Definition at line 589 of file ntfs_recovery.cpp.
References _, apply_fixup(), anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::mft_record_size, mftmirr_ranges_, DiskReader::read_at(), reader_, trs(), and volume_.
Referenced by read_mft_record().
|
inlineprivate |
Definition at line 496 of file ntfs_recovery.cpp.
References cluster_to_offset(), anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::mft_lcn, mft_ranges_, anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::mft_record_size, DiskReader::read_at(), reader_, trs(), and volume_.
Referenced by read_mft_record().
|
inlineprivate |
Definition at line 757 of file ntfs_recovery.cpp.
References DiskReader::read_at(), reader_, and trs().
Referenced by decode_compressed_stream(), export_stream(), process_attributes(), read_stream_data(), and scan_logfile().
|
inlineprivate |
Definition at line 1457 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::compressed, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::data_size, decode_compressed_stream(), read_runs_to_buffer(), anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::resident, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::resident_data, and anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::runs.
|
inline |
Definition at line 205 of file ntfs_recovery.cpp.
References _, build_relative_path(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::deleted_candidate, export_reparse_sidecar(), export_stream(), export_usn_summary_if_needed(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::in_use, mft_ranges_, anonymous_namespace{ntfs_recovery.cpp}::NtfsVolumeInfo::mft_record_size, mftmirr_ranges_, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::name, output_path_for_stream(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::own_sequence_number, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::parent_record_number, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::parent_sequence_number, parse_file_record(), read_boot_sector(), read_mft_record(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::record_number, anonymous_namespace{ntfs_recovery.cpp}::sanitize_component(), scan_logfile(), stream_exportable(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::streams, trs(), volume_, and walk_i30().
Referenced by NtfsRecovery::recover().
|
inlineprivate |
Definition at line 1566 of file ntfs_recovery.cpp.
References apply_fixup(), anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::data_size, export_stream(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::is_directory, kLogPageMagicRCRD, kRedoOpInitFileRecord, anonymous_namespace{ntfs_recovery.cpp}::le16(), anonymous_namespace{ntfs_recovery.cpp}::le32(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::name, parse_file_record(), read_mft_record(), read_runs_to_buffer(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::record_number, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::runs, anonymous_namespace{ntfs_recovery.cpp}::sanitize_component(), stream_exportable(), anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::streams, and trs().
Referenced by recover().
|
inlineprivate |
Definition at line 1297 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::data_size, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::encrypted, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::resident, anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::runs, and anonymous_namespace{ntfs_recovery.cpp}::NtfsDataStream::unsupported_layout.
Referenced by recover(), and scan_logfile().
|
inlineprivate |
Definition at line 695 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::streams.
Referenced by process_attributes().
|
inlineprivate |
Definition at line 1309 of file ntfs_recovery.cpp.
Referenced by export_reparse_sidecar(), export_usn_summary_if_needed(), and output_path_for_stream().
|
inlineprivate |
Definition at line 1186 of file ntfs_recovery.cpp.
References anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::index_allocation_runs, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::index_record_size, anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::index_root_data, anonymous_namespace{ntfs_recovery.cpp}::le32(), parse_index_entries(), read_indx_block(), and anonymous_namespace{ntfs_recovery.cpp}::NtfsFileRecordInfo::record_number.
Referenced by recover().
|
inlineprivate |
Definition at line 1471 of file ntfs_recovery.cpp.
|
staticconstexprprivate |
Definition at line 1563 of file ntfs_recovery.cpp.
Referenced by scan_logfile().
|
staticconstexprprivate |
Definition at line 1562 of file ntfs_recovery.cpp.
|
staticconstexprprivate |
Definition at line 1564 of file ntfs_recovery.cpp.
Referenced by scan_logfile().
|
private |
Definition at line 446 of file ntfs_recovery.cpp.
Referenced by read_raw_record(), and recover().
|
private |
Definition at line 451 of file ntfs_recovery.cpp.
Referenced by read_mft_record_from_mirror(), and recover().
|
private |
Definition at line 444 of file ntfs_recovery.cpp.
Referenced by NtfsRecoveryImpl(), read_boot_sector(), read_indx_block(), read_mft_record_from_mirror(), read_raw_record(), and read_runs_to_buffer().
|
private |
Definition at line 445 of file ntfs_recovery.cpp.
Referenced by cluster_to_offset(), decode_compressed_stream(), parse_runlist(), read_boot_sector(), read_mft_record_from_mirror(), read_raw_record(), and recover().