📄 layout.h
字号:
/* 64*/ leUSN usn; /* Last update sequence number of the file. This is a direct index into the transaction log file ($UsnJrnl). It is zero if the usn journal is disabled or this file has not been subject to logging yet. See usnjrnl.h for details. */ } __attribute__ ((__packed__)) v3; /* sizeof() = 72 bytes (NTFS 3.x) */ } __attribute__ ((__packed__)) ver;} __attribute__ ((__packed__)) STANDARD_INFORMATION;/* * 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 list is not terminated by anything at all! The only way to know when * the end is reached is to keep track of the current offset and compare it to * the attribute value size. * - 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 instace 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_TYPE type; /* Type of referenced attribute. *//* 4*/ le16 length; /* Byte size of this entry (8-byte aligned). *//* 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*/ leVCN 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*/ leMFT_REF mft_reference;/* The reference of the mft record holding the ATTR_RECORD for this portion of the attribute value. *//* 24*/ le16 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 MAXIMUM_FILE_NAME_LENGTH 255/* * Possible namespaces for filenames in ntfs (8-bit). */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/2003 by default 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. However if for example Services For Unix (SFU) are installed and the case sensitive option was enabled at installation time, then you can create/access/delete such files. Note that even SFU places restrictions on the filenames beyond the '\0' and '/' and in particular the following set of characters is not allowed: '"', '/', '<', '>', '\'. All other characters, including the ones no allowed in WIN32 namespace are allowed. Tested with SFU 3.5 (this is now free) running on Windows XP. */ 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__));typedef u8 FILE_NAME_TYPE_FLAGS;/* * 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*/ leMFT_REF parent_directory; /* Directory this filename is referenced from. *//* 8*/ sle64 creation_time; /* Time file was created. *//* 10*/ sle64 last_data_change_time; /* Time the data attribute was last modified. *//* 18*/ sle64 last_mft_change_time; /* Time this mft record was last modified. *//* 20*/ sle64 last_access_time; /* Time this mft record was last accessed. *//* 28*/ sle64 allocated_size; /* Byte size of on-disk allocated space for the unnamed 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. For a directory or other inode without an unnamed $DATA attribute, this is always 0. NOTE: This is a multiple of the cluster size. *//* 30*/ sle64 data_size; /* Byte size of actual data in unnamed data attribute. For a directory or other inode without an unnamed $DATA attribute, this is always 0. *//* 38*/ FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. *//* 3c*/ union { /* 3c*/ struct { /* 3c*/ le16 packed_ea_size; /* Size of the buffer needed to pack the extended attributes (EAs), if such are present.*/ /* 3e*/ le16 reserved; /* Reserved for alignment. */ } __attribute__ ((__packed__)) ea; /* 3c*/ struct { /* 3c*/ le32 reparse_point_tag; /* Type of reparse point, present only in reparse points and only if there are no EAs. */ } __attribute__ ((__packed__)) rp; } __attribute__ ((__packed__)) type;/* 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;/* * 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-0010A52216A7 */typedef struct { le32 data1; /* The first eight hexadecimal digits of the GUID. */ le16 data2; /* The first group of four hexadecimal digits. */ le16 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;/* * 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 { leMFT_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__)) origin; u8 extended_info[48]; } __attribute__ ((__packed__)) opt;} __attribute__ ((__packed__)) OBJ_ID_INDEX_DATA;/* * 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. */ 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__)) origin; u8 extended_info[48]; } __attribute__ ((__packed__)) opt;} __attribute__ ((__packed__)) OBJECT_ID_ATTR;/* * 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;/* * 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, SECURITY_ENTERPRISE_CONTROLLERS_RID=9, SECURITY_SERVER_LOGON_RID = 9, SECURITY_PRINCIPAL_SELF_RID = 0xa, SECURITY_AUTHENTICATED_USER_RID = 0xb, SECURITY_RESTRICTED_CODE_RID = 0xc, SECURITY_TERMINAL_SERVER_RID = 0xd, SECURITY_LOGON_IDS_RID = 5, SECURITY_LOGON_IDS_RID_COUNT = 3, SECURITY_LOCAL_SYSTEM_RID = 0x12, SECURITY_NT_NON_UNIQUE = 0x15, SECURITY_BUILTIN_DOMAIN_RID = 0x20, /* * Well-known domain relative sub-authority values (RIDs). */ /* Users. */ DOMAIN_USER_RID_ADMIN = 0x1f4, DOMAIN_USER_RID_GUEST = 0x1f5, DOMAIN_USER_RID_KRBTGT = 0x1f6, /* Groups. */ DOMAIN_GROUP_RID_ADMINS = 0x200, DOMAIN_GROUP_RID_USERS = 0x201, DOMAIN_GROUP_RID_GUESTS = 0x202, DOMAIN_GROUP_RID_COMPUTERS = 0x203, DOMAIN_GROUP_RID_CONTROLLERS = 0x204, DOMAIN_GROUP_RID_CERT_ADMINS = 0x205,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -