- Promote service start failures from TRACE to ERR.
[reactos.git] / reactos / base / system / services / services.h
1 /*
2 * services.h
3 */
4
5 #include <stdio.h>
6 #define WIN32_NO_STATUS
7 #include <windows.h>
8 #define NTOS_MODE_USER
9 #include <ndk/ntndk.h>
10 #include <services/services.h>
11
12
13 typedef struct _SERVICE_GROUP
14 {
15 LIST_ENTRY GroupListEntry;
16 LPWSTR lpGroupName;
17
18 DWORD dwRefCount;
19 BOOLEAN ServicesRunning;
20 ULONG TagCount;
21 PULONG TagArray;
22
23 WCHAR szGroupName[1];
24 } SERVICE_GROUP, *PSERVICE_GROUP;
25
26
27 typedef struct _SERVICE_IMAGE
28 {
29 DWORD dwServiceRefCount; // Number of running services of this image
30 DWORD Dummy;
31 } SERVICE_IMAGE, *PSERVICE_IMAGE;
32
33
34 typedef struct _SERVICE
35 {
36 LIST_ENTRY ServiceListEntry;
37 LPWSTR lpServiceName;
38 LPWSTR lpDisplayName;
39 PSERVICE_GROUP lpGroup;
40 PSERVICE_IMAGE lpImage;
41 BOOL bDeleted;
42 DWORD dwResumeCount;
43 DWORD dwRefCount;
44
45 SERVICE_STATUS Status;
46 DWORD dwStartType;
47 DWORD dwErrorControl;
48 DWORD dwTag;
49
50 ULONG Flags;
51
52 PSECURITY_DESCRIPTOR lpSecurityDescriptor;
53
54 BOOLEAN ServiceVisited;
55
56 HANDLE ControlPipeHandle;
57 ULONG ProcessId;
58 ULONG ThreadId;
59
60 WCHAR szServiceName[1];
61 } SERVICE, *PSERVICE;
62
63
64 /* VARIABLES ***************************************************************/
65
66 extern LIST_ENTRY ServiceListHead;
67 extern LIST_ENTRY GroupListHead;
68 extern BOOL ScmShutdown;
69
70
71 /* FUNCTIONS ***************************************************************/
72
73 /* config.c */
74
75 DWORD ScmOpenServiceKey(LPWSTR lpServiceName,
76 REGSAM samDesired,
77 PHKEY phKey);
78
79 DWORD ScmCreateServiceKey(LPCWSTR lpServiceName,
80 REGSAM samDesired,
81 PHKEY phKey);
82
83 DWORD ScmWriteDependencies(HKEY hServiceKey,
84 LPWSTR lpDependencies,
85 DWORD dwDependenciesLength);
86
87 DWORD ScmMarkServiceForDelete(PSERVICE pService);
88 BOOL ScmIsDeleteFlagSet(HKEY hServiceKey);
89
90 DWORD ScmReadString(HKEY hServiceKey,
91 LPWSTR lpValueName,
92 LPWSTR *lpValue);
93
94 DWORD
95 ScmReadDependencies(HKEY hServiceKey,
96 LPWSTR *lpDependencies,
97 DWORD *lpdwDependenciesLength);
98
99
100 /* database.c */
101
102 DWORD ScmCreateServiceDatabase(VOID);
103 VOID ScmShutdownServiceDatabase(VOID);
104 VOID ScmGetBootAndSystemDriverState(VOID);
105 VOID ScmAutoStartServices(VOID);
106 VOID ScmAutoShutdownServices(VOID);
107 DWORD ScmStartService(PSERVICE Service,
108 DWORD argc,
109 LPWSTR *argv);
110
111 PSERVICE ScmGetServiceEntryByName(LPCWSTR lpServiceName);
112 PSERVICE ScmGetServiceEntryByDisplayName(LPCWSTR lpDisplayName);
113 PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount);
114 DWORD ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
115 PSERVICE *lpServiceRecord);
116 VOID ScmDeleteServiceRecord(PSERVICE lpService);
117 DWORD ScmMarkServiceForDelete(PSERVICE pService);
118
119 DWORD ScmControlService(PSERVICE Service,
120 DWORD dwControl);
121
122 BOOL ScmLockDatabaseExclusive(VOID);
123 BOOL ScmLockDatabaseShared(VOID);
124 VOID ScmUnlockDatabase(VOID);
125
126
127 /* driver.c */
128
129 DWORD ScmLoadDriver(PSERVICE lpService);
130 DWORD ScmUnloadDriver(PSERVICE lpService);
131 DWORD ScmControlDriver(PSERVICE lpService,
132 DWORD dwControl,
133 LPSERVICE_STATUS lpServiceStatus);
134
135
136 /* groupdb.c */
137
138 DWORD ScmCreateGroupList(VOID);
139 DWORD ScmSetServiceGroup(PSERVICE lpService,
140 LPCWSTR lpGroupName);
141
142
143 /* rpcserver.c */
144
145 VOID ScmStartRpcServer(VOID);
146
147
148 /* services.c */
149
150 VOID PrintString(LPCSTR fmt, ...);
151
152 /* EOF */
153