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
;
35 typedef ULONG CSR_API_NUMBER
;
37 #define CSR_CREATE_API_NUMBER(ServerId, ApiId) \
38 (CSR_API_NUMBER)(((ServerId) << 16) | (ApiId))
40 #define CSR_API_NUMBER_TO_SERVER_ID(ApiNumber) \
41 (ULONG)((ULONG)(ApiNumber) >> 16)
43 #define CSR_API_NUMBER_TO_API_ID(ApiNumber) \
44 (ULONG)((ULONG)(ApiNumber) & 0xFFFF)
47 typedef struct _CSR_CONNECTION_INFO
51 HANDLE ObjectDirectory
;
52 PVOID SharedSectionBase
;
53 PVOID SharedSectionHeap
;
54 PVOID SharedSectionData
;
58 } CSR_CONNECTION_INFO
, *PCSR_CONNECTION_INFO
;
60 #define CSRSRV_VERSION 0x10000
62 // We must have a size at most equal to the maximum acceptable LPC data size.
63 C_ASSERT(sizeof(CSR_CONNECTION_INFO
) <= LPC_MAX_DATA_LENGTH
);
66 typedef struct _CSR_IDENTIFY_ALTERTABLE_THREAD
69 } CSR_IDENTIFY_ALTERTABLE_THREAD
, *PCSR_IDENTIFY_ALTERTABLE_THREAD
;
71 typedef struct _CSR_SET_PRIORITY_CLASS
75 } CSR_SET_PRIORITY_CLASS
, *PCSR_SET_PRIORITY_CLASS
;
81 } CSRSS_IDENTIFY_ALERTABLE_THREAD
, *PCSRSS_IDENTIFY_ALERTABLE_THREAD
;
83 typedef struct _CSR_CLIENT_CONNECT
87 ULONG ConnectionInfoSize
;
88 } CSR_CLIENT_CONNECT
, *PCSR_CLIENT_CONNECT
;
90 typedef struct _CSR_CAPTURE_BUFFER
93 struct _CSR_CAPTURE_BUFFER
*PreviousCaptureBuffer
;
96 ULONG_PTR PointerOffsetsArray
[ANYSIZE_ARRAY
];
97 } CSR_CAPTURE_BUFFER
, *PCSR_CAPTURE_BUFFER
;
100 typedef struct _CSR_API_MESSAGE
105 CSR_CONNECTION_INFO ConnectionInfo
; // Uniquely used in CSRSRV for internal signaling (opening a new connection).
108 PCSR_CAPTURE_BUFFER CsrCaptureData
;
109 CSR_API_NUMBER ApiNumber
;
110 NTSTATUS Status
; // ReturnValue;
114 CSR_CLIENT_CONNECT CsrClientConnect
;
115 CSR_SET_PRIORITY_CLASS SetPriorityClass
;
116 CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread
;
119 // This padding is used to make the CSR_API_MESSAGE structure
120 // large enough to hold full other API_MESSAGE-type structures
121 // used by other servers. These latter structures's sizes must
122 // be checked against the size of CSR_API_MESSAGE by using the
123 // CHECK_API_MSG_SIZE macro defined below.
125 // This is required because LPC will use this generic structure
126 // for communicating all the different servers' messages, and
127 // thus we avoid possible buffer overflows with this method.
128 // The problems there are, that we have to manually adjust the
129 // size of the padding to hope that all the servers' messaging
130 // structures will hold in it, or, that we have to be careful
131 // to not define too big messaging structures for the servers.
133 // Finally, the overall message structure size must be at most
134 // equal to the maximum acceptable LPC message size.
136 ULONG_PTR Padding
[35];
140 } CSR_API_MESSAGE
, *PCSR_API_MESSAGE
;
142 // We must have a size at most equal to the maximum acceptable LPC message size.
143 C_ASSERT(sizeof(CSR_API_MESSAGE
) <= LPC_MAX_MESSAGE_LENGTH
);
145 // Macro to check that the total size of servers' message structures
146 // are at most equal to the size of the CSR_API_MESSAGE structure.
147 #define CHECK_API_MSG_SIZE(type) C_ASSERT(sizeof(type) <= sizeof(CSR_API_MESSAGE))