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