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
36 typedef enum _LPC_TYPE
48 LPC_CONNECTION_REQUEST
,
49 LPC_CONNECTION_REFUSED
,
54 // Information Classes for NtQueryInformationPort
56 typedef enum _PORT_INFORMATION_CLASS
59 } PORT_INFORMATION_CLASS
;
64 // Portable LPC Types for 32/64-bit compatibility
67 #define LPC_CLIENT_ID CLIENT_ID64
68 #define LPC_SIZE_T ULONGLONG
69 #define LPC_PVOID ULONGLONG
70 #define LPC_HANDLE ULONGLONG
72 #define LPC_CLIENT_ID CLIENT_ID
73 #define LPC_SIZE_T SIZE_T
74 #define LPC_PVOID PVOID
75 #define LPC_HANDLE HANDLE
81 typedef struct _PORT_MESSAGE
97 CSHORT DataInfoOffset
;
103 LPC_CLIENT_ID ClientId
;
104 double DoNotUseThisField
;
109 LPC_SIZE_T ClientViewSize
;
112 } PORT_MESSAGE
, *PPORT_MESSAGE
;
115 // Local and Remove Port Views
117 typedef struct _PORT_VIEW
120 LPC_HANDLE SectionHandle
;
124 LPC_PVOID ViewRemoteBase
;
125 } PORT_VIEW
, *PPORT_VIEW
;
127 typedef struct _REMOTE_PORT_VIEW
132 } REMOTE_PORT_VIEW
, *PREMOTE_PORT_VIEW
;
135 // LPC Kernel-Mode Message Structures defined for size only
137 typedef struct _LPCP_MESSAGE
140 PORT_MESSAGE Request
;
143 typedef struct _LPCP_CONNECTION_MESSAGE
146 } LPCP_CONNECTION_MESSAGE
;
151 // LPC Paged and Non-Paged Port Queues
153 typedef struct _LPCP_NONPAGED_PORT_QUEUE
155 KSEMAPHORE Semaphore
;
156 struct _LPCP_PORT_OBJECT
*BackPointer
;
157 } LPCP_NONPAGED_PORT_QUEUE
, *PLPCP_NONPAGED_PORT_QUEUE
;
159 typedef struct _LPCP_PORT_QUEUE
161 PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue
;
162 KSEMAPHORE Semaphore
;
163 LIST_ENTRY ReceiveHead
;
164 } LPCP_PORT_QUEUE
, *PLPCP_PORT_QUEUE
;
169 typedef struct _LPCP_PORT_OBJECT
173 struct _LPCP_PORT_OBJECT
*ConnectionPort
;
174 struct _LPCP_PORT_OBJECT
*ConnectedPort
;
175 LPCP_PORT_QUEUE MsgQueue
;
177 PVOID ClientSectionBase
;
178 PVOID ServerSectionBase
;
180 ULONG MaxMessageLength
;
181 ULONG MaxConnectionInfoLength
;
182 PETHREAD ClientThread
;
183 SECURITY_QUALITY_OF_SERVICE SecurityQos
;
184 SECURITY_CLIENT_CONTEXT StaticSecurity
;
185 LIST_ENTRY LpcReplyChainHead
;
186 LIST_ENTRY LpcDataInfoChainHead
;
187 } LPCP_PORT_OBJECT
, *PLPCP_PORT_OBJECT
;
190 // LPC Kernel-Mode Message Structures
192 typedef struct _LPCP_MESSAGE
199 SINGLE_LIST_ENTRY FreeEntry
;
203 PLPCP_PORT_OBJECT SenderPort
;
204 PETHREAD RepliedToThread
;
206 PORT_MESSAGE Request
;
207 } LPCP_MESSAGE
, *PLPCP_MESSAGE
;
209 typedef struct _LPCP_CONNECTION_MESSAGE
211 PORT_VIEW ClientView
;
212 PLPCP_PORT_OBJECT ClientPort
;
214 REMOTE_PORT_VIEW ServerView
;
215 } LPCP_CONNECTION_MESSAGE
, *PLPCP_CONNECTION_MESSAGE
;
220 // Client Died LPC Message (FIXME: should go in pstypes.h?)
222 typedef struct _CLIENT_DIED_MSG
225 LARGE_INTEGER CreateTime
;
226 } CLIENT_DIED_MSG
, *PCLIENT_DIED_MSG
;
229 // Maximum total Kernel-Mode LPC Message Structure Size
231 #define LPCP_MAX_MESSAGE_SIZE \
232 ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
233 sizeof(LPCP_MESSAGE) + \
234 sizeof(LPCP_CONNECTION_MESSAGE), 16)
237 // Maximum actual LPC Message Length
239 #define LPC_MAX_MESSAGE_LENGTH \
240 (LPCP_MAX_MESSAGE_SIZE - \
241 FIELD_OFFSET(LPCP_MESSAGE, Request))
244 // Maximum actual size of LPC Message Data
246 #define LPC_MAX_DATA_LENGTH \
247 (LPC_MAX_MESSAGE_LENGTH - \
248 sizeof(PORT_MESSAGE) - \
249 sizeof(LPCP_CONNECTION_MESSAGE))
251 #endif // _LPCTYPES_H