ReactOS 0.4.15-dev-7670-g69b08be
finfo.c
Go to the documentation of this file.
1/*
2 * ReactOS kernel
3 * Copyright (C) 2002 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 * Hervé Poussineau (hpoussin@reactos.org)
25 * Pierre Schweitzer (pierre@reactos.org)
26 */
27
28/* INCLUDES *****************************************************************/
29
30#include "ntfs.h"
31
32#define NDEBUG
33#include <debug.h>
34
35/* FUNCTIONS ****************************************************************/
36
37/*
38 * FUNCTION: Retrieve the standard file information
39 */
40static
44 PFILE_STANDARD_INFORMATION StandardInfo,
46{
48
49 DPRINT("NtfsGetStandardInformation(%p, %p, %p, %p)\n", Fcb, DeviceObject, StandardInfo, BufferLength);
50
53
54 /* PRECONDITION */
55 ASSERT(StandardInfo != NULL);
56 ASSERT(Fcb != NULL);
57
58 RtlZeroMemory(StandardInfo,
60
61 StandardInfo->AllocationSize = Fcb->RFCB.AllocationSize;
62 StandardInfo->EndOfFile = Fcb->RFCB.FileSize;
63 StandardInfo->NumberOfLinks = Fcb->LinkCount;
64 StandardInfo->DeletePending = FALSE;
65 StandardInfo->Directory = NtfsFCBIsDirectory(Fcb);
66
68
69 return STATUS_SUCCESS;
70}
71
72
73static
76 PFILE_POSITION_INFORMATION PositionInfo,
78{
79 DPRINT1("NtfsGetPositionInformation(%p, %p, %p)\n", FileObject, PositionInfo, BufferLength);
80
83
84 PositionInfo->CurrentByteOffset.QuadPart = FileObject->CurrentByteOffset.QuadPart;
85
86 DPRINT("Getting position %I64x\n",
87 PositionInfo->CurrentByteOffset.QuadPart);
88
90
91 return STATUS_SUCCESS;
92}
93
94
95static
100 PFILE_BASIC_INFORMATION BasicInfo,
102{
104
105 DPRINT("NtfsGetBasicInformation(%p, %p, %p, %p, %p)\n", FileObject, Fcb, DeviceObject, BasicInfo, BufferLength);
106
109
110 RtlZeroMemory(BasicInfo, sizeof(FILE_BASIC_INFORMATION));
111
112 BasicInfo->CreationTime.QuadPart = FileName->CreationTime;
113 BasicInfo->LastAccessTime.QuadPart = FileName->LastAccessTime;
114 BasicInfo->LastWriteTime.QuadPart = FileName->LastWriteTime;
115 BasicInfo->ChangeTime.QuadPart = FileName->ChangeTime;
116
117 NtfsFileFlagsToAttributes(FileName->FileAttributes, &BasicInfo->FileAttributes);
118
120
121 return STATUS_SUCCESS;
122}
123
124
125/*
126 * FUNCTION: Retrieve the file name information
127 */
128static
133 PFILE_NAME_INFORMATION NameInfo,
135{
137
140
141 DPRINT("NtfsGetNameInformation(%p, %p, %p, %p, %p)\n", FileObject, Fcb, DeviceObject, NameInfo, BufferLength);
142
143 ASSERT(NameInfo != NULL);
144 ASSERT(Fcb != NULL);
145
146 /* If buffer can't hold at least the file name length, bail out */
149
150 /* Save file name length, and as much file len, as buffer length allows */
151 NameInfo->FileNameLength = wcslen(Fcb->PathName) * sizeof(WCHAR);
152
153 /* Calculate amount of bytes to copy not to overflow the buffer */
154 BytesToCopy = min(NameInfo->FileNameLength,
156
157 /* Fill in the bytes */
159
160 /* Check if we could write more but are not able to */
161 if (*BufferLength < NameInfo->FileNameLength + (ULONG)FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0]))
162 {
163 /* Return number of bytes written */
166 }
167
168 /* We filled up as many bytes, as needed */
170
171 return STATUS_SUCCESS;
172}
173
174
175static
178 PFILE_INTERNAL_INFORMATION InternalInfo,
180{
181 DPRINT1("NtfsGetInternalInformation(%p, %p, %p)\n", Fcb, InternalInfo, BufferLength);
182
183 ASSERT(InternalInfo);
184 ASSERT(Fcb);
185
188
189 InternalInfo->IndexNumber.QuadPart = Fcb->MFTIndex;
190
192
193 return STATUS_SUCCESS;
194}
195
196static
199 PDEVICE_EXTENSION DeviceExt,
202{
204
205 DPRINT("NtfsGetNetworkOpenInformation(%p, %p, %p, %p)\n", Fcb, DeviceExt, NetworkInfo, BufferLength);
206
209
210 NetworkInfo->CreationTime.QuadPart = FileName->CreationTime;
211 NetworkInfo->LastAccessTime.QuadPart = FileName->LastAccessTime;
212 NetworkInfo->LastWriteTime.QuadPart = FileName->LastWriteTime;
213 NetworkInfo->ChangeTime.QuadPart = FileName->ChangeTime;
214
215 NetworkInfo->EndOfFile = Fcb->RFCB.FileSize;
216 NetworkInfo->AllocationSize = Fcb->RFCB.AllocationSize;
217
218 NtfsFileFlagsToAttributes(FileName->FileAttributes, &NetworkInfo->FileAttributes);
219
221 return STATUS_SUCCESS;
222}
223
224static
227 PDEVICE_EXTENSION DeviceExt,
228 PFILE_STREAM_INFORMATION StreamInfo,
230{
231 ULONG CurrentSize;
233 PNTFS_ATTR_RECORD Attribute;
234 NTSTATUS Status, BrowseStatus;
235 PFILE_RECORD_HEADER FileRecord;
236 PFILE_STREAM_INFORMATION CurrentInfo = StreamInfo, Previous = NULL;
237
240
241 FileRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
242 if (FileRecord == NULL)
243 {
244 DPRINT1("Not enough memory!\n");
246 }
247
248 Status = ReadFileRecord(DeviceExt, Fcb->MFTIndex, FileRecord);
249 if (!NT_SUCCESS(Status))
250 {
251 DPRINT1("Can't find record!\n");
252 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
253 return Status;
254 }
255
256 BrowseStatus = FindFirstAttribute(&Context, DeviceExt, FileRecord, FALSE, &Attribute);
257 while (NT_SUCCESS(BrowseStatus))
258 {
259 if (Attribute->Type == AttributeData)
260 {
261 CurrentSize = FIELD_OFFSET(FILE_STREAM_INFORMATION, StreamName) + Attribute->NameLength * sizeof(WCHAR) + wcslen(L"::$DATA") * sizeof(WCHAR);
262
263 if (CurrentSize > *BufferLength)
264 {
266 break;
267 }
268
269 CurrentInfo->NextEntryOffset = 0;
270 CurrentInfo->StreamNameLength = (Attribute->NameLength + wcslen(L"::$DATA")) * sizeof(WCHAR);
271 CurrentInfo->StreamSize.QuadPart = AttributeDataLength(Attribute);
273 CurrentInfo->StreamName[0] = L':';
274 RtlMoveMemory(&CurrentInfo->StreamName[1], (PWCHAR)((ULONG_PTR)Attribute + Attribute->NameOffset), CurrentInfo->StreamNameLength);
275 RtlMoveMemory(&CurrentInfo->StreamName[Attribute->NameLength + 1], L":$DATA", sizeof(L":$DATA") - sizeof(UNICODE_NULL));
276
277 if (Previous != NULL)
278 {
279 Previous->NextEntryOffset = (ULONG_PTR)CurrentInfo - (ULONG_PTR)Previous;
280 }
281 Previous = CurrentInfo;
282 CurrentInfo = (PFILE_STREAM_INFORMATION)((ULONG_PTR)CurrentInfo + CurrentSize);
283 *BufferLength -= CurrentSize;
284 }
285
286 BrowseStatus = FindNextAttribute(&Context, &Attribute);
287 }
288
290 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
291 return Status;
292}
293
294// Convert enum value to friendly name
295const PCSTR
297{
298 const PCSTR fileInfoClassNames[] = { "???????",
299 "FileDirectoryInformation",
300 "FileFullDirectoryInformation",
301 "FileBothDirectoryInformation",
302 "FileBasicInformation",
303 "FileStandardInformation",
304 "FileInternalInformation",
305 "FileEaInformation",
306 "FileAccessInformation",
307 "FileNameInformation",
308 "FileRenameInformation",
309 "FileLinkInformation",
310 "FileNamesInformation",
311 "FileDispositionInformation",
312 "FilePositionInformation",
313 "FileFullEaInformation",
314 "FileModeInformation",
315 "FileAlignmentInformation",
316 "FileAllInformation",
317 "FileAllocationInformation",
318 "FileEndOfFileInformation",
319 "FileAlternateNameInformation",
320 "FileStreamInformation",
321 "FilePipeInformation",
322 "FilePipeLocalInformation",
323 "FilePipeRemoteInformation",
324 "FileMailslotQueryInformation",
325 "FileMailslotSetInformation",
326 "FileCompressionInformation",
327 "FileObjectIdInformation",
328 "FileCompletionInformation",
329 "FileMoveClusterInformation",
330 "FileQuotaInformation",
331 "FileReparsePointInformation",
332 "FileNetworkOpenInformation",
333 "FileAttributeTagInformation",
334 "FileTrackingInformation",
335 "FileIdBothDirectoryInformation",
336 "FileIdFullDirectoryInformation",
337 "FileValidDataLengthInformation",
338 "FileShortNameInformation",
339 "FileIoCompletionNotificationInformation",
340 "FileIoStatusBlockRangeInformation",
341 "FileIoPriorityHintInformation",
342 "FileSfioReserveInformation",
343 "FileSfioVolumeInformation",
344 "FileHardLinkInformation",
345 "FileProcessIdsUsingFileInformation",
346 "FileNormalizedNameInformation",
347 "FileNetworkPhysicalNameInformation",
348 "FileIdGlobalTxDirectoryInformation",
349 "FileIsRemoteDeviceInformation",
350 "FileAttributeCacheInformation",
351 "FileNumaNodeInformation",
352 "FileStandardLinkInformation",
353 "FileRemoteProtocolInformation",
354 "FileReplaceCompletionInformation",
355 "FileMaximumInformation",
356 "FileDirectoryInformation",
357 "FileFullDirectoryInformation",
358 "FileBothDirectoryInformation",
359 "FileBasicInformation",
360 "FileStandardInformation",
361 "FileInternalInformation",
362 "FileEaInformation",
363 "FileAccessInformation",
364 "FileNameInformation",
365 "FileRenameInformation",
366 "FileLinkInformation",
367 "FileNamesInformation",
368 "FileDispositionInformation",
369 "FilePositionInformation",
370 "FileFullEaInformation",
371 "FileModeInformation",
372 "FileAlignmentInformation",
373 "FileAllInformation",
374 "FileAllocationInformation",
375 "FileEndOfFileInformation",
376 "FileAlternateNameInformation",
377 "FileStreamInformation",
378 "FilePipeInformation",
379 "FilePipeLocalInformation",
380 "FilePipeRemoteInformation",
381 "FileMailslotQueryInformation",
382 "FileMailslotSetInformation",
383 "FileCompressionInformation",
384 "FileObjectIdInformation",
385 "FileCompletionInformation",
386 "FileMoveClusterInformation",
387 "FileQuotaInformation",
388 "FileReparsePointInformation",
389 "FileNetworkOpenInformation",
390 "FileAttributeTagInformation",
391 "FileTrackingInformation",
392 "FileIdBothDirectoryInformation",
393 "FileIdFullDirectoryInformation",
394 "FileValidDataLengthInformation",
395 "FileShortNameInformation",
396 "FileIoCompletionNotificationInformation",
397 "FileIoStatusBlockRangeInformation",
398 "FileIoPriorityHintInformation",
399 "FileSfioReserveInformation",
400 "FileSfioVolumeInformation",
401 "FileHardLinkInformation",
402 "FileProcessIdsUsingFileInformation",
403 "FileNormalizedNameInformation",
404 "FileNetworkPhysicalNameInformation",
405 "FileIdGlobalTxDirectoryInformation",
406 "FileIsRemoteDeviceInformation",
407 "FileAttributeCacheInformation",
408 "FileNumaNodeInformation",
409 "FileStandardLinkInformation",
410 "FileRemoteProtocolInformation",
411 "FileReplaceCompletionInformation",
412 "FileMaximumInformation" };
413 return fileInfoClassNames[infoClass];
414}
415
416/*
417 * FUNCTION: Retrieve the specified file information
418 */
421{
426 PVOID SystemBuffer;
428 PIRP Irp;
431
432 DPRINT1("NtfsQueryInformation(%p)\n", IrpContext);
433
434 Irp = IrpContext->Irp;
435 Stack = IrpContext->Stack;
436 DeviceObject = IrpContext->DeviceObject;
437 FileInformationClass = Stack->Parameters.QueryFile.FileInformationClass;
438 FileObject = IrpContext->FileObject;
439 Fcb = FileObject->FsContext;
440
441 SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
442 BufferLength = Stack->Parameters.QueryFile.Length;
443
446 {
447 return NtfsMarkIrpContextForQueue(IrpContext);
448 }
449
450 switch (FileInformationClass)
451 {
455 SystemBuffer,
456 &BufferLength);
457 break;
458
461 SystemBuffer,
462 &BufferLength);
463 break;
464
467 Fcb,
469 SystemBuffer,
470 &BufferLength);
471 break;
472
475 Fcb,
477 SystemBuffer,
478 &BufferLength);
479 break;
480
483 SystemBuffer,
484 &BufferLength);
485 break;
486
489 DeviceObject->DeviceExtension,
490 SystemBuffer,
491 &BufferLength);
492 break;
493
496 DeviceObject->DeviceExtension,
497 SystemBuffer,
498 &BufferLength);
499 break;
500
503 DPRINT1("Unimplemented information class: %s\n", GetInfoClassName(FileInformationClass));
505 break;
506
507 default:
508 DPRINT1("Unimplemented information class: %s\n", GetInfoClassName(FileInformationClass));
510 }
511
513
514 if (NT_SUCCESS(Status))
515 Irp->IoStatus.Information =
516 Stack->Parameters.QueryFile.Length - BufferLength;
517 else
518 Irp->IoStatus.Information = 0;
519
520 return Status;
521}
522
565 PDEVICE_EXTENSION DeviceExt,
566 ULONG IrpFlags,
567 BOOLEAN CaseSensitive,
569{
570 LARGE_INTEGER CurrentFileSize;
571 PFILE_RECORD_HEADER FileRecord;
572 PNTFS_ATTR_CONTEXT DataContext;
573 ULONG AttributeOffset;
576 PFILENAME_ATTRIBUTE FileNameAttribute;
577 ULONGLONG ParentMFTId;
579
580
581 // Allocate non-paged memory for the file record
582 FileRecord = ExAllocateFromNPagedLookasideList(&DeviceExt->FileRecLookasideList);
583 if (FileRecord == NULL)
584 {
585 DPRINT1("Couldn't allocate memory for file record!");
587 }
588
589 // read the file record
590 DPRINT("Reading file record...\n");
591 Status = ReadFileRecord(DeviceExt, Fcb->MFTIndex, FileRecord);
592 if (!NT_SUCCESS(Status))
593 {
594 // We couldn't get the file's record. Free the memory and return the error
595 DPRINT1("Can't find record for %wS!\n", Fcb->ObjectName);
596 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
597 return Status;
598 }
599
600 DPRINT("Found record for %wS\n", Fcb->ObjectName);
601
602 CurrentFileSize.QuadPart = NtfsGetFileSize(DeviceExt, FileRecord, L"", 0, NULL);
603
604 // Are we trying to decrease the file size?
605 if (NewFileSize->QuadPart < CurrentFileSize.QuadPart)
606 {
607 // Is the file mapped?
608 if (!MmCanFileBeTruncated(FileObject->SectionObjectPointer,
610 {
611 DPRINT1("Couldn't decrease file size!\n");
612 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
614 }
615 }
616
617 // Find the attribute with the data stream for our file
618 DPRINT("Finding Data Attribute...\n");
619 Status = FindAttribute(DeviceExt,
620 FileRecord,
622 Fcb->Stream,
623 wcslen(Fcb->Stream),
624 &DataContext,
625 &AttributeOffset);
626
627 // Did we fail to find the attribute?
628 if (!NT_SUCCESS(Status))
629 {
630 DPRINT1("No '%S' data stream associated with file!\n", Fcb->Stream);
631 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
632 return Status;
633 }
634
635 // Get the size of the data attribute
636 CurrentFileSize.QuadPart = AttributeDataLength(DataContext->pRecord);
637
638 // Are we enlarging the attribute?
639 if (NewFileSize->QuadPart > CurrentFileSize.QuadPart)
640 {
641 // is increasing the stream size not allowed?
642 if ((Fcb->Flags & FCB_IS_VOLUME) ||
643 (IrpFlags & IRP_PAGING_IO))
644 {
645 // TODO - just fail for now
646 ReleaseAttributeContext(DataContext);
647 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
649 }
650 }
651
652 // set the attribute data length
653 Status = SetAttributeDataLength(FileObject, Fcb, DataContext, AttributeOffset, FileRecord, NewFileSize);
654 if (!NT_SUCCESS(Status))
655 {
656 ReleaseAttributeContext(DataContext);
657 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
658 return Status;
659 }
660
661 // now we need to update this file's size in every directory index entry that references it
662 // TODO: expand to work with every filename / hardlink stored in the file record.
663 FileNameAttribute = GetBestFileNameFromRecord(Fcb->Vcb, FileRecord);
664 if (FileNameAttribute == NULL)
665 {
666 DPRINT1("Unable to find FileName attribute associated with file!\n");
667 ReleaseAttributeContext(DataContext);
668 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
670 }
671
672 ParentMFTId = FileNameAttribute->DirectoryFileReferenceNumber & NTFS_MFT_MASK;
673
674 FileName.Buffer = FileNameAttribute->Name;
675 FileName.Length = FileNameAttribute->NameLength * sizeof(WCHAR);
676 FileName.MaximumLength = FileName.Length;
677
678 AllocationSize = AttributeAllocatedLength(DataContext->pRecord);
679
681 ParentMFTId,
682 &FileName,
683 FALSE,
686 CaseSensitive);
687
688 ReleaseAttributeContext(DataContext);
689 ExFreeToNPagedLookasideList(&DeviceExt->FileRecLookasideList, FileRecord);
690
691 return Status;
692}
693
720{
723 PDEVICE_EXTENSION DeviceExt;
726 PVOID SystemBuffer;
728 PIRP Irp;
731
732 DPRINT("NtfsSetInformation(%p)\n", IrpContext);
733
734 Irp = IrpContext->Irp;
735 Stack = IrpContext->Stack;
736 DeviceObject = IrpContext->DeviceObject;
737 DeviceExt = DeviceObject->DeviceExtension;
738 FileInformationClass = Stack->Parameters.QueryFile.FileInformationClass;
739 FileObject = IrpContext->FileObject;
740 Fcb = FileObject->FsContext;
741
742 SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
743 BufferLength = Stack->Parameters.QueryFile.Length;
744
747 {
748 return NtfsMarkIrpContextForQueue(IrpContext);
749 }
750
751 switch (FileInformationClass)
752 {
753 PFILE_END_OF_FILE_INFORMATION EndOfFileInfo;
754
755 /* TODO: Allocation size is not actually the same as file end for NTFS,
756 however, few applications are likely to make the distinction. */
758 DPRINT1("FIXME: Using hacky method of setting FileAllocationInformation.\n");
760 EndOfFileInfo = (PFILE_END_OF_FILE_INFORMATION)SystemBuffer;
763 DeviceExt,
764 Irp->Flags,
766 &EndOfFileInfo->EndOfFile);
767 break;
768
769 // TODO: all other information classes
770
771 default:
772 DPRINT1("FIXME: Unimplemented information class: %s\n", GetInfoClassName(FileInformationClass));
774 }
775
777
778 if (NT_SUCCESS(Status))
779 Irp->IoStatus.Information =
780 Stack->Parameters.QueryFile.Length - BufferLength;
781 else
782 Irp->IoStatus.Information = 0;
783
784 return Status;
785}
786/* EOF */
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define NTFS_MFT_MASK
Definition: ntfs.h:68
_In_ PFCB Fcb
Definition: cdprocs.h:159
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS FindFirstAttribute(PFIND_ATTR_CONTXT Context, PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord, BOOLEAN OnlyResident, PNTFS_ATTR_RECORD *Attribute)
Definition: attrib.c:1383
VOID FindCloseAttribute(PFIND_ATTR_CONTXT Context)
Definition: attrib.c:1465
NTSTATUS FindNextAttribute(PFIND_ATTR_CONTXT Context, PNTFS_ATTR_RECORD *Attribute)
Definition: attrib.c:1431
PFILENAME_ATTRIBUTE GetBestFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1985
VOID NtfsFileFlagsToAttributes(ULONG NtfsAttributes, PULONG FileAttributes)
Definition: misc.c:105
FORCEINLINE NTSTATUS NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
Definition: ntfs.h:569
#define IRPCONTEXT_CANWAIT
Definition: ntfs.h:474
@ AttributeData
Definition: ntfs.h:168
#define FCB_IS_VOLUME
Definition: ntfs.h:510
#define ULONG_PTR
Definition: config.h:101
#define ExAcquireResourceSharedLite(res, wait)
Definition: env_spec_w32.h:621
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:322
struct _FileName FileName
Definition: fatprocs.h:896
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ HANDLE _In_ ULONG FileNameLength
Definition: fltkernel.h:1129
@ FilePositionInformation
Definition: from_kernel.h:75
@ FileEndOfFileInformation
Definition: from_kernel.h:81
@ FileAllInformation
Definition: from_kernel.h:79
@ FileInternalInformation
Definition: from_kernel.h:67
@ FileAlternateNameInformation
Definition: from_kernel.h:82
@ FileNameInformation
Definition: from_kernel.h:70
@ FileAllocationInformation
Definition: from_kernel.h:80
@ FileNetworkOpenInformation
Definition: from_kernel.h:95
@ FileStreamInformation
Definition: from_kernel.h:83
@ FileBasicInformation
Definition: from_kernel.h:65
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
struct _FILE_INTERNAL_INFORMATION FILE_INTERNAL_INFORMATION
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING StreamName
Definition: fsrtlfuncs.h:741
Status
Definition: gdiplustypes.h:25
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
struct _FILE_STREAM_INFORMATION * PFILE_STREAM_INFORMATION
NTSTATUS ReadFileRecord(PDEVICE_EXTENSION Vcb, ULONGLONG index, PFILE_RECORD_HEADER file)
Definition: mft.c:1631
VOID ReleaseAttributeContext(PNTFS_ATTR_CONTEXT Context)
Definition: mft.c:104
NTSTATUS UpdateFileNameRecord(PDEVICE_EXTENSION Vcb, ULONGLONG ParentMFTIndex, PUNICODE_STRING FileName, BOOLEAN DirSearch, ULONGLONG NewDataSize, ULONGLONG NewAllocationSize, BOOLEAN CaseSensitive)
Definition: mft.c:1660
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 SetAttributeDataLength(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PNTFS_ATTR_CONTEXT AttrContext, ULONG AttrOffset, PFILE_RECORD_HEADER FileRecord, PLARGE_INTEGER DataSize)
Definition: mft.c:615
#define ASSERT(a)
Definition: mode.c:44
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
#define FILE_BASIC_INFORMATION
Definition: disk.h:53
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:75
#define min(a, b)
Definition: monoChain.cc:55
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3168
struct _FILE_POSITION_INFORMATION FILE_POSITION_INFORMATION
struct _FILE_END_OF_FILE_INFORMATION * PFILE_END_OF_FILE_INFORMATION
#define UNICODE_NULL
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
ULONGLONG NtfsGetFileSize(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, PCWSTR Stream, ULONG StreamLength, PULONGLONG AllocatedSize)
Definition: dirctl.c:38
BOOLEAN NtfsFCBIsDirectory(PNTFS_FCB Fcb)
Definition: fcb.c:132
static NTSTATUS NtfsGetNameInformation(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_NAME_INFORMATION NameInfo, PULONG BufferLength)
Definition: finfo.c:130
static NTSTATUS NtfsGetStreamInformation(PNTFS_FCB Fcb, PDEVICE_EXTENSION DeviceExt, PFILE_STREAM_INFORMATION StreamInfo, PULONG BufferLength)
Definition: finfo.c:226
NTSTATUS NtfsSetEndOfFile(PNTFS_FCB Fcb, PFILE_OBJECT FileObject, PDEVICE_EXTENSION DeviceExt, ULONG IrpFlags, BOOLEAN CaseSensitive, PLARGE_INTEGER NewFileSize)
Definition: finfo.c:563
NTSTATUS NtfsQueryInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: finfo.c:420
static NTSTATUS NtfsGetPositionInformation(PFILE_OBJECT FileObject, PFILE_POSITION_INFORMATION PositionInfo, PULONG BufferLength)
Definition: finfo.c:75
const PCSTR GetInfoClassName(FILE_INFORMATION_CLASS infoClass)
Definition: finfo.c:296
static NTSTATUS NtfsGetStandardInformation(PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_STANDARD_INFORMATION StandardInfo, PULONG BufferLength)
Definition: finfo.c:42
static NTSTATUS NtfsGetNetworkOpenInformation(PNTFS_FCB Fcb, PDEVICE_EXTENSION DeviceExt, PFILE_NETWORK_OPEN_INFORMATION NetworkInfo, PULONG BufferLength)
Definition: finfo.c:198
static NTSTATUS NtfsGetInternalInformation(PNTFS_FCB Fcb, PFILE_INTERNAL_INFORMATION InternalInfo, PULONG BufferLength)
Definition: finfo.c:177
NTSTATUS NtfsSetInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: finfo.c:719
static NTSTATUS NtfsGetBasicInformation(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_BASIC_INFORMATION BasicInfo, PULONG BufferLength)
Definition: finfo.c:97
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
#define STATUS_USER_MAPPED_FILE
Definition: ntstatus.h:711
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define L(x)
Definition: ntvdm.h:50
#define FileStandardInformation
Definition: propsheet.cpp:61
BOOLEAN NTAPI MmCanFileBeTruncated(_In_ PSECTION_OBJECT_POINTERS SectionObjectPointer, _In_opt_ PLARGE_INTEGER NewFileSize)
Definition: section.c:4255
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
#define DPRINT
Definition: sndvol32.h:71
UCHAR NameLength
Definition: ntfs.h:377
ULONGLONG DirectoryFileReferenceNumber
Definition: ntfs.h:360
WCHAR Name[1]
Definition: ntfs.h:379
USHORT NameOffset
Definition: ntfs.h:130
UCHAR NameLength
Definition: ntfs.h:129
ULONG Type
Definition: ntfs.h:126
PFILE_OBJECT FileObject
Definition: ntfs.h:489
ULONG Flags
Definition: ntfs.h:481
PIO_STACK_LOCATION Stack
Definition: ntfs.h:482
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:488
Definition: cdstruc.h:902
ULONG Flags
Definition: ntfs.h:536
PVCB Vcb
Definition: cdstruc.h:933
FSRTL_COMMON_FCB_HEADER RFCB
Definition: ntfs.h:517
ULONGLONG MFTIndex
Definition: ntfs.h:539
WCHAR Stream[MAX_PATH]
Definition: ntfs.h:523
WCHAR * ObjectName
Definition: ntfs.h:524
WCHAR PathName[MAX_PATH]
Definition: ntfs.h:525
USHORT LinkCount
Definition: ntfs.h:540
FILENAME_ATTRIBUTE Entry
Definition: ntfs.h:542
ERESOURCE MainResource
Definition: ntfs.h:528
LARGE_INTEGER LastWriteTime
Definition: nt_native.h:941
LARGE_INTEGER CreationTime
Definition: nt_native.h:939
LARGE_INTEGER ChangeTime
Definition: nt_native.h:942
LARGE_INTEGER LastAccessTime
Definition: nt_native.h:940
LARGE_INTEGER CurrentByteOffset
Definition: nt_native.h:955
LARGE_INTEGER AllocationSize
Definition: propsheet.cpp:54
LARGE_INTEGER StreamSize
Definition: winternl.h:721
LARGE_INTEGER StreamAllocationSize
Definition: winternl.h:722
LARGE_INTEGER AllocationSize
Definition: env_spec_w32.h:755
uint32_t * PULONG
Definition: typedefs.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
const char * PCSTR
Definition: typedefs.h:52
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
#define IRP_PAGING_IO
* PFILE_OBJECT
Definition: iotypes.h:1998
#define SL_CASE_SENSITIVE
Definition: iotypes.h:1820
_In_opt_ PLARGE_INTEGER NewFileSize
Definition: mmfuncs.h:608
__wchar_t WCHAR
Definition: xmlstorage.h:180