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

📄 tsk_fs.h

📁 linux下开发的针对所有磁盘的数据恢复的源码
💻 H
📖 第 1 页 / 共 3 页
字号:
    typedef struct {        TSK_DADDR_T jblk;       /* journal block address */        TSK_DADDR_T fsblk;      /* fs block that journal entry is about */    } TSK_FS_JENTRY;    typedef TSK_WALK_RET_ENUM(*TSK_FS_JBLK_WALK_CB) (TSK_FS_INFO *, char *,        int, void *);    typedef TSK_WALK_RET_ENUM(*TSK_FS_JENTRY_WALK_CB) (TSK_FS_INFO *,        TSK_FS_JENTRY *, int, void *);    //@}/******************************* TSK_FS_INFO ******************/    /** \name Generic File System Handle Data Structure */    //@{    /**     * Values for the file system type.  Each bit corresponds to a file     * system.      */    enum TSK_FS_TYPE_ENUM {        TSK_FS_TYPE_DETECT = 0x00000000,        ///< Use autodetection methods        TSK_FS_TYPE_NTFS = 0x00000001,  ///< NTFS file system        TSK_FS_TYPE_NTFS_DETECT = 0x00000001,   ///< NTFS auto detection        TSK_FS_TYPE_FAT12 = 0x00000002, ///< FAT12 file system        TSK_FS_TYPE_FAT16 = 0x00000004, ///< FAT16 file system        TSK_FS_TYPE_FAT32 = 0x00000008, ///< FAT32 file system        TSK_FS_TYPE_FAT_DETECT = 0x0000000e,    ///< FAT auto detection        TSK_FS_TYPE_FFS1 = 0x00000010,  ///< UFS1 (FreeBSD, OpenBSD, BSDI ...)        TSK_FS_TYPE_FFS1B = 0x00000020, ///< UFS1b (Solaris - has no type)        TSK_FS_TYPE_FFS2 = 0x00000040,  ///< UFS2 - FreeBSD, NetBSD         TSK_FS_TYPE_FFS_DETECT = 0x00000070,    ///< UFS auto detection        TSK_FS_TYPE_EXT2 = 0x00000080,  ///< Ext2 file system        TSK_FS_TYPE_EXT3 = 0x00000100,  ///< Ext3 file system        TSK_FS_TYPE_EXT_DETECT = 0x00000180,    ///< ExtX auto detection        TSK_FS_TYPE_SWAP = 0x00000200,  ///< SWAP file system        TSK_FS_TYPE_SWAP_DETECT = 0x00000200,   ///< SWAP auto detection        TSK_FS_TYPE_RAW = 0x00000400,   ///< RAW file system        TSK_FS_TYPE_RAW_DETECT = 0x00000400,    ///< Raw auto detection        TSK_FS_TYPE_ISO9660 = 0x00000800,       ///< ISO9660 file system        TSK_FS_TYPE_ISO9660_DETECT = 0x00000800,        ///< ISO9660 auto detection        TSK_FS_TYPE_HFS = 0x00001000,   ///< HFS file system        TSK_FS_TYPE_HFS_DETECT = 0x00001000,    ///< FAT auto detection        TSK_FS_TYPE_UNSUPP = 0xffffffff,        ///< Unsupported file system    };    typedef enum TSK_FS_TYPE_ENUM TSK_FS_TYPE_ENUM;    /**        * \ingroup fslib     * Macro that takes a file system type and returns 1 if the type     * is for an NTFS file system. */#define TSK_FS_TYPE_ISNTFS(ftype) \    (((ftype) & TSK_FS_TYPE_NTFS_DETECT)?1:0)        /**        * \ingroup fslib         * Macro that takes a file system type and returns 1 if the type         * is for a FAT file system. */#define TSK_FS_TYPE_ISFAT(ftype) \        (((ftype) & TSK_FS_TYPE_FAT_DETECT)?1:0)        /**        * \ingroup fslib         * Macro that takes a file system type and returns 1 if the type         * is for a FFS file system. */#define TSK_FS_TYPE_ISFFS(ftype) \        (((ftype) & TSK_FS_TYPE_FFS_DETECT)?1:0)        /**        * \ingroup fslib         * Macro that takes a file system type and returns 1 if the type         * is for a ExtX file system. */#define TSK_FS_TYPE_ISEXT(ftype) \        (((ftype) & TSK_FS_TYPE_EXT_DETECT)?1:0)        /**        * \ingroup fslib         * Macro that takes a file system type and returns 1 if the type         * is for a ISO9660 file system. */#define TSK_FS_TYPE_ISISO9660(ftype) \        (((ftype) & TSK_FS_TYPE_ISO9660_DETECT)?1:0)        /**        * \ingroup fslib         * Macro that takes a file system type and returns 1 if the type         * is for a HFS file system. */#define TSK_FS_TYPE_ISHFS(ftype) \        (((ftype) & TSK_FS_TYPE_HFS_DETECT)?1:0)        /**        * \ingroup fslib         * Macro that takes a file system type and returns 1 if the type         * is for a swap "file system". */#define TSK_FS_TYPE_ISSWAP(ftype) \        (((ftype) & TSK_FS_TYPE_SWAP_DETECT)?1:0)        /**        * \ingroup fslib         * Macro that takes a file system type and returns 1 if the type         * is for a raw "file system". */#define TSK_FS_TYPE_ISRAW(ftype) \        (((ftype) & TSK_FS_TYPE_RAW_DETECT)?1:0)    /**     * Flags for the FS_INFO structure      */    enum TSK_FS_INFO_FLAG_ENUM {        TSK_FS_INFO_FLAG_HAVE_SEQ = 0x01        ///< File system has sequence numbers in the inode addresses.    };    typedef enum TSK_FS_INFO_FLAG_ENUM TSK_FS_INFO_FLAG_ENUM;#define TSK_FS_INFO_TAG  0x10101010#define TSK_FS_INFO_FS_ID_LEN   32      // set based on largest file system / volume ID supported/** * Stores state information for an open file system.  * One of these are generated for each open files system and it contains * file system-type specific data.  These values are all filled in by * the file system code and not the caller functions.  */    struct TSK_FS_INFO {        int tag;                ///< \internal Will be set to TSK_FS_INFO_TAG if structure is still allocated, 0 if not        TSK_IMG_INFO *img_info; ///< Pointer to the image layer state        TSK_OFF_T offset;       ///< Byte offset into img_info that fs starts         /* meta data */        TSK_INUM_T inum_count;  ///< Number of metadata addresses         TSK_INUM_T root_inum;   ///< Metadata address of root directory          TSK_INUM_T first_inum;  ///< First valid metadata address        TSK_INUM_T last_inum;   ///< Last valid metadata address        /* content */        TSK_DADDR_T block_count;        ///< Number of blocks in fs        TSK_DADDR_T first_block;        ///< Address of first block        TSK_DADDR_T last_block; ///< Address of last block as reported by file system (could be larger than last_block in image if end of image does not exist)        TSK_DADDR_T last_block_act;     ///< Address of last block -- adjusted so that it is equal to the last block in the image or volume (if image is not complete)        unsigned int block_size;        ///< Size of each block (in bytes)        unsigned int dev_bsize; ///< Size of device block (typically always 512)        /* Journal */        TSK_INUM_T journ_inum;  ///< Address of journal inode        TSK_FS_TYPE_ENUM ftype; ///< type of file system         const char *duname;     ///< string "name" of data unit type         TSK_FS_INFO_FLAG_ENUM flags;    ///< flags for file system        uint8_t fs_id[TSK_FS_INFO_FS_ID_LEN];   ///< File system id (as reported in boot sector)        size_t fs_id_used;      ///< Number of bytes in fs_id that are being used        TSK_ENDIAN_ENUM endian; ///< Endian order of data        TSK_LIST *list_inum_named;      /**< List of unallocated inodes that					 * are pointed to by a file name -- 					 * Used to find orphan files.  Is filled when looking for orphans                     * or when a full name_walk is performed. 					 */        uint8_t isOrphanHunting;        ///< Set to 1 if TSK is currently looking for Orphan files         uint8_t(*block_walk) (TSK_FS_INFO * fs, TSK_DADDR_T start, TSK_DADDR_T end, TSK_FS_BLOCK_WALK_FLAG_ENUM flags, TSK_FS_BLOCK_WALK_CB cb, void *ptr);    ///< FS-specific function: Call tsk_fs_block_walk() instead.          TSK_FS_BLOCK_FLAG_ENUM(*block_getflags) (TSK_FS_INFO * a_fs, TSK_DADDR_T a_addr);      ///< \internal         uint8_t(*inode_walk) (TSK_FS_INFO * fs, TSK_INUM_T start, TSK_INUM_T end, TSK_FS_META_FLAG_ENUM flags, TSK_FS_META_WALK_CB cb, void *ptr);     ///< FS-specific function: Call tsk_fs_meta_walk() instead.          uint8_t(*file_add_meta) (TSK_FS_INFO * fs, TSK_FS_FILE * fs_file, TSK_INUM_T addr);    ///< \internal         TSK_FS_ATTR_TYPE_ENUM(*get_default_attr_type) (const TSK_FS_FILE *);   ///< \internal         uint8_t(*load_attrs) (TSK_FS_FILE *);  ///< \internal        /**         * Pointer to file system specific function that prints details on a specific file to a file handle.          *         * @param fs File system file is located in         * @param hFile File handle to print text to         * @param inum Address of file in file system         * @param numblock The number of blocks in file to force print (can go beyond file size)         * @param sec_skew Clock skew in seconds to also print times in         *          * @returns 1 on error and 0 on success         */         uint8_t(*istat) (TSK_FS_INFO * fs, FILE * hFile, TSK_INUM_T inum,            TSK_DADDR_T numblock, int32_t sec_skew);         TSK_RETVAL_ENUM(*dir_open_meta) (TSK_FS_INFO * fs, TSK_FS_DIR ** a_fs_dir, TSK_INUM_T inode);  ///< FS-specific function: Call tsk_fs_dir_open_meta() instead.          uint8_t(*jopen) (TSK_FS_INFO *, TSK_INUM_T);   ///< \internal         uint8_t(*jblk_walk) (TSK_FS_INFO *, TSK_DADDR_T, TSK_DADDR_T, int, TSK_FS_JBLK_WALK_CB, void *);       ///< \internal         uint8_t(*jentry_walk) (TSK_FS_INFO *, int, TSK_FS_JENTRY_WALK_CB, void *);     ///< \internal         uint8_t(*fsstat) (TSK_FS_INFO * fs, FILE * hFile);     ///< \internal         uint8_t(*fscheck) (TSK_FS_INFO *, FILE *);     ///< \internal        void (*close) (TSK_FS_INFO * fs);       ///< FS-specific function: Call tsk_fs_close() instead.     };    /* File system level */    extern TSK_FS_INFO *tsk_fs_open_img(TSK_IMG_INFO *, TSK_OFF_T,        TSK_FS_TYPE_ENUM);    extern TSK_FS_INFO *tsk_fs_open_vol(const TSK_VS_PART_INFO *,        TSK_FS_TYPE_ENUM);    extern void tsk_fs_close(TSK_FS_INFO *);    extern TSK_FS_TYPE_ENUM tsk_fs_type_toid(const TSK_TCHAR *);    extern void tsk_fs_type_print(FILE *);    extern const char *tsk_fs_type_toname(TSK_FS_TYPE_ENUM);    extern TSK_FS_TYPE_ENUM tsk_fs_type_supported();    extern ssize_t tsk_fs_read(TSK_FS_INFO * a_fs, TSK_OFF_T a_off,        char *a_buf, size_t a_len);    extern ssize_t tsk_fs_read_block(TSK_FS_INFO * a_fs,        TSK_DADDR_T a_addr, char *a_buf, size_t a_len);    //@}/***** LIBRARY ROUTINES FOR COMMAND LINE FUNCTIONS */    enum TSK_FS_BLKCALC_FLAG_ENUM {        TSK_FS_BLKCALC_DD = 0x01,        TSK_FS_BLKCALC_BLKLS = 0x02,        TSK_FS_BLKCALC_SLACK = 0x04    };    typedef enum TSK_FS_BLKCALC_FLAG_ENUM TSK_FS_BLKCALC_FLAG_ENUM;    extern int8_t tsk_fs_blkcalc(TSK_FS_INFO * fs,        TSK_FS_BLKCALC_FLAG_ENUM flags, TSK_DADDR_T cnt);    enum TSK_FS_BLKCAT_FLAG_ENUM {        TSK_FS_BLKCAT_HEX = 0x01,        TSK_FS_BLKCAT_ASCII = 0x02,        TSK_FS_BLKCAT_HTML = 0x04,        TSK_FS_BLKCAT_STAT = 0x08    };    typedef enum TSK_FS_BLKCAT_FLAG_ENUM TSK_FS_BLKCAT_FLAG_ENUM;    extern uint8_t tsk_fs_blkcat(TSK_FS_INFO * fs,        TSK_FS_BLKCAT_FLAG_ENUM flags, TSK_DADDR_T addr,        TSK_DADDR_T read_num_units);    enum TSK_FS_BLKLS_FLAG_ENUM {        TSK_FS_BLKLS_CAT = 0x01,        TSK_FS_BLKLS_LIST = 0x02,        TSK_FS_BLKLS_SLACK = 0x04,    };    typedef enum TSK_FS_BLKLS_FLAG_ENUM TSK_FS_BLKLS_FLAG_ENUM;    extern uint8_t tsk_fs_blkls(TSK_FS_INFO * fs,        TSK_FS_BLKLS_FLAG_ENUM lclflags, TSK_DADDR_T bstart,        TSK_DADDR_T bend, TSK_FS_BLOCK_FLAG_ENUM flags);    extern uint8_t tsk_fs_blkstat(TSK_FS_INFO * fs, TSK_DADDR_T addr,        TSK_FS_BLOCK_FLAG_ENUM flags);    enum TSK_FS_FFIND_FLAG_ENUM {        TSK_FS_FFIND_ALL = 0x01,    };    typedef enum TSK_FS_FFIND_FLAG_ENUM TSK_FS_FFIND_FLAG_ENUM;    extern uint8_t tsk_fs_ffind(TSK_FS_INFO * fs,        TSK_FS_FFIND_FLAG_ENUM lclflags, TSK_INUM_T inode,        TSK_FS_ATTR_TYPE_ENUM type, uint8_t type_used,        uint16_t id, uint8_t id_used, TSK_FS_DIR_WALK_FLAG_ENUM flags);    enum TSK_FS_FLS_FLAG_ENUM {        TSK_FS_FLS_DOT = 0x01,        TSK_FS_FLS_LONG = 0x02,        TSK_FS_FLS_FILE = 0x04,        TSK_FS_FLS_DIR = 0x08,        TSK_FS_FLS_FULL = 0x10,        TSK_FS_FLS_MAC = 0x20,    };    typedef enum TSK_FS_FLS_FLAG_ENUM TSK_FS_FLS_FLAG_ENUM;    extern uint8_t tsk_fs_fls(TSK_FS_INFO * fs,        TSK_FS_FLS_FLAG_ENUM lclflags, TSK_INUM_T inode,        TSK_FS_NAME_FLAG_ENUM flags, TSK_TCHAR * pre, int32_t skew);    extern uint8_t tsk_fs_icat(TSK_FS_INFO * fs,        TSK_INUM_T inum,        TSK_FS_ATTR_TYPE_ENUM type, uint8_t type_used,        uint16_t id, uint8_t id_used, TSK_FS_FILE_WALK_FLAG_ENUM flags);    enum TSK_FS_IFIND_FLAG_ENUM {        TSK_FS_IFIND_ALL = 0x01,        TSK_FS_IFIND_PAR_LONG = 0x02,    };    typedef enum TSK_FS_IFIND_FLAG_ENUM TSK_FS_IFIND_FLAG_ENUM;    extern int8_t tsk_fs_ifind_path(TSK_FS_INFO * fs,        TSK_TCHAR * path, TSK_INUM_T * result);    extern uint8_t tsk_fs_ifind_data(TSK_FS_INFO * fs,        TSK_FS_IFIND_FLAG_ENUM flags, TSK_DADDR_T blk);    extern uint8_t tsk_fs_ifind_par(TSK_FS_INFO * fs,        TSK_FS_IFIND_FLAG_ENUM flags, TSK_INUM_T par);    enum TSK_FS_ILS_FLAG_ENUM {        TSK_FS_ILS_OPEN = 0x01,        TSK_FS_ILS_MAC = 0x02,        TSK_FS_ILS_LINK = 0x04,        TSK_FS_ILS_UNLINK = 0x08,    };    typedef enum TSK_FS_ILS_FLAG_ENUM TSK_FS_ILS_FLAG_ENUM;    extern uint8_t tsk_fs_ils(TSK_FS_INFO * fs,        TSK_FS_ILS_FLAG_ENUM lclflags, TSK_INUM_T istart, TSK_INUM_T ilast,        TSK_FS_META_FLAG_ENUM flags, int32_t skew, const TSK_TCHAR * img);    /*     ** Is this string a "." or ".."     */#define TSK_FS_ISDOT(str) ( ((str[0] == '.') && \                             ( ((str[1] == '.') && (str[2] == '\0')) || (str[1] == '\0') ) ) ? 1 : 0 )    extern int tsk_fs_parse_inum(const TSK_TCHAR * str, TSK_INUM_T *,        TSK_FS_ATTR_TYPE_ENUM *, uint8_t *, uint16_t *, uint8_t *);#ifdef __cplusplus}#endif#endif

⌨️ 快捷键说明

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