- 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
This commit is contained in:
Thomas Faber 2014-10-16 16:57:11 +00:00
parent 32f8a44f8e
commit e67bbc79a9

View file

@ -218,7 +218,6 @@ NpCreateFcb(IN PNP_DCB Dcb,
PNP_FCB Fcb; PNP_FCB Fcb;
BOOLEAN RootPipe; BOOLEAN RootPipe;
PWCHAR NameBuffer; PWCHAR NameBuffer;
ULONG BufferOffset;
USHORT Length, MaximumLength; USHORT Length, MaximumLength;
PAGED_CODE(); PAGED_CODE();
@ -233,6 +232,7 @@ NpCreateFcb(IN PNP_DCB Dcb,
RootPipe = FALSE; RootPipe = FALSE;
if (PipeName->Buffer[0] != OBJ_NAME_PATH_SEPARATOR) if (PipeName->Buffer[0] != OBJ_NAME_PATH_SEPARATOR)
{ {
Length += sizeof(OBJ_NAME_PATH_SEPARATOR);
MaximumLength += sizeof(OBJ_NAME_PATH_SEPARATOR); MaximumLength += sizeof(OBJ_NAME_PATH_SEPARATOR);
RootPipe = TRUE; RootPipe = TRUE;
if (MaximumLength < sizeof(WCHAR)) if (MaximumLength < sizeof(WCHAR))
@ -262,15 +262,21 @@ NpCreateFcb(IN PNP_DCB Dcb,
InsertTailList(&Dcb->FcbList, &Fcb->DcbEntry); InsertTailList(&Dcb->FcbList, &Fcb->DcbEntry);
BufferOffset = 0;
if (RootPipe) if (RootPipe)
{ {
NameBuffer[0] = OBJ_NAME_PATH_SEPARATOR; 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[Length / sizeof(WCHAR)] = UNICODE_NULL;
NameBuffer[BufferOffset + (Length / sizeof(WCHAR))] = UNICODE_NULL;
Fcb->FullName.Length = Length; Fcb->FullName.Length = Length;
Fcb->FullName.MaximumLength = MaximumLength; Fcb->FullName.MaximumLength = MaximumLength;