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

mod.rs « structured_values « src - github.com/windirstat/ntfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f9bbc8a7419629519056fec4b80b1f49af0bfab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2021 Colin Finck <colin@reactos.org>
// SPDX-License-Identifier: GPL-2.0-or-later

mod attribute_list;
mod file_name;
mod index_allocation;
mod index_root;
mod object_id;
mod security_descriptor;
mod standard_information;
mod volume_information;
mod volume_name;

pub use attribute_list::*;
pub use file_name::*;
pub use index_allocation::*;
pub use index_root::*;
pub use object_id::*;
pub use security_descriptor::*;
pub use standard_information::*;
pub use volume_information::*;
pub use volume_name::*;

use crate::attribute::NtfsAttributeType;
use crate::attribute_value::NtfsNonResidentAttributeValue;
use crate::error::Result;
use binread::io::{Read, Seek};
use bitflags::bitflags;

bitflags! {
    pub struct NtfsFileAttributeFlags: u32 {
        const READ_ONLY = 0x0001;
        const HIDDEN = 0x0002;
        const SYSTEM = 0x0004;
        const ARCHIVE = 0x0020;
        const DEVICE = 0x0040;
        const NORMAL = 0x0080;
        const TEMPORARY = 0x0100;
        const SPARSE_FILE = 0x0200;
        const REPARSE_POINT = 0x0400;
        const COMPRESSED = 0x0800;
        const OFFLINE = 0x1000;
        const NOT_CONTENT_INDEXED = 0x2000;
        const ENCRYPTED = 0x4000;
    }
}

pub trait NtfsStructuredValue: Sized {
    const TY: NtfsAttributeType;
}

/// Create a structured value from an arbitrary data slice.
/// This handles Resident Attributes of File Records AND Keys of Index Records (when an attribute is indexed).
pub trait NtfsStructuredValueFromSlice<'s>: NtfsStructuredValue {
    fn from_slice(slice: &'s [u8], position: u64) -> Result<Self>;
}

/// Create a structured value from a Non-Resident Attribute Value.
pub trait NtfsStructuredValueFromNonResidentAttributeValue<'n, 'f>: NtfsStructuredValue {
    fn from_non_resident_attribute_value<T>(
        fs: &mut T,
        value: NtfsNonResidentAttributeValue<'n, 'f>,
    ) -> Result<Self>
    where
        T: Read + Seek;
}