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.
svn path=/branches/GSoC_2016/NTFS/; revision=75178
* @param ParentMftIndex
* Pointer to a ULONGLONG which will receive the index of the 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.
+*
* @return
* STATUS_SUCCESS on success. STATUS_NOT_IMPLEMENTED if target address isn't at the end
* of the given file record.
* @return
* STATUS_SUCCESS on success. STATUS_NOT_IMPLEMENTED if target address isn't at the end
* of the given file record.
PNTFS_ATTR_RECORD AttributeAddress,
PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject,
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;
{
ULONG ResidentHeaderLength = FIELD_OFFSET(NTFS_ATTR_RECORD, Resident.Reserved) + sizeof(UCHAR);
PFILENAME_ATTRIBUTE FileNameAttribute;
if(Remaining.Length != 0)
RtlCopyUnicodeString(&FilenameNoPath, &Remaining);
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;
if (!NT_SUCCESS(Status))
break;
NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject,
PWSTR FileName,
NtfsOpenFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject,
PWSTR FileName,
PNTFS_FCB * FoundFCB)
{
PNTFS_FCB ParentFcb;
PNTFS_FCB * FoundFCB)
{
PNTFS_FCB ParentFcb;
NTSTATUS Status;
PWSTR AbsFileName = NULL;
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);
Status = NtfsGetFCBForFile(DeviceExt,
&ParentFcb,
&Fcb,
Status = NtfsGetFCBForFile(DeviceExt,
&ParentFcb,
&Fcb,
+ FileName,
+ CaseSensitive);
if (ParentFcb != NULL)
{
NtfsReleaseFCB(DeviceExt,
if (ParentFcb != NULL)
{
NtfsReleaseFCB(DeviceExt,
Status = NtfsOpenFile(DeviceExt,
FileObject,
((RequestedOptions & FILE_OPEN_BY_FILE_ID) ? FullPath.Buffer : FileObject->FileName.Buffer),
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)
&Fcb);
if (RequestedOptions & FILE_OPEN_BY_FILE_ID)
&Ccb->Entry,
&FileRecord,
&MFTRecord,
&Ccb->Entry,
&FileRecord,
&MFTRecord,
+ Fcb->MFTIndex,
+ (Stack->Flags & SL_CASE_SENSITIVE));
if (NT_SUCCESS(Status))
{
if (NT_SUCCESS(Status))
{
NtfsDirFindFile(PNTFS_VCB Vcb,
PNTFS_FCB DirectoryFcb,
PWSTR FileToFind,
NtfsDirFindFile(PNTFS_VCB Vcb,
PNTFS_FCB DirectoryFcb,
PWSTR FileToFind,
PNTFS_FCB *FoundFCB)
{
NTSTATUS Status;
PNTFS_FCB *FoundFCB)
{
NTSTATUS Status;
PNTFS_ATTR_CONTEXT DataContext;
USHORT Length = 0;
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);
*FoundFCB = NULL;
RtlInitUnicodeString(&File, FileToFind);
DPRINT1("Will now look for file '%wZ' with stream '%S'\n", &File, Colon);
}
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;
if (!NT_SUCCESS(Status))
{
return Status;
NtfsGetFCBForFile(PNTFS_VCB Vcb,
PNTFS_FCB *pParentFCB,
PNTFS_FCB *pFCB,
NtfsGetFCBForFile(PNTFS_VCB Vcb,
PNTFS_FCB *pParentFCB,
PNTFS_FCB *pFCB,
+ const PWSTR pFileName,
+ BOOLEAN CaseSensitive)
{
NTSTATUS Status;
WCHAR pathName [MAX_PATH];
{
NTSTATUS Status;
WCHAR pathName [MAX_PATH];
PNTFS_FCB FCB;
PNTFS_FCB parentFCB;
PNTFS_FCB FCB;
PNTFS_FCB parentFCB;
- DPRINT("NtfsGetFCBForFile(%p, %p, %p, '%S')\n",
+ DPRINT("NtfsGetFCBForFile(%p, %p, %p, '%S', %s)\n",
+ pFileName,
+ CaseSensitive ? "TRUE" : "FALSE");
/* Dummy code */
// FCB = NtfsOpenRootFCB(Vcb);
/* Dummy code */
// FCB = NtfsOpenRootFCB(Vcb);
NtfsGetNextPathElement(currentElement) - currentElement);
DPRINT(" elementName:%S\n", elementName);
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;
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
{
*pParentFCB = parentFCB;
* @param IrpFlags
* ULONG describing the flags of the original IRP request (Irp->Flags).
*
* @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).
*
* @param NewFileSize
* Pointer to a LARGE_INTEGER which indicates the new end of file (file size).
*
PFILE_OBJECT FileObject,
PDEVICE_EXTENSION DeviceExt,
ULONG IrpFlags,
PFILE_OBJECT FileObject,
PDEVICE_EXTENSION DeviceExt,
ULONG IrpFlags,
PLARGE_INTEGER NewFileSize)
{
LARGE_INTEGER CurrentFileSize;
PLARGE_INTEGER NewFileSize)
{
LARGE_INTEGER CurrentFileSize;
AllocationSize = ROUND_UP(NewFileSize->QuadPart, Fcb->Vcb->NtfsInfo.BytesPerCluster);
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);
ReleaseAttributeContext(DataContext);
ExFreePoolWithTag(FileRecord, TAG_NTFS);
DPRINT1("FIXME: Using hacky method of setting FileAllocationInformation.\n");
case FileEndOfFileInformation:
EndOfFileInfo = (PFILE_END_OF_FILE_INFORMATION)SystemBuffer;
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
break;
// TODO: all other information classes
PUNICODE_STRING FileName,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
PUNICODE_STRING FileName,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
- ULONGLONG NewAllocationSize)
+ ULONGLONG NewAllocationSize,
+ BOOLEAN CaseSensitive)
{
PFILE_RECORD_HEADER MftRecord;
PNTFS_ATTR_CONTEXT IndexRootCtx;
{
PFILE_RECORD_HEADER MftRecord;
PNTFS_ATTR_CONTEXT IndexRootCtx;
NTSTATUS Status;
ULONG CurrentEntry = 0;
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,
MftRecord = ExAllocatePoolWithTag(NonPagedPool,
Vcb->NtfsInfo.BytesPerFileRecord,
&CurrentEntry,
DirSearch,
NewDataSize,
&CurrentEntry,
DirSearch,
NewDataSize,
+ NewAllocationSize,
+ CaseSensitive);
ReleaseAttributeContext(IndexRootCtx);
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
ReleaseAttributeContext(IndexRootCtx);
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
PULONG CurrentEntry,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
PULONG CurrentEntry,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
- ULONGLONG NewAllocatedSize)
+ ULONGLONG NewAllocatedSize,
+ BOOLEAN CaseSensitive)
{
NTSTATUS Status;
ULONG RecordOffset;
{
NTSTATUS Status;
ULONG RecordOffset;
if ((IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK) > 0x10 &&
*CurrentEntry >= *StartEntry &&
IndexEntry->FileName.NameType != NTFS_FILE_NAME_DOS &&
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;
{
*StartEntry = *CurrentEntry;
IndexEntry->FileName.DataSize = NewDataSize;
LastEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)&IndexBuffer->Header + IndexBuffer->Header.TotalSizeOfEntries);
ASSERT(LastEntry <= (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexBuffer + IndexBlockSize));
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
if (Status == STATUS_PENDING)
{
// write the index record back to disk
BOOLEAN
CompareFileName(PUNICODE_STRING FileName,
PINDEX_ENTRY_ATTRIBUTE IndexEntry,
BOOLEAN
CompareFileName(PUNICODE_STRING FileName,
PINDEX_ENTRY_ATTRIBUTE IndexEntry,
+ BOOLEAN DirSearch,
+ BOOLEAN CaseSensitive)
{
BOOLEAN Ret, Alloc = FALSE;
UNICODE_STRING EntryName;
{
BOOLEAN Ret, Alloc = FALSE;
UNICODE_STRING EntryName;
if (DirSearch)
{
UNICODE_STRING IntFileName;
if (DirSearch)
{
UNICODE_STRING IntFileName;
- if (IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX)
{
NT_VERIFY(NT_SUCCESS(RtlUpcaseUnicodeString(&IntFileName, FileName, TRUE)));
Alloc = TRUE;
{
NT_VERIFY(NT_SUCCESS(RtlUpcaseUnicodeString(&IntFileName, FileName, TRUE)));
Alloc = TRUE;
IntFileName = *FileName;
}
IntFileName = *FileName;
}
- Ret = FsRtlIsNameInExpression(&IntFileName, &EntryName, (IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX), NULL);
+ Ret = FsRtlIsNameInExpression(&IntFileName, &EntryName, !CaseSensitive, NULL);
- return (RtlCompareUnicodeString(FileName, &EntryName, (IndexEntry->FileName.NameType != NTFS_FILE_NAME_POSIX)) == 0);
+ return (RtlCompareUnicodeString(FileName, &EntryName, !CaseSensitive) == 0);
PULONG StartEntry,
PULONG CurrentEntry,
BOOLEAN DirSearch,
PULONG StartEntry,
PULONG CurrentEntry,
BOOLEAN DirSearch,
ULONGLONG *OutMFTIndex)
{
NTSTATUS Status;
ULONGLONG *OutMFTIndex)
{
NTSTATUS Status;
ULONGLONG IndexAllocationSize;
PINDEX_BUFFER IndexBuffer;
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 &&
IndexEntry = FirstEntry;
while (IndexEntry < LastEntry &&
if ((IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK) >= 0x10 &&
*CurrentEntry >= *StartEntry &&
IndexEntry->FileName.NameType != NTFS_FILE_NAME_DOS &&
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);
{
*StartEntry = *CurrentEntry;
*OutMFTIndex = (IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK);
LastEntry = (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)&IndexBuffer->Header + IndexBuffer->Header.TotalSizeOfEntries);
ASSERT(LastEntry <= (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexBuffer + IndexBlockSize));
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;
if (NT_SUCCESS(Status))
{
break;
PUNICODE_STRING FileName,
PULONG FirstEntry,
BOOLEAN DirSearch,
PUNICODE_STRING FileName,
PULONG FirstEntry,
BOOLEAN DirSearch,
- ULONGLONG *OutMFTIndex)
+ ULONGLONG *OutMFTIndex,
+ BOOLEAN CaseSensitive)
{
PFILE_RECORD_HEADER MftRecord;
PNTFS_ATTR_CONTEXT IndexRootCtx;
{
PFILE_RECORD_HEADER MftRecord;
PNTFS_ATTR_CONTEXT IndexRootCtx;
DPRINT("IndexRecordSize: %x IndexBlockSize: %x\n", Vcb->NtfsInfo.BytesPerIndexRecord, IndexRoot->SizeOfEntry);
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);
ExFreePoolWithTag(IndexRecord, TAG_NTFS);
ExFreePoolWithTag(MftRecord, TAG_NTFS);
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
- ULONGLONG CurrentMFTIndex)
+ ULONGLONG CurrentMFTIndex,
+ BOOLEAN CaseSensitive)
{
UNICODE_STRING Current, Remaining;
NTSTATUS Status;
{
UNICODE_STRING Current, Remaining;
NTSTATUS Status;
{
DPRINT("Current: %wZ\n", &Current);
{
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;
if (!NT_SUCCESS(Status))
{
return Status;
NtfsLookupFile(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
NtfsLookupFile(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
+ PULONGLONG MFTIndex,
+ BOOLEAN CaseSensitive)
- return NtfsLookupFileAt(Vcb, PathName, FileRecord, MFTIndex, NTFS_FILE_ROOT);
+ return NtfsLookupFileAt(Vcb, PathName, FileRecord, MFTIndex, NTFS_FILE_ROOT, CaseSensitive);
PULONG FirstEntry,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
PULONG FirstEntry,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
- ULONGLONG CurrentMFTIndex)
+ ULONGLONG CurrentMFTIndex,
+ BOOLEAN CaseSensitive)
- DPRINT("NtfsFindFileAt(%p, %wZ, %u, %p, %p, %I64x)\n", Vcb, SearchPattern, *FirstEntry, FileRecord, MFTIndex, 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);
+ Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE, &CurrentMFTIndex, CaseSensitive);
if (!NT_SUCCESS(Status))
{
DPRINT("NtfsFindFileAt: NtfsFindMftRecord() failed with status 0x%08lx\n", Status);
if (!NT_SUCCESS(Status))
{
DPRINT("NtfsFindFileAt: NtfsFindMftRecord() failed with status 0x%08lx\n", Status);
NtfsGetFCBForFile(PNTFS_VCB Vcb,
PNTFS_FCB *pParentFCB,
PNTFS_FCB *pFCB,
NtfsGetFCBForFile(PNTFS_VCB Vcb,
PNTFS_FCB *pParentFCB,
PNTFS_FCB *pFCB,
- const PWSTR pFileName);
+ const PWSTR pFileName,
+ BOOLEAN CaseSensitive);
NTSTATUS
NtfsReadFCBAttribute(PNTFS_VCB Vcb,
NTSTATUS
NtfsReadFCBAttribute(PNTFS_VCB Vcb,
PFILE_OBJECT FileObject,
PDEVICE_EXTENSION DeviceExt,
ULONG IrpFlags,
PFILE_OBJECT FileObject,
PDEVICE_EXTENSION DeviceExt,
ULONG IrpFlags,
PLARGE_INTEGER NewFileSize);
NTSTATUS
PLARGE_INTEGER NewFileSize);
NTSTATUS
BOOLEAN
CompareFileName(PUNICODE_STRING FileName,
PINDEX_ENTRY_ATTRIBUTE IndexEntry,
BOOLEAN
CompareFileName(PUNICODE_STRING FileName,
PINDEX_ENTRY_ATTRIBUTE IndexEntry,
+ BOOLEAN DirSearch,
+ BOOLEAN CaseSensitive);
NTSTATUS
ReadFileRecord(PDEVICE_EXTENSION Vcb,
NTSTATUS
ReadFileRecord(PDEVICE_EXTENSION Vcb,
PULONG CurrentEntry,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
PULONG CurrentEntry,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
- ULONGLONG NewAllocatedSize);
+ ULONGLONG NewAllocatedSize,
+ BOOLEAN CaseSensitive);
NTSTATUS
UpdateFileNameRecord(PDEVICE_EXTENSION Vcb,
NTSTATUS
UpdateFileNameRecord(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING FileName,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
PUNICODE_STRING FileName,
BOOLEAN DirSearch,
ULONGLONG NewDataSize,
- ULONGLONG NewAllocationSize);
+ ULONGLONG NewAllocationSize,
+ BOOLEAN CaseSensitive);
NTSTATUS
UpdateFileRecord(PDEVICE_EXTENSION Vcb,
NTSTATUS
UpdateFileRecord(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
PUNICODE_STRING PathName,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
- ULONGLONG CurrentMFTIndex);
+ ULONGLONG CurrentMFTIndex,
+ BOOLEAN CaseSensitive);
VOID
NtfsDumpFileRecord(PDEVICE_EXTENSION Vcb,
VOID
NtfsDumpFileRecord(PDEVICE_EXTENSION Vcb,
PULONG FirstEntry,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
PULONG FirstEntry,
PFILE_RECORD_HEADER *FileRecord,
PULONGLONG MFTIndex,
- ULONGLONG CurrentMFTIndex);
+ ULONGLONG CurrentMFTIndex,
+ BOOLEAN CaseSensitive);
NTSTATUS
NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
NTSTATUS
NtfsFindMftRecord(PDEVICE_EXTENSION Vcb,
PUNICODE_STRING FileName,
PULONG FirstEntry,
BOOLEAN DirSearch,
PUNICODE_STRING FileName,
PULONG FirstEntry,
BOOLEAN DirSearch,
- ULONGLONG *OutMFTIndex);
+ ULONGLONG *OutMFTIndex,
+ BOOLEAN CaseSensitive);
* @param IrpFlags
* TODO: flags are presently ignored in code.
*
* @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.
*
* @param LengthWritten
* Pointer to a ULONG. This ULONG will be set to the number of bytes successfully written.
*
ULONG Length,
ULONG WriteOffset,
ULONG IrpFlags,
ULONG Length,
ULONG WriteOffset,
ULONG IrpFlags,
PULONG LengthWritten)
{
NTSTATUS Status = STATUS_NOT_IMPLEMENTED;
PULONG LengthWritten)
{
NTSTATUS Status = STATUS_NOT_IMPLEMENTED;
ULONG AttributeOffset;
ULONGLONG StreamSize;
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);
filename.Length = fileNameAttribute->NameLength * sizeof(WCHAR);
filename.MaximumLength = filename.Length;
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);
Length,
ByteOffset.LowPart,
Irp->Flags,
Length,
ByteOffset.LowPart,
Irp->Flags,
+ (IrpContext->Stack->Flags & SL_CASE_SENSITIVE),
&ReturnedWriteLength);
IrpContext->Irp->IoStatus.Status = Status;
&ReturnedWriteLength);
IrpContext->Irp->IoStatus.Status = Status;