360{
380
381 DPRINT(
"NtfsQueryDirectory() called\n");
382
386
390
393
394
396 SearchPattern =
Stack->Parameters.QueryDirectory.FileName;
398 FileIndex =
Stack->Parameters.QueryDirectory.FileIndex;
399
401 {
402 DPRINT1(
"Compressed directory!\n");
405 }
406
409 {
411 }
412
413 if (SearchPattern !=
NULL)
414 {
415 if (!
Ccb->DirectorySearchPattern)
416 {
420 Ccb->DirectorySearchPattern = Pattern.
Buffer =
422 if (!
Ccb->DirectorySearchPattern)
423 {
426 }
427
429 Ccb->DirectorySearchPattern[SearchPattern->
Length /
sizeof(
WCHAR)] = 0;
430 }
431 }
432 else if (!
Ccb->DirectorySearchPattern)
433 {
436 if (!
Ccb->DirectorySearchPattern)
437 {
440 }
441
442 Ccb->DirectorySearchPattern[0] =
L'*';
443 Ccb->DirectorySearchPattern[1] = 0;
444 }
445
447 DPRINT(
"Search pattern '%S'\n",
Ccb->DirectorySearchPattern);
449
450
452 {
454 }
456 {
458 }
459
460
462
464
467 {
470 }
471
472 Written = 0;
474 {
476 &Pattern,
478 &FileRecord,
479 &MFTRecord,
482
484 {
485
486
487
488 if (MFTRecord == OldMFTRecord)
489 {
490 DPRINT1(
"Ignoring duplicate MFT entry 0x%x\n", MFTRecord);
492 ExFreeToNPagedLookasideList(&DeviceExtension->FileRecLookasideList, FileRecord);
493 continue;
494 }
495 OldMFTRecord = MFTRecord;
496
498 {
501 FileRecord,
502 MFTRecord,
505 &Written,
507 break;
508
511 FileRecord,
512 MFTRecord,
515 &Written,
517 break;
518
521 FileRecord,
522 MFTRecord,
525 &Written,
527 break;
528
531 FileRecord,
532 MFTRecord,
535 &Written,
537 break;
538
539 default:
541 }
542
544 {
545 break;
546 }
547 }
548 else
549 {
551 break;
552 }
553
558
559 ExFreeToNPagedLookasideList(&DeviceExtension->FileRecLookasideList, FileRecord);
560
562 {
563 break;
564 }
565
567 }
568
569 if (Buffer0)
570 {
574 }
575 else
576 {
580 }
581
584
586}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
PVOID NtfsGetUserBuffer(PIRP Irp, BOOLEAN Paging)
struct NTFS_CCB * PNTFS_CCB
#define IRPCONTEXT_CANWAIT
#define ExAllocatePoolWithTag(hernya, size, tag)
#define ExAcquireResourceExclusiveLite(res, wait)
#define ExAcquireResourceSharedLite(res, wait)
#define BooleanFlagOn(F, SF)
@ FileDirectoryInformation
@ FileFullDirectoryInformation
@ FileBothDirectoryInformation
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
struct _FILE_NAMES_INFORMATION * PFILE_NAMES_INFORMATION
NTSTATUS NtfsFindFileAt(PDEVICE_EXTENSION Vcb, PUNICODE_STRING SearchPattern, PULONG FirstEntry, PFILE_RECORD_HEADER *FileRecord, PULONGLONG MFTIndex, ULONGLONG CurrentMFTIndex, BOOLEAN CaseSensitive)
#define memcpy(s1, s2, n)
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
static NTSTATUS NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_DIRECTORY_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
static NTSTATUS NtfsGetNamesInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_NAMES_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
static NTSTATUS NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_BOTH_DIR_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
static NTSTATUS NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_FULL_DIRECTORY_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
BOOLEAN NtfsFCBIsCompressed(PNTFS_FCB Fcb)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
#define STATUS_INVALID_INFO_CLASS
PDEVICE_OBJECT DeviceObject
#define STATUS_NO_SUCH_FILE
#define STATUS_INSUFFICIENT_RESOURCES
#define STATUS_NO_MORE_FILES
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
#define SL_INDEX_SPECIFIED
#define SL_RETURN_SINGLE_ENTRY
#define SL_CASE_SENSITIVE