VirtualBox

Changeset 69902 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Dec 1, 2017 5:58:28 PM (7 years ago)
Author:
vboxsync
Message:

IPRT/ntfsvfs.h: Working on reading the root dir. Did some cleanups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/formats/ntfs.h

    r69885 r69902  
    202202#define NTFS_AT_SECURITY_DESCRIPTOR         RT_H2LE_U32_C(UINT32_C(0x00000050))
    203203#define NTFS_AT_VOLUME_NAME                 RT_H2LE_U32_C(UINT32_C(0x00000060))
     204/** NTFSATVOLUMEINFO */
    204205#define NTFS_AT_VOLUME_INFORMATION          RT_H2LE_U32_C(UINT32_C(0x00000070))
    205206#define NTFS_AT_DATA                        RT_H2LE_U32_C(UINT32_C(0x00000080))
     207/** NTFSATINDEXROOT */
    206208#define NTFS_AT_INDEX_ROOT                  RT_H2LE_U32_C(UINT32_C(0x00000090))
    207209#define NTFS_AT_INDEX_ALLOCATION            RT_H2LE_U32_C(UINT32_C(0x000000a0))
     
    218220/** @name NTFS_AF_XXX - Attribute flags.
    219221 * @{ */
    220 #define NTFS_AF_COMPR_FMT_NONE              UINT16_C(0x0000)
    221 #define NTFS_AF_COMPR_FMT_LZNT1             UINT16_C(0x0001)    /**< See RtlCompressBuffer / COMPRESSION_FORMAT_LZNT1. */
    222 #define NTFS_AF_COMPR_FMT_XPRESS            UINT16_C(0x0002)    /**< See RtlCompressBuffer / COMPRESSION_FORMAT_XPRESS_HUFF. */
    223 #define NTFS_AF_COMPR_FMT_XPRESS_HUFF       UINT16_C(0x0003)    /**< See RtlCompressBuffer / COMPRESSION_FORMAT_XPRESS_HUFF. */
    224 #define NTFS_AF_COMPR_FMT_MASK              UINT16_C(0x00ff)
    225 #define NTFS_AF_ENCRYPTED                   UINT16_C(0x4000)
    226 #define NTFS_AF_SPARSE                      UINT16_C(0x8000)
     222#define NTFS_AF_COMPR_FMT_NONE              RT_H2LE_U16_C(UINT16_C(0x0000))
     223/** See RtlCompressBuffer / COMPRESSION_FORMAT_LZNT1. */
     224#define NTFS_AF_COMPR_FMT_LZNT1             RT_H2LE_U16_C(UINT16_C(0x0001))
     225/** See RtlCompressBuffer / COMPRESSION_FORMAT_XPRESS_HUFF. */
     226#define NTFS_AF_COMPR_FMT_XPRESS            RT_H2LE_U16_C(UINT16_C(0x0002))
     227/** See RtlCompressBuffer / COMPRESSION_FORMAT_XPRESS_HUFF. */
     228#define NTFS_AF_COMPR_FMT_XPRESS_HUFF       RT_H2LE_U16_C(UINT16_C(0x0003))
     229#define NTFS_AF_COMPR_FMT_MASK              RT_H2LE_U16_C(UINT16_C(0x00ff))
     230#define NTFS_AF_ENCRYPTED                   RT_H2LE_U16_C(UINT16_C(0x4000))
     231#define NTFS_AF_SPARSE                      RT_H2LE_U16_C(UINT16_C(0x8000))
    227232/** @} */
    228233
     
    294299             * @note Only set in the first attribute record (iVcnFirst == 0). */
    295300            int64_t         cbData;
    296             /** 0x38: The length of the initialized data (rounded to cluster).
     301            /** 0x38: The length of the initialized data.  (Not necessarily
     302             *  rounded up to cluster size.)
    297303             * @note Only set in the first attribute record (iVcnFirst == 0). */
    298304            int64_t         cbInitialized;
     
    322328/** @} */
    323329
     330/** Get the pointer to the embedded name from an attribute.
     331 * @note  ASSUMES the caller check that there is a name.   */
     332#define NTFSATTRIBHDR_GET_NAME(a_pAttrHdr)          ( (PRTUTF16)((uintptr_t)(a_pAttrHdr) + (a_pAttrHdr)->offName) )
     333
     334
     335/** @name NTFS_RES_AF_XXX
     336 *  @{ */
     337/** Attribute is referenced in an index. */
     338#define NTFS_RES_AF_INDEXED                         UINT8_C(0x01)
     339/** @} */
    324340
    325341/**
     
    487503/** @} */
    488504
     505
     506/**
     507 * NTFS volume information (NTFS_AT_VOLUME_INFORMATION).
     508 *
     509 * This is found in the special NTFS_MFT_IDX_VOLUME file.
     510 */
     511typedef struct NTFSATVOLUMEINFO
     512{
     513    /** 0x00: Reserved bytes. */
     514    uint8_t         abReserved[8];
     515    /** 0x08: Major NTFS version number.   */
     516    uint8_t         uMajorVersion;
     517    /** 0x09: Minor NTFS version number.   */
     518    uint8_t         uMinorVersion;
     519    /** 0x0a: Volume flags (NTFS_VOLUME_F_XXX)  */
     520    uint16_t        fFlags;
     521} NTFSATVOLUMEINFO;
     522AssertCompileSize(NTFSATVOLUMEINFO, 12);
     523/** Pointer to NTFS volume information. */
     524typedef NTFSATVOLUMEINFO *PNTFSATVOLUMEINFO;
     525/** Pointer to const NTFS volume information. */
     526typedef NTFSATVOLUMEINFO const *PCNTFSATVOLUMEINFO;
     527
     528/** @name NTFS_VOLUME_F_XXX
     529 *  @{ */
     530#define NTFS_VOLUME_F_DIRTY                 RT_H2LE_U16_C(0x0001) /**< Volume is dirty. */
     531#define NTFS_VOLUME_F_RESIZE_LOG_FILE       RT_H2LE_U16_C(0x0002) /**< */
     532#define NTFS_VOLUME_F_UPGRADE_ON_MOUNT      RT_H2LE_U16_C(0x0004) /**< */
     533#define NTFS_VOLUME_F_MOUNTED_ON_NT4        RT_H2LE_U16_C(0x0008) /**< */
     534#define NTFS_VOLUME_F_DELETE_USN_UNDERWAY   RT_H2LE_U16_C(0x0010) /**< */
     535#define NTFS_VOLUME_F_REPAIR_OBJECT_ID      RT_H2LE_U16_C(0x0020) /**< */
     536#define NTFS_VOLUME_F_CHKDSK_UNDERWAY       RT_H2LE_U16_C(0x4000) /**< */
     537#define NTFS_VOLUME_F_MODIFIED_BY_CHKDSK    RT_H2LE_U16_C(0x8000) /**< */
     538
     539#define NTFS_VOLUME_F_KNOWN_MASK            RT_H2LE_U16_C(0xc03f)
     540#define NTFS_VOLUME_F_MOUNT_READONLY_MASK   RT_H2LE_U16_C(0xc027)
     541/** @} */
     542
     543
     544/** The attribute name used by the index attributes on NTFS directories,
     545 *  ASCII stirng variant. */
     546#define NTFS_DIR_ATTRIBUTE_NAME             "$I30"
     547
     548/**
     549 * NTFS index header.
     550 *
     551 * This is used by NTFSATINDEXROOT and NTFSATINDEXALLOC.
     552 */
     553typedef struct NTFSINDEXHEADER
     554{
     555    /** 0x00: Offset of the first entry relative to this header. */
     556    uint32_t        offFirstEntry;
     557    /** 0x04: Size of the index in bytes, including this header.  */
     558    uint32_t        cbIndex;
     559    /** 0x08: Number of bytes allocated for the index (including this header). */
     560    uint32_t        cbAllocated;
     561    /** 0x0c: Flags (NTFSINDEXHEADER_F_XXX).   */
     562    uint8_t         fFlags;
     563    /** 0x0d: Reserved bytes. */
     564    uint8_t         abReserved[3];
     565} NTFSINDEXHEADER;
     566AssertCompileSize(NTFSINDEXHEADER, 16);
     567/** Pointer to a NTFS index header. */
     568typedef NTFSINDEXHEADER *PNTFSINDEXHEADER;
     569/** Pointer to a const NTFS index header. */
     570typedef NTFSINDEXHEADER const *PCNTFSINDEXHEADER;
     571
     572/** Index root only: Small enough to fit inside the index root attrib.  */
     573#define NTFSINDEXHEADER_F_ROOT_SMALL        UINT8_C(0x00)
     574/** Index root only: Too large to fit inside the index root attrib and/or an
     575 *  index allocation attribute is present. */
     576#define NTFSINDEXHEADER_F_ROOT_LARGE        UINT8_C(0x01)
     577
     578
     579/**
     580 * NTFS index root (NTFS_AT_INDEX_ROOT).
     581 *
     582 * This is a generic index structure, but is most prominently used for
     583 * implementating directories.
     584 */
     585typedef struct NTFSATINDEXROOT
     586{
     587    /** 0x00: The index type (NTFSATINDEXROOT_TYPE_XXX). */
     588    uint32_t        uType;
     589    /** 0x04: The sorting rules to use (NTFS_COLLATION_XXX). */
     590    uint32_t        uCollationRules;
     591    /** 0x08: Index buffer size (in bytes). */
     592    uint32_t        cbIndexBuffer;
     593    /** 0x0c: Number of clusters allocated for each index buffer if
     594     * cbIndexBuffer is larger than a cluster, otherwise log2(cbIndexBuffer)?  */
     595    uint8_t         cClustersPerBuffer;
     596    /** 0x0d: Reserved padding or something. */
     597    uint8_t         abReserved[3];
     598    /** 0x10: Index header detailing the entries that follows. */
     599    NTFSINDEXHEADER Hdr;
     600    /* NTFSINDEXENTRYHDR array typically follows */
     601} NTFSATINDEXROOT;
     602AssertCompileSize(NTFSATINDEXROOT, 32);
     603/** Pointer to a NTFS index root. */
     604typedef NTFSATINDEXROOT *PNTFSATINDEXROOT;
     605/** Pointer to a const NTFS index root. */
     606typedef NTFSATINDEXROOT const *PCNTFSATINDEXROOT;
     607
     608/** @name NTFSATINDEXROOT_TYPE_XXX
     609 * @{ */
     610/** View index. */
     611#define NTFSATINDEXROOT_TYPE_VIEW           RT_H2LE_U32_C(UINT32_C(0x00000000))
     612/** Directory index, NTFSATFILENAME follows NTFSINDEXENTRY. */
     613#define NTFSATINDEXROOT_TYPE_DIRECTORY      RT_H2LE_U32_C(UINT32_C(0x00000030))
     614/** @} */
     615
     616/** @name NTFS_COLLATION_XXX - index sorting rules
     617 * @{ */
     618/** Little endian binary compare (or plain byte compare if you like). */
     619#define NTFS_COLLATION_BINARY               RT_H2LE_U32_C(UINT32_C(0x00000000))
     620/** Same as NTFS_COLLATION_UNICODE_STRING. */
     621#define NTFS_COLLATION_FILENAME             RT_H2LE_U32_C(UINT32_C(0x00000001))
     622/** Compare the uppercased unicode characters. */
     623#define NTFS_COLLATION_UNICODE_STRING       RT_H2LE_U32_C(UINT32_C(0x00000002))
     624
     625/** Single little endian 32-bit unsigned integer value as sort key. */
     626#define NTFS_COLLATION_UINT32               RT_H2LE_U32_C(UINT32_C(0x00000010))
     627/** Little endian SID value as sort key. */
     628#define NTFS_COLLATION_SID                  RT_H2LE_U32_C(UINT32_C(0x00000011))
     629/** Two little endian 32-bit unsigned integer values used as sorting key. */
     630#define NTFS_COLLATION_UINT32_PAIR          RT_H2LE_U32_C(UINT32_C(0x00000012))
     631/** Sequence of little endian 32-bit unsigned integer values used as sorting key. */
     632#define NTFS_COLLATION_UINT32_SEQ           RT_H2LE_U32_C(UINT32_C(0x00000013))
     633
     634/** @} */
     635
     636
     637/**
     638 * NTFS index entry header.
     639 */
     640typedef struct NTFSINDEXENTRYHDR
     641{
     642    union
     643    {
     644        /** 0x00: Non-View: Reference to the MFT record being indexed here.
     645         * This is invalid if NTFSINDEX_EF_LAST is set.  */
     646        NTFSMFTREF      FileMftRec;
     647        /** 0x00: View   */
     648        struct
     649        {
     650            /** 0x00: Offset to the data relative to this header. */
     651            uint16_t    offData;
     652            /** 0x02: Size of data at offData. */
     653            uint16_t    cbData;
     654            /** 0x04: Reserved.   */
     655            uint32_t    uReserved;
     656        } View;
     657    } u;
     658
     659    /** 0x08: Size of this entry, 8-byte aligned. */
     660    uint16_t        cbEntry;
     661    /** 0x0a: Key length (unaligned). */
     662    uint16_t        cbKey;
     663    /** 0x0c: Entry flags, NTFSINDEX_EF_XXX. */
     664    uint16_t        fFlags;
     665    /** 0x0d: Entry flags, NTFSINDEX_EF_XXX. */
     666    uint16_t        uReserved;
     667} NTFSINDEXENTRYHDR;
     668AssertCompileSize(NTFSINDEXENTRYHDR, 16);
     669/** Pointer to a NTFS index entry header. */
     670typedef NTFSINDEXENTRYHDR *PNTFSINDEXENTRYHDR;
     671/** Pointer to a const NTFS index entry header. */
     672typedef NTFSINDEXENTRYHDR const *PCNTFSINDEXENTRYHDR;
     673
     674/** @name  NTFSINDEX_EF_XXX - NTFSINDEXENTRYHDR::fFlags
     675 * @{ */
     676/** Indicates an internal node, as opposed to a leaf node. */
     677#define NTFSINDEX_EF_NODE           RT_H2LE_U16_C(UINT16_C(0x0001))
     678/** Last entry in a block, may point to the next node. */
     679#define NTFSINDEX_EF_LAST           RT_H2LE_U16_C(UINT16_C(0x0002))
     680/** @}  */
     681
    489682/** @} */
    490683
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette