ReactOS 0.4.16-dev-319-g6cf4263
dirctl.c File Reference
#include "ntfs.h"
#include <debug.h>
Include dependency graph for dirctl.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define ULONG_ROUND_UP(x)   ROUND_UP((x), (sizeof(ULONG)))
 

Functions

ULONGLONG NtfsGetFileSize (PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, PCWSTR Stream, ULONG StreamLength, PULONGLONG AllocatedSize)
 
static NTSTATUS NtfsGetNamesInformation (PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_NAMES_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
 
static NTSTATUS NtfsGetDirectoryInformation (PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_DIRECTORY_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)
 
static NTSTATUS NtfsGetBothDirectoryInformation (PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_BOTH_DIR_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
 
NTSTATUS NtfsQueryDirectory (PNTFS_IRP_CONTEXT IrpContext)
 
NTSTATUS NtfsDirectoryControl (PNTFS_IRP_CONTEXT IrpContext)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 32 of file dirctl.c.

◆ ULONG_ROUND_UP

#define ULONG_ROUND_UP (   x)    ROUND_UP((x), (sizeof(ULONG)))

Definition at line 63 of file dirctl.c.

Function Documentation

◆ NtfsDirectoryControl()

NTSTATUS NtfsDirectoryControl ( PNTFS_IRP_CONTEXT  IrpContext)

Definition at line 590 of file dirctl.c.

591{
593
594 DPRINT("NtfsDirectoryControl() called\n");
595
596 switch (IrpContext->MinorFunction)
597 {
599 Status = NtfsQueryDirectory(IrpContext);
600 break;
601
603 DPRINT1("IRP_MN_NOTIFY_CHANGE_DIRECTORY\n");
605 break;
606
607 default:
609 break;
610 }
611
612 if (Status == STATUS_PENDING && IrpContext->Flags & IRPCONTEXT_COMPLETE)
613 {
614 return NtfsMarkIrpContextForQueue(IrpContext);
615 }
616
617 IrpContext->Irp->IoStatus.Information = 0;
618
619 return Status;
620}
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
FORCEINLINE NTSTATUS NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
Definition: ntfs.h:569
#define IRPCONTEXT_COMPLETE
Definition: ntfs.h:475
Status
Definition: gdiplustypes.h:25
NTSTATUS NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
Definition: dirctl.c:359
#define IRP_MN_QUERY_DIRECTORY
Definition: rdpdr.c:55
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY
Definition: rdpdr.c:56
#define DPRINT
Definition: sndvol32.h:73
ULONG Flags
Definition: ntfs.h:481
UCHAR MinorFunction
Definition: ntfs.h:484
IO_STATUS_BLOCK IoStatus
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by NtfsDispatch().

◆ NtfsGetBothDirectoryInformation()

static NTSTATUS NtfsGetBothDirectoryInformation ( PDEVICE_EXTENSION  DeviceExt,
PFILE_RECORD_HEADER  FileRecord,
ULONGLONG  MFTIndex,
PFILE_BOTH_DIR_INFORMATION  Info,
ULONG  BufferLength,
PULONG  Written,
BOOLEAN  First 
)
static

Definition at line 271 of file dirctl.c.

278{
281 ULONG BytesToCopy = 0;
282 PFILENAME_ATTRIBUTE FileName, ShortFileName;
283 PSTANDARD_INFORMATION StdInfo;
284
285 DPRINT("NtfsGetBothDirectoryInformation() called\n");
286
287 *Written = 0;
290 {
291 return Status;
292 }
293
294 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
295 if (FileName == NULL)
296 {
297 DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
298 NtfsDumpFileAttributes(DeviceExt, FileRecord);
300 }
301 ShortFileName = GetFileNameFromRecord(DeviceExt, FileRecord, NTFS_FILE_NAME_DOS);
302
303 StdInfo = GetStandardInformationFromRecord(DeviceExt, FileRecord);
304 ASSERT(StdInfo != NULL);
305
306 Length = FileName->NameLength * sizeof (WCHAR);
308 {
309 Info->FileNameLength = Length;
310
312 Info->NextEntryOffset = 0;
314 {
317 *Written += BytesToCopy;
318
319 if (BytesToCopy == Length)
320 {
321 Info->NextEntryOffset = ULONG_ROUND_UP(sizeof(FILE_BOTH_DIR_INFORMATION) +
324 }
325 }
326
327 if (ShortFileName)
328 {
329 /* Should we upcase the filename? */
330 ASSERT(ShortFileName->NameLength <= ARRAYSIZE(Info->ShortName));
331 Info->ShortNameLength = ShortFileName->NameLength * sizeof(WCHAR);
332 RtlCopyMemory(Info->ShortName, ShortFileName->Name, Info->ShortNameLength);
333 }
334 else
335 {
336 Info->ShortName[0] = 0;
337 Info->ShortNameLength = 0;
338 }
339
340 Info->CreationTime.QuadPart = FileName->CreationTime;
341 Info->LastAccessTime.QuadPart = FileName->LastAccessTime;
342 Info->LastWriteTime.QuadPart = FileName->LastWriteTime;
343 Info->ChangeTime.QuadPart = FileName->ChangeTime;
344
345 /* Convert file flags */
346 NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
347
348 Info->EndOfFile.QuadPart = NtfsGetFileSize(DeviceExt, FileRecord, L"", 0, (PULONGLONG)&Info->AllocationSize.QuadPart);
349
350 Info->FileIndex = MFTIndex;
351 Info->EaSize = 0;
352 }
353
354 return Status;
355}
WCHAR First[]
Definition: FormatMessage.c:11
#define NTFS_FILE_NAME_DOS
Definition: ntfs.h:65
#define NULL
Definition: types.h:112
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
PSTANDARD_INFORMATION GetStandardInformationFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1940
PFILENAME_ATTRIBUTE GetFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord, UCHAR NameType)
Definition: attrib.c:1809
VOID NtfsDumpFileAttributes(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1790
PFILENAME_ATTRIBUTE GetBestFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1985
VOID NtfsFileFlagsToAttributes(ULONG NtfsAttributes, PULONG FileAttributes)
Definition: misc.c:105
struct _FileName FileName
Definition: fatprocs.h:897
#define ASSERT(a)
Definition: mode.c:44
#define min(a, b)
Definition: monoChain.cc:55
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3168
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:391
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
ULONGLONG NtfsGetFileSize(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, PCWSTR Stream, ULONG StreamLength, PULONGLONG AllocatedSize)
Definition: dirctl.c:38
#define ULONG_ROUND_UP(x)
Definition: dirctl.c:63
#define L(x)
Definition: ntvdm.h:50
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
UCHAR NameLength
Definition: ntfs.h:377
WCHAR Name[1]
Definition: ntfs.h:379
ULONG FileAttribute
Definition: ntfs.h:334
TCHAR Name[MAX_PATH]
Definition: filecomp.c:349
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by NtfsQueryDirectory().

◆ NtfsGetDirectoryInformation()

static NTSTATUS NtfsGetDirectoryInformation ( PDEVICE_EXTENSION  DeviceExt,
PFILE_RECORD_HEADER  FileRecord,
ULONGLONG  MFTIndex,
PFILE_DIRECTORY_INFORMATION  Info,
ULONG  BufferLength,
PULONG  Written,
BOOLEAN  First 
)
static

Definition at line 124 of file dirctl.c.

131{
134 ULONG BytesToCopy = 0;
136 PSTANDARD_INFORMATION StdInfo;
137
138 DPRINT("NtfsGetDirectoryInformation() called\n");
139
140 *Written = 0;
143 {
144 return Status;
145 }
146
147 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
148 if (FileName == NULL)
149 {
150 DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
151 NtfsDumpFileAttributes(DeviceExt, FileRecord);
153 }
154
155 StdInfo = GetStandardInformationFromRecord(DeviceExt, FileRecord);
156 ASSERT(StdInfo != NULL);
157
158 Length = FileName->NameLength * sizeof (WCHAR);
160 {
161 Info->FileNameLength = Length;
162
164 Info->NextEntryOffset = 0;
166 {
169 *Written += BytesToCopy;
170
171 if (BytesToCopy == Length)
172 {
173 Info->NextEntryOffset = ULONG_ROUND_UP(sizeof(FILE_DIRECTORY_INFORMATION) +
176 }
177 }
178
179 Info->CreationTime.QuadPart = FileName->CreationTime;
180 Info->LastAccessTime.QuadPart = FileName->LastAccessTime;
181 Info->LastWriteTime.QuadPart = FileName->LastWriteTime;
182 Info->ChangeTime.QuadPart = FileName->ChangeTime;
183
184 /* Convert file flags */
185 NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
186
187 Info->EndOfFile.QuadPart = NtfsGetFileSize(DeviceExt, FileRecord, L"", 0, (PULONGLONG)&Info->AllocationSize.QuadPart);
188
189 Info->FileIndex = MFTIndex;
190 }
191
192 return Status;
193}

Referenced by NtfsQueryDirectory().

◆ NtfsGetFileSize()

ULONGLONG NtfsGetFileSize ( PDEVICE_EXTENSION  DeviceExt,
PFILE_RECORD_HEADER  FileRecord,
PCWSTR  Stream,
ULONG  StreamLength,
PULONGLONG  AllocatedSize 
)

Definition at line 38 of file dirctl.c.

43{
47 PNTFS_ATTR_CONTEXT DataContext;
48
49 Status = FindAttribute(DeviceExt, FileRecord, AttributeData, Stream, StreamLength, &DataContext, NULL);
50 if (NT_SUCCESS(Status))
51 {
52 Size = AttributeDataLength(DataContext->pRecord);
53 Allocated = AttributeAllocatedLength(DataContext->pRecord);
54 ReleaseAttributeContext(DataContext);
55 }
56
57 if (AllocatedSize != NULL) *AllocatedSize = Allocated;
58
59 return Size;
60}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
@ AttributeData
Definition: ntfs.h:168
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN Allocated
Definition: fatprocs.h:311
VOID ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context)
Definition: mft.c:104
ULONGLONG AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord)
Definition: mft.c:259
NTSTATUS FindAttribute(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, ULONG Type, PCWSTR Name, ULONG NameLength, PNTFS_ATTR_CONTEXT *AttrCtx, PULONG Offset)
Definition: mft.c:131
ULONGLONG AttributeAllocatedLength(PNTFS_ATTR_RECORD AttrRecord)
Definition: mft.c:249
#define ULL(a, b)
Definition: format_msg.c:27
static IStream Stream
Definition: htmldoc.c:1115
uint64_t ULONGLONG
Definition: typedefs.h:67
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by NtfsGetBothDirectoryInformation(), NtfsGetDirectoryInformation(), NtfsGetFullDirectoryInformation(), NtfsMakeFCBFromDirEntry(), and NtfsSetEndOfFile().

◆ NtfsGetFullDirectoryInformation()

static NTSTATUS NtfsGetFullDirectoryInformation ( PDEVICE_EXTENSION  DeviceExt,
PFILE_RECORD_HEADER  FileRecord,
ULONGLONG  MFTIndex,
PFILE_FULL_DIRECTORY_INFORMATION  Info,
ULONG  BufferLength,
PULONG  Written,
BOOLEAN  First 
)
static

Definition at line 197 of file dirctl.c.

204{
207 ULONG BytesToCopy = 0;
209 PSTANDARD_INFORMATION StdInfo;
210
211 DPRINT("NtfsGetFullDirectoryInformation() called\n");
212
213 *Written = 0;
216 {
217 return Status;
218 }
219
220 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
221 if (FileName == NULL)
222 {
223 DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
224 NtfsDumpFileAttributes(DeviceExt, FileRecord);
226 }
227
228 StdInfo = GetStandardInformationFromRecord(DeviceExt, FileRecord);
229 ASSERT(StdInfo != NULL);
230
231 Length = FileName->NameLength * sizeof (WCHAR);
233 {
234 Info->FileNameLength = Length;
235
237 Info->NextEntryOffset = 0;
239 {
242 *Written += BytesToCopy;
243
244 if (BytesToCopy == Length)
245 {
246 Info->NextEntryOffset = ULONG_ROUND_UP(sizeof(FILE_FULL_DIR_INFORMATION) +
249 }
250 }
251
252 Info->CreationTime.QuadPart = FileName->CreationTime;
253 Info->LastAccessTime.QuadPart = FileName->LastAccessTime;
254 Info->LastWriteTime.QuadPart = FileName->LastWriteTime;
255 Info->ChangeTime.QuadPart = FileName->ChangeTime;
256
257 /* Convert file flags */
258 NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
259
260 Info->EndOfFile.QuadPart = NtfsGetFileSize(DeviceExt, FileRecord, L"", 0, (PULONGLONG)&Info->AllocationSize.QuadPart);
261
262 Info->FileIndex = MFTIndex;
263 Info->EaSize = 0;
264 }
265
266 return Status;
267}

Referenced by NtfsQueryDirectory().

◆ NtfsGetNamesInformation()

static NTSTATUS NtfsGetNamesInformation ( PDEVICE_EXTENSION  DeviceExt,
PFILE_RECORD_HEADER  FileRecord,
ULONGLONG  MFTIndex,
PFILE_NAMES_INFORMATION  Info,
ULONG  BufferLength,
PULONG  Written,
BOOLEAN  First 
)
static

Definition at line 67 of file dirctl.c.

74{
79
80 DPRINT("NtfsGetNamesInformation() called\n");
81
82 *Written = 0;
85 {
86 return Status;
87 }
88
89 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
90 if (FileName == NULL)
91 {
92 DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
93 NtfsDumpFileAttributes(DeviceExt, FileRecord);
95 }
96
97 Length = FileName->NameLength * sizeof (WCHAR);
99 {
100 Info->FileNameLength = Length;
101
103 Info->NextEntryOffset = 0;
105 {
108 *Written += BytesToCopy;
109
110 if (BytesToCopy == Length)
111 {
112 Info->NextEntryOffset = ULONG_ROUND_UP(sizeof(FILE_NAMES_INFORMATION) +
115 }
116 }
117 }
118
119 return Status;
120}

Referenced by NtfsQueryDirectory().

◆ NtfsQueryDirectory()

NTSTATUS NtfsQueryDirectory ( PNTFS_IRP_CONTEXT  IrpContext)

Definition at line 359 of file dirctl.c.

360{
361 PIRP Irp;
363 PDEVICE_EXTENSION DeviceExtension;
364 LONG BufferLength = 0;
365 PUNICODE_STRING SearchPattern = NULL;
367 ULONG FileIndex = 0;
376 PFILE_RECORD_HEADER FileRecord;
377 ULONGLONG MFTRecord, OldMFTRecord = 0;
378 UNICODE_STRING Pattern;
379 ULONG Written;
380
381 DPRINT("NtfsQueryDirectory() called\n");
382
383 ASSERT(IrpContext);
384 Irp = IrpContext->Irp;
385 DeviceObject = IrpContext->DeviceObject;
386
387 DeviceExtension = DeviceObject->DeviceExtension;
389 FileObject = Stack->FileObject;
390
391 Ccb = (PNTFS_CCB)FileObject->FsContext2;
392 Fcb = (PNTFS_FCB)FileObject->FsContext;
393
394 /* Obtain the callers parameters */
395 BufferLength = Stack->Parameters.QueryDirectory.Length;
396 SearchPattern = Stack->Parameters.QueryDirectory.FileName;
397 FileInformationClass = Stack->Parameters.QueryDirectory.FileInformationClass;
398 FileIndex = Stack->Parameters.QueryDirectory.FileIndex;
399
401 {
402 DPRINT1("Compressed directory!\n");
405 }
406
409 {
410 return STATUS_PENDING;
411 }
412
413 if (SearchPattern != NULL)
414 {
415 if (!Ccb->DirectorySearchPattern)
416 {
417 First = TRUE;
418 Pattern.Length = 0;
419 Pattern.MaximumLength = SearchPattern->Length + sizeof(WCHAR);
420 Ccb->DirectorySearchPattern = Pattern.Buffer =
422 if (!Ccb->DirectorySearchPattern)
423 {
426 }
427
428 memcpy(Ccb->DirectorySearchPattern, SearchPattern->Buffer, SearchPattern->Length);
429 Ccb->DirectorySearchPattern[SearchPattern->Length / sizeof(WCHAR)] = 0;
430 }
431 }
432 else if (!Ccb->DirectorySearchPattern)
433 {
434 First = TRUE;
435 Ccb->DirectorySearchPattern = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), TAG_NTFS);
436 if (!Ccb->DirectorySearchPattern)
437 {
440 }
441
442 Ccb->DirectorySearchPattern[0] = L'*';
443 Ccb->DirectorySearchPattern[1] = 0;
444 }
445
446 RtlInitUnicodeString(&Pattern, Ccb->DirectorySearchPattern);
447 DPRINT("Search pattern '%S'\n", Ccb->DirectorySearchPattern);
448 DPRINT("In: '%S'\n", Fcb->PathName);
449
450 /* Determine directory index */
451 if (Stack->Flags & SL_INDEX_SPECIFIED)
452 {
453 Ccb->Entry = FileIndex;
454 }
455 else if (First || (Stack->Flags & SL_RESTART_SCAN))
456 {
457 Ccb->Entry = 0;
458 }
459
460 /* Get Buffer for result */
462
463 DPRINT("Buffer=%p tofind=%S\n", Buffer, Ccb->DirectorySearchPattern);
464
465 if (!ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource,
467 {
469 return STATUS_PENDING;
470 }
471
472 Written = 0;
473 while (Status == STATUS_SUCCESS && BufferLength > 0)
474 {
475 Status = NtfsFindFileAt(DeviceExtension,
476 &Pattern,
477 &Ccb->Entry,
478 &FileRecord,
479 &MFTRecord,
480 Fcb->MFTIndex,
482
483 if (NT_SUCCESS(Status))
484 {
485 /* HACK: files with both a short name and a long name are present twice in the index.
486 * Ignore the second entry, if it is immediately following the first one.
487 */
488 if (MFTRecord == OldMFTRecord)
489 {
490 DPRINT1("Ignoring duplicate MFT entry 0x%x\n", MFTRecord);
491 Ccb->Entry++;
492 ExFreeToNPagedLookasideList(&DeviceExtension->FileRecLookasideList, FileRecord);
493 continue;
494 }
495 OldMFTRecord = MFTRecord;
496
497 switch (FileInformationClass)
498 {
500 Status = NtfsGetNamesInformation(DeviceExtension,
501 FileRecord,
502 MFTRecord,
505 &Written,
506 Buffer0 == NULL);
507 break;
508
510 Status = NtfsGetDirectoryInformation(DeviceExtension,
511 FileRecord,
512 MFTRecord,
515 &Written,
516 Buffer0 == NULL);
517 break;
518
520 Status = NtfsGetFullDirectoryInformation(DeviceExtension,
521 FileRecord,
522 MFTRecord,
525 &Written,
526 Buffer0 == NULL);
527 break;
528
530 Status = NtfsGetBothDirectoryInformation(DeviceExtension,
531 FileRecord,
532 MFTRecord,
535 &Written,
536 Buffer0 == NULL);
537 break;
538
539 default:
541 }
542
544 {
545 break;
546 }
547 }
548 else
549 {
551 break;
552 }
553
555 Buffer0->FileIndex = FileIndex++;
556 Ccb->Entry++;
557 BufferLength -= Buffer0->NextEntryOffset;
558
559 ExFreeToNPagedLookasideList(&DeviceExtension->FileRecLookasideList, FileRecord);
560
561 if (Stack->Flags & SL_RETURN_SINGLE_ENTRY)
562 {
563 break;
564 }
565
566 Buffer += Buffer0->NextEntryOffset;
567 }
568
569 if (Buffer0)
570 {
571 Buffer0->NextEntryOffset = 0;
573 IrpContext->Irp->IoStatus.Information = Stack->Parameters.QueryDirectory.Length - BufferLength;
574 }
575 else
576 {
578 ASSERT(Written <= Stack->Parameters.QueryDirectory.Length);
579 IrpContext->Irp->IoStatus.Information = Written;
580 }
581
582 ExReleaseResourceLite(&DeviceExtension->DirResource);
584
585 return Status;
586}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
Definition: bufpool.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
PVOID NtfsGetUserBuffer(PIRP Irp, BOOLEAN Paging)
Definition: misc.c:120
struct NTFS_CCB * PNTFS_CCB
#define IRPCONTEXT_CANWAIT
Definition: ntfs.h:474
#define TAG_NTFS
Definition: ntfs.h:12
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
#define NonPagedPool
Definition: env_spec_w32.h:307
#define ExAcquireResourceSharedLite(res, wait)
Definition: env_spec_w32.h:621
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
@ FileDirectoryInformation
Definition: from_kernel.h:62
@ FileNamesInformation
Definition: from_kernel.h:73
@ FileFullDirectoryInformation
Definition: from_kernel.h:63
@ FileBothDirectoryInformation
Definition: from_kernel.h:64
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
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)
Definition: mft.c:3355
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:75
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)
Definition: dirctl.c:124
static NTSTATUS NtfsGetNamesInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_NAMES_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
Definition: dirctl.c:67
static NTSTATUS NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_BOTH_DIR_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
Definition: dirctl.c:271
static NTSTATUS NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_FULL_DIRECTORY_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First)
Definition: dirctl.c:197
BOOLEAN NtfsFCBIsCompressed(PNTFS_FCB Fcb)
Definition: fcb.c:146
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
long LONG
Definition: pedump.c:60
Definition: ntfs.h:130
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:488
Definition: cdstruc.h:902
ULONGLONG MFTIndex
Definition: ntfs.h:539
WCHAR PathName[MAX_PATH]
Definition: ntfs.h:525
FILENAME_ATTRIBUTE Entry
Definition: ntfs.h:542
ERESOURCE MainResource
Definition: ntfs.h:528
USHORT MaximumLength
Definition: env_spec_w32.h:370
unsigned char * PUCHAR
Definition: typedefs.h:53
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFQUEUE _In_opt_ WDFREQUEST _In_opt_ WDFFILEOBJECT _Inout_opt_ PWDF_REQUEST_PARAMETERS Parameters
Definition: wdfio.h:869
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
#define SL_INDEX_SPECIFIED
Definition: iotypes.h:1837
#define SL_RETURN_SINGLE_ENTRY
Definition: iotypes.h:1836
* PFILE_OBJECT
Definition: iotypes.h:1998
#define SL_RESTART_SCAN
Definition: iotypes.h:1835
#define SL_CASE_SENSITIVE
Definition: iotypes.h:1820

Referenced by NtfsDirectoryControl().