mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
- don't redefine public structures in taskmgr
- minor taskmgr changes and make better use of PCH - fixed definition of SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION and depending code svn path=/trunk/; revision=14536
This commit is contained in:
parent
b995b11c1d
commit
2acf2098b8
31 changed files with 141 additions and 623 deletions
|
@ -1401,17 +1401,17 @@ struct _SYSTEM_DEVICE_INFORMATION
|
||||||
// SystemProcessorPerformanceInformation (8)
|
// SystemProcessorPerformanceInformation (8)
|
||||||
// (one per processor in the system)
|
// (one per processor in the system)
|
||||||
typedef
|
typedef
|
||||||
struct _SYSTEM_PROCESSORTIME_INFO
|
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
|
||||||
{
|
{
|
||||||
TIME TotalProcessorRunTime;
|
LARGE_INTEGER IdleTime;
|
||||||
TIME TotalProcessorTime;
|
LARGE_INTEGER KernelTime;
|
||||||
TIME TotalProcessorUserTime;
|
LARGE_INTEGER UserTime;
|
||||||
TIME TotalDPCTime;
|
LARGE_INTEGER DpcTime;
|
||||||
TIME TotalInterruptTime;
|
LARGE_INTEGER InterruptTime;
|
||||||
ULONG TotalInterrupts;
|
ULONG InterruptCount;
|
||||||
ULONG Unused;
|
ULONG Reserved;
|
||||||
|
|
||||||
} SYSTEM_PROCESSORTIME_INFO, *PSYSTEM_PROCESSORTIME_INFO;
|
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
|
||||||
|
|
||||||
// SystemFlagsInformation (9)
|
// SystemFlagsInformation (9)
|
||||||
typedef
|
typedef
|
||||||
|
|
|
@ -500,12 +500,12 @@ GetSystemTimes(
|
||||||
LPFILETIME lpUserTime
|
LPFILETIME lpUserTime
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SYSTEM_PROCESSORTIME_INFO SysProcTime;
|
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcPerfInfo;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation,
|
Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation,
|
||||||
&SysProcTime,
|
&SysProcPerfInfo,
|
||||||
sizeof(SysProcTime),
|
sizeof(SysProcPerfInfo),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -517,14 +517,14 @@ GetSystemTimes(
|
||||||
Good only for one processor system.
|
Good only for one processor system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
lpIdleTime->dwLowDateTime = SysProcTime.TotalProcessorRunTime.LowPart;
|
lpIdleTime->dwLowDateTime = SysProcPerfInfo.IdleTime.LowPart;
|
||||||
lpIdleTime->dwHighDateTime = SysProcTime.TotalProcessorRunTime.HighPart;
|
lpIdleTime->dwHighDateTime = SysProcPerfInfo.IdleTime.HighPart;
|
||||||
|
|
||||||
lpKernelTime->dwLowDateTime = SysProcTime.TotalProcessorTime.LowPart;
|
lpKernelTime->dwLowDateTime = SysProcPerfInfo.KernelTime.LowPart;
|
||||||
lpKernelTime->dwHighDateTime = SysProcTime.TotalProcessorTime.HighPart;
|
lpKernelTime->dwHighDateTime = SysProcPerfInfo.KernelTime.HighPart;
|
||||||
|
|
||||||
lpUserTime->dwLowDateTime = SysProcTime.TotalProcessorUserTime.LowPart;
|
lpUserTime->dwLowDateTime = SysProcPerfInfo.UserTime.LowPart;
|
||||||
lpUserTime->dwHighDateTime = SysProcTime.TotalProcessorUserTime.HighPart;
|
lpUserTime->dwHighDateTime = SysProcPerfInfo.UserTime.HighPart;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -725,18 +725,18 @@ QSI_DEF(SystemDeviceInformation)
|
||||||
/* Class 8 - Processor Performance Information */
|
/* Class 8 - Processor Performance Information */
|
||||||
QSI_DEF(SystemProcessorPerformanceInformation)
|
QSI_DEF(SystemProcessorPerformanceInformation)
|
||||||
{
|
{
|
||||||
PSYSTEM_PROCESSORTIME_INFO Spi
|
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION Spi
|
||||||
= (PSYSTEM_PROCESSORTIME_INFO) Buffer;
|
= (PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) Buffer;
|
||||||
|
|
||||||
ULONG i;
|
ULONG i;
|
||||||
LARGE_INTEGER CurrentTime;
|
LARGE_INTEGER CurrentTime;
|
||||||
PKPRCB Prcb;
|
PKPRCB Prcb;
|
||||||
|
|
||||||
*ReqSize = KeNumberProcessors * sizeof (SYSTEM_PROCESSORTIME_INFO);
|
*ReqSize = KeNumberProcessors * sizeof (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
|
||||||
/*
|
/*
|
||||||
* Check user buffer's size
|
* Check user buffer's size
|
||||||
*/
|
*/
|
||||||
if (Size < KeNumberProcessors * sizeof(SYSTEM_PROCESSORTIME_INFO))
|
if (Size < KeNumberProcessors * sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION))
|
||||||
{
|
{
|
||||||
return (STATUS_INFO_LENGTH_MISMATCH);
|
return (STATUS_INFO_LENGTH_MISMATCH);
|
||||||
}
|
}
|
||||||
|
@ -745,16 +745,16 @@ QSI_DEF(SystemProcessorPerformanceInformation)
|
||||||
Prcb = ((PKPCR)KPCR_BASE)->Prcb;
|
Prcb = ((PKPCR)KPCR_BASE)->Prcb;
|
||||||
for (i = 0; i < KeNumberProcessors; i++)
|
for (i = 0; i < KeNumberProcessors; i++)
|
||||||
{
|
{
|
||||||
Spi->TotalProcessorRunTime.QuadPart = (Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime) * 100000LL; // IdleTime
|
Spi->IdleTime.QuadPart = (Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime) * 100000LL; // IdleTime
|
||||||
Spi->TotalProcessorTime.QuadPart = Prcb->KernelTime * 100000LL; // KernelTime
|
Spi->KernelTime.QuadPart = Prcb->KernelTime * 100000LL; // KernelTime
|
||||||
Spi->TotalProcessorUserTime.QuadPart = Prcb->UserTime * 100000LL;
|
Spi->UserTime.QuadPart = Prcb->UserTime * 100000LL;
|
||||||
Spi->TotalDPCTime.QuadPart = Prcb->DpcTime * 100000LL;
|
Spi->DpcTime.QuadPart = Prcb->DpcTime * 100000LL;
|
||||||
Spi->TotalInterruptTime.QuadPart = Prcb->InterruptTime * 100000LL;
|
Spi->InterruptTime.QuadPart = Prcb->InterruptTime * 100000LL;
|
||||||
Spi->TotalInterrupts = Prcb->InterruptCount; // Interrupt Count
|
Spi->InterruptCount = Prcb->InterruptCount; // Interrupt Count
|
||||||
Spi++;
|
Spi++;
|
||||||
Prcb = (PKPRCB)((ULONG_PTR)Prcb + PAGE_SIZE);
|
Prcb = (PKPRCB)((ULONG_PTR)Prcb + PAGE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (STATUS_SUCCESS);
|
return (STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -583,6 +583,7 @@ STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_APP_TITLE "Task-Manager"
|
IDS_APP_TITLE "Task-Manager"
|
||||||
IDC_TASKMGR "Task-Manager"
|
IDC_TASKMGR "Task-Manager"
|
||||||
|
IDS_IDLE_PROCESS "Leerlaufprozess"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
|
|
|
@ -538,6 +538,7 @@ STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_APP_TITLE "Opgavestyring"
|
IDS_APP_TITLE "Opgavestyring"
|
||||||
IDC_TASKMGR "Opgavestyring"
|
IDC_TASKMGR "Opgavestyring"
|
||||||
|
IDS_IDLE_PROCESS "System Idle Process"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
|
|
|
@ -538,6 +538,7 @@ STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_APP_TITLE "Task Manager"
|
IDS_APP_TITLE "Task Manager"
|
||||||
IDC_TASKMGR "Task Manager"
|
IDC_TASKMGR "Task Manager"
|
||||||
|
IDS_IDLE_PROCESS "System Idle Process"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
|
|
|
@ -611,6 +611,7 @@ STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_APP_TITLE "Administrador de Tareas"
|
IDS_APP_TITLE "Administrador de Tareas"
|
||||||
IDC_TASKMGR "Administrador de Tareas"
|
IDC_TASKMGR "Administrador de Tareas"
|
||||||
|
IDS_IDLE_PROCESS "System Idle Process"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
|
|
|
@ -555,6 +555,7 @@ STRINGTABLE DISCARDABLE
|
||||||
BEGIN
|
BEGIN
|
||||||
IDS_APP_TITLE "Aktivitetshanteraren"
|
IDS_APP_TITLE "Aktivitetshanteraren"
|
||||||
IDC_TASKMGR "Aktivitetshanteraren"
|
IDC_TASKMGR "Aktivitetshanteraren"
|
||||||
|
IDS_IDLE_PROCESS "System Idle Process"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
|
|
|
@ -21,14 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "about.h"
|
|
||||||
|
|
||||||
INT_PTR CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK AboutDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
|
|
|
@ -22,17 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "procpage.h"
|
|
||||||
#include "affinity.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
|
|
||||||
HANDLE hProcessAffinityHandle;
|
HANDLE hProcessAffinityHandle;
|
||||||
TCHAR szTemp[256];
|
TCHAR szTemp[256];
|
||||||
|
|
|
@ -22,15 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "applpage.h"
|
|
||||||
#include "procpage.h"
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -370,7 +361,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
|
||||||
/* It is not already in the list so add it */
|
/* It is not already in the list so add it */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)malloc(sizeof(APPLICATION_PAGE_LIST_ITEM));
|
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)HeapAlloc(GetProcessHeap(), 0, sizeof(APPLICATION_PAGE_LIST_ITEM));
|
||||||
|
|
||||||
pAPLI->hWnd = hWnd;
|
pAPLI->hWnd = hWnd;
|
||||||
pAPLI->hIcon = hIcon;
|
pAPLI->hIcon = hIcon;
|
||||||
|
@ -409,7 +400,7 @@ void AddOrUpdateHwnd(HWND hWnd, TCHAR *szTitle, HICON hIcon, BOOL bHung)
|
||||||
ImageList_Remove(hImageListSmall, item.iItem);
|
ImageList_Remove(hImageListSmall, item.iItem);
|
||||||
|
|
||||||
ListView_DeleteItem(hApplicationPageListCtrl, item.iItem);
|
ListView_DeleteItem(hApplicationPageListCtrl, item.iItem);
|
||||||
free(pAPLI);
|
HeapFree(GetProcessHeap(), 0, pAPLI);
|
||||||
bItemRemoved = TRUE;
|
bItemRemoved = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -704,7 +695,7 @@ void ApplicationPage_OnWindowsTileHorizontally(void)
|
||||||
HWND* hWndArray;
|
HWND* hWndArray;
|
||||||
int nWndCount;
|
int nWndCount;
|
||||||
|
|
||||||
hWndArray = (HWND*)malloc(sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
|
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
|
||||||
nWndCount = 0;
|
nWndCount = 0;
|
||||||
|
|
||||||
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
||||||
|
@ -724,7 +715,7 @@ void ApplicationPage_OnWindowsTileHorizontally(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TileWindows(NULL, MDITILE_HORIZONTAL, NULL, nWndCount, hWndArray);
|
TileWindows(NULL, MDITILE_HORIZONTAL, NULL, nWndCount, hWndArray);
|
||||||
free(hWndArray);
|
HeapFree(GetProcessHeap(), 0, hWndArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationPage_OnWindowsTileVertically(void)
|
void ApplicationPage_OnWindowsTileVertically(void)
|
||||||
|
@ -735,7 +726,7 @@ void ApplicationPage_OnWindowsTileVertically(void)
|
||||||
HWND* hWndArray;
|
HWND* hWndArray;
|
||||||
int nWndCount;
|
int nWndCount;
|
||||||
|
|
||||||
hWndArray = (HWND*)malloc(sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
|
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
|
||||||
nWndCount = 0;
|
nWndCount = 0;
|
||||||
|
|
||||||
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
||||||
|
@ -755,7 +746,7 @@ void ApplicationPage_OnWindowsTileVertically(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
TileWindows(NULL, MDITILE_VERTICAL, NULL, nWndCount, hWndArray);
|
TileWindows(NULL, MDITILE_VERTICAL, NULL, nWndCount, hWndArray);
|
||||||
free(hWndArray);
|
HeapFree(GetProcessHeap(), 0, hWndArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationPage_OnWindowsMinimize(void)
|
void ApplicationPage_OnWindowsMinimize(void)
|
||||||
|
@ -808,7 +799,7 @@ void ApplicationPage_OnWindowsCascade(void)
|
||||||
HWND* hWndArray;
|
HWND* hWndArray;
|
||||||
int nWndCount;
|
int nWndCount;
|
||||||
|
|
||||||
hWndArray = (HWND*)malloc(sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
|
hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
|
||||||
nWndCount = 0;
|
nWndCount = 0;
|
||||||
|
|
||||||
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
|
||||||
|
@ -826,7 +817,7 @@ void ApplicationPage_OnWindowsCascade(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CascadeWindows(NULL, 0, NULL, nWndCount, hWndArray);
|
CascadeWindows(NULL, 0, NULL, nWndCount, hWndArray);
|
||||||
free(hWndArray);
|
HeapFree(GetProcessHeap(), 0, hWndArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationPage_OnWindowsBringToFront(void)
|
void ApplicationPage_OnWindowsBringToFront(void)
|
||||||
|
|
|
@ -22,15 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "column.h"
|
|
||||||
#include "procpage.h"
|
|
||||||
|
|
||||||
UINT ColumnDataHints[25];
|
UINT ColumnDataHints[25];
|
||||||
TCHAR szTemp[256];
|
TCHAR szTemp[256];
|
||||||
|
|
|
@ -21,20 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "procpage.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
#include "column.h"
|
|
||||||
#include "proclist.h"
|
|
||||||
#include "dbgchnl.h"
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
* - the dialog box could be non modal
|
* - the dialog box could be non modal
|
||||||
|
|
|
@ -22,17 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "debug.h"
|
|
||||||
#include "procpage.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
|
|
||||||
void ProcessPage_OnDebug(void)
|
void ProcessPage_OnDebug(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,17 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "endproc.h"
|
|
||||||
#include "procpage.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
|
|
||||||
TCHAR szTemp[256];
|
TCHAR szTemp[256];
|
||||||
TCHAR szTempA[256];
|
TCHAR szTempA[256];
|
||||||
|
|
|
@ -21,14 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "font.h"
|
|
||||||
|
|
||||||
void Font_DrawText(HDC hDC, LPCTSTR lpszText, int x, int y)
|
void Font_DrawText(HDC hDC, LPCTSTR lpszText, int x, int y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,18 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "graph.h"
|
|
||||||
#include "font.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
|
|
||||||
|
|
||||||
LONG OldGraphWndProc;
|
LONG OldGraphWndProc;
|
||||||
|
|
||||||
|
|
|
@ -21,15 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
#include "graphctl.h"
|
|
||||||
|
|
||||||
LONG OldGraphCtrlWndProc;
|
LONG OldGraphCtrlWndProc;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ TARGET_INSTALLDIR = system32
|
||||||
|
|
||||||
TARGET_PCH = precomp.h
|
TARGET_PCH = precomp.h
|
||||||
|
|
||||||
TARGET_CFLAGS = -Werror -Wall -DDBG -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -D__USE_W32API
|
TARGET_CFLAGS = -Werror -Wall -DDBG -D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501 -D__USE_W32API
|
||||||
|
|
||||||
TARGET_SDKLIBS = ntdll.a kernel32.a user32.a gdi32.a comctl32.a
|
TARGET_SDKLIBS = ntdll.a kernel32.a user32.a gdi32.a comctl32.a
|
||||||
|
|
||||||
|
|
|
@ -27,15 +27,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "optnmenu.h"
|
|
||||||
#include "procpage.h"
|
|
||||||
|
|
||||||
void TaskManager_OnOptionsAlwaysOnTop(void)
|
void TaskManager_OnOptionsAlwaysOnTop(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,19 +21,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
#include "perfdata.h"
|
|
||||||
|
|
||||||
PROCNTQSI NtQuerySystemInformation = NULL;
|
CRITICAL_SECTION PerfDataCriticalSection;
|
||||||
PROCGGR pGetGuiResources = NULL;
|
|
||||||
PROCGPIC pGetProcessIoCounters = NULL;
|
|
||||||
CRITICAL_SECTION PerfDataCriticalSection;
|
|
||||||
PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */
|
PPERFDATA pPerfDataOld = NULL; /* Older perf data (saved to establish delta values) */
|
||||||
PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */
|
PPERFDATA pPerfData = NULL; /* Most recent copy of perf data */
|
||||||
ULONG ProcessCountOld = 0;
|
ULONG ProcessCountOld = 0;
|
||||||
|
@ -48,21 +37,14 @@ SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo;
|
||||||
SYSTEM_BASIC_INFORMATION SystemBasicInfo;
|
SYSTEM_BASIC_INFORMATION SystemBasicInfo;
|
||||||
SYSTEM_CACHE_INFORMATION SystemCacheInfo;
|
SYSTEM_CACHE_INFORMATION SystemCacheInfo;
|
||||||
SYSTEM_HANDLE_INFORMATION SystemHandleInfo;
|
SYSTEM_HANDLE_INFORMATION SystemHandleInfo;
|
||||||
PSYSTEM_PROCESSORTIME_INFO SystemProcessorTimeInfo = NULL;
|
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo = NULL;
|
||||||
|
|
||||||
BOOL PerfDataInitialize(void)
|
BOOL PerfDataInitialize(void)
|
||||||
{
|
{
|
||||||
LONG status;
|
NTSTATUS status;
|
||||||
|
|
||||||
NtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "NtQuerySystemInformation");
|
|
||||||
pGetGuiResources = (PROCGGR)GetProcAddress(GetModuleHandle(_T("user32.dll")), "GetGuiResources");
|
|
||||||
pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetProcessIoCounters");
|
|
||||||
|
|
||||||
InitializeCriticalSection(&PerfDataCriticalSection);
|
InitializeCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (!NtQuerySystemInformation)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get number of processors in the system
|
* Get number of processors in the system
|
||||||
*/
|
*/
|
||||||
|
@ -75,15 +57,13 @@ BOOL PerfDataInitialize(void)
|
||||||
|
|
||||||
void PerfDataUninitialize(void)
|
void PerfDataUninitialize(void)
|
||||||
{
|
{
|
||||||
NtQuerySystemInformation = NULL;
|
|
||||||
|
|
||||||
DeleteCriticalSection(&PerfDataCriticalSection);
|
DeleteCriticalSection(&PerfDataCriticalSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerfDataRefresh(void)
|
void PerfDataRefresh(void)
|
||||||
{
|
{
|
||||||
ULONG ulSize;
|
ULONG ulSize;
|
||||||
LONG status;
|
NTSTATUS status;
|
||||||
LPBYTE pBuffer;
|
LPBYTE pBuffer;
|
||||||
ULONG BufferSize;
|
ULONG BufferSize;
|
||||||
PSYSTEM_PROCESS_INFORMATION pSPI;
|
PSYSTEM_PROCESS_INFORMATION pSPI;
|
||||||
|
@ -94,18 +74,14 @@ void PerfDataRefresh(void)
|
||||||
TCHAR szTemp[MAX_PATH];
|
TCHAR szTemp[MAX_PATH];
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo;
|
SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo;
|
||||||
SYSTEM_TIME_INFORMATION SysTimeInfo;
|
SYSTEM_TIMEOFDAY_INFORMATION SysTimeInfo;
|
||||||
SYSTEM_CACHE_INFORMATION SysCacheInfo;
|
SYSTEM_CACHE_INFORMATION SysCacheInfo;
|
||||||
LPBYTE SysHandleInfoData;
|
LPBYTE SysHandleInfoData;
|
||||||
PSYSTEM_PROCESSORTIME_INFO SysProcessorTimeInfo;
|
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcessorTimeInfo;
|
||||||
double CurrentKernelTime;
|
double CurrentKernelTime;
|
||||||
|
|
||||||
|
|
||||||
if (!NtQuerySystemInformation)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Get new system time */
|
/* Get new system time */
|
||||||
status = NtQuerySystemInformation(SystemTimeInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0);
|
status = NtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0);
|
||||||
if (status != NO_ERROR)
|
if (status != NO_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -120,8 +96,8 @@ void PerfDataRefresh(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get processor time information */
|
/* Get processor time information */
|
||||||
SysProcessorTimeInfo = (PSYSTEM_PROCESSORTIME_INFO)malloc(sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors);
|
SysProcessorTimeInfo = (PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION)HeapAlloc(GetProcessHeap(), 0, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberProcessors);
|
||||||
status = NtQuerySystemInformation(SystemProcessorTimeInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors, &ulSize);
|
status = NtQuerySystemInformation(SystemProcessorPerformanceInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * SystemBasicInfo.NumberProcessors, &ulSize);
|
||||||
if (status != NO_ERROR)
|
if (status != NO_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -133,12 +109,12 @@ void PerfDataRefresh(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
BufferSize += 0x10000;
|
BufferSize += 0x10000;
|
||||||
SysHandleInfoData = (LPBYTE)malloc(BufferSize);
|
SysHandleInfoData = (LPBYTE)HeapAlloc(GetProcessHeap(), 0, BufferSize);
|
||||||
|
|
||||||
status = NtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize);
|
status = NtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize);
|
||||||
|
|
||||||
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
|
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
|
||||||
free(SysHandleInfoData);
|
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/);
|
} while (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/);
|
||||||
|
@ -151,12 +127,12 @@ void PerfDataRefresh(void)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
BufferSize += 0x10000;
|
BufferSize += 0x10000;
|
||||||
pBuffer = (LPBYTE)malloc(BufferSize);
|
pBuffer = (LPBYTE)HeapAlloc(GetProcessHeap(), 0, BufferSize);
|
||||||
|
|
||||||
status = NtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize);
|
status = NtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize);
|
||||||
|
|
||||||
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
|
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
|
||||||
free(pBuffer);
|
HeapFree(GetProcessHeap(), 0, pBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/);
|
} while (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/);
|
||||||
|
@ -177,7 +153,7 @@ void PerfDataRefresh(void)
|
||||||
* Save system processor time info
|
* Save system processor time info
|
||||||
*/
|
*/
|
||||||
if (SystemProcessorTimeInfo) {
|
if (SystemProcessorTimeInfo) {
|
||||||
free(SystemProcessorTimeInfo);
|
HeapFree(GetProcessHeap(), 0, SystemProcessorTimeInfo);
|
||||||
}
|
}
|
||||||
SystemProcessorTimeInfo = SysProcessorTimeInfo;
|
SystemProcessorTimeInfo = SysProcessorTimeInfo;
|
||||||
|
|
||||||
|
@ -185,9 +161,9 @@ void PerfDataRefresh(void)
|
||||||
* Save system handle info
|
* Save system handle info
|
||||||
*/
|
*/
|
||||||
memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION));
|
memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION));
|
||||||
free(SysHandleInfoData);
|
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
|
||||||
|
|
||||||
for (CurrentKernelTime=0, Idx=0; Idx<SystemBasicInfo.bKeNumberProcessors; Idx++) {
|
for (CurrentKernelTime=0, Idx=0; Idx<SystemBasicInfo.NumberProcessors; Idx++) {
|
||||||
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].KernelTime);
|
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].KernelTime);
|
||||||
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].DpcTime);
|
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].DpcTime);
|
||||||
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].InterruptTime);
|
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].InterruptTime);
|
||||||
|
@ -196,22 +172,22 @@ void PerfDataRefresh(void)
|
||||||
/* If it's a first call - skip idle time calcs */
|
/* If it's a first call - skip idle time calcs */
|
||||||
if (liOldIdleTime.QuadPart != 0) {
|
if (liOldIdleTime.QuadPart != 0) {
|
||||||
/* CurrentValue = NewValue - OldValue */
|
/* CurrentValue = NewValue - OldValue */
|
||||||
dbIdleTime = Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);
|
dbIdleTime = Li2Double(SysPerfInfo.IdleTime) - Li2Double(liOldIdleTime);
|
||||||
dbKernelTime = CurrentKernelTime - OldKernelTime;
|
dbKernelTime = CurrentKernelTime - OldKernelTime;
|
||||||
dbSystemTime = Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);
|
dbSystemTime = Li2Double(SysTimeInfo.CurrentTime) - Li2Double(liOldSystemTime);
|
||||||
|
|
||||||
/* CurrentCpuIdle = IdleTime / SystemTime */
|
/* CurrentCpuIdle = IdleTime / SystemTime */
|
||||||
dbIdleTime = dbIdleTime / dbSystemTime;
|
dbIdleTime = dbIdleTime / dbSystemTime;
|
||||||
dbKernelTime = dbKernelTime / dbSystemTime;
|
dbKernelTime = dbKernelTime / dbSystemTime;
|
||||||
|
|
||||||
/* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors */
|
/* CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessors */
|
||||||
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
dbIdleTime = 100.0 - dbIdleTime * 100.0 / (double)SystemBasicInfo.NumberProcessors; /* + 0.5; */
|
||||||
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
dbKernelTime = 100.0 - dbKernelTime * 100.0 / (double)SystemBasicInfo.NumberProcessors; /* + 0.5; */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store new CPU's idle and system time */
|
/* Store new CPU's idle and system time */
|
||||||
liOldIdleTime = SysPerfInfo.liIdleTime;
|
liOldIdleTime = SysPerfInfo.IdleTime;
|
||||||
liOldSystemTime = SysTimeInfo.liKeSystemTime;
|
liOldSystemTime = SysTimeInfo.CurrentTime;
|
||||||
OldKernelTime = CurrentKernelTime;
|
OldKernelTime = CurrentKernelTime;
|
||||||
|
|
||||||
/* Determine the process count
|
/* Determine the process count
|
||||||
|
@ -223,24 +199,24 @@ void PerfDataRefresh(void)
|
||||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
||||||
while (pSPI) {
|
while (pSPI) {
|
||||||
ProcessCount++;
|
ProcessCount++;
|
||||||
if (pSPI->RelativeOffset == 0)
|
if (pSPI->NextEntryOffset == 0)
|
||||||
break;
|
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 */
|
/* Now alloc a new PERFDATA array and fill in the data */
|
||||||
if (pPerfDataOld) {
|
if (pPerfDataOld) {
|
||||||
free(pPerfDataOld);
|
HeapFree(GetProcessHeap(), 0, pPerfDataOld);
|
||||||
}
|
}
|
||||||
pPerfDataOld = pPerfData;
|
pPerfDataOld = pPerfData;
|
||||||
pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
|
pPerfData = (PPERFDATA)HeapAlloc(GetProcessHeap(), 0, sizeof(PERFDATA) * ProcessCount);
|
||||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
|
||||||
for (Idx=0; Idx<ProcessCount; Idx++) {
|
for (Idx=0; Idx<ProcessCount; Idx++) {
|
||||||
/* Get the old perf data for this process (if any) */
|
/* Get the old perf data for this process (if any) */
|
||||||
/* so that we can establish delta values */
|
/* so that we can establish delta values */
|
||||||
pPDOld = NULL;
|
pPDOld = NULL;
|
||||||
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
|
for (Idx2=0; Idx2<ProcessCountOld; Idx2++) {
|
||||||
if (pPerfDataOld[Idx2].ProcessId == pSPI->ProcessId) {
|
if (pPerfDataOld[Idx2].ProcessId == pSPI->UniqueProcessId) {
|
||||||
pPDOld = &pPerfDataOld[Idx2];
|
pPDOld = &pPerfDataOld[Idx2];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -249,25 +225,26 @@ void PerfDataRefresh(void)
|
||||||
/* Clear out process perf data structure */
|
/* Clear out process perf data structure */
|
||||||
memset(&pPerfData[Idx], 0, sizeof(PERFDATA));
|
memset(&pPerfData[Idx], 0, sizeof(PERFDATA));
|
||||||
|
|
||||||
if (pSPI->Name.Buffer)
|
if (pSPI->ImageName.Buffer)
|
||||||
wcscpy(pPerfData[Idx].ImageName, pSPI->Name.Buffer);
|
wcscpy(pPerfData[Idx].ImageName, pSPI->ImageName.Buffer);
|
||||||
else
|
else
|
||||||
wcscpy(pPerfData[Idx].ImageName, L"System Idle Process");
|
LoadStringW(hInst, IDS_IDLE_PROCESS, pPerfData[Idx].ImageName,
|
||||||
|
sizeof(pPerfData[Idx].ImageName) / sizeof(pPerfData[Idx].ImageName[0]));
|
||||||
|
|
||||||
pPerfData[Idx].ProcessId = pSPI->ProcessId;
|
pPerfData[Idx].ProcessId = pSPI->UniqueProcessId;
|
||||||
|
|
||||||
if (pPDOld) {
|
if (pPDOld) {
|
||||||
double CurTime = Li2Double(pSPI->KernelTime) + Li2Double(pSPI->UserTime);
|
double CurTime = Li2Double(pSPI->KernelTime) + Li2Double(pSPI->UserTime);
|
||||||
double OldTime = Li2Double(pPDOld->KernelTime) + Li2Double(pPDOld->UserTime);
|
double OldTime = Li2Double(pPDOld->KernelTime) + Li2Double(pPDOld->UserTime);
|
||||||
double CpuTime = (CurTime - OldTime) / dbSystemTime;
|
double CpuTime = (CurTime - OldTime) / dbSystemTime;
|
||||||
CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.bKeNumberProcessors; /* + 0.5; */
|
CpuTime = CpuTime * 100.0 / (double)SystemBasicInfo.NumberProcessors; /* + 0.5; */
|
||||||
pPerfData[Idx].CPUUsage = (ULONG)CpuTime;
|
pPerfData[Idx].CPUUsage = (ULONG)CpuTime;
|
||||||
}
|
}
|
||||||
pPerfData[Idx].CPUTime.QuadPart = pSPI->UserTime.QuadPart + pSPI->KernelTime.QuadPart;
|
pPerfData[Idx].CPUTime.QuadPart = pSPI->UserTime.QuadPart + pSPI->KernelTime.QuadPart;
|
||||||
pPerfData[Idx].WorkingSetSizeBytes = pSPI->TotalWorkingSetSizeBytes;
|
pPerfData[Idx].WorkingSetSizeBytes = pSPI->WorkingSetSize;
|
||||||
pPerfData[Idx].PeakWorkingSetSizeBytes = pSPI->PeakWorkingSetSizeBytes;
|
pPerfData[Idx].PeakWorkingSetSizeBytes = pSPI->PeakWorkingSetSize;
|
||||||
if (pPDOld)
|
if (pPDOld)
|
||||||
pPerfData[Idx].WorkingSetSizeDelta = labs((LONG)pSPI->TotalWorkingSetSizeBytes - (LONG)pPDOld->WorkingSetSizeBytes);
|
pPerfData[Idx].WorkingSetSizeDelta = labs((LONG)pSPI->WorkingSetSize - (LONG)pPDOld->WorkingSetSizeBytes);
|
||||||
else
|
else
|
||||||
pPerfData[Idx].WorkingSetSizeDelta = 0;
|
pPerfData[Idx].WorkingSetSizeDelta = 0;
|
||||||
pPerfData[Idx].PageFaultCount = pSPI->PageFaultCount;
|
pPerfData[Idx].PageFaultCount = pSPI->PageFaultCount;
|
||||||
|
@ -275,15 +252,15 @@ void PerfDataRefresh(void)
|
||||||
pPerfData[Idx].PageFaultCountDelta = labs((LONG)pSPI->PageFaultCount - (LONG)pPDOld->PageFaultCount);
|
pPerfData[Idx].PageFaultCountDelta = labs((LONG)pSPI->PageFaultCount - (LONG)pPDOld->PageFaultCount);
|
||||||
else
|
else
|
||||||
pPerfData[Idx].PageFaultCountDelta = 0;
|
pPerfData[Idx].PageFaultCountDelta = 0;
|
||||||
pPerfData[Idx].VirtualMemorySizeBytes = pSPI->TotalVirtualSizeBytes;
|
pPerfData[Idx].VirtualMemorySizeBytes = pSPI->VirtualSize;
|
||||||
pPerfData[Idx].PagedPoolUsagePages = pSPI->TotalPagedPoolUsagePages;
|
pPerfData[Idx].PagedPoolUsagePages = pSPI->QuotaPagedPoolUsage;
|
||||||
pPerfData[Idx].NonPagedPoolUsagePages = pSPI->TotalNonPagedPoolUsagePages;
|
pPerfData[Idx].NonPagedPoolUsagePages = pSPI->QuotaPeakNonPagedPoolUsage;
|
||||||
pPerfData[Idx].BasePriority = pSPI->BasePriority;
|
pPerfData[Idx].BasePriority = pSPI->BasePriority;
|
||||||
pPerfData[Idx].HandleCount = pSPI->HandleCount;
|
pPerfData[Idx].HandleCount = pSPI->HandleCount;
|
||||||
pPerfData[Idx].ThreadCount = pSPI->ThreadCount;
|
pPerfData[Idx].ThreadCount = pSPI->NumberOfThreads;
|
||||||
pPerfData[Idx].SessionId = pSPI->SessionId;
|
pPerfData[Idx].SessionId = pSPI->SessionId;
|
||||||
|
|
||||||
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pSPI->ProcessId);
|
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)) {
|
||||||
ImpersonateLoggedOnUser(hProcessToken);
|
ImpersonateLoggedOnUser(hProcessToken);
|
||||||
|
@ -306,19 +283,16 @@ int MultiByteToWideChar(
|
||||||
RevertToSelf();
|
RevertToSelf();
|
||||||
CloseHandle(hProcessToken);
|
CloseHandle(hProcessToken);
|
||||||
}
|
}
|
||||||
if (pGetGuiResources) {
|
pPerfData[Idx].USERObjectCount = GetGuiResources(hProcess, GR_USEROBJECTS);
|
||||||
pPerfData[Idx].USERObjectCount = pGetGuiResources(hProcess, GR_USEROBJECTS);
|
pPerfData[Idx].GDIObjectCount = GetGuiResources(hProcess, GR_GDIOBJECTS);
|
||||||
pPerfData[Idx].GDIObjectCount = pGetGuiResources(hProcess, GR_GDIOBJECTS);
|
GetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters);
|
||||||
}
|
|
||||||
if (pGetProcessIoCounters)
|
|
||||||
pGetProcessIoCounters(hProcess, &pPerfData[Idx].IOCounters);
|
|
||||||
CloseHandle(hProcess);
|
CloseHandle(hProcess);
|
||||||
}
|
}
|
||||||
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;
|
||||||
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->RelativeOffset);
|
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->NextEntryOffset);
|
||||||
}
|
}
|
||||||
free(pBuffer);
|
HeapFree(GetProcessHeap(), 0, pBuffer);
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +339,7 @@ ULONG PerfDataGetProcessId(ULONG Index)
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
if (Index < ProcessCount)
|
if (Index < ProcessCount)
|
||||||
ProcessId = pPerfData[Index].ProcessId;
|
ProcessId = (ULONG)pPerfData[Index].ProcessId;
|
||||||
else
|
else
|
||||||
ProcessId = 0;
|
ProcessId = 0;
|
||||||
|
|
||||||
|
@ -677,8 +651,8 @@ ULONG PerfDataGetCommitChargeTotalK(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Total = SystemPerfInfo.MmTotalCommitedPages;
|
Total = SystemPerfInfo.TotalCommittedPages;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -694,8 +668,8 @@ ULONG PerfDataGetCommitChargeLimitK(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Limit = SystemPerfInfo.MmTotalCommitLimit;
|
Limit = SystemPerfInfo.TotalCommitLimit;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -711,8 +685,8 @@ ULONG PerfDataGetCommitChargePeakK(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Peak = SystemPerfInfo.MmPeakLimit;
|
Peak = SystemPerfInfo.PeakCommitment;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -730,9 +704,9 @@ ULONG PerfDataGetKernelMemoryTotalK(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Paged = SystemPerfInfo.PoolPagedBytes;
|
Paged = SystemPerfInfo.PagedPoolUsage;
|
||||||
NonPaged = SystemPerfInfo.PoolNonPagedBytes;
|
NonPaged = SystemPerfInfo.NonPagedPoolUsage;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -751,8 +725,8 @@ ULONG PerfDataGetKernelMemoryPagedK(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Paged = SystemPerfInfo.PoolPagedBytes;
|
Paged = SystemPerfInfo.PagedPoolUsage;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -768,8 +742,8 @@ ULONG PerfDataGetKernelMemoryNonPagedK(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
NonPaged = SystemPerfInfo.PoolNonPagedBytes;
|
NonPaged = SystemPerfInfo.NonPagedPoolUsage;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -785,8 +759,8 @@ ULONG PerfDataGetPhysicalMemoryTotalK(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Total = SystemBasicInfo.uMmNumberOfPhysicalPages;
|
Total = SystemBasicInfo.NumberOfPhysicalPages;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -802,8 +776,8 @@ ULONG PerfDataGetPhysicalMemoryAvailableK(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
Available = SystemPerfInfo.MmAvailablePages;
|
Available = SystemPerfInfo.AvailablePages;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -820,7 +794,7 @@ ULONG PerfDataGetPhysicalMemorySystemCacheK(void)
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
SystemCache = SystemCacheInfo.CurrentSize;
|
SystemCache = SystemCacheInfo.CurrentSize;
|
||||||
PageSize = SystemBasicInfo.uPageSize;
|
PageSize = SystemBasicInfo.PhysicalPageSize;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
@ -836,7 +810,7 @@ ULONG PerfDataGetSystemHandleCount(void)
|
||||||
|
|
||||||
EnterCriticalSection(&PerfDataCriticalSection);
|
EnterCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
HandleCount = SystemHandleInfo.Count;
|
HandleCount = SystemHandleInfo.NumberOfHandles;
|
||||||
|
|
||||||
LeaveCriticalSection(&PerfDataCriticalSection);
|
LeaveCriticalSection(&PerfDataCriticalSection);
|
||||||
|
|
||||||
|
|
|
@ -27,27 +27,12 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + (double)((x).LowPart))
|
||||||
#if 0
|
|
||||||
typedef struct _TIME {
|
|
||||||
DWORD LowPart;
|
|
||||||
LONG HighPart;
|
|
||||||
} TIME, *PTIME;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef ULARGE_INTEGER TIME, *PTIME;
|
|
||||||
|
|
||||||
/* typedef WCHAR UNICODE_STRING; */
|
|
||||||
typedef struct _UNICODE_STRING {
|
|
||||||
USHORT Length;
|
|
||||||
USHORT MaximumLength;
|
|
||||||
PWSTR Buffer;
|
|
||||||
} UNICODE_STRING, *PUNICODE_STRING;
|
|
||||||
|
|
||||||
typedef struct _PERFDATA
|
typedef struct _PERFDATA
|
||||||
{
|
{
|
||||||
WCHAR ImageName[MAX_PATH];
|
WCHAR ImageName[MAX_PATH];
|
||||||
ULONG ProcessId;
|
HANDLE ProcessId;
|
||||||
WCHAR UserName[MAX_PATH];
|
WCHAR UserName[MAX_PATH];
|
||||||
ULONG SessionId;
|
ULONG SessionId;
|
||||||
ULONG CPUUsage;
|
ULONG CPUUsage;
|
||||||
|
@ -71,277 +56,6 @@ typedef struct _PERFDATA
|
||||||
TIME KernelTime;
|
TIME KernelTime;
|
||||||
} PERFDATA, *PPERFDATA;
|
} 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 MmTotalCommitedPages;
|
|
||||||
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
|
|
||||||
{
|
|
||||||
ULONG RelativeOffset;
|
|
||||||
ULONG CurrentSizePages;
|
|
||||||
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).HighPart) * 4.294967296E9 + (double)((x).LowPart))
|
|
||||||
|
|
||||||
#define BELOW_NORMAL_PRIORITY_CLASS 0x00004000
|
|
||||||
#define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
|
|
||||||
|
|
||||||
#define GR_GDIOBJECTS 0 /* Count of GDI objects */
|
|
||||||
#define GR_USEROBJECTS 1 /* Count of USER objects */
|
|
||||||
|
|
||||||
typedef LONG (WINAPI *PROCNTQSI)(UINT,PVOID,ULONG,PULONG);
|
|
||||||
typedef DWORD (WINAPI *PROCGGR)(HANDLE,DWORD);
|
|
||||||
typedef BOOL (WINAPI *PROCGPIC)(HANDLE,PIO_COUNTERS);
|
|
||||||
|
|
||||||
BOOL PerfDataInitialize(void);
|
BOOL PerfDataInitialize(void);
|
||||||
void PerfDataUninitialize(void);
|
void PerfDataUninitialize(void);
|
||||||
void PerfDataRefresh(void);
|
void PerfDataRefresh(void);
|
||||||
|
|
|
@ -21,19 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "perfpage.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
|
|
||||||
#include "graph.h"
|
|
||||||
#include "graphctl.h"
|
|
||||||
|
|
||||||
TGraphCtrl PerformancePageCpuUsageHistoryGraph;
|
TGraphCtrl PerformancePageCpuUsageHistoryGraph;
|
||||||
TGraphCtrl PerformancePageMemUsageHistoryGraph;
|
TGraphCtrl PerformancePageMemUsageHistoryGraph;
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
#define NTOS_MODE_USER
|
||||||
|
#include <ntos.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
#include <shellapi.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "taskmgr.h"
|
#include "taskmgr.h"
|
||||||
|
#include "perfdata.h"
|
||||||
|
#include "perfpage.h"
|
||||||
|
#include "about.h"
|
||||||
|
#include "procpage.h"
|
||||||
|
#include "proclist.h"
|
||||||
|
#include "affinity.h"
|
||||||
|
#include "applpage.h"
|
||||||
|
#include "column.h"
|
||||||
|
#include "dbgchnl.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "endproc.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "graph.h"
|
||||||
|
#include "graphctl.h"
|
||||||
|
#include "optnmenu.h"
|
||||||
|
#include "priority.h"
|
||||||
|
#include "run.h"
|
||||||
|
#include "trayicon.h"
|
||||||
|
|
|
@ -22,17 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "priority.h"
|
|
||||||
#include "procpage.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
|
|
||||||
TCHAR szTemp[256];
|
TCHAR szTemp[256];
|
||||||
TCHAR szTempA[256];
|
TCHAR szTempA[256];
|
||||||
|
|
|
@ -21,17 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "procpage.h"
|
|
||||||
#include "proclist.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
|
|
||||||
|
|
||||||
INT_PTR CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
INT_PTR CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
|
@ -21,21 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "procpage.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
#include "column.h"
|
|
||||||
#include "proclist.h"
|
|
||||||
#include "dbgchnl.h"
|
|
||||||
#include "endproc.h"
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
HWND hProcessPage; /* Process List Property Page */
|
HWND hProcessPage; /* Process List Property Page */
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Microsoft Developer Studio generated include file.
|
// Microsoft Developer Studio generated include file.
|
||||||
// Used by TaskMgr.rc
|
// Used by TaskMgr.rc
|
||||||
//
|
//
|
||||||
|
#define IDS_IDLE_PROCESS 102
|
||||||
#define IDD_TASKMGR_DIALOG 102
|
#define IDD_TASKMGR_DIALOG 102
|
||||||
#define IDD_ABOUTBOX 103
|
#define IDD_ABOUTBOX 103
|
||||||
#define IDS_APP_TITLE 103
|
#define IDS_APP_TITLE 103
|
||||||
|
|
|
@ -22,14 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "run.h"
|
|
||||||
|
|
||||||
void TaskManager_OnFileNew(void)
|
void TaskManager_OnFileNew(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,29 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "resource.h"
|
|
||||||
#include "applpage.h"
|
|
||||||
#include "procpage.h"
|
|
||||||
#include "perfpage.h"
|
|
||||||
#include "run.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
#include "optnmenu.h"
|
|
||||||
#include "affinity.h"
|
|
||||||
#include "priority.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "endproc.h"
|
|
||||||
#include "column.h"
|
|
||||||
#include "about.h"
|
|
||||||
#include "trayicon.h"
|
|
||||||
#include "dbgchnl.h"
|
|
||||||
|
|
||||||
#define STATUS_WINDOW 2001
|
#define STATUS_WINDOW 2001
|
||||||
|
|
||||||
|
|
|
@ -22,17 +22,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <commctrl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <memory.h>
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <winnt.h>
|
|
||||||
|
|
||||||
#include "trayicon.h"
|
|
||||||
#include "perfdata.h"
|
|
||||||
#include "shellapi.h"
|
|
||||||
|
|
||||||
HICON TrayIcon_GetProcessorUsageIcon(void)
|
HICON TrayIcon_GetProcessorUsageIcon(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue