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