📄 fatprocs.h
字号:
VOID
FatTunnelFcbOrDcb (
IN PFCB FcbOrDcb,
IN PCCB Ccb OPTIONAL
);
ULONG
FatCreateNewDirent (
IN PIRP_CONTEXT IrpContext,
IN PDCB ParentDirectory,
IN ULONG DirentsNeeded
);
VOID
FatInitializeDirectoryDirent (
IN PIRP_CONTEXT IrpContext,
IN PDCB Dcb,
IN PDIRENT ParentDirent
);
VOID
FatDeleteDirent (
IN PIRP_CONTEXT IrpContext,
IN PFCB FcbOrDcb,
IN PDELETE_CONTEXT DeleteContext OPTIONAL,
IN BOOLEAN DeleteEa
);
VOID
FatLocateDirent (
IN PIRP_CONTEXT IrpContext,
IN PDCB ParentDirectory,
IN PCCB Ccb,
IN VBO OffsetToStartSearchFrom,
OUT PDIRENT *Dirent,
OUT PBCB *Bcb,
OUT PVBO ByteOffset,
OUT PBOOLEAN FileNameDos OPTIONAL,
OUT PUNICODE_STRING Lfn OPTIONAL
);
VOID
FatLocateSimpleOemDirent (
IN PIRP_CONTEXT IrpContext,
IN PDCB ParentDirectory,
IN POEM_STRING FileName,
OUT PDIRENT *Dirent,
OUT PBCB *Bcb,
OUT PVBO ByteOffset
);
BOOLEAN
FatLfnDirentExists (
IN PIRP_CONTEXT IrpContext,
IN PDCB Dcb,
IN PUNICODE_STRING Lfn,
IN PUNICODE_STRING LfnTmp
);
VOID
FatLocateVolumeLabel (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
OUT PDIRENT *Dirent,
OUT PBCB *Bcb,
OUT PVBO ByteOffset
);
VOID
FatGetDirentFromFcbOrDcb (
IN PIRP_CONTEXT IrpContext,
IN PFCB FcbOrDcb,
IN BOOLEAN ReturnOnFailure,
OUT PDIRENT *Dirent,
OUT PBCB *Bcb
);
BOOLEAN
FatIsDirectoryEmpty (
IN PIRP_CONTEXT IrpContext,
IN PDCB Dcb
);
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 UCHAR Attributes,
IN BOOLEAN ZeroAndSetTimeFields,
IN PLARGE_INTEGER SetCreationTime OPTIONAL
);
VOID
FatConstructLabelDirent (
IN PIRP_CONTEXT IrpContext,
IN OUT PDIRENT Dirent,
IN POEM_STRING Label
);
VOID
FatSetFileSizeInDirent (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN PULONG AlternativeFileSize OPTIONAL
);
VOID
FatUpdateDirentFromFcb (
IN PIRP_CONTEXT IrpContext,
IN PFILE_OBJECT FileObject,
IN PFCB FcbOrDcb,
IN PCCB Ccb
);
//
// Generate a relatively unique static 64bit ID from a FAT Fcb/Dcb
//
// ULONGLONG
// FatDirectoryKey (FcbOrDcb);
//
#define FatDirectoryKey(FcbOrDcb) ((ULONGLONG)((FcbOrDcb)->CreationTime.QuadPart ^ (FcbOrDcb)->FirstClusterOfFile))
//
// The following routines are used to access and manipulate the
// clusters containing EA data in the ea data file. They are
// implemented in EaSup.c
//
//
// VOID
// FatUpcaseEaName (
// IN PIRP_CONTEXT IrpContext,
// IN POEM_STRING EaName,
// OUT POEM_STRING UpcasedEaName
// );
//
#define FatUpcaseEaName( IRPCONTEXT, NAME, UPCASEDNAME ) \
RtlUpperString( UPCASEDNAME, NAME )
VOID
FatGetEaLength (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PDIRENT Dirent,
OUT PULONG EaLength
);
VOID
FatGetNeedEaCount (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PDIRENT Dirent,
OUT PULONG NeedEaCount
);
VOID
FatCreateEa (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PUCHAR Buffer,
IN ULONG Length,
IN POEM_STRING FileName,
OUT PUSHORT EaHandle
);
VOID
FatDeleteEa (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN USHORT EaHandle,
IN POEM_STRING FileName
);
VOID
FatGetEaFile (
IN PIRP_CONTEXT IrpContext,
IN OUT PVCB Vcb,
OUT PDIRENT *EaDirent,
OUT PBCB *EaBcb,
IN BOOLEAN CreateFile,
IN BOOLEAN ExclusiveFcb
);
VOID
FatReadEaSet (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN USHORT EaHandle,
IN POEM_STRING FileName,
IN BOOLEAN ReturnEntireSet,
OUT PEA_RANGE EaSetRange
);
VOID
FatDeleteEaSet (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PBCB EaBcb,
OUT PDIRENT EaDirent,
IN USHORT EaHandle,
IN POEM_STRING Filename
);
VOID
FatAddEaSet (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN ULONG EaSetLength,
IN PBCB EaBcb,
OUT PDIRENT EaDirent,
OUT PUSHORT EaHandle,
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
);
//
// The following macro computes the size of a full ea (not including
// padding to bring it to a longword. A full ea has a 4 byte offset,
// folowed by 1 byte flag, 1 byte name length, 2 bytes value length,
// the name, 1 null byte, and the value.
//
// ULONG
// SizeOfFullEa (
// IN PFILE_FULL_EA_INFORMATION FullEa
// );
//
#define SizeOfFullEa(EA) (4+1+1+2+(EA)->EaNameLength+1+(EA)->EaValueLength)
//
// The following routines are used to manipulate the fscontext fields
// of the file object, implemented in FilObSup.c
//
typedef enum _TYPE_OF_OPEN {
UnopenedFileObject = 1,
UserFileOpen,
UserDirectoryOpen,
UserVolumeOpen,
VirtualVolumeFile,
DirectoryFile,
EaFile
} TYPE_OF_OPEN;
typedef enum _FAT_FLUSH_TYPE {
NoFlush = 0,
Flush,
FlushAndInvalidate,
FlushWithoutPurge
} FAT_FLUSH_TYPE;
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,
OUT PVCB *Vcb,
OUT PFCB *FcbOrDcb,
OUT PCCB *Ccb
);
VOID
FatPurgeReferencedFileObjects (
IN PIRP_CONTEXT IrpContext,
IN PFCB FcbOrDcb,
IN FAT_FLUSH_TYPE FlushType
);
VOID
FatForceCacheMiss (
IN PIRP_CONTEXT IrpContext,
IN PFCB Fcb,
IN FAT_FLUSH_TYPE FlushType
);
//
// File system control routines, implemented in FsCtrl.c
//
VOID
FatFlushAndCleanVolume(
IN PIRP_CONTEXT IrpContext,
IN PIRP Irp,
IN PVCB Vcb,
IN FAT_FLUSH_TYPE FlushType
);
BOOLEAN
FatIsBootSectorFat (
IN PPACKED_BOOT_SECTOR BootSector
);
NTSTATUS
FatLockVolumeInternal (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PFILE_OBJECT FileObject OPTIONAL
);
NTSTATUS
FatUnlockVolumeInternal (
IN PIRP_CONTEXT IrpContext,
IN PVCB Vcb,
IN PFILE_OBJECT FileObject OPTIONAL
);
//
// Name support routines, implemented in NameSup.c
//
//
// VOID
// FatDissectName (
// IN PIRP_CONTEXT IrpContext,
// IN OEM_STRING InputString,
// OUT POEM_STRING FirstPart,
// OUT POEM_STRING RemainingPart
// )
//
// /*++
//
// Routine Description:
//
// This routine takes an input string and dissects it into two substrings.
// The first output string contains the name that appears at the beginning
// of the input string, the second output string contains the remainder of
// the input string.
//
// In the input string backslashes are used to separate names. The input
// string must not start with a backslash. Both output strings will not
// begin with a backslash.
//
// If the input string does not contain any names then both output strings
// are empty. If the input string contains only one name then the first
// output string contains the name and the second string is empty.
//
// Note that both output strings use the same string buffer memory of the
// input string.
//
// Example of its results are:
//
// //. . InputString FirstPart RemainingPart
// //
// //. . empty empty empty
// //
// //. . A A empty
// //
// //. . A\B\C\D\E A B\C\D\E
// //
// //. . *A? *A? empty
// //
// //. . \A A empty
// //
// //. . A[,] A[,] empty
// //
// //. . A\\B+;\C A \B+;\C
//
// Arguments:
//
// InputString - Supplies the input string being dissected
//
// FirstPart - Receives the first name in the input string
//
// RemainingPart - Receives the remaining part of the input string
//
// Return Value:
//
// BOOLEAN - TRUE if the input string is well formed and its first part
// does not contain any illegal characters, and FALSE otherwise.
//
// --*/
//
#define FatDissectName(IRPCONTEXT,INPUT_STRING,FIRST_PART,REMAINING_PART) { \
FsRtlDissectDbcs( (INPUT_STRING), \
(FIRST_PART), \
(REMAINING_PART) ); \
}
//
// BOOLEAN
// FatDoesNameContainWildCards (
// IN PIRP_CONTEXT IrpContext,
// IN OEM_STRING Name
// )
//
// /*++
//
// Routine Description:
//
// This routine checks if the input name contains any wild card characters.
//
// Arguments:
//
// Name - Supplies the name to examine
//
// Return Value:
//
// BOOLEAN - TRUE if the input name contains any wildcard characters and
// FALSE otherwise.
//
// --*/
//
#define FatDoesNameContainWildCards(IRPCONTEXT,NAME) ( \
FsRtlDoesDbcsContainWildCards( &(NAME) ) \
)
//
// BOOLEAN
// FatAreNamesEqual (
// IN PIRP_CONTEXT IrpContext,
// IN OEM_STRING ConstantNameA,
// IN OEM_STRING ConstantNameB
// )
//
// /*++
//
// Routine Description:
//
// This routine simple returns whether the two names are exactly equal.
// If the two names are known to be constant, this routine is much
// faster than FatIsDbcsInExpression.
//
// Arguments:
//
// ConstantNameA - Constant name.
//
// ConstantNameB - Constant name.
//
// Return Value:
//
// BOOLEAN - TRUE if the two names are lexically equal.
//
#define FatAreNamesEqual(IRPCONTEXT,NAMEA,NAMEB) ( \
((ULONG)(NAMEA).Length == (ULONG)(NAMEB).Length) && \
(RtlEqualMemory( &(NAMEA).Buffer[0], \
&(NAMEB).Buffer[0], \
(NAMEA).Length )) \
)
//
// BOOLEAN
// FatIsNameShortOemValid (
// IN PIRP_CONTEXT IrpContext,
// IN OEM_STRING Name,
// IN BOOLEAN CanContainWildCards,
// IN BOOLEAN PathNamePermissible,
// IN BOOLEAN LeadingBackslashPermissible
// )
//
// /*++
//
// Routine Description:
//
// This routine scans the input name and verifies that if only
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -