* Sync with trunk r64401.
[reactos.git] / base / applications / mscutils / servman / precomp.h
1 #ifndef __SERVMAN_PRECOMP_H
2 #define __SERVMAN_PRECOMP_H
3
4 #include <stdarg.h>
5
6 #define WIN32_NO_STATUS
7 #define _INC_WINDOWS
8 #define COM_NO_WINDOWS_H
9
10 #include <windef.h>
11 #include <winbase.h>
12 #include <wingdi.h>
13 #include <winsvc.h>
14 #include <wincon.h>
15 #include <tchar.h>
16 #include <shlobj.h>
17 #include <strsafe.h>
18
19 #include "resource.h"
20
21 #ifdef _MSC_VER
22 #pragma warning(disable : 4100)
23 #endif
24
25 #define NO_ITEM_SELECTED -1
26 #define MAX_KEY_LENGTH 256
27
28 #define LVNAME 0
29 #define LVDESC 1
30 #define LVSTATUS 2
31 #define LVSTARTUP 3
32 #define LVLOGONAS 4
33
34 #define IMAGE_UNKNOWN 0
35 #define IMAGE_SERVICE 1
36 #define IMAGE_DRIVER 2
37
38 typedef struct _MAIN_WND_INFO
39 {
40 HWND hMainWnd;
41 HWND hListView;
42 HWND hStatus;
43 HWND hTool;
44 HMENU hShortcutMenu;
45 int nCmdShow;
46
47 ENUM_SERVICE_STATUS_PROCESS *pAllServices;
48 ENUM_SERVICE_STATUS_PROCESS *pCurrentService;
49
50 INT SelectedItem;/* selection number in the list view */
51 BOOL bDlgOpen;
52 BOOL bInMenuLoop;
53 BOOL bIsUserAnAdmin;
54
55 PVOID pTag;
56
57 } MAIN_WND_INFO, *PMAIN_WND_INFO;
58
59
60 INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
61 INT_PTR CALLBACK CreateDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
62 INT_PTR CALLBACK DeleteDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
63 INT_PTR CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
64
65
66 /* servman.c */
67 extern HINSTANCE hInstance;
68 extern HANDLE ProcessHeap;
69
70 /* mainwnd.c */
71 typedef struct _MENU_HINT
72 {
73 WORD CmdId;
74 UINT HintId;
75 } MENU_HINT, *PMENU_HINT;
76
77 VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info);
78 VOID UpdateServiceCount(PMAIN_WND_INFO Info);
79 VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS* pService, UINT Column);
80 BOOL InitMainWindowImpl(VOID);
81 VOID UninitMainWindowImpl(VOID);
82 HWND CreateMainWindow(LPCTSTR lpCaption, int nCmdShow);
83
84 /* listview.c */
85 VOID SetListViewStyle(HWND hListView, DWORD View);
86 VOID ListViewSelectionChanged(PMAIN_WND_INFO Info, LPNMLISTVIEW pnmv);
87 BOOL CreateListView(PMAIN_WND_INFO Info);
88
89 /* start */
90 BOOL DoStart(PMAIN_WND_INFO Info, LPWSTR lpStartParams);
91
92 /* stop */
93 typedef struct _STOP_INFO
94 {
95 PMAIN_WND_INFO pInfo;
96 SC_HANDLE hSCManager;
97 SC_HANDLE hMainService;
98 } STOP_INFO, *PSTOP_INFO;
99
100 /* control */
101 BOOL Control(PMAIN_WND_INFO Info, HWND hProgress, DWORD Control);
102 BOOL DoStop(PMAIN_WND_INFO Info);
103 BOOL DoPause(PMAIN_WND_INFO Info);
104 BOOL DoResume(PMAIN_WND_INFO Info);
105
106 /* progress.c */
107 #define DEFAULT_STEP 0
108 HWND CreateProgressDialog(HWND hParent, UINT LabelId);
109 BOOL DestroyProgressDialog(HWND hProgress, BOOL bComplete);
110 VOID InitializeProgressDialog(HWND hProgress, LPWSTR lpServiceName);
111 VOID IncrementProgressBar(HWND hProgress, UINT NewPos);
112 VOID CompleteProgressBar(HWND hProgress);
113
114 /* query.c */
115 ENUM_SERVICE_STATUS_PROCESS* GetSelectedService(PMAIN_WND_INFO Info);
116 LPQUERY_SERVICE_CONFIG GetServiceConfig(LPTSTR lpServiceName);
117 BOOL SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, LPTSTR lpServiceName, LPTSTR lpPassword);
118 LPTSTR GetServiceDescription(LPTSTR lpServiceName);
119 BOOL SetServiceDescription(LPTSTR lpServiceName, LPTSTR lpDescription);
120 LPTSTR GetExecutablePath(LPTSTR lpServiceName);
121 BOOL RefreshServiceList(PMAIN_WND_INFO Info);
122 BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS* pService);
123 BOOL GetServiceList(PMAIN_WND_INFO Info, DWORD *NumServices);
124
125
126 /* propsheet.c */
127 typedef struct _SERVICEPROPSHEET
128 {
129 PMAIN_WND_INFO Info;
130 ENUM_SERVICE_STATUS_PROCESS *pService;
131 HIMAGELIST hDependsImageList;
132 HWND hDependsWnd;
133 HWND hDependsTreeView1;
134 HWND hDependsTreeView2;
135 } SERVICEPROPSHEET, *PSERVICEPROPSHEET;
136
137
138 HTREEITEM AddItemToTreeView(HWND hTreeView, HTREEITEM hRoot, LPTSTR lpDisplayName, LPTSTR lpServiceName, ULONG serviceType, BOOL bHasChildren);
139
140 /* stop_dependencies */
141 INT_PTR CALLBACK StopDependsDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
142 LPWSTR GetListOfServicesToStop(LPWSTR lpServiceName);
143
144 /* tv1_dependencies */
145 BOOL TV1_Initialize(PSERVICEPROPSHEET pDlgInfo, LPTSTR lpServiceName);
146 VOID TV1_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, HTREEITEM hParent, LPTSTR lpServiceName);
147
148 /* tv2_dependencies */
149 BOOL TV2_Initialize(PSERVICEPROPSHEET pDlgInfo, LPTSTR lpServiceName);
150 VOID TV2_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, HTREEITEM hParent, LPTSTR lpServiceName);
151 BOOL TV2_HasDependantServices(LPWSTR lpServiceName);
152 LPENUM_SERVICE_STATUS TV2_GetDependants(LPWSTR lpServiceName, LPDWORD lpdwCount);
153
154 LONG APIENTRY OpenPropSheet(PMAIN_WND_INFO Info);
155
156 /* propsheet window procs */
157 INT_PTR CALLBACK DependenciesPageProc(HWND hwndDlg,
158 UINT uMsg,
159 WPARAM wParam,
160 LPARAM lParam);
161 INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg,
162 UINT uMsg,
163 WPARAM wParam,
164 LPARAM lParam);
165
166 /* export.c */
167 VOID ExportFile(PMAIN_WND_INFO Info);
168
169 /* misc.c */
170 INT AllocAndLoadString(OUT LPTSTR *lpTarget,
171 IN HINSTANCE hInst,
172 IN UINT uID);
173 DWORD LoadAndFormatString(IN HINSTANCE hInstance,
174 IN UINT uID,
175 OUT LPTSTR *lpTarget,
176 ...);
177 BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar,
178 IN INT PartId,
179 IN HINSTANCE hInstance,
180 IN UINT uID,
181 ...);
182 BOOL StatusBarLoadString(IN HWND hStatusBar,
183 IN INT PartId,
184 IN HINSTANCE hInstance,
185 IN UINT uID);
186 INT GetTextFromEdit(OUT LPTSTR lpString,
187 IN HWND hDlg,
188 IN UINT Res);
189 VOID GetError(VOID);
190 VOID DisplayString(PTCHAR);
191 HIMAGELIST InitImageList(UINT StartResource,
192 UINT EndResource,
193 UINT Width,
194 UINT Height,
195 ULONG type);
196
197 #endif /* __SERVMAN_PRECOMP_H */