Expand description
A low-level NTFS filesystem library implemented in Rust.
NTFS is the primary filesystem in all versions of Windows (since Windows NT 3.1 in 1993). This crate is geared towards the NTFS 3.x versions used in Windows 2000 up to the current Windows 11. However, the basics are expected to be compatible to even earlier versions.
The crate is no_std
-compatible and therefore usable from firmware level code up to user-mode applications.
§Getting started
- Create an
Ntfs
structure from a reader by callingNtfs::new
. - Retrieve the
NtfsFile
of the root directory viaNtfs::root_directory
. - Dig into its attributes via
NtfsFile::attributes
, go even deeper viaNtfsFile::attributes_raw
or use one of the convenience functions, likeNtfsFile::directory_index
,NtfsFile::info
orNtfsFile::name
.
§Example
The following example dumps the names of all files and folders in the root directory of a given NTFS filesystem.
The list is directly taken from the NTFS index, hence it’s sorted in ascending order with respect to NTFS’s understanding of case-insensitive string comparison.
let mut ntfs = Ntfs::new(&mut fs).unwrap();
let root_dir = ntfs.root_directory(&mut fs).unwrap();
let index = root_dir.directory_index(&mut fs).unwrap();
let mut iter = index.entries();
while let Some(entry) = iter.next(&mut fs) {
let entry = entry.unwrap();
let file_name = entry.key().unwrap();
println!("{}", file_name.name());
}
Check out the docs, the tests, and the supplied ntfs-shell
application for more examples on how to use the ntfs
library.
Modules§
- attribute_
value - Readers for attribute value types.
- indexes
- Various types of NTFS indexes and traits to work with them.
- structured_
values - Various types of NTFS Attribute structured values.
- types
- Supplementary helper types.
Structs§
- Ntfs
- Root structure describing an NTFS filesystem.
- Ntfs
Attribute - A single NTFS Attribute of an
NtfsFile
. - Ntfs
Attribute Flags - Flags returned by
NtfsAttribute::flags
. - Ntfs
Attribute Item - Item returned by the
NtfsAttributes
iterator. - Ntfs
Attributes - Iterator over
all attributes of an
NtfsFile
, returning anNtfsAttributeItem
for each entry. - Ntfs
Attributes Attached - Iterator over
all attributes of an
NtfsFile
, returning anNtfsAttributeItem
for each entry, implementingIterator
andFusedIterator
. - Ntfs
Attributes Raw - Iterator over
all top-level attributes of an
NtfsFile
, returning anNtfsAttribute
for each entry, implementingIterator
andFusedIterator
. - Ntfs
File - A single NTFS File Record.
- Ntfs
File Flags - Flags returned by
NtfsFile::flags
. - Ntfs
File Reference - Absolute reference to a File Record on the filesystem, composed out of a File Record Number and a Sequence Number.
- Ntfs
Guid - A Globally Unique Identifier (GUID), used for Object IDs in NTFS.
- Ntfs
Index - Helper structure to iterate over all entries of an index or find a specific one.
- Ntfs
Index Entries - Iterator over
all index entries of an index,
sorted ascending by the index key,
returning an
NtfsIndexEntry
for each entry. - Ntfs
Index Entry - A single entry of an NTFS index.
- Ntfs
Index Entry Flags - Flags returned by
NtfsIndexEntry::flags
. - Ntfs
Index Finder - Helper structure to efficiently find an entry in an index, created by
NtfsIndex::finder
. - Ntfs
Index Node Entries - Iterator over
all index entries of a single index node,
sorted ascending by the index key,
returning an
NtfsIndexEntry
for each entry. - Ntfs
Index Record - A single NTFS Index Record.
- Ntfs
Time - An NTFS timestamp, used for expressing file times.
Enums§
- Known
Ntfs File Record Number - A list of standardized NTFS File Record Numbers.
- Ntfs
Attribute Type - All known NTFS Attribute types.
- Ntfs
Error - Central error type of ntfs.
Traits§
- Ntfs
Read Seek - Trait to read/seek in a source by the help of a temporarily passed mutable reference to the filesystem reader.
- Upcase
Ord - Trait for a case-insensitive ordering with respect to the $UpCase table read from the filesystem.
Type Aliases§
- Result
- Central result type of ntfs.