ReactOS  0.4.12-dev-919-gfc3b8d5
fatprocs.h File Reference
#include <ntifs.h>
#include <ntddscsi.h>
#include <scsi.h>
#include <ntddcdrm.h>
#include <ntdddisk.h>
#include <ntddstor.h>
#include <ntintsafe.h>
#include "nodetype.h"
#include "fat.h"
#include "lfn.h"
#include "fatstruc.h"
#include "fatdata.h"
Include dependency graph for fatprocs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _FAT_ENUMERATION_CONTEXT
 
union  _UCHAR1
 
union  _UCHAR2
 
union  _UCHAR4
 

Macros

#define INLINE   __inline
 
#define Add2Ptr(P, I)   ((PVOID)((PUCHAR)(P) + (I)))
 
#define MAX_ULONG   ((ULONG)-1)
 
#define MAX_USHORT   ((USHORT)-1)
 
#define FAT_CREATE_INITIAL_NAME_BUF_SIZE   32
 
#define FatUnpinBcb(IRPCONTEXT, BCB)
 
#define FatDirectoryKey(FcbOrDcb)   ((ULONGLONG)((FcbOrDcb)->CreationTime.QuadPart ^ (FcbOrDcb)->FirstClusterOfFile))
 
#define FatUpcaseEaName(IRPCONTEXT, NAME, UPCASEDNAME)   RtlUpperString( UPCASEDNAME, NAME )
 
#define SizeOfFullEa(EA)   (4+1+1+2+(EA)->EaNameLength+1+(EA)->EaValueLength)
 
#define FatAreNamesEqual(IRPCONTEXT, NAMEA, NAMEB)
 
#define FatIsNameShortOemValid(IRPCONTEXT, NAME, CAN_CONTAIN_WILD_CARDS, PATH_NAME_OK, LEADING_BACKSLASH_OK)
 
#define FatIsNameLongOemValid(IRPCONTEXT, NAME, CAN_CONTAIN_WILD_CARDS, PATH_NAME_OK, LEADING_BACKSLASH_OK)
 
#define FatAcquireExclusiveGlobal(IRPCONTEXT)
 
#define FatAcquireSharedGlobal(IRPCONTEXT)
 
#define FatAcquireExclusiveVolume(IRPCONTEXT, VCB)
 
#define FatReleaseVolume(IRPCONTEXT, VCB)
 
#define FatSetVcbCondition(V, X)   (V)->VcbCondition = (X)
 
#define FatIsFat32(VCB)   ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 32))
 
#define FatIsFat16(VCB)   ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 16))
 
#define FatIsFat12(VCB)   ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 12))
 
#define FatAcquireExclusiveVcb(IC, V)   FatAcquireExclusiveVcb_Real( IC, V, FALSE)
 
#define FatAcquireExclusiveVcbNoOpCheck(IC, V)   FatAcquireExclusiveVcb_Real( IC, V, TRUE)
 
#define FatVcbAcquiredExclusive(IRPCONTEXT, VCB)
 
#define FatFcbAcquiredShared(IRPCONTEXT, FCB)
 
#define FatFcbAcquiredExclusive(IRPCONTEXT, FCB)
 
#define FatAcquireDirectoryFileMutex(VCB)
 
#define FatReleaseDirectoryFileMutex(VCB)
 
#define FatConvertToSharedFcb(IRPCONTEXT, Fcb)
 
#define FatDeleteResource(RESRC)
 
#define FatReleaseGlobal(IRPCONTEXT)
 
#define FatReleaseVcb(IRPCONTEXT, Vcb)
 
#define FatReleaseFcb(IRPCONTEXT, Fcb)
 
#define FatGetFcbOplock(F)   &(F)->Header.Oplock
 
#define FatDeleteIrpContext(IRPCONTEXT)
 
#define FatGetFirstChild(DIR)
 
#define FatGetNextSibling(FILE)
 
#define FatIsRawDevice(IC, S)
 
#define CompareNames(NAMEA, NAMEB)
 
#define PtrOffset(BASE, OFFSET)   ((ULONG)((ULONG_PTR)(OFFSET) - (ULONG_PTR)(BASE)))
 
#define WordAlign(Ptr)
 
#define LongAlign(Ptr)
 
#define QuadAlign(Ptr)
 
#define CopyUchar1(Dst, Src)
 
#define CopyUchar2(Dst, Src)
 
#define CopyUchar4(Dst, Src)
 
#define CopyU4char(Dst, Src)
 
#define FatNotifyReportChange(I, V, F, FL, A)
 
#define CanFsdWait(IRP)   IoIsOperationSynchronous(Irp)
 
#define FatCompleteRequest(IRPCONTEXT, IRP, STATUS)
 
#define IsFileDeleted(IRPCONTEXT, FCB)
 
#define IsFileWriteThrough(FO, VCB)
 
#define FatIsFastIoPossible(FCB)
 
#define FatIsNodeTypeOplockable(N)
 
#define FatIsFileOplockable(F)
 
#define IsFileObjectReadOnly(FO)   (!((FO)->WriteAccess | (FO)->DeleteAccess))
 
#define DebugBreakOnStatus(S)
 
#define FatRaiseStatus(IRPCONTEXT, STATUS)
 
#define FatResetExceptionState(IRPCONTEXT)
 
#define FatNormalizeAndRaiseStatus(IRPCONTEXT, STATUS)
 
#define try_return(S)   { S; goto try_exit; }
 
#define try_leave(S)   { S; _SEH2_LEAVE; }
 
#define FatGenerateFileIdFromDirentOffset(ParentDcb, DirentOffset)
 
#define FatGenerateFileIdFromFcb(Fcb)   FatGenerateFileIdFromDirentOffset( (Fcb)->ParentDcb, (Fcb)->DirentOffsetWithinDirectory )
 
#define FATDOT   ((ULONG)0x2020202E)
 
#define FATDOTDOT   ((ULONG)0x20202E2E)
 
#define FatGenerateFileIdFromDirentAndOffset(Dcb, Dirent, DirentOffset)
 
#define FatDeviceIsFatFsdo(D)   (((D) == FatData.DiskFileSystemDeviceObject) || ((D) == FatData.CdromFileSystemDeviceObject))
 
#define BlockAlign(P, V)   ((ASSERT( V != 0)), (((P)) + (V-1) & (0-(V))))
 
#define BlockAlignTruncate(P, V)   ((P) & (0-(V)))
 
#define IsDirectory(FcbOrDcb)   ((NodeType((FcbOrDcb)) == FAT_NTC_DCB) || (NodeType((FcbOrDcb)) == FAT_NTC_ROOT_DCB))
 

Typedefs

typedef BOOLEAN FINISHED
 
typedef struct _FAT_ENUMERATION_CONTEXT FAT_ENUMERATION_CONTEXT
 
typedef struct _FAT_ENUMERATION_CONTEXTPFAT_ENUMERATION_CONTEXT
 
typedef enum _TYPE_OF_OPEN TYPE_OF_OPEN
 
typedef enum _FAT_FLUSH_TYPE FAT_FLUSH_TYPE
 
typedef enum _COMPARISON COMPARISON
 
typedef enum _FAT_VOLUME_STATE FAT_VOLUME_STATE
 
typedef enum _FAT_VOLUME_STATEPFAT_VOLUME_STATE
 
typedef union _UCHAR1 UCHAR1
 
typedef union _UCHAR1PUCHAR1
 
typedef union _UCHAR2 UCHAR2
 
typedef union _UCHAR2PUCHAR2
 
typedef union _UCHAR4 UCHAR4
 
typedef union _UCHAR4PUCHAR4
 

Enumerations

enum  _TYPE_OF_OPEN {
  UnopenedFileObject = 0, StreamFileOpen, UserVolumeOpen, UserDirectoryOpen,
  UserFileOpen, BeyondValidType, UnopenedFileObject = 1, UserFileOpen,
  UserDirectoryOpen, UserVolumeOpen, VirtualVolumeFile, DirectoryFile,
  EaFile
}
 
enum  _FAT_FLUSH_TYPE { NoFlush = 0, Flush, FlushAndInvalidate, FlushWithoutPurge }
 
enum  _COMPARISON { IsLessThan, IsGreaterThan, IsEqual }
 
enum  _FAT_VOLUME_STATE { VolumeClean, VolumeDirty, VolumeDirtyWithSurfaceTest }
 

Functions

VOID FatFreeStringBuffer (_Inout_ PVOID String)
 
VOID FatExtendString (_Inout_ PVOID String, _In_ USHORT DesiredBufferSize, _In_ BOOLEAN FreeOldBuffer, __out_opt PBOOLEAN NeedsFree)
 
VOID FatEnsureStringBufferEnough (_Inout_ PVOID String, _In_ USHORT DesiredBufferSize)
 
BOOLEAN FatAddMcbEntry (IN PVCB Vcb, IN PLARGE_MCB Mcb, IN VBO Vbo, IN LBO Lbo, IN ULONG SectorCount)
 
BOOLEAN FatLookupMcbEntry (IN PVCB Vcb, IN PLARGE_MCB Mcb, IN VBO Vbo, OUT PLBO Lbo, OUT PULONG ByteCount OPTIONAL, OUT PULONG Index OPTIONAL)
 
BOOLEAN FatLookupLastMcbEntry (IN PVCB Vcb, IN PLARGE_MCB Mcb, OUT PVBO Vbo, OUT PLBO Lbo, OUT PULONG Index OPTIONAL)
 
BOOLEAN FatGetNextMcbEntry (IN PVCB Vcb, IN PLARGE_MCB Mcb, IN ULONG RunIndex, OUT PVBO Vbo, OUT PLBO Lbo, OUT PULONG ByteCount)
 
VOID FatRemoveMcbEntry (IN PVCB Vcb, IN PLARGE_MCB Mcb, IN VBO Vbo, IN ULONG SectorCount)
 
BOOLEAN FatCheckFileAccess (PIRP_CONTEXT IrpContext, IN UCHAR DirentAttributes, IN PACCESS_MASK DesiredAccess)
 
BOOLEAN FatCheckManageVolumeAccess (_In_ PIRP_CONTEXT IrpContext, _In_ PACCESS_STATE AccessState, _In_ KPROCESSOR_MODE ProcessorMode)
 
NTSTATUS FatExplicitDeviceAccessGranted (IN PIRP_CONTEXT IrpContext, IN PDEVICE_OBJECT DeviceObject, IN PACCESS_STATE AccessState, IN KPROCESSOR_MODE ProcessorMode)
 
static INLINE BOOLEAN FatIsIoRangeValid (IN PVCB Vcb, IN LARGE_INTEGER Start, IN ULONG Length)
 
VOID FatLookupFatEntry (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN ULONG FatIndex, IN OUT PULONG FatEntry, IN OUT PFAT_ENUMERATION_CONTEXT Context)
 
VOID FatSetupAllocationSupport (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
VOID FatTearDownAllocationSupport (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
 _Requires_lock_held_ (_Global_critical_region_) VOID FatLookupFileAllocation(IN PIRP_CONTEXT IrpContext
 
UCHAR FatLogOf (IN ULONG Value)
 
VOID FatReadVolumeFile (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN VBO StartingVbo, IN ULONG ByteCount, OUT PBCB *Bcb, OUT PVOID *Buffer)
 
PFILE_OBJECT FatOpenEaFile (IN PIRP_CONTEXT IrpContext, IN PFCB EaFcb)
 
VOID FatCloseEaFile (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN BOOLEAN FlushFirst)
 
VOID FatRepinBcb (IN PIRP_CONTEXT IrpContext, IN PBCB Bcb)
 
VOID FatUnpinRepinnedBcbs (IN PIRP_CONTEXT IrpContext)
 
FINISHED FatZeroData (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PFILE_OBJECT FileObject, IN ULONG StartingZero, IN ULONG ByteCount)
 
NTSTATUS FatCompleteMdl (IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
 
VOID FatPinMappedData (IN PIRP_CONTEXT IrpContext, IN PDCB Dcb, IN VBO StartingVbo, IN ULONG ByteCount, OUT PBCB *Bcb)
 
NTSTATUS FatPrefetchPages (IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject, IN ULONG StartingPage, IN ULONG PageCount)
 
VOID FatInitializeCacheMap (_In_ PFILE_OBJECT FileObject, _In_ PCC_FILE_SIZES FileSizes, _In_ BOOLEAN PinAccess, _In_ PCACHE_MANAGER_CALLBACKS Callbacks, _In_ PVOID LazyWriteContext)
 
VOID FatSyncUninitializeCacheMap (IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject)
 
VOID FatPagingFileIo (IN PIRP Irp, IN PFCB Fcb)
 
VOID FatMultipleAsync (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PIRP Irp, IN ULONG MultipleIrpCount, IN PIO_RUN IoRuns)
 
VOID FatSingleAsync (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN LBO Lbo, IN ULONG ByteCount, IN PIRP Irp)
 
VOID FatWaitSync (IN PIRP_CONTEXT IrpContext)
 
VOID FatLockUserBuffer (IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp, IN LOCK_OPERATION Operation, IN ULONG BufferLength)
 
PVOID FatBufferUserBuffer (IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp, IN ULONG BufferLength)
 
PVOID FatMapUserBuffer (IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp)
 
NTSTATUS FatToggleMediaEjectDisable (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN BOOLEAN PreventRemoval)
 
NTSTATUS FatPerformDevIoCtrl (IN PIRP_CONTEXT IrpContext, IN ULONG IoControlCode, IN PDEVICE_OBJECT Device, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
 
PMDL FatBuildZeroMdl (__in PIRP_CONTEXT IrpContext, __in ULONG Length)
 
VOID FatTunnelFcbOrDcb (IN PFCB FcbOrDcb, IN PCCB Ccb OPTIONAL)
 
VOID FatConstructDirent (IN PIRP_CONTEXT IrpContext, IN OUT PDIRENT Dirent, IN POEM_STRING FileName, IN BOOLEAN ComponentReallyLowercase, IN BOOLEAN ExtensionReallyLowercase, IN PUNICODE_STRING Lfn OPTIONAL, IN USHORT Attributes, IN BOOLEAN ZeroAndSetTimeFields, IN PLARGE_INTEGER SetCreationTime OPTIONAL)
 
VOID FatConstructLabelDirent (IN PIRP_CONTEXT IrpContext, IN OUT PDIRENT Dirent, IN POEM_STRING Label)
 
VOID FatReadEaSet (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN USHORT EaHandle, IN POEM_STRING FileName, IN BOOLEAN ReturnEntireSet, OUT PEA_RANGE EaSetRange)
 
VOID FatDeletePackedEa (IN PIRP_CONTEXT IrpContext, IN OUT PEA_SET_HEADER EaSetHeader, IN OUT PULONG PackedEasLength, IN ULONG Offset)
 
VOID FatAppendPackedEa (IN PIRP_CONTEXT IrpContext, IN OUT PEA_SET_HEADER *EaSetHeader, IN OUT PULONG PackedEasLength, IN OUT PULONG AllocationLength, IN PFILE_FULL_EA_INFORMATION FullEa, IN ULONG BytesPerCluster)
 
ULONG FatLocateNextEa (IN PIRP_CONTEXT IrpContext, IN PPACKED_EA FirstPackedEa, IN ULONG PackedEasLength, IN ULONG PreviousOffset)
 
BOOLEAN FatLocateEaByName (IN PIRP_CONTEXT IrpContext, IN PPACKED_EA FirstPackedEa, IN ULONG PackedEasLength, IN POEM_STRING EaName, OUT PULONG Offset)
 
BOOLEAN FatIsEaNameValid (IN PIRP_CONTEXT IrpContext, IN OEM_STRING Name)
 
VOID FatPinEaRange (IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT VirtualEaFile, IN PFCB EaFcb, IN OUT PEA_RANGE EaRange, IN ULONG StartingVbo, IN ULONG Length, IN NTSTATUS ErrorStatus)
 
VOID FatMarkEaRangeDirty (IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT EaFileObject, IN OUT PEA_RANGE EaRange)
 
VOID FatUnpinEaRange (IN PIRP_CONTEXT IrpContext, IN OUT PEA_RANGE EaRange)
 
VOID FatSetFileObject (IN PFILE_OBJECT FileObject OPTIONAL, IN TYPE_OF_OPEN TypeOfOpen, IN PVOID VcbOrFcbOrDcb, IN PCCB Ccb OPTIONAL)
 
TYPE_OF_OPEN FatDecodeFileObject (_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
 
BOOLEAN FatIsBootSectorFat (IN PPACKED_BOOT_SECTOR BootSector)
 
NTSTATUS FatUnlockVolumeInternal (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PFILE_OBJECT FileObject OPTIONAL)
 
static INLINE BOOLEAN FatIsNameLongUnicodeValid (PIRP_CONTEXT IrpContext, PUNICODE_STRING Name, BOOLEAN CanContainWildcards, BOOLEAN PathNameOk, BOOLEAN LeadingBackslashOk)
 
BOOLEAN FatIsNameInExpression (IN PIRP_CONTEXT IrpContext, IN OEM_STRING Expression, IN OEM_STRING Name)
 
VOID FatStringTo8dot3 (_In_ PIRP_CONTEXT IrpContext, _In_ OEM_STRING InputString, _Out_writes_bytes_(11) PFAT8DOT3 Output8dot3)
 
VOID Fat8dot3ToString (_In_ PIRP_CONTEXT IrpContext, _In_ PDIRENT Dirent, _In_ BOOLEAN RestoreCase, _Out_ POEM_STRING OutputString)
 
VOID FatSetFullNameInFcb (_In_ PIRP_CONTEXT IrpContext, _Inout_ PFCB Fcb, _In_ PUNICODE_STRING FinalName)
 
VOID FatUnicodeToUpcaseOem (IN PIRP_CONTEXT IrpContext, IN POEM_STRING OemString, IN PUNICODE_STRING UnicodeString)
 
VOID FatEvaluateNameCase (IN PIRP_CONTEXT IrpContext, IN PUNICODE_STRING Name, IN OUT BOOLEAN *AllLowerComponent, IN OUT BOOLEAN *AllLowerExtension, IN OUT BOOLEAN *CreateLfn)
 
BOOLEAN FatSpaceInName (IN PIRP_CONTEXT IrpContext, IN PUNICODE_STRING UnicodeName)
 
VOID FatUnicodeRestoreShortNameCase (IN PUNICODE_STRING ShortNameWithCase, IN BOOLEAN LowerCase8, IN BOOLEAN LowerCase3)
 
 _Acquires_exclusive_lock_ (Vcb->Resource)) FINISHED FatAcquireExclusiveVcb_Real(IN PIRP_CONTEXT IrpContext
 
 _Acquires_shared_lock_ (Vcb->Resource)) FINISHED FatAcquireSharedVcb(IN PIRP_CONTEXT IrpContext
 
_Acquires_shared_lock_ Fcb FINISHED FatAcquireSharedFcbWaitForEx (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb)
 
BOOLEAN FatAcquireVolumeForClose (IN PVOID Vcb, IN BOOLEAN Wait)
 
VOID FatReleaseVolumeFromClose (IN PVOID Vcb)
 
 _Function_class_ (FAST_IO_ACQUIRE_FOR_CCFLUSH) _Requires_lock_held_(_Global_critical_region_) NTSTATUS NTAPI FatAcquireForCcFlush(IN PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_RELEASE_FOR_CCFLUSH) _Requires_lock_held_(_Global_critical_region_) NTSTATUS NTAPI FatReleaseForCcFlush(IN PFILE_OBJECT FileObject
 
BOOLEAN NTAPI FatNoOpAcquire (IN PVOID Fcb, IN BOOLEAN Wait)
 
VOID NTAPI FatNoOpRelease (IN PVOID Fcb)
 
VOID FatTearDownVcb (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
VOID FatDeleteVcb (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
PFCB FatCreateFcb (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PDCB ParentDcb, IN ULONG LfnOffsetWithinDirectory, IN ULONG DirentOffsetWithinDirectory, IN PDIRENT Dirent, IN PUNICODE_STRING Lfn OPTIONAL, IN PUNICODE_STRING OrigLfn OPTIONAL, IN BOOLEAN IsPagingFile, IN BOOLEAN SingleResource)
 
PDCB FatCreateDcb (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN PDCB ParentDcb, IN ULONG LfnOffsetWithinDirectory, IN ULONG DirentOffsetWithinDirectory, IN PDIRENT Dirent, IN PUNICODE_STRING Lfn OPTIONAL)
 
VOID FatDeleteFcb (IN PIRP_CONTEXT IrpContext, IN PFCB *Fcb)
 
PCCB FatCreateCcb (IN PIRP_CONTEXT IrpContext)
 
VOID FatDeallocateCcbStrings (IN PCCB Ccb)
 
VOID FatDeleteCcb (IN PIRP_CONTEXT IrpContext, IN PCCB *Ccb)
 
PIRP_CONTEXT FatCreateIrpContext (IN PIRP Irp, IN BOOLEAN Wait)
 
VOID FatDeleteIrpContext_Real (IN PIRP_CONTEXT IrpContext)
 
PFCB FatGetNextFcbTopDown (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PFCB TerminationFcb)
 
PFCB FatGetNextFcbBottomUp (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PFCB TerminationFcb)
 
VOID FatConstructNamesInFcb (IN PIRP_CONTEXT IrpContext, PFCB Fcb, PDIRENT Dirent, PUNICODE_STRING Lfn OPTIONAL)
 
ULONG FatVolumeUncleanCount (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
VOID FatPreallocateCloseContext (IN PVCB Vcb)
 
PCLOSE_CONTEXT FatAllocateCloseContext (IN PVCB Vcb)
 
VOID FatInsertName (IN PIRP_CONTEXT IrpContext, IN PRTL_SPLAY_LINKS *RootNode, IN PFILE_NAME_NODE Name)
 
VOID FatRemoveNames (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb)
 
PFCB FatFindFcb (IN PIRP_CONTEXT IrpContext, IN OUT PRTL_SPLAY_LINKS *RootNode, IN PSTRING Name, OUT PBOOLEAN FileNameDos OPTIONAL)
 
BOOLEAN FatIsHandleCountZero (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
COMPARISON FatCompareNames (IN PSTRING NameA, IN PSTRING NameB)
 
 _Success_ (return !=FALSE) BOOLEAN FatNtTimeToFatTime(_In_ PIRP_CONTEXT IrpContext
 
LARGE_INTEGER FatFatTimeToNtTime (_In_ PIRP_CONTEXT IrpContext, _In_ FAT_TIME_STAMP FatTime, _In_ UCHAR TenMilliSeconds)
 
LARGE_INTEGER FatFatDateToNtTime (_In_ PIRP_CONTEXT IrpContext, _In_ FAT_DATE FatDate)
 
FAT_TIME_STAMP FatGetCurrentFatTime (_In_ PIRP_CONTEXT IrpContext)
 
VOID FatMarkFcbCondition (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN FCB_CONDITION FcbCondition, IN BOOLEAN Recursive)
 
VOID FatVerifyVcb (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
VOID NTAPI FatCleanVolumeDpc (_In_ PKDPC Dpc, _In_opt_ PVOID DeferredContext, _In_opt_ PVOID SystemArgument1, _In_opt_ PVOID SystemArgument2)
 
VOID NTAPI FatFspMarkVolumeDirtyWithRecover (PVOID Parameter)
 
VOID FatCheckDirtyBit (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
VOID FatQuickVerifyVcb (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
VOID FatVerifyOperationIsLegal (IN PIRP_CONTEXT IrpContext)
 
VOID NTAPI FatOplockComplete (IN PVOID Context, IN PIRP Irp)
 
VOID NTAPI FatPrePostIrp (IN PVOID Context, IN PIRP Irp)
 
VOID FatAddToWorkque (IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
 
NTSTATUS FatFsdPostRequest (IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
 
 _Function_class_ (IRP_MJ_CLEANUP) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdCleanup(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_CLOSE) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdClose(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_CREATE) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdCreate(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_DEVICE_CONTROL) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdDeviceControl(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_DIRECTORY_CONTROL) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdDirectoryControl(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_QUERY_EA) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdQueryEa(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_SET_EA) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdSetEa(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_QUERY_INFORMATION) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdQueryInformation(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_SET_INFORMATION) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdSetInformation(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_FLUSH_BUFFERS) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdFlushBuffers(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_FILE_SYSTEM_CONTROL) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdFileSystemControl(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_LOCK_CONTROL) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdLockControl(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_PNP) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdPnp(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_READ) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdRead(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_SHUTDOWN) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdShutdown(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_QUERY_VOLUME_INFORMATION) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdQueryVolumeInformation(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_SET_VOLUME_INFORMATION) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdSetVolumeInformation(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
 _Function_class_ (IRP_MJ_WRITE) _Function_class_(DRIVER_DISPATCH) NTSTATUS NTAPI FatFsdWrite(_In_ PVOLUME_DEVICE_OBJECT VolumeDeviceObject
 
VOID NTAPI FatFspDispatch (_In_ PVOID Context)
 
NTSTATUS FatCommonQueryEa (IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
 
NTSTATUS FatCommonSetEa (IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
 
NTSTATUS FatFlushFat (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb)
 
NTSTATUS FatHijackIrpAndFlushDevice (IN PIRP_CONTEXT IrpContext, IN PIRP Irp, IN PDEVICE_OBJECT TargetDeviceObject)
 
VOID FatFlushFatEntries (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN ULONG Cluster, IN ULONG Count)
 
VOID FatFlushDirentForFile (IN PIRP_CONTEXT IrpContext, IN PFCB Fcb)
 
VOID FatCompleteRequest_Real (IN PIRP_CONTEXT IrpContext, IN PIRP Irp, IN NTSTATUS Status)
 
BOOLEAN FatIsIrpTopLevel (IN PIRP Irp)
 
 _Function_class_ (FAST_IO_CHECK_IF_POSSIBLE) BOOLEAN NTAPI FatFastIoCheckIfPossible(IN PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_QUERY_BASIC_INFO) BOOLEAN NTAPI FatFastQueryBasicInfo(IN PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_QUERY_STANDARD_INFO) BOOLEAN NTAPI FatFastQueryStdInfo(IN PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_QUERY_NETWORK_OPEN_INFO) BOOLEAN NTAPI FatFastQueryNetworkOpenInfo(IN PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_LOCK) BOOLEAN NTAPI FatFastLock(IN PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_UNLOCK_SINGLE) BOOLEAN NTAPI FatFastUnlockSingle(IN PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_UNLOCK_ALL) BOOLEAN NTAPI FatFastUnlockAll(IN PFILE_OBJECT FileObject
 
 _Function_class_ (FAST_IO_UNLOCK_ALL_BY_KEY) BOOLEAN NTAPI FatFastUnlockAllByKey(IN PFILE_OBJECT FileObject
 
VOID FatExamineFatEntries (IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN ULONG StartIndex OPTIONAL, IN ULONG EndIndex OPTIONAL, IN BOOLEAN SetupWindows, IN PFAT_WINDOW SwitchToWindow OPTIONAL, IN PULONG BitMapBuffer OPTIONAL)
 
BOOLEAN FatScanForDataTrack (IN PIRP_CONTEXT IrpContext, IN PDEVICE_OBJECT TargetDeviceObject)
 
ULONG FatExceptionFilter (IN PIRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
 
CLUSTER_TYPE FatInterpretClusterType (IN PVCB Vcb, IN FAT_ENTRY Entry)
 

Variables

IN PFCB FcbOrDcb
 
IN PFCB IN VBO Vbo
 
IN PFCB IN VBO OUT PLBO Lbo
 
IN PFCB IN VBO OUT PLBO OUT PULONG ByteCount
 
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN Allocated
 
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN OUT PBOOLEAN EndOnMax
 
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN OUT PBOOLEAN OUT PULONG Index OPTIONAL
 
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
 
IN PVCB Vcb
 
IN PVCB IN ULONG AbsoluteClusterHint
 
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN ExactMatchRequired
 
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
 
IN PVCB IN PLARGE_MCB IN BOOLEAN ZeroOnDeallocate
 
IN PVCB IN OUT PLARGE_MCB IN VBO SplitAtVbo
 
IN PVCB IN OUT PLARGE_MCB IN VBO OUT PLARGE_MCB RemainingMcb
 
IN PVCB IN OUT PLARGE_MCB IN PLARGE_MCB SecondMcb
 
IN PVCB IN ULONG FatIndex
 
IN PVCB IN ULONG IN FAT_ENTRY FatEntry
 
IN PVCB IN VBO StartingVbo
 
IN PVCB IN VBO IN ULONG OUT PBCBBcb
 
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOIDBuffer
 
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN Reversible
 
IN PVCB IN VBO IN ULONG OUT PBCB OUT PVOID IN BOOLEAN IN BOOLEAN Zero
 
IN PDCB Dcb
 
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
 
IN PDCB IN VBO IN ULONG IN BOOLEAN OUT PBCB OUT PVOID OUT PNTSTATUS Status
 
IN PIRP Irp
 
IN PIRP IN PFCB IN ULONG IN ULONG IN ULONG UserByteCount
 
IN PIRP IN PFCB IN ULONG IN ULONG IN ULONG IN ULONG StreamFlags
 
IN PDCB ParentDirectory
 
IN PDCB IN ULONG DirentsNeeded
 
IN PDCB IN ULONG IN BOOLEAN RescanDir
 
IN PDCB IN PDIRENT ParentDirent
 
IN PFCB IN PDELETE_CONTEXT DeleteContext IN BOOLEAN DeleteEa
 
IN PDCB IN PCCB Ccb
 
IN PDCB IN PCCB IN VBO OffsetToStartSearchFrom
 
IN PDCB IN PCCB IN VBO IN OUT PULONG Flags
 
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENTDirent
 
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
 
IN PDCB IN POEM_STRING FileName
 
IN PDCB IN PUNICODE_STRING Lfn
 
IN PDCB IN PUNICODE_STRING IN PUNICODE_STRING LfnTmp
 
IN PFCB IN BOOLEAN ReturnOnFailure
 
IN PDCB TargetDcb
 
IN PDCB IN ULONG LfnOffset
 
IN PDCB IN ULONG IN ULONG DirentOffset
 
IN PFCB Fcb
 
IN PFILE_OBJECT FileObject
 
IN PVCB IN PDIRENT OUT PULONG EaLength
 
IN PVCB IN PDIRENT OUT PULONG NeedEaCount
 
IN PVCB IN PUCHAR IN ULONG Length
 
IN PVCB IN PUCHAR IN ULONG IN POEM_STRING OUT PUSHORT EaHandle
 
IN OUT PVCB OUT PDIRENTEaDirent
 
IN OUT PVCB OUT PDIRENT OUT PBCBEaBcb
 
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN CreateFile
 
IN OUT PVCB OUT PDIRENT OUT PBCB IN BOOLEAN IN BOOLEAN ExclusiveFcb
 
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
 
IN PVCB IN ULONG EaSetLength
 
IN PVCB IN ULONG IN PBCB OUT PDIRENT OUT PUSHORT OUT PEA_RANGE EaSetRange
 
IN PFCB IN FAT_FLUSH_TYPE FlushType
 
IN PDCB Parent
 
IN PDCB IN POEM_STRING OemName
 
IN PDCB IN POEM_STRING IN PUNICODE_STRING UnicodeName
 
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING ShortName
 
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING IN PUNICODE_STRING SuggestedShortName IN OUT BOOLEANAllLowerComponent
 
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING IN PUNICODE_STRING SuggestedShortName IN OUT BOOLEAN IN OUT BOOLEANAllLowerExtension
 
IN PDCB IN POEM_STRING IN PUNICODE_STRING IN OUT POEM_STRING IN PUNICODE_STRING SuggestedShortName IN OUT BOOLEAN IN OUT BOOLEAN IN OUT BOOLEANCreateLfn
 
IN PVCB IN BOOLEAN NoOpCheck
 
IN BOOLEAN Wait
 
IN PDEVICE_OBJECT DeviceObject
 
OUT PVOIDCompletionContext
 
IN OUT PVCB IN PDEVICE_OBJECT TargetDeviceObject
 
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
 
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB IN PDEVICE_OBJECT FsDeviceObject
 
PVCB IN BOOLEAN Force
 
_In_ PLARGE_INTEGER NtTime
 
_In_ PLARGE_INTEGER _In_ BOOLEAN Rounding
 
_In_ PLARGE_INTEGER _In_ BOOLEAN _Out_ PFAT_TIME_STAMP FatTime
 
_In_ PLARGE_INTEGER _In_ BOOLEAN _Out_ PFAT_TIME_STAMP _Out_opt_ PUCHAR TenMsecs
 
KDEFERRED_ROUTINE FatCleanVolumeDpc
 
IN PVCB IN FAT_VOLUME_STATE VolumeState
 
WORKER_THREAD_ROUTINE FatFspMarkVolumeDirtyWithRecover
 
_In_ PIRP _In_ PDEVICE_OBJECT Device
 
WORKER_THREAD_ROUTINE FatFspDispatch
 
IN PFCB IN PCCB IN TYPE_OF_OPEN TypeOfOpen
 
IN PFCB IN PCCB IN TYPE_OF_OPEN IN BOOLEAN IN BOOLEAN TopLevel
 
IN PLARGE_INTEGER FileOffset
 
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
 
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN CheckForReadOperation
 
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
 
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
 
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG Key
 
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN FailImmediately
 
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN BOOLEAN ExclusiveLock
 
IN PIRP IN NTSTATUS ExceptionCode
 

Macro Definition Documentation

◆ Add2Ptr

#define Add2Ptr (   P,
  I 
)    ((PVOID)((PUCHAR)(P) + (I)))

Definition at line 71 of file fatprocs.h.

◆ BlockAlign

#define BlockAlign (   P,
  V 
)    ((ASSERT( V != 0)), (((P)) + (V-1) & (0-(V))))

Definition at line 3091 of file fatprocs.h.

◆ BlockAlignTruncate

#define BlockAlignTruncate (   P,
  V 
)    ((P) & (0-(V)))

Definition at line 3092 of file fatprocs.h.

◆ CanFsdWait

#define CanFsdWait (   IRP)    IoIsOperationSynchronous(Irp)

Definition at line 2358 of file fatprocs.h.

◆ CompareNames

#define CompareNames (   NAMEA,
  NAMEB 
)
Value:
( \
*(PUCHAR)(NAMEA)->Buffer != *(PUCHAR)(NAMEB)->Buffer ? \
*(PUCHAR)(NAMEA)->Buffer < *(PUCHAR)(NAMEB)->Buffer ? \
IsLessThan : IsGreaterThan : \
FatCompareNames((PSTRING)(NAMEA), (PSTRING)(NAMEB)) \
)
unsigned char * PUCHAR
Definition: retypes.h:3

Definition at line 1890 of file fatprocs.h.

◆ CopyU4char

#define CopyU4char (   Dst,
  Src 
)
Value:
{ \
*((UNALIGNED UCHAR4 *)(Dst)) = *((UCHAR4 *)(Src)); \
}
#define UNALIGNED
Definition: crtdefs.h:132
#define Dst
Definition: mesh.h:153

Definition at line 2141 of file fatprocs.h.

◆ CopyUchar1

#define CopyUchar1 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
}
#define UNALIGNED
Definition: crtdefs.h:132
#define Dst
Definition: mesh.h:153

Definition at line 2121 of file fatprocs.h.

◆ CopyUchar2

#define CopyUchar2 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
}
#define UNALIGNED
Definition: crtdefs.h:132
#define Dst
Definition: mesh.h:153

Definition at line 2129 of file fatprocs.h.

◆ CopyUchar4

#define CopyUchar4 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
}
#define UNALIGNED
Definition: crtdefs.h:132
#define Dst
Definition: mesh.h:153

Definition at line 2137 of file fatprocs.h.

◆ DebugBreakOnStatus

#define DebugBreakOnStatus (   S)

Definition at line 2962 of file fatprocs.h.

◆ FAT_CREATE_INITIAL_NAME_BUF_SIZE

#define FAT_CREATE_INITIAL_NAME_BUF_SIZE   32

Definition at line 102 of file fatprocs.h.

◆ FatAcquireDirectoryFileMutex

#define FatAcquireDirectoryFileMutex (   VCB)
Value:
{ \
NT_ASSERT(KeAreApcsDisabled()); \
ExAcquireFastMutexUnsafe(&(VCB)->DirectoryFileCreationMutex); \
}
Definition: cdstruc.h:504
BOOLEAN NTAPI KeAreApcsDisabled(VOID)
Definition: apc.c:958

Definition at line 1499 of file fatprocs.h.

◆ FatAcquireExclusiveGlobal

#define FatAcquireExclusiveGlobal (   IRPCONTEXT)
Value:
( \
ExAcquireResourceExclusiveLite( &FatData.Resource, BooleanFlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT) ) \
)
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1221
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
FAT_DATA FatData
Definition: fatdata.c:56
ERESOURCE Resource
Definition: fatstruc.h:64

Definition at line 1378 of file fatprocs.h.

◆ FatAcquireExclusiveVcb

#define FatAcquireExclusiveVcb (   IC,
  V 
)    FatAcquireExclusiveVcb_Real( IC, V, FALSE)

Definition at line 1451 of file fatprocs.h.

◆ FatAcquireExclusiveVcbNoOpCheck

#define FatAcquireExclusiveVcbNoOpCheck (   IC,
  V 
)    FatAcquireExclusiveVcb_Real( IC, V, TRUE)

Definition at line 1452 of file fatprocs.h.

◆ FatAcquireExclusiveVolume

#define FatAcquireExclusiveVolume (   IRPCONTEXT,
  VCB 
)
Value:
{ \
PFCB __FFFFFcb = NULL; \
NT_ASSERT(FlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT)); \
(VOID)FatAcquireExclusiveVcb( (IRPCONTEXT), (VCB) ); \
while ( (__FFFFFcb = FatGetNextFcbBottomUp((IRPCONTEXT), __FFFFFcb, (VCB)->RootDcb)) != NULL) { \
(VOID)FatAcquireExclusiveFcb((IRPCONTEXT), __FFFFFcb ); \
} \
}
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1221
Definition: cdstruc.h:504
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
struct _VCB VCB
smooth NULL
Definition: ftsmooth.c:416
PFCB FatGetNextFcbBottomUp(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PFCB TerminationFcb)
Definition: strucsup.c:2524
#define VOID
Definition: acefi.h:82
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define FatAcquireExclusiveVcb(IC, V)
Definition: fatprocs.h:1451

Definition at line 1400 of file fatprocs.h.

◆ FatAcquireSharedGlobal

#define FatAcquireSharedGlobal (   IRPCONTEXT)
Value:
( \
ExAcquireResourceSharedLite( &FatData.Resource, BooleanFlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT) ) \
)
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1221
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
FAT_DATA FatData
Definition: fatdata.c:56
ERESOURCE Resource
Definition: fatstruc.h:64

Definition at line 1382 of file fatprocs.h.

◆ FatAreNamesEqual

#define FatAreNamesEqual (   IRPCONTEXT,
  NAMEA,
  NAMEB 
)
Value:
( \
((ULONG)(NAMEA).Length == (ULONG)(NAMEB).Length) && \
(RtlEqualMemory( &(NAMEA).Buffer[0], \
&(NAMEB).Buffer[0], \
(NAMEA).Length )) \
)
Definition: bufpool.h:45
NTSYSAPI ULONG NTAPI RtlEqualMemory(CONST VOID *Source1, CONST VOID *Source2, ULONG Length)
unsigned int ULONG
Definition: retypes.h:1

Definition at line 1149 of file fatprocs.h.

◆ FatCompleteRequest

#define FatCompleteRequest (   IRPCONTEXT,
  IRP,
  STATUS 
)
Value:
{ \
FatCompleteRequest_Real(IRPCONTEXT,IRP,STATUS); \
}
IRP
Definition: iotypes.h:2462
#define STATUS
Definition: blue.h:128

Definition at line 2621 of file fatprocs.h.

◆ FatConvertToSharedFcb

#define FatConvertToSharedFcb (   IRPCONTEXT,
  Fcb 
)
Value:
{ \
ExConvertExclusiveToSharedLite( (Fcb)->Header.Resource ); \
}
Definition: Header.h:8
IN PFCB Fcb
Definition: fatprocs.h:811

Definition at line 1600 of file fatprocs.h.

◆ FatDeleteIrpContext

#define FatDeleteIrpContext (   IRPCONTEXT)
Value:
{ \
FatDeleteIrpContext_Real((IRPCONTEXT)); \
}

Definition at line 1753 of file fatprocs.h.

◆ FatDeleteResource

#define FatDeleteResource (   RESRC)
Value:
{ \
ExDeleteResourceLite( (RESRC) ); \
}

Definition at line 1623 of file fatprocs.h.

◆ FatDeviceIsFatFsdo

#define FatDeviceIsFatFsdo (   D)    (((D) == FatData.DiskFileSystemDeviceObject) || ((D) == FatData.CdromFileSystemDeviceObject))

Definition at line 3083 of file fatprocs.h.

◆ FatDirectoryKey

#define FatDirectoryKey (   FcbOrDcb)    ((ULONGLONG)((FcbOrDcb)->CreationTime.QuadPart ^ (FcbOrDcb)->FirstClusterOfFile))

Definition at line 841 of file fatprocs.h.

◆ FATDOT

#define FATDOT   ((ULONG)0x2020202E)

Definition at line 3062 of file fatprocs.h.

◆ FATDOTDOT

#define FATDOTDOT   ((ULONG)0x20202E2E)

Definition at line 3063 of file fatprocs.h.

◆ FatFcbAcquiredExclusive

#define FatFcbAcquiredExclusive (   IRPCONTEXT,
  FCB 
)
Value:
( \
ExIsResourceAcquiredExclusiveLite((FCB)->Header.Resource) \
)
Definition: cdstruc.h:908
Definition: Header.h:8

Definition at line 1495 of file fatprocs.h.

◆ FatFcbAcquiredShared

#define FatFcbAcquiredShared (   IRPCONTEXT,
  FCB 
)
Value:
( \
ExIsResourceAcquiredSharedLite((FCB)->Header.Resource) \
)
Definition: cdstruc.h:908
Definition: Header.h:8

Definition at line 1491 of file fatprocs.h.

◆ FatGenerateFileIdFromDirentAndOffset

#define FatGenerateFileIdFromDirentAndOffset (   Dcb,
  Dirent,
  DirentOffset 
)
Value:
((*((PULONG)(Dirent)->FileName)) == FATDOT ? FatGenerateFileIdFromFcb(Dcb) : \
((*((PULONG)(Dirent)->FileName)) == FATDOTDOT ? ((Dcb)->ParentDcb ? \
0) : \
IN PDCB Dcb
Definition: fatprocs.h:415
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT * Dirent
Definition: fatprocs.h:716
#define FatGenerateFileIdFromDirentOffset(ParentDcb, DirentOffset)
Definition: fatprocs.h:3042
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB ParentDcb
Definition: create.c:4157
#define FATDOT
Definition: fatprocs.h:3062
#define FATDOTDOT
Definition: fatprocs.h:3063
IN PDCB IN ULONG IN ULONG DirentOffset
Definition: fatprocs.h:779
#define FatGenerateFileIdFromFcb(Fcb)
Definition: fatprocs.h:3054
unsigned int * PULONG
Definition: retypes.h:1

Definition at line 3065 of file fatprocs.h.

◆ FatGenerateFileIdFromDirentOffset

#define FatGenerateFileIdFromDirentOffset (   ParentDcb,
  DirentOffset 
)
Value:
FatGetLboFromIndex( (ParentDcb)->Vcb, \
(ParentDcb)->FirstClusterOfFile ) : \
(ParentDcb)->Vcb->AllocationSupport.RootDirectoryLbo) + \
: \
0)
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB ParentDcb
Definition: create.c:4157
IN PVCB Vcb
Definition: fatprocs.h:334
NodeType
Definition: Node.h:5
IN PDCB IN ULONG IN ULONG DirentOffset
Definition: fatprocs.h:779
#define FatIsFat32(VCB)
Definition: fatprocs.h:1437
#define FAT_NTC_ROOT_DCB
Definition: nodetype.h:31

Definition at line 3042 of file fatprocs.h.

◆ FatGenerateFileIdFromFcb

#define FatGenerateFileIdFromFcb (   Fcb)    FatGenerateFileIdFromDirentOffset( (Fcb)->ParentDcb, (Fcb)->DirentOffsetWithinDirectory )

Definition at line 3054 of file fatprocs.h.

◆ FatGetFcbOplock

#define FatGetFcbOplock (   F)    &(F)->Header.Oplock

Definition at line 1647 of file fatprocs.h.

◆ FatGetFirstChild

#define FatGetFirstChild (   DIR)
Value:
((PFCB)( \
IsListEmpty(&(DIR)->Specific.Dcb.ParentDcbQueue) ? NULL : \
CONTAINING_RECORD((DIR)->Specific.Dcb.ParentDcbQueue.Flink, \
DCB, \
ParentDcbLinks.Flink)))
Definition: cdstruc.h:908
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
Definition: dirent.h:39
smooth NULL
Definition: ftsmooth.c:416
FCB * PFCB
Definition: cdstruc.h:1046

Definition at line 1776 of file fatprocs.h.

◆ FatGetNextSibling

#define FatGetNextSibling (   FILE)
Value:
((PFCB)( \
&(FILE)->ParentDcb->Specific.Dcb.ParentDcbQueue.Flink == \
(PVOID)(FILE)->ParentDcbLinks.Flink ? NULL : \
CONTAINING_RECORD((FILE)->ParentDcbLinks.Flink, \
FCB, \
ParentDcbLinks.Flink)))
Definition: cdstruc.h:908
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
FCB * PFCB
Definition: cdstruc.h:1046

Definition at line 1782 of file fatprocs.h.

◆ FatIsFastIoPossible

#define FatIsFastIoPossible (   FCB)
Value:
((BOOLEAN) \
((((FCB)->FcbCondition != FcbGood) || \
(NodeType( (FCB) ) != FAT_NTC_FCB) || \
FastIoIsNotPossible \
: \
(!FsRtlAreThereCurrentFileLocks( &(FCB)->Specific.Fcb.FileLock ) && \
((FCB)->NonPaged->OutstandingAsyncWrites == 0) && \
FastIoIsPossible \
: \
FastIoIsQuestionable \
) \
) \
)
Definition: cdstruc.h:908
#define VCB_STATE_FLAG_WRITE_PROTECTED
Definition: fatstruc.h:566
ULONG VcbState
Definition: cdstruc.h:546
IN PVCB Vcb
Definition: fatprocs.h:334
#define FatGetFcbOplock(F)
Definition: fatprocs.h:1647
struct _FCB FCB
NodeType
Definition: Node.h:5
#define FsRtlAreThereCurrentFileLocks(FL)
Definition: fsrtlfuncs.h:1584
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define BOOLEAN
Definition: pedump.c:73
BOOLEAN NTAPI FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
Definition: oplock.c:1566
#define FAT_NTC_FCB
Definition: nodetype.h:29

Definition at line 2801 of file fatprocs.h.

◆ FatIsFat12

#define FatIsFat12 (   VCB)    ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 12))

Definition at line 1439 of file fatprocs.h.

◆ FatIsFat16

#define FatIsFat16 (   VCB)    ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 16))

Definition at line 1438 of file fatprocs.h.

◆ FatIsFat32

#define FatIsFat32 (   VCB)    ((BOOLEAN)((VCB)->AllocationSupport.FatIndexBitSize == 32))

Definition at line 1437 of file fatprocs.h.

◆ FatIsFileOplockable

#define FatIsFileOplockable (   F)
Value:
( \
FatIsNodeTypeOplockable( NodeType( (F) )) \
)
NodeType
Definition: Node.h:5
#define F(x, y, z)
Definition: md5.c:51

Definition at line 2839 of file fatprocs.h.

◆ FatIsNameLongOemValid

#define FatIsNameLongOemValid (   IRPCONTEXT,
  NAME,
  CAN_CONTAIN_WILD_CARDS,
  PATH_NAME_OK,
  LEADING_BACKSLASH_OK 
)
Value:
( \
FsRtlIsHpfsDbcsLegal((NAME), \
(CAN_CONTAIN_WILD_CARDS), \
(PATH_NAME_OK), \
(LEADING_BACKSLASH_OK)) \
)
Definition: inflate.h:27

Definition at line 1196 of file fatprocs.h.

◆ FatIsNameShortOemValid

#define FatIsNameShortOemValid (   IRPCONTEXT,
  NAME,
  CAN_CONTAIN_WILD_CARDS,
  PATH_NAME_OK,
  LEADING_BACKSLASH_OK 
)
Value:
( \
FsRtlIsFatDbcsLegal((NAME), \
(CAN_CONTAIN_WILD_CARDS), \
(PATH_NAME_OK), \
(LEADING_BACKSLASH_OK)) \
)
Definition: inflate.h:27

Definition at line 1189 of file fatprocs.h.

◆ FatIsNodeTypeOplockable

#define FatIsNodeTypeOplockable (   N)
Value:
( \
((N) == FAT_NTC_FCB) || \
((N) == FAT_NTC_ROOT_DCB) || \
((N) == FAT_NTC_DCB) \
)
Definition: bidi.c:97
#define FAT_NTC_ROOT_DCB
Definition: nodetype.h:31
#define FAT_NTC_DCB
Definition: nodetype.h:30
#define FAT_NTC_FCB
Definition: nodetype.h:29

Definition at line 2825 of file fatprocs.h.

◆ FatIsRawDevice

#define FatIsRawDevice (   IC,
  S 
)
Value:
( \
)
#define STATUS_NO_MEDIA_IN_DEVICE
Definition: udferr_usr.h:141
#define S(x)
Definition: test.h:190
#define STATUS_DEVICE_NOT_READY
Definition: shellext.h:65

Definition at line 1836 of file fatprocs.h.

◆ FatNormalizeAndRaiseStatus

#define FatNormalizeAndRaiseStatus (   IRPCONTEXT,
  STATUS 
)
Value:
{ \
(IRPCONTEXT)->ExceptionStatus = (STATUS); \
}
#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 2983 of file fatprocs.h.

◆ FatNotifyReportChange

#define FatNotifyReportChange (   I,
  V,
  F,
  FL,
  A 
)
Value:
{ \
if ((F)->FullFileName.Buffer == NULL) { \
FatSetFullFileNameInFcb((I),(F)); \
} \
NT_ASSERT( (F)->FullFileName.Length != 0 ); \
NT_ASSERT( (F)->FinalNameLength != 0 ); \
NT_ASSERT( (F)->FullFileName.Length > (F)->FinalNameLength ); \
NT_ASSERT( (F)->FullFileName.Buffer[((F)->FullFileName.Length - (F)->FinalNameLength)/sizeof(WCHAR) - 1] == L'\\' ); \
FsRtlNotifyFullReportChange( (V)->NotifySync, \
&(V)->DirNotifyList, \
(PSTRING)&(F)->FullFileName, \
(USHORT) ((F)->FullFileName.Length - \
(F)->FinalNameLength), \
(ULONG)FL, \
(ULONG)A, \
(PVOID)NULL ); \
}
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
Definition: ttei1.cpp:12
static const WCHAR L[]
Definition: oid.c:1250
#define I(s)
unsigned short USHORT
Definition: pedump.c:61
unsigned int ULONG
Definition: retypes.h:1
#define F(x, y, z)
Definition: md5.c:51

Definition at line 2156 of file fatprocs.h.

◆ FatRaiseStatus

#define FatRaiseStatus (   IRPCONTEXT,
  STATUS 
)
Value:
{ \
(IRPCONTEXT)->ExceptionStatus = (STATUS); \
DebugBreakOnStatus( (STATUS) ) \
ExRaiseStatus( (STATUS) ); \
}
#define STATUS
Definition: blue.h:128

Definition at line 2965 of file fatprocs.h.

◆ FatReleaseDirectoryFileMutex

#define FatReleaseDirectoryFileMutex (   VCB)
Value:
{ \
NT_ASSERT(KeAreApcsDisabled()); \
ExReleaseFastMutexUnsafe(&(VCB)->DirectoryFileCreationMutex); \
}
Definition: cdstruc.h:504
BOOLEAN NTAPI KeAreApcsDisabled(VOID)
Definition: apc.c:958

Definition at line 1504 of file fatprocs.h.

◆ FatReleaseFcb

#define FatReleaseFcb (   IRPCONTEXT,
  Fcb 
)
Value:
{ \
ExReleaseResourceLite( (Fcb)->Header.Resource ); \
}
Definition: Header.h:8
IN PFCB Fcb
Definition: fatprocs.h:811

Definition at line 1635 of file fatprocs.h.

◆ FatReleaseGlobal

#define FatReleaseGlobal (   IRPCONTEXT)
Value:
{ \
ExReleaseResourceLite( &(FatData.Resource) ); \
}
FAT_DATA FatData
Definition: fatdata.c:56
ERESOURCE Resource
Definition: fatstruc.h:64

Definition at line 1627 of file fatprocs.h.

◆ FatReleaseVcb

#define FatReleaseVcb (   IRPCONTEXT,
  Vcb 
)
Value:
{ \
ExReleaseResourceLite( &((Vcb)->Resource) ); \
}
IN PVCB Vcb
Definition: fatprocs.h:334
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848

Definition at line 1631 of file fatprocs.h.

◆ FatReleaseVolume

#define FatReleaseVolume (   IRPCONTEXT,
  VCB 
)
Value:
{ \
PFCB __FFFFFcb = NULL; \
NT_ASSERT(FlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT)); \
while ( (__FFFFFcb = FatGetNextFcbBottomUp((IRPCONTEXT), __FFFFFcb, (VCB)->RootDcb)) != NULL) { \
(VOID)ExReleaseResourceLite( __FFFFFcb->Header.Resource ); \
} \
FatReleaseVcb((IRPCONTEXT), (VCB)); \
}
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1221
Definition: cdstruc.h:504
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
PFCB FatGetNextFcbBottomUp(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PFCB TerminationFcb)
Definition: strucsup.c:2524
#define VOID
Definition: acefi.h:82
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179

Definition at line 1409 of file fatprocs.h.

◆ FatResetExceptionState

#define FatResetExceptionState (   IRPCONTEXT)
Value:
{ \
(IRPCONTEXT)->ExceptionStatus = STATUS_SUCCESS; \
}
return STATUS_SUCCESS
Definition: btrfs.c:2725

Definition at line 2971 of file fatprocs.h.

◆ FatSetVcbCondition

#define FatSetVcbCondition (   V,
  X 
)    (V)->VcbCondition = (X)

Definition at line 1429 of file fatprocs.h.

◆ FatUnpinBcb

#define FatUnpinBcb (   IRPCONTEXT,
  BCB 
)
Value:
{ \
if ((BCB) != NULL) { \
CcUnpinData((BCB)); \
(BCB) = NULL; \
} \
}
smooth NULL
Definition: ftsmooth.c:416

Definition at line 537 of file fatprocs.h.

◆ FatUpcaseEaName

#define FatUpcaseEaName (   IRPCONTEXT,
  NAME,
  UPCASEDNAME 
)    RtlUpperString( UPCASEDNAME, NAME )

Definition at line 859 of file fatprocs.h.

◆ FatVcbAcquiredExclusive

#define FatVcbAcquiredExclusive (   IRPCONTEXT,
  VCB 
)
Value:
( \
ExIsResourceAcquiredExclusiveLite(&(VCB)->Resource) || \
ExIsResourceAcquiredExclusiveLite(&FatData.Resource) \
)
Definition: cdstruc.h:504
_Acquires_exclusive_lock_ Resource _Acquires_shared_lock_ Resource _Inout_ PERESOURCE Resource
Definition: cdprocs.h:848
FAT_DATA FatData
Definition: fatdata.c:56
ERESOURCE Resource
Definition: fatstruc.h:64

Definition at line 1486 of file fatprocs.h.

◆ INLINE

#define INLINE   __inline

Definition at line 68 of file fatprocs.h.

◆ IsDirectory

#define IsDirectory (   FcbOrDcb)    ((NodeType((FcbOrDcb)) == FAT_NTC_DCB) || (NodeType((FcbOrDcb)) == FAT_NTC_ROOT_DCB))

Definition at line 3094 of file fatprocs.h.

◆ IsFileDeleted

#define IsFileDeleted (   IRPCONTEXT,
  FCB 
)
Value:
((FCB)->UncleanCount == 0))
Dcb UncleanCount
Definition: create.c:4364
Definition: cdstruc.h:908
struct _FCB FCB
#define FCB_STATE_DELETE_ON_CLOSE
Definition: fatstruc.h:1189
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179

Definition at line 2769 of file fatprocs.h.

◆ IsFileObjectReadOnly

#define IsFileObjectReadOnly (   FO)    (!((FO)->WriteAccess | (FO)->DeleteAccess))

Definition at line 2854 of file fatprocs.h.

◆ IsFileWriteThrough

#define IsFileWriteThrough (   FO,
  VCB 
)
Value:
( \
BooleanFlagOn((FO)->Flags, FO_WRITE_THROUGH) \
)
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define FO_WRITE_THROUGH
Definition: iotypes.h:1735

Definition at line 2784 of file fatprocs.h.

◆ LongAlign

#define LongAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 3) & 0xfffffffc) \
)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
unsigned int ULONG
Definition: retypes.h:1

Definition at line 2084 of file fatprocs.h.

◆ MAX_ULONG

#define MAX_ULONG   ((ULONG)-1)

Definition at line 74 of file fatprocs.h.

◆ MAX_USHORT

#define MAX_USHORT   ((USHORT)-1)

Definition at line 78 of file fatprocs.h.

◆ PtrOffset

#define PtrOffset (   BASE,
  OFFSET 
)    ((ULONG)((ULONG_PTR)(OFFSET) - (ULONG_PTR)(BASE)))

Definition at line 2068 of file fatprocs.h.

◆ QuadAlign

#define QuadAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 7) & 0xfffffff8) \
)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
unsigned int ULONG
Definition: retypes.h:1

Definition at line 2093 of file fatprocs.h.

◆ SizeOfFullEa

#define SizeOfFullEa (   EA)    (4+1+1+2+(EA)->EaNameLength+1+(EA)->EaValueLength)

Definition at line 1021 of file fatprocs.h.

◆ try_leave

#define try_leave (   S)    { S; _SEH2_LEAVE; }

Definition at line 3018 of file fatprocs.h.

◆ try_return

#define try_return (   S)    { S; goto try_exit; }

Definition at line 3017 of file fatprocs.h.

◆ WordAlign

#define WordAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 1) & 0xfffffffe) \
)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
unsigned int ULONG
Definition: retypes.h:1

Definition at line 2075 of file fatprocs.h.

Typedef Documentation

◆ COMPARISON

◆ FAT_ENUMERATION_CONTEXT

◆ FAT_FLUSH_TYPE

◆ FAT_VOLUME_STATE

◆ FINISHED

typedef BOOLEAN FINISHED

Definition at line 95 of file fatprocs.h.

◆ PFAT_ENUMERATION_CONTEXT

◆ PFAT_VOLUME_STATE

◆ PUCHAR1

typedef union _UCHAR1 * PUCHAR1

◆ PUCHAR2

typedef union _UCHAR2 * PUCHAR2

◆ PUCHAR4

typedef union _UCHAR4 * PUCHAR4

◆ TYPE_OF_OPEN

◆ UCHAR1

typedef union _UCHAR1 UCHAR1

◆ UCHAR2

typedef union _UCHAR2 UCHAR2

◆ UCHAR4

typedef union _UCHAR4 UCHAR4

Enumeration Type Documentation

◆ _COMPARISON

Enumerator
IsLessThan 
IsGreaterThan 
IsEqual 

Definition at line 1874 of file fatprocs.h.

1874  {
1875  IsLessThan,
1876  IsGreaterThan,
1877  IsEqual
1878 } COMPARISON;
enum _COMPARISON COMPARISON

◆ _FAT_FLUSH_TYPE

Enumerator
NoFlush 
Flush 
FlushAndInvalidate 
FlushWithoutPurge 

Definition at line 1042 of file fatprocs.h.

1042  {
1043 
1044  NoFlush = 0,
1045  Flush,
1048 
1049 } FAT_FLUSH_TYPE;
enum _FAT_FLUSH_TYPE FAT_FLUSH_TYPE

◆ _FAT_VOLUME_STATE

Enumerator
VolumeClean 
VolumeDirty 
VolumeDirtyWithSurfaceTest 

Definition at line 1944 of file fatprocs.h.

1944  {
1945  VolumeClean,
1946  VolumeDirty,
enum _FAT_VOLUME_STATE * PFAT_VOLUME_STATE
enum _FAT_VOLUME_STATE FAT_VOLUME_STATE

◆ _TYPE_OF_OPEN

Enumerator
UnopenedFileObject 
StreamFileOpen 
UserVolumeOpen 
UserDirectoryOpen 
UserFileOpen 
BeyondValidType 
UnopenedFileObject 
UserFileOpen 
UserDirectoryOpen 
UserVolumeOpen 
VirtualVolumeFile 
DirectoryFile 
EaFile 

Definition at line 1030 of file fatprocs.h.

1030  {
1031 
1032  UnopenedFileObject = 1,
1033  UserFileOpen,
1037  DirectoryFile,
1038  EaFile,
1039 } TYPE_OF_OPEN;
enum _TYPE_OF_OPEN TYPE_OF_OPEN

Function Documentation

◆ _Acquires_exclusive_lock_()

_Acquires_exclusive_lock_ ( Vcb->  Resource)

◆ _Acquires_shared_lock_()

_Acquires_shared_lock_ ( Vcb->  Resource)

◆ _Function_class_() [1/28]

_Function_class_ ( FAST_IO_ACQUIRE_FOR_CCFLUSH  )

◆ _Function_class_() [2/28]

_Function_class_ ( FAST_IO_RELEASE_FOR_CCFLUSH  )

◆ _Function_class_() [3/28]

_Function_class_ ( IRP_MJ_CLEANUP  )

◆ _Function_class_() [4/28]

_Function_class_ ( IRP_MJ_CLOSE  )

◆ _Function_class_() [5/28]

_Function_class_ ( IRP_MJ_CREATE  )

◆ _Function_class_() [6/28]

_Function_class_ ( IRP_MJ_DEVICE_CONTROL  )

◆ _Function_class_() [7/28]

_Function_class_ ( IRP_MJ_DIRECTORY_CONTROL  )

◆ _Function_class_() [8/28]

_Function_class_ ( IRP_MJ_QUERY_EA  )

◆ _Function_class_() [9/28]

_Function_class_ ( IRP_MJ_SET_EA  )

◆ _Function_class_() [10/28]

_Function_class_ ( IRP_MJ_QUERY_INFORMATION  )

◆ _Function_class_() [11/28]

_Function_class_ ( IRP_MJ_SET_INFORMATION  )

◆ _Function_class_() [12/28]

_Function_class_ ( IRP_MJ_FLUSH_BUFFERS  )

◆ _Function_class_() [13/28]

_Function_class_ ( IRP_MJ_FILE_SYSTEM_CONTROL  )

◆ _Function_class_() [14/28]

_Function_class_ ( IRP_MJ_LOCK_CONTROL  )

◆ _Function_class_() [15/28]

_Function_class_ ( IRP_MJ_PNP  )

◆ _Function_class_() [16/28]

_Function_class_ ( IRP_MJ_READ  )

◆ _Function_class_() [17/28]

_Function_class_ ( IRP_MJ_SHUTDOWN  )

◆ _Function_class_() [18/28]

_Function_class_ ( IRP_MJ_QUERY_VOLUME_INFORMATION  )

◆ _Function_class_() [19/28]

_Function_class_ ( IRP_MJ_SET_VOLUME_INFORMATION  )

◆ _Function_class_() [20/28]

_Function_class_ ( IRP_MJ_WRITE  )

◆ _Function_class_() [21/28]

_Function_class_ ( FAST_IO_CHECK_IF_POSSIBLE  )

◆ _Function_class_() [22/28]

_Function_class_ ( FAST_IO_QUERY_BASIC_INFO  )

◆ _Function_class_() [23/28]

_Function_class_ ( FAST_IO_QUERY_STANDARD_INFO  )

◆ _Function_class_() [24/28]

_Function_class_ ( FAST_IO_QUERY_NETWORK_OPEN_INFO  )

◆ _Function_class_() [25/28]

_Function_class_ ( FAST_IO_LOCK  )

◆ _Function_class_() [26/28]

_Function_class_ ( FAST_IO_UNLOCK_SINGLE  )

◆ _Function_class_() [27/28]

_Function_class_ ( FAST_IO_UNLOCK_ALL  )

◆ _Function_class_() [28/28]

_Function_class_ ( FAST_IO_UNLOCK_ALL_BY_KEY  )

◆ _Requires_lock_held_()

_Requires_lock_held_ ( _Global_critical_region_  )

◆ _Success_()

_Success_ ( return = FALSE)

Definition at line 3139 of file fsctrl.c.

3189 {
3190  PLIST_ENTRY Link;
3191 
3192  PVPB Vpb = Vcb->Vpb;
3193  PVPB OldVpb;
3194 
3195  BOOLEAN Remount = FALSE;
3196 
3197  PAGED_CODE();
3198 
3199  UNREFERENCED_PARAMETER( IrpContext );
3200 
3201  //
3202  // Check whether we are looking for a device only Mvcb.
3203  //
3204 
3205  for (Link = CdData.VcbQueue.Flink;
3206  Link != &CdData.VcbQueue;
3207  Link = Link->Flink) {
3208 
3209  *OldVcb = CONTAINING_RECORD( Link, VCB, VcbLinks );
3210 
3211  //
3212  // Skip ourselves.
3213  //
3214 
3215  if (Vcb == *OldVcb) { continue; }
3216 
3217  //
3218  // Look at the Vpb and state of the previous Vcb.
3219  //
3220 
3221  OldVpb = (*OldVcb)->Vpb;
3222 
3223  if ((OldVpb != Vpb) &&
3224  (OldVpb->RealDevice == Vpb->RealDevice) &&
3225  ((*OldVcb)->VcbCondition == VcbNotMounted)) {
3226 
3227  //
3228  // If the current disk is a raw disk then it can match a previous music or
3229  // raw disk.
3230  //
3231 
3232  if (FlagOn( Vcb->VcbState, VCB_STATE_AUDIO_DISK)) {
3233 
3234  if (FlagOn( (*OldVcb)->VcbState, VCB_STATE_AUDIO_DISK )) {
3235 
3236  //
3237  // If we have both TOC then fail the remount if the lengths
3238  // are different or they don't match.
3239  //
3240 
3241  if ((Vcb->TocLength != (*OldVcb)->TocLength) ||
3242  ((Vcb->TocLength != 0) &&
3243  !RtlEqualMemory( Vcb->CdromToc,
3244  (*OldVcb)->CdromToc,
3245  Vcb->TocLength ))) {
3246 
3247  continue;
3248  }
3249 
3250  Remount = TRUE;
3251  break;
3252  }
3253 
3254  //
3255  // The current disk is not a raw disk. Go ahead and compare
3256  // serial numbers, volume label and TOC.
3257  //
3258 
3259  }
3260  else if ((OldVpb->SerialNumber == Vpb->SerialNumber) &&
3261  (Vcb->TocLength == (*OldVcb)->TocLength) &&
3262  ((Vcb->TocLength == 0) || RtlEqualMemory( Vcb->CdromToc,
3263  (*OldVcb)->CdromToc,
3264  Vcb->TocLength )) &&
3265  (Vpb->VolumeLabelLength == OldVpb->VolumeLabelLength) &&
3266  (RtlEqualMemory( OldVpb->VolumeLabel,
3267  Vpb->VolumeLabel,
3268  Vpb->VolumeLabelLength ))) {
3269  //
3270  // Remember the old Vcb. Then set the return value to
3271  // TRUE and break.
3272  //
3273 
3274  Remount = TRUE;
3275  break;
3276  }
3277  }
3278  }
3279 
3280  return Remount;
3281 }
#define VCB_STATE_AUDIO_DISK
Definition: cdstruc.h:718
#define TRUE
Definition: types.h:120
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH/sizeof(WCHAR)]
Definition: iotypes.h:175
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
Definition: cdstruc.h:504
static int Link(const char **args)
Definition: vfdcmd.c:2414
#define PAGED_CODE()
Definition: video.h:57
unsigned char BOOLEAN
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
CD_DATA CdData
Definition: cddata.c:42
NTSYSAPI ULONG NTAPI RtlEqualMemory(CONST VOID *Source1, CONST VOID *Source2, ULONG Length)
struct _DEVICE_OBJECT * RealDevice
Definition: iotypes.h:172
#define Vcb
Definition: cdprocs.h:1425
Definition: typedefs.h:117
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
LIST_ENTRY VcbQueue
Definition: cdstruc.h:340
Definition: iotypes.h:166
USHORT VolumeLabelLength
Definition: iotypes.h:170
ULONG SerialNumber
Definition: iotypes.h:173
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1664

◆ Fat8dot3ToString()

VOID Fat8dot3ToString ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PDIRENT  Dirent,
_In_ BOOLEAN  RestoreCase,
_Out_ POEM_STRING  OutputString 
)

Definition at line 179 of file namesup.c.

208 {
209  ULONG StringIndex;
210  ULONG BaseLength, ExtensionLength;
211 
212  PAGED_CODE();
213 
214  DebugTrace(+1, Dbg, "Fat8dot3ToString\n", 0);
215 
216  //
217  // First, find the length of the base component.
218  //
219 
220  for (BaseLength = 8; BaseLength > 0; BaseLength -= 1) {
221 
222  if (Dirent->FileName[BaseLength - 1] != UCHAR_SP) {
223 
224  break;
225  }
226  }
227 
228  //
229  // Now find the length of the extension.
230  //
231 
232  for (ExtensionLength = 3; ExtensionLength > 0; ExtensionLength -= 1) {
233 
234  if (Dirent->FileName[8 + ExtensionLength - 1] != UCHAR_SP) {
235 
236  break;
237  }
238  }
239 
240  //
241  // If there was a base part, copy it and check the case. Don't forget
242  // if the first character needs to be changed from 0x05 to 0xe5.
243  //
244 
245  if (BaseLength != 0) {
246 
247  RtlCopyMemory( OutputString->Buffer, Dirent->FileName, BaseLength );
248 
249  if (OutputString->Buffer[0] == FAT_DIRENT_REALLY_0E5) {
250 
251  OutputString->Buffer[0] = 0xe5;
252  }
253 
254  //
255  // Now if we are to restore case, look for A-Z
256  //
257 
258  if (FatData.ChicagoMode &&
259  RestoreCase &&
261 
262  for (StringIndex = 0; StringIndex < BaseLength; StringIndex += 1) {
263 
264  //
265  // Depending on whether the media was built in a system that was
266  // running with "code page invariance" (see FatEvaluateNameCase),
267  // there could be double-byte OEM characters lying in wait here.
268  // Gotta skip them.
269  //
270 
271  if (FsRtlIsLeadDbcsCharacter(OutputString->Buffer[StringIndex])) {
272 
273  StringIndex += 1;
274  continue;
275  }
276 
277  if ((OutputString->Buffer[StringIndex] >= 'A') &&
278  (OutputString->Buffer[StringIndex] <= 'Z')) {
279 
280  OutputString->Buffer[StringIndex] += 'a' - 'A';
281  }
282  }
283  }
284  }
285 
286  //
287  // If there was an extension, copy that over. Else we now know the
288  // size of the string.
289  //
290 
291  if (ExtensionLength != 0) {
292 
293  PUCHAR o, d;
294 
295  //
296  // Now add the dot
297  //
298 
299  OutputString->Buffer[BaseLength++] = '.';
300 
301  //
302  // Copy over the extension into the output buffer.
303  //
304 
305  o = (PUCHAR)&OutputString->Buffer[BaseLength];
306  d = &Dirent->FileName[8];
307 
308  switch (ExtensionLength) {
309  case 3:
310  *o++ = *d++;
311  case 2:
312  *o++ = *d++;
313  case 1:
314  *o++ = *d++;
315  }
316 
317  //
318  // Set the output string length
319  //
320 
321  OutputString->Length = (USHORT)(BaseLength + ExtensionLength);
322 
323  //
324  // Now if we are to restore case, look for A-Z
325  //
326 
327  if (FatData.ChicagoMode &&
328  RestoreCase &&
330 
331  for (StringIndex = BaseLength;
332  StringIndex < OutputString->Length;
333  StringIndex++ ) {
334 
335  //
336  // Depending on whether the media was built in a system that was
337  // running with "code page invariance" (see FatEvaluateNameCase),
338  // there could be double-byte OEM characters lying in wait here.
339  // Gotta skip them.
340  //
341 
342  if (FsRtlIsLeadDbcsCharacter(OutputString->Buffer[StringIndex])) {
343 
344  StringIndex += 1;
345  continue;
346  }
347 
348  if ((OutputString->Buffer[StringIndex] >= 'A') &&
349  (OutputString->Buffer[StringIndex] <= 'Z')) {
350 
351  OutputString->Buffer[StringIndex] += 'a' - 'A';
352  }
353  }
354  }
355 
356  } else {
357 
358  //
359  // Set the output string length
360  //
361 
362  OutputString->Length = (USHORT)BaseLength;
363  }
364 
365  //
366  // And return to our caller
367  //
368 
369  DebugTrace(-1, Dbg, "Fat8dot3ToString, OutputString = \"%Z\" -> VOID\n", OutputString);
370 
371  UNREFERENCED_PARAMETER( IrpContext );
372 
373  return;
374 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
unsigned char * PUCHAR
Definition: retypes.h:3
#define FAT_DIRENT_REALLY_0E5
Definition: fat.h:335
#define DebugTrace(INDENT, LEVEL, X, Y)
Definition: fatdata.h:313
BOOLEAN ChicagoMode
Definition: fatstruc.h:83
#define FAT_DIRENT_NT_BYTE_8_LOWER_CASE
Definition: fat.h:361
switch(r->id)
Definition: btrfs.c:2691
FAT_DATA FatData
Definition: fatdata.c:56
#define d
Definition: ke_i.h:81
#define UCHAR_SP
Definition: nodetype.h:143
PAGED_CODE()
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define FAT_DIRENT_NT_BYTE_3_LOWER_CASE
Definition: fat.h:362
unsigned short USHORT
Definition: pedump.c:61
#define Dbg
Definition: namesup.c:18
unsigned int ULONG
Definition: retypes.h:1
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: cdprocs.h:429
#define FsRtlIsLeadDbcsCharacter(DBCS_CHAR)
Definition: init.c:417
UNREFERENCED_PARAMETER(IrpContext)

Referenced by _Requires_lock_held_(), and FatConstructNamesInFcb().

◆ FatAcquireSharedFcbWaitForEx()

_Acquires_shared_lock_ Fcb FINISHED FatAcquireSharedFcbWaitForEx ( IN PIRP_CONTEXT  IrpContext,
IN PFCB  Fcb 
)

Referenced by _Requires_lock_held_().

◆ FatAcquireVolumeForClose()

BOOLEAN FatAcquireVolumeForClose ( IN PVOID  Vcb,
IN BOOLEAN  Wait 
)

◆ FatAddMcbEntry()

BOOLEAN FatAddMcbEntry ( IN PVCB  Vcb,
IN PLARGE_MCB  Mcb,
IN VBO  Vbo,
IN LBO  Lbo,
IN ULONG  SectorCount 
)

Definition at line 364 of file fsctrl.c.

372 {
373  BOOLEAN Result;
374 #if DBG
375  VBO SparseVbo;
376  LONGLONG SparseByteCount;
377 #endif
378 
379  PAGED_CODE();
380 
381  if (SectorCount) {
382 
383  //
384  // Round up sectors, but be careful as SectorCount approaches 4Gb.
385  // Note that for x>0, (x+m-1)/m = ((x-1)/m)+(m/m) = ((x-1)/m)+1
386  //
387 
388  SectorCount--;
390  SectorCount++;
391  }
392 
393  Vbo >>= MCB_SCALE_LOG2;
394  Lbo >>= MCB_SCALE_LOG2;
395 
396  NT_ASSERT( SectorCount != 0 );
397 
398  if (Mcb != &Vcb->DirtyFatMcb) {
399  NT_ASSERT( FatNonSparseMcb( Vcb, Mcb, &SparseVbo, &SparseByteCount ) ||
400  ((SparseVbo == Vbo) && (SparseByteCount == SectorCount )) );
401  }
402 
404  ((LONGLONG) Vbo),
405  ((LONGLONG) Lbo),
406  ((LONGLONG) SectorCount) );
407 
408  if (Mcb != &Vcb->DirtyFatMcb) {
409  NT_ASSERT( FatNonSparseMcb( Vcb, Mcb, &SparseVbo, &SparseByteCount ) ||
410  ((SparseVbo == Vbo) && (SparseByteCount == SectorCount )) );
411  }
412 
413  return Result;
414 }
ULONG32 VBO
Definition: fat.h:38
IN PFCB IN VBO OUT PLBO Lbo
Definition: fatprocs.h:297
#define PAGED_CODE()
Definition: video.h:57
#define MCB_SCALE_LOG2
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
int64_t LONGLONG
Definition: typedefs.h:66
#define Vcb
Definition: cdprocs.h:1425
BOOLEAN NTAPI FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb, IN LONGLONG Vbn, IN LONGLONG Lbn, IN LONGLONG SectorCount)
Definition: largemcb.c:282
ULONG SectorCount
Definition: part_xbox.c:32
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:334
IN PFCB IN VBO Vbo
Definition: fatprocs.h:297
#define NT_ASSERT
Definition: rtlfuncs.h:3312

Referenced by _Requires_lock_held_(), FatComputeMoveFileSplicePoints(), FatExamineFatEntries(), and FatSetFatRun().

◆ FatAddToWorkque()

VOID FatAddToWorkque ( IN PIRP_CONTEXT  IrpContext,
IN PIRP  Irp 
)

Definition at line 277 of file workque.c.

301 {
302  KIRQL SavedIrql;
304 
306 
307  //
308  // Check if this request has an associated file object, and thus volume
309  // device object.
310  //
311 
312  if ( IrpSp->FileObject != NULL ) {
313 
315 
318  DeviceObject );
319 
320  //
321  // Check to see if this request should be sent to the overflow
322  // queue. If not, then send it off to an exworker thread.
323  //
324 
325  KeAcquireSpinLock( &Vdo->OverflowQueueSpinLock, &SavedIrql );
326 
328 
329  //
330  // We cannot currently respond to this IRP so we'll just enqueue it
331  // to the overflow queue on the volume.
332  //
333 
335  &IrpContext->WorkQueueItem.List );
336 
337  Vdo->OverflowQueueCount += 1;
338 
339  KeReleaseSpinLock( &Vdo->OverflowQueueSpinLock, SavedIrql );
340 
341  return;
342 
343  } else {
344 
345  //
346  // We are going to send this Irp to an ex worker thread so up
347  // the count.
348  //
349 
350  Vdo->PostedRequestCount += 1;
351 
352  KeReleaseSpinLock( &Vdo->OverflowQueueSpinLock, SavedIrql );
353  }
354  }
355 
356  //
357  // Send it off.....
358  //
359 
360  ExInitializeWorkItem( &IrpContext->WorkQueueItem,
362  IrpContext );
363 
364 #ifdef _MSC_VER
365 #pragma prefast( suppress:28159, "prefast indicates this is an obsolete API but it is ok for fastfat to keep using it." )
366 #endif
367  ExQueueWorkItem( &IrpContext->WorkQueueItem, CriticalWorkQueue );
368 
369  return;
370 }
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
_In_ PIRP Irp
Definition: csq.h:116
#define InsertTailList(ListHead, Entry)
#define FSP_PER_DEVICE_THRESHOLD
Definition: workque.c:24
ULONG OverflowQueueCount
Definition: cdstruc.h:752
UCHAR KIRQL
Definition: env_spec_w32.h:591
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
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2866
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
__volatile LONG PostedRequestCount
Definition: cdstruc.h:745
WORKER_THREAD_ROUTINE FatFspDispatch
Definition: fatprocs.h:2368
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
KSPIN_LOCK OverflowQueueSpinLock
Definition: cdstruc.h:766
LIST_ENTRY OverflowQueue
Definition: cdstruc.h:760

Referenced by _Requires_lock_held_(), FatFsdPostRequest(), and FatOplockComplete().

◆ FatAllocateCloseContext()

PCLOSE_CONTEXT FatAllocateCloseContext ( IN PVCB  Vcb)

◆ FatAppendPackedEa()

VOID FatAppendPackedEa ( IN PIRP_CONTEXT  IrpContext,
IN OUT PEA_SET_HEADER EaSetHeader,
IN OUT PULONG  PackedEasLength,
IN OUT PULONG  AllocationLength,
IN PFILE_FULL_EA_INFORMATION  FullEa,
IN ULONG  BytesPerCluster 
)

Definition at line 2967 of file easup.c.

3010 {
3011  ULONG PackedEaSize;
3012  PPACKED_EA ThisPackedEa;
3013  OEM_STRING EaName;
3014 
3015  PAGED_CODE();
3016 
3017  DebugTrace(+1, Dbg, "FatAppendPackedEa...\n", 0);
3018 
3019  //
3020  // As a quick check see if the computed packed ea size plus the
3021  // current packed ea list size will overflow the buffer. Full Ea and
3022  // packed Ea only differ by 4 in their size
3023  //
3024 
3025  PackedEaSize = SizeOfFullEa( FullEa ) - 4;
3026 
3027  if ( PackedEaSize + *PackedEasLength > *AllocationLength ) {
3028 
3029  //
3030  // We will overflow our current work buffer so allocate a larger
3031  // one and copy over the current buffer
3032  //
3033 
3034  PVOID Temp;
3035  ULONG NewAllocationSize;
3036  ULONG OldAllocationSize;
3037 
3038  DebugTrace(0, Dbg, "Allocate a new ea list buffer\n", 0);
3039 
3040  //
3041  // Compute a new size and allocate space. Always increase the
3042  // allocation in cluster increments.
3043  //
3044 
3045  NewAllocationSize = (SIZE_OF_EA_SET_HEADER
3046  + PackedEaSize
3047  + *PackedEasLength
3048  + BytesPerCluster - 1)
3049  & ~(BytesPerCluster - 1);
3050 
3052  NewAllocationSize,
3054 
3055  //
3056  // Move over the existing ea list, and deallocate the old one
3057  //
3058 
3059  RtlCopyMemory( Temp,
3060  *EaSetHeader,
3061  OldAllocationSize = *AllocationLength
3063 
3064  ExFreePool( *EaSetHeader );
3065 
3066  //
3067  // Set up so we will use the new packed ea list
3068  //
3069 
3070  *EaSetHeader = Temp;
3071 
3072  //
3073  // Zero out the added memory.
3074  //
3075 
3076  RtlZeroMemory( &(*EaSetHeader)->PackedEas[*AllocationLength],
3077  NewAllocationSize - OldAllocationSize );
3078 
3079  *AllocationLength = NewAllocationSize - SIZE_OF_EA_SET_HEADER;
3080  }
3081 
3082  //
3083  // Determine if we need to increment our need ea changes count
3084  //
3085 
3086  if ( FlagOn(FullEa->Flags, FILE_NEED_EA )) {
3087 
3088  //
3089  // The NeedEaCount field is long aligned so we will write
3090  // directly to it.
3091  //
3092 
3093  (*EaSetHeader)->NeedEaCount++;
3094  }
3095 
3096  //
3097  // Now copy over the ea, full ea's and packed ea are identical except
3098  // that full ea also have a next ea offset that we skip over
3099  //
3100  // Before:
3101  // UsedSize Allocated
3102  // | |
3103  // V V
3104  // +xxxxxxxx+-----------------------------+
3105  //
3106  // After:
3107  // UsedSize Allocated
3108  // | |
3109  // V V
3110  // +xxxxxxxx+yyyyyyyyyyyyyyyy+------------+
3111  //
3112 
3113  ThisPackedEa = (PPACKED_EA) (RtlOffsetToPointer( (*EaSetHeader)->PackedEas,
3114  *PackedEasLength ));
3115 
3116  RtlCopyMemory( ThisPackedEa,
3117  (PUCHAR) FullEa + 4,
3118  PackedEaSize );
3119 
3120  //
3121  // Now convert the name to uppercase.
3122  //
3123 
3124  EaName.MaximumLength = EaName.Length = FullEa->EaNameLength;
3125  EaName.Buffer = ThisPackedEa->EaName;
3126 
3127  FatUpcaseEaName( IrpContext, &EaName, &EaName );
3128 
3129  //
3130  // Increment the used size in the packed ea list structure
3131  //
3132 
3133  *PackedEasLength += PackedEaSize;
3134 
3135  //
3136  // And return to our caller
3137  //
3138 
3139  DebugTrace(-1, Dbg, "FatAppendPackedEa -> VOID\n", 0);
3140 
3141  UNREFERENCED_PARAMETER( IrpContext );
3142 
3143  return;
3144 }
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
CHAR EaName[1]
Definition: fat.h:698
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:229
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
unsigned char * PUCHAR
Definition: retypes.h:3
#define DebugTrace(INDENT, LEVEL, X, Y)
Definition: fatdata.h:313
STRING OEM_STRING
Definition: umtypes.h:203
#define PAGED_CODE()
Definition: video.h:57
#define SizeOfFullEa(EA)
Definition: fatprocs.h:1021
#define RtlOffsetToPointer(B, O)
#define FILE_NEED_EA
#define FatUpcaseEaName(IRPCONTEXT, NAME, UPCASEDNAME)
Definition: fatprocs.h:859
PACKED_EA * PPACKED_EA
Definition: fat.h:700
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define TAG_EA_SET_HEADER
Definition: nodetype.h:161
#define SIZE_OF_EA_SET_HEADER
Definition: fat.h:674
#define Dbg
Definition: easup.c:22
#define ExFreePool(addr)
Definition: env_spec_w32.h:352

Referenced by FatCommonSetEa().

◆ FatBufferUserBuffer()

PVOID FatBufferUserBuffer ( IN PIRP_CONTEXT  IrpContext,
IN OUT PIRP  Irp,
IN ULONG  BufferLength 
)

Definition at line 3427 of file deviosup.c.

3454 {
3455  PUCHAR UserBuffer;
3456 
3457  UNREFERENCED_PARAMETER( IrpContext );
3458 
3459  PAGED_CODE();
3460 
3461  //
3462  // Handle the no buffer case.
3463  //
3464 
3465  if (BufferLength == 0) {
3466 
3467  return NULL;
3468  }
3469 
3470  //
3471  // If there is no system buffer we must have been supplied an Mdl
3472  // describing the users input buffer, which we will now snapshot.
3473  //
3474 
3475  if (Irp->AssociatedIrp.SystemBuffer == NULL) {
3476 
3477  UserBuffer = FatMapUserBuffer( IrpContext, Irp );
3478 
3479 #ifndef __REACTOS__
3480  Irp->AssociatedIrp.SystemBuffer = FsRtlAllocatePoolWithQuotaTag( NonPagedPoolNx,
3481 #else
3482  Irp->AssociatedIrp.SystemBuffer = FsRtlAllocatePoolWithQuotaTag( NonPagedPool,
3483 #endif
3484  BufferLength,
3486 
3487  //
3488  // Set the flags so that the completion code knows to deallocate the
3489  // buffer.
3490  //
3491 
3493 
3494  _SEH2_TRY {
3495 
3496  RtlCopyMemory( Irp->AssociatedIrp.SystemBuffer,
3497  UserBuffer,
3498  BufferLength );
3499 
3501 
3502  NTSTATUS Status;
3503 
3505  FatRaiseStatus( IrpContext,
3507  } _SEH2_END;
3508  }
3509 
3510  return Irp->AssociatedIrp.SystemBuffer;
3511 }
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
Definition: filter.c:61
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
PVOID FatMapUserBuffer(IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp)
Definition: deviosup.c:3369
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
PVOID NTAPI FsRtlAllocatePoolWithQuotaTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:189
#define FatRaiseStatus(IRPCONTEXT, STATUS)
Definition: fatprocs.h:2965
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
_In_ ULONG BufferLength
Definition: usbdlib.h:225
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
Status
Definition: gdiplustypes.h:24
#define TAG_IO_USER_BUFFER
Definition: nodetype.h:184
_SEH2_END
Definition: create.c:4424
#define IRP_BUFFERED_IO
#define IRP_DEALLOCATE_BUFFER
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12

Referenced by FatCommonSetEa().

◆ FatBuildZeroMdl()

PMDL FatBuildZeroMdl ( __in PIRP_CONTEXT  IrpContext,
__in ULONG  Length 
)

Definition at line 3754 of file deviosup.c.

3777 {
3778  PMDL ZeroMdl;
3779  ULONG SavedByteCount;
3780  PPFN_NUMBER Page;
3781  ULONG i;
3782 
3783  UNREFERENCED_PARAMETER( IrpContext );
3784 
3785  //
3786  // Spin down trying to get an MDL which can describe our operation.
3787  //
3788 
3789  while (TRUE) {
3790 
3791  ZeroMdl = IoAllocateMdl( FatData.ZeroPage, Length, FALSE, FALSE, NULL );
3792 
3793  //
3794  // Throttle ourselves to what we've physically allocated. Note that
3795  // we could have started with an odd multiple of this number. If we
3796  // tried for exactly that size and failed, we're toast.
3797  //
3798 
3799  if (ZeroMdl || (Length <= PAGE_SIZE)) {
3800 
3801  break;
3802  }
3803 
3804  //
3805  // Fallback by half and round down to a page multiple.
3806  //
3807 
3808  ASSERT( IrpContext->Vcb->Bpb.BytesPerSector <= PAGE_SIZE );
3810  if (Length < PAGE_SIZE) {
3811  Length = PAGE_SIZE;
3812  }
3813  }
3814 
3815  if (ZeroMdl == NULL) {
3816  return NULL;
3817  }
3818 
3819  //
3820  // If we have throttled all the way down, stop and just build a
3821  // simple MDL describing our previous allocation.
3822  //
3823 
3824  if (Length == PAGE_SIZE) {
3825 
3826  MmBuildMdlForNonPagedPool( ZeroMdl );
3827  return ZeroMdl;
3828  }
3829 
3830  //
3831  // Now we will temporarily lock the allocated pages
3832  // only, and then replicate the page frame numbers through
3833  // the entire Mdl to keep writing the same pages of zeros.
3834  //
3835  // It would be nice if Mm exported a way for us to not have
3836  // to pull the Mdl apart and rebuild it ourselves, but this
3837  // is so bizzare a purpose as to be tolerable.
3838  //
3839 
3840  SavedByteCount = ZeroMdl->ByteCount;
3841  ZeroMdl->ByteCount = PAGE_SIZE;
3842  MmBuildMdlForNonPagedPool( ZeroMdl );
3843 
3844  ZeroMdl->MdlFlags &= ~MDL_SOURCE_IS_NONPAGED_POOL;
3845  ZeroMdl->MdlFlags |= MDL_PAGES_LOCKED;
3846  ZeroMdl->MappedSystemVa = NULL;
3847  ZeroMdl->StartVa = NULL;
3848  ZeroMdl->ByteCount = SavedByteCount;
3849  Page = MmGetMdlPfnArray( ZeroMdl );
3850  for (i = 1; i < (ADDRESS_AND_SIZE_TO_SPAN_PAGES( 0, SavedByteCount )); i++) {
3851  *(Page + i) = *(Page);
3852  }
3853 
3854 
3855  return ZeroMdl;
3856 }
#define TRUE
Definition: types.h:120
PVOID ZeroPage
Definition: fatstruc.h:159
#define MmGetMdlPfnArray(_Mdl)
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
Definition: mdlsup.c:428
ULONG * PPFN_NUMBER
Definition: ke.h:8
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
smooth NULL
Definition: ftsmooth.c:416
#define MDL_SOURCE_IS_NONPAGED_POOL
Definition: mmtypes.h:20
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
FAT_DATA FatData
Definition: fatdata.c:56
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define PAGE_SIZE
Definition: env_spec_w32.h:49
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
unsigned int ULONG
Definition: retypes.h:1
#define BlockAlignTruncate(P, V)
Definition: fatprocs.h:3092

◆ FatCheckDirtyBit()

VOID FatCheckDirtyBit ( IN PIRP_CONTEXT  IrpContext,
IN PVCB  Vcb 
)

Definition at line 1189 of file verfysup.c.

1211 {
1212  BOOLEAN Dirty;
1213 
1215  PBCB BootSectorBcb;
1216 
1217  UNICODE_STRING VolumeLabel;
1218 
1219  PAGED_CODE();
1220 
1221  //
1222  // Look in the boot sector
1223  //
1224 
1225  FatReadVolumeFile( IrpContext,
1226  Vcb,
1227  0,
1228  sizeof(PACKED_BOOT_SECTOR),
1229  &BootSectorBcb,
1230  (PVOID *)&BootSector );
1231 
1232  _SEH2_TRY {
1233 
1234  //
1235  // Check if the magic bit is set
1236  //
1237 
1238  if (IsBpbFat32(&BootSector->PackedBpb)) {
1239  Dirty = BooleanFlagOn( ((PPACKED_BOOT_SECTOR_EX)BootSector)->CurrentHead,
1241  } else {
1242  Dirty = BooleanFlagOn( BootSector->CurrentHead, FAT_BOOT_SECTOR_DIRTY );
1243  }
1244 
1245  //
1246  // Setup the VolumeLabel string
1247  //
1248 
1249  VolumeLabel.Length = Vcb->Vpb->VolumeLabelLength;
1251  VolumeLabel.Buffer = &Vcb->Vpb->VolumeLabel[0];
1252 
1253  if ( Dirty ) {
1254 
1255  //
1256  // Do not trigger the mounted dirty bit if this is a verify
1257  // and the volume is a boot or paging device. We know that
1258  // a boot or paging device cannot leave the system, and thus
1259  // that on its mount we will have figured this out correctly.
1260  //
1261  // This logic is a reasonable change. Why?
1262  // 'cause setup cracked a non-exclusive DASD handle near the
1263  // end of setup, wrote some data, closed the handle and we
1264  // set the verify bit ... came back around and saw that other
1265  // arbitrary activity had left the volume in a temporarily dirty
1266  // state.
1267  //
1268  // Of course, the real problem is that we don't have a journal.
1269  //
1270 
1271  if (!(IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
1272  IrpContext->MinorFunction == IRP_MN_VERIFY_VOLUME &&
1274 
1277  "FASTFAT: WARNING! Mounting Dirty Volume %Z\n",
1278  &VolumeLabel));
1279 
1281  }
1282 
1283  } else {
1284 
1285  if (FlagOn(Vcb->VcbState, VCB_STATE_FLAG_MOUNTED_DIRTY)) {
1286 
1289  "FASTFAT: Volume %Z has been cleaned.\n",
1290  &VolumeLabel));
1291 
1293 
1294  } else {
1295 
1296  (VOID)FsRtlBalanceReads( Vcb->TargetDeviceObject );
1297  }
1298  }
1299 
1300  } _SEH2_FINALLY {
1301 
1302  FatUnpinBcb( IrpContext, BootSectorBcb );
1303  } _SEH2_END;
1304 }
#define IsBpbFat32(bpb)
Definition: fat.h:101
#define VCB_STATE_FLAG_MOUNTED_DIRTY
Definition: fatstruc.h:558
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define FAT_BOOT_SECTOR_DIRTY
Definition: fat.h:213
#define DPFLTR_INFO_LEVEL
Definition: kdtypes.h:33
VOID FatReadVolumeFile(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN VBO StartingVbo, IN ULONG ByteCount, OUT PBCB *Bcb, OUT PVOID *Buffer)
Definition: cachesup.c:102
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define KdPrintEx(_x_)
Definition: kdfuncs.h:114
struct _BootSector BootSector
Definition: vfat.h:108
#define IRP_MN_VERIFY_VOLUME
Definition: iotypes.h:4048
#define FatUnpinBcb(IRPCONTEXT, BCB)
Definition: fatprocs.h:537
unsigned char BOOLEAN
#define MAXIMUM_VOLUME_LABEL_LENGTH
Definition: iotypes.h:154
#define VCB_STATE_FLAG_BOOT_OR_PAGING_FILE
Definition: fatstruc.h:563
NTSTATUS NTAPI FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice)
Definition: faulttol.c:35
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define Vcb
Definition: cdprocs.h:1425
#define VOID
Definition: acefi.h:82
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
_SEH2_END
Definition: create.c:4424
_SEH2_FINALLY
Definition: create.c:4395

◆ FatCheckFileAccess()

BOOLEAN FatCheckFileAccess ( PIRP_CONTEXT  IrpContext,
IN UCHAR  DirentAttributes,
IN PACCESS_MASK  DesiredAccess 
)

Definition at line 39 of file acchksup.c.

64 {
66 
67  DebugTrace(+1, Dbg, "FatCheckFileAccess\n", 0);
68  DebugTrace( 0, Dbg, "DirentAttributes = %8lx\n", DirentAttributes);
69  DebugTrace( 0, Dbg, "DesiredAccess = %8lx\n", *DesiredAccess);
70 
71  PAGED_CODE();
72 
73  //
74  // This procedures is programmed like a string of filters each
75  // filter checks to see if some access is allowed, if it is not allowed
76  // the filter return FALSE to the user without further checks otherwise
77  // it moves on to the next filter. The filter check is to check for
78  // desired access flags that are not allowed for a particular dirent
79  //
80 
81  Result = TRUE;
82 
83  _SEH2_TRY {
84 
85  //
86  // Check for Volume ID or Device Dirents, these are not allowed user
87  // access at all
88  //
89 
90  if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_VOLUME_ID) ||
91  FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DEVICE)) {
92 
93  DebugTrace(0, Dbg, "Cannot access volume id or device\n", 0);
94 
95  try_return( Result = FALSE );
96  }
97 
98  //
99  // Check the desired access for the object - we only blackball that
100  // we do not understand. The model of filesystems using ACLs is that
101  // they do not type the ACL to the object the ACL is on. Permissions
102  // are not checked for consistency vs. the object type - dir/file.
103  //
104 
105  if (FlagOn(*DesiredAccess, ~(DELETE |
106  READ_CONTROL |
107  WRITE_OWNER |
108  WRITE_DAC |
109  SYNCHRONIZE |
112  FILE_READ_EA |
113  FILE_WRITE_EA |
117  FILE_TRAVERSE |
120  MAXIMUM_ALLOWED))) {
121 
122  DebugTrace(0, Dbg, "Cannot open object\n", 0);
123 
124  try_return( Result = FALSE );
125  }
126 
127  //
128  // Check for a read-only Dirent
129  //
130 
131  if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_READ_ONLY)) {
132 
133  //
134  // Check the desired access for a read-only dirent. AccessMask will contain
135  // the flags we're going to allow.
136  //
137 
143 
144  //
145  // If this is a subdirectory also allow add file/directory and delete.
146  //
147 
148  if (FlagOn(DirentAttributes, FAT_DIRENT_ATTR_DIRECTORY)) {
149 
151  }
152 
153  if (FlagOn(*DesiredAccess, ~AccessMask)) {
154 
155  DebugTrace(0, Dbg, "Cannot open readonly\n", 0);
156 
157  try_return( Result = FALSE );
158  }
159  }
160 
161  try_exit: NOTHING;
162  } _SEH2_FINALLY {
163 
165 
166  DebugTrace(-1, Dbg, "FatCheckFileAccess -> %08lx\n", Result);
167  } _SEH2_END;
168 
169  UNREFERENCED_PARAMETER( IrpContext );
170 
171  return Result;
172 }
#define FAT_DIRENT_ATTR_DEVICE
Definition: fat.h:374
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define FILE_WRITE_EA
Definition: nt_native.h:640
#define TRUE
Definition: types.h:120
#define ACCESS_SYSTEM_SECURITY
Definition: nt_native.h:77
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define DebugTrace(INDENT, LEVEL, X, Y)
Definition: fatdata.h:313
#define FAT_DIRENT_ATTR_READ_ONLY
Definition: fat.h:368
#define FAT_DIRENT_ATTR_DIRECTORY
Definition: fat.h:372
#define WRITE_OWNER
Definition: nt_native.h:60
#define FILE_APPEND_DATA
Definition: nt_native.h:634
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
#define FILE_TRAVERSE
Definition: nt_native.h:643
#define FILE_DELETE_CHILD
Definition: nt_native.h:645
#define FILE_ADD_FILE
Definition: nt_native.h:632
#define FILE_READ_DATA
Definition: nt_native.h:628
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define DebugUnwind(X)
Definition: fatdata.h:315
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
#define try_return(S)
Definition: cdprocs.h:2189
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
#define WRITE_DAC
Definition: nt_native.h:59
#define READ_CONTROL
Definition: nt_native.h:58
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_ADD_SUBDIRECTORY
Definition: nt_native.h:635
#define FILE_EXECUTE
Definition: nt_native.h:642
#define NOTHING
Definition: env_spec_w32.h:461
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define SYNCHRONIZE
Definition: nt_native.h:61
_SEH2_END
Definition: create.c:4424
BOOLEAN FatCheckFileAccess(PIRP_CONTEXT IrpContext, IN UCHAR DirentAttributes, IN PACCESS_MASK DesiredAccess)
Definition: acchksup.c:39
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
_SEH2_FINALLY
Definition: create.c:4395
#define FILE_READ_EA
Definition: nt_native.h:638
#define Dbg
Definition: acchksup.c:22
#define FAT_DIRENT_ATTR_VOLUME_ID
Definition: fat.h:371
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define DELETE
Definition: nt_native.h:57

Referenced by FatCheckFileAccess().

◆ FatCheckManageVolumeAccess()

BOOLEAN FatCheckManageVolumeAccess ( _In_ PIRP_CONTEXT  IrpContext,
_In_ PACCESS_STATE  AccessState,
_In_ KPROCESSOR_MODE  ProcessorMode 
)

Definition at line 176 of file acchksup.c.

201 {
202  PRIVILEGE_SET PrivilegeSet;
203 
204  PAGED_CODE();
205 
206  PrivilegeSet.PrivilegeCount = 1;
207  PrivilegeSet.Control = PRIVILEGE_SET_ALL_NECESSARY;
208  PrivilegeSet.Privilege[0].Luid = RtlConvertLongToLuid( SE_MANAGE_VOLUME_PRIVILEGE );
209  PrivilegeSet.Privilege[0].Attributes = 0;
210 
211  if (SePrivilegeCheck( &PrivilegeSet,
212  &AccessState->SubjectSecurityContext,
213  ProcessorMode )) {
214 
215  return TRUE;
216  }
217 
218  UNREFERENCED_PARAMETER( IrpContext );
219 
220  return FALSE;
221 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
$ULONG Control
Definition: setypes.h:87
#define PAGED_CODE()
Definition: video.h:57
#define PRIVILEGE_SET_ALL_NECESSARY
Definition: setypes.h:83
$ULONG PrivilegeCount
Definition: setypes.h:86
_In_opt_ PVOID _In_opt_ PUNICODE_STRING _In_ PSECURITY_DESCRIPTOR _In_ PACCESS_STATE AccessState
Definition: sefuncs.h:414
BOOLEAN NTAPI SePrivilegeCheck(PPRIVILEGE_SET Privileges, PSECURITY_SUBJECT_CONTEXT SubjectContext, KPROCESSOR_MODE PreviousMode)
Definition: priv.c:491
#define SE_MANAGE_VOLUME_PRIVILEGE
Definition: security.c:682
LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]
Definition: setypes.h:88

Referenced by FatExplicitDeviceAccessGranted().

◆ FatCleanVolumeDpc()

VOID NTAPI FatCleanVolumeDpc ( _In_ PKDPC  Dpc,
_In_opt_ PVOID  DeferredContext,
_In_opt_ PVOID  SystemArgument1,
_In_opt_ PVOID  SystemArgument2 
)

Definition at line 654 of file verfysup.c.

679 {
680  PVCB Vcb;
682 
686 
688 
689 
690  //
691  // If there is still dirty data (highly unlikely), set the timer for a
692  // second in the future.
693  //
694 
695  if (CcIsThereDirtyData(Vcb->Vpb)) {
696 
697  LARGE_INTEGER TwoSecondsFromNow;
698 
699  TwoSecondsFromNow.QuadPart = (LONG)-2*1000*1000*10;
700 
701  KeSetTimer( &Vcb->CleanVolumeTimer,
702  TwoSecondsFromNow,
703  &Vcb->CleanVolumeDpc );
704 
705  return;
706  }
707 
708  //
709  // If we couldn't get pool, oh well....
710  //
711 
712 #ifndef __REACTOS__
713  Packet = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF');
714 #else
716 #endif
717 
718  if ( Packet ) {
719 
720  Packet->Vcb = Vcb;
721  Packet->Irp = NULL;
722 
723  //
724  // Clear the dirty flag now since we cannot synchronize after this point.
725  //
726 
727  ClearFlag( Packet->Vcb->VcbState, VCB_STATE_FLAG_VOLUME_DIRTY );
728 
730 
731 #ifdef _MSC_VER
732 #pragma prefast( suppress:28159, "prefast indicates this is an obsolete API, but it is ok for fastfat to keep using it" )
733 #endif
735  }
736 
737  return;
738 }
#define VCB_STATE_FLAG_VOLUME_DIRTY
Definition: fatstruc.h:557
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
Definition: work.c:717
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1530
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOLEAN NTAPI CcIsThereDirtyData(IN PVPB Vpb)
Definition: logsup.c:55
Definition: cdstruc.h:504
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:675
_In_ LARGE_INTEGER _In_opt_ PKDPC Dpc
Definition: kefuncs.h:524
#define ExInitializeWorkItem(Item, Routine, Context)
Definition: exfuncs.h:265
VOID NTAPI FatDeferredCleanVolume(_In_ PVOID Parameter)
Definition: verfysup.c:499
#define Vcb
Definition: cdprocs.h:1425
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _VCB * PVCB
Definition: fatstruc.h:553
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:675
LONGLONG QuadPart
Definition: typedefs.h:112
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:675

◆ FatCloseEaFile()

VOID FatCloseEaFile ( IN PIRP_CONTEXT  IrpContext,
IN PVCB  Vcb,
IN BOOLEAN  FlushFirst 
)

Definition at line 1079 of file cachesup.c.

1106 {
1107  PFILE_OBJECT EaFileObject = Vcb->VirtualEaFile;
1108 
1109  PAGED_CODE();
1110 
1111  DebugTrace(+1, Dbg, "FatCloseEaFile\n", 0);
1112  DebugTrace( 0, Dbg, "Vcb = %p\n", Vcb);
1113 
1114  NT_ASSERT( FatVcbAcquiredExclusive(IrpContext, Vcb) );
1115 
1116  if (EaFileObject != NULL) {
1117 
1118  EaFileObject = Vcb->VirtualEaFile;
1119 
1120  if (FlushFirst) {
1121 
1122  CcFlushCache( Vcb->VirtualEaFile->SectionObjectPointer, NULL, 0, NULL );
1123  }
1124 
1125  Vcb->VirtualEaFile = NULL;
1126 
1127  //
1128  // Empty the Mcb for the Ea file.
1129  //
1130 
1131  FatRemoveMcbEntry( Vcb, &Vcb->EaFcb->Mcb, 0, 0xFFFFFFFF );
1132 
1133  //
1134  // Uninitialize the cache for this file object and dereference it.
1135  //
1136 
1137  FatSyncUninitializeCacheMap( IrpContext, EaFileObject );
1138 
1139  ObDereferenceObject( EaFileObject );
1140  }
1141 
1142  DebugTrace(-1, Dbg, "FatCloseEaFile -> %p\n", EaFileObject);
1143 }
VOID FatSyncUninitializeCacheMap(IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject)
Definition: cachesup.c:1812
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
#define DebugTrace(INDENT, LEVEL, X, Y)
Definition: fatdata.h:313
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
#define PAGED_CODE()
Definition: video.h:57
#define Dbg
Definition: cachesup.c:29
VOID FatRemoveMcbEntry(IN PVCB Vcb, IN PLARGE_MCB Mcb, IN VBO Vbo, IN ULONG SectorCount)
Definition: fsctrl.c:599
smooth NULL
Definition: ftsmooth.c:416
#define Vcb
Definition: cdprocs.h:1425
* PFILE_OBJECT
Definition: iotypes.h:1954
#define FatVcbAcquiredExclusive(IRPCONTEXT, VCB)
Definition: fatprocs.h:1486
#define NT_ASSERT
Definition: rtlfuncs.h:3312

Referenced by FatTearDownVcb().

◆ FatCommonQueryEa()

NTSTATUS FatCommonQueryEa ( IN PIRP_CONTEXT  IrpContext,
IN PIRP  Irp 
)

Definition at line 250 of file ea.c.

272 {
273 #if 0
275 
277 
278  PUCHAR Buffer;
279  ULONG UserBufferLength;
280 
281  PUCHAR UserEaList;
282  ULONG UserEaListLength;
283  ULONG UserEaIndex;
286  BOOLEAN IndexSpecified;
287 
288  PVCB Vcb;
289  PCCB Ccb;
290 
291  PFCB Fcb;
292  PDIRENT Dirent;
293  PBCB Bcb;
294 
296  PBCB EaBcb;
297  BOOLEAN LockedEaFcb;
298 
299  PEA_SET_HEADER EaSetHeader;
301 
302  USHORT ExtendedAttributes;
303 #endif
304 
305  PAGED_CODE();
306 
309 
310 #if 0
311  //
312  // Get the current Irp stack location
313  //
314 
316 
317  DebugTrace(+1, Dbg, "FatCommonQueryEa...\n", 0);
318  DebugTrace( 0, Dbg, " Wait = %08lx\n", FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT));
319  DebugTrace( 0, Dbg, " Irp = %p\n", Irp );
320  DebugTrace( 0, Dbg, " ->SystemBuffer = %p\n", Irp->AssociatedIrp.SystemBuffer );
321  DebugTrace( 0, Dbg, " ->Length = %08lx\n", IrpSp->Parameters.QueryEa.Length );
322  DebugTrace( 0, Dbg, " ->EaList = %08lx\n", IrpSp->Parameters.QueryEa.EaList );
323  DebugTrace( 0, Dbg, " ->EaListLength = %08lx\n", IrpSp->Parameters.QueryEa.EaListLength );
324  DebugTrace( 0, Dbg, " ->EaIndex = %08lx\n", IrpSp->Parameters.QueryEa.EaIndex );
325  DebugTrace( 0, Dbg, " ->RestartScan = %08lx\n", FlagOn(IrpSp->Flags, SL_RESTART_SCAN));
326  DebugTrace( 0, Dbg, " ->ReturnSingleEntry = %08lx\n", FlagOn(IrpSp->Flags, SL_RETURN_SINGLE_ENTRY));
327  DebugTrace( 0, Dbg, " ->IndexSpecified = %08lx\n", FlagOn(IrpSp->Flags, SL_INDEX_SPECIFIED));
328 
329  Irp->IoStatus.Status = STATUS_SUCCESS;
330  Irp->IoStatus.Information = 0;
331 
332  //
333  // Check that the file object is associated with either a user file
334  // or directory open. We don't allow Ea operations on the root
335  // directory.
336  //
337 
338  {
339  TYPE_OF_OPEN OpenType;
340 
341  if (((OpenType = FatDecodeFileObject( IrpSp->FileObject,
342  &Vcb,
343  &Fcb,
344  &Ccb )) != UserFileOpen
345  && OpenType != UserDirectoryOpen) ||
346 
347  (NodeType( Fcb )) == FAT_NTC_ROOT_DCB) {
348 
350 
351  DebugTrace(-1, Dbg,
352  "FatCommonQueryEa -> %08lx\n",
354 
356  }
357  }
358 
359  //
360  // Fat32 does not support ea's.
361  //
362 
363  if (FatIsFat32(Vcb)) {
364 
366  DebugTrace(-1, Dbg,
367  "FatCommonQueryEa -> %08lx\n",
370  }
371 
372  //
373  // Acquire shared access to the Fcb and enqueue the Irp if we didn't
374  // get access.
375  //
376 
377  if (!FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT )) {
378 
379  DebugTrace(0, Dbg, "FatCommonQueryEa: Thread can't wait\n", 0);
380 
381  Status = FatFsdPostRequest( IrpContext, Irp );
382 
383  DebugTrace(-1, Dbg, "FatCommonQueryEa -> %08lx\n", Status );
384 
385  return Status;
386  }
387 
388  FatAcquireSharedFcb( IrpContext, Fcb );
389 
390  //
391  // Reference our input parameters to make things easier
392  //
393 
394  UserBufferLength = IrpSp->Parameters.QueryEa.Length;
395  UserEaList = IrpSp->Parameters.QueryEa.EaList;
396  UserEaListLength = IrpSp->Parameters.QueryEa.EaListLength;
397  UserEaIndex = IrpSp->Parameters.QueryEa.EaIndex;
400  IndexSpecified = BooleanFlagOn(IrpSp->Flags, SL_INDEX_SPECIFIED);
401 
402  //
403  // Initialize our local values.
404  //
405 
406  LockedEaFcb = FALSE;
407  Bcb = NULL;
408  EaBcb = NULL;
409 
411 
412  RtlZeroMemory( &EaSetRange, sizeof( EA_RANGE ));
413 
414  try {
415 
416  PPACKED_EA FirstPackedEa;
417  ULONG PackedEasLength;
418 
419  Buffer = FatMapUserBuffer( IrpContext, Irp );
420 
421  //
422  // We verify that the Fcb is still valid.
423  //
424 
425  FatVerifyFcb( IrpContext, Fcb );
426 
427  //
428  // We need to get the dirent for the Fcb to recover the Ea handle.
429  //
430 
431  FatGetDirentFromFcbOrDcb( IrpContext, Fcb, &Dirent, &Bcb );
432 
433  //
434  // Verify that the Ea file is in a consistant state. If the
435  // Ea modification count in the Fcb doesn't match that in
436  // the CCB, then the Ea file has been changed from under
437  // us. If we are not starting the search from the beginning
438  // of the Ea set, we return an error.
439  //
440 
441  if (UserEaList == NULL
442  && Ccb->OffsetOfNextEaToReturn != 0
443  && !IndexSpecified
444  && !RestartScan
446 
447  DebugTrace(0, Dbg,
448  "FatCommonQueryEa: Ea file in unknown state\n", 0);
449 
451 
452  try_return( Status );
453  }
454 
455  //
456  // Show that the Ea's for this file are consistant for this
457  // file handle.
458  //
459 
461 
462  //
463  // If the handle value is 0, then the file has no Eas. We dummy up
464  // an ea list to use below.
465  //
466 
467  ExtendedAttributes = Dirent->ExtendedAttributes;
468 
469  FatUnpinBcb( IrpContext, Bcb );
470 
471  if (ExtendedAttributes == 0) {
472 
473  DebugTrace(0, Dbg,
474  "FatCommonQueryEa: Zero handle, no Ea's for this file\n", 0);
475 
476  FirstPackedEa = (PPACKED_EA) NULL;
477 
478  PackedEasLength = 0;
479 
480  } else {
481 
482  //
483  // We need to get the Ea file for this volume. If the
484  // operation doesn't complete due to blocking, then queue the
485  // Irp to the Fsp.
486  //
487 
488  FatGetEaFile( IrpContext,
489  Vcb,
490  &EaDirent,
491  &EaBcb,
492  FALSE,
493  FALSE );
494 
495  LockedEaFcb = TRUE;
496 
497  //
498  // If the above operation completed and the Ea file did not exist,
499  // the disk has been corrupted. There is an existing Ea handle
500  // without any Ea data.
501  //
502 
503  if (Vcb->VirtualEaFile == NULL) {
504 
505  DebugTrace(0, Dbg,
506  "FatCommonQueryEa: No Ea file found when expected\n", 0);
507 
509 
510  try_return( Status );
511  }
512 
513  //
514  // We need to try to get the Ea set for the desired file. If
515  // blocking is necessary then we'll post the request to the Fsp.
516  //
517 
518  FatReadEaSet( IrpContext,
519  Vcb,
520  ExtendedAttributes,
521  &Fcb->ShortName.Name.Oem,
522  TRUE,
523  &EaSetRange );
524 
525  EaSetHeader = (PEA_SET_HEADER) EaSetRange.Data;
526 
527  //
528  // Find the start and length of the Eas.
529  //
530 
531  FirstPackedEa = (PPACKED_EA) EaSetHeader->PackedEas;
532 
533  PackedEasLength = GetcbList( EaSetHeader ) - 4;
534  }
535 
536  //
537  // Protect our access to the user buffer since IO dosn't do this
538  // for us in this path unless we had specified that our driver
539  // requires buffering for these large requests. We don't, so ...
540  //
541 
542  try {
543 
544  //
545  // Let's clear the output buffer.
546  //
547 
548  RtlZeroMemory( Buffer, UserBufferLength );
549 
550  //
551  // We now satisfy the user's request depending on whether he
552  // specified an Ea name list, an Ea index or restarting the
553  // search.
554  //
555 
556  //
557  // The user has supplied a list of Ea names.
558  //
559 
560  if (UserEaList != NULL) {
561 
562  Irp->IoStatus = FatQueryEaUserEaList( IrpContext,
563  Ccb,
564  FirstPackedEa,
565  PackedEasLength,
566  Buffer,
567  UserBufferLength,
568  UserEaList,
569  UserEaListLength,
571 
572  //
573  // The user supplied an index into the Ea list.
574  //
575 
576  } else if (IndexSpecified) {
577 
578  Irp->IoStatus = FatQueryEaIndexSpecified( IrpContext,
579  Ccb,
580  FirstPackedEa,
581  PackedEasLength,
582  Buffer,
583  UserBufferLength,
584  UserEaIndex,
586 
587  //
588  // Else perform a simple scan, taking into account the restart
589  // flag and the position of the next Ea stored in the Ccb.
590  //
591 
592  } else {
593 
594  Irp->IoStatus = FatQueryEaSimpleScan( IrpContext,
595  Ccb,
596  FirstPackedEa,
597  PackedEasLength,
598  Buffer,
599  UserBufferLength,
602  ? 0
603  : Ccb->OffsetOfNextEaToReturn );
604  }
605 
608 
609  //
610  // We must have had a problem filling in the user's buffer, so fail.
611  //
612 
613  Irp->IoStatus.Status = GetExceptionCode();
614  Irp->IoStatus.Information = 0;
615  }
616 
617  Status = Irp->IoStatus.Status;
618 
619  try_exit: NOTHING;
620  } finally {
621 
623 
624  //
625  // Release the Fcb for the file object, and the Ea Fcb if
626  // successfully locked.
627  //
628 
629  FatReleaseFcb( IrpContext, Fcb );
630 
631  if (LockedEaFcb) {
632 
633  FatReleaseFcb( IrpContext, Vcb->EaFcb );
634  }
635 
636  //
637  // Unpin the dirents for the Fcb, EaFcb and EaSetFcb if necessary.
638  //
639 
640  FatUnpinBcb( IrpContext, Bcb );
641  FatUnpinBcb( IrpContext, EaBcb );
642 
643  FatUnpinEaRange( IrpContext, &EaSetRange );
644 
645  if (!AbnormalTermination()) {
646 
647  FatCompleteRequest( IrpContext, Irp, Status );
648  }
649 
650  DebugTrace(-1, Dbg, "FatCommonQueryEa -> %08lx\n", Status);
651  }
652 
653  return Status;
654 #endif
655 }
#define STATUS_EAS_NOT_SUPPORTED
Definition: ntstatus.h:301
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
Definition: filter.c:61
IO_STATUS_BLOCK FatQueryEaSimpleScan(IN PIRP_CONTEXT IrpContext, OUT PCCB Ccb, IN PPACKED_EA FirstPackedEa, IN ULONG PackedEasLength, OUT PUCHAR UserBuffer, IN ULONG UserBufferLength, IN BOOLEAN ReturnSingleEntry, ULONG StartOffset)
#define TRUE
Definition: types.h:120
#define IRP_CONTEXT_FLAG_WAIT
Definition: cdstruc.h:1221
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:402
PVOID FatMapUserBuffer(IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp)
Definition: deviosup.c:3369
IO_STATUS_BLOCK FatQueryEaIndexSpecified(IN PIRP_CONTEXT IrpContext, OUT PCCB Ccb, IN PPACKED_EA FirstPackedEa, IN ULONG PackedEasLength, OUT PUCHAR UserBuffer, IN ULONG UserBufferLength, IN ULONG UserEaIndex, IN BOOLEAN ReturnSingleEntry)
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN _In_ ULONG _In_opt_ PULONG _In_ BOOLEAN RestartScan
Definition: fltkernel.h:2298
#define AbnormalTermination()
Definition: exception.h:73
#define SL_INDEX_SPECIFIED
Definition: iotypes.h:1793
#define FatCompleteRequest(IRPCONTEXT, IRP, STATUS)
Definition: fatprocs.h:2621
_In_ PIRP Irp
Definition: csq.h:116
IO_STATUS_BLOCK FatQueryEaUserEaList(IN PIRP_CONTEXT IrpContext, OUT PCCB Ccb, IN PPACKED_EA FirstPackedEa, IN ULONG PackedEasLength, OUT PUCHAR UserBuffer, IN ULONG UserBufferLength, IN PUCHAR UserEaList, IN ULONG UserEaListLength, IN BOOLEAN ReturnSingleEntry)
Definition: cdstruc.h:908
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
Definition: cdstruc.h:1073
unsigned char * PUCHAR
Definition: retypes.h:3
#define Dbg
Definition: ea.c:23
LONG NTSTATUS
Definition: precomp.h:26
#define DebugTrace(INDENT, LEVEL, X, Y)
Definition: fatdata.h:313
#define STATUS_NO_EAS_ON_FILE
Definition: ntstatus.h:304
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN ReturnSingleEntry
Definition: fltkernel.h:2295
VOID FatUnpinEaRange(IN PIRP_CONTEXT IrpContext, IN OUT PEA_RANGE EaRange)
Definition: easup.c:3782
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
Definition: cdstruc.h:504
ULONG EaModificationCount
Definition: fatstruc.h:1103
#define PAGED_CODE()
Definition: video.h:57
IN OUT PVCB OUT PDIRENT * EaDirent
Definition: fatprocs.h:904
VOID FatReadEaSet(IN PIRP_CONTEXT IrpContext, IN PVCB Vcb, IN USHORT EaHandle, IN POEM_STRING FileName, IN BOOLEAN ReturnEntireSet, OUT PEA_RANGE EaSetRange)
Definition: easup.c:1306
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define FatUnpinBcb(IRPCONTEXT, BCB)
Definition: fatprocs.h:537
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS FatCommonQueryEa(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: ea.c:250
Definition: bufpool.h:45
NodeType
Definition: Node.h:5
OEM_STRING Oem
Definition: fatstruc.h:689
#define GetExceptionCode()
Definition: exception.h:65
#define DebugUnwind(X)
Definition: fatdata.h:315
#define FatReleaseFcb(IRPCONTEXT, Fcb)
Definition: fatprocs.h:1635
#define try_return(S)
Definition: cdprocs.h:2189
IN PVCB IN ULONG IN PBCB OUT PDIRENT OUT PUSHORT OUT PEA_RANGE EaSetRange
Definition: fatprocs.h:936
#define Vcb
Definition: cdprocs.h:1425
EA_SET_HEADER * PEA_SET_HEADER
Definition: fat.h:672
#define except(x)
Definition: btrfs_drv.h:127
enum _TYPE_OF_OPEN TYPE_OF_OPEN
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define NOTHING
Definition: env_spec_w32.h:461
PACKED_EA * PPACKED_EA
Definition: fat.h:700
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define FatIsFat32(VCB)
Definition: fatprocs.h:1437
Status
Definition: gdiplustypes.h:24
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
PFILE_OBJECT FileObject
Definition: iotypes.h:2812
#define SL_RETURN_SINGLE_ENTRY
Definition: iotypes.h:1792
unsigned short USHORT
Definition: pedump.c:61
#define FAT_NTC_ROOT_DCB
Definition: nodetype.h:31
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
union _FILE_NAME_NODE::@683 Name
#define SL_RESTART_SCAN
Definition: iotypes.h:1791
UCHAR PackedEas[1]
Definition: fat.h:670
NTSTATUS FatFsdPostRequest(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: workque.c:229
#define GetcbList(EASET)
Definition: fat.h:678
unsigned int ULONG
Definition: retypes.h:1
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: cdprocs.h:429
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
_In_ PFCB Fcb
Definition: cdprocs.h:151
IN OUT PVCB OUT PDIRENT OUT PBCB * EaBcb
Definition: fatprocs.h:904
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define STATUS_EA_CORRUPT_ERROR
Definition: ntstatus.h:305
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1111
TYPE_OF_OPEN FatDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
Definition: filobsup.c:176

Referenced by _Function_class_(), FatCommonQueryEa(), and FatFspDispatch().

◆ FatCommonSetEa()

NTSTATUS FatCommonSetEa ( IN PIRP_CONTEXT  IrpContext,
IN PIRP  Irp 
)

Definition at line 659 of file ea.c.

681 {
682 #if 0
684 
686 
687  USHORT ExtendedAttributes;
688 
689  PUCHAR Buffer;
690  ULONG UserBufferLength;
691 
692  PVCB Vcb;
693  PCCB Ccb;
694 
695  PFCB Fcb;
696  PDIRENT Dirent;
697  PBCB Bcb = NULL;
698 
700  PBCB EaBcb = NULL;
701 
702  PEA_SET_HEADER EaSetHeader = NULL;
703 
704  PEA_SET_HEADER PrevEaSetHeader;
705  PEA_SET_HEADER NewEaSetHeader;
707 
708  BOOLEAN AcquiredVcb = FALSE;
709  BOOLEAN AcquiredFcb = FALSE;
710  BOOLEAN AcquiredParentDcb = FALSE;
711  BOOLEAN AcquiredRootDcb = FALSE;
712  BOOLEAN AcquiredEaFcb = FALSE;
713 #endif
714 
715  PAGED_CODE();
716 
719 
720 #if 0
721 
722  //
723  // The following booleans are used in the unwind process.
724  //
725 
726  //
727  // Get the current Irp stack location
728  //
729 
731 
732  DebugTrace(+1, Dbg, "FatCommonSetEa...\n", 0);
733  DebugTrace( 0, Dbg, " Wait = %08lx\n", FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT));
734  DebugTrace( 0, Dbg, " Irp = %p\n", Irp );
735  DebugTrace( 0, Dbg, " ->SystemBuffer = %p\n", Irp->AssociatedIrp.SystemBuffer );
736  DebugTrace( 0, Dbg, " ->Length = %08lx\n", IrpSp->Parameters.SetEa.Length );
737 
738  Irp->IoStatus.Status = STATUS_SUCCESS;
739  Irp->IoStatus.Information = 0;
740 
741  //
742  // Check that the file object is associated with either a user file
743  // or directory open.
744  //
745 
746  {
747  TYPE_OF_OPEN OpenType;
748 
749  if (((OpenType = FatDecodeFileObject( IrpSp->FileObject,
750  &Vcb,
751  &Fcb,
752  &Ccb )) != UserFileOpen
753  && OpenType != UserDirectoryOpen) ||
754 
755  (NodeType( Fcb )) == FAT_NTC_ROOT_DCB) {
756 
758 
759  DebugTrace(-1, Dbg,
760  "FatCommonSetEa -> %08lx\n",
762 
764  }
765  }
766 
767  //
768  // Fat32 does not support ea's.
769  //
770 
771  if (FatIsFat32(Vcb)) {
772 
774  DebugTrace(-1, Dbg,
775  "FatCommonSetEa -> %08lx\n",
778  }
779 
780  //
781  // Reference our input parameters to make things easier
782  //
783 
784  UserBufferLength = IrpSp->Parameters.SetEa.Length;
785 
786  //
787  // Since we ask for no outside help (direct or buffered IO), it
788  // is our responsibility to insulate ourselves from the
789  // deviousness of the user above. Now, buffer and validate the
790  // contents.
791  //
792 
793  Buffer = FatBufferUserBuffer( IrpContext, Irp, UserBufferLength );
794 
795  //
796  // Check the validity of the buffer with the new eas. We really
797  // need to do this always since we don't know, if it was already
798  // buffered, that we buffered and checked it or some overlying
799  // filter buffered without checking.
800  //
801 
803  UserBufferLength,
804  (PULONG)&Irp->IoStatus.Information );
805 
806  if (!NT_SUCCESS( Status )) {
807 
808  FatCompleteRequest( IrpContext, Irp, Status );
809  DebugTrace(-1, Dbg,
810  "FatCommonSetEa -> %08lx\n",
811  Status);
812  return Status;
813  }
814 
815  //
816  // Acquire exclusive access to the Fcb. If this is a write-through operation
817  // we will need to pick up the other possible streams that can be modified in
818  // this operation so that the locking order is preserved - the root directory
819  // (dirent addition if EA database doesn't already exist) and the parent
820  // directory (addition of the EA handle to the object's dirent).
821  //
822  // We are primarily synchronizing with directory enumeration here.
823  //
824  // If we cannot wait need to send things off to the fsp.
825  //
826 
827  if (!FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT)) {
828 
829  DebugTrace(0, Dbg, "FatCommonSetEa: Set Ea must be waitable\n", 0);
830 
831  Status = FatFsdPostRequest( IrpContext, Irp );
832 
833  DebugTrace(-1, Dbg, "FatCommonSetEa -> %08lx\n", Status );
834 
835  return Status;
836  }
837 
838  //
839  // Set this handle as having modified the file
840  //
841 
842  IrpSp->FileObject->Flags |= FO_FILE_MODIFIED;
843 
844  RtlZeroMemory( &EaSetRange, sizeof( EA_RANGE ));
845 
846  try {
847 
848  ULONG PackedEasLength;
849  BOOLEAN PreviousEas;
850  ULONG AllocationLength;
851  ULONG BytesPerCluster;
853 
855 
856  //
857  // Now go pick up everything
858  //
859 
860  FatAcquireSharedVcb( IrpContext, Fcb->Vcb );
861  AcquiredVcb = TRUE;
862  FatAcquireExclusiveFcb( IrpContext, Fcb );
863  AcquiredFcb = TRUE;
864 
865  if (FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WRITE_THROUGH)) {
866 
867  if (Fcb->ParentDcb) {
868 
869  FatAcquireExclusiveFcb( IrpContext, Fcb->ParentDcb );
870  AcquiredParentDcb = TRUE;
871  }
872 
873  FatAcquireExclusiveFcb( IrpContext, Fcb->Vcb->RootDcb );
874  AcquiredRootDcb = TRUE;
875  }
876 
877  //
878  // We verify that the Fcb is still valid.
879  //
880 
881  FatVerifyFcb( IrpContext, Fcb );
882 
883  //
884  // We need to get the dirent for the Fcb to recover the Ea handle.
885  //
886 
887  FatGetDirentFromFcbOrDcb( IrpContext, Fcb, &Dirent, &Bcb );
888 
889  DebugTrace(0, Dbg, "FatCommonSetEa: Dirent Address -> %p\n",
890  Dirent );
891  DebugTrace(0, Dbg, "FatCommonSetEa: Dirent Bcb -> %p\n",
892  Bcb);
893 
894  //
895  // If the handle value is 0, then the file has no Eas. In that
896  // case we allocate memory to hold the Eas to be added. If there
897  // are existing Eas for the file, then we must read from the
898  // file and copy the Eas.
899  //
900 
901  ExtendedAttributes = Dirent->ExtendedAttributes;
902 
903  FatUnpinBcb( IrpContext, Bcb );
904 
905  if (ExtendedAttributes == 0) {
906 
907  PreviousEas = FALSE;
908 
909  DebugTrace(0, Dbg,
910  "FatCommonSetEa: File has no current Eas\n", 0 );
911 
912  } else {
913 
914  PreviousEas = TRUE;
915 
916  DebugTrace(0, Dbg, "FatCommonSetEa: File has previous Eas\n", 0 );
917 
918  FatGetEaFile( IrpContext,
919  Vcb,
920  &EaDirent,
921  &EaBcb,
922  FALSE,
923  TRUE );
924 
925  AcquiredEaFcb = TRUE;
926 
927  //
928  // If we didn't get the file then there is an error on
929  // the disk.
930  //
931 
932  if (Vcb->VirtualEaFile == NULL) {
933 
935  try_return( Status );
936  }
937  }
938 
939  DebugTrace(0, Dbg, "FatCommonSetEa: EaBcb -> %p\n", EaBcb);
940 
941  DebugTrace(0, Dbg, "FatCommonSetEa: EaDirent -> %p\n", EaDirent);
942 
943  //
944  // If the file has existing ea's, we need to read them to
945  // determine the size of the buffer allocation.
946  //
947 
948  if (PreviousEas) {
949 
950  //
951  // We need to try to get the Ea set for the desired file.
952  //
953 
954  FatReadEaSet( IrpContext,
955  Vcb,
956  ExtendedAttributes,
957  &Fcb->ShortName.Name.Oem,
958  TRUE,
959  &EaSetRange );
960 
961  PrevEaSetHeader = (PEA_SET_HEADER) EaSetRange.Data;
962 
963  //
964  // We now must allocate pool memory for our copy of the
965  // EaSetHeader and then copy the Ea data into it. At that
966  // time we can unpin the EaSet.
967  //
968 
969  PackedEasLength = GetcbList( PrevEaSetHeader ) - 4;
970 
971  //
972  // Else we will create a dummy EaSetHeader.
973  //
974 
975  } else {
976 
977  PackedEasLength = 0;
978  }
979 
980  BytesPerCluster = 1 << Vcb->AllocationSupport.LogOfBytesPerCluster;
981 
982  AllocationLength = (PackedEasLength
984  + BytesPerCluster - 1)
985  & ~(BytesPerCluster - 1);
986 
987  EaSetHeader = FsRtlAllocatePoolWithTag( PagedPool,
988  AllocationLength,
990 
991  //
992  // Copy the existing Eas over to pool memory.
993  //
994 
995  if (PreviousEas) {
996 
997  RtlCopyMemory( EaSetHeader, PrevEaSetHeader, AllocationLength );
998