ReactOS 0.4.15-dev-7788-g1ad9096
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
386 UNREFERENCED_PARAMETER(hControl);
387
388 switch (CmdId)
389 {
390 case ID_PROP:
391 {
392 if (Info->SelectedItem != NO_ITEM_SELECTED)
393 {
394 Info->bDlgOpen = TRUE;
396 Info->bDlgOpen = FALSE;
398 }
399 }
400 break;
401
402 case ID_REFRESH:
403 {
405 Info->SelectedItem = NO_ITEM_SELECTED;
406
407 /* disable menus and buttons */
409
410 /* clear the service in the status bar */
411 SendMessage(Info->hStatus,
413 1,
414 L'\0');
415 }
416 break;
417
418 case ID_EXPORT:
419 {
421 SetFocus(Info->hListView);
422 }
423 break;
424
425 case ID_CREATE:
426 {
427 INT ret;
428
431 Info->hMainWnd,
433 (LPARAM)Info);
434 if (ret == IDOK)
436
437 SetFocus(Info->hListView);
438 }
439 break;
440
441 case ID_DELETE:
442 {
443 if (Info->pCurrentService->ServiceStatusProcess.dwCurrentState != SERVICE_RUNNING)
444 {
447 Info->hMainWnd,
449 (LPARAM)Info);
450 }
451 else
452 {
453 WCHAR Buf[60];
456 Buf,
457 sizeof(Buf) / sizeof(WCHAR));
458 DisplayString(Buf);
459 }
460
461 SetFocus(Info->hListView);
462
463 }
464 break;
465
466 case ID_START:
467 {
468 RunActionWithProgress(Info->hMainWnd,
469 Info->pCurrentService->lpServiceName,
470 Info->pCurrentService->lpDisplayName,
472 NULL); //FIXME: Add start params
473
474 UpdateServiceStatus(Info->pCurrentService);
475 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
477 SetFocus(Info->hListView);
478
479 }
480 break;
481
482 case ID_STOP:
483 RunActionWithProgress(Info->hMainWnd,
484 Info->pCurrentService->lpServiceName,
485 Info->pCurrentService->lpDisplayName,
487 NULL);
488
489 UpdateServiceStatus(Info->pCurrentService);
490 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
492 SetFocus(Info->hListView);
493
494 break;
495
496 case ID_PAUSE:
497 RunActionWithProgress(Info->hMainWnd,
498 Info->pCurrentService->lpServiceName,
499 Info->pCurrentService->lpDisplayName,
501 NULL);
502
503 UpdateServiceStatus(Info->pCurrentService);
504 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
506 SetFocus(Info->hListView);
507 break;
508
509 case ID_RESUME:
510 RunActionWithProgress(Info->hMainWnd,
511 Info->pCurrentService->lpServiceName,
512 Info->pCurrentService->lpDisplayName,
514 NULL);
515
516 UpdateServiceStatus(Info->pCurrentService);
517 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
519 SetFocus(Info->hListView);
520 break;
521
522 case ID_RESTART:
523 RunActionWithProgress(Info->hMainWnd,
524 Info->pCurrentService->lpServiceName,
525 Info->pCurrentService->lpDisplayName,
527 NULL);
528
529 UpdateServiceStatus(Info->pCurrentService);
530 ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
532 SetFocus(Info->hListView);
533 break;
534
535 case ID_HELP:
537 L"Help is not yet implemented\n",
538 L"Note!",
540 SetFocus(Info->hListView);
541 break;
542
543 case ID_EXIT:
544 PostMessage(Info->hMainWnd,
545 WM_CLOSE,
546 0,
547 0);
548 break;
549
550 case ID_VIEW_LARGE:
551 SetListViewStyle(Info->hListView, LVS_ICON);
552 ListView_Arrange(Info->hListView, LVA_DEFAULT);
553
559 break;
560
561 case ID_VIEW_SMALL:
563 ListView_Arrange(Info->hListView, LVA_DEFAULT);
564
570 break;
571
572 case ID_VIEW_LIST:
573 SetListViewStyle(Info->hListView,
574 LVS_LIST);
580 break;
581
582 case ID_VIEW_DETAILS:
583 SetListViewStyle(Info->hListView,
584 LVS_REPORT);
590 break;
591
592 case ID_VIEW_CUST:
593 break;
594
595 case ID_ABOUT:
597 LoadStringW(hInstance, IDS_APPAUTHORS, szAppAuthors, _countof(szAppAuthors));
598
599 ShellAboutW(Info->hMainWnd, szAppName, szAppAuthors,
601 break;
602
603 }
604}
605
606
607static VOID CALLBACK
609 WORD cx,
610 WORD cy)
611{
612 RECT rcClient, rcTool, rcStatus;
613 int lvHeight, iToolHeight, iStatusHeight;
614
615 /* Size toolbar and get height */
616 SendMessage(Info->hTool, TB_AUTOSIZE, 0, 0);
617 GetWindowRect(Info->hTool, &rcTool);
618 iToolHeight = rcTool.bottom - rcTool.top;
619
620 /* Size status bar and get height */
621 SendMessage(Info->hStatus, WM_SIZE, 0, 0);
622 GetWindowRect(Info->hStatus, &rcStatus);
623 iStatusHeight = rcStatus.bottom - rcStatus.top;
624
625 /* Calculate remaining height and size list view */
626 GetClientRect(Info->hMainWnd, &rcClient);
627 lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
628 SetWindowPos(Info->hListView,
629 NULL,
630 0,
631 iToolHeight,
632 rcClient.right,
633 lvHeight,
635}
636
637
638static LRESULT CALLBACK
640 UINT msg,
643{
645 LRESULT Ret = 0;
646
647 /* Get the window context */
650 if (Info == NULL && msg != WM_CREATE)
651 {
652 goto HandleDefaultMessage;
653 }
654
655 switch(msg)
656 {
657 case WM_CREATE:
658 {
659 Info = (PMAIN_WND_INFO)(((LPCREATESTRUCT)lParam)->lpCreateParams);
660
661 /* Initialize the main window context */
662 Info->hMainWnd = hwnd;
663 Info->SelectedItem = NO_ITEM_SELECTED;
664
667 (LONG_PTR)Info);
668
669 if (!InitMainWnd(Info))
670 return -1;
671
672 /* Fill the list-view before showing the main window */
674
675 /* Show the window */
677 Info->nCmdShow);
678
679 SetFocus(Info->hListView);
680 }
681 break;
682
683 case WM_SIZE:
684 {
686 LOWORD(lParam),
687 HIWORD(lParam));
688 }
689 break;
690
691 case WM_NOTIFY:
692 {
693 LPNMHDR pnmhdr = (LPNMHDR)lParam;
694
695 switch (pnmhdr->code)
696 {
697 case NM_DBLCLK:
698 {
699 POINT pt;
700 RECT rect;
701
703 GetWindowRect(Info->hListView, &rect);
704
705 if (PtInRect(&rect, pt))
706 {
709 //ID_PROP,
711 0);
712 }
713
714 //OpenPropSheet(Info);
715 }
716 break;
717
718 case NM_RETURN:
719 {
722 //ID_PROP,
724 0);
725 }
726 break;
727
728 case LVN_COLUMNCLICK:
729 {
731 HDITEM hdi;
732
733 /* get pending sort direction for clicked column */
734 hdi.mask = HDI_LPARAM;
735 (void)Header_GetItem(Info->hHeader, pnmv->iSubItem, &hdi);
736
737 /* get new sort parameters */
738 Info->SortSelection = pnmv->iSubItem;
739 Info->SortDirection = hdi.lParam;
740
741 /* set new sort direction and save */
742 hdi.lParam = (hdi.lParam == ORD_ASCENDING) ?
744
745 (void)Header_SetItem(Info->hHeader, pnmv->iSubItem, &hdi);
746
747 (void)ListView_SortItemsEx(Info->hListView,
749 (LPARAM)Info);
750 }
751 break;
752 case LVN_ITEMCHANGED:
753 {
755
756 if (pnmv->uNewState != 0)
757 {
760 }
761 }
762 break;
763
764 case TTN_GETDISPINFO:
765 {
766 LPTOOLTIPTEXT lpttt;
767 UINT idButton;
768
769 lpttt = (LPTOOLTIPTEXT)lParam;
770
771 /* Specify the resource identifier of the descriptive
772 * text for the given button. */
773 idButton = (UINT)lpttt->hdr.idFrom;
774 switch (idButton)
775 {
776 case ID_PROP:
777 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PROP);
778 break;
779
780 case ID_REFRESH:
781 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_REFRESH);
782 break;
783
784 case ID_EXPORT:
785 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT);
786 break;
787
788 case ID_CREATE:
789 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_CREATE);
790 break;
791
792 case ID_DELETE:
793 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_DELETE);
794 break;
795
796 case ID_START:
797 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_START);
798 break;
799
800 case ID_STOP:
801 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_STOP);
802 break;
803
804 case ID_PAUSE:
805 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_PAUSE);
806 break;
807
808 case ID_RESTART:
809 lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_RESTART);
810 break;
811 }
812 }
813 break;
814 }
815 }
816 break;
817
818 case WM_CONTEXTMENU:
819 {
820 POINT pt;
821 RECT lvRect;
822
823 INT xPos = GET_X_LPARAM(lParam);
824 INT yPos = GET_Y_LPARAM(lParam);
825
827
828 /* display popup when cursor is in the list view */
829 GetWindowRect(Info->hListView, &lvRect);
830 if (PtInRect(&lvRect, pt))
831 {
832 TrackPopupMenuEx(GetSubMenu(Info->hShortcutMenu, 0),
834 xPos,
835 yPos,
836 Info->hMainWnd,
837 NULL);
838 }
839 }
840 break;
841
842 case WM_COMMAND:
843 {
845 LOWORD(wParam),
846 (HWND)lParam);
847 goto HandleDefaultMessage;
848 }
849
850 case WM_MENUSELECT:
851 {
852 if (Info->hStatus != NULL)
853 {
855 LOWORD(wParam),
857 sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
859 {
861 LOWORD(wParam),
863 sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
865 }
866 }
867 }
868 break;
869
870 case WM_ENTERMENULOOP:
871 {
872 Info->bInMenuLoop = TRUE;
874 break;
875 }
876
877 case WM_EXITMENULOOP:
878 {
879 Info->bInMenuLoop = FALSE;
881 break;
882 }
883
884 case WM_CLOSE:
885 {
887 DestroyMenu(Info->hShortcutMenu);
889 }
890 break;
891
892 case WM_DESTROY:
893 {
895 0,
896 Info);
899 0);
900
902 }
903 break;
904
905 default:
906 {
907HandleDefaultMessage:
908
909 Ret = DefWindowProc(hwnd,
910 msg,
911 wParam,
912 lParam);
913 }
914 break;
915 }
916
917 return Ret;
918}
919
920
921
922HWND
924 int nCmdShow)
925{
928
931 sizeof(MAIN_WND_INFO));
932
933 if (Info != NULL)
934 {
935 Info->nCmdShow = nCmdShow;
936
939 lpCaption,
943 680,
944 450,
945 NULL,
946 NULL,
947 hInstance,
948 Info);
949 if (hMainWnd == NULL)
950 {
951 //int ret;
952 //ret = GetLastError();
953 GetError();
955 0,
956 Info);
957 }
958 }
959
960 return hMainWnd;
961}
962
963BOOL
965{
966 WNDCLASSEX wc = {0};
967
968 wc.cbSize = sizeof(WNDCLASSEX);
970 wc.hInstance = hInstance;
974 IDC_ARROW);
975 wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
981 16,
982 16,
983 LR_SHARED);
984
985 return RegisterClassEx(&wc) != (ATOM)0;
986}
987
988
989VOID
991{
993 hInstance);
994}
#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:108
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:990
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:608
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:964
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: mainwnd.c:639
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:46
HANDLE ProcessHeap
Definition: servman.c:15
struct _MAIN_WND_INFO * PMAIN_WND_INFO
#define ACTION_START
Definition: precomp.h:40
#define NO_ITEM_SELECTED
Definition: precomp.h:26
#define ACTION_RESTART
Definition: precomp.h:44
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:42
BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS *pService)
Definition: query.c:373
#define LVSTATUS
Definition: precomp.h:31
#define ORD_DESCENDING
Definition: precomp.h:47
#define ACTION_STOP
Definition: precomp.h:41
#define ACTION_RESUME
Definition: precomp.h:43
#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:63
HMENU hMainMenu
Definition: mplay32.c:25
__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:18
& rect
Definition: startmenu.cpp:1413
UINT HintId
Definition: precomp.h:90
WORD CmdId
Definition: precomp.h:89
HINSTANCE hInstance
Definition: winuser.h:3206
HCURSOR hCursor
Definition: winuser.h:3208
LPCSTR lpszMenuName
Definition: winuser.h:3210
HICON hIconSm
Definition: winuser.h:3212
UINT cbSize
Definition: winuser.h:3201
WNDPROC lpfnWndProc
Definition: winuser.h:3203
LPCSTR lpszClassName
Definition: winuser.h:3211
HICON hIcon
Definition: winuser.h:3207
HBRUSH hbrBackground
Definition: winuser.h:3209
UINT code
Definition: winuser.h:3159
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:5755
#define MAKEWPARAM(l, h)
Definition: winuser.h:4009
#define WM_CLOSE
Definition: winuser.h:1621
#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:2380
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define WM_CREATE
Definition: winuser.h:1608
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:1611
#define WM_COMMAND
Definition: winuser.h:1740
#define IDC_ARROW
Definition: winuser.h:687
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2670
#define UnregisterClass
Definition: winuser.h:5861
#define DialogBoxParam
Definition: winuser.h:5764
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:830
#define SC_SIZE
Definition: winuser.h:2584
#define SC_MINIMIZE
Definition: winuser.h:2586
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define SM_CXSMICON
Definition: winuser.h:1012
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define RegisterClassEx
Definition: winuser.h:5837
#define WM_ENTERMENULOOP
Definition: winuser.h:1804
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:5813
struct tagNMHDR * LPNMHDR
#define SendMessage
Definition: winuser.h:5843
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define LoadCursor
Definition: winuser.h:5812
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5719
#define WM_EXITMENULOOP
Definition: winuser.h:1805
#define SC_CLOSE
Definition: winuser.h:2592
#define SC_MOVE
Definition: winuser.h:2585
#define LR_SHARED
Definition: winuser.h:1100
#define LoadMenu
Definition: winuser.h:5817
#define MB_OK
Definition: winuser.h:790
#define PostMessage
Definition: winuser.h:5832
#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:5815
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define LoadString
Definition: winuser.h:5819
#define MB_ICONINFORMATION
Definition: winuser.h:802
#define WM_DESTROY
Definition: winuser.h:1609
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define SWP_NOZORDER
Definition: winuser.h:1247
#define WM_MENUSELECT
Definition: winuser.h:1747
#define SC_RESTORE
Definition: winuser.h:2598
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:2075
int WINAPI GetSystemMetrics(_In_ int)
HMENU WINAPI GetMenu(_In_ HWND)
#define SC_MAXIMIZE
Definition: winuser.h:2588
#define COLOR_BTNFACE
Definition: winuser.h:928
#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