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)
17 #define CSR_PORT_NAME L"ApiPort" // CSR_API_PORT_NAME
20 #define CSRSRV_SERVERDLL_INDEX 0
21 #define CSRSRV_FIRST_API_NUMBER 0
23 typedef enum _CSRSRV_API_NUMBER
25 CsrpClientConnect
= CSRSRV_FIRST_API_NUMBER
,
28 CsrpIdentifyAlertable
,
32 } CSRSRV_API_NUMBER
, *PCSRSRV_API_NUMBER
;
36 typedef struct _CSR_API_NUMBER
40 } CSR_API_NUMBER, *PCSR_API_NUMBER;
42 typedef ULONG CSR_API_NUMBER
;
44 #define CSR_CREATE_API_NUMBER(ServerId, ApiId) \
45 (CSR_API_NUMBER)(((ServerId) << 16) | (ApiId))
47 #define CSR_API_NUMBER_TO_SERVER_ID(ApiNumber) \
48 (ULONG)((ULONG)(ApiNumber) >> 16)
50 #define CSR_API_NUMBER_TO_API_ID(ApiNumber) \
51 (ULONG)((ULONG)(ApiNumber) & 0xFFFF)
54 typedef struct _CSR_CONNECTION_INFO
58 HANDLE ObjectDirectory
;
59 PVOID SharedSectionBase
;
60 PVOID SharedSectionHeap
;
61 PVOID SharedSectionData
;
65 } CSR_CONNECTION_INFO
, *PCSR_CONNECTION_INFO
;
67 // We must have a size at most equal to the maximum acceptable LPC data size.
68 C_ASSERT(sizeof(CSR_CONNECTION_INFO
) <= LPC_MAX_DATA_LENGTH
);
71 typedef struct _CSR_IDENTIFY_ALTERTABLE_THREAD
74 } CSR_IDENTIFY_ALTERTABLE_THREAD
, *PCSR_IDENTIFY_ALTERTABLE_THREAD
;
76 typedef struct _CSR_SET_PRIORITY_CLASS
80 } CSR_SET_PRIORITY_CLASS
, *PCSR_SET_PRIORITY_CLASS
;
86 } CSRSS_IDENTIFY_ALERTABLE_THREAD
, *PCSRSS_IDENTIFY_ALERTABLE_THREAD
;
88 typedef struct _CSR_CLIENT_CONNECT
92 ULONG ConnectionInfoSize
;
93 } CSR_CLIENT_CONNECT
, *PCSR_CLIENT_CONNECT
;
95 typedef struct _CSR_CAPTURE_BUFFER
98 struct _CSR_CAPTURE_BUFFER
*PreviousCaptureBuffer
;
101 ULONG_PTR PointerOffsetsArray
[ANYSIZE_ARRAY
];
102 } CSR_CAPTURE_BUFFER
, *PCSR_CAPTURE_BUFFER
;
105 typedef struct _CSR_API_MESSAGE
110 CSR_CONNECTION_INFO ConnectionInfo
; // Uniquely used in CSRSRV for internal signaling (opening a new connection).
113 PCSR_CAPTURE_BUFFER CsrCaptureData
;
114 CSR_API_NUMBER ApiNumber
;
115 NTSTATUS Status
; // ReturnValue;
119 CSR_CLIENT_CONNECT CsrClientConnect
;
120 CSR_SET_PRIORITY_CLASS SetPriorityClass
;
121 CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread
;
124 // This padding is used to make the CSR_API_MESSAGE structure
125 // large enough to hold full other API_MESSAGE-type structures
126 // used by other servers. These latter structures's sizes must
127 // be checked against the size of CSR_API_MESSAGE by using the
128 // CHECK_API_MSG_SIZE macro defined below.
130 // This is required because LPC will use this generic structure
131 // for communicating all the different servers' messages, and
132 // thus we avoid possible buffer overflows with this method.
133 // The problems there are, that we have to manually adjust the
134 // size of the padding to hope that all the servers' messaging
135 // structures will hold in it, or, that we have to be careful
136 // to not define too big messaging structures for the servers.
138 // Finally, the overall message structure size must be at most
139 // equal to the maximum acceptable LPC message size.
141 ULONG_PTR Padding
[35];
145 } CSR_API_MESSAGE
, *PCSR_API_MESSAGE
;
147 // We must have a size at most equal to the maximum acceptable LPC message size.
148 C_ASSERT(sizeof(CSR_API_MESSAGE
) <= LPC_MAX_MESSAGE_LENGTH
);
150 // Macro to check that the total size of servers' message structures
151 // are at most equal to the size of the CSR_API_MESSAGE structure.
152 #define CHECK_API_MSG_SIZE(type) C_ASSERT(sizeof(type) <= sizeof(CSR_API_MESSAGE))