diff --git a/drivers/filesystems/ntfs/attrib.c b/drivers/filesystems/ntfs/attrib.c index 85f7f880476..120cf901853 100644 --- a/drivers/filesystems/ntfs/attrib.c +++ b/drivers/filesystems/ntfs/attrib.c @@ -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; diff --git a/drivers/filesystems/ntfs/create.c b/drivers/filesystems/ntfs/create.c index ddafb14d678..f52cd7d187d 100644 --- a/drivers/filesystems/ntfs/create.c +++ b/drivers/filesystems/ntfs/create.c @@ -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); diff --git a/drivers/filesystems/ntfs/fcb.c b/drivers/filesystems/ntfs/fcb.c index 531749d4d28..851234c4fec 100644 --- a/drivers/filesystems/ntfs/fcb.c +++ b/drivers/filesystems/ntfs/fcb.c @@ -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; diff --git a/drivers/filesystems/ntfs/mft.c b/drivers/filesystems/ntfs/mft.c index 2c0dab65864..e83c33e6de7 100644 --- a/drivers/filesystems/ntfs/mft.c +++ b/drivers/filesystems/ntfs/mft.c @@ -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); } /** diff --git a/drivers/filesystems/ntfs/ntfs.h b/drivers/filesystems/ntfs/ntfs.h index f54a14d2545..b2633c0dd89 100644 --- a/drivers/filesystems/ntfs/ntfs.h +++ b/drivers/filesystems/ntfs/ntfs.h @@ -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,