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 // Internal helper macro
31 #define N_ROUND_UP(x,s) \
32 (((ULONG)(x)+(s)-1) & ~((ULONG)(s)-1))
35 // Maximum message size that can be sent through an LPC Port without a section
37 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
40 // Port Object Access Masks
42 #define PORT_ALL_ACCESS 0x1
47 typedef enum _LPC_TYPE
59 LPC_CONNECTION_REQUEST
,
60 LPC_CONNECTION_REFUSED
,
65 // Information Classes for NtQueryInformationPort
67 typedef enum _PORT_INFORMATION_CLASS
70 } PORT_INFORMATION_CLASS
;
75 // Portable LPC Types for 32/64-bit compatibility
78 #define LPC_CLIENT_ID CLIENT_ID64
79 #define LPC_SIZE_T ULONGLONG
80 #define LPC_PVOID ULONGLONG
81 #define LPC_HANDLE ULONGLONG
83 #define LPC_CLIENT_ID CLIENT_ID
84 #define LPC_SIZE_T SIZE_T
85 #define LPC_PVOID PVOID
86 #define LPC_HANDLE HANDLE
92 typedef struct _PORT_MESSAGE
108 CSHORT DataInfoOffset
;
114 LPC_CLIENT_ID ClientId
;
115 double DoNotUseThisField
;
120 LPC_SIZE_T ClientViewSize
;
123 } PORT_MESSAGE
, *PPORT_MESSAGE
;
126 // Local and Remove Port Views
128 typedef struct _PORT_VIEW
131 LPC_HANDLE SectionHandle
;
135 LPC_PVOID ViewRemoteBase
;
136 } PORT_VIEW
, *PPORT_VIEW
;
138 typedef struct _REMOTE_PORT_VIEW
143 } REMOTE_PORT_VIEW
, *PREMOTE_PORT_VIEW
;
146 // LPC Kernel-Mode Message Structures defined for size only
148 typedef struct _LPCP_MESSAGE
151 PORT_MESSAGE Request
;
154 typedef struct _LPCP_CONNECTION_MESSAGE
157 } LPCP_CONNECTION_MESSAGE
;
162 // LPC Paged and Non-Paged Port Queues
164 typedef struct _LPCP_NONPAGED_PORT_QUEUE
166 KSEMAPHORE Semaphore
;
167 struct _LPCP_PORT_OBJECT
*BackPointer
;
168 } LPCP_NONPAGED_PORT_QUEUE
, *PLPCP_NONPAGED_PORT_QUEUE
;
170 typedef struct _LPCP_PORT_QUEUE
172 PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue
;
173 KSEMAPHORE Semaphore
;
174 LIST_ENTRY ReceiveHead
;
175 } LPCP_PORT_QUEUE
, *PLPCP_PORT_QUEUE
;
180 typedef struct _LPCP_PORT_OBJECT
184 struct _LPCP_PORT_OBJECT
*ConnectionPort
;
185 struct _LPCP_PORT_OBJECT
*ConnectedPort
;
186 LPCP_PORT_QUEUE MsgQueue
;
188 PVOID ClientSectionBase
;
189 PVOID ServerSectionBase
;
191 ULONG MaxMessageLength
;
192 ULONG MaxConnectionInfoLength
;
193 PETHREAD ClientThread
;
194 SECURITY_QUALITY_OF_SERVICE SecurityQos
;
195 SECURITY_CLIENT_CONTEXT StaticSecurity
;
196 LIST_ENTRY LpcReplyChainHead
;
197 LIST_ENTRY LpcDataInfoChainHead
;
198 } LPCP_PORT_OBJECT
, *PLPCP_PORT_OBJECT
;
201 // LPC Kernel-Mode Message Structures
203 typedef struct _LPCP_MESSAGE
210 SINGLE_LIST_ENTRY FreeEntry
;
214 PLPCP_PORT_OBJECT SenderPort
;
215 PETHREAD RepliedToThread
;
217 PORT_MESSAGE Request
;
218 } LPCP_MESSAGE
, *PLPCP_MESSAGE
;
220 typedef struct _LPCP_CONNECTION_MESSAGE
222 PORT_VIEW ClientView
;
223 PLPCP_PORT_OBJECT ClientPort
;
225 REMOTE_PORT_VIEW ServerView
;
226 } LPCP_CONNECTION_MESSAGE
, *PLPCP_CONNECTION_MESSAGE
;
231 // Client Died LPC Message (FIXME: should go in pstypes.h?)
233 typedef struct _CLIENT_DIED_MSG
236 LARGE_INTEGER CreateTime
;
237 } CLIENT_DIED_MSG
, *PCLIENT_DIED_MSG
;
240 // Maximum total Kernel-Mode LPC Message Structure Size
242 #define LPCP_MAX_MESSAGE_SIZE \
243 N_ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
244 sizeof(LPCP_MESSAGE) + \
245 sizeof(LPCP_CONNECTION_MESSAGE), 16)
248 // Maximum actual LPC Message Length
250 #define LPC_MAX_MESSAGE_LENGTH \
251 (LPCP_MAX_MESSAGE_SIZE - \
252 FIELD_OFFSET(LPCP_MESSAGE, Request))
255 // Maximum actual size of LPC Message Data
257 #define LPC_MAX_DATA_LENGTH \
258 (LPC_MAX_MESSAGE_LENGTH - \
259 sizeof(PORT_MESSAGE) - \
260 sizeof(LPCP_CONNECTION_MESSAGE))
262 #endif // _LPCTYPES_H