Author: tthompson
Date: Sat Jun 24 04:36:28 2017
New Revision: 75178
URL:
http://svn.reactos.org/svn/reactos?rev=75178&view=rev
Log:
[NTFS] - Fix POSIX rules. Fix accessing long filenames created in Windows when 8dot3 name
creation is disabled.
Whether or not a filename should be interpreted as case-sensitive is dependent on a flag
passed to the driver when a file is created (opened); it's separate from the namespace
associated with the file being accessed.
Modified:
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/fcb.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/finfo.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h
branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
==============================================================================
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/attrib.c [iso-8859-1] Sat Jun 24
04:36:28 2017
@@ -115,6 +115,10 @@
* @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.
+*
* @return
* STATUS_SUCCESS on success. STATUS_NOT_IMPLEMENTED if target address isn't at the
end
* of the given file record.
@@ -132,7 +136,8 @@
PNTFS_ATTR_RECORD AttributeAddress,
PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject,
- PULONGLONG ParentMftIndex)
+ PULONGLONG ParentMftIndex,
+ BOOLEAN CaseSensitive)
{
ULONG ResidentHeaderLength = FIELD_OFFSET(NTFS_ATTR_RECORD, Resident.Reserved) +
sizeof(UCHAR);
PFILENAME_ATTRIBUTE FileNameAttribute;
@@ -178,7 +183,13 @@
if(Remaining.Length != 0)
RtlCopyUnicodeString(&FilenameNoPath, &Remaining);
- Status = NtfsFindMftRecord(DeviceExt, CurrentMFTIndex, &Current,
&FirstEntry, FALSE, &CurrentMFTIndex);
+ Status = NtfsFindMftRecord(DeviceExt,
+ CurrentMFTIndex,
+ &Current,
+ &FirstEntry,
+ FALSE,
+ &CurrentMFTIndex,
+ CaseSensitive);
if (!NT_SUCCESS(Status))
break;
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
==============================================================================
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/create.c [iso-8859-1] Sat Jun 24
04:36:28 2017
@@ -246,6 +246,7 @@
NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject,
PWSTR FileName,
+ BOOLEAN CaseSensitive,
PNTFS_FCB * FoundFCB)
{
PNTFS_FCB ParentFcb;
@@ -253,7 +254,12 @@
NTSTATUS Status;
PWSTR AbsFileName = NULL;
- DPRINT1("NtfsOpenFile(%p, %p, %S, %p)\n", DeviceExt, FileObject, FileName,
FoundFCB);
+ DPRINT1("NtfsOpenFile(%p, %p, %S, %s, %p)\n",
+ DeviceExt,
+ FileObject,
+ FileName,
+ CaseSensitive ? "TRUE" : "FALSE",
+ FoundFCB);
*FoundFCB = NULL;
@@ -285,7 +291,8 @@
Status = NtfsGetFCBForFile(DeviceExt,
&ParentFcb,
&Fcb,
- FileName);
+ FileName,
+ CaseSensitive);
if (ParentFcb != NULL)
{
NtfsReleaseFCB(DeviceExt,
@@ -412,6 +419,7 @@
Status = NtfsOpenFile(DeviceExt,
FileObject,
((RequestedOptions & FILE_OPEN_BY_FILE_ID) ?
FullPath.Buffer : FileObject->FileName.Buffer),
+ (Stack->Flags & SL_CASE_SENSITIVE),
&Fcb);
if (RequestedOptions & FILE_OPEN_BY_FILE_ID)
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
==============================================================================
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] Sat Jun 24
04:36:28 2017
@@ -627,7 +627,8 @@
&Ccb->Entry,
&FileRecord,
&MFTRecord,
- Fcb->MFTIndex);
+ Fcb->MFTIndex,
+ (Stack->Flags & SL_CASE_SENSITIVE));
if (NT_SUCCESS(Status))
{
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/fcb.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
==============================================================================
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/fcb.c [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/fcb.c [iso-8859-1] Sat Jun 24
04:36:28 2017
@@ -506,6 +506,7 @@
NtfsDirFindFile(PNTFS_VCB Vcb,
PNTFS_FCB DirectoryFcb,
PWSTR FileToFind,
+ BOOLEAN CaseSensitive,
PNTFS_FCB *FoundFCB)
{
NTSTATUS Status;
@@ -517,7 +518,12 @@
PNTFS_ATTR_CONTEXT DataContext;
USHORT Length = 0;
- DPRINT1("NtfsDirFindFile(%p, %p, %S, %p)\n", Vcb, DirectoryFcb, FileToFind,
FoundFCB);
+ DPRINT1("NtfsDirFindFile(%p, %p, %S, %s, %p)\n",
+ Vcb,
+ DirectoryFcb,
+ FileToFind,
+ CaseSensitive ? "TRUE" : "FALSE",
+ FoundFCB);
*FoundFCB = NULL;
RtlInitUnicodeString(&File, FileToFind);
@@ -551,7 +557,7 @@
DPRINT1("Will now look for file '%wZ' with stream
'%S'\n", &File, Colon);
}
- Status = NtfsLookupFileAt(Vcb, &File, &FileRecord, &MFTIndex,
CurrentDir);
+ Status = NtfsLookupFileAt(Vcb, &File, &FileRecord, &MFTIndex, CurrentDir,
CaseSensitive);
if (!NT_SUCCESS(Status))
{
return Status;
@@ -587,7 +593,8 @@
NtfsGetFCBForFile(PNTFS_VCB Vcb,
PNTFS_FCB *pParentFCB,
PNTFS_FCB *pFCB,
- const PWSTR pFileName)
+ const PWSTR pFileName,
+ BOOLEAN CaseSensitive)
{
NTSTATUS Status;
WCHAR pathName [MAX_PATH];
@@ -596,11 +603,12 @@
PNTFS_FCB FCB;
PNTFS_FCB parentFCB;
- DPRINT("NtfsGetFCBForFile(%p, %p, %p, '%S')\n",
+ DPRINT("NtfsGetFCBForFile(%p, %p, %p, '%S', %s)\n",
Vcb,
pParentFCB,
pFCB,
- pFileName);
+ pFileName,
+ CaseSensitive ? "TRUE" : "FALSE");
/* Dummy code */
// FCB = NtfsOpenRootFCB(Vcb);
@@ -677,7 +685,7 @@
NtfsGetNextPathElement(currentElement) - currentElement);
DPRINT(" elementName:%S\n", elementName);
- Status = NtfsDirFindFile(Vcb, parentFCB, elementName, &FCB);
+ Status = NtfsDirFindFile(Vcb, parentFCB, elementName, CaseSensitive,
&FCB);
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
{
*pParentFCB = parentFCB;
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/finfo.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
==============================================================================
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/finfo.c [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/finfo.c [iso-8859-1] Sat Jun 24
04:36:28 2017
@@ -415,6 +415,10 @@
* @param IrpFlags
* ULONG describing the flags of the original IRP request (Irp->Flags).
*
+* @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 NewFileSize
* Pointer to a LARGE_INTEGER which indicates the new end of file (file size).
*
@@ -436,6 +440,7 @@
PFILE_OBJECT FileObject,
PDEVICE_EXTENSION DeviceExt,
ULONG IrpFlags,
+ BOOLEAN CaseSensitive,
PLARGE_INTEGER NewFileSize)
{
LARGE_INTEGER CurrentFileSize;
@@ -545,7 +550,13 @@
AllocationSize = ROUND_UP(NewFileSize->QuadPart,
Fcb->Vcb->NtfsInfo.BytesPerCluster);
- Status = UpdateFileNameRecord(Fcb->Vcb, ParentMFTId, &filename, FALSE,
NewFileSize->QuadPart, AllocationSize);
+ Status = UpdateFileNameRecord(Fcb->Vcb,
+ ParentMFTId,
+ &filename,
+ FALSE,
+ NewFileSize->QuadPart,
+ AllocationSize,
+ CaseSensitive);
ReleaseAttributeContext(DataContext);
ExFreePoolWithTag(FileRecord, TAG_NTFS);
@@ -620,7 +631,12 @@
DPRINT1("FIXME: Using hacky method of setting
FileAllocationInformation.\n");
case FileEndOfFileInformation:
EndOfFileInfo = (PFILE_END_OF_FILE_INFORMATION)SystemBuffer;
- Status = NtfsSetEndOfFile(Fcb, FileObject, DeviceExt, Irp->Flags,
&EndOfFileInfo->EndOfFile);
+ Status = NtfsSetEndOfFile(Fcb,
+ FileObject,
+ DeviceExt,
+ Irp->Flags,
+ (Stack->Flags & SL_CASE_SENSITIVE),
+ &EndOfFileInfo->EndOfFile);
break;
// TODO: all other information classes
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
==============================================================================
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/mft.c [iso-8859-1] Sat Jun 24
04:36:28 2017
@@ -1359,7 +1359,8 @@
PUNICODE_STRING FileName,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
- ULONGLONG NewAllocationSize)
+ ULONGLONG NewAllocationSize,
+ BOOLEAN CaseSensitive)
{
PFILE_RECORD_HEADER MftRecord;
PNTFS_ATTR_CONTEXT IndexRootCtx;
@@ -1369,7 +1370,14 @@
NTSTATUS Status;
ULONG CurrentEntry = 0;
- DPRINT("UpdateFileNameRecord(%p, %I64d, %wZ, %u, %I64u, %I64u)\n", Vcb,
ParentMFTIndex, FileName, DirSearch, NewDataSize, NewAllocationSize);
+ DPRINT("UpdateFileNameRecord(%p, %I64d, %wZ, %u, %I64u, %I64u, %s)\n",
+ Vcb,
+ ParentMFTIndex,
+ FileName,
+ DirSearch,
+ NewDataSize,
+ NewAllocationSize,
+ CaseSensitive ? "TRUE" : "FALSE");
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
Vcb->NtfsInfo.BytesPerFileRecord,
@@ -1421,7 +1429,8 @@
&CurrentEntry,
DirSearch,
NewDataSize,
- NewAllocationSize);
+ NewAllocationSize,
+ CaseSensitive);
ReleaseAttributeContext(IndexRootCtx);
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
@@ -1447,7 +1456,8 @@
PULONG CurrentEntry,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
- ULONGLONG NewAllocatedSize)
+ ULONGLONG NewAllocatedSize,
+ BOOLEAN CaseSensitive)
{
NTSTATUS Status;
ULONG RecordOffset;
@@ -1466,7 +1476,7 @@
if ((IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK) > 0x10
&&
*CurrentEntry >= *StartEntry &&
IndexEntry->FileName.NameType != NTFS_FILE_NAME_DOS &&
- CompareFileName(FileName, IndexEntry, DirSearch))
+ CompareFileName(FileName, IndexEntry, DirSearch, CaseSensitive))
{
*StartEntry = *CurrentEntry;
IndexEntry->FileName.DataSize = NewDataSize;
@@ -1517,7 +1527,19 @@
LastEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)&IndexBuffer->Header +
IndexBuffer->Header.TotalSizeOfEntries);
ASSERT(LastEntry <= (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexBuffer +
IndexBlockSize));
- Status = UpdateIndexEntryFileNameSize(NULL, NULL, NULL, 0, FirstEntry, LastEntry,
FileName, StartEntry, CurrentEntry, DirSearch, NewDataSize, NewAllocatedSize);
+ Status = UpdateIndexEntryFileNameSize(NULL,
+ NULL,
+ NULL,
+ 0,
+ FirstEntry,
+ LastEntry,
+ FileName,
+ StartEntry,
+ CurrentEntry,
+ DirSearch,
+ NewDataSize,
+ NewAllocatedSize,
+ CaseSensitive);
if (Status == STATUS_PENDING)
{
// write the index record back to disk
@@ -1827,7 +1849,8 @@
BOOLEAN
CompareFileName(PUNICODE_STRING FileName,
PINDEX_ENTRY_ATTRIBUTE IndexEntry,
- BOOLEAN DirSearch)
+ BOOLEAN DirSearch,
+ BOOLEAN CaseSensitive)
{
BOOLEAN Ret, Alloc = FALSE;
UNICODE_STRING EntryName;
@@ -1839,7 +1862,7 @@
if (DirSearch)
{
UNICODE_STRING IntFileName;
- if (IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX)
+ if (!CaseSensitive)
{
NT_VERIFY(NT_SUCCESS(RtlUpcaseUnicodeString(&IntFileName, FileName,
TRUE)));
Alloc = TRUE;
@@ -1849,7 +1872,7 @@
IntFileName = *FileName;
}
- Ret = FsRtlIsNameInExpression(&IntFileName, &EntryName,
(IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX), NULL);
+ Ret = FsRtlIsNameInExpression(&IntFileName, &EntryName, !CaseSensitive,
NULL);
if (Alloc)
{
@@ -1860,7 +1883,7 @@
}
else
{
- return (RtlCompareUnicodeString(FileName, &EntryName,
(IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX)) == 0);
+ return (RtlCompareUnicodeString(FileName, &EntryName, !CaseSensitive) == 0);
}
}
@@ -1900,6 +1923,7 @@
PULONG StartEntry,
PULONG CurrentEntry,
BOOLEAN DirSearch,
+ BOOLEAN CaseSensitive,
ULONGLONG *OutMFTIndex)
{
NTSTATUS Status;
@@ -1909,7 +1933,19 @@
ULONGLONG IndexAllocationSize;
PINDEX_BUFFER IndexBuffer;
- DPRINT("BrowseIndexEntries(%p, %p, %p, %u, %p, %p, %wZ, %u, %u, %u, %p)\n",
Vcb, MftRecord, IndexRecord, IndexBlockSize, FirstEntry, LastEntry, FileName, *StartEntry,
*CurrentEntry, DirSearch, OutMFTIndex);
+ DPRINT("BrowseIndexEntries(%p, %p, %p, %u, %p, %p, %wZ, %u, %u, %s, %s,
%p)\n",
+ Vcb,
+ MftRecord,
+ IndexRecord,
+ IndexBlockSize,
+ FirstEntry,
+ LastEntry,
+ FileName,
+ *StartEntry,
+ *CurrentEntry,
+ DirSearch ? "TRUE" : "FALSE",
+ CaseSensitive ? "TRUE" : "FALSE",
+ OutMFTIndex);
IndexEntry = FirstEntry;
while (IndexEntry < LastEntry &&
@@ -1918,7 +1954,7 @@
if ((IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK) >= 0x10
&&
*CurrentEntry >= *StartEntry &&
IndexEntry->FileName.NameType != NTFS_FILE_NAME_DOS &&
- CompareFileName(FileName, IndexEntry, DirSearch))
+ CompareFileName(FileName, IndexEntry, DirSearch, CaseSensitive))
{
*StartEntry = *CurrentEntry;
*OutMFTIndex = (IndexEntry->Data.Directory.IndexedFile &
NTFS_MFT_MASK);
@@ -1967,7 +2003,18 @@
LastEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)&IndexBuffer->Header +
IndexBuffer->Header.TotalSizeOfEntries);
ASSERT(LastEntry <= (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexBuffer +
IndexBlockSize));
- Status = BrowseIndexEntries(NULL, NULL, NULL, 0, FirstEntry, LastEntry, FileName,
StartEntry, CurrentEntry, DirSearch, OutMFTIndex);
+ Status = BrowseIndexEntries(NULL,
+ NULL,
+ NULL,
+ 0,
+ FirstEntry,
+ LastEntry,
+ FileName,
+ StartEntry,
+ CurrentEntry,
+ DirSearch,
+ CaseSensitive,
+ OutMFTIndex);
if (NT_SUCCESS(Status))
{
break;
@@ -1984,7 +2031,8 @@
PUNICODE_STRING FileName,
PULONG FirstEntry,
BOOLEAN DirSearch,
- ULONGLONG *OutMFTIndex)
+ ULONGLONG *OutMFTIndex,
+ BOOLEAN CaseSensitive)
{
PFILE_RECORD_HEADER MftRecord;
PNTFS_ATTR_CONTEXT IndexRootCtx;
@@ -2036,7 +2084,18 @@
DPRINT("IndexRecordSize: %x IndexBlockSize: %x\n",
Vcb->NtfsInfo.BytesPerIndexRecord, IndexRoot->SizeOfEntry);
- Status = BrowseIndexEntries(Vcb, MftRecord, IndexRecord, IndexRoot->SizeOfEntry,
IndexEntry, IndexEntryEnd, FileName, FirstEntry, &CurrentEntry, DirSearch,
OutMFTIndex);
+ Status = BrowseIndexEntries(Vcb,
+ MftRecord,
+ IndexRecord,
+ IndexRoot->SizeOfEntry,
+ IndexEntry,
+ IndexEntryEnd,
+ FileName,
+ FirstEntry,
+ &CurrentEntry,
+ DirSearch,
+ CaseSensitive,
+ OutMFTIndex);
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
ExFreePoolWithTag(MftRecord, TAG_NTFS);
@@ -2049,7 +2108,8 @@
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
- ULONGLONG CurrentMFTIndex)
+ ULONGLONG CurrentMFTIndex,
+ BOOLEAN CaseSensitive)
{
UNICODE_STRING Current, Remaining;
NTSTATUS Status;
@@ -2063,7 +2123,7 @@
{
DPRINT("Current: %wZ\n", &Current);
- Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry,
FALSE, &CurrentMFTIndex);
+ Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry,
FALSE, &CurrentMFTIndex, CaseSensitive);
if (!NT_SUCCESS(Status))
{
return Status;
@@ -2099,9 +2159,10 @@
NtfsLookupFile(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
- PULONGLONG MFTIndex)
-{
- return NtfsLookupFileAt(Vcb, PathName, FileRecord, MFTIndex, NTFS_FILE_ROOT);
+ PULONGLONG MFTIndex,
+ BOOLEAN CaseSensitive)
+{
+ return NtfsLookupFileAt(Vcb, PathName, FileRecord, MFTIndex, NTFS_FILE_ROOT,
CaseSensitive);
}
/**
@@ -2150,13 +2211,21 @@
PULONG FirstEntry,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
- ULONGLONG CurrentMFTIndex)
+ ULONGLONG CurrentMFTIndex,
+ BOOLEAN CaseSensitive)
{
NTSTATUS Status;
- DPRINT("NtfsFindFileAt(%p, %wZ, %u, %p, %p, %I64x)\n", Vcb, SearchPattern,
*FirstEntry, FileRecord, MFTIndex, CurrentMFTIndex);
-
- Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE,
&CurrentMFTIndex);
+ DPRINT("NtfsFindFileAt(%p, %wZ, %u, %p, %p, %I64x, %s)\n",
+ Vcb,
+ SearchPattern,
+ *FirstEntry,
+ FileRecord,
+ MFTIndex,
+ CurrentMFTIndex,
+ (CaseSensitive ? "TRUE" : "FALSE"));
+
+ Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE,
&CurrentMFTIndex, CaseSensitive);
if (!NT_SUCCESS(Status))
{
DPRINT("NtfsFindFileAt: NtfsFindMftRecord() failed with status
0x%08lx\n", Status);
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
==============================================================================
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Sat Jun 24
04:36:28 2017
@@ -781,7 +781,8 @@
NtfsGetFCBForFile(PNTFS_VCB Vcb,
PNTFS_FCB *pParentFCB,
PNTFS_FCB *pFCB,
- const PWSTR pFileName);
+ const PWSTR pFileName,
+ BOOLEAN CaseSensitive);
NTSTATUS
NtfsReadFCBAttribute(PNTFS_VCB Vcb,
@@ -811,6 +812,7 @@
PFILE_OBJECT FileObject,
PDEVICE_EXTENSION DeviceExt,
ULONG IrpFlags,
+ BOOLEAN CaseSensitive,
PLARGE_INTEGER NewFileSize);
NTSTATUS
@@ -892,7 +894,8 @@
BOOLEAN
CompareFileName(PUNICODE_STRING FileName,
PINDEX_ENTRY_ATTRIBUTE IndexEntry,
- BOOLEAN DirSearch);
+ BOOLEAN DirSearch,
+ BOOLEAN CaseSensitive);
NTSTATUS
ReadFileRecord(PDEVICE_EXTENSION Vcb,
@@ -911,7 +914,8 @@
PULONG CurrentEntry,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
- ULONGLONG NewAllocatedSize);
+ ULONGLONG NewAllocatedSize,
+ BOOLEAN CaseSensitive);
NTSTATUS
UpdateFileNameRecord(PDEVICE_EXTENSION Vcb,
@@ -919,7 +923,8 @@
PUNICODE_STRING FileName,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
- ULONGLONG NewAllocationSize);
+ ULONGLONG NewAllocationSize,
+ BOOLEAN CaseSensitive);
NTSTATUS
UpdateFileRecord(PDEVICE_EXTENSION Vcb,
@@ -973,7 +978,8 @@
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
- ULONGLONG CurrentMFTIndex);
+ ULONGLONG CurrentMFTIndex,
+ BOOLEAN CaseSensitive);
VOID
NtfsDumpFileRecord(PDEVICE_EXTENSION Vcb,
@@ -985,7 +991,8 @@
PULONG FirstEntry,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
- ULONGLONG CurrentMFTIndex);
+ ULONGLONG CurrentMFTIndex,
+ BOOLEAN CaseSensitive);
NTSTATUS
NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
@@ -993,7 +1000,8 @@
PUNICODE_STRING FileName,
PULONG FirstEntry,
BOOLEAN DirSearch,
- ULONGLONG *OutMFTIndex);
+ ULONGLONG *OutMFTIndex,
+ BOOLEAN CaseSensitive);
/* misc.c */
Modified: branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/NTFS/drivers/filesyst…
==============================================================================
--- branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c [iso-8859-1] (original)
+++ branches/GSoC_2016/NTFS/drivers/filesystems/ntfs/rw.c [iso-8859-1] Sat Jun 24 04:36:28
2017
@@ -283,6 +283,10 @@
* @param IrpFlags
* TODO: flags are presently ignored in code.
*
+* @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 LengthWritten
* Pointer to a ULONG. This ULONG will be set to the number of bytes successfully
written.
*
@@ -303,6 +307,7 @@
ULONG Length,
ULONG WriteOffset,
ULONG IrpFlags,
+ BOOLEAN CaseSensitive,
PULONG LengthWritten)
{
NTSTATUS Status = STATUS_NOT_IMPLEMENTED;
@@ -312,7 +317,15 @@
ULONG AttributeOffset;
ULONGLONG StreamSize;
- DPRINT("NtfsWriteFile(%p, %p, %p, %u, %u, %x, %p)\n", DeviceExt,
FileObject, Buffer, Length, WriteOffset, IrpFlags, LengthWritten);
+ DPRINT("NtfsWriteFile(%p, %p, %p, %u, %u, %x, %s, %p)\n",
+ DeviceExt,
+ FileObject,
+ Buffer,
+ Length,
+ WriteOffset,
+ IrpFlags,
+ (CaseSensitive ? "TRUE" : "FALSE"),
+ LengthWritten);
*LengthWritten = 0;
@@ -444,7 +457,13 @@
filename.Length = fileNameAttribute->NameLength * sizeof(WCHAR);
filename.MaximumLength = filename.Length;
- Status = UpdateFileNameRecord(Fcb->Vcb, ParentMFTId, &filename, FALSE,
DataSize.QuadPart, AllocationSize);
+ Status = UpdateFileNameRecord(Fcb->Vcb,
+ ParentMFTId,
+ &filename,
+ FALSE,
+ DataSize.QuadPart,
+ AllocationSize,
+ CaseSensitive);
}
else
@@ -667,6 +686,7 @@
Length,
ByteOffset.LowPart,
Irp->Flags,
+ (IrpContext->Stack->Flags & SL_CASE_SENSITIVE),
&ReturnedWriteLength);
IrpContext->Irp->IoStatus.Status = Status;