[NTFS] - Fix a mistake with AddFileName() from my last commit. Also, move CaseSensiti...
authorTrevor Thompson <tmt256@email.vccs.edu>
Sun, 25 Jun 2017 02:38:15 +0000 (02:38 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 10 Dec 2017 10:14:35 +0000 (11:14 +0100)
svn path=/branches/GSoC_2016/NTFS/; revision=75191

drivers/filesystems/ntfs/attrib.c
drivers/filesystems/ntfs/create.c
drivers/filesystems/ntfs/fcb.c
drivers/filesystems/ntfs/mft.c
drivers/filesystems/ntfs/ntfs.h

index 85f7f88..120cf90 100644 (file)
@@ -112,13 +112,13 @@ AddData(PFILE_RECORD_HEADER FileRecord,
 * Pointer to the FILE_OBJECT which represents the new name.
 * This parameter is used to determine the filename and parent directory.
 *
-* @param ParentMftIndex
-* Pointer to a ULONGLONG which will receive the index of the parent directory.
-*
 * @param CaseSensitive
 * Boolean indicating if the function should operate in case-sensitive mode. This will be TRUE
 * if an application opened the file with the FILE_FLAG_POSIX_SEMANTICS flag.
 *
+* @param ParentMftIndex
+* Pointer to a ULONGLONG which will receive the index of the parent directory.
+*
 * @return
 * STATUS_SUCCESS on success. STATUS_NOT_IMPLEMENTED if target address isn't at the end
 * of the given file record.
@@ -136,8 +136,8 @@ AddFileName(PFILE_RECORD_HEADER FileRecord,
             PNTFS_ATTR_RECORD AttributeAddress,
             PDEVICE_EXTENSION DeviceExt,
             PFILE_OBJECT FileObject,
-            PULONGLONG ParentMftIndex,
-            BOOLEAN CaseSensitive)
+            BOOLEAN CaseSensitive,
+            PULONGLONG ParentMftIndex)
 {
     ULONG ResidentHeaderLength = FIELD_OFFSET(NTFS_ATTR_RECORD, Resident.Reserved) + sizeof(UCHAR);
     PFILENAME_ATTRIBUTE FileNameAttribute;
index ddafb14..f52cd7d 100644 (file)
@@ -570,7 +570,10 @@ NtfsCreateFile(PDEVICE_OBJECT DeviceObject,
             }
 
             // Create the file record on disk
-            Status = NtfsCreateFileRecord(DeviceExt, FileObject, BooleanFlagOn(IrpContext->Flags, IRPCONTEXT_CANWAIT));
+            Status = NtfsCreateFileRecord(DeviceExt,
+                                          FileObject,
+                                          (Stack->Flags & SL_CASE_SENSITIVE),
+                                          BooleanFlagOn(IrpContext->Flags,IRPCONTEXT_CANWAIT));
             if (!NT_SUCCESS(Status))
             {
                 DPRINT1("ERROR: Couldn't create file record!\n");
@@ -656,6 +659,7 @@ NtfsCreate(PNTFS_IRP_CONTEXT IrpContext)
 NTSTATUS
 NtfsCreateFileRecord(PDEVICE_EXTENSION DeviceExt,
                      PFILE_OBJECT FileObject,
+                     BOOLEAN CaseSensitive,
                      BOOLEAN CanWait)
 {
     NTSTATUS Status = STATUS_SUCCESS;
@@ -665,7 +669,11 @@ NtfsCreateFileRecord(PDEVICE_EXTENSION DeviceExt,
     ULONGLONG ParentMftIndex;
     ULONGLONG FileMftIndex;
 
-    DPRINT1("NtfsCreateFileRecord(%p, %p, %s)\n", DeviceExt, FileObject, CanWait ? "TRUE" : "FALSE");
+    DPRINT1("NtfsCreateFileRecord(%p, %p, %s, %s)\n",
+            DeviceExt,
+            FileObject,
+            CaseSensitive ? "TRUE" : "FALSE",
+            CanWait ? "TRUE" : "FALSE");
 
     // allocate memory for file record
     FileRecord = ExAllocatePoolWithTag(NonPagedPool,
@@ -709,7 +717,7 @@ NtfsCreateFileRecord(PDEVICE_EXTENSION DeviceExt,
     NextAttribute = (PNTFS_ATTR_RECORD)((ULONG_PTR)NextAttribute + (ULONG_PTR)NextAttribute->Length);
 
     // Add the $FILE_NAME attribute
-    AddFileName(FileRecord, NextAttribute, DeviceExt, FileObject, &ParentMftIndex);
+    AddFileName(FileRecord, NextAttribute, DeviceExt, FileObject, CaseSensitive, &ParentMftIndex);
 
     // save a pointer to the filename attribute
     FilenameAttribute = (PFILENAME_ATTRIBUTE)((ULONG_PTR)NextAttribute + NextAttribute->Resident.ValueOffset);
index 531749d..851234c 100644 (file)
@@ -557,7 +557,7 @@ NtfsDirFindFile(PNTFS_VCB Vcb,
         DPRINT1("Will now look for file '%wZ' with stream '%S'\n", &File, Colon);
     }
 
-    Status = NtfsLookupFileAt(Vcb, &File, &FileRecord, &MFTIndex, CurrentDir, CaseSensitive);
+    Status = NtfsLookupFileAt(Vcb, &File, CaseSensitive, &FileRecord, &MFTIndex, CurrentDir);
     if (!NT_SUCCESS(Status))
     {
         return Status;
index 2c0dab6..e83c33e 100644 (file)
@@ -2106,16 +2106,22 @@ NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
 NTSTATUS
 NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
                  PUNICODE_STRING PathName,
+                 BOOLEAN CaseSensitive,
                  PFILE_RECORD_HEADER *FileRecord,
                  PULONGLONG MFTIndex,
-                 ULONGLONG CurrentMFTIndex,
-                 BOOLEAN CaseSensitive)
+                 ULONGLONG CurrentMFTIndex)
 {
     UNICODE_STRING Current, Remaining;
     NTSTATUS Status;
     ULONG FirstEntry = 0;
 
-    DPRINT("NtfsLookupFileAt(%p, %wZ, %p, %I64x)\n", Vcb, PathName, FileRecord, CurrentMFTIndex);
+    DPRINT("NtfsLookupFileAt(%p, %wZ, %s, %p, %p, %I64x)\n",
+           Vcb,
+           PathName,
+           CaseSensitive ? "TRUE" : "FALSE",
+           FileRecord,
+           MFTIndex,
+           CurrentMFTIndex);
 
     FsRtlDissectName(*PathName, &Current, &Remaining);
 
@@ -2158,11 +2164,11 @@ NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
 NTSTATUS
 NtfsLookupFile(PDEVICE_EXTENSION Vcb,
                PUNICODE_STRING PathName,
+               BOOLEAN CaseSensitive,
                PFILE_RECORD_HEADER *FileRecord,
-               PULONGLONG MFTIndex,
-               BOOLEAN CaseSensitive)
+               PULONGLONG MFTIndex)
 {
-    return NtfsLookupFileAt(Vcb, PathName, FileRecord, MFTIndex, NTFS_FILE_ROOT, CaseSensitive);
+    return NtfsLookupFileAt(Vcb, PathName, CaseSensitive, FileRecord, MFTIndex, NTFS_FILE_ROOT);
 }
 
 /**
index f54a14d..b2633c0 100644 (file)
@@ -536,6 +536,7 @@ AddFileName(PFILE_RECORD_HEADER FileRecord,
             PNTFS_ATTR_RECORD AttributeAddress,
             PDEVICE_EXTENSION DeviceExt,
             PFILE_OBJECT FileObject,
+            BOOLEAN CaseSensitive,
             PULONGLONG ParentMftIndex);
 
 NTSTATUS
@@ -668,6 +669,7 @@ NtfsCreate(PNTFS_IRP_CONTEXT IrpContext);
 NTSTATUS
 NtfsCreateFileRecord(PDEVICE_EXTENSION DeviceExt,
                      PFILE_OBJECT FileObject,
+                     BOOLEAN CaseSensitive,
                      BOOLEAN CanWait);
 
 /* devctl.c */
@@ -970,16 +972,17 @@ EnumerAttribute(PFILE_RECORD_HEADER file,
 NTSTATUS
 NtfsLookupFile(PDEVICE_EXTENSION Vcb,
                PUNICODE_STRING PathName,
+               BOOLEAN CaseSensitive,
                PFILE_RECORD_HEADER *FileRecord,
                PULONGLONG MFTIndex);
 
 NTSTATUS
 NtfsLookupFileAt(PDEVICE_EXTENSION Vcb,
                  PUNICODE_STRING PathName,
+                 BOOLEAN CaseSensitive,
                  PFILE_RECORD_HEADER *FileRecord,
                  PULONGLONG MFTIndex,
-                 ULONGLONG CurrentMFTIndex,
-                 BOOLEAN CaseSensitive);
+                 ULONGLONG CurrentMFTIndex);
 
 VOID
 NtfsDumpFileRecord(PDEVICE_EXTENSION Vcb,