ReactOS  0.4.12-dev-43-g63b00d8
mainwnd.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Services
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: base/applications/mscutils/servman/mainwnd.c
5  * PURPOSE: Main window message handler
6  * COPYRIGHT: Copyright 2006-2017 Ged Murphy <gedmurphy@reactos.org>
7  *
8  */
9 
10 #include "precomp.h"
11 
12 #include <windowsx.h>
13 
14 static const WCHAR szMainWndClass[] = L"ServManWndClass";
15 
16 /* Toolbar buttons */
17 static const TBBUTTON Buttons [] =
18 { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
19  {TBICON_PROP, ID_PROP, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0}, /* properties */
20  {TBICON_REFRESH, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* refresh */
21  {TBICON_EXPORT, ID_EXPORT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* export */
22 
23  /* Note: First item for a separator is its width in pixels */
24  {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
25 
26  {TBICON_CREATE, ID_CREATE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* create */
27  {TBICON_DELETE, ID_DELETE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* delete */
28 
29  {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
30 
31  {TBICON_START, ID_START, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* start */
32  {TBICON_STOP, ID_STOP, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* stop */
33  {TBICON_PAUSE, ID_PAUSE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* pause */
34  {TBICON_RESTART, ID_RESTART, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* restart */
35 };
36 
37 
38 /* menu hints */
39 static const MENU_HINT MainMenuHintTable[] = {
40  /* File Menu */
43 
44  /* Action Menu */
56 
57  /* View menu */
63 
64  /* Help Menu */
67 };
68 /* system menu hints */
69 static const MENU_HINT SystemMenuHintTable[] = {
76 };
77 
78 
79 static BOOL
81  WORD CmdId,
82  const MENU_HINT *HintArray,
83  DWORD HintsCount,
84  UINT DefHintId)
85 {
86  BOOL Found = FALSE;
87  const MENU_HINT *LastHint;
88  UINT HintId = DefHintId;
89 
90  LastHint = HintArray + HintsCount;
91  while (HintArray != LastHint)
92  {
93  if (HintArray->CmdId == CmdId)
94  {
95  HintId = HintArray->HintId;
96  Found = TRUE;
97  break;
98  }
99  HintArray++;
100  }
101 
103  SB_SIMPLEID,
104  hInstance,
105  HintId);
106 
107  return Found;
108 }
109 
110 
111 static VOID
113 {
114  if (Info->hStatus != NULL)
115  {
116  SendMessage(Info->hStatus,
117  SB_SIMPLE,
118  (WPARAM)Info->bInMenuLoop,
119  0);
120  }
121 }
122 
123 VOID
125 {
126  LPWSTR lpNumServices;
127 
128  if (AllocAndLoadString(&lpNumServices,
129  hInstance,
131  {
132  WCHAR szNumServices[32];
133 
134  INT NumListedServ = ListView_GetItemCount(Info->hListView);
135 
136  _snwprintf(szNumServices,
137  31,
138  lpNumServices,
139  NumListedServ);
140 
141  SendMessage(Info->hStatus,
142  SB_SETTEXT,
143  0,
144  (LPARAM)szNumServices);
145 
146  LocalFree(lpNumServices);
147  }
148 }
149 
150 
152 {
154  UINT i;
155 
156  /* get handle to menu */
157  hMainMenu = GetMenu(Info->hMainWnd);
158 
159  /* set all to greyed */
160  for (i = ID_START; i <= ID_RESTART; i++)
161  {
162  EnableMenuItem(hMainMenu, i, MF_GRAYED);
164  SendMessage(Info->hTool, TB_SETSTATE, i,
166  }
167 
168  if (Info->SelectedItem != NO_ITEM_SELECTED)
169  {
170  LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL;
171  DWORD Flags, State;
172 
173  /* allow user to delete service */
174  if (Info->bIsUserAnAdmin)
175  {
178  EnableMenuItem(hMainMenu, ID_DELETE, MF_ENABLED);
180  }
181 
184 
185  lpServiceConfig = GetServiceConfig(Info->pCurrentService->lpServiceName);
186 
187  if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
188  {
189  if (State == SERVICE_STOPPED)
190  {
191  EnableMenuItem(hMainMenu, ID_START, MF_ENABLED);
195  }
196 
197  if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
198  {
199  EnableMenuItem(hMainMenu, ID_RESTART, MF_ENABLED);
203  }
204  }
205 
206  if(lpServiceConfig)
207  HeapFree(GetProcessHeap(), 0, lpServiceConfig);
208 
209  if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
210  {
211  EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED);
215  }
216 
217  if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
218  {
219  EnableMenuItem(hMainMenu, ID_PAUSE, MF_ENABLED);
223  }
224  }
225  else
226  {
227  /* disable tools which rely on a selected service */
228  EnableMenuItem(hMainMenu, ID_PROP, MF_GRAYED);
229  EnableMenuItem(hMainMenu, ID_DELETE, MF_GRAYED);
236  }
237 
238 }
239 
240 
241 static INT CALLBACK
242 CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
243 {
244  PMAIN_WND_INFO Info = (PMAIN_WND_INFO)lParamSort;
245  WCHAR Item1[256], Item2[256];
246 
247  ListView_GetItemText(Info->hListView, lParam1, Info->SortSelection, Item1, sizeof(Item1) / sizeof(WCHAR));
248  ListView_GetItemText(Info->hListView, lParam2, Info->SortSelection, Item2, sizeof(Item2) / sizeof(WCHAR));
249 
250  return wcscmp(Item1, Item2) * Info->SortDirection;
251 }
252 
253 
254 static BOOL
256 {
257  INT numButtons = sizeof(Buttons) / sizeof(Buttons[0]);
258 
259  Info->hTool = CreateWindowEx(0,
261  NULL,
263  0, 0, 0, 0,
264  Info->hMainWnd,
265  0,
266  hInstance,
267  NULL);
268  if(Info->hTool != NULL)
269  {
270  HIMAGELIST hImageList;
271 
272  SendMessage(Info->hTool,
274  0,
276 
277  SendMessage(Info->hTool,
279  sizeof(Buttons[0]),
280  0);
281 
282  hImageList = InitImageList(IDB_PROP,
283  IDB_RESTART,
286  IMAGE_BITMAP);
287  if (hImageList == NULL)
288  return FALSE;
289 
292  0,
293  (LPARAM)hImageList));
294 
295  SendMessage(Info->hTool,
297  numButtons,
298  (LPARAM)Buttons);
299 
300  return TRUE;
301  }
302 
303  return FALSE;
304 }
305 
306 static BOOL
308 {
309  INT StatWidths[] = {130, -1}; /* widths of status bar */
310 
311  Info->hStatus = CreateWindowEx(0,
313  NULL,
315  0, 0, 0, 0,
316  Info->hMainWnd,
318  hInstance,
319  NULL);
320  if(Info->hStatus == NULL)
321  return FALSE;
322 
323  SendMessage(Info->hStatus,
324  SB_SETPARTS,
325  sizeof(StatWidths) / sizeof(INT),
326  (LPARAM)StatWidths);
327 
328  return TRUE;
329 }
330 
331 
332 static BOOL
334 {
335  if (!pCreateToolbar(Info))
336  {
337  DisplayString(L"error creating toolbar");
338  return FALSE;
339  }
340 
341  if (!CreateListView(Info))
342  {
343  DisplayString(L"error creating list view");
344  return FALSE;
345  }
346 
347  if (!CreateStatusBar(Info))
348  DisplayString(L"error creating status bar");
349 
350  /* Create Popup Menu */
353 
354  Info->bIsUserAnAdmin = TRUE;// IsUserAnAdmin();
355  if (Info->bIsUserAnAdmin)
356  {
357  HMENU hMainMenu = GetMenu(Info->hMainWnd);
358 
359  SendMessage(Info->hTool,
360  TB_SETSTATE,
361  ID_CREATE,
363  if (hMainMenu)
364  {
365  EnableMenuItem(hMainMenu,
366  ID_CREATE,
367  MF_ENABLED);
368  }
370  ID_CREATE,
371  MF_ENABLED);
372  }
373 
374  return TRUE;
375 }
376 
377 
378 static VOID
380  WORD CmdId,
381  HWND hControl)
382 {
383  UNREFERENCED_PARAMETER(hControl);
384 
385  switch (CmdId)
386  {
387  case ID_PROP:
388  {
389  if (Info->SelectedItem != NO_ITEM_SELECTED)
390  {
391  Info->bDlgOpen = TRUE;
392  OpenPropSheet(Info);
393  Info->bDlgOpen = FALSE;
395  }
396  }
397  break;
398 
399  case ID_REFRESH:
400  {
401  RefreshServiceList(Info);
403 
404  /* disable menus and buttons */
406 
407  /* clear the service in the status bar */
408  SendMessage(Info->hStatus,
409  SB_SETTEXT,
410  1,
411  L'\0');
412  }
413  break;
414 
415  case ID_EXPORT:
416  {
417  ExportFile(Info);
418  SetFocus(Info->hListView);
419  }
420  break;
421 
422  case ID_CREATE:
423  {
424  INT ret;
425 
428  Info->hMainWnd,
430  (LPARAM)Info);
431  if (ret == IDOK)
432  RefreshServiceList(Info);
433 
434  SetFocus(Info->hListView);
435  }
436  break;
437 
438  case ID_DELETE:
439  {
441  {
444  Info->hMainWnd,
446  (LPARAM)Info);
447  }
448  else
449  {
450  WCHAR Buf[60];
453  Buf,
454  sizeof(Buf) / sizeof(WCHAR));
455  DisplayString(Buf);
456  }
457 
458  SetFocus(Info->hListView);
459 
460  }
461  break;
462 
463  case ID_START:
464  {
468  ACTION_START,
469  NULL); //FIXME: Add start params
470 
474  SetFocus(Info->hListView);
475 
476  }
477  break;
478 
479  case ID_STOP:
483  ACTION_STOP,
484  NULL);
485 
489  SetFocus(Info->hListView);
490 
491  break;
492 
493  case ID_PAUSE:
497  ACTION_PAUSE,
498  NULL);
499 
503  SetFocus(Info->hListView);
504  break;
505 
506  case ID_RESUME:
511  NULL);
512 
516  SetFocus(Info->hListView);
517  break;
518 
519  case ID_RESTART:
524  NULL);
525 
529  SetFocus(Info->hListView);
530  break;
531 
532  case ID_HELP:
534  L"Help is not yet implemented\n",
535  L"Note!",
537  SetFocus(Info->hListView);
538  break;
539 
540  case ID_EXIT:
541  PostMessage(Info->hMainWnd,
542  WM_CLOSE,
543  0,
544  0);
545  break;
546 
547  case ID_VIEW_LARGE:
550 
555  MF_BYCOMMAND);
556  break;
557 
558  case ID_VIEW_SMALL:
561 
566  MF_BYCOMMAND);
567  break;
568 
569  case ID_VIEW_LIST:
571  LVS_LIST);
575  ID_VIEW_LIST,
576  MF_BYCOMMAND);
577  break;
578 
579  case ID_VIEW_DETAILS:
581  LVS_REPORT);
586  MF_BYCOMMAND);
587  break;
588 
589  case ID_VIEW_CUST:
590  break;
591 
592  case ID_ABOUT:
595  Info->hMainWnd,
597  SetFocus(Info->hListView);
598  break;
599 
600  }
601 }
602 
603 
604 static VOID CALLBACK
606  WORD cx,
607  WORD cy)
608 {
609  RECT rcClient, rcTool, rcStatus;
610  int lvHeight, iToolHeight, iStatusHeight;
611 
612  /* Size toolbar and get height */
613  SendMessage(Info->hTool, TB_AUTOSIZE, 0, 0);
614  GetWindowRect(Info->hTool, &rcTool);
615  iToolHeight = rcTool.bottom - rcTool.top;
616 
617  /* Size status bar and get height */
618  SendMessage(Info->hStatus, WM_SIZE, 0, 0);
619  GetWindowRect(Info->hStatus, &rcStatus);
620  iStatusHeight = rcStatus.bottom - rcStatus.top;
621 
622  /* Calculate remaining height and size list view */
623  GetClientRect(Info->hMainWnd, &rcClient);
624  lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
625  SetWindowPos(Info->hListView,
626  NULL,
627  0,
628  iToolHeight,
629  rcClient.right,
630  lvHeight,
631  SWP_NOZORDER);
632 }
633 
634 
635 static LRESULT CALLBACK
637  UINT msg,
638  WPARAM wParam,
639  LPARAM lParam)
640 {
642  LRESULT Ret = 0;
643 
644  /* Get the window context */
645  Info = (PMAIN_WND_INFO)GetWindowLongPtr(hwnd,
646  GWLP_USERDATA);
647  if (Info == NULL && msg != WM_CREATE)
648  {
649  goto HandleDefaultMessage;
650  }
651 
652  switch(msg)
653  {
654  case WM_CREATE:
655  {
656  Info = (PMAIN_WND_INFO)(((LPCREATESTRUCT)lParam)->lpCreateParams);
657 
658  /* Initialize the main window context */
659  Info->hMainWnd = hwnd;
661 
662  SetWindowLongPtr(hwnd,
664  (LONG_PTR)Info);
665 
666  if (!InitMainWnd(Info))
667  return -1;
668 
669  /* Fill the list-view before showing the main window */
670  RefreshServiceList(Info);
671 
672  /* Show the window */
673  ShowWindow(hwnd,
674  Info->nCmdShow);
675 
676  SetFocus(Info->hListView);
677  }
678  break;
679 
680  case WM_SIZE:
681  {
682  MainWndResize(Info,
683  LOWORD(lParam),
684  HIWORD(lParam));
685  }
686  break;
687 
688  case WM_NOTIFY:
689  {
690  LPNMHDR pnmhdr = (LPNMHDR)lParam;
691 
692  switch (pnmhdr->code)
693  {
694  case NM_DBLCLK:
695  {
696  POINT pt;
697  RECT rect;
698 
699  GetCursorPos(&pt);
700  GetWindowRect(Info->hListView, &rect);
701 
702  if (PtInRect(&rect, pt))
703  {
704  SendMessage(hwnd,
705  WM_COMMAND,
706  //ID_PROP,
707  MAKEWPARAM((WORD)ID_PROP, (WORD)0),
708  0);
709  }
710 
711  //OpenPropSheet(Info);
712  }
713  break;
714 
715  case NM_RETURN:
716  {
717  SendMessage(hwnd,
718  WM_COMMAND,
719  //ID_PROP,
720  MAKEWPARAM((WORD)ID_PROP, (WORD)0),
721  0);
722  }
723  break;
724 
725  case LVN_COLUMNCLICK:
726  {
727  LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
728  HDITEM hdi;
729 
730  /* get pending sort direction for clicked column */
731  hdi.mask = HDI_LPARAM;
732  (void)Header_GetItem(Info->hHeader, pnmv->iSubItem, &hdi);
733 
734  /* get new sort parameters */
735  Info->SortSelection = pnmv->iSubItem;
736  Info->SortDirection = hdi.lParam;
737 
738  /* set new sort direction and save */
739  hdi.lParam = (hdi.lParam == ORD_ASCENDING) ?
741 
742  (void)Header_SetItem(Info->hHeader, pnmv->iSubItem, &hdi);
743 
745  CompareFunc,
746  (LPARAM)Info);
747  }
748  break;
749  case LVN_ITEMCHANGED:
750  {
751  LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
752 
753  if (pnmv->uNewState != 0)
754  {
755  ListViewSelectionChanged(Info, pnmv);
757  }
758  }
759  break;
760 
761  case TTN_GETDISPINFO:
762  {
763  LPTOOLTIPTEXT lpttt;
764  UINT idButton;
765 
766  lpttt = (LPTOOLTIPTEXT)lParam;
767 
768  /* Specify the resource identifier of the descriptive
769  * text for the given button. */
770  idButton = (UINT)lpttt->hdr.idFrom;
771  switch (idButton)
772  {
773  case ID_PROP:
774  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PROP);
775  break;
776 
777  case ID_REFRESH:
778  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH);
779  break;
780 
781  case ID_EXPORT:
782  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT);
783  break;
784 
785  case ID_CREATE:
786  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_CREATE);
787  break;
788 
789  case ID_DELETE:
790  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_DELETE);
791  break;
792 
793  case ID_START:
794  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_START);
795  break;
796 
797  case ID_STOP:
798  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_STOP);
799  break;
800 
801  case ID_PAUSE:
802  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PAUSE);
803  break;
804 
805  case ID_RESTART:
806  lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_RESTART);
807  break;
808  }
809  }
810  break;
811  }
812  }
813  break;
814 
815  case WM_CONTEXTMENU:
816  {
817  POINT pt;
818  RECT lvRect;
819 
820  INT xPos = GET_X_LPARAM(lParam);
821  INT yPos = GET_Y_LPARAM(lParam);
822 
823  GetCursorPos(&pt);
824 
825  /* display popup when cursor is in the list view */
826  GetWindowRect(Info->hListView, &lvRect);
827  if (PtInRect(&lvRect, pt))
828  {
831  xPos,
832  yPos,
833  Info->hMainWnd,
834  NULL);
835  }
836  }
837  break;
838 
839  case WM_COMMAND:
840  {
841  MainWndCommand(Info,
842  LOWORD(wParam),
843  (HWND)lParam);
844  goto HandleDefaultMessage;
845  }
846 
847  case WM_MENUSELECT:
848  {
849  if (Info->hStatus != NULL)
850  {
851  if (!MainWndMenuHint(Info,
852  LOWORD(wParam),
853  MainMenuHintTable,
854  sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
856  {
857  MainWndMenuHint(Info,
858  LOWORD(wParam),
859  SystemMenuHintTable,
860  sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
862  }
863  }
864  }
865  break;
866 
867  case WM_ENTERMENULOOP:
868  {
869  Info->bInMenuLoop = TRUE;
870  UpdateMainStatusBar(Info);
871  break;
872  }
873 
874  case WM_EXITMENULOOP:
875  {
876  Info->bInMenuLoop = FALSE;
877  UpdateMainStatusBar(Info);
878  break;
879  }
880 
881  case WM_CLOSE:
882  {
883  FreeServiceList(Info);
884  DestroyMenu(Info->hShortcutMenu);
885  DestroyWindow(hwnd);
886  }
887  break;
888 
889  case WM_DESTROY:
890  {
892  0,
893  Info);
894  SetWindowLongPtr(hwnd,
896  0);
897 
898  PostQuitMessage(0);
899  }
900  break;
901 
902  default:
903  {
904 HandleDefaultMessage:
905 
906  Ret = DefWindowProc(hwnd,
907  msg,
908  wParam,
909  lParam);
910  }
911  break;
912  }
913 
914  return Ret;
915 }
916 
917 
918 
919 HWND
921  int nCmdShow)
922 {
924  HWND hMainWnd = NULL;
925 
928  sizeof(MAIN_WND_INFO));
929 
930  if (Info != NULL)
931  {
932  Info->nCmdShow = nCmdShow;
933 
934  hMainWnd = CreateWindowEx(WS_EX_WINDOWEDGE,
936  lpCaption,
940  680,
941  450,
942  NULL,
943  NULL,
944  hInstance,
945  Info);
946  if (hMainWnd == NULL)
947  {
948  //int ret;
949  //ret = GetLastError();
950  GetError();
952  0,
953  Info);
954  }
955  }
956 
957  return hMainWnd;
958 }
959 
960 BOOL
962 {
963  WNDCLASSEX wc = {0};
964 
965  wc.cbSize = sizeof(WNDCLASSEX);
967  wc.hInstance = hInstance;
968  wc.hIcon = LoadIcon(hInstance,
970  wc.hCursor = LoadCursor(NULL,
971  IDC_ARROW);
972  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
977  IMAGE_ICON,
978  16,
979  16,
980  LR_SHARED);
981 
982  return RegisterClassEx(&wc) != (ATOM)0;
983 }
984 
985 
986 VOID
988 {
990  hInstance);
991 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
static const MENU_HINT SystemMenuHintTable[]
Definition: mainwnd.c:69
#define IDS_HINT_EXIT
Definition: resource.h:96
#define ID_RESUME
Definition: resource.h:23
#define IDS_HINT_BLANK
Definition: resource.h:94
static const WCHAR szMainWndClass[]
Definition: mainwnd.c:14
#define IDS_HINT_ABOUT
Definition: resource.h:117
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define IDR_MAINMENU
Definition: resource.h:40
#define TBICON_DELETE
Definition: resource.h:87
static HICON
Definition: imagelist.c:84
VOID OpenPropSheet(PMAIN_WND_INFO Info)
Definition: propsheet.c:30
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1104
LPCSTR lpszMenuName
Definition: winuser.h:3163
#define ID_VIEW_DETAILS
Definition: resource.h:38
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3916
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
#define IDOK
Definition: winuser.h:824
#define ID_REFRESH
Definition: resource.h:18
#define LR_SHARED
Definition: winuser.h:1090
#define ID_CONNECT
Definition: resource.h:30
#define IMAGE_ICON
Definition: winuser.h:212
#define IDC_STATUSBAR
Definition: resource.h:14
#define RegisterClassEx
Definition: winuser.h:5703
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:47
#define IDS_TOOLTIP_STOP
Definition: resource.h:19
#define MF_BYCOMMAND
Definition: winuser.h:202
#define SC_RESTORE
Definition: winuser.h:2552
UINT HintId
Definition: precomp.h:87
INT_PTR CALLBACK DeleteDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: delete.c:57
#define WM_CONTEXTMENU
Definition: richedit.h:64
UINT uNewState
Definition: commctrl.h:3006
HCURSOR hCursor
Definition: winuser.h:3161
WNDPROC lpfnWndProc
Definition: winuser.h:3156
#define ACTION_START
Definition: precomp.h:37
#define IDS_HINT_EXPORT
Definition: resource.h:95
#define ID_EXPORT
Definition: resource.h:19
#define IDS_HINT_LARGE
Definition: resource.h:110
static BOOL CreateStatusBar(PMAIN_WND_INFO Info)
Definition: mainwnd.c:307
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:983
#define IDS_TOOLTIP_DELETE
Definition: resource.h:53
LPCSTR lpszClassName
Definition: winuser.h:3164
WORD ATOM
Definition: dimm.idl:113
#define IDS_HINT_REFRESH
Definition: resource.h:104
#define TBSTATE_INDETERMINATE
Definition: commctrl.h:946
#define IDS_HINT_CUST
Definition: resource.h:114
VOID UpdateServiceCount(PMAIN_WND_INFO Info)
Definition: mainwnd.c:124
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define pt(x, y)
Definition: drawing.c:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDD_DLG_DELETE
Definition: resource.h:197
#define TB_SETSTATE
Definition: commctrl.h:1024
#define LVS_REPORT
Definition: commctrl.h:2232
VOID ListViewSelectionChanged(PMAIN_WND_INFO Info, LPNMLISTVIEW pnmv)
Definition: listview.c:48
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2654
static VOID UpdateMainStatusBar(PMAIN_WND_INFO Info)
Definition: mainwnd.c:112
#define ACTION_STOP
Definition: precomp.h:38
#define LVN_ITEMCHANGED
Definition: commctrl.h:3101
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param)
Definition: progress.c:322
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define CALLBACK
Definition: compat.h:27
static BOOL MainWndMenuHint(PMAIN_WND_INFO Info, WORD CmdId, const MENU_HINT *HintArray, DWORD HintsCount, UINT DefHintId)
Definition: mainwnd.c:80
LONG top
Definition: windef.h:297
#define IDS_HINT_STOP
Definition: resource.h:100
#define IDS_HINT_EDIT
Definition: resource.h:105
HWND WINAPI SetFocus(_In_opt_ HWND)
#define IDB_PROP
Definition: resource.h:72
static BOOL InitMainWnd(PMAIN_WND_INFO Info)
Definition: mainwnd.c:333
#define WS_CHILD
Definition: pedump.c:617
HICON hIconSm
Definition: winuser.h:3165
#define SWP_NOZORDER
Definition: winuser.h:1232
#define IDS_HINT_DETAILS
Definition: resource.h:113
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
static INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:60
#define WS_CLIPCHILDREN
Definition: pedump.c:619
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2635
LONG right
Definition: windef.h:298
#define HDITEM
Definition: commctrl.h:682
#define STATUSCLASSNAME
Definition: commctrl.h:1909
BOOL WINAPI DestroyWindow(_In_ HWND)
#define ID_CREATE
Definition: resource.h:26
int32_t INT
Definition: typedefs.h:56
static const MENU_HINT MainMenuHintTable[]
Definition: mainwnd.c:39
#define SetWindowLongPtr
Definition: treelist.c:70
& rect
Definition: startmenu.cpp:1413
HWND hStatus
Definition: precomp.h:50
WPARAM wParam
Definition: combotst.c:138
struct TraceInfo Info
#define IDS_HINT_SYS_MINIMIZE
Definition: resource.h:123
struct tagNMHDR * LPNMHDR
INT SelectedItem
Definition: precomp.h:60
INT SortSelection
Definition: precomp.h:61
UINT_PTR WPARAM
Definition: windef.h:207
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:893
#define IDS_TOOLTIP_CREATE
Definition: resource.h:52
UINT code
Definition: winuser.h:3112
#define SERVICE_DISABLED
Definition: cmtypes.h:977
#define DialogBox
Definition: winuser.h:5627
VOID GetError(VOID)
Definition: misc.c:192
HMENU hMainMenu
Definition: mplay32.c:19
#define TPM_RIGHTBUTTON
Definition: winuser.h:2334
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define BTNS_BUTTON
Definition: commctrl.h:968
BOOL bInMenuLoop
Definition: precomp.h:65
#define SERVICE_STOPPED
Definition: winsvc.h:21
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
HINSTANCE hInstance
Definition: winuser.h:3159
#define ID_DELETE
Definition: resource.h:27
#define IDS_TOOLTIP_PROP
Definition: resource.h:49
#define IDD_DLG_CREATE
Definition: resource.h:183
#define ID_PAUSE
Definition: resource.h:22
#define TB_AUTOSIZE
Definition: commctrl.h:1107
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_ENTERMENULOOP
Definition: winuser.h:1780
#define IDD_ABOUTBOX
Definition: resource.h:8
#define IDS_HINT_CONNECT
Definition: resource.h:98
#define LVSTATUS
Definition: precomp.h:29
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define WM_MENUSELECT
Definition: winuser.h:1723
#define Header_GetItem(hwndHD, i, phdi)
Definition: commctrl.h:736
#define SB_SIMPLEID
Definition: precomp.h:15
#define TTN_GETDISPINFO
Definition: commctrl.h:1848
#define CreateWindowEx
Definition: winuser.h:5621
#define SC_MAXIMIZE
Definition: winuser.h:2542
#define CW_USEDEFAULT
Definition: winuser.h:225
#define GWLP_USERDATA
Definition: treelist.c:63
#define SB_SIMPLE
Definition: commctrl.h:1928
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
#define TOOLBARCLASSNAME
Definition: commctrl.h:916
#define MAKELONG(a, b)
Definition: typedefs.h:248
WORD CmdId
Definition: precomp.h:86
#define WM_EXITMENULOOP
Definition: winuser.h:1781
UINT msg
Definition: msvc.h:92
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
#define IDR_POPUP
Definition: resource.h:7
smooth NULL
Definition: ftsmooth.c:416
static VOID CALLBACK MainWndResize(PMAIN_WND_INFO Info, WORD cx, WORD cy)
Definition: mainwnd.c:605
#define ListView_Arrange(hwndLV, code)
Definition: commctrl.h:2503
UINT cbSize
Definition: winuser.h:3154
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2277
#define GET_X_LPARAM(lp)
Definition: precomp.h:67
#define TBICON_START
Definition: resource.h:88
#define ID_ABOUT
Definition: charmap.c:18
#define ACTION_RESUME
Definition: precomp.h:40
switch(r->id)
Definition: btrfs.c:2676
static INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: about.c:15
#define LVS_LIST
Definition: commctrl.h:2234
return Found
Definition: dirsup.c:1270
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
#define IDS_TOOLTIP_RESTART
Definition: resource.h:57
HBRUSH hbrBackground
Definition: winuser.h:3162
#define DefWindowProc
Definition: ros2win.h:31
#define WM_DESTROY
Definition: winuser.h:1591
#define IDS_HINT_HELP
Definition: resource.h:116
#define PostMessage
Definition: winuser.h:5698
#define IDS_NUM_SERVICES
Definition: resource.h:64
#define TBICON_PROP
Definition: resource.h:83
#define ORD_ASCENDING
Definition: precomp.h:43
#define TB_SETIMAGELIST
Definition: commctrl.h:1120
#define LPTOOLTIPTEXT
Definition: commctrl.h:1860
#define ID_VIEW_LIST
Definition: resource.h:37
#define IDS_HINT_SYS_MOVE
Definition: resource.h:121
#define TBICON_EXPORT
Definition: resource.h:85
unsigned int BOOL
Definition: ntddk_ex.h:94
int nCmdShow
Definition: precomp.h:54
static BOOL pCreateToolbar(PMAIN_WND_INFO Info)
Definition: mainwnd.c:255
INT SortDirection
Definition: precomp.h:62
#define GetProcessHeap()
Definition: compat.h:395
#define BTNS_SEP
Definition: commctrl.h:969
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
#define SBARS_SIZEGRIP
Definition: commctrl.h:1893
#define WM_SIZE
Definition: winuser.h:1593
#define IDS_TOOLTIP_REFRESH
Definition: resource.h:50
#define ID_EDIT
Definition: resource.h:25
#define TBICON_RESTART
Definition: resource.h:91
#define MF_ENABLED
Definition: winuser.h:128
#define WM_CLOSE
Definition: winuser.h:1603
unsigned int UINT
Definition: ndis.h:50
struct _MAIN_WND_INFO * PMAIN_WND_INFO
unsigned short WORD
Definition: ntddk_ex.h:93
int WINAPI GetSystemMetrics(_In_ int)
#define IDS_HINT_SYS_RESTORE
Definition: resource.h:120
BOOL RefreshServiceList(PMAIN_WND_INFO Info)
Definition: listview.c:247
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:959
#define IDS_HINT_PROP
Definition: resource.h:108
VOID UninitMainWindowImpl(VOID)
Definition: mainwnd.c:987
#define LVS_ICON
Definition: commctrl.h:2231
#define SM_CXSMICON
Definition: winuser.h:1002
#define IDS_HINT_START
Definition: resource.h:99
#define ID_START
Definition: resource.h:20
VOID ExportFile(PMAIN_WND_INFO Info)
Definition: export.c:98
#define IDS_HINT_SYS_SIZE
Definition: resource.h:122
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define DialogBoxParam
Definition: winuser.h:5630
int ret
HWND hMainWnd
Definition: magnifier.c:33
HICON hIcon
Definition: winuser.h:3160
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:636
static const WCHAR L[]
Definition: oid.c:1087
HWND hTool
Definition: precomp.h:51
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
#define SB_SETTEXT
Definition: commctrl.h:1919
#define IDS_HINT_RESUME
Definition: resource.h:102
#define COLOR_BTNFACE
Definition: winuser.h:918
HIMAGELIST InitImageList(UINT StartResource, UINT EndResource, UINT Width, UINT Height, ULONG type)
Definition: misc.c:219
#define TB_ADDBUTTONS
Definition: commctrl.h:1241
#define TBICON_REFRESH
Definition: resource.h:84
#define IDS_TOOLTIP_PAUSE
Definition: resource.h:25
#define ID_RESTART
Definition: resource.h:24
HMENU hShortcutMenu
Definition: precomp.h:53
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1716
#define ORD_DESCENDING
Definition: precomp.h:44
#define IDS_DELETE_STOP
Definition: resource.h:201
#define ID_VIEW_SMALL
Definition: resource.h:36
VOID DisplayString(LPWSTR Msg)
Definition: misc.c:211
#define LoadCursor
Definition: winuser.h:5678
#define ID_EXIT
Definition: resource.h:10
HANDLE ProcessHeap
Definition: servman.c:15
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define SC_MINIMIZE
Definition: winuser.h:2540
BOOL bIsUserAnAdmin
Definition: precomp.h:66
#define ACTION_PAUSE
Definition: precomp.h:39
#define NM_RETURN
Definition: commctrl.h:132
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define IDS_HINT_LIST
Definition: resource.h:112
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
Definition: listview.c:105
enum State_ State
Definition: pofuncs.h:54
#define NO_ITEM_SELECTED
Definition: precomp.h:24
BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS *pService)
Definition: query.c:373
#define LoadMenu
Definition: winuser.h:5683
#define NM_DBLCLK
Definition: commctrl.h:131
struct tagNMLISTVIEW * LPNMLISTVIEW
ENUM_SERVICE_STATUS_PROCESS * pCurrentService
Definition: precomp.h:57
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define IDS_TOOLTIP_EXPORT
Definition: resource.h:51
HINSTANCE hInstance
Definition: mainwnd.c:15
static INT CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: mainwnd.c:242
#define SC_SIZE
Definition: winuser.h:2538
#define TBICON_CREATE
Definition: resource.h:86
#define TBICON_PAUSE
Definition: resource.h:90
HWND hMainWnd
Definition: precomp.h:48
#define ID_PROP
Definition: resource.h:17
VOID SetListViewStyle(HWND hListView, DWORD View)
Definition: listview.c:34
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define MB_OK
Definition: winuser.h:784
BOOL CreateListView(PMAIN_WND_INFO Info)
Definition: listview.c:355
#define IMAGE_BITMAP
Definition: winuser.h:211
#define IDS_HINT_SYS_MAXIMIZE
Definition: resource.h:124
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define LVN_COLUMNCLICK
Definition: commctrl.h:3109
#define SB_SETPARTS
Definition: commctrl.h:1924
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
Definition: mainwnd.c:151
#define ListView_SortItemsEx(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2771
#define GET_Y_LPARAM(lp)
Definition: precomp.h:68
#define IDS_HINT_DELETE
Definition: resource.h:107
HWND hHeader
Definition: precomp.h:52
#define IDI_SM_ICON
Definition: resource.h:66
#define TBICON_STOP
Definition: resource.h:60
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define IDC_ARROW
Definition: winuser.h:682
BOOL bDlgOpen
Definition: precomp.h:64
#define HDI_LPARAM
Definition: commctrl.h:691
#define SC_MOVE
Definition: winuser.h:2539
_Out_opt_ int * cx
Definition: commctrl.h:570
#define SC_CLOSE
Definition: winuser.h:2546
#define IDS_HINT_SMALL
Definition: resource.h:111
#define SendMessage
Definition: winuser.h:5709
#define TBSTATE_ENABLED
Definition: commctrl.h:944
#define WM_CREATE
Definition: winuser.h:1590
#define IDS_HINT_SYS_CLOSE
Definition: resource.h:125
#define LVA_DEFAULT
Definition: commctrl.h:2497
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define HIWORD(l)
Definition: typedefs.h:246
LONG bottom
Definition: windef.h:299
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
static VOID MainWndCommand(PMAIN_WND_INFO Info, WORD CmdId, HWND hControl)
Definition: mainwnd.c:379
#define LoadImage
Definition: winuser.h:5681
#define IDS_TOOLTIP_START
Definition: resource.h:54
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
INT_PTR CALLBACK CreateDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: create.c:218
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5585
#define LoadIcon
Definition: winuser.h:5679
#define ID_VIEW_CUST
Definition: resource.h:34
#define GetWindowLongPtr
Definition: treelist.c:73
#define MF_GRAYED
Definition: winuser.h:129
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:743
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL InitMainWindowImpl(VOID)
Definition: mainwnd.c:961
LONG_PTR LRESULT
Definition: windef.h:209
#define IDB_RESTART
Definition: resource.h:80
#define ID_HELP
Definition: resource.h:28
#define UINT
Definition: msvc.h:27
#define WS_VISIBLE
Definition: pedump.c:620
#define IDS_HINT_CREATE
Definition: resource.h:106
#define UnregisterClass
Definition: winuser.h:5727
SERVICE_STATUS_PROCESS ServiceStatusProcess
Definition: winsvc.h:137
#define IDS_HINT_PAUSE
Definition: resource.h:101
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139
#define IDS_HINT_RESTART
Definition: resource.h:103
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define LoadString
Definition: winuser.h:5685
static const TBBUTTON Buttons[]
Definition: mainwnd.c:17
#define ID_STOP
Definition: resource.h:21
#define TBSTYLE_FLAT
Definition: commctrl.h:962
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1160
#define WM_NOTIFY
Definition: richedit.h:61
BOOL StatusBarLoadString(IN HWND hStatusBar, IN INT PartId, IN HINSTANCE hInstance, IN UINT uID)
Definition: misc.c:150
HWND CreateMainWindow(LPCTSTR lpCaption, int nCmdShow)
Definition: mainwnd.c:920
#define LVS_SMALLICON
Definition: commctrl.h:2233
#define ACTION_RESTART
Definition: precomp.h:41
#define ID_VIEW_LARGE
Definition: resource.h:35
HWND hListView
Definition: precomp.h:49
VOID FreeServiceList(PMAIN_WND_INFO Info)
Definition: query.c:257