2 * PROJECT: ReactOS Native Headers
3 * FILE: include/subsys/csr/server.h
4 * PURPOSE: Public Definitions for CSR Servers
5 * PROGRAMMER: Alex Ionescu (alex@relsoft.net)
12 #pragma warning (disable:4201)
15 /* DEPENDENCIES **************************************************************/
17 /* TYPES **********************************************************************/
18 typedef struct _CSR_NT_SESSION
21 LIST_ENTRY SessionLink
;
23 } CSR_NT_SESSION
, *PCSR_NT_SESSION
;
25 typedef struct _CSR_PROCESS
29 LIST_ENTRY ThreadList
;
30 struct _CSR_PROCESS
*Parent
;
31 PCSR_NT_SESSION NtSession
;
32 ULONG ExpectedVersion
;
34 ULONG_PTR ClientViewBase
;
35 ULONG_PTR ClientViewBounds
;
43 ULONG ProcessGroupSequence
;
50 PVOID ServerData
[ANYSIZE_ARRAY
];
51 } CSR_PROCESS
, *PCSR_PROCESS
;
53 typedef struct _CSR_THREAD
55 LARGE_INTEGER CreateTime
;
60 struct _CSR_WAIT_BLOCK
*WaitBlock
;
64 ULONG ImpersonationCount
;
65 } CSR_THREAD
, *PCSR_THREAD
;
67 /* ENUMERATIONS **************************************************************/
68 #define CSR_SRV_SERVER 0
70 typedef enum _CSR_PROCESS_FLAGS
72 CsrProcessTerminating
= 0x1,
73 CsrProcessSkipShutdown
= 0x2,
74 CsrProcessNormalPriority
= 0x10,
75 CsrProcessIdlePriority
= 0x20,
76 CsrProcessHighPriority
= 0x40,
77 CsrProcessRealtimePriority
= 0x80,
78 CsrProcessCreateNewGroup
= 0x100,
79 CsrProcessTerminated
= 0x200,
80 CsrProcessLastThreadTerminated
= 0x400,
81 CsrProcessIsConsoleApp
= 0x800
82 } CSR_PROCESS_FLAGS
, *PCSR_PROCESS_FLAGS
;
84 #define CsrProcessPriorityFlags (CsrProcessNormalPriority | \
85 CsrProcessIdlePriority | \
86 CsrProcessHighPriority | \
87 CsrProcessRealtimePriority)
89 typedef enum _CSR_THREAD_FLAGS
91 CsrThreadAltertable
= 0x1,
92 CsrThreadInTermination
= 0x2,
93 CsrThreadTerminated
= 0x4,
94 CsrThreadIsServerThread
= 0x10
95 } CSR_THREAD_FLAGS
, *PCSR_THREAD_FLAGS
;
97 typedef enum _SHUTDOWN_RESULT
99 CsrShutdownCsrProcess
= 1,
100 CsrShutdownNonCsrProcess
,
102 } SHUTDOWN_RESULT
, *PSHUTDOWN_RESULT
;
104 typedef enum _CSR_SHUTDOWN_FLAGS
106 CsrShutdownSystem
= 4,
108 } CSR_SHUTDOWN_FLAGS
, *PCSR_SHUTDOWN_FLAGS
;
110 typedef enum _CSR_DEBUG_FLAGS
112 CsrDebugOnlyThisProcess
= 1,
113 CsrDebugProcessChildren
= 2
114 } CSR_PROCESS_DEBUG_FLAGS
, *PCSR_PROCESS_DEBUG_FLAGS
;
116 /* FUNCTION TYPES ************************************************************/
119 (NTAPI
*PCSR_CONNECT_CALLBACK
)(
120 IN PCSR_PROCESS CsrProcess
,
121 IN OUT PVOID ConnectionInfo
,
122 IN OUT PULONG ConnectionInfoLength
127 (NTAPI
*PCSR_DISCONNECT_CALLBACK
)(IN PCSR_PROCESS CsrProcess
);
131 (NTAPI
*PCSR_NEWPROCESS_CALLBACK
)(
132 IN PCSR_PROCESS Parent
,
133 IN PCSR_PROCESS CsrProcess
138 (NTAPI
*PCSR_HARDERROR_CALLBACK
)(
139 IN PCSR_THREAD CsrThread
,
140 IN PHARDERROR_MSG HardErrorMessage
145 (NTAPI
*PCSR_SHUTDOWNPROCESS_CALLBACK
)(
146 IN PCSR_PROCESS CsrProcess
,
148 IN BOOLEAN FirstPhase
152 /* FIXME: Put into public NDK Header */
153 typedef ULONG CSR_API_NUMBER
;
155 #define CSR_MAKE_OPCODE(s,m) ((s) << 16) | (m)
156 #define CSR_API_ID_FROM_OPCODE(n) ((ULONG)((USHORT)(n)))
157 #define CSR_SERVER_ID_FROM_OPCODE(n) (ULONG)((n) >> 16)
159 typedef struct _CSR_CONNECTION_INFO
162 HANDLE ObjectDirectory
;
163 PVOID SharedSectionBase
;
164 PVOID SharedSectionHeap
;
165 PVOID SharedSectionData
;
169 } CSR_CONNECTION_INFO
, *PCSR_CONNECTION_INFO
;
171 typedef struct _CSR_CLIENT_CONNECT
174 PVOID ConnectionInfo
;
175 ULONG ConnectionInfoSize
;
176 } CSR_CLIENT_CONNECT
, *PCSR_CLIENT_CONNECT
;
178 typedef struct _CSR_API_MESSAGE
183 CSR_CONNECTION_INFO ConnectionInfo
;
186 PVOID CsrCaptureData
;
187 CSR_API_NUMBER Opcode
;
192 CSR_CLIENT_CONNECT CsrClientConnect
;
196 } CSR_API_MESSAGE
, *PCSR_API_MESSAGE
;
198 typedef struct _CSR_CAPTURE_BUFFER
201 struct _CSR_CAPTURE_BUFFER
*PreviousCaptureBuffer
;
204 } CSR_CAPTURE_BUFFER
, *PCSR_CAPTURE_BUFFER
;
206 /* Private data resumes here */
209 (NTAPI
*PCSR_API_ROUTINE
)(
210 IN OUT PCSR_API_MESSAGE ApiMessage
,
214 typedef struct _CSR_SERVER_DLL
223 ULONG HighestApiSupported
;
224 PCSR_API_ROUTINE
*DispatchTable
;
227 ULONG SizeOfProcessData
;
228 PCSR_CONNECT_CALLBACK ConnectCallback
;
229 PCSR_DISCONNECT_CALLBACK DisconnectCallback
;
230 PCSR_HARDERROR_CALLBACK HardErrorCallback
;
232 PCSR_NEWPROCESS_CALLBACK NewProcessCallback
;
233 PCSR_SHUTDOWNPROCESS_CALLBACK ShutdownProcessCallback
;
235 } CSR_SERVER_DLL
, *PCSR_SERVER_DLL
;
239 (NTAPI
*PCSR_SERVER_DLL_INIT_CALLBACK
)(IN PCSR_SERVER_DLL ServerDll
);
243 (*CSR_WAIT_FUNCTION
)(
244 IN PLIST_ENTRY WaitList
,
245 IN PCSR_THREAD WaitThread
,
246 IN PCSR_API_MESSAGE WaitApiMessage
,
247 IN PVOID WaitContext
,
248 IN PVOID WaitArgument1
,
249 IN PVOID WaitArgument2
,
253 typedef struct _CSR_WAIT_BLOCK
257 LIST_ENTRY UserWaitList
;
259 PCSR_THREAD WaitThread
;
260 CSR_WAIT_FUNCTION WaitFunction
;
261 CSR_API_MESSAGE WaitApiMessage
;
262 } CSR_WAIT_BLOCK
, *PCSR_WAIT_BLOCK
;
264 /* PROTOTYPES ****************************************************************/
268 CsrServerInitialization(