From 31f889367834bea2f280319c9dda35b4f30a441b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 11 Sep 2013 18:04:33 +0200 Subject: [PATCH] taskmgr: Use definitions from winternl.h instead of duplicating them. --- include/winternl.h | 2 +- programs/taskmgr/perfdata.c | 141 +++++++++--------- programs/taskmgr/perfdata.h | 285 +----------------------------------- programs/taskmgr/taskmgr.c | 1 - 4 files changed, 72 insertions(+), 357 deletions(-) diff --git a/include/winternl.h b/include/winternl.h index 47d9a0980ed..80694a82046 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -1363,7 +1363,7 @@ typedef struct _SYSTEM_PROCESS_INFORMATION { HANDLE UniqueProcessId; /* 44/50 */ HANDLE ParentProcessId; /* 48/58 */ ULONG HandleCount; /* 4c/60 */ - DWORD dwUnknown3; /* 50/64 */ + ULONG SessionId; /* 50/64 */ DWORD dwUnknown4; /* 54/68 */ VM_COUNTERS vmCounters; /* 58/70 */ IO_COUNTERS ioCounters; /* 88/d0 */ diff --git a/programs/taskmgr/perfdata.c b/programs/taskmgr/perfdata.c index 95516def297..110fe5ae600 100644 --- a/programs/taskmgr/perfdata.c +++ b/programs/taskmgr/perfdata.c @@ -30,7 +30,7 @@ #include "taskmgr.h" #include "perfdata.h" -static PROCNTQSI NtQuerySystemInformation = NULL; +static PROCNTQSI pNtQuerySystemInformation = NULL; static PROCGGR pGetGuiResources = NULL; static PROCGPIC pGetProcessIoCounters = NULL; static CRITICAL_SECTION PerfDataCriticalSection; @@ -48,7 +48,7 @@ static SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo; static SYSTEM_BASIC_INFORMATION SystemBasicInfo; static SYSTEM_CACHE_INFORMATION SystemCacheInfo; static SYSTEM_HANDLE_INFORMATION SystemHandleInfo; -static PSYSTEM_PROCESSORTIME_INFO SystemProcessorTimeInfo = NULL; +static PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL; BOOL PerfDataInitialize(void) { @@ -57,32 +57,25 @@ BOOL PerfDataInitialize(void) static const WCHAR wszUser32[] = {'u','s','e','r','3','2','.','d','l','l',0}; static const WCHAR wszKernel32[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0}; - NtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandleW(wszNtdll), "NtQuerySystemInformation"); + pNtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandleW(wszNtdll), "NtQuerySystemInformation"); pGetGuiResources = (PROCGGR)GetProcAddress(GetModuleHandleW(wszUser32), "GetGuiResources"); pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandleW(wszKernel32), "GetProcessIoCounters"); InitializeCriticalSection(&PerfDataCriticalSection); - - if (!NtQuerySystemInformation) + + if (!pNtQuerySystemInformation) return FALSE; - + /* * Get number of processors in the system */ - status = NtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL); + status = pNtQuerySystemInformation(SystemBasicInformation, &SystemBasicInfo, sizeof(SystemBasicInfo), NULL); if (status != NO_ERROR) return FALSE; return TRUE; } -void PerfDataUninitialize(void) -{ - NtQuerySystemInformation = NULL; - - DeleteCriticalSection(&PerfDataCriticalSection); -} - void PerfDataRefresh(void) { ULONG ulSize; @@ -97,35 +90,32 @@ void PerfDataRefresh(void) WCHAR wszTemp[MAX_PATH]; DWORD dwSize; SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo; - SYSTEM_TIME_INFORMATION SysTimeInfo; + SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo; SYSTEM_CACHE_INFORMATION SysCacheInfo; LPBYTE SysHandleInfoData; - PSYSTEM_PROCESSORTIME_INFO SysProcessorTimeInfo; + SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION *SysProcessorTimeInfo; double CurrentKernelTime; - if (!NtQuerySystemInformation) - return; - /* Get new system time */ - status = NtQuerySystemInformation(SystemTimeInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0); + status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0); if (status != NO_ERROR) return; /* Get new CPU's idle time */ - status = NtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL); + status = pNtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL); if (status != NO_ERROR) return; /* Get system cache information */ - status = NtQuerySystemInformation(SystemCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL); + status = pNtQuerySystemInformation(SystemCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL); if (status != NO_ERROR) return; /* Get processor time information */ SysProcessorTimeInfo = HeapAlloc(GetProcessHeap(), 0, - sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors); - status = NtQuerySystemInformation(SystemProcessorTimeInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors, &ulSize); + sizeof(*SysProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors); + status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, SysProcessorTimeInfo, sizeof(*SysProcessorTimeInfo) * SystemBasicInfo.NumberOfProcessors, &ulSize); if (status != NO_ERROR) { HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo); return; @@ -141,7 +131,7 @@ void PerfDataRefresh(void) BufferSize += 0x10000; SysHandleInfoData = HeapAlloc(GetProcessHeap(), 0, BufferSize); - status = NtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize); + status = pNtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize); if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) { HeapFree(GetProcessHeap(), 0, SysHandleInfoData); @@ -159,7 +149,7 @@ void PerfDataRefresh(void) BufferSize += 0x10000; pBuffer = HeapAlloc(GetProcessHeap(), 0, BufferSize); - status = NtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize); + status = pNtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize); if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) { HeapFree(GetProcessHeap(), 0, pBuffer); @@ -191,16 +181,16 @@ void PerfDataRefresh(void) memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION)); HeapFree(GetProcessHeap(), 0, SysHandleInfoData); - for (CurrentKernelTime=0, Idx=0; IdxRelativeOffset == 0) + if (pSPI->NextEntryOffset == 0) break; - pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->RelativeOffset); + pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset); } /* Now alloc a new PERFDATA array and fill in the data */ @@ -242,7 +232,7 @@ void PerfDataRefresh(void) /* so that we can establish delta values */ pPDOld = NULL; for (Idx2=0; Idx2ProcessId) { + if (pPerfDataOld[Idx2].ProcessId == (DWORD_PTR)pSPI->UniqueProcessId) { pPDOld = &pPerfDataOld[Idx2]; break; } @@ -251,8 +241,8 @@ void PerfDataRefresh(void) /* Clear out process perf data structure */ memset(&pPerfData[Idx], 0, sizeof(PERFDATA)); - if (pSPI->Name.Buffer) - lstrcpyW(pPerfData[Idx].ImageName, pSPI->Name.Buffer); + if (pSPI->ProcessName.Buffer) + lstrcpyW(pPerfData[Idx].ImageName, pSPI->ProcessName.Buffer); else { WCHAR idleW[255]; @@ -260,36 +250,37 @@ void PerfDataRefresh(void) lstrcpyW(pPerfData[Idx].ImageName, idleW ); } - pPerfData[Idx].ProcessId = pSPI->ProcessId; + pPerfData[Idx].ProcessId = (DWORD_PTR)pSPI->UniqueProcessId; if (pPDOld) { double CurTime = Li2Double(pSPI->KernelTime) + Li2Double(pSPI->UserTime); double OldTime = Li2Double(pPDOld->KernelTime) + Li2Double(pPDOld->UserTime); double CpuTime = (CurTime - OldTime) / dbSystemTime; - CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */ + CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.NumberOfProcessors; /* + 0.5; */ pPerfData[Idx].CPUUsage = (ULONG)CpuTime; } + pPerfData[Idx].CPUTime.QuadPart = pSPI->UserTime.QuadPart + pSPI->KernelTime.QuadPart; - pPerfData[Idx].WorkingSetSizeBytes = pSPI->TotalWorkingSetSizeBytes; - pPerfData[Idx].PeakWorkingSetSizeBytes = pSPI->PeakWorkingSetSizeBytes; + pPerfData[Idx].vmCounters.WorkingSetSize = pSPI->vmCounters.WorkingSetSize; + pPerfData[Idx].vmCounters.PeakWorkingSetSize = pSPI->vmCounters.PeakWorkingSetSize; if (pPDOld) - pPerfData[Idx].WorkingSetSizeDelta = labs((LONG)pSPI->TotalWorkingSetSizeBytes - (LONG)pPDOld->WorkingSetSizeBytes); + pPerfData[Idx].WorkingSetSizeDelta = labs(pSPI->vmCounters.WorkingSetSize - pPDOld->vmCounters.WorkingSetSize); else pPerfData[Idx].WorkingSetSizeDelta = 0; - pPerfData[Idx].PageFaultCount = pSPI->PageFaultCount; + pPerfData[Idx].vmCounters.PageFaultCount = pSPI->vmCounters.PageFaultCount; if (pPDOld) - pPerfData[Idx].PageFaultCountDelta = labs((LONG)pSPI->PageFaultCount - (LONG)pPDOld->PageFaultCount); + pPerfData[Idx].PageFaultCountDelta = labs(pSPI->vmCounters.PageFaultCount - pPDOld->vmCounters.PageFaultCount); else pPerfData[Idx].PageFaultCountDelta = 0; - pPerfData[Idx].VirtualMemorySizeBytes = pSPI->TotalVirtualSizeBytes; - pPerfData[Idx].PagedPoolUsagePages = pSPI->TotalPagedPoolUsagePages; - pPerfData[Idx].NonPagedPoolUsagePages = pSPI->TotalNonPagedPoolUsagePages; - pPerfData[Idx].BasePriority = pSPI->BasePriority; + pPerfData[Idx].vmCounters.VirtualSize = pSPI->vmCounters.VirtualSize; + pPerfData[Idx].vmCounters.QuotaPagedPoolUsage = pSPI->vmCounters.QuotaPagedPoolUsage; + pPerfData[Idx].vmCounters.QuotaNonPagedPoolUsage = pSPI->vmCounters.QuotaNonPagedPoolUsage; + pPerfData[Idx].BasePriority = pSPI->dwBasePriority; pPerfData[Idx].HandleCount = pSPI->HandleCount; - pPerfData[Idx].ThreadCount = pSPI->ThreadCount; + pPerfData[Idx].ThreadCount = pSPI->dwThreadCount; pPerfData[Idx].SessionId = pSPI->SessionId; - hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pSPI->ProcessId); + hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, (DWORD_PTR)pSPI->UniqueProcessId); if (hProcess) { if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) { ImpersonateLoggedOnUser(hProcessToken); @@ -309,7 +300,7 @@ void PerfDataRefresh(void) } pPerfData[Idx].UserTime.QuadPart = pSPI->UserTime.QuadPart; pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart; - pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->RelativeOffset); + pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset); } HeapFree(GetProcessHeap(), 0, pBuffer); LeaveCriticalSection(&PerfDataCriticalSection); @@ -441,7 +432,7 @@ ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index) EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) - WorkingSetSizeBytes = pPerfData[Index].WorkingSetSizeBytes; + WorkingSetSizeBytes = pPerfData[Index].vmCounters.WorkingSetSize; else WorkingSetSizeBytes = 0; @@ -457,7 +448,7 @@ ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index) EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) - PeakWorkingSetSizeBytes = pPerfData[Index].PeakWorkingSetSizeBytes; + PeakWorkingSetSizeBytes = pPerfData[Index].vmCounters.PeakWorkingSetSize; else PeakWorkingSetSizeBytes = 0; @@ -489,7 +480,7 @@ ULONG PerfDataGetPageFaultCount(ULONG Index) EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) - PageFaultCount = pPerfData[Index].PageFaultCount; + PageFaultCount = pPerfData[Index].vmCounters.PageFaultCount; else PageFaultCount = 0; @@ -521,7 +512,7 @@ ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index) EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) - VirtualMemorySizeBytes = pPerfData[Index].VirtualMemorySizeBytes; + VirtualMemorySizeBytes = pPerfData[Index].vmCounters.VirtualSize; else VirtualMemorySizeBytes = 0; @@ -537,7 +528,7 @@ ULONG PerfDataGetPagedPoolUsagePages(ULONG Index) EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) - PagedPoolUsagePages = pPerfData[Index].PagedPoolUsagePages; + PagedPoolUsagePages = pPerfData[Index].vmCounters.QuotaPagedPoolUsage; else PagedPoolUsagePages = 0; @@ -553,7 +544,7 @@ ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index) EnterCriticalSection(&PerfDataCriticalSection); if (Index < ProcessCount) - NonPagedPoolUsagePages = pPerfData[Index].NonPagedPoolUsagePages; + NonPagedPoolUsagePages = pPerfData[Index].vmCounters.QuotaNonPagedPoolUsage; else NonPagedPoolUsagePages = 0; @@ -668,8 +659,8 @@ ULONG PerfDataGetCommitChargeTotalK(void) EnterCriticalSection(&PerfDataCriticalSection); - Total = SystemPerfInfo.MmTotalCommittedPages; - PageSize = SystemBasicInfo.uPageSize; + Total = SystemPerfInfo.TotalCommittedPages; + PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); @@ -685,8 +676,8 @@ ULONG PerfDataGetCommitChargeLimitK(void) EnterCriticalSection(&PerfDataCriticalSection); - Limit = SystemPerfInfo.MmTotalCommitLimit; - PageSize = SystemBasicInfo.uPageSize; + Limit = SystemPerfInfo.TotalCommitLimit; + PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); @@ -702,8 +693,8 @@ ULONG PerfDataGetCommitChargePeakK(void) EnterCriticalSection(&PerfDataCriticalSection); - Peak = SystemPerfInfo.MmPeakLimit; - PageSize = SystemBasicInfo.uPageSize; + Peak = SystemPerfInfo.PeakCommitment; + PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); @@ -721,9 +712,9 @@ ULONG PerfDataGetKernelMemoryTotalK(void) EnterCriticalSection(&PerfDataCriticalSection); - Paged = SystemPerfInfo.PoolPagedBytes; - NonPaged = SystemPerfInfo.PoolNonPagedBytes; - PageSize = SystemBasicInfo.uPageSize; + Paged = SystemPerfInfo.PagedPoolUsage; + NonPaged = SystemPerfInfo.NonPagedPoolUsage; + PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); @@ -742,8 +733,8 @@ ULONG PerfDataGetKernelMemoryPagedK(void) EnterCriticalSection(&PerfDataCriticalSection); - Paged = SystemPerfInfo.PoolPagedBytes; - PageSize = SystemBasicInfo.uPageSize; + Paged = SystemPerfInfo.PagedPoolUsage; + PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); @@ -759,8 +750,8 @@ ULONG PerfDataGetKernelMemoryNonPagedK(void) EnterCriticalSection(&PerfDataCriticalSection); - NonPaged = SystemPerfInfo.PoolNonPagedBytes; - PageSize = SystemBasicInfo.uPageSize; + NonPaged = SystemPerfInfo.NonPagedPoolUsage; + PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); @@ -776,8 +767,8 @@ ULONG PerfDataGetPhysicalMemoryTotalK(void) EnterCriticalSection(&PerfDataCriticalSection); - Total = SystemBasicInfo.uMmNumberOfPhysicalPages; - PageSize = SystemBasicInfo.uPageSize; + Total = SystemBasicInfo.MmNumberOfPhysicalPages; + PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); @@ -793,8 +784,8 @@ ULONG PerfDataGetPhysicalMemoryAvailableK(void) EnterCriticalSection(&PerfDataCriticalSection); - Available = SystemPerfInfo.MmAvailablePages; - PageSize = SystemBasicInfo.uPageSize; + Available = SystemPerfInfo.AvailablePages; + PageSize = SystemBasicInfo.PageSize; LeaveCriticalSection(&PerfDataCriticalSection); diff --git a/programs/taskmgr/perfdata.h b/programs/taskmgr/perfdata.h index 4ee6b59209e..be6b819457a 100644 --- a/programs/taskmgr/perfdata.h +++ b/programs/taskmgr/perfdata.h @@ -23,25 +23,9 @@ #ifndef __PERFDATA_H #define __PERFDATA_H -#ifdef __cplusplus -extern "C" { -#endif +#include "winternl.h" - -#if 0 -typedef struct _TIME { - DWORD LowPart; - LONG HighPart; -} TIME, *PTIME; -#endif - -typedef ULARGE_INTEGER TIME, *PTIME; - -typedef struct _UNICODE_STRING { - USHORT Length; - USHORT MaximumLength; - PWSTR Buffer; -} UNICODE_STRING, *PUNICODE_STRING; +typedef ULARGE_INTEGER TIME; typedef struct _PERFDATA { @@ -51,227 +35,20 @@ typedef struct _PERFDATA ULONG SessionId; ULONG CPUUsage; TIME CPUTime; - ULONG WorkingSetSizeBytes; - ULONG PeakWorkingSetSizeBytes; - ULONG WorkingSetSizeDelta; - ULONG PageFaultCount; - ULONG PageFaultCountDelta; - ULONG VirtualMemorySizeBytes; - ULONG PagedPoolUsagePages; - ULONG NonPagedPoolUsagePages; ULONG BasePriority; ULONG HandleCount; ULONG ThreadCount; ULONG USERObjectCount; ULONG GDIObjectCount; + SIZE_T WorkingSetSizeDelta; + ULONG PageFaultCountDelta; + VM_COUNTERS vmCounters; IO_COUNTERS IOCounters; TIME UserTime; TIME KernelTime; } PERFDATA, *PPERFDATA; -typedef struct _CLIENT_ID -{ - HANDLE UniqueProcess; - HANDLE UniqueThread; -} CLIENT_ID, *PCLIENT_ID; - -typedef enum _KWAIT_REASON -{ - Executive, - FreePage, - PageIn, - PoolAllocation, - DelayExecution, - Suspended, - UserRequest, - WrExecutive, - WrFreePage, - WrPageIn, - WrDelayExecution, - WrSuspended, - WrUserRequest, - WrQueue, - WrLpcReceive, - WrLpcReply, - WrVirtualMemory, - WrPageOut, - WrRendezvous, - Spare2, - Spare3, - Spare4, - Spare5, - Spare6, - WrKernel, - MaximumWaitReason, -} KWAIT_REASON; - -/* SystemProcessThreadInfo (5) */ -typedef struct _SYSTEM_THREAD_INFORMATION -{ - TIME KernelTime; - TIME UserTime; - TIME CreateTime; - ULONG TickCount; - ULONG StartEIP; - CLIENT_ID ClientId; - ULONG DynamicPriority; - ULONG BasePriority; - ULONG nSwitches; - DWORD State; - KWAIT_REASON WaitReason; - -} SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION; - -typedef struct SYSTEM_PROCESS_INFORMATION -{ - ULONG RelativeOffset; - ULONG ThreadCount; - ULONG Unused1 [6]; - TIME CreateTime; - TIME UserTime; - TIME KernelTime; - UNICODE_STRING Name; - ULONG BasePriority; - ULONG ProcessId; - ULONG ParentProcessId; - ULONG HandleCount; - ULONG SessionId; - ULONG Unused2; - ULONG PeakVirtualSizeBytes; - ULONG TotalVirtualSizeBytes; - ULONG PageFaultCount; - ULONG PeakWorkingSetSizeBytes; - ULONG TotalWorkingSetSizeBytes; - ULONG PeakPagedPoolUsagePages; - ULONG TotalPagedPoolUsagePages; - ULONG PeakNonPagedPoolUsagePages; - ULONG TotalNonPagedPoolUsagePages; - ULONG TotalPageFileUsageBytes; - ULONG PeakPageFileUsageBytes; - ULONG TotalPrivateBytes; - SYSTEM_THREAD_INFORMATION ThreadSysInfo [1]; - -} SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION; - -typedef struct -{ - DWORD dwUnknown1; - ULONG uKeMaximumIncrement; - ULONG uPageSize; - ULONG uMmNumberOfPhysicalPages; - ULONG uMmLowestPhysicalPage; - ULONG uMmHighestPhysicalPage; - ULONG uAllocationGranularity; - PVOID pLowestUserAddress; - PVOID pMmHighestUserAddress; - ULONG uKeActiveProcessors; - BYTE bKeNumberProcessors; - BYTE bUnknown2; - WORD wUnknown3; -} SYSTEM_BASIC_INFORMATION; - -/* SystemPerformanceInfo (2) */ -typedef struct _SYSTEM_PERFORMANCE_INFORMATION -{ - LARGE_INTEGER /*TotalProcessorTime*/liIdleTime; - LARGE_INTEGER IoReadTransferCount; - LARGE_INTEGER IoWriteTransferCount; - LARGE_INTEGER IoOtherTransferCount; - ULONG IoReadOperationCount; - ULONG IoWriteOperationCount; - ULONG IoOtherOperationCount; - ULONG MmAvailablePages; - ULONG MmTotalCommittedPages; - ULONG MmTotalCommitLimit; - ULONG MmPeakLimit; - ULONG PageFaults; - ULONG WriteCopies; - ULONG TransitionFaults; - ULONG Unknown1; - ULONG DemandZeroFaults; - ULONG PagesInput; - ULONG PagesRead; - ULONG Unknown2; - ULONG Unknown3; - ULONG PagesOutput; - ULONG PageWrites; - ULONG Unknown4; - ULONG Unknown5; - ULONG PoolPagedBytes; - ULONG PoolNonPagedBytes; - ULONG Unknown6; - ULONG Unknown7; - ULONG Unknown8; - ULONG Unknown9; - ULONG MmTotalSystemFreePtes; - ULONG MmSystemCodepage; - ULONG MmTotalSystemDriverPages; - ULONG MmTotalSystemCodePages; - ULONG Unknown10; - ULONG Unknown11; - ULONG Unknown12; - ULONG MmSystemCachePage; - ULONG MmPagedPoolPage; - ULONG MmSystemDriverPage; - ULONG CcFastReadNoWait; - ULONG CcFastReadWait; - ULONG CcFastReadResourceMiss; - ULONG CcFastReadNotPossible; - ULONG CcFastMdlReadNoWait; - ULONG CcFastMdlReadWait; - ULONG CcFastMdlReadResourceMiss; - ULONG CcFastMdlReadNotPossible; - ULONG CcMapDataNoWait; - ULONG CcMapDataWait; - ULONG CcMapDataNoWaitMiss; - ULONG CcMapDataWaitMiss; - ULONG CcPinMappedDataCount; - ULONG CcPinReadNoWait; - ULONG CcPinReadWait; - ULONG CcPinReadNoWaitMiss; - ULONG CcPinReadWaitMiss; - ULONG CcCopyReadNoWait; - ULONG CcCopyReadWait; - ULONG CcCopyReadNoWaitMiss; - ULONG CcCopyReadWaitMiss; - ULONG CcMdlReadNoWait; - ULONG CcMdlReadWait; - ULONG CcMdlReadNoWaitMiss; - ULONG CcMdlReadWaitMiss; - ULONG CcReadaheadIos; - ULONG CcLazyWriteIos; - ULONG CcLazyWritePages; - ULONG CcDataFlushes; - ULONG CcDataPages; - ULONG ContextSwitches; - ULONG Unknown13; - ULONG Unknown14; - ULONG SystemCalls; - -} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION; - -typedef struct -{ - LARGE_INTEGER liKeBootTime; - LARGE_INTEGER liKeSystemTime; - LARGE_INTEGER liExpTimeZoneBias; - ULONG uCurrentTimeZoneId; - DWORD dwReserved; -} SYSTEM_TIME_INFORMATION; - -/* SystemCacheInformation (21) */ -typedef struct _SYSTEM_CACHE_INFORMATION -{ - ULONG CurrentSize; - ULONG PeakSize; - ULONG PageFaultCount; - ULONG MinimumWorkingSet; - ULONG MaximumWorkingSet; - ULONG Unused[4]; - -} SYSTEM_CACHE_INFORMATION; - /* SystemPageFileInformation (18) */ typedef struct _SYSTEM_PAGEFILE_INFORMATION @@ -281,54 +58,8 @@ struct _SYSTEM_PAGEFILE_INFORMATION ULONG TotalUsedPages; ULONG PeakUsedPages; UNICODE_STRING PagefileFileName; - } SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION; -/* SystemHandleInformation (16) */ -/* (see ontypes.h) */ -typedef -struct _SYSTEM_HANDLE_ENTRY -{ - ULONG OwnerPid; - BYTE ObjectType; - BYTE HandleFlags; - USHORT HandleValue; - PVOID ObjectPointer; - ULONG AccessMask; - -} SYSTEM_HANDLE_ENTRY, *PSYSTEM_HANDLE_ENTRY; - -typedef -struct _SYSTEM_HANDLE_INFORMATION -{ - ULONG Count; - SYSTEM_HANDLE_ENTRY Handle [1]; - -} SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION; - -/* SystemProcessorPerformanceInformation (8) */ -typedef -struct _SYSTEM_PROCESSORTIME_INFO -{ - LARGE_INTEGER IdleTime; - LARGE_INTEGER KernelTime; - LARGE_INTEGER UserTime; - LARGE_INTEGER DpcTime; - LARGE_INTEGER InterruptTime; - ULONG InterruptCount; - ULONG Unused; - -} SYSTEM_PROCESSORTIME_INFO, *PSYSTEM_PROCESSORTIME_INFO; - -#define SystemBasicInformation 0 -#define SystemPerformanceInformation 2 -#define SystemTimeInformation 3 -#define SystemProcessInformation 5 -#define SystemProcessorTimeInformation 8 -#define SystemHandleInformation 16 -#define SystemPageFileInformation 18 -#define SystemCacheInformation 21 - #define Li2Double(x) ((double)((x).QuadPart)) #define GR_GDIOBJECTS 0 /* Count of GDI objects */ @@ -339,7 +70,6 @@ typedef DWORD (WINAPI *PROCGGR)(HANDLE,DWORD); typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS); BOOL PerfDataInitialize(void); -void PerfDataUninitialize(void); void PerfDataRefresh(void); ULONG PerfDataGetProcessCount(void); @@ -383,9 +113,4 @@ ULONG PerfDataGetSystemHandleCount(void); ULONG PerfDataGetTotalThreadCount(void); - -#ifdef __cplusplus -}; -#endif - #endif /* __PERFDATA_H */ diff --git a/programs/taskmgr/taskmgr.c b/programs/taskmgr/taskmgr.c index e72e12be6ba..1fa530a0385 100644 --- a/programs/taskmgr/taskmgr.c +++ b/programs/taskmgr/taskmgr.c @@ -1101,6 +1101,5 @@ int APIENTRY WinMain(HINSTANCE hInstance, /* Save our settings to the registry */ SaveSettings(); - PerfDataUninitialize(); return 0; }