ReactOS  0.4.14-dev-52-g6116262
fileinfo.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GNU GENERAL PUBLIC LICENSE VERSION 2
3  * PROJECT: ReiserFs file system driver for Windows NT/2000/XP/Vista.
4  * FILE: fileinfo.c
5  * PURPOSE:
6  * PROGRAMMER: Mark Piper, Matt Wu, Bo BrantÚn.
7  * HOMEPAGE:
8  * UPDATE HISTORY:
9  */
10 
11 /* INCLUDES *****************************************************************/
12 
13 #include "rfsd.h"
14 
15 /* GLOBALS ***************************************************************/
16 
18 
19 /* DEFINITIONS *************************************************************/
20 
21 #ifdef ALLOC_PRAGMA
22 #pragma alloc_text(PAGE, RfsdQueryInformation)
23 #pragma alloc_text(PAGE, RfsdSetInformation)
24 #if !RFSD_READ_ONLY
25 #pragma alloc_text(PAGE, RfsdExpandFile)
26 #pragma alloc_text(PAGE, RfsdTruncateFile)
27 #pragma alloc_text(PAGE, RfsdSetDispositionInfo)
28 #pragma alloc_text(PAGE, RfsdSetRenameInfo)
29 #pragma alloc_text(PAGE, RfsdDeleteFile)
30 #endif // !RFSD_READ_ONLY
31 #endif
32 
36 {
40  PRFSD_VCB Vcb;
41  PRFSD_FCB Fcb = 0;
42  PRFSD_CCB Ccb;
43  PIRP Irp;
44  PIO_STACK_LOCATION IoStackLocation;
46  ULONG Length;
47  PVOID Buffer;
48  BOOLEAN FcbResourceAcquired = FALSE;
51 
52  PAGED_CODE();
53 
54  _SEH2_TRY {
55 
56  ASSERT(IrpContext != NULL);
57 
58  ASSERT((IrpContext->Identifier.Type == RFSDICX) &&
59  (IrpContext->Identifier.Size == sizeof(RFSD_IRP_CONTEXT)));
60 
61  DeviceObject = IrpContext->DeviceObject;
62 
63  //
64  // This request is not allowed on the main device object
65  //
69  }
70 
71  FileObject = IrpContext->FileObject;
72 
73  Fcb = (PRFSD_FCB) FileObject->FsContext;
74 
75  ASSERT(Fcb != NULL);
76 
77  //
78  // This request is not allowed on volumes
79  //
80  if (Fcb->Identifier.Type == RFSDVCB) {
83  }
84 
86  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
87 
88  Vcb = Fcb->Vcb;
89 
90 /*
91  if ( !IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY) &&
92  !FlagOn(Fcb->Flags, FCB_PAGE_FILE))
93 */
94  {
96  &Fcb->MainResource,
97  IrpContext->IsSynchronous
98  )) {
99 
101  _SEH2_LEAVE;
102  }
103 
104  FcbResourceAcquired = TRUE;
105  }
106 
107  Ccb = (PRFSD_CCB) FileObject->FsContext2;
108 
109  ASSERT(Ccb != NULL);
110 
111  ASSERT((Ccb->Identifier.Type == RFSDCCB) &&
112  (Ccb->Identifier.Size == sizeof(RFSD_CCB)));
113 
114  Irp = IrpContext->Irp;
115 
116  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
117 
119  IoStackLocation->Parameters.QueryFile.FileInformationClass;
120 
121  Length = IoStackLocation->Parameters.QueryFile.Length;
122 
123  Buffer = Irp->AssociatedIrp.SystemBuffer;
124 
126 
127  FileSize = (LONGLONG) Fcb->Inode->i_size;
128 
130 
131  switch (FileInformationClass) {
132 
134  {
136 
137  if (Length < sizeof(FILE_BASIC_INFORMATION)) {
139  _SEH2_LEAVE;
140  }
141 
143 
144  FileBasicInformation->CreationTime = RfsdSysTime(Fcb->Inode->i_ctime);
145 
146  FileBasicInformation->LastAccessTime = RfsdSysTime(Fcb->Inode->i_atime);
147 
148  FileBasicInformation->LastWriteTime = RfsdSysTime(Fcb->Inode->i_mtime);
149 
150  FileBasicInformation->ChangeTime = RfsdSysTime(Fcb->Inode->i_mtime);
151 
152  FileBasicInformation->FileAttributes = Fcb->RfsdMcb->FileAttr;
153 
154  Irp->IoStatus.Information = sizeof(FILE_BASIC_INFORMATION);
156  _SEH2_LEAVE;
157  }
158 
159 #if (_WIN32_WINNT >= 0x0500)
160 
162  {
164 
165  if (Length < sizeof(FILE_ATTRIBUTE_TAG_INFORMATION)) {
167  _SEH2_LEAVE;
168  }
169 
171 
172  FATI->FileAttributes = Fcb->RfsdMcb->FileAttr;
173  FATI->ReparseTag = 0;
174 
175  Irp->IoStatus.Information = sizeof(FILE_ATTRIBUTE_TAG_INFORMATION);
177  _SEH2_LEAVE;
178  }
179 #endif // (_WIN32_WINNT >= 0x0500)
180 
182  {
184 
185  if (Length < sizeof(FILE_STANDARD_INFORMATION)) {
187  _SEH2_LEAVE;
188  }
189 
191 
192  FileStandardInformation->AllocationSize.QuadPart = AllocationSize;
193  FileStandardInformation->EndOfFile.QuadPart = FileSize;
194 
195  FileStandardInformation->NumberOfLinks = Fcb->Inode->i_links_count;
196 
197  if (IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY))
198  FileStandardInformation->DeletePending = FALSE;
199  else
201 
202  if (Fcb->RfsdMcb->FileAttr & FILE_ATTRIBUTE_DIRECTORY) {
203  FileStandardInformation->Directory = TRUE;
204  } else {
205  FileStandardInformation->Directory = FALSE;
206  }
207 
208  Irp->IoStatus.Information = sizeof(FILE_STANDARD_INFORMATION);
210  _SEH2_LEAVE;
211  }
212 
214  {
216 
217  if (Length < sizeof(FILE_INTERNAL_INFORMATION)) {
219  _SEH2_LEAVE;
220  }
221 
223 
224  // The "inode number"
225  FileInternalInformation->IndexNumber.LowPart = Fcb->RfsdMcb->Key.k_dir_id;
226  FileInternalInformation->IndexNumber.HighPart = Fcb->RfsdMcb->Key.k_objectid;
227 
228  Irp->IoStatus.Information = sizeof(FILE_INTERNAL_INFORMATION);
230  _SEH2_LEAVE;
231  }
232 
233  case FileEaInformation:
234  {
236 
237  if (Length < sizeof(FILE_EA_INFORMATION)) {
239  _SEH2_LEAVE;
240  }
241 
243 
244  // Romfs doesn't have any extended attributes
245  FileEaInformation->EaSize = 0;
246 
247  Irp->IoStatus.Information = sizeof(FILE_EA_INFORMATION);
249  _SEH2_LEAVE;
250  }
251 
252  case FileNameInformation:
253  {
255 
256  if (Length < sizeof(FILE_NAME_INFORMATION) +
257  Fcb->RfsdMcb->ShortName.Length - sizeof(WCHAR)) {
259  _SEH2_LEAVE;
260  }
261 
263 
264  FileNameInformation->FileNameLength = Fcb->RfsdMcb->ShortName.Length;
265 
267  FileNameInformation->FileName,
268  Fcb->RfsdMcb->ShortName.Buffer,
269  Fcb->RfsdMcb->ShortName.Length );
270 
271  Irp->IoStatus.Information = sizeof(FILE_NAME_INFORMATION) +
272  Fcb->RfsdMcb->ShortName.Length - sizeof(WCHAR);
274  _SEH2_LEAVE;
275  }
276 
278  {
280 
281  if (Length < sizeof(FILE_POSITION_INFORMATION)) {
283  _SEH2_LEAVE;
284  }
285 
287 
288  FilePositionInformation->CurrentByteOffset =
289  FileObject->CurrentByteOffset;
290 
291  Irp->IoStatus.Information = sizeof(FILE_POSITION_INFORMATION);
293  _SEH2_LEAVE;
294  }
295 
296  case FileAllInformation:
297  {
305 
306  if (Length < sizeof(FILE_ALL_INFORMATION)) {
308  _SEH2_LEAVE;
309  }
310 
312 
314  &FileAllInformation->BasicInformation;
315 
317  &FileAllInformation->StandardInformation;
318 
320  &FileAllInformation->InternalInformation;
321 
323  &FileAllInformation->EaInformation;
324 
326  &FileAllInformation->PositionInformation;
327 
329  &FileAllInformation->NameInformation;
330 
331  FileBasicInformation->CreationTime = RfsdSysTime(Fcb->Inode->i_ctime);
332 
333  FileBasicInformation->LastAccessTime = RfsdSysTime(Fcb->Inode->i_atime);
334 
335  FileBasicInformation->LastWriteTime = RfsdSysTime(Fcb->Inode->i_mtime);
336 
337  FileBasicInformation->ChangeTime = RfsdSysTime(Fcb->Inode->i_mtime);
338 
339  FileBasicInformation->FileAttributes = Fcb->RfsdMcb->FileAttr;
340 
341  FileStandardInformation->AllocationSize.QuadPart = AllocationSize;
342 
343  FileStandardInformation->EndOfFile.QuadPart = FileSize;
344 
345  FileStandardInformation->NumberOfLinks = Fcb->Inode->i_links_count;
346 
347  if (IsFlagOn(Fcb->Vcb->Flags, VCB_READ_ONLY))
348  FileStandardInformation->DeletePending = FALSE;
349  else
351 
352  if (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) {
353  FileStandardInformation->Directory = TRUE;
354  } else {
355  FileStandardInformation->Directory = FALSE;
356  }
357 
358  // The "inode number"
359  FileInternalInformation->IndexNumber.LowPart = Fcb->RfsdMcb->Key.k_dir_id;
360  FileInternalInformation->IndexNumber.HighPart = Fcb->RfsdMcb->Key.k_objectid;
361 
362  // Romfs doesn't have any extended attributes
363  FileEaInformation->EaSize = 0;
364 
365  FilePositionInformation->CurrentByteOffset =
366  FileObject->CurrentByteOffset;
367 
368  if (Length < sizeof(FILE_ALL_INFORMATION) +
369  Fcb->RfsdMcb->ShortName.Length - sizeof(WCHAR)) {
370  Irp->IoStatus.Information = sizeof(FILE_ALL_INFORMATION);
372  _SEH2_LEAVE;
373  }
374 
375  FileNameInformation->FileNameLength = Fcb->RfsdMcb->ShortName.Length;
376 
378  FileNameInformation->FileName,
379  Fcb->RfsdMcb->ShortName.Buffer,
380  Fcb->RfsdMcb->ShortName.Length
381  );
382 
383  Irp->IoStatus.Information = sizeof(FILE_ALL_INFORMATION) +
384  Fcb->RfsdMcb->ShortName.Length - sizeof(WCHAR);
386  _SEH2_LEAVE;
387  }
388 
389  /*
390  case FileAlternateNameInformation:
391  {
392  // TODO: [ext2fsd] Handle FileAlternateNameInformation
393 
394  // Here we would like to use RtlGenerate8dot3Name but I don't
395  // know how to use the argument PGENERATE_NAME_CONTEXT
396  }
397  */
398 
400  {
402 
403  if (Length < sizeof(FILE_NETWORK_OPEN_INFORMATION)) {
405  _SEH2_LEAVE;
406  }
407 
410 
411  FileNetworkOpenInformation->CreationTime = RfsdSysTime(Fcb->Inode->i_ctime);
412 
413  FileNetworkOpenInformation->LastAccessTime = RfsdSysTime(Fcb->Inode->i_atime);
414 
415  FileNetworkOpenInformation->LastWriteTime = RfsdSysTime(Fcb->Inode->i_mtime);
416 
417  FileNetworkOpenInformation->ChangeTime = RfsdSysTime(Fcb->Inode->i_mtime);
418 
419  FileNetworkOpenInformation->AllocationSize.QuadPart = AllocationSize;
420 
421  FileNetworkOpenInformation->EndOfFile.QuadPart = FileSize;
422 
423  FileNetworkOpenInformation->FileAttributes = Fcb->RfsdMcb->FileAttr;
424 
425  Irp->IoStatus.Information =
428  _SEH2_LEAVE;
429  }
430 
431  default:
433  }
434 
435  } _SEH2_FINALLY {
436 
437  if (FcbResourceAcquired) {
439  &Fcb->MainResource,
441  }
442 
443  if (!IrpContext->ExceptionInProgress) {
444  if (Status == STATUS_PENDING) {
445  RfsdQueueRequest(IrpContext);
446  } else {
447  RfsdCompleteIrpContext(IrpContext, Status);
448  }
449  }
450  } _SEH2_END;
451 
452  return Status;
453 }
454 
456 NTSTATUS
458 {
461  PRFSD_VCB Vcb = 0;
463  PRFSD_FCB Fcb = 0;
464  PRFSD_CCB Ccb;
465  PIRP Irp;
466  PIO_STACK_LOCATION IoStackLocation;
468 
469  ULONG NotifyFilter = 0;
470 
471  ULONG Length;
472  PVOID Buffer;
473  BOOLEAN FcbMainResourceAcquired = FALSE;
474 
475  BOOLEAN VcbResourceAcquired = FALSE;
476  BOOLEAN FcbPagingIoResourceAcquired = FALSE;
477 
478  PAGED_CODE();
479 
480  _SEH2_TRY {
481 
482  ASSERT(IrpContext != NULL);
483 
484  ASSERT((IrpContext->Identifier.Type == RFSDICX) &&
485  (IrpContext->Identifier.Size == sizeof(RFSD_IRP_CONTEXT)));
486 
487  DeviceObject = IrpContext->DeviceObject;
488 
489  //
490  // This request is not allowed on the main device object
491  //
494  _SEH2_LEAVE;
495  }
496 
498 
499  ASSERT(Vcb != NULL);
500 
501  ASSERT((Vcb->Identifier.Type == RFSDVCB) &&
502  (Vcb->Identifier.Size == sizeof(RFSD_VCB)));
503 
504  ASSERT(IsMounted(Vcb));
505 
506  FileObject = IrpContext->FileObject;
507 
508  Fcb = (PRFSD_FCB) FileObject->FsContext;
509 
510  ASSERT(Fcb != NULL);
511 
512  //
513  // This request is not allowed on volumes
514  //
515  if (Fcb->Identifier.Type == RFSDVCB) {
516  DbgBreak();
517 
519  _SEH2_LEAVE;
520  }
521 
522  ASSERT((Fcb->Identifier.Type == RFSDFCB) &&
523  (Fcb->Identifier.Size == sizeof(RFSD_FCB)));
524 
527  _SEH2_LEAVE;
528  }
529 
530  Ccb = (PRFSD_CCB) FileObject->FsContext2;
531 
532  ASSERT(Ccb != NULL);
533 
534  ASSERT((Ccb->Identifier.Type == RFSDCCB) &&
535  (Ccb->Identifier.Size == sizeof(RFSD_CCB)));
536 
537  Irp = IrpContext->Irp;
538 
539  IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
540 
542  IoStackLocation->Parameters.SetFile.FileInformationClass;
543 
544  Length = IoStackLocation->Parameters.SetFile.Length;
545 
546  Buffer = Irp->AssociatedIrp.SystemBuffer;
547 
548  if (IsFlagOn(Vcb->Flags, VCB_READ_ONLY)) {
549 
553 
554 #ifdef _MSC_VER
555 #pragma prefast( suppress: 28137, "by design" )
556 #endif
558  &Vcb->MainResource,
559  IrpContext->IsSynchronous )) {
560 
562  _SEH2_LEAVE;
563  }
564 
565  VcbResourceAcquired = TRUE;
566  }
567 
568  } else if (!FlagOn(Fcb->Flags, FCB_PAGE_FILE)) {
569 
570 #ifdef _MSC_VER
571 #pragma prefast( suppress: 28137, "by design" )
572 #endif
574  &Fcb->MainResource,
575  IrpContext->IsSynchronous )) {
577  _SEH2_LEAVE;
578  }
579 
580  FcbMainResourceAcquired = TRUE;
581  }
582 
583  if (IsFlagOn(Vcb->Flags, VCB_READ_ONLY)) {
584 
587  _SEH2_LEAVE;
588  }
589  }
590 
596 
597 #ifdef _MSC_VER
598 #pragma prefast( suppress: 28137, "by design" )
599 #endif
602  IrpContext->IsSynchronous )) {
604  _SEH2_LEAVE;
605  }
606 
607  FcbPagingIoResourceAcquired = TRUE;
608  }
609 
610 /*
611  if (FileInformationClass != FileDispositionInformation
612  && FlagOn(Fcb->Flags, FCB_DELETE_PENDING))
613  {
614  Status = STATUS_DELETE_PENDING;
615  _SEH2_LEAVE;
616  }
617 */
618  switch (FileInformationClass) {
619 
620 #if !RFSD_READ_ONLY
621 #if 0
623  {
625  PRFSD_INODE RfsdInode = Fcb->Inode;
626 
627  if (FBI->CreationTime.QuadPart) {
628  RfsdInode->i_ctime = (ULONG)(RfsdInodeTime(FBI->CreationTime));
629  }
630 
631  if (FBI->LastAccessTime.QuadPart) {
632  RfsdInode->i_atime = (ULONG)(RfsdInodeTime(FBI->LastAccessTime));
633  }
634 
635  if (FBI->LastWriteTime.QuadPart) {
636  RfsdInode->i_mtime = (ULONG)(RfsdInodeTime(FBI->LastWriteTime));
637  }
638 
640  RfsdSetReadOnly(Fcb->Inode->i_mode);
641  SetFlag(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_READONLY);
642  } else {
643  RfsdSetWritable(Fcb->Inode->i_mode);
644  ClearFlag(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_READONLY);
645  }
646 
647  if(RfsdSaveInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, RfsdInode)) {
649  }
650 
653  } else {
655  }
656 
661 
663  }
664 
665  break;
666 
668  {
670 
671  if (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) {
673  _SEH2_LEAVE;
674  }
675 
676  if ( FAI->AllocationSize.QuadPart ==
677  Fcb->Header.AllocationSize.QuadPart) {
678 
680 
681  } else if ( FAI->AllocationSize.QuadPart >
682  Fcb->Header.AllocationSize.QuadPart ) {
683 
685  IrpContext,
686  Vcb, Fcb,
687  &(FAI->AllocationSize));
688 
689  if (NT_SUCCESS(Status)) {
690 
691  RfsdSaveInode( IrpContext,
692  Vcb,
693  Fcb->RfsdMcb->Inode,
694  Fcb->Inode );
695  }
696 
697  } else {
698 
699  if (MmCanFileBeTruncated(&(Fcb->SectionObject), &(FAI->AllocationSize))) {
700 
701  LARGE_INTEGER EndOfFile;
702 
703  EndOfFile.QuadPart = FAI->AllocationSize.QuadPart +
704  (LONGLONG)(Vcb->BlockSize - 1);
705 
706  Status = RfsdTruncateFile(IrpContext, Vcb, Fcb, &(EndOfFile));
707 
708  if (NT_SUCCESS(Status)) {
709 
710  if ( FAI->AllocationSize.QuadPart <
711  Fcb->Header.FileSize.QuadPart) {
712  Fcb->Header.FileSize.QuadPart =
714  }
715 
716  RfsdSaveInode( IrpContext,
717  Vcb,
718  Fcb->RfsdMcb->Inode,
719  Fcb->Inode);
720  }
721 
722  } else {
723 
725  _SEH2_LEAVE;
726  }
727  }
728 
729  if (NT_SUCCESS(Status)) {
730 
732  (PCC_FILE_SIZES)(&(Fcb->Header.AllocationSize)));
734 
737 
738  }
739 
740  }
741 
742  break;
743 
745  {
747 
748  BOOLEAN CacheInitialized = FALSE;
749 
750  if (IsDirectory(Fcb)) {
752  _SEH2_LEAVE;
753  }
754 
755  if (FEOFI->EndOfFile.HighPart != 0) {
757  _SEH2_LEAVE;
758  }
759 
760 
761  if (IoStackLocation->Parameters.SetFile.AdvanceOnly) {
763  _SEH2_LEAVE;
764  }
765 
766  if ((FileObject->SectionObjectPointer->DataSectionObject != NULL) &&
767  (FileObject->SectionObjectPointer->SharedCacheMap == NULL) &&
768  !FlagOn(Irp->Flags, IRP_PAGING_IO)) {
769 
771 
773  FileObject,
774  (PCC_FILE_SIZES)&(Fcb->Header.AllocationSize),
775  FALSE,
777  Fcb );
778 
779  CacheInitialized = TRUE;
780  }
781 
782  if ( FEOFI->EndOfFile.QuadPart ==
783  Fcb->Header.AllocationSize.QuadPart) {
784 
786 
787  } else if ( FEOFI->EndOfFile.QuadPart >
788  Fcb->Header.AllocationSize.QuadPart) {
789 
790  LARGE_INTEGER FileSize = Fcb->Header.FileSize;
791 
792  Status = RfsdExpandFile(IrpContext, Vcb, Fcb, &(FEOFI->EndOfFile));
793 
794  if (NT_SUCCESS(Status)) {
795 
796  Fcb->Header.FileSize.QuadPart = FEOFI->EndOfFile.QuadPart;
797 
798  Fcb->Inode->i_size = FEOFI->EndOfFile.QuadPart;
799 
800  Fcb->Header.ValidDataLength.QuadPart =
801  (LONGLONG)(0x7fffffffffffffff);
802 
803  RfsdSaveInode( IrpContext,
804  Vcb,
805  Fcb->RfsdMcb->Inode,
806  Fcb->Inode);
807 
808 
810  (PCC_FILE_SIZES)(&(Fcb->Header.AllocationSize)));
811 
813 
814  RfsdZeroHoles( IrpContext,
815  Vcb, FileObject,
817  Fcb->Header.AllocationSize.QuadPart -
818  FileSize.QuadPart );
819 
822 
823  }
824  } else {
825 
826  if (MmCanFileBeTruncated(&(Fcb->SectionObject), &(FEOFI->EndOfFile))) {
827 
828  LARGE_INTEGER EndOfFile = FEOFI->EndOfFile;
829 
830  EndOfFile.QuadPart = EndOfFile.QuadPart +
831  (LONGLONG)(Vcb->BlockSize - 1);
832 
833  Status = RfsdTruncateFile(IrpContext, Vcb, Fcb, &(EndOfFile));
834 
835  if (NT_SUCCESS(Status)) {
836 
837  Fcb->Header.FileSize.QuadPart = FEOFI->EndOfFile.QuadPart;
838  Fcb->Inode->i_size = FEOFI->EndOfFile.QuadPart;
839 
840  RfsdSaveInode( IrpContext,
841  Vcb,
842  Fcb->RfsdMcb->Inode,
843  Fcb->Inode);
844 
846  (PCC_FILE_SIZES)(&(Fcb->Header.AllocationSize)));
847 
849 
852  }
853 
854  } else {
855 
857  _SEH2_LEAVE;
858  }
859  }
860  }
861 
862  break;
863 
865  {
867 
868  Status = RfsdSetDispositionInfo(IrpContext, Vcb, Fcb, FDI->DeleteFile);
869  }
870 
871  break;
872 
874  {
875  Status = RfsdSetRenameInfo(IrpContext, Vcb, Fcb);
876  }
877 
878  break;
879 #endif // 0
880 #endif // !RFSD_READ_ONLY
881 
882  //
883  // This is the only set file information request supported on read
884  // only file systems
885  //
887  {
889 
890  if (Length < sizeof(FILE_POSITION_INFORMATION)) {
892  _SEH2_LEAVE;
893  }
894 
896 
898  (FilePositionInformation->CurrentByteOffset.LowPart &
901  _SEH2_LEAVE;
902  }
903 
904  FileObject->CurrentByteOffset =
905  FilePositionInformation->CurrentByteOffset;
906 
908  _SEH2_LEAVE;
909  }
910 
911  break;
912 
913  default:
915  }
916 
917  } _SEH2_FINALLY {
918 
919  if (FcbPagingIoResourceAcquired) {
923  }
924 
925  if (NT_SUCCESS(Status) && (NotifyFilter != 0)) {
927  IrpContext,
928  Vcb,
929  Fcb,
930  NotifyFilter,
932 
933  }
934 
935  if (FcbMainResourceAcquired) {
937  &Fcb->MainResource,
939  }
940 
941  if (VcbResourceAcquired) {
943  &Vcb->MainResource,
945  }
946 
947  if (!IrpContext->ExceptionInProgress) {
948  if (Status == STATUS_PENDING) {
949  RfsdQueueRequest(IrpContext);
950  } else {
951  RfsdCompleteIrpContext(IrpContext, Status);
952  }
953  }
954  } _SEH2_END;
955 
956  return Status;
957 }
958 
959 #if !RFSD_READ_ONLY
960 
961 NTSTATUS
965 {
966  ULONG dwRet = 0;
968 
969  PAGED_CODE();
970 
971  if (AllocationSize->QuadPart <= Fcb->Header.AllocationSize.QuadPart) {
972  return Status;
973  }
974 
975  if (((LONGLONG)SUPER_BLOCK->s_free_blocks_count) * Vcb->BlockSize <=
976  (AllocationSize->QuadPart - Fcb->Header.AllocationSize.QuadPart) ) {
977  RfsdPrint((DBG_ERROR, "RfsdExpandFile: There is no enough disk space available.\n"));
978  return STATUS_DISK_FULL;
979  }
980 
981  while (NT_SUCCESS(Status) && (AllocationSize->QuadPart > Fcb->Header.AllocationSize.QuadPart)) {
982  Status = RfsdExpandInode(IrpContext, Vcb, Fcb, &dwRet);
983  }
984 
985  return Status;
986 }
987 
988 NTSTATUS
992 {
994 
995  PAGED_CODE();
996 
997  while (NT_SUCCESS(Status) && (AllocationSize->QuadPart <
998  Fcb->Header.AllocationSize.QuadPart)) {
999  Status= RfsdTruncateInode(IrpContext, Vcb, Fcb);
1000  }
1001 
1002  return Status;
1003 }
1004 
1005 NTSTATUS
1007  PRFSD_IRP_CONTEXT IrpContext,
1008  PRFSD_VCB Vcb,
1009  PRFSD_FCB Fcb,
1010  BOOLEAN bDelete)
1011 {
1012  PIRP Irp = IrpContext->Irp;
1014 
1015  PAGED_CODE();
1016 
1018 
1019  RfsdPrint((DBG_INFO, "RfsdSetDispositionInfo: bDelete=%x\n", bDelete));
1020 
1021  if (bDelete) {
1022 
1023  RfsdPrint((DBG_INFO, "RfsdSetDispositionInformation: MmFlushImageSection on %s.\n",
1024  Fcb->AnsiFileName.Buffer));
1025 
1026  if (!MmFlushImageSection( &Fcb->SectionObject,
1027  MmFlushForDelete )) {
1028  return STATUS_CANNOT_DELETE;
1029  }
1030 
1031  if (RFSD_IS_ROOT_KEY(Fcb->RfsdMcb->Key)) {
1032  return STATUS_CANNOT_DELETE;
1033  }
1034 
1035  if (IsDirectory(Fcb)) {
1036  if (!RfsdIsDirectoryEmpty(Vcb, Fcb)) {
1038  }
1039  }
1040 
1042  IrpSp->FileObject->DeletePending = TRUE;
1043 
1044  if (IsDirectory(Fcb)) {
1045  FsRtlNotifyFullChangeDirectory( Vcb->NotifySync,
1046  &Vcb->NotifyList,
1047  Fcb,
1048  NULL,
1049  FALSE,
1050  FALSE,
1051  0,
1052  NULL,
1053  NULL,
1054  NULL );
1055  }
1056 
1057  } else {
1058 
1060  IrpSp->FileObject->DeletePending = FALSE;
1061  }
1062 
1063  return STATUS_SUCCESS;
1064 }
1065 
1066 NTSTATUS
1068  PRFSD_IRP_CONTEXT IrpContext,
1069  PRFSD_VCB Vcb,
1070  PRFSD_FCB Fcb )
1071 {
1073  PRFSD_MCB TargetMcb;
1074 
1075  PRFSD_MCB Mcb;
1076  RFSD_INODE Inode;
1077 
1079 
1080  NTSTATUS Status;
1081 
1082  PIRP Irp;
1084 
1086  PFILE_OBJECT TargetObject;
1087  BOOLEAN ReplaceIfExists;
1088 
1089  BOOLEAN bMove = FALSE;
1090 
1092 
1093  PAGED_CODE();
1094 #if 0
1095  if (Fcb->RfsdMcb->Inode == RFSD_ROOT_INO) {
1097  goto errorout;
1098  }
1099 
1100  Irp = IrpContext->Irp;
1102 
1104  TargetObject = IrpSp->Parameters.SetFile.FileObject;
1105  ReplaceIfExists = IrpSp->Parameters.SetFile.ReplaceIfExists;
1106 
1107  FRI = (PFILE_RENAME_INFORMATION)Irp->AssociatedIrp.SystemBuffer;
1108 
1109  if (TargetObject == NULL) {
1110 
1112 
1113  NewName.Buffer = FRI->FileName;
1115 
1116  while (NewName.Length > 0 && NewName.Buffer[NewName.Length/2 - 1] == L'\\') {
1117  NewName.Buffer[NewName.Length/2 - 1] = 0;
1118  NewName.Length -= 2;
1119  }
1120 
1121  while (NewName.Length > 0 && NewName.Buffer[NewName.Length/2 - 1] != L'\\') {
1122  NewName.Length -= 2;
1123  }
1124 
1127 
1128  FileName = NewName;
1129 
1130  TargetDcb = NULL;
1131  TargetMcb = Fcb->RfsdMcb->Parent;
1132 
1133  if (FileName.Length >= RFSD_NAME_LEN*sizeof(USHORT)) {
1135  goto errorout;
1136  }
1137 
1138  } else {
1139 
1140  TargetDcb = (PRFSD_FCB)(TargetObject->FsContext);
1141 
1142  if (!TargetDcb || TargetDcb->Vcb != Vcb) {
1143 
1144  DbgBreak();
1145 
1147  goto errorout;
1148  }
1149 
1150  TargetMcb = TargetDcb->RfsdMcb;
1151 
1152  FileName = TargetObject->FileName;
1153  }
1154 
1157  goto errorout;
1158  }
1159 
1160  if (TargetMcb->Inode == Fcb->RfsdMcb->Parent->Inode) {
1162  &(Fcb->RfsdMcb->ShortName),
1163  FALSE,
1164  NULL )) {
1166  goto errorout;
1167  }
1168  } else {
1169  bMove = TRUE;
1170  }
1171 
1172  TargetDcb = TargetMcb->RfsdFcb;
1173 
1174  if (!TargetDcb)
1175  TargetDcb = RfsdCreateFcbFromMcb(Vcb, TargetMcb);
1176 
1177  if ((TargetMcb->Inode != Fcb->RfsdMcb->Parent->Inode) &&
1178  (Fcb->RfsdMcb->Parent->RfsdFcb == NULL) ) {
1179  RfsdCreateFcbFromMcb(Vcb, Fcb->RfsdMcb->Parent);
1180  }
1181 
1182  if (!TargetDcb || !(Fcb->RfsdMcb->Parent->RfsdFcb)) {
1184 
1185  goto errorout;
1186  }
1187 
1188  Mcb = NULL;
1190  Vcb,
1191  &FileName,
1192  TargetMcb,
1193  &Mcb,
1194  &Inode );
1195 
1196  if (NT_SUCCESS(Status)) {
1197 
1198  if ( (!ReplaceIfExists) ||
1199  (IsFlagOn(Mcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) ||
1200  (IsFlagOn(Mcb->FileAttr, FILE_ATTRIBUTE_READONLY))) {
1202  goto errorout;
1203  }
1204 
1205  if (ReplaceIfExists) {
1207  goto errorout;
1208  }
1209  }
1210 
1211  if (IsDirectory(Fcb)) {
1212 
1213  Status = RfsdRemoveEntry( IrpContext, Vcb,
1214  Fcb->RfsdMcb->Parent->RfsdFcb,
1215  RFSD_FT_DIR,
1216  Fcb->RfsdMcb->Inode );
1217 
1218  if (!NT_SUCCESS(Status)) {
1219  DbgBreak();
1220 
1221  goto errorout;
1222  }
1223 
1224  Status = RfsdAddEntry( IrpContext, Vcb,
1225  TargetDcb,
1226  RFSD_FT_DIR,
1227  Fcb->RfsdMcb->Inode,
1228  &FileName );
1229 
1230  if (!NT_SUCCESS(Status)) {
1231 
1232  DbgBreak();
1233 
1234  RfsdAddEntry( IrpContext, Vcb,
1235  Fcb->RfsdMcb->Parent->RfsdFcb,
1236  RFSD_FT_DIR,
1237  Fcb->RfsdMcb->Inode,
1238  &Fcb->RfsdMcb->ShortName );
1239 
1240  goto errorout;
1241  }
1242 
1243  if( !RfsdSaveInode( IrpContext,
1244  Vcb,
1245  TargetMcb->Inode,
1246  TargetDcb->Inode)) {
1248 
1249  DbgBreak();
1250 
1251  goto errorout;
1252  }
1253 
1254  if( !RfsdSaveInode( IrpContext,
1255  Vcb,
1256  Fcb->RfsdMcb->Parent->Inode,
1257  Fcb->RfsdMcb->Parent->RfsdFcb->Inode)) {
1258 
1260 
1261  DbgBreak();
1262 
1263  goto errorout;
1264  }
1265 
1266  Status = RfsdSetParentEntry( IrpContext, Vcb, Fcb,
1267  Fcb->RfsdMcb->Parent->Inode,
1268  TargetDcb->RfsdMcb->Inode );
1269 
1270 
1271  if (!NT_SUCCESS(Status)) {
1272  DbgBreak();
1273  goto errorout;
1274  }
1275 
1276  } else {
1277 
1278  Status = RfsdRemoveEntry( IrpContext, Vcb,
1279  Fcb->RfsdMcb->Parent->RfsdFcb,
1280  RFSD_FT_REG_FILE,
1281  Fcb->RfsdMcb->Inode );
1282  if (!NT_SUCCESS(Status)) {
1283  DbgBreak();
1284  goto errorout;
1285  }
1286 
1287  Status = RfsdAddEntry( IrpContext,
1288  Vcb, TargetDcb,
1289  RFSD_FT_REG_FILE,
1290  Fcb->RfsdMcb->Inode,
1291  &FileName );
1292 
1293  if (!NT_SUCCESS(Status)) {
1294 
1295  DbgBreak();
1296 
1297  RfsdAddEntry( IrpContext, Vcb,
1298  Fcb->RfsdMcb->Parent->RfsdFcb,
1299  RFSD_FT_REG_FILE,
1300  Fcb->RfsdMcb->Inode,
1301  &Fcb->RfsdMcb->ShortName );
1302 
1303  goto errorout;
1304  }
1305  }
1306 
1307  if (NT_SUCCESS(Status)) {
1308 
1309  if (Fcb->RfsdMcb->ShortName.MaximumLength < (FileName.Length + 2)) {
1310 
1311  ExFreePool(Fcb->RfsdMcb->ShortName.Buffer);
1312  Fcb->RfsdMcb->ShortName.Buffer =
1314 
1315  if (!Fcb->RfsdMcb->ShortName.Buffer) {
1317  goto errorout;
1318  }
1319 
1320  Fcb->RfsdMcb->ShortName.MaximumLength = FileName.Length + 2;
1321  }
1322 
1323  {
1324  RtlZeroMemory( Fcb->RfsdMcb->ShortName.Buffer,
1325  Fcb->RfsdMcb->ShortName.MaximumLength);
1326 
1327  RtlCopyMemory( Fcb->RfsdMcb->ShortName.Buffer,
1328  FileName.Buffer, FileName.Length);
1329 
1330  Fcb->RfsdMcb->ShortName.Length = FileName.Length;
1331  }
1332 
1333 #if DBG
1334 
1335  Fcb->AnsiFileName.Length = (USHORT)
1337 
1338  if (Fcb->AnsiFileName.MaximumLength < FileName.Length) {
1339  ExFreePool(Fcb->AnsiFileName.Buffer);
1340 
1341  Fcb->AnsiFileName.Buffer =
1342  ExAllocatePoolWithTag(PagedPool, Fcb->AnsiFileName.Length + 1, RFSD_POOL_TAG);
1343 
1344  if (!Fcb->AnsiFileName.Buffer) {
1346  goto errorout;
1347  }
1348 
1349  RtlZeroMemory( Fcb->AnsiFileName.Buffer,
1350  Fcb->AnsiFileName.Length + 1);
1351  Fcb->AnsiFileName.MaximumLength =
1352  Fcb->AnsiFileName.Length + 1;
1353  }
1354 
1355  RfsdUnicodeToOEM( &(Fcb->AnsiFileName),
1356  &FileName );
1357 
1358 #endif
1359 
1360  if (bMove) {
1361 
1363  IrpContext,
1364  Vcb,
1365  Fcb,
1366  (IsDirectory(Fcb) ?
1370 
1371  } else {
1372 
1374  IrpContext,
1375  Vcb,
1376  Fcb,
1377  (IsDirectory(Fcb) ?
1381 
1382  }
1383 
1384  RfsdDeleteMcbNode(Vcb, Fcb->RfsdMcb->Parent, Fcb->RfsdMcb);
1385  RfsdAddMcbNode(Vcb, TargetMcb, Fcb->RfsdMcb);
1386 
1387  if (bMove) {
1388 
1390  IrpContext,
1391  Vcb,
1392  Fcb,
1393  (IsDirectory(Fcb) ?
1397  } else {
1398 
1400  IrpContext,
1401  Vcb,
1402  Fcb,
1403  (IsDirectory(Fcb) ?
1407 
1408  }
1409  }
1410 
1411 errorout:
1412 #endif // 0
1413  return 0;//Status;
1414 }
1415 
1416 NTSTATUS
1418  PRFSD_IRP_CONTEXT IrpContext,
1419  PRFSD_VCB Vcb,
1420  PRFSD_FCB Fcb )
1421 {
1422  BOOLEAN bRet = FALSE;
1424  PRFSD_FCB Dcb = NULL;
1426 
1427  PAGED_CODE();
1428 #if 0
1429  RfsdPrint((DBG_INFO, "RfsdDeleteFile: File %S (%xh) will be deleted!\n",
1430  Fcb->RfsdMcb->ShortName.Buffer, Fcb->RfsdMcb->Inode));
1431 
1433  return Status;
1434  }
1435 
1436  if (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY)) {
1437  if (!RfsdIsDirectoryEmpty(Vcb, Fcb)) {
1439 
1441  }
1442  }
1443 
1444  RfsdPrint((DBG_INFO, "RfsdDeleteFile: RFSDSB->S_FREE_BLOCKS = %xh .\n",
1445  Vcb->SuperBlock->s_free_blocks_count));
1446 
1447  if (IsDirectory(Fcb)) {
1448  if (Fcb->Inode->i_links_count <= 2) {
1449  } else {
1451  }
1452  } else {
1453  if (Fcb->Inode->i_links_count <= 1) {
1454  } else {
1456  }
1457  }
1458 
1459  if (!NT_SUCCESS(Status)) {
1460  DbgBreak();
1461  return Status;
1462  }
1463 
1464  if (Fcb->RfsdMcb->Parent->RfsdFcb) {
1465 
1467  IrpContext, Vcb,
1468  Fcb->RfsdMcb->Parent->RfsdFcb,
1469  (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY) ?
1470  RFSD_FT_DIR : RFSD_FT_REG_FILE),
1471  Fcb->RfsdMcb->Inode);
1472  } else {
1473 
1474  Dcb = RfsdCreateFcbFromMcb(Vcb, Fcb->RfsdMcb->Parent);
1475  if (Dcb) {
1477  IrpContext, Vcb, Dcb,
1478  (FlagOn(Fcb->RfsdMcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY) ?
1479  RFSD_FT_DIR : RFSD_FT_REG_FILE),
1480  Fcb->RfsdMcb->Inode);
1481  }
1482  }
1483 
1484  if (NT_SUCCESS(Status)) {
1485 
1486  LARGE_INTEGER SysTime;
1487  KeQuerySystemTime(&SysTime);
1488 
1489  AllocationSize.QuadPart = (LONGLONG)0;
1490 
1491  Status = RfsdTruncateFile(IrpContext, Vcb, Fcb, &AllocationSize);
1492 
1493  //
1494  // Update the inode's data length . It should be ZERO if succeeds.
1495  //
1496 
1497  if (Fcb->Header.FileSize.QuadPart > Fcb->Header.AllocationSize.QuadPart) {
1498 
1499  Fcb->Header.FileSize.QuadPart = Fcb->Header.AllocationSize.QuadPart;
1500  Fcb->Inode->i_size = Fcb->Header.AllocationSize.QuadPart;
1501  }
1502 
1503  Fcb->Inode->i_links_count = 0;
1504 
1505  RfsdSaveInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, Fcb->Inode);
1506 
1507  if (IsDirectory(Fcb)) {
1508  bRet = RfsdFreeInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, RFSD_FT_DIR);
1509  } else {
1510  bRet = RfsdFreeInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, RFSD_FT_REG_FILE);
1511  }
1512 
1514  RfsdDeleteMcbNode(Vcb, Fcb->RfsdMcb->Parent, Fcb->RfsdMcb);
1515 
1516  } else {
1517  DbgBreak();
1518  RfsdSaveInode(IrpContext, Vcb, Fcb->RfsdMcb->Inode, Fcb->Inode);
1519  }
1520 
1521  RfsdPrint((DBG_INFO, "RfsdDeleteFile: Succeed... RFSDSB->S_FREE_BLOCKS = %xh .\n",
1522  Vcb->SuperBlock->s_free_blocks_count));
1523 #endif // 0
1524  return Status;
1525 }
1526 
1527 #endif // !RFSD_READ_ONLY
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
struct _RFSD_CCB * PRFSD_CCB
struct _FILE_EA_INFORMATION * PFILE_EA_INFORMATION
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define RFSD_NAME_LEN
Definition: rfsd.h:45
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
BOOLEAN NTAPI MmCanFileBeTruncated(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN PLARGE_INTEGER NewFileSize)
Definition: section.c:4724
struct _FILE_INTERNAL_INFORMATION * PFILE_INTERNAL_INFORMATION
struct _FILE_BASIC_INFORMATION * PFILE_BASIC_INFORMATION
NTSTATUS RfsdUnicodeToOEM(IN OUT POEM_STRING Oem, IN PUNICODE_STRING Unicode)
Definition: misc.c:246
#define IN
Definition: typedefs.h:38
NTSTATUS RfsdAddEntry(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG FileType, IN ULONG Inode, IN PUNICODE_STRING FileName)
struct _FILE_INTERNAL_INFORMATION FILE_INTERNAL_INFORMATION
#define IsMounted(Vcb)
Definition: ext2fs.h:803
NTSTATUS RfsdCompleteIrpContext(IN PRFSD_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: memory.c:160
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
__u32 i_ctime
Definition: reiserfs.h:237
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define FILE_ACTION_RENAMED_OLD_NAME
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
USHORT MaximumLength
Definition: env_spec_w32.h:370
VOID NTAPI FsRtlNotifyFullChangeDirectory(IN PNOTIFY_SYNC NotifySync, IN PLIST_ENTRY NotifyList, IN PVOID FsContext, IN PSTRING FullDirectoryName, IN BOOLEAN WatchTree, IN BOOLEAN IgnoreBuffer, IN ULONG CompletionFilter, IN PIRP NotifyIrp, IN PCHECK_FOR_TRAVERSE_ACCESS TraverseCallback OPTIONAL, IN PSECURITY_SUBJECT_CONTEXT SubjectContext OPTIONAL)
Definition: notify.c:1458
#define STATUS_DIRECTORY_NOT_EMPTY
Definition: udferr_usr.h:167
NTSTATUS RfsdSetParentEntry(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG OldParent, IN ULONG NewParent)
#define CEILING_ALIGNED(T, A, B)
Definition: ext2fs.h:111
struct _FILE_NAME_INFORMATION FILE_NAME_INFORMATION
struct _FILE_DISPOSITION_INFORMATION * PFILE_DISPOSITION_INFORMATION
LARGE_INTEGER LastAccessTime
Definition: nt_native.h:940
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _FILE_ALL_INFORMATION FILE_ALL_INFORMATION
VOID RfsdNotifyReportChange(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb, IN ULONG Filter, IN ULONG Action)
Definition: dirctl.c:745
NTSTATUS RfsdLookupFileName(IN PRFSD_VCB Vcb, IN PUNICODE_STRING FullFileName, IN PRFSD_MCB ParentMcb, OUT PRFSD_MCB *RfsdMcb, IN OUT PRFSD_INODE Inode)
Definition: create.c:51
__drv_mustHoldCriticalRegion NTSTATUS RfsdSetInformation(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: fileinfo.c:457
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define RFSD_IS_ROOT_KEY(x)
Definition: rfsd.h:52
#define RFSD_POOL_TAG
Definition: rfsd.h:99
BOOLEAN RfsdDeleteMcbNode(PRFSD_VCB Vcb, PRFSD_MCB McbTree, PRFSD_MCB RfsdMcb)
Definition: memory.c:1057
#define FILE_NOTIFY_CHANGE_SIZE
struct _FILE_EA_INFORMATION FILE_EA_INFORMATION
#define FILE_NOTIFY_CHANGE_LAST_WRITE
#define FILE_NOTIFY_CHANGE_FILE_NAME
static OUT PIO_STATUS_BLOCK OUT PVOID IN ULONG IN FILE_INFORMATION_CLASS FileInformationClass
Definition: pipe.c:75
NTSTATUS RfsdQueueRequest(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: dispatch.c:29
BOOLEAN RfsdZeroHoles(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PFILE_OBJECT FileObject, IN LONGLONG Offset, IN LONGLONG Count)
Definition: write.c:188
#define FO_NO_INTERMEDIATE_BUFFERING
Definition: iotypes.h:1735
NTSTATUS RfsdDeleteFile(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb)
Definition: fileinfo.c:1417
struct _FILE_POSITION_INFORMATION FILE_POSITION_INFORMATION
NTSTATUS RfsdExpandInode(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, ULONG *dwRet)
#define FILE_NOTIFY_CHANGE_DIR_NAME
Definition: rfsd.h:323
BOOLEAN NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
Definition: name.c:464
#define FCB_DELETE_PENDING
Definition: ext2fs.h:879
#define PAGED_CODE()
Definition: video.h:57
LARGE_INTEGER AllocationSize
Definition: winternl.h:688
struct _FILE_NETWORK_OPEN_INFORMATION FILE_NETWORK_OPEN_INFORMATION
PDEVICE_OBJECT DeviceObject
Definition: rfsd.h:407
_SEH2_TRY
Definition: create.c:4250
Definition: rfsd.h:324
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
LARGE_INTEGER RfsdSysTime(IN ULONG i_time)
Definition: misc.c:47
#define FO_FILE_MODIFIED
Definition: iotypes.h:1745
while(1)
Definition: macro.lex.yy.c:740
struct _RFSD_FCB * PRFSD_FCB
NTFSIDENTIFIER Identifier
Definition: ntfs.h:511
#define RfsdSetReadOnly(m)
Definition: rfsd.h:294
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
NTSTATUS RfsdSetDispositionInfo(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, BOOLEAN bDelete)
Definition: fileinfo.c:1006
#define FILE_ACTION_MODIFIED
__drv_mustHoldCriticalRegion NTSTATUS RfsdQueryInformation(IN PRFSD_IRP_CONTEXT IrpContext)
Definition: fileinfo.c:35
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
NTSTATUS RfsdTruncateInode(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb)
smooth NULL
Definition: ftsmooth.c:416
#define FILE_ACTION_REMOVED
BOOLEAN RfsdIsDirectoryEmpty(IN PRFSD_VCB Vcb, IN PRFSD_FCB Fcb)
#define STATUS_MEDIA_WRITE_PROTECTED
Definition: udferr_usr.h:161
Definition: rfsd.h:326
Definition: bufpool.h:45
#define STATUS_USER_MAPPED_FILE
Definition: ntstatus.h:697
IN PDCB TargetDcb
Definition: fatprocs.h:779
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define STATUS_FILE_DELETED
Definition: udferr_usr.h:172
#define SUPER_BLOCK
Definition: ext2fs.h:90
#define FILE_NOTIFY_CHANGE_CREATION
struct _FILE_END_OF_FILE_INFORMATION * PFILE_END_OF_FILE_INFORMATION
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
struct _RFSD_VCB * PRFSD_VCB
__u32 i_mtime
Definition: reiserfs.h:236
int64_t LONGLONG
Definition: typedefs.h:66
enum _FILE_INFORMATION_CLASS FILE_INFORMATION_CLASS
Definition: directory.c:44
BOOLEAN NTAPI FsRtlAreNamesEqual(IN PCUNICODE_STRING Name1, IN PCUNICODE_STRING Name2, IN BOOLEAN IgnoreCase, IN PCWCH UpcaseTable OPTIONAL)
Definition: name.c:296
LARGE_INTEGER LastWriteTime
Definition: nt_native.h:941
if(!(yy_init))
Definition: macro.lex.yy.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _FILE_ALLOCATION_INFORMATION * PFILE_ALLOCATION_INFORMATION
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
VOID NTAPI CcInitializeCacheMap(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes, IN BOOLEAN PinAccess, IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext)
Definition: fssup.c:193
BOOLEAN NTAPI MmFlushImageSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN MMFLUSH_TYPE FlushType)
Definition: section.c:4798
uint64_t ULONGLONG
Definition: typedefs.h:65
struct _FILE_ALL_INFORMATION * PFILE_ALL_INFORMATION
#define Vcb
Definition: cdprocs.h:1425
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
BOOLEAN RfsdSaveInode(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN ULONG inode, IN PRFSD_INODE Inode)
ULONG RfsdUnicodeToOEMSize(IN PUNICODE_STRING Unicode)
Definition: misc.c:233
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1955
ULONG RfsdInodeTime(IN LARGE_INTEGER SysTime)
Definition: misc.c:59
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ULONG Flags
Definition: ntfs.h:532
PRFSD_GLOBAL RfsdGlobal
Definition: init.c:17
CACHE_MANAGER_CALLBACKS CacheManagerNoOpCallbacks
Definition: rfsd.h:401
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
PRFSD_FCB RfsdCreateFcbFromMcb(PRFSD_VCB Vcb, PRFSD_MCB Mcb)
Definition: memory.c:867
#define STATUS_CANNOT_DELETE
Definition: shellext.h:66
unsigned char UCHAR
Definition: xmlstorage.h:181
struct _FILE_RENAME_INFORMATION * PFILE_RENAME_INFORMATION
LARGE_INTEGER CreationTime
Definition: nt_native.h:939
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:226
static const WCHAR L[]
Definition: oid.c:1250
PRFSD_FCB RfsdFcb
Definition: rfsd.h:691
_Must_inspect_result_ _In_ PFLT_INSTANCE _Out_ PBOOLEAN IsDirectory
Definition: fltkernel.h:1139
#define RfsdPrint(arg)
Definition: rfsd.h:1069
ULONG Type
Definition: ntfs.h:95
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
#define FILE_ACTION_RENAMED_NEW_NAME
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
Definition: fsrtlfuncs.h:108
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define DBG_ERROR
Definition: ffsdrv.h:1031
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
struct _FILE_STANDARD_INFORMATION * PFILE_STANDARD_INFORMATION
ERESOURCE MainResource
Definition: ntfs.h:524
ULONG AlignmentRequirement
Definition: env_spec_w32.h:420
struct _FILE_NAME_INFORMATION * PFILE_NAME_INFORMATION
NTSTATUS RfsdExpandFile(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, PLARGE_INTEGER AllocationSize)
Definition: fileinfo.c:962
#define VCB_READ_ONLY
Definition: ext2fs.h:795
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
Definition: rfsd.h:325
Status
Definition: gdiplustypes.h:24
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:310
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
struct _FileName FileName
Definition: fatprocs.h:884
#define SetFlag(_F, _SF)
Definition: ext2fs.h:187
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
_SEH2_END
Definition: create.c:4424
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
unsigned short USHORT
Definition: pedump.c:61
#define FO_CLEANUP_COMPLETE
Definition: iotypes.h:1747
#define FO_TEMPORARY_FILE
Definition: iotypes.h:1748
#define FILE_NOTIFY_CHANGE_ATTRIBUTES
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
VOID NTAPI CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
Definition: fssup.c:354
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:334
NTSTATUS RfsdRemoveEntry(IN PRFSD_IRP_CONTEXT IrpContext, IN PRFSD_VCB Vcb, IN PRFSD_FCB Dcb, IN ULONG FileType, IN ULONG Inode)
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
_SEH2_FINALLY
Definition: create.c:4395
struct _FILE_NETWORK_OPEN_INFORMATION * PFILE_NETWORK_OPEN_INFORMATION
#define FCB_PAGE_FILE
Definition: ext2fs.h:872
#define IRP_PAGING_IO
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
#define FILE_ACTION_ADDED
#define FileStandardInformation
Definition: propsheet.cpp:61
#define FCB_FILE_DELETED
Definition: ffsdrv.h:635
struct _FILE_ATTRIBUTE_TAG_INFORMATION * PFILE_ATTRIBUTE_TAG_INFORMATION
NTSTATUS RfsdTruncateFile(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb, PLARGE_INTEGER AllocationSize)
Definition: fileinfo.c:989
_In_ PUNICODE_STRING NewName
Definition: zwfuncs.h:1203
struct _FILE_POSITION_INFORMATION * PFILE_POSITION_INFORMATION
VOID RfsdAddMcbNode(PRFSD_VCB Vcb, PRFSD_MCB Parent, PRFSD_MCB Child)
Definition: memory.c:1023
#define STATUS_DISK_FULL
Definition: udferr_usr.h:155
__u32 i_atime
Definition: reiserfs.h:235
unsigned int ULONG
Definition: retypes.h:1
ERESOURCE PagingIoResource
Definition: ntfs.h:523
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
PVCB Vcb
Definition: cdstruc.h:939
#define DbgBreak()
Definition: ext2fs.h:46
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
#define DBG_INFO
Definition: ffsdrv.h:1034
#define _SEH2_LEAVE
Definition: filesup.c:20
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
_In_ PFCB Fcb
Definition: cdprocs.h:151
NTSTATUS RfsdSetRenameInfo(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, PRFSD_FCB Fcb)
Definition: fileinfo.c:1067
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define RfsdSetWritable(m)
Definition: rfsd.h:292
#define FILE_NOTIFY_CHANGE_LAST_ACCESS
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1114
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB * Dcb
Definition: create.c:4157
struct _FILE_ATTRIBUTE_TAG_INFORMATION FILE_ATTRIBUTE_TAG_INFORMATION
ULONG Size
Definition: ntfs.h:96
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
_In_opt_ HANDLE _In_opt_ PIO_APC_ROUTINE _In_opt_ PVOID _Out_ PIO_STATUS_BLOCK _In_ ULONG NotifyFilter
Definition: zwfuncs.h:500
BOOLEAN RfsdFreeInode(PRFSD_IRP_CONTEXT IrpContext, PRFSD_VCB Vcb, ULONG Inode, ULONG Type)
LONGLONG QuadPart
Definition: typedefs.h:112
#define FILE_BASIC_INFORMATION
Definition: disk.h:53