- 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
This commit is contained in:
Pierre Schweitzer 2014-04-06 16:15:06 +00:00
parent 4a7e080751
commit f7bab18907
3 changed files with 9 additions and 11 deletions

View file

@ -440,6 +440,7 @@ NpCommonQueryInformation(IN PDEVICE_OBJECT DeviceObject,
NpQueryInternalInfo(Ccb, &AllInfo->InternalInformation, &Length); NpQueryInternalInfo(Ccb, &AllInfo->InternalInformation, &Length);
NpQueryEaInfo(Ccb, &AllInfo->EaInformation, &Length); NpQueryEaInfo(Ccb, &AllInfo->EaInformation, &Length);
NpQueryPositionInfo(Ccb, &AllInfo->PositionInformation, &Length, NamedPipeEnd); NpQueryPositionInfo(Ccb, &AllInfo->PositionInformation, &Length, NamedPipeEnd);
Status = NpQueryNameInfo(Ccb, &AllInfo->NameInformation, &Length);
Length += 96; Length += 96;
break; break;

View file

@ -241,16 +241,13 @@ NpImpersonate(IN PDEVICE_OBJECT DeviceObject,
IoStack = IoGetCurrentIrpStackLocation(Irp); IoStack = IoGetCurrentIrpStackLocation(Irp);
NodeTypeCode = NpDecodeFileObject(IoStack->FileObject, NULL, &Ccb, &NamedPipeEnd); 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);
{ }
Status = NpImpersonateClientContext(Ccb); else
} {
else Status = STATUS_ILLEGAL_FUNCTION;
{
Status = STATUS_ILLEGAL_FUNCTION;
}
} }
return Status; return Status;

View file

@ -35,7 +35,7 @@ NpQueryFsVolumeInfo(IN PVOID Buffer,
NameLength = 18; NameLength = 18;
InfoBuffer->VolumeLabelLength = 18; InfoBuffer->VolumeLabelLength = 18;
if (NameLength < 18) if (*Length < 18)
{ {
NameLength = (USHORT)*Length; NameLength = (USHORT)*Length;
Status = STATUS_BUFFER_OVERFLOW; Status = STATUS_BUFFER_OVERFLOW;
@ -45,7 +45,7 @@ NpQueryFsVolumeInfo(IN PVOID Buffer,
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
} }
RtlCopyMemory(InfoBuffer->VolumeLabel, L"Named Pipe", NameLength); RtlCopyMemory(InfoBuffer->VolumeLabel, L"NamedPipe", NameLength);
*Length -= NameLength; *Length -= NameLength;
TRACE("Leaving, Status = %lx\n", Status); TRACE("Leaving, Status = %lx\n", Status);