ReactOS  0.4.15-dev-4594-g505ac65
procpage.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

INT_PTR CALLBACK ProcessPageWndProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 
void RefreshProcessPage (void)
 
DWORD GetSelectedProcessId (void)
 
void ProcessPage_OnProperties (void)
 
void ProcessPage_OnOpenFileLocation (void)
 

Variables

HWND hProcessPage
 
HWND hProcessPageListCtrl
 
HWND hProcessPageHeaderCtrl
 
HWND hProcessPageEndProcessButton
 
HWND hProcessPageShowAllProcessesButton
 

Function Documentation

◆ GetSelectedProcessId()

DWORD GetSelectedProcessId ( void  )

Definition at line 104 of file procpage.c.

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 }
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
_In_ WDFCOLLECTION _In_ ULONG Index
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVITEM
Definition: commctrl.h:2375
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2789
#define memset(x, y, z)
Definition: compat.h:39
HWND hProcessPageListCtrl
Definition: procpage.c:43

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

◆ ProcessPage_OnOpenFileLocation()

void ProcessPage_OnOpenFileLocation ( void  )

Definition at line 1160 of file procpage.c.

1161 {
1162  DWORD dwProcessId;
1164  LPWSTR pszPath = NULL;
1165  LPWSTR pszExePath = NULL;
1166  LPWSTR pszCmdLine = NULL;
1167  DWORD dwLength;
1168 
1169  dwProcessId = GetSelectedProcessId();
1171 
1172  if (dwLength == 0)
1173  {
1174  return;
1175  }
1176  else if (dwLength > _countof(szPath))
1177  {
1178  pszPath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1179 
1180  if (!pszPath)
1181  {
1182  return;
1183  }
1184 
1185  if (GetProcessExecutablePathById(dwProcessId, pszPath, dwLength) == 0)
1186  {
1187  goto Cleanup;
1188  }
1189 
1190  pszExePath = pszPath;
1191  }
1192  else
1193  {
1194  pszExePath = szPath;
1195  dwLength += 1;
1196  }
1197 
1198  pszCmdLine = HeapAlloc(GetProcessHeap(), 0, (dwLength + 10) * sizeof(WCHAR));
1199 
1200  if (!pszCmdLine)
1201  {
1202  goto Cleanup;
1203  }
1204 
1205  StringCchPrintfW(pszCmdLine, dwLength + 10, L"/select,\"%s\"", pszExePath);
1206 
1207  /* Open file explorer and select the exe file */
1208  ShellExecuteW(NULL, L"open", L"explorer.exe", pszCmdLine, NULL, SW_SHOWNORMAL);
1209 
1210  HeapFree(GetProcessHeap(), 0, pszCmdLine);
1211 
1212 Cleanup:
1213 
1214  if (pszPath)
1215  {
1216  HeapFree(GetProcessHeap(), 0, pszPath);
1217  }
1218 }
DWORD GetSelectedProcessId(void)
Definition: procpage.c:104
void Cleanup(void)
Definition: procpage.c:67
#define L(x)
Definition: ntvdm.h:50
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD GetProcessExecutablePathById(DWORD dwProcessId, LPWSTR lpExePath, DWORD dwLength)
Definition: procpage.c:1056
#define SW_SHOWNORMAL
Definition: winuser.h:764
LPCWSTR szPath
Definition: env.c:37
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
#define NULL
Definition: types.h:112
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2354
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by TaskManagerWndProc().

◆ ProcessPage_OnProperties()

void ProcessPage_OnProperties ( void  )

Definition at line 1103 of file procpage.c.

1104 {
1105  DWORD dwProcessId;
1107  LPWSTR pszPath = NULL;
1108  LPWSTR pszExePath = NULL;
1109  DWORD dwLength;
1110  SHELLEXECUTEINFOW info = { 0 };
1111 
1112  dwProcessId = GetSelectedProcessId();
1114 
1115  if (dwLength == 0)
1116  {
1117  return;
1118  }
1119  else if (dwLength > _countof(szPath))
1120  {
1121  pszPath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1122 
1123  if (!pszPath)
1124  {
1125  return;
1126  }
1127 
1128  if (GetProcessExecutablePathById(dwProcessId, pszPath, dwLength) == 0)
1129  {
1130  goto Cleanup;
1131  }
1132 
1133  pszExePath = pszPath;
1134  }
1135  else
1136  {
1137  pszExePath = szPath;
1138  }
1139 
1140  info.cbSize = sizeof(SHELLEXECUTEINFOW);
1141  info.fMask = SEE_MASK_INVOKEIDLIST;
1142  info.hwnd = NULL;
1143  info.lpVerb = L"properties";
1144  info.lpFile = pszExePath;
1145  info.lpParameters = L"";
1146  info.lpDirectory = NULL;
1147  info.nShow = SW_SHOW;
1148  info.hInstApp = NULL;
1149 
1151 
1152 Cleanup:
1153 
1154  if (pszPath)
1155  {
1156  HeapFree(GetProcessHeap(), 0, pszPath);
1157  }
1158 }
DWORD GetSelectedProcessId(void)
Definition: procpage.c:104
void Cleanup(void)
Definition: procpage.c:67
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2343
#define SW_SHOW
Definition: winuser.h:769
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static DWORD DWORD * dwLength
Definition: fusion.c:85
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD GetProcessExecutablePathById(DWORD dwProcessId, LPWSTR lpExePath, DWORD dwLength)
Definition: procpage.c:1056
LPCWSTR szPath
Definition: env.c:37
#define NULL
Definition: types.h:112
struct _SHELLEXECUTEINFOW SHELLEXECUTEINFOW
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by TaskManagerWndProc().

◆ ProcessPageWndProc()

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

Definition at line 137 of file procpage.c.

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 }
INT_PTR CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: proclist.c:31
Definition: tftpd.h:59
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static int nProcessPageWidth
Definition: procpage.c:49
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define IDC_PROCESSLIST
Definition: resource.h:37
HWND hProcessPageEndProcessButton
Definition: procpage.c:45
#define TRUE
Definition: types.h:120
#define IDC_SHOWALLPROCESSES
Definition: resource.h:41
#define ListView_GetHeader(hwnd)
Definition: commctrl.h:2651
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
LONG top
Definition: windef.h:307
static DWORD dwProcessThread
Definition: procpage.c:53
HWND hProcessPageShowAllProcessesButton
Definition: procpage.c:46
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
LONG left
Definition: windef.h:306
#define SWP_NOZORDER
Definition: winuser.h:1237
DWORD EndLocalThread(HANDLE *hThread, DWORD dwThread)
Definition: taskmgr.c:1181
LONG right
Definition: windef.h:308
static int nProcessPageHeight
Definition: procpage.c:50
WPARAM wParam
Definition: combotst.c:138
void Cleanup(void)
Definition: procpage.c:67
#define L(x)
Definition: ntvdm.h:50
#define ListView_GetExtendedListViewStyle(hwndLV)
Definition: commctrl.h:2728
HWND hProcessPageHeaderCtrl
Definition: procpage.c:44
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:585
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2733
void SaveColumnSettings(void)
Definition: column.c:105
void ProcessPage_OnEndProcess(void)
Definition: endproc.c:30
#define WM_KEYDOWN
Definition: winuser.h:1702
#define VK_DELETE
Definition: winuser.h:2213
#define WM_DESTROY
Definition: winuser.h:1596
#define IDC_ENDPROCESS
Definition: resource.h:36
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_SIZE
Definition: winuser.h:1598
#define SWP_NOACTIVATE
Definition: winuser.h:1232
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define SIZE_MINIMIZED
Definition: winuser.h:2486
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
Definition: procpage.c:252
#define WM_COMMAND
Definition: winuser.h:1727
#define GWLP_WNDPROC
Definition: treelist.c:66
WNDPROC OldProcessListWndProc
Definition: proclist.c:27
#define SWP_NOSIZE
Definition: winuser.h:1235
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2886
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
Definition: procpage.c:422
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
void ProcessPageUpdate(void)
Definition: procpage.c:127
static HANDLE hProcessThread
Definition: procpage.c:52
_Out_opt_ int * cx
Definition: commctrl.h:585
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define SWP_NOMOVE
Definition: winuser.h:1234
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SetWindowLongPtrW
Definition: winuser.h:5326
HWND hProcessPageListCtrl
Definition: procpage.c:43
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
void AddColumns(void)
Definition: column.c:63
#define SWP_NOOWNERZORDER
Definition: winuser.h:1239

Referenced by OnCreate().

◆ RefreshProcessPage()

void RefreshProcessPage ( void  )

Definition at line 413 of file procpage.c.

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 }
static DWORD dwProcessThread
Definition: procpage.c:53
#define WM_TIMER
Definition: winuser.h:1729
#define PostThreadMessage
Definition: winuser.h:5813

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

Variable Documentation

◆ hProcessPage

HWND hProcessPage

◆ hProcessPageEndProcessButton

HWND hProcessPageEndProcessButton

Definition at line 45 of file procpage.c.

Referenced by ProcessPageUpdate(), and ProcessPageWndProc().

◆ hProcessPageHeaderCtrl

◆ hProcessPageListCtrl

◆ hProcessPageShowAllProcessesButton

HWND hProcessPageShowAllProcessesButton

Definition at line 46 of file procpage.c.

Referenced by ProcessPageWndProc().