3 Copyright (c) Alex Ionescu. All rights reserved.
11 Type definitions for the Loader.
15 Alex Ionescu (alex.ionescu@reactos.com) 06-Oct-2004
29 // Maximum message size that can be sent through an LPC Port without a section
31 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
34 // Port Object Access Masks
36 #define PORT_ALL_ACCESS 0x1
41 typedef enum _LPC_TYPE
53 LPC_CONNECTION_REQUEST
,
54 LPC_CONNECTION_REFUSED
,
59 // Information Classes for NtQueryInformationPort
61 typedef enum _PORT_INFORMATION_CLASS
64 } PORT_INFORMATION_CLASS
;
69 // Portable LPC Types for 32/64-bit compatibility
72 #define LPC_CLIENT_ID CLIENT_ID64
73 #define LPC_SIZE_T ULONGLONG
74 #define LPC_PVOID ULONGLONG
75 #define LPC_HANDLE ULONGLONG
77 #define LPC_CLIENT_ID CLIENT_ID
78 #define LPC_SIZE_T SIZE_T
79 #define LPC_PVOID PVOID
80 #define LPC_HANDLE HANDLE
86 typedef struct _PORT_MESSAGE
102 CSHORT DataInfoOffset
;
108 LPC_CLIENT_ID ClientId
;
109 double DoNotUseThisField
;
114 LPC_SIZE_T ClientViewSize
;
117 } PORT_MESSAGE
, *PPORT_MESSAGE
;
120 // Local and Remove Port Views
122 typedef struct _PORT_VIEW
125 LPC_HANDLE SectionHandle
;
129 LPC_PVOID ViewRemoteBase
;
130 } PORT_VIEW
, *PPORT_VIEW
;
132 typedef struct _REMOTE_PORT_VIEW
137 } REMOTE_PORT_VIEW
, *PREMOTE_PORT_VIEW
;
140 // LPC Kernel-Mode Message Structures defined for size only
142 typedef struct _LPCP_MESSAGE
145 PORT_MESSAGE Request
;
148 typedef struct _LPCP_CONNECTION_MESSAGE
151 } LPCP_CONNECTION_MESSAGE
;
156 // LPC Paged and Non-Paged Port Queues
158 typedef struct _LPCP_NONPAGED_PORT_QUEUE
160 KSEMAPHORE Semaphore
;
161 struct _LPCP_PORT_OBJECT
*BackPointer
;
162 } LPCP_NONPAGED_PORT_QUEUE
, *PLPCP_NONPAGED_PORT_QUEUE
;
164 typedef struct _LPCP_PORT_QUEUE
166 PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue
;
167 KSEMAPHORE Semaphore
;
168 LIST_ENTRY ReceiveHead
;
169 } LPCP_PORT_QUEUE
, *PLPCP_PORT_QUEUE
;
174 typedef struct _LPCP_PORT_OBJECT
178 struct _LPCP_PORT_OBJECT
*ConnectionPort
;
179 struct _LPCP_PORT_OBJECT
*ConnectedPort
;
180 LPCP_PORT_QUEUE MsgQueue
;
182 PVOID ClientSectionBase
;
183 PVOID ServerSectionBase
;
185 ULONG MaxMessageLength
;
186 ULONG MaxConnectionInfoLength
;
187 PETHREAD ClientThread
;
188 SECURITY_QUALITY_OF_SERVICE SecurityQos
;
189 SECURITY_CLIENT_CONTEXT StaticSecurity
;
190 LIST_ENTRY LpcReplyChainHead
;
191 LIST_ENTRY LpcDataInfoChainHead
;
192 } LPCP_PORT_OBJECT
, *PLPCP_PORT_OBJECT
;
195 // LPC Kernel-Mode Message Structures
197 typedef struct _LPCP_MESSAGE
204 SINGLE_LIST_ENTRY FreeEntry
;
208 PLPCP_PORT_OBJECT SenderPort
;
209 PETHREAD RepliedToThread
;
211 PORT_MESSAGE Request
;
212 } LPCP_MESSAGE
, *PLPCP_MESSAGE
;
214 typedef struct _LPCP_CONNECTION_MESSAGE
216 PORT_VIEW ClientView
;
217 PLPCP_PORT_OBJECT ClientPort
;
219 REMOTE_PORT_VIEW ServerView
;
220 } LPCP_CONNECTION_MESSAGE
, *PLPCP_CONNECTION_MESSAGE
;
225 // Client Died LPC Message (FIXME: should go in pstypes.h?)
227 typedef struct _CLIENT_DIED_MSG
230 LARGE_INTEGER CreateTime
;
231 } CLIENT_DIED_MSG
, *PCLIENT_DIED_MSG
;
234 // Maximum total Kernel-Mode LPC Message Structure Size
236 #define LPCP_MAX_MESSAGE_SIZE \
237 ALIGN_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
238 sizeof(LPCP_MESSAGE) + \
239 sizeof(LPCP_CONNECTION_MESSAGE), sizeof(ULONGLONG) * 2)
242 // Maximum actual LPC Message Length
244 #define LPC_MAX_MESSAGE_LENGTH \
245 (LPCP_MAX_MESSAGE_SIZE - \
246 FIELD_OFFSET(LPCP_MESSAGE, Request))
249 // Maximum actual size of LPC Message Data
251 #define LPC_MAX_DATA_LENGTH \
252 (LPC_MAX_MESSAGE_LENGTH - \
253 sizeof(PORT_MESSAGE) - \
254 sizeof(LPCP_CONNECTION_MESSAGE))
256 #endif // _LPCTYPES_H