Author: tfaber
Date: Thu Oct 16 16:57:11 2014
New Revision: 64763

URL: http://svn.reactos.org/svn/reactos?rev=64763&view=rev
Log:
[NPFS]
- Don't truncate pipe name in the RootPipe case in NpCreateFcb. Found by 
Windows's RtlInsertUnicodePrefix implementation -- which might indicate that 
ours is broken.

Modified:
    trunk/reactos/drivers/filesystems/npfs/strucsup.c

Modified: trunk/reactos/drivers/filesystems/npfs/strucsup.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/npfs/strucsup.c?rev=64763&r1=64762&r2=64763&view=diff
==============================================================================
--- trunk/reactos/drivers/filesystems/npfs/strucsup.c   [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/npfs/strucsup.c   [iso-8859-1] Thu Oct 16 
16:57:11 2014
@@ -218,7 +218,6 @@
     PNP_FCB Fcb;
     BOOLEAN RootPipe;
     PWCHAR NameBuffer;
-    ULONG BufferOffset;
     USHORT Length, MaximumLength;
     PAGED_CODE();
 
@@ -233,6 +232,7 @@
     RootPipe = FALSE;
     if (PipeName->Buffer[0] != OBJ_NAME_PATH_SEPARATOR)
     {
+        Length += sizeof(OBJ_NAME_PATH_SEPARATOR);
         MaximumLength += sizeof(OBJ_NAME_PATH_SEPARATOR);
         RootPipe = TRUE;
         if (MaximumLength < sizeof(WCHAR))
@@ -262,15 +262,21 @@
 
     InsertTailList(&Dcb->FcbList, &Fcb->DcbEntry);
 
-    BufferOffset = 0;
     if (RootPipe)
     {
         NameBuffer[0] = OBJ_NAME_PATH_SEPARATOR;
-        BufferOffset = 1;
-    }
-
-    RtlCopyMemory(NameBuffer + BufferOffset, PipeName->Buffer, Length);
-    NameBuffer[BufferOffset + (Length / sizeof(WCHAR))] = UNICODE_NULL;
+        RtlCopyMemory(NameBuffer + 1,
+                      PipeName->Buffer,
+                      PipeName->Length);
+    }
+    else
+    {
+        RtlCopyMemory(NameBuffer,
+                      PipeName->Buffer,
+                      PipeName->Length);
+    }
+
+    NameBuffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
 
     Fcb->FullName.Length = Length;
     Fcb->FullName.MaximumLength = MaximumLength;


Reply via email to