Fix PhStdGetClientIdNameEx not showing the system process filename
@@ -852,7 +852,22 @@ PPH_STRING PhStdGetClientIdNameEx(
}
else
{
- // Determine the name of the process ourselves
+ if (ClientId->UniqueProcess == SYSTEM_PROCESS_ID)
+ {
+ if (processName = PhGetKernelFileName())
+ {
+ PhMoveReference(&processName, PhGetBaseName(processName));
+ processNameRef.Length = processName->Length;
+ processNameRef.Buffer = processName->Buffer;
+ }
+ else
+ {
+ PhInitializeStringRef(&processNameRef, L"Unknown process");
+ }
+ }
+ else
+ {
+ // Determine the name of the process ourselves (diversenok)
if (NT_SUCCESS(PhGetProcessImageFileNameById(
ClientId->UniqueProcess,
NULL,
@@ -867,6 +882,7 @@ PPH_STRING PhStdGetClientIdNameEx(
PhInitializeStringRef(&processNameRef, L"Unknown process");
}
}
+ }
// Check if the process is alive, but only if we didn't get its name
if (!ProcessName && NT_SUCCESS(PhOpenProcess(
@@ -901,7 +917,7 @@ PPH_STRING PhStdGetClientIdNameEx(
);
// Use the name of the thread if available
- if (NT_SUCCESS(PhGetThreadName(threadHandle, &threadName)) && threadName->Length)
+ if (NT_SUCCESS(PhGetThreadName(threadHandle, &threadName)))
{
threadNameRef.Length = threadName->Length;
threadNameRef.Buffer = threadName->Buffer;
