72343acf553f226b13b753bcd62768b93072cd04
[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
44 CLIENT_HANDLE hClient;
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(LPWSTR 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
95 /* database.c */
96
97 DWORD ScmCreateServiceDatabase(VOID);
98 VOID ScmShutdownServiceDatabase(VOID);
99 VOID ScmGetBootAndSystemDriverState(VOID);
100 VOID ScmAutoStartServices(VOID);
101 VOID ScmAutoShutdownServices(VOID);
102 DWORD ScmStartService(PSERVICE Service,
103 DWORD argc,
104 LPWSTR *argv);
105
106 PSERVICE ScmGetServiceEntryByName(LPWSTR lpServiceName);
107 PSERVICE ScmGetServiceEntryByDisplayName(LPWSTR lpDisplayName);
108 PSERVICE ScmGetServiceEntryByResumeCount(DWORD dwResumeCount);
109 PSERVICE ScmGetServiceEntryByClientHandle(ULONG ThreadId);
110 DWORD ScmCreateNewServiceRecord(LPWSTR lpServiceName,
111 PSERVICE *lpServiceRecord);
112 DWORD ScmMarkServiceForDelete(PSERVICE pService);
113
114 DWORD ScmControlService(PSERVICE Service,
115 DWORD dwControl,
116 LPSERVICE_STATUS lpServiceStatus);
117
118 /* driver.c */
119
120 DWORD ScmLoadDriver(PSERVICE lpService);
121 DWORD ScmUnloadDriver(PSERVICE lpService);
122 DWORD ScmControlDriver(PSERVICE lpService,
123 DWORD dwControl,
124 LPSERVICE_STATUS lpServiceStatus);
125
126
127 /* groupdb.c */
128
129 DWORD ScmCreateGroupList(VOID);
130 DWORD ScmSetServiceGroup(PSERVICE lpService,
131 LPWSTR lpGroupName);
132
133
134 /* rpcserver.c */
135
136 VOID ScmStartRpcServer(VOID);
137
138
139 /* services.c */
140
141 VOID PrintString(LPCSTR fmt, ...);
142
143 /* EOF */
144