ReactOS  0.4.15-dev-4872-g8a3db97
procpage.c
Go to the documentation of this file.
1 /*
2  * ReactOS Task Manager
3  *
4  * procpage.c
5  *
6  * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7  * Copyright (C) 2009 Maxime Vernier <maxime.vernier@gmail.com>
8  * Copyright (C) 2022 Thamatip Chitpong <tangaming123456@outlook.com>
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 
25 #include "precomp.h"
26 
27 #include "proclist.h"
28 
29 #include <strsafe.h>
30 
31 #include <ndk/psfuncs.h>
32 
33 #define CMP(x1, x2)\
34  (x1 < x2 ? -1 : (x1 > x2 ? 1 : 0))
35 
36 typedef struct
37 {
40 
41 HWND hProcessPage; /* Process List Property Page */
42 
43 HWND hProcessPageListCtrl; /* Process ListCtrl Window */
44 HWND hProcessPageHeaderCtrl; /* Process Header Control */
45 HWND hProcessPageEndProcessButton; /* Process End Process button */
46 HWND hProcessPageShowAllProcessesButton;/* Process Show All Processes checkbox */
47 BOOL bProcessPageSelectionMade = FALSE; /* Is item in ListCtrl selected */
48 
49 static int nProcessPageWidth;
50 static int nProcessPageHeight;
51 #ifdef RUN_PROC_PAGE
54 #endif
55 
56 int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
57 void AddProcess(ULONG Index);
58 void UpdateProcesses();
59 void gethmsfromlargeint(LARGE_INTEGER largeint, DWORD *dwHours, DWORD *dwMinutes, DWORD *dwSeconds);
62 void ProcessPageShowContextMenu(DWORD dwProcessId);
63 BOOL PerfDataGetText(ULONG Index, ULONG ColumnIndex, LPTSTR lpText, ULONG nMaxCount);
64 DWORD WINAPI ProcessPageRefreshThread(void *lpParameter);
66 
67 void Cleanup(void)
68 {
69  int i;
70  LV_ITEM item;
73  {
74  memset(&item, 0, sizeof(LV_ITEM));
75  item.mask = LVIF_PARAM;
76  item.iItem = i;
80  }
81 }
82 
84 {
85  int i;
86  LVITEM item;
88 
90  {
91  memset(&item, 0, sizeof(LV_ITEM));
92  item.mask = LVIF_PARAM;
93  item.iItem = i;
96  if (pData->ProcessId == dwProcessId)
97  {
98  return i;
99  }
100  }
101  return 0;
102 }
103 
105 {
106  int Index;
107  LVITEM lvitem;
108 
110  {
112 
113  memset(&lvitem, 0, sizeof(LVITEM));
114 
115  lvitem.mask = LVIF_PARAM;
116  lvitem.iItem = Index;
117 
119 
120  if (lvitem.lParam)
121  return ((LPPROCESS_PAGE_LIST_ITEM)lvitem.lParam)->ProcessId;
122  }
123 
124  return 0;
125 }
126 
128 {
129  /* Enable or disable the "End Process" button */
132  else
134 }
135 
138 {
139  RECT rc;
140  int nXDifference;
141  int nYDifference;
142  int cx, cy;
143 
144  switch (message) {
145  case WM_INITDIALOG:
146  /*
147  * Save the width and height
148  */
149  GetClientRect(hDlg, &rc);
152 
153  /* Update window position */
155 
156  /*
157  * Get handles to the controls
158  */
163 
164  /*
165  * Set the title, and extended window styles for the list control
166  */
169 
170  AddColumns();
171 
172  /*
173  * Subclass the process list control so we can intercept WM_ERASEBKGND
174  */
176 
177 #ifdef RUN_PROC_PAGE
178  /* Start our refresh thread */
180 #endif
181 
182  /* Refresh page */
184 
185  return TRUE;
186 
187  case WM_DESTROY:
188  /* Close the event handle, this will make the */
189  /* refresh thread exit when the wait fails */
190 #ifdef RUN_PROC_PAGE
192 #endif
194  Cleanup();
195  break;
196 
197  case WM_COMMAND:
198  /* Handle the button clicks */
199  switch (LOWORD(wParam))
200  {
201  case IDC_ENDPROCESS:
203  }
204  break;
205 
206  case WM_SIZE:
207  if (wParam == SIZE_MINIMIZED)
208  return 0;
209 
210  cx = LOWORD(lParam);
211  cy = HIWORD(lParam);
212  nXDifference = cx - nProcessPageWidth;
213  nYDifference = cy - nProcessPageHeight;
216 
217  /* Reposition the application page's controls */
219  cx = (rc.right - rc.left) + nXDifference;
220  cy = (rc.bottom - rc.top) + nYDifference;
223 
225  MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT));
226  cx = rc.left + nXDifference;
227  cy = rc.top + nYDifference;
230 
233  cx = rc.left;
234  cy = rc.top + nYDifference;
237  break;
238 
239  case WM_NOTIFY:
241  break;
242 
243  case WM_KEYDOWN:
244  if (wParam == VK_DELETE)
246  break;
247  }
248 
249  return 0;
250 }
251 
253 {
254  LPNMHDR pnmh;
255  NMLVDISPINFO* pnmdi;
256  LPNMHEADER pnmhdr;
257  ULONG Index;
258  ULONG ColumnIndex;
260 
261  pnmh = (LPNMHDR) lParam;
262  pnmdi = (NMLVDISPINFO*) lParam;
263  pnmhdr = (LPNMHEADER) lParam;
264 
265  if (pnmh->hwndFrom == hProcessPageListCtrl)
266  {
267  switch (pnmh->code)
268  {
269  case LVN_ITEMCHANGED:
271  break;
272 
273  case LVN_GETDISPINFO:
274 
275  if (!(pnmdi->item.mask & LVIF_TEXT))
276  break;
277 
278  pData = (LPPROCESS_PAGE_LIST_ITEM)pnmdi->item.lParam;
279  Index = PerfDataGetProcessIndex(pData->ProcessId);
280  ColumnIndex = pnmdi->item.iSubItem;
281 
282  PerfDataGetText(Index, ColumnIndex, pnmdi->item.pszText, (ULONG)pnmdi->item.cchTextMax);
283 
284  break;
285 
286  case NM_RCLICK:
287 
289  break;
290 
291  case LVN_KEYDOWN:
292 
293  if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE)
295  break;
296 
297  }
298  }
299  else if (pnmh->hwndFrom == hProcessPageHeaderCtrl)
300  {
301  switch (pnmh->code)
302  {
303  case HDN_ITEMCLICK:
304 
308 
309  break;
310 
311  case HDN_ITEMCHANGED:
312 
314 
315  break;
316 
317  case HDN_ENDDRAG:
318 
320 
321  break;
322 
323  }
324  }
325 }
326 
328 {
329  WCHAR temp[260];
330  UINT i, j, k;
331 
332  for (i=0,j=0; i<(wcslen(strNumber) % 3); i++, j++)
333  temp[j] = strNumber[i];
334  for (k=0; i<wcslen(strNumber); i++,j++,k++) {
335  if ((k % 3 == 0) && (j > 0))
336  temp[j++] = L',';
337  temp[j] = strNumber[i];
338  }
339  temp[j] = L'\0';
340  wcsncpy(strNumber, temp, nMaxCount);
341 }
342 
344 {
345  HMENU hMenu;
346  HMENU hSubMenu;
347  HMENU hPriorityMenu;
348  POINT pt;
349  SYSTEM_INFO si;
351  DWORD dwProcessPriorityClass;
352  WCHAR strDebugger[260];
353  DWORD dwDebuggerSize;
354  HKEY hKey;
355 
356  memset(&si, 0, sizeof(SYSTEM_INFO));
357 
358  GetCursorPos(&pt);
359  GetSystemInfo(&si);
360 
362  hSubMenu = GetSubMenu(hMenu, 0);
363  hPriorityMenu = GetSubMenu(hSubMenu, 4);
364 
366  dwProcessPriorityClass = GetPriorityClass(hProcess);
368 
369  if (si.dwNumberOfProcessors < 2)
371 
372  switch (dwProcessPriorityClass) {
375  break;
376  case HIGH_PRIORITY_CLASS:
378  break;
381  break;
384  break;
387  break;
388  case IDLE_PRIORITY_CLASS:
390  break;
391  }
392 
393  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
394  {
395  dwDebuggerSize = sizeof(strDebugger);
396  if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
397  {
398  CharUpper(strDebugger);
399  if (wcsstr(strDebugger, L"DRWTSN32"))
401  }
402  else
404 
405  RegCloseKey(hKey);
406  } else {
408  }
410  DestroyMenu(hMenu);
411 }
412 
414 {
415 #ifdef RUN_PROC_PAGE
416  /* Signal the event so that our refresh thread */
417  /* will wake up and refresh the process page */
419 #endif
420 }
421 
423 {
424  MSG msg;
425 
426  while (1) {
427  /* Wait for an the event or application close */
428  if (GetMessage(&msg, NULL, 0, 0) <= 0)
429  return 0;
430 
431  if (msg.message == WM_TIMER) {
432 
433  UpdateProcesses();
434 
437 
439  }
440  }
441  return 0;
442 }
443 
445 {
446  int i;
447  ULONG l;
448  LV_ITEM item;
450 
452 
453  /* Remove old processes */
455  {
456  memset(&item, 0, sizeof (LV_ITEM));
457  item.mask = LVIF_PARAM;
458  item.iItem = i;
461  if (!ProcessRunning(pData->ProcessId))
462  {
465  }
466  }
467 
468  /* Check for difference in listview process and performance process counts */
470  {
471  /* Add new processes by checking against the current items */
472  for (l = 0; l < PerfDataGetProcessCount(); l++)
473  {
474  AddProcess(l);
475  }
476  }
477 
479  {
481  }
482 
484 
485  /* Select first item if any */
488  {
491  }
492  /*
493  else
494  {
495  bProcessPageSelectionMade = FALSE;
496  }
497  */
498 }
499 
501 {
503  DWORD exitCode;
504 
505  if (ProcessId == 0) {
506  return TRUE;
507  }
508 
510  if (hProcess == NULL) {
511  return FALSE;
512  }
513 
514  if (GetExitCodeProcess(hProcess, &exitCode)) {
516  return (exitCode == STILL_ACTIVE);
517  }
518 
520  return FALSE;
521 }
522 
524 {
526  int i;
527  LV_ITEM item;
528  BOOL bAlreadyInList = FALSE;
529  ULONG pid;
530 
532 
533  /* Check to see if it's already in our list */
535  {
536  memset(&item, 0, sizeof(LV_ITEM));
537  item.mask = LVIF_PARAM;
538  item.iItem = i;
541  if (pData->ProcessId == pid)
542  {
543  bAlreadyInList = TRUE;
544  break;
545  }
546  }
547  if (!bAlreadyInList) /* Add */
548  {
550  pData->ProcessId = pid;
551 
552  /* Add the item to the list */
553  memset(&item, 0, sizeof(LV_ITEM));
554  item.mask = LVIF_TEXT|LVIF_PARAM;
555  item.pszText = LPSTR_TEXTCALLBACK;
557  item.lParam = (LPARAM)pData;
559  }
560 }
561 
563 {
564  IO_COUNTERS iocounters;
566 
567  if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
569  if (ColumnDataHints[ColumnIndex] == COLUMN_PID)
570  wsprintfW(lpText, L"%lu", PerfDataGetProcessId(Index));
571  if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
573  if (ColumnDataHints[ColumnIndex] == COLUMN_COMMANDLINE)
575  if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID)
576  wsprintfW(lpText, L"%lu", PerfDataGetSessionId(Index));
577  if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE)
578  wsprintfW(lpText, L"%02lu", PerfDataGetCPUUsage(Index));
579  if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
580  {
581  DWORD dwHours;
582  DWORD dwMinutes;
583  DWORD dwSeconds;
584 
586  gethmsfromlargeint(time, &dwHours, &dwMinutes, &dwSeconds);
587  wsprintfW(lpText, L"%lu:%02lu:%02lu", dwHours, dwMinutes, dwSeconds);
588  }
589  if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE)
590  {
591  wsprintfW(lpText, L"%lu", PerfDataGetWorkingSetSizeBytes(Index) / 1024);
593  wcscat(lpText, L" K");
594  }
595  if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE)
596  {
597  wsprintfW(lpText, L"%lu", PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
599  wcscat(lpText, L" K");
600  }
601  if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA)
602  {
603  wsprintfW(lpText, L"%lu", PerfDataGetWorkingSetSizeDelta(Index) / 1024);
605  wcscat(lpText, L" K");
606  }
607  if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS)
608  {
609  wsprintfW(lpText, L"%lu", PerfDataGetPageFaultCount(Index));
611  }
612  if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA)
613  {
616  }
617  if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE)
618  {
619  wsprintfW(lpText, L"%lu", PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
621  wcscat(lpText, L" K");
622  }
623  if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL)
624  {
625  wsprintfW(lpText, L"%lu", PerfDataGetPagedPoolUsagePages(Index) / 1024);
627  wcscat(lpText, L" K");
628  }
629  if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL)
630  {
631  wsprintfW(lpText, L"%lu", PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
633  wcscat(lpText, L" K");
634  }
635  if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY)
636  wsprintfW(lpText, L"%lu", PerfDataGetBasePriority(Index));
637  if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT)
638  {
639  wsprintfW(lpText, L"%lu", PerfDataGetHandleCount(Index));
641  }
642  if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT)
643  {
644  wsprintfW(lpText, L"%lu", PerfDataGetThreadCount(Index));
646  }
647  if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS)
648  {
651  }
652  if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS)
653  {
654  wsprintfW(lpText, L"%lu", PerfDataGetGDIObjectCount(Index));
656  }
657  if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
658  {
659  PerfDataGetIOCounters(Index, &iocounters);
660  /* wsprintfW(pnmdi->item.pszText, L"%d", iocounters.ReadOperationCount); */
661  _ui64tow(iocounters.ReadOperationCount, lpText, 10);
663  }
664  if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
665  {
666  PerfDataGetIOCounters(Index, &iocounters);
667  /* wsprintfW(pnmdi->item.pszText, L"%d", iocounters.WriteOperationCount); */
668  _ui64tow(iocounters.WriteOperationCount, lpText, 10);
670  }
671  if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
672  {
673  PerfDataGetIOCounters(Index, &iocounters);
674  /* wsprintfW(pnmdi->item.pszText, L"%d", iocounters.OtherOperationCount); */
675  _ui64tow(iocounters.OtherOperationCount, lpText, 10);
677  }
678  if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
679  {
680  PerfDataGetIOCounters(Index, &iocounters);
681  /* wsprintfW(pnmdi->item.pszText, L"%d", iocounters.ReadTransferCount); */
682  _ui64tow(iocounters.ReadTransferCount, lpText, 10);
684  }
685  if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
686  {
687  PerfDataGetIOCounters(Index, &iocounters);
688  /* wsprintfW(pnmdi->item.pszText, L"%d", iocounters.WriteTransferCount); */
689  _ui64tow(iocounters.WriteTransferCount, lpText, 10);
691  }
692  if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
693  {
694  PerfDataGetIOCounters(Index, &iocounters);
695  /* wsprintfW(pnmdi->item.pszText, L"%d", iocounters.OtherTransferCount); */
696  _ui64tow(iocounters.OtherTransferCount, lpText, 10);
698  }
699 
700  return FALSE;
701 }
702 
703 
704 void gethmsfromlargeint(LARGE_INTEGER largeint, DWORD *dwHours, DWORD *dwMinutes, DWORD *dwSeconds)
705 {
706 #ifdef _MSC_VER
707  *dwHours = (DWORD)(largeint.QuadPart / 36000000000L);
708  *dwMinutes = (DWORD)((largeint.QuadPart % 36000000000L) / 600000000L);
709  *dwSeconds = (DWORD)(((largeint.QuadPart % 36000000000L) % 600000000L) / 10000000L);
710 #else
711  *dwHours = (DWORD)(largeint.QuadPart / 36000000000LL);
712  *dwMinutes = (DWORD)((largeint.QuadPart % 36000000000LL) / 600000000LL);
713  *dwSeconds = (DWORD)(((largeint.QuadPart % 36000000000LL) % 600000000LL) / 10000000LL);
714 #endif
715 }
716 
718 {
719  int ret = 0;
720  DWORD dwHours1;
721  DWORD dwMinutes1;
722  DWORD dwSeconds1;
723  DWORD dwHours2;
724  DWORD dwMinutes2;
725  DWORD dwSeconds2;
726 
727  gethmsfromlargeint(l1, &dwHours1, &dwMinutes1, &dwSeconds1);
728  gethmsfromlargeint(l2, &dwHours2, &dwMinutes2, &dwSeconds2);
729  ret = CMP(dwHours1, dwHours2);
730  if (ret == 0)
731  {
732  ret = CMP(dwMinutes1, dwMinutes2);
733  if (ret == 0)
734  {
735  ret = CMP(dwSeconds1, dwSeconds2);
736  }
737  }
738  return ret;
739 }
740 
741 int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
742 {
743  int ret = 0;
746  ULONG IndexParam1;
747  ULONG IndexParam2;
748  WCHAR text1[260];
749  WCHAR text2[260];
750  ULONG l1;
751  ULONG l2;
752  LARGE_INTEGER time1;
753  LARGE_INTEGER time2;
754  IO_COUNTERS iocounters1;
755  IO_COUNTERS iocounters2;
756  ULONGLONG ull1;
757  ULONGLONG ull2;
758 
760  Param1 = (LPPROCESS_PAGE_LIST_ITEM)lParam1;
761  Param2 = (LPPROCESS_PAGE_LIST_ITEM)lParam2;
762  } else {
763  Param1 = (LPPROCESS_PAGE_LIST_ITEM)lParam2;
764  Param2 = (LPPROCESS_PAGE_LIST_ITEM)lParam1;
765  }
766  IndexParam1 = PerfDataGetProcessIndex(Param1->ProcessId);
767  IndexParam2 = PerfDataGetProcessIndex(Param2->ProcessId);
768 
770  {
771  PerfDataGetImageName(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
772  PerfDataGetImageName(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
773  ret = _wcsicmp(text1, text2);
774  }
776  {
777  l1 = Param1->ProcessId;
778  l2 = Param2->ProcessId;
779  ret = CMP(l1, l2);
780  }
782  {
783  PerfDataGetUserName(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
784  PerfDataGetUserName(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
785  ret = _wcsicmp(text1, text2);
786  }
788  {
789  PerfDataGetCommandLine(IndexParam1, text1, sizeof (text1) / sizeof (*text1));
790  PerfDataGetCommandLine(IndexParam2, text2, sizeof (text2) / sizeof (*text2));
791  ret = _wcsicmp(text1, text2);
792  }
794  {
795  l1 = PerfDataGetSessionId(IndexParam1);
796  l2 = PerfDataGetSessionId(IndexParam2);
797  ret = CMP(l1, l2);
798  }
800  {
801  l1 = PerfDataGetCPUUsage(IndexParam1);
802  l2 = PerfDataGetCPUUsage(IndexParam2);
803  ret = CMP(l1, l2);
804  }
806  {
807  time1 = PerfDataGetCPUTime(IndexParam1);
808  time2 = PerfDataGetCPUTime(IndexParam2);
809  ret = largeintcmp(time1, time2);
810  }
812  {
813  l1 = PerfDataGetWorkingSetSizeBytes(IndexParam1);
814  l2 = PerfDataGetWorkingSetSizeBytes(IndexParam2);
815  ret = CMP(l1, l2);
816  }
818  {
819  l1 = PerfDataGetPeakWorkingSetSizeBytes(IndexParam1);
820  l2 = PerfDataGetPeakWorkingSetSizeBytes(IndexParam2);
821  ret = CMP(l1, l2);
822  }
824  {
825  l1 = PerfDataGetWorkingSetSizeDelta(IndexParam1);
826  l2 = PerfDataGetWorkingSetSizeDelta(IndexParam2);
827  ret = CMP(l1, l2);
828  }
830  {
831  l1 = PerfDataGetPageFaultCount(IndexParam1);
832  l2 = PerfDataGetPageFaultCount(IndexParam2);
833  ret = CMP(l1, l2);
834  }
836  {
837  l1 = PerfDataGetPageFaultCountDelta(IndexParam1);
838  l2 = PerfDataGetPageFaultCountDelta(IndexParam2);
839  ret = CMP(l1, l2);
840  }
842  {
843  l1 = PerfDataGetVirtualMemorySizeBytes(IndexParam1);
844  l2 = PerfDataGetVirtualMemorySizeBytes(IndexParam2);
845  ret = CMP(l1, l2);
846  }
848  {
849  l1 = PerfDataGetPagedPoolUsagePages(IndexParam1);
850  l2 = PerfDataGetPagedPoolUsagePages(IndexParam2);
851  ret = CMP(l1, l2);
852  }
854  {
855  l1 = PerfDataGetNonPagedPoolUsagePages(IndexParam1);
856  l2 = PerfDataGetNonPagedPoolUsagePages(IndexParam2);
857  ret = CMP(l1, l2);
858  }
860  {
861  l1 = PerfDataGetBasePriority(IndexParam1);
862  l2 = PerfDataGetBasePriority(IndexParam2);
863  ret = CMP(l1, l2);
864  }
866  {
867  l1 = PerfDataGetHandleCount(IndexParam1);
868  l2 = PerfDataGetHandleCount(IndexParam2);
869  ret = CMP(l1, l2);
870  }
872  {
873  l1 = PerfDataGetThreadCount(IndexParam1);
874  l2 = PerfDataGetThreadCount(IndexParam2);
875  ret = CMP(l1, l2);
876  }
878  {
879  l1 = PerfDataGetUSERObjectCount(IndexParam1);
880  l2 = PerfDataGetUSERObjectCount(IndexParam2);
881  ret = CMP(l1, l2);
882  }
884  {
885  l1 = PerfDataGetGDIObjectCount(IndexParam1);
886  l2 = PerfDataGetGDIObjectCount(IndexParam2);
887  ret = CMP(l1, l2);
888  }
890  {
891  PerfDataGetIOCounters(IndexParam1, &iocounters1);
892  PerfDataGetIOCounters(IndexParam2, &iocounters2);
893  ull1 = iocounters1.ReadOperationCount;
894  ull2 = iocounters2.ReadOperationCount;
895  ret = CMP(ull1, ull2);
896  }
898  {
899  PerfDataGetIOCounters(IndexParam1, &iocounters1);
900  PerfDataGetIOCounters(IndexParam2, &iocounters2);
901  ull1 = iocounters1.WriteOperationCount;
902  ull2 = iocounters2.WriteOperationCount;
903  ret = CMP(ull1, ull2);
904  }
906  {
907  PerfDataGetIOCounters(IndexParam1, &iocounters1);
908  PerfDataGetIOCounters(IndexParam2, &iocounters2);
909  ull1 = iocounters1.OtherOperationCount;
910  ull2 = iocounters2.OtherOperationCount;
911  ret = CMP(ull1, ull2);
912  }
914  {
915  PerfDataGetIOCounters(IndexParam1, &iocounters1);
916  PerfDataGetIOCounters(IndexParam2, &iocounters2);
917  ull1 = iocounters1.ReadTransferCount;
918  ull2 = iocounters2.ReadTransferCount;
919  ret = CMP(ull1, ull2);
920  }
922  {
923  PerfDataGetIOCounters(IndexParam1, &iocounters1);
924  PerfDataGetIOCounters(IndexParam2, &iocounters2);
925  ull1 = iocounters1.WriteTransferCount;
926  ull2 = iocounters2.WriteTransferCount;
927  ret = CMP(ull1, ull2);
928  }
930  {
931  PerfDataGetIOCounters(IndexParam1, &iocounters1);
932  PerfDataGetIOCounters(IndexParam2, &iocounters2);
933  ull1 = iocounters1.OtherTransferCount;
934  ull2 = iocounters2.OtherTransferCount;
935  ret = CMP(ull1, ull2);
936  }
937  return ret;
938 }
939 
958 static DWORD
960  _In_ LPCWSTR lpDevicePath,
962  LPWSTR lpDosPath,
964 {
965  DWORD dwRet = 0;
966  WCHAR szDrive[3] = L"?:";
968 
969  /* Check if lpDevicePath is a device path */
970  if (_wcsnicmp(lpDevicePath, L"\\Device\\", _countof(L"\\Device\\")-1) != 0)
971  {
972  return 0;
973  }
974 
975  for (szDrive[0] = L'A'; szDrive[0] <= L'`'; szDrive[0]++)
976  {
977  if (QueryDosDeviceW(szDrive, szDeviceName, _countof(szDeviceName)) != 0)
978  {
979  size_t len = wcslen(szDeviceName);
980 
981  if (_wcsnicmp(lpDevicePath, szDeviceName, len) == 0)
982  {
983  /* Get the required length, including the NULL terminator */
984  dwRet = _countof(szDrive) + wcslen(lpDevicePath + len);
985 
986  if (lpDosPath && (dwLength >= dwRet))
987  {
988  StringCchPrintfW(lpDosPath, dwLength, L"%s%s",
989  szDrive, lpDevicePath + len);
990  }
991 
992  break;
993  }
994  }
995  }
996 
997  return dwRet;
998 }
999 
1019 static DWORD
1022  _Out_writes_to_opt_(dwLength, return)
1023  LPWSTR lpExePath,
1025 {
1026  DWORD dwRet = 0;
1027  NTSTATUS Status;
1028  BYTE StaticBuffer[sizeof(UNICODE_STRING) + (MAX_PATH * sizeof(WCHAR))];
1030  PUNICODE_STRING ExePath;
1031  ULONG SizeNeeded;
1032 
1035  StaticBuffer,
1036  /* Reserve a NULL terminator */
1037  sizeof(StaticBuffer) - sizeof(WCHAR),
1038  &SizeNeeded);
1039  if (NT_SUCCESS(Status))
1040  {
1041  ExePath = (PUNICODE_STRING)StaticBuffer;
1042  }
1043  else if (Status == STATUS_INFO_LENGTH_MISMATCH)
1044  {
1045  /* Allocate the buffer, reserving space for a NULL terminator */
1046  DynamicBuffer = HeapAlloc(GetProcessHeap(), 0, SizeNeeded + sizeof(WCHAR));
1047  if (!DynamicBuffer)
1048  return 0;
1049 
1052  DynamicBuffer,
1053  SizeNeeded,
1054  &SizeNeeded);
1055  if (!NT_SUCCESS(Status))
1056  goto Cleanup;
1057 
1058  ExePath = DynamicBuffer;
1059  }
1060  else
1061  {
1062  return 0;
1063  }
1064 
1065  /* Manually NULL-terminate */
1066  ExePath->Buffer[ExePath->Length / sizeof(WCHAR)] = UNICODE_NULL;
1067 
1068  /* HACK: Convert device path format into Win32 path format.
1069  * Use ProcessImageFileNameWin32 instead if the kernel supports it. */
1070  dwRet = DevicePathToDosPath(ExePath->Buffer, lpExePath, dwLength);
1071 
1072 Cleanup:
1074 
1075  return dwRet;
1076 }
1077 
1096 static DWORD
1098  _In_ DWORD dwProcessId,
1099  _Out_writes_to_opt_(dwLength, return)
1100  LPWSTR lpExePath,
1102 {
1103  DWORD dwRet = 0;
1104 
1105  if (dwProcessId == 0)
1106  return 0;
1107 
1108  /* PID = 4 ("System") */
1109  if (dwProcessId == 4)
1110  {
1111  static const WCHAR szKernelExe[] = L"\\ntoskrnl.exe";
1112  LPWSTR pszSystemDir;
1113  UINT uLength;
1114 
1115  uLength = GetSystemDirectoryW(NULL, 0);
1116  if (uLength == 0)
1117  return 0;
1118 
1119  pszSystemDir = HeapAlloc(GetProcessHeap(), 0, uLength * sizeof(WCHAR));
1120  if (!pszSystemDir)
1121  return 0;
1122 
1123  if (GetSystemDirectoryW(pszSystemDir, uLength) != 0)
1124  {
1125  /* Get the required length, including the NULL terminator */
1126  dwRet = uLength + _countof(szKernelExe) - 1;
1127 
1128  if (lpExePath && (dwLength >= dwRet))
1129  {
1130  StringCchPrintfW(lpExePath, dwLength, L"%s%s",
1131  pszSystemDir, szKernelExe);
1132  }
1133  }
1134 
1135  HeapFree(GetProcessHeap(), 0, pszSystemDir);
1136  }
1137  else
1138  {
1139  HANDLE hProcess;
1140 
1142  if (hProcess)
1143  {
1144  dwRet = GetProcessExecutablePath(hProcess, lpExePath, dwLength);
1146  }
1147  }
1148 
1149  return dwRet;
1150 }
1151 
1153 {
1154  DWORD dwProcessId;
1155  DWORD dwLength;
1156  LPWSTR pszExePath;
1157  SHELLEXECUTEINFOW info = { 0 };
1158 
1159  dwProcessId = GetSelectedProcessId();
1160 
1161  /* Retrieve the image path length */
1162  dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0);
1163  if (dwLength == 0)
1164  return;
1165 
1166  /* Allocate and retrieve the image path */
1167  pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1168  if (!pszExePath)
1169  return;
1170 
1171  if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0)
1172  goto Cleanup;
1173 
1174  /* Call the shell to display the file properties */
1175  info.cbSize = sizeof(SHELLEXECUTEINFOW);
1176  info.fMask = SEE_MASK_INVOKEIDLIST;
1177  info.hwnd = NULL;
1178  info.lpVerb = L"properties";
1179  info.lpFile = pszExePath;
1180  info.lpParameters = L"";
1181  info.lpDirectory = NULL;
1182  info.nShow = SW_SHOW;
1183  info.hInstApp = NULL;
1184 
1186 
1187 Cleanup:
1188  HeapFree(GetProcessHeap(), 0, pszExePath);
1189 }
1190 
1192 {
1193  DWORD dwProcessId;
1194  DWORD dwLength;
1195  LPWSTR pszExePath;
1196  LPWSTR pszCmdLine = NULL;
1197 
1198  dwProcessId = GetSelectedProcessId();
1199 
1200  /* Retrieve the image path length */
1201  dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0);
1202  if (dwLength == 0)
1203  return;
1204 
1205  /* Allocate and retrieve the image path */
1206  pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1207  if (!pszExePath)
1208  return;
1209 
1210  if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0)
1211  goto Cleanup;
1212 
1213  /* Build the shell command line */
1214  pszCmdLine = HeapAlloc(GetProcessHeap(), 0, (dwLength + 10) * sizeof(WCHAR));
1215  if (!pszCmdLine)
1216  goto Cleanup;
1217 
1218  StringCchPrintfW(pszCmdLine, dwLength + 10, L"/select,\"%s\"", pszExePath);
1219 
1220  /* Call the shell to open the file location and select it */
1221  ShellExecuteW(NULL, L"open", L"explorer.exe", pszCmdLine, NULL, SW_SHOWNORMAL);
1222 
1223 Cleanup:
1224  HeapFree(GetProcessHeap(), 0, pszCmdLine);
1225  HeapFree(GetProcessHeap(), 0, pszExePath);
1226 }
#define COLUMN_NONPAGEDPOOL
Definition: column.h:38
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
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:1097
ULONG PerfDataGetBasePriority(ULONG Index)
Definition: perfdata.c:838
#define LV_ITEM
Definition: commctrl.h:2337
INT_PTR CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: proclist.c:31
void ProcessPage_OnProperties(void)
Definition: procpage.c:1152
ULONGLONG OtherOperationCount
Definition: pstypes.h:85
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define COLUMN_GDIOBJECTS
Definition: column.h:43
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
Definition: tftpd.h:59
#define MF_DISABLED
Definition: winuser.h:130
#define REALTIME_PRIORITY_CLASS
Definition: winbase.h:184
DWORD GetSelectedProcessId(void)
Definition: procpage.c:104
#define CloseHandle
Definition: compat.h:598
#define COLUMN_PAGEFAULTSDELTA
Definition: column.h:35
#define LL
Definition: tui.h:150
#define CharUpper
Definition: winuser.h:5725
#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 COLUMN_PAGEFAULTS
Definition: column.h:34
#define MF_BYCOMMAND
Definition: winuser.h:202
#define _In_opt_
Definition: ms_sal.h:309
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
static int nProcessPageWidth
Definition: procpage.c:49
#define ERROR_SUCCESS
Definition: deptool.c:10
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDC_PROCESSLIST
Definition: resource.h:37
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:166
#define ID_PROCESS_PAGE_SETPRIORITY_NORMAL
Definition: resource.h:179
#define CMP(x1, x2)
Definition: procpage.c:33
HWND hProcessPageEndProcessButton
Definition: procpage.c:45
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define TPM_LEFTALIGN
Definition: winuser.h:2357
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
#define IDC_SHOWALLPROCESSES
Definition: resource.h:41
#define COLUMN_COMMANDLINE
Definition: column.h:50
ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index)
Definition: perfdata.c:710
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1168
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define ListView_GetHeader(hwnd)
Definition: commctrl.h:2651
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
LONG NTSTATUS
Definition: precomp.h:26
#define COLUMN_PID
Definition: column.h:26
BOOL PerfDataGetText(ULONG Index, ULONG ColumnIndex, LPTSTR lpText, ULONG nMaxCount)
Definition: procpage.c:562
ULONG PerfDataGetCPUUsage(ULONG Index)
Definition: perfdata.c:680
#define CALLBACK
Definition: compat.h:35
#define WM_SETREDRAW
Definition: winuser.h:1603
_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)
struct PROCESS_PAGE_LIST_ITEM * LPPROCESS_PAGE_LIST_ITEM
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
ULONGLONG WriteOperationCount
Definition: pstypes.h:84
LONG top
Definition: windef.h:307
ULONG PerfDataGetPageFaultCount(ULONG Index)
Definition: perfdata.c:758
static DWORD dwProcessThread
Definition: procpage.c:53
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define COLUMN_CPUTIME
Definition: column.h:30
HWND hProcessPageShowAllProcessesButton
Definition: procpage.c:46
ULONG PerfDataGetProcessIndex(ULONG pid)
Definition: perfdata.c:440
#define COLUMN_IOOTHERBYTES
Definition: column.h:49
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
ULONG PerfDataGetPageFaultCountDelta(ULONG Index)
Definition: perfdata.c:774
#define LVNI_SELECTED
Definition: commctrl.h:2424
UINT_PTR WPARAM
Definition: windef.h:207
#define ID_PROCESS_PAGE_SETPRIORITY_HIGH
Definition: resource.h:177
void RefreshProcessPage(void)
Definition: procpage.c:413
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
__u16 time
Definition: mkdosfs.c:366
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1237
#define NORMAL_PRIORITY_CLASS
Definition: winbase.h:181
int32_t INT_PTR
Definition: typedefs.h:64
#define COLUMN_USEROBJECTS
Definition: column.h:42
DWORD EndLocalThread(HANDLE *hThread, DWORD dwThread)
Definition: taskmgr.c:1181
if(dx==0 &&dy==0)
Definition: linetemp.h:174
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
LONG right
Definition: windef.h:308
ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index)
Definition: perfdata.c:822
static int nProcessPageHeight
Definition: procpage.c:50
int ProcessRunning(ULONG ProcessId)
Definition: procpage.c:500
#define DWORD
Definition: nt_native.h:44
ULONG PerfDataGetGDIObjectCount(ULONG Index)
Definition: perfdata.c:902
#define COLUMN_SESSIONID
Definition: column.h:28
WPARAM wParam
Definition: combotst.c:138
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:959
CHAR * LPTSTR
Definition: xmlstorage.h:192
struct tagNMHDR * LPNMHDR
#define ABOVE_NORMAL_PRIORITY_CLASS
Definition: winbase.h:191
int CALLBACK ProcessPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: procpage.c:741
#define COLUMN_CPUUSAGE
Definition: column.h:29
#define LVIF_TEXT
Definition: commctrl.h:2309
#define _Out_writes_to_opt_(size, count)
Definition: ms_sal.h:356
void ProcessPageShowContextMenu(DWORD dwProcessId)
Definition: procpage.c:343
UINT code
Definition: winuser.h:3139
int largeintcmp(LARGE_INTEGER l1, LARGE_INTEGER l2)
Definition: procpage.c:717
BOOL bProcessPageSelectionMade
Definition: procpage.c:47
void Cleanup(void)
Definition: procpage.c:67
ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index)
Definition: perfdata.c:790
#define L(x)
Definition: ntvdm.h:50
#define COLUMN_THREADCOUNT
Definition: column.h:41
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define LVN_KEYDOWN
Definition: commctrl.h:3184
unsigned char * LPBYTE
Definition: typedefs.h:53
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
void UpdateProcesses()
Definition: procpage.c:444
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
#define ID_PROCESS_PAGE_SETPRIORITY_REALTIME
Definition: resource.h:176
#define ListView_GetExtendedListViewStyle(hwndLV)
Definition: commctrl.h:2728
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND hProcessPageHeaderCtrl
Definition: procpage.c:44
#define HDN_ITEMCHANGED
Definition: commctrl.h:867
#define TPM_TOPALIGN
Definition: winuser.h:2363
__MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _ui64tow(_In_ unsigned __int64 _Val, _Pre_notnull_ _Post_z_ wchar_t *_DstBuf, _In_ int _Radix)
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
#define HIGH_PRIORITY_CLASS
Definition: winbase.h:183
BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount)
Definition: perfdata.c:490
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 LVIS_SELECTED
Definition: commctrl.h:2319
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
#define _In_
Definition: ms_sal.h:308
#define ID_PROCESS_PAGE_SETAFFINITY
Definition: resource.h:175
#define WM_KEYDOWN
Definition: winuser.h:1702
LONG_PTR LPARAM
Definition: windef.h:208
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2411
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2343
#define LVNI_FOCUSED
Definition: commctrl.h:2423
ULONGLONG WriteTransferCount
Definition: pstypes.h:87
#define SW_SHOW
Definition: winuser.h:769
#define VK_DELETE
Definition: winuser.h:2213
ULONG PerfDataGetProcessCount(void)
Definition: perfdata.c:463
#define WM_DESTROY
Definition: winuser.h:1596
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 GLint GLint j
Definition: glfuncs.h:250
BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters)
Definition: perfdata.c:918
r l[0]
Definition: byte_order.h:167
#define IDC_ENDPROCESS
Definition: resource.h:36
Status
Definition: gdiplustypes.h:24
void UpdateColumnDataHints(void)
Definition: column.c:203
ULONG PerfDataGetThreadCount(ULONG Index)
Definition: perfdata.c:870
#define COLUMN_PAGEDPOOL
Definition: column.h:37
#define NMLVDISPINFO
Definition: commctrl.h:3182
void AddProcess(ULONG Index)
Definition: procpage.c:523
#define ID_PROCESS_PAGE_DEBUG
Definition: resource.h:174
#define IDLE_PRIORITY_CLASS
Definition: winbase.h:182
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define COLUMN_IMAGENAME
Definition: column.h:25
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
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define WM_SIZE
Definition: winuser.h:1598
#define STILL_ACTIVE
Definition: winbase.h:230
_In_ WDFCOLLECTION _In_ ULONG Index
#define SWP_NOACTIVATE
Definition: winuser.h:1232
uint64_t ULONGLONG
Definition: typedefs.h:67
#define _countof(array)
Definition: sndvol32.h:68
ULONG PerfDataGetProcessId(ULONG Index)
Definition: perfdata.c:506
#define WM_TIMER
Definition: winuser.h:1729
#define COLUMN_HANDLECOUNT
Definition: column.h:40
UINT ColumnDataHints[COLUMN_NMAX]
Definition: column.c:26
#define PostThreadMessage
Definition: winuser.h:5813
#define MAX_PATH
Definition: compat.h:34
#define WINAPI
Definition: msvc.h:6
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SIZE_MINIMIZED
Definition: winuser.h:2486
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
void gethmsfromlargeint(LARGE_INTEGER largeint, DWORD *dwHours, DWORD *dwMinutes, DWORD *dwSeconds)
Definition: procpage.c:704
#define ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL
Definition: resource.h:178
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
Definition: procpage.c:252
ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index)
Definition: perfdata.c:726
int ret
HWND hMainWnd
Definition: magnifier.c:32
LARGE_INTEGER PerfDataGetCPUTime(ULONG Index)
Definition: perfdata.c:696
#define IDR_PROCESS_PAGE_CONTEXT
Definition: resource.h:25
ULONGLONG ReadTransferCount
Definition: pstypes.h:86
int ProcGetIndexByProcessId(DWORD dwProcessId)
Definition: procpage.c:83
GLenum GLsizei len
Definition: glext.h:6722
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1727
static const WCHAR szDeviceName[]
Definition: provider.c:56
HWND hwndFrom
Definition: winuser.h:3137
unsigned char BYTE
Definition: xxhash.c:193
#define GWLP_WNDPROC
Definition: treelist.c:66
WNDPROC OldProcessListWndProc
Definition: proclist.c:27
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:1020
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define LVN_GETDISPINFO
Definition: commctrl.h:3160
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SWP_NOSIZE
Definition: winuser.h:1235
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2886
#define HDN_ITEMCLICK
Definition: commctrl.h:868
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define SW_SHOWNORMAL
Definition: winuser.h:764
#define HDN_ENDDRAG
Definition: commctrl.h:856
HINSTANCE hInst
Definition: dxdiag.c:13
DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
Definition: procpage.c:422
static ATOM item
Definition: dde.c:856
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
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
void CommaSeparateNumberString(LPWSTR strNumber, ULONG nMaxCount)
Definition: procpage.c:327
static calc_node_t temp
Definition: rpn_ieee.c:38
FxAutoRegKey hKey
#define NM_RCLICK
Definition: commctrl.h:133
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
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
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index)
Definition: perfdata.c:742
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
ULONG PerfDataGetSessionId(ULONG Index)
Definition: perfdata.c:664
HWND hProcessPage
Definition: procpage.c:41
#define GetMessage
Definition: winuser.h:5770
struct _SHELLEXECUTEINFOW SHELLEXECUTEINFOW
#define COLUMN_IOWRITEBYTES
Definition: column.h:48
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
void ProcessPageUpdate(void)
Definition: procpage.c:127
ULONG PerfDataGetHandleCount(ULONG Index)
Definition: perfdata.c:854
struct _UNICODE_STRING UNICODE_STRING
static HANDLE hProcessThread
Definition: procpage.c:52
#define msg(x)
Definition: auth_time.c:54
_Out_opt_ int * cx
Definition: commctrl.h:585
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
BOOL PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, ULONG nMaxCount)
Definition: perfdata.c:522
#define ListView_SortItems(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2703
#define SendMessage
Definition: winuser.h:5823
#define LVIF_PARAM
Definition: commctrl.h:2311
DWORD dwNumberOfProcessors
Definition: winbase.h:1162
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2354
#define LVITEM
Definition: commctrl.h:2375
#define TPM_LEFTBUTTON
Definition: winuser.h:2359
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
void ProcessPage_OnOpenFileLocation(void)
Definition: procpage.c:1191
#define BELOW_NORMAL_PRIORITY_CLASS
Definition: winbase.h:190
#define HIWORD(l)
Definition: typedefs.h:247
unsigned int ULONG
Definition: retypes.h:1
#define COLUMN_IOWRITES
Definition: column.h:45
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
LONG bottom
Definition: windef.h:309
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
#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:5326
#define COLUMN_IOREADS
Definition: column.h:44
#define COLUMN_USERNAME
Definition: column.h:27
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MF_GRAYED
Definition: winuser.h:129
ULONGLONG OtherTransferCount
Definition: pstypes.h:88
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2789
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define COLUMN_IOOTHER
Definition: column.h:46
#define LPSTR_TEXTCALLBACK
Definition: commctrl.h:2383
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
DWORD WINAPI GetPriorityClass(IN HANDLE hProcess)
Definition: proc.c:1658
#define memset(x, y, z)
Definition: compat.h:39
HWND hProcessPageListCtrl
Definition: procpage.c:43
#define COLUMN_BASEPRIORITY
Definition: column.h:39
INT_PTR CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: procpage.c:137
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
ULONG PerfDataGetUSERObjectCount(ULONG Index)
Definition: perfdata.c:886
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
BOOL WINAPI TrackPopupMenu(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _Reserved_ int, _In_ HWND, _Reserved_ LPCRECT)
_In_ int nMaxCount
Definition: winuser.h:4857
ULONG PerfDataGetPagedPoolUsagePages(ULONG Index)
Definition: perfdata.c:806
#define COLUMN_IOREADBYTES
Definition: column.h:47
int k
Definition: mpi.c:3369
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
#define ID_PROCESS_PAGE_SETPRIORITY_LOW
Definition: resource.h:181
_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 LVIS_FOCUSED
Definition: commctrl.h:2318
#define WM_NOTIFY
Definition: richedit.h:61
#define COLUMN_VIRTUALMEMORYSIZE
Definition: column.h:36
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:59
LONGLONG QuadPart
Definition: typedefs.h:114
#define COLUMN_PEAKMEMORYUSAGE
Definition: column.h:32
void AddColumns(void)
Definition: column.c:63
ULONGLONG ReadOperationCount
Definition: pstypes.h:83
#define SWP_NOOWNERZORDER
Definition: winuser.h:1239
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define COLUMN_MEMORYUSAGEDELTA
Definition: column.h:33
BOOL PerfDataGetCommandLine(ULONG Index, LPWSTR lpCommandLine, ULONG nMaxCount)
Definition: perfdata.c:540