don't query additional information for the system idle process (which doesn't work anyway)

svn path=/trunk/; revision=14682
This commit is contained in:
Thomas Bluemel 2005-04-18 21:03:33 +00:00
parent b3dee30733
commit 88e83d47c5

View file

@ -260,6 +260,7 @@ void PerfDataRefresh(void)
pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads; pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads;
pPerfData[Idx].SessionId = pSPI->SessionId; pPerfData[Idx].SessionId = pSPI->SessionId;
if (pSPI->UniqueProcessId != NULL) {
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)pSPI->UniqueProcessId); hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)pSPI->UniqueProcessId);
if (hProcess) { if (hProcess) {
if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) { if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) {
@ -282,11 +283,23 @@ int MultiByteToWideChar(
#endif #endif
RevertToSelf(); RevertToSelf();
CloseHandle(hProcessToken); CloseHandle(hProcessToken);
} else {
pPerfData[Idx].UserName[0] = _T('\0');
} }
pPerfData[Idx].USERObjectCount = GetGuiResources(hProcess, GR_USEROBJECTS); pPerfData[Idx].USERObjectCount = GetGuiResources(hProcess, GR_USEROBJECTS);
pPerfData[Idx].GDIObjectCount = GetGuiResources(hProcess, GR_GDIOBJECTS); pPerfData[Idx].GDIObjectCount = GetGuiResources(hProcess, GR_GDIOBJECTS);
GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters); GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters);
CloseHandle(hProcess); CloseHandle(hProcess);
} else {
goto ClearInfo;
}
} else {
ClearInfo:
/* clear information we were unable to fetch */
pPerfData[Idx].UserName[0] = _T('\0');
pPerfData[Idx].USERObjectCount = 0;
pPerfData[Idx].GDIObjectCount = 0;
ZeroMemory(&pPerfData[Idx].IOCounters, sizeof(IO_COUNTERS));
} }
pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart; pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart;
pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart; pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart;