ReactOS  0.4.13-dev-73-gcfe54aa
csrmsg.h
Go to the documentation of this file.
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.ionescu@reactos.org)
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 {
30 
33 
34 
36 
37 #define CSR_CREATE_API_NUMBER(ServerId, ApiId) \
38  (CSR_API_NUMBER)(((ServerId) << 16) | (ApiId))
39 
40 #define CSR_API_NUMBER_TO_SERVER_ID(ApiNumber) \
41  (ULONG)((ULONG)(ApiNumber) >> 16)
42 
43 #define CSR_API_NUMBER_TO_API_ID(ApiNumber) \
44  (ULONG)((ULONG)(ApiNumber) & 0xFFFF)
45 
46 
47 typedef struct _CSR_API_CONNECTINFO
48 {
49  HANDLE ObjectDirectory; // Unused on Windows >= 2k3
59 
60 #if defined(_M_IX86)
61 C_ASSERT(sizeof(CSR_API_CONNECTINFO) == 0x24);
62 #endif
63 
64 // We must have a size at most equal to the maximum acceptable LPC data size.
66 
67 
69 {
72 
74 {
78 
79 typedef struct
80 {
84 
85 typedef struct _CSR_CLIENT_CONNECT
86 {
91 
92 typedef struct _CSR_CAPTURE_BUFFER
93 {
100 
101 
102 typedef struct _CSR_API_MESSAGE
103 {
105  union
106  {
107  CSR_API_CONNECTINFO ConnectionInfo; // Uniquely used in CSRSRV for internal signaling (opening a new connection).
108  struct
109  {
112  NTSTATUS Status; // ReturnValue;
114  union
115  {
119 
120  //
121  // This padding is used to make the CSR_API_MESSAGE structure
122  // large enough to hold full other API_MESSAGE-type structures
123  // used by other servers. These latter structures's sizes must
124  // be checked against the size of CSR_API_MESSAGE by using the
125  // CHECK_API_MSG_SIZE macro defined below.
126  //
127  // This is required because LPC will use this generic structure
128  // for communicating all the different servers' messages, and
129  // thus we avoid possible buffer overflows with this method.
130  // The problems there are, that we have to manually adjust the
131  // size of the padding to hope that all the servers' messaging
132  // structures will hold in it, or, that we have to be careful
133  // to not define too big messaging structures for the servers.
134  //
135  // Finally, the overall message structure size must be at most
136  // equal to the maximum acceptable LPC message size.
137  //
139  } Data;
140  };
141  };
143 
144 // We must have a size at most equal to the maximum acceptable LPC message size.
146 
147 // Macro to check that the total size of servers' message structures
148 // are at most equal to the size of the CSR_API_MESSAGE structure.
149 #define CHECK_API_MSG_SIZE(type) C_ASSERT(sizeof(type) <= sizeof(CSR_API_MESSAGE))
150 
151 #endif // _CSRMSG_H
152 
153 /* EOF */
ULONG CSR_API_NUMBER
Definition: csrmsg.h:35
ULONG SizeOfPebData
Definition: csrmsg.h:54
#define ANYSIZE_ARRAY
Definition: typedefs.h:45
CSR_CLIENT_CONNECT CsrClientConnect
Definition: csrmsg.h:116
enum _CSRSRV_API_NUMBER CSRSRV_API_NUMBER
struct _CSR_CAPTURE_BUFFER CSR_CAPTURE_BUFFER
PVOID SharedStaticServerData
Definition: csrmsg.h:51
LONG NTSTATUS
Definition: precomp.h:26
struct _CSR_IDENTIFY_ALTERTABLE_THREAD * PCSR_IDENTIFY_ALTERTABLE_THREAD
ULONG NumberOfServerDllNames
Definition: csrmsg.h:56
PVOID ConnectionInfo
Definition: csrmsg.h:88
PCSR_CAPTURE_BUFFER CsrCaptureData
Definition: csrmsg.h:110
uint32_t ULONG_PTR
Definition: typedefs.h:63
PVOID SharedSectionBase
Definition: csrmsg.h:50
NTSTATUS Status
Definition: csrmsg.h:112
#define LPC_MAX_DATA_LENGTH
Definition: lpctypes.h:291
HANDLE ServerProcessId
Definition: csrmsg.h:57
HANDLE ObjectDirectory
Definition: csrmsg.h:49
PVOID SharedSectionHeap
Definition: csrmsg.h:52
struct CSRSS_IDENTIFY_ALERTABLE_THREAD * PCSRSS_IDENTIFY_ALERTABLE_THREAD
ULONG_PTR ApiMessageData[39]
Definition: csrmsg.h:138
struct _CSR_IDENTIFY_ALTERTABLE_THREAD CSR_IDENTIFY_ALTERTABLE_THREAD
struct _CSR_SET_PRIORITY_CLASS CSR_SET_PRIORITY_CLASS
CSR_IDENTIFY_ALTERTABLE_THREAD IdentifyAlertableThread
Definition: csrmsg.h:118
CSR_API_NUMBER ApiNumber
Definition: csrmsg.h:111
struct _CSR_CAPTURE_BUFFER * PCSR_CAPTURE_BUFFER
union _CSR_API_MESSAGE::@3317::@3319::@3321 Data
CSR_API_CONNECTINFO ConnectionInfo
Definition: csrmsg.h:107
struct _CSR_API_CONNECTINFO CSR_API_CONNECTINFO
ULONG ConnectionInfoSize
Definition: csrmsg.h:89
struct _CSR_CAPTURE_BUFFER * PreviousCaptureBuffer
Definition: csrmsg.h:95
ULONG SizeOfTebData
Definition: csrmsg.h:55
struct _CSR_API_MESSAGE * PCSR_API_MESSAGE
#define CSRSRV_FIRST_API_NUMBER
Definition: csrmsg.h:21
CSR_SET_PRIORITY_CLASS SetPriorityClass
Definition: csrmsg.h:117
ULONG PointerCount
Definition: csrmsg.h:96
struct _CSR_API_CONNECTINFO * PCSR_API_CONNECTINFO
C_ASSERT(sizeof(CSR_API_CONNECTINFO)<=LPC_MAX_DATA_LENGTH)
enum _CSRSRV_API_NUMBER * PCSRSRV_API_NUMBER
#define LPC_MAX_MESSAGE_LENGTH
Definition: lpctypes.h:284
ULONG Reserved
Definition: csrmsg.h:113
unsigned int ULONG
Definition: retypes.h:1
struct _CSR_SET_PRIORITY_CLASS * PCSR_SET_PRIORITY_CLASS
struct _CSR_CLIENT_CONNECT * PCSR_CLIENT_CONNECT
struct _CSR_CLIENT_CONNECT CSR_CLIENT_CONNECT
PORT_MESSAGE Header
Definition: csrmsg.h:104
ULONG_PTR PointerOffsetsArray[ANYSIZE_ARRAY]
Definition: csrmsg.h:98
struct _CSR_API_MESSAGE CSR_API_MESSAGE
_CSRSRV_API_NUMBER
Definition: csrmsg.h:23