ReactOS  0.4.15-dev-5452-g3c95c95
procpage.c File Reference
#include "precomp.h"
#include "proclist.h"
#include <strsafe.h>
#include <ndk/psfuncs.h>
Include dependency graph for procpage.c:

Go to the source code of this file.

Classes

struct  PROCESS_PAGE_LIST_ITEM
 

Macros

#define CMP(x1, x2)   (x1 < x2 ? -1 : (x1 > x2 ? 1 : 0))
 

Typedefs

typedef struct PROCESS_PAGE_LIST_ITEMLPPROCESS_PAGE_LIST_ITEM
 

Functions

int CALLBACK ProcessPageCompareFunc (LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
 
void AddProcess (ULONG Index)
 
void UpdateProcesses ()
 
void gethmsfromlargeint (LARGE_INTEGER largeint, DWORD *dwHours, DWORD *dwMinutes, DWORD *dwSeconds)
 
void ProcessPageOnNotify (WPARAM wParam, LPARAM lParam)
 
void ProcessPageShowContextMenu (DWORD dwProcessId)
 
BOOL PerfDataGetText (ULONG Index, ULONG ColumnIndex, LPTSTR lpText, ULONG nMaxCount)
 
DWORD WINAPI ProcessPageRefreshThread (void *lpParameter)
 
int ProcessRunning (ULONG ProcessId)
 
void Cleanup (void)
 
int ProcGetIndexByProcessId (DWORD dwProcessId)
 
DWORD GetSelectedProcessId (void)
 
void ProcessPageUpdate (void)
 
INT_PTR CALLBACK ProcessPageWndProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
UINT SH_FormatInteger (_In_ LONGLONG Num, _Out_writes_z_(cchResultMax) LPWSTR pwszResult, _In_ UINT cchResultMax)
 
void RefreshProcessPage (void)
 
int largeintcmp (LARGE_INTEGER l1, LARGE_INTEGER l2)
 
static DWORD DevicePathToDosPath (_In_ LPCWSTR lpDevicePath, _Out_writes_to_opt_(dwLength, return) LPWSTR lpDosPath, _In_opt_ DWORD dwLength)
 Maps an NT "\Device\..." path to its Win32 "DOS" equivalent. More...
 
static DWORD GetProcessExecutablePath (_In_ HANDLE hProcess, _Out_writes_to_opt_(dwLength, return) LPWSTR lpExePath, _In_opt_ DWORD dwLength)
 Retrieves the Win32 path of an executable image, by handle. More...
 
static DWORD GetProcessExecutablePathById (_In_ DWORD dwProcessId, _Out_writes_to_opt_(dwLength, return) LPWSTR lpExePath, _In_opt_ DWORD dwLength)
 Retrieves the Win32 path of an executable image, by identifier. More...
 
void ProcessPage_OnProperties (void)
 
void ProcessPage_OnOpenFileLocation (void)
 

Variables

HWND hProcessPage
 
HWND hProcessPageListCtrl
 
HWND hProcessPageHeaderCtrl
 
HWND hProcessPageEndProcessButton
 
HWND hProcessPageShowAllProcessesButton
 
BOOL bProcessPageSelectionMade = FALSE
 
static int nProcessPageWidth
 
static int nProcessPageHeight
 
static HANDLE hProcessThread = NULL
 
static DWORD dwProcessThread
 

Macro Definition Documentation

◆ CMP

#define CMP (   x1,
  x2 
)    (x1 < x2 ? -1 : (x1 > x2 ? 1 : 0))

Definition at line 33 of file procpage.c.

Typedef Documentation

◆ LPPROCESS_PAGE_LIST_ITEM

Function Documentation

◆ AddProcess()

void AddProcess ( ULONG  Index)

Definition at line 573 of file procpage.c.

574 {
576  int i;
577  LV_ITEM item;
578  BOOL bAlreadyInList = FALSE;
579  ULONG pid;
580 
582 
583  /* Check to see if it's already in our list */
585  {
586  memset(&item, 0, sizeof(LV_ITEM));
587  item.mask = LVIF_PARAM;
588  item.iItem = i;
591  if (pData->ProcessId == pid)
592  {
593  bAlreadyInList = TRUE;
594  break;
595  }
596  }
597  if (!bAlreadyInList) /* Add */
598  {
600  pData->ProcessId = pid;
601 
602  /* Add the item to the list */
603  memset(&item, 0, sizeof(LV_ITEM));
604  item.mask = LVIF_TEXT|LVIF_PARAM;
605  item.pszText = LPSTR_TEXTCALLBACK;
607  item.lParam = (LPARAM)pData;
609  }
610 }
#define LV_ITEM
Definition: commctrl.h:2337
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define TRUE
Definition: types.h:120
struct PROCESS_PAGE_LIST_ITEM * LPPROCESS_PAGE_LIST_ITEM
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define LVIF_TEXT
Definition: commctrl.h:2309
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_In_ WDFCOLLECTION _In_ ULONG Index
ULONG PerfDataGetProcessId(ULONG Index)
Definition: perfdata.c:506
static ATOM item
Definition: dde.c:856
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
unsigned int ULONG
Definition: retypes.h:1
#define LPSTR_TEXTCALLBACK
Definition: commctrl.h:2383
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39
HWND hProcessPageListCtrl
Definition: procpage.c:43

Referenced by UpdateProcesses().

◆ Cleanup()

void Cleanup ( void  )

Definition at line 66 of file procpage.c.

67 {
68  int i;
69  LV_ITEM item;
72  {
73  memset(&item, 0, sizeof(LV_ITEM));
74  item.mask = LVIF_PARAM;
75  item.iItem = i;
79  }
80 }
#define LV_ITEM
Definition: commctrl.h:2337
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
struct PROCESS_PAGE_LIST_ITEM * LPPROCESS_PAGE_LIST_ITEM
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define GetProcessHeap()
Definition: compat.h:736
static ATOM item
Definition: dde.c:856
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39
HWND hProcessPageListCtrl
Definition: procpage.c:43
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by GetProcessExecutablePath(), ProcessPage_OnOpenFileLocation(), ProcessPage_OnProperties(), and ProcessPageWndProc().

◆ DevicePathToDosPath()

static DWORD DevicePathToDosPath ( _In_ LPCWSTR  lpDevicePath,
_Out_writes_to_opt_(dwLength, return) LPWSTR  lpDosPath,
_In_opt_ DWORD  dwLength 
)
static

Maps an NT "\Device\..." path to its Win32 "DOS" equivalent.

Parameters
[in]lpDevicePathThe NT device path to convert.
[out]lpDosPathReceives the converted Win32 path.
[in]dwLengthSize of the lpDosPath buffer in characters.
Returns
The number of characters required (if lpDosPath == NULL or dwLength == 0), or actually written in the lpDosPath buffer, including the NULL terminator. Returns 0 in case of failure.

Definition at line 1003 of file procpage.c.

1008 {
1009  DWORD dwRet = 0;
1010  WCHAR szDrive[3] = L"?:";
1012 
1013  /* Check if lpDevicePath is a device path */
1014  if (_wcsnicmp(lpDevicePath, L"\\Device\\", _countof(L"\\Device\\")-1) != 0)
1015  {
1016  return 0;
1017  }
1018 
1019  for (szDrive[0] = L'A'; szDrive[0] <= L'`'; szDrive[0]++)
1020  {
1021  if (QueryDosDeviceW(szDrive, szDeviceName, _countof(szDeviceName)) != 0)
1022  {
1023  size_t len = wcslen(szDeviceName);
1024 
1025  if (_wcsnicmp(lpDevicePath, szDeviceName, len) == 0)
1026  {
1027  /* Get the required length, including the NULL terminator */
1028  dwRet = _countof(szDrive) + wcslen(lpDevicePath + len);
1029 
1030  if (lpDosPath && (dwLength >= dwRet))
1031  {
1032  StringCchPrintfW(lpDosPath, dwLength, L"%s%s",
1033  szDrive, lpDevicePath + len);
1034  }
1035 
1036  break;
1037  }
1038  }
1039  }
1040 
1041  return dwRet;
1042 }
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define L(x)
Definition: ntvdm.h:50
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR szDeviceName[]
Definition: provider.c:56
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by GetProcessExecutablePath().

◆ gethmsfromlargeint()

void gethmsfromlargeint ( LARGE_INTEGER  largeint,
DWORD dwHours,
DWORD dwMinutes,
DWORD dwSeconds 
)

Definition at line 748 of file procpage.c.

749 {
750 #ifdef _MSC_VER
751  *dwHours = (DWORD)(largeint.QuadPart / 36000000000L);
752  *dwMinutes = (DWORD)((largeint.QuadPart % 36000000000L) / 600000000L);
753  *dwSeconds = (DWORD)(((largeint.QuadPart % 36000000000L) % 600000000L) / 10000000L);
754 #else
755  *dwHours = (DWORD)(largeint.QuadPart / 36000000000LL);
756  *dwMinutes = (DWORD)((largeint.QuadPart % 36000000000LL) / 600000000LL);
757  *dwSeconds = (DWORD)(((largeint.QuadPart % 36000000000LL) % 600000000LL) / 10000000LL);
758 #endif
759 }
#define LL
Definition: tui.h:150
#define DWORD
Definition: nt_native.h:44
#define L(x)
Definition: ntvdm.h:50
LONGLONG QuadPart
Definition: typedefs.h:114

Referenced by largeintcmp(), and PerfDataGetText().

◆ GetProcessExecutablePath()

static DWORD GetProcessExecutablePath ( _In_ HANDLE  hProcess,
_Out_writes_to_opt_(dwLength, return) LPWSTR  lpExePath,
_In_opt_ DWORD  dwLength 
)
static

Retrieves the Win32 path of an executable image, by handle.

Parameters
[in]hProcessHandle to the executable image; it should be opened with PROCESS_QUERY_INFORMATION access rights.
[out]lpExePathReceives the Win32 image path.
[in]dwLengthSize of the lpExePath buffer in characters.
Returns
The number of characters required (if lpExePath == NULL or dwLength == 0), or actually written in the lpExePath buffer, including the NULL terminator. Returns 0 in case of failure.

Definition at line 1064 of file procpage.c.

1069 {
1070  DWORD dwRet = 0;
1071  NTSTATUS Status;
1072  BYTE StaticBuffer[sizeof(UNICODE_STRING) + (MAX_PATH * sizeof(WCHAR))];
1074  PUNICODE_STRING ExePath;
1075  ULONG SizeNeeded;
1076 
1079  StaticBuffer,
1080  /* Reserve a NULL terminator */
1081  sizeof(StaticBuffer) - sizeof(WCHAR),
1082  &SizeNeeded);
1083  if (NT_SUCCESS(Status))
1084  {
1085  ExePath = (PUNICODE_STRING)StaticBuffer;
1086  }
1087  else if (Status == STATUS_INFO_LENGTH_MISMATCH)
1088  {
1089  /* Allocate the buffer, reserving space for a NULL terminator */
1090  DynamicBuffer = HeapAlloc(GetProcessHeap(), 0, SizeNeeded + sizeof(WCHAR));
1091  if (!DynamicBuffer)
1092  return 0;
1093 
1096  DynamicBuffer,
1097  SizeNeeded,
1098  &SizeNeeded);
1099  if (!NT_SUCCESS(Status))
1100  goto Cleanup;
1101 
1102  ExePath = DynamicBuffer;
1103  }
1104  else
1105  {
1106  return 0;
1107  }
1108 
1109  /* Manually NULL-terminate */
1110  ExePath->Buffer[ExePath->Length / sizeof(WCHAR)] = UNICODE_NULL;
1111 
1112  /* HACK: Convert device path format into Win32 path format.
1113  * Use ProcessImageFileNameWin32 instead if the kernel supports it. */
1114  dwRet = DevicePathToDosPath(ExePath->Buffer, lpExePath, dwLength);
1115 
1116 Cleanup:
1118 
1119  return dwRet;
1120 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONG NTSTATUS
Definition: precomp.h:26
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static DWORD DevicePathToDosPath(_In_ LPCWSTR lpDevicePath, _Out_writes_to_opt_(dwLength, return) LPWSTR lpDosPath, _In_opt_ DWORD dwLength)
Maps an NT "\Device\..." path to its Win32 "DOS" equivalent.
Definition: procpage.c:1003
void Cleanup(void)
Definition: procpage.c:66
#define UNICODE_NULL
Status
Definition: gdiplustypes.h:24
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: xxhash.c:193
#define NULL
Definition: types.h:112
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
struct _UNICODE_STRING UNICODE_STRING
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:735
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:59

Referenced by GetProcessExecutablePathById().

◆ GetProcessExecutablePathById()

static DWORD GetProcessExecutablePathById ( _In_ DWORD  dwProcessId,
_Out_writes_to_opt_(dwLength, return) LPWSTR  lpExePath,
_In_opt_ DWORD  dwLength 
)
static

Retrieves the Win32 path of an executable image, by identifier.

Parameters
[in]dwProcessIdIdentifier of the running executable image.
[out]lpExePathReceives the Win32 image path.
[in]dwLengthSize of the lpExePath buffer in characters.
Returns
The number of characters required (if lpExePath == NULL or dwLength == 0), or actually written in the lpExePath buffer, including the NULL terminator. Returns 0 in case of failure.

Definition at line 1141 of file procpage.c.

1146 {
1147  DWORD dwRet = 0;
1148 
1149  if (dwProcessId == 0)
1150  return 0;
1151 
1152  /* PID = 4 ("System") */
1153  if (dwProcessId == 4)
1154  {
1155  static const WCHAR szKernelExe[] = L"\\ntoskrnl.exe";
1156  LPWSTR pszSystemDir;
1157  UINT uLength;
1158 
1159  uLength = GetSystemDirectoryW(NULL, 0);
1160  if (uLength == 0)
1161  return 0;
1162 
1163  pszSystemDir = HeapAlloc(GetProcessHeap(), 0, uLength * sizeof(WCHAR));
1164  if (!pszSystemDir)
1165  return 0;
1166 
1167  if (GetSystemDirectoryW(pszSystemDir, uLength) != 0)
1168  {
1169  /* Get the required length, including the NULL terminator */
1170  dwRet = uLength + _countof(szKernelExe) - 1;
1171 
1172  if (lpExePath && (dwLength >= dwRet))
1173  {
1174  StringCchPrintfW(lpExePath, dwLength, L"%s%s",
1175  pszSystemDir, szKernelExe);
1176  }
1177  }
1178 
1179  HeapFree(GetProcessHeap(), 0, pszSystemDir);
1180  }
1181  else
1182  {
1183  HANDLE hProcess;
1184 
1186  if (hProcess)
1187  {
1188  dwRet = GetProcessExecutablePath(hProcess, lpExePath, dwLength);
1190  }
1191  }
1192 
1193  return dwRet;
1194 }
#define CloseHandle
Definition: compat.h:739
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:166
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define _countof(array)
Definition: sndvol32.h:68
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD GetProcessExecutablePath(_In_ HANDLE hProcess, _Out_writes_to_opt_(dwLength, return) LPWSTR lpExePath, _In_opt_ DWORD dwLength)
Retrieves the Win32 path of an executable image, by handle.
Definition: procpage.c:1064
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by ProcessPage_OnOpenFileLocation(), and ProcessPage_OnProperties().

◆ GetSelectedProcessId()

DWORD GetSelectedProcessId ( void  )

Definition at line 103 of file procpage.c.

104 {
105  int Index;
106  LVITEM lvitem;
107 
109  {
111 
112  memset(&lvitem, 0, sizeof(LVITEM));
113 
114  lvitem.mask = LVIF_PARAM;
115  lvitem.iItem = Index;
116 
118 
119  if (lvitem.lParam)
120  return ((LPPROCESS_PAGE_LIST_ITEM)lvitem.lParam)->ProcessId;
121  }
122 
123  return 0;
124 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
_In_ WDFCOLLECTION _In_ ULONG Index
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVITEM
Definition: commctrl.h:2375
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2789
#define memset(x, y, z)
Definition: compat.h:39
HWND hProcessPageListCtrl
Definition: procpage.c:43

Referenced by DoSetPriority(), ProcessPage_OnDebug(), ProcessPage_OnEndProcess(), ProcessPage_OnEndProcessTree(), ProcessPage_OnOpenFileLocation(), ProcessPage_OnProperties(), ProcessPage_OnSetAffinity(), and ProcessPageOnNotify().

◆ largeintcmp()

int largeintcmp ( LARGE_INTEGER  l1,
LARGE_INTEGER  l2 
)

Definition at line 761 of file procpage.c.

762 {
763  int ret = 0;
764  DWORD dwHours1;
765  DWORD dwMinutes1;
766  DWORD dwSeconds1;
767  DWORD dwHours2;
768  DWORD dwMinutes2;
769  DWORD dwSeconds2;
770 
771  gethmsfromlargeint(l1, &dwHours1, &dwMinutes1, &dwSeconds1);
772  gethmsfromlargeint(l2, &dwHours2, &dwMinutes2, &dwSeconds2);
773  ret = CMP(dwHours1, dwHours2);
774  if (ret == 0)
775  {
776  ret = CMP(dwMinutes1, dwMinutes2);
777  if (ret == 0)
778  {
779  ret = CMP(dwSeconds1, dwSeconds2);
780  }
781  }
782  return ret;
783 }
#define CMP(x1, x2)
Definition: procpage.c:33
unsigned long DWORD
Definition: ntddk_ex.h:95
void gethmsfromlargeint(LARGE_INTEGER largeint, DWORD *dwHours, DWORD *dwMinutes, DWORD *dwSeconds)
Definition: procpage.c:748
int ret

Referenced by ProcessPageCompareFunc().

◆ PerfDataGetText()

BOOL PerfDataGetText ( ULONG  Index,
ULONG  ColumnIndex,
LPTSTR  lpText,
ULONG  nMaxCount 
)

Definition at line 612 of file procpage.c.

613 {
614  IO_COUNTERS iocounters;
615 
616  switch (ColumnDataHints[ColumnIndex])
617  {
618  case COLUMN_IMAGENAME:
620  return TRUE;
621 
622  case COLUMN_PID:
624  return TRUE;
625 
626  case COLUMN_USERNAME:
628  return TRUE;
629 
630  case COLUMN_COMMANDLINE:
632  return TRUE;
633 
634  case COLUMN_SESSIONID:
636  return TRUE;
637 
638  case COLUMN_CPUUSAGE:
640  return TRUE;
641 
642  case COLUMN_CPUTIME:
643  {
645  DWORD dwHours;
646  DWORD dwMinutes;
647  DWORD dwSeconds;
648 
650  gethmsfromlargeint(time, &dwHours, &dwMinutes, &dwSeconds);
651  StringCchPrintfW(lpText, nMaxCount, L"%lu:%02lu:%02lu", dwHours, dwMinutes, dwSeconds);
652  return TRUE;
653  }
654 
655  case COLUMN_MEMORYUSAGE:
657  StringCchCatW(lpText, nMaxCount, L" K");
658  return TRUE;
659 
662  StringCchCatW(lpText, nMaxCount, L" K");
663  return TRUE;
664 
667  StringCchCatW(lpText, nMaxCount, L" K");
668  return TRUE;
669 
670  case COLUMN_PAGEFAULTS:
672  return TRUE;
673 
676  return TRUE;
677 
680  StringCchCatW(lpText, nMaxCount, L" K");
681  return TRUE;
682 
683  case COLUMN_PAGEDPOOL:
685  StringCchCatW(lpText, nMaxCount, L" K");
686  return TRUE;
687 
688  case COLUMN_NONPAGEDPOOL:
690  StringCchCatW(lpText, nMaxCount, L" K");
691  return TRUE;
692 
693  case COLUMN_BASEPRIORITY:
695  return TRUE;
696 
697  case COLUMN_HANDLECOUNT:
699  return TRUE;
700 
701  case COLUMN_THREADCOUNT:
703  return TRUE;
704 
705  case COLUMN_USEROBJECTS:
707  return TRUE;
708 
709  case COLUMN_GDIOBJECTS:
711  return TRUE;
712 
713  case COLUMN_IOREADS:
714  PerfDataGetIOCounters(Index, &iocounters);
715  SH_FormatInteger(iocounters.ReadOperationCount, lpText, nMaxCount);
716  return TRUE;
717 
718  case COLUMN_IOWRITES:
719  PerfDataGetIOCounters(Index, &iocounters);
720  SH_FormatInteger(iocounters.WriteOperationCount, lpText, nMaxCount);
721  return TRUE;
722 
723  case COLUMN_IOOTHER:
724  PerfDataGetIOCounters(Index, &iocounters);
725  SH_FormatInteger(iocounters.OtherOperationCount, lpText, nMaxCount);
726  return TRUE;
727 
728  case COLUMN_IOREADBYTES:
729  PerfDataGetIOCounters(Index, &iocounters);
730  SH_FormatInteger(iocounters.ReadTransferCount, lpText, nMaxCount);
731  return TRUE;
732 
733  case COLUMN_IOWRITEBYTES:
734  PerfDataGetIOCounters(Index, &iocounters);
735  SH_FormatInteger(iocounters.WriteTransferCount, lpText, nMaxCount);
736  return TRUE;
737 
738  case COLUMN_IOOTHERBYTES:
739  PerfDataGetIOCounters(Index, &iocounters);
740  SH_FormatInteger(iocounters.OtherTransferCount, lpText, nMaxCount);
741  return TRUE;
742  }
743 
744  return FALSE;
745 }
#define COLUMN_NONPAGEDPOOL
Definition: column.h:38
ULONG PerfDataGetBasePriority(ULONG Index)
Definition: perfdata.c:838
ULONGLONG OtherOperationCount
Definition: pstypes.h:85
#define COLUMN_GDIOBJECTS
Definition: column.h:43
#define COLUMN_PAGEFAULTSDELTA
Definition: column.h:35
#define COLUMN_PAGEFAULTS
Definition: column.h:34
#define TRUE
Definition: types.h:120
#define COLUMN_COMMANDLINE
Definition: column.h:50
ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index)
Definition: perfdata.c:710
#define COLUMN_PID
Definition: column.h:26
ULONG PerfDataGetCPUUsage(ULONG Index)
Definition: perfdata.c:680
ULONGLONG WriteOperationCount
Definition: pstypes.h:84
ULONG PerfDataGetPageFaultCount(ULONG Index)
Definition: perfdata.c:758
#define COLUMN_CPUTIME
Definition: column.h:30
#define COLUMN_IOOTHERBYTES
Definition: column.h:49
ULONG PerfDataGetPageFaultCountDelta(ULONG Index)
Definition: perfdata.c:774
__u16 time
Definition: mkdosfs.c:366
#define COLUMN_USEROBJECTS
Definition: column.h:42
ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index)
Definition: perfdata.c:822
ULONG PerfDataGetGDIObjectCount(ULONG Index)
Definition: perfdata.c:902
#define COLUMN_SESSIONID
Definition: column.h:28
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
#define COLUMN_CPUUSAGE
Definition: column.h:29
ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index)
Definition: perfdata.c:790
#define L(x)
Definition: ntvdm.h:50
#define COLUMN_THREADCOUNT
Definition: column.h:41
#define FALSE
Definition: types.h:117
BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount)
Definition: perfdata.c:490
UINT SH_FormatInteger(_In_ LONGLONG Num, _Out_writes_z_(cchResultMax) LPWSTR pwszResult, _In_ UINT cchResultMax)
Definition: procpage.c:330
ULONGLONG WriteTransferCount
Definition: pstypes.h:87
BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters)
Definition: perfdata.c:918
ULONG PerfDataGetThreadCount(ULONG Index)
Definition: perfdata.c:870
#define COLUMN_PAGEDPOOL
Definition: column.h:37
#define COLUMN_IMAGENAME
Definition: column.h:25
_In_ WDFCOLLECTION _In_ ULONG Index
ULONG PerfDataGetProcessId(ULONG Index)
Definition: perfdata.c:506
#define COLUMN_HANDLECOUNT
Definition: column.h:40
UINT ColumnDataHints[COLUMN_NMAX]
Definition: column.c:26
unsigned long DWORD
Definition: ntddk_ex.h:95
void gethmsfromlargeint(LARGE_INTEGER largeint, DWORD *dwHours, DWORD *dwMinutes, DWORD *dwSeconds)
Definition: procpage.c:748
ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index)
Definition: perfdata.c:726
LARGE_INTEGER PerfDataGetCPUTime(ULONG Index)
Definition: perfdata.c:696
ULONGLONG ReadTransferCount
Definition: pstypes.h:86
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index)
Definition: perfdata.c:742
ULONG PerfDataGetSessionId(ULONG Index)
Definition: perfdata.c:664
#define COLUMN_IOWRITEBYTES
Definition: column.h:48
ULONG PerfDataGetHandleCount(ULONG Index)
Definition: perfdata.c:854
BOOL PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, ULONG nMaxCount)
Definition: perfdata.c:522
#define COLUMN_IOWRITES
Definition: column.h:45
#define COLUMN_IOREADS
Definition: column.h:44
#define COLUMN_USERNAME
Definition: column.h:27
ULONGLONG OtherTransferCount
Definition: pstypes.h:88
#define COLUMN_IOOTHER
Definition: column.h:46
#define COLUMN_BASEPRIORITY
Definition: column.h:39
ULONG PerfDataGetUSERObjectCount(ULONG Index)
Definition: perfdata.c:886
_In_ int nMaxCount
Definition: winuser.h:4867
ULONG PerfDataGetPagedPoolUsagePages(ULONG Index)
Definition: perfdata.c:806
#define COLUMN_IOREADBYTES
Definition: column.h:47
#define COLUMN_MEMORYUSAGE
Definition: column.h:31
#define COLUMN_VIRTUALMEMORYSIZE
Definition: column.h:36
#define COLUMN_PEAKMEMORYUSAGE
Definition: column.h:32
ULONGLONG ReadOperationCount
Definition: pstypes.h:83
#define COLUMN_MEMORYUSAGEDELTA
Definition: column.h:33
BOOL PerfDataGetCommandLine(ULONG Index, LPWSTR lpCommandLine, ULONG nMaxCount)
Definition: perfdata.c:540

Referenced by ProcessPageOnNotify().

◆ ProcessPage_OnOpenFileLocation()

void ProcessPage_OnOpenFileLocation ( void  )

Definition at line 1235 of file procpage.c.

1236 {
1237  DWORD dwProcessId;
1238  DWORD dwLength;
1239  LPWSTR pszExePath;
1240  LPWSTR pszCmdLine = NULL;
1241 
1242  dwProcessId = GetSelectedProcessId();
1243 
1244  /* Retrieve the image path length */
1245  dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0);
1246  if (dwLength == 0)
1247  return;
1248 
1249  /* Allocate and retrieve the image path */
1250  pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1251  if (!pszExePath)
1252  return;
1253 
1254  if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0)
1255  goto Cleanup;
1256 
1257  /* Build the shell command line */
1258  pszCmdLine = HeapAlloc(GetProcessHeap(), 0, (dwLength + 10) * sizeof(WCHAR));
1259  if (!pszCmdLine)
1260  goto Cleanup;
1261 
1262  StringCchPrintfW(pszCmdLine, dwLength + 10, L"/select,\"%s\"", pszExePath);
1263 
1264  /* Call the shell to open the file location and select it */
1265  ShellExecuteW(NULL, L"open", L"explorer.exe", pszCmdLine, NULL, SW_SHOWNORMAL);
1266 
1267 Cleanup:
1268  HeapFree(GetProcessHeap(), 0, pszCmdLine);
1269  HeapFree(GetProcessHeap(), 0, pszExePath);
1270 }
static DWORD GetProcessExecutablePathById(_In_ DWORD dwProcessId, _Out_writes_to_opt_(dwLength, return) LPWSTR lpExePath, _In_opt_ DWORD dwLength)
Retrieves the Win32 path of an executable image, by identifier.
Definition: procpage.c:1141
DWORD GetSelectedProcessId(void)
Definition: procpage.c:103
void Cleanup(void)
Definition: procpage.c:66
#define L(x)
Definition: ntvdm.h:50
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SW_SHOWNORMAL
Definition: winuser.h:764
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define NULL
Definition: types.h:112
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2346
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by TaskManagerWndProc().

◆ ProcessPage_OnProperties()

void ProcessPage_OnProperties ( void  )

Definition at line 1196 of file procpage.c.

1197 {
1198  DWORD dwProcessId;
1199  DWORD dwLength;
1200  LPWSTR pszExePath;
1201  SHELLEXECUTEINFOW info = { 0 };
1202 
1203  dwProcessId = GetSelectedProcessId();
1204 
1205  /* Retrieve the image path length */
1206  dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0);
1207  if (dwLength == 0)
1208  return;
1209 
1210  /* Allocate and retrieve the image path */
1211  pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1212  if (!pszExePath)
1213  return;
1214 
1215  if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0)
1216  goto Cleanup;
1217 
1218  /* Call the shell to display the file properties */
1219  info.cbSize = sizeof(SHELLEXECUTEINFOW);
1220  info.fMask = SEE_MASK_INVOKEIDLIST;
1221  info.hwnd = NULL;
1222  info.lpVerb = L"properties";
1223  info.lpFile = pszExePath;
1224  info.lpParameters = L"";
1225  info.lpDirectory = NULL;
1226  info.nShow = SW_SHOW;
1227  info.hInstApp = NULL;
1228 
1230 
1231 Cleanup:
1232  HeapFree(GetProcessHeap(), 0, pszExePath);
1233 }
static DWORD GetProcessExecutablePathById(_In_ DWORD dwProcessId, _Out_writes_to_opt_(dwLength, return) LPWSTR lpExePath, _In_opt_ DWORD dwLength)
Retrieves the Win32 path of an executable image, by identifier.
Definition: procpage.c:1141
DWORD GetSelectedProcessId(void)
Definition: procpage.c:103
void Cleanup(void)
Definition: procpage.c:66
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2335
#define SW_SHOW
Definition: winuser.h:769
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
struct _SHELLEXECUTEINFOW SHELLEXECUTEINFOW
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by TaskManagerWndProc().

◆ ProcessPageCompareFunc()

int CALLBACK ProcessPageCompareFunc ( LPARAM  lParam1,
LPARAM  lParam2,
LPARAM  lParamSort 
)

Definition at line 785 of file procpage.c.

786 {
787  int ret = 0;
790  ULONG IndexParam1;
791  ULONG IndexParam2;
792  WCHAR text1[260];
793  WCHAR text2[260];
794  ULONG l1;
795  ULONG l2;
796  LARGE_INTEGER time1;
797  LARGE_INTEGER time2;
798  IO_COUNTERS iocounters1;
799  IO_COUNTERS iocounters2;
800  ULONGLONG ull1;
801  ULONGLONG ull2;
802 
804  Param1 = (LPPROCESS_PAGE_LIST_ITEM)lParam1;
805  Param2 = (LPPROCESS_PAGE_LIST_ITEM)lParam2;
806  } else {
807  Param1 = (LPPROCESS_PAGE_LIST_ITEM)lParam2;
808  Param2 = (LPPROCESS_PAGE_LIST_ITEM)lParam1;
809  }
810  IndexParam1 = PerfDataGetProcessIndex(Param1->ProcessId);
811  IndexParam2 = PerfDataGetProcessIndex(Param2->ProcessId);
812 
814  {
815  PerfDataGetImageName(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
816  PerfDataGetImageName(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
817  ret = _wcsicmp(text1, text2);
818  }
820  {
821  l1 = Param1->ProcessId;
822  l2 = Param2->ProcessId;
823  ret = CMP(l1, l2);
824  }
826  {
827  PerfDataGetUserName(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
828  PerfDataGetUserName(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
829  ret = _wcsicmp(text1, text2);
830  }
832  {
833  PerfDataGetCommandLine(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
834  PerfDataGetCommandLine(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
835  ret = _wcsicmp(text1, text2);
836  }
838  {
839  l1 = PerfDataGetSessionId(IndexParam1);
840  l2 = PerfDataGetSessionId(IndexParam2);
841  ret = CMP(l1, l2);
842  }
844  {
845  l1 = PerfDataGetCPUUsage(IndexParam1);
846  l2 = PerfDataGetCPUUsage(IndexParam2);
847  ret = CMP(l1, l2);
848  }
850  {
851  time1 = PerfDataGetCPUTime(IndexParam1);
852  time2 = PerfDataGetCPUTime(IndexParam2);
853  ret = largeintcmp(time1, time2);
854  }
856  {
857  l1 = PerfDataGetWorkingSetSizeBytes(IndexParam1);
858  l2 = PerfDataGetWorkingSetSizeBytes(IndexParam2);
859  ret = CMP(l1, l2);
860  }
862  {
863  l1 = PerfDataGetPeakWorkingSetSizeBytes(IndexParam1);
864  l2 = PerfDataGetPeakWorkingSetSizeBytes(IndexParam2);
865  ret = CMP(l1, l2);
866  }
868  {
869  l1 = PerfDataGetWorkingSetSizeDelta(IndexParam1);
870  l2 = PerfDataGetWorkingSetSizeDelta(IndexParam2);
871  ret = CMP(l1, l2);
872  }
874  {
875  l1 = PerfDataGetPageFaultCount(IndexParam1);
876  l2 = PerfDataGetPageFaultCount(IndexParam2);
877  ret = CMP(l1, l2);
878  }
880  {
881  l1 = PerfDataGetPageFaultCountDelta(IndexParam1);
882  l2 = PerfDataGetPageFaultCountDelta(IndexParam2);
883  ret = CMP(l1, l2);
884  }
886  {
887  l1 = PerfDataGetVirtualMemorySizeBytes(IndexParam1);
888  l2 = PerfDataGetVirtualMemorySizeBytes(IndexParam2);
889  ret = CMP(l1, l2);
890  }
892  {
893  l1 = PerfDataGetPagedPoolUsagePages(IndexParam1);
894  l2 = PerfDataGetPagedPoolUsagePages(IndexParam2);
895  ret = CMP(l1, l2);
896  }
898  {
899  l1 = PerfDataGetNonPagedPoolUsagePages(IndexParam1);
900  l2 = PerfDataGetNonPagedPoolUsagePages(IndexParam2);
901  ret = CMP(l1, l2);
902  }
904  {
905  l1 = PerfDataGetBasePriority(IndexParam1);
906  l2 = PerfDataGetBasePriority(IndexParam2);
907  ret = CMP(l1, l2);
908  }
910  {
911  l1 = PerfDataGetHandleCount(IndexParam1);
912  l2 = PerfDataGetHandleCount(IndexParam2);
913  ret = CMP(l1, l2);
914  }
916  {
917  l1 = PerfDataGetThreadCount(IndexParam1);
918  l2 = PerfDataGetThreadCount(IndexParam2);
919  ret = CMP(l1, l2);
920  }
922  {
923  l1 = PerfDataGetUSERObjectCount(IndexParam1);
924  l2 = PerfDataGetUSERObjectCount(IndexParam2);
925  ret = CMP(l1, l2);
926  }
928  {
929  l1 = PerfDataGetGDIObjectCount(IndexParam1);
930  l2 = PerfDataGetGDIObjectCount(IndexParam2);
931  ret = CMP(l1, l2);
932  }
934  {
935  PerfDataGetIOCounters(IndexParam1, &iocounters1);
936  PerfDataGetIOCounters(IndexParam2, &iocounters2);
937  ull1 = iocounters1.ReadOperationCount;
938  ull2 = iocounters2.ReadOperationCount;
939  ret = CMP(ull1, ull2);
940  }
942  {
943  PerfDataGetIOCounters(IndexParam1, &iocounters1);
944  PerfDataGetIOCounters(IndexParam2, &iocounters2);
945  ull1 = iocounters1.WriteOperationCount;
946  ull2 = iocounters2.WriteOperationCount;
947  ret = CMP(ull1, ull2);
948  }
950  {
951  PerfDataGetIOCounters(IndexParam1, &iocounters1);
952  PerfDataGetIOCounters(IndexParam2, &iocounters2);
953  ull1 = iocounters1.OtherOperationCount;
954  ull2 = iocounters2.OtherOperationCount;
955  ret = CMP(ull1, ull2);
956  }
958  {
959  PerfDataGetIOCounters(IndexParam1, &iocounters1);
960  PerfDataGetIOCounters(IndexParam2, &iocounters2);
961  ull1 = iocounters1.ReadTransferCount;
962  ull2 = iocounters2.ReadTransferCount;
963  ret = CMP(ull1, ull2);
964  }
966  {
967  PerfDataGetIOCounters(IndexParam1, &iocounters1);
968  PerfDataGetIOCounters(IndexParam2, &iocounters2);
969  ull1 = iocounters1.WriteTransferCount;
970  ull2 = iocounters2.WriteTransferCount;
971  ret = CMP(ull1, ull2);
972  }
974  {
975  PerfDataGetIOCounters(IndexParam1, &iocounters1);
976  PerfDataGetIOCounters(IndexParam2, &iocounters2);
977  ull1 = iocounters1.OtherTransferCount;
978  ull2 = iocounters2.OtherTransferCount;
979  ret = CMP(ull1, ull2);
980  }
981  return ret;
982 }
#define COLUMN_NONPAGEDPOOL
Definition: column.h:38
ULONG PerfDataGetBasePriority(ULONG Index)
Definition: perfdata.c:838
ULONGLONG OtherOperationCount
Definition: pstypes.h:85
#define COLUMN_GDIOBJECTS
Definition: column.h:43
#define COLUMN_PAGEFAULTSDELTA
Definition: column.h:35
#define COLUMN_PAGEFAULTS
Definition: column.h:34
#define CMP(x1, x2)
Definition: procpage.c:33
#define COLUMN_COMMANDLINE
Definition: column.h:50
ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index)
Definition: perfdata.c:710
#define COLUMN_PID
Definition: column.h:26
ULONG PerfDataGetCPUUsage(ULONG Index)
Definition: perfdata.c:680
struct PROCESS_PAGE_LIST_ITEM * LPPROCESS_PAGE_LIST_ITEM
ULONGLONG WriteOperationCount
Definition: pstypes.h:84
ULONG PerfDataGetPageFaultCount(ULONG Index)
Definition: perfdata.c:758
#define COLUMN_CPUTIME
Definition: column.h:30
ULONG PerfDataGetProcessIndex(ULONG pid)
Definition: perfdata.c:440
#define COLUMN_IOOTHERBYTES
Definition: column.h:49
ULONG PerfDataGetPageFaultCountDelta(ULONG Index)
Definition: perfdata.c:774
#define COLUMN_USEROBJECTS
Definition: column.h:42
ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index)
Definition: perfdata.c:822
ULONG PerfDataGetGDIObjectCount(ULONG Index)
Definition: perfdata.c:902
#define COLUMN_SESSIONID
Definition: column.h:28
#define COLUMN_CPUUSAGE
Definition: column.h:29
int largeintcmp(LARGE_INTEGER l1, LARGE_INTEGER l2)
Definition: procpage.c:761
ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index)
Definition: perfdata.c:790
#define COLUMN_THREADCOUNT
Definition: column.h:41
BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount)
Definition: perfdata.c:490
ULONGLONG WriteTransferCount
Definition: pstypes.h:87
BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters)
Definition: perfdata.c:918
ULONG PerfDataGetThreadCount(ULONG Index)
Definition: perfdata.c:870
#define COLUMN_PAGEDPOOL
Definition: column.h:37
#define COLUMN_IMAGENAME
Definition: column.h:25
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:67
#define COLUMN_HANDLECOUNT
Definition: column.h:40
ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index)
Definition: perfdata.c:726
int ret
LARGE_INTEGER PerfDataGetCPUTime(ULONG Index)
Definition: perfdata.c:696
ULONGLONG ReadTransferCount
Definition: pstypes.h:86
ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index)
Definition: perfdata.c:742
ULONG PerfDataGetSessionId(ULONG Index)
Definition: perfdata.c:664
#define COLUMN_IOWRITEBYTES
Definition: column.h:48
ULONG PerfDataGetHandleCount(ULONG Index)
Definition: perfdata.c:854
BOOL PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, ULONG nMaxCount)
Definition: perfdata.c:522
unsigned int ULONG
Definition: retypes.h:1
#define COLUMN_IOWRITES
Definition: column.h:45
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
#define COLUMN_IOREADS
Definition: column.h:44
#define COLUMN_USERNAME
Definition: column.h:27
ULONGLONG OtherTransferCount
Definition: pstypes.h:88
#define COLUMN_IOOTHER
Definition: column.h:46
#define COLUMN_BASEPRIORITY
Definition: column.h:39
ULONG PerfDataGetUSERObjectCount(ULONG Index)
Definition: perfdata.c:886
ULONG PerfDataGetPagedPoolUsagePages(ULONG Index)
Definition: perfdata.c:806
#define COLUMN_IOREADBYTES
Definition: column.h:47
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define COLUMN_MEMORYUSAGE
Definition: column.h:31
#define COLUMN_VIRTUALMEMORYSIZE
Definition: column.h:36
#define COLUMN_PEAKMEMORYUSAGE
Definition: column.h:32
ULONGLONG ReadOperationCount
Definition: pstypes.h:83
#define COLUMN_MEMORYUSAGEDELTA
Definition: column.h:33
BOOL PerfDataGetCommandLine(ULONG Index, LPWSTR lpCommandLine, ULONG nMaxCount)
Definition: perfdata.c:540

Referenced by ProcessPageOnNotify(), and UpdateProcesses().

◆ ProcessPageOnNotify()

void ProcessPageOnNotify ( WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 251 of file procpage.c.

252 {
253  LPNMHDR pnmh;
254  NMLVDISPINFO* pnmdi;
255  LPNMHEADER pnmhdr;
256  ULONG Index;
257  ULONG ColumnIndex;
259 
260  pnmh = (LPNMHDR) lParam;
261  pnmdi = (NMLVDISPINFO*) lParam;
262  pnmhdr = (LPNMHEADER) lParam;
263 
264  if (pnmh->hwndFrom == hProcessPageListCtrl)
265  {
266  switch (pnmh->code)
267  {
268  case LVN_ITEMCHANGED:
270  break;
271 
272  case LVN_GETDISPINFO:
273 
274  if (!(pnmdi->item.mask & LVIF_TEXT))
275  break;
276 
277  pData = (LPPROCESS_PAGE_LIST_ITEM)pnmdi->item.lParam;
278  Index = PerfDataGetProcessIndex(pData->ProcessId);
279  ColumnIndex = pnmdi->item.iSubItem;
280 
281  PerfDataGetText(Index, ColumnIndex, pnmdi->item.pszText, (ULONG)pnmdi->item.cchTextMax);
282 
283  break;
284 
285  case NM_RCLICK:
286 
288  break;
289 
290  case LVN_KEYDOWN:
291 
292  if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE)
294  break;
295 
296  }
297  }
298  else if (pnmh->hwndFrom == hProcessPageHeaderCtrl)
299  {
300  switch (pnmh->code)
301  {
302  case HDN_ITEMCLICK:
303 
307 
308  break;
309 
310  case HDN_ITEMCHANGED:
311 
313 
314  break;
315 
316  case HDN_ENDDRAG:
317 
319 
320  break;
321 
322  }
323  }
324 }
DWORD GetSelectedProcessId(void)
Definition: procpage.c:103
#define LPNMHEADER
Definition: commctrl.h:895
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
BOOL PerfDataGetText(ULONG Index, ULONG ColumnIndex, LPTSTR lpText, ULONG nMaxCount)
Definition: procpage.c:612
struct PROCESS_PAGE_LIST_ITEM * LPPROCESS_PAGE_LIST_ITEM
ULONG PerfDataGetProcessIndex(ULONG pid)
Definition: perfdata.c:440
struct tagNMHDR * LPNMHDR
int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: procpage.c:785
#define LVIF_TEXT
Definition: commctrl.h:2309
void ProcessPageShowContextMenu(DWORD dwProcessId)
Definition: procpage.c:390
UINT code
Definition: winuser.h:3149
#define LVN_KEYDOWN
Definition: commctrl.h:3184
HWND hProcessPageHeaderCtrl
Definition: procpage.c:44
#define HDN_ITEMCHANGED
Definition: commctrl.h:867
void ProcessPage_OnEndProcess(void)
Definition: endproc.c:30
#define VK_DELETE
Definition: winuser.h:2223
void UpdateColumnDataHints(void)
Definition: column.c:203
#define NMLVDISPINFO
Definition: commctrl.h:3182
_In_ WDFCOLLECTION _In_ ULONG Index
UINT ColumnDataHints[COLUMN_NMAX]
Definition: column.c:26
HWND hwndFrom
Definition: winuser.h:3147
#define LVN_GETDISPINFO
Definition: commctrl.h:3160
#define HDN_ITEMCLICK
Definition: commctrl.h:868
#define HDN_ENDDRAG
Definition: commctrl.h:856
#define NM_RCLICK
Definition: commctrl.h:133
#define NULL
Definition: types.h:112
void ProcessPageUpdate(void)
Definition: procpage.c:126
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2703
unsigned int ULONG
Definition: retypes.h:1
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
HWND hProcessPageListCtrl
Definition: procpage.c:43
LPARAM lParam
Definition: combotst.c:139

Referenced by ProcessPageWndProc().

◆ ProcessPageRefreshThread()

DWORD WINAPI ProcessPageRefreshThread ( void lpParameter)

Definition at line 472 of file procpage.c.

473 {
474  MSG msg;
475 
476  while (1) {
477  /* Wait for an the event or application close */
478  if (GetMessage(&msg, NULL, 0, 0) <= 0)
479  return 0;
480 
481  if (msg.message == WM_TIMER) {
482 
483  UpdateProcesses();
484 
487 
489  }
490  }
491  return 0;
492 }
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define FALSE
Definition: types.h:117
void UpdateProcesses()
Definition: procpage.c:494
#define WM_TIMER
Definition: winuser.h:1732
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define NULL
Definition: types.h:112
HWND hProcessPage
Definition: procpage.c:41
#define GetMessage
Definition: winuser.h:5780
void ProcessPageUpdate(void)
Definition: procpage.c:126
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI IsWindowVisible(_In_ HWND)
HWND hProcessPageListCtrl
Definition: procpage.c:43

Referenced by ProcessPageWndProc().

◆ ProcessPageShowContextMenu()

void ProcessPageShowContextMenu ( DWORD  dwProcessId)

Definition at line 390 of file procpage.c.

391 {
392  HMENU hMenu;
393  HMENU hSubMenu;
394  HMENU hPriorityMenu;
395  POINT pt;
396  SYSTEM_INFO si;
398  DWORD dwProcessPriorityClass;
399  WCHAR strDebugger[260];
400  DWORD dwDebuggerSize;
401  HKEY hKey;
402 
403  if (dwProcessId == 0)
404  return;
405 
406  memset(&si, 0, sizeof(SYSTEM_INFO));
407 
408  GetCursorPos(&pt);
409  GetSystemInfo(&si);
410 
412  hSubMenu = GetSubMenu(hMenu, 0);
413  hPriorityMenu = GetSubMenu(hSubMenu, 4);
414 
416  dwProcessPriorityClass = GetPriorityClass(hProcess);
418 
419  if (si.dwNumberOfProcessors < 2)
421 
422  switch (dwProcessPriorityClass) {
425  break;
426  case HIGH_PRIORITY_CLASS:
428  break;
431  break;
434  break;
437  break;
438  case IDLE_PRIORITY_CLASS:
440  break;
441  }
442 
443  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
444  {
445  dwDebuggerSize = sizeof(strDebugger);
446  if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
447  {
448  CharUpper(strDebugger);
449  if (wcsstr(strDebugger, L"DRWTSN32"))
451  }
452  else
454 
455  RegCloseKey(hKey);
456  } else {
458  }
460  DestroyMenu(hMenu);
461 }
#define MF_DISABLED
Definition: winuser.h:130
#define REALTIME_PRIORITY_CLASS
Definition: winbase.h:184
#define CloseHandle
Definition: compat.h:739
#define CharUpper
Definition: winuser.h:5735
#define MF_BYCOMMAND
Definition: winuser.h:202
#define ERROR_SUCCESS
Definition: deptool.c:10
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:166
#define ID_PROCESS_PAGE_SETPRIORITY_NORMAL
Definition: resource.h:179
#define KEY_READ
Definition: nt_native.h:1023
#define pt(x, y)
Definition: drawing.c:79
#define TPM_LEFTALIGN
Definition: winuser.h:2367
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define ID_PROCESS_PAGE_SETPRIORITY_HIGH
Definition: resource.h:177
#define NORMAL_PRIORITY_CLASS
Definition: winbase.h:181
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
#define ABOVE_NORMAL_PRIORITY_CLASS
Definition: winbase.h:191
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
#define ID_PROCESS_PAGE_SETPRIORITY_REALTIME
Definition: resource.h:176
#define TPM_TOPALIGN
Definition: winuser.h:2373
#define HIGH_PRIORITY_CLASS
Definition: winbase.h:183
#define ID_PROCESS_PAGE_SETAFFINITY
Definition: resource.h:175
#define ID_PROCESS_PAGE_DEBUG
Definition: resource.h:174
#define IDLE_PRIORITY_CLASS
Definition: winbase.h:182
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4120
#define ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL
Definition: resource.h:180
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL
Definition: resource.h:178
HWND hMainWnd
Definition: magnifier.c:32
#define IDR_PROCESS_PAGE_CONTEXT
Definition: resource.h:25
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
BOOL WINAPI DestroyMenu(_In_ HMENU)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
HINSTANCE hInst
Definition: dxdiag.c:13
FxAutoRegKey hKey
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142
#define NULL
Definition: types.h:112
DWORD dwNumberOfProcessors
Definition: winbase.h:1165
#define TPM_LEFTBUTTON
Definition: winuser.h:2369
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define BELOW_NORMAL_PRIORITY_CLASS
Definition: winbase.h:190
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MF_GRAYED
Definition: winuser.h:129
DWORD WINAPI GetPriorityClass(IN HANDLE hProcess)
Definition: proc.c:1658
#define memset(x, y, z)
Definition: compat.h:39
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
#define RegCloseKey(hKey)
Definition: registry.h:47
#define ID_PROCESS_PAGE_SETPRIORITY_LOW
Definition: resource.h:181
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by ProcessPageOnNotify().

◆ ProcessPageUpdate()

void ProcessPageUpdate ( void  )

Definition at line 126 of file procpage.c.

127 {
128  /* Enable or disable the "End Process" button */
131  else
133 }
HWND hProcessPageEndProcessButton
Definition: procpage.c:45
#define TRUE
Definition: types.h:120
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
#define FALSE
Definition: types.h:117
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND hProcessPageListCtrl
Definition: procpage.c:43

Referenced by ProcessPageOnNotify(), ProcessPageRefreshThread(), and ProcessPageWndProc().

◆ ProcessPageWndProc()

INT_PTR CALLBACK ProcessPageWndProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 136 of file procpage.c.

137 {
138  RECT rc;
139  int nXDifference;
140  int nYDifference;
141  int cx, cy;
142 
143  switch (message) {
144  case WM_INITDIALOG:
145  /*
146  * Save the width and height
147  */
148  GetClientRect(hDlg, &rc);
151 
152  /* Update window position */
154 
155  /*
156  * Get handles to the controls
157  */
162 
163  /*
164  * Set the title, and extended window styles for the list control
165  */
168 
169  AddColumns();
170 
171  /*
172  * Subclass the process list control so we can intercept WM_ERASEBKGND
173  */
175 
176 #ifdef RUN_PROC_PAGE
177  /* Start our refresh thread */
179 #endif
180 
181  /* Refresh page */
183 
184  return TRUE;
185 
186  case WM_DESTROY:
187  /* Close the event handle, this will make the */
188  /* refresh thread exit when the wait fails */
189 #ifdef RUN_PROC_PAGE
191 #endif
193  Cleanup();
194  break;
195 
196  case WM_COMMAND:
197  /* Handle the button clicks */
198  switch (LOWORD(wParam))
199  {
200  case IDC_ENDPROCESS:
202  }
203  break;
204 
205  case WM_SIZE:
206  if (wParam == SIZE_MINIMIZED)
207  return 0;
208 
209  cx = LOWORD(lParam);
210  cy = HIWORD(lParam);
211  nXDifference = cx - nProcessPageWidth;
212  nYDifference = cy - nProcessPageHeight;
215 
216  /* Reposition the application page's controls */
218  cx = (rc.right - rc.left) + nXDifference;
219  cy = (rc.bottom - rc.top) + nYDifference;
222 
224  MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT));
225  cx = rc.left + nXDifference;
226  cy = rc.top + nYDifference;
229 
232  cx = rc.left;
233  cy = rc.top + nYDifference;
236  break;
237 
238  case WM_NOTIFY:
240  break;
241 
242  case WM_KEYDOWN:
243  if (wParam == VK_DELETE)
245  break;
246  }
247 
248  return 0;
249 }
INT_PTR CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: proclist.c:31
Definition: tftpd.h:59
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static int nProcessPageWidth
Definition: procpage.c:49
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define IDC_PROCESSLIST
Definition: resource.h:37
HWND hProcessPageEndProcessButton
Definition: procpage.c:45
#define TRUE
Definition: types.h:120
#define IDC_SHOWALLPROCESSES
Definition: resource.h:41
#define ListView_GetHeader(hwnd)
Definition: commctrl.h:2651
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
LONG top
Definition: windef.h:307
static DWORD dwProcessThread
Definition: procpage.c:53
HWND hProcessPageShowAllProcessesButton
Definition: procpage.c:46
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1237
DWORD EndLocalThread(HANDLE *hThread, DWORD dwThread)
Definition: taskmgr.c:1181
LONG right
Definition: windef.h:308
static int nProcessPageHeight
Definition: procpage.c:50
WPARAM wParam
Definition: combotst.c:138
void Cleanup(void)
Definition: procpage.c:66
#define L(x)
Definition: ntvdm.h:50
#define ListView_GetExtendedListViewStyle(hwndLV)
Definition: commctrl.h:2728
HWND hProcessPageHeaderCtrl
Definition: procpage.c:44
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2733
void SaveColumnSettings(void)
Definition: column.c:105
void ProcessPage_OnEndProcess(void)
Definition: endproc.c:30
#define WM_KEYDOWN
Definition: winuser.h:1705
#define VK_DELETE
Definition: winuser.h:2223
#define WM_DESTROY
Definition: winuser.h:1599
#define IDC_ENDPROCESS
Definition: resource.h:36
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_SIZE
Definition: winuser.h:1601
#define SWP_NOACTIVATE
Definition: winuser.h:1232
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define SIZE_MINIMIZED
Definition: winuser.h:2496
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
Definition: procpage.c:251
#define WM_COMMAND
Definition: winuser.h:1730
#define GWLP_WNDPROC
Definition: treelist.c:66
WNDPROC OldProcessListWndProc
Definition: proclist.c:27
#define SWP_NOSIZE
Definition: winuser.h:1235
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2896
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
Definition: procpage.c:472
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
void ProcessPageUpdate(void)
Definition: procpage.c:126
static HANDLE hProcessThread
Definition: procpage.c:52
_Out_opt_ int * cx
Definition: commctrl.h:585
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define SWP_NOMOVE
Definition: winuser.h:1234
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5336
HWND hProcessPageListCtrl
Definition: procpage.c:43
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
void AddColumns(void)
Definition: column.c:63
#define SWP_NOOWNERZORDER
Definition: winuser.h:1239

Referenced by OnCreate().

◆ ProcessRunning()

BOOL ProcessRunning ( ULONG  ProcessId)

Definition at line 550 of file procpage.c.

551 {
553  DWORD exitCode;
554 
555  if (ProcessId == 0) {
556  return TRUE;
557  }
558 
560  if (hProcess == NULL) {
561  return FALSE;
562  }
563 
564  if (GetExitCodeProcess(hProcess, &exitCode)) {
566  return (exitCode == STILL_ACTIVE);
567  }
568 
570  return FALSE;
571 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
#define CloseHandle
Definition: compat.h:739
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
#define TRUE
Definition: types.h:120
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1168
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define STILL_ACTIVE
Definition: winbase.h:233
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define NULL
Definition: types.h:112

Referenced by UpdateProcesses().

◆ ProcGetIndexByProcessId()

int ProcGetIndexByProcessId ( DWORD  dwProcessId)

Definition at line 82 of file procpage.c.

83 {
84  int i;
85  LVITEM item;
87 
89  {
90  memset(&item, 0, sizeof(LV_ITEM));
91  item.mask = LVIF_PARAM;
92  item.iItem = i;
95  if (pData->ProcessId == dwProcessId)
96  {
97  return i;
98  }
99  }
100  return 0;
101 }
#define LV_ITEM
Definition: commctrl.h:2337
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
struct PROCESS_PAGE_LIST_ITEM * LPPROCESS_PAGE_LIST_ITEM
if(dx==0 &&dy==0)
Definition: linetemp.h:174
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
static ATOM item
Definition: dde.c:856
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVITEM
Definition: commctrl.h:2375
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39
HWND hProcessPageListCtrl
Definition: procpage.c:43

Referenced by ApplicationPage_OnGotoProcess().

◆ RefreshProcessPage()

void RefreshProcessPage ( void  )

Definition at line 463 of file procpage.c.

464 {
465 #ifdef RUN_PROC_PAGE
466  /* Signal the event so that our refresh thread */
467  /* will wake up and refresh the process page */
469 #endif
470 }
static DWORD dwProcessThread
Definition: procpage.c:53
#define WM_TIMER
Definition: winuser.h:1732
#define PostThreadMessage
Definition: winuser.h:5823

Referenced by OnCreate(), TaskManager_OnOptionsShow16BitTasks(), and TaskManagerWndProc().

◆ SH_FormatInteger()

UINT SH_FormatInteger ( _In_ LONGLONG  Num,
_Out_writes_z_(cchResultMax) LPWSTR  pwszResult,
_In_ UINT  cchResultMax 
)

Definition at line 330 of file procpage.c.

334 {
335  NUMBERFMTW nf;
336  INT i;
337  INT cchGrouping, cchResult;
338  WCHAR wszNumber[24];
339  WCHAR wszDecimalSep[8], wszThousandSep[8];
340  WCHAR wszGrouping[12];
341 
342  /* Print the number in uniform mode */
343  StringCchPrintfW(wszNumber, _countof(wszNumber), L"%I64u", Num);
344 
345  /* Get system strings for decimal and thousand separators */
346  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, wszDecimalSep, _countof(wszDecimalSep));
347  GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, wszThousandSep, _countof(wszThousandSep));
348 
349  /* Initialize format for printing the number in bytes */
350  ZeroMemory(&nf, sizeof(nf));
351  nf.lpDecimalSep = wszDecimalSep;
352  nf.lpThousandSep = wszThousandSep;
353 
354  /* Get system string for groups separator */
355  cchGrouping = GetLocaleInfoW(LOCALE_USER_DEFAULT,
357  wszGrouping,
358  _countof(wszGrouping));
359 
360  /* Convert grouping specs from string to integer */
361  for (i = 0; i < cchGrouping; i++)
362  {
363  WCHAR wch = wszGrouping[i];
364 
365  if (wch >= L'0' && wch <= L'9')
366  nf.Grouping = nf.Grouping * 10 + (wch - L'0');
367  else if (wch != L';')
368  break;
369  }
370 
371  if ((nf.Grouping % 10) == 0)
372  nf.Grouping /= 10;
373  else
374  nf.Grouping *= 10;
375 
376  /* Format the number */
378  0,
379  wszNumber,
380  &nf,
381  pwszResult,
382  cchResultMax);
383  if (!cchResult)
384  return 0;
385 
386  /* GetNumberFormatW returns number of characters including UNICODE_NULL */
387  return cchResult - 1;
388 }
LPWSTR lpThousandSep
Definition: winnls.h:646
#define LOCALE_SGROUPING
Definition: winnls.h:44
LPWSTR lpDecimalSep
Definition: winnls.h:645
#define LOCALE_USER_DEFAULT
UINT Grouping
Definition: winnls.h:644
#define ZeroMemory
Definition: winbase.h:1670
int32_t INT
Definition: typedefs.h:58
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1102
#define L(x)
Definition: ntvdm.h:50
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_SDECIMAL
Definition: winnls.h:42
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, LPCWSTR lpszValue, const NUMBERFMTW *lpFormat, LPWSTR lpNumberStr, int cchOut)
Definition: lcformat.c:1198

Referenced by PerfDataGetText().

◆ UpdateProcesses()

void UpdateProcesses ( )

Definition at line 494 of file procpage.c.

495 {
496  int i;
497  ULONG l;
498  LV_ITEM item;
500 
502 
503  /* Remove old processes */
505  {
506  memset(&item, 0, sizeof (LV_ITEM));
507  item.mask = LVIF_PARAM;
508  item.iItem = i;
511  if (!ProcessRunning(pData->ProcessId))
512  {
515  }
516  }
517 
518  /* Check for difference in listview process and performance process counts */
520  {
521  /* Add new processes by checking against the current items */
522  for (l = 0; l < PerfDataGetProcessCount(); l++)
523  {
524  AddProcess(l);
525  }
526  }
527 
529  {
531  }
532 
534 
535  /* Select first item if any */
538  {
541  }
542  /*
543  else
544  {
545  bProcessPageSelectionMade = FALSE;
546  }
547  */
548 }
#define LV_ITEM
Definition: commctrl.h:2337
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define TRUE
Definition: types.h:120
#define WM_SETREDRAW
Definition: winuser.h:1606
struct PROCESS_PAGE_LIST_ITEM * LPPROCESS_PAGE_LIST_ITEM
#define LVNI_SELECTED
Definition: commctrl.h:2424
if(dx==0 &&dy==0)
Definition: linetemp.h:174
int ProcessRunning(ULONG ProcessId)
Definition: procpage.c:550
int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: procpage.c:785
BOOL bProcessPageSelectionMade
Definition: procpage.c:47
#define FALSE
Definition: types.h:117
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2411
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define LVNI_FOCUSED
Definition: commctrl.h:2423
ULONG PerfDataGetProcessCount(void)
Definition: perfdata.c:463
r l[0]
Definition: byte_order.h:167
void AddProcess(ULONG Index)
Definition: procpage.c:573
#define GetProcessHeap()
Definition: compat.h:736
static ATOM item
Definition: dde.c:856
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2703
#define SendMessage
Definition: winuser.h:5833
#define LVIF_PARAM
Definition: commctrl.h:2311
unsigned int ULONG
Definition: retypes.h:1
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39
HWND hProcessPageListCtrl
Definition: procpage.c:43
#define HeapFree(x, y, z)
Definition: compat.h:735
#define LVIS_FOCUSED
Definition: commctrl.h:2318

Referenced by ProcessPageRefreshThread().

Variable Documentation

◆ bProcessPageSelectionMade

BOOL bProcessPageSelectionMade = FALSE

Definition at line 47 of file procpage.c.

Referenced by UpdateProcesses().

◆ dwProcessThread

DWORD dwProcessThread
static

Definition at line 53 of file procpage.c.

Referenced by ProcessPageWndProc(), and RefreshProcessPage().

◆ hProcessPage

HWND hProcessPage

◆ hProcessPageEndProcessButton

HWND hProcessPageEndProcessButton

Definition at line 45 of file procpage.c.

Referenced by ProcessPageUpdate(), and ProcessPageWndProc().

◆ hProcessPageHeaderCtrl

◆ hProcessPageListCtrl

◆ hProcessPageShowAllProcessesButton

HWND hProcessPageShowAllProcessesButton

Definition at line 46 of file procpage.c.

Referenced by ProcessPageWndProc().

◆ hProcessThread

HANDLE hProcessThread = NULL
static

Definition at line 52 of file procpage.c.

Referenced by ProcessPageWndProc().

◆ nProcessPageHeight

int nProcessPageHeight
static

Definition at line 50 of file procpage.c.

Referenced by ProcessPageWndProc().

◆ nProcessPageWidth

int nProcessPageWidth
static

Definition at line 49 of file procpage.c.

Referenced by ProcessPageWndProc().