ReactOS  0.4.15-dev-1177-g6cb3b62
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  */
40 static
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 
73 static
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 
95 static
98  PNTFS_FCB Fcb,
100  PFILE_BASIC_INFORMATION BasicInfo,
102 {
104 
105  DPRINT("NtfsGetBasicInformation(%p, %p, %p, %p, %p)\n", FileObject, Fcb, DeviceObject, BasicInfo, BufferLength);
106 
107  if (*BufferLength < sizeof(FILE_BASIC_INFORMATION))
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  */
128 static
129 NTSTATUS
131  PNTFS_FCB Fcb,
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 */
165  return STATUS_BUFFER_OVERFLOW;
166  }
167 
168  /* We filled up as many bytes, as needed */
170 
171  return STATUS_SUCCESS;
172 }
173 
174 
175 static
176 NTSTATUS
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 
196 static
197 NTSTATUS
199  PDEVICE_EXTENSION DeviceExt,
200  PFILE_NETWORK_OPEN_INFORMATION NetworkInfo,
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 
224 static
225 NTSTATUS
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 
238  if (*BufferLength < sizeof(FILE_STREAM_INFORMATION))
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);
272  CurrentInfo->StreamAllocationSize.QuadPart = AttributeAllocatedLength(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
295 const 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  */
419 NTSTATUS
421 {
423  PIO_STACK_LOCATION Stack;
425  PNTFS_FCB Fcb;
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 
445  BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
446  {
447  return NtfsMarkIrpContextForQueue(IrpContext);
448  }
449 
450  switch (FileInformationClass)
451  {
454  DeviceObject,
455  SystemBuffer,
456  &BufferLength);
457  break;
458 
461  SystemBuffer,
462  &BufferLength);
463  break;
464 
467  Fcb,
468  DeviceObject,
469  SystemBuffer,
470  &BufferLength);
471  break;
472 
473  case FileNameInformation:
475  Fcb,
476  DeviceObject,
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 
502  case FileAllInformation:
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 
562 NTSTATUS
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,
609  NewFileSize))
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);
648  return STATUS_ACCESS_DENIED;
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 
718 NTSTATUS
720 {
722  PIO_STACK_LOCATION Stack;
723  PDEVICE_EXTENSION DeviceExt;
725  PNTFS_FCB Fcb;
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 
746  BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT)))
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;
762  FileObject,
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 */
BOOLEAN NTAPI MmCanFileBeTruncated(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN PLARGE_INTEGER NewFileSize)
Definition: section.c:4728
#define NTFS_MFT_MASK
Definition: ntfs.h:198
ULONGLONG AttributeAllocatedLength(PNTFS_ATTR_RECORD AttrRecord)
Definition: mft.c:249
PFILENAME_ATTRIBUTE GetBestFileNameFromRecord(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord)
Definition: attrib.c:1985
struct _FILE_INTERNAL_INFORMATION FILE_INTERNAL_INFORMATION
PDEVICE_OBJECT DeviceObject
Definition: ntfs.h:484
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define SL_CASE_SENSITIVE
Definition: iotypes.h:1800
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PSCSI_REQUEST_BLOCK _In_opt_ PVOID _In_ ULONG BufferLength
Definition: cdrom.h:989
USHORT NameOffset
Definition: ntfs.h:126
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
WCHAR Name[1]
Definition: ntfs.h:375
PIO_STACK_LOCATION Stack
Definition: ntfs.h:478
LARGE_INTEGER LastAccessTime
Definition: nt_native.h:940
_In_ PIRP Irp
Definition: csq.h:116
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
Definition: cdstruc.h:908
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
FORCEINLINE NTSTATUS NtfsMarkIrpContextForQueue(PNTFS_IRP_CONTEXT IrpContext)
Definition: ntfs.h:565
LONG NTSTATUS
Definition: precomp.h:26
USHORT LinkCount
Definition: ntfs.h:536
ULONG Type
Definition: ntfs.h:122
UCHAR NameLength
Definition: ntfs.h:373
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:75
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
uint16_t * PWCHAR
Definition: typedefs.h:56
WCHAR PathName[MAX_PATH]
Definition: ntfs.h:521
BOOLEAN NtfsFCBIsDirectory(PNTFS_FCB Fcb)
Definition: fcb.c:127
ULONGLONG MFTIndex
Definition: ntfs.h:535
struct _FILE_POSITION_INFORMATION FILE_POSITION_INFORMATION
_In_ UINT _In_ UINT BytesToCopy
Definition: ndis.h:3167
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
LARGE_INTEGER StreamAllocationSize
Definition: winternl.h:722
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
LARGE_INTEGER StreamSize
Definition: winternl.h:721
unsigned char BOOLEAN
struct _FILE_STREAM_INFORMATION * PFILE_STREAM_INFORMATION
smooth NULL
Definition: ftsmooth.c:416
WCHAR Stream[MAX_PATH]
Definition: ntfs.h:519
#define IRPCONTEXT_CANWAIT
Definition: vfat.h:569
LARGE_INTEGER CurrentByteOffset
Definition: nt_native.h:955
void DPRINT(...)
Definition: polytest.cpp:61
WCHAR * ObjectName
Definition: ntfs.h:520
#define STATUS_USER_MAPPED_FILE
Definition: ntstatus.h:711
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:588
NTSTATUS FindNextAttribute(PFIND_ATTR_CONTXT Context, PNTFS_ATTR_RECORD *Attribute)
Definition: attrib.c:1431
FSRTL_COMMON_FCB_HEADER RFCB
Definition: ntfs.h:513
ULONGLONG NtfsGetFileSize(PDEVICE_EXTENSION DeviceExt, PFILE_RECORD_HEADER FileRecord, PCWSTR Stream, ULONG StreamLength, PULONGLONG AllocatedSize)
Definition: dirctl.c:38
struct _FILE_END_OF_FILE_INFORMATION * PFILE_END_OF_FILE_INFORMATION
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING StreamName
Definition: fsrtlfuncs.h:738
const PCSTR GetInfoClassName(FILE_INFORMATION_CLASS infoClass)
Definition: finfo.c:296
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
LARGE_INTEGER LastWriteTime
Definition: nt_native.h:941
VOID NtfsFileFlagsToAttributes(ULONG NtfsAttributes, PULONG FileAttributes)
Definition: misc.c:105
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
uint64_t ULONGLONG
Definition: typedefs.h:67
static NTSTATUS NtfsGetInternalInformation(PNTFS_FCB Fcb, PFILE_INTERNAL_INFORMATION InternalInfo, PULONG BufferLength)
Definition: finfo.c:177
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
LARGE_INTEGER AllocationSize
Definition: propsheet.cpp:54
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
NTSTATUS UpdateFileNameRecord(PDEVICE_EXTENSION Vcb, ULONGLONG ParentMFTIndex, PUNICODE_STRING FileName, BOOLEAN DirSearch, ULONGLONG NewDataSize, ULONGLONG NewAllocationSize, BOOLEAN CaseSensitive)
Definition: mft.c:1660
* PFILE_OBJECT
Definition: iotypes.h:1978
_In_opt_ PLARGE_INTEGER NewFileSize
Definition: mmfuncs.h:608
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG Flags
Definition: ntfs.h:532
static NTSTATUS NtfsGetNameInformation(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_NAME_INFORMATION NameInfo, PULONG BufferLength)
Definition: finfo.c:130
LARGE_INTEGER CreationTime
Definition: nt_native.h:939
Status
Definition: gdiplustypes.h:24
static const WCHAR L[]
Definition: oid.c:1250
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
ULONG Flags
Definition: ntfs.h:477
VOID FindCloseAttribute(PFIND_ATTR_CONTXT Context)
Definition: attrib.c:1465
LARGE_INTEGER AllocationSize
Definition: env_spec_w32.h:755
ULONGLONG DirectoryFileReferenceNumber
Definition: ntfs.h:356
NTSTATUS NtfsQueryInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: finfo.c:420
ERESOURCE MainResource
Definition: ntfs.h:524
LARGE_INTEGER ChangeTime
Definition: nt_native.h:942
_Must_inspect_result_ _In_ PFILE_OBJECT _In_opt_ HANDLE _In_ ULONG FileNameLength
Definition: fltkernel.h:1129
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:319
#define FCB_IS_VOLUME
Definition: vfat.h:431
static NTSTATUS NtfsGetBasicInformation(PFILE_OBJECT FileObject, PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_BASIC_INFORMATION BasicInfo, PULONG BufferLength)
Definition: finfo.c:97
UCHAR NameLength
Definition: ntfs.h:125
struct _FileName FileName
Definition: fatprocs.h:893
NTSTATUS FindFirstAttribute(PFIND_ATTR_CONTXT Context, PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER FileRecord, BOOLEAN OnlyResident, PNTFS_ATTR_RECORD *Attribute)
Definition: attrib.c:1383
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
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
static NTSTATUS NtfsGetStandardInformation(PNTFS_FCB Fcb, PDEVICE_OBJECT DeviceObject, PFILE_STANDARD_INFORMATION StandardInfo, PULONG BufferLength)
Definition: finfo.c:42
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_In_ PDEVICE_OBJECT DeviceObject
Definition: iotypes.h:2464
unsigned int * PULONG
Definition: retypes.h:1
#define min(a, b)
Definition: monoChain.cc:55
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 IRP_PAGING_IO
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
#define DPRINT1
Definition: precomp.h:8
#define FileStandardInformation
Definition: propsheet.cpp:61
struct tagContext Context
Definition: acpixf.h:1034
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
static NTSTATUS NtfsGetNetworkOpenInformation(PNTFS_FCB Fcb, PDEVICE_EXTENSION DeviceExt, PFILE_NETWORK_OPEN_INFORMATION NetworkInfo, PULONG BufferLength)
Definition: finfo.c:198
#define ULONG_PTR
Definition: config.h:101
PVCB Vcb
Definition: cdstruc.h:939
const char * PCSTR
Definition: typedefs.h:52
static NTSTATUS NtfsGetPositionInformation(PFILE_OBJECT FileObject, PFILE_POSITION_INFORMATION PositionInfo, PULONG BufferLength)
Definition: finfo.c:75
static NTSTATUS NtfsGetSteamInformation(PNTFS_FCB Fcb, PDEVICE_EXTENSION DeviceExt, PFILE_STREAM_INFORMATION StreamInfo, PULONG BufferLength)
Definition: finfo.c:226
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:3107
_In_ PFCB Fcb
Definition: cdprocs.h:159
return STATUS_SUCCESS
Definition: btrfs.c:3014
FILENAME_ATTRIBUTE Entry
Definition: ntfs.h:538
NTSTATUS NtfsSetInformation(PNTFS_IRP_CONTEXT IrpContext)
Definition: finfo.c:719
ULONGLONG AttributeDataLength(PNTFS_ATTR_RECORD AttrRecord)
Definition: mft.c:259
NTSTATUS NtfsSetEndOfFile(PNTFS_FCB Fcb, PFILE_OBJECT FileObject, PDEVICE_EXTENSION DeviceExt, ULONG IrpFlags, BOOLEAN CaseSensitive, PLARGE_INTEGER NewFileSize)
Definition: finfo.c:563
PFILE_OBJECT FileObject
Definition: ntfs.h:485
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
LONGLONG QuadPart
Definition: typedefs.h:114
#define FILE_BASIC_INFORMATION
Definition: disk.h:53