📄 layout.h
字号:
* Upgrade attribute to NTFS 3.0 format. * else * Use NTFS 1.2- format for access. * } else * Use NTFS 3.0 format for access. * Only problem is that it might be legal to set the length of the value to * arbitrarily large values thus spoiling this check. - But chkdsk probably * views that as a corruption, assuming that it behaves like this for all * attributes. */ /* 36*/ u32 maximum_versions; /* Maximum allowed versions for file. Zero if version numbering is disabled. */ /* 40*/ u32 version_number; /* This file's version (if any). Set to zero if maximum_versions is zero. */ /* 44*/ u32 class_id; /* Class id from bidirectional class id index (?). */ /* 48*/ u32 owner_id; /* Owner_id of the user owning the file. Translate via $Q index in FILE_Extend /$Quota to the quota control entry for the user owning the file. Zero if quotas are disabled. */ /* 52*/ u32 security_id; /* Security_id for the file. Translate via $SII index and $SDS data stream in FILE_Secure to the security descriptor. */ /* 56*/ u64 quota_charged; /* Byte size of the charge to the quota for all streams of the file. Note: Is zero if quotas are disabled. */ /* 64*/ u64 usn; /* Last update sequence number of the file. This is a direct index into the change (aka usn) journal file. It is zero if the usn journal is disabled. NOTE: To disable the journal need to delete the journal file itself and to then walk the whole mft and set all Usn entries in all mft records to zero! (This can take a while!) The journal is FILE_Extend/$UsnJrnl. Win2k will recreate the journal and initiate logging if necessary when mounting the partition. This, in contrast to disabling the journal is a very fast process, so the user won't even notice it. */ /* 72*/ void *v3_end[0]; /* Marker for offsetof(). */ } __attribute__((__packed__)); } __attribute__((__packed__));/* sizeof() = 72 bytes (NTFS 3.0) */} __attribute__((__packed__)) STANDARD_INFORMATION;/** * struct ATTR_LIST_ENTRY - Attribute: Attribute list (0x20). * * - Can be either resident or non-resident. * - Value consists of a sequence of variable length, 8-byte aligned, * ATTR_LIST_ENTRY records. * - The attribute list attribute contains one entry for each attribute of * the file in which the list is located, except for the list attribute * itself. The list is sorted: first by attribute type, second by attribute * name (if present), third by instance number. The extents of one * non-resident attribute (if present) immediately follow after the initial * extent. They are ordered by lowest_vcn and have their instance set to zero. * It is not allowed to have two attributes with all sorting keys equal. * - Further restrictions: * - If not resident, the vcn to lcn mapping array has to fit inside the * base mft record. * - The attribute list attribute value has a maximum size of 256kb. This * is imposed by the Windows cache manager. * - Attribute lists are only used when the attributes of mft record do not * fit inside the mft record despite all attributes (that can be made * non-resident) having been made non-resident. This can happen e.g. when: * - File has a large number of hard links (lots of file name * attributes present). * - The mapping pairs array of some non-resident attribute becomes so * large due to fragmentation that it overflows the mft record. * - The security descriptor is very complex (not applicable to * NTFS 3.0 volumes). * - There are many named streams. */typedef struct {/*Ofs*//* 0*/ ATTR_TYPES type; /* Type of referenced attribute. *//* 4*/ u16 length; /* Byte size of this entry. *//* 6*/ u8 name_length; /* Size in Unicode chars of the name of the attribute or 0 if unnamed. *//* 7*/ u8 name_offset; /* Byte offset to beginning of attribute name (always set this to where the name would start even if unnamed). *//* 8*/ VCN lowest_vcn; /* Lowest virtual cluster number of this portion of the attribute value. This is usually 0. It is non-zero for the case where one attribute does not fit into one mft record and thus several mft records are allocated to hold this attribute. In the latter case, each mft record holds one extent of the attribute and there is one attribute list entry for each extent. NOTE: This is DEFINITELY a signed value! The windows driver uses cmp, followed by jg when comparing this, thus it treats it as signed. *//* 16*/ MFT_REF mft_reference; /* The reference of the mft record holding the ATTR_RECORD for this portion of the attribute value. *//* 24*/ u16 instance; /* If lowest_vcn = 0, the instance of the attribute being referenced; otherwise 0. *//* 26*/ ntfschar name[0]; /* Use when creating only. When reading use name_offset to determine the location of the name. *//* sizeof() = 26 + (attribute_name_length * 2) bytes */} __attribute__((__packed__)) ATTR_LIST_ENTRY;/* * The maximum allowed length for a file name. */#define NTFS_MAX_NAME_LEN 255/** * enum FILE_NAME_TYPE_FLAGS - Possible namespaces for filenames in ntfs. * (8-bit). */typedef enum { FILE_NAME_POSIX = 0x00, /* This is the largest namespace. It is case sensitive and allows all Unicode characters except for: '\0' and '/'. Beware that in WinNT/2k files which eg have the same name except for their case will not be distinguished by the standard utilities and thus a "del filename" will delete both "filename" and "fileName" without warning. */ FILE_NAME_WIN32 = 0x01, /* The standard WinNT/2k NTFS long filenames. Case insensitive. All Unicode chars except: '\0', '"', '*', '/', ':', '<', '>', '?', '\' and '|'. Further, names cannot end with a '.' or a space. */ FILE_NAME_DOS = 0x02, /* The standard DOS filenames (8.3 format). Uppercase only. All 8-bit characters greater space, except: '"', '*', '+', ',', '/', ':', ';', '<', '=', '>', '?' and '\'. */ FILE_NAME_WIN32_AND_DOS = 0x03, /* 3 means that both the Win32 and the DOS filenames are identical and hence have been saved in this single filename record. */} __attribute__((__packed__)) FILE_NAME_TYPE_FLAGS;/** * struct FILE_NAME_ATTR - Attribute: Filename (0x30). * * NOTE: Always resident. * NOTE: All fields, except the parent_directory, are only updated when the * filename is changed. Until then, they just become out of sync with * reality and the more up to date values are present in the standard * information attribute. * NOTE: There is conflicting information about the meaning of each of the time * fields but the meaning as defined below has been verified to be * correct by practical experimentation on Windows NT4 SP6a and is hence * assumed to be the one and only correct interpretation. */typedef struct {/*hex ofs*//* 0*/ MFT_REF parent_directory; /* Directory this filename is referenced from. *//* 8*/ s64 creation_time; /* Time file was created. *//* 10*/ s64 last_data_change_time; /* Time the data attribute was last modified. *//* 18*/ s64 last_mft_change_time; /* Time this mft record was last modified. *//* 20*/ s64 last_access_time; /* Last time this mft record was accessed. *//* 28*/ s64 allocated_size; /* Byte size of on-disk allocated space for the data attribute. So for normal $DATA, this is the allocated_size from the unnamed $DATA attribute and for compressed and/or sparse $DATA, this is the compressed_size from the unnamed $DATA attribute. NOTE: This is a multiple of the cluster size. *//* 30*/ s64 data_size; /* Byte size of actual data in data attribute. *//* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. *//* 3c*/ union { /* 3c*/ struct { /* 3c*/ u16 packed_ea_size; /* Size of the buffer needed to pack the extended attributes (EAs), if such are present.*/ /* 3e*/ u16 reserved; /* Reserved for alignment. */ } __attribute__((__packed__)); /* 3c*/ u32 reparse_point_tag; /* Type of reparse point, present only in reparse points and only if there are no EAs. */ } __attribute__((__packed__));/* 40*/ u8 file_name_length; /* Length of file name in (Unicode) characters. *//* 41*/ FILE_NAME_TYPE_FLAGS file_name_type; /* Namespace of the file name.*//* 42*/ ntfschar file_name[0]; /* File name in Unicode. */} __attribute__((__packed__)) FILE_NAME_ATTR;/** * struct GUID - GUID structures store globally unique identifiers (GUID). * * A GUID is a 128-bit value consisting of one group of eight hexadecimal * digits, followed by three groups of four hexadecimal digits each, followed * by one group of twelve hexadecimal digits. GUIDs are Microsoft's * implementation of the distributed computing environment (DCE) universally * unique identifier (UUID). * * Example of a GUID: * 1F010768-5A73-BC91-0010-A52216A7227B */typedef struct { u32 data1; /* The first eight hexadecimal digits of the GUID. */ u16 data2; /* The first group of four hexadecimal digits. */ u16 data3; /* The second group of four hexadecimal digits. */ u8 data4[8]; /* The first two bytes are the third group of four hexadecimal digits. The remaining six bytes are the final 12 hexadecimal digits. */} __attribute__((__packed__)) GUID;/** * struct OBJ_ID_INDEX_DATA - FILE_Extend/$ObjId contains an index named $O. * * This index contains all object_ids present on the volume as the index keys * and the corresponding mft_record numbers as the index entry data parts. * * The data part (defined below) also contains three other object_ids: * birth_volume_id - object_id of FILE_Volume on which the file was first * created. Optional (i.e. can be zero). * birth_object_id - object_id of file when it was first created. Usually * equals the object_id. Optional (i.e. can be zero). * domain_id - Reserved (always zero). */typedef struct { MFT_REF mft_reference; /* Mft record containing the object_id in the index entry key. */ union { struct { GUID birth_volume_id; GUID birth_object_id; GUID domain_id; } __attribute__((__packed__)); u8 extended_info[48]; } __attribute__((__packed__));} __attribute__((__packed__)) OBJ_ID_INDEX_DATA;/** * struct OBJECT_ID_ATTR - Attribute: Object id (NTFS 3.0+) (0x40). * * NOTE: Always resident. */typedef struct { GUID object_id; /* Unique id assigned to the file.*/ /* The following fields are optional. The attribute value size is 16 bytes, i.e. sizeof(GUID), if these are not present at all. Note, the entries can be present but one or more (or all) can be zero meaning that that particular value(s) is(are) not defined. Note, when the fields are missing here, it is well possible that they are to be found within the $Extend/$ObjId system file indexed under the above object_id. */ union { struct { GUID birth_volume_id; /* Unique id of volume on which the file was first created.*/ GUID birth_object_id; /* Unique id of file when it was first created. */ GUID domain_id; /* Reserved, zero. */ } __attribute__((__packed__)); u8 extended_info[48]; } __attribute__((__packed__));} __attribute__((__packed__)) OBJECT_ID_ATTR;#if 0/** * enum IDENTIFIER_AUTHORITIES - * * The pre-defined IDENTIFIER_AUTHORITIES used as SID_IDENTIFIER_AUTHORITY in * the SID structure (see below). */typedef enum { /* SID string prefix. */ SECURITY_NULL_SID_AUTHORITY = {0, 0, 0, 0, 0, 0}, /* S-1-0 */ SECURITY_WORLD_SID_AUTHORITY = {0, 0, 0, 0, 0, 1}, /* S-1-1 */ SECURITY_LOCAL_SID_AUTHORITY = {0, 0, 0, 0, 0, 2}, /* S-1-2 */ SECURITY_CREATOR_SID_AUTHORITY = {0, 0, 0, 0, 0, 3}, /* S-1-3 */ SECURITY_NON_UNIQUE_AUTHORITY = {0, 0, 0, 0, 0, 4}, /* S-1-4 */ SECURITY_NT_SID_AUTHORITY = {0, 0, 0, 0, 0, 5}, /* S-1-5 */} IDENTIFIER_AUTHORITIES;#endif/** * enum RELATIVE_IDENTIFIERS - * * These relative identifiers (RIDs) are used with the above identifier * authorities to make up universal well-known SIDs. * * Note: The relative identifier (RID) refers to the portion of a SID, which * identifies a user or group in relation to the authority that issued the SID. * For example, the universal well-known SID Creator Owner ID (S-1-3-0) is * made up of the identifier authority SECURITY_CREATOR_SID_AUTHORITY (3) and * the relative identifier SECURITY_CREATOR_OWNER_RID (0). */typedef enum { /* Identifier authority. */ SECURITY_NULL_RID = 0, /* S-1-0 */ SECURITY_WORLD_RID = 0, /* S-1-1 */ SECURITY_LOCAL_RID = 0, /* S-1-2 */ SECURITY_CREATOR_OWNER_RID = 0, /* S-1-3 */ SECURITY_CREATOR_GROUP_RID = 1, /* S-1-3 */ SECURITY_CREATOR_OWNER_SERVER_RID = 2, /* S-1-3 */ SECURITY_CREATOR_GROUP_SERVER_RID = 3, /* S-1-3 */ SECURITY_DIALUP_RID = 1, SECURITY_NETWORK_RID = 2, SECURITY_BATCH_RID = 3, SECURITY_INTERACTIVE_RID = 4, SECURITY_SERVICE_RID = 6, SECURITY_ANONYMOUS_LOGON_RID = 7, SECURITY_PROXY_RID = 8,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -