- Merge from trunk up to r45543
[reactos.git] / 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 CLIENT_HANDLE hClient;
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 PSERVICE ScmGetServiceEntryByClientHandle(HANDLE Handle);
116 DWORD ScmCreateNewServiceRecord(LPCWSTR lpServiceName,
117 PSERVICE *lpServiceRecord);
118 VOID ScmDeleteServiceRecord(PSERVICE lpService);
119 DWORD ScmMarkServiceForDelete(PSERVICE pService);
120
121 DWORD ScmControlService(PSERVICE Service,
122 DWORD dwControl,
123 LPSERVICE_STATUS lpServiceStatus);
124
125 /* driver.c */
126
127 DWORD ScmLoadDriver(PSERVICE lpService);
128 DWORD ScmUnloadDriver(PSERVICE lpService);
129 DWORD ScmControlDriver(PSERVICE lpService,
130 DWORD dwControl,
131 LPSERVICE_STATUS lpServiceStatus);
132
133
134 /* groupdb.c */
135
136 DWORD ScmCreateGroupList(VOID);
137 DWORD ScmSetServiceGroup(PSERVICE lpService,
138 LPCWSTR lpGroupName);
139
140
141 /* rpcserver.c */
142
143 VOID ScmStartRpcServer(VOID);
144
145
146 /* services.c */
147
148 VOID PrintString(LPCSTR fmt, ...);
149
150 /* EOF */
151