[NPFS]
authorThomas Faber <thomas.faber@reactos.org>
Thu, 16 Oct 2014 16:57:11 +0000 (16:57 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 16 Oct 2014 16:57:11 +0000 (16:57 +0000)
- Don't truncate pipe name in the RootPipe case in NpCreateFcb. Found by Windows's RtlInsertUnicodePrefix implementation -- which might indicate that ours is broken.

svn path=/trunk/; revision=64763

reactos/drivers/filesystems/npfs/strucsup.c

index 73d0360..29a8c85 100644 (file)
@@ -218,7 +218,6 @@ NpCreateFcb(IN PNP_DCB Dcb,
     PNP_FCB Fcb;
     BOOLEAN RootPipe;
     PWCHAR NameBuffer;
-    ULONG BufferOffset;
     USHORT Length, MaximumLength;
     PAGED_CODE();
 
@@ -233,6 +232,7 @@ NpCreateFcb(IN PNP_DCB Dcb,
     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 @@ NpCreateFcb(IN PNP_DCB Dcb,
 
     InsertTailList(&Dcb->FcbList, &Fcb->DcbEntry);
 
-    BufferOffset = 0;
     if (RootPipe)
     {
         NameBuffer[0] = OBJ_NAME_PATH_SEPARATOR;
-        BufferOffset = 1;
+        RtlCopyMemory(NameBuffer + 1,
+                      PipeName->Buffer,
+                      PipeName->Length);
+    }
+    else
+    {
+        RtlCopyMemory(NameBuffer,
+                      PipeName->Buffer,
+                      PipeName->Length);
     }
 
-    RtlCopyMemory(NameBuffer + BufferOffset, PipeName->Buffer, Length);
-    NameBuffer[BufferOffset + (Length / sizeof(WCHAR))] = UNICODE_NULL;
+    NameBuffer[Length / sizeof(WCHAR)] = UNICODE_NULL;
 
     Fcb->FullName.Length = Length;
     Fcb->FullName.MaximumLength = MaximumLength;