ReactOS 0.4.15-dev-8102-g108db8f
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
 

Function Documentation

◆ GetSelectedProcessId()

DWORD GetSelectedProcessId ( void  )

Definition at line 88 of file procpage.c.

89{
90 int Index;
91 LVITEM lvitem;
92
94 {
96
97 memset(&lvitem, 0, sizeof(LVITEM));
98
99 lvitem.mask = LVIF_PARAM;
100 lvitem.iItem = Index;
101
103
104 if (lvitem.lParam)
105 return ((LPPROCESS_PAGE_LIST_ITEM)lvitem.lParam)->ProcessId;
106 }
107
108 return 0;
109}
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2711
HWND hProcessPageListCtrl
Definition: procpage.c:28
#define ListView_GetSelectionMark(hwnd)
Definition: commctrl.h:2789
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
#define LVITEM
Definition: commctrl.h:2375
#define LVIF_PARAM
Definition: commctrl.h:2311
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define memset(x, y, z)
Definition: compat.h:39
_In_ WDFCOLLECTION _In_ ULONG Index

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 1220 of file procpage.c.

1221{
1222 DWORD dwProcessId;
1224 LPWSTR pszExePath;
1225 static const WCHAR szCmdFormat[] = L"/select,\"%s\"";
1226 LPWSTR pszCmdLine = NULL;
1227
1228 dwProcessId = GetSelectedProcessId();
1229
1230 /* Retrieve the image path length */
1231 dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0);
1232 if (dwLength == 0)
1233 return;
1234
1235 /* Allocate and retrieve the image path */
1236 pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1237 if (!pszExePath)
1238 return;
1239
1240 if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0)
1241 goto Cleanup;
1242
1243 /* Build the shell command line */
1244 dwLength += CONST_STR_LEN(szCmdFormat) - CONST_STR_LEN(L"%s");
1245 pszCmdLine = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1246 if (!pszCmdLine)
1247 goto Cleanup;
1248
1249 StringCchPrintfW(pszCmdLine, dwLength, szCmdFormat, pszExePath);
1250
1251 /* Call the shell to open the file location and select it. If Explorer shell
1252 * is not available, use ReactOS's alternative file browser instead. */
1253 ShellExecuteW(NULL, L"open",
1254 GetShellWindow() ? L"explorer.exe" : L"filebrowser.exe",
1255 pszCmdLine, NULL, SW_SHOWNORMAL);
1256
1257Cleanup:
1258 HeapFree(GetProcessHeap(), 0, pszCmdLine);
1259 HeapFree(GetProcessHeap(), 0, pszExePath);
1260}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static DWORD DWORD * dwLength
Definition: fusion.c:86
unsigned long DWORD
Definition: ntddk_ex.h:95
#define L(x)
Definition: ntvdm.h:50
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:1126
DWORD GetSelectedProcessId(void)
Definition: procpage.c:88
void Cleanup(void)
Definition: procpage.c:51
#define CONST_STR_LEN(str)
Definition: procpage.c:19
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2486
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
#define SW_SHOWNORMAL
Definition: winuser.h:770
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by TaskManagerWndProc().

◆ ProcessPage_OnProperties()

void ProcessPage_OnProperties ( void  )

Definition at line 1181 of file procpage.c.

1182{
1183 DWORD dwProcessId;
1185 LPWSTR pszExePath;
1186 SHELLEXECUTEINFOW info = { 0 };
1187
1188 dwProcessId = GetSelectedProcessId();
1189
1190 /* Retrieve the image path length */
1191 dwLength = GetProcessExecutablePathById(dwProcessId, NULL, 0);
1192 if (dwLength == 0)
1193 return;
1194
1195 /* Allocate and retrieve the image path */
1196 pszExePath = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
1197 if (!pszExePath)
1198 return;
1199
1200 if (GetProcessExecutablePathById(dwProcessId, pszExePath, dwLength) == 0)
1201 goto Cleanup;
1202
1203 /* Call the shell to display the file properties */
1204 info.cbSize = sizeof(SHELLEXECUTEINFOW);
1206 info.hwnd = NULL;
1207 info.lpVerb = L"properties";
1208 info.lpFile = pszExePath;
1209 info.lpParameters = L"";
1210 info.lpDirectory = NULL;
1211 info.nShow = SW_SHOW;
1212 info.hInstApp = NULL;
1213
1215
1216Cleanup:
1217 HeapFree(GetProcessHeap(), 0, pszExePath);
1218}
struct _SHELLEXECUTEINFOW SHELLEXECUTEINFOW
#define SEE_MASK_INVOKEIDLIST
Definition: shellapi.h:28
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
Definition: shlexec.cpp:2428
#define SW_SHOW
Definition: winuser.h:775

Referenced by TaskManagerWndProc().

◆ ProcessPageWndProc()

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

Definition at line 121 of file procpage.c.

122{
123 RECT rc;
124 int nXDifference;
125 int nYDifference;
126 int cx, cy;
127
128 switch (message) {
129 case WM_INITDIALOG:
130 /*
131 * Save the width and height
132 */
133 GetClientRect(hDlg, &rc);
136
137 /* Update window position */
139
140 /*
141 * Get handles to the controls
142 */
147
148 /*
149 * Set the title, and extended window styles for the list control
150 */
153
154 AddColumns();
155
156 /*
157 * Subclass the process list control so we can intercept WM_ERASEBKGND
158 */
160
161#ifdef RUN_PROC_PAGE
162 /* Start our refresh thread */
164#endif
165
166 /* Refresh page */
168
169 return TRUE;
170
171 case WM_DESTROY:
172 /* Close the event handle, this will make the */
173 /* refresh thread exit when the wait fails */
174#ifdef RUN_PROC_PAGE
176#endif
178 Cleanup();
179 break;
180
181 case WM_COMMAND:
182 /* Handle the button clicks */
183 switch (LOWORD(wParam))
184 {
185 case IDC_ENDPROCESS:
187 }
188 break;
189
190 case WM_SIZE:
191 if (wParam == SIZE_MINIMIZED)
192 return 0;
193
194 cx = LOWORD(lParam);
195 cy = HIWORD(lParam);
196 nXDifference = cx - nProcessPageWidth;
197 nYDifference = cy - nProcessPageHeight;
200
201 /* Reposition the application page's controls */
203 cx = (rc.right - rc.left) + nXDifference;
204 cy = (rc.bottom - rc.top) + nYDifference;
207
209 MapWindowPoints(hProcessPageEndProcessButton, hDlg, (LPPOINT)(PRECT)(&rc), sizeof(RECT)/sizeof(POINT));
210 cx = rc.left + nXDifference;
211 cy = rc.top + nYDifference;
214
217 cx = rc.left;
218 cy = rc.top + nYDifference;
221 break;
222
223 case WM_NOTIFY:
225 break;
226
227 case WM_KEYDOWN:
228 if (wParam == VK_DELETE)
230 break;
231 }
232
233 return 0;
234}
WNDPROC OldProcessListWndProc
Definition: proclist.c:12
INT_PTR CALLBACK ProcessListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Definition: proclist.c:16
#define IDC_ENDPROCESS
Definition: resource.h:41
#define IDC_SHOWALLPROCESSES
Definition: resource.h:46
#define IDC_PROCESSLIST
Definition: resource.h:42
void SaveColumnSettings(void)
Definition: column.c:90
void AddColumns(void)
Definition: column.c:48
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
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
void ProcessPage_OnEndProcess(void)
Definition: endproc.c:15
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
Definition: procpage.c:457
static DWORD dwProcessThread
Definition: procpage.c:38
static HWND hProcessPageEndProcessButton
Definition: procpage.c:30
static HWND hProcessPageShowAllProcessesButton
Definition: procpage.c:31
static HANDLE hProcessThread
Definition: procpage.c:37
static int nProcessPageHeight
Definition: procpage.c:35
static int nProcessPageWidth
Definition: procpage.c:34
void ProcessPageUpdate(void)
Definition: procpage.c:111
HWND hProcessPageHeaderCtrl
Definition: procpage.c:29
void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
Definition: procpage.c:236
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define ListView_GetHeader(hwnd)
Definition: commctrl.h:2651
#define LVS_EX_HEADERDRAGDROP
Definition: commctrl.h:2733
_Out_opt_ int * cx
Definition: commctrl.h:585
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define ListView_SetExtendedListViewStyle(hwndLV, dw)
Definition: commctrl.h:2725
#define ListView_GetExtendedListViewStyle(hwndLV)
Definition: commctrl.h:2728
#define WM_NOTIFY
Definition: richedit.h:61
Definition: tftpd.h:60
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
DWORD EndLocalThread(HANDLE *hThread, DWORD dwThread)
Definition: taskmgr.c:1109
#define GWLP_WNDPROC
Definition: treelist.c:66
#define HIWORD(l)
Definition: typedefs.h:247
#define SWP_NOACTIVATE
Definition: winuser.h:1242
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 WM_SIZE
Definition: winuser.h:1611
#define SWP_NOMOVE
Definition: winuser.h:1244
#define WM_COMMAND
Definition: winuser.h:1740
#define SWP_NOSIZE
Definition: winuser.h:1245
#define SIZE_MINIMIZED
Definition: winuser.h:2506
#define WM_INITDIALOG
Definition: winuser.h:1739
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define SWP_NOOWNERZORDER
Definition: winuser.h:1249
#define VK_DELETE
Definition: winuser.h:2233
#define WM_DESTROY
Definition: winuser.h:1609
#define WM_KEYDOWN
Definition: winuser.h:1715
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2906
#define SWP_NOZORDER
Definition: winuser.h:1247
#define SetWindowLongPtrW
Definition: winuser.h:5346

Referenced by OnCreate().

◆ RefreshProcessPage()

void RefreshProcessPage ( void  )

Definition at line 448 of file procpage.c.

449{
450#ifdef RUN_PROC_PAGE
451 /* Signal the event so that our refresh thread */
452 /* will wake up and refresh the process page */
454#endif
455}
#define PostThreadMessage
Definition: winuser.h:5833
#define WM_TIMER
Definition: winuser.h:1742

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

Variable Documentation

◆ hProcessPage

HWND hProcessPage
extern

◆ hProcessPageHeaderCtrl

◆ hProcessPageListCtrl