1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
/*++
Copyright (c) 1990 Microsoft Corporation
Module Name:
svcs.h
Abstract:
This file contains definitions used by service dlls that share
a process in the system. The SERVICES.EXE process is an example of
a user of these definitions.
Author:
Rajen Shah rajens 12-Apr-1991
[Environment:]
User Mode - Win32
Revision History:
25-Oct-1993 Danl
Used to be services.h in the net\inc directory.
Made it non-network specific and moved to private\inc.
12-Apr-1991 RajenS
Created
--*/
#ifndef _SVCS_
#define _SVCS_
#ifndef RPC_NO_WINDOWS_H // Don't let rpc.h include windows.h
#define RPC_NO_WINDOWS_H
#endif // RPC_NO_WINDOWS_H
#include <rpc.h> // RPC_IF_HANDLE
//
// Service DLLs loaded into services.exe all export the same main
// entry point. SVCS_ENTRY_POINT defines that name.
//
// Note that SVCS_ENTRY_POINT_STRING is always ANSI, because that's
// what GetProcAddress takes.
//
#define SVCS_ENTRY_POINT ServiceEntry
#define SVCS_ENTRY_POINT_STRING "ServiceEntry"
//
// Name for the common RPC pipe shared by all the RPC servers in services.exe.
// Note: Because version 1.0 of WinNt had seperate names for each server's
// pipe, the client side names have remained the same. Mapping to the new
// name is handled by the named pipe file system.
//
#define SVCS_RPC_PIPE L"ntsvcs"
//
// Flags indicating how a work item is to be operated upon.
// SVC_QUEUE_WORK_ITEM - This indicates that the work item should be
// placed in the work queue to be operated upon when a worker
// thread becomes available.
// SVC_IMMEDIATE_CALLBACK - This indicates that the Watcher Thread
// should make the callback and return the response prior to
// returning from this call to SvcAddWorkItem. This allows
// asynchronous I/O events to be setup in the context of the
// Watcher Thread, which never goes away. If the service had
// a worker thread setup the async I/O operation, the operation
// would become signalled as soon as the worker thread was
// terminated. I/O is terminated when the requesting thread
// goes away.
//
#define SVC_QUEUE_WORK_ITEM 0x00000001
#define SVC_IMMEDIATE_CALLBACK 0x00000002
//
// Start and stop RPC server entry point prototype.
//
typedef
DWORD
(*PSVCS_START_RPC_SERVER) (
IN LPTSTR InterfaceName,
IN RPC_IF_HANDLE InterfaceSpecification
);
typedef
DWORD
(*PSVCS_STOP_RPC_SERVER) (
IN RPC_IF_HANDLE InterfaceSpecification
);
typedef
VOID
(*PSVCS_NET_BIOS_OPEN) (
VOID
);
typedef
VOID
(*PSVCS_NET_BIOS_CLOSE) (
VOID
);
typedef
DWORD
(*PSVCS_NET_BIOS_RESET) (
IN UCHAR LanAdapterNumber
);
//
// Thread Management
//
typedef
DWORD
(*PSVCS_WORKER_CALLBACK) (
IN PVOID pContext,
IN DWORD dwWaitStatus
);
//
// Call this function to add a work item
typedef
HANDLE
(*PSVCS_ADD_WORK_ITEM) (
IN HANDLE hWaitableObject,
IN PSVCS_WORKER_CALLBACK pCallbackFunction,
IN PVOID pContext,
IN DWORD dwFlags,
IN DWORD dwTimeout,
IN HANDLE hDllReference
);
//
// Call this function to remove a work item.
typedef
BOOL
(*PSVCS_REMOVE_WORK_ITEM) (
IN HANDLE hWorkItem
);
//
// Structure containing "global" data for the various DLLs.
//
typedef struct _SVCS_GLOBAL_DATA {
//
// NT well-known SIDs
//
PSID NullSid; // No members SID
PSID WorldSid; // All users SID
PSID LocalSid; // NT local users SID
PSID NetworkSid; // NT remote users SID
PSID LocalSystemSid; // NT system processes SID
PSID BuiltinDomainSid; // Domain Id of the Builtin Domain
//
// Well Known Aliases.
//
// These are aliases that are relative to the built-in domain.
//
PSID AliasAdminsSid; // Administrator Sid
PSID AliasUsersSid; // User Sid
PSID AliasGuestsSid; // Guest Sid
PSID AliasPowerUsersSid; // Power User Sid
PSID AliasAccountOpsSid; // Account Operator Sid
PSID AliasSystemOpsSid; // System Operator Sid
PSID AliasPrintOpsSid; // Print Operator Sid
PSID AliasBackupOpsSid; // Backup Operator Sid
//
// Entry points provided by SERVICES.EXE.
//
PSVCS_START_RPC_SERVER StartRpcServer;
PSVCS_STOP_RPC_SERVER StopRpcServer;
PSVCS_NET_BIOS_OPEN NetBiosOpen;
PSVCS_NET_BIOS_CLOSE NetBiosClose;
PSVCS_NET_BIOS_RESET NetBiosReset;
LPWSTR SvcsRpcPipeName;
PSVCS_ADD_WORK_ITEM SvcsAddWorkItem;
PSVCS_REMOVE_WORK_ITEM SvcsRemoveWorkItem;
} SVCS_GLOBAL_DATA, *PSVCS_GLOBAL_DATA;
//
// Service DLL entry point prototype.
//
typedef
VOID
(*PSVCS_SERVICE_DLL_ENTRY) (
IN DWORD argc,
IN LPTSTR argv[],
IN PSVCS_GLOBAL_DATA pGlobalData,
IN HANDLE SvcReferenceHandle
);
#endif // ndef _SVCS_
|