Skip to content

Commit aefc62d

Browse files
committed
Fix missing handle type when NtQueryObject has been hooked by kernel
1 parent 339c6d6 commit aefc62d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ProcessHacker/hndlprv.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,19 @@ VOID PhHandleProviderUpdate(
625625
NULL
626626
);
627627

628+
// HACK: Some security products block NtQueryObject with ObjectTypeInformation and return an invalid type
629+
// so we need to lookup the TypeName using the TypeIndex. We should improve PhGetHandleInformationEx for this case
630+
// but for now we'll preserve backwards compat by doing the lookup here. (dmex)
631+
if (PhIsNullOrEmptyString(handleItem->TypeName))
632+
{
633+
PPH_STRING typeName;
634+
635+
if (typeName = PhGetObjectTypeName(handleItem->TypeIndex))
636+
{
637+
PhMoveReference(&handleItem->TypeName, typeName);
638+
}
639+
}
640+
628641
if (handleItem->TypeName && PhEqualString2(handleItem->TypeName, L"File", TRUE) && KphIsConnected())
629642
{
630643
KPH_FILE_OBJECT_INFORMATION objectInfo;

0 commit comments

Comments
 (0)