ReactOS 0.4.15-dev-6068-g8061a6f
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#include <shellapi.h>
14
15static const WCHAR szMainWndClass[] = L"ServManWndClass";
16
17/* Toolbar buttons */
18static const TBBUTTON Buttons [] =
19{ /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
20 {TBICON_PROP, ID_PROP, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0}, /* properties */
21 {TBICON_REFRESH, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* refresh */
22 {TBICON_EXPORT, ID_EXPORT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* export */
23
24 /* Note: First item for a separator is its width in pixels */
25 {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
26
27 {TBICON_CREATE, ID_CREATE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* create */
28 {TBICON_DELETE, ID_DELETE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* delete */
29
30 {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
31
32 {TBICON_START, ID_START, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* start */
33 {TBICON_STOP, ID_STOP, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* stop */
34 {TBICON_PAUSE, ID_PAUSE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* pause */
35 {TBICON_RESTART, ID_RESTART, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* restart */
36};
37
38
39/* menu hints */
40static const MENU_HINT MainMenuHintTable[] = {
41 /* File Menu */
44
45 /* Action Menu */
57
58 /* View menu */
64
65 /* Help Menu */
68};
69/* system menu hints */
77};
78
79
80static BOOL
82 WORD CmdId,
83 const MENU_HINT *HintArray,
84 DWORD HintsCount,
85 UINT DefHintId)
86{
88 const MENU_HINT *LastHint;
89 UINT HintId = DefHintId;
90
91 LastHint = HintArray + HintsCount;
92 while (HintArray != LastHint)
93 {
94 if (HintArray->CmdId == CmdId)
95 {
96 HintId = HintArray->HintId;
97 Found = TRUE;
98 break;
99 }
100 HintArray++;
101 }
102
103 StatusBarLoadString(Info->hStatus,
105 hInstance,
106 HintId);
107
108 return Found;
109}
110
111
112static VOID
114{
115 if (Info->hStatus != NULL)
116 {
117 SendMessage(Info->hStatus,
118 SB_SIMPLE,
119 (WPARAM)Info->bInMenuLoop,
120 0);
121 }
122}
123
124VOID
126{
127 LPWSTR lpNumServices;
128
129 if (AllocAndLoadString(&lpNumServices,
130 hInstance,
132 {
133 WCHAR szNumServices[32];
134
135 INT NumListedServ = ListView_GetItemCount(Info->hListView);
136
137 _snwprintf(szNumServices,
138 31,
139 lpNumServices,
140 NumListedServ);
141
142 SendMessage(Info->hStatus,
144 0,
145 (LPARAM)szNumServices);
146
147 LocalFree(lpNumServices);
148 }
149}
150
151
153{
155 UINT i;
156
157 /* get handle to menu */
158 hMainMenu = GetMenu(Info->hMainWnd);
159
160 /* set all to greyed */
161 for (i = ID_START; i <= ID_RESTART; i++)
162 {
164 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), i, MF_GRAYED);
165 SendMessage(Info->hTool, TB_SETSTATE, i,
167 }
168
169 if (Info->SelectedItem != NO_ITEM_SELECTED)
170 {
171 LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL;
173
174 /* allow user to delete service */
175 if (Info->bIsUserAnAdmin)
176 {
180 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED);
181 }
182
183 Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
184 State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
185
186 lpServiceConfig = GetServiceConfig(Info->pCurrentService->lpServiceName);
187
188 if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
189 {
190 if (State == SERVICE_STOPPED)
191 {
193 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_ENABLED);
196 }
197
199 {
201 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_RESTART, MF_ENABLED);
204 }
205 }
206
207 if(lpServiceConfig)
208 HeapFree(GetProcessHeap(), 0, lpServiceConfig);
209
211 {
213 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_STOP, MF_ENABLED);
216 }
217
219 {
221 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PAUSE, MF_ENABLED);
224 }
225 }
226 else
227 {
228 /* disable tools which rely on a selected service */
231 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PROP, MF_GRAYED);
232 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_GRAYED);
237 }
238
239}
240
241
242static INT CALLBACK
243CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
244{
245 PMAIN_WND_INFO Info = (PMAIN_WND_INFO)lParamSort;
246 WCHAR Item1[256], Item2[256];
247
248 ListView_GetItemText(Info->hListView, lParam1, Info->SortSelection, Item1, sizeof(Item1) / sizeof(WCHAR));
249 ListView_GetItemText(Info->hListView, lParam2, Info->SortSelection, Item2, sizeof(Item2) / sizeof(WCHAR));
250
251 return wcscmp(Item1, Item2) * Info->SortDirection;
252}
253
254
255static BOOL
257{
258 INT numButtons = sizeof(Buttons) / sizeof(Buttons[0]);
259
260 Info->hTool = CreateWindowEx(0,
262 NULL,
264 0, 0, 0, 0,
265 Info->hMainWnd,
266 0,
267 hInstance,
268 NULL);
269 if(Info->hTool != NULL)
270 {
271 HIMAGELIST hImageList;
272
273 SendMessage(Info->hTool,
275 0,
277
278 SendMessage(Info->hTool,
280 sizeof(Buttons[0]),
281 0);
282
283 hImageList = InitImageList(IDB_PROP,
288 if (hImageList == NULL)
289 return FALSE;
290
293 0,
294 (LPARAM)hImageList));
295
296 SendMessage(Info->hTool,
298 numButtons,
299 (LPARAM)Buttons);
300
301 return TRUE;
302 }
303
304 return FALSE;
305}
306
307static BOOL
309{
310 INT StatWidths[] = {130, -1}; /* widths of status bar */
311
312 Info->hStatus = CreateWindowEx(0,
314 NULL,
316 0, 0, 0, 0,
317 Info->hMainWnd,
319 hInstance,
320 NULL);
321 if(Info->hStatus == NULL)
322 return FALSE;
323
324 SendMessage(Info->hStatus,
326 sizeof(StatWidths) / sizeof(INT),
327 (LPARAM)StatWidths);
328
329 return TRUE;
330}
331
332
333static BOOL
335{
336 if (!pCreateToolbar(Info))
337 {
338 DisplayString(L"error creating toolbar");
339 return FALSE;
340 }
341
342 if (!CreateListView(Info))
343 {
344 DisplayString(L"error creating list view");
345 return FALSE;
346 }
347
348 if (!CreateStatusBar(Info))
349 DisplayString(L"error creating status bar");
350
351 /* Create Popup Menu */
352 Info->hShortcutMenu = LoadMenu(hInstance,
354
355 Info->bIsUserAnAdmin = TRUE;// IsUserAnAdmin();
356 if (Info->bIsUserAnAdmin)
357 {
358 HMENU hMainMenu = GetMenu(Info->hMainWnd);
359
360 SendMessage(Info->hTool,
362 ID_CREATE,
364 if (hMainMenu)
365 {
367 ID_CREATE,
368 MF_ENABLED);
369 }
370 EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0),
371 ID_CREATE,
372 MF_ENABLED);
373 }
374
375 return TRUE;
376}
377
378static VOID
380 WORD CmdId,
381 HWND hControl)
382{
383 WCHAR szAppName[256];
384 WCHAR szAppAuthors[256];
385 HICON hIcon;
386
387 UNREFERENCED_PARAMETER(hControl);
388
389 switch (CmdId)
390 {
391 case ID_PROP:
392 {
393 if (Info->SelectedItem != NO_ITEM_SELECTED)
394 {
395 Info->bDlgOpen = TRUE;
397 Info->bDlgOpen = FALSE;
399 }
400 }
401 break;
402
403 case ID_REFRESH:
404 {
406 Info->SelectedItem = NO_ITEM_SELECTED;
407
408 /* disable menus and buttons */
410
411 /* clear the service in the status bar */
412 SendMessage(Info->hStatus,
414 1,
415 L'\0');
416 }
417 break;
418
419 case ID_EXPORT:
420 {
422 SetFocus(Info->hListView);
423 }
424 break;
425
426 case ID_CREATE:
427 {
428 INT ret;
429
432 Info->hMainWnd,
434 (LPARAM)Info);
435 if (ret == IDOK)
437
438 SetFocus(Info->hListView);
439 }
440 break;
441
442 case ID_DELETE:
443 {
444 if (Info->pCurrentService->ServiceStatusProcess.dwCurrentState != SERVICE_RUNNING)
445 {
448 Info->hMainWnd,
450 (LPARAM)Info);
451 }
452 else
453 {
454 WCHAR Buf[60];
457 Buf,
458 sizeof(Buf) / sizeof(WCHAR));
459 DisplayString(Buf);
460 }
461
462 SetFocus(Info->hListView);
463
464 }
465 break;
466
467 case ID_START:
468 {
469 RunActionWithProgress(Info->hMainWnd,
470 Info->pCurrentService->lpServiceName,
471 Info->pCurrentService->lpDisplayName,
473 NULL); //FIXME: Add start params
474
475 UpdateServiceStatus(Info->pCurrentService);
476 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
478 SetFocus(Info->hListView);
479
480 }
481 break;
482
483 case ID_STOP:
484 RunActionWithProgress(Info->hMainWnd,
485 Info->pCurrentService->lpServiceName,
486 Info->pCurrentService->lpDisplayName,
488 NULL);
489
490 UpdateServiceStatus(Info->pCurrentService);
491 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
493 SetFocus(Info->hListView);
494
495 break;
496
497 case ID_PAUSE:
498 RunActionWithProgress(Info->hMainWnd,
499 Info->pCurrentService->lpServiceName,
500 Info->pCurrentService->lpDisplayName,
502 NULL);
503
504 UpdateServiceStatus(Info->pCurrentService);
505 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
507 SetFocus(Info->hListView);
508 break;
509
510 case ID_RESUME:
511 RunActionWithProgress(Info->hMainWnd,
512 Info->pCurrentService->lpServiceName,
513 Info->pCurrentService->lpDisplayName,
515 NULL);
516
517 UpdateServiceStatus(Info->pCurrentService);
518 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
520 SetFocus(Info->hListView);
521 break;
522
523 case ID_RESTART:
524 RunActionWithProgress(Info->hMainWnd,
525 Info->pCurrentService->lpServiceName,
526 Info->pCurrentService->lpDisplayName,
528 NULL);
529
530 UpdateServiceStatus(Info->pCurrentService);
531 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
533 SetFocus(Info->hListView);
534 break;
535
536 case ID_HELP:
538 L"Help is not yet implemented\n",
539 L"Note!",
541 SetFocus(Info->hListView);
542 break;
543
544 case ID_EXIT:
545 PostMessage(Info->hMainWnd,
546 WM_CLOSE,
547 0,
548 0);
549 break;
550
551 case ID_VIEW_LARGE:
552 SetListViewStyle(Info->hListView, LVS_ICON);
553 ListView_Arrange(Info->hListView, LVA_DEFAULT);
554
560 break;
561
562 case ID_VIEW_SMALL:
564 ListView_Arrange(Info->hListView, LVA_DEFAULT);
565
571 break;
572
573 case ID_VIEW_LIST:
574 SetListViewStyle(Info->hListView,
575 LVS_LIST);
581 break;
582
583 case ID_VIEW_DETAILS:
584 SetListViewStyle(Info->hListView,
585 LVS_REPORT);
591 break;
592
593 case ID_VIEW_CUST:
594 break;
595
596 case ID_ABOUT:
598 LoadStringW(hInstance, IDS_APPAUTHORS, szAppAuthors, _countof(szAppAuthors));
599
601 ShellAboutW(Info->hMainWnd, szAppName, szAppAuthors, hIcon);
603 break;
604
605 }
606}
607
608
609static VOID CALLBACK
611 WORD cx,
612 WORD cy)
613{
614 RECT rcClient, rcTool, rcStatus;
615 int lvHeight, iToolHeight, iStatusHeight;
616
617 /* Size toolbar and get height */
618 SendMessage(Info->hTool, TB_AUTOSIZE, 0, 0);
619 GetWindowRect(Info->hTool, &rcTool);
620 iToolHeight = rcTool.bottom - rcTool.top;
621
622 /* Size status bar and get height */
623 SendMessage(Info->hStatus, WM_SIZE, 0, 0);
624 GetWindowRect(Info->hStatus, &rcStatus);
625 iStatusHeight = rcStatus.bottom - rcStatus.top;
626
627 /* Calculate remaining height and size list view */
628 GetClientRect(Info->hMainWnd, &rcClient);
629 lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
630 SetWindowPos(Info->hListView,
631 NULL,
632 0,
633 iToolHeight,
634 rcClient.right,
635 lvHeight,
637}
638
639
640static LRESULT CALLBACK
642 UINT msg,
645{
647 LRESULT Ret = 0;
648
649 /* Get the window context */
652 if (Info == NULL && msg != WM_CREATE)
653 {
654 goto HandleDefaultMessage;
655 }
656
657 switch(msg)
658 {
659 case WM_CREATE:
660 {
661 Info = (PMAIN_WND_INFO)(((LPCREATESTRUCT)lParam)->lpCreateParams);
662
663 /* Initialize the main window context */
664 Info->hMainWnd = hwnd;
665 Info->SelectedItem = NO_ITEM_SELECTED;
666
669 (LONG_PTR)Info);
670
671 if (!InitMainWnd(Info))
672 return -1;
673
674 /* Fill the list-view before showing the main window */
676
677 /* Show the window */
679 Info->nCmdShow);
680
681 SetFocus(Info->hListView);
682 }
683 break;
684
685 case WM_SIZE:
686 {
688 LOWORD(lParam),
689 HIWORD(lParam));
690 }
691 break;
692
693 case WM_NOTIFY:
694 {
695 LPNMHDR pnmhdr = (LPNMHDR)lParam;
696
697 switch (pnmhdr->code)
698 {
699 case NM_DBLCLK:
700 {
701 POINT pt;
702 RECT rect;
703
705 GetWindowRect(Info->hListView, &rect);
706
707 if (PtInRect(&rect, pt))
708 {
711 //ID_PROP,
713 0);
714 }
715
716 //OpenPropSheet(Info);
717 }
718 break;
719
720 case NM_RETURN:
721 {
724 //ID_PROP,
726 0);
727 }
728 break;
729
730 case LVN_COLUMNCLICK:
731 {
733 HDITEM hdi;
734
735 /* get pending sort direction for clicked column */
736 hdi.mask = HDI_LPARAM;
737 (void)Header_GetItem(Info->hHeader, pnmv->iSubItem, &hdi);
738
739 /* get new sort parameters */
740 Info->SortSelection = pnmv->iSubItem;
741 Info->SortDirection = hdi.lParam;
742
743 /* set new sort direction and save */
744 hdi.lParam = (hdi.lParam == ORD_ASCENDING) ?
746
747 (void)Header_SetItem(Info->hHeader, pnmv->iSubItem, &hdi);
748
749 (void)ListView_SortItemsEx(Info->hListView,
751 (LPARAM)Info);
752 }
753 break;
754 case LVN_ITEMCHANGED:
755 {
757
758 if (pnmv->uNewState != 0)
759 {
762 }
763 }
764 break;
765
766 case TTN_GETDISPINFO:
767 {
768 LPTOOLTIPTEXT lpttt;
769 UINT idButton;
770
771 lpttt = (LPTOOLTIPTEXT)lParam;
772
773 /* Specify the resource identifier of the descriptive
774 * text for the given button. */
775 idButton = (UINT)lpttt->hdr.idFrom;
776 switch (idButton)
777 {
778 case ID_PROP:
779 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PROP);
780 break;
781
782 case ID_REFRESH:
783 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH);
784 break;
785
786 case ID_EXPORT:
787 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT);
788 break;
789
790 case ID_CREATE:
791 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_CREATE);
792 break;
793
794 case ID_DELETE:
795 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_DELETE);
796 break;
797
798 case ID_START:
799 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_START);
800 break;
801
802 case ID_STOP:
803 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_STOP);
804 break;
805
806 case ID_PAUSE:
807 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PAUSE);
808 break;
809
810 case ID_RESTART:
811 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_RESTART);
812 break;
813 }
814 }
815 break;
816 }
817 }
818 break;
819
820 case WM_CONTEXTMENU:
821 {
822 POINT pt;
823 RECT lvRect;
824
825 INT xPos = GET_X_LPARAM(lParam);
826 INT yPos = GET_Y_LPARAM(lParam);
827
829
830 /* display popup when cursor is in the list view */
831 GetWindowRect(Info->hListView, &lvRect);
832 if (PtInRect(&lvRect, pt))
833 {
834 TrackPopupMenuEx(GetSubMenu(Info->hShortcutMenu, 0),
836 xPos,
837 yPos,
838 Info->hMainWnd,
839 NULL);
840 }
841 }
842 break;
843
844 case WM_COMMAND:
845 {
847 LOWORD(wParam),
848 (HWND)lParam);
849 goto HandleDefaultMessage;
850 }
851
852 case WM_MENUSELECT:
853 {
854 if (Info->hStatus != NULL)
855 {
857 LOWORD(wParam),
859 sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
861 {
863 LOWORD(wParam),
865 sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
867 }
868 }
869 }
870 break;
871
872 case WM_ENTERMENULOOP:
873 {
874 Info->bInMenuLoop = TRUE;
876 break;
877 }
878
879 case WM_EXITMENULOOP:
880 {
881 Info->bInMenuLoop = FALSE;
883 break;
884 }
885
886 case WM_CLOSE:
887 {
889 DestroyMenu(Info->hShortcutMenu);
891 }
892 break;
893
894 case WM_DESTROY:
895 {
897 0,
898 Info);
901 0);
902
904 }
905 break;
906
907 default:
908 {
909HandleDefaultMessage:
910
911 Ret = DefWindowProc(hwnd,
912 msg,
913 wParam,
914 lParam);
915 }
916 break;
917 }
918
919 return Ret;
920}
921
922
923
924HWND
926 int nCmdShow)
927{
930
933 sizeof(MAIN_WND_INFO));
934
935 if (Info != NULL)
936 {
937 Info->nCmdShow = nCmdShow;
938
941 lpCaption,
945 680,
946 450,
947 NULL,
948 NULL,
949 hInstance,
950 Info);
951 if (hMainWnd == NULL)
952 {
953 //int ret;
954 //ret = GetLastError();
955 GetError();
957 0,
958 Info);
959 }
960 }
961
962 return hMainWnd;
963}
964
965BOOL
967{
968 WNDCLASSEX wc = {0};
969
970 wc.cbSize = sizeof(WNDCLASSEX);
972 wc.hInstance = hInstance;
976 IDC_ARROW);
977 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
983 16,
984 16,
985 LR_SHARED);
986
987 return RegisterClassEx(&wc) != (ATOM)0;
988}
989
990
991VOID
993{
995 hInstance);
996}
#define msg(x)
Definition: auth_time.c:54
#define IDS_APPNAME
Definition: resource.h:49
#define ID_EXIT
Definition: resource.h:10
#define IDR_POPUP
Definition: resource.h:7
INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:59
#define TBICON_STOP
Definition: resource.h:60
#define IDR_MAINMENU
Definition: resource.h:40
#define IDS_TOOLTIP_PAUSE
Definition: resource.h:25
#define IDS_TOOLTIP_STOP
Definition: resource.h:19
INT_PTR CALLBACK CreateDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: create.c:218
INT_PTR CALLBACK DeleteDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: delete.c:57
VOID ExportFile(PMAIN_WND_INFO Info)
Definition: export.c:98
VOID SetListViewStyle(HWND hListView, DWORD View)
Definition: listview.c:34
BOOL RefreshServiceList(PMAIN_WND_INFO Info)
Definition: listview.c:247
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS *pService, UINT Column)
Definition: listview.c:105
VOID ListViewSelectionChanged(PMAIN_WND_INFO Info, LPNMLISTVIEW pnmv)
Definition: listview.c:48
BOOL CreateListView(PMAIN_WND_INFO Info)
Definition: listview.c:355
VOID UninitMainWindowImpl(VOID)
Definition: mainwnd.c:992
static const TBBUTTON Buttons[]
Definition: mainwnd.c:18
static BOOL InitMainWnd(PMAIN_WND_INFO Info)
Definition: mainwnd.c:334
static BOOL MainWndMenuHint(PMAIN_WND_INFO Info, WORD CmdId, const MENU_HINT *HintArray, DWORD HintsCount, UINT DefHintId)
Definition: mainwnd.c:81
static BOOL pCreateToolbar(PMAIN_WND_INFO Info)
Definition: mainwnd.c:256
static VOID CALLBACK MainWndResize(PMAIN_WND_INFO Info, WORD cx, WORD cy)
Definition: mainwnd.c:610
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
Definition: mainwnd.c:152
static const WCHAR szMainWndClass[]
Definition: mainwnd.c:15
static const MENU_HINT SystemMenuHintTable[]
Definition: mainwnd.c:70
static BOOL CreateStatusBar(PMAIN_WND_INFO Info)
Definition: mainwnd.c:308
VOID UpdateServiceCount(PMAIN_WND_INFO Info)
Definition: mainwnd.c:125
BOOL InitMainWindowImpl(VOID)
Definition: mainwnd.c:966
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:641
static VOID UpdateMainStatusBar(PMAIN_WND_INFO Info)
Definition: mainwnd.c:113
static const MENU_HINT MainMenuHintTable[]
Definition: mainwnd.c:40
static INT CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
Definition: mainwnd.c:243
static VOID MainWndCommand(PMAIN_WND_INFO Info, WORD CmdId, HWND hControl)
Definition: mainwnd.c:379
VOID DisplayString(LPWSTR Msg)
Definition: misc.c:211
HIMAGELIST InitImageList(UINT StartResource, UINT EndResource, UINT Width, UINT Height, ULONG type)
Definition: misc.c:219
VOID GetError(VOID)
Definition: misc.c:192
BOOL StatusBarLoadString(IN HWND hStatusBar, IN INT PartId, IN HINSTANCE hInstance, IN UINT uID)
Definition: misc.c:150
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName)
Definition: query.c:29
VOID OpenPropSheet(PMAIN_WND_INFO Info)
Definition: propsheet.c:30
#define ORD_ASCENDING
Definition: precomp.h:45
HANDLE ProcessHeap
Definition: servman.c:15
struct _MAIN_WND_INFO * PMAIN_WND_INFO
#define ACTION_START
Definition: precomp.h:39
#define NO_ITEM_SELECTED
Definition: precomp.h:26
#define ACTION_RESTART
Definition: precomp.h:43
VOID FreeServiceList(PMAIN_WND_INFO Info)
Definition: query.c:257
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param)
Definition: progress.c:372
#define ACTION_PAUSE
Definition: precomp.h:41
BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS *pService)
Definition: query.c:373
#define LVSTATUS
Definition: precomp.h:31
#define ORD_DESCENDING
Definition: precomp.h:46
#define ACTION_STOP
Definition: precomp.h:40
#define ACTION_RESUME
Definition: precomp.h:42
#define TBICON_CREATE
Definition: resource.h:84
#define ID_VIEW_LARGE
Definition: resource.h:33
#define IDS_HINT_EXPORT
Definition: resource.h:93
#define TBICON_REFRESH
Definition: resource.h:82
#define IDS_HINT_PROP
Definition: resource.h:106
#define ID_START
Definition: resource.h:18
#define IDS_HINT_SYS_CLOSE
Definition: resource.h:123
#define TBICON_RESTART
Definition: resource.h:89
#define ID_DELETE
Definition: resource.h:25
#define TBICON_PAUSE
Definition: resource.h:88
#define IDS_TOOLTIP_CREATE
Definition: resource.h:50
#define ID_HELP
Definition: resource.h:26
#define TBICON_EXPORT
Definition: resource.h:83
#define ID_PROP
Definition: resource.h:15
#define IDS_TOOLTIP_RESTART
Definition: resource.h:55
#define IDC_STATUSBAR
Definition: resource.h:12
#define IDS_HINT_SMALL
Definition: resource.h:109
#define ID_STOP
Definition: resource.h:19
#define IDS_HINT_SYS_MINIMIZE
Definition: resource.h:121
#define IDS_HINT_LARGE
Definition: resource.h:108
#define IDS_HINT_EXIT
Definition: resource.h:94
#define TBICON_DELETE
Definition: resource.h:85
#define IDS_HINT_EDIT
Definition: resource.h:103
#define IDS_HINT_SYS_SIZE
Definition: resource.h:120
#define IDS_DELETE_STOP
Definition: resource.h:199
#define IDS_HINT_SYS_RESTORE
Definition: resource.h:118
#define IDS_HINT_ABOUT
Definition: resource.h:115
#define IDS_TOOLTIP_EXPORT
Definition: resource.h:49
#define IDS_HINT_REFRESH
Definition: resource.h:102
#define IDB_PROP
Definition: resource.h:70
#define ID_VIEW_CUST
Definition: resource.h:32
#define ID_PAUSE
Definition: resource.h:20
#define IDD_DLG_DELETE
Definition: resource.h:195
#define IDS_TOOLTIP_REFRESH
Definition: resource.h:48
#define IDS_TOOLTIP_PROP
Definition: resource.h:47
#define IDS_NUM_SERVICES
Definition: resource.h:62
#define ID_EXPORT
Definition: resource.h:17
#define IDS_HINT_STOP
Definition: resource.h:98
#define IDS_HINT_LIST
Definition: resource.h:110
#define IDD_DLG_CREATE
Definition: resource.h:181
#define IDS_HINT_BLANK
Definition: resource.h:92
#define IDS_HINT_START
Definition: resource.h:97
#define ID_REFRESH
Definition: resource.h:16
#define ID_CONNECT
Definition: resource.h:28
#define IDS_HINT_SYS_MOVE
Definition: resource.h:119
#define IDI_SM_ICON
Definition: resource.h:64
#define IDS_HINT_PAUSE
Definition: resource.h:99
#define IDB_RESTART
Definition: resource.h:78
#define IDS_HINT_CREATE
Definition: resource.h:104
#define ID_VIEW_SMALL
Definition: resource.h:34
#define IDS_HINT_CONNECT
Definition: resource.h:96
#define ID_VIEW_DETAILS
Definition: resource.h:36
#define IDS_HINT_DETAILS
Definition: resource.h:111
#define IDS_HINT_DELETE
Definition: resource.h:105
#define ID_CREATE
Definition: resource.h:24
#define IDS_HINT_CUST
Definition: resource.h:112
#define ID_VIEW_LIST
Definition: resource.h:35
#define IDS_TOOLTIP_START
Definition: resource.h:52
#define IDS_HINT_RESUME
Definition: resource.h:100
#define ID_RESUME
Definition: resource.h:21
#define IDS_HINT_HELP
Definition: resource.h:114
#define IDS_TOOLTIP_DELETE
Definition: resource.h:51
#define ID_RESTART
Definition: resource.h:22
#define IDS_HINT_SYS_MAXIMIZE
Definition: resource.h:122
#define IDS_HINT_RESTART
Definition: resource.h:101
#define ID_EDIT
Definition: resource.h:23
#define IDS_APPAUTHORS
Definition: resource.h:8
#define TBICON_START
Definition: resource.h:86
#define TBICON_PROP
Definition: resource.h:81
HWND CreateMainWindow()
Definition: biditext.c:330
return Found
Definition: dirsup.c:1270
HINSTANCE hInstance
Definition: charmap.c:19
#define ID_ABOUT
Definition: charmap.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
WORD ATOM
Definition: dimm.idl:113
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
Definition: imagelist.c:928
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define pt(x, y)
Definition: drawing.c:79
switch(r->id)
Definition: btrfs.c:3046
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
HWND hMainWnd
Definition: magnifier.c:32
int _snwprintf(wchar_t *buffer, size_t count, const wchar_t *format,...)
#define SB_SIMPLEID
Definition: precomp.h:15
static HICON
Definition: imagelist.c:84
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
HMENU hMainMenu
Definition: mplay32.c:25
HICON hIcon
Definition: msconfig.c:44
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CHILD
Definition: pedump.c:617
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define Header_GetItem(hwndHD, i, phdi)
Definition: commctrl.h:751
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
#define SB_SIMPLE
Definition: commctrl.h:1958
#define TB_ADDBUTTONS
Definition: commctrl.h:1271
#define BTNS_BUTTON
Definition: commctrl.h:998
#define TB_SETEXTENDEDSTYLE
Definition: commctrl.h:1190
#define TB_AUTOSIZE
Definition: commctrl.h:1137
#define LVS_ICON
Definition: commctrl.h:2261
#define TBSTATE_INDETERMINATE
Definition: commctrl.h:976
#define LVN_COLUMNCLICK
Definition: commctrl.h:3139
#define NM_DBLCLK
Definition: commctrl.h:131
#define TBSTYLE_TOOLTIPS
Definition: commctrl.h:989
#define Header_SetItem(hwndHD, i, phdi)
Definition: commctrl.h:758
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2684
#define TB_SETSTATE
Definition: commctrl.h:1054
#define BTNS_SEP
Definition: commctrl.h:999
#define LVS_REPORT
Definition: commctrl.h:2262
#define LVS_SMALLICON
Definition: commctrl.h:2263
#define LVA_DEFAULT
Definition: commctrl.h:2527
#define TB_BUTTONSTRUCTSIZE
Definition: commctrl.h:1134
_Out_opt_ int * cx
Definition: commctrl.h:585
#define TTN_GETDISPINFO
Definition: commctrl.h:1878
#define ListView_Arrange(hwndLV, code)
Definition: commctrl.h:2533
#define TB_SETIMAGELIST
Definition: commctrl.h:1150
#define TBSTYLE_EX_HIDECLIPPEDBUTTONS
Definition: commctrl.h:1013
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define NM_RETURN
Definition: commctrl.h:132
struct tagNMLISTVIEW * LPNMLISTVIEW
#define TBSTATE_ENABLED
Definition: commctrl.h:974
#define TBSTYLE_FLAT
Definition: commctrl.h:992
#define HDI_LPARAM
Definition: commctrl.h:706
#define TOOLBARCLASSNAME
Definition: commctrl.h:946
#define SB_SETTEXT
Definition: commctrl.h:1949
#define SB_SETPARTS
Definition: commctrl.h:1954
#define SBARS_SIZEGRIP
Definition: commctrl.h:1923
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
#define HDITEM
Definition: commctrl.h:697
#define ListView_SortItemsEx(hwndLV, _pfnCompare, _lPrm)
Definition: commctrl.h:2801
#define STATUSCLASSNAME
Definition: commctrl.h:1939
#define LVS_LIST
Definition: commctrl.h:2264
#define LPTOOLTIPTEXT
Definition: commctrl.h:1890
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_NOTIFY
Definition: richedit.h:61
#define DefWindowProc
Definition: ros2win.h:31
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
#define _countof(array)
Definition: sndvol32.h:68
TCHAR szAppName[128]
Definition: solitaire.cpp:17
& rect
Definition: startmenu.cpp:1413
UINT HintId
Definition: precomp.h:89
WORD CmdId
Definition: precomp.h:88
HINSTANCE hInstance
Definition: winuser.h:3196
HCURSOR hCursor
Definition: winuser.h:3198
LPCSTR lpszMenuName
Definition: winuser.h:3200
HICON hIconSm
Definition: winuser.h:3202
UINT cbSize
Definition: winuser.h:3191
WNDPROC lpfnWndProc
Definition: winuser.h:3193
LPCSTR lpszClassName
Definition: winuser.h:3201
HICON hIcon
Definition: winuser.h:3197
HBRUSH hbrBackground
Definition: winuser.h:3199
UINT code
Definition: winuser.h:3149
UINT uNewState
Definition: commctrl.h:3036
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_USERDATA
Definition: treelist.c:63
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HIWORD(l)
Definition: typedefs.h:247
int ret
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_ACCEPT_PAUSE_CONTINUE
Definition: winsvc.h:29
#define CreateWindowEx
Definition: winuser.h:5745
#define MAKEWPARAM(l, h)
Definition: winuser.h:3999
#define WM_CLOSE
Definition: winuser.h:1611
#define MF_BYCOMMAND
Definition: winuser.h:202
#define IMAGE_BITMAP
Definition: winuser.h:211
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IMAGE_ICON
Definition: winuser.h:212
#define TPM_RIGHTBUTTON
Definition: winuser.h:2370
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define WM_CREATE
Definition: winuser.h:1598
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_SIZE
Definition: winuser.h:1601
#define WM_COMMAND
Definition: winuser.h:1730
#define IDC_ARROW
Definition: winuser.h:682
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2639
#define UnregisterClass
Definition: winuser.h:5851
#define DialogBoxParam
Definition: winuser.h:5754
BOOL WINAPI TrackPopupMenuEx(_In_ HMENU, _In_ UINT, _In_ int, _In_ int, _In_ HWND, _In_opt_ LPTPMPARAMS)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define IDOK
Definition: winuser.h:824
#define SC_SIZE
Definition: winuser.h:2574
#define SC_MINIMIZE
Definition: winuser.h:2576
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define SM_CXSMICON
Definition: winuser.h:1006
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define RegisterClassEx
Definition: winuser.h:5827
#define WM_ENTERMENULOOP
Definition: winuser.h:1794
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
HWND WINAPI SetFocus(_In_opt_ HWND)
#define MF_ENABLED
Definition: winuser.h:128
#define LoadIcon
Definition: winuser.h:5803
struct tagNMHDR * LPNMHDR
#define SendMessage
Definition: winuser.h:5833
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define LoadCursor
Definition: winuser.h:5802
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5709
#define WM_EXITMENULOOP
Definition: winuser.h:1795
#define SC_CLOSE
Definition: winuser.h:2582
#define SC_MOVE
Definition: winuser.h:2575
#define LR_SHARED
Definition: winuser.h:1094
#define LoadMenu
Definition: winuser.h:5807
#define MB_OK
Definition: winuser.h:784
#define PostMessage
Definition: winuser.h:5822
#define CW_USEDEFAULT
Definition: winuser.h:225
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define LoadImage
Definition: winuser.h:5805
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define LoadString
Definition: winuser.h:5809
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define WM_DESTROY
Definition: winuser.h:1599
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SWP_NOZORDER
Definition: winuser.h:1237
#define WM_MENUSELECT
Definition: winuser.h:1737
#define SC_RESTORE
Definition: winuser.h:2588
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
#define MAKEINTRESOURCE
Definition: winuser.h:591
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2044
int WINAPI GetSystemMetrics(_In_ int)
HMENU WINAPI GetMenu(_In_ HWND)
#define SC_MAXIMIZE
Definition: winuser.h:2578
#define COLOR_BTNFACE
Definition: winuser.h:922
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define MF_GRAYED
Definition: winuser.h:129
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define SERVICE_DISABLED
Definition: cmtypes.h:979
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const CHAR * LPCTSTR
Definition: xmlstorage.h:193