Import the FFS driver by Jae-Hong Lee.
Patch by Peter Hater
CORE-11040
svn path=/trunk/; revision=71425
add_subdirectory(ext2)
add_subdirectory(fastfat)
#add_subdirectory(fastfat_new)
+add_subdirectory(ffs)
add_subdirectory(fs_rec)
add_subdirectory(msfs)
add_subdirectory(mup)
--- /dev/null
+include_directories(${REACTOS_SOURCE_DIR}/include/reactos/drivers
+ inc)
+
+list(APPEND SOURCE
+ src/block.c
+ src/cleanup.c
+ src/close.c
+ src/cmcb.c
+ src/create.c
+ src/debug.c
+ src/devctl.c
+ src/dirctl.c
+ src/dispatch.c
+ src/except.c
+ src/fastio.c
+ src/ffs.c
+ src/fileinfo.c
+ src/flush.c
+ src/fsctl.c
+ src/init.c
+ src/lock.c
+ src/memory.c
+ src/misc.c
+ src/pnp.c
+ src/read.c
+ src/shutdown.c
+ src/volinfo.c
+ src/write.c
+ inc/ffsdrv.h)
+
+add_library(ffs SHARED ${SOURCE} src/ffsdrv.rc)
+
+if(NOT MSVC)
+ add_target_compile_flags(ffs "-Wno-pointer-sign -Wno-unused-function")
+ if(NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ add_target_compile_flags(ffs "-Wno-unused-but-set-variable -Wno-unused-variable -Wno-missing-braces")
+ endif()
+#else()
+# replace_compile_flags("/we\"4189\"" " ")
+endif()
+
+add_definitions(-D__KERNEL__)
+set_module_type(ffs kernelmodedriver)
+target_link_libraries(ffs memcmp ${PSEH_LIB})
+add_importlibs(ffs ntoskrnl hal)
+add_pch(ffs inc/ffsdrv.h SOURCE)
+add_cd_file(TARGET ffs DESTINATION reactos/system32/drivers NO_CAB FOR all)
+
--- /dev/null
+/* $NetBSD: bootblock.h,v 1.24 2004/03/22 07:11:00 lukem Exp $ */
+
+/*-
+ * Copyright (c) 2002-2004 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*-
+ * Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
+ * Michael L. Finch, Bradley A. Grantham, and
+ * Lawrence A. Kesteloot
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the Alice Group.
+ * 4. The names of the Alice Group or any of its members may not be used
+ * to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/*
+ * Copyright (c) 1994, 1999 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Copyright (c) 1994 Rolf Grossmann
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Rolf Grossmann.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_BOOTBLOCK_H
+#define _SYS_BOOTBLOCK_H
+
+#include "type.h"
+
+#if 0 /* XXX ffsdrv */
+#if !defined(__ASSEMBLER__)
+#if defined(_KERNEL) || defined(_STANDALONE)
+#include <sys/stdint.h>
+#else
+#include <stdint.h>
+#endif
+#endif /* !defined(__ASSEMBLER__) */
+#endif
+
+/* ------------------------------------------
+ * MBR (Master Boot Record) --
+ * definitions for systems that use MBRs
+ */
+
+/*
+ * Layout of boot records:
+ *
+ * Byte range Use Description
+ * ---------- --- -----------
+ *
+ * 0 - 2 FMP JMP xxx, NOP
+ * 3 - 10 FP OEM Name
+ *
+ * 11 - 61 FMP FAT12/16 BPB
+ * Whilst not strictly necessary for MBR,
+ * GRUB reserves this area
+ *
+ * 11 - 89 P FAT32 BPB
+ * (are we ever going to boot off this?)
+ *
+ *
+ * 62 - 217 FMP Boot code
+ *
+ * 90 - 217 P FAT32 boot code
+ *
+ * 218 - 223 M Win95b/98/me "drive time"
+ * http://www.geocities.com/thestarman3/asm/mbr/95BMEMBR.htm#MYST
+ * only changed if all 6 bytes are 0
+ *
+ * 224 - 436 FMP boot code (continued)
+ *
+ * 437 - 439 M WinNT/2K/XP MBR "boot language"
+ * http://www.geocities.com/thestarman3/asm/mbr/Win2kmbr.htm
+ * not needed by us
+ *
+ * 400 - 439 MP NetBSD: mbr_bootsel
+ *
+ * 440 - 443 M WinNT/2K/XP Drive Serial Number (NT DSN)
+ * http://www.geocities.com/thestarman3/asm/mbr/Win2kmbr.htm
+ *
+ * 444 - 445 FMP bootcode or unused
+ * NetBSD: mbr_bootsel_magic
+ *
+ * 446 - 509 M partition table
+ *
+ * 510 - 511 FMP magic number (0xAA55)
+ *
+ * Use:
+ * ----
+ * F Floppy boot sector
+ * M Master Boot Record
+ * P Partition Boot record
+ *
+ */
+
+/*
+ * MBR (Master Boot Record)
+ */
+#define MBR_BBSECTOR 0 /* MBR relative sector # */
+#define MBR_BPB_OFFSET 11 /* offsetof(mbr_sector, mbr_bpb) */
+#define MBR_BOOTCODE_OFFSET 90 /* offsetof(mbr_sector, mbr_bootcode) */
+#define MBR_BS_OFFSET 400 /* offsetof(mbr_sector, mbr_bootsel) */
+#define MBR_DSN_OFFSET 440 /* offsetof(mbr_sector, mbr_dsn) */
+#define MBR_BS_MAGIC_OFFSET 444 /* offsetof(mbr_sector, mbr_bootsel_magic) */
+#define MBR_PART_OFFSET 446 /* offsetof(mbr_sector, mbr_part[0]) */
+#define MBR_MAGIC_OFFSET 510 /* offsetof(mbr_sector, mbr_magic) */
+#define MBR_MAGIC 0xaa55 /* MBR magic number */
+#define MBR_BS_MAGIC 0xb5e1 /* mbr_bootsel magic number */
+#define MBR_PART_COUNT 4 /* Number of partitions in MBR */
+#define MBR_BS_PARTNAMESIZE 8 /* Size of name mbr_bootsel nametab */
+ /* (excluding trailing NUL) */
+
+ /* values for mbr_partition.mbrp_flag */
+#define MBR_PFLAG_ACTIVE 0x80 /* The active partition */
+
+ /* values for mbr_partition.mbrp_type */
+#define MBR_PTYPE_FAT12 0x01 /* 12-bit FAT */
+#define MBR_PTYPE_FAT16S 0x04 /* 16-bit FAT, less than 32M */
+#define MBR_PTYPE_EXT 0x05 /* extended partition */
+#define MBR_PTYPE_FAT16B 0x06 /* 16-bit FAT, more than 32M */
+#define MBR_PTYPE_NTFS 0x07 /* OS/2 HPFS, NTFS, QNX2, Adv. UNIX */
+#define MBR_PTYPE_FAT32 0x0b /* 32-bit FAT */
+#define MBR_PTYPE_FAT32L 0x0c /* 32-bit FAT, LBA-mapped */
+#define MBR_PTYPE_FAT16L 0x0e /* 16-bit FAT, LBA-mapped */
+#define MBR_PTYPE_EXT_LBA 0x0f /* extended partition, LBA-mapped */
+#define MBR_PTYPE_ONTRACK 0x54
+#define MBR_PTYPE_LNXSWAP 0x82 /* Linux swap or Solaris */
+#define MBR_PTYPE_LNXEXT2 0x83 /* Linux native */
+#define MBR_PTYPE_EXT_LNX 0x85 /* Linux extended partition */
+#define MBR_PTYPE_NTFSVOL 0x87 /* NTFS volume set or HPFS mirrored */
+#define MBR_PTYPE_PREP 0x41 /* PReP */
+#define MBR_PTYPE_386BSD 0xa5 /* 386BSD partition type */
+#define MBR_PTYPE_APPLEUFS 0xa8 /* Apple UFS */
+#define MBR_PTYPE_NETBSD 0xa9 /* NetBSD partition type */
+#define MBR_PTYPE_OPENBSD 0xa6 /* OpenBSD partition type */
+
+#define MBR_PSECT(s) ((s) & 0x3f)
+#define MBR_PCYL(c, s) ((c) + (((s) & 0xc0) << 2))
+
+#define MBR_IS_EXTENDED(x) ((x) == MBR_PTYPE_EXT || \
+ (x) == MBR_PTYPE_EXT_LBA || \
+ (x) == MBR_PTYPE_EXT_LNX)
+
+ /* values for mbr_bootsel.mbrbs_flags */
+#define MBR_BS_ACTIVE 0x01 /* Bootselector active (or code present) */
+#define MBR_BS_EXTINT13 0x02 /* Set by fdisk if LBA needed (deprecated) */
+#define MBR_BS_READ_LBA 0x04 /* Force LBA reads - even for low numbers */
+#define MBR_BS_EXTLBA 0x08 /* Extended ptn capable (LBA reads) */
+#define MBR_BS_NEWMBR 0x80 /* New bootsel at offset 440 */
+
+#if !defined(__ASSEMBLER__) /* { */
+
+#pragma pack(1)
+
+/*
+ * (x86) BIOS Parameter Block for FAT12
+ */
+struct mbr_bpbFAT12 {
+ uint16_t bpbBytesPerSec; /* bytes per sector */
+ uint8_t bpbSecPerClust; /* sectors per cluster */
+ uint16_t bpbResSectors; /* number of reserved sectors */
+ uint8_t bpbFATs; /* number of FATs */
+ uint16_t bpbRootDirEnts; /* number of root directory entries */
+ uint16_t bpbSectors; /* total number of sectors */
+ uint8_t bpbMedia; /* media descriptor */
+ uint16_t bpbFATsecs; /* number of sectors per FAT */
+ uint16_t bpbSecPerTrack; /* sectors per track */
+ uint16_t bpbHeads; /* number of heads */
+ uint16_t bpbHiddenSecs; /* # of hidden sectors */
+}; /* __attribute__((__packed__)); */
+
+/*
+ * (x86) BIOS Parameter Block for FAT16
+ */
+struct mbr_bpbFAT16 {
+ uint16_t bpbBytesPerSec; /* bytes per sector */
+ uint8_t bpbSecPerClust; /* sectors per cluster */
+ uint16_t bpbResSectors; /* number of reserved sectors */
+ uint8_t bpbFATs; /* number of FATs */
+ uint16_t bpbRootDirEnts; /* number of root directory entries */
+ uint16_t bpbSectors; /* total number of sectors */
+ uint8_t bpbMedia; /* media descriptor */
+ uint16_t bpbFATsecs; /* number of sectors per FAT */
+ uint16_t bpbSecPerTrack; /* sectors per track */
+ uint16_t bpbHeads; /* number of heads */
+ uint32_t bpbHiddenSecs; /* # of hidden sectors */
+ uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
+ uint8_t bsDrvNum; /* Int 0x13 drive number (e.g. 0x80) */
+ uint8_t bsReserved1; /* Reserved; set to 0 */
+ uint8_t bsBootSig; /* 0x29 if next 3 fields are present */
+ uint8_t bsVolID[4]; /* Volume serial number */
+ uint8_t bsVolLab[11]; /* Volume label */
+ uint8_t bsFileSysType[8];
+ /* "FAT12 ", "FAT16 ", "FAT " */
+}; /* __attribute__((__packed__)); */
+
+/*
+ * (x86) BIOS Parameter Block for FAT32
+ */
+struct mbr_bpbFAT32 {
+ uint16_t bpbBytesPerSec; /* bytes per sector */
+ uint8_t bpbSecPerClust; /* sectors per cluster */
+ uint16_t bpbResSectors; /* number of reserved sectors */
+ uint8_t bpbFATs; /* number of FATs */
+ uint16_t bpbRootDirEnts; /* number of root directory entries */
+ uint16_t bpbSectors; /* total number of sectors */
+ uint8_t bpbMedia; /* media descriptor */
+ uint16_t bpbFATsecs; /* number of sectors per FAT */
+ uint16_t bpbSecPerTrack; /* sectors per track */
+ uint16_t bpbHeads; /* number of heads */
+ uint32_t bpbHiddenSecs; /* # of hidden sectors */
+ uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
+ uint32_t bpbBigFATsecs; /* like bpbFATsecs for FAT32 */
+ uint16_t bpbExtFlags; /* extended flags: */
+#define MBR_FAT32_FATNUM 0x0F /* mask for numbering active FAT */
+#define MBR_FAT32_FATMIRROR 0x80 /* FAT is mirrored (as previously) */
+ uint16_t bpbFSVers; /* filesystem version */
+#define MBR_FAT32_FSVERS 0 /* currently only 0 is understood */
+ uint32_t bpbRootClust; /* start cluster for root directory */
+ uint16_t bpbFSInfo; /* filesystem info structure sector */
+ uint16_t bpbBackup; /* backup boot sector */
+ uint8_t bsReserved[12]; /* Reserved for future expansion */
+ uint8_t bsDrvNum; /* Int 0x13 drive number (e.g. 0x80) */
+ uint8_t bsReserved1; /* Reserved; set to 0 */
+ uint8_t bsBootSig; /* 0x29 if next 3 fields are present */
+ uint8_t bsVolID[4]; /* Volume serial number */
+ uint8_t bsVolLab[11]; /* Volume label */
+ uint8_t bsFileSysType[8]; /* "FAT32 " */
+}; /* __attribute__((__packed__)); */
+
+/*
+ * (x86) MBR boot selector
+ */
+struct mbr_bootsel {
+ uint8_t mbrbs_defkey;
+ uint8_t mbrbs_flags;
+ uint16_t mbrbs_timeo;
+ uint8_t mbrbs_nametab[MBR_PART_COUNT][MBR_BS_PARTNAMESIZE + 1];
+}; /* __attribute__((__packed__)); */
+
+/*
+ * MBR partition
+ */
+struct mbr_partition {
+ uint8_t mbrp_flag; /* MBR partition flags */
+ uint8_t mbrp_shd; /* Starting head */
+ uint8_t mbrp_ssect; /* Starting sector */
+ uint8_t mbrp_scyl; /* Starting cylinder */
+ uint8_t mbrp_type; /* Partition type (see below) */
+ uint8_t mbrp_ehd; /* End head */
+ uint8_t mbrp_esect; /* End sector */
+ uint8_t mbrp_ecyl; /* End cylinder */
+ uint32_t mbrp_start; /* Absolute starting sector number */
+ uint32_t mbrp_size; /* Partition size in sectors */
+}; /* __attribute__((__packed__)); */
+
+int xlat_mbr_fstype(int); /* in sys/lib/libkern/xlat_mbr_fstype.c */
+
+/*
+ * MBR boot sector.
+ * This is used by both the MBR (Master Boot Record) in sector 0 of the disk
+ * and the PBR (Partition Boot Record) in sector 0 of an MBR partition.
+ */
+struct mbr_sector {
+ /* Jump instruction to boot code. */
+ /* Usually 0xE9nnnn or 0xEBnn90 */
+ uint8_t mbr_jmpboot[3];
+ /* OEM name and version */
+ uint8_t mbr_oemname[8];
+ union { /* BIOS Parameter Block */
+ struct mbr_bpbFAT12 bpb12;
+ struct mbr_bpbFAT16 bpb16;
+ struct mbr_bpbFAT32 bpb32;
+ } mbr_bpb;
+ /* Boot code */
+ uint8_t mbr_bootcode[310];
+ /* Config for /usr/mdec/mbr_bootsel */
+ struct mbr_bootsel mbr_bootsel;
+ /* NT Drive Serial Number */
+ uint32_t mbr_dsn;
+ /* mbr_bootsel magic */
+ uint16_t mbr_bootsel_magic;
+ /* MBR partition table */
+ struct mbr_partition mbr_parts[MBR_PART_COUNT];
+ /* MBR magic (0xaa55) */
+ uint16_t mbr_magic;
+}; /* __attribute__((__packed__)); */
+
+#endif /* !defined(__ASSEMBLER__) */ /* } */
+
+#pragma pack()
+
+
+/* ------------------------------------------
+ * shared --
+ * definitions shared by many platforms
+ */
+
+#if !defined(__ASSEMBLER__) /* { */
+
+ /* Maximum # of blocks in bbi_block_table, each bbi_block_size long */
+#define SHARED_BBINFO_MAXBLOCKS 118 /* so sizeof(shared_bbinfo) == 512 */
+
+struct shared_bbinfo {
+ uint8_t bbi_magic[32];
+ int32_t bbi_block_size;
+ int32_t bbi_block_count;
+ int32_t bbi_block_table[SHARED_BBINFO_MAXBLOCKS];
+};
+
+#if 0 /* XXX ffsdrv */
+
+/* ------------------------------------------
+ * alpha --
+ * Alpha (disk, but also tape) Boot Block.
+ *
+ * See Section (III) 3.6.1 of the Alpha Architecture Reference Manual.
+ */
+
+struct alpha_boot_block {
+ uint64_t bb_data[63]; /* data (disklabel, also as below) */
+ uint64_t bb_cksum; /* checksum of the boot block,
+ * taken as uint64_t's
+ */
+};
+#define bb_secsize bb_data[60] /* secondary size (blocks) */
+#define bb_secstart bb_data[61] /* secondary start (blocks) */
+#define bb_flags bb_data[62] /* unknown flags (set to zero) */
+
+#define ALPHA_BOOT_BLOCK_OFFSET 0 /* offset of boot block. */
+#define ALPHA_BOOT_BLOCK_BLOCKSIZE 512 /* block size for sector
+ * size/start, and for boot
+ * block itself.
+ */
+
+#define ALPHA_BOOT_BLOCK_CKSUM(bb,cksum) \
+ do { \
+ const struct alpha_boot_block *_bb = (bb); \
+ uint64_t _cksum; \
+ int _i; \
+ \
+ _cksum = 0; \
+ for (_i = 0; \
+ _i < (sizeof _bb->bb_data / sizeof _bb->bb_data[0]); \
+ _i++) \
+ _cksum += _bb->bb_data[_i]; \
+ *(cksum) = _cksum; \
+ } while (/*CONSTCOND*/ 0)
+
+/* ------------------------------------------
+ * apple --
+ * Apple computers boot block related information
+ */
+
+/*
+ * Driver Descriptor Map, from Inside Macintosh: Devices, SCSI Manager
+ * pp 12-13. The driver descriptor map always resides on physical block 0.
+ */
+struct apple_drvr_descriptor {
+ uint32_t descBlock; /* first block of driver */
+ uint16_t descSize; /* driver size in blocks */
+ uint16_t descType; /* system type */
+};
+
+/*
+ * system types; Apple reserves 0-15
+ */
+#define APPLE_DRVR_TYPE_MACINTOSH 1
+
+#define APPLE_DRVR_MAP_MAGIC 0x4552
+#define APPLE_DRVR_MAP_MAX_DESCRIPTORS 61
+
+struct apple_drvr_map {
+ uint16_t sbSig; /* map signature */
+ uint16_t sbBlockSize; /* block size of device */
+ uint32_t sbBlkCount; /* number of blocks on device */
+ uint16_t sbDevType; /* (used internally by ROM) */
+ uint16_t sbDevID; /* (used internally by ROM) */
+ uint32_t sbData; /* (used internally by ROM) */
+ uint16_t sbDrvrCount; /* number of driver descriptors */
+ struct apple_drvr_descriptor sb_dd[APPLE_DRVR_MAP_MAX_DESCRIPTORS];
+ uint16_t pad[3];
+} __attribute__((__packed__));
+
+/*
+ * Partition map structure from Inside Macintosh: Devices, SCSI Manager
+ * pp. 13-14. The partition map always begins on physical block 1.
+ *
+ * With the exception of block 0, all blocks on the disk must belong to
+ * exactly one partition. The partition map itself belongs to a partition
+ * of type `APPLE_PARTITION_MAP', and is not limited in size by anything
+ * other than available disk space. The partition map is not necessarily
+ * the first partition listed.
+ */
+#define APPLE_PART_MAP_ENTRY_MAGIC 0x504d
+
+struct apple_part_map_entry {
+ uint16_t pmSig; /* partition signature */
+ uint16_t pmSigPad; /* (reserved) */
+ uint32_t pmMapBlkCnt; /* number of blocks in partition map */
+ uint32_t pmPyPartStart; /* first physical block of partition */
+ uint32_t pmPartBlkCnt; /* number of blocks in partition */
+ uint8_t pmPartName[32]; /* partition name */
+ uint8_t pmPartType[32]; /* partition type */
+ uint32_t pmLgDataStart; /* first logical block of data area */
+ uint32_t pmDataCnt; /* number of blocks in data area */
+ uint32_t pmPartStatus; /* partition status information */
+ uint32_t pmLgBootStart; /* first logical block of boot code */
+ uint32_t pmBootSize; /* size of boot code, in bytes */
+ uint32_t pmBootLoad; /* boot code load address */
+ uint32_t pmBootLoad2; /* (reserved) */
+ uint32_t pmBootEntry; /* boot code entry point */
+ uint32_t pmBootEntry2; /* (reserved) */
+ uint32_t pmBootCksum; /* boot code checksum */
+ int8_t pmProcessor[16]; /* processor type (e.g. "68020") */
+ uint8_t pmBootArgs[128]; /* A/UX boot arguments */
+ uint8_t pad[248]; /* pad to end of block */
+};
+
+#define APPLE_PART_TYPE_DRIVER "APPLE_DRIVER"
+#define APPLE_PART_TYPE_DRIVER43 "APPLE_DRIVER43"
+#define APPLE_PART_TYPE_DRIVERATA "APPLE_DRIVER_ATA"
+#define APPLE_PART_TYPE_DRIVERIOKIT "APPLE_DRIVER_IOKIT"
+#define APPLE_PART_TYPE_FWDRIVER "APPLE_FWDRIVER"
+#define APPLE_PART_TYPE_FWB_COMPONENT "FWB DRIVER COMPONENTS"
+#define APPLE_PART_TYPE_FREE "APPLE_FREE"
+#define APPLE_PART_TYPE_MAC "APPLE_HFS"
+#define APPLE_PART_TYPE_NETBSD "NETBSD"
+#define APPLE_PART_TYPE_NBSD_PPCBOOT "NETBSD/MACPPC"
+#define APPLE_PART_TYPE_NBSD_68KBOOT "NETBSD/MAC68K"
+#define APPLE_PART_TYPE_PATCHES "APPLE_PATCHES"
+#define APPLE_PART_TYPE_PARTMAP "APPLE_PARTITION_MAP"
+#define APPLE_PART_TYPE_PATCHES "APPLE_PATCHES"
+#define APPLE_PART_TYPE_SCRATCH "APPLE_SCRATCH"
+#define APPLE_PART_TYPE_UNIX "APPLE_UNIX_SVR2"
+
+/*
+ * "pmBootArgs" for APPLE_UNIX_SVR2 partition.
+ * NetBSD/mac68k only uses Magic, Cluster, Type, and Flags.
+ */
+struct apple_blockzeroblock {
+ uint32_t bzbMagic;
+ uint8_t bzbCluster;
+ uint8_t bzbType;
+ uint16_t bzbBadBlockInode;
+ uint16_t bzbFlags;
+ uint16_t bzbReserved;
+ uint32_t bzbCreationTime;
+ uint32_t bzbMountTime;
+ uint32_t bzbUMountTime;
+};
+
+#define APPLE_BZB_MAGIC 0xABADBABE
+#define APPLE_BZB_TYPEFS 1
+#define APPLE_BZB_TYPESWAP 3
+#define APPLE_BZB_ROOTFS 0x8000
+#define APPLE_BZB_USRFS 0x4000
+
+/* ------------------------------------------
+ * hp300
+ *
+ */
+
+/* volume header for "LIF" format volumes */
+
+struct hp300_lifvol {
+ int16_t vol_id;
+ char vol_label[6];
+ int32_t vol_addr;
+ int16_t vol_oct;
+ int16_t vol_dummy;
+ int32_t vol_dirsize;
+ int16_t vol_version;
+ int16_t vol_zero;
+ int32_t vol_huh1;
+ int32_t vol_huh2;
+ int32_t vol_length;
+};
+
+/* LIF directory entry format */
+
+struct hp300_lifdir {
+ char dir_name[10];
+ int16_t dir_type;
+ int32_t dir_addr;
+ int32_t dir_length;
+ char dir_toc[6];
+ int16_t dir_flag;
+ int32_t dir_exec;
+};
+
+/* load header for boot rom */
+struct hp300_load {
+ int32_t address;
+ int32_t count;
+};
+
+#define HP300_VOL_ID -32768
+#define HP300_VOL_OCT 4096
+#define HP300_DIR_TYPE -5822
+#define HP300_DIR_FLAG 0x8001 /* dont ask me! */
+#define HP300_SECTSIZE 256
+
+#endif
+
+/* ------------------------------------------
+ * x86
+ *
+ */
+
+/*
+ * Parameters for NetBSD /boot written to start of pbr code by installboot
+ */
+
+struct x86_boot_params {
+ uint32_t bp_length; /* length of patchable data */
+ uint32_t bp_flags;
+ uint32_t bp_timeout; /* boot timeout in seconds */
+ uint32_t bp_consdev;
+ uint32_t bp_conspeed;
+ uint8_t bp_password[16]; /* md5 hash of password */
+ char bp_keymap[16]; /* keyboard traslation map */
+};
+
+#endif /* !defined(__ASSEMBLER__) */ /* } */
+
+#define X86_BOOT_MAGIC(n) ('x' << 24 | 0x86b << 12 | 'm' << 4 | (n))
+#define X86_BOOT_MAGIC_1 X86_BOOT_MAGIC(1) /* pbr.S */
+#define X86_BOOT_MAGIC_2 X86_BOOT_MAGIC(2) /* bootxx.S */
+#define X86_BOOT_MAGIC_PXE X86_BOOT_MAGIC(3) /* start_pxe.S */
+
+ /* values for bp_flags */
+#define X86_BP_FLAGS_RESET_VIDEO 1
+#define X86_BP_FLAGS_PASSWORD 2
+
+ /* values for bp_consdev */
+#define X86_BP_CONSDEV_PC 0
+#define X86_BP_CONSDEV_COM0 1
+#define X86_BP_CONSDEV_COM1 2
+#define X86_BP_CONSDEV_COM2 3
+#define X86_BP_CONSDEV_COM3 4
+#define X86_BP_CONSDEV_COM0KBD 5
+#define X86_BP_CONSDEV_COM1KBD 6
+#define X86_BP_CONSDEV_COM2KBD 7
+#define X86_BP_CONSDEV_COM3KBD 8
+
+#if !defined(__ASSEMBLER__) /* { */
+
+#if 0 /* XXX ffsdrv */
+/* ------------------------------------------
+ * macppc
+ */
+
+#define MACPPC_BOOT_BLOCK_OFFSET 2048
+#define MACPPC_BOOT_BLOCK_BLOCKSIZE 512
+#define MACPPC_BOOT_BLOCK_MAX_SIZE 2048 /* XXX: could be up to 6144 */
+ /* Magic string -- 32 bytes long (including the NUL) */
+#define MACPPC_BBINFO_MAGIC "NetBSD/macppc bootxx 20020515"
+
+/* ------------------------------------------
+ * news68k, newsmips
+ */
+
+#define NEWS_BOOT_BLOCK_LABELOFFSET 64 /* XXX from <machine/disklabel.h> */
+#define NEWS_BOOT_BLOCK_OFFSET 0
+#define NEWS_BOOT_BLOCK_BLOCKSIZE 512
+#define NEWS_BOOT_BLOCK_MAX_SIZE (512 * 16)
+
+ /* Magic string -- 32 bytes long (including the NUL) */
+#define NEWS68K_BBINFO_MAGIC "NetBSD/news68k bootxx 20020518"
+#define NEWSMIPS_BBINFO_MAGIC "NetBSD/newsmips bootxx 20020518"
+
+/* ------------------------------------------
+ * next68k
+ */
+
+#define NEXT68K_LABEL_MAXPARTITIONS 8 /* number of partitions in next68k_disklabel */
+#define NEXT68K_LABEL_CPULBLLEN 24
+#define NEXT68K_LABEL_MAXDNMLEN 24
+#define NEXT68K_LABEL_MAXTYPLEN 24
+#define NEXT68K_LABEL_MAXBFLEN 24
+#define NEXT68K_LABEL_MAXHNLEN 32
+#define NEXT68K_LABEL_MAXMPTLEN 16
+#define NEXT68K_LABEL_MAXFSTLEN 8
+#define NEXT68K_LABEL_NBAD 1670 /* sized to make label ~= 8KB */
+
+struct next68k_partition {
+ int32_t cp_offset; /* starting sector */
+ int32_t cp_size; /* number of sectors in partition */
+ int16_t cp_bsize; /* block size in bytes */
+ int16_t cp_fsize; /* filesystem basic fragment size */
+ char cp_opt; /* optimization type: 's'pace/'t'ime */
+ char cp_pad1;
+ int16_t cp_cpg; /* filesystem cylinders per group */
+ int16_t cp_density; /* bytes per inode density */
+ int8_t cp_minfree; /* minfree (%) */
+ int8_t cp_newfs; /* run newfs during init */
+ char cp_mountpt[NEXT68K_LABEL_MAXMPTLEN];
+ /* default/standard mount point */
+ int8_t cp_automnt; /* auto-mount when inserted */
+ char cp_type[NEXT68K_LABEL_MAXFSTLEN]; /* file system type name */
+ char cp_pad2;
+} __attribute__ ((packed));
+
+/* The disklabel the way it is on the disk */
+struct next68k_disklabel {
+ int32_t cd_version; /* label version */
+ int32_t cd_label_blkno; /* block # of this label */
+ int32_t cd_size; /* size of media area (sectors) */
+ char cd_label[NEXT68K_LABEL_CPULBLLEN]; /* disk name (label) */
+ uint32_t cd_flags; /* flags */
+ uint32_t cd_tag; /* volume tag */
+ char cd_name[NEXT68K_LABEL_MAXDNMLEN]; /* drive (hardware) name */
+ char cd_type[NEXT68K_LABEL_MAXTYPLEN]; /* drive type */
+ int32_t cd_secsize; /* # of bytes per sector */
+ int32_t cd_ntracks; /* # of tracks per cylinder */
+ int32_t cd_nsectors; /* # of data sectors per track */
+ int32_t cd_ncylinders; /* # of data cylinders per unit */
+ int32_t cd_rpm; /* rotational speed */
+ int16_t cd_front; /* # of sectors in "front porch" */
+ int16_t cd_back; /* # of sectors in "back porch" */
+ int16_t cd_ngroups; /* # of alt groups */
+ int16_t cd_ag_size; /* alt group size (sectors) */
+ int16_t cd_ag_alts; /* alternate sectors / alt group */
+ int16_t cd_ag_off; /* sector offset to first alternate */
+ int32_t cd_boot_blkno[2]; /* boot program locations */
+ char cd_kernel[NEXT68K_LABEL_MAXBFLEN]; /* default kernel name */
+ char cd_hostname[NEXT68K_LABEL_MAXHNLEN];
+ /* host name (usu. where disk was labeled) */
+ char cd_rootpartition; /* root partition letter e.g. 'a' */
+ char cd_rwpartition; /* r/w partition letter e.g. 'b' */
+ struct next68k_partition cd_partitions[NEXT68K_LABEL_MAXPARTITIONS];
+
+ union {
+ uint16_t CD_v3_checksum; /* label version 3 checksum */
+ int32_t CD_bad[NEXT68K_LABEL_NBAD];
+ /* block number that is bad */
+ } cd_un;
+ uint16_t cd_checksum; /* label version 1 or 2 checksum */
+} __attribute__ ((packed));
+
+#define NEXT68K_LABEL_cd_checksum cd_checksum
+#define NEXT68K_LABEL_cd_v3_checksum cd_un.CD_v3_checksum
+#define NEXT68K_LABEL_cd_bad cd_un.CD_bad
+
+#define NEXT68K_LABEL_SECTOR 0 /* sector containing label */
+#define NEXT68K_LABEL_OFFSET 0 /* offset of label in sector */
+#define NEXT68K_LABEL_SIZE 8192 /* size of label */
+#define NEXT68K_LABEL_CD_V1 0x4e655854 /* version #1: "NeXT" */
+#define NEXT68K_LABEL_CD_V2 0x646c5632 /* version #2: "dlV2" */
+#define NEXT68K_LABEL_CD_V3 0x646c5633 /* version #3: "dlV3" */
+#define NEXT68K_LABEL_DEFAULTFRONTPORCH (160 * 2)
+#define NEXT68K_LABEL_DEFAULTBOOT0_1 (32 * 2)
+#define NEXT68K_LABEL_DEFAULTBOOT0_2 (96 * 2)
+
+/* ------------------------------------------
+ * pmax --
+ * PMAX (DECstation / MIPS) boot block information
+ */
+
+/*
+ * If mode is 0, there is just one sequence of blocks and one Dec_BootMap
+ * is used. If mode is 1, there are multiple sequences of blocks
+ * and multiple Dec_BootMaps are used, the last with numBlocks = 0.
+ */
+struct pmax_boot_map {
+ int32_t num_blocks; /* Number of blocks to read. */
+ int32_t start_block; /* Starting block on disk. */
+};
+
+/*
+ * This is the structure of a disk or tape boot block. The boot_map
+ * can either be a single boot count and start block (contiguous mode)
+ * or a list of up to 61 (to fill a 512 byte sector) block count and
+ * start block pairs. Under NetBSD, contiguous mode is always used.
+ */
+struct pmax_boot_block {
+ uint8_t pad[8];
+ int32_t magic; /* PMAX_BOOT_MAGIC */
+ int32_t mode; /* Mode for boot info. */
+ uint32_t load_addr; /* Address to start loading. */
+ uint32_t exec_addr; /* Address to start execing. */
+ struct pmax_boot_map map[61]; /* boot program section(s). */
+} __attribute__((__packed__));
+
+#define PMAX_BOOT_MAGIC 0x0002757a
+#define PMAX_BOOTMODE_CONTIGUOUS 0
+#define PMAX_BOOTMODE_SCATTERED 1
+
+#define PMAX_BOOT_BLOCK_OFFSET 0
+#define PMAX_BOOT_BLOCK_BLOCKSIZE 512
+
+
+/* ------------------------------------------
+ * sparc
+ */
+
+#define SPARC_BOOT_BLOCK_OFFSET 512
+#define SPARC_BOOT_BLOCK_BLOCKSIZE 512
+#define SPARC_BOOT_BLOCK_MAX_SIZE (512 * 15)
+ /* Magic string -- 32 bytes long (including the NUL) */
+#define SPARC_BBINFO_MAGIC "NetBSD/sparc bootxx 20020515"
+
+
+/* ------------------------------------------
+ * sparc64
+ */
+
+#define SPARC64_BOOT_BLOCK_OFFSET 512
+#define SPARC64_BOOT_BLOCK_BLOCKSIZE 512
+#define SPARC64_BOOT_BLOCK_MAX_SIZE (512 * 15)
+
+
+/* ------------------------------------------
+ * sun68k (sun2, sun3)
+ */
+
+#define SUN68K_BOOT_BLOCK_OFFSET 512
+#define SUN68K_BOOT_BLOCK_BLOCKSIZE 512
+#define SUN68K_BOOT_BLOCK_MAX_SIZE (512 * 15)
+ /* Magic string -- 32 bytes long (including the NUL) */
+#define SUN68K_BBINFO_MAGIC "NetBSD/sun68k bootxx 20020515"
+
+
+/* ------------------------------------------
+ * vax --
+ * VAX boot block information
+ */
+
+struct vax_boot_block {
+/* Note that these don't overlap any of the pmax boot block */
+ uint8_t pad0[2];
+ uint8_t bb_id_offset; /* offset in words to id (magic1)*/
+ uint8_t bb_mbone; /* must be one */
+ uint16_t bb_lbn_hi; /* lbn (hi word) of bootstrap */
+ uint16_t bb_lbn_low; /* lbn (low word) of bootstrap */
+ uint8_t pad1[332];
+
+ /* The rest of these fields are identification area and describe
+ * the secondary block for uVAX VMB.
+ */
+ uint8_t bb_magic1; /* magic number */
+ uint8_t bb_mbz1; /* must be zero */
+ uint8_t bb_pad1; /* any value */
+ uint8_t bb_sum1; /* ~(magic1 + mbz1 + pad1) */
+
+ uint8_t bb_mbz2; /* must be zero */
+ uint8_t bb_volinfo; /* volinfo */
+ uint8_t bb_pad2a; /* any value */
+ uint8_t bb_pad2b; /* any value */
+
+ uint32_t bb_size; /* size in blocks of bootstrap */
+ uint32_t bb_load; /* load offset to bootstrap */
+ uint32_t bb_entry; /* byte offset in bootstrap */
+ uint32_t bb_sum3; /* sum of previous 3 fields */
+
+ /* The rest is unused.
+ */
+ uint8_t pad2[148];
+} __attribute__((__packed__));
+
+#define VAX_BOOT_MAGIC1 0x18 /* size of BB info? */
+#define VAX_BOOT_VOLINFO_NONE 0x00 /* no special info */
+#define VAX_BOOT_VOLINFO_SS 0x01 /* single sided */
+#define VAX_BOOT_VOLINFO_DS 0x81 /* double sided */
+
+#define VAX_BOOT_SIZE 15 /* 15 blocks */
+#define VAX_BOOT_LOAD 0 /* no load offset */
+#define VAX_BOOT_ENTRY 0x200 /* one block in */
+
+#define VAX_BOOT_BLOCK_OFFSET 0
+#define VAX_BOOT_BLOCK_BLOCKSIZE 512
+
+
+/* ------------------------------------------
+ * x68k
+ */
+
+#define X68K_BOOT_BLOCK_OFFSET 0
+#define X68K_BOOT_BLOCK_BLOCKSIZE 512
+#define X68K_BOOT_BLOCK_MAX_SIZE (512 * 16)
+ /* Magic string -- 32 bytes long (including the NUL) */
+#define X68K_BBINFO_MAGIC "NetBSD/x68k bootxx 20020601"
+
+#endif /* !defined(__ASSEMBLER__) */ /* } */
+
+#endif
+
+#endif /* !_SYS_BOOTBLOCK_H */
--- /dev/null
+/* $NetBSD: dinode.h,v 1.18 2003/08/07 16:34:42 agc Exp $ */
+
+/*
+ * Copyright (c) 2002 Networks Associates Technology, Inc.
+ * All rights reserved.
+ *
+ * This software was developed for the FreeBSD Project by Marshall
+ * Kirk McKusick and Network Associates Laboratories, the Security
+ * Research Division of Network Associates, Inc. under DARPA/SPAWAR
+ * contract N66001-01-C-8035 ("CBOSS"), as part of the DARPA CHATS
+ * research program
+ *
+ * Copyright (c) 1982, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)dinode.h 8.9 (Berkeley) 3/29/95
+ */
+
+#ifndef _UFS_UFS_DINODE_H_
+#define _UFS_UFS_DINODE_H_
+
+#include "type.h"
+
+/*
+ * The root inode is the root of the file system. Inode 0 can't be used for
+ * normal purposes and historically bad blocks were linked to inode 1, thus
+ * the root inode is 2. (Inode 1 is no longer used for this purpose, however
+ * numerous dump tapes make this assumption, so we are stuck with it).
+ */
+#define ROOTINO ((ino_t)2)
+
+/*
+ * The Whiteout inode# is a dummy non-zero inode number which will
+ * never be allocated to a real file. It is used as a place holder
+ * in the directory entry which has been tagged as a DT_W entry.
+ * See the comments about ROOTINO above.
+ */
+#define WINO ((ino_t)1)
+
+/*
+ * A dinode contains all the meta-data associated with a UFS file.
+ * This structure defines the on-disk format of a dinode. Since
+ * this structure describes an on-disk structure, all its fields
+ * are defined by types with precise widths.
+ */
+
+#define NXADDR 2
+#define NDADDR 12 /* Direct addresses in inode. */
+#define NIADDR 3 /* Indirect addresses in inode. */
+
+struct ufs1_dinode {
+ u_int16_t di_mode; /* 0: IFMT, permissions; see below. */
+ int16_t di_nlink; /* 2: File link count. */
+ union {
+ u_int16_t oldids[2]; /* 4: Ffs: old user and group ids. */
+ u_int32_t inumber; /* 4: Lfs: inode number. */
+ } di_u;
+ u_int64_t di_size; /* 8: File byte count. */
+ int32_t di_atime; /* 16: Last access time. */
+ int32_t di_atimensec; /* 20: Last access time. */
+ int32_t di_mtime; /* 24: Last modified time. */
+ int32_t di_mtimensec; /* 28: Last modified time. */
+ int32_t di_ctime; /* 32: Last inode change time. */
+ int32_t di_ctimensec; /* 36: Last inode change time. */
+ int32_t di_db[NDADDR]; /* 40: Direct disk blocks. */
+ int32_t di_ib[NIADDR]; /* 88: Indirect disk blocks. */
+ u_int32_t di_flags; /* 100: Status flags (chflags). */
+ u_int32_t di_blocks; /* 104: Blocks actually held. */
+ int32_t di_gen; /* 108: Generation number. */
+ u_int32_t di_uid; /* 112: File owner. */
+ u_int32_t di_gid; /* 116: File group. */
+ int32_t di_spare[2]; /* 120: Reserved; currently unused */
+};
+
+struct ufs2_dinode {
+ u_int16_t di_mode; /* 0: IFMT, permissions; see below. */
+ int16_t di_nlink; /* 2: File link count. */
+ u_int32_t di_uid; /* 4: File owner. */
+ u_int32_t di_gid; /* 8: File group. */
+ u_int32_t di_blksize; /* 12: Inode blocksize. */
+ u_int64_t di_size; /* 16: File byte count. */
+ u_int64_t di_blocks; /* 24: Bytes actually held. */
+ int64_t di_atime; /* 32: Last access time. */
+ int64_t di_mtime; /* 40: Last modified time. */
+ int64_t di_ctime; /* 48: Last inode change time. */
+ int64_t di_birthtime; /* 56: Inode creation time. */
+ int32_t di_mtimensec; /* 64: Last modified time. */
+ int32_t di_atimensec; /* 68: Last access time. */
+ int32_t di_ctimensec; /* 72: Last inode change time. */
+ int32_t di_birthnsec; /* 76: Inode creation time. */
+ int32_t di_gen; /* 80: Generation number. */
+ u_int32_t di_kernflags; /* 84: Kernel flags. */
+ u_int32_t di_flags; /* 88: Status flags (chflags). */
+ int32_t di_extsize; /* 92: External attributes block. */
+ int64_t di_extb[NXADDR];/* 96: External attributes block. */
+ int64_t di_db[NDADDR]; /* 112: Direct disk blocks. */
+ int64_t di_ib[NIADDR]; /* 208: Indirect disk blocks. */
+ int64_t di_spare[3]; /* 232: Reserved; currently unused */
+};
+
+/*
+ * The di_db fields may be overlaid with other information for
+ * file types that do not have associated disk storage. Block
+ * and character devices overlay the first data block with their
+ * dev_t value. Short symbolic links place their path in the
+ * di_db area.
+ */
+#define di_inumber di_u.inumber
+#define di_ogid di_u.oldids[1]
+#define di_ouid di_u.oldids[0]
+#define di_rdev di_db[0]
+#define MAXSYMLINKLEN_UFS1 ((NDADDR + NIADDR) * sizeof(int32_t))
+#define MAXSYMLINKLEN_UFS2 ((NDADDR + NIADDR) * sizeof(int64_t))
+
+#define MAXSYMLINKLEN(ip) \
+ ((ip)->i_ump->um_fstype == UFS1) ? \
+ MAXSYMLINKLEN_UFS1 : MAXSYMLINKLEN_UFS2
+
+/* NeXT used to keep short symlinks in the inode even when using
+ * FS_42INODEFMT. In that case fs->fs_maxsymlinklen is probably -1,
+ * but short symlinks were stored in inodes shorter than this:
+ */
+#define APPLEUFS_MAXSYMLINKLEN 60
+
+/* File permissions. */
+#define IEXEC 0000100 /* Executable. */
+#define IWRITE 0000200 /* Writable. */
+#define IREAD 0000400 /* Readable. */
+#define ISVTX 0001000 /* Sticky bit. */
+#define ISGID 0002000 /* Set-gid. */
+#define ISUID 0004000 /* Set-uid. */
+
+/* File types. */
+#define IFMT 0170000 /* Mask of file type. */
+#define IFIFO 0010000 /* Named pipe (fifo). */
+#define IFCHR 0020000 /* Character device. */
+#define IFDIR 0040000 /* Directory file. */
+#define IFBLK 0060000 /* Block device. */
+#define IFREG 0100000 /* Regular file. */
+#define IFLNK 0120000 /* Symbolic link. */
+#define IFSOCK 0140000 /* UNIX domain socket. */
+#define IFWHT 0160000 /* Whiteout. */
+
+/* Size of the on-disk inode. */
+#define DINODE1_SIZE (sizeof(struct ufs1_dinode)) /* 128 */
+#define DINODE2_SIZE (sizeof(struct ufs2_dinode))
+
+#endif /* !_UFS_UFS_DINODE_H_ */
--- /dev/null
+/* $NetBSD: dir.h,v 1.17 2003/08/07 16:34:42 agc Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)dir.h 8.5 (Berkeley) 4/27/95
+ */
+
+#ifndef _UFS_UFS_DIR_H_
+#define _UFS_UFS_DIR_H_
+
+#include "type.h"
+
+/*
+ * Theoretically, directories can be more than 2Gb in length, however, in
+ * practice this seems unlikely. So, we define the type doff_t as a 32-bit
+ * quantity to keep down the cost of doing lookup on a 32-bit machine.
+ */
+#define doff_t int32_t
+#define MAXDIRSIZE (0x7fffffff)
+
+/*
+ * A directory consists of some number of blocks of DIRBLKSIZ
+ * bytes, where DIRBLKSIZ is chosen such that it can be transferred
+ * to disk in a single atomic operation (e.g. 512 bytes on most machines).
+ *
+ * Each DIRBLKSIZ byte block contains some number of directory entry
+ * structures, which are of variable length. Each directory entry has
+ * a struct direct at the front of it, containing its inode number,
+ * the length of the entry, and the length of the name contained in
+ * the entry. These are followed by the name padded to a 4 byte boundary.
+ * All names are guaranteed null terminated.
+ * The maximum length of a name in a directory is MAXNAMLEN.
+ *
+ * The macro DIRSIZ(fmt, dp) gives the amount of space required to represent
+ * a directory entry. Free space in a directory is represented by
+ * entries which have dp->d_reclen > DIRSIZ(fmt, dp). All DIRBLKSIZ bytes
+ * in a directory block are claimed by the directory entries. This
+ * usually results in the last entry in a directory having a large
+ * dp->d_reclen. When entries are deleted from a directory, the
+ * space is returned to the previous entry in the same directory
+ * block by increasing its dp->d_reclen. If the first entry of
+ * a directory block is free, then its dp->d_ino is set to 0.
+ * Entries other than the first in a directory do not normally have
+ * dp->d_ino set to 0.
+ */
+#undef DIRBLKSIZ
+#define DIRBLKSIZ DEV_BSIZE
+#undef MAXNAMLEN
+#define MAXNAMLEN 255
+#define APPLEUFS_DIRBLKSIZ 1024
+
+struct direct {
+ u_int32_t d_ino; /* inode number of entry */
+ u_int16_t d_reclen; /* length of this record */
+ u_int8_t d_type; /* file type, see below */
+ u_int8_t d_namlen; /* length of string in d_name */
+ char d_name[MAXNAMLEN + 1];/* name with length <= MAXNAMLEN */
+};
+
+/*
+ * File types
+ */
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+
+/*
+ * Convert between stat structure types and directory types.
+ */
+#define IFTODT(mode) (((mode) & 0170000) >> 12)
+#define DTTOIF(dirtype) ((dirtype) << 12)
+
+/*
+ * The DIRSIZ macro gives the minimum record length which will hold
+ * the directory entry. This requires the amount of space in struct direct
+ * without the d_name field, plus enough space for the name with a terminating
+ * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
+ */
+#define DIRECTSIZ(namlen) \
+ ((sizeof(struct direct) - (MAXNAMLEN+1)) + (((namlen)+1 + 3) &~ 3))
+
+#if (BYTE_ORDER == LITTLE_ENDIAN)
+#define DIRSIZ(oldfmt, dp, needswap) \
+ (((oldfmt) && !(needswap)) ? \
+ DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen))
+#else
+#define DIRSIZ(oldfmt, dp, needswap) \
+ (((oldfmt) && (needswap)) ? \
+ DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen))
+#endif
+
+#define OLDDIRFMT 1
+#define NEWDIRFMT 0
+
+/*
+ * Template for manipulating directories. Should use struct direct's,
+ * but the name field is MAXNAMLEN - 1, and this just won't do.
+ */
+struct dirtemplate {
+ u_int32_t dot_ino;
+ int16_t dot_reclen;
+ u_int8_t dot_type;
+ u_int8_t dot_namlen;
+ char dot_name[4]; /* must be multiple of 4 */
+ u_int32_t dotdot_ino;
+ int16_t dotdot_reclen;
+ u_int8_t dotdot_type;
+ u_int8_t dotdot_namlen;
+ char dotdot_name[4]; /* ditto */
+};
+
+/*
+ * This is the old format of directories, sanz type element.
+ */
+struct odirtemplate {
+ u_int32_t dot_ino;
+ int16_t dot_reclen;
+ u_int16_t dot_namlen;
+ char dot_name[4]; /* must be multiple of 4 */
+ u_int32_t dotdot_ino;
+ int16_t dotdot_reclen;
+ u_int16_t dotdot_namlen;
+ char dotdot_name[4]; /* ditto */
+};
+#endif /* !_UFS_UFS_DIR_H_ */
--- /dev/null
+/* $NetBSD: disklabel.h,v 1.88 2003/11/14 12:07:42 lukem Exp $ */
+
+/*
+ * Copyright (c) 1987, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
+ */
+
+#ifndef _SYS_DISKLABEL_H_
+#define _SYS_DISKLABEL_H_
+
+#include "type.h"
+
+/*
+ * We need <machine/types.h> for __HAVE_OLD_DISKLABEL
+ */
+#if 0 /* XXX ffsdrv */
+#ifndef _LOCORE
+#include <sys/types.h>
+#endif
+#endif
+
+/* sys/arch/i386/include/type.h XXX ffsdrv */
+#define __HAVE_OLD_DISKLABEL
+
+/*
+ * Each disk has a label which includes information about the hardware
+ * disk geometry, filesystem partitions, and drive specific information.
+ * The location of the label, as well as the number of partitions the
+ * label can describe and the number of the "whole disk" (raw)
+ * paritition are machine dependent.
+ */
+#if 0 /* XXX ffsdrv */
+#include <machine/disklabel.h>
+#endif
+
+/* arch/i386/include/disklabel.h */
+#define LABELSECTOR 1 /* sector containing label */
+#define LABELOFFSET 0 /* offset of label in sector */
+#define MAXPARTITIONS 16 /* number of partitions */
+#define OLDMAXPARTITIONS 8 /* number of partitions before 1.6 */
+#define RAW_PART 3 /* raw partition: XX?d (XXX) */
+
+/*
+ * We use the highest bit of the minor number for the partition number.
+ * This maintains backward compatibility with device nodes created before
+ * MAXPARTITIONS was increased.
+ */
+#define __I386_MAXDISKS ((1 << 20) / MAXPARTITIONS)
+#define DISKUNIT(dev) ((minor(dev) / OLDMAXPARTITIONS) % __I386_MAXDISKS)
+#define DISKPART(dev) ((minor(dev) % OLDMAXPARTITIONS) + \
+ ((minor(dev) / (__I386_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS))
+#define DISKMINOR(unit, part) \
+ (((unit) * OLDMAXPARTITIONS) + ((part) % OLDMAXPARTITIONS) + \
+ ((part) / OLDMAXPARTITIONS) * (__I386_MAXDISKS * OLDMAXPARTITIONS))
+
+/* Pull in MBR partition definitions. */
+#include "bootblock.h"
+
+/* end of arch/i386/include/disklabel.h */
+
+
+/*
+ * The absolute maximum number of disk partitions allowed.
+ * This is the maximum value of MAXPARTITIONS for which 'struct disklabel'
+ * is <= DEV_BSIZE bytes long. If MAXPARTITIONS is greater than this, beware.
+ */
+#define MAXMAXPARTITIONS 22
+#if MAXPARTITIONS > MAXMAXPARTITIONS
+#warning beware: MAXPARTITIONS bigger than MAXMAXPARTITIONS
+#endif
+
+/*
+ * Ports can switch their MAXPARTITIONS once, as follows:
+ *
+ * - define OLDMAXPARTITIONS in <machine/disklabel.h> as the old number
+ * - define MAXPARTITIONS as the new number
+ * - define DISKUNIT, DISKPART and DISKMINOR macros in <machine/disklabel.h>
+ * as appropriate for the port (see the i386 one for an example).
+ * - define __HAVE_OLD_DISKLABEL in <machine/types.h>
+ */
+
+#if defined(_KERNEL) && defined(__HAVE_OLD_DISKLABEL) && \
+ (MAXPARTITIONS < OLDMAXPARTITIONS)
+#error "can only grow disklabel size"
+#endif
+
+
+/*
+ * Translate between device numbers and major/disk unit/disk partition.
+ */
+#ifndef __HAVE_OLD_DISKLABEL
+#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS)
+#define DISKPART(dev) (minor(dev) % MAXPARTITIONS)
+#define DISKMINOR(unit, part) \
+ (((unit) * MAXPARTITIONS) + (part))
+#endif
+#define MAKEDISKDEV(maj, unit, part) \
+ (makedev((maj), DISKMINOR((unit), (part))))
+
+#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */
+
+#ifndef _LOCORE
+struct disklabel {
+ u_int32_t d_magic; /* the magic number */
+ u_int16_t d_type; /* drive type */
+ u_int16_t d_subtype; /* controller/d_type specific */
+ char d_typename[16]; /* type name, e.g. "eagle" */
+
+ /*
+ * d_packname contains the pack identifier and is returned when
+ * the disklabel is read off the disk or in-core copy.
+ * d_boot0 and d_boot1 are the (optional) names of the
+ * primary (block 0) and secondary (block 1-15) bootstraps
+ * as found in /usr/mdec. These are returned when using
+ * getdiskbyname(3) to retrieve the values from /etc/disktab.
+ */
+ union {
+ char un_d_packname[16]; /* pack identifier */
+ struct {
+ char *un_d_boot0; /* primary bootstrap name */
+ char *un_d_boot1; /* secondary bootstrap name */
+ } un_b;
+ } d_un;
+#define d_packname d_un.un_d_packname
+#define d_boot0 d_un.un_b.un_d_boot0
+#define d_boot1 d_un.un_b.un_d_boot1
+
+ /* disk geometry: */
+ u_int32_t d_secsize; /* # of bytes per sector */
+ u_int32_t d_nsectors; /* # of data sectors per track */
+ u_int32_t d_ntracks; /* # of tracks per cylinder */
+ u_int32_t d_ncylinders; /* # of data cylinders per unit */
+ u_int32_t d_secpercyl; /* # of data sectors per cylinder */
+ u_int32_t d_secperunit; /* # of data sectors per unit */
+
+ /*
+ * Spares (bad sector replacements) below are not counted in
+ * d_nsectors or d_secpercyl. Spare sectors are assumed to
+ * be physical sectors which occupy space at the end of each
+ * track and/or cylinder.
+ */
+ u_int16_t d_sparespertrack; /* # of spare sectors per track */
+ u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */
+ /*
+ * Alternative cylinders include maintenance, replacement,
+ * configuration description areas, etc.
+ */
+ u_int32_t d_acylinders; /* # of alt. cylinders per unit */
+
+ /* hardware characteristics: */
+ /*
+ * d_interleave, d_trackskew and d_cylskew describe perturbations
+ * in the media format used to compensate for a slow controller.
+ * Interleave is physical sector interleave, set up by the
+ * formatter or controller when formatting. When interleaving is
+ * in use, logically adjacent sectors are not physically
+ * contiguous, but instead are separated by some number of
+ * sectors. It is specified as the ratio of physical sectors
+ * traversed per logical sector. Thus an interleave of 1:1
+ * implies contiguous layout, while 2:1 implies that logical
+ * sector 0 is separated by one sector from logical sector 1.
+ * d_trackskew is the offset of sector 0 on track N relative to
+ * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
+ * is the offset of sector 0 on cylinder N relative to sector 0
+ * on cylinder N-1.
+ */
+ u_int16_t d_rpm; /* rotational speed */
+ u_int16_t d_interleave; /* hardware sector interleave */
+ u_int16_t d_trackskew; /* sector 0 skew, per track */
+ u_int16_t d_cylskew; /* sector 0 skew, per cylinder */
+ u_int32_t d_headswitch; /* head switch time, usec */
+ u_int32_t d_trkseek; /* track-to-track seek, usec */
+ u_int32_t d_flags; /* generic flags */
+#define NDDATA 5
+ u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */
+#define NSPARE 5
+ u_int32_t d_spare[NSPARE]; /* reserved for future use */
+ u_int32_t d_magic2; /* the magic number (again) */
+ u_int16_t d_checksum; /* xor of data incl. partitions */
+
+ /* filesystem and partition information: */
+ u_int16_t d_npartitions; /* number of partitions in following */
+ u_int32_t d_bbsize; /* size of boot area at sn0, bytes */
+ u_int32_t d_sbsize; /* max size of fs superblock, bytes */
+ struct partition { /* the partition table */
+ u_int32_t p_size; /* number of sectors in partition */
+ u_int32_t p_offset; /* starting sector */
+ union {
+ u_int32_t fsize; /* FFS, ADOS:
+ filesystem basic fragment size */
+ u_int32_t cdsession; /* ISO9660: session offset */
+ } __partition_u2;
+#define p_fsize __partition_u2.fsize
+#define p_cdsession __partition_u2.cdsession
+ u_int8_t p_fstype; /* filesystem type, see below */
+ u_int8_t p_frag; /* filesystem fragments per block */
+ union {
+ u_int16_t cpg; /* UFS: FS cylinders per group */
+ u_int16_t sgs; /* LFS: FS segment shift */
+ } __partition_u1;
+#define p_cpg __partition_u1.cpg
+#define p_sgs __partition_u1.sgs
+ } d_partitions[MAXPARTITIONS]; /* actually may be more */
+};
+
+#ifdef __HAVE_OLD_DISKLABEL
+/*
+ * Same as above, but with OLDMAXPARTITIONS partitions. For use in
+ * the old DIOC* ioctl calls.
+ */
+struct olddisklabel {
+ u_int32_t d_magic;
+ u_int16_t d_type;
+ u_int16_t d_subtype;
+ char d_typename[16];
+ union {
+ char un_d_packname[16];
+ struct {
+ char *un_d_boot0;
+ char *un_d_boot1;
+ } un_b;
+ } d_un;
+ u_int32_t d_secsize;
+ u_int32_t d_nsectors;
+ u_int32_t d_ntracks;
+ u_int32_t d_ncylinders;
+ u_int32_t d_secpercyl;
+ u_int32_t d_secperunit;
+ u_int16_t d_sparespertrack;
+ u_int16_t d_sparespercyl;
+ u_int32_t d_acylinders;
+ u_int16_t d_rpm;
+ u_int16_t d_interleave;
+ u_int16_t d_trackskew;
+ u_int16_t d_cylskew;
+ u_int32_t d_headswitch;
+ u_int32_t d_trkseek;
+ u_int32_t d_flags;
+ u_int32_t d_drivedata[NDDATA];
+ u_int32_t d_spare[NSPARE];
+ u_int32_t d_magic2;
+ u_int16_t d_checksum;
+ u_int16_t d_npartitions;
+ u_int32_t d_bbsize;
+ u_int32_t d_sbsize;
+ struct opartition {
+ u_int32_t p_size;
+ u_int32_t p_offset;
+ union {
+ u_int32_t fsize;
+ u_int32_t cdsession;
+ } __partition_u2;
+ u_int8_t p_fstype;
+ u_int8_t p_frag;
+ union {
+ u_int16_t cpg;
+ u_int16_t sgs;
+ } __partition_u1;
+ } d_partitions[OLDMAXPARTITIONS];
+};
+#endif /* __HAVE_OLD_DISKLABEL */
+#else /* _LOCORE */
+ /*
+ * offsets for asm boot files.
+ */
+ .set d_secsize,40
+ .set d_nsectors,44
+ .set d_ntracks,48
+ .set d_ncylinders,52
+ .set d_secpercyl,56
+ .set d_secperunit,60
+ .set d_end_,276 /* size of disk label */
+#endif /* _LOCORE */
+
+/* d_type values: */
+#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
+#define DTYPE_MSCP 2 /* MSCP */
+#define DTYPE_DEC 3 /* other DEC (rk, rl) */
+#define DTYPE_SCSI 4 /* SCSI */
+#define DTYPE_ESDI 5 /* ESDI interface */
+#define DTYPE_ST506 6 /* ST506 etc. */
+#define DTYPE_HPIB 7 /* CS/80 on HP-IB */
+#define DTYPE_HPFL 8 /* HP Fiber-link */
+#define DTYPE_FLOPPY 10 /* floppy */
+#define DTYPE_CCD 11 /* concatenated disk device */
+#define DTYPE_VND 12 /* vnode pseudo-disk */
+#define DTYPE_ATAPI 13 /* ATAPI */
+#define DTYPE_RAID 14 /* RAIDframe */
+#define DTYPE_LD 15 /* logical disk */
+#define DTYPE_JFS2 16 /* IBM JFS2 */
+#define DTYPE_CGD 17 /* cryptographic pseudo-disk */
+#define DTYPE_VINUM 18 /* vinum volume */
+
+#ifdef DKTYPENAMES
+static const char *const dktypenames[] = {
+ "unknown",
+ "SMD",
+ "MSCP",
+ "old DEC",
+ "SCSI",
+ "ESDI",
+ "ST506",
+ "HP-IB",
+ "HP-FL",
+ "type 9",
+ "floppy",
+ "ccd",
+ "vnd",
+ "ATAPI",
+ "RAID",
+ "ld",
+ "jfs",
+ "cgd",
+ "vinum",
+ NULL
+};
+#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
+#endif
+
+/*
+ * Filesystem type and version.
+ * Used to interpret other filesystem-specific
+ * per-partition information.
+ *
+ * These are used only for COMPAT_09 support.
+ */
+#define FS_UNUSED 0 /* unused */
+#define FS_SWAP 1 /* swap */
+#define FS_V6 2 /* Sixth Edition */
+#define FS_V7 3 /* Seventh Edition */
+#define FS_SYSV 4 /* System V */
+#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */
+#define FS_V8 6 /* Eighth Edition, 4K blocks */
+#define FS_BSDFFS 7 /* 4.2BSD fast file system */
+#define FS_MSDOS 8 /* MSDOS file system */
+#define FS_BSDLFS 9 /* 4.4BSD log-structured file system */
+#define FS_OTHER 10 /* in use, but unknown/unsupported */
+#define FS_HPFS 11 /* OS/2 high-performance file system */
+#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */
+#define FS_BOOT 13 /* partition contains bootstrap */
+#define FS_ADOS 14 /* AmigaDOS fast file system */
+#define FS_HFS 15 /* Macintosh HFS */
+#define FS_FILECORE 16 /* Acorn Filecore Filing System */
+#define FS_EX2FS 17 /* Linux Extended 2 file system */
+#define FS_NTFS 18 /* Windows/NT file system */
+#define FS_RAID 19 /* RAIDframe component */
+#define FS_CCD 20 /* concatenated disk component */
+#define FS_JFS2 21 /* IBM JFS2 */
+#define FS_APPLEUFS 22 /* Apple UFS */
+/* XXX this is not the same as FreeBSD. How to solve? */
+#define FS_VINUM 23 /* Vinum */
+
+/* Adjust the FSMAXTYPES def below if you add something after APPLEUFS */
+
+#ifdef FSTYPENAMES
+static const char *const fstypenames[] = {
+ "unused",
+ "swap",
+ "Version 6",
+ "Version 7",
+ "System V",
+ "4.1BSD",
+ "Eighth Edition",
+ "4.2BSD",
+ "MSDOS",
+ "4.4LFS",
+ "unknown",
+ "HPFS",
+ "ISO9660",
+ "boot",
+ "ADOS",
+ "HFS",
+ "FILECORE",
+ "Linux Ext2",
+ "NTFS",
+ "RAID",
+ "ccd",
+ "jfs",
+ "Apple UFS",
+ "vinum",
+ NULL
+};
+#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
+#else
+#define FSMAXTYPES (FS_VINUM + 1)
+#endif
+
+#ifdef FSCKNAMES
+/* These are the names MOUNT_XXX from <sys/mount.h> */
+static const char *const fscknames[] = {
+ NULL, /* unused */
+ NULL, /* swap */
+ NULL, /* Version 6 */
+ NULL, /* Version 7 */
+ NULL, /* System V */
+ NULL, /* 4.1BSD */
+ NULL, /* Eighth edition */
+ "ffs", /* 4.2BSD */
+ "msdos", /* MSDOS */
+ "lfs", /* 4.4LFS */
+ NULL, /* unknown */
+ NULL, /* HPFS */
+ NULL, /* ISO9660 */
+ NULL, /* boot */
+ NULL, /* ADOS */
+ NULL, /* HFS */
+ NULL, /* FILECORE */
+ "ext2fs", /* Linux Ext2 */
+ NULL, /* Windows/NT */
+ NULL, /* RAID Component */
+ NULL, /* concatenated disk component */
+ NULL, /* IBM JFS2 */
+ "ffs", /* Apple UFS */
+ NULL /* NULL */
+};
+#define FSMAXNAMES (sizeof(fscknames) / sizeof(fscknames[0]) - 1)
+
+#endif
+
+#ifdef MOUNTNAMES
+/* These are the names MOUNT_XXX from <sys/mount.h> */
+static const char *const mountnames[] = {
+ NULL, /* unused */
+ NULL, /* swap */
+ NULL, /* Version 6 */
+ NULL, /* Version 7 */
+ NULL, /* System V */
+ NULL, /* 4.1BSD */
+ NULL, /* Eighth edition */
+ "ffs", /* 4.2BSD */
+ "msdos", /* MSDOS */
+ "lfs", /* 4.4LFS */
+ NULL, /* unknown */
+ NULL, /* HPFS */
+ "cd9660", /* ISO9660 */
+ NULL, /* boot */
+ "ados", /* ADOS */
+ NULL, /* HFS */
+ "filecore", /* FILECORE */
+ "ext2fs", /* Linux Ext2 */
+ "ntfs", /* Windows/NT */
+ NULL, /* RAID Component */
+ NULL, /* concatenated disk component */
+ NULL, /* IBM JFS2 */
+ "ffs", /* Apple UFS */
+ NULL /* NULL */
+};
+#define FSMAXMOUNTNAMES (sizeof(mountnames) / sizeof(mountnames[0]) - 1)
+
+#endif
+
+/*
+ * flags shared by various drives:
+ */
+#define D_REMOVABLE 0x01 /* removable media */
+#define D_ECC 0x02 /* supports ECC */
+#define D_BADSECT 0x04 /* supports bad sector forw. */
+#define D_RAMDISK 0x08 /* disk emulator */
+#define D_CHAIN 0x10 /* can do back-back transfers */
+
+/*
+ * Drive data for SMD.
+ */
+#define d_smdflags d_drivedata[0]
+#define D_SSE 0x1 /* supports skip sectoring */
+#define d_mindist d_drivedata[1]
+#define d_maxdist d_drivedata[2]
+#define d_sdist d_drivedata[3]
+
+/*
+ * Drive data for ST506.
+ */
+#define d_precompcyl d_drivedata[0]
+#define d_gap3 d_drivedata[1] /* used only when formatting */
+
+/*
+ * Drive data for SCSI.
+ */
+#define d_blind d_drivedata[0]
+
+#ifndef _LOCORE
+/*
+ * Structure used to perform a format or other raw operation,
+ * returning data and/or register values. Register identification
+ * and format are device- and driver-dependent. Currently unused.
+ */
+struct format_op {
+ char *df_buf;
+ int df_count; /* value-result */
+ daddr_t df_startblk;
+ int df_reg[8]; /* result */
+};
+
+/*
+ * Structure used internally to retrieve information about a partition
+ * on a disk.
+ */
+struct partinfo {
+ struct disklabel *disklab;
+ struct partition *part;
+};
+
+#ifdef _KERNEL
+
+struct disk;
+
+void diskerr __P((const struct buf *, const char *, const char *, int,
+ int, const struct disklabel *));
+u_int dkcksum __P((struct disklabel *));
+int setdisklabel __P((struct disklabel *, struct disklabel *, u_long,
+ struct cpu_disklabel *));
+const char *readdisklabel __P((dev_t, void (*)(struct buf *),
+ struct disklabel *, struct cpu_disklabel *));
+int writedisklabel __P((dev_t, void (*)(struct buf *), struct disklabel *,
+ struct cpu_disklabel *));
+int bounds_check_with_label __P((struct disk *, struct buf *, int));
+int bounds_check_with_mediasize __P((struct buf *, int, u_int64_t));
+#endif
+#endif /* _LOCORE */
+
+#if !defined(_KERNEL) && !defined(_LOCORE)
+
+#if 0 /* XXX ffsdrv */
+#include <sys/cdefs.h>
+#endif
+
+#endif
+
+#endif /* !_SYS_DISKLABEL_H_ */
--- /dev/null
+/*
+ * FFS File System Driver for Windows
+ *
+ * ffsdrv.h
+ *
+ * 2004.5.6 ~
+ *
+ * Lee Jae-Hong, http://www.pyrasis.com
+ *
+ */
+
+#ifndef _FFS_HEADER_
+#define _FFS_HEADER_
+
+/* include files */
+#ifdef __REACTOS__
+#include <ntifs.h>
+#include <ntddk.h>
+#include <ntdddisk.h>
+#include <pseh/pseh2.h>
+#endif
+#include "fs.h"
+#include "dinode.h"
+#include "dir.h"
+#include "disklabel.h"
+#ifndef __REACTOS__
+#include <ntdddisk.h>
+#endif
+
+#ifndef _PREFAST_
+#ifdef _MSC_VER
+#pragma warning(disable:4068)
+#endif
+#define __drv_mustHoldCriticalRegion
+#endif // !_PREFAST_
+
+#pragma pack(1)
+
+/* debug */
+#if DBG
+ #define FFSBreakPoint() /*__asm int 3*/ //DbgBreakPoint()
+#else
+ #define FFSBreakPoint()
+#endif
+
+/* Structs & Consts */
+
+#define FFSDRV_VERSION "0.5.2"
+
+/*
+ * ffsdrv build options
+ */
+
+/* To build read-only driver */
+
+#define FFS_READ_ONLY TRUE
+
+
+/* To support driver dynamics unload */
+
+#define FFS_UNLOAD TRUE
+
+/*
+ * Constants
+ */
+
+#define FFS_BLOCK_TYPES (0x04)
+
+#define MAXIMUM_RECORD_LENGTH (0x10000)
+
+#define SECTOR_BITS (Vcb->SectorBits)
+#define SECTOR_SIZE (Vcb->DiskGeometry.BytesPerSector)
+#define DEFAULT_SECTOR_SIZE (0x200)
+
+#define SUPER_BLOCK_OFFSET (0x2000)
+#define SUPER_BLOCK_SIZE SBLOCKSIZE
+
+#define READ_AHEAD_GRANULARITY (0x10000)
+
+#define SUPER_BLOCK (Vcb->ffs_super_block)
+#define FS_VERSION (Vcb->FSVersion)
+
+#define BLOCK_SIZE (Vcb->BlockSize)
+#define BLOCK_BITS FFSLog2(Vcb->BlockSize)
+
+#define INODES_COUNT (Vcb->ffs_super_block->s_inodes_count)
+
+#define INODES_PER_GROUP (SUPER_BLOCK->fs_ipg)
+#define BLOCKS_PER_GROUP (SUPER_BLOCK->fs_fpg)
+#define TOTAL_BLOCKS (SUPER_BLOCK->fs_size)
+
+
+
+/* File System Releated */
+
+#define DRIVER_NAME "FFS"
+#ifndef __REACTOS__
+#define DEVICE_NAME L"\\FileSystem\\FFS"
+#else
+#define DEVICE_NAME L"\\FFS"
+#endif
+
+/* Registry */
+
+#define PARAMETERS_KEY L"\\Parameters"
+
+#define WRITING_SUPPORT L"WritingSupport"
+#define CHECKING_BITMAP L"CheckingBitmap"
+#define PARTITION_NUMBER L"PartitionNumber"
+
+/* To support select BSD partition and ffsdrv unload routine */
+#define DOS_DEVICE_NAME L"\\DosDevices\\ffs"
+
+/*
+ * Private IOCTL to make the driver ready to unload
+ */
+#if FFS_UNLOAD
+#define IOCTL_PREPARE_TO_UNLOAD \
+CTL_CODE(FILE_DEVICE_UNKNOWN, 2048, METHOD_NEITHER, FILE_WRITE_ACCESS)
+#endif // FFS_UNLOAD
+
+/*
+ * Private IOCTL to select BSD partition.
+ */
+#define IOCTL_SELECT_BSD_PARTITION \
+CTL_CODE(FILE_DEVICE_UNKNOWN, 2049, METHOD_BUFFERED, FILE_WRITE_ACCESS)
+
+
+#ifndef SetFlag
+#define SetFlag(x,f) ((x) |= (f))
+#endif
+
+#ifndef ClearFlag
+#define ClearFlag(x,f) ((x) &= ~(f))
+#endif
+
+#define IsFlagOn(a,b) ((BOOLEAN)(FlagOn(a,b) == b))
+
+#define FFSRaiseStatus(IRPCONTEXT,STATUS) { \
+ (IRPCONTEXT)->ExceptionCode = (STATUS); \
+ ExRaiseStatus( (STATUS) ); \
+}
+
+#define FFSNormalizeAndRaiseStatus(IRPCONTEXT,STATUS) { \
+ /* (IRPCONTEXT)->ExceptionStatus = (STATUS); */ \
+ if ((STATUS) == STATUS_VERIFY_REQUIRED) { ExRaiseStatus((STATUS)); } \
+ ExRaiseStatus(FsRtlNormalizeNtstatus((STATUS),STATUS_UNEXPECTED_IO_ERROR)); \
+}
+
+/*
+ * Define IsEndofFile for read and write operations
+ */
+
+#define FILE_WRITE_TO_END_OF_FILE 0xffffffff
+#define FILE_USE_FILE_POINTER_POSITION 0xfffffffe
+
+#define IsEndOfFile(Pos) ((Pos.LowPart == FILE_WRITE_TO_END_OF_FILE) && \
+ (Pos.HighPart == FILE_USE_FILE_POINTER_POSITION ))
+
+#define IsDirectory(Fcb) IsFlagOn(Fcb->FFSMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)
+
+/*
+ * Bug Check Codes Definitions
+ */
+
+#define FFS_FILE_SYSTEM (FILE_SYSTEM)
+
+#define FFS_BUGCHK_BLOCK (0x00010000)
+#define FFS_BUGCHK_CLEANUP (0x00020000)
+#define FFS_BUGCHK_CLOSE (0x00030000)
+#define FFS_BUGCHK_CMCB (0x00040000)
+#define FFS_BUGCHK_CREATE (0x00050000)
+#define FFS_BUGCHK_DEBUG (0x00060000)
+#define FFS_BUGCHK_DEVCTL (0x00070000)
+#define FFS_BUGCHK_DIRCTL (0x00080000)
+#define FFS_BUGCHK_DISPATCH (0x00090000)
+#define FFS_BUGCHK_EXCEPT (0x000A0000)
+#define FFS_BUGCHK_FFS (0x000B0000)
+#define FFS_BUGCHK_FASTIO (0x000C0000)
+#define FFS_BUGCHK_FILEINFO (0x000D0000)
+#define FFS_BUGCHK_FLUSH (0x000E0000)
+#define FFS_BUGCHK_FSCTL (0x000F0000)
+#define FFS_BUGCHK_INIT (0x00100000)
+#define FFS_BUGCHK_LOCK (0x0011000)
+#define FFS_BUGCHK_MEMORY (0x0012000)
+#define FFS_BUGCHK_MISC (0x0013000)
+#define FFS_BUGCHK_READ (0x00140000)
+#define FFS_BUGCHK_SHUTDOWN (0x00150000)
+#define FFS_BUGCHK_VOLINFO (0x00160000)
+#define FFS_BUGCHK_WRITE (0x00170000)
+
+#define FFS_BUGCHK_LAST (0x00170000)
+
+#define FFSBugCheck(A,B,C,D) { KeBugCheckEx(FFS_FILE_SYSTEM, A | __LINE__, B, C, D ); }
+
+
+/* FFS file system definions */
+
+/*
+ * Structure of a directory entry
+ */
+#define FFS_NAME_LEN 255
+
+#define FFS_ROOT_INO 2 /* Root inode */
+
+
+/*
+ * FFS_DIR_PAD defines the directory entries boundaries
+ *
+ * NOTE: It must be a multiple of 4
+ */
+#define FFS_DIR_PAD 4
+#define FFS_DIR_ROUND (FFS_DIR_PAD - 1)
+#define FFS_DIR_REC_LEN(name_len) (((name_len) + 8 + FFS_DIR_ROUND) & \
+ ~FFS_DIR_ROUND)
+
+
+/* sys/sys/stat.h */
+
+#define S_ISDIR(m) ((m & _S_IFMT) == _S_IFDIR) /* directory */
+#define S_ISCHR(m) ((m & _S_IFMT) == _S_IFCHR) /* char special */
+#define S_ISBLK(m) ((m & _S_IFMT) == _S_IFBLK) /* block special */
+#define S_ISREG(m) ((m & _S_IFMT) == _S_IFREG) /* regular file */
+#define S_ISFIFO(m) ((m & _S_IFMT) == _S_IFIFO) /* fifo */
+#define S_ISLNK(m) ((m & _S_IFMT) == _S_IFLNK) /* symbolic link */
+#define S_ISSOCK(m) ((m & _S_IFMT) == _S_IFSOCK) /* socket */
+#define S_ISWHT(m) ((m & _S_IFMT) == _S_IFWHT) /* whiteout */
+
+
+#define S_IPERMISSION_MASK 0x1FF /* */
+
+#define S_IRWXU 0000700 /* RWX mask for owner */
+#define S_IRUSR 0000400 /* R for owner */
+#define S_IWUSR 0000200 /* W for owner */
+#define S_IXUSR 0000100 /* X for owner */
+
+#define S_IRWXG 0000070 /* RWX mask for group */
+#define S_IRGRP 0000040 /* R for group */
+#define S_IWGRP 0000020 /* W for group */
+#define S_IXGRP 0000010 /* X for group */
+
+#define S_IRWXO 0000007 /* RWX mask for other */
+#define S_IROTH 0000004 /* R for other */
+#define S_IWOTH 0000002 /* W for other */
+#define S_IXOTH 0000001 /* X for other */
+
+#define S_ISREADABLE(m) (((m) & S_IPERMISSION_MASK) == (S_IRUSR | S_IRGRP | S_IROTH))
+#define S_ISWRITABLE(m) (((m) & S_IPERMISSION_MASK) == (S_IWUSR | S_IWGRP | S_IWOTH))
+
+#define FFSSetReadable(m) (m) = ((m) | (S_IRUSR | S_IRGRP | S_IROTH))
+#define FFSSetWritable(m) (m) = ((m) | (S_IWUSR | S_IWGRP | S_IWOTH))
+
+#define FFSSetReadOnly(m) (m) = ((m) & (~(S_IWUSR | S_IWGRP | S_IWOTH)))
+#define FFSIsReadOnly(m) (!((m) & (S_IWUSR | S_IWGRP | S_IWOTH)))
+
+#define FFS_FIRST_DATA_BLOCK (Vcb->ffs_super_block->fs_dblkno)
+
+typedef struct fs FFS_SUPER_BLOCK, *PFFS_SUPER_BLOCK;
+
+typedef struct disklabel DISKLABEL, *PDISKLABEL;
+
+typedef struct ufs1_dinode FFSv1_INODE, *PFFSv1_INODE;
+typedef struct ufs2_dinode FFSv2_INODE, *PFFSv2_INODE;
+
+typedef struct direct FFS_DIR_ENTRY, *PFFS_DIR_ENTRY;
+
+
+/*
+ * ffsdrv Driver Definitions
+ */
+
+/*
+ * FFS_IDENTIFIER_TYPE
+ *
+ * Identifiers used to mark the structures
+ */
+
+typedef enum _FFS_IDENTIFIER_TYPE {
+ FFSFGD = ':DGF',
+ FFSVCB = ':BCV',
+ FFSFCB = ':BCF',
+ FFSCCB = ':BCC',
+ FFSICX = ':XCI',
+ FFSDRV = ':VRD',
+ FFSMCB = ':BCM'
+} FFS_IDENTIFIER_TYPE;
+
+/*
+ * FFS_IDENTIFIER
+ *
+ * Header used to mark the structures
+ */
+typedef struct _FFS_IDENTIFIER {
+ FFS_IDENTIFIER_TYPE Type;
+ ULONG Size;
+} FFS_IDENTIFIER, *PFFS_IDENTIFIER;
+
+
+#define NodeType(Ptr) (*((FFS_IDENTIFIER_TYPE *)(Ptr)))
+
+typedef struct _FFS_MCB FFS_MCB, *PFFS_MCB;
+
+
+typedef PVOID PBCB;
+
+/*
+ * REPINNED_BCBS List
+ */
+
+#define FFS_REPINNED_BCBS_ARRAY_SIZE (8)
+
+typedef struct _FFS_REPINNED_BCBS {
+
+ //
+ // A pointer to the next structure contains additional repinned bcbs
+ //
+
+ struct _FFS_REPINNED_BCBS *Next;
+
+ //
+ // A fixed size array of pinned bcbs. Whenever a new bcb is added to
+ // the repinned bcb structure it is added to this array. If the
+ // array is already full then another repinned bcb structure is allocated
+ // and pointed to with Next.
+ //
+
+ PBCB Bcb[ FFS_REPINNED_BCBS_ARRAY_SIZE ];
+
+} FFS_REPINNED_BCBS, *PFFS_REPINNED_BCBS;
+
+
+/*
+ * FFS_BSD_PARTITION
+ */
+typedef struct _FFS_BSD_PARTITION
+{
+ ULONG Number;
+} FFS_BSD_PARTITION, *PFFS_BSD_PARTITION;
+
+
+/*
+ * FFS_GLOBAL_DATA
+ *
+ * Data that is not specific to a mounted volume
+ */
+typedef struct _FFS_GLOBAL {
+
+ // Identifier for this structure
+ FFS_IDENTIFIER Identifier;
+
+ // Syncronization primitive for this structure
+ ERESOURCE Resource;
+
+ // Syncronization primitive for Counting
+ ERESOURCE CountResource;
+
+ // Syncronization primitive for LookAside Lists
+ ERESOURCE LAResource;
+
+ // Table of pointers to the fast I/O entry points
+ FAST_IO_DISPATCH FastIoDispatch;
+
+ // Table of pointers to the Cache Manager callbacks
+ CACHE_MANAGER_CALLBACKS CacheManagerCallbacks;
+ CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks;
+
+ // Pointer to the driver object
+ PDRIVER_OBJECT DriverObject;
+
+ // Pointer to the main device object
+ PDEVICE_OBJECT DeviceObject;
+
+ // List of mounted volumes
+ LIST_ENTRY VcbList;
+
+ // Look Aside table of IRP_CONTEXT, FCB, MCB, CCB
+ USHORT MaxDepth;
+ NPAGED_LOOKASIDE_LIST FFSIrpContextLookasideList;
+ NPAGED_LOOKASIDE_LIST FFSFcbLookasideList;
+ NPAGED_LOOKASIDE_LIST FFSCcbLookasideList;
+ PAGED_LOOKASIDE_LIST FFSMcbLookasideList;
+
+ // Mcb Count ...
+ USHORT McbAllocated;
+
+#if DBG
+ // Fcb Count
+ USHORT FcbAllocated;
+
+ // IRP_MJ_CLOSE : FCB
+ USHORT IRPCloseCount;
+#endif
+
+ // Global flags for the driver
+ ULONG Flags;
+
+ ULONG PartitionNumber;
+
+} FFS_GLOBAL, *PFFS_GLOBAL;
+
+/*
+ * Flags for FFS_GLOBAL_DATA
+ */
+#define FFS_UNLOAD_PENDING 0x00000001
+#define FFS_SUPPORT_WRITING 0x00000002
+#define FFS_CHECKING_BITMAP 0x00000008
+
+/*
+ * Driver Extension define
+ */
+typedef struct {
+ FFS_GLOBAL FFSGlobal;
+} FFS_EXT, *PFFS_EXT;
+
+
+typedef struct _FFS_FCBVCB {
+
+ // FCB header required by NT
+ FSRTL_COMMON_FCB_HEADER CommonFCBHeader;
+ SECTION_OBJECT_POINTERS SectionObject;
+ ERESOURCE MainResource;
+ ERESOURCE PagingIoResource;
+ // end FCB header required by NT
+
+ // Identifier for this structure
+ FFS_IDENTIFIER Identifier;
+} FFS_FCBVCB, *PFFS_FCBVCB;
+
+/*
+ * FFS_VCB Volume Control Block
+ *
+ * Data that represents a mounted logical volume
+ * It is allocated as the device extension of the volume device object
+ */
+typedef struct _FFS_VCB {
+
+ // FCB header required by NT
+ // The VCB is also used as an FCB for file objects
+ // that represents the volume itself
+ FSRTL_COMMON_FCB_HEADER Header;
+ SECTION_OBJECT_POINTERS SectionObject;
+ ERESOURCE MainResource;
+ ERESOURCE PagingIoResource;
+ // end FCB header required by NT
+
+ // Identifier for this structure
+ FFS_IDENTIFIER Identifier;
+
+ LIST_ENTRY Next;
+
+ // Share Access for the file object
+ SHARE_ACCESS ShareAccess;
+
+ // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
+ // for files on this volume.
+ ULONG OpenFileHandleCount;
+
+ // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE
+ // for both files on this volume and open instances of the
+ // volume itself.
+ ULONG ReferenceCount;
+ ULONG OpenHandleCount;
+
+ //
+ // Disk change count
+ //
+
+ ULONG ChangeCount;
+
+ // Pointer to the VPB in the target device object
+ PVPB Vpb;
+
+ // The FileObject of Volume used to lock the volume
+ PFILE_OBJECT LockFile;
+
+ // List of FCBs for open files on this volume
+ LIST_ENTRY FcbList;
+
+ // List of IRPs pending on directory change notify requests
+ LIST_ENTRY NotifyList;
+
+ // Pointer to syncronization primitive for this list
+ PNOTIFY_SYNC NotifySync;
+
+ // This volumes device object
+ PDEVICE_OBJECT DeviceObject;
+
+ // The physical device object (the disk)
+ PDEVICE_OBJECT TargetDeviceObject;
+
+ // The physical device object (the disk)
+ PDEVICE_OBJECT RealDevice;
+
+ // Information about the physical device object
+ DISK_GEOMETRY DiskGeometry;
+ PARTITION_INFORMATION PartitionInformation;
+
+ // File System Super Block
+ PFFS_SUPER_BLOCK ffs_super_block;
+
+ // File System version
+ ULONG FSVersion;
+
+ // Number of Group Decsciptions
+ ULONG ffs_groups;
+ /*
+ // Bitmap Block per group
+ PRTL_BITMAP BlockBitMaps;
+ PRTL_BITMAP InodeBitMaps;
+ */
+ // Block / Cluster size
+ ULONG BlockSize;
+
+ // Sector size in bits
+ ULONG SectorBits;
+
+ ULONG dwData[FFS_BLOCK_TYPES];
+ ULONG dwMeta[FFS_BLOCK_TYPES];
+
+ // Flags for the volume
+ ULONG Flags;
+
+ // Streaming File Object
+ PFILE_OBJECT StreamObj;
+
+ // Resource Lock for Mcb
+ ERESOURCE McbResource;
+
+ // Dirty Mcbs of modifications for volume stream
+ LARGE_MCB DirtyMcbs;
+
+ // Entry of Mcb Tree (Root Node)
+ PFFS_MCB McbTree;
+ LIST_ENTRY McbList;
+
+ ULONGLONG FSOffset[MAXPARTITIONS];
+
+ ULONG RootPartition;
+
+ ULONG PartitionNumber;
+
+} FFS_VCB, *PFFS_VCB;
+
+/*
+ * Flags for FFS_VCB
+ */
+#define VCB_INITIALIZED 0x00000001
+#define VCB_VOLUME_LOCKED 0x00000002
+#define VCB_MOUNTED 0x00000004
+#define VCB_DISMOUNT_PENDING 0x00000008
+#define VCB_READ_ONLY 0x00000010
+
+#define VCB_WRITE_PROTECTED 0x10000000
+#define VCB_FLOPPY_DISK 0x20000000
+#define VCB_REMOVAL_PREVENTED 0x40000000
+#define VCB_REMOVABLE_MEDIA 0x80000000
+
+
+#define IsMounted(Vcb) (IsFlagOn(Vcb->Flags, VCB_MOUNTED))
+
+
+/*
+ * FFS_FCB File Control Block
+ *
+ * Data that represents an open file
+ * There is a single instance of the FCB for every open file
+ */
+typedef struct _FFS_FCB {
+
+ // FCB header required by NT
+ FSRTL_COMMON_FCB_HEADER Header;
+ SECTION_OBJECT_POINTERS SectionObject;
+ ERESOURCE MainResource;
+ ERESOURCE PagingIoResource;
+ // end FCB header required by NT
+
+ // Identifier for this structure
+ FFS_IDENTIFIER Identifier;
+
+ // List of FCBs for this volume
+ LIST_ENTRY Next;
+
+ // Share Access for the file object
+ SHARE_ACCESS ShareAccess;
+
+ // List of byte-range locks for this file
+ FILE_LOCK FileLockAnchor;
+
+ // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
+ ULONG OpenHandleCount;
+
+ // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE
+ ULONG ReferenceCount;
+
+ // Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP
+ // But only for Files with FO_NO_INTERMEDIATE_BUFFERING flag
+ ULONG NonCachedOpenCount;
+
+ // Flags for the FCB
+ ULONG Flags;
+
+ // Pointer to the inode
+ PFFSv1_INODE dinode1;
+ PFFSv2_INODE dinode2;
+
+ // Hint block for next allocation
+ ULONG BlkHint;
+
+ // Vcb
+
+ PFFS_VCB Vcb;
+
+ // Mcb Node ...
+ PFFS_MCB FFSMcb;
+
+ // Full Path Name
+ UNICODE_STRING LongName;
+
+#if DBG
+ // The Ansi Filename for debugging
+ OEM_STRING AnsiFileName;
+#endif
+
+
+} FFS_FCB, *PFFS_FCB;
+
+
+//
+// Flags for FFS_FCB
+//
+#define FCB_FROM_POOL 0x00000001
+#define FCB_PAGE_FILE 0x00000002
+#define FCB_DELETE_ON_CLOSE 0x00000004
+#define FCB_DELETE_PENDING 0x00000008
+#define FCB_FILE_DELETED 0x00000010
+#define FCB_FILE_MODIFIED 0x00000020
+
+// Mcb Node
+
+struct _FFS_MCB {
+
+ // Identifier for this structure
+ FFS_IDENTIFIER Identifier;
+
+ // Flags
+ ULONG Flags;
+
+ // Link List Info
+
+ PFFS_MCB Parent; // Parent
+ PFFS_MCB Child; // Children
+ PFFS_MCB Next; // Brothers
+
+ // Mcb Node Info
+
+ // -> Fcb
+ PFFS_FCB FFSFcb;
+
+ // Short name
+ UNICODE_STRING ShortName;
+
+ // Inode number
+ ULONG Inode;
+
+ // Dir entry offset in parent
+ ULONG DeOffset;
+
+ // File attribute
+ ULONG FileAttr;
+
+ // List Link to Vcb->McbList
+ LIST_ENTRY Link;
+};
+
+/*
+ * Flags for MCB
+ */
+#define MCB_FROM_POOL 0x00000001
+#define MCB_IN_TREE 0x00000002
+#define MCB_IN_USE 0x00000004
+
+#define IsMcbUsed(Mcb) IsFlagOn(Mcb->Flags, MCB_IN_USE)
+
+
+/*
+ * FFS_CCB Context Control Block
+ *
+ * Data that represents one instance of an open file
+ * There is one instance of the CCB for every instance of an open file
+ */
+typedef struct _FFS_CCB {
+
+ // Identifier for this structure
+ FFS_IDENTIFIER Identifier;
+
+ // Flags
+ ULONG Flags;
+
+ // State that may need to be maintained
+ ULONG CurrentByteOffset;
+ UNICODE_STRING DirectorySearchPattern;
+
+} FFS_CCB, *PFFS_CCB;
+
+/*
+ * Flags for CCB
+ */
+
+#define CCB_FROM_POOL 0x00000001
+
+#define CCB_ALLOW_EXTENDED_DASD_IO 0x80000000
+
+
+/*
+ * FFS_IRP_CONTEXT
+ *
+ * Used to pass information about a request between the drivers functions
+ */
+typedef struct _FFS_IRP_CONTEXT {
+
+ // Identifier for this structure
+ FFS_IDENTIFIER Identifier;
+
+ // Pointer to the IRP this request describes
+ PIRP Irp;
+
+ // Flags
+ ULONG Flags;
+
+ // The major and minor function code for the request
+ UCHAR MajorFunction;
+ UCHAR MinorFunction;
+
+ // The device object
+ PDEVICE_OBJECT DeviceObject;
+
+ // The real device object
+ PDEVICE_OBJECT RealDevice;
+
+ // The file object
+ PFILE_OBJECT FileObject;
+
+ PFFS_FCB Fcb;
+ PFFS_CCB Ccb;
+
+ // If the request is synchronous (we are allowed to block)
+ BOOLEAN IsSynchronous;
+
+ // If the request is top level
+ BOOLEAN IsTopLevel;
+
+ // Used if the request needs to be queued for later processing
+ WORK_QUEUE_ITEM WorkQueueItem;
+
+ // If an exception is currently in progress
+ BOOLEAN ExceptionInProgress;
+
+ // The exception code when an exception is in progress
+ NTSTATUS ExceptionCode;
+
+ // Repinned BCBs List
+ FFS_REPINNED_BCBS Repinned;
+
+} FFS_IRP_CONTEXT, *PFFS_IRP_CONTEXT;
+
+
+#define IRP_CONTEXT_FLAG_FROM_POOL (0x00000001)
+#define IRP_CONTEXT_FLAG_WAIT (0x00000002)
+#define IRP_CONTEXT_FLAG_WRITE_THROUGH (0x00000004)
+#define IRP_CONTEXT_FLAG_FLOPPY (0x00000008)
+#define IRP_CONTEXT_FLAG_RECURSIVE_CALL (0x00000010)
+#define IRP_CONTEXT_FLAG_DISABLE_POPUPS (0x00000020)
+#define IRP_CONTEXT_FLAG_DEFERRED (0x00000040)
+#define IRP_CONTEXT_FLAG_VERIFY_READ (0x00000080)
+#define IRP_CONTEXT_STACK_IO_CONTEXT (0x00000100)
+#define IRP_CONTEXT_FLAG_REQUEUED (0x00000200)
+#define IRP_CONTEXT_FLAG_USER_IO (0x00000400)
+#define IRP_CONTEXT_FLAG_DELAY_CLOSE (0x00000800)
+
+
+/*
+ * FFS_ALLOC_HEADER
+ *
+ * In the checked version of the driver this header is put in the beginning of
+ * every memory allocation
+ */
+typedef struct _FFS_ALLOC_HEADER {
+ FFS_IDENTIFIER Identifier;
+} FFS_ALLOC_HEADER, *PFFS_ALLOC_HEADER;
+
+typedef struct _FCB_LIST_ENTRY {
+ PFFS_FCB Fcb;
+ LIST_ENTRY Next;
+} FCB_LIST_ENTRY, *PFCB_LIST_ENTRY;
+
+
+/* Block Description List */
+typedef struct _FFS_BDL {
+ LONGLONG Lba;
+ ULONG Offset;
+ ULONG Length;
+ PIRP Irp;
+} FFS_BDL, *PFFS_BDL;
+
+#pragma pack()
+
+
+/*
+ * The following macro is used to determine if an FSD thread can block
+ * for I/O or wait for a resource. It returns TRUE if the thread can
+ * block and FALSE otherwise. This attribute can then be used to call
+ * the FSD & FSP common work routine with the proper wait value.
+ */
+
+#define CanFFSWait(IRP) IoIsOperationSynchronous(Irp)
+
+#define FFS_POOL_TAG 'dsfF'
+
+//
+// Block.c
+//
+
+NTSTATUS
+FFSLockUserBuffer(
+ IN PIRP Irp,
+ IN ULONG Length,
+ IN LOCK_OPERATION Operation);
+PVOID
+FFSGetUserBuffer(
+ IN PIRP Irp);
+
+NTSTATUS
+FFSReadWriteBlocks(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_BDL FFSBDL,
+ IN ULONG Length,
+ IN ULONG Count,
+ IN BOOLEAN bVerify);
+
+NTSTATUS
+FFSReadSync(
+ IN PFFS_VCB Vcb,
+ IN ULONGLONG Offset,
+ IN ULONG Length,
+ OUT PVOID Buffer,
+ IN BOOLEAN bVerify);
+
+NTSTATUS
+FFSReadDisk(
+ IN PFFS_VCB Vcb,
+ IN ULONGLONG Offset,
+ IN ULONG Size,
+ IN PVOID Buffer,
+ IN BOOLEAN bVerify);
+
+NTSTATUS
+FFSDiskIoControl(
+ IN PDEVICE_OBJECT DeviceOjbect,
+ IN ULONG IoctlCode,
+ IN PVOID InputBuffer,
+ IN ULONG InputBufferSize,
+ IN OUT PVOID OutputBuffer,
+ IN OUT PULONG OutputBufferSize);
+
+__drv_mustHoldCriticalRegion
+VOID
+FFSMediaEjectControl(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN BOOLEAN bPrevent);
+
+NTSTATUS
+FFSDiskShutDown(
+ PFFS_VCB Vcb);
+
+
+//
+// Cleanup.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSCleanup(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// Close.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSClose(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+VOID
+FFSQueueCloseRequest(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+#ifdef _PREFAST_
+IO_WORKITEM_ROUTINE FFSDeQueueCloseRequest;
+#endif // _PREFAST_
+
+VOID NTAPI
+FFSDeQueueCloseRequest(
+ IN PVOID Context);
+
+
+//
+// Cmcb.c
+//
+
+__drv_mustHoldCriticalRegion
+BOOLEAN NTAPI
+FFSAcquireForLazyWrite(
+ IN PVOID Context,
+ IN BOOLEAN Wait);
+
+__drv_mustHoldCriticalRegion
+VOID NTAPI
+FFSReleaseFromLazyWrite(
+ IN PVOID Context);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN NTAPI
+FFSAcquireForReadAhead(
+ IN PVOID Context,
+ IN BOOLEAN Wait);
+
+BOOLEAN NTAPI
+FFSNoOpAcquire(
+ IN PVOID Fcb,
+ IN BOOLEAN Wait);
+
+VOID NTAPI
+FFSNoOpRelease(
+ IN PVOID Fcb);
+
+__drv_mustHoldCriticalRegion
+VOID NTAPI
+FFSReleaseFromReadAhead(
+ IN PVOID Context);
+
+
+//
+// Create.c
+//
+
+PFFS_FCB
+FFSSearchFcbList(
+ IN PFFS_VCB Vcb,
+ IN ULONG inode);
+
+NTSTATUS
+FFSv1ScanDir(
+ IN PFFS_VCB Vcb,
+ IN PFFS_MCB ParentMcb,
+ IN PUNICODE_STRING FileName,
+ IN OUT PULONG Index,
+ IN PFFSv1_INODE dinode1,
+ IN PFFS_DIR_ENTRY ffs_dir);
+
+NTSTATUS
+FFSv2ScanDir(
+ IN PFFS_VCB Vcb,
+ IN PFFS_MCB ParentMcb,
+ IN PUNICODE_STRING FileName,
+ IN OUT PULONG Index,
+ IN PFFSv2_INODE dinode2,
+ IN PFFS_DIR_ENTRY ffs_dir);
+
+NTSTATUS
+FFSv1LookupFileName(
+ IN PFFS_VCB Vcb,
+ IN PUNICODE_STRING FullFileName,
+ IN PFFS_MCB ParentMcb,
+ OUT PFFS_MCB* FFSMcb,
+ IN OUT PFFSv1_INODE dinode1);
+
+
+NTSTATUS
+FFSv2LookupFileName(
+ IN PFFS_VCB Vcb,
+ IN PUNICODE_STRING FullFileName,
+ IN PFFS_MCB ParentMcb,
+ OUT PFFS_MCB* FFSMcb,
+ IN OUT PFFSv2_INODE dinode2);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSCreateFile(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSCreateVolume(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSCreate(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSCreateInode(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ PFFS_FCB ParentFcb,
+ ULONG Type,
+ ULONG FileAttr,
+ PUNICODE_STRING FileName);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSSupersedeOrOverWriteFile(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_FCB Fcb,
+ IN ULONG Disposition);
+
+
+//
+// Debug.c
+//
+
+#define DBG_VITAL 0
+#define DBG_ERROR 1
+#define DBG_USER 2
+#define DBG_TRACE 3
+#define DBG_INFO 4
+#define DBG_FUNC 5
+
+#if DBG
+#define FFSPrint(arg) FFSPrintf arg
+#define FFSPrintNoIndent(arg) FFSNIPrintf arg
+
+#define FFSCompleteRequest(Irp, bPrint, PriorityBoost) \
+ FFSDbgPrintComplete(Irp, bPrint); \
+ IoCompleteRequest(Irp, PriorityBoost)
+
+#else
+
+#define FFSPrint(arg)
+
+#define FFSCompleteRequest(Irp, bPrint, PriorityBoost) \
+ IoCompleteRequest(Irp, PriorityBoost)
+
+#endif // DBG
+
+VOID
+__cdecl
+FFSPrintf(
+ LONG DebugPrintLevel,
+ PCHAR DebugMessage,
+ ...);
+
+VOID
+__cdecl
+FFSNIPrintf(
+ LONG DebugPrintLevel,
+ PCHAR DebugMessage,
+ ...);
+
+extern ULONG ProcessNameOffset;
+
+#define FFSGetCurrentProcessName() ( \
+ (PCHAR) PsGetCurrentProcess() + ProcessNameOffset \
+)
+
+ULONG
+FFSGetProcessNameOffset(
+ VOID);
+
+VOID
+FFSDbgPrintCall(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp);
+
+VOID
+FFSDbgPrintComplete(
+ IN PIRP Irp,
+ IN BOOLEAN bPrint);
+
+PCHAR
+FFSNtStatusToString(
+ IN NTSTATUS Status);
+
+
+//
+// Devctl.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSDeviceControlNormal(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSPrepareToUnload(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSDeviceControl(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// Dirctl.c
+//
+
+ULONG
+FFSGetInfoLength(
+ IN FILE_INFORMATION_CLASS FileInformationClass);
+
+ULONG
+FFSProcessDirEntry(
+ IN PFFS_VCB Vcb,
+ IN FILE_INFORMATION_CLASS FileInformationClass,
+ IN ULONG in,
+ IN PVOID Buffer,
+ IN ULONG UsedLength,
+ IN ULONG Length,
+ IN ULONG FileIndex,
+ IN PUNICODE_STRING pName,
+ IN BOOLEAN Single);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSQueryDirectory(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSNotifyChangeDirectory(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+VOID
+FFSNotifyReportChange(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_FCB Fcb,
+ IN ULONG Filter,
+ IN ULONG Action);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSDirectoryControl(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+BOOLEAN
+FFSIsDirectoryEmpty(
+ PFFS_VCB Vcb,
+ PFFS_FCB Dcb);
+
+
+//
+// Dispatch.c
+//
+
+NTSTATUS
+FFSQueueRequest(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+#ifdef _PREFAST_
+IO_WORKITEM_ROUTINE FFSDeQueueRequest;
+#endif // _PREFAST_
+
+VOID NTAPI
+FFSDeQueueRequest(
+ IN PVOID Context);
+
+NTSTATUS
+FFSDispatchRequest(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+#ifdef _PREFAST_
+__drv_dispatchType(IRP_MJ_CREATE)
+__drv_dispatchType(IRP_MJ_CLOSE)
+__drv_dispatchType(IRP_MJ_READ)
+__drv_dispatchType(IRP_MJ_WRITE)
+__drv_dispatchType(IRP_MJ_QUERY_INFORMATION)
+__drv_dispatchType(IRP_MJ_SET_INFORMATION)
+__drv_dispatchType(IRP_MJ_FLUSH_BUFFERS)
+__drv_dispatchType(IRP_MJ_QUERY_VOLUME_INFORMATION)
+__drv_dispatchType(IRP_MJ_SET_VOLUME_INFORMATION)
+__drv_dispatchType(IRP_MJ_DIRECTORY_CONTROL)
+__drv_dispatchType(IRP_MJ_FILE_SYSTEM_CONTROL)
+__drv_dispatchType(IRP_MJ_DEVICE_CONTROL)
+__drv_dispatchType(IRP_MJ_SHUTDOWN)
+__drv_dispatchType(IRP_MJ_LOCK_CONTROL)
+__drv_dispatchType(IRP_MJ_CLEANUP)
+__drv_dispatchType(IRP_MJ_PNP)
+DRIVER_DISPATCH FFSBuildRequest;
+#endif // _PREFAST_
+
+NTSTATUS NTAPI
+FFSBuildRequest(
+ PDEVICE_OBJECT DeviceObject,
+ PIRP Irp);
+
+
+//
+// Except.c
+//
+
+NTSTATUS
+FFSExceptionFilter(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PEXCEPTION_POINTERS ExceptionPointer);
+
+NTSTATUS
+FFSExceptionHandler(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// ffs.c
+//
+
+PFFS_SUPER_BLOCK
+FFSLoadSuper(
+ IN PFFS_VCB Vcb,
+ IN BOOLEAN bVerify,
+ IN ULONGLONG SuperBlockOffset);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSSaveSuper(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb);
+
+BOOLEAN
+FFSLoadGroup(
+ IN PFFS_VCB Vcb);
+
+BOOLEAN
+FFSSaveGroup(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb);
+
+BOOLEAN
+FFSv1GetInodeLba(
+ IN PFFS_VCB Vcb,
+ IN ULONG inode,
+ OUT PLONGLONG offset);
+
+BOOLEAN
+FFSv2GetInodeLba(
+ IN PFFS_VCB Vcb,
+ IN ULONG inode,
+ OUT PLONGLONG offset);
+
+BOOLEAN
+FFSv1LoadInode(
+ IN PFFS_VCB Vcb,
+ IN ULONG inode,
+ IN PFFSv1_INODE dinode1);
+
+BOOLEAN
+FFSv2LoadInode(
+ IN PFFS_VCB Vcb,
+ IN ULONG inode,
+ IN PFFSv2_INODE dinode2);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSv1SaveInode(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN ULONG Inode,
+ IN PFFSv1_INODE dinode1);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSv2SaveInode(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN ULONG Inode,
+ IN PFFSv2_INODE dinode2);
+
+BOOLEAN
+FFSv1LoadBlock(
+ IN PFFS_VCB Vcb,
+ IN ULONG dwBlk,
+ IN PVOID Buffer);
+
+BOOLEAN
+FFSv2LoadBlock(
+ IN PFFS_VCB Vcb,
+ IN ULONGLONG dwBlk,
+ IN PVOID Buffer);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSSaveBlock(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN ULONG dwBlk,
+ IN PVOID Buf);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSSaveBuffer(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN LONGLONG Offset,
+ IN ULONG Size,
+ IN PVOID Buf);
+
+ULONG
+FFSv1GetBlock(
+ IN PFFS_VCB Vcb,
+ IN ULONG dwContent,
+ IN ULONG Index,
+ IN int layer);
+
+ULONGLONG
+FFSv2GetBlock(
+ IN PFFS_VCB Vcb,
+ IN ULONGLONG dwContent,
+ IN ULONG Index,
+ IN int layer);
+
+ULONG
+FFSv1BlockMap(
+ IN PFFS_VCB Vcb,
+ IN PFFSv1_INODE dinode1,
+ IN ULONG Index);
+
+ULONGLONG
+FFSv2BlockMap(
+ IN PFFS_VCB Vcb,
+ IN PFFSv2_INODE dinode2,
+ IN ULONG Index);
+
+ULONG
+FFSv1BuildBDL(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFSv1_INODE dinode1,
+ IN ULONGLONG Offset,
+ IN ULONG Size,
+ OUT PFFS_BDL *ffs_bdl);
+
+ULONG
+FFSv2BuildBDL(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFSv2_INODE dinode2,
+ IN ULONGLONG Offset,
+ IN ULONG Size,
+ OUT PFFS_BDL *ffs_bdl);
+
+BOOLEAN
+FFSNewBlock(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ ULONG GroupHint,
+ ULONG BlockHint,
+ PULONG dwRet);
+
+BOOLEAN
+FFSFreeBlock(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ ULONG Block);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSExpandBlock(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ PFFS_FCB Fcb,
+ ULONG dwContent,
+ ULONG Index,
+ ULONG layer,
+ BOOLEAN bNew,
+ ULONG *dwRet);
+
+BOOLEAN
+FFSExpandInode(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ PFFS_FCB Fcb,
+ ULONG *dwRet);
+
+NTSTATUS
+FFSNewInode(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ ULONG GroupHint,
+ ULONG Type,
+ PULONG Inode);
+
+BOOLEAN
+FFSFreeInode(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ ULONG Inode,
+ ULONG Type);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSAddEntry(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_FCB Dcb,
+ IN ULONG FileType,
+ IN ULONG Inode,
+ IN PUNICODE_STRING FileName);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSRemoveEntry(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_FCB Dcb,
+ IN ULONG FileType,
+ IN ULONG Inode);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSSetParentEntry(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_FCB Dcb,
+ IN ULONG OldParent,
+ IN ULONG NewParent);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSTruncateBlock(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_FCB Fcb,
+ IN ULONG dwContent,
+ IN ULONG Index,
+ IN ULONG layer,
+ OUT BOOLEAN *bFreed);
+
+BOOLEAN
+FFSTruncateInode(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_FCB Fcb);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSAddMcbEntry(
+ IN PFFS_VCB Vcb,
+ IN LONGLONG Lba,
+ IN LONGLONG Length);
+
+__drv_mustHoldCriticalRegion
+VOID
+FFSRemoveMcbEntry(
+ IN PFFS_VCB Vcb,
+ IN LONGLONG Lba,
+ IN LONGLONG Length);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSLookupMcbEntry(
+ IN PFFS_VCB Vcb,
+ IN LONGLONG Lba,
+ OUT PLONGLONG pLba,
+ OUT PLONGLONG pLength,
+ OUT PLONGLONG RunStart,
+ OUT PLONGLONG RunLength,
+ OUT PULONG Index);
+
+ULONG
+FFSDataBlocks(
+ PFFS_VCB Vcb,
+ ULONG TotalBlocks);
+
+ULONG
+FFSTotalBlocks(
+ PFFS_VCB Vcb,
+ ULONG DataBlocks);
+
+
+//
+// Fastio.c
+//
+
+#ifdef _PREFAST_
+FAST_IO_CHECK_IF_POSSIBLE FFSFastIoCheckIfPossible;
+#endif // _PREFAST_
+
+BOOLEAN NTAPI
+FFSFastIoCheckIfPossible(
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN ULONG LockKey,
+ IN BOOLEAN CheckForReadOperation,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_READ FFSFastIoRead;
+#endif // _PREFAST_
+
+BOOLEAN NTAPI
+FFSFastIoRead(
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN ULONG LockKey,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_WRITE FFSFastIoWrite;
+#endif // _PREFAST_
+
+BOOLEAN NTAPI
+FFSFastIoWrite(
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ IN ULONG LockKey,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_QUERY_BASIC_INFO FFSFastIoQueryBasicInfo;
+#endif // _PREFAST_
+
+__drv_mustHoldCriticalRegion
+BOOLEAN NTAPI
+FFSFastIoQueryBasicInfo(
+ IN PFILE_OBJECT FileObject,
+ IN BOOLEAN Wait,
+ OUT PFILE_BASIC_INFORMATION Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_QUERY_STANDARD_INFO FFSFastIoQueryStandardInfo;
+#endif // _PREFAST_
+
+__drv_mustHoldCriticalRegion
+BOOLEAN NTAPI
+FFSFastIoQueryStandardInfo(
+ IN PFILE_OBJECT FileObject,
+ IN BOOLEAN Wait,
+ OUT PFILE_STANDARD_INFORMATION Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_LOCK FFSFastIoLock;
+#endif // _PREFAST_
+
+BOOLEAN NTAPI
+FFSFastIoLock(
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER Length,
+ IN PEPROCESS Process,
+ IN ULONG Key,
+ IN BOOLEAN FailImmediately,
+ IN BOOLEAN ExclusiveLock,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_UNLOCK_SINGLE FFSFastIoUnlockSingle;
+#endif // _PREFAST_
+
+BOOLEAN NTAPI
+FFSFastIoUnlockSingle(
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN PLARGE_INTEGER Length,
+ IN PEPROCESS Process,
+ IN ULONG Key,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_UNLOCK_ALL FFSFastIoUnlockAll;
+#endif // _PREFAST_
+
+BOOLEAN NTAPI
+FFSFastIoUnlockAll(
+ IN PFILE_OBJECT FileObject,
+ IN PEPROCESS Process,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_UNLOCK_ALL_BY_KEY FFSFastIoUnlockAllByKey;
+#endif // _PREFAST_
+
+BOOLEAN NTAPI
+FFSFastIoUnlockAllByKey(
+ IN PFILE_OBJECT FileObject,
+#ifndef __REACTOS__
+ IN PEPROCESS Process,
+#else
+ IN PVOID Process,
+#endif
+ IN ULONG Key,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+#ifdef _PREFAST_
+FAST_IO_QUERY_NETWORK_OPEN_INFO FFSFastIoQueryNetworkOpenInfo;
+#endif // _PREFAST_
+
+__drv_mustHoldCriticalRegion
+BOOLEAN NTAPI
+FFSFastIoQueryNetworkOpenInfo(
+ IN PFILE_OBJECT FileObject,
+ IN BOOLEAN Wait,
+ OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus,
+ IN PDEVICE_OBJECT DeviceObject);
+
+//
+// FileInfo.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSQueryInformation(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSSetInformation(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+BOOLEAN
+FFSExpandFile(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ PFFS_FCB Fcb,
+ PLARGE_INTEGER AllocationSize);
+
+BOOLEAN
+FFSTruncateFile(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ PFFS_FCB Fcb,
+ PLARGE_INTEGER AllocationSize);
+
+NTSTATUS
+FFSSetDispositionInfo(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ PFFS_FCB Fcb,
+ BOOLEAN bDelete);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSSetRenameInfo(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ PFFS_FCB Fcb);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSDeleteFile(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ PFFS_FCB Fcb);
+
+
+//
+// Flush.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSFlushFiles(
+ IN PFFS_VCB Vcb,
+ BOOLEAN bShutDown);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSFlushVolume(
+ IN PFFS_VCB Vcb,
+ BOOLEAN bShutDown);
+
+NTSTATUS
+FFSFlushFile(
+ IN PFFS_FCB Fcb);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSFlush(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// Fsctl.c
+//
+
+VOID
+FFSSetVpbFlag(
+ IN PVPB Vpb,
+ IN USHORT Flag);
+
+VOID
+FFSClearVpbFlag(
+ IN PVPB Vpb,
+ IN USHORT Flag);
+
+NTSTATUS
+FFSGetPartition(
+ IN PDEVICE_OBJECT DeviceObject,
+ OUT ULONGLONG *StartOffset);
+
+NTSTATUS
+FFSLoadDiskLabel(
+ PDEVICE_OBJECT DeviceObject,
+ IN PFFS_VCB Vcb);
+
+__drv_mustHoldCriticalRegion
+BOOLEAN
+FFSCheckDismount(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN BOOLEAN bForce);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSPurgeVolume(
+ IN PFFS_VCB Vcb,
+ IN BOOLEAN FlushBeforePurge);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSPurgeFile(
+ IN PFFS_FCB Fcb,
+ IN BOOLEAN FlushBeforePurge);
+
+BOOLEAN
+FFSIsHandleCountZero(
+ IN PFFS_VCB Vcb);
+
+NTSTATUS
+FFSLockVcb(
+ IN PFFS_VCB Vcb,
+ IN PFILE_OBJECT FileObject);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSLockVolume(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+NTSTATUS
+FFSUnlockVcb(
+ IN PFFS_VCB Vcb,
+ IN PFILE_OBJECT FileObject);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSUnlockVolume(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSAllowExtendedDasdIo(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSUserFsRequest(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSMountVolume(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSVerifyVolume(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSIsVolumeMounted(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSDismountVolume(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSSelectBSDPartition(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSFileSystemControl(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// Init.c
+//
+
+BOOLEAN
+FFSQueryParameters(
+ IN PUNICODE_STRING RegistryPath);
+
+#ifdef _PREFAST_
+DRIVER_INITIALIZE DriverEntry;
+#endif // _PREFAST_
+
+#ifdef _PREFAST_
+DRIVER_UNLOAD DriverUnload;
+#endif // _PREFAST_
+
+VOID NTAPI
+DriverUnload(
+ IN PDRIVER_OBJECT DriverObject);
+
+
+//
+// Lock.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSLockControl(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// Memory.c
+//
+
+__drv_mustHoldCriticalRegion
+PFFS_IRP_CONTEXT
+FFSAllocateIrpContext(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp);
+
+__drv_mustHoldCriticalRegion
+VOID
+FFSFreeIrpContext(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+PFFS_FCB
+FFSv1AllocateFcb(
+ IN PFFS_VCB Vcb,
+ IN PFFS_MCB FFSMcb,
+ IN PFFSv1_INODE dinode1);
+
+__drv_mustHoldCriticalRegion
+PFFS_FCB
+FFSv2AllocateFcb(
+ IN PFFS_VCB Vcb,
+ IN PFFS_MCB FFSMcb,
+ IN PFFSv2_INODE dinode2);
+
+__drv_mustHoldCriticalRegion
+VOID
+FFSFreeFcb(
+ IN PFFS_FCB Fcb);
+
+__drv_mustHoldCriticalRegion
+PFFS_CCB
+FFSAllocateCcb(
+ VOID);
+
+__drv_mustHoldCriticalRegion
+VOID
+FFSFreeMcb(
+ IN PFFS_MCB Mcb);
+
+__drv_mustHoldCriticalRegion
+PFFS_FCB
+FFSCreateFcbFromMcb(
+ PFFS_VCB Vcb,
+ PFFS_MCB Mcb);
+
+__drv_mustHoldCriticalRegion
+VOID
+FFSFreeCcb(
+ IN PFFS_CCB Ccb);
+
+PFFS_MCB
+FFSAllocateMcb(
+ PFFS_VCB Vcb,
+ PUNICODE_STRING FileName,
+ ULONG FileAttr);
+
+PFFS_MCB
+FFSSearchMcbTree(
+ PFFS_VCB Vcb,
+ PFFS_MCB FFSMcb,
+ ULONG Inode);
+
+PFFS_MCB
+FFSSearchMcb(
+ PFFS_VCB Vcb,
+ PFFS_MCB Parent,
+ PUNICODE_STRING FileName);
+
+BOOLEAN
+FFSGetFullFileName(
+ PFFS_MCB Mcb,
+ PUNICODE_STRING FileName);
+
+VOID
+FFSRefreshMcb(
+ PFFS_VCB Vcb, PFFS_MCB Mcb);
+
+VOID
+FFSAddMcbNode(
+ PFFS_VCB Vcb,
+ PFFS_MCB Parent,
+ PFFS_MCB Child);
+
+BOOLEAN
+FFSDeleteMcbNode(
+ PFFS_VCB Vcb,
+ PFFS_MCB McbTree,
+ PFFS_MCB FFSMcb);
+
+__drv_mustHoldCriticalRegion
+VOID
+FFSFreeMcbTree(
+ PFFS_MCB McbTree);
+
+BOOLEAN
+FFSCheckSetBlock(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb,
+ ULONG Block);
+
+BOOLEAN
+FFSCheckBitmapConsistency(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb);
+
+VOID
+FFSInsertVcb(
+ PFFS_VCB Vcb);
+
+VOID
+FFSRemoveVcb(
+ PFFS_VCB Vcb);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSInitializeVcb(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFS_SUPER_BLOCK FFSSb,
+ IN PDEVICE_OBJECT TargetDevice,
+ IN PDEVICE_OBJECT VolumeDevice,
+ IN PVPB Vpb);
+
+__drv_mustHoldCriticalRegion
+VOID
+FFSFreeVcb(
+ IN PFFS_VCB Vcb);
+
+VOID
+FFSRepinBcb(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PBCB Bcb);
+
+VOID
+FFSUnpinRepinnedBcbs(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSCompleteIrpContext(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN NTSTATUS Status);
+
+VOID
+FFSSyncUninitializeCacheMap(
+ IN PFILE_OBJECT FileObject);
+
+
+//
+// Misc.c
+//
+
+ULONG
+FFSLog2(
+ ULONG Value);
+
+LARGE_INTEGER
+FFSSysTime(
+ IN ULONG i_time);
+
+ULONG
+FFSInodeTime(
+ IN LARGE_INTEGER SysTime);
+
+NTSTATUS
+FFSOEMToUnicode(
+ IN OUT PUNICODE_STRING Unicode,
+ IN POEM_STRING Oem);
+
+NTSTATUS
+FFSUnicodeToOEM(
+ IN OUT POEM_STRING Oem,
+ IN PUNICODE_STRING Unicode);
+
+
+//
+// Pnp.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSPnp(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSPnpQueryRemove(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSPnpRemove(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSPnpCancelRemove(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSPnpSurpriseRemove(
+ PFFS_IRP_CONTEXT IrpContext,
+ PFFS_VCB Vcb);
+
+
+//
+// Read.c
+//
+
+BOOLEAN
+FFSCopyRead(
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN BOOLEAN Wait,
+ OUT PVOID Buffer,
+ OUT PIO_STATUS_BLOCK IoStatus);
+
+NTSTATUS
+FFSv1ReadInode(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFSv1_INODE dinode1,
+ IN ULONGLONG offset,
+ IN PVOID Buffer,
+ IN ULONG size,
+ OUT PULONG dwRet);
+
+NTSTATUS
+FFSv2ReadInode(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFSv2_INODE dinode2,
+ IN ULONGLONG offset,
+ IN PVOID Buffer,
+ IN ULONG size,
+ OUT PULONG dwRet);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSRead(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// Shutdown.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSShutDown(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// Volinfo.c
+//
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSQueryVolumeInformation(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSSetVolumeInformation(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+
+//
+// Write.c
+//
+
+NTSTATUS
+FFSv1WriteInode(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFSv1_INODE dinode1,
+ IN ULONGLONG offset,
+ IN PVOID Buffer,
+ IN ULONG size,
+ IN BOOLEAN bWriteToDisk,
+ OUT PULONG dwRet);
+
+NTSTATUS
+FFSv2WriteInode(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFFSv2_INODE dinode2,
+ IN ULONGLONG offset,
+ IN PVOID Buffer,
+ IN ULONG size,
+ IN BOOLEAN bWriteToDisk,
+ OUT PULONG dwRet);
+
+VOID
+FFSStartFloppyFlushDpc(
+ PFFS_VCB Vcb,
+ PFFS_FCB Fcb,
+ PFILE_OBJECT FileObject);
+
+BOOLEAN
+FFSZeroHoles(
+ IN PFFS_IRP_CONTEXT IrpContext,
+ IN PFFS_VCB Vcb,
+ IN PFILE_OBJECT FileObject,
+ IN LONGLONG Offset,
+ IN LONGLONG Count);
+
+__drv_mustHoldCriticalRegion
+NTSTATUS
+FFSWrite(
+ IN PFFS_IRP_CONTEXT IrpContext);
+
+NTSTATUS
+DeviceControl(
+ IN PDEVICE_OBJECT pDeviceObject,
+ IN PIRP pIrp);
+
+#endif /* _FFS_HEADER_ */
--- /dev/null
+/* $NetBSD: fs.h,v 1.43 2004/03/21 18:48:24 dsl Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fs.h 8.13 (Berkeley) 3/21/95
+ */
+
+#ifndef _UFS_FFS_FS_H_
+#define _UFS_FFS_FS_H_
+
+#include "type.h"
+
+/*
+ * Each disk drive contains some number of file systems.
+ * A file system consists of a number of cylinder groups.
+ * Each cylinder group has inodes and data.
+ *
+ * A file system is described by its super-block, which in turn
+ * describes the cylinder groups. The super-block is critical
+ * data and is replicated in each cylinder group to protect against
+ * catastrophic loss. This is done at `newfs' time and the critical
+ * super-block data does not change, so the copies need not be
+ * referenced further unless disaster strikes.
+ *
+ * For file system fs, the offsets of the various blocks of interest
+ * are given in the super block as:
+ * [fs->fs_sblkno] Super-block
+ * [fs->fs_cblkno] Cylinder group block
+ * [fs->fs_iblkno] Inode blocks
+ * [fs->fs_dblkno] Data blocks
+ * The beginning of cylinder group cg in fs, is given by
+ * the ``cgbase(fs, cg)'' macro.
+ *
+ * Depending on the architecture and the media, the superblock may
+ * reside in any one of four places. For tiny media where every block
+ * counts, it is placed at the very front of the partition. Historically,
+ * UFS1 placed it 8K from the front to leave room for the disk label and
+ * a small bootstrap. For UFS2 it got moved to 64K from the front to leave
+ * room for the disk label and a bigger bootstrap, and for really piggy
+ * systems we check at 256K from the front if the first three fail. In
+ * all cases the size of the superblock will be SBLOCKSIZE. All values are
+ * given in byte-offset form, so they do not imply a sector size. The
+ * SBLOCKSEARCH specifies the order in which the locations should be searched.
+ *
+ * Unfortunately the UFS2/FFSv2 change was done without adequate consideration
+ * of backward compatibility. In particular 'newfs' for a FFSv2 partition
+ * must overwrite any old FFSv1 superblock at 8k, and preferrably as many
+ * of the alternates as it can find - otherwise attempting to mount on a
+ * system that only supports FFSv1 is likely to succeed!.
+ * For a small FFSv1 filesystem, an old FFSv2 superblock can be left on
+ * the disk, and a system that tries to find an FFSv2 filesystem in preference
+ * to and FFSv1 one (as NetBSD does) can mount the old FFSv2 filesystem.
+ * As a added bonus, the 'first alternate' superblock of a FFSv1 filesystem
+ * with 64k blocks is at 64k - just where the code looks first when playing
+ * 'hunt the superblock'.
+ *
+ * The ffsv2 superblock layout (which might contain an ffsv1 filesystem)
+ * can be detected by checking for sb->fs_old_flags & FS_FLAGS_UPDATED.
+ * This is the default suberblock type for NetBSD since ffsv2 support was added.
+ */
+#define BBSIZE 8192
+#define BBOFF ((off_t)(0))
+#define BBLOCK ((daddr_t)(0))
+
+#define SBLOCK_FLOPPY 0
+#define SBLOCK_UFS1 8192
+#define SBLOCK_UFS2 65536
+#define SBLOCK_PIGGY 262144
+#define SBLOCKSIZE 8192
+/*
+ * NB: Do not, under any circumstances, look for an ffsv1 filesystem at
+ * SBLOCK_UFS2. Doing so will find the wrong superblock for filesystems
+ * with a 64k block size.
+ */
+#define SBLOCKSEARCH \
+ { SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }
+
+/*
+ * Max number of fragments per block. This value is NOT tweakable.
+ */
+#define MAXFRAG 8
+
+
+
+/*
+ * Addresses stored in inodes are capable of addressing fragments
+ * of `blocks'. File system blocks of at most size MAXBSIZE can
+ * be optionally broken into 2, 4, or 8 pieces, each of which is
+ * addressable; these pieces may be DEV_BSIZE, or some multiple of
+ * a DEV_BSIZE unit.
+ *
+ * Large files consist of exclusively large data blocks. To avoid
+ * undue wasted disk space, the last data block of a small file may be
+ * allocated as only as many fragments of a large block as are
+ * necessary. The file system format retains only a single pointer
+ * to such a fragment, which is a piece of a single large block that
+ * has been divided. The size of such a fragment is determinable from
+ * information in the inode, using the ``blksize(fs, ip, lbn)'' macro.
+ *
+ * The file system records space availability at the fragment level;
+ * to determine block availability, aligned fragments are examined.
+ */
+
+/*
+ * MINBSIZE is the smallest allowable block size.
+ * In order to insure that it is possible to create files of size
+ * 2^32 with only two levels of indirection, MINBSIZE is set to 4096.
+ * MINBSIZE must be big enough to hold a cylinder group block,
+ * thus changes to (struct cg) must keep its size within MINBSIZE.
+ * Note that super blocks are always of size SBSIZE,
+ * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE.
+ */
+#define MINBSIZE 4096
+
+/*
+ * The path name on which the file system is mounted is maintained
+ * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
+ * the super block for this name.
+ */
+#define MAXMNTLEN 468
+
+/*
+ * The volume name for this filesystem is maintained in fs_volname.
+ * MAXVOLLEN defines the length of the buffer allocated.
+ * This space used to be part of of fs_fsmnt.
+ */
+#define MAXVOLLEN 32
+
+/*
+ * There is a 128-byte region in the superblock reserved for in-core
+ * pointers to summary information. Originally this included an array
+ * of pointers to blocks of struct csum; now there are just four
+ * pointers and the remaining space is padded with fs_ocsp[].
+ * NOCSPTRS determines the size of this padding. One pointer (fs_csp)
+ * is taken away to point to a contiguous array of struct csum for
+ * all cylinder groups; a second (fs_maxcluster) points to an array
+ * of cluster sizes that is computed as cylinder groups are inspected;
+ * the third (fs_contigdirs) points to an array that tracks the
+ * creation of new directories; and the fourth (fs_active) is used
+ * by snapshots.
+ */
+#define NOCSPTRS ((128 / sizeof(void *)) - 4)
+
+/*
+ * A summary of contiguous blocks of various sizes is maintained
+ * in each cylinder group. Normally this is set by the initial
+ * value of fs_maxcontig. To conserve space, a maximum summary size
+ * is set by FS_MAXCONTIG.
+ */
+#define FS_MAXCONTIG 16
+
+/*
+ * Unused value currently, FreeBSD compat.
+ */
+#define FSMAXSNAP 20
+
+/*
+ * MINFREE gives the minimum acceptable percentage of file system
+ * blocks which may be free. If the freelist drops below this level
+ * only the superuser may continue to allocate blocks. This may
+ * be set to 0 if no reserve of free blocks is deemed necessary,
+ * however throughput drops by fifty percent if the file system
+ * is run at between 95% and 100% full; thus the minimum default
+ * value of fs_minfree is 5%. However, to get good clustering
+ * performance, 10% is a better choice. hence we use 10% as our
+ * default value. With 10% free space, fragmentation is not a
+ * problem, so we choose to optimize for time.
+ */
+#define MINFREE 5
+#define DEFAULTOPT FS_OPTTIME
+
+/*
+ * Grigoriy Orlov <gluk@ptci.ru> has done some extensive work to fine
+ * tune the layout preferences for directories within a filesystem.
+ * His algorithm can be tuned by adjusting the following parameters
+ * which tell the system the average file size and the average number
+ * of files per directory. These defaults are well selected for typical
+ * filesystems, but may need to be tuned for odd cases like filesystems
+ * being used for squid caches or news spools.
+ */
+#define AVFILESIZ 16384 /* expected average file size */
+#define AFPDIR 64 /* expected number of files per directory */
+
+/*
+ * Per cylinder group information; summarized in blocks allocated
+ * from first cylinder group data blocks. These blocks have to be
+ * read in from fs_csaddr (size fs_cssize) in addition to the
+ * super block.
+ */
+struct csum {
+ int32_t cs_ndir; /* number of directories */
+ int32_t cs_nbfree; /* number of free blocks */
+ int32_t cs_nifree; /* number of free inodes */
+ int32_t cs_nffree; /* number of free frags */
+};
+
+struct csum_total {
+ int64_t cs_ndir; /* number of directories */
+ int64_t cs_nbfree; /* number of free blocks */
+ int64_t cs_nifree; /* number of free inodes */
+ int64_t cs_nffree; /* number of free frags */
+ int64_t cs_spare[4]; /* future expansion */
+};
+
+
+/*
+ * Super block for an FFS file system in memory.
+ */
+struct fs {
+ int32_t fs_firstfield; /* historic file system linked list, */
+ int32_t fs_unused_1; /* used for incore super blocks */
+ int32_t fs_sblkno; /* addr of super-block in filesys */
+ int32_t fs_cblkno; /* offset of cyl-block in filesys */
+ int32_t fs_iblkno; /* offset of inode-blocks in filesys */
+ int32_t fs_dblkno; /* offset of first data after cg */
+ int32_t fs_old_cgoffset; /* cylinder group offset in cylinder */
+ int32_t fs_old_cgmask; /* used to calc mod fs_ntrak */
+ int32_t fs_old_time; /* last time written */
+ int32_t fs_old_size; /* number of blocks in fs */
+ int32_t fs_old_dsize; /* number of data blocks in fs */
+ int32_t fs_ncg; /* number of cylinder groups */
+ int32_t fs_bsize; /* size of basic blocks in fs */
+ int32_t fs_fsize; /* size of frag blocks in fs */
+ int32_t fs_frag; /* number of frags in a block in fs */
+/* these are configuration parameters */
+ int32_t fs_minfree; /* minimum percentage of free blocks */
+ int32_t fs_old_rotdelay; /* num of ms for optimal next block */
+ int32_t fs_old_rps; /* disk revolutions per second */
+/* these fields can be computed from the others */
+ int32_t fs_bmask; /* ``blkoff'' calc of blk offsets */
+ int32_t fs_fmask; /* ``fragoff'' calc of frag offsets */
+ int32_t fs_bshift; /* ``lblkno'' calc of logical blkno */
+ int32_t fs_fshift; /* ``numfrags'' calc number of frags */
+/* these are configuration parameters */
+ int32_t fs_maxcontig; /* max number of contiguous blks */
+ int32_t fs_maxbpg; /* max number of blks per cyl group */
+/* these fields can be computed from the others */
+ int32_t fs_fragshift; /* block to frag shift */
+ int32_t fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */
+ int32_t fs_sbsize; /* actual size of super block */
+ int32_t fs_spare1[2]; /* old fs_csmask */
+ /* old fs_csshift */
+ int32_t fs_nindir; /* value of NINDIR */
+ int32_t fs_inopb; /* value of INOPB */
+ int32_t fs_old_nspf; /* value of NSPF */
+/* yet another configuration parameter */
+ int32_t fs_optim; /* optimization preference, see below */
+/* these fields are derived from the hardware */
+ int32_t fs_old_npsect; /* # sectors/track including spares */
+ int32_t fs_old_interleave; /* hardware sector interleave */
+ int32_t fs_old_trackskew; /* sector 0 skew, per track */
+/* fs_id takes the space of the unused fs_headswitch and fs_trkseek fields */
+ int32_t fs_id[2]; /* unique file system id */
+/* sizes determined by number of cylinder groups and their sizes */
+ int32_t fs_old_csaddr; /* blk addr of cyl grp summary area */
+ int32_t fs_cssize; /* size of cyl grp summary area */
+ int32_t fs_cgsize; /* cylinder group size */
+/* these fields are derived from the hardware */
+ int32_t fs_spare2; /* old fs_ntrak */
+ int32_t fs_old_nsect; /* sectors per track */
+ int32_t fs_old_spc; /* sectors per cylinder */
+ int32_t fs_old_ncyl; /* cylinders in file system */
+ int32_t fs_old_cpg; /* cylinders per group */
+ int32_t fs_ipg; /* inodes per group */
+ int32_t fs_fpg; /* blocks per group * fs_frag */
+/* this data must be re-computed after crashes */
+ struct csum fs_old_cstotal; /* cylinder summary information */
+/* these fields are cleared at mount time */
+ int8_t fs_fmod; /* super block modified flag */
+ int8_t fs_clean; /* file system is clean flag */
+ int8_t fs_ronly; /* mounted read-only flag */
+ uint8_t fs_old_flags; /* see FS_ flags below */
+ u_char fs_fsmnt[MAXMNTLEN]; /* name mounted on */
+ u_char fs_volname[MAXVOLLEN]; /* volume name */
+ uint64_t fs_swuid; /* system-wide uid */
+ int32_t fs_pad;
+/* these fields retain the current block allocation info */
+ int32_t fs_cgrotor; /* last cg searched (UNUSED) */
+ void *fs_ocsp[NOCSPTRS]; /* padding; was list of fs_cs buffers */
+ u_int8_t *fs_contigdirs; /* # of contiguously allocated dirs */
+ struct csum *fs_csp; /* cg summary info buffer for fs_cs */
+ int32_t *fs_maxcluster; /* max cluster in each cyl group */
+ u_int *fs_active; /* used by snapshots to track fs */
+ int32_t fs_old_cpc; /* cyl per cycle in postbl */
+/* this area is otherwise allocated unless fs_old_flags & FS_FLAGS_UPDATED */
+ int32_t fs_maxbsize; /* maximum blocking factor permitted */
+ int64_t fs_sparecon64[17]; /* old rotation block list head */
+ int64_t fs_sblockloc; /* byte offset of standard superblock */
+ struct csum_total fs_cstotal; /* cylinder summary information */
+ int64_t fs_time; /* last time written */
+ int64_t fs_size; /* number of blocks in fs */
+ int64_t fs_dsize; /* number of data blocks in fs */
+ int64_t fs_csaddr; /* blk addr of cyl grp summary area */
+ int64_t fs_pendingblocks; /* blocks in process of being freed */
+ int32_t fs_pendinginodes; /* inodes in process of being freed */
+ int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */
+/* back to stuff that has been around a while */
+ int32_t fs_avgfilesize; /* expected average file size */
+ int32_t fs_avgfpdir; /* expected # of files per directory */
+ int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */
+ int32_t fs_sparecon32[26]; /* reserved for future constants */
+ uint32_t fs_flags; /* see FS_ flags below */
+/* back to stuff that has been around a while (again) */
+ int32_t fs_contigsumsize; /* size of cluster summary array */
+ int32_t fs_maxsymlinklen; /* max length of an internal symlink */
+ int32_t fs_old_inodefmt; /* format of on-disk inodes */
+ u_int64_t fs_maxfilesize; /* maximum representable file size */
+ int64_t fs_qbmask; /* ~fs_bmask for use with 64-bit size */
+ int64_t fs_qfmask; /* ~fs_fmask for use with 64-bit size */
+ int32_t fs_state; /* validate fs_clean field (UNUSED) */
+ int32_t fs_old_postblformat; /* format of positional layout tables */
+ int32_t fs_old_nrpos; /* number of rotational positions */
+ int32_t fs_spare5[2]; /* old fs_postbloff */
+ /* old fs_rotbloff */
+ int32_t fs_magic; /* magic number */
+};
+
+#define fs_old_postbloff fs_spare5[0]
+#define fs_old_rotbloff fs_spare5[1]
+#define fs_old_postbl_start fs_maxbsize
+#define fs_old_headswitch fs_id[0]
+#define fs_old_trkseek fs_id[1]
+#define fs_old_csmask fs_spare1[0]
+#define fs_old_csshift fs_spare1[1]
+
+#define FS_42POSTBLFMT -1 /* 4.2BSD rotational table format */
+#define FS_DYNAMICPOSTBLFMT 1 /* dynamic rotational table format */
+
+#define old_fs_postbl(fs_, cylno, opostblsave) \
+ ((((fs_)->fs_old_postblformat == FS_42POSTBLFMT) || \
+ ((fs_)->fs_old_postbloff == offsetof(struct fs, fs_old_postbl_start))) \
+ ? ((int16_t *)(opostblsave) + (cylno) * (fs_)->fs_old_nrpos) \
+ : ((int16_t *)((uint8_t *)(fs_) + \
+ (fs_)->fs_old_postbloff) + (cylno) * (fs_)->fs_old_nrpos))
+#define old_fs_rotbl(fs) \
+ (((fs)->fs_old_postblformat == FS_42POSTBLFMT) \
+ ? ((uint8_t *)(&(fs)->fs_magic+1)) \
+ : ((uint8_t *)((uint8_t *)(fs) + (fs)->fs_old_rotbloff)))
+
+/*
+ * File system identification
+ */
+#define FS_UFS1_MAGIC 0x011954 /* UFS1 fast file system magic number */
+#define FS_UFS2_MAGIC 0x19540119 /* UFS2 fast file system magic number */
+#define FS_UFS1_MAGIC_SWAPPED 0x54190100
+#define FS_UFS2_MAGIC_SWAPPED 0x19015419
+#define FS_OKAY 0x7c269d38 /* superblock checksum */
+#define FS_42INODEFMT -1 /* 4.2BSD inode format */
+#define FS_44INODEFMT 2 /* 4.4BSD inode format */
+
+/*
+ * File system clean flags
+ */
+#define FS_ISCLEAN 0x01
+#define FS_WASCLEAN 0x02
+
+/*
+ * Preference for optimization.
+ */
+#define FS_OPTTIME 0 /* minimize allocation time */
+#define FS_OPTSPACE 1 /* minimize disk fragmentation */
+
+/*
+ * File system flags
+ */
+#define FS_UNCLEAN 0x01 /* file system not clean at mount (unused) */
+#define FS_DOSOFTDEP 0x02 /* file system using soft dependencies */
+#define FS_NEEDSFSCK 0x04 /* needs sync fsck (FreeBSD compat, unused) */
+#define FS_INDEXDIRS 0x08 /* kernel supports indexed directories */
+#define FS_ACLS 0x10 /* file system has ACLs enabled */
+#define FS_MULTILABEL 0x20 /* file system is MAC multi-label */
+#define FS_FLAGS_UPDATED 0x80 /* flags have been moved to new location */
+
+/*
+ * File system internal flags, also in fs_flags.
+ * (Pick highest number to avoid conflicts with others)
+ */
+#define FS_SWAPPED 0x80000000 /* file system is endian swapped */
+#define FS_INTERNAL 0x80000000 /* mask for internal flags */
+
+/*
+ * The size of a cylinder group is calculated by CGSIZE. The maximum size
+ * is limited by the fact that cylinder groups are at most one block.
+ * Its size is derived from the size of the maps maintained in the
+ * cylinder group and the (struct cg) size.
+ */
+#define CGSIZE_IF(fs, ipg, fpg) \
+ /* base cg */ (sizeof(struct cg) + sizeof(int32_t) + \
+ /* old btotoff */ (fs)->fs_old_cpg * sizeof(int32_t) + \
+ /* old boff */ (fs)->fs_old_cpg * sizeof(u_int16_t) + \
+ /* inode map */ howmany((ipg), NBBY) + \
+ /* block map */ howmany((fpg), NBBY) +\
+ /* if present */ ((fs)->fs_contigsumsize <= 0 ? 0 : \
+ /* cluster sum */ (fs)->fs_contigsumsize * sizeof(int32_t) + \
+ /* cluster map */ howmany(fragstoblks(fs, (fpg)), NBBY)))
+
+#define CGSIZE(fs) CGSIZE_IF((fs), (fs)->fs_ipg, (fs)->fs_fpg)
+
+/*
+ * The minimal number of cylinder groups that should be created.
+ */
+#define MINCYLGRPS 4
+
+
+/*
+ * Convert cylinder group to base address of its global summary info.
+ */
+#define fs_cs(fs, indx) fs_csp[indx]
+
+/*
+ * Cylinder group block for a file system.
+ */
+#define CG_MAGIC 0x090255
+struct cg {
+ int32_t cg_firstfield; /* historic cyl groups linked list */
+ int32_t cg_magic; /* magic number */
+ int32_t cg_old_time; /* time last written */
+ int32_t cg_cgx; /* we are the cgx'th cylinder group */
+ int16_t cg_old_ncyl; /* number of cyl's this cg */
+ int16_t cg_old_niblk; /* number of inode blocks this cg */
+ int32_t cg_ndblk; /* number of data blocks this cg */
+ struct csum cg_cs; /* cylinder summary information */
+ int32_t cg_rotor; /* position of last used block */
+ int32_t cg_frotor; /* position of last used frag */
+ int32_t cg_irotor; /* position of last used inode */
+ int32_t cg_frsum[MAXFRAG]; /* counts of available frags */
+ int32_t cg_old_btotoff; /* (int32) block totals per cylinder */
+ int32_t cg_old_boff; /* (u_int16) free block positions */
+ int32_t cg_iusedoff; /* (u_int8) used inode map */
+ int32_t cg_freeoff; /* (u_int8) free block map */
+ int32_t cg_nextfreeoff; /* (u_int8) next available space */
+ int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */
+ int32_t cg_clusteroff; /* (u_int8) free cluster map */
+ int32_t cg_nclusterblks; /* number of clusters this cg */
+ int32_t cg_niblk; /* number of inode blocks this cg */
+ int32_t cg_initediblk; /* last initialized inode */
+ int32_t cg_sparecon32[3]; /* reserved for future use */
+ int64_t cg_time; /* time last written */
+ int64_t cg_sparecon64[3]; /* reserved for future use */
+ u_int8_t cg_space[1]; /* space for cylinder group maps */
+/* actually longer */
+};
+
+/*
+ * The following structure is defined
+ * for compatibility with old file systems.
+ */
+struct ocg {
+ int32_t cg_firstfield; /* historic linked list of cyl groups */
+ int32_t cg_unused_1; /* used for incore cyl groups */
+ int32_t cg_time; /* time last written */
+ int32_t cg_cgx; /* we are the cgx'th cylinder group */
+ int16_t cg_ncyl; /* number of cyl's this cg */
+ int16_t cg_niblk; /* number of inode blocks this cg */
+ int32_t cg_ndblk; /* number of data blocks this cg */
+ struct csum cg_cs; /* cylinder summary information */
+ int32_t cg_rotor; /* position of last used block */
+ int32_t cg_frotor; /* position of last used frag */
+ int32_t cg_irotor; /* position of last used inode */
+ int32_t cg_frsum[8]; /* counts of available frags */
+ int32_t cg_btot[32]; /* block totals per cylinder */
+ int16_t cg_b[32][8]; /* positions of free blocks */
+ u_int8_t cg_iused[256]; /* used inode map */
+ int32_t cg_magic; /* magic number */
+ u_int8_t cg_free[1]; /* free block map */
+/* actually longer */
+};
+
+
+/*
+ * Macros for access to cylinder group array structures.
+ */
+#define old_cg_blktot_old(cgp, ns) \
+ (((struct ocg *)(cgp))->cg_btot)
+#define old_cg_blks_old(fs, cgp, cylno, ns) \
+ (((struct ocg *)(cgp))->cg_b[cylno])
+
+#define old_cg_blktot_new(cgp, ns) \
+ ((int32_t *)((u_int8_t *)(cgp) + \
+ ufs_rw32((cgp)->cg_old_btotoff, (ns))))
+#define old_cg_blks_new(fs, cgp, cylno, ns) \
+ ((int16_t *)((u_int8_t *)(cgp) + \
+ ufs_rw32((cgp)->cg_old_boff, (ns))) + (cylno) * (fs)->fs_old_nrpos)
+
+#define old_cg_blktot(cgp, ns) \
+ ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
+ old_cg_blktot_old(cgp, ns) : old_cg_blktot_new(cgp, ns))
+#define old_cg_blks(fs, cgp, cylno, ns) \
+ ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
+ old_cg_blks_old(fs, cgp, cylno, ns) : old_cg_blks_new(fs, cgp, cylno, ns))
+
+#define cg_inosused_new(cgp, ns) \
+ ((u_int8_t *)((u_int8_t *)(cgp) + \
+ ufs_rw32((cgp)->cg_iusedoff, (ns))))
+#define cg_blksfree_new(cgp, ns) \
+ ((u_int8_t *)((u_int8_t *)(cgp) + \
+ ufs_rw32((cgp)->cg_freeoff, (ns))))
+#define cg_chkmagic_new(cgp, ns) \
+ (ufs_rw32((cgp)->cg_magic, (ns)) == CG_MAGIC)
+
+#define cg_inosused_old(cgp, ns) \
+ (((struct ocg *)(cgp))->cg_iused)
+#define cg_blksfree_old(cgp, ns) \
+ (((struct ocg *)(cgp))->cg_free)
+#define cg_chkmagic_old(cgp, ns) \
+ (ufs_rw32(((struct ocg *)(cgp))->cg_magic, (ns)) == CG_MAGIC)
+
+#define cg_inosused(cgp, ns) \
+ ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
+ cg_inosused_old(cgp, ns) : cg_inosused_new(cgp, ns))
+#define cg_blksfree(cgp, ns) \
+ ((ufs_rw32((cgp)->cg_magic, (ns)) != CG_MAGIC) ? \
+ cg_blksfree_old(cgp, ns) : cg_blksfree_new(cgp, ns))
+#define cg_chkmagic(cgp, ns) \
+ (cg_chkmagic_new(cgp, ns) || cg_chkmagic_old(cgp, ns))
+
+#define cg_clustersfree(cgp, ns) \
+ ((u_int8_t *)((u_int8_t *)(cgp) + \
+ ufs_rw32((cgp)->cg_clusteroff, (ns))))
+#define cg_clustersum(cgp, ns) \
+ ((int32_t *)((u_int8_t *)(cgp) + \
+ ufs_rw32((cgp)->cg_clustersumoff, (ns))))
+
+
+/*
+ * Turn file system block numbers into disk block addresses.
+ * This maps file system blocks to device size blocks.
+ */
+#define fsbtodb(fs, b) ((b) << (fs)->fs_fsbtodb)
+#define dbtofsb(fs, b) ((b) >> (fs)->fs_fsbtodb)
+
+/*
+ * Cylinder group macros to locate things in cylinder groups.
+ * They calc file system addresses of cylinder group data structures.
+ */
+#define cgbase(fs, c) (((daddr_t)(fs)->fs_fpg) * (c))
+#define cgstart_ufs1(fs, c) \
+ (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask)))
+#define cgstart_ufs2(fs, c) cgbase((fs), (c))
+#define cgstart(fs, c) ((fs)->fs_magic == FS_UFS2_MAGIC \
+ ? cgstart_ufs2((fs), (c)) : cgstart_ufs1((fs), (c)))
+#define cgdmin(fs, c) (cgstart(fs, c) + (fs)->fs_dblkno) /* 1st data */
+#define cgimin(fs, c) (cgstart(fs, c) + (fs)->fs_iblkno) /* inode blk */
+#define cgsblock(fs, c) (cgstart(fs, c) + (fs)->fs_sblkno) /* super blk */
+#define cgtod(fs, c) (cgstart(fs, c) + (fs)->fs_cblkno) /* cg block */
+
+/*
+ * Macros for handling inode numbers:
+ * inode number to file system block offset.
+ * inode number to cylinder group number.
+ * inode number to file system block address.
+ */
+#define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg)
+#define ino_to_fsba(fs, x) \
+ ((daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \
+ (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs))))))
+#define ino_to_fsbo(fs, x) ((x) % INOPB(fs))
+
+/*
+ * Give cylinder group number for a file system block.
+ * Give cylinder group block number for a file system block.
+ */
+#define dtog(fs, d) ((d) / (fs)->fs_fpg)
+#define dtogd(fs, d) ((d) % (fs)->fs_fpg)
+
+/*
+ * Extract the bits for a block from a map.
+ * Compute the cylinder and rotational position of a cyl block addr.
+ */
+#define blkmap(fs, map, loc) \
+ (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))
+#define old_cbtocylno(fs, bno) \
+ (fsbtodb(fs, bno) / (fs)->fs_old_spc)
+#define old_cbtorpos(fs, bno) \
+ ((fs)->fs_old_nrpos <= 1 ? 0 : \
+ (fsbtodb(fs, bno) % (fs)->fs_old_spc / (fs)->fs_old_nsect * (fs)->fs_old_trackskew + \
+ fsbtodb(fs, bno) % (fs)->fs_old_spc % (fs)->fs_old_nsect * (fs)->fs_old_interleave) % \
+ (fs)->fs_old_nsect * (fs)->fs_old_nrpos / (fs)->fs_old_npsect)
+
+/*
+ * The following macros optimize certain frequently calculated
+ * quantities by using shifts and masks in place of divisions
+ * modulos and multiplications.
+ */
+#define blkoff(fs, loc) /* calculates (loc % fs->fs_bsize) */ \
+ ((loc) & (fs)->fs_qbmask)
+#define fragoff(fs, loc) /* calculates (loc % fs->fs_fsize) */ \
+ ((loc) & (fs)->fs_qfmask)
+#define lfragtosize(fs, frag) /* calculates ((off_t)frag * fs->fs_fsize) */ \
+ (((off_t)(frag)) << (fs)->fs_fshift)
+#define lblktosize(fs, blk) /* calculates ((off_t)blk * fs->fs_bsize) */ \
+ (((off_t)(blk)) << (fs)->fs_bshift)
+#define lblkno(fs, loc) /* calculates (loc / fs->fs_bsize) */ \
+ ((loc) >> (fs)->fs_bshift)
+#define numfrags(fs, loc) /* calculates (loc / fs->fs_fsize) */ \
+ ((loc) >> (fs)->fs_fshift)
+#define blkroundup(fs, size) /* calculates roundup(size, fs->fs_bsize) */ \
+ (((size) + (fs)->fs_qbmask) & (fs)->fs_bmask)
+#define fragroundup(fs, size) /* calculates roundup(size, fs->fs_fsize) */ \
+ (((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)
+#define fragstoblks(fs, frags) /* calculates (frags / fs->fs_frag) */ \
+ ((frags) >> (fs)->fs_fragshift)
+#define blkstofrags(fs, blks) /* calculates (blks * fs->fs_frag) */ \
+ ((blks) << (fs)->fs_fragshift)
+#define fragnum(fs, fsb) /* calculates (fsb % fs->fs_frag) */ \
+ ((fsb) & ((fs)->fs_frag - 1))
+#define blknum(fs, fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \
+ ((fsb) &~ ((fs)->fs_frag - 1))
+
+/*
+ * Determine the number of available frags given a
+ * percentage to hold in reserve.
+ */
+#define freespace(fs, percentreserved) \
+ (blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \
+ (fs)->fs_cstotal.cs_nffree - \
+ (((off_t)((fs)->fs_dsize)) * (percentreserved) / 100))
+
+/*
+ * Determining the size of a file block in the file system.
+ */
+#define blksize(fs, ip, lbn) \
+ (((lbn) >= NDADDR || (ip)->i_size >= lblktosize(fs, (lbn) + 1)) \
+ ? (fs)->fs_bsize \
+ : (fragroundup(fs, blkoff(fs, (ip)->i_size))))
+
+#define sblksize(fs, size, lbn) \
+ (((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \
+ ? (fs)->fs_bsize \
+ : (fragroundup(fs, blkoff(fs, (size)))))
+
+
+/*
+ * Number of inodes in a secondary storage block/fragment.
+ */
+#define INOPB(fs) ((fs)->fs_inopb)
+#define INOPF(fs) ((fs)->fs_inopb >> (fs)->fs_fragshift)
+
+/*
+ * Number of indirects in a file system block.
+ */
+#define NINDIR(fs) ((fs)->fs_nindir)
+
+/*
+ * Apple UFS Label:
+ * We check for this to decide to use APPLEUFS_DIRBLKSIZ
+ */
+#define APPLEUFS_LABEL_MAGIC 0x4c41424c /* LABL */
+#define APPLEUFS_LABEL_SIZE 1024
+#define APPLEUFS_LABEL_OFFSET (BBSIZE - APPLEUFS_LABEL_SIZE) /* located at 7k */
+#define APPLEUFS_LABEL_VERSION 1
+#define APPLEUFS_MAX_LABEL_NAME 512
+
+#if 0
+struct appleufslabel {
+ u_int32_t ul_magic;
+ u_int16_t ul_checksum;
+ u_int16_t ul_unused0;
+ u_int32_t ul_version;
+ u_int32_t ul_time;
+ u_int16_t ul_namelen;
+ u_char ul_name[APPLEUFS_MAX_LABEL_NAME]; /* Warning: may not be null terminated */
+ u_int16_t ul_unused1;
+ u_int64_t ul_uuid; /* Note this is only 4 byte aligned */
+ u_char ul_reserved[24];
+ u_char ul_unused[460];
+} __attribute__((__packed__));
+#endif
+
+
+#endif /* !_UFS_FFS_FS_H_ */
--- /dev/null
+/*
+ This is a free version of the file ntifs.h, release 58.
+ The purpose of this include file is to build file system and
+ file system filter drivers for Windows.
+ Copyright (C) 1999-2015 Bo Brantén.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ The GNU General Public License is also available from:
+ http://www.gnu.org/copyleft/gpl.html
+
+ Windows and Windows NT are either registered trademarks or trademarks of
+ Microsoft Corporation in the United States and/or other countries.
+
+ DISCLAIMER: I do not encourage anyone to use this include file to build
+ drivers used in production. Some of the information in this file may not
+ be available in other publications intended for similar use. Some of the
+ information in this file may have different names than in other
+ publications even though they describe the same thing.
+
+ NOTE: This file should be used with the Microsoft® Windows® Driver
+ Development Kit (DDK) while the file wdkundoc.h is a subset of this
+ file that should be used with the Microsoft Windows Driver Kit (WDK).
+
+ Please send comments, corrections and contributions to bosse@acc.umu.se.
+
+ The most recent version of this file is available from:
+ http://www.acc.umu.se/~bosse/ntifs.h
+
+ The most recent version of the file wdkundoc.h is available from:
+ http://www.acc.umu.se/~bosse/wdkundoc.h
+
+ Thanks to:
+ Andrey Shedel, Luigi Mori, Louis Joubert, Itai Shaham, David Welch,
+ Emanuele Aliberti, Anton Altaparmakov, Dan Partelly, Mamaich, Yossi
+ Yaffe, Gunnar André Dalsnes, Vadim V Vorobev, Ashot Oganesyan K,
+ Oleg Nikityenko, Matt Wu, Tomas Olsson, Raaf, Anthony Choi, Alexey
+ Logachyov, Marc-Antoine Ruel, Vyacheslav I. Levtchenko, Yuri Polyakov,
+ Bruno Milot, Alex Vlasov, Dan Fulger, Petr Semerad, Sobame La Garompa,
+ Jérôme Hodé and Darja Isaksson.
+
+ Revision history:
+
+ 58. 2015-06-11
+ Added:
+ Externals:
+ PsInitialSystemProcess
+ HalPrivateDispatchTable
+ KeLoaderBlock
+ KeI386MachineType
+ KiBugCheckData
+ InitSafeBootMode
+ KiEnableTimerWatchdog
+ KdComPortInUse
+ KdEnteredDebugger
+ MmBadPointer
+ NlsLeadByteInfo
+ NlsOemLeadByteInfo
+ NlsMbCodePageTag
+ NlsMbOemCodePageTag
+ NlsAnsiCodePage
+ NlsOemCodePage
+ IoStatisticsLock
+ IoReadOperationCount
+ IoWriteOperationCount
+ IoReadTransferCount
+ IoWriteTransferCount
+ KeDcacheFlushCount
+ KeIcacheFlushCount
+ CcFastMdlReadWait
+ CcFastReadNotPossible
+ CcFastReadWait
+ IoAdapterObjectType
+ IoDeviceObjectType
+ MmSectionObjectType
+ PsProcessType
+ PsThreadType
+ ExDesktopObjectType
+ ExWindowStationObjectType
+ IoDeviceHandlerObjectType
+ LpcPortObjectType
+ PsJobType
+ SeTokenObjectType
+ TmEnlistmentObjectType
+ TmResourceManagerObjectType
+ TmTransactionManagerObjectType
+ TmTransactionObjectType
+ CmKeyObjectType
+ IoDeviceHandlerObjectSize
+ POGOBuffer
+ psMUITest
+ PsUILanguageComitted
+
+ 57. 2015-03-23
+ Corrected:
+ ObGetObjectPointerCount
+ Added:
+ Function prototypes:
+ FsRtlTeardownPerFileContexts
+ FsRtlTeardownPerStreamContexts
+
+ 56. 2008-07-31
+ Corrected:
+ FSCTL_SET_SPARSE
+ FSRTL_COMMON_FCB_HEADER
+ Added:
+ Defines:
+ FSRTL_XXX
+ IO_REPARSE_TAG_XXX
+ Data types:
+ FSRTL_ADVANCED_FCB_HEADER
+ Function prototypes:
+ FsRtlSetupAdvancedHeader
+
+ 55. 2006-05-15
+ Corrected:
+ TOKEN_OBJECT
+ Added:
+ Data types:
+ SEP_AUDIT_POLICY_VISTA
+ SID_AND_ATTRIBUTES_HASH
+
+ 54. 2006-05-14
+ Corrected:
+ EXTENDED_IO_STACK_LOCATION
+
+ 53. 2005-11-06
+ Added:
+ Function prototypes:
+ RtlRandom
+ RtlRandomEx
+ RtlSecondsSince1980ToTime
+ RtlTimeToSecondsSince1980
+
+ 52. 2005-11-05
+ Corrected:
+ OBJECT_NAME
+ TOKEN_OBJECT
+
+ 51. 2005-10-16
+ Corrected:
+ ETHREAD
+ GDI_TEB_BATCH
+ MMADDRESS_NODE
+ TEB
+
+ 50. 2005-10-15
+ Added:
+ Data types:
+ READ_LIST
+ Function prototypes:
+ IoAttachDeviceToDeviceStackSafe
+ IoCheckQuerySetFileInformation
+ IoCheckQuerySetVolumeInformation
+ IoCreateFileSpecifyDeviceObjectHint
+ IoCreateStreamFileObjectEx
+ IoEnumerateDeviceObjectList
+ IoGetDeviceAttachmentBaseRef
+ IoGetDiskDeviceObject
+ IoGetLowerDeviceObject
+ IoIsFileOriginRemote
+ IoQueryFileDosDeviceName
+ IoQueueThreadIrp
+ IoSetFileOrigin
+ KeAcquireQueuedSpinLock
+ KeInitializeMutant
+ KeReadStateMutant
+ KeReleaseMutant
+ KeReleaseQueuedSpinLock
+ KeSetIdealProcessorThread
+ KeSetKernelStackSwapEnable
+ KeTryToAcquireQueuedSpinLock
+ MmPrefetchPages
+ ObDereferenceSecurityDescriptor
+ ObLogSecurityDescriptor
+ ObReferenceSecurityDescriptor
+ PoQueueShutdownWorkItem
+ RtlxUnicodeStringToAnsiSize
+ SeAuditHardLinkCreation
+ SeAuditingHardLinkEvents
+ SeFilterToken
+
+ 49. 2005-10-09
+ Corrected:
+ EPROCESS
+ KTHREAD
+ MMSUPPORT_FLAGS
+ MMSUPPORT
+ OBJECT_HEADER
+ OBJECT_TYPE_INITIALIZER
+ OBJECT_TYPE
+ TEB
+ KeInsertQueueApc
+ Added:
+ Defines:
+ OB_FLAG_XXX
+ OB_SECURITY_CHARGE
+ Data types:
+ ACTIVATION_CONTEXT_STACK
+ GDI_TEB_BATCH
+ HANDLE_INFO
+ KGUARDED_MUTEX
+ MMADDRESS_NODE
+ MM_AVL_TABLE
+ OBJECT_CREATE_INFORMATION
+ OBJECT_CREATOR_INFO
+ OBJECT_DIRECTORY
+ OBJECT_DIRECTORY_ITEM
+ OBJECT_HANDLE_DB
+ OBJECT_HANDLE_DB_LIST
+ OBJECT_HEADER_FLAGS
+ OBJECT_NAME
+ OBJECT_QUOTA_CHARGES
+ OBJECT_QUOTA_INFO
+ QUOTA_BLOCK
+ RTL_ACTIVATION_CONTEXT_STACK_FRAME
+ TEB_ACTIVE_FRAME
+ TEB_ACTIVE_FRAME_CONTEXT
+ Wx86ThreadState
+ Function prototypes:
+ FsRtlAcquireFileExclusive
+ FsRtlBalanceReads
+ FsRtlDissectDbcs
+ FsRtlDoesDbcsContainWildCards
+ FsRtlIsDbcsInExpression
+ FsRtlIsFatDbcsLegal
+ FsRtlIsHpfsDbcsLegal
+ FsRtlIsPagingFile
+ FsRtlIsTotalDeviceFailure
+ FsRtlMdlReadDev
+ FsRtlPostPagingFileStackOverflow
+ FsRtlPostStackOverflow
+ FsRtlPrepareMdlWriteDev
+ FsRtlReleaseFile
+
+ 48. 2005-04-16
+ Added:
+ Data types:
+ THREAD_BASIC_INFORMATION
+ Function prototypes:
+ ZwQueryInformationThread
+
+ 47. 2005-03-08
+ Corrected:
+ SYSTEM_PROCESSES_INFORMATION
+ TOKEN_OBJECT
+ KeInsertQueueApc
+
+ 46. 2004-06-08
+ Added:
+ Data types:
+ TOKEN_OBJECT
+
+ 45. 2004-06-06
+ Corrected:
+ SERVICE_DESCRIPTOR_TABLE
+ Added:
+ Defines:
+ TOKEN_SESSION_NOT_REFERENCED
+ TOKEN_SANDBOX_INERT
+ TOKEN_HAS_IMPERSONATE_PRIVILEGE
+ Function prototypes:
+ FsRtlDissectName
+ RtlOemStringToCountedUnicodeSize
+ RtlOemStringToUnicodeSize
+ RtlOemStringToUnicodeString
+ RtlUnicodeStringToOemSize
+ RtlUnicodeStringToOemString
+ RtlxOemStringToUnicodeSize
+ RtlxUnicodeStringToOemSize
+
+ 44. 2003-05-06
+ Added:
+ Function prototypes:
+ InbvAcquireDisplayOwnership
+ InbvCheckDisplayOwnership
+ InbvDisplayString
+ InbvEnableBootDriver
+ InbvEnableDisplayString
+ InbvInstallDisplayStringFilter
+ InbvIsBootDriverInstalled
+ InbvNotifyDisplayOwnershipLost
+ InbvResetDisplay
+ InbvSetScrollRegion
+ InbvSetTextColor
+ InbvSolidColorFill
+
+ 43. 2003-04-07
+ Added:
+ Data types:
+ MCB
+ Function prototypes:
+ FsRtlAddMcbEntry
+ FsRtlInitializeMcb
+ FsRtlLookupLastMcbEntry
+ FsRtlLookupMcbEntry
+ FsRtlNotifyFilterChangeDirectory
+ FsRtlNotifyFilterReportChange
+ FsRtlNumberOfRunsInMcb
+ FsRtlRemoveMcbEntry
+ FsRtlTruncateMcb
+ FsRtlUninitializeMcb
+
+ 42. 2003-03-30
+ Corrected:
+ SYSTEM_CACHE_INFORMATION
+ SYSTEM_INFORMATION_CLASS
+ Added:
+ Data types:
+ SYSTEM_XXX_INFORMATION
+ THREAD_STATE
+
+ 41. 2003-01-03
+ Corrected:
+ CcMapData
+ PsDereferenceImpersonationToken
+ PsDereferencePrimaryToken
+ PsGetProcessExitTime
+ PsReferencePrimaryToken
+ Added:
+ Defines:
+ MAP_XXX
+ Function prototypes:
+ CcMdlWriteAbort
+ PsAssignImpersonationToken
+ PsChargeProcessNonPagedPoolQuota
+ PsChargeProcessPagedPoolQuota
+ PsChargeProcessPoolQuota
+ PsDisableImpersonation
+ PsImpersonateClient
+ PsIsSystemThread
+ PsRestoreImpersonation
+ SeDeleteAccessState
+ ZwOpenProcessTokenEx
+ ZwOpenThreadTokenEx
+
+ 40. 2002-10-02
+ Corrected:
+ HANDLE_TABLE_ENTRY
+ Added:
+ Defines:
+ FSRTL_FLAG_ADVANCED_HEADER
+ FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS
+ FSRTL_FLAG2_PURGE_WHEN_MAPPED
+ Data types:
+ FILE_ID_BOTH_DIR_INFORMATION
+ FILE_ID_FULL_DIR_INFORMATION
+
+ 39. 2002-08-04
+ Added:
+ Data types:
+ LARGE_MCB
+ Function prototypes:
+ FsRtlAddLargeMcbEntry
+ FsRtlGetNextLargeMcbEntry
+ FsRtlInitializeLargeMcb
+ FsRtlLookupLargeMcbEntry
+ FsRtlLookupLastLargeMcbEntry
+ FsRtlLookupLastLargeMcbEntryAndIndex
+ FsRtlNumberOfRunsInLargeMcb
+ FsRtlRemoveLargeMcbEntry
+ FsRtlResetLargeMcb
+ FsRtlSplitLargeMcb
+ FsRtlTruncateLargeMcb
+ FsRtlUninitializeLargeMcb
+
+ 38. 2002-06-30
+ Added:
+ Defines:
+ FILE_READ_ONLY_VOLUME
+ Function prototypes:
+ FsRtlAllocateResource
+ FsRtlIncrementCcFastReadNotPossible
+ FsRtlIncrementCcFastReadNoWait
+ FsRtlIncrementCcFastReadResourceMiss
+ FsRtlIncrementCcFastReadWait
+ KeIsAttachedProcess
+ KeIsExecutingDpc
+ KeRevertToUserAffinityThread
+ KeUpdateSystemTime
+ PsGetCurrentProcessSessionId
+ PsGetCurrentThreadPreviousMode
+ PsGetCurrentThreadStackBase
+ PsGetCurrentThreadStackLimit
+ RtlGetNtGlobalFlags
+
+ 37. 2002-05-18
+ Uppdated for Windows XP:
+ EPROCESS
+ ETHREAD
+ KPROCESS
+ KTHREAD
+ MMSUPPORT_FLAGS
+ MMSUPPORT
+ PRIVATE_CACHE_MAP_FLAGS
+ PRIVATE_CACHE_MAP
+ SHARED_CACHE_MAP
+ Corrected:
+ VACB
+ Added:
+ Data types:
+ EPROCESS_QUOTA_ENTRY
+ EPROCESS_QUOTA_BLOCK
+ EX_FAST_REF
+ EX_PUSH_LOCK
+ EX_RUNDOWN_REF
+ PAGEFAULT_HISTORY
+ SE_AUDIT_PROCESS_CREATION_INFO
+ SECTION_OBJECT
+ TERMINATION_PORT
+
+ 36. 2002-05-14
+ Corrected:
+ FILE_FS_FULL_SIZE_INFORMATION
+
+ 35. 2002-03-23
+ Added:
+ Defines:
+ COMPRESSION_XXX
+ Data types:
+ COMPRESSED_DATA_INFO
+ OBJECT_HEADER
+ VAD_HEADER
+ Function prototypes:
+ CcWaitForCurrentLazyWriterActivity
+ FsRtlCheckOplock
+ FsRtlCurrentBatchOplock
+ FsRtlDeregisterUncProvider
+ FsRtlInitializeOplock
+ FsRtlOplockFsctrl
+ FsRtlOplockIsFastIoPossible
+ FsRtlRegisterUncProvider
+ FsRtlUninitializeOplock
+ RtlCompressBuffer
+ RtlCompressChunks
+ RtlDecompressBuffer
+ RtlDecompressChunks
+ RtlDecompressFragment
+ RtlDescribeChunk
+ RtlGetCompressionWorkSpaceSize
+ RtlReserveChunk
+
+ 34. 2002-02-14
+ Corrected:
+ HARDWARE_PTE
+ Changed the use of _WIN32_WINNT to VER_PRODUCTBUILD since _WIN32_WINNT
+ is incorrectly defined in the Windows 2000 build environment included
+ in the Windows XP DDK.
+
+ 33. 2002-01-20
+ Added:
+ Function prototypes:
+ PsDereferenceImpersonationToken
+ PsDereferencePrimaryToken
+
+ 32. 2002-01-18
+ Corrected:
+ ObReferenceObjectByName
+ FILE_FS_OBJECT_ID_INFORMATION
+ FILE_OBJECTID_INFORMATION
+ Added:
+ Externals:
+ IoDriverObjectType
+ SeExports
+ Defines:
+ FILE_ACTION_XXX
+ FSCTL_XXX
+ IO_FILE_OBJECT_XXX
+ IRP_BEING_VERIFIED
+ TOKEN_XXX
+ Data types:
+ DEVICE_MAP
+ FILE_TRACKING_INFORMATION
+ SE_EXPORTS
+ Function prototypes:
+ SeEnableAccessToExports
+
+ 31. 2001-12-23
+ Corrected:
+ QueryQuota in EXTENDED_IO_STACK_LOCATION
+ FILE_LOCK
+ CcPinMappedData
+ CcPinRead
+ CcPreparePinWrite
+ FsRtlFastUnlockAll
+ FsRtlFastUnlockAllByKey
+ FsRtlFastUnlockSingle
+ FsRtlInitializeFileLock
+ FsRtlPrivateLock
+ FsRtlProcessFileLock
+ MmForceSectionClosed
+ MmIsRecursiveIoFault
+ SeImpersonateClient
+ SeImpersonateClientEx
+ Added:
+ Defines:
+ More FSRTL_FLAG_XXX
+ PIN_XXX
+ VACB_XXX
+ Data types:
+ REPARSE_DATA_BUFFER
+ Function prototypes:
+ CcCopyWriteWontFlush
+ CcGetFileSizePointer
+ CcGetFlushedValidData
+ CcIsFileCached
+ CcRemapBcb
+ ExDisableResourceBoostLite
+ ExQueryPoolBlockSize
+ FsRtlAllocateFileLock
+ FsRtlAreThereCurrentFileLocks
+ FsRtlFastLock
+ FsRtlFreeFileLock
+ IoCheckDesiredAccess
+ IoCheckEaBufferValidity
+ IoCheckFunctionAccess
+ IoCheckQuotaBufferValidity
+ IoCreateStreamFileObjectLite
+ IoFastQueryNetworkAttributes
+ IoGetRequestorProcessId
+ IoIsFileOpenedExclusively
+ IoIsSystemThread
+ IoIsValidNameGraftingBuffer
+ IoSynchronousPageWrite
+ IoThreadToProcess
+ KeInitializeQueue
+ KeInsertHeadQueue
+ KeInsertQueue
+ KeReadStateQueue
+ KeRemoveQueue
+ KeRundownQueue
+ MmSetAddressRangeModified
+ ObGetObjectPointerCount
+ ObMakeTemporaryObject
+ ObQueryObjectAuditingByHandle
+ PsChargePoolQuota
+ PsReturnPoolQuota
+ SeAppendPrivileges
+ SeAuditingFileEvents
+ SeAuditingFileOrGlobalEvents
+ SeCreateClientSecurity
+ SeCreateClientSecurityFromSubjectContext
+ SeDeleteClientSecurity
+ SeDeleteObjectAuditAlarm
+ SeFreePrivileges
+ SeLockSubjectContext
+ SeOpenObjectAuditAlarm
+ SeOpenObjectForDeleteAuditAlarm
+ SePrivilegeCheck
+ SeQueryAuthenticationIdToken
+ SeQuerySecurityDescriptorInfo
+ SeQuerySessionIdToken
+ SeSetAccessStateGenericMapping
+ SeSetSecurityDescriptorInfo
+ SeSetSecurityDescriptorInfoEx
+ SeTokenIsAdmin
+ SeTokenIsRestricted
+ SeTokenType
+ SeUnlockSubjectContext
+
+ 30. 2001-10-24
+ Corrected:
+ KINTERRUPT
+ OBJECT_TYPE
+ Added:
+ Defines:
+ More FSCTL_XXX
+ Data types:
+ BITMAP_RANGE
+ CreateMailslot in EXTENDED_IO_STACK_LOCATION
+ CreatePipe in EXTENDED_IO_STACK_LOCATION
+ QueryQuota in EXTENDED_IO_STACK_LOCATION
+ MAILSLOT_CREATE_PARAMETERS
+ MBCB
+ NAMED_PIPE_CREATE_PARAMETERS
+ PRIVATE_CACHE_MAP_FLAGS
+ PRIVATE_CACHE_MAP
+ SECURITY_CLIENT_CONTEXT
+ SHARED_CACHE_MAP
+ VACB
+ Function prototypes:
+ HalQueryRealTimeClock
+ HalSetRealTimeClock
+ PsGetProcessExitTime
+ PsIsThreadTerminating
+ PsLookupProcessThreadByCid
+ PsLookupThreadByThreadId
+ SeQueryAuthenticationIdToken
+ Externals:
+ KeServiceDescriptorTable
+ SePublicDefaultDacl
+ SeSystemDefaultDacl
+
+ 29. 2001-10-06
+ Added:
+ Defines:
+ FSRTL_VOLUME_XXX
+ Function prototypes:
+ FsRtlNotifyChangeDirectory
+ FsRtlNotifyReportChange
+ FsRtlNotifyVolumeEvent
+
+ 28. 2001-09-16
+ Added:
+ Function prototypes:
+ FsRtlNotifyInitializeSync
+ FsRtlNotifyUninitializeSync
+ SeImpersonateClientEx
+ SeReleaseSubjectContext
+
+ 27. 2001-08-25
+ Corrected:
+ KPROCESS
+ FILE_LOCK_ANCHOR
+ FsRtlNormalizeNtstatus
+ RtlSecondsSince1970ToTime
+ RtlTimeToSecondsSince1970
+ SeQueryInformationToken
+ Added:
+ Defines:
+ FS_LFN_APIS
+ Data types:
+ FILE_LOCK_ENTRY
+ FILE_SHARED_LOCK_ENTRY
+ FILE_EXCLUSIVE_LOCK_ENTRY
+ Function prototypes:
+ FsRtlCheckLockForReadAccess
+ FsRtlCheckLockForWriteAccess
+ FsRtlFastUnlockAll
+ FsRtlFastUnlockAllByKey
+ FsRtlFastUnlockSingle
+ FsRtlGetFileSize
+ FsRtlGetNextFileLock
+ FsRtlInitializeFileLock
+ FsRtlPrivateLock
+ FsRtlProcessFileLock
+ FsRtlUninitializeFileLock
+ IoUnregisterFsRegistrationChange
+ PsLookupProcessByProcessId
+ SeQuerySubjectContextToken
+
+ 26. 2001-04-28
+ Added:
+ Defines:
+ FSCTL_XXX
+ Data types:
+ RTL_SPLAY_LINKS
+ TUNNEL
+ Function prototypes:
+ FsRtlAddToTunnelCache
+ FsRtlDeleteKeyFromTunnelCache
+ FsRtlDeleteTunnelCache
+ FsRtlFindInTunnelCache
+ FsRtlInitializeTunnelCache
+ IoSetDeviceToVerify
+ KeInitializeApc
+ KeInsertQueueApc
+ SeQueryInformationToken
+
+ 25. 2001-04-05
+ Corrected:
+ RtlImageNtHeader
+ LPC_XXX
+ OBJECT_BASIC_INFO
+ Added:
+ Defines:
+ SID_REVISION
+ Data types:
+ DIRECTORY_BASIC_INFORMATION
+ KINTERRUPT
+ OBJECT_HANDLE_ATTRIBUTE_INFO
+ PROCESS_PRIORITY_CLASS
+ SECTION_BASIC_INFORMATION
+ SECTION_IMAGE_INFORMATION
+ SECTION_INFORMATION_CLASS
+ Function prototypes:
+ RtlSecondsSince1970ToTime
+ RtlTimeToSecondsSince1970
+ ZwAdjustPrivilegesToken
+ ZwAlertThread
+ ZwAccessCheckAndAuditAlarm
+ ZwClearEvent
+ ZwCloseObjectAuditAlarm
+ ZwCreateSection
+ ZwCreateSymbolicLinkObject
+ ZwDuplicateToken
+ ZwFlushInstructionCache
+ ZwFlushVirtualMemory
+ ZwInitiatePowerAction
+ ZwLoadKey
+ ZwNotifyChangeKey
+ ZwOpenThread
+ ZwPowerInformation
+ ZwPulseEvent
+ ZwQueryDefaultLocale
+ ZwQueryDefaultUILanguage
+ ZwQueryInformationProcess
+ ZwQueryInstallUILanguage
+ ZwQuerySection
+ ZwReplaceKey
+ ZwResetEvent
+ ZwRestoreKey
+ ZwSaveKey
+ ZwSetDefaultLocale
+ ZwSetDefaultUILanguage
+ ZwSetEvent
+ ZwSetInformationObject
+ ZwSetInformationProcess
+ ZwSetSecurityObject
+ ZwSetSystemTime
+ ZwTerminateProcess
+ ZwUnloadKey
+ ZwWaitForSingleObject
+ ZwWaitForMultipleObjects
+ ZwYieldExecution
+ Removed functions that is not exported in kernel mode:
+ CcZeroEndOfLastPage
+ RtlAllocateAndInitializeSid
+ ZwAcceptConnectPort
+ ZwCompleteConnectPort
+ ZwCreatePort
+ ZwCreateProcess
+ ZwCreateThread
+ ZwFlushBuffersFile
+ ZwGetContextThread
+ ZwImpersonateClientOfPort
+ ZwListenPort
+ ZwLockFile
+ ZwNotifyChangeDirectoryFile
+ ZwQueryInformationPort
+ ZwReadRequestData
+ ZwReplyPort
+ ZwReplyWaitReceivePort
+ ZwReplyWaitReplyPort
+ ZwRequestPort
+ ZwUnlockFile
+ ZwWriteRequestData
+
+ 24. 2001-03-08
+ Corrected:
+ EPROCESS
+ ETHREAD
+ FAST_IO_POSSIBLE
+ QueryEa in EXTENDED_IO_STACK_LOCATION
+ Added:
+ Defines:
+ Some more flags for FileSystemAttributes
+ Data types:
+ EXCEPTION_REGISTRATION_RECORD
+ FILE_FS_FULL_SIZE_INFORMATION
+ FILE_FS_OBJECT_ID_INFORMATION
+ HANDLE_TABLE_ENTRY
+ IO_CLIENT_EXTENSION
+ PS_IMPERSONATION_INFORMATION
+ SetEa and SetQuota in EXTENDED_IO_STACK_LOCATION
+ Function prototypes:
+ IoPageRead
+ KeStackAttachProcess
+ KeUnstackDetachProcess
+ MmMapViewOfSection
+ RtlSelfRelativeToAbsoluteSD
+ SeCreateAccessState
+
+ 23. 2001-01-29
+ Corrected:
+ FSCTL_GET_VOLUME_INFORMATION
+ FSCTL_READ_MFT_RECORD
+ HARDWARE_PTE
+ EPROCESS
+ ETHREAD
+ KAPC_STATE
+ KPROCESS
+ KTHREAD
+ MMSUPPORT
+ Added:
+ Data types:
+ KGDTENTRY
+ KIDTENTRY
+ MMSUPPORT_FLAGS
+
+ 22. 2000-12-23
+ Corrected:
+ EPROCESS
+ KPROCESS
+ Added:
+ Data types:
+ HARDWARE_PTE
+ MMSUPPORT
+
+ 21. 2000-12-12
+ Added:
+ Defines:
+ IO_TYPE_XXX
+ OB_TYPE_XXX
+ THREAD_STATE_XXX
+ Data types:
+ EPROCESS
+ ETHREAD
+ KAPC_STATE
+ KEVENT_PAIR
+ KPROCESS
+ KTHREAD
+ KQUEUE
+ SERVICE_DESCRIPTOR_TABLE
+ TEB
+
+ 20. 2000-12-03
+ Added:
+ Data types:
+ OBJECT_TYPE
+ Function prototypes:
+ ObCreateObject
+ ObInsertObject
+ ObReferenceObjectByName
+
+ 19. 2000-11-25
+ Removed a name from credits since the person want to be anonymous.
+
+ 18. 2000-10-13
+ Corrected:
+ PsReferenceImpersonationToken
+ Added:
+ Defines:
+ FILE_PIPE_XXX
+ LPC_XXX
+ MAILSLOT_XXX
+ PORT_XXX
+ FSCTL_GET_VOLUME_INFORMATION
+ FSCTL_READ_MFT_RECORD
+ FSCTL_MAILSLOT_PEEK
+ FSCTL_PIPE_XXX
+ Data types:
+ PORT_INFORMATION_CLASS
+ BITMAP_DESCRIPTOR
+ FILE_MAILSLOT_XXX
+ FILE_PIPE_XXX
+ MAPPING_PAIR
+ GET_RETRIEVAL_DESCRIPTOR
+ LPC_XXX
+ MOVEFILE_DESCRIPTOR
+ Function prototypes:
+ InitializeMessageHeader
+ MmForceSectionClosed
+ ZwAcceptConnectPort
+ ZwCompleteConnectPort
+ ZwConnectPort
+ ZwCreateEvent
+ ZwCreatePort
+ ZwImpersonateClientOfPort
+ ZwListenPort
+ ZwQueryInformationPort
+ ZwReadRequestData
+ ZwReplyPort
+ ZwReplyWaitReceivePort
+ ZwReplyWaitReplyPort
+ ZwRequestPort
+ ZwRequestWaitReplyPort
+ ZwWriteRequestData
+
+ 17. 2000-05-21
+ Added:
+ Function prototypes:
+ PsRevertToSelf
+ SeCreateClientSecurity
+ SeImpersonateClient
+ ZwDuplicateObject
+
+ 16. 2000-03-28
+ Added:
+ Defines:
+ FILE_STORAGE_TYPE_XXX
+ FILE_VC_XXX
+ IO_CHECK_CREATE_PARAMETERS
+ IO_ATTACH_DEVICE
+ IO_ATTACH_DEVICE_API
+ IO_COMPLETION_XXX
+ Data types:
+ IO_COMPLETION_INFORMATION_CLASS
+ OBJECT_INFO_CLASS
+ SYSTEM_INFORMATION_CLASS
+ FILE_LOCK_ANCHOR
+ IO_COMPLETION_BASIC_INFORMATION
+ OBJECT_BASIC_INFO
+ OBJECT_NAME_INFO
+ OBJECT_PROTECTION_INFO
+ OBJECT_TYPE_INFO
+ OBJECT_ALL_TYPES_INFO
+ SYSTEM_CACHE_INFORMATION
+ Function prototypes:
+ FsRtlAllocatePool
+ FsRtlAllocatePoolWithQuota
+ FsRtlAllocatePoolWithQuotaTag
+ FsRtlAllocatePoolWithTag
+ FsRtlAreNamesEqual
+ FsRtlFastCheckLockForRead
+ FsRtlFastCheckLockForWrite
+ FsRtlMdlReadComplete
+ FsRtlMdlWriteComplete
+ FsRtlNormalizeNtstatus
+ RtlAllocateHeap
+ RtlCreateHeap
+ RtlDestroyHeap
+ RtlFreeHeap
+ RtlImageNtHeader
+ ZwQueryObject
+ ZwQuerySystemInformation
+ ZwSetSystemInformation
+
+ 15. 2000-03-15
+ Corrected:
+ Renamed IoQueryFileVolumeInformation to IoQueryVolumeInformation
+ Comment on:
+ CcZeroEndOfLastPage
+
+ 14. 2000-03-12
+ Corrected:
+ IoCreateFile
+ Added:
+ #if (_WIN32_WINNT < 0x0500)/#endif around stuff that is included in
+ the Windows 2000 DDK but is missing in the Windows NT 4.0 DDK.
+ ZwOpenEvent
+
+ 13. 2000-02-08
+ Corrected:
+ PsReferenceImpersonationToken
+ Comment on:
+ RtlAllocateAndInitializeSid
+
+ 12. 1999-10-18
+ Corrected:
+ FILE_COMPRESSION_INFORMATION
+ Added:
+ Defines:
+ ACCESS_ALLOWED_ACE_TYPE
+ ACCESS_DENIED_ACE_TYPE
+ SYSTEM_AUDIT_ACE_TYPE
+ SYSTEM_ALARM_ACE_TYPE
+ ANSI_DOS_STAR/QM/DOT
+ DOS_STAR/QM/DOT
+ FILE_EA_TYPE_XXX
+ FILE_NEED_EA
+ FILE_OPBATCH_BREAK_UNDERWAY
+ SECURITY_WORLD_SID_AUTHORITY
+ SECURITY_WORLD_RID
+ Data types:
+ POBJECT
+ FILE_STORAGE_TYPE
+ FILE_COMPLETION_INFORMATION
+ FILE_COPY_ON_WRITE_INFORMATION
+ FILE_FS_CONTROL_INFORMATION
+ FILE_GET_EA_INFORMATION
+ FILE_GET_QUOTA_INFORMATION
+ FILE_OBJECTID_INFORMATION
+ FILE_OLE_CLASSID_INFORMATION
+ FILE_OLE_ALL_INFORMATION
+ FILE_OLE_DIR_INFORMATION
+ FILE_OLE_INFORMATION
+ FILE_OLE_STATE_BITS_INFORMATION
+ FILE_QUOTA_INFORMATION
+ Function prototypes:
+ HalDisplayString
+ HalMakeBeep
+ IoGetRequestorProcess
+ ObQueryNameString
+ ProbeForWrite
+ RtlAbsoluteToSelfRelativeSD
+ RtlGetDaclSecurityDescriptor
+ RtlGetGroupSecurityDescriptor
+ RtlGetOwnerSecurityDescriptor
+ RtlInitializeSid
+ RtlSetGroupSecurityDescriptor
+ RtlSetOwnerSecurityDescriptor
+ RtlSetSaclSecurityDescriptor
+ ZwDeleteValueKey
+ ZwDisplayString
+ ZwQueryDirectoryObject
+
+ 11. 1999-10-13
+ Corrected:
+ ZwOpenProcessToken
+ ZwOpenThreadToken
+ Added:
+ Function prototypes:
+ RtlAllocateAndInitializeSid
+ RtlCopySid
+ RtlEqualSid
+ RtlFillMemoryUlong
+ RtlIsNameLegalDOS8Dot3
+ RtlLengthRequiredSid
+ RtlLengthSid
+ RtlNtStatusToDosError
+ RtlSubAuthorityCountSid
+ RtlSubAuthoritySid
+ RtlValidSid
+
+ 10. 1999-07-15
+ Corrected:
+ RtlConvertSidToUnicodeString
+ Added:
+ Externals:
+ FsRtlLegalAnsiCharacterArray
+ NtBuildNumber
+ Defines:
+ FSRTL_WILD_CHARACTER
+ FlagOn
+ FsRtlIsUnicodeCharacterWild
+ Structures:
+ FILE_ACCESS_INFORMATION
+ FILE_MODE_INFORMATION
+ GENERATE_NAME_CONTEXT
+ Function prototypes:
+ FsRtlDoesNameContainWildCards
+ FsRtlIsNameInExpression
+ IoSetInformation
+ RtlGenerate8dot3Name
+ ZwQuerySecurityObject
+
+ 9. 1999-07-12
+ Corrected:
+ EXTENDED_IO_STACK_LOCATION
+ QueryDirectory in EXTENDED_IO_STACK_LOCATION
+ ZwCreateThread
+ Added:
+ Structures:
+ INITIAL_TEB
+ Function prototypes:
+ ZwQuerySymbolicLinkObject
+
+ 8. 1999-06-07
+ Corrected:
+ ZwOpenProcessToken
+ ZwOpenThreadToken
+ Added:
+ Defines:
+ FILE_OPLOCK_BROKEN_TO_LEVEL_2
+ FILE_OPLOCK_BROKEN_TO_NONE
+ FILE_CASE_SENSITIVE_SEARCH
+ FILE_CASE_PRESERVED_NAMES
+ FILE_UNICODE_ON_DISK
+ FILE_PERSISTENT_ACLS
+ FILE_FILE_COMPRESSION
+ FILE_VOLUME_IS_COMPRESSED
+ FSRTL_FLAG_ACQUIRE_MAIN_RSRC_EX
+ FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH
+ IOCTL_REDIR_QUERY_PATH
+ Structures:
+ FILE_FS_LABEL_INFORMATION
+ PATHNAME_BUFFER
+ In IO_STACK_LOCATION:
+ FileSystemControl
+ LockControl
+ SetVolume
+ Function prototypes:
+ FsRtlCopyRead
+ FsRtlCopyWrite
+ IoVerifyVolume
+
+ 7. 1999-06-05
+ Added:
+ defines for TOKEN_XXX
+ SID_NAME_USE
+ TOKEN_INFORMATION_CLASS
+ TOKEN_TYPE
+ FILE_FS_ATTRIBUTE_INFORMATION
+ FILE_FS_SIZE_INFORMATION
+ SID_IDENTIFIER_AUTHORITY
+ SID
+ SID_AND_ATTRIBUTES
+ TOKEN_CONTROL
+ TOKEN_DEFAULT_DACL
+ TOKEN_GROUPS
+ TOKEN_OWNER
+ TOKEN_PRIMARY_GROUP
+ TOKEN_PRIVILEGES
+ TOKEN_SOURCE
+ TOKEN_STATISTICS
+ TOKEN_USER
+ IoCreateFile
+ IoGetAttachedDevice
+ IoGetBaseFileSystemDeviceObject
+ PsReferenceImpersonationToken
+ PsReferencePrimaryToken
+ RtlConvertSidToUnicodeString
+ SeCaptureSubjectContext
+ SeMarkLogonSessionForTerminationNotification
+ SeRegisterLogonSessionTerminatedRoutine
+ SeUnregisterLogonSessionTerminatedRoutine
+ ZwOpenProcessToken
+ ZwOpenThreadToken
+ ZwQueryInformationToken
+
+ 6. 1999-05-10
+ Corrected declarations of Zw functions.
+ Added:
+ ZwCancelIoFile
+ ZwDeleteFile
+ ZwFlushBuffersFile
+ ZwFsControlFile
+ ZwLockFile
+ ZwNotifyChangeDirectoryFile
+ ZwOpenFile
+ ZwQueryEaFile
+ ZwSetEaFile
+ ZwSetVolumeInformationFile
+ ZwUnlockFile
+
+ 5. 1999-05-09
+ Added:
+ defines for FILE_ACTION_XXX and FILE_NOTIFY_XXX
+ FILE_FS_VOLUME_INFORMATION
+ RETRIEVAL_POINTERS_BUFFER
+ STARTING_VCN_INPUT_BUFFER
+ FsRtlNotifyFullReportChange
+
+ 4. 1999-04-11
+ Corrected:
+ ZwCreateThread
+ Added:
+ define _GNU_NTIFS_
+
+ 3. 1999-03-30
+ Added:
+ defines for MAP_XXX, MEM_XXX and SEC_XXX
+ FILE_BOTH_DIR_INFORMATION
+ FILE_DIRECTORY_INFORMATION
+ FILE_FULL_DIR_INFORMATION
+ FILE_NAMES_INFORMATION
+ FILE_NOTIFY_INFORMATION
+ FsRtlNotifyCleanup
+ KeAttachProcess
+ KeDetachProcess
+ MmCreateSection
+ ZwCreateProcess
+ ZwCreateThread
+ ZwDeviceIoControlFile
+ ZwGetContextThread
+ ZwLoadDriver
+ ZwOpenDirectoryObject
+ ZwOpenProcess
+ ZwOpenSymbolicLinkObject
+ ZwQueryDirectoryFile
+ ZwUnloadDriver
+
+ 2. 1999-03-15
+ Added:
+ FILE_COMPRESSION_INFORMATION
+ FILE_STREAM_INFORMATION
+ FILE_LINK_INFORMATION
+ FILE_RENAME_INFORMATION
+ EXTENDED_IO_STACK_LOCATION
+ IoQueryFileInformation
+ IoQueryFileVolumeInformation
+ ZwQueryVolumeInformationFile
+ Moved include of ntddk.h to inside extern "C" block.
+
+ 1. 1999-03-11
+ Initial release.
+*/
+
+#ifndef _NTIFS_
+#define _NTIFS_
+#define _GNU_NTIFS_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <ntddk.h>
+#include <ntverp.h>
+
+// Available in Windows NT 3.1 and later versions.
+// Documented in the WDK.
+extern PEPROCESS PsInitialSystemProcess;
+
+// Available in Windows NT 3.5 and later versions.
+typedef struct _HAL_PRIVATE_DISPATCH *PHAL_PRIVATE_DISPATCH;
+extern PHAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
+
+// Available in Windows NT 3.5 and later versions.
+typedef struct _LOADER_PARAMETER_BLOCK *PLOADER_PARAMETER_BLOCK;
+extern PLOADER_PARAMETER_BLOCK KeLoaderBlock;
+
+// Available in Windows NT 3.5 and later versions.
+typedef struct _SERVICE_DESCRIPTOR_TABLE *PSERVICE_DESCRIPTOR_TABLE;
+extern PSERVICE_DESCRIPTOR_TABLE KeServiceDescriptorTable;
+
+// Available in Windows NT 3.5 and later versions.
+extern PSHORT NtBuildNumber;
+extern PULONG KeI386MachineType;
+
+// Available in Windows NT 4.0 and later versions.
+extern ULONG KiBugCheckData[5];
+
+// Available in Windows 2000 and later versions.
+extern PULONG InitSafeBootMode;
+
+// Available from Windows 2000 untill Windows Server 2003.
+extern PULONG KiEnableTimerWatchdog;
+
+// Available in Windows NT 3.5 and later versions.
+//
+// Set by the kernel debugger on the target system to the address of the
+// serial port used to communicate with the host.
+//
+extern PUCHAR *KdComPortInUse;
+
+// Available in Windows 2000 and later versions.
+extern PULONG KdEnteredDebugger;
+
+// Available in Windows Vista and later versions.
+// Documented in the WDK.
+extern PVOID MmBadPointer;
+
+// Available in Windows NT 3.5 and later versions.
+// Documented in the WDK.
+extern PUCHAR *FsRtlLegalAnsiCharacterArray;
+
+// Available in Windows NT 3.5 and later versions.
+extern PUSHORT *NlsLeadByteInfo;
+extern PUSHORT *NlsOemLeadByteInfo;
+extern PBOOLEAN NlsMbCodePageTag;
+extern PBOOLEAN NlsMbOemCodePageTag;
+
+// Available in Windows NT 4.0 and later versions.
+extern PUSHORT NlsAnsiCodePage;
+
+// Available in Windows 2000 and later versions.
+extern PUSHORT NlsOemCodePage;
+
+// Available in Windows NT 3.5 and later versions.
+// SeExports is documented in the WDK.
+typedef struct _SE_EXPORTS *PSE_EXPORTS;
+extern PSE_EXPORTS SeExports;
+extern PACL SePublicDefaultDacl;
+extern PACL SeSystemDefaultDacl;
+
+// Available in Windows NT 3.5 and later versions.
+// Documented in the WDK.
+extern KSPIN_LOCK IoStatisticsLock;
+extern ULONG IoReadOperationCount;
+extern ULONG IoWriteOperationCount;
+extern LARGE_INTEGER IoReadTransferCount;
+extern LARGE_INTEGER IoWriteTransferCount;
+
+// Available from Windows NT 3.5 untill Windows XP.
+extern ULONG KeDcacheFlushCount;
+extern ULONG KeIcacheFlushCount;
+
+// Available in Windows NT 4.0 and later versions.
+// Documented in the WDK.
+extern ULONG CcFastMdlReadWait;
+// Available from Windows NT 4.0 untill Windows Server 2003.
+extern ULONG CcFastReadNotPossible;
+extern ULONG CcFastReadWait;
+
+// The ExEventObjectType, ExSemaphoreObjectType and IoFileObjectType is
+// documented in the DDK and the WDK.
+//
+// The CmKeyObjectType, SeTokenObjectType, PsProcessType, PsThreadType,
+// TmEnlistmentObjectType, TmResourceManagerObjectType,
+// TmTransactionManagerObjectType and TmTransactionObjectType
+// is documented in the WDK.
+//
+// Available in Windows NT 3.5 and later versions.
+extern POBJECT_TYPE *IoAdapterObjectType;
+extern POBJECT_TYPE *IoDeviceObjectType;
+extern POBJECT_TYPE *IoDriverObjectType;
+extern POBJECT_TYPE *MmSectionObjectType;
+extern POBJECT_TYPE *PsProcessType;
+extern POBJECT_TYPE *PsThreadType;
+// Available in Windows NT 4.0 and later versions.
+extern POBJECT_TYPE *ExDesktopObjectType;
+extern POBJECT_TYPE *ExWindowStationObjectType;
+extern POBJECT_TYPE *IoDeviceHandlerObjectType;
+// Available in Windows 2000 and later versions.
+extern POBJECT_TYPE *LpcPortObjectType;
+extern POBJECT_TYPE *PsJobType;
+// Available in Windows XP and later versions.
+extern POBJECT_TYPE *SeTokenObjectType;
+// Available in Windows Vista and later versions.
+extern POBJECT_TYPE *TmEnlistmentObjectType;
+extern POBJECT_TYPE *TmResourceManagerObjectType;
+extern POBJECT_TYPE *TmTransactionManagerObjectType;
+extern POBJECT_TYPE *TmTransactionObjectType;
+// Available in Windows 7 and later versions.
+extern POBJECT_TYPE *CmKeyObjectType;
+
+// Available in Windows NT 4.0 and later versions.
+extern PULONG IoDeviceHandlerObjectSize;
+
+// Available in Windows Vista and later versions.
+extern PVOID POGOBuffer;
+extern PVOID psMUITest;
+extern PVOID PsUILanguageComitted;
+
+#define ACCESS_ALLOWED_ACE_TYPE (0x0)
+#define ACCESS_DENIED_ACE_TYPE (0x1)
+#define SYSTEM_AUDIT_ACE_TYPE (0x2)
+#define SYSTEM_ALARM_ACE_TYPE (0x3)
+
+#define ANSI_DOS_STAR ('<')
+#define ANSI_DOS_QM ('>')
+#define ANSI_DOS_DOT ('"')
+
+#define DOS_STAR (L'<')
+#define DOS_QM (L'>')
+#define DOS_DOT (L'"')
+
+#define COMPRESSION_FORMAT_NONE (0x0000)
+#define COMPRESSION_FORMAT_DEFAULT (0x0001)
+#define COMPRESSION_FORMAT_LZNT1 (0x0002)
+#define COMPRESSION_ENGINE_STANDARD (0x0000)
+#define COMPRESSION_ENGINE_MAXIMUM (0x0100)
+#define COMPRESSION_ENGINE_HIBER (0x0200)
+
+#define FILE_ACTION_ADDED 0x00000001
+#define FILE_ACTION_REMOVED 0x00000002
+#define FILE_ACTION_MODIFIED 0x00000003
+#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
+#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
+#define FILE_ACTION_ADDED_STREAM 0x00000006
+#define FILE_ACTION_REMOVED_STREAM 0x00000007
+#define FILE_ACTION_MODIFIED_STREAM 0x00000008
+#define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
+#define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
+#define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
+
+#define FILE_EA_TYPE_BINARY 0xfffe
+#define FILE_EA_TYPE_ASCII 0xfffd
+#define FILE_EA_TYPE_BITMAP 0xfffb
+#define FILE_EA_TYPE_METAFILE 0xfffa
+#define FILE_EA_TYPE_ICON 0xfff9
+#define FILE_EA_TYPE_EA 0xffee
+#define FILE_EA_TYPE_MVMT 0xffdf
+#define FILE_EA_TYPE_MVST 0xffde
+#define FILE_EA_TYPE_ASN1 0xffdd
+#define FILE_EA_TYPE_FAMILY_IDS 0xff01
+
+#define FILE_NEED_EA 0x00000080
+
+#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
+#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
+#define FILE_NOTIFY_CHANGE_NAME 0x00000003
+#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
+#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
+#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
+#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
+#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
+#define FILE_NOTIFY_CHANGE_EA 0x00000080
+#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
+#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
+#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
+#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
+#define FILE_NOTIFY_VALID_MASK 0x00000fff
+
+#define FILE_OPLOCK_BROKEN_TO_LEVEL_2 0x00000007
+#define FILE_OPLOCK_BROKEN_TO_NONE 0x00000008
+
+#define FILE_OPBATCH_BREAK_UNDERWAY 0x00000009
+
+#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
+#define FILE_CASE_PRESERVED_NAMES 0x00000002
+#define FILE_UNICODE_ON_DISK 0x00000004
+#define FILE_PERSISTENT_ACLS 0x00000008
+#define FILE_FILE_COMPRESSION 0x00000010
+#define FILE_VOLUME_QUOTAS 0x00000020
+#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
+#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
+#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
+#define FS_LFN_APIS 0x00004000
+#define FILE_VOLUME_IS_COMPRESSED 0x00008000
+#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
+#define FILE_SUPPORTS_ENCRYPTION 0x00020000
+#define FILE_NAMED_STREAMS 0x00040000
+#define FILE_READ_ONLY_VOLUME 0x00080000
+
+#define FILE_PIPE_BYTE_STREAM_TYPE 0x00000000
+#define FILE_PIPE_MESSAGE_TYPE 0x00000001
+
+#define FILE_PIPE_BYTE_STREAM_MODE 0x00000000
+#define FILE_PIPE_MESSAGE_MODE 0x00000001
+
+#define FILE_PIPE_QUEUE_OPERATION 0x00000000
+#define FILE_PIPE_COMPLETE_OPERATION 0x00000001
+
+#define FILE_PIPE_INBOUND 0x00000000
+#define FILE_PIPE_OUTBOUND 0x00000001
+#define FILE_PIPE_FULL_DUPLEX 0x00000002
+
+#define FILE_PIPE_DISCONNECTED_STATE 0x00000001
+#define FILE_PIPE_LISTENING_STATE 0x00000002
+#define FILE_PIPE_CONNECTED_STATE 0x00000003
+#define FILE_PIPE_CLOSING_STATE 0x00000004
+
+#define FILE_PIPE_CLIENT_END 0x00000000
+#define FILE_PIPE_SERVER_END 0x00000001
+
+#define FILE_PIPE_READ_DATA 0x00000000
+#define FILE_PIPE_WRITE_SPACE 0x00000001
+
+#define FILE_STORAGE_TYPE_SPECIFIED 0x00000041 // FILE_DIRECTORY_FILE | FILE_NON_DIRECTORY_FILE
+#define FILE_STORAGE_TYPE_DEFAULT (StorageTypeDefault << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_DIRECTORY (StorageTypeDirectory << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_FILE (StorageTypeFile << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_DOCFILE (StorageTypeDocfile << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_JUNCTION_POINT (StorageTypeJunctionPoint << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_CATALOG (StorageTypeCatalog << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_STRUCTURED_STORAGE (StorageTypeStructuredStorage << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_EMBEDDING (StorageTypeEmbedding << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_STORAGE_TYPE_STREAM (StorageTypeStream << FILE_STORAGE_TYPE_SHIFT)
+#define FILE_MINIMUM_STORAGE_TYPE FILE_STORAGE_TYPE_DEFAULT
+#define FILE_MAXIMUM_STORAGE_TYPE FILE_STORAGE_TYPE_STREAM
+#define FILE_STORAGE_TYPE_MASK 0x000f0000
+#define FILE_STORAGE_TYPE_SHIFT 16
+
+#define FILE_VC_QUOTA_NONE 0x00000000
+#define FILE_VC_QUOTA_TRACK 0x00000001
+#define FILE_VC_QUOTA_ENFORCE 0x00000002
+#define FILE_VC_QUOTA_MASK 0x00000003
+
+#define FILE_VC_QUOTAS_LOG_VIOLATIONS 0x00000004
+#define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008
+
+#define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010
+#define FILE_VC_LOG_QUOTA_LIMIT 0x00000020
+#define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040
+#define FILE_VC_LOG_VOLUME_LIMIT 0x00000080
+
+#define FILE_VC_QUOTAS_INCOMPLETE 0x00000100
+#define FILE_VC_QUOTAS_REBUILDING 0x00000200
+
+#define FILE_VC_VALID_MASK 0x000003ff
+
+#define FSRTL_FCB_HEADER_V0 (0x00)
+#define FSRTL_FCB_HEADER_V1 (0x01)
+
+#define FSRTL_FLAG_FILE_MODIFIED (0x01)
+#define FSRTL_FLAG_FILE_LENGTH_CHANGED (0x02)
+#define FSRTL_FLAG_LIMIT_MODIFIED_PAGES (0x04)
+#define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_EX (0x08)
+#define FSRTL_FLAG_ACQUIRE_MAIN_RSRC_SH (0x10)
+#define FSRTL_FLAG_USER_MAPPED_FILE (0x20)
+#define FSRTL_FLAG_ADVANCED_HEADER (0x40)
+#define FSRTL_FLAG_EOF_ADVANCE_ACTIVE (0x80)
+
+#define FSRTL_FLAG2_DO_MODIFIED_WRITE (0x01)
+#define FSRTL_FLAG2_SUPPORTS_FILTER_CONTEXTS (0x02)
+#define FSRTL_FLAG2_PURGE_WHEN_MAPPED (0x04)
+#define FSRTL_FLAG2_IS_PAGING_FILE (0x08)
+
+#define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
+#define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
+#define FSRTL_MOD_WRITE_TOP_LEVEL_IRP (0x03)
+#define FSRTL_FAST_IO_TOP_LEVEL_IRP (0x04)
+#define FSRTL_MAX_TOP_LEVEL_IRP_FLAG (0x04)
+
+#define FSRTL_VOLUME_DISMOUNT 1
+#define FSRTL_VOLUME_DISMOUNT_FAILED 2
+#define FSRTL_VOLUME_LOCK 3
+#define FSRTL_VOLUME_LOCK_FAILED 4
+#define FSRTL_VOLUME_UNLOCK 5
+#define FSRTL_VOLUME_MOUNT 6
+
+#define FSRTL_WILD_CHARACTER 0x08
+
+#ifdef _X86_
+#define HARDWARE_PTE HARDWARE_PTE_X86
+#define PHARDWARE_PTE PHARDWARE_PTE_X86
+#else
+#define HARDWARE_PTE ULONG
+#define PHARDWARE_PTE PULONG
+#endif
+
+#define IO_CHECK_CREATE_PARAMETERS 0x0200
+#define IO_ATTACH_DEVICE 0x0400
+
+#define IO_ATTACH_DEVICE_API 0x80000000
+
+#define IO_COMPLETION_QUERY_STATE 0x0001
+#define IO_COMPLETION_MODIFY_STATE 0x0002
+#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
+
+#define IO_FILE_OBJECT_NON_PAGED_POOL_CHARGE 64
+#define IO_FILE_OBJECT_PAGED_POOL_CHARGE 1024
+
+#define IO_REPARSE_TAG_RESERVED_ZERO (0)
+#define IO_REPARSE_TAG_RESERVED_ONE (1)
+
+#define IO_TYPE_APC 18
+#define IO_TYPE_DPC 19
+#define IO_TYPE_DEVICE_QUEUE 20
+#define IO_TYPE_EVENT_PAIR 21
+#define IO_TYPE_INTERRUPT 22
+#define IO_TYPE_PROFILE 23
+
+#define IRP_BEING_VERIFIED 0x10
+
+#define MAILSLOT_CLASS_FIRSTCLASS 1
+#define MAILSLOT_CLASS_SECONDCLASS 2
+
+#define MAILSLOT_SIZE_AUTO 0
+
+#define MAP_PROCESS 1L
+#define MAP_SYSTEM 2L
+
+#define MEM_DOS_LIM 0x40000000
+#define MEM_IMAGE SEC_IMAGE
+
+#define OB_FLAG_CREATE_INFO 0x01 /* Object header has OBJECT_CREATE_INFO */
+#define OB_FLAG_KERNEL_MODE 0x02 /* Created by kernel */
+#define OB_FLAG_CREATOR_INFO 0x04 /* Object header has OBJECT_CREATOR_INFO */
+#define OB_FLAG_EXCLUSIVE 0x08 /* OBJ_EXCLUSIVE */
+#define OB_FLAG_PERMAMENT 0x10 /* OBJ_PERMAMENT */
+#define OB_FLAG_SECURITY 0x20 /* Object header has SecurityDescriptor != NULL */
+#define OB_FLAG_SINGLE_PROCESS 0x40 /* absent HandleDBList */
+
+#define OB_SECURITY_CHARGE 0x00000800
+
+#define OB_TYPE_TYPE 1
+#define OB_TYPE_DIRECTORY 2
+#define OB_TYPE_SYMBOLIC_LINK 3
+#define OB_TYPE_TOKEN 4
+#define OB_TYPE_PROCESS 5
+#define OB_TYPE_THREAD 6
+#define OB_TYPE_EVENT 7
+#define OB_TYPE_EVENT_PAIR 8
+#define OB_TYPE_MUTANT 9
+#define OB_TYPE_SEMAPHORE 10
+#define OB_TYPE_TIMER 11
+#define OB_TYPE_PROFILE 12
+#define OB_TYPE_WINDOW_STATION 13
+#define OB_TYPE_DESKTOP 14
+#define OB_TYPE_SECTION 15
+#define OB_TYPE_KEY 16
+#define OB_TYPE_PORT 17
+#define OB_TYPE_ADAPTER 18
+#define OB_TYPE_CONTROLLER 19
+#define OB_TYPE_DEVICE 20
+#define OB_TYPE_DRIVER 21
+#define OB_TYPE_IO_COMPLETION 22
+#define OB_TYPE_FILE 23
+
+#define PIN_WAIT (1)
+#define PIN_EXCLUSIVE (2)
+#define PIN_NO_READ (4)
+#define PIN_IF_BCB (8)
+
+#define MAP_WAIT (1)
+#define MAP_NO_READ (16)
+
+#define PORT_CONNECT 0x0001
+#define PORT_ALL_ACCESS (STANDARD_RIGHTS_ALL |\
+ PORT_CONNECT)
+
+#define SEC_BASED 0x00200000
+#define SEC_NO_CHANGE 0x00400000
+#define SEC_FILE 0x00800000
+#define SEC_IMAGE 0x01000000
+#define SEC_COMMIT 0x08000000
+#define SEC_NOCACHE 0x10000000
+
+#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
+#define SECURITY_WORLD_RID (0x00000000L)
+
+#define SID_REVISION 1
+
+#define THREAD_STATE_INITIALIZED 0
+#define THREAD_STATE_READY 1
+#define THREAD_STATE_RUNNING 2
+#define THREAD_STATE_STANDBY 3
+#define THREAD_STATE_TERMINATED 4
+#define THREAD_STATE_WAIT 5
+#define THREAD_STATE_TRANSITION 6
+#define THREAD_STATE_UNKNOWN 7
+
+#define TOKEN_ASSIGN_PRIMARY (0x0001)
+#define TOKEN_DUPLICATE (0x0002)
+#define TOKEN_IMPERSONATE (0x0004)
+#define TOKEN_QUERY (0x0008)
+#define TOKEN_QUERY_SOURCE (0x0010)
+#define TOKEN_ADJUST_PRIVILEGES (0x0020)
+#define TOKEN_ADJUST_GROUPS (0x0040)
+#define TOKEN_ADJUST_DEFAULT (0x0080)
+
+#define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
+ TOKEN_ASSIGN_PRIMARY |\
+ TOKEN_DUPLICATE |\
+ TOKEN_IMPERSONATE |\
+ TOKEN_QUERY |\
+ TOKEN_QUERY_SOURCE |\
+ TOKEN_ADJUST_PRIVILEGES |\
+ TOKEN_ADJUST_GROUPS |\
+ TOKEN_ADJUST_DEFAULT)
+
+#define TOKEN_READ (STANDARD_RIGHTS_READ |\
+ TOKEN_QUERY)
+
+#define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
+ TOKEN_ADJUST_PRIVILEGES |\
+ TOKEN_ADJUST_GROUPS |\
+ TOKEN_ADJUST_DEFAULT)
+
+#define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
+
+#define TOKEN_SOURCE_LENGTH 8
+
+#define TOKEN_HAS_TRAVERSE_PRIVILEGE 0x01
+#define TOKEN_HAS_BACKUP_PRIVILEGE 0x02
+#define TOKEN_HAS_RESTORE_PRIVILEGE 0x04
+#define TOKEN_HAS_ADMIN_GROUP 0x08
+#define TOKEN_IS_RESTRICTED 0x10
+#define TOKEN_SESSION_NOT_REFERENCED 0x20
+#define TOKEN_SANDBOX_INERT 0x40
+#define TOKEN_HAS_IMPERSONATE_PRIVILEGE 0x80
+
+#define VACB_MAPPING_GRANULARITY (0x40000)
+#define VACB_OFFSET_SHIFT (18)
+
+#define FSCTL_REQUEST_OPLOCK_LEVEL_1 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_REQUEST_OPLOCK_LEVEL_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_REQUEST_BATCH_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_OPLOCK_BREAK_ACKNOWLEDGE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 3, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_OPBATCH_ACK_CLOSE_PENDING CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_OPLOCK_BREAK_NOTIFY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 5, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_LOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_UNLOCK_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DISMOUNT_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define FSCTL_IS_VOLUME_MOUNTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 10, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_IS_PATHNAME_VALID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 11, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_MARK_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 12, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define FSCTL_QUERY_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 14, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_GET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 15, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_SET_COMPRESSION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 16, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
+
+
+#define FSCTL_MARK_AS_SYSTEM_HIVE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 19, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_OPLOCK_BREAK_ACK_NO_2 CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_INVALIDATE_VOLUMES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_QUERY_FAT_BPB CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_REQUEST_FILTER_OPLOCK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_FILESYSTEM_GET_STATISTICS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 24, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#if (VER_PRODUCTBUILD >= 1381)
+
+#define FSCTL_GET_NTFS_VOLUME_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 25, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_GET_NTFS_FILE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 26, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_GET_VOLUME_BITMAP CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 27, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_GET_RETRIEVAL_POINTERS CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 28, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_MOVE_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 29, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_IS_VOLUME_DIRTY CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 30, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_GET_HFS_INFORMATION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 31, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_ALLOW_EXTENDED_DASD_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 32, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#endif // (VER_PRODUCTBUILD >= 1381)
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+#define FSCTL_READ_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 33, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_WRITE_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 34, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_FIND_FILES_BY_SID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 35, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+#define FSCTL_DUMP_PROPERTY_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 37, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_SET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 38, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 39, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DELETE_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 40, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_SET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_GET_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 42, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DELETE_REPARSE_POINT CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 43, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_ENUM_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 44, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_SECURITY_ID_CHECK CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 45, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_READ_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 46, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_SET_OBJECT_ID_EXTENDED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 47, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_CREATE_OR_GET_OBJECT_ID CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 48, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_SET_SPARSE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
+#define FSCTL_SET_ZERO_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 50, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_QUERY_ALLOCATED_RANGES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_ENABLE_UPGRADE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 52, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_SET_ENCRYPTION CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 53, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_ENCRYPTION_FSCTL_IO CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 54, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_WRITE_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 55, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_READ_RAW_ENCRYPTED CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 56, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_CREATE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 57, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_READ_FILE_USN_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 58, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_WRITE_USN_CLOSE_RECORD CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 59, METHOD_NEITHER, FILE_READ_DATA)
+#define FSCTL_EXTEND_VOLUME CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_QUERY_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 61, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_DELETE_USN_JOURNAL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 62, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_MARK_HANDLE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 63, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_SIS_COPYFILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 64, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_SIS_LINK_FILES CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 65, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_HSM_MSG CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 66, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_NSS_CONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 67, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_HSM_DATA CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 68, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_RECALL_FILE CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 69, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_NSS_RCONTROL CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 70, METHOD_BUFFERED, FILE_READ_DATA)
+#define FSCTL_READ_FROM_PLEX CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 71, METHOD_OUT_DIRECT, FILE_READ_DATA)
+#define FSCTL_FILE_PREFETCH CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 72, METHOD_BUFFERED, FILE_SPECIAL_ACCESS)
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+#define FSCTL_MAILSLOT_PEEK CTL_CODE(FILE_DEVICE_MAILSLOT, 0, METHOD_NEITHER, FILE_READ_DATA)
+
+#define FSCTL_NETWORK_SET_CONFIGURATION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 102, METHOD_IN_DIRECT, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_GET_CONFIGURATION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 103, METHOD_OUT_DIRECT, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_GET_CONNECTION_INFO CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 104, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_ENUMERATE_CONNECTIONS CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 105, METHOD_NEITHER, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_DELETE_CONNECTION CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 107, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_GET_STATISTICS CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 116, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_SET_DOMAIN_NAME CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 120, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_NETWORK_REMOTE_BOOT_INIT_SCRT CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 250, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+#define FSCTL_PIPE_ASSIGN_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 0, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_DISCONNECT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_PEEK CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, METHOD_BUFFERED, FILE_READ_DATA)
+#define FSCTL_PIPE_QUERY_EVENT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 5, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_PIPE_WAIT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_SET_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 8, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_QUERY_CLIENT_PROCESS CTL_CODE(FILE_DEVICE_NAMED_PIPE, 9, METHOD_BUFFERED, FILE_ANY_ACCESS)
+#define FSCTL_PIPE_INTERNAL_READ CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2045, METHOD_BUFFERED, FILE_READ_DATA)
+#define FSCTL_PIPE_INTERNAL_WRITE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2046, METHOD_BUFFERED, FILE_WRITE_DATA)
+#define FSCTL_PIPE_INTERNAL_TRANSCEIVE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2047, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA)
+#define FSCTL_PIPE_INTERNAL_READ_OVFLOW CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2048, METHOD_BUFFERED, FILE_READ_DATA)
+
+#define IOCTL_REDIR_QUERY_PATH CTL_CODE(FILE_DEVICE_NETWORK_FILE_SYSTEM, 99, METHOD_NEITHER, FILE_ANY_ACCESS)
+
+typedef PVOID PEJOB;
+typedef PVOID PNOTIFY_SYNC;
+typedef PVOID OPLOCK, *POPLOCK;
+typedef PVOID PWOW64_PROCESS;
+
+typedef ULONG LBN;
+typedef LBN *PLBN;
+
+typedef ULONG VBN;
+typedef VBN *PVBN;
+
+typedef struct _CACHE_MANAGER_CALLBACKS *PCACHE_MANAGER_CALLBACKS;
+typedef struct _EPROCESS_QUOTA_BLOCK *PEPROCESS_QUOTA_BLOCK;
+typedef struct _FILE_GET_QUOTA_INFORMATION *PFILE_GET_QUOTA_INFORMATION;
+typedef struct _HANDLE_TABLE *PHANDLE_TABLE;
+typedef struct _KEVENT_PAIR *PKEVENT_PAIR;
+typedef struct _KPROCESS *PKPROCESS;
+typedef struct _KQUEUE *PKQUEUE;
+typedef struct _KTRAP_FRAME *PKTRAP_FRAME;
+typedef struct _LPC_MESSAGE *PLPC_MESSAGE;
+typedef struct _MAILSLOT_CREATE_PARAMETERS *PMAILSLOT_CREATE_PARAMETERS;
+typedef struct _MMWSL *PMMWSL;
+typedef struct _NAMED_PIPE_CREATE_PARAMETERS *PNAMED_PIPE_CREATE_PARAMETERS;
+typedef struct _OBJECT_DIRECTORY *POBJECT_DIRECTORY;
+typedef struct _PAGEFAULT_HISTORY *PPAGEFAULT_HISTORY;
+typedef struct _PEB *PPEB;
+typedef struct _PS_IMPERSONATION_INFORMATION *PPS_IMPERSONATION_INFORMATION;
+typedef struct _SECTION_OBJECT *PSECTION_OBJECT;
+typedef struct _SERVICE_DESCRIPTOR_TABLE *PSERVICE_DESCRIPTOR_TABLE;
+typedef struct _SHARED_CACHE_MAP *PSHARED_CACHE_MAP;
+typedef struct _TERMINATION_PORT *PTERMINATION_PORT;
+typedef struct _VACB *PVACB;
+typedef struct _VAD_HEADER *PVAD_HEADER;
+
+#if (VER_PRODUCTBUILD < 2195)
+typedef ULONG SIZE_T, *PSIZE_T;
+#endif
+
+typedef enum _FAST_IO_POSSIBLE {
+ FastIoIsNotPossible,
+ FastIoIsPossible,
+ FastIoIsQuestionable
+} FAST_IO_POSSIBLE;
+
+typedef enum _FILE_STORAGE_TYPE {
+ StorageTypeDefault = 1,
+ StorageTypeDirectory,
+ StorageTypeFile,
+ StorageTypeJunctionPoint,
+ StorageTypeCatalog,
+ StorageTypeStructuredStorage,
+ StorageTypeEmbedding,
+ StorageTypeStream
+} FILE_STORAGE_TYPE;
+
+typedef enum _IO_COMPLETION_INFORMATION_CLASS {
+ IoCompletionBasicInformation
+} IO_COMPLETION_INFORMATION_CLASS;
+
+#if (VER_PRODUCTBUILD == 2195)
+
+typedef enum _KSPIN_LOCK_QUEUE_NUMBER {
+ LockQueueDispatcherLock,
+ LockQueueContextSwapLock,
+ LockQueuePfnLock,
+ LockQueueSystemSpaceLock,
+ LockQueueVacbLock,
+ LockQueueMasterLock,
+ LockQueueNonPagedPoolLock,
+ LockQueueIoCancelLock,
+ LockQueueWorkQueueLock,
+ LockQueueIoVpbLock,
+ LockQueueIoDatabaseLock,
+ LockQueueIoCompletionLock,
+ LockQueueNtfsStructLock,
+ LockQueueAfdWorkQueueLock,
+ LockQueueBcbLock,
+ LockQueueMaximumLock
+} KSPIN_LOCK_QUEUE_NUMBER;
+
+#endif // (VER_PRODUCTBUILD == 2195)
+
+typedef enum _LPC_TYPE {
+ LPC_NEW_MESSAGE,
+ LPC_REQUEST,
+ LPC_REPLY,
+ LPC_DATAGRAM,
+ LPC_LOST_REPLY,
+ LPC_PORT_CLOSED,
+ LPC_CLIENT_DIED,
+ LPC_EXCEPTION,
+ LPC_DEBUG_EVENT,
+ LPC_ERROR_EVENT,
+ LPC_CONNECTION_REQUEST
+} LPC_TYPE;
+
+typedef enum _MMFLUSH_TYPE {
+ MmFlushForDelete,
+ MmFlushForWrite
+} MMFLUSH_TYPE;
+
+typedef enum _OBJECT_INFO_CLASS {
+ ObjectBasicInfo,
+ ObjectNameInfo,
+ ObjectTypeInfo,
+ ObjectAllTypesInfo,
+ ObjectProtectionInfo
+} OBJECT_INFO_CLASS;
+
+typedef enum _PORT_INFORMATION_CLASS {
+ PortNoInformation
+} PORT_INFORMATION_CLASS;
+
+typedef enum _SECTION_INFORMATION_CLASS {
+ SectionBasicInformation,
+ SectionImageInformation
+} SECTION_INFORMATION_CLASS;
+
+typedef enum _SID_NAME_USE {
+ SidTypeUser = 1,
+ SidTypeGroup,
+ SidTypeDomain,
+ SidTypeAlias,
+ SidTypeWellKnownGroup,
+ SidTypeDeletedAccount,
+ SidTypeInvalid,
+ SidTypeUnknown
+} SID_NAME_USE;
+
+typedef enum _SYSTEM_INFORMATION_CLASS {
+ SystemBasicInformation,
+ SystemProcessorInformation,
+ SystemPerformanceInformation,
+ SystemTimeOfDayInformation,
+ SystemNotImplemented1,
+ SystemProcessesAndThreadsInformation,
+ SystemCallCounts,
+ SystemConfigurationInformation,
+ SystemProcessorTimes,
+ SystemGlobalFlag,
+ SystemNotImplemented2,
+ SystemModuleInformation,
+ SystemLockInformation,
+ SystemNotImplemented3,
+ SystemNotImplemented4,
+ SystemNotImplemented5,
+ SystemHandleInformation,
+ SystemObjectInformation,
+ SystemPagefileInformation,
+ SystemInstructionEmulationCounts,
+ SystemInvalidInfoClass1,
+ SystemCacheInformation,
+ SystemPoolTagInformation,
+ SystemProcessorStatistics,
+ SystemDpcInformation,
+ SystemNotImplemented6,
+ SystemLoadImage,
+ SystemUnloadImage,
+ SystemTimeAdjustment,
+ SystemNotImplemented7,
+ SystemNotImplemented8,
+ SystemNotImplemented9,
+ SystemCrashDumpInformation,
+ SystemExceptionInformation,
+ SystemCrashDumpStateInformation,
+ SystemKernelDebuggerInformation,
+ SystemContextSwitchInformation,
+ SystemRegistryQuotaInformation,
+ SystemLoadAndCallImage,
+ SystemPrioritySeparation,
+ SystemNotImplemented10,
+ SystemNotImplemented11,
+ SystemInvalidInfoClass2,
+ SystemInvalidInfoClass3,
+ SystemTimeZoneInformation,
+ SystemLookasideInformation,
+ SystemSetTimeSlipEvent,
+ SystemCreateSession,
+ SystemDeleteSession,
+ SystemInvalidInfoClass4,
+ SystemRangeStartInformation,
+ SystemVerifierInformation,
+ SystemAddVerifier,
+ SystemSessionProcessesInformation
+} SYSTEM_INFORMATION_CLASS;
+
+typedef enum _THREAD_STATE {
+ StateInitialized,
+ StateReady,
+ StateRunning,
+ StateStandby,
+ StateTerminated,
+ StateWait,
+ StateTransition,
+ StateUnknown
+} THREAD_STATE;
+
+typedef enum _TOKEN_INFORMATION_CLASS {
+ TokenUser = 1,
+ TokenGroups,
+ TokenPrivileges,
+ TokenOwner,
+ TokenPrimaryGroup,
+ TokenDefaultDacl,
+ TokenSource,
+ TokenType,
+ TokenImpersonationLevel,
+ TokenStatistics,
+ TokenRestrictedSids
+} TOKEN_INFORMATION_CLASS;
+
+typedef enum _TOKEN_TYPE {
+ TokenPrimary = 1,
+ TokenImpersonation
+} TOKEN_TYPE;
+
+typedef struct _HARDWARE_PTE_X86 {
+ ULONG Valid : 1;
+ ULONG Write : 1;
+ ULONG Owner : 1;
+ ULONG WriteThrough : 1;
+ ULONG CacheDisable : 1;
+ ULONG Accessed : 1;
+ ULONG Dirty : 1;
+ ULONG LargePage : 1;
+ ULONG Global : 1;
+ ULONG CopyOnWrite : 1;
+ ULONG Prototype : 1;
+ ULONG reserved : 1;
+ ULONG PageFrameNumber : 20;
+} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
+
+typedef struct _KAPC_STATE {
+ LIST_ENTRY ApcListHead[2];
+ PKPROCESS Process;
+ BOOLEAN KernelApcInProgress;
+ BOOLEAN KernelApcPending;
+ BOOLEAN UserApcPending;
+} KAPC_STATE, *PKAPC_STATE;
+
+typedef struct _KGDTENTRY {
+ USHORT LimitLow;
+ USHORT BaseLow;
+ union {
+ struct {
+ UCHAR BaseMid;
+ UCHAR Flags1;
+ UCHAR Flags2;
+ UCHAR BaseHi;
+ } Bytes;
+ struct {
+ ULONG BaseMid : 8;
+ ULONG Type : 5;
+ ULONG Dpl : 2;
+ ULONG Pres : 1;
+ ULONG LimitHi : 4;
+ ULONG Sys : 1;
+ ULONG Reserved_0 : 1;
+ ULONG Default_Big : 1;
+ ULONG Granularity : 1;
+ ULONG BaseHi : 8;
+ } Bits;
+ } HighWord;
+} KGDTENTRY, *PKGDTENTRY;
+
+typedef struct _KIDTENTRY {
+ USHORT Offset;
+ USHORT Selector;
+ USHORT Access;
+ USHORT ExtendedOffset;
+} KIDTENTRY, *PKIDTENTRY;
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _KPROCESS {
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY ProfileListHead;
+ ULONG DirectoryTableBase[2];
+ KGDTENTRY LdtDescriptor;
+ KIDTENTRY Int21Descriptor;
+ USHORT IopmOffset;
+ UCHAR Iopl;
+ UCHAR Unused;
+ ULONG ActiveProcessors;
+ ULONG KernelTime;
+ ULONG UserTime;
+ LIST_ENTRY ReadyListHead;
+ SINGLE_LIST_ENTRY SwapListEntry;
+ PVOID VdmTrapcHandler;
+ LIST_ENTRY ThreadListHead;
+ KSPIN_LOCK ProcessLock;
+ KAFFINITY Affinity;
+ USHORT StackCount;
+ CHAR BasePriority;
+ CHAR ThreadQuantum;
+ BOOLEAN AutoAlignment;
+ UCHAR State;
+ UCHAR ThreadSeed;
+ BOOLEAN DisableBoost;
+ UCHAR PowerState;
+ BOOLEAN DisableQuantum;
+ UCHAR IdealNode;
+ UCHAR Spare;
+} KPROCESS, *PKPROCESS;
+
+#else
+
+typedef struct _KPROCESS {
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY ProfileListHead;
+ ULONG DirectoryTableBase[2];
+ KGDTENTRY LdtDescriptor;
+ KIDTENTRY Int21Descriptor;
+ USHORT IopmOffset;
+ UCHAR Iopl;
+ UCHAR VdmFlag;
+ ULONG ActiveProcessors;
+ ULONG KernelTime;
+ ULONG UserTime;
+ LIST_ENTRY ReadyListHead;
+ SINGLE_LIST_ENTRY SwapListEntry;
+ PVOID Reserved1;
+ LIST_ENTRY ThreadListHead;
+ KSPIN_LOCK ProcessLock;
+ KAFFINITY Affinity;
+ USHORT StackCount;
+ UCHAR BasePriority;
+ UCHAR ThreadQuantum;
+ BOOLEAN AutoAlignment;
+ UCHAR State;
+ UCHAR ThreadSeed;
+ BOOLEAN DisableBoost;
+#if (VER_PRODUCTBUILD >= 2195)
+ UCHAR PowerState;
+ BOOLEAN DisableQuantum;
+ UCHAR IdealNode;
+ UCHAR Spare;
+#endif // (VER_PRODUCTBUILD >= 2195)
+} KPROCESS, *PKPROCESS;
+
+#endif
+
+#if (VER_PRODUCTBUILD >= 3790)
+
+typedef struct _KTHREAD {
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY MutantListHead; // 0x10
+ PVOID InitialStack; // 0x18
+ PVOID StackLimit; // 0x1c
+ PVOID KernelStack; // 0x20
+ ULONG ThreadLock; // 0x24
+ ULONG ContextSwitches; // 0x28
+ UCHAR State; // 0x2c
+ UCHAR NpxState; // 0x2d
+ UCHAR WaitIrql; // 0x2e
+ CHAR WaitMode; // 0x2f
+ struct _TEB *Teb; // 0x30
+ KAPC_STATE ApcState; // 0x34
+ KSPIN_LOCK ApcQueueLock; // 0x4c
+ NTSTATUS WaitStatus; // 0x50
+ PKWAIT_BLOCK WaitBlockList; // 0x54
+ BOOLEAN Alertable; // 0x58
+ UCHAR WaitNext; // 0x59
+ UCHAR WaitReason; // 0x5a
+ CHAR Priority; // 0x5b
+ BOOLEAN EnableStackSwap; // 0x5c
+ BOOLEAN SwapBusy; // 0x5d
+ UCHAR Alerted[2]; // 0x5e
+ union {
+ LIST_ENTRY WaitListEntry; // 0x60
+ SINGLE_LIST_ENTRY SwapListEntry; // 0x60
+ };
+ PKQUEUE Queue; // 0x68
+ ULONG WaitTime; // 0x6c
+ union {
+ struct {
+ USHORT KernelApcDisable; // 0x70
+ USHORT SpecialApcDisable; // 0x72
+ };
+ USHORT CombinedApcDisable; // 0x70
+ };
+ KTIMER Timer; // 0x78
+ KWAIT_BLOCK WaitBlock[4]; // 0xa0
+ LIST_ENTRY QueueListEntry; // 0x100
+ UCHAR ApcStateIndex; // 0x108
+ BOOLEAN ApcQueueable; // 0x109
+ BOOLEAN Preempted; // 0x10a
+ BOOLEAN ProcessReadyQueue; // 0x10b
+ BOOLEAN KernelStackResident; // 0x10c
+ CHAR Saturation; // 0x10d
+ UCHAR IdealProcessor; // 0x10e
+ UCHAR NextProcessor; // 0x10f
+ CHAR BasePriority; // 0x110
+ UCHAR Spare4; // 0x111
+ CHAR PriorityDecrement; // 0x112
+ CHAR Quantum; // 0x113
+ BOOLEAN SystemAffinityActive; // 0x114
+ CHAR PreviousMode; // 0x115
+ UCHAR ResourceIndex; // 0x116
+ BOOLEAN DisableBoost; // 0x117
+ ULONG UserAffinity; // 0x118
+ PKPROCESS Process; // 0x11c
+ ULONG Affinity; // 0x120
+ PSERVICE_DESCRIPTOR_TABLE ServiceTable; // 0x124
+ PKAPC_STATE ApcStatePointer[2]; // 0x128
+ KAPC_STATE SavedApcState; // 0x130
+ PVOID CallbackStack; // 0x148
+ PVOID Win32Thread; // 0x14c
+ PKTRAP_FRAME TrapFrame; // 0x150
+ ULONG KernelTime; // 0x154
+ ULONG UserTime; // 0x158
+ PVOID StackBase; // 0x15c
+ KAPC SuspendApc; // 0x160
+ KSEMAPHORE SuspendSemaphore; // 0x190
+ PVOID TlsArray; // 0x1a4
+ PVOID LegoData; // 0x1a8
+ LIST_ENTRY ThreadListEntry; // 0x1ac
+ BOOLEAN LargeStack; // 0x1b4
+ UCHAR PowerState; // 0x1b5
+ UCHAR NpxIrql; // 0x1b6
+ UCHAR Spare5; // 0x1b7
+ BOOLEAN AutoAlignment; // 0x1b8
+ UCHAR Iopl; // 0x1b9
+ CHAR FreezeCount; // 0x1ba
+ CHAR SuspendCount; // 0x1bb
+ UCHAR Spare0[1]; // 0x1bc
+ UCHAR UserIdealProcessor; // 0x1bd
+ UCHAR DeferredProcessor; // 0x1be
+ UCHAR AdjustReason; // 0x1bf
+ CHAR AdjustIncrement; // 0x1c0
+ UCHAR Spare2[3]; // 0x1c1
+} KTHREAD, *PKTHREAD;
+
+#elif (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _KTHREAD {
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY MutantListHead;
+ PVOID InitialStack;
+ PVOID StackLimit;
+ struct _TEB *Teb;
+ PVOID TlsArray;
+ PVOID KernelStack;
+ BOOLEAN DebugActive;
+ UCHAR State;
+ UCHAR Alerted[2];
+ UCHAR Iopl;
+ UCHAR NpxState;
+ CHAR Saturation;
+ CHAR Priority;
+ KAPC_STATE ApcState;
+ ULONG ContextSwitches;
+ UCHAR IdleSwapBlock;
+ UCHAR Spare0[3];
+ NTSTATUS WaitStatus;
+ UCHAR WaitIrql;
+ CHAR WaitMode;
+ UCHAR WaitNext;
+ UCHAR WaitReason;
+ PKWAIT_BLOCK WaitBlockList;
+ union {
+ LIST_ENTRY WaitListEntry;
+ SINGLE_LIST_ENTRY SwapListEntry;
+ };
+ ULONG WaitTime;
+ CHAR BasePriority;
+ UCHAR DecrementCount;
+ CHAR PriorityDecrement;
+ CHAR Quantum;
+ KWAIT_BLOCK WaitBlock[4];
+ PVOID LegoData;
+ ULONG KernelApcDisable;
+ ULONG UserAffinity;
+ BOOLEAN SystemAffinityActive;
+ UCHAR PowerState;
+ UCHAR NpxIrql;
+ UCHAR InitialNode;
+ PSERVICE_DESCRIPTOR_TABLE ServiceTable;
+ PKQUEUE Queue;
+ KSPIN_LOCK ApcQueueLock;
+ KTIMER Timer;
+ LIST_ENTRY QueueListEntry;
+ ULONG SoftAffinity;
+ ULONG Affinity;
+ BOOLEAN Preempted;
+ BOOLEAN ProcessReadyQueue;
+ BOOLEAN KernelStackResident;
+ UCHAR NextProcessor;
+ PVOID CallbackStack;
+ PVOID Win32Thread;
+ PKTRAP_FRAME TrapFrame;
+ PKAPC_STATE ApcStatePointer[2];
+ CHAR PreviousMode;
+ BOOLEAN EnableStackSwap;
+ BOOLEAN LargeStack;
+ UCHAR ResourceIndex;
+ ULONG KernelTime;
+ ULONG UserTime;
+ KAPC_STATE SavedApcState;
+ BOOLEAN Alertable;
+ UCHAR ApcStateIndex;
+ BOOLEAN ApcQueueable;
+ BOOLEAN AutoAlignment;
+ PVOID StackBase;
+ KAPC SuspendApc;
+ KSEMAPHORE SuspendSemaphore;
+ LIST_ENTRY ThreadListEntry;
+ CHAR FreezeCount;
+ CHAR SuspendCount;
+ UCHAR IdealProcessor;
+ BOOLEAN DisableBoost;
+} KTHREAD, *PKTHREAD;
+
+#else
+
+typedef struct _KTHREAD {
+ DISPATCHER_HEADER Header;
+ LIST_ENTRY MutantListHead;
+ PVOID InitialStack;
+ PVOID StackLimit;
+ struct _TEB *Teb;
+ PVOID TlsArray;
+ PVOID KernelStack;
+ BOOLEAN DebugActive;
+ UCHAR State;
+ USHORT Alerted;
+ UCHAR Iopl;
+ UCHAR NpxState;
+ UCHAR Saturation;
+ UCHAR Priority;
+ KAPC_STATE ApcState;
+ ULONG ContextSwitches;
+ NTSTATUS WaitStatus;
+ UCHAR WaitIrql;
+ UCHAR WaitMode;
+ UCHAR WaitNext;
+ UCHAR WaitReason;
+ PKWAIT_BLOCK WaitBlockList;
+ LIST_ENTRY WaitListEntry;
+ ULONG WaitTime;
+ UCHAR BasePriority;
+ UCHAR DecrementCount;
+ UCHAR PriorityDecrement;
+ UCHAR Quantum;
+ KWAIT_BLOCK WaitBlock[4];
+ ULONG LegoData;
+ ULONG KernelApcDisable;
+ ULONG UserAffinity;
+ BOOLEAN SystemAffinityActive;
+#if (VER_PRODUCTBUILD < 2195)
+ UCHAR Pad[3];
+#else // (VER_PRODUCTBUILD >= 2195)
+ UCHAR PowerState;
+ UCHAR NpxIrql;
+ UCHAR Pad[1];
+#endif // (VER_PRODUCTBUILD >= 2195)
+ PSERVICE_DESCRIPTOR_TABLE ServiceDescriptorTable;
+ PKQUEUE Queue;
+ KSPIN_LOCK ApcQueueLock;
+ KTIMER Timer;
+ LIST_ENTRY QueueListEntry;
+ ULONG Affinity;
+ BOOLEAN Preempted;
+ BOOLEAN ProcessReadyQueue;
+ BOOLEAN KernelStackResident;
+ UCHAR NextProcessor;
+ PVOID CallbackStack;
+ PVOID Win32Thread;
+ PKTRAP_FRAME TrapFrame;
+ PKAPC_STATE ApcStatePointer[2];
+#if (VER_PRODUCTBUILD >= 2195)
+ UCHAR PreviousMode;
+#endif // (VER_PRODUCTBUILD >= 2195)
+ BOOLEAN EnableStackSwap;
+ BOOLEAN LargeStack;
+ UCHAR ResourceIndex;
+#if (VER_PRODUCTBUILD < 2195)
+ UCHAR PreviousMode;
+#endif // (VER_PRODUCTBUILD < 2195)
+ ULONG KernelTime;
+ ULONG UserTime;
+ KAPC_STATE SavedApcState;
+ BOOLEAN Alertable;
+ UCHAR ApcStateIndex;
+ BOOLEAN ApcQueueable;
+ BOOLEAN AutoAlignment;
+ PVOID StackBase;
+ KAPC SuspendApc;
+ KSEMAPHORE SuspendSemaphore;
+ LIST_ENTRY ThreadListEntry;
+ UCHAR FreezeCount;
+ UCHAR SuspendCount;
+ UCHAR IdealProcessor;
+ BOOLEAN DisableBoost;
+} KTHREAD, *PKTHREAD;
+
+#endif
+
+#if (VER_PRODUCTBUILD >= 3790)
+
+typedef struct _MMSUPPORT_FLAGS {
+ ULONG SessionSpace : 1;
+ ULONG BeingTrimmed : 1;
+ ULONG SessionLeader : 1;
+ ULONG TrimHard : 1;
+ ULONG MaximumWorkingSetHard : 1;
+ ULONG ForceTrim : 1;
+ ULONG MinimumWorkingSetHard : 1;
+ ULONG Available0 : 1;
+ ULONG MemoryPriority : 8;
+ ULONG GrowWsleHash : 1;
+ ULONG AcquiredUnsafe : 1;
+ ULONG Available : 14;
+} MMSUPPORT_FLAGS, *PMMSUPPORT_FLAGS;
+
+#elif (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _MMSUPPORT_FLAGS {
+ ULONG SessionSpace : 1;
+ ULONG BeingTrimmed : 1;
+ ULONG SessionLeader : 1;
+ ULONG TrimHard : 1;
+ ULONG WorkingSetHard : 1;
+ ULONG AddressSpaceBeingDeleted : 1;
+ ULONG Available : 10;
+ ULONG AllowWorkingSetAdjustment : 8;
+ ULONG MemoryPriority : 8;
+} MMSUPPORT_FLAGS, *PMMSUPPORT_FLAGS;
+
+#else
+
+typedef struct _MMSUPPORT_FLAGS {
+ ULONG SessionSpace : 1;
+ ULONG BeingTrimmed : 1;
+ ULONG ProcessInSession : 1;
+ ULONG SessionLeader : 1;
+ ULONG TrimHard : 1;
+ ULONG WorkingSetHard : 1;
+ ULONG WriteWatch : 1;
+ ULONG Filler : 25;
+} MMSUPPORT_FLAGS, *PMMSUPPORT_FLAGS;
+
+#endif
+
+#if (VER_PRODUCTBUILD >= 3790)
+/*
+typedef struct _KGUARDED_MUTEX {
+ LONG Count;
+ PKTHREAD Owner; // 0x4
+ ULONG Contention; // 0x8
+ KEVENT Event; // 0xc
+ union {
+ struct {
+ USHORT KernelApcDisable; // 0x1c
+ USHORT SpecialApcDisable; // 0x1e
+ };
+ USHORT CombinedApcDisable; // 0x1c
+ };
+} KGUARDED_MUTEX, *PKGUARDED_MUTEX;
+*/
+typedef struct _MMSUPPORT {
+ LIST_ENTRY WorkingSetExpansionLinks;
+ LARGE_INTEGER LastTrimTime; // 0x8
+ MMSUPPORT_FLAGS Flags; // 0x10
+ ULONG PageFaultCount; // 0x14
+ ULONG PeakWorkingSetSize; // 0x18
+ ULONG GrowthSinceLastEstimate; // 0x1c
+ ULONG MinimumWorkingSetSize; // 0x20
+ ULONG MaximumWorkingSetSize; // 0x24
+ PMMWSL VmWorkingSetList; // 0x28
+ ULONG Claim; // 0x2c
+ ULONG NextEstimationSlot; // 0x30
+ ULONG NextAgingSlot; // 0x34
+ ULONG EstimatedAvailable; // 0x38
+ ULONG WorkingSetSize; //0x3c
+ KGUARDED_MUTEX Mutex; // 0x40
+} MMSUPPORT, *PMMSUPPORT;
+
+#elif (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _MMSUPPORT {
+ LARGE_INTEGER LastTrimTime;
+ MMSUPPORT_FLAGS Flags;
+ ULONG PageFaultCount;
+ ULONG PeakWorkingSetSize;
+ ULONG WorkingSetSize;
+ ULONG MinimumWorkingSetSize;
+ ULONG MaximumWorkingSetSize;
+ PMMWSL VmWorkingSetList;
+ LIST_ENTRY WorkingSetExpansionLinks;
+ ULONG Claim;
+ ULONG NextEstimationSlot;
+ ULONG NextAgingSlot;
+ ULONG EstimatedAvailable;
+ ULONG GrowthSinceLastEstimate;
+} MMSUPPORT, *PMMSUPPORT;
+
+#else
+
+typedef struct _MMSUPPORT {
+ LARGE_INTEGER LastTrimTime;
+ ULONG LastTrimFaultCount;
+ ULONG PageFaultCount;
+ ULONG PeakWorkingSetSize;
+ ULONG WorkingSetSize;
+ ULONG MinimumWorkingSetSize;
+ ULONG MaximumWorkingSetSize;
+ PMMWSL VmWorkingSetList;
+ LIST_ENTRY WorkingSetExpansionLinks;
+ BOOLEAN AllowWorkingSetAdjustment;
+ BOOLEAN AddressSpaceBeingDeleted;
+ UCHAR ForegroundSwitchCount;
+ UCHAR MemoryPriority;
+#if (VER_PRODUCTBUILD >= 2195)
+ union {
+ ULONG LongFlags;
+ MMSUPPORT_FLAGS Flags;
+ } u;
+ ULONG Claim;
+ ULONG NextEstimationSlot;
+ ULONG NextAgingSlot;
+ ULONG EstimatedAvailable;
+ ULONG GrowthSinceLastEstimate;
+#endif // (VER_PRODUCTBUILD >= 2195)
+} MMSUPPORT, *PMMSUPPORT;
+
+#endif
+
+typedef struct _SE_AUDIT_PROCESS_CREATION_INFO {
+ POBJECT_NAME_INFORMATION ImageFileName;
+} SE_AUDIT_PROCESS_CREATION_INFO, *PSE_AUDIT_PROCESS_CREATION_INFO;
+
+typedef struct _SID_IDENTIFIER_AUTHORITY {
+ UCHAR Value[6];
+} SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
+
+typedef struct _SID {
+ UCHAR Revision;
+ UCHAR SubAuthorityCount;
+ SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
+ ULONG SubAuthority[1];
+} SID, *PREAL_SID;
+
+typedef struct _BITMAP_DESCRIPTOR {
+ ULONGLONG StartLcn;
+ ULONGLONG ClustersToEndOfVol;
+ UCHAR Map[1];
+} BITMAP_DESCRIPTOR, *PBITMAP_DESCRIPTOR;
+
+typedef struct _BITMAP_RANGE {
+ LIST_ENTRY Links;
+ LARGE_INTEGER BasePage;
+ ULONG FirstDirtyPage;
+ ULONG LastDirtyPage;
+ ULONG DirtyPages;
+ PULONG Bitmap;
+} BITMAP_RANGE, *PBITMAP_RANGE;
+
+typedef struct _CACHE_UNINITIALIZE_EVENT {
+ struct _CACHE_UNINITIALIZE_EVENT *Next;
+ KEVENT Event;
+} CACHE_UNINITIALIZE_EVENT, *PCACHE_UNINITIALIZE_EVENT;
+
+typedef struct _CC_FILE_SIZES {
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER FileSize;
+ LARGE_INTEGER ValidDataLength;
+} CC_FILE_SIZES, *PCC_FILE_SIZES;
+
+typedef struct _COMPRESSED_DATA_INFO {
+ USHORT CompressionFormatAndEngine;
+ UCHAR CompressionUnitShift;
+ UCHAR ChunkShift;
+ UCHAR ClusterShift;
+ UCHAR Reserved;
+ USHORT NumberOfChunks;
+ ULONG CompressedChunkSizes[ANYSIZE_ARRAY];
+} COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
+
+typedef struct _DEVICE_MAP {
+ POBJECT_DIRECTORY DosDevicesDirectory;
+ POBJECT_DIRECTORY GlobalDosDevicesDirectory;
+ ULONG ReferenceCount;
+ ULONG DriveMap;
+ UCHAR DriveType[32];
+} DEVICE_MAP, *PDEVICE_MAP;
+
+typedef struct _DIRECTORY_BASIC_INFORMATION {
+ UNICODE_STRING ObjectName;
+ UNICODE_STRING ObjectTypeName;
+} DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_INFORMATION;
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _EX_FAST_REF {
+ union {
+ PVOID Object;
+ ULONG RefCnt : 3;
+ ULONG Value;
+ };
+} EX_FAST_REF, *PEX_FAST_REF;
+
+typedef struct _EX_PUSH_LOCK {
+ union {
+ struct {
+ ULONG Waiting : 1;
+ ULONG Exclusive : 1;
+ ULONG Shared : 30;
+ };
+ ULONG Value;
+ PVOID Ptr;
+ };
+} EX_PUSH_LOCK, *PEX_PUSH_LOCK;
+
+#endif // (VER_PRODUCTBUILD >= 2600)
+
+#if (VER_PRODUCTBUILD == 2600)
+
+typedef struct _EX_RUNDOWN_REF {
+ union {
+ ULONG Count;
+ PVOID Ptr;
+ };
+} EX_RUNDOWN_REF, *PEX_RUNDOWN_REF;
+
+#endif // (VER_PRODUCTBUILD == 2600)
+
+#if (VER_PRODUCTBUILD >= 3790)
+
+typedef struct _MM_ADDRESS_NODE {
+ union {
+ ULONG Balance : 2;
+ struct _MM_ADDRESS_NODE *Parent; // lower 2 bits of Parent are Balance and must be zeroed to obtain Parent
+ };
+ struct _MM_ADDRESS_NODE *LeftChild;
+ struct _MM_ADDRESS_NODE *RightChild;
+ ULONG_PTR StartingVpn;
+ ULONG_PTR EndingVpn;
+} MMADDRESS_NODE, *PMMADDRESS_NODE;
+
+typedef struct _MM_AVL_TABLE {
+ MMADDRESS_NODE BalancedRoot; // Vadroot; incorrectly represents the NULL pages (EndingVpn should be 0xf, etc.)
+ ULONG DepthOfTree : 5; // 0x14
+ ULONG Unused : 3;
+ ULONG NumberGenericTableElements : 24; // total number of nodes
+ PVOID NodeHint; // 0x18 (0x270 in _EPROCESS)
+ PVOID NodeFreeHint; // 0x1c
+} MM_AVL_TABLE, *PMM_AVL_TABLE;
+
+typedef struct _EPROCESS {
+ KPROCESS Pcb; // +0x000
+ EX_PUSH_LOCK ProcessLock; // +0x06c
+ LARGE_INTEGER CreateTime; // +0x070
+ LARGE_INTEGER ExitTime; // +0x078
+ EX_RUNDOWN_REF RundownProtect; // +0x080
+ ULONG UniqueProcessId; // +0x084
+ LIST_ENTRY ActiveProcessLinks; // +0x088
+ ULONG QuotaUsage[3]; // +0x090
+ ULONG QuotaPeak[3]; // +0x09c
+ ULONG CommitCharge; // +0x0a8
+ ULONG PeakVirtualSize; // +0x0ac
+ ULONG VirtualSize; // +0x0b0
+ LIST_ENTRY SessionProcessLinks; // +0x0b4
+ PVOID DebugPort; // +0x0bc
+ PVOID ExceptionPort; // +0x0c0
+ PHANDLE_TABLE ObjectTable; // +0x0c4
+ EX_FAST_REF Token; // +0x0c8
+ ULONG WorkingSetPage; // +0x0cc
+ KGUARDED_MUTEX AddressCreationLock; // +0x0d0
+ ULONG HyperSpaceLock; // +0x0f0
+ PETHREAD ForkInProgress; // +0x0f4
+ ULONG HardwareTrigger; // +0x0f8
+ PMM_AVL_TABLE PhysicalVadRoot; // +0x0fc
+ PVOID CloneRoot; // +0x100
+ ULONG NumberOfPrivatePages; // +0x104
+ ULONG NumberOfLockedPages; // +0x108
+ PVOID Win32Process; // +0x10c
+ PEJOB Job; // +0x110
+ PVOID SectionObject; // +0x114
+ PVOID SectionBaseAddress; // +0x118
+ PEPROCESS_QUOTA_BLOCK QuotaBlock; // +0x11c
+ PPAGEFAULT_HISTORY WorkingSetWatch; // +0x120
+ PVOID Win32WindowStation; // +0x124
+ ULONG InheritedFromUniqueProcessId; // +0x128
+ PVOID LdtInformation; // +0x12c
+ PVOID VadFreeHint; // +0x130
+ PVOID VdmObjects; // +0x134
+ PVOID DeviceMap; // +0x138
+ PVOID Spare0[3]; // +0x13c
+ union {
+ HARDWARE_PTE PageDirectoryPte; // +0x148
+ UINT64 Filler; // +0x148
+ };
+ PVOID Session; // +0x150
+ UCHAR ImageFileName[16]; // +0x154
+ LIST_ENTRY JobLinks; // +0x164
+ PVOID LockedPagesList; // +0x16c
+ LIST_ENTRY ThreadListHead; // +0x170
+ PVOID SecurityPort; // +0x178
+ PVOID PaeTop; // +0x17c
+ ULONG ActiveThreads; // +0x180
+ ULONG GrantedAccess; // +0x184
+ ULONG DefaultHardErrorProcessing; // +0x188
+ SHORT LastThreadExitStatus; // +0x18c
+ PPEB Peb; // +0x190
+ EX_FAST_REF PrefetchTrace; // +0x194
+ LARGE_INTEGER ReadOperationCount; // +0x198
+ LARGE_INTEGER WriteOperationCount; // +0x1a0
+ LARGE_INTEGER OtherOperationCount; // +0x1a8
+ LARGE_INTEGER ReadTransferCount; // +0x1b0
+ LARGE_INTEGER WriteTransferCount; // +0x1b8
+ LARGE_INTEGER OtherTransferCount; // +0x1c0
+ ULONG CommitChargeLimit; // +0x1c8
+ ULONG CommitChargePeak; // +0x1cc
+ PVOID AweInfo; // +0x1d0
+ SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo; // +0x1d4
+ MMSUPPORT Vm; // +0x1d8
+ LIST_ENTRY MmProcessLinks; // +0x238
+ ULONG ModifiedPageCount; // +0x240
+ ULONG JobStatus; // +0x244
+ union {
+ ULONG Flags; // 0x248
+ struct {
+ ULONG CreateReported : 1;
+ ULONG NoDebugInherit : 1;
+ ULONG ProcessExiting : 1;
+ ULONG ProcessDelete : 1;
+ ULONG Wow64SplitPages : 1;
+ ULONG VmDeleted : 1;
+ ULONG OutswapEnabled : 1;
+ ULONG Outswapped : 1;
+ ULONG ForkFailed : 1;
+ ULONG Wow64VaSpace4Gb : 1;
+ ULONG AddressSpaceInitialized : 2;
+ ULONG SetTimerResolution : 1;
+ ULONG BreakOnTermination : 1;
+ ULONG SessionCreationUnderway : 1;
+ ULONG WriteWatch : 1;
+ ULONG ProcessInSession : 1;
+ ULONG OverrideAddressSpace : 1;
+ ULONG HasAddressSpace : 1;
+ ULONG LaunchPrefetched : 1;
+ ULONG InjectInpageErrors : 1;
+ ULONG VmTopDown : 1;
+ ULONG ImageNotifyDone : 1;
+ ULONG PdeUpdateNeeded : 1;
+ ULONG VdmAllowed : 1;
+ ULONG Unused : 7;
+ };
+ };
+ NTSTATUS ExitStatus; // +0x24c
+ USHORT NextPageColor; // +0x250
+ union {
+ struct {
+ UCHAR SubSystemMinorVersion; // +0x252
+ UCHAR SubSystemMajorVersion; // +0x253
+ };
+ USHORT SubSystemVersion; // +0x252
+ };
+ UCHAR PriorityClass; // +0x254
+ MM_AVL_TABLE VadRoot; // +0x258
+} EPROCESS, *PEPROCESS; // 0x278 in total
+
+#elif (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _EPROCESS {
+ KPROCESS Pcb;
+ EX_PUSH_LOCK ProcessLock;
+ LARGE_INTEGER CreateTime;
+ LARGE_INTEGER ExitTime;
+ EX_RUNDOWN_REF RundownProtect;
+ ULONG UniqueProcessId;
+ LIST_ENTRY ActiveProcessLinks;
+ ULONG QuotaUsage[3];
+ ULONG QuotaPeak[3];
+ ULONG CommitCharge;
+ ULONG PeakVirtualSize;
+ ULONG VirtualSize;
+ LIST_ENTRY SessionProcessLinks;
+ PVOID DebugPort;
+ PVOID ExceptionPort;
+ PHANDLE_TABLE ObjectTable;
+ EX_FAST_REF Token;
+ FAST_MUTEX WorkingSetLock;
+ ULONG WorkingSetPage;
+ FAST_MUTEX AddressCreationLock;
+ KSPIN_LOCK HyperSpaceLock;
+ PETHREAD ForkInProgress;
+ ULONG HardwareTrigger;
+ PVOID VadRoot;
+ PVOID VadHint;
+ PVOID CloneRoot;
+ ULONG NumberOfPrivatePages;
+ ULONG NumberOfLockedPages;
+ PVOID Win32Process;
+ PEJOB Job;
+ PSECTION_OBJECT SectionObject;
+ PVOID SectionBaseAddress;
+ PEPROCESS_QUOTA_BLOCK QuotaBlock;
+ PPAGEFAULT_HISTORY WorkingSetWatch;
+ PVOID Win32WindowStation;
+ PVOID InheritedFromUniqueProcessId;
+ PVOID LdtInformation;
+ PVOID VadFreeHint;
+ PVOID VdmObjects;
+ PDEVICE_MAP DeviceMap;
+ LIST_ENTRY PhysicalVadList;
+ union {
+ HARDWARE_PTE PageDirectoryPte;
+ ULONGLONG Filler;
+ };
+ PVOID Session;
+ UCHAR ImageFileName[16];
+ LIST_ENTRY JobLinks;
+ PVOID LockedPageList;
+ LIST_ENTRY ThreadListHead;
+ PVOID SecurityPort;
+ PVOID PaeTop;
+ ULONG ActiveThreads;
+ ULONG GrantedAccess;
+ ULONG DefaultHardErrorProcessing;
+ NTSTATUS LastThreadExitStatus;
+ PPEB Peb;
+ EX_FAST_REF PrefetchTrace;
+ LARGE_INTEGER ReadOperationCount;
+ LARGE_INTEGER WriteOperationCount;
+ LARGE_INTEGER OtherOperationCount;
+ LARGE_INTEGER ReadTransferCount;
+ LARGE_INTEGER WriteTransferCount;
+ LARGE_INTEGER OtherTransferCount;
+ ULONG CommitChargeLimit;
+ ULONG CommitChargePeek;
+ PVOID AweInfo;
+ SE_AUDIT_PROCESS_CREATION_INFO SeAuditProcessCreationInfo;
+ MMSUPPORT Vm;
+ ULONG LastFaultCount;
+ ULONG ModifiedPageCount;
+ ULONG NumberOfVads;
+ ULONG JobStatus;
+ union {
+ ULONG Flags;
+ struct {
+ ULONG CreateReported : 1;
+ ULONG NoDebugInherit : 1;
+ ULONG ProcessExiting : 1;
+ ULONG ProcessDelete : 1;
+ ULONG Wow64SplitPages : 1;
+ ULONG VmDeleted : 1;
+ ULONG OutswapEnabled : 1;
+ ULONG Outswapped : 1;
+ ULONG ForkFailed : 1;
+ ULONG HasPhysicalVad : 1;
+ ULONG AddressSpaceInitialized : 2;
+ ULONG SetTimerResolution : 1;
+ ULONG BreakOnTermination : 1;
+ ULONG SessionCreationUnderway : 1;
+ ULONG WriteWatch : 1;
+ ULONG ProcessInSession : 1;
+ ULONG OverrideAddressSpace : 1;
+ ULONG HasAddressSpace : 1;
+ ULONG LaunchPrefetched : 1;
+ ULONG InjectInpageErrors : 1;
+ ULONG Unused : 11;
+ };
+ };
+ NTSTATUS ExitStatus;
+ USHORT NextPageColor;
+ union {
+ struct {
+ UCHAR SubSystemMinorVersion;
+ UCHAR SubSystemMajorVersion;
+ };
+ USHORT SubSystemVersion;
+ };
+ UCHAR PriorityClass;
+ BOOLEAN WorkingSetAcquiredUnsafe;
+} EPROCESS, *PEPROCESS;
+
+#else
+
+typedef struct _EPROCESS {
+ KPROCESS Pcb;
+ NTSTATUS ExitStatus;
+ KEVENT LockEvent;
+ ULONG LockCount;
+ LARGE_INTEGER CreateTime;
+ LARGE_INTEGER ExitTime;
+ PKTHREAD LockOwner;
+ ULONG UniqueProcessId;
+ LIST_ENTRY ActiveProcessLinks;
+ ULONGLONG QuotaPeakPoolUsage;
+ ULONGLONG QuotaPoolUsage;
+ ULONG PagefileUsage;
+ ULONG CommitCharge;
+ ULONG PeakPagefileUsage;
+ ULONG PeakVirtualSize;
+ ULONGLONG VirtualSize;
+ MMSUPPORT Vm;
+#if (VER_PRODUCTBUILD < 2195)
+ ULONG LastProtoPteFault;
+#else // (VER_PRODUCTBUILD >= 2195)
+ LIST_ENTRY SessionProcessLinks;
+#endif // (VER_PRODUCTBUILD >= 2195)
+ ULONG DebugPort;
+ ULONG ExceptionPort;
+ PHANDLE_TABLE ObjectTable;
+ PACCESS_TOKEN Token;
+ FAST_MUTEX WorkingSetLock;
+ ULONG WorkingSetPage;
+ BOOLEAN ProcessOutswapEnabled;
+ BOOLEAN ProcessOutswapped;
+ BOOLEAN AddressSpaceInitialized;
+ BOOLEAN AddressSpaceDeleted;
+ FAST_MUTEX AddressCreationLock;
+ KSPIN_LOCK HyperSpaceLock;
+ PETHREAD ForkInProgress;
+ USHORT VmOperation;
+ BOOLEAN ForkWasSuccessful;
+ UCHAR MmAgressiveWsTrimMask;
+ PKEVENT VmOperationEvent;
+#if (VER_PRODUCTBUILD < 2195)
+ HARDWARE_PTE PageDirectoryPte;
+#else // (VER_PRODUCTBUILD >= 2195)
+ PVOID PaeTop;
+#endif // (VER_PRODUCTBUILD >= 2195)
+ ULONG LastFaultCount;
+ ULONG ModifiedPageCount;
+ PVOID VadRoot;
+ PVOID VadHint;
+ ULONG CloneRoot;
+ ULONG NumberOfPrivatePages;
+ ULONG NumberOfLockedPages;
+ USHORT NextPageColor;
+ BOOLEAN ExitProcessCalled;
+ BOOLEAN CreateProcessReported;
+ HANDLE SectionHandle;
+ PPEB Peb;
+ PVOID SectionBaseAddress;
+ PEPROCESS_QUOTA_BLOCK QuotaBlock;
+ NTSTATUS LastThreadExitStatus;
+ PPROCESS_WS_WATCH_INFORMATION WorkingSetWatch;
+ HANDLE Win32WindowStation;
+ HANDLE InheritedFromUniqueProcessId;
+ ACCESS_MASK GrantedAccess;
+ ULONG DefaultHardErrorProcessing;
+ PVOID LdtInformation;
+ PVOID VadFreeHint;
+ PVOID VdmObjects;
+#if (VER_PRODUCTBUILD < 2195)
+ KMUTANT ProcessMutant;
+#else // (VER_PRODUCTBUILD >= 2195)
+ PDEVICE_MAP DeviceMap;
+ ULONG SessionId;
+ LIST_ENTRY PhysicalVadList;
+ HARDWARE_PTE PageDirectoryPte;
+ ULONG Filler;
+ ULONG PaePageDirectoryPage;
+#endif // (VER_PRODUCTBUILD >= 2195)
+ UCHAR ImageFileName[16];
+ ULONG VmTrimFaultValue;
+ UCHAR SetTimerResolution;
+ UCHAR PriorityClass;
+ union {
+ struct {
+ UCHAR SubSystemMinorVersion;
+ UCHAR SubSystemMajorVersion;
+ };
+ USHORT SubSystemVersion;
+ };
+ PVOID Win32Process;
+#if (VER_PRODUCTBUILD >= 2195)
+ PEJOB Job;
+ ULONG JobStatus;
+ LIST_ENTRY JobLinks;
+ PVOID LockedPageList;
+ PVOID SecurityPort;
+ PWOW64_PROCESS Wow64Process;
+ LARGE_INTEGER ReadOperationCount;
+ LARGE_INTEGER WriteOperationCount;
+ LARGE_INTEGER OtherOperationCount;
+ LARGE_INTEGER ReadTransferCount;
+ LARGE_INTEGER WriteTransferCount;
+ LARGE_INTEGER OtherTransferCount;
+ ULONG CommitChargeLimit;
+ ULONG CommitChargePeek;
+ LIST_ENTRY ThreadListHead;
+ PRTL_BITMAP VadPhysicalPagesBitMap;
+ ULONG VadPhysicalPages;
+ ULONG AweLock;
+#endif // (VER_PRODUCTBUILD >= 2195)
+} EPROCESS, *PEPROCESS;
+
+#endif
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _ETHREAD {
+ KTHREAD Tcb;
+ union {
+ LARGE_INTEGER CreateTime;
+ struct {
+ ULONG NestedFaultCount : 2;
+ ULONG ApcNeeded : 1;
+ };
+ };
+ union {
+ LARGE_INTEGER ExitTime;
+ LIST_ENTRY LpcReplyChain;
+ LIST_ENTRY KeyedWaitChain;
+ };
+ union {
+ NTSTATUS ExitStatus;
+ PVOID OfsChain;
+ };
+ LIST_ENTRY PostBlockList;
+ union {
+ PTERMINATION_PORT TerminationPort;
+ PETHREAD ReaperLink;
+ PVOID KeyedWaitValue;
+ };
+ KSPIN_LOCK ActiveTimerListLock;
+ LIST_ENTRY ActiveTimerListHead;
+ CLIENT_ID Cid;
+ union {
+ KSEMAPHORE LpcReplySemaphore;
+ KSEMAPHORE KeyedWaitSemaphore;
+ };
+ union {
+ PLPC_MESSAGE LpcReplyMessage;
+ PVOID LpcWaitingOnPort;
+ };
+ PPS_IMPERSONATION_INFORMATION ImpersonationInfo;
+ LIST_ENTRY IrpList;
+ ULONG TopLevelIrp;
+ PDEVICE_OBJECT DeviceToVerify;
+ PEPROCESS ThreadsProcess;
+ PKSTART_ROUTINE StartAddress;
+ union {
+ PVOID Win32StartAddress;
+ ULONG LpcReceivedMessageId;
+ };
+ LIST_ENTRY ThreadListEntry;
+ EX_RUNDOWN_REF RundownProtect;
+ EX_PUSH_LOCK ThreadLock;
+ ULONG LpcReplyMessageId;
+ ULONG ReadClusterSize;
+ ACCESS_MASK GrantedAccess;
+ union {
+ ULONG CrossThreadFlags;
+ struct {
+ ULONG Terminated : 1;
+ ULONG DeadThread : 1;
+ ULONG HideFromDebugger : 1;
+ ULONG ActiveImpersonationInfo : 1;
+ ULONG SystemThread : 1;
+ ULONG HardErrorsAreDisabled : 1;
+ ULONG BreakOnTermination : 1;
+ ULONG SkipCreationMsg : 1;
+ ULONG SkipTerminationMsg : 1;
+ };
+ };
+ union {
+ ULONG SameThreadPassiveFlags;
+ struct {
+ ULONG ActiveExWorker : 1;
+ ULONG ExWorkerCanWaitUser : 1;
+ ULONG MemoryMaker : 1;
+ ULONG KeyedEventInUse : 1;
+ };
+ };
+ union {
+ ULONG SameThreadApcFlags;
+ struct {
+ BOOLEAN LpcReceivedMsgIdValid : 1;
+ BOOLEAN LpcExitThreadCalled : 1;
+ BOOLEAN AddressSpaceOwner : 1;
+ };
+ };
+ BOOLEAN ForwardClusterOnly;
+ BOOLEAN DisablePageFaultClustering;
+} ETHREAD, *PETHREAD;
+
+#else
+
+typedef struct _ETHREAD {
+ KTHREAD Tcb;
+ LARGE_INTEGER CreateTime;
+ union {
+ LARGE_INTEGER ExitTime;
+ LIST_ENTRY LpcReplyChain;
+ };
+ union {
+ NTSTATUS ExitStatus;
+ PVOID OfsChain;
+ };
+ LIST_ENTRY PostBlockList;
+ LIST_ENTRY TerminationPortList;
+ KSPIN_LOCK ActiveTimerListLock;
+ LIST_ENTRY ActiveTimerListHead;
+ CLIENT_ID Cid;
+ KSEMAPHORE LpcReplySemaphore;
+ PLPC_MESSAGE LpcReplyMessage;
+ ULONG LpcReplyMessageId;
+ ULONG PerformanceCountLow;
+ PPS_IMPERSONATION_INFORMATION ImpersonationInfo;
+ LIST_ENTRY IrpList;
+ PVOID TopLevelIrp;
+ PDEVICE_OBJECT DeviceToVerify;
+ ULONG ReadClusterSize;
+ BOOLEAN ForwardClusterOnly;
+ BOOLEAN DisablePageFaultClustering;
+ BOOLEAN DeadThread;
+#if (VER_PRODUCTBUILD >= 2195)
+ BOOLEAN HideFromDebugger;
+#endif // (VER_PRODUCTBUILD >= 2195)
+#if (VER_PRODUCTBUILD < 2195)
+ BOOLEAN HasTerminated;
+#else // (VER_PRODUCTBUILD >= 2195)
+ ULONG HasTerminated;
+#endif // (VER_PRODUCTBUILD >= 2195)
+#if (VER_PRODUCTBUILD < 2195)
+ PKEVENT_PAIR EventPair;
+#endif // (VER_PRODUCTBUILD < 2195)
+ ACCESS_MASK GrantedAccess;
+ PEPROCESS ThreadsProcess;
+ PKSTART_ROUTINE StartAddress;
+ union {
+ PVOID Win32StartAddress;
+ ULONG LpcReceivedMessageId;
+ };
+ BOOLEAN LpcExitThreadCalled;
+ BOOLEAN HardErrorsAreDisabled;
+ BOOLEAN LpcReceivedMsgIdValid;
+ BOOLEAN ActiveImpersonationInfo;
+ ULONG PerformanceCountHigh;
+#if (VER_PRODUCTBUILD >= 2195)
+ LIST_ENTRY ThreadListEntry;
+#endif // (VER_PRODUCTBUILD >= 2195)
+} ETHREAD, *PETHREAD;
+
+#endif
+
+typedef struct _EPROCESS_QUOTA_ENTRY {
+ ULONG Usage;
+ ULONG Limit;
+ ULONG Peak;
+ ULONG Return;
+} EPROCESS_QUOTA_ENTRY, *PEPROCESS_QUOTA_ENTRY;
+
+typedef struct _EPROCESS_QUOTA_BLOCK {
+ EPROCESS_QUOTA_ENTRY QuotaEntry[3];
+ LIST_ENTRY QuotaList;
+ ULONG ReferenceCount;
+ ULONG ProcessCount;
+} EPROCESS_QUOTA_BLOCK, *PEPROCESS_QUOTA_BLOCK;
+
+typedef struct _EXCEPTION_REGISTRATION_RECORD {
+ struct _EXCEPTION_REGISTRATION_RECORD *Next;
+ PVOID Handler;
+} EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
+
+/*
+ * When needing these parameters cast your PIO_STACK_LOCATION to
+ * PEXTENDED_IO_STACK_LOCATION
+ */
+#if !defined(_ALPHA_) && !defined(_AMD64_) && !defined(_IA64_)
+#include <pshpack4.h>
+#endif
+typedef struct _EXTENDED_IO_STACK_LOCATION {
+
+ /* Included for padding */
+ UCHAR MajorFunction;
+ UCHAR MinorFunction;
+ UCHAR Flags;
+ UCHAR Control;
+
+ union {
+
+ struct {
+ PIO_SECURITY_CONTEXT SecurityContext;
+ ULONG Options;
+ USHORT Reserved;
+ USHORT ShareAccess;
+ PMAILSLOT_CREATE_PARAMETERS Parameters;
+ } CreateMailslot;
+
+ struct {
+ PIO_SECURITY_CONTEXT SecurityContext;
+ ULONG Options;
+ USHORT Reserved;
+ USHORT ShareAccess;
+ PNAMED_PIPE_CREATE_PARAMETERS Parameters;
+ } CreatePipe;
+
+ struct {
+ ULONG OutputBufferLength;
+ ULONG InputBufferLength;
+ ULONG FsControlCode;
+ PVOID Type3InputBuffer;
+ } FileSystemControl;
+
+ struct {
+ PLARGE_INTEGER Length;
+ ULONG Key;
+ LARGE_INTEGER ByteOffset;
+ } LockControl;
+
+ struct {
+ ULONG Length;
+ ULONG CompletionFilter;
+ } NotifyDirectory;
+
+ struct {
+ ULONG Length;
+ PUNICODE_STRING FileName;
+ FILE_INFORMATION_CLASS FileInformationClass;
+ ULONG FileIndex;
+ } QueryDirectory;
+
+ struct {
+ ULONG Length;
+ PVOID EaList;
+ ULONG EaListLength;
+ ULONG EaIndex;
+ } QueryEa;
+
+ struct {
+ ULONG Length;
+ PSID StartSid;
+ PFILE_GET_QUOTA_INFORMATION SidList;
+ ULONG SidListLength;
+ } QueryQuota;
+
+ struct {
+ ULONG Length;
+ } SetEa;
+
+ struct {
+ ULONG Length;
+ } SetQuota;
+
+ struct {
+ ULONG Length;
+ FS_INFORMATION_CLASS FsInformationClass;
+ } SetVolume;
+
+ } Parameters;
+
+} EXTENDED_IO_STACK_LOCATION, *PEXTENDED_IO_STACK_LOCATION;
+#if !defined(_ALPHA_) && !defined(_AMD64_) && !defined(_IA64_)
+#include <poppack.h>
+#endif
+
+typedef struct _FILE_ACCESS_INFORMATION {
+ ACCESS_MASK AccessFlags;
+} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
+
+typedef struct _FILE_ALLOCATION_INFORMATION {
+ LARGE_INTEGER AllocationSize;
+} FILE_ALLOCATION_INFORMATION, *PFILE_ALLOCATION_INFORMATION;
+
+typedef struct _FILE_BOTH_DIR_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ CCHAR ShortNameLength;
+ WCHAR ShortName[12];
+ WCHAR FileName[1];
+} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
+
+typedef struct _FILE_COMPLETION_INFORMATION {
+ HANDLE Port;
+ ULONG Key;
+} FILE_COMPLETION_INFORMATION, *PFILE_COMPLETION_INFORMATION;
+
+typedef struct _FILE_COMPRESSION_INFORMATION {
+ LARGE_INTEGER CompressedFileSize;
+ USHORT CompressionFormat;
+ UCHAR CompressionUnitShift;
+ UCHAR ChunkShift;
+ UCHAR ClusterShift;
+ UCHAR Reserved[3];
+} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
+
+typedef struct _FILE_COPY_ON_WRITE_INFORMATION {
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_COPY_ON_WRITE_INFORMATION, *PFILE_COPY_ON_WRITE_INFORMATION;
+
+typedef struct _FILE_DIRECTORY_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
+
+typedef struct _FILE_EA_INFORMATION {
+ ULONG EaSize;
+} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
+
+typedef struct _FILE_FS_ATTRIBUTE_INFORMATION {
+ ULONG FileSystemAttributes;
+ ULONG MaximumComponentNameLength;
+ ULONG FileSystemNameLength;
+ WCHAR FileSystemName[1];
+} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
+
+typedef struct _FILE_FS_CONTROL_INFORMATION {
+ LARGE_INTEGER FreeSpaceStartFiltering;
+ LARGE_INTEGER FreeSpaceThreshold;
+ LARGE_INTEGER FreeSpaceStopFiltering;
+ LARGE_INTEGER DefaultQuotaThreshold;
+ LARGE_INTEGER DefaultQuotaLimit;
+ ULONG FileSystemControlFlags;
+} FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION;
+
+typedef struct _FILE_FS_FULL_SIZE_INFORMATION {
+ LARGE_INTEGER TotalAllocationUnits;
+ LARGE_INTEGER CallerAvailableAllocationUnits;
+ LARGE_INTEGER ActualAvailableAllocationUnits;
+ ULONG SectorsPerAllocationUnit;
+ ULONG BytesPerSector;
+} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
+
+typedef struct _FILE_FS_LABEL_INFORMATION {
+ ULONG VolumeLabelLength;
+ WCHAR VolumeLabel[1];
+} FILE_FS_LABEL_INFORMATION, *PFILE_FS_LABEL_INFORMATION;
+
+#if (VER_PRODUCTBUILD >= 2195)
+
+typedef struct _FILE_FS_OBJECT_ID_INFORMATION {
+ UCHAR ObjectId[16];
+ UCHAR ExtendedInfo[48];
+} FILE_FS_OBJECT_ID_INFORMATION, *PFILE_FS_OBJECT_ID_INFORMATION;
+
+#endif // (VER_PRODUCTBUILD >= 2195)
+
+typedef struct _FILE_FS_SIZE_INFORMATION {
+ LARGE_INTEGER TotalAllocationUnits;
+ LARGE_INTEGER AvailableAllocationUnits;
+ ULONG SectorsPerAllocationUnit;
+ ULONG BytesPerSector;
+} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
+
+typedef struct _FILE_FS_VOLUME_INFORMATION {
+ LARGE_INTEGER VolumeCreationTime;
+ ULONG VolumeSerialNumber;
+ ULONG VolumeLabelLength;
+ BOOLEAN SupportsObjects;
+ WCHAR VolumeLabel[1];
+} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
+
+typedef struct _FILE_FULL_DIR_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ WCHAR FileName[1];
+} FILE_FULL_DIR_INFORMATION, *PFILE_FULL_DIR_INFORMATION;
+
+typedef struct _FILE_GET_EA_INFORMATION {
+ ULONG NextEntryOffset;
+ UCHAR EaNameLength;
+ CHAR EaName[1];
+} FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
+
+typedef struct _FILE_GET_QUOTA_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG SidLength;
+ SID Sid;
+} FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION;
+
+typedef struct _FILE_ID_BOTH_DIR_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ CCHAR ShortNameLength;
+ WCHAR ShortName[12];
+ LARGE_INTEGER FileId;
+ WCHAR FileName[1];
+} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION;
+
+typedef struct _FILE_ID_FULL_DIR_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ ULONG EaSize;
+ LARGE_INTEGER FileId;
+ WCHAR FileName[1];
+} FILE_ID_FULL_DIR_INFORMATION, *PFILE_ID_FULL_DIR_INFORMATION;
+
+typedef struct _FILE_INTERNAL_INFORMATION {
+ LARGE_INTEGER IndexNumber;
+} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
+
+typedef struct _FILE_LINK_INFORMATION {
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
+
+typedef struct _FILE_LOCK_INFO {
+ LARGE_INTEGER StartingByte;
+ LARGE_INTEGER Length;
+ BOOLEAN ExclusiveLock;
+ ULONG Key;
+ PFILE_OBJECT FileObject;
+ PEPROCESS Process;
+ LARGE_INTEGER EndingByte;
+} FILE_LOCK_INFO, *PFILE_LOCK_INFO;
+
+// raw internal file lock struct returned from FsRtlGetNextFileLock
+typedef struct _FILE_SHARED_LOCK_ENTRY {
+ PVOID Unknown1;
+ PVOID Unknown2;
+ FILE_LOCK_INFO FileLock;
+} FILE_SHARED_LOCK_ENTRY, *PFILE_SHARED_LOCK_ENTRY;
+
+// raw internal file lock struct returned from FsRtlGetNextFileLock
+typedef struct _FILE_EXCLUSIVE_LOCK_ENTRY {
+ LIST_ENTRY ListEntry;
+ PVOID Unknown1;
+ PVOID Unknown2;
+ FILE_LOCK_INFO FileLock;
+} FILE_EXCLUSIVE_LOCK_ENTRY, *PFILE_EXCLUSIVE_LOCK_ENTRY;
+
+typedef NTSTATUS (*PCOMPLETE_LOCK_IRP_ROUTINE) (
+ IN PVOID Context,
+ IN PIRP Irp
+);
+
+typedef VOID (*PUNLOCK_ROUTINE) (
+ IN PVOID Context,
+ IN PFILE_LOCK_INFO FileLockInfo
+);
+
+typedef struct _FILE_LOCK {
+ PCOMPLETE_LOCK_IRP_ROUTINE CompleteLockIrpRoutine;
+ PUNLOCK_ROUTINE UnlockRoutine;
+ BOOLEAN FastIoIsQuestionable;
+ BOOLEAN Pad[3];
+ PVOID LockInformation;
+ FILE_LOCK_INFO LastReturnedLockInfo;
+ PVOID LastReturnedLock;
+} FILE_LOCK, *PFILE_LOCK;
+
+typedef struct _FILE_MAILSLOT_PEEK_BUFFER {
+ ULONG ReadDataAvailable;
+ ULONG NumberOfMessages;
+ ULONG MessageLength;
+} FILE_MAILSLOT_PEEK_BUFFER, *PFILE_MAILSLOT_PEEK_BUFFER;
+
+typedef struct _FILE_MAILSLOT_QUERY_INFORMATION {
+ ULONG MaximumMessageSize;
+ ULONG MailslotQuota;
+ ULONG NextMessageSize;
+ ULONG MessagesAvailable;
+ LARGE_INTEGER ReadTimeout;
+} FILE_MAILSLOT_QUERY_INFORMATION, *PFILE_MAILSLOT_QUERY_INFORMATION;
+
+typedef struct _FILE_MAILSLOT_SET_INFORMATION {
+ PLARGE_INTEGER ReadTimeout;
+} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
+
+typedef struct _FILE_MODE_INFORMATION {
+ ULONG Mode;
+} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
+
+// This structure is included in the Windows 2000 DDK but is missing in the
+// Windows NT 4.0 DDK
+#if (VER_PRODUCTBUILD < 2195)
+typedef struct _FILE_NAME_INFORMATION {
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
+#endif // (VER_PRODUCTBUILD < 2195)
+
+typedef struct _FILE_ALL_INFORMATION {
+ FILE_BASIC_INFORMATION BasicInformation;
+ FILE_STANDARD_INFORMATION StandardInformation;
+ FILE_INTERNAL_INFORMATION InternalInformation;
+ FILE_EA_INFORMATION EaInformation;
+ FILE_ACCESS_INFORMATION AccessInformation;
+ FILE_POSITION_INFORMATION PositionInformation;
+ FILE_MODE_INFORMATION ModeInformation;
+ FILE_ALIGNMENT_INFORMATION AlignmentInformation;
+ FILE_NAME_INFORMATION NameInformation;
+} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
+
+typedef struct _FILE_NAMES_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
+
+typedef struct _FILE_NOTIFY_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG Action;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
+
+typedef struct _FILE_OBJECTID_INFORMATION {
+ LONGLONG FileReference;
+ UCHAR ObjectId[16];
+ union {
+ struct {
+ UCHAR BirthVolumeId[16];
+ UCHAR BirthObjectId[16];
+ UCHAR DomainId[16];
+ } ;
+ UCHAR ExtendedInfo[48];
+ };
+} FILE_OBJECTID_INFORMATION, *PFILE_OBJECTID_INFORMATION;
+
+typedef struct _FILE_OLE_CLASSID_INFORMATION {
+ GUID ClassId;
+} FILE_OLE_CLASSID_INFORMATION, *PFILE_OLE_CLASSID_INFORMATION;
+
+typedef struct _FILE_OLE_ALL_INFORMATION {
+ FILE_BASIC_INFORMATION BasicInformation;
+ FILE_STANDARD_INFORMATION StandardInformation;
+ FILE_INTERNAL_INFORMATION InternalInformation;
+ FILE_EA_INFORMATION EaInformation;
+ FILE_ACCESS_INFORMATION AccessInformation;
+ FILE_POSITION_INFORMATION PositionInformation;
+ FILE_MODE_INFORMATION ModeInformation;
+ FILE_ALIGNMENT_INFORMATION AlignmentInformation;
+ USN LastChangeUsn;
+ USN ReplicationUsn;
+ LARGE_INTEGER SecurityChangeTime;
+ FILE_OLE_CLASSID_INFORMATION OleClassIdInformation;
+ FILE_OBJECTID_INFORMATION ObjectIdInformation;
+ FILE_STORAGE_TYPE StorageType;
+ ULONG OleStateBits;
+ ULONG OleId;
+ ULONG NumberOfStreamReferences;
+ ULONG StreamIndex;
+ ULONG SecurityId;
+ BOOLEAN ContentIndexDisable;
+ BOOLEAN InheritContentIndexDisable;
+ FILE_NAME_INFORMATION NameInformation;
+} FILE_OLE_ALL_INFORMATION, *PFILE_OLE_ALL_INFORMATION;
+
+typedef struct _FILE_OLE_DIR_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG FileIndex;
+ LARGE_INTEGER CreationTime;
+ LARGE_INTEGER LastAccessTime;
+ LARGE_INTEGER LastWriteTime;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER EndOfFile;
+ LARGE_INTEGER AllocationSize;
+ ULONG FileAttributes;
+ ULONG FileNameLength;
+ FILE_STORAGE_TYPE StorageType;
+ GUID OleClassId;
+ ULONG OleStateBits;
+ BOOLEAN ContentIndexDisable;
+ BOOLEAN InheritContentIndexDisable;
+ WCHAR FileName[1];
+} FILE_OLE_DIR_INFORMATION, *PFILE_OLE_DIR_INFORMATION;
+
+typedef struct _FILE_OLE_INFORMATION {
+ LARGE_INTEGER SecurityChangeTime;
+ FILE_OLE_CLASSID_INFORMATION OleClassIdInformation;
+ FILE_OBJECTID_INFORMATION ObjectIdInformation;
+ FILE_STORAGE_TYPE StorageType;
+ ULONG OleStateBits;
+ BOOLEAN ContentIndexDisable;
+ BOOLEAN InheritContentIndexDisable;
+} FILE_OLE_INFORMATION, *PFILE_OLE_INFORMATION;
+
+typedef struct _FILE_OLE_STATE_BITS_INFORMATION {
+ ULONG StateBits;
+ ULONG StateBitsMask;
+} FILE_OLE_STATE_BITS_INFORMATION, *PFILE_OLE_STATE_BITS_INFORMATION;
+
+typedef struct _FILE_PIPE_ASSIGN_EVENT_BUFFER {
+ HANDLE EventHandle;
+ ULONG KeyValue;
+} FILE_PIPE_ASSIGN_EVENT_BUFFER, *PFILE_PIPE_ASSIGN_EVENT_BUFFER;
+
+typedef struct _FILE_PIPE_CLIENT_PROCESS_BUFFER {
+ PVOID ClientSession;
+ PVOID ClientProcess;
+} FILE_PIPE_CLIENT_PROCESS_BUFFER, *PFILE_PIPE_CLIENT_PROCESS_BUFFER;
+
+typedef struct _FILE_PIPE_EVENT_BUFFER {
+ ULONG NamedPipeState;
+ ULONG EntryType;
+ ULONG ByteCount;
+ ULONG KeyValue;
+ ULONG NumberRequests;
+} FILE_PIPE_EVENT_BUFFER, *PFILE_PIPE_EVENT_BUFFER;
+
+typedef struct _FILE_PIPE_INFORMATION {
+ ULONG ReadMode;
+ ULONG CompletionMode;
+} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
+
+typedef struct _FILE_PIPE_LOCAL_INFORMATION {
+ ULONG NamedPipeType;
+ ULONG NamedPipeConfiguration;
+ ULONG MaximumInstances;
+ ULONG CurrentInstances;
+ ULONG InboundQuota;
+ ULONG ReadDataAvailable;
+ ULONG OutboundQuota;
+ ULONG WriteQuotaAvailable;
+ ULONG NamedPipeState;
+ ULONG NamedPipeEnd;
+} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
+
+typedef struct _FILE_PIPE_PEEK_BUFFER {
+ ULONG NamedPipeState;
+ ULONG ReadDataAvailable;
+ ULONG NumberOfMessages;
+ ULONG MessageLength;
+ CHAR Data[1];
+} FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER;
+
+typedef struct _FILE_PIPE_REMOTE_INFORMATION {
+ LARGE_INTEGER CollectDataTime;
+ ULONG MaximumCollectionCount;
+} FILE_PIPE_REMOTE_INFORMATION, *PFILE_PIPE_REMOTE_INFORMATION;
+
+typedef struct _FILE_PIPE_WAIT_FOR_BUFFER {
+ LARGE_INTEGER Timeout;
+ ULONG NameLength;
+ BOOLEAN TimeoutSpecified;
+ WCHAR Name[1];
+} FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER;
+
+typedef struct _FILE_QUOTA_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG SidLength;
+ LARGE_INTEGER ChangeTime;
+ LARGE_INTEGER QuotaUsed;
+ LARGE_INTEGER QuotaThreshold;
+ LARGE_INTEGER QuotaLimit;
+ SID Sid;
+} FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
+
+typedef struct _FILE_RENAME_INFORMATION {
+ BOOLEAN ReplaceIfExists;
+ HANDLE RootDirectory;
+ ULONG FileNameLength;
+ WCHAR FileName[1];
+} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
+
+typedef struct _FILE_STREAM_INFORMATION {
+ ULONG NextEntryOffset;
+ ULONG StreamNameLength;
+ LARGE_INTEGER StreamSize;
+ LARGE_INTEGER StreamAllocationSize;
+ WCHAR StreamName[1];
+} FILE_STREAM_INFORMATION, *PFILE_STREAM_INFORMATION;
+
+typedef struct _FILE_TRACKING_INFORMATION {
+ HANDLE DestinationFile;
+ ULONG ObjectInformationLength;
+ CHAR ObjectInformation[1];
+} FILE_TRACKING_INFORMATION, *PFILE_TRACKING_INFORMATION;
+
+typedef struct _FSRTL_COMMON_FCB_HEADER {
+ CSHORT NodeTypeCode;
+ CSHORT NodeByteSize;
+ UCHAR Flags;
+ UCHAR IsFastIoPossible;
+#if (VER_PRODUCTBUILD >= 1381)
+ UCHAR Flags2;
+ UCHAR Reserved : 4;
+ UCHAR Version : 4;
+#endif // (VER_PRODUCTBUILD >= 1381)
+ PERESOURCE Resource;
+ PERESOURCE PagingIoResource;
+ LARGE_INTEGER AllocationSize;
+ LARGE_INTEGER FileSize;
+ LARGE_INTEGER ValidDataLength;
+} FSRTL_COMMON_FCB_HEADER, *PFSRTL_COMMON_FCB_HEADER;
+
+#if (VER_PRODUCTBUILD >= 2600)
+
+#ifdef __cplusplus
+typedef struct _FSRTL_ADVANCED_FCB_HEADER:FSRTL_COMMON_FCB_HEADER {
+#else // __cplusplus
+typedef struct _FSRTL_ADVANCED_FCB_HEADER {
+ FSRTL_COMMON_FCB_HEADER;
+#endif // __cplusplus
+ PFAST_MUTEX FastMutex;
+ LIST_ENTRY FilterContexts;
+ EX_PUSH_LOCK PushLock;
+ PVOID *FileContextSupportPointer;
+} FSRTL_ADVANCED_FCB_HEADER, *PFSRTL_ADVANCED_FCB_HEADER;
+
+#endif // (VER_PRODUCTBUILD >= 2600)
+
+typedef struct _GENERATE_NAME_CONTEXT {
+ USHORT Checksum;
+ BOOLEAN CheckSumInserted;
+ UCHAR NameLength;
+ WCHAR NameBuffer[8];
+ ULONG ExtensionLength;
+ WCHAR ExtensionBuffer[4];
+ ULONG LastIndexValue;
+} GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
+
+typedef struct _HANDLE_INFO { // Information about open handles
+ union {
+ PEPROCESS Process; // Pointer to PEPROCESS owning the Handle
+ ULONG Count; // Count of HANDLE_INFO structures following this structure
+ } HandleInfo;
+ USHORT HandleCount;
+} HANDLE_INFO, *PHANDLE_INFO;
+
+typedef struct _HANDLE_TABLE_ENTRY_INFO {
+ ULONG AuditMask;
+} HANDLE_TABLE_ENTRY_INFO, *PHANDLE_TABLE_ENTRY_INFO;
+
+typedef struct _HANDLE_TABLE_ENTRY {
+ union {
+ PVOID Object;
+ &