Author: ekohl
Date: Tue Sep 26 12:36:17 2017
New Revision: 75975
URL:
http://svn.reactos.org/svn/reactos?rev=75975&view=rev
Log:
[FASTFAT]
Terminate the path name at the last slash when a file is opened using the
IO_OPEN_TARGET_DIRECTORY option. This fixes some IoCreateFile kernel mode tests.
Modified:
trunk/reactos/drivers/filesystems/fastfat/create.c
Modified: trunk/reactos/drivers/filesystems/fastfat/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/create.c [iso-8859-1] Tue Sep 26 12:36:17
2017
@@ -577,7 +577,7 @@
else
{
PVFATFCB TargetFcb;
- LONG idx, FileNameLen;
+ LONG idx;
vfatAddToStat(DeviceExt, Fat.CreateHits, 1);
@@ -586,8 +586,8 @@
{
vfatGrabFCB(DeviceExt, ParentFcb);
}
+
Status = vfatGetFCBForFile(DeviceExt, &ParentFcb, &TargetFcb,
&PathNameU);
-
if (NT_SUCCESS(Status))
{
vfatReleaseFCB(DeviceExt, TargetFcb);
@@ -615,14 +615,14 @@
if (idx > 0 || PathNameU.Buffer[0] == L'\\')
{
- /* We don't want to include / in the name */
- FileNameLen = PathNameU.Length - ((idx + 1) * sizeof(WCHAR));
-
- /* Update FO just to keep file name */
- /* Skip first slash */
- ++idx;
- FileObject->FileName.Length = FileNameLen;
- RtlMoveMemory(&PathNameU.Buffer[0], &PathNameU.Buffer[idx],
FileObject->FileName.Length);
+ /* Terminate the string at the last backslash */
+ PathNameU.Buffer[idx + 1] = UNICODE_NULL;
+ PathNameU.Length = (idx + 1) * sizeof(WCHAR);
+ PathNameU.MaximumLength = PathNameU.Length + sizeof(WCHAR);
+
+ /* Update the file object as well */
+ FileObject->FileName.Length = PathNameU.Length;
+ FileObject->FileName.MaximumLength = PathNameU.MaximumLength;
}
else
{