ReactOS 0.4.15-dev-8093-g3285f69
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 80 of file fatprocs.h.

◆ BlockAlign

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

Definition at line 3103 of file fatprocs.h.

◆ BlockAlignTruncate

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

Definition at line 3104 of file fatprocs.h.

◆ CanFsdWait

#define CanFsdWait (   IRP)    IoIsOperationSynchronous(Irp)

Definition at line 2370 of file fatprocs.h.

◆ CompareNames

#define CompareNames (   NAMEA,
  NAMEB 
)
Value:
( \
*(PUCHAR)(NAMEA)->Buffer != *(PUCHAR)(NAMEB)->Buffer ? \
*(PUCHAR)(NAMEA)->Buffer < *(PUCHAR)(NAMEB)->Buffer ? \
FatCompareNames((PSTRING)(NAMEA), (PSTRING)(NAMEB)) \
)
@ IsLessThan
Definition: fatprocs.h:1884
@ IsGreaterThan
Definition: fatprocs.h:1885
unsigned char * PUCHAR
Definition: typedefs.h:53

Definition at line 1899 of file fatprocs.h.

◆ CopyU4char

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

Definition at line 2153 of file fatprocs.h.

◆ CopyUchar1

#define CopyUchar1 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR1 *)(Dst)) = *((UNALIGNED UCHAR1 *)(Src)); \
}

Definition at line 2133 of file fatprocs.h.

◆ CopyUchar2

#define CopyUchar2 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR2 *)(Dst)) = *((UNALIGNED UCHAR2 *)(Src)); \
}

Definition at line 2141 of file fatprocs.h.

◆ CopyUchar4

#define CopyUchar4 (   Dst,
  Src 
)
Value:
{ \
*((UCHAR4 *)(Dst)) = *((UNALIGNED UCHAR4 *)(Src)); \
}

Definition at line 2149 of file fatprocs.h.

◆ DebugBreakOnStatus

#define DebugBreakOnStatus (   S)

Definition at line 2974 of file fatprocs.h.

◆ FAT_CREATE_INITIAL_NAME_BUF_SIZE

#define FAT_CREATE_INITIAL_NAME_BUF_SIZE   32

Definition at line 111 of file fatprocs.h.

◆ FatAcquireDirectoryFileMutex

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

Definition at line 1508 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:1215
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
FAT_DATA FatData
Definition: fatdata.c:56
ERESOURCE Resource
Definition: fatstruc.h:68
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Definition at line 1387 of file fatprocs.h.

◆ FatAcquireExclusiveVcb

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

Definition at line 1460 of file fatprocs.h.

◆ FatAcquireExclusiveVcbNoOpCheck

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

Definition at line 1461 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 VOID
Definition: acefi.h:82
struct _VCB VCB
#define NULL
Definition: types.h:112
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define FatAcquireExclusiveVcb(IC, V)
Definition: fatprocs.h:1460
PFCB FatGetNextFcbBottomUp(IN PIRP_CONTEXT IrpContext, IN PFCB Fcb, IN PFCB TerminationFcb)
Definition: strucsup.c:2525
Definition: cdstruc.h:902

Definition at line 1409 of file fatprocs.h.

◆ FatAcquireSharedGlobal

#define FatAcquireSharedGlobal (   IRPCONTEXT)
Value:
( \
ExAcquireResourceSharedLite( &FatData.Resource, BooleanFlagOn((IRPCONTEXT)->Flags, IRP_CONTEXT_FLAG_WAIT) ) \
)

Definition at line 1391 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
#define RtlEqualMemory(a, b, c)
Definition: kdvm.h:18
uint32_t ULONG
Definition: typedefs.h:59

Definition at line 1158 of file fatprocs.h.

◆ FatCompleteRequest

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

Definition at line 2633 of file fatprocs.h.

◆ FatConvertToSharedFcb

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

Definition at line 1609 of file fatprocs.h.

◆ FatDeleteIrpContext

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

Definition at line 1762 of file fatprocs.h.

◆ FatDeleteResource

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

Definition at line 1632 of file fatprocs.h.

◆ FatDeviceIsFatFsdo

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

Definition at line 3095 of file fatprocs.h.

◆ FatDirectoryKey

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

Definition at line 850 of file fatprocs.h.

◆ FATDOT

#define FATDOT   ((ULONG)0x2020202E)

Definition at line 3074 of file fatprocs.h.

◆ FATDOTDOT

#define FATDOTDOT   ((ULONG)0x20202E2E)

Definition at line 3075 of file fatprocs.h.

◆ FatFcbAcquiredExclusive

#define FatFcbAcquiredExclusive (   IRPCONTEXT,
  FCB 
)
Value:
( \
ExIsResourceAcquiredExclusiveLite((FCB)->Header.Resource) \
)

Definition at line 1504 of file fatprocs.h.

◆ FatFcbAcquiredShared

#define FatFcbAcquiredShared (   IRPCONTEXT,
  FCB 
)
Value:
( \
ExIsResourceAcquiredSharedLite((FCB)->Header.Resource) \
)

Definition at line 1500 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_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB ParentDcb
Definition: create.c:4141
#define FATDOTDOT
Definition: fatprocs.h:3075
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT * Dirent
Definition: fatprocs.h:729
#define FatGenerateFileIdFromDirentOffset(ParentDcb, DirentOffset)
Definition: fatprocs.h:3054
IN PDCB IN ULONG IN ULONG DirentOffset
Definition: fatprocs.h:790
#define FatGenerateFileIdFromFcb(Fcb)
Definition: fatprocs.h:3066
#define FATDOT
Definition: fatprocs.h:3074
IN PDCB Dcb
Definition: fatprocs.h:424
uint32_t * PULONG
Definition: typedefs.h:59

Definition at line 3077 of file fatprocs.h.

◆ FatGenerateFileIdFromDirentOffset

#define FatGenerateFileIdFromDirentOffset (   ParentDcb,
  DirentOffset 
)
Value:
FatGetLboFromIndex( (ParentDcb)->Vcb, \
(ParentDcb)->FirstClusterOfFile ) : \
(ParentDcb)->Vcb->AllocationSupport.RootDirectoryLbo) + \
: \
0)
#define NodeType(P)
Definition: nodetype.h:51
#define FAT_NTC_ROOT_DCB
Definition: nodetype.h:31
IN PVCB Vcb
Definition: fatprocs.h:343
#define FatIsFat32(VCB)
Definition: fatprocs.h:1446

Definition at line 3054 of file fatprocs.h.

◆ FatGenerateFileIdFromFcb

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

Definition at line 3066 of file fatprocs.h.

◆ FatGetFcbOplock

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

Definition at line 1656 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)))
FCB * PFCB
Definition: cdstruc.h:1040
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
Definition: dirent.h:40

Definition at line 1785 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)))
void * PVOID
Definition: typedefs.h:50

Definition at line 1791 of file fatprocs.h.

◆ FatIsFastIoPossible

#define FatIsFastIoPossible (   FCB)
Value:
((BOOLEAN) \
((((FCB)->FcbCondition != FcbGood) || \
(NodeType( (FCB) ) != FAT_NTC_FCB) || \
: \
(!FsRtlAreThereCurrentFileLocks( &(FCB)->Specific.Fcb.FileLock ) && \
((FCB)->NonPaged->OutstandingAsyncWrites == 0) && \
: \
) \
) \
)
struct _FCB FCB
@ FcbGood
Definition: cdstruc.h:779
#define FAT_NTC_FCB
Definition: nodetype.h:29
#define FatGetFcbOplock(F)
Definition: fatprocs.h:1656
#define VCB_STATE_FLAG_WRITE_PROTECTED
Definition: fatstruc.h:570
#define FsRtlAreThereCurrentFileLocks(FL)
Definition: fsrtlfuncs.h:1584
@ FastIoIsQuestionable
Definition: fsrtltypes.h:242
@ FastIoIsNotPossible
Definition: fsrtltypes.h:240
@ FastIoIsPossible
Definition: fsrtltypes.h:241
BOOLEAN NTAPI FsRtlOplockIsFastIoPossible(IN POPLOCK Oplock)
Definition: oplock.c:1564
#define BOOLEAN
Definition: pedump.c:73
ULONG VcbState
Definition: cdstruc.h:540

Definition at line 2813 of file fatprocs.h.

◆ FatIsFat12

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

Definition at line 1448 of file fatprocs.h.

◆ FatIsFat16

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

Definition at line 1447 of file fatprocs.h.

◆ FatIsFat32

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

Definition at line 1446 of file fatprocs.h.

◆ FatIsFileOplockable

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

Definition at line 2851 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)) \
)
@ NAME
Definition: inflate.c:164

Definition at line 1205 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 at line 1198 of file fatprocs.h.

◆ FatIsNodeTypeOplockable

#define FatIsNodeTypeOplockable (   N)
Value:
( \
((N) == FAT_NTC_FCB) || \
((N) == FAT_NTC_ROOT_DCB) || \
((N) == FAT_NTC_DCB) \
)
#define N
Definition: crc32.c:57
#define FAT_NTC_DCB
Definition: nodetype.h:30

Definition at line 2837 of file fatprocs.h.

◆ FatIsRawDevice

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

Definition at line 1845 of file fatprocs.h.

◆ FatNormalizeAndRaiseStatus

#define FatNormalizeAndRaiseStatus (   IRPCONTEXT,
  STATUS 
)
Value:
{ \
(IRPCONTEXT)->ExceptionStatus = (STATUS); \
}
NTSTATUS NTAPI FsRtlNormalizeNtstatus(IN NTSTATUS NtStatusToNormalize, IN NTSTATUS NormalizedNtStatus)
Definition: filter.c:90
#define STATUS_UNEXPECTED_IO_ERROR
Definition: ntstatus.h:469

Definition at line 2995 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 ); \
}
Definition: ehthrow.cxx:93
#define I(s)
#define L(x)
Definition: ntvdm.h:50
unsigned short USHORT
Definition: pedump.c:61
__wchar_t WCHAR
Definition: xmlstorage.h:180

Definition at line 2168 of file fatprocs.h.

◆ FatRaiseStatus

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

Definition at line 2977 of file fatprocs.h.

◆ FatReleaseDirectoryFileMutex

#define FatReleaseDirectoryFileMutex (   VCB)
Value:
{ \
NT_ASSERT(KeAreApcsDisabled()); \
ExReleaseFastMutexUnsafe(&(VCB)->DirectoryFileCreationMutex); \
}

Definition at line 1513 of file fatprocs.h.

◆ FatReleaseFcb

#define FatReleaseFcb (   IRPCONTEXT,
  Fcb 
)
Value:
{ \
ExReleaseResourceLite( (Fcb)->Header.Resource ); \
}

Definition at line 1644 of file fatprocs.h.

◆ FatReleaseGlobal

#define FatReleaseGlobal (   IRPCONTEXT)
Value:
{ \
ExReleaseResourceLite( &(FatData.Resource) ); \
}

Definition at line 1636 of file fatprocs.h.

◆ FatReleaseVcb

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

Definition at line 1640 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)); \
}
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:925

Definition at line 1418 of file fatprocs.h.

◆ FatResetExceptionState

#define FatResetExceptionState (   IRPCONTEXT)
Value:
{ \
(IRPCONTEXT)->ExceptionStatus = STATUS_SUCCESS; \
}
#define STATUS_SUCCESS
Definition: shellext.h:65

Definition at line 2983 of file fatprocs.h.

◆ FatSetVcbCondition

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

Definition at line 1438 of file fatprocs.h.

◆ FatUnpinBcb

#define FatUnpinBcb (   IRPCONTEXT,
  BCB 
)
Value:
{ \
if ((BCB) != NULL) { \
CcUnpinData((BCB)); \
(BCB) = NULL; \
} \
}

Definition at line 546 of file fatprocs.h.

◆ FatUpcaseEaName

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

Definition at line 868 of file fatprocs.h.

◆ FatVcbAcquiredExclusive

#define FatVcbAcquiredExclusive (   IRPCONTEXT,
  VCB 
)
Value:
( \
ExIsResourceAcquiredExclusiveLite(&(VCB)->Resource) || \
ExIsResourceAcquiredExclusiveLite(&FatData.Resource) \
)

Definition at line 1495 of file fatprocs.h.

◆ INLINE

#define INLINE   __inline

Definition at line 77 of file fatprocs.h.

◆ IsDirectory

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

Definition at line 3106 of file fatprocs.h.

◆ IsFileDeleted

#define IsFileDeleted (   IRPCONTEXT,
  FCB 
)
Value:
(FlagOn((FCB)->FcbState, FCB_STATE_DELETE_ON_CLOSE) && \
((FCB)->UncleanCount == 0))
Dcb UncleanCount
Definition: create.c:4340
#define FCB_STATE_DELETE_ON_CLOSE
Definition: fatstruc.h:1193

Definition at line 2781 of file fatprocs.h.

◆ IsFileObjectReadOnly

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

Definition at line 2866 of file fatprocs.h.

◆ IsFileWriteThrough

#define IsFileWriteThrough (   FO,
  VCB 
)
Value:
( \
BooleanFlagOn((FO)->Flags, FO_WRITE_THROUGH) \
)
#define FO_WRITE_THROUGH
Definition: iotypes.h:1779

Definition at line 2796 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

Definition at line 2096 of file fatprocs.h.

◆ MAX_ULONG

#define MAX_ULONG   ((ULONG)-1)

Definition at line 83 of file fatprocs.h.

◆ MAX_USHORT

#define MAX_USHORT   ((USHORT)-1)

Definition at line 87 of file fatprocs.h.

◆ PtrOffset

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

Definition at line 2080 of file fatprocs.h.

◆ QuadAlign

#define QuadAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 7) & 0xfffffff8) \
)

Definition at line 2105 of file fatprocs.h.

◆ SizeOfFullEa

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

Definition at line 1030 of file fatprocs.h.

◆ try_leave

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

Definition at line 3030 of file fatprocs.h.

◆ try_return

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

Definition at line 3029 of file fatprocs.h.

◆ WordAlign

#define WordAlign (   Ptr)
Value:
( \
((((ULONG)(Ptr)) + 1) & 0xfffffffe) \
)

Definition at line 2087 of file fatprocs.h.

Typedef Documentation

◆ COMPARISON

◆ FAT_ENUMERATION_CONTEXT

◆ FAT_FLUSH_TYPE

◆ FAT_VOLUME_STATE

◆ FINISHED

typedef BOOLEAN FINISHED

Definition at line 104 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 1883 of file fatprocs.h.

1883 {
1884 IsLessThan,
1886 IsEqual
1887} COMPARISON;
@ IsEqual
Definition: fatprocs.h:1886
enum _COMPARISON COMPARISON

◆ _FAT_FLUSH_TYPE

Enumerator
NoFlush 
Flush 
FlushAndInvalidate 
FlushWithoutPurge 

Definition at line 1051 of file fatprocs.h.

1051 {
1052
1053 NoFlush = 0,
1054 Flush,
1057
enum _FAT_FLUSH_TYPE FAT_FLUSH_TYPE
@ FlushWithoutPurge
Definition: fatprocs.h:1056
@ Flush
Definition: fatprocs.h:1054
@ FlushAndInvalidate
Definition: fatprocs.h:1055
@ NoFlush
Definition: fatprocs.h:1053

◆ _FAT_VOLUME_STATE

Enumerator
VolumeClean 
VolumeDirty 
VolumeDirtyWithSurfaceTest 

Definition at line 1953 of file fatprocs.h.

1953 {
@ VolumeClean
Definition: fatprocs.h:1954
@ VolumeDirty
Definition: fatprocs.h:1955
@ VolumeDirtyWithSurfaceTest
Definition: fatprocs.h:1956
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 1039 of file fatprocs.h.

1039 {
1040
1047 EaFile,
1048} TYPE_OF_OPEN;
@ UnopenedFileObject
Definition: fatprocs.h:1041
@ UserDirectoryOpen
Definition: fatprocs.h:1043
@ DirectoryFile
Definition: fatprocs.h:1046
@ UserFileOpen
Definition: fatprocs.h:1042
@ UserVolumeOpen
Definition: fatprocs.h:1044
@ VirtualVolumeFile
Definition: fatprocs.h:1045
@ EaFile
Definition: fatprocs.h:1047
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_CHECK_IF_POSSIBLE  )

◆ _Function_class_() [3/28]

_Function_class_ ( FAST_IO_LOCK  )

◆ _Function_class_() [4/28]

_Function_class_ ( FAST_IO_QUERY_BASIC_INFO  )

◆ _Function_class_() [5/28]

_Function_class_ ( FAST_IO_QUERY_NETWORK_OPEN_INFO  )

◆ _Function_class_() [6/28]

_Function_class_ ( FAST_IO_QUERY_STANDARD_INFO  )

◆ _Function_class_() [7/28]

_Function_class_ ( FAST_IO_RELEASE_FOR_CCFLUSH  )

◆ _Function_class_() [8/28]

_Function_class_ ( FAST_IO_UNLOCK_ALL  )

◆ _Function_class_() [9/28]

_Function_class_ ( FAST_IO_UNLOCK_ALL_BY_KEY  )

◆ _Function_class_() [10/28]

_Function_class_ ( FAST_IO_UNLOCK_SINGLE  )

◆ _Function_class_() [11/28]

_Function_class_ ( IRP_MJ_CLEANUP  )

◆ _Function_class_() [12/28]

_Function_class_ ( IRP_MJ_CLOSE  )

◆ _Function_class_() [13/28]

_Function_class_ ( IRP_MJ_CREATE  )

◆ _Function_class_() [14/28]

_Function_class_ ( IRP_MJ_DEVICE_CONTROL  )

◆ _Function_class_() [15/28]

_Function_class_ ( IRP_MJ_DIRECTORY_CONTROL  )

◆ _Function_class_() [16/28]

_Function_class_ ( IRP_MJ_FILE_SYSTEM_CONTROL  )

◆ _Function_class_() [17/28]

_Function_class_ ( IRP_MJ_FLUSH_BUFFERS  )

◆ _Function_class_() [18/28]

_Function_class_ ( IRP_MJ_LOCK_CONTROL  )

◆ _Function_class_() [19/28]

_Function_class_ ( IRP_MJ_PNP  )

◆ _Function_class_() [20/28]

_Function_class_ ( IRP_MJ_QUERY_EA  )

◆ _Function_class_() [21/28]

_Function_class_ ( IRP_MJ_QUERY_INFORMATION  )

◆ _Function_class_() [22/28]

_Function_class_ ( IRP_MJ_QUERY_VOLUME_INFORMATION  )

◆ _Function_class_() [23/28]

_Function_class_ ( IRP_MJ_READ  )

◆ _Function_class_() [24/28]

_Function_class_ ( IRP_MJ_SET_EA  )

◆ _Function_class_() [25/28]

_Function_class_ ( IRP_MJ_SET_INFORMATION  )

◆ _Function_class_() [26/28]

_Function_class_ ( IRP_MJ_SET_VOLUME_INFORMATION  )

◆ _Function_class_() [27/28]

_Function_class_ ( IRP_MJ_SHUTDOWN  )

◆ _Function_class_() [28/28]

_Function_class_ ( IRP_MJ_WRITE  )

◆ _Requires_lock_held_()

_Requires_lock_held_ ( _Global_critical_region_  )

◆ _Success_()

_Success_ ( return = FALSE)

Definition at line 1028 of file fsctrl.c.

3189{
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 PAGED_CODE()
unsigned char BOOLEAN
CD_DATA CdData
Definition: cddata.c:42
#define VCB_STATE_AUDIO_DISK
Definition: cdstruc.h:712
@ VcbNotMounted
Definition: cdstruc.h:490
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
IN OUT PVCB IN PDEVICE_OBJECT IN PVPB Vpb
Definition: fatprocs.h:1675
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define Vcb
Definition: cdprocs.h:1415
LIST_ENTRY VcbQueue
Definition: cdstruc.h:334
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: iotypes.h:189
WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH/sizeof(WCHAR)]
Definition: iotypes.h:198
USHORT VolumeLabelLength
Definition: iotypes.h:193
ULONG SerialNumber
Definition: iotypes.h:196
struct _DEVICE_OBJECT * RealDevice
Definition: iotypes.h:195
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
static int Link(const char **args)
Definition: vfdcmd.c:2414

◆ 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{
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}
PAGED_CODE()
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
Definition: cdprocs.h:427
switch(r->id)
Definition: btrfs.c:3046
#define FsRtlIsLeadDbcsCharacter(DBCS_CHAR)
Definition: init.c:428
#define FAT_DIRENT_NT_BYTE_8_LOWER_CASE
Definition: fat.h:361
#define FAT_DIRENT_REALLY_0E5
Definition: fat.h:335
#define FAT_DIRENT_NT_BYTE_3_LOWER_CASE
Definition: fat.h:362
#define UCHAR_SP
Definition: nodetype.h:143
#define Dbg
Definition: namesup.c:18
#define DebugTrace(INDENT, LEVEL, X, Y)
Definition: fatdata.h:313
#define d
Definition: ke_i.h:81
BOOLEAN ChicagoMode
Definition: fatstruc.h:87
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
_Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ WDFREQUEST _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_writes_opt_ NumCharacters PUSHORT _Inout_ PUSHORT _In_ UCHAR StringIndex
Definition: wdfusb.h:1080

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{
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
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
#define MCB_SCALE_LOG2
IN PFCB IN VBO OUT PLBO Lbo
Definition: fatprocs.h:308
IN PFCB IN VBO Vbo
Definition: fatprocs.h:307
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:348
BOOLEAN NTAPI FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb, IN LONGLONG Vbn, IN LONGLONG Lbn, IN LONGLONG SectorCount)
Definition: largemcb.c:288
ULONG SectorCount
Definition: part_xbox.c:31
int64_t LONGLONG
Definition: typedefs.h:68
_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:409
#define NT_ASSERT
Definition: rtlfuncs.h:3310

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

◆ FatAddToWorkque()

VOID FatAddToWorkque ( IN PIRP_CONTEXT  IrpContext,
IN PIRP  Irp 
)

Definition at line 280 of file workque.c.

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

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}
PACKED_EA * PPACKED_EA
Definition: fat.h:700
#define SIZE_OF_EA_SET_HEADER
Definition: fat.h:674
#define TAG_EA_SET_HEADER
Definition: nodetype.h:161
#define Dbg
Definition: easup.c:22
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define PagedPool
Definition: env_spec_w32.h:308
#define FatUpcaseEaName(IRPCONTEXT, NAME, UPCASEDNAME)
Definition: fatprocs.h:868
#define SizeOfFullEa(EA)
Definition: fatprocs.h:1030
#define RtlOffsetToPointer(Base, Offset)
Definition: ndis56common.h:50
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:229
CHAR EaName[1]
Definition: fat.h:698
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
STRING OEM_STRING
Definition: umtypes.h:203
#define FILE_NEED_EA

Referenced by FatCommonSetEa().

◆ FatBufferUserBuffer()

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

Definition at line 3411 of file deviosup.c.

3438{
3439 PUCHAR UserBuffer;
3440
3441 UNREFERENCED_PARAMETER( IrpContext );
3442
3443 PAGED_CODE();
3444
3445 //
3446 // Handle the no buffer case.
3447 //
3448
3449 if (BufferLength == 0) {
3450
3451 return NULL;
3452 }
3453
3454 //
3455 // If there is no system buffer we must have been supplied an Mdl
3456 // describing the users input buffer, which we will now snapshot.
3457 //
3458
3459 if (Irp->AssociatedIrp.SystemBuffer == NULL) {
3460
3461 UserBuffer = FatMapUserBuffer( IrpContext, Irp );
3462
3463 Irp->AssociatedIrp.SystemBuffer = FsRtlAllocatePoolWithQuotaTag( NonPagedPoolNx,
3466
3467 //
3468 // Set the flags so that the completion code knows to deallocate the
3469 // buffer.
3470 //
3471
3473
3474 _SEH2_TRY {
3475
3476 RtlCopyMemory( Irp->AssociatedIrp.SystemBuffer,
3477 UserBuffer,
3478 BufferLength );
3479
3481
3483
3485 FatRaiseStatus( IrpContext,
3487 } _SEH2_END;
3488 }
3489
3490 return Irp->AssociatedIrp.SystemBuffer;
3491}
LONG NTSTATUS
Definition: precomp.h:26
#define TAG_IO_USER_BUFFER
Definition: nodetype.h:184
PVOID FatMapUserBuffer(IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp)
Definition: deviosup.c:3357
#define FatRaiseStatus(IRPCONTEXT, STATUS)
Definition: fatprocs.h:2977
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
BOOLEAN NTAPI FsRtlIsNtstatusExpected(IN NTSTATUS NtStatus)
Definition: filter.c:61
PVOID NTAPI FsRtlAllocatePoolWithQuotaTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
Definition: filter.c:189
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define STATUS_INVALID_USER_BUFFER
Definition: udferr_usr.h:166
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
#define IRP_DEALLOCATE_BUFFER
#define IRP_BUFFERED_IO

Referenced by FatCommonSetEa().

◆ FatBuildZeroMdl()

PMDL FatBuildZeroMdl ( __in PIRP_CONTEXT  IrpContext,
__in ULONG  Length 
)

Definition at line 3734 of file deviosup.c.

3757{
3758 PMDL ZeroMdl;
3759 ULONG SavedByteCount;
3761 ULONG i;
3762
3763 UNREFERENCED_PARAMETER( IrpContext );
3764
3765 //
3766 // Spin down trying to get an MDL which can describe our operation.
3767 //
3768
3769 while (TRUE) {
3770
3772
3773 //
3774 // Throttle ourselves to what we've physically allocated. Note that
3775 // we could have started with an odd multiple of this number. If we
3776 // tried for exactly that size and failed, we're toast.
3777 //
3778
3779 if (ZeroMdl || (Length <= PAGE_SIZE)) {
3780
3781 break;
3782 }
3783
3784 //
3785 // Fallback by half and round down to a page multiple.
3786 //
3787
3788 ASSERT( IrpContext->Vcb->Bpb.BytesPerSector <= PAGE_SIZE );
3790 if (Length < PAGE_SIZE) {
3791 Length = PAGE_SIZE;
3792 }
3793 }
3794
3795 if (ZeroMdl == NULL) {
3796 return NULL;
3797 }
3798
3799 //
3800 // If we have throttled all the way down, stop and just build a
3801 // simple MDL describing our previous allocation.
3802 //
3803
3804 if (Length == PAGE_SIZE) {
3805
3806 MmBuildMdlForNonPagedPool( ZeroMdl );
3807 return ZeroMdl;
3808 }
3809
3810 //
3811 // Now we will temporarily lock the allocated pages
3812 // only, and then replicate the page frame numbers through
3813 // the entire Mdl to keep writing the same pages of zeros.
3814 //
3815 // It would be nice if Mm exported a way for us to not have
3816 // to pull the Mdl apart and rebuild it ourselves, but this
3817 // is so bizarre a purpose as to be tolerable.
3818 //
3819
3820 SavedByteCount = ZeroMdl->ByteCount;
3821 ZeroMdl->ByteCount = PAGE_SIZE;
3822 MmBuildMdlForNonPagedPool( ZeroMdl );
3823
3824 ZeroMdl->MdlFlags &= ~MDL_SOURCE_IS_NONPAGED_POOL;
3825 ZeroMdl->MdlFlags |= MDL_PAGES_LOCKED;
3826 ZeroMdl->MappedSystemVa = NULL;
3827 ZeroMdl->StartVa = NULL;
3828 ZeroMdl->ByteCount = SavedByteCount;
3829 Page = MmGetMdlPfnArray( ZeroMdl );
3830 for (i = 1; i < (ADDRESS_AND_SIZE_TO_SPAN_PAGES( 0, SavedByteCount )); i++) {
3831 *(Page + i) = *(Page);
3832 }
3833
3834
3835 return ZeroMdl;
3836}
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define BlockAlignTruncate(P, V)
Definition: fatprocs.h:3104
#define IoAllocateMdl
Definition: fxmdl.h:88
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
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
Definition: mdlsup.c:424
#define ASSERT(a)
Definition: mode.c:44
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
Definition: mm.h:1306
ULONG * PPFN_NUMBER
Definition: ke.h:9
PVOID ZeroPage
Definition: fatstruc.h:163
#define MmGetMdlPfnArray(_Mdl)
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19

◆ FatCheckDirtyBit()

VOID FatCheckDirtyBit ( IN PIRP_CONTEXT  IrpContext,
IN PVCB  Vcb 
)

Definition at line 1185 of file verfysup.c.

1207{
1208 BOOLEAN Dirty;
1209
1211 PBCB BootSectorBcb;
1212
1213 UNICODE_STRING VolumeLabel;
1214
1215 PAGED_CODE();
1216
1217 //
1218 // Look in the boot sector
1219 //
1220
1221 FatReadVolumeFile( IrpContext,
1222 Vcb,
1223 0,
1224 sizeof(PACKED_BOOT_SECTOR),
1225 &BootSectorBcb,
1226 (PVOID *)&BootSector );
1227
1228 _SEH2_TRY {
1229
1230 //
1231 // Check if the magic bit is set
1232 //
1233
1234 if (IsBpbFat32(&BootSector->PackedBpb)) {
1235 Dirty = BooleanFlagOn( ((PPACKED_BOOT_SECTOR_EX)BootSector)->CurrentHead,
1237 } else {
1238 Dirty = BooleanFlagOn( BootSector->CurrentHead, FAT_BOOT_SECTOR_DIRTY );
1239 }
1240
1241 //
1242 // Setup the VolumeLabel string
1243 //
1244
1245 VolumeLabel.Length = Vcb->Vpb->VolumeLabelLength;
1247 VolumeLabel.Buffer = &Vcb->Vpb->VolumeLabel[0];
1248
1249 if ( Dirty ) {
1250
1251 //
1252 // Do not trigger the mounted dirty bit if this is a verify
1253 // and the volume is a boot or paging device. We know that
1254 // a boot or paging device cannot leave the system, and thus
1255 // that on its mount we will have figured this out correctly.
1256 //
1257 // This logic is a reasonable change. Why?
1258 // 'cause setup cracked a non-exclusive DASD handle near the
1259 // end of setup, wrote some data, closed the handle and we
1260 // set the verify bit ... came back around and saw that other
1261 // arbitrary activity had left the volume in a temporarily dirty
1262 // state.
1263 //
1264 // Of course, the real problem is that we don't have a journal.
1265 //
1266
1267 if (!(IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL &&
1268 IrpContext->MinorFunction == IRP_MN_VERIFY_VOLUME &&
1270
1273 "FASTFAT: WARNING! Mounting Dirty Volume %Z\n",
1274 &VolumeLabel));
1275
1277 }
1278
1279 } else {
1280
1281 if (FlagOn(Vcb->VcbState, VCB_STATE_FLAG_MOUNTED_DIRTY)) {
1282
1285 "FASTFAT: Volume %Z has been cleaned.\n",
1286 &VolumeLabel));
1287
1289
1290 } else {
1291
1292 (VOID)FsRtlBalanceReads( Vcb->TargetDeviceObject );
1293 }
1294 }
1295
1296 } _SEH2_FINALLY {
1297
1298 FatUnpinBcb( IrpContext, BootSectorBcb );
1299 } _SEH2_END;
1300}
@ DPFLTR_FASTFAT_ID
Definition: dpfilter.h:61
#define IsBpbFat32(bpb)
Definition: fat.h:101
#define FAT_BOOT_SECTOR_DIRTY
Definition: fat.h:213
#define ClearFlag(_F, _SF)
Definition: ext2fs.h:191
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
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 FatUnpinBcb(IRPCONTEXT, BCB)
Definition: fatprocs.h:546
#define VCB_STATE_FLAG_BOOT_OR_PAGING_FILE
Definition: fatstruc.h:567
#define VCB_STATE_FLAG_MOUNTED_DIRTY
Definition: fatstruc.h:562
NTSTATUS NTAPI FsRtlBalanceReads(PDEVICE_OBJECT TargetDevice)
Definition: faulttol.c:35
#define _SEH2_FINALLY
Definition: filesup.c:21
#define DPFLTR_INFO_LEVEL
Definition: kdtypes.h:33
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define IRP_MJ_FILE_SYSTEM_CONTROL
#define IRP_MN_VERIFY_VOLUME
Definition: iotypes.h:4405
#define MAXIMUM_VOLUME_LABEL_LENGTH
Definition: iotypes.h:177
#define KdPrintEx(_x_)
Definition: kdfuncs.h:114

◆ 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
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 |
108 WRITE_DAC |
120 MAXIMUM_ALLOWED))) {
121
122 DebugTrace(0, Dbg, "Cannot open object\n", 0);
123
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
154
155 DebugTrace(0, Dbg, "Cannot open readonly\n", 0);
156
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}
BOOLEAN FatCheckFileAccess(PIRP_CONTEXT IrpContext, IN UCHAR DirentAttributes, IN PACCESS_MASK DesiredAccess)
Definition: acchksup.c:39
#define Dbg
Definition: acchksup.c:22
#define try_return(S)
Definition: cdprocs.h:2179
#define FAT_DIRENT_ATTR_READ_ONLY
Definition: fat.h:368
#define FAT_DIRENT_ATTR_VOLUME_ID
Definition: fat.h:371
#define FAT_DIRENT_ATTR_DIRECTORY
Definition: fat.h:372
#define FAT_DIRENT_ATTR_DEVICE
Definition: fat.h:374
#define DebugUnwind(X)
Definition: fatdata.h:315
#define NOTHING
Definition: input_list.c:10
_In_ ACCESS_MASK AccessMask
Definition: exfuncs.h:186
#define SYNCHRONIZE
Definition: nt_native.h:61
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define WRITE_DAC
Definition: nt_native.h:59
#define FILE_READ_DATA
Definition: nt_native.h:628
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define ACCESS_SYSTEM_SECURITY
Definition: nt_native.h:77
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
#define FILE_DELETE_CHILD
Definition: nt_native.h:645
#define FILE_READ_EA
Definition: nt_native.h:638
#define FILE_EXECUTE
Definition: nt_native.h:642
#define FILE_TRAVERSE
Definition: nt_native.h:643
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define FILE_APPEND_DATA
Definition: nt_native.h:634
#define DELETE
Definition: nt_native.h:57
#define READ_CONTROL
Definition: nt_native.h:58
#define WRITE_OWNER
Definition: nt_native.h:60
#define FILE_ADD_SUBDIRECTORY
Definition: nt_native.h:635
#define FILE_ADD_FILE
Definition: nt_native.h:632
#define FILE_WRITE_EA
Definition: nt_native.h:640
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658

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;
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 SE_MANAGE_VOLUME_PRIVILEGE
Definition: security.c:682
BOOLEAN NTAPI SePrivilegeCheck(_In_ PPRIVILEGE_SET Privileges, _In_ PSECURITY_SUBJECT_CONTEXT SubjectContext, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a set of privileges exist and match within a security subject context.
Definition: priv.c:698
LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]
Definition: setypes.h:88
$ULONG Control
Definition: setypes.h:87
$ULONG PrivilegeCount
Definition: setypes.h:86
_In_opt_ PVOID _In_opt_ PUNICODE_STRING _In_ PSECURITY_DESCRIPTOR _In_ PACCESS_STATE AccessState
Definition: sefuncs.h:417
#define PRIVILEGE_SET_ALL_NECESSARY
Definition: setypes.h:83

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 Packet = ExAllocatePoolWithTag(NonPagedPoolNx, sizeof(CLEAN_AND_DIRTY_VOLUME_PACKET), ' taF');
713
714 if ( Packet ) {
715
716 Packet->Vcb = Vcb;
717 Packet->Irp = NULL;
718
719 //
720 // Clear the dirty flag now since we cannot synchronize after this point.
721 //
722
724
726
727#ifdef _MSC_VER
728#pragma prefast( suppress:28159, "prefast indicates this is an obsolete API, but it is ok for fastfat to keep using it" )
729#endif
731 }
732
733 return;
734}
struct _VCB * PVCB
Definition: fatstruc.h:557
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI FatDeferredCleanVolume(_In_ PVOID Parameter)
Definition: verfysup.c:499
#define VCB_STATE_FLAG_VOLUME_DIRTY
Definition: fatstruc.h:561
BOOLEAN NTAPI CcIsThereDirtyData(IN PVPB Vpb)
Definition: logsup.c:55
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
Definition: ndis.h:1549
long LONG
Definition: pedump.c:60
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
Definition: timerobj.c:281
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:688
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:687
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:689

◆ 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 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
VOID FatSyncUninitializeCacheMap(IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject)
Definition: cachesup.c:1812
#define Dbg
Definition: cachesup.c:29
#define FatVcbAcquiredExclusive(IRPCONTEXT, VCB)
Definition: fatprocs.h:1495
VOID FatRemoveMcbEntry(IN PVCB Vcb, IN PLARGE_MCB Mcb, IN VBO Vbo, IN ULONG SectorCount)
Definition: fsctrl.c:599
* PFILE_OBJECT
Definition: iotypes.h:1998
#define ObDereferenceObject
Definition: obfuncs.h:203

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
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;
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
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
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,
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}
NodeType
Definition: Node.h:6
#define except(x)
Definition: btrfs_drv.h:136
@ UserDirectoryOpen
Definition: cdprocs.h:576
@ UserFileOpen
Definition: cdprocs.h:577
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
enum _TYPE_OF_OPEN TYPE_OF_OPEN
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)
NTSTATUS FatCommonQueryEa(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: ea.c:250
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)
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)
#define Dbg
Definition: ea.c:23
EA_SET_HEADER * PEA_SET_HEADER
Definition: fat.h:672
#define GetcbList(EASET)
Definition: fat.h:678
VOID FatUnpinEaRange(IN PIRP_CONTEXT IrpContext, IN OUT PEA_RANGE EaRange)
Definition: easup.c:3782
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
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
Definition: fatprocs.h:414
IN PVCB IN ULONG IN PBCB OUT PDIRENT OUT PUSHORT OUT PEA_RANGE EaSetRange
Definition: fatprocs.h:951
NTSTATUS FatFsdPostRequest(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: workque.c:229
TYPE_OF_OPEN FatDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
Definition: filobsup.c:176
#define FatCompleteRequest(IRPCONTEXT, IRP, STATUS)
Definition: fatprocs.h:2633
#define FatReleaseFcb(IRPCONTEXT, Fcb)
Definition: fatprocs.h:1644
IN OUT PVCB OUT PDIRENT OUT PBCB * EaBcb
Definition: fatprocs.h:915
IN OUT PVCB OUT PDIRENT * EaDirent
Definition: fatprocs.h:914
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN _In_ ULONG _In_opt_ PULONG _In_ BOOLEAN RestartScan
Definition: fltkernel.h:2299
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN ReturnSingleEntry
Definition: fltkernel.h:2295
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define STATUS_EA_CORRUPT_ERROR
Definition: ntstatus.h:319
#define STATUS_NO_EAS_ON_FILE
Definition: ntstatus.h:318
#define STATUS_EAS_NOT_SUPPORTED
Definition: ntstatus.h:315
#define AbnormalTermination()
Definition: seh.h:28
#define GetExceptionCode()
Definition: seh.h:27
Definition: cdstruc.h:1067
UCHAR PackedEas[1]
Definition: fat.h:670
ULONG EaModificationCount
Definition: fatstruc.h:1107
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1115
union _FILE_NAME_NODE::@722 Name
OEM_STRING Oem
Definition: fatstruc.h:693
struct _IO_STACK_LOCATION::@3982::@3993 QueryEa
union _IO_STACK_LOCATION::@1567 Parameters
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define SL_INDEX_SPECIFIED
Definition: iotypes.h:1837
#define SL_RETURN_SINGLE_ENTRY
Definition: iotypes.h:1836
#define SL_RESTART_SCAN
Definition: iotypes.h:1835

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
690 ULONG UserBufferLength;
691
692 PVCB Vcb;
693 PCCB Ccb;
694
695 PFCB Fcb;
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
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
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,
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
999 FatUnpinEaRange( IrpContext, &EaSetRange );
1000
1001 } else {
1002
1003 RtlZeroMemory( EaSetHeader, AllocationLength );
1004
1005 RtlCopyMemory( EaSetHeader->OwnerFileName,
1006 Fcb->ShortName.Name.Oem.Buffer,
1007 Fcb->ShortName.Name.Oem.Length );
1008 }
1009
1010
1011 AllocationLength -= SIZE_OF_EA_SET_HEADER;
1012
1013 DebugTrace(0, Dbg, "FatCommonSetEa: Initial Ea set -> %p\n",
1014 EaSetHeader);
1015
1016 //
1017 // At this point we have either read in the current eas for the file
1018 // or we have initialized a new empty buffer for the eas. Now for
1019 // each full ea in the input user buffer we do the specified operation
1020 // on the ea
1021 //
1022
1023 for (FullEa = (PFILE_FULL_EA_INFORMATION) Buffer;
1024 FullEa < (PFILE_FULL_EA_INFORMATION) &Buffer[UserBufferLength];
1025 FullEa = (PFILE_FULL_EA_INFORMATION) (FullEa->NextEntryOffset == 0 ?
1026 &Buffer[UserBufferLength] :
1027 (PUCHAR) FullEa + FullEa->NextEntryOffset)) {
1028
1029 OEM_STRING EaName;
1030 ULONG Offset;
1031
1032 EaName.MaximumLength = EaName.Length = FullEa->EaNameLength;
1033 EaName.Buffer = &FullEa->EaName[0];
1034
1035 DebugTrace(0, Dbg, "FatCommonSetEa: Next Ea name -> %Z\n",
1036 &EaName);
1037
1038 //
1039 // Make sure the ea name is valid
1040 //
1041
1042 if (!FatIsEaNameValid( IrpContext,EaName )) {
1043
1044 Irp->IoStatus.Information = (PUCHAR)FullEa - Buffer;
1046 try_return( Status );
1047 }
1048
1049 //
1050 // Check that no invalid ea flags are set.
1051 //
1052
1053 //
1054 // TEMPCODE We are returning STATUS_INVALID_EA_NAME
1055 // until a more appropriate error code exists.
1056 //
1057
1058 if (FullEa->Flags != 0
1059 && FullEa->Flags != FILE_NEED_EA) {
1060
1061 Irp->IoStatus.Information = (PUCHAR)FullEa - (PUCHAR)Buffer;
1063 }
1064
1065 //
1066 // See if we can locate the ea name in the ea set
1067 //
1068
1069 if (FatLocateEaByName( IrpContext,
1070 (PPACKED_EA) EaSetHeader->PackedEas,
1071 PackedEasLength,
1072 &EaName,
1073 &Offset )) {
1074
1075 DebugTrace(0, Dbg, "FatCommonSetEa: Found Ea name\n", 0);
1076
1077 //
1078 // We found the ea name so now delete the current entry,
1079 // and if the new ea value length is not zero then we
1080 // replace if with the new ea
1081 //
1082
1083 FatDeletePackedEa( IrpContext,
1084 EaSetHeader,
1085 &PackedEasLength,
1086 Offset );
1087 }
1088
1089 if (FullEa->EaValueLength != 0) {
1090
1091 FatAppendPackedEa( IrpContext,
1092 &EaSetHeader,
1093 &PackedEasLength,
1094 &AllocationLength,
1095 FullEa,
1096 BytesPerCluster );
1097 }
1098 }
1099
1100 //
1101 // If there are any ea's not removed, we
1102 // call 'AddEaSet' to insert them into the Fat chain.
1103 //
1104
1105 if (PackedEasLength != 0) {
1106
1107 LARGE_INTEGER EaOffset;
1108
1109 EaOffset.HighPart = 0;
1110
1111 //
1112 // If the packed eas length (plus 4 bytes) is greater
1113 // than the maximum allowed ea size, we return an error.
1114 //
1115
1116 if (PackedEasLength + 4 > MAXIMUM_EA_SIZE) {
1117
1118 DebugTrace( 0, Dbg, "Ea length is greater than maximum\n", 0 );
1119
1121 }
1122
1123 //
1124 // We need to now read the ea file if we haven't already.
1125 //
1126
1127 if (EaDirent == NULL) {
1128
1129 FatGetEaFile( IrpContext,
1130 Vcb,
1131 &EaDirent,
1132 &EaBcb,
1133 TRUE,
1134 TRUE );
1135
1136 AcquiredEaFcb = TRUE;
1137 }
1138
1139 FatGetDirentFromFcbOrDcb( IrpContext, Fcb, &Dirent, &Bcb );
1140
1141 RtlZeroMemory( &EaSetRange, sizeof( EA_RANGE ));
1142
1143 FatAddEaSet( IrpContext,
1144 Vcb,
1145 PackedEasLength + SIZE_OF_EA_SET_HEADER,
1146 EaBcb,
1147 EaDirent,
1148 &EaHandle,
1149 &EaSetRange );
1150
1151 NewEaSetHeader = (PEA_SET_HEADER) EaSetRange.Data;
1152
1153 DebugTrace(0, Dbg, "FatCommonSetEa: Adding an ea set\n", 0);
1154
1155 //
1156 // Store the length of the new Ea's into the EaSetHeader.
1157 // This is the PackedEasLength + 4.
1158 //
1159
1160 PackedEasLength += 4;
1161
1162 CopyU4char( EaSetHeader->cbList, &PackedEasLength );
1163
1164 //
1165 // Copy all but the first four bytes of EaSetHeader into
1166 // NewEaSetHeader. The signature and index fields have
1167 // already been filled in.
1168 //
1169
1170 RtlCopyMemory( &NewEaSetHeader->NeedEaCount,
1171 &EaSetHeader->NeedEaCount,
1172 PackedEasLength + SIZE_OF_EA_SET_HEADER - 8 );
1173
1174 FatMarkEaRangeDirty( IrpContext, Vcb->VirtualEaFile, &EaSetRange );
1175 FatUnpinEaRange( IrpContext, &EaSetRange );
1176
1177 CcFlushCache( Vcb->VirtualEaFile->SectionObjectPointer, NULL, 0, NULL );
1178
1179 } else {
1180
1181 FatGetDirentFromFcbOrDcb( IrpContext, Fcb, &Dirent, &Bcb );
1182
1183 EaHandle = 0;
1184 }
1185
1186 //
1187 // Now we do a wholesale replacement of the ea for the file
1188 //
1189
1190 if (PreviousEas) {
1191
1192 FatDeleteEaSet( IrpContext,
1193 Vcb,
1194 EaBcb,
1195 EaDirent,
1196 ExtendedAttributes,
1197 &Fcb->ShortName.Name.Oem );
1198
1199 CcFlushCache( Vcb->VirtualEaFile->SectionObjectPointer, NULL, 0, NULL );
1200 }
1201
1202 if (PackedEasLength != 0 ) {
1203
1205 }
1206
1207 //
1208 // Mark the dirent with the new ea's
1209 //
1210
1211 Dirent->ExtendedAttributes = EaHandle;
1212
1213 FatSetDirtyBcb( IrpContext, Bcb, Vcb, TRUE );
1214
1215 //
1216 // We call the notify package to report that the ea's were
1217 // modified.
1218 //
1219
1220 FatNotifyReportChange( IrpContext,
1221 Vcb,
1222 Fcb,
1225
1226 Irp->IoStatus.Information = 0;
1228
1229 try_exit: NOTHING;
1230
1231 //
1232 // Unpin the dirents for the Fcb and EaFcb if necessary.
1233 //
1234
1235 FatUnpinBcb( IrpContext, Bcb );
1236 FatUnpinBcb( IrpContext, EaBcb );
1237
1238 FatUnpinRepinnedBcbs( IrpContext );
1239
1240 } finally {
1241
1243
1244 //
1245 // If this is an abnormal termination, we need to clean up
1246 // any locked resources.
1247 //
1248
1249 if (AbnormalTermination()) {
1250
1251 //
1252 // Unpin the dirents for the Fcb, EaFcb and EaSetFcb if necessary.
1253 //
1254
1255 FatUnpinBcb( IrpContext, Bcb );
1256 FatUnpinBcb( IrpContext, EaBcb );
1257
1258 FatUnpinEaRange( IrpContext, &EaSetRange );
1259 }
1260
1261 //
1262 // Release the Fcbs/Vcb acquired.
1263 //
1264
1265 if (AcquiredEaFcb) {
1266 FatReleaseFcb( IrpContext, Vcb->EaFcb );
1267 }
1268
1269 if (AcquiredFcb) {
1270 FatReleaseFcb( IrpContext, Fcb );
1271 }
1272
1273 if (AcquiredParentDcb) {
1274 FatReleaseFcb( IrpContext, Fcb->ParentDcb );
1275 }
1276
1277 if (AcquiredRootDcb) {
1278 FatReleaseFcb( IrpContext, Fcb->Vcb->RootDcb );
1279 }
1280
1281 if (AcquiredVcb) {
1282 FatReleaseVcb( IrpContext, Fcb->Vcb );
1283 }
1284
1285 //
1286 // Deallocate our Ea buffer.
1287 //
1288
1289 if (EaSetHeader != NULL) {
1290
1291 ExFreePool( EaSetHeader );
1292 }
1293
1294 //
1295 // Complete the irp.
1296 //
1297
1298 if (!AbnormalTermination()) {
1299
1300 FatCompleteRequest( IrpContext, Irp, Status );
1301 }
1302
1303 DebugTrace(-1, Dbg, "FatCommonSetEa -> %08lx\n", Status);
1304 }
1305
1306 //
1307 // And return to our caller
1308 //
1309
1310 return Status;
1311#endif
1312}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS FatCommonSetEa(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
Definition: ea.c:659
#define MAXIMUM_EA_SIZE
Definition: fat.h:676
VOID FatMarkEaRangeDirty(IN PIRP_CONTEXT IrpContext, IN PFILE_OBJECT EaFileObject, IN OUT PEA_RANGE EaRange)
Definition: easup.c:3709
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: easup.c:2967
VOID FatDeletePackedEa(IN PIRP_CONTEXT IrpContext, IN OUT PEA_SET_HEADER EaSetHeader, IN OUT PULONG PackedEasLength, IN ULONG Offset)
Definition: easup.c:3148
BOOLEAN FatLocateEaByName(IN PIRP_CONTEXT IrpContext, IN PPACKED_EA FirstPackedEa, IN ULONG PackedEasLength, IN POEM_STRING EaName, OUT PULONG Offset)
Definition: easup.c:3344
BOOLEAN FatIsEaNameValid(IN PIRP_CONTEXT IrpContext, IN OEM_STRING Name)
Definition: easup.c:3429
#define IRP_CONTEXT_FLAG_WRITE_THROUGH
Definition: ext2fs.h:1088
VOID FatUnpinRepinnedBcbs(IN PIRP_CONTEXT IrpContext)
Definition: cachesup.c:1407
PVOID FatBufferUserBuffer(IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp, IN ULONG BufferLength)
Definition: deviosup.c:3411
#define FatNotifyReportChange(I, V, F, FL, A)
Definition: fatprocs.h:2168
IN PVCB IN PUCHAR IN ULONG IN POEM_STRING OUT PUSHORT EaHandle
Definition: fatprocs.h:898
#define FatReleaseVcb(IRPCONTEXT, Vcb)
Definition: fatprocs.h:1640
#define CopyU4char(Dst, Src)
Definition: fatprocs.h:2153
struct _FILE_FULL_EA_INFORMATION * PFILE_FULL_EA_INFORMATION
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
NTSTATUS NTAPI IoCheckEaBufferValidity(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: util.c:191
#define STATUS_INVALID_EA_NAME
Definition: ntstatus.h:199
#define STATUS_EA_TOO_LARGE
Definition: ntstatus.h:316
ULONG32 NeedEaCount
Definition: fat.h:666
UCHAR cbList[4]
Definition: fat.h:669
UCHAR OwnerFileName[14]
Definition: fat.h:667
struct _FCB * ParentDcb
Definition: fatstruc.h:836
PVCB Vcb
Definition: cdstruc.h:933
struct _IO_STACK_LOCATION::@3982::@3994 SetEa
struct _FCB * RootDcb
Definition: fatstruc.h:285
#define FILE_ACTION_MODIFIED
#define FO_FILE_MODIFIED
Definition: iotypes.h:1788
#define FILE_NOTIFY_CHANGE_EA

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

◆ FatCompareNames()

COMPARISON FatCompareNames ( IN PSTRING  NameA,
IN PSTRING  NameB 
)

Definition at line 421 of file splaysup.c.

449{
450 ULONG i;
451 ULONG MinLength;
452
453 PAGED_CODE();
454
455 //
456 // Figure out the minimum of the two lengths
457 //
458
459 MinLength = NameA->Length < NameB->Length ? NameA->Length :
460 NameB->Length;
461
462 //
463 // Loop through looking at all of the characters in both strings
464 // testing for equalilty, less than, and greater than
465 //
466
467 i = (ULONG)RtlCompareMemory( NameA->Buffer, NameB->Buffer, MinLength );
468
469
470 if (i < MinLength) {
471
472 return NameA->Buffer[i] < NameB->Buffer[i] ? IsLessThan :
474 }
475
476 if (NameA->Length < NameB->Length) {
477
478 return IsLessThan;
479 }
480
481 if (NameA->Length > NameB->Length) {
482
483 return IsGreaterThan;
484 }
485
486 return IsEqual;
487}
#define RtlCompareMemory(s1, s2, l)
Definition: env_spec_w32.h:465

◆ FatCompleteMdl()

NTSTATUS FatCompleteMdl ( IN PIRP_CONTEXT  IrpContext,
IN PIRP  Irp 
)

Definition at line 1728 of file cachesup.c.

1750{
1753
1754 PAGED_CODE();
1755
1756 DebugTrace(+1, Dbg, "FatCompleteMdl\n", 0 );
1757 DebugTrace( 0, Dbg, "IrpContext = %p\n", IrpContext );
1758 DebugTrace( 0, Dbg, "Irp = %p\n", Irp );
1759
1760 //
1761 // Do completion processing.
1762 //
1763
1765
1766 switch( IrpContext->MajorFunction ) {
1767
1768 case IRP_MJ_READ:
1769
1770 CcMdlReadComplete( FileObject, Irp->MdlAddress );
1771 break;
1772
1773 case IRP_MJ_WRITE:
1774
1776
1777 NT_ASSERT( FlagOn(IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT ));
1778
1779 CcMdlWriteComplete( FileObject, &IrpSp->Parameters.Write.ByteOffset, Irp->MdlAddress );
1780
1781 Irp->IoStatus.Status = STATUS_SUCCESS;
1782
1783 break;
1784
1785 default:
1786
1787 DebugTrace( DEBUG_TRACE_ERROR, 0, "Illegal Mdl Complete.\n", 0);
1788#ifdef _MSC_VER
1789#pragma prefast( suppress: 28159, "we're very broken if we get here" )
1790#endif
1791 FatBugCheck( IrpContext->MajorFunction, 0, 0 );
1792 }
1793
1794 //
1795 // Mdl is now deallocated.
1796 //
1797
1798 Irp->MdlAddress = NULL;
1799
1800 //
1801 // Complete the request and exit right away.
1802 //
1803
1804 FatCompleteRequest( IrpContext, Irp, STATUS_SUCCESS );
1805
1806 DebugTrace(-1, Dbg, "FatCompleteMdl -> STATUS_SUCCESS\n", 0 );
1807
1808 return STATUS_SUCCESS;
1809}
VOID NTAPI CcMdlReadComplete(IN PFILE_OBJECT FileObject, IN PMDL MdlChain)
Definition: mdlsup.c:75
VOID NTAPI CcMdlWriteComplete(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain)
Definition: mdlsup.c:102
#define FatBugCheck(A, B, C)
Definition: nodetype.h:104
#define IRP_MJ_READ
Definition: rdpdr.c:46
#define IRP_MJ_WRITE
Definition: rdpdr.c:47
struct _IO_STACK_LOCATION::@3982::@3987 Write
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550

Referenced by _Function_class_().

◆ FatCompleteRequest_Real()

VOID FatCompleteRequest_Real ( IN PIRP_CONTEXT  IrpContext,
IN PIRP  Irp,
IN NTSTATUS  Status 
)

Definition at line 733 of file fatdata.c.

757{
758 PAGED_CODE();
759
760#if DBG
761 if ( (FatBreakOnInterestingIrpCompletion != 0) && (Status == FatBreakOnInterestingIrpCompletion) ) {
763 }
764
765#endif
766
767 //
768 // If we have an Irp Context then unpin all of the repinned bcbs
769 // we might have collected.
770 //
771
772 if (IrpContext != NULL) {
773
774 NT_ASSERT( IrpContext->Repinned.Bcb[0] == NULL );
775
776 FatUnpinRepinnedBcbs( IrpContext );
777 }
778
779 //
780 // Delete the Irp context before completing the IRP so if
781 // we run into some of the asserts, we can still backtrack
782 // through the IRP.
783 //
784
785 if (IrpContext != NULL) {
786
787 FatDeleteIrpContext( IrpContext );
788 }
789
790 //
791 // If we have an Irp then complete the irp.
792 //
793
794 if (Irp != NULL) {
795
796 //
797 // We got an error, so zero out the information field before
798 // completing the request if this was an input operation.
799 // Otherwise IopCompleteRequest will try to copy to the user's buffer.
800 //
801
802 if ( NT_ERROR(Status) &&
803 FlagOn(Irp->Flags, IRP_INPUT_OPERATION) ) {
804
805 Irp->IoStatus.Information = 0;
806 }
807
808 Irp->IoStatus.Status = Status;
809
811 }
812
813 return;
814}
#define FatDeleteIrpContext(IRPCONTEXT)
Definition: fatprocs.h:1762