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