ReactOS 0.4.17-dev-1247-ge46f4bb
dirctl.c
Go to the documentation of this file.
1/*
2 * ReactOS kernel
3 * Copyright (C) 2002, 2003, 2014 ReactOS Team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 * COPYRIGHT: See COPYING in the top level directory
20 * PROJECT: ReactOS kernel
21 * FILE: drivers/filesystem/ntfs/dirctl.c
22 * PURPOSE: NTFS filesystem driver
23 * PROGRAMMERS: Eric Kohl
24 * Pierre Schweitzer (pierre@reactos.org)
25 * Hervé Poussineau (hpoussin@reactos.org)
26 */
27
28/* INCLUDES *****************************************************************/
29
30#include "ntfs.h"
31
32#define NDEBUG
33#include <debug.h>
34
35/* FUNCTIONS ****************************************************************/
36
39 PFILE_RECORD_HEADER FileRecord,
41 ULONG StreamLength,
42 PULONGLONG AllocatedSize)
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}
61
62
63#define ULONG_ROUND_UP(x) ROUND_UP((x), (sizeof(ULONG)))
64
65
66static NTSTATUS
68 PFILE_RECORD_HEADER FileRecord,
69 ULONGLONG MFTIndex,
72 PULONG Written,
74 PCUNICODE_STRING OverrideName)
75{
80 PCWSTR NameBuffer;
81
82 DPRINT("NtfsGetNamesInformation() called\n");
83
84 *Written = 0;
87 {
88 return Status;
89 }
90
91 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
92 if (FileName == NULL)
93 {
94 DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
95 NtfsDumpFileAttributes(DeviceExt, FileRecord);
97 }
98
99 if (OverrideName != NULL)
100 {
101 NameBuffer = OverrideName->Buffer;
102 Length = OverrideName->Length;
103 }
104 else
105 {
106 NameBuffer = FileName->Name;
107 Length = FileName->NameLength * sizeof (WCHAR);
108 }
109
111 {
112 Info->FileNameLength = Length;
113
115 Info->NextEntryOffset = 0;
117 {
119 RtlCopyMemory(Info->FileName, NameBuffer, BytesToCopy);
120 *Written += BytesToCopy;
121
122 if (BytesToCopy == Length)
123 {
124 Info->NextEntryOffset = ULONG_ROUND_UP(sizeof(FILE_NAMES_INFORMATION) +
127 }
128 }
129 }
130
131 return Status;
132}
133
134
135static NTSTATUS
137 PFILE_RECORD_HEADER FileRecord,
138 ULONGLONG MFTIndex,
141 PULONG Written,
143 PCUNICODE_STRING OverrideName)
144{
147 ULONG BytesToCopy = 0;
149 PCWSTR NameBuffer;
150 PSTANDARD_INFORMATION StdInfo;
151
152 DPRINT("NtfsGetDirectoryInformation() called\n");
153
154 *Written = 0;
157 {
158 return Status;
159 }
160
161 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
162 if (FileName == NULL)
163 {
164 DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
165 NtfsDumpFileAttributes(DeviceExt, FileRecord);
167 }
168
169 StdInfo = GetStandardInformationFromRecord(DeviceExt, FileRecord);
170 ASSERT(StdInfo != NULL);
171
172 if (OverrideName != NULL)
173 {
174 NameBuffer = OverrideName->Buffer;
175 Length = OverrideName->Length;
176 }
177 else
178 {
179 NameBuffer = FileName->Name;
180 Length = FileName->NameLength * sizeof (WCHAR);
181 }
182
184 {
185 Info->FileNameLength = Length;
186
188 Info->NextEntryOffset = 0;
190 {
192 RtlCopyMemory(Info->FileName, NameBuffer, BytesToCopy);
193 *Written += BytesToCopy;
194
195 if (BytesToCopy == Length)
196 {
197 Info->NextEntryOffset = ULONG_ROUND_UP(sizeof(FILE_DIRECTORY_INFORMATION) +
200 }
201 }
202
203 Info->CreationTime.QuadPart = FileName->CreationTime;
204 Info->LastAccessTime.QuadPart = FileName->LastAccessTime;
205 Info->LastWriteTime.QuadPart = FileName->LastWriteTime;
206 Info->ChangeTime.QuadPart = FileName->ChangeTime;
207
208 /* Convert file flags */
209 NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
210
211 Info->EndOfFile.QuadPart = NtfsGetFileSize(DeviceExt, FileRecord, L"", 0, (PULONGLONG)&Info->AllocationSize.QuadPart);
212
213 Info->FileIndex = MFTIndex;
214 }
215
216 return Status;
217}
218
219
220static NTSTATUS
222 PFILE_RECORD_HEADER FileRecord,
223 ULONGLONG MFTIndex,
226 PULONG Written,
228 PCUNICODE_STRING OverrideName)
229{
232 ULONG BytesToCopy = 0;
234 PCWSTR NameBuffer;
235 PSTANDARD_INFORMATION StdInfo;
236
237 DPRINT("NtfsGetFullDirectoryInformation() called\n");
238
239 *Written = 0;
242 {
243 return Status;
244 }
245
246 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
247 if (FileName == NULL)
248 {
249 DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
250 NtfsDumpFileAttributes(DeviceExt, FileRecord);
252 }
253
254 StdInfo = GetStandardInformationFromRecord(DeviceExt, FileRecord);
255 ASSERT(StdInfo != NULL);
256
257 if (OverrideName != NULL)
258 {
259 NameBuffer = OverrideName->Buffer;
260 Length = OverrideName->Length;
261 }
262 else
263 {
264 NameBuffer = FileName->Name;
265 Length = FileName->NameLength * sizeof (WCHAR);
266 }
267
269 {
270 Info->FileNameLength = Length;
271
273 Info->NextEntryOffset = 0;
275 {
277 RtlCopyMemory(Info->FileName, NameBuffer, BytesToCopy);
278 *Written += BytesToCopy;
279
280 if (BytesToCopy == Length)
281 {
282 Info->NextEntryOffset = ULONG_ROUND_UP(sizeof(FILE_FULL_DIR_INFORMATION) +
285 }
286 }
287
288 Info->CreationTime.QuadPart = FileName->CreationTime;
289 Info->LastAccessTime.QuadPart = FileName->LastAccessTime;
290 Info->LastWriteTime.QuadPart = FileName->LastWriteTime;
291 Info->ChangeTime.QuadPart = FileName->ChangeTime;
292
293 /* Convert file flags */
294 NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
295
296 Info->EndOfFile.QuadPart = NtfsGetFileSize(DeviceExt, FileRecord, L"", 0, (PULONGLONG)&Info->AllocationSize.QuadPart);
297
298 Info->FileIndex = MFTIndex;
299 Info->EaSize = 0;
300 }
301
302 return Status;
303}
304
305
306static NTSTATUS
308 PFILE_RECORD_HEADER FileRecord,
309 ULONGLONG MFTIndex,
312 PULONG Written,
314 PCUNICODE_STRING OverrideName)
315{
318 ULONG BytesToCopy = 0;
319 PFILENAME_ATTRIBUTE FileName, ShortFileName;
320 PCWSTR NameBuffer;
321 PSTANDARD_INFORMATION StdInfo;
322
323 DPRINT("NtfsGetBothDirectoryInformation() called\n");
324
325 *Written = 0;
328 {
329 return Status;
330 }
331
332 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
333 if (FileName == NULL)
334 {
335 DPRINT1("No name information for file ID: %#I64x\n", MFTIndex);
336 NtfsDumpFileAttributes(DeviceExt, FileRecord);
338 }
339 ShortFileName = GetFileNameFromRecord(DeviceExt, FileRecord, NTFS_FILE_NAME_DOS);
340
341 StdInfo = GetStandardInformationFromRecord(DeviceExt, FileRecord);
342 ASSERT(StdInfo != NULL);
343
344 if (OverrideName != NULL)
345 {
346 NameBuffer = OverrideName->Buffer;
347 Length = OverrideName->Length;
348 }
349 else
350 {
351 NameBuffer = FileName->Name;
352 Length = FileName->NameLength * sizeof (WCHAR);
353 }
354
356 {
357 Info->FileNameLength = Length;
358
360 Info->NextEntryOffset = 0;
362 {
364 RtlCopyMemory(Info->FileName, NameBuffer, BytesToCopy);
365 *Written += BytesToCopy;
366
367 if (BytesToCopy == Length)
368 {
369 Info->NextEntryOffset = ULONG_ROUND_UP(sizeof(FILE_BOTH_DIR_INFORMATION) +
372 }
373 }
374
375 if (ShortFileName && OverrideName == NULL)
376 {
377 /* Should we upcase the filename? */
378 ASSERT(ShortFileName->NameLength <= ARRAYSIZE(Info->ShortName));
379 Info->ShortNameLength = ShortFileName->NameLength * sizeof(WCHAR);
380 RtlCopyMemory(Info->ShortName, ShortFileName->Name, Info->ShortNameLength);
381 }
382 else
383 {
384 Info->ShortName[0] = 0;
385 Info->ShortNameLength = 0;
386 }
387
388 Info->CreationTime.QuadPart = FileName->CreationTime;
389 Info->LastAccessTime.QuadPart = FileName->LastAccessTime;
390 Info->LastWriteTime.QuadPart = FileName->LastWriteTime;
391 Info->ChangeTime.QuadPart = FileName->ChangeTime;
392
393 /* Convert file flags */
394 NtfsFileFlagsToAttributes(FileName->FileAttributes | StdInfo->FileAttribute, &Info->FileAttributes);
395
396 Info->EndOfFile.QuadPart = NtfsGetFileSize(DeviceExt, FileRecord, L"", 0, (PULONGLONG)&Info->AllocationSize.QuadPart);
397
398 Info->FileIndex = MFTIndex;
399 Info->EaSize = 0;
400 }
401
402 return Status;
403}
404
405
406
407/*
408 * NTFS keeps no "." or ".." entries in its indices, so enumeration has to make
409 * them up. ntfs.sys emits them ahead of the real entries and filters them
410 * through the caller's search pattern; these do the same.
411 */
412static BOOLEAN
415 BOOLEAN CaseSensitive)
416{
417 UNICODE_STRING Upcased;
418 BOOLEAN Ret;
419
420 if (!FsRtlDoesNameContainWildCards(Pattern))
421 {
422 return (RtlCompareUnicodeString(Pattern, Name, !CaseSensitive) == 0);
423 }
424
425 /* FsRtlIsNameInExpression() wants the expression upcased when matching
426 * case-insensitively. "." and ".." need no upcasing themselves. */
427 if (CaseSensitive)
428 {
429 return FsRtlIsNameInExpression(Pattern, Name, FALSE, NULL);
430 }
431
432 if (!NT_SUCCESS(RtlUpcaseUnicodeString(&Upcased, Pattern, TRUE)))
433 {
434 return FALSE;
435 }
436
437 Ret = FsRtlIsNameInExpression(&Upcased, Name, TRUE, NULL);
438 RtlFreeUnicodeString(&Upcased);
439
440 return Ret;
441}
442
443static NTSTATUS
446 PFILE_RECORD_HEADER FileRecord,
447 ULONGLONG MFTIndex,
448 PCUNICODE_STRING OverrideName,
451 PULONG Written,
453{
454 switch (FileInformationClass)
455 {
457 return NtfsGetNamesInformation(DeviceExt, FileRecord, MFTIndex,
459 BufferLength, Written, First, OverrideName);
460
462 return NtfsGetDirectoryInformation(DeviceExt, FileRecord, MFTIndex,
464 BufferLength, Written, First, OverrideName);
465
467 return NtfsGetFullDirectoryInformation(DeviceExt, FileRecord, MFTIndex,
469 BufferLength, Written, First, OverrideName);
470
472 return NtfsGetBothDirectoryInformation(DeviceExt, FileRecord, MFTIndex,
474 BufferLength, Written, First, OverrideName);
475
476 default:
478 }
479}
480
481/* Describes MFTIndex under the given name. "." reports the directory itself,
482 * ".." its parent, so both take their times and attributes from a real record. */
483static NTSTATUS
485 ULONGLONG MFTIndex,
490 PULONG Written,
492{
493 PFILE_RECORD_HEADER FileRecord;
495
496 FileRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
497 if (FileRecord == NULL)
498 {
500 }
501
502 Status = ReadFileRecord(DeviceExt, MFTIndex, FileRecord);
503 if (NT_SUCCESS(Status))
504 {
506 MFTIndex, Name, Buffer, BufferLength,
507 Written, First);
508 }
509
510 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
511
512 return Status;
513}
514
515static ULONGLONG
517 ULONGLONG MFTIndex)
518{
519 PFILE_RECORD_HEADER FileRecord;
521 ULONGLONG Parent = MFTIndex;
522
523 FileRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
524 if (FileRecord == NULL)
525 {
526 return Parent;
527 }
528
529 if (NT_SUCCESS(ReadFileRecord(DeviceExt, MFTIndex, FileRecord)))
530 {
531 FileName = GetBestFileNameFromRecord(DeviceExt, FileRecord);
532 if (FileName != NULL)
533 {
534 Parent = FileName->DirectoryFileReferenceNumber & NTFS_MFT_MASK;
535 }
536 }
537
538 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
539
540 return Parent;
541}
542
545{
546 PIRP Irp;
548 PDEVICE_EXTENSION DeviceExtension;
549 LONG BufferLength = 0;
550 PUNICODE_STRING SearchPattern = NULL;
552 ULONG FileIndex = 0;
561 PFILE_RECORD_HEADER FileRecord;
562 ULONGLONG MFTRecord, OldMFTRecord = 0;
563 UNICODE_STRING Pattern;
564 ULONG Written;
565
566 DPRINT("NtfsQueryDirectory() called\n");
567
568 ASSERT(IrpContext);
569 Irp = IrpContext->Irp;
570 DeviceObject = IrpContext->DeviceObject;
571
572 DeviceExtension = DeviceObject->DeviceExtension;
574 FileObject = Stack->FileObject;
575
576 Ccb = (PNTFS_CCB)FileObject->FsContext2;
577 Fcb = (PNTFS_FCB)FileObject->FsContext;
578
579 /* Obtain the callers parameters */
580 BufferLength = Stack->Parameters.QueryDirectory.Length;
581 SearchPattern = Stack->Parameters.QueryDirectory.FileName;
582 FileInformationClass = Stack->Parameters.QueryDirectory.FileInformationClass;
583 FileIndex = Stack->Parameters.QueryDirectory.FileIndex;
584
586 {
587 DPRINT1("Compressed directory!\n");
590 }
591
594 {
595 return STATUS_PENDING;
596 }
597
598 if (SearchPattern != NULL)
599 {
600 if (!Ccb->DirectorySearchPattern)
601 {
602 First = TRUE;
603 Pattern.Length = 0;
604 Pattern.MaximumLength = SearchPattern->Length + sizeof(WCHAR);
605 Ccb->DirectorySearchPattern = Pattern.Buffer =
607 if (!Ccb->DirectorySearchPattern)
608 {
611 }
612
613 memcpy(Ccb->DirectorySearchPattern, SearchPattern->Buffer, SearchPattern->Length);
614 Ccb->DirectorySearchPattern[SearchPattern->Length / sizeof(WCHAR)] = 0;
615 }
616 }
617 else if (!Ccb->DirectorySearchPattern)
618 {
619 First = TRUE;
620 Ccb->DirectorySearchPattern = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), TAG_NTFS);
621 if (!Ccb->DirectorySearchPattern)
622 {
625 }
626
627 Ccb->DirectorySearchPattern[0] = L'*';
628 Ccb->DirectorySearchPattern[1] = 0;
629 }
630
631 RtlInitUnicodeString(&Pattern, Ccb->DirectorySearchPattern);
632 DPRINT("Search pattern '%S'\n", Ccb->DirectorySearchPattern);
633 DPRINT("In: '%S'\n", Fcb->PathName);
634
635 /* Determine directory index */
636 if (Stack->Flags & SL_INDEX_SPECIFIED)
637 {
638 Ccb->Entry = FileIndex;
640 }
641 else if (First || (Stack->Flags & SL_RESTART_SCAN))
642 {
643 Ccb->Entry = 0;
645 }
646
647 /* Get Buffer for result */
649
650 DPRINT("Buffer=%p tofind=%S\n", Buffer, Ccb->DirectorySearchPattern);
651
652 if (!ExAcquireResourceExclusiveLite(&DeviceExtension->DirResource,
654 {
656 return STATUS_PENDING;
657 }
658
659 Written = 0;
660 while (Status == STATUS_SUCCESS && BufferLength > 0)
661 {
664 {
666 UNICODE_STRING DotName;
667 ULONGLONG DotIndex;
668
669 RtlInitUnicodeString(&DotName, DotDot ? L".." : L".");
670
671 if (!NtfsDotNameMatches(&Pattern, &DotName,
673 {
675 continue;
676 }
677
678 DotIndex = DotDot ? NtfsGetParentMftIndex(DeviceExtension, Fcb->MFTIndex)
679 : Fcb->MFTIndex;
680
681 Status = NtfsGetDotEntry(DeviceExtension, DotIndex, &DotName,
683 &Written, Buffer0 == NULL);
684
685 /* The entry did not fit. Leave the flag alone so the next call,
686 * with a bigger buffer, hands it out instead of skipping it. */
688 {
689 break;
690 }
691
693
694 if (!NT_SUCCESS(Status))
695 {
696 /* Losing "." is not worth failing the whole enumeration over */
698 continue;
699 }
700
702 Buffer0->FileIndex = FileIndex++;
703 BufferLength -= Buffer0->NextEntryOffset;
704
705 if (Stack->Flags & SL_RETURN_SINGLE_ENTRY)
706 {
707 break;
708 }
709
710 Buffer += Buffer0->NextEntryOffset;
711 continue;
712 }
713
714 Status = NtfsFindFileAt(DeviceExtension,
715 &Pattern,
716 &Ccb->Entry,
717 &FileRecord,
718 &MFTRecord,
719 Fcb->MFTIndex,
721
722 if (NT_SUCCESS(Status))
723 {
724 /* HACK: files with both a short name and a long name are present twice in the index.
725 * Ignore the second entry, if it is immediately following the first one.
726 */
727 if (MFTRecord == OldMFTRecord)
728 {
729 DPRINT1("Ignoring duplicate MFT entry 0x%x\n", MFTRecord);
730 Ccb->Entry++;
731 ExFreeToNPagedLookasideList(&DeviceExtension->FileRecLookasideList, FileRecord);
732 continue;
733 }
734 OldMFTRecord = MFTRecord;
735
736 Status = NtfsGetDirEntryInformation(DeviceExtension,
738 FileRecord,
739 MFTRecord,
740 NULL,
741 Buffer,
743 &Written,
744 Buffer0 == NULL);
745
747 {
748 break;
749 }
750 }
751 else
752 {
754 break;
755 }
756
758 Buffer0->FileIndex = FileIndex++;
759 Ccb->Entry++;
760 BufferLength -= Buffer0->NextEntryOffset;
761
762 ExFreeToNPagedLookasideList(&DeviceExtension->FileRecLookasideList, FileRecord);
763
764 if (Stack->Flags & SL_RETURN_SINGLE_ENTRY)
765 {
766 break;
767 }
768
769 Buffer += Buffer0->NextEntryOffset;
770 }
771
772 if (Buffer0)
773 {
774 Buffer0->NextEntryOffset = 0;
776 IrpContext->Irp->IoStatus.Information = Stack->Parameters.QueryDirectory.Length - BufferLength;
777 }
778 else
779 {
781 ASSERT(Written <= Stack->Parameters.QueryDirectory.Length);
782 IrpContext->Irp->IoStatus.Information = Written;
783 }
784
785 ExReleaseResourceLite(&DeviceExtension->DirResource);
787
788 return Status;
789}
790
791
794{
796
797 DPRINT("NtfsDirectoryControl() called\n");
798
799 /* Handlers that fill the caller's buffer overwrite this with the byte count */
800 IrpContext->Irp->IoStatus.Information = 0;
801
802 switch (IrpContext->MinorFunction)
803 {
805 Status = NtfsQueryDirectory(IrpContext);
806 break;
807
809 DPRINT1("IRP_MN_NOTIFY_CHANGE_DIRECTORY\n");
811 break;
812
813 default:
815 break;
816 }
817
818 if (Status == STATUS_PENDING && IrpContext->Flags & IRPCONTEXT_COMPLETE)
819 {
820 return NtfsMarkIrpContextForQueue(IrpContext);
821 }
822
823 return Status;
824}
825
826/* EOF */
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
WCHAR First[]
Definition: FormatMessage.c:11
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define NTFS_FILE_NAME_DOS
Definition: ntfs.h:65
#define NTFS_MFT_MASK
Definition: ntfs.h:76
#define ARRAYSIZE(a)
Definition: cat.c:25
_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
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
LPWSTR Name
Definition: desk.c:124
_In_ HANDLE _In_ CONST PDXGKMDT_OPM_GET_INFO_PARAMETERS Parameters
Definition: dispmprt.h:321
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
PSTANDARD_INFORMATION GetStandardInformationFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1970
PFILENAME_ATTRIBUTE GetFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord, UCHAR NameType)
Definition: attrib.c:1839
VOID NtfsDumpFileAttributes(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1820
PFILENAME_ATTRIBUTE GetBestFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:2015
VOID NtfsFileFlagsToAttributes(ULONG NtfsAttributes, PULONG FileAttributes)
Definition: misc.c:105
PVOID NtfsGetUserBuffer(PIRP Irp, BOOLEAN Paging)
Definition: misc.c:120
FORCEINLINE NTSTATUS NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
Definition: ntfs.h:652
#define IRPCONTEXT_COMPLETE
Definition: ntfs.h:506
struct NTFS_CCB * PNTFS_CCB
#define IRPCONTEXT_CANWAIT
Definition: ntfs.h:505
#define CCB_RETURNED_DOTDOT
Definition: ntfs.h:168
@ AttributeData
Definition: ntfs.h:195
#define TAG_NTFS
Definition: ntfs.h:12
#define CCB_RETURNED_DOT
Definition: ntfs.h:167
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
Definition: string_lib.cpp:46
#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 ClearFlag(_F, _SF)
Definition: ext2fs.h:191
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
IN PFCB IN VBO OUT PLBO OUT PULONG OUT PBOOLEAN Allocated
Definition: fatprocs.h:311
struct _FileName FileName
Definition: fatprocs.h:897
@ 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
Status
Definition: gdiplustypes.h:24
_In_ PIRP Irp
Definition: kse.h:79
NTSTATUS ReadFileRecord(PDEVICE_EXTENSION Vcb, ULONGLONG index, PFILE_RECORD_HEADER file)
Definition: mft.c:1936
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
NTSTATUS NtfsFindFileAt(PDEVICE_EXTENSION Vcb, PUNICODE_STRING SearchPattern, PULONG FirstEntry, PFILE_RECORD_HEADER *FileRecord, PULONGLONG MFTIndex, ULONGLONG CurrentMFTIndex, BOOLEAN CaseSensitive)
Definition: mft.c:4363
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ASSERT(a)
Definition: mode.c:44
#define ULL(a, b)
Definition: format_msg.c:27
static IStream Stream
Definition: htmldoc.c:1115
#define min(a, b)
Definition: monoChain.cc:55
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3168
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:395
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:100
static NTSTATUS NtfsGetDirEntryInformation(PDEVICE_EXTENSION DeviceExt, FILE_INFORMATION_CLASS FileInformationClass, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PCUNICODE_STRING OverrideName, PVOID Buffer, ULONG BufferLength, PULONG Written, BOOLEAN First)
Definition: dirctl.c:444
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
static NTSTATUS NtfsGetDotEntry(PDEVICE_EXTENSION DeviceExt, ULONGLONG MFTIndex, PCUNICODE_STRING Name, FILE_INFORMATION_CLASS FileInformationClass, PVOID Buffer, ULONG BufferLength, PULONG Written, BOOLEAN First)
Definition: dirctl.c:484
static NTSTATUS NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_FULL_DIRECTORY_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First, PCUNICODE_STRING OverrideName)
Definition: dirctl.c:221
static NTSTATUS NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_DIRECTORY_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First, PCUNICODE_STRING OverrideName)
Definition: dirctl.c:136
static NTSTATUS NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_BOTH_DIR_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First, PCUNICODE_STRING OverrideName)
Definition: dirctl.c:307
static NTSTATUS NtfsGetNamesInformation(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, ULONGLONG MFTIndex, PFILE_NAMES_INFORMATION Info, ULONG BufferLength, PULONG Written, BOOLEAN First, PCUNICODE_STRING OverrideName)
Definition: dirctl.c:67
NTSTATUS NtfsDirectoryControl(PNTFS_IRP_CONTEXT IrpContext)
Definition: dirctl.c:793
static BOOLEAN NtfsDotNameMatches(PUNICODE_STRING Pattern, PUNICODE_STRING Name, BOOLEAN CaseSensitive)
Definition: dirctl.c:413
NTSTATUS NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext)
Definition: dirctl.c:544
static ULONGLONG NtfsGetParentMftIndex(PDEVICE_EXTENSION DeviceExt, ULONGLONG MFTIndex)
Definition: dirctl.c:516
BOOLEAN NtfsFCBIsCompressed(PNTFS_FCB Fcb)
Definition: fcb.c:173
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
BOOLEAN NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
Definition: name.c:213
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:333
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
#define IRP_MN_QUERY_DIRECTORY
Definition: rdpdr.c:55
#define IRP_MN_NOTIFY_CHANGE_DIRECTORY
Definition: rdpdr.c:56
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define DPRINT
Definition: sndvol32.h:73
UCHAR NameLength
Definition: ntfs.h:408
WCHAR Name[1]
Definition: ntfs.h:410
Definition: ntfs.h:151
ULONG Flags
Definition: ntfs.h:556
UCHAR MinorFunction
Definition: ntfs.h:559
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:563
ULONG FileAttribute
Definition: ntfs.h:365
Definition: cdstruc.h:902
ULONG Flags
Definition: ntfs.h:618
ULONGLONG MFTIndex
Definition: ntfs.h:622
WCHAR PathName[MAX_PATH]
Definition: ntfs.h:604
FILENAME_ATTRIBUTE Entry
Definition: ntfs.h:625
ERESOURCE MainResource
Definition: ntfs.h:607
TCHAR Name[MAX_PATH]
Definition: filecomp.c:349
IO_STATUS_BLOCK IoStatus
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define STATUS_PENDING
Definition: telnetd.h:14
uint32_t * PULONG
Definition: typedefs.h:59
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
uint64_t ULONGLONG
Definition: typedefs.h:67
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2061
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3777
_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