ReactOS  0.4.15-dev-5142-g967f5b9
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 103 of file procpage.c.

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

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

◆ ProcessPage_OnOpenFileLocation()

void ProcessPage_OnOpenFileLocation ( void  )

Definition at line 1232 of file procpage.c.

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

1194 {
1195  DWORD dwProcessId;
1196  DWORD dwLength;
1197  LPWSTR pszExePath;
1198  SHELLEXECUTEINFOW info = { 0 };
1199 
1200  dwProcessId = GetSelectedProcessId();
1201 
1202  /* Retrieve the image path length */
1203  dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0);
1204  if (dwLength == 0)
1205  return;
1206 
1207  /* Allocate and retrieve the image path */
1208  pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1209  if (!pszExePath)
1210  return;
1211 
1212  if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0)
1213  goto Cleanup;
1214 
1215  /* Call the shell to display the file properties */
1216  info.cbSize = sizeof(SHELLEXECUTEINFOW);
1217  info.fMask = SEE_MASK_INVOKEIDLIST;
1218  info.hwnd = NULL;
1219  info.lpVerb = L"properties";
1220  info.lpFile = pszExePath;
1221  info.lpParameters = L"";
1222  info.lpDirectory = NULL;
1223  info.nShow = SW_SHOW;
1224  info.hInstApp = NULL;
1225 
1227 
1228 Cleanup:
1229  HeapFree(GetProcessHeap(), 0, pszExePath);
1230 }
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:1138
DWORD GetSelectedProcessId(void)
Definition: procpage.c:103
void Cleanup(void)
Definition: procpage.c:66
#define L(x)
Definition: ntvdm.h:50
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp: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
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
struct _SHELLEXECUTEINFOW SHELLEXECUTEINFOW
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by TaskManagerWndProc().

◆ ProcessPageWndProc()

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

Definition at line 136 of file procpage.c.

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

Referenced by OnCreate().

◆ RefreshProcessPage()

void RefreshProcessPage ( void  )

Definition at line 460 of file procpage.c.

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

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

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().