From f7bab18907faacd2346aea34f41b327c54568959 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 6 Apr 2014 16:15:06 +0000 Subject: [PATCH] [NPFS] - Also call NpQueryNameInfo() in FileAllInformation and return its status. This prevents from returning uninit status - By default, return STATUS_ILLEGAL_FUNCTION in NpImpersonate(). This prevents from returning uninit status - Fix comparison in NpQueryFsVolumeInfo() (remaining len is to be used) - Properly set the string without space. This allows setting the complete string with 18 bytes. CID #1102019 CID #1102505 CID #1102506 svn path=/trunk/; revision=62663 --- reactos/drivers/filesystems/npfs/fileinfo.c | 1 + reactos/drivers/filesystems/npfs/fsctrl.c | 15 ++++++--------- reactos/drivers/filesystems/npfs/volinfo.c | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/reactos/drivers/filesystems/npfs/fileinfo.c b/reactos/drivers/filesystems/npfs/fileinfo.c index e39feb9ef5f..d6f2a103082 100644 --- a/reactos/drivers/filesystems/npfs/fileinfo.c +++ b/reactos/drivers/filesystems/npfs/fileinfo.c @@ -440,6 +440,7 @@ NpCommonQueryInformation(IN PDEVICE_OBJECT DeviceObject, NpQueryInternalInfo(Ccb, &AllInfo->InternalInformation, &Length); NpQueryEaInfo(Ccb, &AllInfo->EaInformation, &Length); NpQueryPositionInfo(Ccb, &AllInfo->PositionInformation, &Length, NamedPipeEnd); + Status = NpQueryNameInfo(Ccb, &AllInfo->NameInformation, &Length); Length += 96; break; diff --git a/reactos/drivers/filesystems/npfs/fsctrl.c b/reactos/drivers/filesystems/npfs/fsctrl.c index dc3526d35ea..74826f828d7 100644 --- a/reactos/drivers/filesystems/npfs/fsctrl.c +++ b/reactos/drivers/filesystems/npfs/fsctrl.c @@ -241,16 +241,13 @@ NpImpersonate(IN PDEVICE_OBJECT DeviceObject, IoStack = IoGetCurrentIrpStackLocation(Irp); NodeTypeCode = NpDecodeFileObject(IoStack->FileObject, NULL, &Ccb, &NamedPipeEnd); - if (NodeTypeCode == NPFS_NTC_CCB) + if (NodeTypeCode == NPFS_NTC_CCB && NamedPipeEnd == FILE_PIPE_SERVER_END) { - if (NamedPipeEnd == FILE_PIPE_SERVER_END) - { - Status = NpImpersonateClientContext(Ccb); - } - else - { - Status = STATUS_ILLEGAL_FUNCTION; - } + Status = NpImpersonateClientContext(Ccb); + } + else + { + Status = STATUS_ILLEGAL_FUNCTION; } return Status; diff --git a/reactos/drivers/filesystems/npfs/volinfo.c b/reactos/drivers/filesystems/npfs/volinfo.c index 54c9240e51c..a8449ef9a84 100644 --- a/reactos/drivers/filesystems/npfs/volinfo.c +++ b/reactos/drivers/filesystems/npfs/volinfo.c @@ -35,7 +35,7 @@ NpQueryFsVolumeInfo(IN PVOID Buffer, NameLength = 18; InfoBuffer->VolumeLabelLength = 18; - if (NameLength < 18) + if (*Length < 18) { NameLength = (USHORT)*Length; Status = STATUS_BUFFER_OVERFLOW; @@ -45,7 +45,7 @@ NpQueryFsVolumeInfo(IN PVOID Buffer, Status = STATUS_SUCCESS; } - RtlCopyMemory(InfoBuffer->VolumeLabel, L"Named Pipe", NameLength); + RtlCopyMemory(InfoBuffer->VolumeLabel, L"NamedPipe", NameLength); *Length -= NameLength; TRACE("Leaving, Status = %lx\n", Status);