⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tsk_ntfs.h

📁 linux下开发的针对所有磁盘的数据恢复的源码
💻 H
📖 第 1 页 / 共 2 页
字号:
    typedef struct {        /* lsb 4 bits: num of bytes in run length field         * msb 4 bits: num of bytes in run offset field - (LCN)         */        uint8_t len;        uint8_t buf[32];    } ntfs_runlist;#define NTFS_RUNL_LENSZ(runl)	\	(uint8_t)(runl->len & 0x0f)#define NTFS_RUNL_OFFSZ(runl)	\	(uint8_t)((runl->len & 0xf0) >> 4)/************************************************************************ * Index root for directories  *  * the attribute has two parts.  The header is general to all index entries * and applies to $IDX_ALLOC as well. The buffer part contains the * index entries that are allocated to $IDX_ROOT. * *//* * Starting at begin_off is a stream of ntfs_idxentry structures  */    typedef struct {        uint8_t begin_off[4];   /* offset to start of seq of idx entries */        uint8_t seqend_off[4];  /* offset to end of seq of idx entries */        uint8_t bufend_off[4];  /* offset to end of idx buffer */        uint8_t flags[4];    } ntfs_idxelist;/* value for flags */#define NTFS_IDXELIST_CHILD	0x1     /* children exist below this node *//* This is general index information and applies to $IDX_ALLOC as well */    typedef struct {        uint8_t type[4];        /* ATYPE that tree is sorted by */        uint8_t collation_rule[4];        uint8_t idxalloc_size_b[4];     /* index alloc size in bytes */        uint8_t idx_size_c;     /* index alloc size in clusters */        uint8_t pad[3];        ntfs_idxelist list;    } ntfs_idxroot;/************************************************************************ * idxrec * * this is structure for the nodes of the B+ index trees * It contains a list of index entry data structures.  Each * buffer corresponds to one node.  The $IDX_ALLOC attribute * is an array of these data structures  */    typedef struct {        uint8_t magic[4];       /* INDX */        uint8_t upd_off[2];        uint8_t upd_cnt[2];     /* size + 1 */        uint8_t lsn[8];         /*  $LogFile Sequence Number */        uint8_t idx_vcn[8];     /* vcn in idx alloc attr */        ntfs_idxelist list;    } ntfs_idxrec;#define NTFS_IDXREC_MAGIC	0x58444e49      /* INDX *//************************************************************************ * This structure exists for each file and directory in the tree */    typedef struct {        uint8_t file_ref[6];    /* file reference (invalid for last entry) */        uint8_t seq_num[2];     /* file reference (invalid for last entry) */        uint8_t idxlen[2];      /* length of the index entry */        uint8_t strlen[2];      /* length of stream */        uint8_t flags;        uint8_t f1[3];        uint8_t stream;         /* length of strlen - invalid for last entry */        /* loc of subnode is found in last 8-bytes         * of idx entry (idxlen - 8).  use macro          */    } ntfs_idxentry;#define NTFS_IDX_SUB	0x01    /* Entry points to a sub-node */#define NTFS_IDX_LAST	0x02    /* last indx entry in the node *//* return the address of the subnode entry, it is located in the last * 8 bytes of the structure  */#define GET_IDXENTRY_SUB(fs, e)	\	(tsk_getu64(fs->endian, (int)e + tsk_getu16(fs->endian, e->idxlen) - 8))/*************************************************************************/    typedef struct {        char label[128];        /* label in unicode */        uint8_t type[4];        uint8_t disp[4];        /* display rule */        uint8_t coll[4];        /* collation rule */        uint8_t flags[4];        uint8_t minsize[8];     /* minimum size */        uint8_t maxsize[8];     /* maximum size */    } ntfs_attrdef;#define NTFS_ATTRDEF_FLAGS_IDX	0x02#define NTFS_ATTRDEF_FLAGS_RES	0x40    /* always resident */#define NTFS_ATTRDEF_FLAGS_NONRES	0x80    /* allowed to be non-resident *//************************************************************************ * OBJECT_ID attribute*/    typedef struct {        uint8_t objid1[8];      /* object id of file or directory */        uint8_t objid2[8];        uint8_t orig_volid1[8]; /* id of "birth" volume */        uint8_t orig_volid2[8];        uint8_t orig_objid1[8]; /* original object id */        uint8_t orig_objid2[8];        uint8_t orig_domid1[8]; /* id of "birth" domain */        uint8_t orig_domid2[8];    } ntfs_attr_objid;#if TSK_USE_SID/************************************************************************ * Self-relative security descriptor */    typedef struct {        uint8_t revision;       /* Revision level of the security descriptor. */        uint8_t pad;        uint8_t control[2];     /* Flags qualifying the type of                                   the descriptor as well as the following fields. */        uint8_t owner[4];       /* Byte offset to a SID representing an object's                                   owner. If this is NULL, no owner SID is present in                                   the descriptor. */        uint8_t group[4];       /* Byte offset to a SID representing an object's                                   primary group. If this is NULL, no primary group                                   SID is present in the descriptor. */        uint8_t sacl[4];        /* Byte offset to a system ACL. Only valid, if                                   SE_SACL_PRESENT is set in the control field. If                                   SE_SACL_PRESENT is set but sacl is NULL, a NULL ACL                                   is specified. */        uint8_t dacl[4];        /* Byte offset to a discretionary ACL. Only valid, if                                   SE_DACL_PRESENT is set in the control field. If                                   SE_DACL_PRESENT is set but dacl is NULL, a NULL ACL                                   (unconditionally granting access) is specified. */    } ntfs_self_relative_security_descriptor;/************************************************************************ * Structure used in Security Descriptor lookups */    typedef struct {        char *buffer;        size_t size;        size_t used;    } NTFS_SXX_BUFFER;/************************************************************************ * SID attribute */    typedef struct {        uint8_t revision;       /* Revision */        uint8_t sub_auth_count; /* Sub Authority Count */        uint8_t ident_auth[6];  /* NT Authority ::NOTE:: big endian number */        uint32_t sub_auth[1];   /* At least one sub_auth */    } ntfs_sid;    void ntfs_print_sid(TSK_FS_INFO * fs, FILE * hFile);    char *ntfs_get_sid_as_string(TSK_FS_INFO * fs, uint32_t security_id);#define NTFS_ACE_SIZE	16      /* Size in bytes of ACE information proceeding                                   the SID.  Since we don't current require                                   the ACE information, we will use this as an                                   offset to get to the start of the SID */    typedef struct NTFS_SID_ENTRY NTFS_SID_ENTRY;    struct NTFS_SID_ENTRY {        NTFS_SID_ENTRY *next;        ntfs_sid *data;         /* ntfs_sid record */        uint32_t sec_id;        /* Security ID */        char *sid_str;          /* SID string representation */    };/************************************************************************ * SDS attribute */    typedef struct {        uint8_t hash_sec_desc[4];       /* Hash of Security Descriptor */        uint8_t sec_id[4];      /* Security ID */        uint8_t file_off[8];    /* Offset of this entry in this file */        uint8_t ent_size[4];    /* Size of this entry */        ntfs_self_relative_security_descriptor self_rel_sec_desc;       /* Self-relative Security Descriptor */    } ntfs_attr_sds;#define NTFS_SDS_BLOCK_OFFSET	262144  /* Data offset within $SDS (1024x256) */    typedef struct NTFS_SDS_ENTRY NTFS_SDS_ENTRY;    struct NTFS_SDS_ENTRY {        NTFS_SDS_ENTRY *next;        uint32_t len;           /* Length of data */        uint8_t *data;          /* Raw data */    };/************************************************************************ * SDH attribute */    typedef struct {        uint8_t data_off[2];    /* Offset to data */        uint8_t size[2];        /* Size of data */        uint8_t pad1[4];        /* Padding */        uint8_t ent_size[2];    /* Size of Index Entry */        uint8_t key_size[2];    /* Size of Index Key */        uint8_t flags[2];       /* Flags */        uint8_t pad2[2];        /* Padding */        uint8_t key_hash_sec_desc[4];   /* Hash of Security Descriptor */        uint8_t key_sec_id[4];  /* Security ID */        uint8_t data_hash_sec_desc[4];  /* Hash of Security Descriptor */        uint8_t data_sec_id[4]; /* Security ID */        uint8_t sec_desc_off[8];        /* Offset to Security Descriptor (in $SDS) */        uint8_t sec_desc_size[4];       /* Size of Security Descriptor (in $SDS) */        uint8_t pad3[4];        /* Padding */    } ntfs_attr_sdh;    typedef struct NTFS_SDH_ENTRY NTFS_SDH_ENTRY;    struct NTFS_SDH_ENTRY {        NTFS_SDH_ENTRY *next;        ntfs_attr_sdh *data;    /* ntfs_attr_sdh record */    };/************************************************************************ * SII attribute */    typedef struct {        uint8_t data_off[2];    /* Offset to data */        uint8_t size[2];        /* Size of data */        uint8_t pad1[4];        /* Padding */        uint8_t ent_size[2];    /* Size of Index Entry */        uint8_t key_size[2];    /* Size of Index Key */        uint8_t flags[2];       /* Flags */        uint8_t pad2[2];        /* Padding */        uint8_t key_sec_id[4];  /* Security ID */        uint8_t data_hash_sec_desc[4];  /* Hash of Security Descriptor */        uint8_t data_sec_id[4]; /* Security ID */        uint8_t sec_desc_off[8];        /* Offset to Security Descriptor (in $SDS) */        uint8_t sec_desc_size[4];       /* Size of Security Descriptor (in $SDS) */    } ntfs_attr_sii;    typedef struct NTFS_SII_ENTRY NTFS_SII_ENTRY;    struct NTFS_SII_ENTRY {        NTFS_SII_ENTRY *next;        ntfs_attr_sii *data;    /* ntfs_attr_sii record */    };#endif/*************************************************************************/    typedef struct {        TSK_FS_INFO fs_info;    /* super class */        ntfs_sb *fs;        uint8_t ver;            /* version of NTFS - uses the VINFO flag */        TSK_FS_FILE *mft_file;  /* contains the data for the mft entry for the mft */        const TSK_FS_ATTR *mft_data;    /* Data run for MFT entry for MFT */        ntfs_mft *mft;          /* cache for on-disk inode */        TSK_INUM_T mnum;        /* number of above cached mft */        uint32_t csize_b;       /* number of bytes in a cluster */        uint16_t ssize_b;       /* number of bytes in a sector */        uint32_t mft_rsize_b;   /* number of bytes per mft record */        uint32_t idx_rsize_b;   /* number of bytes per idx record */        TSK_DADDR_T root_mft_addr;      /* address of first mft entry */        uint8_t loading_the_MFT;        /* set to 1 when initializing the setup */        TSK_FS_ATTR_RUN *bmap;  /* Run of bitmap for clusters (linked list) */        char *bmap_buf;         /* buffer to hold cached copy of bitmap */        TSK_DADDR_T bmap_buf_off;       /* offset cluster in cached bitmap */        ntfs_attrdef *attrdef;  // buffer of attrdef file contents        size_t attrdef_len;     // length of addrdef buffer#if TSK_USE_SID        NTFS_SDS_ENTRY *sds;    /* Data run of ntfs_attr_sds */        //NTFS_SDH_ENTRY *sdh;  /* Data run of ntfs_attr_sdh */        //NTFS_SII_ENTRY *sii;  /* Data run of ntfs_attr_sii */        NTFS_SID_ENTRY *sid;    /* Data run of ntfs_sid */#endif    } NTFS_INFO;//    extern uint8_t    //      ntfs_attr_walk(NTFS_INFO *, TSK_INUM_T, TSK_FS_ATTR *, int,    //     TSK_FS_FILE_WALK_CB, void *);    extern uint32_t nt2unixtime(uint64_t ntdate);    extern uint8_t ntfs_attrname_lookup(TSK_FS_INFO *, uint16_t, char *,        int);    extern TSK_RETVAL_ENUM        ntfs_dir_open_meta(TSK_FS_INFO * a_fs, TSK_FS_DIR ** a_fs_dir,        TSK_INUM_T a_addr);#ifdef __cplusplus}#endif#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -