[NTOSKRNL] Use faster internal helper to query name

This only applies if we're called from kernel mode
with a synchronous file.
This commit is contained in:
Pierre Schweitzer 2018-10-03 10:21:39 +02:00
parent 1348f62f20
commit a1401a7577
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
2 changed files with 27 additions and 5 deletions

View file

@ -1276,6 +1276,16 @@ IoComputeDesiredAccessFileObject(
IN PACCESS_MASK DesiredAccess IN PACCESS_MASK DesiredAccess
); );
NTSTATUS
NTAPI
IopGetFileInformation(
IN PFILE_OBJECT FileObject,
IN ULONG Length,
IN FILE_INFORMATION_CLASS FileInfoClass,
OUT PVOID Buffer,
OUT PULONG ReturnedLength
);
// //
// I/O Timer Routines // I/O Timer Routines
// //

View file

@ -1941,11 +1941,23 @@ IopQueryNameInternal(IN PVOID ObjectBody,
FIELD_OFFSET(FILE_NAME_INFORMATION, FileName); FIELD_OFFSET(FILE_NAME_INFORMATION, FileName);
/* Query the File name */ /* Query the File name */
Status = IoQueryFileInformation(FileObject, if (PreviousMode == KernelMode &&
FileNameInformation, BooleanFlagOn(FileObject->Flags, FO_SYNCHRONOUS_IO))
LengthMismatch ? Length : FileLength, {
LocalFileInfo, Status = IopGetFileInformation(FileObject,
&LocalReturnLength); LengthMismatch ? Length : FileLength,
FileNameInformation,
LocalFileInfo,
&LocalReturnLength);
}
else
{
Status = IoQueryFileInformation(FileObject,
FileNameInformation,
LengthMismatch ? Length : FileLength,
LocalFileInfo,
&LocalReturnLength);
}
if (NT_ERROR(Status)) if (NT_ERROR(Status))
{ {
/* Fail on errors only, allow warnings */ /* Fail on errors only, allow warnings */