a64bfff236c33bb0e16bde95d82a57c206cdd8ba
[reactos.git] / include / reactos / subsys / csr / csrmsg.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Client/Server Runtime SubSystem
4 * FILE: include/reactos/subsys/csr/csrmsg.h
5 * PURPOSE: Public definitions for communication
6 * between CSR Clients and Servers
7 * PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
8 * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
9 */
10
11 #ifndef _CSRMSG_H
12 #define _CSRMSG_H
13
14 #pragma once
15
16
17 #define CSR_PORT_NAME L"ApiPort" // CSR_API_PORT_NAME
18
19
20 #define CSRSRV_SERVERDLL_INDEX 0
21 #define CSRSRV_FIRST_API_NUMBER 0
22
23 typedef enum _CSRSRV_API_NUMBER
24 {
25 CsrpClientConnect = CSRSRV_FIRST_API_NUMBER,
26 CsrpThreadConnect,
27 CsrpProfileControl,
28 CsrpIdentifyAlertable,
29 CsrpSetPriorityClass,
30
31 CsrpMaxApiNumber
32 } CSRSRV_API_NUMBER, *PCSRSRV_API_NUMBER;
33
34
35 /*
36 typedef union _CSR_API_NUMBER
37 {
38 WORD Index;
39 WORD Subsystem;
40 } CSR_API_NUMBER, *PCSR_API_NUMBER;
41 */
42 typedef ULONG CSR_API_NUMBER;
43
44 #define CSR_CREATE_API_NUMBER(ServerId, ApiId) \
45 (CSR_API_NUMBER)(((ServerId) << 16) | (ApiId))
46
47 #define CSR_API_NUMBER_TO_SERVER_ID(ApiNumber) \
48 (ULONG)((ULONG)(ApiNumber) >> 16)
49
50 #define CSR_API_NUMBER_TO_API_ID(ApiNumber) \
51 (ULONG)((ULONG)(ApiNumber) & 0xFFFF)
52
53
54 typedef struct _CSR_CONNECTION_INFO
55 {
56 ULONG Version;
57 ULONG Unknown;
58 HANDLE ObjectDirectory;
59 PVOID SharedSectionBase;
60 PVOID SharedSectionHeap;
61 PVOID SharedSectionData;
62 ULONG DebugFlags;
63 ULONG Unknown2[3];
64 HANDLE ProcessId;
65 } CSR_CONNECTION_INFO, *PCSR_CONNECTION_INFO;
66
67 typedef struct _CSR_IDENTIFY_ALTERTABLE_THREAD
68 {
69 CLIENT_ID Cid;
70 } CSR_IDENTIFY_ALTERTABLE_THREAD, *PCSR_IDENTIFY_ALTERTABLE_THREAD;
71
72 typedef struct _CSR_SET_PRIORITY_CLASS
73 {
74 HANDLE hProcess;
75 ULONG PriorityClass;
76 } CSR_SET_PRIORITY_CLASS, *PCSR_SET_PRIORITY_CLASS;
77
78 typedef struct
79 {
80 HANDLE UniqueThread;
81 CLIENT_ID Cid;
82 } CSRSS_IDENTIFY_ALERTABLE_THREAD, *PCSRSS_IDENTIFY_ALERTABLE_THREAD;
83
84 typedef struct _CSR_CLIENT_CONNECT
85 {
86 ULONG ServerId;
87 PVOID ConnectionInfo;
88 ULONG ConnectionInfoSize;
89 } CSR_CLIENT_CONNECT, *PCSR_CLIENT_CONNECT;
90
91 typedef struct _CSR_CAPTURE_BUFFER
92 {
93 ULONG Size;
94 struct _CSR_CAPTURE_BUFFER *PreviousCaptureBuffer;
95 ULONG PointerCount;
96 PVOID BufferEnd;
97 ULONG_PTR PointerOffsetsArray[ANYSIZE_ARRAY];
98 } CSR_CAPTURE_BUFFER, *PCSR_CAPTURE_BUFFER;
99
100 /* Keep in sync with definition below. */
101 // #define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS))
102
103 typedef struct _CSR_API_MESSAGE
104 {
105 PORT_MESSAGE Header;
106 union
107 {
108 CSR_CONNECTION_INFO ConnectionInfo; // Uniquely used in csrss/csrsrv for internal signaling (opening a new connection).
109 struct
110 {
111 PCSR_CAPTURE_BUFFER CsrCaptureData;
112 CSR_API_NUMBER ApiNumber;
113 ULONG Status; // ReturnValue; // NTSTATUS Status
114 ULONG Reserved;
115 union
116 {
117 CSR_CLIENT_CONNECT CsrClientConnect;
118 CSR_SET_PRIORITY_CLASS SetPriorityClass;
119 CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread;
120 } Data;
121 };
122 };
123 } CSR_API_MESSAGE, *PCSR_API_MESSAGE;
124
125 #endif // _CSRMSG_H
126
127 /* EOF */