[CSRSRV]
[reactos.git] / reactos / subsystems / win32 / csrsrv / api.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: subsystems/win32/csrsrv/api.h
5 * PURPOSE: CSRSS Internal API
6 */
7
8 #pragma once
9
10 #define NTOS_MODE_USER
11 #include <ndk/psfuncs.h>
12 #include <ndk/rtlfuncs.h>
13
14 #include <csr/csrsrv.h>
15
16
17 extern RTL_CRITICAL_SECTION CsrProcessLock, CsrWaitListsLock;
18
19 #define CsrAcquireProcessLock() \
20 RtlEnterCriticalSection(&CsrProcessLock);
21
22 #define CsrReleaseProcessLock() \
23 RtlLeaveCriticalSection(&CsrProcessLock);
24
25 #define ProcessStructureListLocked() \
26 (CsrProcessLock.OwningThread == NtCurrentTeb()->ClientId.UniqueThread)
27
28 #define CsrAcquireWaitLock() \
29 RtlEnterCriticalSection(&CsrWaitListsLock);
30
31 #define CsrReleaseWaitLock() \
32 RtlLeaveCriticalSection(&CsrWaitListsLock);
33
34 #define CsrAcquireNtSessionLock() \
35 RtlEnterCriticalSection(&CsrNtSessionLock);
36
37 #define CsrReleaseNtSessionLock() \
38 RtlLeaveCriticalSection(&CsrNtSessionLock);
39
40
41 #define CSR_SERVER_DLL_MAX 4
42
43
44 extern HANDLE hBootstrapOk;
45 extern HANDLE CsrApiPort;
46 extern HANDLE CsrSmApiPort;
47 extern HANDLE CsrSbApiPort;
48 #define NUMBER_THREAD_HASH_BUCKETS 257
49 extern LIST_ENTRY CsrThreadHashTable[NUMBER_THREAD_HASH_BUCKETS];
50 extern PCSR_PROCESS CsrRootProcess;
51 extern UNICODE_STRING CsrDirectoryName;
52 extern ULONG CsrDebug;
53 extern ULONG CsrTotalPerProcessDataLength;
54 extern SYSTEM_BASIC_INFORMATION CsrNtSysInfo;
55 extern HANDLE CsrHeap;
56 extern PVOID CsrSrvSharedSectionHeap;
57 extern PVOID *CsrSrvSharedStaticServerData;
58 extern HANDLE CsrInitializationEvent;
59 extern PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX];
60 extern ULONG CsrMaxApiRequestThreads;
61
62 /****************************************************/
63 extern UNICODE_STRING CsrSbApiPortName;
64 extern UNICODE_STRING CsrApiPortName;
65 extern RTL_CRITICAL_SECTION CsrProcessLock;
66 extern RTL_CRITICAL_SECTION CsrWaitListsLock;
67 extern HANDLE CsrObjectDirectory;
68 /****************************************************/
69
70
71
72 CSR_API(CsrSrvClientConnect);
73 CSR_API(CsrSrvUnusedFunction);
74 CSR_API(CsrSrvIdentifyAlertableThread);
75 CSR_API(CsrSrvSetPriorityClass);
76
77
78 NTSTATUS
79 NTAPI
80 CsrServerDllInitialization(IN PCSR_SERVER_DLL LoadedServerDll);
81
82
83 BOOLEAN
84 NTAPI
85 CsrCaptureArguments(IN PCSR_THREAD CsrThread,
86 IN PCSR_API_MESSAGE ApiMessage);
87
88 VOID
89 NTAPI
90 CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage);
91
92 NTSTATUS
93 NTAPI
94 CsrLoadServerDll(IN PCHAR DllString,
95 IN PCHAR EntryPoint OPTIONAL,
96 IN ULONG ServerId);
97
98
99 PCSR_THREAD
100 NTAPI
101 CsrAllocateThread(IN PCSR_PROCESS CsrProcess);
102
103 PCSR_PROCESS
104 NTAPI
105 CsrAllocateProcess(VOID);
106
107 VOID
108 NTAPI
109 CsrDeallocateProcess(IN PCSR_PROCESS CsrProcess);
110
111 VOID
112 NTAPI
113 CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL,
114 IN PCSR_PROCESS CsrProcess);
115
116 VOID
117 NTAPI
118 CsrRemoveProcess(IN PCSR_PROCESS CsrProcess);
119
120 NTSTATUS
121 NTAPI
122 CsrApiRequestThread(IN PVOID Parameter);
123
124 VOID
125 NTAPI
126 CsrSbApiRequestThread(IN PVOID Parameter);
127
128 NTSTATUS
129 NTAPI
130 CsrApiPortInitialize(VOID);
131
132 BOOLEAN
133 NTAPI
134 ProtectHandle(IN HANDLE ObjectHandle);
135
136 BOOLEAN
137 NTAPI
138 UnProtectHandle(IN HANDLE ObjectHandle);
139
140 VOID
141 NTAPI
142 CsrInsertThread(IN PCSR_PROCESS Process,
143 IN PCSR_THREAD Thread);
144
145 VOID
146 NTAPI
147 CsrLockedReferenceProcess(IN PCSR_PROCESS CsrProcess);
148
149 VOID
150 NTAPI
151 CsrLockedReferenceThread(IN PCSR_THREAD CsrThread);
152
153 NTSTATUS
154 NTAPI
155 CsrInitializeProcessStructure(VOID);
156
157 // NTSTATUS WINAPI CsrEnumProcesses(CSRSS_ENUM_PROCESS_PROC EnumProc,
158 // PVOID Context);
159 PCSR_THREAD
160 NTAPI
161 CsrLocateThreadInProcess(IN PCSR_PROCESS CsrProcess OPTIONAL,
162 IN PCLIENT_ID Cid);
163 PCSR_THREAD
164 NTAPI
165 CsrLocateThreadByClientId(OUT PCSR_PROCESS *Process OPTIONAL,
166 IN PCLIENT_ID ClientId);
167
168 NTSTATUS
169 NTAPI
170 CsrInitializeNtSessionList(VOID);
171
172 NTSTATUS
173 NTAPI
174 CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL,
175 OUT PCSR_CONNECTION_INFO ConnectInfo);
176
177 NTSTATUS
178 NTAPI
179 CsrSrvCreateSharedSection(IN PCHAR ParameterValue);
180
181 VOID
182 NTAPI
183 CsrLockedDereferenceProcess(PCSR_PROCESS CsrProcess);
184
185 VOID
186 NTAPI
187 CsrLockedDereferenceThread(IN PCSR_THREAD CsrThread);
188
189 BOOLEAN
190 NTAPI
191 CsrNotifyWaitBlock(IN PCSR_WAIT_BLOCK WaitBlock,
192 IN PLIST_ENTRY WaitList,
193 IN PVOID WaitArgument1,
194 IN PVOID WaitArgument2,
195 IN ULONG WaitFlags,
196 IN BOOLEAN DereferenceThread);
197
198 VOID
199 NTAPI
200 CsrReferenceNtSession(IN PCSR_NT_SESSION Session);
201
202 VOID
203 NTAPI
204 CsrDereferenceNtSession(IN PCSR_NT_SESSION Session,
205 IN NTSTATUS ExitStatus);
206
207 /******************************************************************************
208 ******************************************************************************/
209
210 NTSTATUS
211 NTAPI
212 CsrCreateSessionObjectDirectory(IN ULONG SessionId);
213
214 NTSTATUS
215 NTAPI
216 CsrCreateObjectDirectory(IN PCHAR ObjectDirectory);
217
218 NTSTATUS
219 NTAPI
220 CsrSbApiPortInitialize(VOID);
221
222 BOOLEAN
223 NTAPI
224 CsrSbCreateSession(IN PSB_API_MSG ApiMessage);
225
226 BOOLEAN
227 NTAPI
228 CsrSbTerminateSession(IN PSB_API_MSG ApiMessage);
229
230 BOOLEAN
231 NTAPI
232 CsrSbForeignSessionComplete(IN PSB_API_MSG ApiMessage);
233
234 BOOLEAN
235 NTAPI
236 CsrSbCreateProcess(IN PSB_API_MSG ApiMessage);
237
238 NTSTATUS
239 NTAPI
240 CsrSbApiHandleConnectionRequest(IN PSB_API_MSG Message);
241
242 NTSTATUS
243 NTAPI
244 CsrApiHandleConnectionRequest(IN PCSR_API_MESSAGE ApiMessage);
245
246 /** this API is used with CsrPopulateDosDevices, deprecated in r55585.
247 NTSTATUS
248 NTAPI
249 CsrPopulateDosDevicesDirectory(IN HANDLE DosDevicesDirectory,
250 IN PPROCESS_DEVICEMAP_INFORMATION DeviceMap);
251 **/
252
253 NTSTATUS
254 NTAPI
255 CsrCreateLocalSystemSD(OUT PSECURITY_DESCRIPTOR *LocalSystemSd);
256
257 NTSTATUS
258 NTAPI
259 CsrSetDirectorySecurity(IN HANDLE ObjectDirectory);
260
261 /* EOF */