ReactOS  0.4.13-dev-257-gfabbd7c
create.c
Go to the documentation of this file.
1 /*
2  * FFS File System Driver for Windows
3  *
4  * create.c
5  *
6  * 2004.5.6 ~
7  *
8  * Lee Jae-Hong, http://www.pyrasis.com
9  *
10  * See License.txt
11  *
12  */
13 
14 #include "ntifs.h"
15 #include "ffsdrv.h"
16 
17 /* Globals */
18 
19 extern PFFS_GLOBAL FFSGlobal;
20 
21 /* Definitions */
22 
23 #ifdef ALLOC_PRAGMA
24 #pragma alloc_text(PAGE, FFSv1LookupFileName)
25 #pragma alloc_text(PAGE, FFSv2LookupFileName)
26 #pragma alloc_text(PAGE, FFSSearchFcbList)
27 #pragma alloc_text(PAGE, FFSv1ScanDir)
28 #pragma alloc_text(PAGE, FFSv2ScanDir)
29 #pragma alloc_text(PAGE, FFSCreateFile)
30 #pragma alloc_text(PAGE, FFSCreateVolume)
31 #pragma alloc_text(PAGE, FFSCreate)
32 #pragma alloc_text(PAGE, FFSCreateInode)
33 #pragma alloc_text(PAGE, FFSSupersedeOrOverWriteFile)
34 #endif
35 
36 
39  IN PFFS_VCB Vcb,
40  IN PUNICODE_STRING FullFileName,
41  IN PFFS_MCB ParentMcb,
42  OUT PFFS_MCB* FFSMcb,
43  IN OUT PFFSv1_INODE dinode1)
44 {
47  PFFS_MCB Mcb = 0;
48 
49  FFS_DIR_ENTRY ffs_dir;
50  int i = 0;
51  BOOLEAN bRun = TRUE;
52  BOOLEAN bParent = FALSE;
54  ULONG off = 0;
55 
56  PAGED_CODE();
57 
59 
60  *FFSMcb = NULL;
61 
62  if (ParentMcb)
63  {
64  bParent = TRUE;
65  }
66  else if (FullFileName->Buffer[0] == L'\\')
67  {
68  ParentMcb = Vcb->McbTree;
69  }
70  else
71  {
73  }
74 
75  RtlZeroMemory(&ffs_dir, sizeof(FFS_DIR_ENTRY));
76 
77  if (FullFileName->Length == 0)
78  {
79  return Status;
80  }
81 
82  if (FullFileName->Length == 2 && FullFileName->Buffer[0] == L'\\')
83  {
84  if (!FFSv1LoadInode(Vcb, ParentMcb->Inode, dinode1))
85  {
86  return Status;
87  }
88 
89  *FFSMcb = Vcb->McbTree;
90 
91  return STATUS_SUCCESS;
92  }
93 
94  while (bRun && i < FullFileName->Length / 2)
95  {
96  int Length;
98 
99  if (bParent)
100  {
101  bParent = FALSE;
102  }
103  else
104  {
105  while(i < FullFileName->Length / 2 && FullFileName->Buffer[i] == L'\\') i++;
106  }
107 
108  Length = i;
109 
110  while(i < FullFileName->Length / 2 && (FullFileName->Buffer[i] != L'\\')) i++;
111 
112  if (i - Length > 0)
113  {
114  FileName = *FullFileName;
115  FileName.Buffer += Length;
116  FileName.Length = (USHORT)((i - Length) * 2);
117 
118  Mcb = FFSSearchMcb(Vcb, ParentMcb, &FileName);
119 
120  if (Mcb)
121  {
122  ParentMcb = Mcb;
123 
125 
126  if (!IsFlagOn(Mcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY))
127  {
128  if (i < FullFileName->Length / 2)
129  {
131  }
132 
133  break;
134  }
135  }
136  else
137  {
138  if (!FFSv1LoadInode(Vcb, ParentMcb->Inode, &in))
139  {
141  break;
142  }
143 
144  if ((in.di_mode & IFMT) != IFDIR)
145  {
146  if (i < FullFileName->Length / 2)
147  {
149  }
150  break;
151  }
152 
154  Vcb,
155  ParentMcb,
156  &FileName,
157  &off,
158  &in,
159  &ffs_dir);
160 
161  if (!NT_SUCCESS(Status))
162  {
163  bRun = FALSE;
164  /*
165  if (i >= FullFileName->Length/2)
166  {
167  *FFSMcb = ParentMcb;
168  }
169  */
170  }
171  else
172  {
173 #if 0
174  if (IsFlagOn(SUPER_BLOCK->s_feature_incompat,
175  FFS_FEATURE_INCOMPAT_FILETYPE))
176  {
177  if (ffs_dir.d_type == FFS_FT_DIR)
179  }
180  else
181 #endif
182  {
183  if (!FFSv1LoadInode(Vcb, ffs_dir.d_ino, &in))
184  {
186  break;
187  }
188 
189  if ((in.di_mode & IFMT) == IFDIR)
190  {
192  }
193  }
194 
195  SetFlag(ParentMcb->Flags, MCB_IN_USE);
197  ClearFlag(ParentMcb->Flags, MCB_IN_USE);
198 
199  if (!Mcb)
200  {
202  break;
203  }
204 
205  Mcb->Inode = ffs_dir.d_ino;
206  Mcb->DeOffset = off;
207  FFSAddMcbNode(Vcb, ParentMcb, Mcb);
208  ParentMcb = Mcb;
209  }
210  }
211  }
212  else
213  {
214  break;
215  }
216  }
217 
218  if (NT_SUCCESS(Status))
219  {
220  *FFSMcb = Mcb;
221  if (dinode1)
222  {
223  if (!FFSv1LoadInode(Vcb, Mcb->Inode, dinode1))
224  {
225  FFSPrint((DBG_ERROR, "FFSv1LookupFileName: error loading Inode %xh\n",
226  Mcb->Inode));
228  }
229  }
230  }
231 
232  return Status;
233 }
234 
235 
236 NTSTATUS
238  IN PFFS_VCB Vcb,
239  IN PUNICODE_STRING FullFileName,
240  IN PFFS_MCB ParentMcb,
241  OUT PFFS_MCB* FFSMcb,
242  IN OUT PFFSv2_INODE dinode2)
243 {
246  PFFS_MCB Mcb = 0;
247 
248  FFS_DIR_ENTRY ffs_dir;
249  int i = 0;
250  BOOLEAN bRun = TRUE;
251  BOOLEAN bParent = FALSE;
252  FFSv2_INODE in;
253  ULONG off = 0;
254 
255  PAGED_CODE();
256 
258 
259  *FFSMcb = NULL;
260 
261  if (ParentMcb)
262  {
263  bParent = TRUE;
264  }
265  else if (FullFileName->Buffer[0] == L'\\')
266  {
267  ParentMcb = Vcb->McbTree;
268  }
269  else
270  {
272  }
273 
274  RtlZeroMemory(&ffs_dir, sizeof(FFS_DIR_ENTRY));
275 
276  if (FullFileName->Length == 0)
277  {
278  return Status;
279  }
280 
281  if (FullFileName->Length == 2 && FullFileName->Buffer[0] == L'\\')
282  {
283  if (!FFSv2LoadInode(Vcb, ParentMcb->Inode, dinode2))
284  {
285  return Status;
286  }
287 
288  *FFSMcb = Vcb->McbTree;
289 
290  return STATUS_SUCCESS;
291  }
292 
293  while (bRun && i < FullFileName->Length / 2)
294  {
295  int Length;
297 
298  if (bParent)
299  {
300  bParent = FALSE;
301  }
302  else
303  {
304  while(i < FullFileName->Length / 2 && FullFileName->Buffer[i] == L'\\') i++;
305  }
306 
307  Length = i;
308 
309  while(i < FullFileName->Length / 2 && (FullFileName->Buffer[i] != L'\\')) i++;
310 
311  if (i - Length > 0)
312  {
313  FileName = *FullFileName;
314  FileName.Buffer += Length;
315  FileName.Length = (USHORT)((i - Length) * 2);
316 
317  Mcb = FFSSearchMcb(Vcb, ParentMcb, &FileName);
318 
319  if (Mcb)
320  {
321  ParentMcb = Mcb;
322 
324 
325  if (!IsFlagOn(Mcb->FileAttr, FILE_ATTRIBUTE_DIRECTORY))
326  {
327  if (i < FullFileName->Length / 2)
328  {
330  }
331 
332  break;
333  }
334  }
335  else
336  {
337  if (!FFSv2LoadInode(Vcb, ParentMcb->Inode, &in))
338  {
340  break;
341  }
342 
343  if ((in.di_mode & IFMT) != IFDIR)
344  {
345  if (i < FullFileName->Length / 2)
346  {
348  }
349  break;
350  }
351 
353  Vcb,
354  ParentMcb,
355  &FileName,
356  &off,
357  &in,
358  &ffs_dir);
359 
360  if (!NT_SUCCESS(Status))
361  {
362  bRun = FALSE;
363  /*
364  if (i >= FullFileName->Length/2)
365  {
366  *FFSMcb = ParentMcb;
367  }
368  */
369  }
370  else
371  {
372 #if 0
373  if (IsFlagOn(SUPER_BLOCK->s_feature_incompat,
374  FFS_FEATURE_INCOMPAT_FILETYPE))
375  {
376  if (ffs_dir.d_type == FFS_FT_DIR)
378  }
379  else
380 #endif
381  {
382  if (!FFSv2LoadInode(Vcb, ffs_dir.d_ino, &in))
383  {
385  break;
386  }
387 
388  if ((in.di_mode & IFMT) == IFDIR)
389  {
391  }
392  }
393 
394  SetFlag(ParentMcb->Flags, MCB_IN_USE);
396  ClearFlag(ParentMcb->Flags, MCB_IN_USE);
397 
398  if (!Mcb)
399  {
401  break;
402  }
403 
404  Mcb->Inode = ffs_dir.d_ino;
405  Mcb->DeOffset = off;
406  FFSAddMcbNode(Vcb, ParentMcb, Mcb);
407  ParentMcb = Mcb;
408  }
409  }
410  }
411  else
412  {
413  break;
414  }
415  }
416 
417  if (NT_SUCCESS(Status))
418  {
419  *FFSMcb = Mcb;
420  if (dinode2)
421  {
422  if (!FFSv2LoadInode(Vcb, Mcb->Inode, dinode2))
423  {
424  FFSPrint((DBG_ERROR, "FFSv2LookupFileName: error loading Inode %xh\n",
425  Mcb->Inode));
427  }
428  }
429  }
430 
431  return Status;
432 }
433 
434 
435 NTSTATUS
437  IN PFFS_VCB Vcb,
438  IN PFFS_MCB ParentMcb,
440  IN OUT PULONG Index,
441  IN PFFSv1_INODE dinode1,
442  IN OUT PFFS_DIR_ENTRY ffs_dir)
443 {
445  USHORT InodeFileNameLength;
446  UNICODE_STRING InodeFileName;
447 
448  PFFS_DIR_ENTRY pDir = NULL;
449  ULONG dwBytes = 0;
450  BOOLEAN bFound = FALSE;
451  LONGLONG Offset = 0;
452 #ifndef __REACTOS__
453  ULONG inode = ParentMcb->Inode;
454 #endif
455  ULONG dwRet;
456 
457  PAGED_CODE();
458 
459  _SEH2_TRY
460  {
461 
463  sizeof(FFS_DIR_ENTRY), FFS_POOL_TAG);
464  if (!pDir)
465  {
467  _SEH2_LEAVE;
468  }
469 
470  InodeFileName.Buffer = ExAllocatePoolWithTag(
471  PagedPool,
472  (FFS_NAME_LEN + 1) * 2, FFS_POOL_TAG);
473 
474  if (!InodeFileName.Buffer)
475  {
477  _SEH2_LEAVE;
478  }
479 
480  dwBytes = 0;
481 
482  while (!bFound && dwBytes < dinode1->di_size)
483  {
484  RtlZeroMemory(pDir, sizeof(FFS_DIR_ENTRY));
485 
486  // Reading the DCB contents
488  NULL,
489  Vcb,
490  dinode1,
491  dwBytes,
492  (PVOID)pDir,
493  sizeof(FFS_DIR_ENTRY),
494  &dwRet);
495 
496 
497  if (!NT_SUCCESS(Status))
498  {
499  FFSPrint((DBG_ERROR, "FFSv1ScanDir: Reading Directory Content error.\n"));
500  _SEH2_LEAVE;
501  }
502 
503  if (pDir->d_ino /*&& (pDir->d_ino < INODES_COUNT)*/)
504  {
506  OemName.Buffer = pDir->d_name;
507  OemName.Length = (pDir->d_namlen & 0xff);
508  OemName.MaximumLength = OemName.Length;
509 
510  InodeFileNameLength = (USHORT)
512 
513  InodeFileName.Length = 0;
514  InodeFileName.MaximumLength = (FFS_NAME_LEN + 1) * 2;
515 
516  RtlZeroMemory(InodeFileName.Buffer,
517  InodeFileNameLength + 2);
518 
520  &InodeFileName,
521  &OemName);
522 
523  if (!NT_SUCCESS(Status))
524  {
525  _SEH2_LEAVE;
526  }
527 
529  FileName,
530  &InodeFileName,
531  TRUE))
532  {
533  bFound = TRUE;
534  *Index = dwBytes;
535  RtlCopyMemory(ffs_dir, pDir, pDir->d_reclen > sizeof(FFS_DIR_ENTRY)
536  ? sizeof(FFS_DIR_ENTRY) : pDir->d_reclen);
538 
539  FFSPrint((DBG_INFO, "FFSv1ScanDir: Found: Name=%S Inode=%xh\n", InodeFileName.Buffer, pDir->d_ino));
540  }
541 
542  dwBytes +=pDir->d_reclen;
543  Offset = (LONGLONG)dwBytes;
544  }
545  else
546  {
547  if (pDir->d_ino == 0)
548  {
549  if (pDir->d_reclen == 0)
550  {
551  FFSBreakPoint();
552  break;
553  }
554  else
555  {
556  dwBytes +=pDir->d_reclen;
557  Offset = (LONGLONG)dwBytes;
558  }
559  }
560  else
561  {
562  break;
563  }
564  }
565  }
566 
567  if (!bFound)
568  {
570  }
571  }
572 
574  {
575  if (InodeFileName.Buffer != NULL)
576  {
577  ExFreePool(InodeFileName.Buffer);
578  }
579 
580  if (pDir)
581  ExFreePool(pDir);
582  } _SEH2_END;
583 
584  return Status;
585 }
586 
587 
588 NTSTATUS
590  IN PFFS_VCB Vcb,
591  IN PFFS_MCB ParentMcb,
593  IN OUT PULONG Index,
594  IN PFFSv2_INODE dinode2,
595  IN OUT PFFS_DIR_ENTRY ffs_dir)
596 {
598  USHORT InodeFileNameLength;
599  UNICODE_STRING InodeFileName;
600 
601  PFFS_DIR_ENTRY pDir = NULL;
602  ULONG dwBytes = 0;
603  BOOLEAN bFound = FALSE;
604  LONGLONG Offset = 0;
605 #ifndef __REACTOS__
606  ULONG inode = ParentMcb->Inode;
607 #endif
608  ULONG dwRet;
609 
610  PAGED_CODE();
611 
612  _SEH2_TRY
613  {
614 
616  sizeof(FFS_DIR_ENTRY), FFS_POOL_TAG);
617  if (!pDir)
618  {
620  _SEH2_LEAVE;
621  }
622 
623  InodeFileName.Buffer = ExAllocatePoolWithTag(
624  PagedPool,
625  (FFS_NAME_LEN + 1) * 2, FFS_POOL_TAG);
626 
627  if (!InodeFileName.Buffer)
628  {
630  _SEH2_LEAVE;
631  }
632 
633  dwBytes = 0;
634 
635  while (!bFound && dwBytes < dinode2->di_size)
636  {
637  RtlZeroMemory(pDir, sizeof(FFS_DIR_ENTRY));
638 
639  // Reading the DCB contents
641  NULL,
642  Vcb,
643  dinode2,
644  dwBytes,
645  (PVOID)pDir,
646  sizeof(FFS_DIR_ENTRY),
647  &dwRet);
648 
649 
650  if (!NT_SUCCESS(Status))
651  {
652  FFSPrint((DBG_ERROR, "FFSv2ScanDir: Reading Directory Content error.\n"));
653  _SEH2_LEAVE;
654  }
655 
656  if (pDir->d_ino /*&& (pDir->d_ino < INODES_COUNT)*/)
657  {
659  OemName.Buffer = pDir->d_name;
660  OemName.Length = (pDir->d_namlen & 0xff);
661  OemName.MaximumLength = OemName.Length;
662 
663  InodeFileNameLength = (USHORT)
665 
666  InodeFileName.Length = 0;
667  InodeFileName.MaximumLength = (FFS_NAME_LEN + 1) * 2;
668 
669  RtlZeroMemory(InodeFileName.Buffer,
670  InodeFileNameLength + 2);
671 
673  &InodeFileName,
674  &OemName);
675 
676  if (!NT_SUCCESS(Status))
677  {
678  _SEH2_LEAVE;
679  }
680 
682  FileName,
683  &InodeFileName,
684  TRUE))
685  {
686  bFound = TRUE;
687  *Index = dwBytes;
688  RtlCopyMemory(ffs_dir, pDir, pDir->d_reclen > sizeof(FFS_DIR_ENTRY)
689  ? sizeof(FFS_DIR_ENTRY) : pDir->d_reclen);
691 
692  FFSPrint((DBG_VITAL, "FFSv2ScanDir: Found: Name=%S Inode=%xh\n", InodeFileName.Buffer, pDir->d_ino));
693  }
694 
695  dwBytes +=pDir->d_reclen;
696  Offset = (LONGLONG)dwBytes;
697  }
698  else
699  {
700  if (pDir->d_ino == 0)
701  {
702  if (pDir->d_reclen == 0)
703  {
704  FFSBreakPoint();
705  break;
706  }
707  else
708  {
709  dwBytes +=pDir->d_reclen;
710  Offset = (LONGLONG)dwBytes;
711  }
712  }
713  else
714  {
715  break;
716  }
717  }
718  }
719 
720  if (!bFound)
721  {
723  }
724  }
725 
727  {
728  if (InodeFileName.Buffer != NULL)
729  {
730  ExFreePool(InodeFileName.Buffer);
731  }
732 
733  if (pDir)
734  ExFreePool(pDir);
735  } _SEH2_END;
736 
737  return Status;
738 }
739 
740 
741 /*
742 PFFS_FCB
743 FFSSearchFcbList(
744  IN PFFS_VCB Vcb,
745  IN ULONG inode)
746 {
747  BOOLEAN bFound = FALSE;
748  PLIST_ENTRY Link;
749  PFFS_FCB TmpFcb;
750 
751  Link = Vcb->FcbList.Flink;
752 
753  while (!bFound && Link != &Vcb->FcbList)
754  {
755  TmpFcb = CONTAINING_RECORD(Link, FFS_FCB, Next);
756 
757  if (TmpFcb && TmpFcb->Identifier.Type == FCB)
758  {
759 #if DBG
760  FFSPrint((DBG_INFO, "FFSSearchFcbList: [%s,%xh]\n",
761  TmpFcb->AnsiFileName.Buffer, TmpFcb->Inode));
762 #endif
763  if (TmpFcb->Inode == inode)
764  {
765  FFSPrint((DBG_INFO, "FFSSearchMcb: Found FCB for %xh.\n", inode));
766  bFound = TRUE;
767  }
768  }
769  Link = Link->Flink;
770  }
771 
772  if (bFound)
773  return TmpFcb;
774  else
775  return NULL;
776 
777 }
778 */
779 
781 NTSTATUS
783  PFFS_IRP_CONTEXT IrpContext,
784  PFFS_VCB Vcb)
785 {
788  PFFS_FCB Fcb = NULL;
789  PFFS_MCB FFSMcb = NULL;
790 
792  PFFS_MCB ParentMcb = NULL;
793 
794  BOOLEAN bParentFcbCreated = FALSE;
795 
796  PFFS_CCB Ccb = NULL;
797  PFFSv1_INODE dinode1 = 0;
798  PFFSv2_INODE dinode2 = 0;
799  BOOLEAN VcbResourceAcquired = FALSE;
800 #ifndef __REACTOS__
801  BOOLEAN bDir = FALSE;
802 #endif
803  BOOLEAN bFcbAllocated = FALSE;
804  BOOLEAN bCreated = FALSE;
806  PIRP Irp;
807 
808  ULONG Options;
810 
812  BOOLEAN OpenTargetDirectory;
814  BOOLEAN SequentialOnly;
815  BOOLEAN NoIntermediateBuffering;
816  BOOLEAN IsPagingFile;
818  BOOLEAN NonDirectoryFile;
821  BOOLEAN TemporaryFile;
822  BOOLEAN CaseSensitive;
823 
826 
827  PAGED_CODE();
828 
829  Irp = IrpContext->Irp;
831 
832  Options = IrpSp->Parameters.Create.Options;
833 
835  OpenTargetDirectory = IsFlagOn(IrpSp->Flags, SL_OPEN_TARGET_DIRECTORY);
836 
837  NonDirectoryFile = IsFlagOn(Options, FILE_NON_DIRECTORY_FILE);
838  SequentialOnly = IsFlagOn(Options, FILE_SEQUENTIAL_ONLY);
839  NoIntermediateBuffering = IsFlagOn(Options, FILE_NO_INTERMEDIATE_BUFFERING);
842 
843  CaseSensitive = IsFlagOn(IrpSp->Flags, SL_CASE_SENSITIVE);
844 
845  TemporaryFile = IsFlagOn(IrpSp->Parameters.Create.FileAttributes,
847 
848  CreateDisposition = (Options >> 24) & 0x000000ff;
849 
850  IsPagingFile = IsFlagOn(IrpSp->Flags, SL_OPEN_PAGING_FILE);
851 
855 
859 
860  DesiredAccess = IrpSp->Parameters.Create.SecurityContext->DesiredAccess;
861  ShareAccess = IrpSp->Parameters.Create.ShareAccess;
862 
863  FileName.Buffer = NULL;
864 
865  _SEH2_TRY
866  {
868  &Vcb->MainResource, TRUE);
869 
870  VcbResourceAcquired = TRUE;
871 
872  if (Irp->Overlay.AllocationSize.HighPart)
873  {
875  _SEH2_LEAVE;
876  }
877 
878  if (FS_VERSION == 1)
879  {
880  if (!(dinode1 = ExAllocatePoolWithTag(
881  PagedPool, DINODE1_SIZE, 'EInd')))
882  {
883  _SEH2_LEAVE;
884  }
885 
886  RtlZeroMemory(dinode1, sizeof(DINODE1_SIZE));
887  }
888  else
889  {
890  if (!(dinode2 = ExAllocatePoolWithTag(
891  PagedPool, DINODE2_SIZE, 'EInd')))
892  {
893  _SEH2_LEAVE;
894  }
895 
896  RtlZeroMemory(dinode2, sizeof(DINODE2_SIZE));
897  }
898 
899 
900  FileName.MaximumLength = IrpSp->FileObject->FileName.MaximumLength;
901  FileName.Length = IrpSp->FileObject->FileName.Length;
902 
904  if (!FileName.Buffer)
905  {
907  _SEH2_LEAVE;
908  }
909 
910  RtlZeroMemory(FileName.Buffer, FileName.MaximumLength);
911  RtlCopyMemory(FileName.Buffer, IrpSp->FileObject->FileName.Buffer, FileName.Length);
912 
913  if (IrpSp->FileObject->RelatedFileObject)
914  {
915  ParentFcb = (PFFS_FCB)(IrpSp->FileObject->RelatedFileObject->FsContext);
916  }
917 
918  if ((FileName.Length > sizeof(WCHAR)) &&
919  (FileName.Buffer[1] == L'\\') &&
920  (FileName.Buffer[0] == L'\\')) {
921 
922  FileName.Length -= sizeof(WCHAR);
923 
924  RtlMoveMemory(&FileName.Buffer[0],
925  &FileName.Buffer[1],
926  FileName.Length);
927 
928  //
929  // Bad Name if there are still beginning backslashes.
930  //
931 
932  if ((FileName.Length > sizeof(WCHAR)) &&
933  (FileName.Buffer[1] == L'\\') &&
934  (FileName.Buffer[0] == L'\\'))
935  {
936 
938 
939  _SEH2_LEAVE;
940  }
941  }
942 
944  {
946  _SEH2_LEAVE;
947  }
948 
949  FFSPrint((DBG_INFO, "FFSCreateFile: %S (NameLen=%xh) Paging=%xh Option: %xh.\n",
950  FileName.Buffer, FileName.Length, IsPagingFile, IrpSp->Parameters.Create.Options));
951 
952  if (ParentFcb)
953  {
954  ParentMcb = ParentFcb->FFSMcb;
955  }
956 
957  if (FS_VERSION == 1)
958  {
960  Vcb,
961  &FileName,
962  ParentMcb,
963  &FFSMcb,
964  dinode1);
965  }
966  else
967  {
969  Vcb,
970  &FileName,
971  ParentMcb,
972  &FFSMcb,
973  dinode2);
974  }
975 
976  if (!NT_SUCCESS(Status))
977  {
978  UNICODE_STRING PathName;
979  UNICODE_STRING RealName;
980  UNICODE_STRING RemainName;
981 #ifndef __REACTOS__
982  LONG i = 0;
983 #endif
984 
985  PathName = FileName;
986 
987  FFSPrint((DBG_INFO, "FFSCreateFile: File %S will be created.\n", PathName.Buffer));
988 
989  FFSMcb = NULL;
990 
991  if (PathName.Buffer[PathName.Length / 2 - 1] == L'\\')
992  {
993  if (DirectoryFile)
994  {
995  PathName.Length -= 2;
996  PathName.Buffer[PathName.Length / 2] = 0;
997  }
998  else
999  {
1001  _SEH2_LEAVE;
1002  }
1003  }
1004 
1005  if (!ParentMcb)
1006  {
1007  if (PathName.Buffer[0] != L'\\')
1008  {
1010  _SEH2_LEAVE;
1011  }
1012  else
1013  {
1014  ParentMcb = Vcb->McbTree;
1015  }
1016  }
1017 
1018 Dissecting:
1019 
1020  FsRtlDissectName(PathName, &RealName, &RemainName);
1021 
1022  if (((RemainName.Length != 0) && (RemainName.Buffer[0] == L'\\')) ||
1023  (RealName.Length >= 256 * sizeof(WCHAR)))
1024  {
1026  _SEH2_LEAVE;
1027  }
1028 
1029  if (RemainName.Length != 0)
1030  {
1031  PFFS_MCB RetMcb;
1032 
1033  if (FS_VERSION == 1)
1034  {
1036  Vcb,
1037  &RealName,
1038  ParentMcb,
1039  &RetMcb,
1040  dinode1);
1041  }
1042  else
1043  {
1045  Vcb,
1046  &RealName,
1047  ParentMcb,
1048  &RetMcb,
1049  dinode2);
1050  }
1051 
1052  if (!NT_SUCCESS(Status))
1053  {
1055  _SEH2_LEAVE;
1056  }
1057 
1058  ParentMcb = RetMcb;
1059  PathName = RemainName;
1060 
1061  goto Dissecting;
1062  }
1063 
1064  if (FsRtlDoesNameContainWildCards(&RealName))
1065  {
1067  _SEH2_LEAVE;
1068  }
1069 
1070  ParentFcb = ParentMcb->FFSFcb;
1071 
1072  if (!ParentFcb)
1073  {
1074  if (FS_VERSION == 1)
1075  {
1078  if (!pTmpInode)
1079  {
1081  _SEH2_LEAVE;
1082  }
1083 
1084  if(!FFSv1LoadInode(Vcb, ParentMcb->Inode, pTmpInode))
1085  {
1087  _SEH2_LEAVE;
1088  }
1089 
1090  ParentFcb = FFSv1AllocateFcb(Vcb, ParentMcb, pTmpInode);
1091 
1092  if (!ParentFcb)
1093  {
1094  ExFreePool(pTmpInode);
1096  _SEH2_LEAVE;
1097  }
1098  }
1099  else
1100  {
1103  if (!pTmpInode)
1104  {
1106  _SEH2_LEAVE;
1107  }
1108 
1109  if(!FFSv2LoadInode(Vcb, ParentMcb->Inode, pTmpInode))
1110  {
1112  _SEH2_LEAVE;
1113  }
1114 
1115  ParentFcb = FFSv2AllocateFcb(Vcb, ParentMcb, pTmpInode);
1116 
1117  if (!ParentFcb)
1118  {
1119  ExFreePool(pTmpInode);
1121  _SEH2_LEAVE;
1122  }
1123  }
1124 
1125  bParentFcbCreated = TRUE;
1126  ParentFcb->ReferenceCount++;
1127  }
1128 
1129  // We need to create a new one ?
1130  if ((CreateDisposition == FILE_CREATE) ||
1133  {
1134 #if FFS_READ_ONLY
1136  _SEH2_LEAVE;
1137 #else // !FFS_READ_ONLY
1139  {
1141  _SEH2_LEAVE;
1142  }
1143 
1145  {
1146  IoSetHardErrorOrVerifyDevice(IrpContext->Irp,
1147  Vcb->Vpb->RealDevice);
1149 
1151  }
1152 
1153  if (DirectoryFile)
1154  {
1155  if (TemporaryFile)
1156  {
1158  _SEH2_LEAVE;
1159  }
1160  }
1161 
1162  if (!ParentFcb)
1163  {
1165  _SEH2_LEAVE;
1166  }
1167 
1168  if (DirectoryFile)
1169  {
1170  if (ParentFcb->FFSMcb->Inode == FFS_ROOT_INO)
1171  {
1172  if ((RealName.Length == 0x10) &&
1173  memcmp(RealName.Buffer, L"Recycled\0", 0x10) == 0)
1174  {
1175  SetFlag(IrpSp->Parameters.Create.FileAttributes,
1177  }
1178  }
1179 
1181  IrpContext,
1182  Vcb,
1183  ParentFcb,
1184  DT_DIR,
1185  IrpSp->Parameters.Create.FileAttributes,
1186  &RealName);
1187  }
1188  else
1189  {
1191  IrpContext,
1192  Vcb,
1193  ParentFcb,
1194  DT_REG,
1195  IrpSp->Parameters.Create.FileAttributes,
1196  &RealName);
1197  }
1198 
1199  if (NT_SUCCESS(Status))
1200  {
1201  bCreated = TRUE;
1202 
1203  Irp->IoStatus.Information = FILE_CREATED;
1204 
1205  if (FS_VERSION == 1)
1206  {
1208  Vcb,
1209  &RealName,
1210  ParentMcb,
1211  &FFSMcb,
1212  dinode1);
1213  }
1214  else
1215  {
1217  Vcb,
1218  &RealName,
1219  ParentMcb,
1220  &FFSMcb,
1221  dinode2);
1222  }
1223 
1224  if (NT_SUCCESS(Status))
1225  {
1226  if (DirectoryFile)
1227  {
1229  IrpContext,
1230  Vcb,
1231  ParentFcb,
1234  }
1235  else
1236  {
1238  IrpContext,
1239  Vcb,
1240  ParentFcb,
1243  }
1244  }
1245  else
1246  {
1247  FFSBreakPoint();
1248  }
1249  }
1250  else
1251  {
1252  FFSBreakPoint();
1253  }
1254 #endif // !FFS_READ_ONLY
1255  }
1256  else if (OpenTargetDirectory)
1257  {
1259  {
1261  _SEH2_LEAVE;
1262  }
1263 
1264  if (!ParentFcb)
1265  {
1267  _SEH2_LEAVE;
1268  }
1269 
1270  RtlZeroMemory(IrpSp->FileObject->FileName.Buffer,
1271  IrpSp->FileObject->FileName.MaximumLength);
1272  IrpSp->FileObject->FileName.Length = RealName.Length;
1273 
1274  RtlCopyMemory(IrpSp->FileObject->FileName.Buffer,
1275  RealName.Buffer,
1276  RealName.Length);
1277 
1278  Fcb = ParentFcb;
1279 
1280  Irp->IoStatus.Information = FILE_DOES_NOT_EXIST;
1282  }
1283  else
1284  {
1286  _SEH2_LEAVE;
1287  }
1288  }
1289  else // File / Dir already exists.
1290  {
1291  if (OpenTargetDirectory)
1292  {
1294  {
1296  _SEH2_LEAVE;
1297  }
1298 
1299  Irp->IoStatus.Information = FILE_EXISTS;
1301 
1302  RtlZeroMemory(IrpSp->FileObject->FileName.Buffer,
1303  IrpSp->FileObject->FileName.MaximumLength);
1304  IrpSp->FileObject->FileName.Length = FFSMcb->ShortName.Length;
1305 
1306  RtlCopyMemory(IrpSp->FileObject->FileName.Buffer,
1307  FFSMcb->ShortName.Buffer,
1308  FFSMcb->ShortName.Length);
1309 
1310  //Let Mcb pointer to it's parent
1311  FFSMcb = FFSMcb->Parent;
1312 
1313  goto Openit;
1314  }
1315 
1316  // We can not create if one exists
1318  {
1319  Irp->IoStatus.Information = FILE_EXISTS;
1321  _SEH2_LEAVE;
1322  }
1323 
1325  {
1326  if ((CreateDisposition != FILE_OPEN) &&
1328  {
1329 
1331  _SEH2_LEAVE;
1332  }
1333 
1334  if (NonDirectoryFile)
1335  {
1337  _SEH2_LEAVE;
1338  }
1339 
1340  if (FFSMcb->Inode == FFS_ROOT_INO)
1341  {
1342  if (DeleteOnClose)
1343  {
1345  _SEH2_LEAVE;
1346  }
1347 
1348  if (OpenTargetDirectory)
1349  {
1351  _SEH2_LEAVE;
1352  }
1353  }
1354  }
1355 
1356  Irp->IoStatus.Information = FILE_OPENED;
1357  }
1358 
1359 Openit:
1360 
1361  if (FFSMcb)
1362  {
1363  Fcb = FFSMcb->FFSFcb;
1364 
1365  if (!Fcb)
1366  {
1367  if (FS_VERSION == 1)
1368  {
1369  Fcb = FFSv1AllocateFcb(Vcb, FFSMcb, dinode1);
1370  bFcbAllocated = TRUE;
1371  }
1372  else
1373  {
1374  Fcb = FFSv2AllocateFcb(Vcb, FFSMcb, dinode2);
1375  bFcbAllocated = TRUE;
1376  }
1377  }
1378  }
1379 
1380  if (Fcb)
1381  {
1383  {
1385  _SEH2_LEAVE;
1386  }
1387 
1389  {
1391  _SEH2_LEAVE;
1392  }
1393 
1394  if (bCreated)
1395  {
1396 #if !FFS_READ_ONLY
1397  //
1398  // This file is just created.
1399  //
1400 
1401  if (DirectoryFile)
1402  {
1403  UNICODE_STRING EntryName;
1404  USHORT NameBuf[6];
1405 
1406  RtlZeroMemory(&NameBuf, 6 * sizeof(USHORT));
1407 
1408  EntryName.Length = EntryName.MaximumLength = 2;
1409  EntryName.Buffer = &NameBuf[0];
1410  NameBuf[0] = (USHORT)'.';
1411 
1412  FFSAddEntry(IrpContext, Vcb, Fcb,
1413  DT_DIR,
1414  Fcb->FFSMcb->Inode,
1415  &EntryName);
1416 
1417  if (FS_VERSION == 1)
1418  {
1419  FFSv1SaveInode(IrpContext, Vcb,
1420  Fcb->FFSMcb->Inode,
1421  Fcb->dinode1);
1422  }
1423  else
1424  {
1425  FFSv2SaveInode(IrpContext, Vcb,
1426  Fcb->FFSMcb->Inode,
1427  Fcb->dinode2);
1428  }
1429 
1430  EntryName.Length = EntryName.MaximumLength = 4;
1431  EntryName.Buffer = &NameBuf[0];
1432  NameBuf[0] = NameBuf[1] = (USHORT)'.';
1433 
1434  FFSAddEntry(IrpContext, Vcb, Fcb,
1435  DT_DIR,
1436  Fcb->FFSMcb->Parent->Inode,
1437  &EntryName);
1438 
1439  if (FS_VERSION == 1)
1440  {
1441  FFSv1SaveInode(IrpContext, Vcb,
1442  Fcb->FFSMcb->Inode,
1443  Fcb->dinode1);
1444  }
1445  else
1446  {
1447  FFSv2SaveInode(IrpContext, Vcb,
1448  Fcb->FFSMcb->Inode,
1449  Fcb->dinode2);
1450  }
1451  }
1452  else
1453  {
1454  if (!FFSExpandFile(
1455  IrpContext, Vcb, Fcb,
1456  &(Irp->Overlay.AllocationSize)))
1457  {
1459  _SEH2_LEAVE;
1460  }
1461  }
1462 #endif // !FFS_READ_ONLY
1463  }
1464  else
1465  {
1466  //
1467  // This file alreayd exists.
1468  //
1469 
1470  if (DeleteOnClose)
1471  {
1473  {
1475  _SEH2_LEAVE;
1476  }
1477 
1479  {
1481 
1482  IoSetHardErrorOrVerifyDevice(IrpContext->Irp,
1483  Vcb->Vpb->RealDevice);
1484 
1486 
1488  }
1489 
1491  }
1492  else
1493  {
1494  //
1495  // Just to Open file (Open/OverWrite ...)
1496  //
1497 
1498  if ((!IsDirectory(Fcb)) && (IsFlagOn(IrpSp->FileObject->Flags,
1500  {
1501  Fcb->Header.IsFastIoPossible = FastIoIsPossible;
1502 
1503  if (IsFlagOn(IrpSp->FileObject->Flags, FO_CACHE_SUPPORTED) &&
1504  (Fcb->SectionObject.DataSectionObject != NULL))
1505  {
1506  if (Fcb->NonCachedOpenCount == Fcb->OpenHandleCount)
1507  {
1508  /* IsFlagOn(FileObject->Flags, FO_FILE_MODIFIED) */
1509 
1511  {
1512  CcFlushCache(&Fcb->SectionObject, NULL, 0, NULL);
1514  }
1515 
1516  CcPurgeCacheSection(&Fcb->SectionObject,
1517  NULL,
1518  0,
1519  FALSE);
1520  }
1521  }
1522  }
1523  }
1524  }
1525 
1526  if (!IsDirectory(Fcb))
1527  {
1528  if (!IsFlagOn(Vcb->Flags, VCB_READ_ONLY))
1529  {
1530  if ((CreateDisposition == FILE_SUPERSEDE) && !IsPagingFile)
1531  {
1532  DesiredAccess |= DELETE;
1533  }
1534  else if (((CreateDisposition == FILE_OVERWRITE) ||
1535  (CreateDisposition == FILE_OVERWRITE_IF)) && !IsPagingFile)
1536  {
1539  }
1540  }
1541  }
1542 
1543  if (Fcb->OpenHandleCount > 0)
1544  {
1546  ShareAccess,
1547  IrpSp->FileObject,
1548  &(Fcb->ShareAccess),
1549  TRUE);
1550 
1551  if (!NT_SUCCESS(Status))
1552  {
1553  _SEH2_LEAVE;
1554  }
1555  }
1556  else
1557  {
1559  ShareAccess,
1560  IrpSp->FileObject,
1561  &(Fcb->ShareAccess));
1562  }
1563 
1564  Ccb = FFSAllocateCcb();
1565 
1566  Fcb->OpenHandleCount++;
1567  Fcb->ReferenceCount++;
1568 
1570  {
1571  Fcb->NonCachedOpenCount++;
1572  }
1573 
1574  Vcb->OpenFileHandleCount++;
1575  Vcb->ReferenceCount++;
1576 
1577  IrpSp->FileObject->FsContext = (void*)Fcb;
1578  IrpSp->FileObject->FsContext2 = (void*) Ccb;
1579  IrpSp->FileObject->PrivateCacheMap = NULL;
1580  IrpSp->FileObject->SectionObjectPointer = &(Fcb->SectionObject);
1581  IrpSp->FileObject->Vpb = Vcb->Vpb;
1582 
1584 
1585  FFSPrint((DBG_INFO, "FFSCreateFile: %s OpenCount: %u ReferCount: %u\n",
1586  Fcb->AnsiFileName.Buffer, Fcb->OpenHandleCount, Fcb->ReferenceCount));
1587 
1588  if (!IsDirectory(Fcb) && !NoIntermediateBuffering)
1589  {
1590  IrpSp->FileObject->Flags |= FO_CACHE_SUPPORTED;
1591  }
1592 
1593  if (!bCreated && !IsDirectory(Fcb))
1594  {
1595  if (DeleteOnClose ||
1599  {
1600  if (!MmFlushImageSection(&Fcb->SectionObject,
1601  MmFlushForWrite))
1602  {
1603 
1606  _SEH2_LEAVE;
1607  }
1608  }
1609 
1610  if ((CreateDisposition == FILE_SUPERSEDE) ||
1613  {
1614 #if FFS_READ_ONLY
1616  _SEH2_LEAVE;
1617 #else // !FFS_READ_ONLY
1618  BOOLEAN bRet;
1619 
1621  {
1623  _SEH2_LEAVE;
1624  }
1625 
1627  {
1628  IoSetHardErrorOrVerifyDevice(IrpContext->Irp,
1629  Vcb->Vpb->RealDevice);
1631 
1633  }
1634 
1635  Status = FFSSupersedeOrOverWriteFile(IrpContext,
1636  Vcb,
1637  Fcb,
1639 
1640  if (NT_SUCCESS(Status))
1641  {
1642  _SEH2_LEAVE;
1643  }
1644 
1645  bRet = FFSExpandFile(IrpContext,
1646  Vcb,
1647  Fcb,
1648  &(Irp->Overlay.AllocationSize));
1649 
1650  if (!bRet)
1651  {
1653  _SEH2_LEAVE;
1654  }
1655 
1657  IrpContext,
1658  Vcb,
1659  Fcb,
1664 
1665 
1667  {
1668  Irp->IoStatus.Information = FILE_SUPERSEDED;
1669  }
1670  else
1671  {
1672  Irp->IoStatus.Information = FILE_OVERWRITTEN;
1673  }
1674 #endif // !FFS_READ_ONLY
1675  }
1676  }
1677  }
1678  }
1679 
1681  {
1682  if (FileName.Buffer)
1683  ExFreePool(FileName.Buffer);
1684 
1685  if (bParentFcbCreated)
1686  {
1687  ParentFcb->ReferenceCount--;
1688  }
1689 
1690  if (VcbResourceAcquired)
1691  {
1693  &Vcb->MainResource,
1695  }
1696 
1697  if (!bFcbAllocated)
1698  {
1699  if (FS_VERSION == 1)
1700  {
1701  if (dinode1)
1702  ExFreePool(dinode1);
1703  }
1704  else
1705  {
1706  if (dinode2)
1707  ExFreePool(dinode2);
1708  }
1709  }
1710  else
1711  {
1712  if (FS_VERSION == 1)
1713  {
1714  if (!Fcb && dinode1)
1715  ExFreePool(dinode1);
1716  }
1717  else
1718  {
1719  if (!Fcb && dinode2)
1720  ExFreePool(dinode2);
1721  }
1722  }
1723  } _SEH2_END;
1724 
1725  return Status;
1726 }
1727 
1728 
1730 NTSTATUS
1732  PFFS_IRP_CONTEXT IrpContext,
1733  PFFS_VCB Vcb)
1734 {
1736  PIRP Irp;
1737 
1738  NTSTATUS Status;
1739 
1742 
1743  ULONG Options;
1745  BOOLEAN OpenTargetDirectory;
1746 
1748 
1749  PAGED_CODE();
1750 
1751  Irp = IrpContext->Irp;
1753 
1754  Options = IrpSp->Parameters.Create.Options;
1755 
1757  OpenTargetDirectory = IsFlagOn(IrpSp->Flags, SL_OPEN_TARGET_DIRECTORY);
1758 
1759  CreateDisposition = (Options >> 24) & 0x000000ff;
1760 
1761  DesiredAccess = IrpSp->Parameters.Create.SecurityContext->DesiredAccess;
1762  ShareAccess = IrpSp->Parameters.Create.ShareAccess;
1763 
1764  if (DirectoryFile)
1765  {
1766  return STATUS_NOT_A_DIRECTORY;
1767  }
1768 
1769  if (OpenTargetDirectory)
1770  {
1771  return STATUS_INVALID_PARAMETER;
1772  }
1773 
1774  if ((CreateDisposition != FILE_OPEN) &&
1776  {
1777  return STATUS_ACCESS_DENIED;
1778  }
1779 
1781 
1782  if (Vcb->OpenHandleCount > 0)
1783  {
1785  IrpSp->FileObject,
1786  &(Vcb->ShareAccess), TRUE);
1787 
1788  if (!NT_SUCCESS(Status))
1789  {
1790  goto errorout;
1791  }
1792  }
1793  else
1794  {
1796  IrpSp->FileObject,
1797  &(Vcb->ShareAccess));
1798  }
1799 
1801  {
1802  ExAcquireResourceExclusiveLite(&Vcb->MainResource, TRUE);
1805  ExReleaseResourceLite(&Vcb->MainResource);
1806  }
1807 
1808  {
1810 
1811  if (Ccb == NULL)
1812  {
1814  goto errorout;
1815  }
1816 
1818  IrpSp->FileObject->FsContext = Vcb;
1819  IrpSp->FileObject->FsContext2 = Ccb;
1820 
1821  Vcb->ReferenceCount++;
1822  Vcb->OpenHandleCount++;
1823 
1824  Irp->IoStatus.Information = FILE_OPENED;
1825  }
1826 
1827 errorout:
1828 
1829  return Status;
1830 }
1831 
1832 
1834 NTSTATUS
1836  IN PFFS_IRP_CONTEXT IrpContext)
1837 {
1839  PIRP Irp;
1841  PFFS_VCB Vcb = 0;
1843  PFFS_FCBVCB Xcb = NULL;
1844 
1845  PAGED_CODE();
1846 
1847  DeviceObject = IrpContext->DeviceObject;
1848 
1850 
1851 #if 0
1852  /* 드라이버가 로드 되었는지 검사할 때 마운트가 되어 있지 않은
1853  경우도 있기 때문에 멈추면 안됨. */
1854  ASSERT(IsMounted(Vcb));
1855 #endif
1856 
1857  Irp = IrpContext->Irp;
1858 
1860 
1861  Xcb = (PFFS_FCBVCB)(IrpSp->FileObject->FsContext);
1862 
1864  {
1865  FFSPrint((DBG_INFO, "FFSCreate: Create on main device object.\n"));
1866 
1868 
1869  Irp->IoStatus.Information = FILE_OPENED;
1870 
1871  FFSUnpinRepinnedBcbs(IrpContext);
1872 
1873  FFSCompleteIrpContext(IrpContext, Status);
1874 
1875  return Status;
1876 
1877  }
1878 
1879  _SEH2_TRY
1880  {
1882  {
1884 
1886  {
1888  }
1889 
1890  _SEH2_LEAVE;
1891  }
1892 
1893  if (((IrpSp->FileObject->FileName.Length == 0) &&
1894  (IrpSp->FileObject->RelatedFileObject == NULL)) ||
1895  (Xcb && Xcb->Identifier.Type == FFSVCB))
1896  {
1897  Status = FFSCreateVolume(IrpContext, Vcb);
1898  }
1899  else
1900  {
1901  Status = FFSCreateFile(IrpContext, Vcb);
1902  }
1903  }
1904 
1906  {
1907 
1908  if (!IrpContext->ExceptionInProgress)
1909  {
1910  FFSUnpinRepinnedBcbs(IrpContext);
1911 
1912  FFSCompleteIrpContext(IrpContext, Status);
1913  }
1914  } _SEH2_END;
1915 
1916  return Status;
1917 }
1918 
1919 #if !FFS_READ_ONLY
1920 
1922 NTSTATUS
1924  PFFS_IRP_CONTEXT IrpContext,
1925  PFFS_VCB Vcb,
1927  ULONG Type,
1928  ULONG FileAttr,
1930 {
1931  NTSTATUS Status;
1932  ULONG Inode;
1933  ULONG Group;
1934 
1935  FFSv1_INODE dinode1;
1936 
1937  PAGED_CODE();
1938 
1939  RtlZeroMemory(&dinode1, DINODE1_SIZE);
1940 
1941  Group = (ParentFcb->FFSMcb->Inode - 1) / BLOCKS_PER_GROUP;
1942 
1943  FFSPrint((DBG_INFO,
1944  "FFSCreateInode: %S in %S(Inode=%xh)\n",
1945  FileName->Buffer,
1946  ParentFcb->FFSMcb->ShortName.Buffer,
1947  ParentFcb->FFSMcb->Inode));
1948 
1949  Status = FFSNewInode(IrpContext, Vcb, Group,Type, &Inode);
1950 
1951  if (!NT_SUCCESS(Status))
1952  {
1953  goto errorout;
1954  }
1955 
1956  Status = FFSAddEntry(IrpContext, Vcb, ParentFcb, Type, Inode, FileName);
1957 
1958  if (!NT_SUCCESS(Status))
1959  {
1960  FFSBreakPoint();
1961  FFSFreeInode(IrpContext, Vcb, Inode, Type);
1962 
1963  goto errorout;
1964  }
1965 
1966  FFSv1SaveInode(IrpContext, Vcb, ParentFcb->FFSMcb->Inode, ParentFcb->dinode1);
1967 
1968  dinode1.di_ctime = ParentFcb->dinode1->di_mtime;
1969  dinode1.di_mode = 0x1FF;
1970 
1972  {
1973  FFSSetReadOnly(dinode1.di_mode);
1974  }
1975 
1976  if (Type == DT_DIR)
1977  {
1978  SetFlag(dinode1.di_mode, IFDIR);
1979 
1980  dinode1.di_nlink = 2;
1981  }
1982  else
1983  {
1984  dinode1.di_nlink = 1;
1985  SetFlag(dinode1.di_mode, IFLNK);
1986  }
1987 
1988  FFSv1SaveInode(IrpContext, Vcb, Inode, &dinode1);
1989 
1990  FFSPrint((DBG_INFO, "FFSCreateInode: New Inode = %xh (Type=%xh)\n", Inode, Type));
1991 
1992 errorout:
1993 
1994  return Status;
1995 }
1996 
1997 
1999 NTSTATUS
2001  IN PFFS_IRP_CONTEXT IrpContext,
2002  IN PFFS_VCB Vcb,
2003  IN PFFS_FCB Fcb,
2005 {
2006  LARGE_INTEGER CurrentTime;
2009 
2010  BOOLEAN bRet = FALSE;
2011 
2012  PAGED_CODE();
2013 
2014  KeQuerySystemTime(&CurrentTime);
2015 
2016  AllocationSize.QuadPart = (LONGLONG)0;
2017 
2018  if (!MmCanFileBeTruncated(&(Fcb->SectionObject), &(AllocationSize)))
2019  {
2021 
2022  return Status;
2023  }
2024 
2025  bRet = FFSTruncateFile(IrpContext, Vcb, Fcb, &AllocationSize);
2026 
2027  if (bRet)
2028  {
2029  Fcb->Header.AllocationSize.QuadPart =
2030  Fcb->Header.FileSize.QuadPart = (LONGLONG)0;
2031 
2032  Fcb->dinode1->di_size = 0;
2033 
2034  if (Disposition == FILE_SUPERSEDE)
2035  Fcb->dinode1->di_ctime = FFSInodeTime(CurrentTime);
2036 
2037  Fcb->dinode1->di_atime =
2038  Fcb->dinode1->di_mtime = FFSInodeTime(CurrentTime);
2039  }
2040  else
2041  {
2042  if (Fcb->dinode1->di_size > Fcb->Header.AllocationSize.LowPart)
2043  Fcb->dinode1->di_size = Fcb->Header.AllocationSize.LowPart;
2044 
2045  Fcb->Header.FileSize.QuadPart = (LONGLONG)Fcb->dinode1->di_size;
2046 
2048  }
2049 
2050  FFSv1SaveInode(IrpContext, Vcb, Fcb->FFSMcb->Inode, Fcb->dinode1);
2051 
2052  return Status;
2053 }
2054 
2055 #endif // !FFS_READ_ONLY
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
__drv_mustHoldCriticalRegion PFFS_FCB FFSv2AllocateFcb(IN PFFS_VCB Vcb, IN PFFS_MCB FFSMcb, IN PFFSv2_INODE dinode2)
Definition: memory.c:549
#define ExGetCurrentResourceThread()
Definition: env_spec_w32.h:633
BOOLEAN NTAPI MmCanFileBeTruncated(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN PLARGE_INTEGER NewFileSize)
Definition: section.c:4722
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:384
#define FILE_WRITE_EA
Definition: nt_native.h:640
#define IN
Definition: typedefs.h:38
#define STATUS_DELETE_PENDING
Definition: ntstatus.h:308
u_int16_t di_mode
Definition: dinode.h:81
#define FILE_EXISTS
Definition: nt_native.h:772
#define IsMounted(Vcb)
Definition: ext2fs.h:803
#define FILE_SEQUENTIAL_ONLY
Definition: from_kernel.h:27
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_FILE_IS_A_DIRECTORY
Definition: udferr_usr.h:164
__drv_mustHoldCriticalRegion PFFS_CCB FFSAllocateCcb(VOID)
Definition: memory.c:803
#define SL_CASE_SENSITIVE
Definition: iotypes.h:1776
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define FFS_ROOT_INO
Definition: ffsdrv.h:204
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
__drv_mustHoldCriticalRegion BOOLEAN FFSv2SaveInode(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN ULONG Inode, IN PFFSv2_INODE dinode2)
Definition: ffs.c:445
Definition: dir.h:83
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_OVERWRITTEN
Definition: nt_native.h:771
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Type
Definition: Type.h:6
#define FS_VERSION
Definition: ffsdrv.h:81
#define __drv_mustHoldCriticalRegion
Definition: ffsdrv.h:34
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
Definition: cachesub.c:222
#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
NTSTATUS FFSv1ReadInode(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN PFFSv1_INODE dinode1, IN ULONGLONG offset, IN PVOID Buffer, IN ULONG size, OUT PULONG dwRet)
Definition: read.c:496
Iosb Status
Definition: create.c:4311
#define FFS_NAME_LEN
Definition: ffsdrv.h:202
#define SL_OPEN_PAGING_FILE
Definition: iotypes.h:1773
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
BOOLEAN FFSv2LoadInode(IN PFFS_VCB Vcb, IN ULONG inode, IN PFFSv2_INODE dinode2)
Definition: ffs.c:336
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_OPENED
Definition: nt_native.h:769
__drv_mustHoldCriticalRegion NTSTATUS FFSCreateFile(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb)
Definition: create.c:782
#define FILE_SUPERSEDED
Definition: nt_native.h:768
#define DO_VERIFY_VOLUME
Definition: env_spec_w32.h:393
__drv_mustHoldCriticalRegion NTSTATUS FFSSupersedeOrOverWriteFile(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN PFFS_FCB Fcb, IN ULONG Disposition)
Definition: create.c:2000
#define FILE_NOTIFY_CHANGE_SIZE
int16_t di_nlink
Definition: dinode.h:82
#define FILE_NOTIFY_CHANGE_LAST_WRITE
#define FILE_OVERWRITE
Definition: from_kernel.h:57
#define FILE_NOTIFY_CHANGE_FILE_NAME
VOID NTAPI IoSetShareAccess(IN ACCESS_MASK DesiredAccess, IN ULONG DesiredShareAccess, IN PFILE_OBJECT FileObject, OUT PSHARE_ACCESS ShareAccess)
Definition: file.c:3516
#define FO_NO_INTERMEDIATE_BUFFERING
Definition: iotypes.h:1734
STRING OEM_STRING
Definition: umtypes.h:203
#define FILE_APPEND_DATA
Definition: nt_native.h:634
BOOLEAN FFSExpandFile(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb, PFFS_FCB Fcb, PLARGE_INTEGER AllocationSize)
Definition: fileinfo.c:1156
struct _FFS_FCB * PFFS_FCB
enum OPTION_FLAGS Options
Definition: stats.c:44
__drv_mustHoldCriticalRegion NTSTATUS FFSCreateVolume(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb)
Definition: create.c:1731
#define FILE_NOTIFY_CHANGE_DIR_NAME
NTSTATUS FFSv1LookupFileName(IN PFFS_VCB Vcb, IN PUNICODE_STRING FullFileName, IN PFFS_MCB ParentMcb, OUT PFFS_MCB *FFSMcb, IN OUT PFFSv1_INODE dinode1)
Definition: create.c:38
BOOLEAN NTAPI FsRtlDoesNameContainWildCards(IN PUNICODE_STRING Name)
Definition: name.c:464
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT ShareAccess
Definition: create.c:4157
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
#define FCB_DELETE_PENDING
Definition: ext2fs.h:879
PDEVICE_OBJECT DeviceObject
Definition: ffsdrv.h:371
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
__drv_mustHoldCriticalRegion NTSTATUS FFSFlushVolume(IN PFFS_VCB Vcb, BOOLEAN bShutDown)
Definition: flush.c:107
#define FILE_OPEN_BY_FILE_ID
Definition: from_kernel.h:41
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
__drv_mustHoldCriticalRegion NTSTATUS FFSCreateInode(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb, PFFS_FCB ParentFcb, ULONG Type, ULONG FileAttr, PUNICODE_STRING FileName)
Definition: create.c:1923
_SEH2_TRY
Definition: create.c:4250
#define FFSBreakPoint()
Definition: ffsdrv.h:43
#define DT_DIR
Definition: fs.h:149
#define FCB_DELETE_ON_CLOSE
Definition: ffsdrv.h:633
ULONG FFSInodeTime(IN LARGE_INTEGER SysTime)
Definition: misc.c:66
Definition: fs.h:78
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB Vcb
Definition: create.c:4157
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FILE_NO_INTERMEDIATE_BUFFERING
Definition: from_kernel.h:28
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define DT_REG
Definition: fs.h:151
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
long LONG
Definition: pedump.c:60
__drv_mustHoldCriticalRegion BOOLEAN FFSv1SaveInode(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN ULONG Inode, IN PFFSv1_INODE dinode1)
Definition: ffs.c:407
#define FILE_READ_DATA
Definition: nt_native.h:628
#define FILE_NO_EA_KNOWLEDGE
Definition: from_kernel.h:36
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
#define FILE_ACTION_MODIFIED
u_int32_t d_ino
Definition: dir.h:84
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define MCB_IN_USE
Definition: ffsdrv.h:680
#define STATUS_MEDIA_WRITE_PROTECTED
Definition: udferr_usr.h:161
struct _FFS_VCB * PFFS_VCB
#define FFSSetReadOnly(m)
Definition: ffsdrv.h:253
#define STATUS_USER_MAPPED_FILE
Definition: ntstatus.h:697
FFS_IDENTIFIER_TYPE Type
Definition: ffsdrv.h:294
BOOLEAN FFSv1LoadInode(IN PFFS_VCB Vcb, IN ULONG inode, IN PFFSv1_INODE dinode1)
Definition: ffs.c:302
__drv_mustHoldCriticalRegion NTSTATUS FFSFlushFiles(IN PFFS_VCB Vcb, BOOLEAN bShutDown)
Definition: flush.c:54
#define FILE_WRITE_DATA
Definition: nt_native.h:631
#define STATUS_FILE_DELETED
Definition: udferr_usr.h:172
#define SUPER_BLOCK
Definition: ext2fs.h:90
struct _FFS_FCBVCB * PFFS_FCBVCB
u_int8_t d_type
Definition: dir.h:86
PAGED_CODE()
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
BOOLEAN FFSTruncateFile(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb, PFFS_FCB Fcb, PLARGE_INTEGER AllocationSize)
Definition: fileinfo.c:1189
ULONG OpenHandleCount
Definition: ntfs.h:521
NTSTATUS FFSNewInode(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb, ULONG GroupHint, ULONG Type, PULONG Inode)
Definition: ffs.c:1645
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
int64_t LONGLONG
Definition: typedefs.h:66
SHARE_ACCESS ShareAccess
Definition: cdstruc.h:1015
PFFS_MCB FFSSearchMcb(PFFS_VCB Vcb, PFFS_MCB Parent, PUNICODE_STRING FileName)
Definition: memory.c:1235
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI FsRtlDissectName(IN UNICODE_STRING Name, OUT PUNICODE_STRING FirstPart, OUT PUNICODE_STRING RemainingPart)
Definition: name.c:398
BOOLEAN NTAPI MmFlushImageSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN MMFLUSH_TYPE FlushType)
Definition: section.c:4796
UNICODE_STRING ShortName
Definition: ffsdrv.h:660
#define IFDIR
Definition: dinode.h:166
struct _DEVICE_OBJECT * RealDevice
Definition: iotypes.h:172
static const UCHAR Index[8]
Definition: usbohci.c:18
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
_In_ PFCB ParentFcb
Definition: cdprocs.h:741
#define FO_CACHE_SUPPORTED
Definition: iotypes.h:1737
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ULONG Flags
Definition: ntfs.h:520
#define VCB_WRITE_PROTECTED
Definition: ext2fs.h:796
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define FILE_DOES_NOT_EXIST
Definition: nt_native.h:773
__drv_mustHoldCriticalRegion NTSTATUS FFSCompleteIrpContext(IN PFFS_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: read.c:53
FFS_IDENTIFIER Identifier
Definition: ffsdrv.h:426
#define STATUS_CANNOT_DELETE
Definition: shellext.h:66
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
BOOLEAN FFSFreeInode(PFFS_IRP_CONTEXT IrpContext, PFFS_VCB Vcb, ULONG Inode, ULONG Type)
Definition: ffs.c:1857
static const WCHAR L[]
Definition: oid.c:1250
ULONG FileAttr
Definition: ffsdrv.h:669
#define VCB_DISMOUNT_PENDING
Definition: ext2fs.h:782
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
_Must_inspect_result_ _In_ PFLT_INSTANCE _Out_ PBOOLEAN IsDirectory
Definition: fltkernel.h:1139
#define FCB_FILE_MODIFIED
Definition: ext2fs.h:873
NTSTATUS FFSv1ScanDir(IN PFFS_VCB Vcb, IN PFFS_MCB ParentMcb, IN PUNICODE_STRING FileName, IN OUT PULONG Index, IN PFFSv1_INODE dinode1, IN OUT PFFS_DIR_ENTRY ffs_dir)
Definition: create.c:436
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
Definition: ffsdrv.h:280
_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
#define FFS_POOL_TAG
Definition: ffsdrv.h:817
USHORT ShareAccess
Definition: iotypes.h:2763
#define VCB_READ_ONLY
Definition: ext2fs.h:795
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
VOID FFSUnpinRepinnedBcbs(IN PFFS_IRP_CONTEXT IrpContext)
Definition: memory.c:276
Status
Definition: gdiplustypes.h:24
#define FFSPrint(arg)
Definition: ffsdrv.h:1047
#define FILE_OPEN
Definition: from_kernel.h:54
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
Definition: fatprocs.h:310
NTSTATUS NTAPI IoCheckShareAccess(IN ACCESS_MASK DesiredAccess, IN ULONG DesiredShareAccess, IN PFILE_OBJECT FileObject, IN PSHARE_ACCESS ShareAccess, IN BOOLEAN Update)
Definition: file.c:3389
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:2812
_SEH2_END
Definition: create.c:4424
#define IFMT
Definition: dinode.h:163
#define SL_OPEN_TARGET_DIRECTORY
Definition: iotypes.h:1774
int32_t di_ctime
Definition: dinode.h:92
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
GLuint in
Definition: glext.h:9616
__drv_mustHoldCriticalRegion NTSTATUS FFSAddEntry(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN PFFS_FCB Dcb, IN ULONG FileType, IN ULONG Inode, IN PUNICODE_STRING FileName)
Definition: ffs.c:1965
unsigned short USHORT
Definition: pedump.c:61
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT _In_ ULONG _In_ BOOLEAN _In_ BOOLEAN DeleteOnClose
Definition: create.c:4157
__drv_mustHoldCriticalRegion NTSTATUS FFSCreate(IN PFFS_IRP_CONTEXT IrpContext)
Definition: create.c:1835
ULONG Inode
Definition: ffsdrv.h:663
PFFS_FCB FFSFcb
Definition: ffsdrv.h:657
#define FILE_NOTIFY_CHANGE_ATTRIBUTES
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
Definition: fatprocs.h:334
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
#define STATUS_NO_SUCH_FILE
Definition: udferr_usr.h:137
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
_SEH2_FINALLY
Definition: create.c:4395
NTSTATUS FFSv2ScanDir(IN PFFS_VCB Vcb, IN PFFS_MCB ParentMcb, IN PUNICODE_STRING FileName, IN OUT PULONG Index, IN PFFSv2_INODE dinode2, IN OUT PFFS_DIR_ENTRY ffs_dir)
Definition: create.c:589
unsigned int * PULONG
Definition: retypes.h:1
#define FILE_CREATED
Definition: nt_native.h:770
#define VCB_VOLUME_LOCKED
Definition: ext2fs.h:780
#define FILE_ACTION_ADDED
#define FCB_FILE_DELETED
Definition: ffsdrv.h:635
VOID FFSNotifyReportChange(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN PFFS_FCB Fcb, IN ULONG Filter, IN ULONG Action)
Definition: dirctl.c:1201
NTSTATUS FFSOEMToUnicode(IN OUT PUNICODE_STRING Unicode, IN POEM_STRING Oem)
Definition: misc.c:80
__drv_mustHoldCriticalRegion PFFS_FCB FFSv1AllocateFcb(IN PFFS_VCB Vcb, IN PFFS_MCB FFSMcb, IN PFFSv1_INODE dinode1)
Definition: memory.c:383
#define BOOLEAN
Definition: pedump.c:73
#define OUT
Definition: typedefs.h:39
#define STATUS_VOLUME_DISMOUNTED
Definition: ntstatus.h:733
#define STATUS_DISK_FULL
Definition: udferr_usr.h:155
VOID FFSAddMcbNode(PFFS_VCB Vcb, PFFS_MCB Parent, PFFS_MCB Child)
Definition: memory.c:1278
unsigned int ULONG
Definition: retypes.h:1
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
PFFS_GLOBAL FFSGlobal
Definition: init.c:22
#define DINODE2_SIZE
Definition: dinode.h:175
#define DINODE1_SIZE
Definition: dinode.h:174
VOID NTAPI ExReleaseResourceForThreadLite(IN PERESOURCE Resource, IN ERESOURCE_THREAD Thread)
Definition: resource.c:1844
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
Definition: util.c:316
#define DBG_INFO
Definition: ffsdrv.h:1034
NTSTATUS FFSv2ReadInode(IN PFFS_IRP_CONTEXT IrpContext, IN PFFS_VCB Vcb, IN PFFSv2_INODE dinode2, IN ULONGLONG offset, IN PVOID Buffer, IN ULONG size, OUT PULONG dwRet)
Definition: read.c:585
#define FFSRaiseStatus(IRPCONTEXT, STATUS)
Definition: ffsdrv.h:139
PFFS_MCB FFSAllocateMcb(PFFS_VCB Vcb, PUNICODE_STRING FileName, ULONG FileAttr)
Definition: memory.c:889
#define _SEH2_LEAVE
Definition: filesup.c:20
IN PDCB IN POEM_STRING OemName
Definition: fatprocs.h:1294
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2745
NTSTATUS FFSv2LookupFileName(IN PFFS_VCB Vcb, IN PUNICODE_STRING FullFileName, IN PFFS_MCB ParentMcb, OUT PFFS_MCB *FFSMcb, IN OUT PFFSv2_INODE dinode2)
Definition: create.c:237
struct direct * PFFS_DIR_ENTRY
Definition: ffsdrv.h:265
FILE_NAME_NODE ShortName
Definition: fatstruc.h:1111
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT _In_ ULONG CreateDisposition
Definition: create.c:4157
HRESULT Create([out]ITransactionReceiver **ppReceiver)
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define BLOCKS_PER_GROUP
Definition: ext2fs.h:100
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK _In_ USHORT _In_ ULONG _In_ BOOLEAN NoEaKnowledge
Definition: create.c:4157
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define DBG_VITAL
Definition: ffsdrv.h:1030
#define RtlOemStringToCountedUnicodeSize(STRING)
#define DELETE
Definition: nt_native.h:57
off
Definition: i386-dis.c:3909
PFFS_MCB Parent
Definition: ffsdrv.h:650
#define IFLNK
Definition: dinode.h:169