25 typedef struct _CHOOSE_PROCESS_DIALOG_CONTEXT
44 _In_ HWND ParentWindowHandle,
51 context.Message = Message;
52 context.ProcessId = NULL;
62 *ProcessId = context.ProcessId;
72 static VOID PhpRefreshProcessList(
82 lvHandle = Context->ListViewHandle;
84 ListView_DeleteAllItems(lvHandle);
85 ImageList_RemoveAll(Context->ImageList);
89 PhShowStatus(hwndDlg, L
"Unable to enumerate processes", status, 0);
101 HANDLE processHandle;
132 NtClose(tokenHandle);
135 NtClose(processHandle);
155 imageIndex = ImageList_AddIcon(Context->ImageList, icon);
186 if (uMsg == WM_INITDIALOG)
195 if (uMsg == WM_DESTROY)
212 SetDlgItemText(hwndDlg,
IDC_MESSAGE, context->Message);
219 PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDOK), NULL,
221 PhAddLayoutItem(&context->LayoutManager, GetDlgItem(hwndDlg, IDCANCEL), NULL,
227 context->MinimumSize.left = 0;
228 context->MinimumSize.top = 0;
229 context->MinimumSize.right = 280;
230 context->MinimumSize.bottom = 170;
231 MapDialogRect(hwndDlg, &context->MinimumSize);
233 context->ListViewHandle = lvHandle = GetDlgItem(hwndDlg,
IDC_LIST);
243 ListView_SetImageList(lvHandle, context->ImageList, LVSIL_SMALL);
245 PhpRefreshProcessList(hwndDlg, context);
247 EnableWindow(GetDlgItem(hwndDlg, IDOK),
FALSE);
252 ImageList_Destroy(context->ImageList);
258 switch (LOWORD(wParam))
262 EndDialog(hwndDlg, IDCANCEL);
267 if (ListView_GetSelectedCount(context->ListViewHandle) == 1)
270 EndDialog(hwndDlg, IDOK);
276 PhpRefreshProcessList(hwndDlg, context);
284 LPNMHDR header = (LPNMHDR)lParam;
286 switch (header->code)
288 case LVN_ITEMCHANGED:
290 EnableWindow(GetDlgItem(hwndDlg, IDOK), ListView_GetSelectedCount(context->ListViewHandle) == 1);
295 SendMessage(hwndDlg, WM_COMMAND, IDOK, 0);
308 PhResizingMinimumSize((PRECT)lParam, wParam, context->MinimumSize.right, context->MinimumSize.bottom);