ReactOS  0.4.14-dev-49-gfb4591c
lpctypes.h
Go to the documentation of this file.
1 /*++ NDK Version: 0098
2 
3 Copyright (c) Alex Ionescu. All rights reserved.
4 
5 Header Name:
6 
7  lpctypes.h
8 
9 Abstract:
10 
11  Type definitions for the Local Procedure Call.
12 
13 Author:
14 
15  Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
16 
17 --*/
18 
19 #ifndef _LPCTYPES_H
20 #define _LPCTYPES_H
21 
22 //
23 // Dependencies
24 //
25 #include <umtypes.h>
26 //#include <pstypes.h>
27 
28 #ifndef NTOS_MODE_USER
29 
30 //
31 // Kernel Exported Object Types
32 //
34 
35 #endif // !NTOS_MODE_USER
36 
37 //
38 // Internal helper macro
39 //
40 #define N_ROUND_UP(x,s) \
41  (((ULONG)(x)+(s)-1) & ~((ULONG)(s)-1))
42 
43 //
44 // Port Object Access Masks
45 //
46 #define PORT_CONNECT 0x1
47 #define PORT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
48  SYNCHRONIZE | \
49  PORT_CONNECT)
50 
51 //
52 // Port Object Flags
53 //
54 #define LPCP_CONNECTION_PORT 0x00000001
55 #define LPCP_UNCONNECTED_PORT 0x00000002
56 #define LPCP_COMMUNICATION_PORT 0x00000003
57 #define LPCP_CLIENT_PORT 0x00000004
58 #define LPCP_PORT_TYPE_MASK 0x0000000F
59 #define LPCP_PORT_DELETED 0x10000000
60 #define LPCP_WAITABLE_PORT 0x20000000
61 #define LPCP_NAME_DELETED 0x40000000
62 #define LPCP_SECURITY_DYNAMIC 0x80000000
63 
64 //
65 // LPC Message Types
66 //
67 typedef enum _LPC_TYPE
68 {
82 } LPC_TYPE;
83 
84 //
85 // Information Classes for NtQueryInformationPort
86 //
88 {
91 
92 #ifdef NTOS_MODE_USER
93 
94 //
95 // Maximum message size that can be sent through an LPC Port without a section
96 //
97 #ifdef _WIN64
98 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
99 #else
100 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
101 #endif
102 
103 //
104 // Portable LPC Types for 32/64-bit compatibility
105 //
106 #ifdef USE_LPC6432
107 #define LPC_CLIENT_ID CLIENT_ID64
108 #define LPC_SIZE_T ULONGLONG
109 #define LPC_PVOID ULONGLONG
110 #define LPC_HANDLE ULONGLONG
111 #else
112 #define LPC_CLIENT_ID CLIENT_ID
113 #define LPC_SIZE_T SIZE_T
114 #define LPC_PVOID PVOID
115 #define LPC_HANDLE HANDLE
116 #endif
117 
118 //
119 // LPC Port Message
120 //
121 typedef struct _PORT_MESSAGE
122 {
123  union
124  {
125  struct
126  {
129  } s1;
130  ULONG Length;
131  } u1;
132  union
133  {
134  struct
135  {
136  CSHORT Type;
138  } s2;
139  ULONG ZeroInit;
140  } u2;
141  union
142  {
144  double DoNotUseThisField;
145  };
147  union
148  {
151  };
153 
154 //
155 // Local and Remove Port Views
156 //
157 typedef struct _PORT_VIEW
158 {
159  ULONG Length;
166 
167 typedef struct _REMOTE_PORT_VIEW
168 {
169  ULONG Length;
173 
174 //
175 // LPC Kernel-Mode Message Structures defined for size only
176 //
177 typedef struct _LPCP_MESSAGE
178 {
179  UCHAR Data[0x14];
181 } LPCP_MESSAGE;
182 
183 typedef struct _LPCP_CONNECTION_MESSAGE
184 {
185  UCHAR Data[0x2C];
187 
188 #else
189 
190 //
191 // LPC Paged and Non-Paged Port Queues
192 //
194 {
198 
199 typedef struct _LPCP_PORT_QUEUE
200 {
205 
206 //
207 // LPC Port Object
208 //
209 typedef struct _LPCP_PORT_OBJECT
210 {
223  union
224  {
227  };
233 
234 //
235 // LPC Kernel-Mode Message Structures
236 //
237 typedef struct _LPCP_MESSAGE
238 {
239  union
240  {
242  struct
243  {
246  };
247  };
253 
255 {
261 
262 #endif
263 
264 //
265 // Client Died LPC Message
266 //
267 typedef struct _CLIENT_DIED_MSG
268 {
272 
273 //
274 // Maximum total Kernel-Mode LPC Message Structure Size
275 //
276 #define LPCP_MAX_MESSAGE_SIZE \
277  N_ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
278  sizeof(LPCP_MESSAGE) + \
279  sizeof(LPCP_CONNECTION_MESSAGE), 16)
280 
281 //
282 // Maximum actual LPC Message Length
283 //
284 #define LPC_MAX_MESSAGE_LENGTH \
285  (LPCP_MAX_MESSAGE_SIZE - \
286  FIELD_OFFSET(LPCP_MESSAGE, Request))
287 
288 //
289 // Maximum actual size of LPC Message Data
290 //
291 #define LPC_MAX_DATA_LENGTH \
292  (LPC_MAX_MESSAGE_LENGTH - \
293  sizeof(PORT_MESSAGE) - \
294  sizeof(LPCP_CONNECTION_MESSAGE))
295 
296 #endif // _LPCTYPES_H
LPC_CLIENT_ID ClientId
KEVENT WaitEvent
Definition: lpctypes.h:231
REMOTE_PORT_VIEW ServerView
Definition: lpctypes.h:259
struct _PORT_VIEW PORT_VIEW
struct _LPCP_CONNECTION_MESSAGE * PLPCP_CONNECTION_MESSAGE
PETHREAD ClientThread
Definition: lpctypes.h:218
struct _LPCP_NONPAGED_PORT_QUEUE * PLPCP_NONPAGED_PORT_QUEUE
struct _LPCP_PORT_OBJECT * ConnectedPort
Definition: lpctypes.h:212
Definition: ntbasedef.h:635
SECURITY_QUALITY_OF_SERVICE SecurityQos
Definition: lpctypes.h:219
_PORT_INFORMATION_CLASS
Definition: lpctypes.h:87
LARGE_INTEGER CreateTime
Definition: lpctypes.h:270
union _PORT_MESSAGE::@3758 u2
LPCP_PORT_QUEUE MsgQueue
Definition: lpctypes.h:213
SINGLE_LIST_ENTRY FreeEntry
Definition: lpctypes.h:244
LIST_ENTRY ReceiveHead
Definition: lpctypes.h:203
ULONG SectionOffset
#define LPC_HANDLE
struct _LPCP_PORT_OBJECT * PLPCP_PORT_OBJECT
PEPROCESS ServerProcess
Definition: lpctypes.h:225
struct _LPCP_PORT_QUEUE LPCP_PORT_QUEUE
#define NTSYSAPI
Definition: ntoskrnl.h:14
struct _PORT_MESSAGE_HEADER PORT_MESSAGE
struct _LPCP_NONPAGED_PORT_QUEUE LPCP_NONPAGED_PORT_QUEUE
struct _CLIENT_DIED_MSG * PCLIENT_DIED_MSG
struct _CLIENT_DIED_MSG CLIENT_DIED_MSG
ULONG MaxMessageLength
Definition: lpctypes.h:228
#define LPC_PVOID
ULONG Reserved0
Definition: lpctypes.h:245
LPC_PVOID ViewRemoteBase
struct _LPCP_PORT_OBJECT * BackPointer
Definition: lpctypes.h:196
struct _REMOTE_PORT_VIEW REMOTE_PORT_VIEW
POBJECT_TYPE NTSYSAPI LpcPortObjectType
Definition: port.c:17
LIST_ENTRY LpcDataInfoChainHead
Definition: lpctypes.h:222
CLIENT_ID Creator
Definition: lpctypes.h:214
LIST_ENTRY Entry
Definition: lpctypes.h:241
struct _PORT_VIEW * PPORT_VIEW
SECURITY_CLIENT_CONTEXT StaticSecurity
Definition: lpctypes.h:220
PKSEMAPHORE Semaphore
Definition: lpctypes.h:202
LPC_SIZE_T ViewSize
_LPC_TYPE
Definition: lpctypes.h:67
#define LPC_SIZE_T
unsigned char UCHAR
Definition: xmlstorage.h:181
enum _PORT_INFORMATION_CLASS PORT_INFORMATION_CLASS
PORT_MESSAGE h
Definition: lpctypes.h:269
struct _LPCP_MESSAGE * PLPCP_MESSAGE
double DoNotUseThisField
PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue
Definition: lpctypes.h:201
#define LPC_CLIENT_ID
Definition: typedefs.h:117
LPC_SIZE_T ClientViewSize
PVOID PortContext
Definition: lpctypes.h:250
struct _PORT_MESSAGE::@3757::@3763 s1
PLPCP_PORT_OBJECT ClientPort
Definition: lpctypes.h:257
LPC_PVOID ViewBase
struct _LPCP_PORT_OBJECT LPCP_PORT_OBJECT
struct _PORT_MESSAGE::@3758::@3764 s2
struct _LPCP_PORT_OBJECT * ConnectionPort
Definition: lpctypes.h:211
PVOID ServerSectionBase
Definition: lpctypes.h:216
PLPCP_PORT_OBJECT SenderPort
Definition: lpctypes.h:248
struct _LPCP_MESSAGE LPCP_MESSAGE
PETHREAD RepliedToThread
Definition: lpctypes.h:249
PVOID ClientSectionBase
Definition: lpctypes.h:215
ULONG MaxConnectionInfoLength
Definition: lpctypes.h:229
struct _LPCP_CONNECTION_MESSAGE LPCP_CONNECTION_MESSAGE
PORT_MESSAGE Request
Definition: lpctypes.h:251
PEPROCESS MappingProcess
Definition: lpctypes.h:226
unsigned int ULONG
Definition: retypes.h:1
union _PORT_MESSAGE::@3757 u1
struct _REMOTE_PORT_VIEW * PREMOTE_PORT_VIEW
LPC_HANDLE SectionHandle
LIST_ENTRY LpcReplyChainHead
Definition: lpctypes.h:221
short CSHORT
Definition: umtypes.h:127
struct _LPCP_PORT_QUEUE * PLPCP_PORT_QUEUE
struct _PORT_MESSAGE_HEADER * PPORT_MESSAGE
enum _LPC_TYPE LPC_TYPE