[CSRSRV]
[reactos.git] / 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 extern LIST_ENTRY CsrThreadHashTable[256];
49 extern PCSR_PROCESS CsrRootProcess;
50 extern UNICODE_STRING CsrDirectoryName;
51 extern ULONG CsrDebug;
52 extern ULONG CsrTotalPerProcessDataLength;
53 extern SYSTEM_BASIC_INFORMATION CsrNtSysInfo;
54 extern HANDLE CsrHeap;
55 extern PVOID CsrSrvSharedSectionHeap;
56 extern PVOID *CsrSrvSharedStaticServerData;
57 extern HANDLE CsrInitializationEvent;
58 extern PCSR_SERVER_DLL CsrLoadedServerDll[CSR_SERVER_DLL_MAX];
59 extern ULONG CsrMaxApiRequestThreads;
60
61 /****************************************************/
62 extern UNICODE_STRING CsrSbApiPortName;
63 extern UNICODE_STRING CsrApiPortName;
64 extern RTL_CRITICAL_SECTION CsrProcessLock;
65 extern RTL_CRITICAL_SECTION CsrWaitListsLock;
66 extern HANDLE CsrObjectDirectory;
67 /****************************************************/
68
69
70
71 CSR_API(CsrSrvClientConnect);
72 CSR_API(CsrSrvUnusedFunction);
73 CSR_API(CsrSrvIdentifyAlertableThread);
74 CSR_API(CsrSrvSetPriorityClass);
75
76
77 NTSTATUS
78 NTAPI
79 CsrServerDllInitialization(IN PCSR_SERVER_DLL LoadedServerDll);
80
81
82 BOOLEAN
83 NTAPI
84 CsrCaptureArguments(IN PCSR_THREAD CsrThread,
85 IN PCSR_API_MESSAGE ApiMessage);
86
87 VOID
88 NTAPI
89 CsrReleaseCapturedArguments(IN PCSR_API_MESSAGE ApiMessage);
90
91 NTSTATUS
92 NTAPI
93 CsrLoadServerDll(IN PCHAR DllString,
94 IN PCHAR EntryPoint OPTIONAL,
95 IN ULONG ServerId);
96
97
98 PCSR_THREAD
99 NTAPI
100 CsrAllocateThread(IN PCSR_PROCESS CsrProcess);
101
102 PCSR_PROCESS
103 NTAPI
104 CsrAllocateProcess(VOID);
105
106 VOID
107 NTAPI
108 CsrDeallocateProcess(IN PCSR_PROCESS CsrProcess);
109
110 VOID
111 NTAPI
112 CsrInsertProcess(IN PCSR_PROCESS ParentProcess OPTIONAL,
113 IN PCSR_PROCESS CsrProcess);
114
115 VOID
116 NTAPI
117 CsrRemoveProcess(IN PCSR_PROCESS CsrProcess);
118
119 NTSTATUS
120 NTAPI
121 CsrApiRequestThread(IN PVOID Parameter);
122
123 VOID
124 NTAPI
125 CsrSbApiRequestThread(IN PVOID Parameter);
126
127 NTSTATUS
128 NTAPI
129 CsrApiPortInitialize(VOID);
130
131 BOOLEAN
132 NTAPI
133 ProtectHandle(IN HANDLE ObjectHandle);
134
135 BOOLEAN
136 NTAPI
137 UnProtectHandle(IN HANDLE ObjectHandle);
138
139 VOID
140 NTAPI
141 CsrInsertThread(IN PCSR_PROCESS Process,
142 IN PCSR_THREAD Thread);
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_CONNECTION_INFO 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 */