ReactOS  0.4.15-dev-5097-g328cc41
taskmgr.c
Go to the documentation of this file.
1 /*
2  * ReactOS Task Manager
3  *
4  * taskmgr.c : Defines the entry point for the application.
5  *
6  * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7  * 2005 Klemens Friedl <frik85@reactos.at>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #include "precomp.h"
25 
26 #include "perfpage.h"
27 #include "about.h"
28 #include "affinity.h"
29 #include "debug.h"
30 #include "priority.h"
31 
32 #define STATUS_WINDOW 2001
33 
34 /* Global Variables: */
35 HINSTANCE hInst; /* current instance */
36 
37 HWND hMainWnd; /* Main Window */
38 HWND hStatusWnd; /* Status Bar Window */
39 HWND hTabWnd; /* Tab Control Window */
40 
42 
43 int nMinimumWidth; /* Minimum width of the dialog (OnSize()'s cx) */
44 int nMinimumHeight; /* Minimum height of the dialog (OnSize()'s cy) */
45 
46 int nOldWidth; /* Holds the previous client area width */
47 int nOldHeight; /* Holds the previous client area height */
48 
49 BOOL bInMenuLoop = FALSE; /* Tells us if we are in the menu loop */
50 BOOL bWasKeyboardInput = FALSE; /* TabChange by Keyboard or Mouse ? */
51 
53 
55 // Taken from WinSpy++ 1.7
56 // http://www.catch22.net/software/winspy
57 // Copyright (c) 2002 by J Brown
58 //
59 
60 //
61 // Copied from uxtheme.h
62 // If you have this new header, then delete these and
63 // #include <uxtheme.h> instead!
64 //
65 #define ETDT_DISABLE 0x00000001
66 #define ETDT_ENABLE 0x00000002
67 #define ETDT_USETABTEXTURE 0x00000004
68 #define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
69 
70 //
71 typedef HRESULT (WINAPI * ETDTProc) (HWND, DWORD);
72 
73 //
74 // Try to call EnableThemeDialogTexture, if uxtheme.dll is present
75 //
77 {
78  HMODULE hUXTheme;
80 
81  hUXTheme = LoadLibraryA("uxtheme.dll");
82 
83  if(hUXTheme)
84  {
86  (ETDTProc)GetProcAddress(hUXTheme, "EnableThemeDialogTexture");
87 
89  {
91 
92  FreeLibrary(hUXTheme);
93  return TRUE;
94  }
95  else
96  {
97  // Failed to locate API!
98  FreeLibrary(hUXTheme);
99  return FALSE;
100  }
101  }
102  else
103  {
104  // Not running under XP? Just fail gracefully
105  return FALSE;
106  }
107 }
108 
110  HINSTANCE hPrevInstance,
111  LPWSTR lpCmdLine,
112  int nCmdShow)
113 {
115  HANDLE hToken;
116  TOKEN_PRIVILEGES tkp;
117  HANDLE hMutex;
118 
119  /* check wether we're already running or not */
120  hMutex = CreateMutexW(NULL, TRUE, L"taskmgrros");
122  {
123  /* Restore existing taskmanager and bring window to front */
124  /* Relies on the fact that the application title string and window title are the same */
125  HWND hTaskMgr;
126  TCHAR szTaskmgr[128];
127 
128  LoadString(hInst, IDS_APP_TITLE, szTaskmgr, sizeof(szTaskmgr)/sizeof(TCHAR));
129  hTaskMgr = FindWindow(NULL, szTaskmgr);
130 
131  if (hTaskMgr != NULL)
132  {
133  SendMessage(hTaskMgr, WM_SYSCOMMAND, SC_RESTORE, 0);
134  SetForegroundWindow(hTaskMgr);
135  }
136 
138  return 0;
139  }
140  else if (!hMutex)
141  {
142  return 1;
143  }
144 
145  /* Initialize global variables */
146  hInst = hInstance;
147 
148  /* Change our priority class to HIGH */
152 
153  /* Now lets get the SE_DEBUG_NAME privilege
154  * so that we can debug processes
155  */
156 
157  /* Get a token for this process. */
159  {
160  /* Get the LUID for the debug privilege. */
162  {
163  tkp.PrivilegeCount = 1; /* one privilege to set */
165 
166  /* Get the debug privilege for this process. */
167  AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, (PTOKEN_PRIVILEGES)NULL, 0);
168  }
169  CloseHandle(hToken);
170  }
171 
172  /* Load our settings from the registry */
173  LoadSettings();
174 
175  /* Initialize perf data */
176  if (!PerfDataInitialize())
177  {
178  return -1;
179  }
180 
181  /*
182  * Set our shutdown parameters: we want to shutdown the very last,
183  * without displaying any end task dialog if needed.
184  */
186 
188 
189  /* Save our settings to the registry */
190  SaveSettings();
193  if (hWindowMenu)
195  return 0;
196 }
197 
198 /* Message handler for dialog box. */
201 {
202 #if 0
203  HDC hdc;
204  PAINTSTRUCT ps;
205  RECT rc;
206 #endif
207  LPRECT pRC;
208  LPNMHDR pnmh;
209  WINDOWPLACEMENT wp;
210 
211  switch (message) {
212  case WM_INITDIALOG:
213  // For now, the Help dialog menu item is disabled because of lacking of HTML Help support
215  hMainWnd = hDlg;
216  return OnCreate(hDlg);
217 
218  case WM_COMMAND:
219  if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
220  EndDialog(hDlg, LOWORD(wParam));
221  return TRUE;
222  }
223  /* Process menu commands */
224  switch (LOWORD(wParam))
225  {
226  case ID_FILE_NEW:
228  break;
231  break;
234  break;
237  break;
240  break;
241  case ID_RESTORE:
243  break;
244  case ID_VIEW_LARGE:
245  case ID_VIEW_SMALL:
246  case ID_VIEW_DETAILS:
248  break;
251  break;
254  break;
257  break;
263  break;
266  break;
267  case ID_VIEW_REFRESH:
268  PostMessageW(hDlg, WM_TIMER, 0, 0);
269  break;
272  break;
275  break;
276  case ID_WINDOWS_MINIMIZE:
278  break;
279  case ID_WINDOWS_MAXIMIZE:
281  break;
282  case ID_WINDOWS_CASCADE:
284  break;
287  break;
290  break;
293  break;
296  break;
299  break;
302  break;
305  break;
308  break;
311  break;
314  break;
317  break;
320  break;
323  break;
326  break;
329  break;
332  break;
333 
334 /* ShutDown items */
335  case ID_SHUTDOWN_STANDBY:
337  break;
340  break;
343  break;
344  case ID_SHUTDOWN_REBOOT:
345  ShutDown_Reboot();
346  break;
347  case ID_SHUTDOWN_LOGOFF:
349  break;
352  break;
355  break;
358  break;
361  break;
362 
363  case ID_HELP_ABOUT:
364  OnAbout();
365  break;
366  case ID_FILE_EXIT:
367  EndDialog(hDlg, IDOK);
368  break;
369  }
370  break;
371 
372  case WM_ONTRAYICON:
373  switch(lParam)
374  {
375  case WM_RBUTTONDOWN:
376  {
377  POINT pt;
378  BOOL OnTop;
379  HMENU hMenu, hPopupMenu;
380 
381  GetCursorPos(&pt);
382 
384 
386  hPopupMenu = GetSubMenu(hMenu, 0);
387 
389  {
390  DeleteMenu(hPopupMenu, ID_RESTORE, MF_BYCOMMAND);
391  }
392  else
393  {
394  SetMenuDefaultItem(hPopupMenu, ID_RESTORE, FALSE);
395  }
396 
397  if(OnTop)
398  {
400  } else
401  {
403  }
404 
406  TrackPopupMenuEx(hPopupMenu, 0, pt.x, pt.y, hMainWnd, NULL);
407 
408  DestroyMenu(hMenu);
409  break;
410  }
411  case WM_LBUTTONDBLCLK:
413  break;
414  }
415  break;
416 
417  case WM_NOTIFY:
418  pnmh = (LPNMHDR)lParam;
419  if ((pnmh->hwndFrom == hTabWnd) &&
420  (pnmh->idFrom == IDC_TAB))
421  {
422  switch (pnmh->code)
423  {
424  case TCN_SELCHANGE:
426  break;
427  case TCN_KEYDOWN:
429  break;
430  case NM_CLICK:
432  break;
433  }
434  }
435  break;
436 #if 0
437  case WM_NCPAINT:
438  hdc = GetDC(hDlg);
439  GetClientRect(hDlg, &rc);
441  ReleaseDC(hDlg, hdc);
442  break;
443 
444  case WM_PAINT:
445  hdc = BeginPaint(hDlg, &ps);
446  GetClientRect(hDlg, &rc);
448  EndPaint(hDlg, &ps);
449  break;
450 #endif
451  case WM_SIZING:
452  /* Make sure the user is sizing the dialog */
453  /* in an acceptable range */
454  pRC = (LPRECT)lParam;
455  if ((wParam == WMSZ_LEFT) || (wParam == WMSZ_TOPLEFT) || (wParam == WMSZ_BOTTOMLEFT)) {
456  /* If the width is too small enlarge it to the minimum */
457  if (nMinimumWidth > (pRC->right - pRC->left))
458  pRC->left = pRC->right - nMinimumWidth;
459  } else {
460  /* If the width is too small enlarge it to the minimum */
461  if (nMinimumWidth > (pRC->right - pRC->left))
462  pRC->right = pRC->left + nMinimumWidth;
463  }
464  if ((wParam == WMSZ_TOP) || (wParam == WMSZ_TOPLEFT) || (wParam == WMSZ_TOPRIGHT)) {
465  /* If the height is too small enlarge it to the minimum */
466  if (nMinimumHeight > (pRC->bottom - pRC->top))
467  pRC->top = pRC->bottom - nMinimumHeight;
468  } else {
469  /* If the height is too small enlarge it to the minimum */
470  if (nMinimumHeight > (pRC->bottom - pRC->top))
471  pRC->bottom = pRC->top + nMinimumHeight;
472  }
473  return TRUE;
474  break;
475 
476  case WM_SIZE:
477  /* Handle the window sizing in it's own function */
479  break;
480 
481  case WM_MOVE:
482  /* Handle the window moving in it's own function */
484  break;
485 
486  case WM_DESTROY:
487  ShowWindow(hDlg, SW_HIDE);
489  wp.length = sizeof(WINDOWPLACEMENT);
490  GetWindowPlacement(hDlg, &wp);
495  if (IsZoomed(hDlg) || (wp.flags & WPF_RESTORETOMAXIMIZED))
497  else
499  /* Get rid of the allocated command line cache, if any */
501  if (hWindowMenu)
503  return DefWindowProcW(hDlg, message, wParam, lParam);
504 
505  case WM_TIMER:
506  /* Refresh the performance data */
507  PerfDataRefresh();
512  break;
513 
514  case WM_ENTERMENULOOP:
516  break;
517  case WM_EXITMENULOOP:
519  break;
520  case WM_MENUSELECT:
522  break;
523  case WM_SYSCOLORCHANGE:
524  /* Forward WM_SYSCOLORCHANGE to common controls */
528  break;
529  }
530 
531  return 0;
532 }
533 
535 {
536  SetBkColor(hDC, clr);
537  ExtTextOutW(hDC, 0, 0, ETO_OPAQUE, lpRect, NULL, 0, NULL);
538 }
539 
540 void FillSolidRect2(HDC hDC, int x, int y, int cx, int cy, COLORREF clr)
541 {
542  RECT rect;
543 
544  SetBkColor(hDC, clr);
545  rect.left = x;
546  rect.top = y;
547  rect.right = x + cx;
548  rect.bottom = y + cy;
549  ExtTextOutW(hDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
550 }
551 
552 void Draw3dRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight)
553 {
554  FillSolidRect2(hDC, x, y, cx - 1, 1, clrTopLeft);
555  FillSolidRect2(hDC, x, y, 1, cy - 1, clrTopLeft);
556  FillSolidRect2(hDC, x + cx, y, -1, cy, clrBottomRight);
557  FillSolidRect2(hDC, x, y + cy, cx, -1, clrBottomRight);
558 }
559 
560 void Draw3dRect2(HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight)
561 {
562  Draw3dRect(hDC, lpRect->left, lpRect->top, lpRect->right - lpRect->left,
563  lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight);
564 }
565 
567 {
568  /* Setup update speed (pause=fall down) */
571  SetTimer(hWnd, 1, 1000, NULL);
572  break;
574  SetTimer(hWnd, 1, 2000, NULL);
575  break;
577  SetTimer(hWnd, 1, 4000, NULL);
578  break;
579  }
580 }
581 
583 {
584  HMENU hMenu;
585  HMENU hEditMenu;
586  HMENU hViewMenu;
587  HMENU hShutMenu;
588  HMENU hUpdateSpeedMenu;
589  HMENU hCPUHistoryMenu;
590  int nActivePage;
591  int nParts[3];
592  RECT rc;
593  WCHAR szTemp[256];
594  WCHAR szLogOffItem[MAX_PATH];
595  LPWSTR lpUserName;
596  TCITEM item;
597  DWORD len = 0;
598 
600 
601  /* Initialize the Windows Common Controls DLL */
603 
604  /* Get the minimum window sizes */
605  GetWindowRect(hWnd, &rc);
606  nMinimumWidth = (rc.right - rc.left);
607  nMinimumHeight = (rc.bottom - rc.top);
608 
609  /* Create the status bar */
611  if(!hStatusWnd)
612  return FALSE;
613 
614  /* Create the status bar panes */
615  nParts[0] = STATUS_SIZE1;
616  nParts[1] = STATUS_SIZE2;
617  nParts[2] = STATUS_SIZE3;
619 
620  /* Create tab pages */
622 #if 1
626 #else
630 #endif
631 
632  /* Insert tabs */
633  LoadStringW(hInst, IDS_TAB_APPS, szTemp, 256);
634  memset(&item, 0, sizeof(TCITEM));
635  item.mask = TCIF_TEXT;
636  item.pszText = szTemp;
638  LoadStringW(hInst, IDS_TAB_PROCESSES, szTemp, 256);
639  memset(&item, 0, sizeof(TCITEM));
640  item.mask = TCIF_TEXT;
641  item.pszText = szTemp;
643  LoadStringW(hInst, IDS_TAB_PERFORMANCE, szTemp, 256);
644  memset(&item, 0, sizeof(TCITEM));
645  item.mask = TCIF_TEXT;
646  item.pszText = szTemp;
648 
649  /* Size everything correctly */
650  GetClientRect(hWnd, &rc);
651  nOldWidth = rc.right;
652  nOldHeight = rc.bottom;
653  /* nOldStartX = rc.left; */
654  /*nOldStartY = rc.top; */
655 
656 #define PAGE_OFFSET_LEFT 17
657 #define PAGE_OFFSET_TOP 72
658 #define PAGE_OFFSET_WIDTH (PAGE_OFFSET_LEFT*2)
659 #define PAGE_OFFSET_HEIGHT (PAGE_OFFSET_TOP+32)
660 
661  if ((TaskManagerSettings.Left != 0) ||
662  (TaskManagerSettings.Top != 0) ||
663  (TaskManagerSettings.Right != 0) ||
665  {
667 #ifdef __GNUC__TEST__
671 #endif
672  }
675 
676  /* Set the always on top style */
677  hMenu = GetMenu(hWnd);
678  hEditMenu = GetSubMenu(hMenu, 1);
679  hViewMenu = GetSubMenu(hMenu, 2);
680  hShutMenu = GetSubMenu(hMenu, 4);
681  hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1);
682  hCPUHistoryMenu = GetSubMenu(hViewMenu, 7);
683 
684  /* Check or uncheck the always on top menu item */
688  } else {
691  }
692 
693  /* Check or uncheck the minimize on use menu item */
696  else
698 
699  /* Check or uncheck the hide when minimized menu item */
702  else
704 
705  /* Check or uncheck the show 16-bit tasks menu item */
708  else
710 
711  /* Set the view mode */
713 
716  else
718 
720 
723  else
725 
726  nActivePage = TaskManagerSettings.ActiveTabPage;
727  TabCtrl_SetCurFocus/*Sel*/(hTabWnd, 0);
728  TabCtrl_SetCurFocus/*Sel*/(hTabWnd, 1);
729  TabCtrl_SetCurFocus/*Sel*/(hTabWnd, 2);
730  TabCtrl_SetCurFocus/*Sel*/(hTabWnd, nActivePage);
731 
732  /* Set the username in the "Log Off %s" item of the Shutdown menu */
733 
734  /* 1- Get the menu item text and store it temporarily */
735  GetMenuStringW(hShutMenu, ID_SHUTDOWN_LOGOFF, szTemp, 256, MF_BYCOMMAND);
736 
737  /* 2- Retrieve the username length first, then allocate a buffer for it and call it again */
739  {
740  lpUserName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR));
741  if (lpUserName && GetUserNameW(lpUserName, &len))
742  {
743  _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]), szTemp, lpUserName);
744  szLogOffItem[sizeof(szLogOffItem)/sizeof(szLogOffItem[0]) - 1] = UNICODE_NULL;
745  }
746  else
747  {
748  _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]), szTemp, L"n/a");
749  }
750 
751  if (lpUserName) HeapFree(GetProcessHeap(), 0, lpUserName);
752  }
753  else
754  {
755  _snwprintf(szLogOffItem, sizeof(szLogOffItem)/sizeof(szLogOffItem[0]), szTemp, L"n/a");
756  }
757 
758  /* 3- Set the menu item text to its formatted counterpart */
760 
761  /* Setup update speed */
763 
764  /*
765  * Refresh the performance data
766  * Sample it twice so we can establish
767  * the delta values & cpu usage
768  */
769  PerfDataRefresh();
770  PerfDataRefresh();
771 
775 
777 
778  return TRUE;
779 }
780 
781 /* OnMove()
782  * This function handles all the moving events for the application
783  * It moves every child window that needs moving
784  */
785 void OnMove( WPARAM nType, int cx, int cy )
786 {
787 #ifdef __GNUC__TEST__
791 #endif
792 }
793 
794 /* OnSize()
795  * This function handles all the sizing events for the application
796  * It re-sizes every window, and child window that needs re-sizing
797  */
798 void OnSize( WPARAM nType, int cx, int cy )
799 {
800  int nParts[3];
801  int nXDifference;
802  int nYDifference;
803  RECT rc;
804 
805  if (nType == SIZE_MINIMIZED)
806  {
808  {
810  }
811  return;
812  }
813 
814  nXDifference = cx - nOldWidth;
815  nYDifference = cy - nOldHeight;
816  nOldWidth = cx;
817  nOldHeight = cy;
818 
819  /* Update the status bar size */
822 
823  /* Update the status bar pane sizes */
824  nParts[0] = bInMenuLoop ? -1 : STATUS_SIZE1;
825  nParts[1] = STATUS_SIZE2;
826  nParts[2] = cx;
828 
829  /* Resize the tab control */
830  GetWindowRect(hTabWnd, &rc);
831  cx = (rc.right - rc.left) + nXDifference;
832  cy = (rc.bottom - rc.top) + nYDifference;
834 
835  /* Resize the application page */
837  cx = (rc.right - rc.left) + nXDifference;
838  cy = (rc.bottom - rc.top) + nYDifference;
840 
841  /* Resize the process page */
843  cx = (rc.right - rc.left) + nXDifference;
844  cy = (rc.bottom - rc.top) + nYDifference;
846 
847  /* Resize the performance page */
849  cx = (rc.right - rc.left) + nXDifference;
850  cy = (rc.bottom - rc.top) + nYDifference;
852 }
853 
854 void LoadSettings(void)
855 {
856  HKEY hKey;
857  WCHAR szSubKey[] = L"Software\\ReactOS\\TaskManager";
858  int i;
859  DWORD dwSize;
860 
861  /* Window size & position settings */
867 
868  /* Tab settings */
870 
871  /* Options menu settings */
876 
877  /* Update speed settings */
879 
880  /* Applications page settings */
882 
883  /* Processes page settings */
884  TaskManagerSettings.ShowProcessesFromAllUsers = FALSE; /* It's the default */
885 
886  for (i = 0; i < COLUMN_NMAX; i++) {
890  }
891 
894 
895  /* Performance page settings */
898 
899  /* Open the key */
901  return;
902  /* Read the settings */
903  dwSize = sizeof(TASKMANAGER_SETTINGS);
905 
906  /*
907  * ATM, the 'ImageName' column is always visible
908  * (and grayed in configuration dialog)
909  * This will avoid troubles if the registry gets corrupted.
910  */
911  TaskManagerSettings.Column_ImageName = TRUE;
912 
913  /* Close the key */
914  RegCloseKey(hKey);
915 }
916 
917 void SaveSettings(void)
918 {
919  HKEY hKey;
920  WCHAR szSubKey[] = L"Software\\ReactOS\\TaskManager";
921 
922  /* Open (or create) the key */
924  return;
925  /* Save the settings */
927  /* Close the key */
928  RegCloseKey(hKey);
929 }
930 
932 {
933  //HMENU hMenu, hOptionsMenu;
934  BOOL OnTop;
935 
936  //hMenu = GetMenu(hMainWnd);
937  //hOptionsMenu = GetSubMenu(hMenu, OPTIONS_MENU_INDEX);
939 
943 }
944 
946 {
947  int nParts;
948 
949  /* Update the status bar pane sizes */
950  nParts = -1;
952  bInMenuLoop = TRUE;
954 }
955 
957 {
958  RECT rc;
959  int nParts[3];
960 
961  bInMenuLoop = FALSE;
962 
963  /* Update the status bar pane sizes */
964  GetClientRect(hWnd, &rc);
965  nParts[0] = STATUS_SIZE1;
966  nParts[1] = STATUS_SIZE2;
967  nParts[2] = rc.right;
969 
970  /* trigger update of status bar columns and performance page asynchronously */
972 }
973 
974 void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
975 {
976  WCHAR str[100];
977 
978  wcscpy(str, L"");
979  if (LoadStringW(hInst, nItemID, str, 100)) {
980  /* load appropriate string */
981  LPWSTR lpsz = str;
982  /* first newline terminates actual string */
983  lpsz = wcschr(lpsz, '\n');
984  if (lpsz != NULL)
985  *lpsz = '\0';
986  }
988 }
989 
991 {
992  HMENU hMenu;
993  HMENU hViewMenu;
994  HMENU hUpdateSpeedMenu;
995 
996  hMenu = GetMenu(hMainWnd);
997  hViewMenu = GetSubMenu(hMenu, 2);
998  hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1);
999 
1000  TaskManagerSettings.UpdateSpeed = dwSpeed;
1002 
1003  KillTimer(hMainWnd, 1);
1004 
1006 }
1007 
1009 {
1010  int i;
1011  HMENU hMenu;
1012  HMENU hOptionsMenu;
1013  HMENU hViewMenu;
1014  HMENU hSubMenu;
1015  WCHAR szTemp[256];
1016  SYSTEM_INFO sysInfo;
1017 
1018  hMenu = GetMenu(hMainWnd);
1019  hViewMenu = GetSubMenu(hMenu, 2);
1020  hOptionsMenu = GetSubMenu(hMenu, 1);
1022  for (i = GetMenuItemCount(hViewMenu) - 1; i > 2; i--) {
1023  hSubMenu = GetSubMenu(hViewMenu, i);
1024  if (hSubMenu)
1025  DestroyMenu(hSubMenu);
1026  RemoveMenu(hViewMenu, i, MF_BYPOSITION);
1027  }
1028  RemoveMenu(hOptionsMenu, 3, MF_BYPOSITION);
1029  if (hWindowMenu)
1032  case 0:
1037 
1038  LoadStringW(hInst, IDS_MENU_LARGEICONS, szTemp, 256);
1039  AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_LARGE, szTemp);
1040 
1041  LoadStringW(hInst, IDS_MENU_SMALLICONS, szTemp, 256);
1042  AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_SMALL, szTemp);
1043 
1044  LoadStringW(hInst, IDS_MENU_DETAILS, szTemp, 256);
1045  AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_DETAILS, szTemp);
1046 
1047  if (GetMenuItemCount(hMenu) <= 5) {
1049 
1050  LoadStringW(hInst, IDS_MENU_WINDOWS, szTemp, 256);
1051  InsertMenuW(hMenu, 3, MF_BYPOSITION|MF_POPUP, (UINT_PTR) hWindowMenu, szTemp);
1052 
1054  }
1056 
1057  /*
1058  * Give the application list control focus
1059  */
1060  if (!bWasKeyboardInput)
1062  break;
1063 
1064  case 1:
1069 
1070  LoadStringW(hInst, IDS_MENU_SELECTCOLUMNS, szTemp, 256);
1071  AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_SELECTCOLUMNS, szTemp);
1072 
1073  LoadStringW(hInst, IDS_MENU_16BITTASK, szTemp, 256);
1074  AppendMenuW(hOptionsMenu, MF_STRING, ID_OPTIONS_SHOW16BITTASKS, szTemp);
1075 
1078  if (GetMenuItemCount(hMenu) > 5)
1079  {
1080  DeleteMenu(hMenu, 3, MF_BYPOSITION);
1082  }
1083  /*
1084  * Give the process list control focus
1085  */
1086  if (!bWasKeyboardInput)
1088  break;
1089 
1090  case 2:
1095  if (GetMenuItemCount(hMenu) > 5) {
1096  DeleteMenu(hMenu, 3, MF_BYPOSITION);
1098  }
1099 
1100  GetSystemInfo(&sysInfo);
1101 
1102  /* Hide CPU graph options on single CPU systems */
1103  if (sysInfo.dwNumberOfProcessors > 1)
1104  {
1105  hSubMenu = CreatePopupMenu();
1106 
1109 
1110  LoadStringW(hInst, IDS_MENU_ONEGRAPHPERCPU, szTemp, 256);
1112 
1113  LoadStringW(hInst, IDS_MENU_CPUHISTORY, szTemp, 256);
1114  AppendMenuW(hViewMenu, MF_STRING|MF_POPUP, (UINT_PTR) hSubMenu, szTemp);
1115 
1118  else
1120  }
1121 
1123  AppendMenuW(hViewMenu, MF_STRING, ID_VIEW_SHOWKERNELTIMES, szTemp);
1124 
1127  else
1129 
1130  /*
1131  * Give the tab control focus
1132  */
1133  if (!bWasKeyboardInput)
1134  SetFocus(hTabWnd);
1135  break;
1136  }
1137 }
1138 
1140 {
1141  LPWSTR lpMessageBuffer;
1142 
1144  NULL,
1145  dwError,
1147  (LPWSTR)&lpMessageBuffer,
1148  0, NULL) != 0)
1149  {
1150  MessageBoxW(hMainWnd, lpMessageBuffer, NULL, MB_OK | MB_ICONERROR);
1151  if (lpMessageBuffer) LocalFree(lpMessageBuffer);
1152  }
1153 }
1154 
1156 {
1157  DWORD dwRet;
1158  LPWSTR lpszTemp = NULL;
1159 
1161  NULL,
1162  GetLastError(),
1163  LANG_NEUTRAL,
1164  (LPWSTR)&lpszTemp,
1165  0,
1166  NULL );
1167 
1168  /* supplied buffer is not long enough */
1169  if (!dwRet || ( (long)dwSize < (long)dwRet+14)) {
1170  lpszBuf[0] = L'\0';
1171  } else {
1172  lpszTemp[lstrlenW(lpszTemp)-2] = L'\0'; /*remove cr and newline character */
1173  wsprintfW(lpszBuf, L"%s (0x%x)", lpszTemp, (int)GetLastError());
1174  }
1175  if (lpszTemp) {
1176  LocalFree((HLOCAL)lpszTemp);
1177  }
1178  return lpszBuf;
1179 }
1180 
1182 {
1183  DWORD dwExitCodeThread = 0;
1184 
1185  if (*hThread != NULL) {
1186  PostThreadMessage(dwThread,WM_QUIT,0,0);
1187  for (;;) {
1188  MSG msg;
1189 
1191  break;
1192  while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
1194  DispatchMessage(&msg);
1195  }
1196  }
1197  GetExitCodeThread(*hThread, &dwExitCodeThread);
1198  CloseHandle(*hThread);
1199  *hThread = NULL;
1200  }
1201  return dwExitCodeThread;
1202 }
1203 
void ApplicationPage_OnWindowsCascade(void)
Definition: applpage.c:812
INT_PTR CALLBACK ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: applpage.c:104
#define IDS_MENU_DETAILS
Definition: resource.h:234
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HINSTANCE hInst
Definition: taskmgr.c:35
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define ID_SHUTDOWN_SWITCHUSER
Definition: resource.h:190
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
#define STATUS_SIZE3
Definition: taskmgr.h:51
void ProcessPage_OnProperties(void)
Definition: procpage.c:1193
#define HRESULT
Definition: msvc.h:7
#define IDR_WINDOWSMENU
Definition: resource.h:16
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
#define DispatchMessage
Definition: winuser.h:5755
#define COLOR_3DHILIGHT
Definition: winuser.h:931
BOOL WINAPI TranslateMessage(_In_ const MSG *)
Definition: tftpd.h:59
#define REALTIME_PRIORITY_CLASS
Definition: winbase.h:184
#define ID_VIEW_DETAILS
Definition: resource.h:36
#define PeekMessage
Definition: winuser.h:5820
#define IDR_TRAY_POPUP
Definition: resource.h:22
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:598
HWND hApplicationPage
Definition: applpage.c:35
#define COLUMN_NMAX
Definition: column.h:51
#define ID_OPTIONS_HIDEWHENMINIMIZED
Definition: resource.h:140
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
#define PAGE_OFFSET_LEFT
BOOL WINAPI DrawMenuBar(_In_ HWND)
#define IDS_MENU_SHOWKERNELTIMES
Definition: resource.h:238
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
BOOL WINAPI ModifyMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define IDD_TASKMGR_DIALOG
Definition: resource.h:4
#define ID_RESTORE
Definition: resource.h:168
#define MF_BYCOMMAND
Definition: winuser.h:202
struct _WINDOWPLACEMENT WINDOWPLACEMENT
#define FindWindow
Definition: winuser.h:5767
#define SC_RESTORE
Definition: winuser.h:2588
#define PROCESS_ALL_ACCESS
Definition: nt_native.h:1324
#define ERROR_SUCCESS
Definition: deptool.c:10
void OnAbout(void)
Definition: about.c:25
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define IDS_MENU_ONEGRAPHALLCPUS
Definition: resource.h:235
#define IDC_TAB
Definition: resource.h:12
void OnMove(WPARAM nType, int cx, int cy)
Definition: taskmgr.c:785
BOOL WINAPI InsertMenuW(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define STATUS_SIZE2
Definition: taskmgr.h:50
void Draw3dRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight)
Definition: taskmgr.c:552
#define ID_PROCESS_PAGE_SETPRIORITY_NORMAL
Definition: resource.h:179
HDC WINAPI GetDC(_In_opt_ HWND)
#define REG_BINARY
Definition: nt_native.h:1496
#define KEY_READ
Definition: nt_native.h:1023
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
#define SW_HIDE
Definition: winuser.h:762
void TaskManager_OnViewUpdateSpeed(DWORD dwSpeed)
Definition: taskmgr.c:990
#define LANG_NEUTRAL
Definition: nls.h:22
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define HKEY_CURRENT_USER
Definition: winreg.h:11
void ProcessPage_OnEndProcessTree(void)
Definition: endproc.c:161
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:421
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
HWND hTabWnd
Definition: taskmgr.c:39
#define ID_OPTIONS_ALWAYSONTOP
Definition: resource.h:138
#define SUBLANG_DEFAULT
Definition: nls.h:168
#define ID_SHUTDOWN_POWEROFF
Definition: resource.h:187
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
#define ID_SHUTDOWN_DISCONNECT
Definition: resource.h:192
void DoSetPriority(DWORD priority)
Definition: priority.c:26
static HDC
Definition: imagelist.c:92
#define ID_APPLICATION_PAGE_GOTOPROCESS
Definition: resource.h:170
#define CALLBACK
Definition: compat.h:35
#define MF_STRING
Definition: winuser.h:138
HWND hWnd
Definition: settings.c:17
#define WM_QUIT
Definition: winuser.h:1613
BOOL HideWhenMinimized
Definition: taskmgr.h:68
VOID ShutDown_LogOffUser(VOID)
Definition: shutdown.c:170
LONG top
Definition: windef.h:307
BOOL PerfDataInitialize(void)
Definition: perfdata.c:64
#define ID_HELP_TOPICS
Definition: resource.h:155
#define ID_VIEW_UPDATESPEED_HIGH
Definition: resource.h:145
HANDLE HWND
Definition: compat.h:19
BOOL WINAPI SetPriorityClass(IN HANDLE hProcess, IN DWORD dwPriorityClass)
Definition: proc.c:1693
$ULONG PrivilegeCount
Definition: setypes.h:1019
int ColumnSizeArray[COLUMN_NMAX]
Definition: taskmgr.h:82
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define WM_MOVE
Definition: winuser.h:1600
VOID ShutDown_PowerOff(VOID)
Definition: shutdown.c:115
#define GWL_EXSTYLE
Definition: winuser.h:845
#define HWND_TOPMOST
Definition: winuser.h:1198
#define HWND_TOP
Definition: winuser.h:1197
BOOL OnCreate(HWND hWnd)
Definition: taskmgr.c:582
void PerformancePage_OnViewCPUHistoryOneGraphPerCPU(void)
Definition: perfpage.c:520
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int nMinimumHeight
Definition: taskmgr.c:44
#define ID_WINDOWS_MAXIMIZE
Definition: resource.h:152
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WMSZ_TOP
Definition: winuser.h:2456
#define TabCtrl_GetCurSel(hwnd)
Definition: commctrl.h:4063
VOID ShutDown_EjectComputer(VOID)
Definition: shutdown.c:194
UINT_PTR WPARAM
Definition: windef.h:207
#define WPF_RESTORETOMAXIMIZED
Definition: winuser.h:2522
#define ID_OPTIONS_SHOW16BITTASKS
Definition: resource.h:158
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
Definition: taskmgr.c:109
#define WS_CHILD
Definition: pedump.c:617
#define TCIF_TEXT
Definition: commctrl.h:3971
#define ID_PROCESS_PAGE_SETPRIORITY_HIGH
Definition: resource.h:177
void RefreshProcessPage(void)
Definition: procpage.c:460
#define GetWindowLongPtrW
Definition: winuser.h:4819
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1237
#define NORMAL_PRIORITY_CLASS
Definition: winbase.h:181
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
int32_t INT_PTR
Definition: typedefs.h:64
void FillSolidRect2(HDC hDC, int x, int y, int cx, int cy, COLORREF clr)
Definition: taskmgr.c:540
DWORD EndLocalThread(HANDLE *hThread, DWORD dwThread)
Definition: taskmgr.c:1181
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
LONG right
Definition: windef.h:308
void PerfDataUninitialize(void)
Definition: perfdata.c:85
HWND hApplicationPageListCtrl
Definition: applpage.c:36
#define lstrlenW
Definition: compat.h:609
HWND hPerformancePage
Definition: perfpage.c:31
#define PAGE_OFFSET_HEIGHT
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
DWORD WINAPI GetSysColor(_In_ int)
void ApplicationPage_OnWindowsMinimize(void)
Definition: applpage.c:770
BOOL TrayIcon_ShellUpdateTrayIcon(void)
Definition: trayicon.c:177
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define ID_WINDOWS_TILEVERTICALLY
Definition: resource.h:150
struct tagNMHDR * LPNMHDR
#define COLOR_3DSHADOW
Definition: winuser.h:925
static void SetUpdateSpeed(HWND hWnd)
Definition: taskmgr.c:566
HWND hStatusWnd
Definition: taskmgr.c:38
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define ID_PROCESS_PAGE_ENDPROCESS
Definition: resource.h:172
#define WMSZ_TOPLEFT
Definition: winuser.h:2457
#define ABOVE_NORMAL_PRIORITY_CLASS
Definition: winbase.h:191
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
#define ID_SHUTDOWN_HIBERNATE
Definition: resource.h:186
BOOL WINAPI SetProcessShutdownParameters(IN DWORD dwLevel, IN DWORD dwFlags)
Definition: proc.c:949
UINT code
Definition: winuser.h:3149
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
#define WM_NCPAINT
Definition: winuser.h:1677
BOOL WINAPI GetExitCodeThread(IN HANDLE hThread, OUT LPDWORD lpExitCode)
Definition: thread.c:541
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
void ProcessPage_OnDebug(void)
Definition: debug.c:26
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
HINSTANCE hInstance
Definition: charmap.c:20
#define L(x)
Definition: ntvdm.h:50
HRESULT(WINAPI * ETDTProc)(HWND, DWORD)
Definition: taskmgr.c:71
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
unsigned char * LPBYTE
Definition: typedefs.h:53
int WINAPI GetMenuStringW(_In_ HMENU hMenu, _In_ UINT uIDItem, _Out_writes_opt_(cchMax) LPWSTR lpString, _In_ int cchMax, _In_ UINT flags)
#define FALSE
Definition: types.h:117
#define ETO_OPAQUE
Definition: wingdi.h:647
#define UNICODE_NULL
#define ID_PROCESS_PAGE_SETPRIORITY_REALTIME
Definition: resource.h:176
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ID_OPTIONS_MINIMIZEONUSE
Definition: resource.h:139
#define ID_VIEW_CPUHISTORY_ONEGRAPHALL
Definition: resource.h:162
#define ETDT_ENABLETAB
Definition: taskmgr.c:68
#define CreateStatusWindow
Definition: commctrl.h:1933
#define WM_ENTERMENULOOP
Definition: winuser.h:1794
#define MF_BYPOSITION
Definition: winuser.h:203
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define ID_FILE_EXIT
Definition: resource.h:46
BOOL TrayIcon_ShellRemoveTrayIcon(void)
Definition: trayicon.c:159
UINT_PTR idFrom
Definition: winuser.h:3148
#define MDITILE_HORIZONTAL
Definition: winuser.h:2178
HWND hProcessPageHeaderCtrl
Definition: procpage.c:44
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_MENUSELECT
Definition: winuser.h:1737
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:416
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
int nOldWidth
Definition: taskmgr.c:46
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
#define WM_SIZING
Definition: winuser.h:1797
#define ID_HELP_ABOUT
Definition: resource.h:78
BOOL WINAPI BringWindowToTop(_In_ HWND)
const WCHAR * str
#define HIGH_PRIORITY_CLASS
Definition: winbase.h:183
#define ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU
Definition: resource.h:163
VOID ShutDown_Disconnect(VOID)
Definition: shutdown.c:189
const PresetColumnEntry ColumnPresets[COLUMN_NMAX]
Definition: column.c:31
#define WM_EXITMENULOOP
Definition: winuser.h:1795
VOID ShutDown_Hibernate(VOID)
Definition: shutdown.c:88
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
void ProcessPage_OnEndProcess(void)
Definition: endproc.c:30
#define ID_VIEW_UPDATESPEED_LOW
Definition: resource.h:147
#define ID_PROCESS_PAGE_SETAFFINITY
Definition: resource.h:175
void Draw3dRect2(HDC hDC, LPRECT lpRect, COLORREF clrTopLeft, COLORREF clrBottomRight)
Definition: taskmgr.c:560
LONG_PTR LPARAM
Definition: windef.h:208
#define LPRECT
Definition: precomp.h:28
#define ID_PROCESS_PAGE_OPENFILELOCATION
Definition: resource.h:183
void ProcessPage_OnSetAffinity(void)
Definition: affinity.c:41
#define ID_SHUTDOWN_STANDBY
Definition: resource.h:185
HANDLE hMutex
Definition: mutex.c:11
#define SW_SHOW
Definition: winuser.h:769
#define IDD_APPLICATION_PAGE
Definition: resource.h:8
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:420
#define IDD_PROCESS_PAGE
Definition: resource.h:14
BOOL WINAPI GetWindowPlacement(_In_ HWND, _Inout_ WINDOWPLACEMENT *)
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4389
#define WM_DESTROY
Definition: winuser.h:1599
#define ID_FILE_NEW
Definition: resource.h:40
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
void SaveSettings(void)
Definition: taskmgr.c:917
void ApplicationPage_OnWindowsTile(DWORD dwMode)
Definition: applpage.c:739
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define MF_CHECKED
Definition: winuser.h:132
void OnSize(WPARAM nType, int cx, int cy)
Definition: taskmgr.c:798
#define KEY_WRITE
Definition: nt_native.h:1031
#define STATUS_SIZE1
Definition: taskmgr.h:49
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4899
char TCHAR
Definition: xmlstorage.h:189
#define TCN_SELCHANGE
Definition: commctrl.h:4132
int nOldHeight
Definition: taskmgr.c:47
#define ID_VIEW_REFRESH
Definition: resource.h:59
BOOL bWasKeyboardInput
Definition: taskmgr.c:50
void ApplicationPage_OnView(DWORD dwMode)
Definition: applpage.c:725
void TaskManager_OnRestoreMainWindow(void)
Definition: taskmgr.c:931
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define FreeLibrary(x)
Definition: compat.h:607
#define ID_PROCESS_PAGE_DEBUG
Definition: resource.h:174
void RefreshApplicationPage(void)
Definition: applpage.c:241
#define IDLE_PRIORITY_CLASS
Definition: winbase.h:182
#define WAIT_OBJECT_0
Definition: winbase.h:403
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ID_SHUTDOWN_EJECT_COMPUTER
Definition: resource.h:193
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
#define TOKEN_QUERY
Definition: setypes.h:924
#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)
void ApplicationPage_OnEndTask(void)
Definition: applpage.c:888
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1601
#define MDITILE_VERTICAL
Definition: winuser.h:2179
BOOL WINAPI DeleteMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SWP_NOACTIVATE
Definition: winuser.h:1232
DWORD COLORREF
Definition: windef.h:300
BOOL WINAPI OpenIcon(_In_ HWND)
#define WM_TIMER
Definition: winuser.h:1732
void RefreshPerformancePage(void)
Definition: perfpage.c:310
BOOL bDefaults
Definition: column.h:76
#define PostThreadMessage
Definition: winuser.h:5823
#define MAX_PATH
Definition: compat.h:34
static ETDTProc fnEnableThemeDialogTexture
Definition: uxthemesupp.c:15
#define WINAPI
Definition: msvc.h:6
#define ID_VIEW_SHOWKERNELTIMES
Definition: resource.h:161
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL Columns[COLUMN_NMAX]
Definition: taskmgr.h:80
DWORD WINAPI CheckMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define SIZE_MINIMIZED
Definition: winuser.h:2496
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define ID_PROCESS_PAGE_PROPERTIES
Definition: resource.h:182
#define IDI_TASKMANAGER
Definition: resource.h:17
#define WM_PAINT
Definition: winuser.h:1610
#define ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL
Definition: resource.h:178
#define IDS_MENU_SMALLICONS
Definition: resource.h:233
BOOL ShowProcessesFromAllUsers
Definition: taskmgr.h:79
void ApplicationPage_OnGotoProcess(void)
Definition: applpage.c:912
VOID ShutDown_StandBy(VOID)
Definition: shutdown.c:61
#define IDS_MENU_ONEGRAPHPERCPU
Definition: resource.h:236
void PerfDataDeallocCommandLineCache()
Definition: perfdata.c:650
#define WM_ONTRAYICON
Definition: trayicon.h:25
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define MF_POPUP
Definition: winuser.h:136
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
HDC hdc
Definition: main.c:9
#define IDS_MENU_LARGEICONS
Definition: resource.h:232
#define SB_SETTEXT
Definition: commctrl.h:1949
#define MB_ICONERROR
Definition: winuser.h:781
#define ID_VIEW_SELECTCOLUMNS
Definition: resource.h:160
#define CreateDialogW(h, n, w, f)
Definition: winuser.h:4271
INT_PTR CALLBACK TaskManagerWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: taskmgr.c:200
GLenum GLsizei len
Definition: glext.h:6722
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1768
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define GetCurrentProcess()
Definition: compat.h:618
#define ID_VIEW_UPDATESPEED_PAUSED
Definition: resource.h:148
VOID ShutDown_LockComputer(VOID)
Definition: shutdown.c:182
void ApplicationPage_OnWindowsBringToFront(void)
Definition: applpage.c:841
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
void PerformancePage_OnViewShowKernelTimes(void)
Definition: perfpage.c:480
#define WM_COMMAND
Definition: winuser.h:1730
#define IDS_MENU_CPUHISTORY
Definition: resource.h:237
HWND hwndFrom
Definition: winuser.h:3147
INT_PTR CALLBACK PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: perfpage.c:113
#define MF_UNCHECKED
Definition: winuser.h:204
#define NM_CLICK
Definition: commctrl.h:130
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)
void PerformancePage_OnViewCPUHistoryOneGraphAll(void)
Definition: perfpage.c:506
#define ID_VIEW_SMALL
Definition: resource.h:34
VOID ShowWin32Error(DWORD dwError)
Definition: taskmgr.c:1139
BOOL bInMenuLoop
Definition: taskmgr.c:49
void TaskManager_OnEnterMenuLoop(HWND hWnd)
Definition: taskmgr.c:945
BOOL WINAPI DestroyMenu(_In_ HMENU)
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
#define IDS_MENU_WINDOWS
Definition: resource.h:231
#define ID_WINDOWS_CASCADE
Definition: resource.h:153
#define SWP_NOSIZE
Definition: winuser.h:1235
void LoadSettings(void)
Definition: taskmgr.c:854
static HDC hDC
Definition: 3dtext.c:33
HMENU hWindowMenu
Definition: taskmgr.c:41
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
VOID ShutDown_SwitchUser(VOID)
Definition: shutdown.c:177
#define IDS_TAB_PERFORMANCE
Definition: resource.h:199
#define IDS_MENU_16BITTASK
Definition: resource.h:230
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
#define SHUTDOWN_NORETRY
Definition: winbase.h:445
#define IDD_PERFORMANCE_PAGE
Definition: resource.h:15
void TaskManager_OnTabWndSelChange(void)
Definition: taskmgr.c:1008
static ATOM item
Definition: dde.c:856
#define IDS_TAB_PROCESSES
Definition: resource.h:198
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
FxAutoRegKey hKey
void ApplicationPage_OnWindowsMaximize(void)
Definition: applpage.c:791
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void TaskManager_OnOptionsAlwaysOnTop(void)
Definition: optnmenu.c:31
void TaskManager_OnFileNew(void)
Definition: run.c:26
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
#define ID_PROCESS_PAGE_ENDPROCESSTREE
Definition: resource.h:173
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142
LPWSTR GetLastErrorText(LPWSTR lpszBuf, DWORD dwSize)
Definition: taskmgr.c:1155
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsZoomed(_In_ HWND)
#define NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
#define ID_WINDOWS_MINIMIZE
Definition: resource.h:151
BOOL TrayIcon_ShellAddTrayIcon(void)
Definition: trayicon.c:129
#define MB_OK
Definition: winuser.h:784
HWND hProcessPage
Definition: procpage.c:41
#define IDS_APP_TITLE
Definition: resource.h:10
#define SWP_SHOWWINDOW
Definition: winuser.h:1238
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define SB_SETPARTS
Definition: commctrl.h:1954
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
HANDLE hThread
Definition: wizard.c:28
BOOL WINAPI SetMenuDefaultItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define ID_APPLICATION_PAGE_ENDTASK
Definition: resource.h:169
#define PAGE_OFFSET_WIDTH
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:1020
HMENU WINAPI CreatePopupMenu(void)
Definition: menu.c:846
RECT rcNormalPosition
Definition: winuser.h:3285
#define msg(x)
Definition: auth_time.c:54
int nMinimumWidth
Definition: taskmgr.c:43
_Out_opt_ int * cx
Definition: commctrl.h:585
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define TabCtrl_InsertItem(hwnd, iItem, pitem)
Definition: commctrl.h:4051
#define SendMessage
Definition: winuser.h:5833
DWORD dwNumberOfProcessors
Definition: winbase.h:1162
void TaskManager_OnOptionsShow16BitTasks(void)
Definition: optnmenu.c:103
#define ID_SHUTDOWN_LOCKCOMPUTER
Definition: resource.h:191
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
void ProcessPage_OnOpenFileLocation(void)
Definition: procpage.c:1232
#define BELOW_NORMAL_PRIORITY_CLASS
Definition: winbase.h:190
#define HIWORD(l)
Definition: typedefs.h:247
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define MAKELANGID(p, s)
Definition: nls.h:15
BOOL EnableDialogTheme(HWND hwnd)
Definition: taskmgr.c:76
BOOL WINAPI SetForegroundWindow(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
LONG bottom
Definition: windef.h:309
#define SE_DEBUG_NAME
Definition: winnt_old.h:385
TASKMANAGER_SETTINGS TaskManagerSettings
Definition: taskmgr.c:52
#define GetProcAddress(x, y)
Definition: compat.h:612
VOID ShutDown_Reboot(VOID)
Definition: shutdown.c:143
#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 HWND_NOTOPMOST
Definition: winuser.h:1196
#define IDS_MENU_SELECTCOLUMNS
Definition: resource.h:229
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
int ColumnOrderArray[COLUMN_NMAX]
Definition: taskmgr.h:81
#define ID_WINDOWS_BRINGTOFRONT
Definition: resource.h:154
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define PM_REMOVE
Definition: winuser.h:1186
#define TCITEM
Definition: commctrl.h:4029
#define MF_GRAYED
Definition: winuser.h:129
void ProcessPage_OnViewSelectColumns(void)
Definition: column.c:145
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4022
#define IDS_TAB_APPS
Definition: resource.h:197
#define WS_VISIBLE
Definition: pedump.c:620
#define ID_WINDOWS_TILEHORIZONTALLY
Definition: resource.h:149
#define memset(x, y, z)
Definition: compat.h:39
HWND hProcessPageListCtrl
Definition: procpage.c:43
#define ID_VIEW_UPDATESPEED_NORMAL
Definition: resource.h:146
HMENU WINAPI GetMenu(_In_ HWND)
#define SW_MAXIMIZE
Definition: winuser.h:766
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:926
#define ID_APPLICATION_PAGE_SWITCHTO
Definition: resource.h:165
INT_PTR CALLBACK ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: procpage.c:136
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define ID_SHUTDOWN_REBOOT
Definition: resource.h:188
HWND hMainWnd
Definition: taskmgr.c:37
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
BOOL CPUHistory_OneGraphPerCPU
Definition: taskmgr.h:87
void FillSolidRect(HDC hDC, LPCRECT lpRect, COLORREF clr)
Definition: taskmgr.c:534
#define SBT_NOBORDERS
Definition: commctrl.h:1971
#define LOWORD(l)
Definition: pedump.c:82
#define TCN_KEYDOWN
Definition: commctrl.h:4118
#define HeapFree(x, y, z)
Definition: compat.h:594
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define LoadString
Definition: winuser.h:5809
void TaskManager_OnOptionsMinimizeOnUse(void)
Definition: optnmenu.c:57
#define ID_PROCESS_PAGE_SETPRIORITY_LOW
Definition: resource.h:181
void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu)
Definition: taskmgr.c:974
#define WMSZ_LEFT
Definition: winuser.h:2454
#define WM_NOTIFY
Definition: richedit.h:61
#define WMSZ_TOPRIGHT
Definition: winuser.h:2458
#define WMSZ_BOTTOMLEFT
Definition: winuser.h:2460
#define APIENTRY
Definition: api.h:79
#define STATUS_WINDOW
Definition: taskmgr.c:32
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158
#define ICON_BIG
Definition: tnclass.cpp:51
#define ID_VIEW_LARGE
Definition: resource.h:33
#define PAGE_OFFSET_TOP
void PerfDataRefresh(void)
Definition: perfdata.c:175
#define ID_SHUTDOWN_LOGOFF
Definition: resource.h:189
void TaskManager_OnExitMenuLoop(HWND hWnd)
Definition: taskmgr.c:956
#define TabCtrl_SetCurFocus(hwnd, i)
Definition: commctrl.h:4102
#define SWP_NOOWNERZORDER
Definition: winuser.h:1239
int * LPINT
Definition: windef.h:178
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
void TaskManager_OnOptionsHideWhenMinimized(void)
Definition: optnmenu.c:80
void ApplicationPage_OnSwitchTo(void)
Definition: applpage.c:863