23#define BugCheckFileId (FAT_BUG_CHECK_DIRCTRL)
29#define Dbg (DEBUG_TRACE_DIRCTRL)
54FatNotifyChangeDirectory (
60#pragma alloc_text(PAGE, FatCommonDirectoryControl)
61#pragma alloc_text(PAGE, FatFsdDirectoryControl)
62#pragma alloc_text(PAGE, FatNotifyChangeDirectory)
63#pragma alloc_text(PAGE, FatQueryDirectory)
64#pragma alloc_text(PAGE, FatGetDirTimes)
73FatFsdDirectoryControl (
120 Status = FatCommonDirectoryControl( IrpContext,
Irp );
152FatCommonDirectoryControl (
200 Status = FatQueryDirectory( IrpContext,
Irp );
205 Status = FatNotifyChangeDirectory( IrpContext,
Irp );
262 CLONG UserBufferLength;
270 ULONG MatchFlags = 0;
279 UCHAR Fat8Dot3Buffer[12];
312 DebugTrace( 0,
Dbg,
" ->UserBuffer = %p\n",
Irp->AssociatedIrp.SystemBuffer);
346 DebugTrace(-1,
Dbg,
"FatQueryDirectory -> STATUS_INVALID_PARAMETER\n", 0);
359 Fat8Dot3String.MaximumLength = 12;
360 Fat8Dot3String.Buffer = (
PCHAR)Fat8Dot3Buffer;
364 LongFileName.
Buffer = LongFileNameBuffer;
366 InitialQuery = (
BOOLEAN)((
Ccb->UnicodeQueryTemplate.Buffer ==
NULL) &&
369 Irp->IoStatus.Information = 0;
371 DiskAllocSize = 1 <<
Vcb->AllocationSupport.LogOfBytesPerCluster;
386 if (!FatAcquireExclusiveFcb( IrpContext,
Dcb )) {
388 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Enqueue to Fsp\n", 0);
397 InitialQuery =
FALSE;
404 if (!FatAcquireSharedFcb( IrpContext,
Dcb )) {
406 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Enqueue to Fsp\n", 0);
418 ULONG BytesConverted;
432 FatVerifyFcb( IrpContext,
Dcb );
441 if (IndexSpecified) {
443 CurrentVbo = FileIndex +
sizeof(
DIRENT );
448 Ccb->OffsetToStartSearchFrom = 0;
452 CurrentVbo =
Ccb->OffsetToStartSearchFrom;
469 if (
Ccb->UnicodeQueryTemplate.Buffer) {
477 Ccb->UnicodeQueryTemplate.Buffer =
NULL;
478 Ccb->UnicodeQueryTemplate.Length = 0;
479 Ccb->UnicodeQueryTemplate.MaximumLength = 0;
482 if (
Ccb->OemQueryTemplate.Wild.Buffer) {
490 Ccb->OemQueryTemplate.Wild.Buffer =
NULL;
491 Ccb->OemQueryTemplate.Wild.Length = 0;
492 Ccb->OemQueryTemplate.Wild.MaximumLength = 0;
514 if ((UniArgFileName ==
NULL) ||
515 (UniArgFileName->
Length == 0) ||
518 (UniArgFileName->
Buffer[0] ==
L'*')) ||
522 12*
sizeof(
WCHAR) )))) {
537 Ccb->ContainsWildCards =
547 if (UniArgFileName->
Buffer[
i] >= 0x80) {
615 Ccb->UnicodeQueryTemplate.Length = UniArgFileName->
Length;
616 Ccb->UnicodeQueryTemplate.MaximumLength = UniArgFileName->
Length;
619 LocalBestFit.Length = UniArgFileName->
Length /
sizeof(
WCHAR);
620 LocalBestFit.MaximumLength = LocalBestFit.Length;
628 LocalBestFit.Buffer[
i] = (
UCHAR)
629 (
Ccb->UnicodeQueryTemplate.Buffer[
i] =
630 (
c <
'a' ?
c :
c <=
'z' ?
c - (
'a' -
'A') :
c));
648 Ccb->ContainsWildCards,
671 if (
Ccb->ContainsWildCards) {
673 Ccb->OemQueryTemplate.Wild = LocalBestFit;
679 &
Ccb->OemQueryTemplate.Constant );
756 ULONG BytesRemainingInBuffer;
776 FatLocateDirent( IrpContext,
798 if (NextEntry == 0) {
828 if (LongFileName.
Length == 0) {
859 BytesRemainingInBuffer = UserBufferLength - NextEntry;
861 if ( (NextEntry != 0) &&
863 (UserBufferLength < NextEntry) ) ) {
870 NT_ASSERT( BytesRemainingInBuffer >= BaseLength );
889 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Getting file full directory information\n", 0);
904 FatGetEaLength( IrpContext,
927 (((
Dirent->FileSize + DiskAllocSize - 1) / DiskAllocSize) *
931 if (
Dirent->Attributes != 0) {
946 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String);
952 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Getting file names information\n", 0);
960 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String );
967#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
975 BytesRemainingInBuffer - BaseLength,
977 Fat8Dot3String.Buffer,
978 Fat8Dot3String.Length );
995 *((
PULONG)(&
Buffer[LastEntry])) = NextEntry - LastEntry;
1004 BaseLength + BytesConverted;
1017 ULONG ShortNameLength;
1037 BytesRemainingInBuffer = UserBufferLength - NextEntry;
1039 if ( (NextEntry != 0) &&
1041 (UserBufferLength < NextEntry) ) ) {
1048 NT_ASSERT( BytesRemainingInBuffer >= BaseLength );
1076 NT_ASSERT( Fat8Dot3String.Length <= 12 );
1081 Fat8Dot3String.Buffer,
1082 Fat8Dot3String.Length );
1107 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Getting file full directory information\n", 0);
1122 FatGetEaLength( IrpContext,
1146 + DiskAllocSize - 1 )
1151 if (
Dirent->Attributes != 0) {
1168 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String);
1174 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Getting file names information\n", 0);
1182 DebugTrace(0,
Dbg,
"FatQueryDirectory -> Name = \"%Z\"\n", &Fat8Dot3String );
1189#pragma prefast( suppress:28159, "things are seriously wrong if we get here" )
1194 BytesConverted = BytesRemainingInBuffer - BaseLength >=
FileNameLength ?
1196 BytesRemainingInBuffer - BaseLength;
1206 *((
PULONG)(&
Buffer[LastEntry])) = NextEntry - LastEntry;
1215 BaseLength + BytesConverted;
1260 Irp->IoStatus.Information = 0;
1269 LastEntry = NextEntry;
1272 CurrentVbo = NextVbo +
sizeof(
DIRENT );
1311 Ccb->OffsetToStartSearchFrom = CurrentVbo;
1384 Dirent->CreationMSec * 10 * 1000 * 10;
1420 (WriteTime->
Minute * 60) +
1421 (WriteTime->
Hour * 60 * 60)),
1434 Dirent->LastAccessDate );
1452FatNotifyChangeDirectory (
1521 DebugTrace(-1,
Dbg,
"FatQueryDirectory -> STATUS_INVALID_PARAMETER\n", 0);
1539 if (!FatAcquireExclusiveFcb( IrpContext,
Dcb )) {
1541 DebugTrace(0,
Dbg,
"FatNotifyChangeDirectory -> Cannot Acquire Fcb\n", 0);
1555 FatVerifyFcb( IrpContext,
Dcb );
1561 FatSetFullFileNameInFcb( IrpContext,
Dcb );
1578 &
Vcb->DirNotifyList,
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_In_ PFCB _In_ PDIRENT_ENUM_CONTEXT _Inout_ PDIRENT Dirent
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
#define IRP_CONTEXT_FLAG_WAIT
#define _Requires_lock_held_(lock)
#define NT_SUCCESS(StatCode)
#define FILE_ATTRIBUTE_NORMAL
NTSTATUS NTAPI CompleteRequest(IN PIRP Irp, IN NTSTATUS Status, IN ULONG_PTR Information)
_In_ PIO_STACK_LOCATION IrpSp
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
#define FAT_DIRENT_ATTR_DIRECTORY
#define FatBugCheck(A, B, C)
#define TAG_FILENAME_BUFFER
#define ExLocalTimeToSystemTime(LocTime, SysTime)
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
#define ClearFlag(_F, _SF)
#define BooleanFlagOn(F, SF)
PVOID FatMapUserBuffer(IN PIRP_CONTEXT IrpContext, IN OUT PIRP Irp)
VOID FatGetDirTimes(PIRP_CONTEXT IrpContext, PDIRENT Dirent, PFILE_DIRECTORY_INFORMATION DirInfo)
LARGE_INTEGER FatJanOne1980
ULONG FatExceptionFilter(IN PIRP_CONTEXT IrpContext, IN PEXCEPTION_POINTERS ExceptionPointer)
BOOLEAN FatIsIrpTopLevel(IN PIRP Irp)
#define DebugTrace(INDENT, LEVEL, X, Y)
#define FatConvertToSharedFcb(IRPCONTEXT, Fcb)
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
#define FatUnpinBcb(IRPCONTEXT, BCB)
VOID FatStringTo8dot3(_In_ PIRP_CONTEXT IrpContext, _In_ OEM_STRING InputString, _Out_writes_bytes_(11) PFAT8DOT3 Output8dot3)
#define FAT_CREATE_INITIAL_NAME_BUF_SIZE
NTSTATUS FatFsdPostRequest(IN PIRP_CONTEXT IrpContext, IN PIRP Irp)
TYPE_OF_OPEN FatDecodeFileObject(_In_ PFILE_OBJECT FileObject, _Outptr_ PVCB *Vcb, _Outptr_ PFCB *FcbOrDcb, _Outptr_ PCCB *Ccb)
IN PFCB IN PCCB IN TYPE_OF_OPEN IN BOOLEAN IN BOOLEAN TopLevel
#define FatCompleteRequest(IRPCONTEXT, IRP, STATUS)
#define FatReleaseFcb(IRPCONTEXT, Fcb)
#define FatResetExceptionState(IRPCONTEXT)
#define FatIsNameShortOemValid(IRPCONTEXT, NAME, CAN_CONTAIN_WILD_CARDS, PATH_NAME_OK, LEADING_BACKSLASH_OK)
#define FatGenerateFileIdFromDirentAndOffset(Dcb, Dirent, DirentOffset)
#define FatRaiseStatus(IRPCONTEXT, STATUS)
VOID Fat8dot3ToString(_In_ PIRP_CONTEXT IrpContext, _In_ PDIRENT Dirent, _In_ BOOLEAN RestoreCase, _Out_ POEM_STRING OutputString)
LARGE_INTEGER FatFatTimeToNtTime(_In_ PIRP_CONTEXT IrpContext, _In_ FAT_TIME_STAMP FatTime, _In_ UCHAR TenMilliSeconds)
VOID FatFreeStringBuffer(_Inout_ PVOID String)
LARGE_INTEGER FatFatDateToNtTime(_In_ PIRP_CONTEXT IrpContext, _In_ FAT_DATE FatDate)
PIRP_CONTEXT FatCreateIrpContext(IN PIRP Irp, IN BOOLEAN Wait)
#define CCB_FLAG_FREE_UNICODE
#define CCB_FLAG_QUERY_TEMPLATE_MIXED
#define CCB_FLAG_SKIP_SHORT_NAME_COMPARE
#define FCB_STATE_DELETE_ON_CLOSE
#define CCB_FLAG_MATCH_ALL
#define CCB_FLAG_FREE_OEM_BEST_FIT
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN _In_ ULONG _In_opt_ PULONG _In_ BOOLEAN RestartScan
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ HANDLE _In_ ULONG FileNameLength
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ BOOLEAN ReturnSingleEntry
_Inout_ PLIST_ENTRY _In_ PVOID _In_ PSTRING _In_ BOOLEAN _In_ BOOLEAN _In_ ULONG CompletionFilter
_Inout_ PLIST_ENTRY _In_ PVOID _In_ PSTRING _In_ BOOLEAN WatchTree
struct _FILE_BOTH_DIR_INFORMATION * PFILE_BOTH_DIR_INFORMATION
@ FileDirectoryInformation
@ FileIdBothDirectoryInformation
@ FileFullDirectoryInformation
@ FileBothDirectoryInformation
@ FileIdFullDirectoryInformation
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
struct _FILE_NAMES_INFORMATION * PFILE_NAMES_INFORMATION
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
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
#define EXCEPTION_EXECUTE_HANDLER
VOID NTAPI RtlFreeOemString(POEM_STRING OemString)
struct _FILE_FULL_DIRECTORY_INFORMATION * PFILE_FULL_DIR_INFORMATION
NTSYSAPI NTSTATUS WINAPI RtlUpcaseUnicodeStringToCountedOemString(STRING *, const UNICODE_STRING *, BOOLEAN)
struct _FILE_DIRECTORY_INFORMATION * PFILE_DIRECTORY_INFORMATION
#define UInt32x32To64(a, b)
#define RtlEqualMemory(dst, src, len)
#define ExFreePoolWithTag(_P, _T)
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
#define _Function_class_(x)
DRIVER_DISPATCH(nfs41_FsdDispatch)
_Use_decl_annotations_ NTSTATUS NTAPI RtlOemToUnicodeN(_Out_ PWCHAR UnicodeString, _In_ ULONG UnicodeSize, _Out_opt_ PULONG ResultSize, _In_ PCCH OemString, _In_ ULONG OemSize)
#define UNREFERENCED_PARAMETER(P)
PVOID NTAPI FsRtlAllocatePoolWithTag(IN POOL_TYPE PoolType, IN ULONG NumberOfBytes, IN ULONG Tag)
BOOLEAN NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
VOID NTAPI FsRtlNotifyFullChangeDirectory(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext, IN PSTRING FullDirectoryName, IN BOOLEAN WatchTree, IN BOOLEAN IgnoreBuffer, IN ULONG CompletionFilter, IN PIRP NotifyIrp, IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
#define STATUS_DELETE_PENDING
#define STATUS_INVALID_INFO_CLASS
#define STATUS_UNMAPPABLE_CHARACTER
#define _SEH2_AbnormalTermination()
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
#define IRP_MJ_DIRECTORY_CONTROL
#define IRP_MN_QUERY_DIRECTORY
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY
#define STATUS_BUFFER_OVERFLOW
LARGE_INTEGER LastWriteTime
struct _IO_STACK_LOCATION::@3974::@3981 NotifyDirectory
union _IO_STACK_LOCATION::@1575 Parameters
struct _IO_STACK_LOCATION::@3974::@3980 QueryDirectory
#define FIELD_OFFSET(t, f)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_INVALID_PARAMETER
#define STATUS_NO_SUCH_FILE
#define STATUS_NO_MORE_FILES
#define SL_INDEX_SPECIFIED
struct _FILE_ID_BOTH_DIR_INFORMATION * PFILE_ID_BOTH_DIR_INFORMATION
#define SL_RETURN_SINGLE_ENTRY
struct _FILE_ID_FULL_DIR_INFORMATION * PFILE_ID_FULL_DIR_INFORMATION
#define RtlOemStringToCountedUnicodeSize(STRING)