ReactOS  0.4.13-dev-235-g7373cb3
ffsdrv.h File Reference
#include "fs.h"
#include "dinode.h"
#include "dir.h"
#include "disklabel.h"
#include <ntdddisk.h>
Include dependency graph for ffsdrv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _FFS_IDENTIFIER
 
struct  _FFS_REPINNED_BCBS
 
struct  _FFS_BSD_PARTITION
 
struct  _FFS_GLOBAL
 
struct  FFS_EXT
 
struct  _FFS_FCBVCB
 
struct  _FFS_VCB
 
struct  _FFS_FCB
 
struct  _FFS_MCB
 
struct  _FFS_CCB
 
struct  _FFS_IRP_CONTEXT
 
struct  _FFS_ALLOC_HEADER
 
struct  _FCB_LIST_ENTRY
 
struct  _FFS_BDL
 

Macros

#define __drv_mustHoldCriticalRegion
 
#define FFSBreakPoint()
 
#define FFSDRV_VERSION   "0.5.2"
 
#define FFS_READ_ONLY   TRUE
 
#define FFS_UNLOAD   TRUE
 
#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)
 
#define DRIVER_NAME   "FFS"
 
#define DEVICE_NAME   L"\\FileSystem\\FFS"
 
#define PARAMETERS_KEY   L"\\Parameters"
 
#define WRITING_SUPPORT   L"WritingSupport"
 
#define CHECKING_BITMAP   L"CheckingBitmap"
 
#define PARTITION_NUMBER   L"PartitionNumber"
 
#define DOS_DEVICE_NAME   L"\\DosDevices\\ffs"
 
#define IOCTL_SELECT_BSD_PARTITION   CTL_CODE(FILE_DEVICE_UNKNOWN, 2049, METHOD_BUFFERED, FILE_WRITE_ACCESS)
 
#define SetFlag(x, f)   ((x) |= (f))
 
#define ClearFlag(x, f)   ((x) &= ~(f))
 
#define IsFlagOn(a, b)   ((BOOLEAN)(FlagOn(a,b) == b))
 
#define FFSRaiseStatus(IRPCONTEXT, STATUS)
 
#define FFSNormalizeAndRaiseStatus(IRPCONTEXT, STATUS)
 
#define FILE_WRITE_TO_END_OF_FILE   0xffffffff
 
#define FILE_USE_FILE_POINTER_POSITION   0xfffffffe
 
#define IsEndOfFile(Pos)
 
#define IsDirectory(Fcb)   IsFlagOn(Fcb->FFSMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)
 
#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 ); }
 
#define FFS_NAME_LEN   255
 
#define FFS_ROOT_INO   2 /* Root inode */
 
#define FFS_DIR_PAD   4
 
#define FFS_DIR_ROUND   (FFS_DIR_PAD - 1)
 
#define FFS_DIR_REC_LEN(name_len)
 
#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)
 
#define NodeType(Ptr)   (*((FFS_IDENTIFIER_TYPE *)(Ptr)))
 
#define FFS_REPINNED_BCBS_ARRAY_SIZE   (8)
 
#define FFS_UNLOAD_PENDING   0x00000001
 
#define FFS_SUPPORT_WRITING   0x00000002
 
#define FFS_CHECKING_BITMAP   0x00000008
 
#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))
 
#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
 
#define MCB_FROM_POOL   0x00000001
 
#define MCB_IN_TREE   0x00000002
 
#define MCB_IN_USE   0x00000004
 
#define IsMcbUsed(Mcb)   IsFlagOn(Mcb->Flags, MCB_IN_USE)
 
#define CCB_FROM_POOL   0x00000001
 
#define CCB_ALLOW_EXTENDED_DASD_IO   0x80000000
 
#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)
 
#define CanFFSWait(IRP)   IoIsOperationSynchronous(Irp)
 
#define FFS_POOL_TAG   'dsfF'
 
#define DBG_VITAL   0
 
#define DBG_ERROR   1
 
#define DBG_USER   2
 
#define DBG_TRACE   3
 
#define DBG_INFO   4
 
#define DBG_FUNC   5
 
#define FFSPrint(arg)
 
#define FFSCompleteRequest(Irp, bPrint, PriorityBoost)   IoCompleteRequest(Irp, PriorityBoost)
 
#define FFSGetCurrentProcessName()
 

Typedefs

typedef struct fs FFS_SUPER_BLOCK
 
typedef struct fsPFFS_SUPER_BLOCK
 
typedef struct disklabel DISKLABEL
 
typedef struct disklabelPDISKLABEL
 
typedef struct ufs1_dinode FFSv1_INODE
 
typedef struct ufs1_dinodePFFSv1_INODE
 
typedef struct ufs2_dinode FFSv2_INODE
 
typedef struct ufs2_dinodePFFSv2_INODE
 
typedef struct direct FFS_DIR_ENTRY
 
typedef struct directPFFS_DIR_ENTRY
 
typedef enum _FFS_IDENTIFIER_TYPE FFS_IDENTIFIER_TYPE
 
typedef struct _FFS_IDENTIFIER FFS_IDENTIFIER
 
typedef struct _FFS_IDENTIFIERPFFS_IDENTIFIER
 
typedef struct _FFS_MCB FFS_MCB
 
typedef struct _FFS_MCBPFFS_MCB
 
typedef PVOID PBCB
 
typedef struct _FFS_REPINNED_BCBS FFS_REPINNED_BCBS
 
typedef struct _FFS_REPINNED_BCBSPFFS_REPINNED_BCBS
 
typedef struct _FFS_BSD_PARTITION FFS_BSD_PARTITION
 
typedef struct _FFS_BSD_PARTITIONPFFS_BSD_PARTITION
 
typedef struct _FFS_GLOBAL FFS_GLOBAL
 
typedef struct _FFS_GLOBALPFFS_GLOBAL
 
typedef struct FFS_EXTPFFS_EXT
 
typedef struct _FFS_FCBVCB FFS_FCBVCB
 
typedef struct _FFS_FCBVCBPFFS_FCBVCB
 
typedef struct _FFS_VCB FFS_VCB
 
typedef struct _FFS_VCBPFFS_VCB
 
typedef struct _FFS_FCB FFS_FCB
 
typedef struct _FFS_FCBPFFS_FCB
 
typedef struct _FFS_CCB FFS_CCB
 
typedef struct _FFS_CCBPFFS_CCB
 
typedef struct _FFS_IRP_CONTEXT FFS_IRP_CONTEXT
 
typedef struct _FFS_IRP_CONTEXTPFFS_IRP_CONTEXT
 
typedef struct _FFS_ALLOC_HEADER FFS_ALLOC_HEADER
 
typedef struct _FFS_ALLOC_HEADERPFFS_ALLOC_HEADER
 
typedef struct _FCB_LIST_ENTRY FCB_LIST_ENTRY
 
typedef struct _FCB_LIST_ENTRYPFCB_LIST_ENTRY
 
typedef struct _FFS_BDL FFS_BDL
 
typedef struct _FFS_BDLPFFS_BDL
 

Enumerations

enum  _FFS_IDENTIFIER_TYPE {
  FFSFGD = ':DGF', FFSVCB = ':BCV', FFSFCB = ':BCF', FFSCCB = ':BCC',
  FFSICX = ':XCI', FFSDRV = ':VRD', FFSMCB = ':BCM'
}
 

Functions

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)
 
__drv_mustHoldCriticalRegion NTSTATUS FFSCleanup (IN PFFS_IRP_CONTEXT IrpContext)
 
__drv_mustHoldCriticalRegion NTSTATUS FFSClose (IN PFFS_IRP_CONTEXT IrpContext)
 
VOID FFSQueueCloseRequest (IN PFFS_IRP_CONTEXT IrpContext)
 
VOID NTAPI FFSDeQueueCloseRequest (IN PVOID Context)
 
__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)
 
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)
 
VOID __cdecl FFSPrintf (LONG DebugPrintLevel, PCHAR DebugMessage,...)
 
VOID __cdecl FFSNIPrintf (LONG DebugPrintLevel, PCHAR DebugMessage,...)
 
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)
 
__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)
 
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)
 
NTSTATUS FFSQueueRequest (IN PFFS_IRP_CONTEXT IrpContext)
 
VOID NTAPI FFSDeQueueRequest (IN PVOID Context)
 
NTSTATUS FFSDispatchRequest (IN PFFS_IRP_CONTEXT IrpContext)
 
NTSTATUS NTAPI FFSBuildRequest (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS FFSExceptionFilter (IN PFFS_IRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
 
NTSTATUS FFSExceptionHandler (IN PFFS_IRP_CONTEXT IrpContext)
 
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)
 
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)
 
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)
 
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)
 
__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)
 
__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)
 
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)
 
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)
 
BOOLEAN NTAPI FFSFastIoUnlockAll (IN PFILE_OBJECT FileObject, IN PEPROCESS Process, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI FFSFastIoUnlockAllByKey (IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN ULONG Key, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
__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)
 
__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)
 
__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)
 
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)
 
BOOLEAN FFSQueryParameters (IN PUNICODE_STRING RegistryPath)
 
VOID NTAPI DriverUnload (IN PDRIVER_OBJECT DriverObject)
 
__drv_mustHoldCriticalRegion NTSTATUS FFSLockControl (IN PFFS_IRP_CONTEXT IrpContext)
 
__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)
 
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)
 
__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)
 
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)
 
__drv_mustHoldCriticalRegion NTSTATUS FFSShutDown (IN PFFS_IRP_CONTEXT IrpContext)
 
__drv_mustHoldCriticalRegion NTSTATUS FFSQueryVolumeInformation (IN PFFS_IRP_CONTEXT IrpContext)
 
__drv_mustHoldCriticalRegion NTSTATUS FFSSetVolumeInformation (IN PFFS_IRP_CONTEXT IrpContext)
 
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)
 

Variables

ULONG ProcessNameOffset
 

Macro Definition Documentation

◆ __drv_mustHoldCriticalRegion

#define __drv_mustHoldCriticalRegion

Definition at line 34 of file ffsdrv.h.

◆ BLOCK_BITS

#define BLOCK_BITS   FFSLog2(Vcb->BlockSize)

Definition at line 84 of file ffsdrv.h.

◆ BLOCK_SIZE

#define BLOCK_SIZE   (Vcb->BlockSize)

Definition at line 83 of file ffsdrv.h.

◆ BLOCKS_PER_GROUP

#define BLOCKS_PER_GROUP   (SUPER_BLOCK->fs_fpg)

Definition at line 89 of file ffsdrv.h.

◆ CanFFSWait

#define CanFFSWait (   IRP)    IoIsOperationSynchronous(Irp)

Definition at line 815 of file ffsdrv.h.

◆ CCB_ALLOW_EXTENDED_DASD_IO

#define CCB_ALLOW_EXTENDED_DASD_IO   0x80000000

Definition at line 711 of file ffsdrv.h.

◆ CCB_FROM_POOL

#define CCB_FROM_POOL   0x00000001

Definition at line 709 of file ffsdrv.h.

◆ CHECKING_BITMAP

#define CHECKING_BITMAP   L"CheckingBitmap"

Definition at line 108 of file ffsdrv.h.

◆ ClearFlag

#define ClearFlag (   x,
  f 
)    ((x) &= ~(f))

Definition at line 134 of file ffsdrv.h.

◆ DBG_ERROR

#define DBG_ERROR   1

Definition at line 1031 of file ffsdrv.h.

◆ DBG_FUNC

#define DBG_FUNC   5

Definition at line 1035 of file ffsdrv.h.

◆ DBG_INFO

#define DBG_INFO   4

Definition at line 1034 of file ffsdrv.h.

◆ DBG_TRACE

#define DBG_TRACE   3

Definition at line 1033 of file ffsdrv.h.

◆ DBG_USER

#define DBG_USER   2

Definition at line 1032 of file ffsdrv.h.

◆ DBG_VITAL

#define DBG_VITAL   0

Definition at line 1030 of file ffsdrv.h.

◆ DEFAULT_SECTOR_SIZE

#define DEFAULT_SECTOR_SIZE   (0x200)

Definition at line 73 of file ffsdrv.h.

◆ DEVICE_NAME

#define DEVICE_NAME   L"\\FileSystem\\FFS"

Definition at line 98 of file ffsdrv.h.

◆ DOS_DEVICE_NAME

#define DOS_DEVICE_NAME   L"\\DosDevices\\ffs"

Definition at line 112 of file ffsdrv.h.

◆ DRIVER_NAME

#define DRIVER_NAME   "FFS"

Definition at line 96 of file ffsdrv.h.

◆ FCB_DELETE_ON_CLOSE

#define FCB_DELETE_ON_CLOSE   0x00000004

Definition at line 633 of file ffsdrv.h.

◆ FCB_DELETE_PENDING

#define FCB_DELETE_PENDING   0x00000008

Definition at line 634 of file ffsdrv.h.

◆ FCB_FILE_DELETED

#define FCB_FILE_DELETED   0x00000010

Definition at line 635 of file ffsdrv.h.

◆ FCB_FILE_MODIFIED

#define FCB_FILE_MODIFIED   0x00000020

Definition at line 636 of file ffsdrv.h.

◆ FCB_FROM_POOL

#define FCB_FROM_POOL   0x00000001

Definition at line 631 of file ffsdrv.h.

◆ FCB_PAGE_FILE

#define FCB_PAGE_FILE   0x00000002

Definition at line 632 of file ffsdrv.h.

◆ FFS_BLOCK_TYPES

#define FFS_BLOCK_TYPES   (0x04)

Definition at line 67 of file ffsdrv.h.

◆ FFS_BUGCHK_BLOCK

#define FFS_BUGCHK_BLOCK   (0x00010000)

Definition at line 168 of file ffsdrv.h.

◆ FFS_BUGCHK_CLEANUP

#define FFS_BUGCHK_CLEANUP   (0x00020000)

Definition at line 169 of file ffsdrv.h.

◆ FFS_BUGCHK_CLOSE

#define FFS_BUGCHK_CLOSE   (0x00030000)

Definition at line 170 of file ffsdrv.h.

◆ FFS_BUGCHK_CMCB

#define FFS_BUGCHK_CMCB   (0x00040000)

Definition at line 171 of file ffsdrv.h.

◆ FFS_BUGCHK_CREATE

#define FFS_BUGCHK_CREATE   (0x00050000)

Definition at line 172 of file ffsdrv.h.

◆ FFS_BUGCHK_DEBUG

#define FFS_BUGCHK_DEBUG   (0x00060000)

Definition at line 173 of file ffsdrv.h.

◆ FFS_BUGCHK_DEVCTL

#define FFS_BUGCHK_DEVCTL   (0x00070000)

Definition at line 174 of file ffsdrv.h.

◆ FFS_BUGCHK_DIRCTL

#define FFS_BUGCHK_DIRCTL   (0x00080000)

Definition at line 175 of file ffsdrv.h.

◆ FFS_BUGCHK_DISPATCH

#define FFS_BUGCHK_DISPATCH   (0x00090000)

Definition at line 176 of file ffsdrv.h.

◆ FFS_BUGCHK_EXCEPT

#define FFS_BUGCHK_EXCEPT   (0x000A0000)

Definition at line 177 of file ffsdrv.h.

◆ FFS_BUGCHK_FASTIO

#define FFS_BUGCHK_FASTIO   (0x000C0000)

Definition at line 179 of file ffsdrv.h.

◆ FFS_BUGCHK_FFS

#define FFS_BUGCHK_FFS   (0x000B0000)

Definition at line 178 of file ffsdrv.h.

◆ FFS_BUGCHK_FILEINFO

#define FFS_BUGCHK_FILEINFO   (0x000D0000)

Definition at line 180 of file ffsdrv.h.

◆ FFS_BUGCHK_FLUSH

#define FFS_BUGCHK_FLUSH   (0x000E0000)

Definition at line 181 of file ffsdrv.h.

◆ FFS_BUGCHK_FSCTL

#define FFS_BUGCHK_FSCTL   (0x000F0000)

Definition at line 182 of file ffsdrv.h.

◆ FFS_BUGCHK_INIT

#define FFS_BUGCHK_INIT   (0x00100000)

Definition at line 183 of file ffsdrv.h.

◆ FFS_BUGCHK_LAST

#define FFS_BUGCHK_LAST   (0x00170000)

Definition at line 192 of file ffsdrv.h.

◆ FFS_BUGCHK_LOCK

#define FFS_BUGCHK_LOCK   (0x0011000)

Definition at line 184 of file ffsdrv.h.

◆ FFS_BUGCHK_MEMORY

#define FFS_BUGCHK_MEMORY   (0x0012000)

Definition at line 185 of file ffsdrv.h.

◆ FFS_BUGCHK_MISC

#define FFS_BUGCHK_MISC   (0x0013000)

Definition at line 186 of file ffsdrv.h.

◆ FFS_BUGCHK_READ

#define FFS_BUGCHK_READ   (0x00140000)

Definition at line 187 of file ffsdrv.h.

◆ FFS_BUGCHK_SHUTDOWN

#define FFS_BUGCHK_SHUTDOWN   (0x00150000)

Definition at line 188 of file ffsdrv.h.

◆ FFS_BUGCHK_VOLINFO

#define FFS_BUGCHK_VOLINFO   (0x00160000)

Definition at line 189 of file ffsdrv.h.

◆ FFS_BUGCHK_WRITE

#define FFS_BUGCHK_WRITE   (0x00170000)

Definition at line 190 of file ffsdrv.h.

◆ FFS_CHECKING_BITMAP

#define FFS_CHECKING_BITMAP   0x00000008

Definition at line 406 of file ffsdrv.h.

◆ FFS_DIR_PAD

#define FFS_DIR_PAD   4

Definition at line 212 of file ffsdrv.h.

◆ FFS_DIR_REC_LEN

#define FFS_DIR_REC_LEN (   name_len)
Value:
(((name_len) + 8 + FFS_DIR_ROUND) & \
~FFS_DIR_ROUND)
#define FFS_DIR_ROUND
Definition: ffsdrv.h:213

Definition at line 214 of file ffsdrv.h.

◆ FFS_DIR_ROUND

#define FFS_DIR_ROUND   (FFS_DIR_PAD - 1)

Definition at line 213 of file ffsdrv.h.

◆ FFS_FILE_SYSTEM

#define FFS_FILE_SYSTEM   (FILE_SYSTEM)

Definition at line 166 of file ffsdrv.h.

◆ FFS_FIRST_DATA_BLOCK

#define FFS_FIRST_DATA_BLOCK   (Vcb->ffs_super_block->fs_dblkno)

Definition at line 256 of file ffsdrv.h.

◆ FFS_NAME_LEN

#define FFS_NAME_LEN   255

Definition at line 202 of file ffsdrv.h.

◆ FFS_POOL_TAG

#define FFS_POOL_TAG   'dsfF'

Definition at line 817 of file ffsdrv.h.

◆ FFS_READ_ONLY

#define FFS_READ_ONLY   TRUE

Definition at line 56 of file ffsdrv.h.

◆ FFS_REPINNED_BCBS_ARRAY_SIZE

#define FFS_REPINNED_BCBS_ARRAY_SIZE   (8)

Definition at line 310 of file ffsdrv.h.

◆ FFS_ROOT_INO

#define FFS_ROOT_INO   2 /* Root inode */

Definition at line 204 of file ffsdrv.h.

◆ FFS_SUPPORT_WRITING

#define FFS_SUPPORT_WRITING   0x00000002

Definition at line 405 of file ffsdrv.h.

◆ FFS_UNLOAD

#define FFS_UNLOAD   TRUE

Definition at line 61 of file ffsdrv.h.

◆ FFS_UNLOAD_PENDING

#define FFS_UNLOAD_PENDING   0x00000001

Definition at line 404 of file ffsdrv.h.

◆ FFSBreakPoint

#define FFSBreakPoint ( )

Definition at line 43 of file ffsdrv.h.

◆ FFSBugCheck

#define FFSBugCheck (   A,
  B,
  C,
  D 
)    { KeBugCheckEx(FFS_FILE_SYSTEM, A | __LINE__, B, C, D ); }

Definition at line 194 of file ffsdrv.h.

◆ FFSCompleteRequest

#define FFSCompleteRequest (   Irp,
  bPrint,
  PriorityBoost 
)    IoCompleteRequest(Irp, PriorityBoost)

Definition at line 1049 of file ffsdrv.h.

◆ FFSDRV_VERSION

#define FFSDRV_VERSION   "0.5.2"

Definition at line 48 of file ffsdrv.h.

◆ FFSGetCurrentProcessName

#define FFSGetCurrentProcessName ( )
Value:
( \
)
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define PCHAR
Definition: match.c:90
ULONG ProcessNameOffset

Definition at line 1070 of file ffsdrv.h.

◆ FFSIsReadOnly

#define FFSIsReadOnly (   m)    (!((m) & (S_IWUSR | S_IWGRP | S_IWOTH)))

Definition at line 254 of file ffsdrv.h.

◆ FFSNormalizeAndRaiseStatus

#define FFSNormalizeAndRaiseStatus (   IRPCONTEXT,
  STATUS 
)
Value:
{ \
/* (IRPCONTEXT)->ExceptionStatus = (STATUS); */ \
}
#define ExRaiseStatus
Definition: ntoskrnl.h:95
#define STATUS_VERIFY_REQUIRED
Definition: udferr_usr.h:130
#define STATUS
Definition: blue.h:128
#define STATUS_UNEXPECTED_IO_ERROR
Definition: ntstatus.h:455
NTSTATUS NTAPI FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize, IN NTSTATUS NormalizedNtStatus)
Definition: filter.c:90

Definition at line 144 of file ffsdrv.h.

◆ FFSPrint

#define FFSPrint (   arg)

Definition at line 1047 of file ffsdrv.h.

◆ FFSRaiseStatus

#define FFSRaiseStatus (   IRPCONTEXT,
  STATUS 
)
Value:
{ \
(IRPCONTEXT)->ExceptionCode = (STATUS); \
ExRaiseStatus( (STATUS) ); \
}
_Inout_ PIRP _In_ NTSTATUS ExceptionCode
Definition: cdprocs.h:1782
#define STATUS
Definition: blue.h:128

Definition at line 139 of file ffsdrv.h.

◆ FFSSetReadable

#define FFSSetReadable (   m)    (m) = ((m) | (S_IRUSR | S_IRGRP | S_IROTH))

Definition at line 250 of file ffsdrv.h.

◆ FFSSetReadOnly

#define FFSSetReadOnly (   m)    (m) = ((m) & (~(S_IWUSR | S_IWGRP | S_IWOTH)))

Definition at line 253 of file ffsdrv.h.

◆ FFSSetWritable

#define FFSSetWritable (   m)    (m) = ((m) | (S_IWUSR | S_IWGRP | S_IWOTH))

Definition at line 251 of file ffsdrv.h.

◆ FILE_USE_FILE_POINTER_POSITION

#define FILE_USE_FILE_POINTER_POSITION   0xfffffffe

Definition at line 155 of file ffsdrv.h.

◆ FILE_WRITE_TO_END_OF_FILE

#define FILE_WRITE_TO_END_OF_FILE   0xffffffff

Definition at line 154 of file ffsdrv.h.

◆ FS_VERSION

#define FS_VERSION   (Vcb->FSVersion)

Definition at line 81 of file ffsdrv.h.

◆ INODES_COUNT

#define INODES_COUNT   (Vcb->ffs_super_block->s_inodes_count)

Definition at line 86 of file ffsdrv.h.

◆ INODES_PER_GROUP

#define INODES_PER_GROUP   (SUPER_BLOCK->fs_ipg)

Definition at line 88 of file ffsdrv.h.

◆ IOCTL_SELECT_BSD_PARTITION

#define IOCTL_SELECT_BSD_PARTITION   CTL_CODE(FILE_DEVICE_UNKNOWN, 2049, METHOD_BUFFERED, FILE_WRITE_ACCESS)

Definition at line 125 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_DEFERRED

#define IRP_CONTEXT_FLAG_DEFERRED   (0x00000040)

Definition at line 773 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_DELAY_CLOSE

#define IRP_CONTEXT_FLAG_DELAY_CLOSE   (0x00000800)

Definition at line 778 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_DISABLE_POPUPS

#define IRP_CONTEXT_FLAG_DISABLE_POPUPS   (0x00000020)

Definition at line 772 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_FLOPPY

#define IRP_CONTEXT_FLAG_FLOPPY   (0x00000008)

Definition at line 770 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_FROM_POOL

#define IRP_CONTEXT_FLAG_FROM_POOL   (0x00000001)

Definition at line 767 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_RECURSIVE_CALL

#define IRP_CONTEXT_FLAG_RECURSIVE_CALL   (0x00000010)

Definition at line 771 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_REQUEUED

#define IRP_CONTEXT_FLAG_REQUEUED   (0x00000200)

Definition at line 776 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_USER_IO

#define IRP_CONTEXT_FLAG_USER_IO   (0x00000400)

Definition at line 777 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_VERIFY_READ

#define IRP_CONTEXT_FLAG_VERIFY_READ   (0x00000080)

Definition at line 774 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_WAIT

#define IRP_CONTEXT_FLAG_WAIT   (0x00000002)

Definition at line 768 of file ffsdrv.h.

◆ IRP_CONTEXT_FLAG_WRITE_THROUGH

#define IRP_CONTEXT_FLAG_WRITE_THROUGH   (0x00000004)

Definition at line 769 of file ffsdrv.h.

◆ IRP_CONTEXT_STACK_IO_CONTEXT

#define IRP_CONTEXT_STACK_IO_CONTEXT   (0x00000100)

Definition at line 775 of file ffsdrv.h.

◆ IsDirectory

#define IsDirectory (   Fcb)    IsFlagOn(Fcb->FFSMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)

Definition at line 160 of file ffsdrv.h.

◆ IsEndOfFile

#define IsEndOfFile (   Pos)
Value:
((Pos.LowPart == FILE_WRITE_TO_END_OF_FILE) && \
ush Pos
Definition: deflate.h:92
#define FILE_USE_FILE_POINTER_POSITION
Definition: ffsdrv.h:155
#define FILE_WRITE_TO_END_OF_FILE
Definition: ffsdrv.h:154

Definition at line 157 of file ffsdrv.h.

◆ IsFlagOn

#define IsFlagOn (   a,
  b 
)    ((BOOLEAN)(FlagOn(a,b) == b))

Definition at line 137 of file ffsdrv.h.

◆ IsMcbUsed

#define IsMcbUsed (   Mcb)    IsFlagOn(Mcb->Flags, MCB_IN_USE)

Definition at line 682 of file ffsdrv.h.

◆ IsMounted

#define IsMounted (   Vcb)    (IsFlagOn(Vcb->Flags, VCB_MOUNTED))

Definition at line 559 of file ffsdrv.h.

◆ MAXIMUM_RECORD_LENGTH

#define MAXIMUM_RECORD_LENGTH   (0x10000)

Definition at line 69 of file ffsdrv.h.

◆ MCB_FROM_POOL

#define MCB_FROM_POOL   0x00000001

Definition at line 678 of file ffsdrv.h.

◆ MCB_IN_TREE

#define MCB_IN_TREE   0x00000002

Definition at line 679 of file ffsdrv.h.

◆ MCB_IN_USE

#define MCB_IN_USE   0x00000004

Definition at line 680 of file ffsdrv.h.

◆ NodeType

#define NodeType (   Ptr)    (*((FFS_IDENTIFIER_TYPE *)(Ptr)))

Definition at line 299 of file ffsdrv.h.

◆ PARAMETERS_KEY

#define PARAMETERS_KEY   L"\\Parameters"

Definition at line 105 of file ffsdrv.h.

◆ PARTITION_NUMBER

#define PARTITION_NUMBER   L"PartitionNumber"

Definition at line 109 of file ffsdrv.h.

◆ READ_AHEAD_GRANULARITY

#define READ_AHEAD_GRANULARITY   (0x10000)

Definition at line 78 of file ffsdrv.h.

◆ S_IPERMISSION_MASK

#define S_IPERMISSION_MASK   0x1FF /* */

Definition at line 230 of file ffsdrv.h.

◆ S_IRGRP

#define S_IRGRP   0000040 /* R for group */

Definition at line 238 of file ffsdrv.h.

◆ S_IROTH

#define S_IROTH   0000004 /* R for other */

Definition at line 243 of file ffsdrv.h.

◆ S_IRUSR

#define S_IRUSR   0000400 /* R for owner */

Definition at line 233 of file ffsdrv.h.

◆ S_IRWXG

#define S_IRWXG   0000070 /* RWX mask for group */

Definition at line 237 of file ffsdrv.h.

◆ S_IRWXO

#define S_IRWXO   0000007 /* RWX mask for other */

Definition at line 242 of file ffsdrv.h.

◆ S_IRWXU

#define S_IRWXU   0000700 /* RWX mask for owner */

Definition at line 232 of file ffsdrv.h.

◆ S_ISBLK

#define S_ISBLK (   m)    ((m & _S_IFMT) == _S_IFBLK) /* block special */

Definition at line 222 of file ffsdrv.h.

◆ S_ISCHR

#define S_ISCHR (   m)    ((m & _S_IFMT) == _S_IFCHR) /* char special */

Definition at line 221 of file ffsdrv.h.

◆ S_ISDIR

#define S_ISDIR (   m)    ((m & _S_IFMT) == _S_IFDIR) /* directory */

Definition at line 220 of file ffsdrv.h.

◆ S_ISFIFO

#define S_ISFIFO (   m)    ((m & _S_IFMT) == _S_IFIFO) /* fifo */

Definition at line 224 of file ffsdrv.h.

◆ S_ISLNK

#define S_ISLNK (   m)    ((m & _S_IFMT) == _S_IFLNK) /* symbolic link */

Definition at line 225 of file ffsdrv.h.

◆ S_ISREADABLE

#define S_ISREADABLE (   m)    (((m) & S_IPERMISSION_MASK) == (S_IRUSR | S_IRGRP | S_IROTH))

Definition at line 247 of file ffsdrv.h.

◆ S_ISREG

#define S_ISREG (   m)    ((m & _S_IFMT) == _S_IFREG) /* regular file */

Definition at line 223 of file ffsdrv.h.

◆ S_ISSOCK

#define S_ISSOCK (   m)    ((m & _S_IFMT) == _S_IFSOCK) /* socket */

Definition at line 226 of file ffsdrv.h.

◆ S_ISWHT

#define S_ISWHT (   m)    ((m & _S_IFMT) == _S_IFWHT) /* whiteout */

Definition at line 227 of file ffsdrv.h.

◆ S_ISWRITABLE

#define S_ISWRITABLE (   m)    (((m) & S_IPERMISSION_MASK) == (S_IWUSR | S_IWGRP | S_IWOTH))

Definition at line 248 of file ffsdrv.h.

◆ S_IWGRP

#define S_IWGRP   0000020 /* W for group */

Definition at line 239 of file ffsdrv.h.

◆ S_IWOTH

#define S_IWOTH   0000002 /* W for other */

Definition at line 244 of file ffsdrv.h.

◆ S_IWUSR

#define S_IWUSR   0000200 /* W for owner */

Definition at line 234 of file ffsdrv.h.

◆ S_IXGRP

#define S_IXGRP   0000010 /* X for group */

Definition at line 240 of file ffsdrv.h.

◆ S_IXOTH

#define S_IXOTH   0000001 /* X for other */

Definition at line 245 of file ffsdrv.h.

◆ S_IXUSR

#define S_IXUSR   0000100 /* X for owner */

Definition at line 235 of file ffsdrv.h.

◆ SECTOR_BITS

#define SECTOR_BITS   (Vcb->SectorBits)

Definition at line 71 of file ffsdrv.h.

◆ SECTOR_SIZE

#define SECTOR_SIZE   (Vcb->DiskGeometry.BytesPerSector)

Definition at line 72 of file ffsdrv.h.

◆ SetFlag

#define SetFlag (   x,
  f 
)    ((x) |= (f))

Definition at line 130 of file ffsdrv.h.

◆ SUPER_BLOCK

#define SUPER_BLOCK   (Vcb->ffs_super_block)

Definition at line 80 of file ffsdrv.h.

◆ SUPER_BLOCK_OFFSET

#define SUPER_BLOCK_OFFSET   (0x2000)

Definition at line 75 of file ffsdrv.h.

◆ SUPER_BLOCK_SIZE

#define SUPER_BLOCK_SIZE   SBLOCKSIZE

Definition at line 76 of file ffsdrv.h.

◆ TOTAL_BLOCKS

#define TOTAL_BLOCKS   (SUPER_BLOCK->fs_size)

Definition at line 90 of file ffsdrv.h.

◆ VCB_DISMOUNT_PENDING

#define VCB_DISMOUNT_PENDING   0x00000008

Definition at line 550 of file ffsdrv.h.

◆ VCB_FLOPPY_DISK

#define VCB_FLOPPY_DISK   0x20000000

Definition at line 554 of file ffsdrv.h.

◆ VCB_INITIALIZED

#define VCB_INITIALIZED   0x00000001

Definition at line 547 of file ffsdrv.h.

◆ VCB_MOUNTED

#define VCB_MOUNTED   0x00000004

Definition at line 549 of file ffsdrv.h.

◆ VCB_READ_ONLY

#define VCB_READ_ONLY   0x00000010

Definition at line 551 of file ffsdrv.h.

◆ VCB_REMOVABLE_MEDIA

#define VCB_REMOVABLE_MEDIA   0x80000000

Definition at line 556 of file ffsdrv.h.

◆ VCB_REMOVAL_PREVENTED

#define VCB_REMOVAL_PREVENTED   0x40000000

Definition at line 555 of file ffsdrv.h.

◆ VCB_VOLUME_LOCKED

#define VCB_VOLUME_LOCKED   0x00000002

Definition at line 548 of file ffsdrv.h.

◆ VCB_WRITE_PROTECTED

#define VCB_WRITE_PROTECTED   0x10000000

Definition at line 553 of file ffsdrv.h.

◆ WRITING_SUPPORT

#define WRITING_SUPPORT   L"WritingSupport"

Definition at line 107 of file ffsdrv.h.

Typedef Documentation

◆ DISKLABEL

Definition at line 260 of file ffsdrv.h.

◆ FCB_LIST_ENTRY

◆ FFS_ALLOC_HEADER

◆ FFS_BDL

◆ FFS_BSD_PARTITION

◆ FFS_CCB

◆ FFS_DIR_ENTRY

Definition at line 265 of file ffsdrv.h.

◆ FFS_FCB

◆ FFS_FCBVCB

◆ FFS_GLOBAL

◆ FFS_IDENTIFIER

◆ FFS_IDENTIFIER_TYPE

◆ FFS_IRP_CONTEXT

◆ FFS_MCB

Definition at line 301 of file ffsdrv.h.

◆ FFS_REPINNED_BCBS

◆ FFS_SUPER_BLOCK

Definition at line 258 of file ffsdrv.h.

◆ FFS_VCB

◆ FFSv1_INODE

Definition at line 262 of file ffsdrv.h.

◆ FFSv2_INODE

Definition at line 263 of file ffsdrv.h.

◆ PBCB

typedef PVOID PBCB

Definition at line 304 of file ffsdrv.h.

◆ PDISKLABEL

Definition at line 260 of file ffsdrv.h.

◆ PFCB_LIST_ENTRY

◆ PFFS_ALLOC_HEADER

◆ PFFS_BDL

◆ PFFS_BSD_PARTITION

◆ PFFS_CCB

◆ PFFS_DIR_ENTRY

Definition at line 265 of file ffsdrv.h.

◆ PFFS_EXT

typedef struct FFS_EXT * PFFS_EXT

◆ PFFS_FCB

◆ PFFS_FCBVCB

◆ PFFS_GLOBAL

◆ PFFS_IDENTIFIER

◆ PFFS_IRP_CONTEXT

◆ PFFS_MCB

Definition at line 301 of file ffsdrv.h.

◆ PFFS_REPINNED_BCBS

◆ PFFS_SUPER_BLOCK

Definition at line 258 of file ffsdrv.h.

◆ PFFS_VCB

◆ PFFSv1_INODE

Definition at line 262 of file ffsdrv.h.

◆ PFFSv2_INODE

Definition at line 263 of file ffsdrv.h.

Enumeration Type Documentation

◆ _FFS_IDENTIFIER_TYPE

Enumerator
FFSFGD 
FFSVCB 
FFSFCB 
FFSCCB 
FFSICX 
FFSDRV 
FFSMCB 

Definition at line 278 of file ffsdrv.h.

278  {
279  FFSFGD = ':DGF',
280  FFSVCB = ':BCV',
281  FFSFCB = ':BCF',
282  FFSCCB = ':BCC',
283  FFSICX = ':XCI',
284  FFSDRV = ':VRD',
285  FFSMCB = ':BCM'
Definition: ffsdrv.h:281
Definition: ffsdrv.h:279
Definition: ffsdrv.h:283
Definition: ffsdrv.h:285
Definition: ffsdrv.h:282
Definition: ffsdrv.h:284
Definition: ffsdrv.h:280
enum _FFS_IDENTIFIER_TYPE FFS_IDENTIFIER_TYPE

Function Documentation

◆ DeviceControl()

NTSTATUS DeviceControl ( IN PDEVICE_OBJECT  pDeviceObject,
IN PIRP  pIrp 
)

◆ DriverUnload()

VOID NTAPI DriverUnload ( IN PDRIVER_OBJECT  DriverObject)

Definition at line 15 of file green.c.

16 {
17  // nothing to do here yet
18 }

◆ FFSAcquireForLazyWrite()

__drv_mustHoldCriticalRegion BOOLEAN NTAPI FFSAcquireForLazyWrite ( IN PVOID  Context,
IN BOOLEAN  Wait 
)

Definition at line 35 of file cmcb.c.

38 {
39  //
40  // On a readonly filesystem this function still has to exist but it
41  // doesn't need to do anything.
42 
43  PFFS_FCB Fcb;
44 
45  PAGED_CODE();
46 
47  Fcb = (PFFS_FCB)Context;
48 
49  ASSERT(Fcb != NULL);
50 
52  (Fcb->Identifier.Size == sizeof(FFS_FCB)));
53 
54  FFSPrint((DBG_INFO, "FFSAcquireForLazyWrite: %s %s %s\n",
56  "ACQUIRE_FOR_LAZY_WRITE",
57  Fcb->AnsiFileName.Buffer));
58 
59 
60  if (!IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY))
61  {
62  FFSPrint((DBG_INFO, "FFSAcquireForLazyWrite: Inode=%xh %S\n",
63  Fcb->FFSMcb->Inode, Fcb->FFSMcb->ShortName.Buffer));
64 
67  {
68  return FALSE;
69  }
70  }
71 
73 
75 
76  return TRUE;
77 }
Definition: ffsdrv.h:281
#define TRUE
Definition: types.h:120
struct _FFS_FCB * PFFS_FCB
#define PAGED_CODE()
Definition: video.h:57
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
smooth NULL
Definition: ftsmooth.c:416
#define FFSGetCurrentProcessName()
Definition: ffsdrv.h:1070
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
ULONG Type
Definition: ntfs.h:95
#define VCB_READ_ONLY
Definition: ext2fs.h:795
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
ERESOURCE PagingIoResource
Definition: ntfs.h:511
PVCB Vcb
Definition: cdstruc.h:939
#define DBG_INFO
Definition: ffsdrv.h:1034
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1111
ULONG Size
Definition: ntfs.h:96
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by DriverEntry().

◆ FFSAcquireForReadAhead()

__drv_mustHoldCriticalRegion BOOLEAN NTAPI FFSAcquireForReadAhead ( IN PVOID  Context,
IN BOOLEAN  Wait 
)

Definition at line 121 of file cmcb.c.

124 {
125  PFFS_FCB Fcb;
126 
127  PAGED_CODE();
128 
129  Fcb = (PFFS_FCB)Context;
130 
131  ASSERT(Fcb != NULL);
132 
133  ASSERT((Fcb->Identifier.Type == FFSFCB) &&
134  (Fcb->Identifier.Size == sizeof(FFS_FCB)));
135 
136  FFSPrint((DBG_INFO, "FFSAcquireForReadAhead: Inode=%xh %S\n",
137  Fcb->FFSMcb->Inode, Fcb->FFSMcb->ShortName.Buffer));
138 
140  &Fcb->MainResource, Wait))
141  return FALSE;
142 
144 
146 
147  return TRUE;
148 }
Definition: ffsdrv.h:281
#define TRUE
Definition: types.h:120
struct _FFS_FCB * PFFS_FCB
#define PAGED_CODE()
Definition: video.h:57
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
smooth NULL
Definition: ftsmooth.c:416
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
ULONG Type
Definition: ntfs.h:95
ERESOURCE MainResource
Definition: ntfs.h:512
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
#define DBG_INFO
Definition: ffsdrv.h:1034
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1111
ULONG Size
Definition: ntfs.h:96
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by DriverEntry().

◆ FFSAddEntry()

__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 
)

Definition at line 1965 of file ffs.c.

1972 {
1974 
1975  PFFS_DIR_ENTRY pDir = NULL;
1976  PFFS_DIR_ENTRY pNewDir = NULL;
1977  PFFS_DIR_ENTRY pTarget = NULL;
1978 
1979  ULONG Length = 0;
1980  ULONG dwBytes = 0;
1981 
1982  BOOLEAN bFound = FALSE;
1983  BOOLEAN bAdding = FALSE;
1984 
1985  BOOLEAN MainResourceAcquired = FALSE;
1986 
1987  ULONG dwRet;
1988 
1989  PAGED_CODE();
1990 
1991  if (!IsDirectory(Dcb))
1992  {
1993  FFSBreakPoint();
1995  return Status;
1996  }
1997 
1998  MainResourceAcquired = ExAcquireResourceExclusiveLite(&Dcb->MainResource, TRUE);
1999 
2000  _SEH2_TRY
2001  {
2002  Dcb->ReferenceCount++;
2003 
2006  if (!pDir)
2007  {
2009  _SEH2_LEAVE;
2010  }
2011 
2014  if (!pTarget)
2015  {
2017  _SEH2_LEAVE;
2018  }
2019 
2020 #if 0
2021  if (IsFlagOn(SUPER_BLOCK->s_feature_incompat,
2022  FFS_FEATURE_INCOMPAT_FILETYPE))
2023  {
2024  pDir->d_type = (UCHAR)FileType;
2025  }
2026  else
2027 #endif
2028  {
2029  pDir->d_type = 0;
2030  }
2031 
2032  {
2034  OemName.Buffer = pDir->d_name;
2035  OemName.MaximumLength = FFS_NAME_LEN;
2036  OemName.Length = 0;
2037 
2039 
2040  if (!NT_SUCCESS(Status))
2041  {
2042  _SEH2_LEAVE;
2043  }
2044 
2045  pDir->d_namlen = (CCHAR)OemName.Length;
2046  }
2047 
2048  pDir->d_ino = Inode;
2049  pDir->d_reclen = (USHORT)(FFS_DIR_REC_LEN(pDir->d_namlen));
2050 
2051  dwBytes = 0;
2052 
2053 Repeat:
2054 
2055  while ((LONGLONG)dwBytes < Dcb->Header.AllocationSize.QuadPart)
2056  {
2058 
2059  // Reading the DCB contents
2061  NULL,
2062  Vcb,
2063  Dcb->dinode1,
2064  dwBytes,
2065  (PVOID)pTarget,
2067  &dwRet);
2068 
2069  if (!NT_SUCCESS(Status))
2070  {
2071  FFSPrint((DBG_ERROR, "FFSAddDirectory: Reading Directory Content error.\n"));
2072  _SEH2_LEAVE;
2073  }
2074 
2075  if (((pTarget->d_ino == 0) && pTarget->d_reclen >= pDir->d_reclen) ||
2076  (pTarget->d_reclen >= FFS_DIR_REC_LEN(pTarget->d_namlen) + pDir->d_reclen))
2077  {
2078  if (pTarget->d_ino)
2079  {
2081 
2082  // Reading the DCB contents
2084  NULL,
2085  Vcb,
2086  Dcb->dinode1,
2087  dwBytes,
2088  (PVOID)pTarget,
2090  &dwRet);
2091 
2092  if (!NT_SUCCESS(Status))
2093  {
2094  FFSPrint((DBG_ERROR, "FFSAddDirectory: Reading Directory Content error.\n"));
2095  _SEH2_LEAVE;
2096  }
2097 
2098  Length = FFS_DIR_REC_LEN(pTarget->d_namlen);
2099 
2100  pNewDir = (PFFS_DIR_ENTRY) ((PUCHAR)pTarget + FFS_DIR_REC_LEN(pTarget->d_namlen));
2101 
2102  pNewDir->d_reclen = pTarget->d_reclen - FFS_DIR_REC_LEN(pTarget->d_namlen);
2103 
2104  pTarget->d_reclen = FFS_DIR_REC_LEN(pTarget->d_namlen);
2105  }
2106  else
2107  {
2108  pNewDir = pTarget;
2109  pNewDir->d_reclen = (USHORT)((ULONG)(Dcb->Header.AllocationSize.QuadPart) - dwBytes);
2110  }
2111 
2112  pNewDir->d_type = pDir->d_type;
2113  pNewDir->d_ino = pDir->d_ino;
2114  pNewDir->d_namlen = pDir->d_namlen;
2115  memcpy(pNewDir->d_name, pDir->d_name, pDir->d_namlen);
2116  Length += FFS_DIR_REC_LEN(pDir->d_namlen);
2117 
2118  bFound = TRUE;
2119  break;
2120  }
2121 
2122  dwBytes += pTarget->d_reclen;
2123  }
2124 
2125  if (bFound)
2126  {
2127  ULONG dwRet;
2128 
2129  if (FileType == DT_DIR)
2130  {
2131  if(((pDir->d_namlen == 1) && (pDir->d_name[0] == '.')) ||
2132  ((pDir->d_namlen == 2) && (pDir->d_name[0] == '.') && (pDir->d_name[1] == '.')))
2133  {
2134  }
2135  else
2136  {
2137  Dcb->dinode1->di_nlink++;
2138  }
2139  }
2140 
2141  Status = FFSv1WriteInode(IrpContext, Vcb, Dcb->dinode1, dwBytes, pTarget, Length, FALSE, &dwRet);
2142  }
2143  else
2144  {
2145  // We should expand the size of the dir inode
2146  if (!bAdding)
2147  {
2148  ULONG dwRet;
2149 
2150  bAdding = FFSExpandInode(IrpContext, Vcb, Dcb, &dwRet);
2151 
2152  if (bAdding)
2153  {
2154 
2155  Dcb->dinode1->di_size = Dcb->Header.AllocationSize.LowPart;
2156 
2157  FFSv1SaveInode(IrpContext, Vcb, Dcb->FFSMcb->Inode, Dcb->dinode1);
2158 
2159  Dcb->Header.FileSize = Dcb->Header.AllocationSize;
2160 
2161  goto Repeat;
2162  }
2163 
2164  _SEH2_LEAVE;
2165 
2166  }
2167  else // Something must be error!
2168  {
2169  _SEH2_LEAVE;
2170  }
2171  }
2172  }
2173 
2175  {
2176 
2177  Dcb->ReferenceCount--;
2178 
2179  if(MainResourceAcquired)
2180  {
2182  &Dcb->MainResource,
2184  }
2185 
2186  if (pTarget != NULL)
2187  {
2188  ExFreePool(pTarget);
2189  }
2190 
2191  if (pDir)
2192  {
2193  ExFreePool(pDir);
2194  }
2195  } _SEH2_END;
2196 
2197  return Status;
2198 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Definition: dir.h:83
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)
Definition: read.c:496
#define FFS_NAME_LEN
Definition: ffsdrv.h:202
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
#define FFS_DIR_REC_LEN(name_len)
Definition: ffsdrv.h:214
STRING OEM_STRING
Definition: umtypes.h:203
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define FFSBreakPoint()
Definition: ffsdrv.h:43
#define DT_DIR
Definition: fs.h:149
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
NTSTATUS FFSUnicodeToOEM(IN OUT POEM_STRING Oem, IN PUNICODE_STRING Unicode)
Definition: misc.c:106
__drv_mustHoldCriticalRegion BOOLEAN FFSv1SaveInode(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN ULONG Inode, IN PFFSv1_INODE dinode1)
Definition: ffs.c:407
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)
Definition: write.c:798
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
u_int32_t d_ino
Definition: dir.h:84
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define SUPER_BLOCK
Definition: ext2fs.h:90
u_int8_t d_type
Definition: dir.h:86
char d_name[MAXNAMLEN+1]
Definition: dir.h:88
int64_t LONGLONG
Definition: typedefs.h:66
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
char CCHAR
Definition: typedefs.h:50
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
unsigned char UCHAR
Definition: xmlstorage.h:181
_Must_inspect_result_ _In_ PFLT_INSTANCE _Out_ PBOOLEAN IsDirectory
Definition: fltkernel.h:1139
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define DBG_ERROR
Definition: ffsdrv.h:1031
#define FFS_POOL_TAG
Definition: ffsdrv.h:817
static BOOLEAN Repeat
Definition: dem.c:247
u_int16_t d_reclen
Definition: dir.h:85
Status
Definition: gdiplustypes.h:24
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
BOOLEAN FFSExpandInode(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb, PFFS_FCB Fcb, ULONG *dwRet)
Definition: ffs.c:1543
_SEH2_END
Definition: create.c:4424
unsigned short USHORT
Definition: pedump.c:61
_SEH2_FINALLY
Definition: create.c:4395
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define _SEH2_LEAVE
Definition: filesup.c:20
IN PDCB IN POEM_STRING OemName
Definition: fatprocs.h:1294
struct direct * PFFS_DIR_ENTRY
Definition: ffsdrv.h:265
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
u_int8_t d_namlen
Definition: dir.h:87

Referenced by FFSCreateFile(), FFSCreateInode(), and FFSSetRenameInfo().

◆ FFSAddMcbEntry()

__drv_mustHoldCriticalRegion BOOLEAN FFSAddMcbEntry ( IN PFFS_VCB  Vcb,
IN LONGLONG  Lba,
IN LONGLONG  Length 
)

Definition at line 2673 of file ffs.c.

2677 {
2678  BOOLEAN bRet = FALSE;
2679 
2680  LONGLONG Offset;
2681 
2682 #if DBG
2683  LONGLONG DirtyLba;
2684  LONGLONG DirtyLen;
2685 #endif
2686 
2687  PAGED_CODE();
2688 
2689  Offset = Lba & (~((LONGLONG)BLOCK_SIZE - 1));
2690 
2691  Length = (Length + Lba - Offset + BLOCK_SIZE - 1) &
2692  (~((LONGLONG)BLOCK_SIZE - 1));
2693 
2694  ASSERT ((Offset & (BLOCK_SIZE - 1)) == 0);
2695  ASSERT ((Length & (BLOCK_SIZE - 1)) == 0);
2696 
2697  Offset = (Offset >> BLOCK_BITS) + 1;
2698  Length = (Length >>BLOCK_BITS);
2699 
2701  &(Vcb->McbResource),
2702  TRUE);
2703 
2704  FFSPrint((DBG_INFO, "FFSAddMcbEntry: Lba=%I64xh Length=%I64xh\n",
2705  Offset, Length));
2706 
2707 #if DBG
2708  bRet = FsRtlLookupLargeMcbEntry(
2709  &(Vcb->DirtyMcbs),
2710  Offset,
2711  &DirtyLba,
2712  &DirtyLen,
2713  NULL,
2714  NULL,
2715  NULL);
2716 
2717  if (bRet && DirtyLba == Offset && DirtyLen >= Length)
2718  {
2719  FFSPrint((DBG_INFO, "FFSAddMcbEntry: this run already exists.\n"));
2720  }
2721 #endif
2722 
2723  _SEH2_TRY
2724  {
2725  bRet = FsRtlAddLargeMcbEntry(
2726  &(Vcb->DirtyMcbs),
2727  Offset, Offset,
2728  Length);
2729 
2730  }
2732  {
2733  FFSBreakPoint();
2734  bRet = FALSE;
2735  } _SEH2_END;
2736 
2737 #if DBG
2738  if (bRet)
2739  {
2740  BOOLEAN bFound = FALSE;
2741  LONGLONG RunStart;
2742  LONGLONG RunLength;
2743  ULONG Index;
2744 
2745  bFound = FsRtlLookupLargeMcbEntry(
2746  &(Vcb->DirtyMcbs),
2747  Offset,
2748  &DirtyLba,
2749  &DirtyLen,
2750  &RunStart,
2751  &RunLength,
2752  &Index);
2753 
2754  if ((!bFound) || (DirtyLba == -1) ||
2755  (DirtyLba != Offset) || (DirtyLen < Length))
2756  {
2757  LONGLONG DirtyVba;
2758  LONGLONG DirtyLba;
2759  LONGLONG DirtyLength;
2760 
2761  FFSBreakPoint();
2762 
2763  for (Index = 0;
2764  FsRtlGetNextLargeMcbEntry(&(Vcb->DirtyMcbs),
2765  Index,
2766  &DirtyVba,
2767  &DirtyLba,
2768  &DirtyLength);
2769  Index++)
2770  {
2771  FFSPrint((DBG_INFO, "Index = %xh\n", Index));
2772  FFSPrint((DBG_INFO, "DirtyVba = %I64xh\n", DirtyVba));
2773  FFSPrint((DBG_INFO, "DirtyLba = %I64xh\n", DirtyLba));
2774  FFSPrint((DBG_INFO, "DirtyLen = %I64xh\n\n", DirtyLength));
2775  }
2776  }
2777  }
2778 #endif
2779 
2781  &(Vcb->McbResource),
2783 
2784  return bRet;
2785 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define TRUE
Definition: types.h:120
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define FFSBreakPoint()
Definition: ffsdrv.h:43
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
BOOLEAN NTAPI FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb, IN ULONG RunIndex, OUT PLONGLONG Vbn, OUT PLONGLONG Lbn, OUT PLONGLONG SectorCount)
Definition: largemcb.c:391
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
#define BLOCK_BITS
Definition: stream.h:22
smooth NULL
Definition: ftsmooth.c:416
int64_t LONGLONG
Definition: typedefs.h:66
#define BLOCK_SIZE
Definition: dlist.c:220
#define Vcb
Definition: cdprocs.h:1425
static const UCHAR Index[8]
Definition: usbohci.c:18
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
BOOLEAN NTAPI FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb, IN LONGLONG Vbn, IN LONGLONG Lbn, IN LONGLONG SectorCount)
Definition: largemcb.c:282
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
BOOLEAN NTAPI FsRtlLookupLargeMcbEntry(IN PLARGE_MCB Mcb, IN LONGLONG Vbn, OUT PLONGLONG Lbn OPTIONAL, OUT PLONGLONG SectorCountFromLbn OPTIONAL, OUT PLONGLONG StartingLbn OPTIONAL, OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL, OUT PULONG Index OPTIONAL)
Definition: largemcb.c:564
_SEH2_END
Definition: create.c:4424
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define DBG_INFO
Definition: ffsdrv.h:1034
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by FFSCheckSetBlock(), FFSFreeBlock(), FFSFreeInode(), FFSNewBlock(), FFSNewInode(), FFSSaveBuffer(), FFSTruncateBlock(), and FFSWriteVolume().

◆ FFSAddMcbNode()

VOID FFSAddMcbNode ( PFFS_VCB  Vcb,
PFFS_MCB  Parent,
PFFS_MCB  Child 
)

Definition at line 1278 of file memory.c.

1282 {
1283  PFFS_MCB TmpMcb = Parent->Child;
1284 
1285  PAGED_CODE();
1286 
1287  if(IsFlagOn(Child->Flags, MCB_IN_TREE))
1288  {
1289  FFSBreakPoint();
1290  FFSPrint((DBG_ERROR, "FFSAddMcbNode: Child Mcb is alreay in the tree.\n"));
1291  return;
1292  }
1293 
1294  if (TmpMcb)
1295  {
1296  ASSERT(TmpMcb->Parent == Parent);
1297 
1298  while (TmpMcb->Next)
1299  {
1300  TmpMcb = TmpMcb->Next;
1301  ASSERT(TmpMcb->Parent == Parent);
1302  }
1303 
1304  TmpMcb->Next = Child;
1305  Child->Parent = Parent;
1306  Child->Next = NULL;
1307  }
1308  else
1309  {
1310  Parent->Child = Child;
1311  Child->Parent = Parent;
1312  Child->Next = NULL;
1313  }
1314 
1315  InsertTailList(&(Vcb->McbList), &(Child->Link));
1316  SetFlag(Child->Flags, MCB_IN_TREE);
1317 }
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:716
#define InsertTailList(ListHead, Entry)
#define PAGED_CODE()
Definition: video.h:57
#define FFSBreakPoint()
Definition: ffsdrv.h:43
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
smooth NULL
Definition: ftsmooth.c:416
PFFS_MCB Next
Definition: ffsdrv.h:652
#define Vcb
Definition: cdprocs.h:1425
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define DBG_ERROR
Definition: ffsdrv.h:1031
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define MCB_IN_TREE
Definition: ffsdrv.h:679
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE Child
Definition: acpixf.h:716
PFFS_MCB Parent
Definition: ffsdrv.h:650

Referenced by FFSSetRenameInfo(), FFSv1LookupFileName(), and FFSv2LookupFileName().

◆ FFSAllocateCcb()

Definition at line 803 of file memory.c.

805 {
806  PFFS_CCB Ccb;
807 
808  PAGED_CODE();
809 
812  TRUE);
813 
814  Ccb = (PFFS_CCB)(ExAllocateFromNPagedLookasideList(&(FFSGlobal->FFSCcbLookasideList)));
815 
819 
820  if (Ccb == NULL)
821  {
823 
824  RtlZeroMemory(Ccb, sizeof(FFS_CCB));
825 
827  }
828  else
829  {
830  RtlZeroMemory(Ccb, sizeof(FFS_CCB));
831  }
832 
833  if (!Ccb)
834  {
835  return NULL;
836  }
837 
839  Ccb->Identifier.Size = sizeof(FFS_CCB);
840 
841  Ccb->CurrentByteOffset = 0;
842 
843  Ccb->DirectorySearchPattern.Length = 0;
844  Ccb->DirectorySearchPattern.MaximumLength = 0;
845  Ccb->DirectorySearchPattern.Buffer = 0;
846 
847  return Ccb;
848 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define TRUE
Definition: types.h:120
#define PAGED_CODE()
Definition: video.h:57
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
NPAGED_LOOKASIDE_LIST FFSCcbLookasideList
Definition: ffsdrv.h:380
struct _FFS_CCB FFS_CCB
Definition: ffsdrv.h:282
smooth NULL
Definition: ftsmooth.c:416
ERESOURCE LAResource
Definition: ffsdrv.h:358
ULONG Flags
Definition: ntfs.h:520
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG Type
Definition: ntfs.h:95
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define FFS_POOL_TAG
Definition: ffsdrv.h:817
struct _FFS_CCB * PFFS_CCB
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define CCB_FROM_POOL
Definition: ext2fs.h:1022
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
ULONG Size
Definition: ntfs.h:96

Referenced by FFSCreateFile(), and FFSCreateVolume().

◆ FFSAllocateIrpContext()

__drv_mustHoldCriticalRegion PFFS_IRP_CONTEXT FFSAllocateIrpContext ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 52 of file memory.c.

55 {
56  PIO_STACK_LOCATION IoStackLocation;
57  PFFS_IRP_CONTEXT IrpContext;
58 
59  PAGED_CODE();
60 
62  ASSERT(Irp != NULL);
63 
64  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
65 
68  TRUE);
69 
70  IrpContext = (PFFS_IRP_CONTEXT)(ExAllocateFromNPagedLookasideList(&(FFSGlobal->FFSIrpContextLookasideList)));
71 
75 
76  if (IrpContext == NULL)
77  {
79 
80  //
81  // Zero out the irp context and indicate that it is from pool and
82  // not region allocated
83  //
84 
85  RtlZeroMemory(IrpContext, sizeof(FFS_IRP_CONTEXT));
86 
88  }
89  else
90  {
91  //
92  // Zero out the irp context and indicate that it is from zone and
93  // not pool allocated
94  //
95 
96  RtlZeroMemory(IrpContext, sizeof(FFS_IRP_CONTEXT));
97  }
98 
99  if (!IrpContext)
100  {
101  return NULL;
102  }
103 
104  IrpContext->Identifier.Type = FFSICX;
105  IrpContext->Identifier.Size = sizeof(FFS_IRP_CONTEXT);
106 
107  IrpContext->Irp = Irp;
108 
109  IrpContext->MajorFunction = IoStackLocation->MajorFunction;
110  IrpContext->MinorFunction = IoStackLocation->MinorFunction;
111 
112  IrpContext->DeviceObject = DeviceObject;
113 
114  IrpContext->FileObject = IoStackLocation->FileObject;
115 
116  if (IrpContext->FileObject != NULL)
117  {
118  IrpContext->RealDevice = IrpContext->FileObject->DeviceObject;
119  }
120  else if (IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL)
121  {
122  if (IoStackLocation->Parameters.MountVolume.Vpb)
123  {
124  IrpContext->RealDevice =
125  IoStackLocation->Parameters.MountVolume.Vpb->RealDevice;
126  }
127  }
128 
129  if (IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL ||
130  IrpContext->MajorFunction == IRP_MJ_DEVICE_CONTROL ||
131  IrpContext->MajorFunction == IRP_MJ_SHUTDOWN)
132  {
133  IrpContext->IsSynchronous = TRUE;
134  }
135  else if (IrpContext->MajorFunction == IRP_MJ_CLEANUP ||
136  IrpContext->MajorFunction == IRP_MJ_CLOSE)
137  {
138  IrpContext->IsSynchronous = FALSE;
139  }
140 #if (_WIN32_WINNT >= 0x0500)
141  else if (IrpContext->MajorFunction == IRP_MJ_PNP)
142  {
144  {
145  IrpContext->IsSynchronous = TRUE;
146  }
147  else
148  {
150  }
151  }
152 #endif //(_WIN32_WINNT >= 0x0500)
153  else
154  {
156  }
157 
158 #if 0
159  //
160  // Temporary workaround for a bug in close that makes it reference a
161  // fileobject when it is no longer valid.
162  //
163  if (IrpContext->MajorFunction == IRP_MJ_CLOSE)
164  {
165  IrpContext->IsSynchronous = TRUE;
166  }
167 #endif
168 
169  IrpContext->IsTopLevel = (IoGetTopLevelIrp() == Irp);
170 
171  IrpContext->ExceptionInProgress = FALSE;
172 
173  return IrpContext;
174 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
#define TRUE
Definition: types.h:120
#define IRP_MJ_SHUTDOWN
_In_ PIRP Irp
Definition: csq.h:116
UCHAR MajorFunction
Definition: ffsdrv.h:731
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
struct _FFS_IRP_CONTEXT FFS_IRP_CONTEXT
NPAGED_LOOKASIDE_LIST FFSIrpContextLookasideList
Definition: ffsdrv.h:378
#define IRP_CONTEXT_FLAG_FROM_POOL
Definition: ext2fs.h:1077
Definition: ffsdrv.h:283
PFILE_OBJECT FileObject
Definition: ffsdrv.h:741
BOOLEAN NTAPI IoIsOperationSynchronous(IN PIRP Irp)
Definition: irp.c:1882
#define PAGED_CODE()
Definition: video.h:57
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
BOOLEAN ExceptionInProgress
Definition: ffsdrv.h:756
BOOLEAN IsTopLevel
Definition: ffsdrv.h:750
struct _FFS_IRP_CONTEXT * PFFS_IRP_CONTEXT
smooth NULL
Definition: ftsmooth.c:416
FFS_IDENTIFIER_TYPE Type
Definition: ffsdrv.h:294
ULONG Size
Definition: ffsdrv.h:295
ERESOURCE LAResource
Definition: ffsdrv.h:358
#define IRP_MJ_FILE_SYSTEM_CONTROL
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IRP_MJ_CLOSE
Definition: rdpdr.c:45
#define FFS_POOL_TAG
Definition: ffsdrv.h:817
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
FFS_IDENTIFIER Identifier
Definition: ffsdrv.h:722
PDEVICE_OBJECT DeviceObject
Definition: ffsdrv.h:735
#define IRP_MJ_CLEANUP
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
PDEVICE_OBJECT RealDevice
Definition: ffsdrv.h:738
BOOLEAN IsSynchronous
Definition: ffsdrv.h:747
UCHAR MinorFunction
Definition: ffsdrv.h:732
#define IRP_MJ_DEVICE_CONTROL
Definition: rdpdr.c:52

Referenced by FFSBuildRequest().

◆ FFSAllocateMcb()

PFFS_MCB FFSAllocateMcb ( PFFS_VCB  Vcb,
PUNICODE_STRING  FileName,
ULONG  FileAttr 
)

Definition at line 889 of file memory.c.

893 {
894  PFFS_MCB Mcb = NULL;
896 
897  ULONG Extra = 0;
898 
899  PAGED_CODE();
900 
901 #define MCB_NUM_SHIFT 0x04
902 
904  Extra = FFSGlobal->McbAllocated -
907 
909  "FFSAllocateMcb: CurrDepth=%xh/%xh/%xh FileName=%S\n",
912  FFSGlobal->FcbAllocated,
913  FileName->Buffer));
914 
915  List = Vcb->McbList.Flink;
916 
917  while ((List != &(Vcb->McbList)) && (Extra > 0))
918  {
920  List = List->Flink;
921 
922  if ((Mcb->Inode != 2) && (Mcb->Child == NULL) &&
923  (Mcb->FFSFcb == NULL) && (!IsMcbUsed(Mcb)))
924  {
925  FFSPrint((DBG_INFO, "FFSAllocateMcb: Mcb %S will be freed.\n",
926  Mcb->ShortName.Buffer));
927 
928  if (FFSDeleteMcbNode(Vcb, Vcb->McbTree, Mcb))
929  {
930  FFSFreeMcb(Mcb);
931 
932  Extra--;
933  }
934  }
935  }
936 
939  TRUE);
940 
941  Mcb = (PFFS_MCB)(ExAllocateFromPagedLookasideList(
943 
947 
948  if (Mcb == NULL)
949  {
951 
952  RtlZeroMemory(Mcb, sizeof(FFS_MCB));
953 
954  SetFlag(Mcb->Flags, MCB_FROM_POOL);
955  }
956  else
957  {
958  RtlZeroMemory(Mcb, sizeof(FFS_MCB));
959  }
960 
961  if (!Mcb)
962  {
963  return NULL;
964  }
965 
966  Mcb->Identifier.Type = FFSMCB;
967  Mcb->Identifier.Size = sizeof(FFS_MCB);
968 
969  if (FileName && FileName->Length)
970  {
971  Mcb->ShortName.Length = FileName->Length;
972  Mcb->ShortName.MaximumLength = Mcb->ShortName.Length + 2;
973 
974  Mcb->ShortName.Buffer = ExAllocatePoolWithTag(PagedPool, Mcb->ShortName.MaximumLength, FFS_POOL_TAG);
975 
976  if (!Mcb->ShortName.Buffer)
977  goto errorout;
978 
979  RtlZeroMemory(Mcb->ShortName.Buffer, Mcb->ShortName.MaximumLength);
980  RtlCopyMemory(Mcb->ShortName.Buffer, FileName->Buffer, Mcb->ShortName.Length);
981  }
982 
983  Mcb->FileAttr = FileAttr;
984 
987  TRUE);
988 
990 
994 
995  return Mcb;
996 
997 errorout:
998 
999  if (Mcb)
1000  {
1001  if (Mcb->ShortName.Buffer)
1002  ExFreePool(Mcb->ShortName.Buffer);
1003 
1004  if (FlagOn(Mcb->Flags, MCB_FROM_POOL))
1005  {
1006  ExFreePool(Mcb);
1007  }
1008  else
1009  {
1012  TRUE);
1013 
1014  ExFreeToPagedLookasideList(&(FFSGlobal->FFSMcbLookasideList), Mcb);
1015 
1019  }
1020  }
1021 
1022  return NULL;
1023 }
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
BOOLEAN FFSDeleteMcbNode(PFFS_VCB Vcb, PFFS_MCB McbTree, PFFS_MCB FFSMcb)
Definition: memory.c:1321
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define MCB_FROM_POOL
Definition: ext2fs.h:943
USHORT MaxDepth
Definition: ffsdrv.h:377
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define PAGED_CODE()
Definition: video.h:57
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
USHORT McbAllocated
Definition: ffsdrv.h:384
ERESOURCE CountResource
Definition: ffsdrv.h:355
Definition: ffsdrv.h:285
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
ERESOURCE LAResource
Definition: ffsdrv.h:358
LIST_ENTRY List
Definition: psmgr.c:57
struct _FFS_MCB * PFFS_MCB
Definition: ffsdrv.h:301
#define Vcb
Definition: cdprocs.h:1425
__drv_mustHoldCriticalRegion VOID FFSFreeMcb(IN PFFS_MCB Mcb)
Definition: memory.c:1028
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Definition: typedefs.h:117
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define FFS_POOL_TAG
Definition: ffsdrv.h:817
#define MCB_NUM_SHIFT
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
#define IsMcbUsed(Mcb)
Definition: ext2fs.h:952
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:334
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define DBG_INFO
Definition: ffsdrv.h:1034
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
PAGED_LOOKASIDE_LIST FFSMcbLookasideList
Definition: ffsdrv.h:381
struct _FFS_MCB FFS_MCB
Definition: ffsdrv.h:301

Referenced by FFSInitializeVcb(), FFSv1LookupFileName(), and FFSv2LookupFileName().

◆ FFSAllowExtendedDasdIo()

__drv_mustHoldCriticalRegion NTSTATUS FFSAllowExtendedDasdIo ( IN PFFS_IRP_CONTEXT  IrpContext)

Definition at line 729 of file fsctl.c.

731 {
733  PFFS_VCB Vcb;
734  PFFS_CCB Ccb;
735 
736  PAGED_CODE();
737 
738  IrpSp = IoGetCurrentIrpStackLocation(IrpContext->Irp);
739 
740  Vcb = (PFFS_VCB)IrpSp->FileObject->FsContext;
741  Ccb = (PFFS_CCB)IrpSp->FileObject->FsContext2;
742 
743  ASSERT(Vcb != NULL);
744 
745  ASSERT((Vcb->Identifier.Type == FFSVCB) &&
746  (Vcb->Identifier.Size == sizeof(FFS_VCB)));
747 
748  ASSERT(IsMounted(Vcb));
749 
750  if (Ccb)
751  {
753 
755 
756  return STATUS_SUCCESS;
757  }
758  else
759  {
761  }
762 }
#define IsMounted(Vcb)
Definition: ext2fs.h:803
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define PAGED_CODE()
Definition: video.h:57
#define CCB_ALLOW_EXTENDED_DASD_IO
Definition: ext2fs.h:1028
smooth NULL
Definition: ftsmooth.c:416
struct _FFS_VCB * PFFS_VCB
#define Vcb
Definition: cdprocs.h:1425
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG Flags
Definition: ntfs.h:520
__drv_mustHoldCriticalRegion NTSTATUS FFSCompleteIrpContext(IN PFFS_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: read.c:53
Definition: ffsdrv.h:280
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
return STATUS_SUCCESS
Definition: btrfs.c:2745

Referenced by FFSUserFsRequest().

◆ FFSBuildRequest()

NTSTATUS NTAPI FFSBuildRequest ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 181 of file dispatch.c.

184 {
185  BOOLEAN AtIrqlPassiveLevel = FALSE;
186  BOOLEAN IsTopLevelIrp = FALSE;
187  PFFS_IRP_CONTEXT IrpContext = NULL;
189 
190  PAGED_CODE();
191 
192  _SEH2_TRY
193  {
194  _SEH2_TRY
195  {
196 #if DBG
198 #endif
199 
200  AtIrqlPassiveLevel = (KeGetCurrentIrql() == PASSIVE_LEVEL);
201 
202  if (AtIrqlPassiveLevel)
203  {
205  }
206 
207  if (!IoGetTopLevelIrp())
208  {
209  IsTopLevelIrp = TRUE;
211  }
212 
213  IrpContext = FFSAllocateIrpContext(DeviceObject, Irp);
214 
215  if (!IrpContext)
216  {
218  Irp->IoStatus.Status = Status;
219 
221  }
222  else
223  {
224  if ((IrpContext->MajorFunction == IRP_MJ_CREATE) &&
225  !AtIrqlPassiveLevel)
226  {
227  FFSBreakPoint();
228  }
229 
230  Status = FFSDispatchRequest(IrpContext);
231  }
232  }
234  {
235  Status = FFSExceptionHandler(IrpContext);
236  } _SEH2_END;
237  }
239  {
240  if (IsTopLevelIrp)
241  {
243  }
244 
245  if (AtIrqlPassiveLevel)
246  {
248  }
249  } _SEH2_END;
250 
251  return Status;
252 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define TRUE
Definition: types.h:120
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
NTSTATUS FFSExceptionHandler(IN PFFS_IRP_CONTEXT IrpContext)
Definition: except.c:117
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
_In_ PIRP Irp
Definition: csq.h:116
UCHAR MajorFunction
Definition: ffsdrv.h:731
LONG NTSTATUS
Definition: precomp.h:26
#define FFSCompleteRequest(Irp, bPrint, PriorityBoost)
Definition: ffsdrv.h:1049
VOID FFSDbgPrintCall(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define FFSBreakPoint()
Definition: ffsdrv.h:43
NTSTATUS FFSDispatchRequest(IN PFFS_IRP_CONTEXT IrpContext)
Definition: dispatch.c:104
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:11
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
__drv_mustHoldCriticalRegion PFFS_IRP_CONTEXT FFSAllocateIrpContext(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: memory.c:52
NTSTATUS FFSExceptionFilter(IN PFFS_IRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
Definition: except.c:31
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
Status
Definition: gdiplustypes.h:24
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
_SEH2_END
Definition: create.c:4424
_SEH2_FINALLY
Definition: create.c:4395
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by DriverEntry().

◆ FFSCheckBitmapConsistency()

BOOLEAN FFSCheckBitmapConsistency ( PFFS_IRP_CONTEXT  IrpContext,
PFFS_VCB  Vcb 
)

Definition at line 1500 of file memory.c.

1503 {
1504  PAGED_CODE();
1505 #if 0
1506  ULONG i, j, InodeBlocks;
1507 
1508  for (i = 0; i < Vcb->ffs_groups; i++)
1509  {
1510  FFSCheckSetBlock(IrpContext, Vcb, Vcb->ffs_group_desc[i].bg_block_bitmap);
1511  FFSCheckSetBlock(IrpContext, Vcb, Vcb->ffs_group_desc[i].bg_inode_bitmap);
1512 
1513 
1514  if (i == Vcb->ffs_groups - 1)
1515  {
1516  InodeBlocks = ((INODES_COUNT % INODES_PER_GROUP) * sizeof(FFS_INODE) + Vcb->BlockSize - 1) / (Vcb->BlockSize);
1517  }
1518  else
1519  {
1520  InodeBlocks = (INODES_PER_GROUP * sizeof(FFS_INODE) + Vcb->BlockSize - 1) / (Vcb->BlockSize);
1521  }
1522 
1523  for (j = 0; j < InodeBlocks; j++)
1524  FFSCheckSetBlock(IrpContext, Vcb, Vcb->ffs_group_desc[i].bg_inode_table + j);
1525  }
1526 
1527  return TRUE;
1528 #endif
1529  return FALSE;
1530 }
#define TRUE
Definition: types.h:120
BOOLEAN FFSCheckSetBlock(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb, ULONG Block)
Definition: memory.c:1412
#define PAGED_CODE()
Definition: video.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define Vcb
Definition: cdprocs.h:1425
unsigned int ULONG
Definition: retypes.h:1
#define INODES_PER_GROUP
Definition: ext2fs.h:99
#define INODES_COUNT
Definition: ext2fs.h:97

Referenced by FFSInitializeVcb().

◆ FFSCheckDismount()

__drv_mustHoldCriticalRegion BOOLEAN FFSCheckDismount ( IN PFFS_IRP_CONTEXT  IrpContext,
IN PFFS_VCB  Vcb,
IN BOOLEAN  bForce 
)

Definition at line 1332 of file fsctl.c.

1336 {
1337  KIRQL Irql;
1338  PVPB Vpb = Vcb->Vpb;
1339  BOOLEAN bDeleted = FALSE;
1340  ULONG UnCleanCount = 0;
1341 
1342  PAGED_CODE();
1343 
1345  &FFSGlobal->Resource, TRUE);
1346 
1348  &Vcb->MainResource, TRUE);
1349 
1350  if ((IrpContext->MajorFunction == IRP_MJ_CREATE) &&
1351  (IrpContext->RealDevice == Vcb->RealDevice))
1352  {
1353  UnCleanCount = 3;
1354  }
1355  else
1356  {
1357  UnCleanCount = 2;
1358  }
1359 
1361 
1362  if ((Vpb->ReferenceCount == UnCleanCount) || bForce)
1363  {
1364 
1365  if ((Vpb->ReferenceCount != UnCleanCount) && bForce)
1366  {
1367  FFSBreakPoint();
1368  }
1369 
1370  ClearFlag(Vpb->Flags, VPB_MOUNTED);
1371  ClearFlag(Vpb->Flags, VPB_LOCKED);
1372 
1373  if ((Vcb->RealDevice != Vpb->RealDevice) &&
1374 #ifdef _MSC_VER
1375 #pragma prefast( suppress: 28175, "allowed in file system drivers" )
1376 #endif
1377  (Vcb->RealDevice->Vpb == Vpb))
1378  {
1379  SetFlag(Vcb->RealDevice->Flags, DO_DEVICE_INITIALIZING);
1380  SetFlag(Vpb->Flags, VPB_PERSISTENT);
1381  }
1382 
1383  FFSRemoveVcb(Vcb);
1384 
1385  ClearFlag(Vpb->Flags, VPB_MOUNTED);
1386  SetFlag(Vcb->Flags, VCB_DISMOUNT_PENDING);
1387 
1388  Vpb->DeviceObject = NULL;
1389 
1390  bDeleted = TRUE;
1391  }
1392 
1393 #if 0
1394 
1395  else if ((Vpb->RealDevice->Vpb == Vpb) && bForce)
1396  {
1397  PVPB NewVpb;
1398 
1399 #define TAG_VPB ' bpV'
1400 
1402  sizeof(VPB), TAG_VPB);
1403 
1404  NewVpb->Type = IO_TYPE_VPB;
1405  NewVpb->Size = sizeof(VPB);
1406  NewVpb->RealDevice = Vcb->Vpb->RealDevice;
1407 
1408  NewVpb->RealDevice->Vpb = NewVpb;
1409 
1410  NewVpb->Flags = FlagOn(Vcb->Vpb->Flags, VPB_REMOVE_PENDING);
1411 
1412  NewVpb = NULL;
1413 
1414  ClearFlag(Vcb->Flags, VCB_MOUNTED);
1416  }
1417 
1418 #endif
1419 
1421 
1423  &Vcb->MainResource,
1425 
1427  &FFSGlobal->Resource,
1429 
1430  if (bDeleted)
1431  {
1432 #if 0
1433  FFSBreakPoint(); /* XP에서 브레이크 포인트 발생 */
1434 #endif
1435 
1436  FFSFreeVcb(Vcb);
1437  }
1438 
1439  return bDeleted;
1440 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
boolean suppress
Definition: jpeglib.h:1005
#define TRUE
Definition: types.h:120
#define IRP_MJ_CREATE
Definition: rdpdr.c:44
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
USHORT Flags
Definition: iotypes.h:169
#define VCB_MOUNTED
Definition: ext2fs.h:781
VOID NTAPI IoAcquireVpbSpinLock(OUT PKIRQL Irql)
Definition: volume.c:1201
PVPB Vpb
Definition: cdstruc.h:517
#define VPB_PERSISTENT
Definition: iotypes.h:1765
_Out_ PKIRQL Irql
Definition: csq.h:179
#define TAG_VPB
Definition: cdprocs.h:98
#define PAGED_CODE()
Definition: video.h:57
#define FFSBreakPoint()
Definition: ffsdrv.h:43
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define VPB_LOCKED
Definition: iotypes.h:1764
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define VPB_REMOVE_PENDING
Definition: ntifs_ex.h:428
VOID FFSRemoveVcb(PFFS_VCB Vcb)
Definition: memory.c:1542
struct _DEVICE_OBJECT * RealDevice
Definition: iotypes.h:172
#define Vcb
Definition: cdprocs.h:1425
CSHORT Size
Definition: iotypes.h:168
__drv_mustHoldCriticalRegion VOID FFSFreeVcb(IN PFFS_VCB Vcb)
Definition: memory.c:1886
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define VCB_DISMOUNT_PENDING
Definition: ext2fs.h:782
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define IO_TYPE_VPB
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
struct _VPB VPB
ERESOURCE Resource
Definition: ffsdrv.h:352
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
CSHORT Type
Definition: iotypes.h:167
Definition: iotypes.h:166
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define VPB_MOUNTED
Definition: iotypes.h:1763
VOID NTAPI IoReleaseVpbSpinLock(IN KIRQL Irql)
Definition: volume.c:1212
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1664

Referenced by FFSDismountVolume(), and FFSInvalidateVolumes().

◆ FFSCheckSetBlock()

BOOLEAN FFSCheckSetBlock ( PFFS_IRP_CONTEXT  IrpContext,
PFFS_VCB  Vcb,
ULONG  Block 
)

Definition at line 1412 of file memory.c.

1416 {
1417  PAGED_CODE();
1418 #if 0
1419  ULONG Group, dwBlk, Length;
1420 
1421  RTL_BITMAP BlockBitmap;
1422  PVOID BitmapCache;
1423  PBCB BitmapBcb;
1424 
1426 
1427  BOOLEAN bModified = FALSE;
1428 
1429 
1430  //Group = (Block - FFS_FIRST_DATA_BLOCK) / BLOCKS_PER_GROUP;
1431 
1432  dwBlk = (Block - FFS_FIRST_DATA_BLOCK) % BLOCKS_PER_GROUP;
1433 
1434 
1435  Offset.QuadPart = (LONGLONG) Vcb->BlockSize;
1436  Offset.QuadPart = Offset.QuadPart * Vcb->ffs_group_desc[Group].bg_block_bitmap;
1437 
1438  if (Group == Vcb->ffs_groups - 1)
1439  {
1441 
1442  /* s_blocks_count is integer multiple of s_blocks_per_group */
1443  if (Length == 0)
1445  }
1446  else
1447  {
1449  }
1450 
1451  if (dwBlk >= Length)
1452  return FALSE;
1453 
1454  if (!CcPinRead(Vcb->StreamObj,
1455  &Offset,
1456  Vcb->BlockSize,
1457  PIN_WAIT,
1458  &BitmapBcb,
1459  &BitmapCache))
1460  {
1461  FFSPrint((DBG_ERROR, "FFSDeleteBlock: PinReading error ...\n"));
1462  return FALSE;
1463  }
1464 
1465  RtlInitializeBitMap(&BlockBitmap,
1466  BitmapCache,
1467  Length);
1468 
1469  if (RtlCheckBit(&BlockBitmap, dwBlk) == 0)
1470  {
1471  FFSBreakPoint();
1472  RtlSetBits(&BlockBitmap, dwBlk, 1);
1473  bModified = TRUE;
1474  }
1475 
1476  if (bModified)
1477  {
1478  CcSetDirtyPinnedData(BitmapBcb, NULL);
1479 
1480  FFSRepinBcb(IrpContext, BitmapBcb);
1481 
1482  FFSAddMcbEntry(Vcb, Offset.QuadPart, (LONGLONG)Vcb->BlockSize);
1483  }
1484 
1485  {
1486  CcUnpinData(BitmapBcb);
1487  BitmapBcb = NULL;
1488  BitmapCache = NULL;
1489 
1490  RtlZeroMemory(&BlockBitmap, sizeof(RTL_BITMAP));
1491  }
1492 
1493  return (!bModified);
1494 #endif
1495  return FALSE;
1496 }
#define TRUE
Definition: types.h:120
NTSYSAPI void WINAPI RtlInitializeBitMap(PRTL_BITMAP, PULONG, ULONG)
VOID NTAPI CcSetDirtyPinnedData(IN PVOID BcbVoid, IN OPTIONAL PLARGE_INTEGER Lsn)
Definition: cachesub.c:121
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
VOID NTAPI CcUnpinData(IN PVOID Bcb)
Definition: pinsup.c:955
#define PIN_WAIT
#define RtlCheckBit(BMH, BP)
Definition: rtlfuncs.h:3154
#define FFS_FIRST_DATA_BLOCK
Definition: ffsdrv.h:256
VOID FFSRepinBcb(IN PFFS_IRP_CONTEXT IrpContext, IN PBCB Bcb)
Definition: memory.c:221
#define PAGED_CODE()
Definition: video.h:57
#define FFSBreakPoint()
Definition: ffsdrv.h:43
__drv_mustHoldCriticalRegion BOOLEAN FFSAddMcbEntry(IN PFFS_VCB Vcb, IN LONGLONG Lba, IN LONGLONG Length)
Definition: ffs.c:2673
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define TOTAL_BLOCKS
Definition: ext2fs.h:101
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
int64_t LONGLONG
Definition: typedefs.h:66
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
BOOLEAN NTAPI CcPinRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN ULONG Flags, OUT PVOID *Bcb, OUT PVOID *Buffer)
Definition: pinsup.c:802
#define DBG_ERROR
Definition: ffsdrv.h:1031
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSYSAPI void WINAPI RtlSetBits(PRTL_BITMAP, ULONG, ULONG)
#define BLOCKS_PER_GROUP
Definition: ext2fs.h:100

Referenced by FFSCheckBitmapConsistency().

◆ FFSCleanup()

Definition at line 30 of file cleanup.c.

32 {
35  PFFS_VCB Vcb = 0;
36  BOOLEAN VcbResourceAcquired = FALSE;
38  PFFS_FCB Fcb = 0;
39  BOOLEAN FcbResourceAcquired = FALSE;
40  BOOLEAN FcbPagingIoAcquired = FALSE;
41  PFFS_CCB Ccb;
42  PIRP Irp;
43 
44  PAGED_CODE();
45 
46  _SEH2_TRY
47  {
48  ASSERT(IrpContext != NULL);
49 
50  ASSERT((IrpContext->Identifier.Type == FFSICX) &&
51  (IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
52 
53  DeviceObject = IrpContext->DeviceObject;
54 
56  {
59  }
60 
62 
63  ASSERT(Vcb != NULL);
64 
65  ASSERT((Vcb->Identifier.Type == FFSVCB) &&
66  (Vcb->Identifier.Size == sizeof(FFS_VCB)));
67 
68  if (!IsFlagOn(Vcb->Flags, VCB_INITIALIZED))
69  {
72  }
73 
74 #ifdef _MSC_VER
75 #pragma prefast( suppress: 28137, "by design" )
76 #endif
78  &Vcb->MainResource,
79  IrpContext->IsSynchronous))
80  {
83  }
84 
85  VcbResourceAcquired = TRUE;
86 
87  FileObject = IrpContext->FileObject;
88 
89  Fcb = (PFFS_FCB)FileObject->FsContext;
90 
91  if (!Fcb)
92  {
95  }
96 
97  if (Fcb->Identifier.Type == FFSVCB)
98  {
99  if (IsFlagOn(Vcb->Flags, VCB_VOLUME_LOCKED) &&
100  (Vcb->LockFile == FileObject))
101  {
103  Vcb->LockFile = NULL;
104 
106  }
107 
108  Vcb->OpenHandleCount--;
109 
110  if (!Vcb->OpenHandleCount)
111  {
112  IoRemoveShareAccess(FileObject, &Vcb->ShareAccess);
113  }
114 
116  _SEH2_LEAVE;
117  }
118 
119  ASSERT((Fcb->Identifier.Type == FFSFCB) &&
120  (Fcb->Identifier.Size == sizeof(FFS_FCB)));
121 
122 /*
123  if (!IsFlagOn(Vcb->Flags, VCB_READ_ONLY) &&
124  !IsFlagOn(Fcb->Flags, FCB_PAGE_FILE))
125 */
126  {
127 #ifdef _MSC_VER
128 #pragma prefast( suppress: 28137, "by design" )
129 #endif
131  &Fcb->MainResource,
132  IrpContext->IsSynchronous))
133  {
135  _SEH2_LEAVE;
136  }
137 
138  FcbResourceAcquired = TRUE;
139  }
140 
141  Ccb = (PFFS_CCB)FileObject->FsContext2;
142 
143  if (!Ccb)
144  {
146  _SEH2_LEAVE;
147  }
148 
150  {
151  if (IsFlagOn(FileObject->Flags, FO_FILE_MODIFIED) &&
152  IsFlagOn(Vcb->Flags, VCB_FLOPPY_DISK) &&
153  !IsFlagOn(Vcb->Flags, VCB_WRITE_PROTECTED))
154  {
156  }
157 
158  _SEH2_LEAVE;
159  }
160 
161  ASSERT((Ccb->Identifier.Type == FFSCCB) &&
162  (Ccb->Identifier.Size == sizeof(FFS_CCB)));
163  Irp = IrpContext->Irp;
164 
165  Fcb->OpenHandleCount--;
166 
167  if (!IsFlagOn(FileObject->Flags, FO_CACHE_SUPPORTED))
168  {
169  Fcb->NonCachedOpenCount--;
170  }
171 
172  Vcb->OpenFileHandleCount--;
173 
175  {
177 
178  if (IsDirectory(Fcb))
179  {
181  Vcb->NotifySync,
182  &Vcb->NotifyList,
183  Fcb,
184  NULL,
185  FALSE,
186  FALSE,
187  0,
188  NULL,
189  NULL,
190  NULL);
191  }
192  }
193 
194  if (IsDirectory(Fcb))
195  {
197  Vcb->NotifySync,
198  &Vcb->NotifyList,
199  Ccb);
200  }
201  else
202  {
203  //
204  // Drop any byte range locks this process may have on the file.
205  //
207  &Fcb->FileLockAnchor,
208  FileObject,
210  NULL);
211 
212  //
213  // If there are no byte range locks owned by other processes on the
214  // file the fast I/O read/write functions doesn't have to check for
215  // locks so we set IsFastIoPossible to FastIoIsPossible again.
216  //
217  if (!FsRtlGetNextFileLock(&Fcb->FileLockAnchor, TRUE))
218  {
219  if (Fcb->Header.IsFastIoPossible != FastIoIsPossible)
220  {
221  FFSPrint((
222  DBG_INFO, ": %-16.16s %-31s %s\n",
224  "FastIoIsPossible",
225  Fcb->AnsiFileName.Buffer));
226 
227  Fcb->Header.IsFastIoPossible = FastIoIsPossible;
228  }
229  }
230  }
231 
232  if (IsFlagOn(FileObject->Flags, FO_CACHE_SUPPORTED) &&
233  (Fcb->NonCachedOpenCount != 0) &&
234  (Fcb->NonCachedOpenCount == Fcb->ReferenceCount) &&
235  (Fcb->SectionObject.DataSectionObject != NULL))
236  {
237 
238  if(!IsFlagOn(Vcb->Flags, VCB_READ_ONLY) &&
239  !IsFlagOn(Vcb->Flags, VCB_WRITE_PROTECTED))
240  {
241  CcFlushCache(&Fcb->SectionObject, NULL, 0, NULL);
242  }
243 
246 
247  CcPurgeCacheSection(&Fcb->SectionObject,
248  NULL,
249  0,
250  FALSE);
251  }
252 
253 #if !FFS_READ_ONLY
254  if (Fcb->OpenHandleCount == 0)
255  {
257  {
258  BOOLEAN bDeleted = FALSE;
259 
260  //
261  // Have to delete this file...
262  //
263 #ifdef _MSC_VER
264 #pragma prefast( suppress: 28137, "by design" )
265 #endif
268  IrpContext->IsSynchronous))
269  {
271  _SEH2_LEAVE;
272  }
273 
274  FcbPagingIoAcquired = TRUE;
275 
276  bDeleted = FFSDeleteFile(IrpContext, Vcb, Fcb);
277 
278  if (bDeleted)
279  {
280  if (IsDirectory(Fcb))
281  {
282  FFSNotifyReportChange(IrpContext, Vcb, Fcb,
285  }
286  else
287  {
288  FFSNotifyReportChange(IrpContext, Vcb, Fcb,
291  }
292  }
293 
294  if (FcbPagingIoAcquired)
295  {
299 
300  FcbPagingIoAcquired = FALSE;
301  }
302 
303 /*
304  if (bDeleted)
305  {
306  FFSPurgeFile(Fcb, FALSE);
307  }
308 */
309  }
310  }
311 #endif // !FFS_READ_ONLY
312 
313  if (!IsDirectory(Fcb) && FileObject->PrivateCacheMap)
314  {
315  FFSPrint((DBG_INFO, "FFSCleanup: CcUninitializeCacheMap is called for %s.\n",
316  Fcb->AnsiFileName.Buffer));
317 
319  FileObject,
320  (PLARGE_INTEGER)(&(Fcb->Header.FileSize)),
321  NULL);
322  }
323 
324  if (!Fcb->OpenHandleCount)
325  {
327  }
328 
329  FFSPrint((DBG_INFO, "FFSCleanup: OpenCount: %u ReferCount: %u %s\n",
330  Fcb->OpenHandleCount, Fcb->ReferenceCount, Fcb->AnsiFileName.Buffer));
331 
333 
334  if (FileObject)
335  {
337  }
338  }
339 
341  {
342 
343  if (FcbPagingIoAcquired)
344  {
348  }
349 
350  if (FcbResourceAcquired)
351  {
353  &Fcb->MainResource,
355  }
356 
357  if (VcbResourceAcquired)
358  {
360  &Vcb->MainResource,
362  }
363 
364  if (!IrpContext->ExceptionInProgress)
365  {
366  if (Status == STATUS_PENDING)
367  {
368  FFSQueueRequest(IrpContext);
369  }
370  else
371  {
372  IrpContext->Irp->IoStatus.Status = Status;
373 
374  FFSCompleteIrpContext(IrpContext, Status);
375  }
376  }
377  } _SEH2_END;
378 
379  return Status;
380 }
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
NTSTATUS FFSQueueRequest(IN PFFS_IRP_CONTEXT IrpContext)
Definition: dispatch.c:33
PEPROCESS NTAPI IoGetRequestorProcess(IN PIRP Irp)
Definition: irp.c:1782
Definition: ffsdrv.h:281
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:384
#define TRUE
Definition: types.h:120
__drv_mustHoldCriticalRegion BOOLEAN FFSDeleteFile(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb, PFFS_FCB Fcb)
Definition: fileinfo.c:1653
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
Definition: cachesub.c:222
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
VOID NTAPI FsRtlNotifyFullChangeDirectory(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext, IN PSTRING FullDirectoryName, IN BOOLEAN WatchTree, IN BOOLEAN IgnoreBuffer, IN ULONG CompletionFilter, IN PIRP NotifyIrp, IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL)
Definition: notify.c:1458
_In_ PIRP Irp
Definition: csq.h:116
LONG NTSTATUS
Definition: precomp.h:26
VOID FFSClearVpbFlag(IN PVPB Vpb, IN USHORT Flag)
Definition: fsctl.c:69
Definition: ffsdrv.h:283
#define FILE_NOTIFY_CHANGE_FILE_NAME
struct _FFS_FCB * PFFS_FCB
#define FILE_NOTIFY_CHANGE_DIR_NAME
VOID NTAPI IoRemoveShareAccess(IN PFILE_OBJECT FileObject, IN PSHARE_ACCESS ShareAccess)
Definition: file.c:3477
#define FCB_DELETE_PENDING
Definition: ext2fs.h:879
PDEVICE_OBJECT DeviceObject
Definition: ffsdrv.h:371
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define FCB_DELETE_ON_CLOSE
Definition: ffsdrv.h:633
NTSTATUS FFSFlushFile(IN PFFS_FCB Fcb)
Definition: flush.c:133
VOID NTAPI FsRtlNotifyCleanup(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext)
Definition: notify.c:635
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
#define FO_FILE_MODIFIED
Definition: iotypes.h:1744
NTFSIDENTIFIER Identifier
Definition: ntfs.h:499
#define VPB_LOCKED
Definition: iotypes.h:1764
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
Definition: ffsdrv.h:282
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define FILE_ACTION_REMOVED
struct _FFS_VCB * PFFS_VCB
#define FFSGetCurrentProcessName()
Definition: ffsdrv.h:1070
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
PFILE_LOCK_INFO NTAPI FsRtlGetNextFileLock(IN PFILE_LOCK FileLock, IN BOOLEAN Restart)
Definition: filelock.c:259
ULONG OpenHandleCount
Definition: ntfs.h:521
SHARE_ACCESS ShareAccess
Definition: cdstruc.h:1015
if(!(yy_init))
Definition: macro.lex.yy.c:714
#define STATUS_PENDING
Definition: ntstatus.h:82
#define Vcb
Definition: cdprocs.h:1425
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
* PFILE_OBJECT
Definition: iotypes.h:1954
#define FO_CACHE_SUPPORTED
Definition: iotypes.h:1737
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG Flags
Definition: ntfs.h:520
#define VCB_WRITE_PROTECTED
Definition: ext2fs.h:796
__drv_mustHoldCriticalRegion NTSTATUS FFSCompleteIrpContext(IN PFFS_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: read.c:53
_Must_inspect_result_ _In_ PFLT_INSTANCE _Out_ PBOOLEAN IsDirectory
Definition: fltkernel.h:1139
ULONG Type
Definition: ntfs.h:95
Definition: ffsdrv.h:280
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
NTSTATUS NTAPI FsRtlFastUnlockAll(IN PFILE_LOCK FileLock, IN PFILE_OBJECT FileObject, IN PEPROCESS Process, IN PVOID Context OPTIONAL)
Definition: filelock.c:1026
ERESOURCE MainResource
Definition: ntfs.h:512
#define VCB_READ_ONLY
Definition: ext2fs.h:795
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
Status
Definition: gdiplustypes.h:24
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
struct _FFS_CCB * PFFS_CCB
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
_SEH2_END
Definition: create.c:4424
#define VCB_FLOPPY_DISK
Definition: ext2fs.h:797
BOOLEAN NTAPI CcUninitializeCacheMap(IN PFILE_OBJECT FileObject, IN OPTIONAL PLARGE_INTEGER TruncateSize, IN OPTIONAL PCACHE_UNINITIALIZE_EVENT UninitializeEvent)
Definition: fssup.c:284
#define FO_CLEANUP_COMPLETE
Definition: iotypes.h:1746
_SEH2_FINALLY
Definition: create.c:4395
#define VCB_VOLUME_LOCKED
Definition: ext2fs.h:780
VOID FFSNotifyReportChange(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN PFFS_FCB Fcb, IN ULONG Filter, IN ULONG Action)
Definition: dirctl.c:1201
ERESOURCE PagingIoResource
Definition: ntfs.h:511
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define DBG_INFO
Definition: ffsdrv.h:1034
#define VCB_INITIALIZED
Definition: ext2fs.h:779
#define _SEH2_LEAVE
Definition: filesup.c:20
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2745
ULONG Size
Definition: ntfs.h:96

Referenced by FFSDispatchRequest().

◆ FFSClearVpbFlag()

VOID FFSClearVpbFlag ( IN PVPB  Vpb,
IN USHORT  Flag 
)

Definition at line 69 of file fsctl.c.

72 {
73  KIRQL OldIrql;
74 
76 
77  Vpb->Flags &= ~Flag;
78 
80 }
VOID NTAPI IoAcquireVpbSpinLock(OUT PKIRQL Irql)
Definition: volume.c:1201
UCHAR KIRQL
Definition: env_spec_w32.h:591
Definition: xml2sdb.h:79
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
VOID NTAPI IoReleaseVpbSpinLock(IN KIRQL Irql)
Definition: volume.c:1212
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1664

Referenced by FFSCleanup(), FFSClose(), and FFSUnlockVcb().

◆ FFSClose()

Definition at line 32 of file close.c.

34 {
37  PFFS_VCB Vcb = 0;
38  BOOLEAN VcbResourceAcquired = FALSE;
40  PFFS_FCB Fcb = 0;
41  BOOLEAN FcbResourceAcquired = FALSE;
42  PFFS_CCB Ccb;
43  BOOLEAN FreeVcb = FALSE;
44 
45  PAGED_CODE();
46 
47  _SEH2_TRY
48  {
49  ASSERT(IrpContext != NULL);
50 
51  ASSERT((IrpContext->Identifier.Type == FFSICX) &&
52  (IrpContext->Identifier.Size == sizeof(FFS_IRP_CONTEXT)));
53 
54  DeviceObject = IrpContext->DeviceObject;
55 
57  {
60  }
61 
63 
64  ASSERT(Vcb != NULL);
65 
66  ASSERT((Vcb->Identifier.Type == FFSVCB) &&
67  (Vcb->Identifier.Size == sizeof(FFS_VCB)));
68 
70 
72  &Vcb->MainResource,
73  IrpContext->IsSynchronous))
74  {
75  FFSPrint((DBG_INFO, "FFSClose: PENDING ... Vcb: %xh/%xh\n",
76  Vcb->OpenFileHandleCount, Vcb->ReferenceCount));
77 
80  }
81 
82  VcbResourceAcquired = TRUE;
83 
84  FileObject = IrpContext->FileObject;
85 
86  if (IsFlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_DELAY_CLOSE))
87  {
88  Fcb = IrpContext->Fcb;
89  Ccb = IrpContext->Ccb;
90  }
91  else
92  {
93  Fcb = (PFFS_FCB)FileObject->FsContext;
94 
95  if (!Fcb)
96  {
99  }
100 
101  ASSERT(Fcb != NULL);
102 
103  Ccb = (PFFS_CCB)FileObject->FsContext2;
104  }
105 
106  if (Fcb->Identifier.Type == FFSVCB)
107  {
108  Vcb->ReferenceCount--;
109 
110  if (!Vcb->ReferenceCount && FlagOn(Vcb->Flags, VCB_DISMOUNT_PENDING))
111  {
112  FreeVcb = TRUE;
113  }
114 
115  if (Ccb)
116  {
117  FFSFreeCcb(Ccb);
118  if (FileObject)
119  {
120  FileObject->FsContext2 = Ccb = NULL;
121  }
122  }
123 
125 
126  _SEH2_LEAVE;
127  }
128 
129  if