mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
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:
parent
b3dee30733
commit
88e83d47c5
1 changed files with 27 additions and 14 deletions
|
@ -260,15 +260,16 @@ void PerfDataRefresh(void)
|
||||||
pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads;
|
pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads;
|
||||||
pPerfData[Idx].SessionId = pSPI->SessionId;
|
pPerfData[Idx].SessionId = pSPI->SessionId;
|
||||||
|
|
||||||
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)pSPI->UniqueProcessId);
|
if (pSPI->UniqueProcessId != NULL) {
|
||||||
if (hProcess) {
|
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD)pSPI->UniqueProcessId);
|
||||||
if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) {
|
if (hProcess) {
|
||||||
ImpersonateLoggedOnUser(hProcessToken);
|
if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) {
|
||||||
memset(szTemp, 0, sizeof(TCHAR[MAX_PATH]));
|
ImpersonateLoggedOnUser(hProcessToken);
|
||||||
dwSize = MAX_PATH;
|
memset(szTemp, 0, sizeof(TCHAR[MAX_PATH]));
|
||||||
GetUserName(szTemp, &dwSize);
|
dwSize = MAX_PATH;
|
||||||
|
GetUserName(szTemp, &dwSize);
|
||||||
#ifndef UNICODE
|
#ifndef UNICODE
|
||||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTemp, -1, pPerfData[Idx].UserName, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTemp, -1, pPerfData[Idx].UserName, MAX_PATH);
|
||||||
/*
|
/*
|
||||||
int MultiByteToWideChar(
|
int MultiByteToWideChar(
|
||||||
UINT CodePage, // code page
|
UINT CodePage, // code page
|
||||||
|
@ -280,13 +281,25 @@ 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].GDIObjectCount = GetGuiResources(hProcess, GR_GDIOBJECTS);
|
||||||
|
GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters);
|
||||||
|
CloseHandle(hProcess);
|
||||||
|
} else {
|
||||||
|
goto ClearInfo;
|
||||||
}
|
}
|
||||||
pPerfData[Idx].USERObjectCount = GetGuiResources(hProcess, GR_USEROBJECTS);
|
} else {
|
||||||
pPerfData[Idx].GDIObjectCount = GetGuiResources(hProcess, GR_GDIOBJECTS);
|
ClearInfo:
|
||||||
GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters);
|
/* clear information we were unable to fetch */
|
||||||
CloseHandle(hProcess);
|
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;
|
||||||
|
|
Loading…
Reference in a new issue