ReactOS  0.4.14-dev-606-g14ebc0b
create.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYRIGHT.TXT
3  * PROJECT: Ext2 File System Driver for WinNT/2K/XP
4  * FILE: create.c
5  * PROGRAMMER: Matt Wu <mattwu@163.com>
6  * HOMEPAGE: http://www.ext2fsd.com
7  * UPDATE HISTORY:
8  */
9 
10 /* INCLUDES *****************************************************************/
11 
12 #include "ext2fs.h"
13 #include <linux/ext4_xattr.h>
14 
15 /* GLOBALS *****************************************************************/
16 
18 
19 /* DEFINITIONS *************************************************************/
20 
21 #ifdef ALLOC_PRAGMA
22 #pragma alloc_text(PAGE, Ext2IsNameValid)
23 #pragma alloc_text(PAGE, Ext2FollowLink)
24 #pragma alloc_text(PAGE, Ext2IsSpecialSystemFile)
25 #pragma alloc_text(PAGE, Ext2LookupFile)
26 #pragma alloc_text(PAGE, Ext2ScanDir)
27 #pragma alloc_text(PAGE, Ext2CreateFile)
28 #pragma alloc_text(PAGE, Ext2CreateVolume)
29 #pragma alloc_text(PAGE, Ext2Create)
30 #pragma alloc_text(PAGE, Ext2CreateInode)
31 #pragma alloc_text(PAGE, Ext2SupersedeOrOverWriteFile)
32 #endif
33 
34 
35 BOOLEAN
37 {
38  USHORT i = 0;
39  PUSHORT pName = (PUSHORT) FileName->Buffer;
40 
41  if (FileName == NULL) {
42  return FALSE;
43  }
44 
45  while (i < (FileName->Length / sizeof(WCHAR))) {
46 
47  if (pName[i] == 0) {
48  break;
49  }
50 
51  if (pName[i] == L'|' || pName[i] == L':' ||
52  pName[i] == L'/' || pName[i] == L'*' ||
53  pName[i] == L'?' || pName[i] == L'\"' ||
54  pName[i] == L'<' || pName[i] == L'>' ) {
55 
56  return FALSE;
57  }
58 
59  i++;
60  }
61 
62  return TRUE;
63 }
64 
65 
68  IN PEXT2_IRP_CONTEXT IrpContext,
72  IN ULONG Linkdep
73 )
74 {
76 
77  UNICODE_STRING UniName;
79  BOOLEAN bOemBuffer = FALSE;
80 
82 
83  USHORT i;
84 
85  _SEH2_TRY {
86 
87  RtlZeroMemory(&UniName, sizeof(UNICODE_STRING));
88  RtlZeroMemory(&OemName, sizeof(OEM_STRING));
89 
90  /* exit if we jump into a possible symlink forever loop */
91  if ((Linkdep + 1) > EXT2_MAX_NESTED_LINKS ||
92  IoGetRemainingStackSize() < 1024) {
94  }
95 
96  /* read the symlink target path */
97  if (!Mcb->Inode.i_blocks) {
98 
99  OemName.Buffer = (PUCHAR) (&Mcb->Inode.i_block[0]);
100  OemName.Length = (USHORT)Mcb->Inode.i_size;
101  OemName.MaximumLength = OemName.Length + 1;
102 
103  } else {
104 
105  OemName.Length = (USHORT)Mcb->Inode.i_size;
106  OemName.MaximumLength = OemName.Length + 1;
108  OemName.MaximumLength,
109  'NL2E');
110  if (OemName.Buffer == NULL) {
112  _SEH2_LEAVE;
113  }
114  bOemBuffer = TRUE;
115  RtlZeroMemory(OemName.Buffer, OemName.MaximumLength);
116 
118  IrpContext,
119  Vcb,
120  Mcb,
121  OemName.Buffer,
122  (ULONG)(Mcb->Inode.i_size),
123  NULL);
124  if (!NT_SUCCESS(Status)) {
125  _SEH2_LEAVE;
126  }
127  }
128 
129  /* convert Linux slash to Windows backslash */
130  for (i=0; i < OemName.Length; i++) {
131  if (OemName.Buffer[i] == '/') {
132  OemName.Buffer[i] = '\\';
133  }
134  }
135 
136  /* convert oem string to unicode string */
138  if (UniName.MaximumLength <= 0) {
140  _SEH2_LEAVE;
141  }
142 
143  UniName.MaximumLength += 2;
145  UniName.MaximumLength,
146  'NL2E');
147  if (UniName.Buffer == NULL) {
149  _SEH2_LEAVE;
150  }
151  RtlZeroMemory(UniName.Buffer, UniName.MaximumLength);
152  Status = Ext2OEMToUnicode(Vcb, &UniName, &OemName);
153  if (!NT_SUCCESS(Status)) {
155  _SEH2_LEAVE;
156  }
157 
158  /* search the real target */
160  IrpContext,
161  Vcb,
162  &UniName,
163  Parent,
164  &Target,
165  Linkdep
166  );
167  if (Target == NULL) {
169  }
170 
171  if (Target == NULL /* link target doesn't exist */ ||
172  Target == Mcb /* symlink points to itself */ ||
173  IsMcbSpecialFile(Target) /* target not resolved*/ ||
174  IsFileDeleted(Target) /* target deleted */ ) {
175 
176  if (Target) {
177  ASSERT(Target->Refercount > 0);
179  }
182  Mcb->Target = NULL;
183 
184  } else if (IsMcbSymLink(Target)) {
185 
186  ASSERT(Target->Refercount > 0);
187  ASSERT(Target->Target != NULL);
188  Ext2ReferMcb(Target->Target);
189  Mcb->Target = Target->Target;
191  ASSERT(!IsMcbSymLink(Target->Target));
194  ASSERT(Mcb->Target->Refercount > 0);
195 
196  } else {
197 
198  Mcb->Target = Target;
201  ASSERT(Mcb->Target->Refercount > 0);
202  }
203 
204  /* add directory flag to file attribute */
205  if (Mcb->Target && IsMcbDirectory(Mcb->Target)) {
206  Mcb->FileAttr |= FILE_ATTRIBUTE_DIRECTORY;
207  }
208 
209  } _SEH2_FINALLY {
210 
211  if (bOemBuffer) {
212  Ext2FreePool(OemName.Buffer, 'NL2E');
213  }
214 
215  if (UniName.Buffer) {
216  Ext2FreePool(UniName.Buffer, 'NL2E');
217  }
218  } _SEH2_END;
219 
220  return Status;
221 }
222 
223 BOOLEAN
226  IN BOOLEAN bDirectory
227 )
228 {
229  PWSTR SpecialFileList[] = {
230  L"pagefile.sys",
231  L"swapfile.sys",
232  L"hiberfil.sys",
233  NULL
234  };
235 
236  PWSTR SpecialDirList[] = {
237  L"Recycled",
238  L"RECYCLER",
239  L"$RECYCLE.BIN",
240  NULL
241  };
242 
243  PWSTR entryName;
244  ULONG length;
245  int i;
246 
247  for (i = 0; TRUE; i++) {
248 
249  if (bDirectory) {
250  entryName = SpecialDirList[i];
251  } else {
252  entryName = SpecialFileList[i];
253  }
254 
255  if (NULL == entryName) {
256  break;
257  }
258 
259  length = wcslen(entryName) * sizeof(WCHAR);
260  if (FileName->Length == length) {
261  if ( 0 == _wcsnicmp( entryName,
262  FileName->Buffer,
263  length / sizeof(WCHAR) )) {
264  return TRUE;
265  }
266  }
267  }
268 
269  return FALSE;
270 }
271 
272 NTSTATUS
274  IN PEXT2_IRP_CONTEXT IrpContext,
275  IN PEXT2_VCB Vcb,
278  OUT PEXT2_MCB * Ext2Mcb,
279  IN ULONG Linkdep
280 )
281 {
284  PEXT2_MCB Mcb = NULL;
285  struct dentry *de = NULL;
286 
287  USHORT i = 0, End;
288  ULONG Inode;
289 
290  BOOLEAN bParent = FALSE;
291  BOOLEAN bDirectory = FALSE;
292  BOOLEAN LockAcquired = FALSE;
293  BOOLEAN bNotFollow = FALSE;
294 
295  _SEH2_TRY {
296 
298  LockAcquired = TRUE;
299 
300  bNotFollow = IsFlagOn(Linkdep, EXT2_LOOKUP_NOT_FOLLOW);
301 #ifndef __REACTOS__
302  Linkdep = ClearFlag(Linkdep, EXT2_LOOKUP_FLAG_MASK);
303 #else
305 #endif
306 
307  *Ext2Mcb = NULL;
308 
309  DEBUG(DL_RES, ("Ext2LookupFile: %wZ\n", FullName));
310 
311  /* check names and parameters */
312  if (FullName->Buffer[0] == L'\\') {
313  Parent = Vcb->McbTree;
314  } else if (Parent) {
315  bParent = TRUE;
316  } else {
317  Parent = Vcb->McbTree;
318  }
319 
320  /* make sure the parent is NULL */
321  if (!IsMcbDirectory(Parent)) {
323  _SEH2_LEAVE;
324  }
325 
326  /* use symlink's target as parent directory */
327  if (IsMcbSymLink(Parent)) {
328  Parent = Parent->Target;
330  if (IsFileDeleted(Parent)) {
332  _SEH2_LEAVE;
333  }
334  }
335 
336  if (NULL == Parent) {
338  _SEH2_LEAVE;
339  }
340 
341  /* default is the parent Mcb*/
343  Mcb = Parent;
344 
345  /* is empty file name or root node */
346  End = FullName->Length/sizeof(WCHAR);
347  if ( (End == 0) || (End == 1 &&
348  FullName->Buffer[0] == L'\\')) {
350  _SEH2_LEAVE;
351  }
352 
353  /* is a directory expected ? */
354  while (FullName->Buffer[End - 1] == L'\\') {
355  bDirectory = TRUE;
356  End -= 1;
357  }
358 
359  /* loop with every sub name */
360  while (i < End) {
361 
362  USHORT Start = 0;
363 
364  /* zero the prefix '\' */
365  while (i < End && FullName->Buffer[i] == L'\\') i++;
366  Start = i;
367 
368  /* zero the suffix '\' */
369  while (i < End && (FullName->Buffer[i] != L'\\')) i++;
370 
371  if (i > Start) {
372 
373  FileName = *FullName;
374  FileName.Buffer += Start;
375  FileName.Length = (USHORT)((i - Start) * 2);
376 
377  /* make sure the parent is NULL */
378  if (!IsMcbDirectory(Parent)) {
381  break;
382  }
383 
384  if (IsMcbSymLink(Parent)) {
385  if (IsFileDeleted(Parent->Target)) {
388  break;
389  } else {
390  Ext2ReferMcb(Parent->Target);
392  Parent = Parent->Target;
393  }
394  }
395 
396  /* search cached Mcb nodes */
398 
399  if (Mcb) {
400 
401  /* derefer the parent Mcb */
404  Parent = Mcb;
405 
406  if (IsMcbSymLink(Mcb) && IsFileDeleted(Mcb->Target) &&
407  Mcb->Refercount == 1) {
408 
409  ASSERT(Mcb->Target);
410  ASSERT(Mcb->Target->Refercount > 0);
411  Ext2DerefMcb(Mcb->Target);
412  Mcb->Target = NULL;
415  Mcb->FileAttr = FILE_ATTRIBUTE_NORMAL;
416  }
417 
418  } else {
419 
420  /* need create new Mcb node */
421 
422  /* is a valid ext2 name */
423  if (!Ext2IsNameValid(&FileName)) {
426  break;
427  }
428 
429  /* seach the disk */
430  de = NULL;
431  Status = Ext2ScanDir (
432  IrpContext,
433  Vcb,
434  Parent,
435  &FileName,
436  &Inode,
437  &de);
438 
439  if (NT_SUCCESS(Status)) {
440 
441  /* check it's real parent */
443 
444  /* allocate Mcb ... */
445  Mcb = Ext2AllocateMcb(Vcb, &FileName, &Parent->FullName, 0);
446  if (!Mcb) {
449  break;
450  }
451  Mcb->de = de;
452  Mcb->de->d_inode = &Mcb->Inode;
453  Mcb->Inode.i_ino = Inode;
454  Mcb->Inode.i_sb = &Vcb->sb;
455  de = NULL;
456 
457  /* load inode information */
458  if (!Ext2LoadInode(Vcb, &Mcb->Inode)) {
461  Ext2FreeMcb(Vcb, Mcb);
462  break;
463  }
464 
465  /* set inode attribute */
467  SetFlag(Mcb->FileAttr, FILE_ATTRIBUTE_READONLY);
468  }
469 
470  if (S_ISDIR(Mcb->Inode.i_mode)) {
472  } else {
473  if (S_ISREG(Mcb->Inode.i_mode)) {
474  SetFlag(Mcb->FileAttr, FILE_ATTRIBUTE_NORMAL);
475  } else if (S_ISLNK(Mcb->Inode.i_mode)) {
477  } else {
479  }
480  }
481 
482  /* process special files under root directory */
483  if (IsMcbRoot(Parent)) {
484  /* set hidden and system attributes for
485  Recycled / RECYCLER / pagefile.sys */
487  if (Ext2IsSpecialSystemFile(&Mcb->ShortName, IsDirectory)) {
488  SetFlag(Mcb->FileAttr, FILE_ATTRIBUTE_HIDDEN);
489  SetFlag(Mcb->FileAttr, FILE_ATTRIBUTE_SYSTEM);
490  }
491  }
492 
493  Mcb->CreationTime = Ext2NtTime(Mcb->Inode.i_ctime);
494  Mcb->LastAccessTime = Ext2NtTime(Mcb->Inode.i_atime);
495  Mcb->LastWriteTime = Ext2NtTime(Mcb->Inode.i_mtime);
496  Mcb->ChangeTime = Ext2NtTime(Mcb->Inode.i_mtime);
497 
498  /* process symlink */
499  if (S_ISLNK(Mcb->Inode.i_mode) && !bNotFollow) {
500  Ext2FollowLink( IrpContext,
501  Vcb,
502  Parent,
503  Mcb,
504  Linkdep+1
505  );
506  }
507 
508  /* add reference ... */
509  Ext2ReferMcb(Mcb);
510 
511  /* add Mcb to it's parent tree*/
513 
514  /* it's safe to deref Parent Mcb */
516 
517  /* linking this Mcb*/
519 
520  /* set parent to preare re-scan */
521  Parent = Mcb;
522 
523  } else {
524 
525  /* derefernce it's parent */
527  break;
528  }
529  }
530 
531  } else {
532 
533  /* there seems too many \ or / */
534  /* Mcb should be already set to Parent */
535  ASSERT(Mcb == Parent);
537  break;
538  }
539  }
540 
541  } _SEH2_FINALLY {
542 
543  if (de) {
544  Ext2FreeEntry(de);
545  }
546 
547  if (NT_SUCCESS(Status)) {
548  if (bDirectory) {
549  if (IsMcbDirectory(Mcb)) {
550  *Ext2Mcb = Mcb;
551  } else {
552  Ext2DerefMcb(Mcb);
554  }
555  } else {
556  *Ext2Mcb = Mcb;
557  }
558  }
559 
560  if (LockAcquired) {
561  ExReleaseResourceLite(&Vcb->McbLock);
562  }
563  } _SEH2_END;
564 
565  return Status;
566 }
567 
568 
569 NTSTATUS
571  IN PEXT2_IRP_CONTEXT IrpContext,
572  IN PEXT2_VCB Vcb,
575  OUT PULONG Inode,
576  OUT struct dentry **dentry
577 )
578 {
579  struct ext3_dir_entry_2 *dir_entry = NULL;
580  struct buffer_head *bh = NULL;
581  struct dentry *de = NULL;
582 
584 
585  DEBUG(DL_RES, ("Ext2ScanDir: %wZ\\%wZ\n", &Parent->FullName, FileName));
586 
587  _SEH2_TRY {
588 
589  /* grab parent's reference first */
591 
592  /* bad request ! Can a man be pregnant ? Maybe:) */
593  if (!IsMcbDirectory(Parent)) {
595  _SEH2_LEAVE;
596  }
597 
598  /* parent is a symlink ? */
599  if IsMcbSymLink(Parent) {
600  if (Parent->Target) {
601  Ext2ReferMcb(Parent->Target);
603  Parent = Parent->Target;
605  } else {
606  DbgBreak();
608  _SEH2_LEAVE;
609  }
610  }
611 
613  if (!de) {
614  DEBUG(DL_ERR, ( "Ex2ScanDir: failed to allocate dentry.\n"));
616  _SEH2_LEAVE;
617  }
618 
619  bh = ext3_find_entry(IrpContext, de, &dir_entry);
620  if (dir_entry) {
622  *Inode = dir_entry->inode;
623  *dentry = de;
624  }
625 
626  } _SEH2_FINALLY {
627 
629 
630  if (bh)
631  __brelse(bh);
632 
633  if (!NT_SUCCESS(Status)) {
634  if (de)
635  Ext2FreeEntry(de);
636  }
637  } _SEH2_END;
638 
639  return Status;
640 }
641 
643  struct inode *inode)
644 {
645  struct ext3_dir_entry_2 * de;
646  struct buffer_head * bh;
647  ext3_lblk_t block = 0;
648  int rc = 0;
649 
650  bh = ext3_append(icb, inode, &block, &rc);
651  if (!bh) {
652  goto errorout;
653  }
654 
655  de = (struct ext3_dir_entry_2 *) bh->b_data;
656  de->inode = cpu_to_le32(inode->i_ino);
657  de->name_len = 1;
659  strcpy (de->name, ".");
661  de = (struct ext3_dir_entry_2 *)
662  ((char *) de + le16_to_cpu(de->rec_len));
663  de->inode = cpu_to_le32(dir->i_ino);
664  de->rec_len = cpu_to_le16(inode->i_sb->s_blocksize-EXT3_DIR_REC_LEN(1));
665  de->name_len = 2;
666  strcpy (de->name, "..");
668  inode->i_nlink = 2;
669  set_buffer_dirty(bh);
671 
672 errorout:
673  if (bh)
674  __brelse (bh);
675 
676  return Ext2WinntError(rc);
677 }
678 
679 //
680 // Any call to this routine must have Fcb's MainResource and FcbLock acquired.
681 //
682 
683 NTSTATUS
685  PEXT2_IRP_CONTEXT IrpContext,
686  PEXT2_VCB Vcb,
687  PEXT2_FCB Fcb,
689 )
690 {
691  PEXT2_MCB Mcb = NULL;
692  PIRP Irp;
694 
695  struct ext4_xattr_ref xattr_ref;
696  BOOLEAN XattrRefAcquired = FALSE;
698 
700  PCHAR EaBuffer;
701  ULONG EaBufferLength;
702 
703  _SEH2_TRY {
704 
705  Irp = IrpContext->Irp;
707  Mcb = Fcb->Mcb;
708 
709  EaBuffer = Irp->AssociatedIrp.SystemBuffer;
710  EaBufferLength = IrpSp->Parameters.Create.EaLength;
711 
712  if (!Mcb)
713  _SEH2_LEAVE;
714 
715  //
716  // Return peacefully if there is no EaBuffer provided.
717  //
718  if (!EaBuffer) {
720  _SEH2_LEAVE;
721  }
722 
723  //
724  // If the caller specifies an EaBuffer, but has no knowledge about Ea,
725  // we reject the request.
726  //
727  if (EaBuffer != NULL &&
730  _SEH2_LEAVE;
731  }
732 
733  //
734  // Check Ea Buffer validity.
735  //
737  EaBufferLength, (PULONG)&Iosb->Information);
738  if (!NT_SUCCESS(Status))
739  _SEH2_LEAVE;
740 
742  if (!NT_SUCCESS(Status)) {
743  DbgPrint("ext4_fs_get_xattr_ref() failed!\n");
744  _SEH2_LEAVE;
745  }
746 
747  XattrRefAcquired = TRUE;
748 
749  //
750  // Remove all existing EA entries.
751  //
752  ext4_xattr_purge_items(&xattr_ref);
753  xattr_ref.dirty = TRUE;
755 
756  // Iterate the whole EA buffer to do inspection
757  for (FullEa = (PFILE_FULL_EA_INFORMATION)EaBuffer;
758  FullEa < (PFILE_FULL_EA_INFORMATION)&EaBuffer[EaBufferLength];
759  FullEa = (PFILE_FULL_EA_INFORMATION)(FullEa->NextEntryOffset == 0 ?
760  &EaBuffer[EaBufferLength] :
761  (PCHAR)FullEa + FullEa->NextEntryOffset)) {
762 
763  OEM_STRING EaName;
764 
765  EaName.MaximumLength = EaName.Length = FullEa->EaNameLength;
766  EaName.Buffer = &FullEa->EaName[0];
767 
768  // Check if EA's name is valid
769  if (!Ext2IsEaNameValid(EaName)) {
771  _SEH2_LEAVE;
772  }
773  }
774 
775  // Now add EA entries to the inode
776  for (FullEa = (PFILE_FULL_EA_INFORMATION)EaBuffer;
777  FullEa < (PFILE_FULL_EA_INFORMATION)&EaBuffer[EaBufferLength];
778  FullEa = (PFILE_FULL_EA_INFORMATION)(FullEa->NextEntryOffset == 0 ?
779  &EaBuffer[EaBufferLength] :
780  (PCHAR)FullEa + FullEa->NextEntryOffset)) {
781 
782  int ret;
783  OEM_STRING EaName;
784 
785  EaName.MaximumLength = EaName.Length = FullEa->EaNameLength;
786  EaName.Buffer = &FullEa->EaName[0];
787 
789  ext4_fs_set_xattr(&xattr_ref,
791  EaName.Buffer,
792  EaName.Length,
793  &FullEa->EaName[0] + FullEa->EaNameLength + 1,
794  FullEa->EaValueLength,
795  TRUE));
796  if (!NT_SUCCESS(Status) && ret != -ENODATA)
797  _SEH2_LEAVE;
798 
799  if (ret == -ENODATA) {
801  ext4_fs_set_xattr(&xattr_ref,
803  EaName.Buffer,
804  EaName.Length,
805  &FullEa->EaName[0] + FullEa->EaNameLength + 1,
806  FullEa->EaValueLength,
807  FALSE));
808  if (!NT_SUCCESS(Status))
809  _SEH2_LEAVE;
810 
811  }
812  }
813  }
814  _SEH2_FINALLY {
815 
816  if (XattrRefAcquired) {
817  if (!NT_SUCCESS(Status)) {
818  xattr_ref.dirty = FALSE;
819  ext4_fs_put_xattr_ref(&xattr_ref);
820  } else {
822  }
823  }
824  } _SEH2_END;
825  return Status;
826 }
827 
828 NTSTATUS
831  PEXT2_VCB Vcb,
832  PBOOLEAN OpPostIrp
833 )
834 {
837  PEXT2_FCB Fcb = NULL;
838  PEXT2_MCB Mcb = NULL;
839  PEXT2_MCB SymLink = NULL;
840  PEXT2_CCB Ccb = NULL;
841 
843  PEXT2_MCB ParentMcb = NULL;
844 
846  PIRP Irp;
847 
848  ULONG Options;
850 
851  BOOLEAN bParentFcbCreated = FALSE;
852 #ifndef __REACTOS__
853  BOOLEAN bDir = FALSE;
854 #endif
855  BOOLEAN bFcbAllocated = FALSE;
856  BOOLEAN bCreated = FALSE;
857 
858  BOOLEAN bMainResourceAcquired = FALSE;
859  BOOLEAN bFcbLockAcquired = FALSE;
860 
862  BOOLEAN OpenTargetDirectory;
864  BOOLEAN SequentialOnly;
865  BOOLEAN NoIntermediateBuffering;
866  BOOLEAN IsPagingFile;
868  BOOLEAN NonDirectoryFile;
871  BOOLEAN TemporaryFile;
872  BOOLEAN CaseSensitive;
873  BOOLEAN OpenReparsePoint;
874 
877  ULONG CcbFlags = 0;
878 
880 
881  Irp = IrpContext->Irp;
883 
884  Options = IrpSp->Parameters.Create.Options;
885 
887  OpenTargetDirectory = IsFlagOn(IrpSp->Flags, SL_OPEN_TARGET_DIRECTORY);
888 
889  NonDirectoryFile = IsFlagOn(Options, FILE_NON_DIRECTORY_FILE);
890  SequentialOnly = IsFlagOn(Options, FILE_SEQUENTIAL_ONLY);
891  NoIntermediateBuffering = IsFlagOn( Options, FILE_NO_INTERMEDIATE_BUFFERING );
894 
895  /* Try to open reparse point (symlink) itself ? */
896  OpenReparsePoint = IsFlagOn(Options, FILE_OPEN_REPARSE_POINT);
897 
898  CaseSensitive = IsFlagOn(IrpSp->Flags, SL_CASE_SENSITIVE);
899 
900  TemporaryFile = IsFlagOn(IrpSp->Parameters.Create.FileAttributes,
902 
903  CreateDisposition = (Options >> 24) & 0x000000ff;
904 
905  IsPagingFile = IsFlagOn(IrpSp->Flags, SL_OPEN_PAGING_FILE);
906 
910 
914 
915  DesiredAccess = IrpSp->Parameters.Create.SecurityContext->DesiredAccess;
916  ShareAccess = IrpSp->Parameters.Create.ShareAccess;
917 
918  *OpPostIrp = FALSE;
919 
920  _SEH2_TRY {
921 
922  FileName.MaximumLength = IrpSp->FileObject->FileName.MaximumLength;
923  FileName.Length = IrpSp->FileObject->FileName.Length;
924 
925  if (IrpSp->FileObject->RelatedFileObject) {
926  ParentFcb = (PEXT2_FCB)(IrpSp->FileObject->RelatedFileObject->FsContext);
927  }
928 
929  if (ParentFcb) {
930  ParentMcb = ParentFcb->Mcb;
931  Ext2ReferMcb(ParentMcb);
932  ParentFcb = NULL;
933  }
934 
935  if (FileName.Length == 0) {
936 
937  if (ParentMcb) {
938  Mcb = ParentMcb;
939  Ext2ReferMcb(Mcb);
941  goto McbExisting;
942  } else {
943  DbgBreak();
945  _SEH2_LEAVE;
946  }
947  }
948 
949  FileName.Buffer = Ext2AllocatePool(
950  PagedPool,
951  FileName.MaximumLength,
953  );
954 
955  if (!FileName.Buffer) {
956  DEBUG(DL_ERR, ( "Ex2CreateFile: failed to allocate FileName.\n"));
958  _SEH2_LEAVE;
959  }
960 
961  INC_MEM_COUNT(PS_FILE_NAME, FileName.Buffer, FileName.MaximumLength);
962 
963  RtlZeroMemory(FileName.Buffer, FileName.MaximumLength);
964  RtlCopyMemory(FileName.Buffer, IrpSp->FileObject->FileName.Buffer, FileName.Length);
965 
966  if (IrpSp->FileObject->RelatedFileObject && FileName.Buffer[0] == L'\\') {
968  _SEH2_LEAVE;
969  }
970 
971  if ((FileName.Length > sizeof(WCHAR)) &&
972  (FileName.Buffer[1] == L'\\') &&
973  (FileName.Buffer[0] == L'\\')) {
974 
975  FileName.Length -= sizeof(WCHAR);
976 
977  RtlMoveMemory( &FileName.Buffer[0],
978  &FileName.Buffer[1],
979  FileName.Length );
980 
981  //
982  // Bad Name if there are still beginning backslashes.
983  //
984 
985  if ((FileName.Length > sizeof(WCHAR)) &&
986  (FileName.Buffer[1] == L'\\') &&
987  (FileName.Buffer[0] == L'\\')) {
988 
990  _SEH2_LEAVE;
991  }
992  }
993 
996  _SEH2_LEAVE;
997  }
998 
999  DEBUG(DL_INF, ( "Ext2CreateFile: %wZ Paging=%d Option: %xh:"
1000  "Dir=%d NonDir=%d OpenTarget=%d NC=%d DeleteOnClose=%d\n",
1001  &FileName, IsPagingFile, IrpSp->Parameters.Create.Options,
1002  DirectoryFile, NonDirectoryFile, OpenTargetDirectory,
1003  NoIntermediateBuffering, DeleteOnClose ));
1004 
1005  DEBUG(DL_RES, ("Ext2CreateFile: Lookup 1st: %wZ at %S\n",
1006  &FileName, ParentMcb ? ParentMcb->FullName.Buffer : L" "));
1008  IrpContext,
1009  Vcb,
1010  &FileName,
1011  ParentMcb,
1012  &Mcb,
1013  0 /* always follow link */
1014  );
1015 McbExisting:
1016 
1017  if (!NT_SUCCESS(Status)) {
1018 
1019  UNICODE_STRING PathName;
1020  UNICODE_STRING RealName;
1021  UNICODE_STRING RemainName;
1022 
1023 #ifndef __REACTOS__
1024  LONG i = 0;
1025 #endif
1026 
1027  PathName = FileName;
1028  Mcb = NULL;
1029 
1030  /* here we've found the target file, but it's not matched. */
1033  _SEH2_LEAVE;
1034  }
1035 
1036  while (PathName.Length > 0 &&
1037  PathName.Buffer[PathName.Length/2 - 1] == L'\\') {
1038  DirectoryFile = TRUE;
1039  PathName.Length -= 2;
1040  PathName.Buffer[PathName.Length / 2] = 0;
1041  }
1042 
1043  if (!ParentMcb) {
1044  if (PathName.Buffer[0] != L'\\') {
1046  _SEH2_LEAVE;
1047  } else {
1048  ParentMcb = Vcb->McbTree;
1049  Ext2ReferMcb(ParentMcb);
1050  }
1051  }
1052 
1053 Dissecting:
1054 
1055  FsRtlDissectName(PathName, &RealName, &RemainName);
1056 
1057  if (((RemainName.Length != 0) && (RemainName.Buffer[0] == L'\\')) ||
1058  (RealName.Length >= 256 * sizeof(WCHAR))) {
1060  _SEH2_LEAVE;
1061  }
1062 
1063  if (RemainName.Length != 0) {
1064 
1065  PEXT2_MCB RetMcb = NULL;
1066 
1067  DEBUG(DL_RES, ("Ext2CreateFile: Lookup 2nd: %wZ\\%wZ\n",
1068  &ParentMcb->FullName, &RealName));
1069 
1071  IrpContext,
1072  Vcb,
1073  &RealName,
1074  ParentMcb,
1075  &RetMcb,
1076  0);
1077 
1078  /* quit name resolving loop */
1079  if (!NT_SUCCESS(Status)) {
1080  if (Status == STATUS_NO_SUCH_FILE ||
1083  }
1084  _SEH2_LEAVE;
1085  }
1086 
1087  /* deref ParentMcb */
1088  Ext2DerefMcb(ParentMcb);
1089 
1090  /* RetMcb is already refered */
1091  ParentMcb = RetMcb;
1092  PathName = RemainName;
1093 
1094  /* symlink must use it's target */
1095  if (IsMcbSymLink(ParentMcb)) {
1096  Ext2ReferMcb(ParentMcb->Target);
1097  Ext2DerefMcb(ParentMcb);
1098  ParentMcb = ParentMcb->Target;
1099  ASSERT(!IsMcbSymLink(ParentMcb));
1100  }
1101 
1102  goto Dissecting;
1103  }
1104 
1105  /* is name valid */
1106  if ( FsRtlDoesNameContainWildCards(&RealName) ||
1107  !Ext2IsNameValid(&RealName)) {
1109  _SEH2_LEAVE;
1110  }
1111 
1112  if (!bFcbLockAcquired) {
1114  bFcbLockAcquired = TRUE;
1115  }
1116 
1117  /* get the ParentFcb, allocate it if needed ... */
1118  ParentFcb = ParentMcb->Fcb;
1119  if (!ParentFcb) {
1120  ParentFcb = Ext2AllocateFcb(Vcb, ParentMcb);
1121  if (!ParentFcb) {
1123  _SEH2_LEAVE;
1124  }
1125  bParentFcbCreated = TRUE;
1126  }
1127  Ext2ReferXcb(&ParentFcb->ReferenceCount);
1128 
1129  if (bFcbLockAcquired) {
1130  ExReleaseResourceLite(&Vcb->FcbLock);
1131  bFcbLockAcquired = FALSE;
1132  }
1133 
1134  // We need to create a new one ?
1135  if ((CreateDisposition == FILE_CREATE ) ||
1139 
1140  if (IsVcbReadOnly(Vcb)) {
1142  _SEH2_LEAVE;
1143  }
1144 
1145  if (!Ext2CheckFileAccess(Vcb, ParentMcb, Ext2FileCanWrite)) {
1147  _SEH2_LEAVE;
1148  }
1149 
1152  Vcb->Vpb->RealDevice );
1155  }
1156 
1157  if (DirectoryFile) {
1158  if (TemporaryFile) {
1159  DbgBreak();
1161  _SEH2_LEAVE;
1162  }
1163  }
1164 
1165  if (!ParentFcb) {
1167  _SEH2_LEAVE;
1168  }
1169 
1170  /* allocate inode and construct entry for this file */
1172  IrpContext,
1173  Vcb,
1174  ParentFcb,
1176  IrpSp->Parameters.Create.FileAttributes,
1177  &RealName
1178  );
1179 
1180  if (!NT_SUCCESS(Status)) {
1181  DbgBreak();
1182  _SEH2_LEAVE;
1183  }
1184 
1185  bCreated = TRUE;
1186  DEBUG(DL_RES, ("Ext2CreateFile: Confirm creation: %wZ\\%wZ\n",
1187  &ParentMcb->FullName, &RealName));
1188 
1189  Irp->IoStatus.Information = FILE_CREATED;
1191  IrpContext,
1192  Vcb,
1193  &RealName,
1194  ParentMcb,
1195  &Mcb,
1196  0);
1197  if (!NT_SUCCESS(Status)) {
1198  DbgBreak();
1199  }
1200 
1201  } else if (OpenTargetDirectory) {
1202 
1203  if (IsVcbReadOnly(Vcb)) {
1205  _SEH2_LEAVE;
1206  }
1207 
1208  if (!ParentFcb) {
1210  _SEH2_LEAVE;
1211  }
1212 
1213  RtlZeroMemory( IrpSp->FileObject->FileName.Buffer,
1214  IrpSp->FileObject->FileName.MaximumLength);
1215  IrpSp->FileObject->FileName.Length = RealName.Length;
1216 
1217  RtlCopyMemory( IrpSp->FileObject->FileName.Buffer,
1218  RealName.Buffer,
1219  RealName.Length );
1220 
1221  Fcb = ParentFcb;
1222  Mcb = Fcb->Mcb;
1223  Ext2ReferMcb(Mcb);
1224 
1225  Irp->IoStatus.Information = FILE_DOES_NOT_EXIST;
1227 
1228  } else {
1229 
1231  _SEH2_LEAVE;
1232  }
1233 
1234  } else { // File / Dir already exists.
1235 
1236  /* here already get Mcb referred */
1237  if (OpenTargetDirectory) {
1238 
1239  UNICODE_STRING RealName = FileName;
1240  USHORT i = 0;
1241 
1242  while (RealName.Buffer[RealName.Length/2 - 1] == L'\\') {
1243  RealName.Length -= sizeof(WCHAR);
1244  RealName.Buffer[RealName.Length/2] = 0;
1245  }
1246  i = RealName.Length/2;
1247  while (i > 0 && RealName.Buffer[i - 1] != L'\\')
1248  i--;
1249 
1250  if (IsVcbReadOnly(Vcb)) {
1252  Ext2DerefMcb(Mcb);
1253  _SEH2_LEAVE;
1254  }
1255 
1256  Irp->IoStatus.Information = FILE_EXISTS;
1258 
1259  RtlZeroMemory( IrpSp->FileObject->FileName.Buffer,
1260  IrpSp->FileObject->FileName.MaximumLength);
1261  IrpSp->FileObject->FileName.Length = RealName.Length - i * sizeof(WCHAR);
1262  RtlCopyMemory( IrpSp->FileObject->FileName.Buffer, &RealName.Buffer[i],
1263  IrpSp->FileObject->FileName.Length );
1264 
1265  // use's it's parent since it's open-target operation
1266  Ext2ReferMcb(Mcb->Parent);
1267  Ext2DerefMcb(Mcb);
1268  Mcb = Mcb->Parent;
1269 
1270  goto Openit;
1271  }
1272 
1273  // We can not create if one exists
1274  if (CreateDisposition == FILE_CREATE) {
1275  Irp->IoStatus.Information = FILE_EXISTS;
1277  Ext2DerefMcb(Mcb);
1278  _SEH2_LEAVE;
1279  }
1280 
1281  /* directory forbits us to do the followings ... */
1282  if (IsMcbDirectory(Mcb)) {
1283 
1284  if ((CreateDisposition != FILE_OPEN) &&
1286 
1288  Ext2DerefMcb(Mcb);
1289  _SEH2_LEAVE;
1290  }
1291 
1292  if (NonDirectoryFile) {
1294  Ext2DerefMcb(Mcb);
1295  _SEH2_LEAVE;
1296  }
1297 
1298  if (Mcb->Inode.i_ino == EXT2_ROOT_INO) {
1299 
1300  if (OpenTargetDirectory) {
1301  DbgBreak();
1303  Ext2DerefMcb(Mcb);
1304  _SEH2_LEAVE;
1305  }
1306  }
1307 
1308  } else {
1309 
1310  if (DirectoryFile) {
1312  Ext2DerefMcb(Mcb);
1313  _SEH2_LEAVE;
1314  }
1315  }
1316 
1317  Irp->IoStatus.Information = FILE_OPENED;
1318  }
1319 
1320 Openit:
1321 
1322  if (!bFcbLockAcquired) {
1324  bFcbLockAcquired = TRUE;
1325  }
1326 
1327  /* Mcb should already be referred and symlink is too */
1328  if (Mcb) {
1329 
1330  ASSERT(Mcb->Refercount > 0);
1331 
1332  /* refer it's target if it's a symlink, so both refered */
1333  if (IsMcbSymLink(Mcb)) {
1334 
1335  if (OpenReparsePoint) {
1336  /* set Ccb flag */
1337  CcbFlags = CCB_OPEN_REPARSE_POINT;
1338  } else if (IsFileDeleted(Mcb->Target)) {
1339  DbgBreak();
1340  SetLongFlag(Mcb->Flags, MCB_TYPE_SPECIAL);
1342  Ext2DerefMcb(Mcb->Target);
1343  Mcb->Target = NULL;
1344  } else {
1345  SymLink = Mcb;
1346  Mcb = Mcb->Target;
1347  Ext2ReferMcb(Mcb);
1348  ASSERT (!IsMcbSymLink(Mcb));
1349  }
1350  }
1351 
1352  // Check readonly flag
1356  _SEH2_LEAVE;
1357  }
1362  _SEH2_LEAVE;
1363  } else if (IsFlagOn(Options, FILE_DELETE_ON_CLOSE )) {
1365  _SEH2_LEAVE;
1366  }
1367  }
1368 
1369  Fcb = Mcb->Fcb;
1370  if (Fcb == NULL) {
1371 
1372  /* allocate Fcb for this file */
1373  Fcb = Ext2AllocateFcb (Vcb, Mcb);
1374  if (Fcb) {
1375  bFcbAllocated = TRUE;
1376  } else {
1378  }
1379  } else {
1380  if (IsPagingFile) {
1382  Fcb = NULL;
1383  }
1384  }
1385 
1386  /* Now it's safe to defer Mcb */
1387  Ext2DerefMcb(Mcb);
1388  }
1389 
1390  if (Fcb) {
1391  /* grab Fcb's reference first to avoid the race between
1392  Ext2Close (it could free the Fcb we are accessing) */
1393  Ext2ReferXcb(&Fcb->ReferenceCount);
1394  }
1395 
1396  ExReleaseResourceLite(&Vcb->FcbLock);
1397  bFcbLockAcquired = FALSE;
1398 
1399  if (Fcb) {
1400 
1402  bMainResourceAcquired = TRUE;
1403 
1404  /* Open target directory ? */
1405  if (NULL == Mcb) {
1406  DbgBreak();
1407  Mcb = Fcb->Mcb;
1408  }
1409 
1410  /* check Mcb reference */
1411  ASSERT(Fcb->Mcb->Refercount > 0);
1412 
1413  /* file delted ? */
1414  if (IsFlagOn(Fcb->Mcb->Flags, MCB_FILE_DELETED)) {
1416  _SEH2_LEAVE;
1417  }
1418 
1419  if (DeleteOnClose && NULL == SymLink) {
1421  if (!NT_SUCCESS(Status)) {
1422  _SEH2_LEAVE;
1423  }
1424  }
1425 
1426  /* check access and oplock access for opened files */
1427  if (!bFcbAllocated && !IsDirectory(Fcb)) {
1428 
1429  /* whether there's batch oplock grabed on the file */
1430  if (FsRtlCurrentBatchOplock(&Fcb->Oplock)) {
1431 
1432  Irp->IoStatus.Information = FILE_OPBATCH_BREAK_UNDERWAY;
1433 
1434  /* break the batch lock if the sharing check fails */
1435  Status = FsRtlCheckOplock( &Fcb->Oplock,
1436  IrpContext->Irp,
1437  IrpContext,
1439  Ext2LockIrp );
1440 
1441  if ( Status != STATUS_SUCCESS &&
1443  *OpPostIrp = TRUE;
1444  _SEH2_LEAVE;
1445  }
1446  }
1447  }
1448 
1449  if (bCreated) {
1450 
1451  //
1452  // This file is just created.
1453  //
1454 
1455  Status = Ext2OverwriteEa(IrpContext, Vcb, Fcb, &Irp->IoStatus);
1456  if (!NT_SUCCESS(Status)) {
1458  _SEH2_LEAVE;
1459  }
1460 
1461  if (DirectoryFile) {
1462 
1463  Status = Ext2AddDotEntries(IrpContext, &ParentMcb->Inode, &Mcb->Inode);
1464  if (!NT_SUCCESS(Status)) {
1466  _SEH2_LEAVE;
1467  }
1468 
1469  } else {
1470 
1472  Ext2TotalBlocks(Vcb, &Irp->Overlay.AllocationSize, NULL)) {
1473  DbgBreak();
1475  _SEH2_LEAVE;
1476  }
1477 
1478  /* disable data blocks allocation */
1479 #if 0
1480  Fcb->Header.AllocationSize.QuadPart =
1481  Irp->Overlay.AllocationSize.QuadPart;
1482 
1483  if (Fcb->Header.AllocationSize.QuadPart > 0) {
1485  Vcb,
1486  Fcb->Mcb,
1487  &(Fcb->Header.AllocationSize)
1488  );
1490  if (!NT_SUCCESS(Status)) {
1491  Fcb->Header.AllocationSize.QuadPart = 0;
1493  &Fcb->Header.AllocationSize);
1494  _SEH2_LEAVE;
1495  }
1496  }
1497 #endif
1498  }
1499 
1500  } else {
1501 
1502  //
1503  // This file alreayd exists.
1504  //
1505 
1506  if (DeleteOnClose) {
1507 
1508  if (IsVcbReadOnly(Vcb)) {
1510  _SEH2_LEAVE;
1511  }
1512 
1515 
1517  Vcb->Vpb->RealDevice );
1518 
1520 
1522  }
1523 
1524  } else {
1525 
1526  //
1527  // Just to Open file (Open/OverWrite ...)
1528  //
1529 
1530  if ((!IsDirectory(Fcb)) && (IsFlagOn(IrpSp->FileObject->Flags,
1532  Fcb->Header.IsFastIoPossible = FastIoIsPossible;
1533 
1534  if (Fcb->SectionObject.DataSectionObject != NULL) {
1535 
1536  if (Fcb->NonCachedOpenCount == Fcb->OpenHandleCount) {
1537 
1538  if (!IsVcbReadOnly(Vcb)) {
1539  CcFlushCache(&Fcb->SectionObject, NULL, 0, NULL);
1541  }
1542 
1543  CcPurgeCacheSection(&Fcb->SectionObject,
1544  NULL,
1545  0,
1546  FALSE );
1547  }
1548  }
1549  }
1550  }
1551  }
1552 
1553  if (!IsDirectory(Fcb)) {
1554 
1555  if (!IsVcbReadOnly(Vcb)) {
1556  if ((CreateDisposition == FILE_SUPERSEDE) && !IsPagingFile) {
1557  DesiredAccess |= DELETE;
1558  } else if (((CreateDisposition == FILE_OVERWRITE) ||
1559  (CreateDisposition == FILE_OVERWRITE_IF)) && !IsPagingFile) {
1562  }
1563  }
1564 
1565  if (!bFcbAllocated) {
1566 
1567  //
1568  // check the oplock state of the file
1569  //
1570 
1571  Status = FsRtlCheckOplock( &Fcb->Oplock,
1572  IrpContext->Irp,
1573  IrpContext,
1575  Ext2LockIrp );
1576 
1577  if ( Status != STATUS_SUCCESS &&
1579  *OpPostIrp = TRUE;
1580  _SEH2_LEAVE;
1581  }
1582  }
1583  }
1584 
1585  if (Fcb->OpenHandleCount > 0) {
1586 
1587  /* check the shrae access conflicts */
1589  ShareAccess,
1590  IrpSp->FileObject,
1591  &(Fcb->ShareAccess),
1592  TRUE );
1593  if (!NT_SUCCESS(Status)) {
1594  _SEH2_LEAVE;
1595  }
1596 
1597  } else {
1598 
1599  /* set share access rights */
1601  ShareAccess,
1602  IrpSp->FileObject,
1603  &(Fcb->ShareAccess) );
1604  }
1605 
1606  Ccb = Ext2AllocateCcb(CcbFlags, SymLink);
1607  if (!Ccb) {
1609  DbgBreak();
1610  _SEH2_LEAVE;
1611  }
1612 
1613  if (DeleteOnClose)
1615 
1616  if (SymLink)
1617  Ccb->filp.f_dentry = SymLink->de;
1618  else
1619  Ccb->filp.f_dentry = Fcb->Mcb->de;
1620 
1621  Ccb->filp.f_version = Fcb->Mcb->Inode.i_version;
1623  Ext2ReferXcb(&Fcb->ReferenceCount);
1624 
1625  if (!IsDirectory(Fcb)) {
1626  if (NoIntermediateBuffering) {
1627  Fcb->NonCachedOpenCount++;
1629  } else {
1631  }
1632  }
1633 
1634  Ext2ReferXcb(&Vcb->OpenHandleCount);
1635  Ext2ReferXcb(&Vcb->ReferenceCount);
1636 
1637  IrpSp->FileObject->FsContext = (void*) Fcb;
1638  IrpSp->FileObject->FsContext2 = (void*) Ccb;
1639  IrpSp->FileObject->PrivateCacheMap = NULL;
1640  IrpSp->FileObject->SectionObjectPointer = &(Fcb->SectionObject);
1641 
1642  DEBUG(DL_INF, ( "Ext2CreateFile: %wZ OpenCount=%u ReferCount=%u NonCachedCount=%u\n",
1643  &Fcb->Mcb->FullName, Fcb->OpenHandleCount, Fcb->ReferenceCount, Fcb->NonCachedOpenCount));
1644 
1646 
1647  if (bCreated) {
1648 
1649  if (IsDirectory(Fcb)) {
1651  IrpContext,
1652  Vcb,
1653  Fcb->Mcb,
1656  } else {
1658  IrpContext,
1659  Vcb,
1660  Fcb->Mcb,
1663  }
1664 
1665  } else if (!IsDirectory(Fcb)) {
1666 
1667  if ( DeleteOnClose ||
1671  if (!MmFlushImageSection( &Fcb->SectionObject,
1672  MmFlushForWrite )) {
1673 
1676  _SEH2_LEAVE;
1677  }
1678  }
1679 
1680  if ((CreateDisposition == FILE_SUPERSEDE) ||
1683 
1684  if (IsDirectory(Fcb)) {
1686  _SEH2_LEAVE;
1687  }
1688 
1689  if (SymLink != NULL) {
1690  DbgBreak();
1692  _SEH2_LEAVE;
1693  }
1694 
1695  if (IsVcbReadOnly(Vcb)) {
1697  _SEH2_LEAVE;
1698  }
1699 
1701 
1703  Vcb->Vpb->RealDevice );
1706  }
1707 
1709  IrpContext,
1710  IrpSp->FileObject,
1711  Vcb,
1712  Fcb,
1713  &Irp->Overlay.AllocationSize,
1715 
1716  if (!NT_SUCCESS(Status)) {
1717  DbgBreak();
1718  _SEH2_LEAVE;
1719  }
1720 
1722  IrpContext,
1723  Vcb,
1724  Fcb->Mcb,
1729 
1730 
1732  Irp->IoStatus.Information = FILE_SUPERSEDED;
1733  } else {
1734  Irp->IoStatus.Information = FILE_OVERWRITTEN;
1735  }
1736  }
1737  }
1738 
1739  } else {
1740  DbgBreak();
1741  _SEH2_LEAVE;
1742  }
1743 
1744  } _SEH2_FINALLY {
1745 
1746  if (bFcbLockAcquired) {
1747  ExReleaseResourceLite(&Vcb->FcbLock);
1748  }
1749 
1750  if (ParentMcb) {
1751  Ext2DerefMcb(ParentMcb);
1752  }
1753 
1754  /* cleanup Fcb and Ccb, Mcb if necessary */
1755  if (!NT_SUCCESS(Status)) {
1756 
1757  if (Ccb != NULL) {
1758 
1759  DbgBreak();
1760 
1761  ASSERT(Fcb != NULL);
1762  ASSERT(Fcb->Mcb != NULL);
1763 
1764  DEBUG(DL_ERR, ("Ext2CreateFile: failed to create %wZ status = %xh\n",
1765  &Fcb->Mcb->FullName, Status));
1766 
1768  Ext2DerefXcb(&Fcb->ReferenceCount);
1769 
1770  if (!IsDirectory(Fcb)) {
1771  if (NoIntermediateBuffering) {
1772  Fcb->NonCachedOpenCount--;
1773  } else {
1775  }
1776  }
1777 
1778  Ext2DerefXcb(&Vcb->OpenHandleCount);
1779  Ext2DerefXcb(&Vcb->ReferenceCount);
1780 
1782 
1783  IrpSp->FileObject->FsContext = NULL;
1784  IrpSp->FileObject->FsContext2 = NULL;
1785  IrpSp->FileObject->PrivateCacheMap = NULL;
1786  IrpSp->FileObject->SectionObjectPointer = NULL;
1787 
1788  Ext2FreeCcb(Vcb, Ccb);
1789  }
1790 
1791  if (Fcb != NULL) {
1792 
1796  _SEH2_TRY {
1797  Size.QuadPart = 0;
1799  } _SEH2_FINALLY {
1801  } _SEH2_END;
1802  }
1803 
1804  if (bCreated) {
1806  }
1807  }
1808  }
1809 
1810  if (bMainResourceAcquired) {
1812  }
1813 
1814  /* free file name buffer */
1815  if (FileName.Buffer) {
1816  DEC_MEM_COUNT(PS_FILE_NAME, FileName.Buffer, FileName.MaximumLength);
1818  }
1819 
1820  /* dereference Fcb and parent */
1821  if (Fcb) {
1823  }
1824  if (ParentFcb) {
1826  }
1827 
1828  /* drop SymLink's refer: If succeeds, Ext2AllocateCcb should refer
1829  it already. It fails, we need release the refer to let it freed */
1830  if (SymLink) {
1831  Ext2DerefMcb(SymLink);
1832  }
1833  } _SEH2_END;
1834 
1835  return Status;
1836 }
1837 
1838 NTSTATUS
1840 {
1842  PIRP Irp;
1843  PEXT2_CCB Ccb;
1844 
1845  NTSTATUS Status;
1846 
1849 
1850  ULONG Options;
1852  BOOLEAN OpenTargetDirectory;
1853 
1855 
1856  Irp = IrpContext->Irp;
1858 
1859  Options = IrpSp->Parameters.Create.Options;
1860 
1862  OpenTargetDirectory = IsFlagOn(IrpSp->Flags, SL_OPEN_TARGET_DIRECTORY);
1863 
1864  CreateDisposition = (Options >> 24) & 0x000000ff;
1865 
1866  DesiredAccess = IrpSp->Parameters.Create.SecurityContext->DesiredAccess;
1867  ShareAccess = IrpSp->Parameters.Create.ShareAccess;
1868 
1869  if (DirectoryFile) {
1870  return STATUS_NOT_A_DIRECTORY;
1871  }
1872 
1873  if (OpenTargetDirectory) {
1874  DbgBreak();
1875  return STATUS_INVALID_PARAMETER;
1876  }
1877 
1878  if ( (CreateDisposition != FILE_OPEN) &&
1880  return STATUS_ACCESS_DENIED;
1881  }
1882 
1884  Vcb->OpenVolumeCount != 0 ) {
1885  return STATUS_SHARING_VIOLATION;
1886  }
1887 
1888  Ccb = Ext2AllocateCcb(0, NULL);
1889  if (Ccb == NULL) {
1891  goto errorout;
1892  }
1893 
1895 
1896  if (Vcb->OpenVolumeCount > 0) {
1898  IrpSp->FileObject,
1899  &(Vcb->ShareAccess), TRUE);
1900 
1901  if (!NT_SUCCESS(Status)) {
1902  goto errorout;
1903  }
1904  } else {
1906  IrpSp->FileObject,
1907  &(Vcb->ShareAccess) );
1908  }
1909 
1910 
1911  if (Vcb->OpenVolumeCount == 0 &&
1914 
1915  if (!IsVcbReadOnly(Vcb)) {
1918  }
1919 
1921  Vcb->LockFile = IrpSp->FileObject;
1922  } else {
1923 
1926  if (!IsVcbReadOnly(Vcb)) {
1929  }
1930  }
1931  }
1932 
1934  IrpSp->FileObject->FsContext = Vcb;
1935  IrpSp->FileObject->FsContext2 = Ccb;
1936  IrpSp->FileObject->Vpb = Vcb->Vpb;
1937 
1938  Ext2ReferXcb(&Vcb->ReferenceCount);
1939  Ext2ReferXcb(&Vcb->OpenHandleCount);
1940  Ext2ReferXcb(&Vcb->OpenVolumeCount);
1941 
1942  Irp->IoStatus.Information = FILE_OPENED;
1943 
1944 errorout:
1945 
1946  return Status;
1947 }
1948 
1949 
1950 NTSTATUS
1952 {
1954  PIRP Irp;
1956  PEXT2_VCB Vcb = 0;
1958  PEXT2_FCBVCB Xcb = NULL;
1959  BOOLEAN PostIrp = FALSE;
1960  BOOLEAN VcbResourceAcquired = FALSE;
1961 
1963  Irp = IrpContext->Irp;
1965 
1966  Xcb = (PEXT2_FCBVCB) (IrpSp->FileObject->FsContext);
1967 
1969 
1970  DEBUG(DL_INF, ( "Ext2Create: Create on main device object.\n"));
1971 
1973  Irp->IoStatus.Information = FILE_OPENED;
1974 
1976 
1977  return Status;
1978  }
1979 
1980  _SEH2_TRY {
1981 
1983  ASSERT(Vcb->Identifier.Type == EXT2VCB);
1984  IrpSp->FileObject->Vpb = Vcb->Vpb;
1985 
1986  if (!IsMounted(Vcb)) {
1987  DbgBreak();
1990  } else {
1992  }
1993  _SEH2_LEAVE;
1994  }
1995 
1997  &Vcb->MainResource, TRUE)) {
1999  _SEH2_LEAVE;
2000  }
2001  VcbResourceAcquired = TRUE;
2002 
2004 
2005  if (FlagOn(Vcb->Flags, VCB_VOLUME_LOCKED)) {
2009  }
2010  _SEH2_LEAVE;
2011  }
2012 
2013  if ( ((IrpSp->FileObject->FileName.Length == 0) &&
2014  (IrpSp->FileObject->RelatedFileObject == NULL)) ||
2015  (Xcb && Xcb->Identifier.Type == EXT2VCB) ) {
2017  } else {
2018 
2019  Status = Ext2CreateFile(IrpContext, Vcb, &PostIrp);
2020  }
2021 
2022  } _SEH2_FINALLY {
2023 
2024  if (VcbResourceAcquired) {
2025  ExReleaseResourceLite(&Vcb->MainResource);
2026  }
2027 
2028  if (!IrpContext->ExceptionInProgress && !PostIrp) {
2029  if ( Status == STATUS_PENDING ||
2030  Status == STATUS_CANT_WAIT) {
2032  } else {
2034  }
2035  }
2036  } _SEH2_END;
2037 
2038  return Status;
2039 }
2040 
2041 NTSTATUS
2044  PEXT2_VCB Vcb,
2045  PEXT2_FCB Parent,
2046  ULONG Type,
2047  ULONG FileAttr,
2049 {
2050  NTSTATUS Status;
2051  ULONG iGrp;
2052  ULONG iNo;
2053  struct inode Inode = { 0 };
2054  struct dentry *Dentry = NULL;
2055  struct ext3_super_block *es = EXT3_SB(&Vcb->sb)->s_es;
2056 
2057  LARGE_INTEGER SysTime;
2058 
2059  iGrp = (Parent->Inode->i_ino - 1) / BLOCKS_PER_GROUP;
2060 
2061  DEBUG(DL_INF, ("Ext2CreateInode: %S in %S(Inode=%xh)\n",
2062  FileName->Buffer,
2063  Parent->Mcb->ShortName.Buffer,
2064  Parent->Inode->i_ino));
2065 
2066  Status = Ext2NewInode(IrpContext, Vcb, iGrp, Type, &iNo);
2067  if (!NT_SUCCESS(Status)) {
2068  goto errorout;
2069  }
2070 
2071  KeQuerySystemTime(&SysTime);
2072  Ext2ClearInode(IrpContext, Vcb, iNo);
2073  Inode.i_sb = &Vcb->sb;
2074  Inode.i_ino = iNo;
2075  Inode.i_ctime = Inode.i_mtime =
2076  Inode.i_atime = Ext2LinuxTime(SysTime);
2077  if (IsFlagOn(Vcb->Flags, VCB_USER_IDS)) {
2078  Inode.i_uid = Vcb->uid;
2079  Inode.i_gid = Vcb->gid;
2080  } else {
2081  Inode.i_uid = Parent->Mcb->Inode.i_uid;
2082  Inode.i_gid = Parent->Mcb->Inode.i_gid;
2083  }
2084  Inode.i_generation = Parent->Inode->i_generation;
2085  Inode.i_mode = S_IPERMISSION_MASK &
2086  Parent->Inode->i_mode;
2087  if (Type == EXT2_FT_DIR) {
2088  Inode.i_mode |= S_IFDIR;
2089  } else if (Type == EXT2_FT_REG_FILE) {
2090  Inode.i_mode &= S_IFATTR;
2091  Inode.i_mode |= S_IFREG;
2092  } else {
2093  DbgBreak();
2094  }
2095  if (le16_to_cpu(es->s_want_extra_isize))
2096  Inode.i_extra_isize = le16_to_cpu(es->s_want_extra_isize);
2097 
2098  /* Force using extent */
2099  if (IsFlagOn(SUPER_BLOCK->s_feature_incompat, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
2100  Inode.i_flags |= EXT2_EXTENTS_FL;
2101  ext4_ext_tree_init(IrpContext, NULL, &Inode);
2102  /* ext4_ext_tree_init will save inode body */
2103  } else {
2104  /* save inode body to cache */
2105  Ext2SaveInode(IrpContext, Vcb, &Inode);
2106  }
2107 
2108  /* add new entry to its parent */
2109  Status = Ext2AddEntry(
2110  IrpContext,
2111  Vcb,
2112  Parent,
2113  &Inode,
2114  FileName,
2115  &Dentry
2116  );
2117 
2118  if (!NT_SUCCESS(Status)) {
2119  DbgBreak();
2120  Ext2FreeInode(IrpContext, Vcb, iNo, Type);
2121  goto errorout;
2122  }
2123 
2124  DEBUG(DL_INF, ("Ext2CreateInode: New Inode = %xh (Type=%xh)\n",
2125  Inode.i_ino, Type));
2126 
2127 errorout:
2128 
2129  if (Dentry)
2130  Ext2FreeEntry(Dentry);
2131 
2132  return Status;
2133 }
2134 
2135 
2136 NTSTATUS
2138  IN PEXT2_IRP_CONTEXT IrpContext,
2140  IN PEXT2_VCB Vcb,
2141  IN PEXT2_FCB Fcb,
2144 )
2145 {
2146  LARGE_INTEGER CurrentTime;
2148 
2149  KeQuerySystemTime(&CurrentTime);
2150 
2151  Size.QuadPart = 0;
2152  if (!MmCanFileBeTruncated(&(Fcb->SectionObject), &(Size))) {
2153  return STATUS_USER_MAPPED_FILE;
2154  }
2155 
2156  /* purge all file cache and shrink cache windows size */
2157  CcPurgeCacheSection(&Fcb->SectionObject, NULL, 0, FALSE);
2158  Fcb->Header.AllocationSize.QuadPart =
2159  Fcb->Header.FileSize.QuadPart =
2160  Fcb->Header.ValidDataLength.QuadPart = 0;
2162  (PCC_FILE_SIZES)&Fcb->Header.AllocationSize);
2163 
2164  Size.QuadPart = CEILING_ALIGNED(ULONGLONG,
2165  (ULONGLONG)AllocationSize->QuadPart,
2167 
2168  if ((loff_t)Size.QuadPart > Fcb->Inode->i_size) {
2169  Ext2ExpandFile(IrpContext, Vcb, Fcb->Mcb, &Size);
2170  } else {
2171  Ext2TruncateFile(IrpContext, Vcb, Fcb->Mcb, &Size);
2172  }
2173 
2174  Fcb->Header.AllocationSize = Size;
2175  if (Fcb->Header.AllocationSize.QuadPart > 0) {
2178  (PCC_FILE_SIZES)&Fcb->Header.AllocationSize );
2179  }
2180 
2181  /* remove all extent mappings */
2182  DEBUG(DL_EXT, ("Ext2SuperSede ...: %wZ\n", &Fcb->Mcb->FullName));
2183  Fcb->Inode->i_size = 0;
2184 
2185  if (Disposition == FILE_SUPERSEDE) {
2186  Fcb->Inode->i_ctime = Ext2LinuxTime(CurrentTime);
2187  }
2188  Fcb->Inode->i_atime =
2189  Fcb->Inode->i_mtime = Ext2LinuxTime(CurrentTime);
2190  Ext2SaveInode(IrpContext, Vcb, Fcb->Inode);
2191 
2192  // See if we need to overwrite EA of the file
2193  return Ext2OverwriteEa(IrpContext, Vcb, Fcb, &IrpContext->Irp->IoStatus);
2194 }
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
static unsigned int block
Definition: xmlmemory.c:118
NTSTATUS Ext2WinntError(int rc)
Definition: misc.c:410
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
signed char * PCHAR
Definition: retypes.h:7
#define FILE_GENERIC_READ
Definition: nt_native.h:653
struct _EXT2_FCB * PEXT2_FCB
#define Ext2DerefMcb(Mcb)
Definition: ext2fs.h:987
BOOLEAN NTAPI MmCanFileBeTruncated(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN PLARGE_INTEGER NewFileSize)
Definition: section.c:4724
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
Definition: fssup.c:384
#define MCB_TYPE_SPECIAL
Definition: ext2fs.h:949
#define FILE_WRITE_EA
Definition: nt_native.h:640
#define IN
Definition: typedefs.h:38
#define FILE_EXISTS
Definition: nt_native.h:772
PEXT2_CCB Ext2AllocateCcb(ULONG Flags, PEXT2_MCB SymLink)
Definition: memory.c:320
#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
NTSTATUS Ext2DeleteFile(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb, PEXT2_FCB Fcb, PEXT2_MCB Mcb)
Definition: fileinfo.c:1915
#define SL_CASE_SENSITIVE
Definition: iotypes.h:1777
PEXT2_FCB Fcb
Definition: ext2fs.h:905
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
PEXT2_MCB Target
Definition: ext2fs.h:899
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define IsMcbDirectory(Mcb)
Definition: ext2fs.h:958
struct inode Inode
Definition: ext2fs.h:936
#define S_IFATTR
Definition: ext2fs.h:400
#define FILE_OVERWRITTEN
Definition: nt_native.h:771
#define EXT3_DIR_REC_LEN(len)
Definition: ext3_fs.h:867
PEXT2_MCB Ext2AllocateMcb(IN PEXT2_VCB Vcb, IN PUNICODE_STRING FileName, IN PUNICODE_STRING Parent, IN ULONG FileAttr)
Definition: memory.c:1430
Type
Definition: Type.h:6
__u16 i_extra_isize
Definition: fs.h:99
#define CCB_DELETE_ON_CLOSE
Definition: ext2fs.h:1026
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
#define DEC_MEM_COUNT(_i, _p, _s)
Definition: ext2fs.h:599
#define DbgPrint
Definition: loader.c:25
ULONG Ext2TotalBlocks(PEXT2_VCB Vcb, PLARGE_INTEGER Size, PULONG pMeta)
Definition: fileinfo.c:1072
FSRTL_ADVANCED_FCB_HEADER Header
Definition: cdstruc.h:931
struct _FILE_FULL_EA_INFORMATION * PFILE_FULL_EA_INFORMATION
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define CEILING_ALIGNED(T, A, B)
Definition: ext2fs.h:111
Iosb Status
Definition: create.c:4311
LARGE_INTEGER Ext2NtTime(IN ULONG i_time)
Definition: misc.c:40
#define SL_OPEN_PAGING_FILE
Definition: iotypes.h:1774
_In_ PIRP Irp
Definition: csq.h:116
#define Ext2FileCanRead
Definition: ext2fs.h:426
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
Definition: ext3_fs.h:774
uint16_t * PWSTR
Definition: typedefs.h:54
Extended Attribute manipulation.
if(OpenRequiringOplock &&(Iosb.Status==STATUS_SUCCESS))
Definition: create.c:4324
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
PDEVICE_OBJECT DeviceObject
Definition: ext2fs.h:1051
umode_t i_mode
Definition: fs.h:87
#define VCB_DEVICE_REMOVED
Definition: ext2fs.h:791
NTSTATUS Ext2FollowLink(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Parent, IN PEXT2_MCB Mcb, IN ULONG Linkdep)
Definition: create.c:67
unsigned char * PUCHAR
Definition: retypes.h:3
#define EXT2_MAX_NESTED_LINKS
Definition: ext2fs.h:75
__u32 i_generation
Definition: fs.h:92
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Out_ PIO_STATUS_BLOCK _In_opt_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _In_ ULONG _In_ ULONG _In_opt_ PVOID EaBuffer
Definition: iofuncs.h:835
#define le16_to_cpu
Definition: module.h:149
LONG NTSTATUS
Definition: precomp.h:26
#define ENODATA
Definition: errno.h:65
#define FILE_CREATE
Definition: from_kernel.h:55
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define FILE_OPENED
Definition: nt_native.h:769
#define FILE_SUPERSEDED
Definition: nt_native.h:768
PIRP Irp
Definition: ext2fs.h:1041
PEXT2_IRP_CONTEXT IrpContext
Definition: ext4_xattr.h:141
#define DO_VERIFY_VOLUME
Definition: env_spec_w32.h:393
#define Ext2ReferMcb(Mcb)
Definition: ext2fs.h:986
__u16 i_nlink
Definition: fs.h:91
VOID Ext2FreeMcb(IN PEXT2_VCB Vcb, IN PEXT2_MCB Mcb)
Definition: memory.c:1538
unsigned short Length
Definition: sprintf.c:451
#define FILE_NOTIFY_CHANGE_SIZE
#define FILE_NOTIFY_CHANGE_LAST_WRITE
#define FILE_OVERWRITE
Definition: from_kernel.h:57
#define FILE_NOTIFY_CHANGE_FILE_NAME
NTSTATUS Ext2FlushVolume(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN BOOLEAN bShutDown)
Definition: flush.c:39
#define S_IFREG
Definition: ext2fs.h:356
__u32 i_atime
Definition: fs.h:81
VOID NTAPI IoSetShareAccess(IN ACCESS_MASK DesiredAccess, IN ULONG DesiredShareAccess, IN PFILE_OBJECT FileObject, OUT PSHARE_ACCESS ShareAccess)
Definition: file.c:3516
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:728
int ext4_fs_set_xattr(struct ext4_xattr_ref *ref, __u8 name_index, const char *name, size_t name_len, const void *data, size_t data_size, BOOL replace)
Definition: ext4_xattr.c:1024
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define VCB_USER_IDS
Definition: ext2fs.h:785
#define FO_NO_INTERMEDIATE_BUFFERING
Definition: iotypes.h:1735
STRING OEM_STRING
Definition: umtypes.h:203
#define FILE_APPEND_DATA
Definition: nt_native.h:634
enum OPTION_FLAGS Options
Definition: stats.c:44
#define FILE_NOTIFY_CHANGE_DIR_NAME
BOOLEAN Ext2IsEaNameValid(IN OEM_STRING Name)
Definition: ea.c:389
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
VOID NTAPI IoRemoveShareAccess(IN PFILE_OBJECT FileObject, IN PSHARE_ACCESS ShareAccess)
Definition: file.c:3477
__u32 i_mtime
Definition: fs.h:83
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
#define FILE_SHARE_READ
Definition: compat.h:125
#define FILE_OPEN_BY_FILE_ID
Definition: from_kernel.h:41
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
_SEH2_TRY
Definition: create.c:4250
NTSTATUS Ext2ScanDir(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Parent, IN PUNICODE_STRING FileName, OUT PULONG Inode, OUT struct dentry **dentry)
Definition: create.c:570
NTSTATUS Ext2TruncateFile(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb, PEXT2_MCB Mcb, PLARGE_INTEGER AllocationSize)
Definition: fileinfo.c:1199
EXT2_IDENTIFIER_TYPE Type
Definition: ext2fs.h:472
Definition: fs.h:78
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
#define S_ISLNK(m)
Definition: ext2fs.h:368
int ext4_ext_tree_init(void *icb, handle_t *handle, struct inode *inode)
#define DL_EXT
Definition: ext2fs.h:1406
VOID Ext2FreeEntry(IN struct dentry *de)
Definition: memory.c:432
#define MCB_FILE_DELETED
Definition: ext2fs.h:946
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB Vcb
Definition: create.c:4157
int Ext2CheckFileAccess(PEXT2_VCB Vcb, PEXT2_MCB Mcb, int attempt)
Definition: access.c:51
VOID Ext2InsertMcb(PEXT2_VCB Vcb, PEXT2_MCB Parent, PEXT2_MCB Child)
Definition: memory.c:1686
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
void * Buffer
Definition: sprintf.c:453
#define PS_FILE_NAME
Definition: common.h:24
#define STATUS_NOT_A_DIRECTORY
Definition: udferr_usr.h:169
#define FILE_DELETE_CHILD
Definition: nt_native.h:645
NTSTATUS Ext2QueueRequest(IN PEXT2_IRP_CONTEXT IrpContext)
Definition: dispatch.c:150
char name[EXT3_NAME_LEN]
Definition: ext3_fs.h:779
#define STATUS_SHARING_VIOLATION
Definition: udferr_usr.h:154
NTSTATUS Ext2IsFileRemovable(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_FCB Fcb, IN PEXT2_CCB Ccb)
Definition: fileinfo.c:1234
int ext3_mark_inode_dirty(struct ext2_icb *icb, struct inode *in)
Definition: htree.c:360
long LONG
Definition: pedump.c:60
gid_t i_gid
Definition: fs.h:89
EXT2_IDENTIFIER Identifier
Definition: ext2fs.h:624
#define FILE_READ_DATA
Definition: nt_native.h:628
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT FileObject
Definition: create.c:4157
#define FILE_NO_EA_KNOWLEDGE
Definition: from_kernel.h:36
NTSTATUS Ext2FreeInode(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN ULONG Inode, IN ULONG Type)
Definition: generic.c:1699
#define IsFlagOn(a, b)
Definition: ext2fs.h:177
#define EXT4_XATTR_INDEX_USER
Definition: ext4_xattr.h:52
#define FILE_OPBATCH_BREAK_UNDERWAY
#define FILE_ACTION_MODIFIED
VOID Ext2NotifyReportChange(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Mcb, IN ULONG Filter, IN ULONG Action)
Definition: dirctl.c:1209
PVOID DeviceExtension
Definition: env_spec_w32.h:418
unsigned char BOOLEAN
#define IsFileDeleted(Mcb)
Definition: ext2fs.h:959
smooth NULL
Definition: ftsmooth.c:416
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define INC_MEM_COUNT(_i, _p, _s)
Definition: ext2fs.h:598
NTSTATUS NTAPI IoCheckEaBufferValidity(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: util.c:191
PEXT2_FCB Ext2AllocateFcb(IN PEXT2_VCB Vcb, IN PEXT2_MCB Mcb)
Definition: memory.c:131
#define STATUS_MEDIA_WRITE_PROTECTED
Definition: udferr_usr.h:161
BOOLEAN Ext2LoadInode(IN PEXT2_VCB Vcb, IN struct inode *Inode)
Definition: generic.c:504
#define ClearLongFlag(_F, _SF)
Definition: ext2fs.h:254
Definition: bufpool.h:45
BOOLEAN Ext2IsNameValid(PUNICODE_STRING FileName)
Definition: create.c:36
Definition: fs.h:117
unsigned int dir
Definition: maze.c:112
#define STATUS_USER_MAPPED_FILE
Definition: ntstatus.h:697
#define FILE_ATTRIBUTE_REPARSE_POINT
Definition: ntifs_ex.h:381
#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
#define EXT2_LOOKUP_FLAG_MASK
Definition: ext2fs.h:1342
__u32 i_flags
Definition: fs.h:94
#define EXT4_FEATURE_INCOMPAT_EXTENTS
Definition: ext3_fs.h:709
#define EXT2_FNAME_MAGIC
Definition: ext2fs.h:293
ULONG Ext2OEMToUnicodeSize(IN PEXT2_VCB Vcb, IN PANSI_STRING Oem)
Definition: misc.c:183
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
int ext4_fs_get_xattr_ref(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB fs, PEXT2_MCB inode_ref, struct ext4_xattr_ref *ref)
Definition: ext4_xattr.c:1105
#define S_IFDIR
Definition: acwin.h:115
#define EXT2_ROOT_INO
Definition: ext2.h:177
NTSTATUS Ext2AddEntry(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_FCB Dcb, IN struct inode *Inode, IN PUNICODE_STRING FileName, OUT struct dentry **dentry)
ULONG OpenHandleCount
Definition: ntfs.h:533
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
int64_t LONGLONG
Definition: typedefs.h:66
#define BLOCK_SIZE
Definition: dlist.c:220
__u32 i_ctime
Definition: fs.h:82
static LPSTR pName
Definition: security.c:75
SHARE_ACCESS ShareAccess
Definition: cdstruc.h:1015
UNICODE_STRING FullName
Definition: ext2fs.h:911
NTSTATUS Ext2CreateFile(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb, PBOOLEAN OpPostIrp)
Definition: create.c:829
__wchar_t WCHAR
Definition: xmlstorage.h:180
NTSTATUS Ext2OverwriteEa(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb, PEXT2_FCB Fcb, PIO_STATUS_BLOCK Iosb)
Definition: create.c:684
return Iosb
Definition: create.c:4426
int ext4_fs_put_xattr_ref(struct ext4_xattr_ref *ref)
Definition: ext4_xattr.c:1176
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
VOID NTAPI FsRtlDissectName(IN UNICODE_STRING Name, OUT PUNICODE_STRING FirstPart, OUT PUNICODE_STRING RemainingPart)
Definition: name.c:398
#define DL_INF
Definition: ext2fs.h:1399
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
BOOLEAN NTAPI MmFlushImageSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN MMFLUSH_TYPE FlushType)
Definition: section.c:4798
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
uid_t i_uid
Definition: fs.h:88
#define IsVcbReadOnly(Vcb)
Definition: ext2fs.h:805
uint64_t ULONGLONG
Definition: typedefs.h:65
#define S_ISDIR(mode)
Definition: various.h:18
struct _DEVICE_OBJECT * RealDevice
Definition: iotypes.h:172
#define IsMcbSymLink(Mcb)
Definition: ext2fs.h:953
struct dentry * de
Definition: ext2fs.h:937
#define CCB_OPEN_REPARSE_POINT
Definition: ext2fs.h:1025
#define MCB_TYPE_SYMLINK
Definition: ext2fs.h:950
NTSTATUS Ext2CreateInode(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb, PEXT2_FCB Parent, ULONG Type, ULONG FileAttr, PUNICODE_STRING FileName)
Definition: create.c:2042
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
struct _EXT2_FCBVCB * PEXT2_FCBVCB
_In_ PSTRING FullName
Definition: rtlfuncs.h:1649
#define STATUS_OBJECT_PATH_NOT_FOUND
Definition: udferr_usr.h:151
#define Ext2ReferXcb(_C)
Definition: ext2fs.h:967
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
BOOLEAN Ext2IsSpecialSystemFile(IN PUNICODE_STRING FileName, IN BOOLEAN bDirectory)
Definition: create.c:224
__le32 inode
Definition: ext3_fs.h:775
NTSTATUS Ext2Create(IN PEXT2_IRP_CONTEXT IrpContext)
Definition: create.c:1951
VOID Ext2LinkTailMcb(PEXT2_VCB Vcb, PEXT2_MCB Mcb)
Definition: memory.c:2900
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
BOOLEAN NTAPI FsRtlCurrentBatchOplock(IN POPLOCK Oplock)
Definition: oplock.c:1366
* PFILE_OBJECT
Definition: iotypes.h:1955
_In_ PFCB ParentFcb
Definition: cdprocs.h:741
Definition: partlist.h:33
#define FO_CACHE_SUPPORTED
Definition: iotypes.h:1738
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ULONG Flags
Definition: ntfs.h:532
#define VCB_WRITE_PROTECTED
Definition: ext2fs.h:796
#define FILE_DOES_NOT_EXIST
Definition: nt_native.h:773
unsigned __int64 loff_t
Definition: types.h:80
void __brelse(struct buffer_head *)
Definition: linux.c:800
CD_MCB Mcb
Definition: cdstruc.h:1022
#define STATUS_CANNOT_DELETE
Definition: shellext.h:71
int ret
char * PBOOLEAN
Definition: retypes.h:11
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static ext3_fsblk_t ext3_free_blocks_count(struct ext3_super_block *es)
Definition: ext2fs.h:1704
static const WCHAR L[]
Definition: oid.c:1250
#define VCB_DISMOUNT_PENDING
Definition: ext2fs.h:782
struct buffer_head * ext3_find_entry(struct ext2_icb *icb, struct dentry *dentry, struct ext3_dir_entry_2 **res_dir)
Definition: htree.c:2166
NTSTATUS Ext2CompleteIrpContext(IN PEXT2_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
Definition: read.c:32
_Must_inspect_result_ _In_ PFLT_INSTANCE _Out_ PBOOLEAN IsDirectory
Definition: fltkernel.h:1139
__u32 ext3_lblk_t
Definition: ext3_fs_i.h:30
#define FILE_ADD_SUBDIRECTORY
Definition: nt_native.h:635
#define FCB_FILE_MODIFIED
Definition: ext2fs.h:873
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define FlagOn(_F, _SF)
Definition: ext2fs.h:179
#define STATUS_INVALID_EA_NAME
Definition: ntstatus.h:187
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
NTSTATUS Ext2NewInode(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN ULONG GroupHint, IN ULONG Type, OUT PULONG Inode)
Definition: generic.c:1299
ERESOURCE MainResource
Definition: ntfs.h:524
NTSTATUS Ext2OEMToUnicode(IN PEXT2_VCB Vcb, IN OUT PUNICODE_STRING Oem, IN POEM_STRING Unicode)
Definition: misc.c:206
__u32 i_ino
Definition: fs.h:79
USHORT ShareAccess
Definition: iotypes.h:2764
char * b_data
Definition: module.h:725
ClearFlag(Dirent->Flags, DIRENT_FLAG_NOT_PERSISTENT)
Status
Definition: gdiplustypes.h:24
#define DL_ERR
Definition: ext2fs.h:1397
#define FILE_OPEN
Definition: from_kernel.h:54
#define DL_RES
Definition: ext2fs.h:1403
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:2813
_SEH2_END
Definition: create.c:4424
#define SL_OPEN_TARGET_DIRECTORY
Definition: iotypes.h:1775
NTSTATUS Ext2AddDotEntries(struct ext2_icb *icb, struct inode *dir, struct inode *inode)
Definition: create.c:642
BOOLEAN Ext2ClearInode(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN ULONG inode)
Definition: generic.c:526
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
NTSTATUS Ext2FlushFiles(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN BOOLEAN bShutDown)
Definition: flush.c:108
PEXT2_GLOBAL Ext2Global
Definition: init.c:16
__u8 name_len
Definition: ext3_fs.h:777
PEXT2_MCB Ext2SearchMcbWithoutLock(PEXT2_MCB Parent, PUNICODE_STRING FileName)
Definition: memory.c:1622
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
#define Ext2RaiseStatus(IRPCONTEXT, STATUS)
Definition: ext2fs.h:258
NTSTATUS Ext2ExpandFile(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb, PEXT2_MCB Mcb, PLARGE_INTEGER Size)
Definition: fileinfo.c:1147
#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
_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 SetLongFlag(_F, _SF)
Definition: ext2fs.h:253
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
_SEH2_FINALLY
Definition: create.c:4395
NTSTATUS Ext2CreateVolume(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb)
Definition: create.c:1839
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
unsigned int * PULONG
Definition: retypes.h:1
struct buffer_head * ext3_append(struct ext2_icb *icb, struct inode *inode, ext3_lblk_t *block, int *err)
Definition: htree.c:279
#define FILE_CREATED
Definition: nt_native.h:770
NTSTATUS Ext2SupersedeOrOverWriteFile(IN PEXT2_IRP_CONTEXT IrpContext, IN PFILE_OBJECT FileObject, IN PEXT2_VCB Vcb, IN PEXT2_FCB Fcb, IN PLARGE_INTEGER AllocationSize, IN ULONG Disposition)
Definition: create.c:2137
#define STATUS_OPLOCK_BREAK_IN_PROGRESS
Definition: ntstatus.h:87
#define VCB_VOLUME_LOCKED
Definition: ext2fs.h:780
#define FILE_ACTION_ADDED
VOID NTAPI Ext2LockIrp(IN PVOID Context, IN PIRP Irp)
Definition: dispatch.c:86
#define IsMcbSpecialFile(Mcb)
Definition: ext2fs.h:955
VOID Ext2ReleaseFcb(IN PEXT2_FCB Fcb)
Definition: memory.c:276
#define S_IPERMISSION_MASK
Definition: ext2fs.h:375
#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
Definition: dirctrl.c:74
#define IsExt2FsDevice(DO)
Definition: ext2fs.h:607
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
#define FILE_SUPERSEDE
Definition: from_kernel.h:53
ERESOURCE PagingIoResource
Definition: ntfs.h:523
struct super_block * i_sb
Definition: fs.h:96
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
DEVICE_RELATION_TYPE Type
Definition: iotypes.h:2886
#define DbgBreak()
Definition: ext2fs.h:46
VOID Ext2FreePool(IN PVOID P, IN ULONG Tag)
Definition: debug.c:2697
__le16 rec_len
Definition: ext3_fs.h:776
VOID NTAPI IoSetHardErrorOrVerifyDevice(IN PIRP Irp, IN PDEVICE_OBJECT DeviceObject)
Definition: util.c:316
struct _EXT2_VCB * PEXT2_VCB
#define DEBUG(args)
Definition: rdesktop.h:129
NTSTATUS NTAPI FsRtlCheckOplock(IN POPLOCK Oplock, IN PIRP Irp, IN PVOID Context, IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL, IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL)
Definition: oplock.c:1172
#define FCB_ALLOC_IN_CREATE
Definition: ext2fs.h:875
VOID Ext2FreeCcb(IN PEXT2_VCB Vcb, IN PEXT2_CCB Ccb)
Definition: memory.c:356
#define _SEH2_LEAVE
Definition: filesup.c:20
#define STATUS_LINK_FAILED
Definition: ntstatus.h:540
IN PDCB IN POEM_STRING OemName
Definition: fatprocs.h:1294
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
_In_ PFCB Fcb
Definition: cdprocs.h:151
#define cpu_to_le16
Definition: module.h:148
#define es
Definition: i386-dis.c:431
return STATUS_SUCCESS
Definition: btrfs.c:2938
PVOID Ext2AllocatePool(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: debug.c:2684
NTSTATUS Ext2ReadSymlink(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Mcb, IN PVOID Buffer, IN ULONG Size, OUT PULONG BytesRead)
Definition: fsctl.c:1364
#define S_ISREG(mode)
Definition: various.h:17
#define EXT2_LOOKUP_NOT_FOLLOW
Definition: ext2fs.h:1343
#define FILE_OPEN_REPARSE_POINT
Definition: from_kernel.h:46
#define Ext2FileCanWrite
Definition: ext2fs.h:427
_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
VOID NTAPI Ext2OplockComplete(IN PVOID Context, IN PIRP Irp)
Definition: dispatch.c:41
HRESULT Create([out]ITransactionReceiver **ppReceiver)
#define EXT3_SB(sb)
Definition: ext3_fs.h:615
BOOLEAN Ext2SaveInode(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN struct inode *Inode)
Definition: generic.c:548
NTSTATUS Ext2LookupFile(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PUNICODE_STRING FullName, IN PEXT2_MCB Parent, OUT PEXT2_MCB *Ext2Mcb, IN ULONG Linkdep)
Definition: create.c:273
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define IsMcbRoot(Mcb)
Definition: ext2fs.h:956
unsigned short * PUSHORT
Definition: retypes.h:2
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define BLOCKS_PER_GROUP
Definition: ext2fs.h:100
VOID Ext2VerifyVcb(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb)
Definition: fsctl.c:2277
_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
ULONG Ext2LinuxTime(IN LARGE_INTEGER SysTime)
Definition: misc.c:51
#define cpu_to_le32
Definition: module.h:146
#define Ext2DerefXcb(_C)
Definition: ext2fs.h:968
void ext3_set_de_type(struct super_block *sb, struct ext3_dir_entry_2 *de, umode_t mode)
Definition: htree.c:347
#define EXT2_EXTENTS_FL
Definition: ext2_fs.h:207
void ext4_xattr_purge_items(struct ext4_xattr_ref *xattr_ref)
Definition: ext4_xattr.c:736
#define DELETE
Definition: nt_native.h:57
#define STATUS_CANT_WAIT
Definition: ntstatus.h:438
struct dentry * Ext2BuildEntry(PEXT2_VCB Vcb, PEXT2_MCB Dcb, PUNICODE_STRING FileName)
Definition: memory.c:444
BOOLEAN ExceptionInProgress
Definition: ext2fs.h:1069