mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NTFS] - Fix a mistake with AddFileName() from my last commit. Also, move CaseSensitive parameter before output parameters in the parameter list of several functions.
svn path=/branches/GSoC_2016/NTFS/; revision=75191
This commit is contained in:
parent
032be02954
commit
948e91907a
5 changed files with 34 additions and 17 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue