21#define SECTOR_SIZE (Ext2Sys->DiskGeometry.BytesPerSector)
30 unsigned char Data4[8];
55#define EXT2_CHECK_MAGIC(struct, code) \
56 if ((struct)->magic != (code)) return (code)
61#define EXT2_SF_CHK_BADBLOCKS 0x0001
62#define EXT2_SF_BAD_INODE_BLK 0x0002
63#define EXT2_SF_BAD_EXTRA_BYTES 0x0004
64#define EXT2_SF_SKIP_MISSING_ITABLE 0x0008
69#define EXT2_MF_MOUNTED 1
70#define EXT2_MF_ISROOT 2
71#define EXT2_MF_READONLY 4
80#define LINUX_S_IFMT 00170000
81#define LINUX_S_IFSOCK 0140000
82#define LINUX_S_IFLNK 0120000
83#define LINUX_S_IFREG 0100000
84#define LINUX_S_IFBLK 0060000
85#define LINUX_S_IFDIR 0040000
86#define LINUX_S_IFCHR 0020000
87#define LINUX_S_IFIFO 0010000
88#define LINUX_S_ISUID 0004000
89#define LINUX_S_ISGID 0002000
90#define LINUX_S_ISVTX 0001000
92#define LINUX_S_IRWXU 00700
93#define LINUX_S_IRUSR 00400
94#define LINUX_S_IWUSR 00200
95#define LINUX_S_IXUSR 00100
97#define LINUX_S_IRWXG 00070
98#define LINUX_S_IRGRP 00040
99#define LINUX_S_IWGRP 00020
100#define LINUX_S_IXGRP 00010
102#define LINUX_S_IRWXO 00007
103#define LINUX_S_IROTH 00004
104#define LINUX_S_IWOTH 00002
105#define LINUX_S_IXOTH 00001
107#define LINUX_S_ISLNK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFLNK)
108#define LINUX_S_ISREG(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFREG)
109#define LINUX_S_ISDIR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFDIR)
110#define LINUX_S_ISCHR(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFCHR)
111#define LINUX_S_ISBLK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFBLK)
112#define LINUX_S_ISFIFO(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFIFO)
113#define LINUX_S_ISSOCK(m) (((m) & LINUX_S_IFMT) == LINUX_S_IFSOCK)
116#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s)
204#define SUPERBLOCK_OFFSET 1024
205#define SUPERBLOCK_SIZE 1024
215#define ext2_mark_block_bitmap ext2_mark_bitmap
216#define ext2_mark_inode_bitmap ext2_mark_bitmap
217#define ext2_unmark_block_bitmap ext2_unmark_bitmap
218#define ext2_unmark_inode_bitmap ext2_unmark_bitmap
int ext2_group_of_ino(PEXT2_FILESYS fs, ULONG ino)
struct ext2_dx_root_info * PEXT2_DX_RI
EXT2_BITMAP EXT2_BLOCK_BITMAP
void ext2_print_super(PEXT2_SUPER_BLOCK pExt2Sb)
bool ext2_test_bit(int nr, void *addr)
bool ext2_test_inode_bitmap(PEXT2_BLOCK_BITMAP bitmap, ULONG inode)
struct ext2_dir_entry * PEXT2_DIR_ENTRY
NTSTATUS Ext2ReadDisk(PEXT2_FILESYS Ext2Sys, ULONGLONG Offset, ULONG Length, PVOID Buffer)
void uuid_generate(__u8 *uuid)
void ext2_inode_alloc_stats2(PEXT2_FILESYS fs, ULONG ino, int inuse, int isdir)
bool ext2_allocate_group_table(PEXT2_FILESYS fs, ULONG group, PEXT2_BLOCK_BITMAP bmap)
bool ext2_test_block_bitmap(PEXT2_BLOCK_BITMAP bitmap, ULONG block)
NTSTATUS Ext2GetMediaInfo(PEXT2_FILESYS Ext2Sys)
bool zero_blocks(PEXT2_FILESYS fs, ULONG blk, ULONG num, ULONG *ret_blk, ULONG *ret_count)
bool ext2_set_bit(int nr, void *addr)
struct ext2_inode * PEXT2_INODE
bool ext2_test_block_bitmap_range(PEXT2_BLOCK_BITMAP bitmap, ULONG block, int num)
bool ext2_write_block_bitmap(PEXT2_FILESYS fs)
void ext2_block_alloc_stats(PEXT2_FILESYS fs, ULONG blk, int inuse)
NTSTATUS Ext2OpenDevice(PEXT2_FILESYS Ext2Sys, PUNICODE_STRING DeviceName)
struct _ext2fs_bitmap * PEXT2_BITMAP
bool ext2_initialize_sb(PEXT2_FILESYS pExt2Sys)
bool ext2_get_inode_lba(PEXT2_FILESYS pExt2Sys, ULONG no, LONGLONG *offset)
bool ext2_read_bitmaps(PEXT2_FILESYS fs)
bool ext2_write_inode(PEXT2_FILESYS pExt2Sys, ULONG ino, ULONG offset, PVOID Buffer, ULONG size, PULONG dwReturn)
int ext2_group_of_blk(PEXT2_FILESYS fs, ULONG blk)
struct ext2_dx_countlimit * PEXT2_DX_CL
bool parase_cmd(int argc, char *argv[], PEXT2_FILESYS pExt2Sys)
bool ext2_new_block(PEXT2_FILESYS fs, ULONG goal, PEXT2_BLOCK_BITMAP map, ULONG *ret)
struct ext2_dir_entry_2 * PEXT2_DIR_ENTRY2
bool create_bad_block_inode(PEXT2_FILESYS fs, PEXT2_BADBLK_LIST bb_list)
struct _EXT2_BDL * PEXT2_BDL
void ext2_free_block_bitmap(PEXT2_FILESYS pExt2Sys)
NTSTATUS Ext2DisMountVolume(PEXT2_FILESYS Ext2Sys)
bool ext2_read_block_bitmap(PEXT2_FILESYS fs)
struct ext2_group_desc * PEXT2_GROUP_DESC
EXT2_BITMAP EXT2_GENERIC_BITMAP
EXT2_BITMAP * PEXT2_GENERIC_BITMAP
bool ext2_allocate_block_bitmap(PEXT2_FILESYS pExt2Sys)
EXT2_BITMAP EXT2_INODE_BITMAP
bool ext2_bg_has_super(PEXT2_SUPER_BLOCK pExt2Sb, int group_block)
void ext2_free_group_desc(PEXT2_FILESYS pExt2Sys)
bool ext2_add_entry(PEXT2_FILESYS pExt2Sys, ULONG parent, ULONG inode, int filetype, char *name)
struct _ext2_filesys EXT2_FILESYS
bool ext2_write_bitmaps(PEXT2_FILESYS fs)
bool ext2_read_inode_bitmap(PEXT2_FILESYS fs)
bool ext2_reserve_inodes(PEXT2_FILESYS fs)
bool ext2_read_block(PEXT2_FILESYS fs, ULONG block, void *inbuf)
EXT2_BITMAP * PEXT2_INODE_BITMAP
bool ext2_expand_inode(PEXT2_FILESYS pExt2Sys, PEXT2_INODE, ULONG newBlk)
struct ext2_acl_entry * PEXT2_ACL_ENTRY
struct ext2_super_block * PEXT2_SUPER_BLOCK
bool ext2_mark_bitmap(PEXT2_BITMAP bitmap, ULONG bitno)
bool ext2_get_free_blocks(PEXT2_FILESYS fs, ULONG start, ULONG finish, int num, PEXT2_BLOCK_BITMAP map, ULONG *ret)
LONGLONG ext2_nt_time(ULONG i_time)
bool ext2_read_inode(PEXT2_FILESYS pExt2Sys, ULONG ino, ULONG offset, PVOID Buffer, ULONG size, PULONG dwReturn)
bool ext2_clear_bit(int nr, void *addr)
bool ext2_unmark_bitmap(PEXT2_BITMAP bitmap, ULONG bitno)
bool ext2_allocate_inode_bitmap(PEXT2_FILESYS pExt2Sys)
void ext2_inode_alloc_stats(PEXT2_FILESYS fs, ULONG ino, int inuse)
bool ext2_save_inode(PEXT2_FILESYS pExt2Sys, ULONG no, PEXT2_INODE pInode)
EXT2_BITMAP * PEXT2_BLOCK_BITMAP
bool ext2_allocate_tables(PEXT2_FILESYS pExt2Sys)
struct ext2_acl_header * PEXT2_ACL_HEADER
bool ext2_write_block(PEXT2_FILESYS fs, ULONG block, void *inbuf)
struct ext2_dx_entry * PEXT2_DX_ENTRY
struct _EXT2_BDL EXT2_BDL
bool ext2_new_dir_block(PEXT2_FILESYS fs, ULONG dir_ino, ULONG parent_ino, char **block)
bool ext2_alloc_block(PEXT2_FILESYS fs, ULONG goal, ULONG *ret)
bool ext2_load_inode(PEXT2_FILESYS pExt2Sys, ULONG no, PEXT2_INODE pInode)
ULONG Ext2TotalBlocks(PEXT2_FILESYS Ext2Sys, ULONG DataBlocks)
bool ext2_write_inode_bitmap(PEXT2_FILESYS fs)
NTSTATUS Ext2WriteDisk(PEXT2_FILESYS Ext2Sys, ULONGLONG Offset, ULONG Length, PVOID Buffer)
struct _ext2_filesys * PEXT2_FILESYS
NTSTATUS Ext2UnLockVolume(PEXT2_FILESYS Ext2Sys)
void ext2_free_inode_bitmap(PEXT2_FILESYS pExt2Sys)
ULONG ext2_unix_time(LONGLONG n_time)
ULONG Ext2DataBlocks(PEXT2_FILESYS Ext2Sys, ULONG TotalBlocks)
bool ext2_allocate_group_desc(PEXT2_FILESYS pExt2Sys)
struct ext2_struct_badblocks_list * PEXT2_BADBLK_LIST
bool ext2_new_inode(PEXT2_FILESYS fs, ULONG dir, int mode, PEXT2_INODE_BITMAP map, ULONG *ret)
NTSTATUS Ext2LockVolume(PEXT2_FILESYS Ext2Sys)
bool write_inode_tables(PEXT2_FILESYS fs)
NTSTATUS Ext2CloseDevice(PEXT2_FILESYS Ext2Sys)
struct _ext2fs_bitmap EXT2_BITMAP
static WCHAR no[MAX_STRING_RESOURCE_LEN]
ULONGLONG bmap(struct inode *i, ULONGLONG b)
GLenum const GLvoid * addr
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
PEXT2_SUPER_BLOCK ext2_sb
DISK_GEOMETRY DiskGeometry
unsigned long inode_blocks_per_group
PARTITION_INFORMATION PartInfo
PEXT2_BLOCK_BITMAP block_map
PEXT2_INODE_BITMAP inode_map
EXT2_BADBLK_LIST badblocks
unsigned long desc_blocks
PEXT2_GROUP_DESC group_desc
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
static unsigned int block