Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/ntfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2022-01-22Add a test that checks reading the "empty-file" and its zero length.Colin Finck
2022-01-18Length of NtfsAttribute can be 0Louis
2022-01-14Fix docs for now.0.1.0Colin Finck
2022-01-14Apply suggestions from clippy.Colin Finck
2022-01-13Fix some typos.Colin Finck
2021-12-15Relicense everything as MIT OR Apache-2.0 to enable a broader usage.Colin Finck
2021-12-15Remove empty `security_descriptor.rs`Colin Finck
2021-12-15Add the missing documentation and some final polishing.Colin Finck
2021-12-08Fix calculation in `NtfsAttribute::non_resident_value_data_and_position`Colin Finck
The attribute length is relative to the attribute start, not to the data runs start! This 64 byte difference previously caused a panic when data run information filled the entire File Record, and `end` was outside the File Record boundaries.
2021-12-05Fix `NtfsAttributeListNonResidentAttributeValue::len`.Colin Finck
It previously returned the length reported by the current data run. This is correct for the first data run, but breaks when the reader moved to a subsequent one. Which is why we now save the length passed to us at creation time.
2021-10-17Implement `NtfsAttributes::attach` and its helper struct.Colin Finck
2021-10-05Fix a corner case in `NtfsIndexEntries::next` after more testing.Colin Finck
For `following_entries` to work, its length must always be one less than `inner_iterators` length. This broke when I started filtering out the last entry without any information. Now `following_entries` is always incremented together with `inner_iterators`. `None` is used to indicate a last entry without any information. Minimum example where this broke: * Top-level node (0) has a subnode (1) and is not the last entry (= inserts an entry into `following_entries`). * Subnode (1) has a subnode (2) and is the last entry. * Subnode (2) has no subnode and is the last entry. When subnode (2) finished iterating, its iterator is dropped and the iterator of subnode (1) becomes the last one. The next item in `following_entries` must now be `None` to loop one more time. Now we notice that subnode (1) has also been fully iterated, drop its iterator, and let the iterator of top-level node (0) become the last iterator. The entry in `following_entries` is now picked up, associated to the correct iterator (0), and returned.
2021-10-05Add more size and range checks with proper error handling.Colin Finck
This crate must never panic on invalid input data!
2021-10-03`NtfsValue` -> `NtfsAttributeValue` and `Slice` -> `Resident`.Colin Finck
Turns out that we won't use this enum for anything else than attribute values, and `Slice` always corresponds to a resident attribute value, so reflect that in the naming. Index keys still use slices without this enum.
2021-10-03Make `NtfsFile::name` useful by matching on namespace and parent.Colin Finck
An NTFS file often has more than one FileName attribute and the caller is likely interested in a specific one. ntfs-shell is changed accordingly to prefer the long filenames.
2021-10-03Refactor structured values to work on any type of `NtfsValue`.Colin Finck
This makes `NtfsFile::directory_index` and `NtfsFile::name` work even if the attributes they are looking for are part of an Attribute List. We keep a fast path for the few attribute types that are always resident.
2021-10-03Refactor `NtfsAttributeValue` into `NtfsValue` and add ↵Colin Finck
`NtfsAttributeListNonResidentAttributeValue`. This enables us to read a data value spread over multiple data runs of multiple connected attributes just like a single contiguous value. A caller can read an attribute value the same way, no matter if it's internally stored as a resident attribute, non-resident attribute, or non-resident attribute within an AttributeList.
2021-09-17Implement the `AttributeList` structured value.Colin Finck
This one can be resident or non-resident, hence this commit also adds some related support code.
2021-09-17Add some more convenience functions and fix comments.Colin Finck
2021-09-17Remove an `Option` around the return value of `NtfsAttribute::name`.Colin Finck
There is no difference between an empty attribute name and no attribute name at all.
2021-09-17Fix `Ntfs::file` to support files outside the first MFT data run.Colin Finck
This change has notable negative performance implications, as the $MFT record is now read and fixed up on every file lookup. This needs to be fixed later via caching.
2021-09-16Save code and get better formatters via `derive_more` and `strum_macros`Colin Finck
2021-08-25Add IS_DIRECTORY to NtfsFileAttributeFlags.Colin Finck
This enables to decide whether a $FILE_NAME Index Entry is a regular file or a directory without loading the FILE Record and looking up the $STANDARD_INFORMATION attribute for that entry first.
2021-08-25Validate signatures before record fixup to catch invalid positions earlyColin Finck
2021-08-19Standardize on "File Record Number" to denote the n-th FILE Record.Colin Finck
2021-08-19Don't revisit a last entry with subnode in `NtfsIndexEntries`Colin Finck
Add a test that would have caught this.
2021-08-09Add tests for the index functions.Colin Finck
2021-08-09Add a few convenience functions to simplify working with the crate.Colin Finck
2021-08-09Skip the empty "last entry" in the `NtfsIndexEntries` iterator.Colin Finck
Testing shows that there are NTFS filesystems that have a last index entry *without* a subnode (i.e. with no useful information at all).
2021-08-09Fix splitting `NtfsFileReference` into record and sequence numbers.Colin Finck
2021-08-09Fix position calculation in `IndexNodeEntryRanges::next`.Colin Finck
2021-08-07`ntfs_file` -> `file` for consistencyColin Finck
2021-08-07Use `ArrayVec` over heap-allocated `Vec` for some structured values.Colin Finck
This greatly reduces the number of heap allocations when traversing an index.
2021-08-02Implement finding files by name in a file name index.Colin Finck
This introduces parsing the $UpCase file to perform case-insensitive searches.
2021-07-28Remove `Result` for `NtfsIndexEntries::new`, which never fails.Colin Finck
2021-07-28Make index type system depend on `core::fmt::Debug` to ease debuggingColin Finck
2021-07-28Fix `PartialOrd` implementations for comparing `NtfsString` and `str`Colin Finck
You can't just compare `other` with `self` when the ordering is important.
2021-07-26Minor improvements.Colin Finck
2021-07-26Introduce typed indexes to support more than just file name indexes.Colin Finck
Index entry keys do not necessarily correspond to the structured values. In fact, file name indexes are the exception and not the rule. All other index types have dedicated key structures. Likewise, some index types (e.g. SDH and SII) also have extra data structures instead of a file reference. Finally, some other index types (like R over Reparse points) only have a key structure, but neither data nor a file reference.
2021-07-26NtfsStructuredValueFromData -> NtfsStructuredValueFromSliceColin Finck
This prevents naming collisions with NTFS fields called "data".
2021-07-26Implement `NtfsFileReference` to replace an opaque u64.Colin Finck
2021-07-21Remove "Ntfs" prefix from `NtfsError` members, make it non-exhaustive.Colin Finck
2021-07-21Improve error reporting of `NtfsIndexRecord::validate_sizes`Colin Finck
2021-07-21Implement Update Sequence Array parsing and record fixups.Colin Finck
This is where things get dirty. As NTFS requires us to fix up records, we can't continue our previous design of avoiding dynamic allocations and reading everything on demand via `io::Read`. Instead, we now read an entire record (usually not larger than 4 KiB), fix it up, and store it in a `Vec`. This required changes almost everywhere. It should be noted that many non-resident attributes are not part of a record, which is why structured values are now implemented differently depending on the attribute type. On the plus side, many structures need less borrowing now, which makes them more comfortable to use. I have also added missing sanity checks with precise errors where appropriate.
2021-06-29Upgrade dependencies and fix `displaydoc` error messages.Colin Finck
2021-06-23Add `NtfsIndex` and `NtfsIndexEntries` to traverse an index in-order.Colin Finck
This introduces a hard dependency on alloc for a core feature. It is required as long as we don't know the B-tree depth in advance, and need to maintain a stack with elements per layer during traversal.
2021-06-22`NtfsIndexEntries` -> `NtfsIndexNodeEntries`Colin Finck
We reuse the former name for something else in the next commit.
2021-06-05Prefer `i64::try_from` over manual range checksColin Finck
2021-06-05Implement `NtfsIndexAllocation::record_from_vcn` to aid index traversalsColin Finck
2021-06-05Add `Lcn`, `Vcn` to simplify cluster calculations and make them typesafeColin Finck