ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

lpctypes.h
Go to the documentation of this file.
00001 /*++ NDK Version: 0098
00002 
00003 Copyright (c) Alex Ionescu.  All rights reserved.
00004 
00005 Header Name:
00006 
00007     lpctypes.h
00008 
00009 Abstract:
00010 
00011     Type definitions for the Loader.
00012 
00013 Author:
00014 
00015     Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
00016 
00017 --*/
00018 
00019 #ifndef _LPCTYPES_H
00020 #define _LPCTYPES_H
00021 
00022 //
00023 // Dependencies
00024 //
00025 #include <umtypes.h>
00026 //#include <pstypes.h>
00027 
00028 #ifndef NTOS_MODE_USER
00029 
00030 //
00031 // Kernel Exported Object Types
00032 //
00033 extern POBJECT_TYPE NTSYSAPI LpcPortObjectType;
00034 
00035 #endif // !NTOS_MODE_USER
00036 
00037 //
00038 // Internal helper macro
00039 //
00040 #define N_ROUND_UP(x,s) \
00041     (((ULONG)(x)+(s)-1) & ~((ULONG)(s)-1))
00042 
00043 //
00044 // Port Object Access Masks
00045 //
00046 #define PORT_CONNECT                    0x1
00047 #define PORT_ALL_ACCESS                 0x1
00048 
00049 //
00050 // Port Object Flags
00051 //
00052 #define LPCP_CONNECTION_PORT            0x00000001
00053 #define LPCP_UNCONNECTED_PORT           0x00000002
00054 #define LPCP_COMMUNICATION_PORT         0x00000003
00055 #define LPCP_CLIENT_PORT                0x00000004
00056 #define LPCP_PORT_TYPE_MASK             0x0000000F
00057 #define LPCP_PORT_DELETED               0x10000000
00058 #define LPCP_WAITABLE_PORT              0x20000000
00059 #define LPCP_NAME_DELETED               0x40000000
00060 #define LPCP_SECURITY_DYNAMIC           0x80000000
00061 
00062 //
00063 // LPC Message Types
00064 //
00065 typedef enum _LPC_TYPE
00066 {
00067     LPC_NEW_MESSAGE,
00068     LPC_REQUEST,
00069     LPC_REPLY,
00070     LPC_DATAGRAM,
00071     LPC_LOST_REPLY,
00072     LPC_PORT_CLOSED,
00073     LPC_CLIENT_DIED,
00074     LPC_EXCEPTION,
00075     LPC_DEBUG_EVENT,
00076     LPC_ERROR_EVENT,
00077     LPC_CONNECTION_REQUEST,
00078     LPC_CONNECTION_REFUSED,
00079     LPC_MAXIMUM
00080 } LPC_TYPE;
00081 
00082 //
00083 // Information Classes for NtQueryInformationPort
00084 //
00085 typedef enum _PORT_INFORMATION_CLASS
00086 {
00087     PortNoInformation
00088 } PORT_INFORMATION_CLASS;
00089 
00090 #ifdef NTOS_MODE_USER
00091 
00092 //
00093 // Maximum message size that can be sent through an LPC Port without a section
00094 //
00095 #ifdef _WIN64
00096 #define PORT_MAXIMUM_MESSAGE_LENGTH 512
00097 #else
00098 #define PORT_MAXIMUM_MESSAGE_LENGTH 256
00099 #endif
00100 
00101 //
00102 // Portable LPC Types for 32/64-bit compatibility
00103 //
00104 #ifdef USE_LPC6432
00105 #define LPC_CLIENT_ID CLIENT_ID64
00106 #define LPC_SIZE_T ULONGLONG
00107 #define LPC_PVOID ULONGLONG
00108 #define LPC_HANDLE ULONGLONG
00109 #else
00110 #define LPC_CLIENT_ID CLIENT_ID
00111 #define LPC_SIZE_T SIZE_T
00112 #define LPC_PVOID PVOID
00113 #define LPC_HANDLE HANDLE
00114 #endif
00115 
00116 //
00117 // LPC Port Message
00118 //
00119 typedef struct _PORT_MESSAGE
00120 {
00121     union
00122     {
00123         struct
00124         {
00125             CSHORT DataLength;
00126             CSHORT TotalLength;
00127         } s1;
00128         ULONG Length;
00129     } u1;
00130     union
00131     {
00132         struct
00133         {
00134             CSHORT Type;
00135             CSHORT DataInfoOffset;
00136         } s2;
00137         ULONG ZeroInit;
00138     } u2;
00139     union
00140     {
00141         LPC_CLIENT_ID ClientId;
00142         double DoNotUseThisField;
00143     };
00144     ULONG MessageId;
00145     union
00146     {
00147         LPC_SIZE_T ClientViewSize;
00148         ULONG CallbackId;
00149     };
00150 } PORT_MESSAGE, *PPORT_MESSAGE;
00151 
00152 //
00153 // Local and Remove Port Views
00154 //
00155 typedef struct _PORT_VIEW
00156 {
00157     ULONG Length;
00158     LPC_HANDLE SectionHandle;
00159     ULONG SectionOffset;
00160     LPC_SIZE_T ViewSize;
00161     LPC_PVOID ViewBase;
00162     LPC_PVOID ViewRemoteBase;
00163 } PORT_VIEW, *PPORT_VIEW;
00164 
00165 typedef struct _REMOTE_PORT_VIEW
00166 {
00167     ULONG Length;
00168     LPC_SIZE_T ViewSize;
00169     LPC_PVOID ViewBase;
00170 } REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;
00171 
00172 //
00173 // LPC Kernel-Mode Message Structures defined for size only
00174 //
00175 typedef struct _LPCP_MESSAGE
00176 {
00177     UCHAR Data[0x14];
00178     PORT_MESSAGE Request;
00179 } LPCP_MESSAGE;
00180 
00181 typedef struct _LPCP_CONNECTION_MESSAGE
00182 {
00183     UCHAR Data[0x2C];
00184 } LPCP_CONNECTION_MESSAGE;
00185 
00186 #else
00187 
00188 //
00189 // LPC Paged and Non-Paged Port Queues
00190 //
00191 typedef struct _LPCP_NONPAGED_PORT_QUEUE
00192 {
00193     KSEMAPHORE Semaphore;
00194     struct _LPCP_PORT_OBJECT *BackPointer;
00195 } LPCP_NONPAGED_PORT_QUEUE, *PLPCP_NONPAGED_PORT_QUEUE;
00196 
00197 typedef struct _LPCP_PORT_QUEUE
00198 {
00199     PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue;
00200     PKSEMAPHORE Semaphore;
00201     LIST_ENTRY ReceiveHead;
00202 } LPCP_PORT_QUEUE, *PLPCP_PORT_QUEUE;
00203 
00204 //
00205 // LPC Port Object
00206 //
00207 typedef struct _LPCP_PORT_OBJECT
00208 {
00209     struct _LPCP_PORT_OBJECT *ConnectionPort;
00210     struct _LPCP_PORT_OBJECT *ConnectedPort;
00211     LPCP_PORT_QUEUE MsgQueue;
00212     CLIENT_ID Creator;
00213     PVOID ClientSectionBase;
00214     PVOID ServerSectionBase;
00215     PVOID PortContext;
00216     PETHREAD ClientThread;
00217     SECURITY_QUALITY_OF_SERVICE SecurityQos;
00218     SECURITY_CLIENT_CONTEXT StaticSecurity;
00219     LIST_ENTRY LpcReplyChainHead;
00220     LIST_ENTRY LpcDataInfoChainHead;
00221     union
00222     {
00223         PEPROCESS ServerProcess;
00224         PEPROCESS MappingProcess;
00225     };
00226     ULONG MaxMessageLength;
00227     ULONG MaxConnectionInfoLength;
00228     ULONG Flags;
00229     KEVENT WaitEvent;
00230 } LPCP_PORT_OBJECT, *PLPCP_PORT_OBJECT;
00231 
00232 //
00233 // LPC Kernel-Mode Message Structures
00234 //
00235 typedef struct _LPCP_MESSAGE
00236 {
00237     union
00238     {
00239         LIST_ENTRY Entry;
00240         struct
00241         {
00242             SINGLE_LIST_ENTRY FreeEntry;
00243             ULONG Reserved0;
00244         };
00245     };
00246     PLPCP_PORT_OBJECT SenderPort;
00247     PETHREAD RepliedToThread;
00248     PVOID PortContext;
00249     PORT_MESSAGE Request;
00250 } LPCP_MESSAGE, *PLPCP_MESSAGE;
00251 
00252 typedef struct _LPCP_CONNECTION_MESSAGE
00253 {
00254     PORT_VIEW ClientView;
00255     PLPCP_PORT_OBJECT ClientPort;
00256     PVOID SectionToMap;
00257     REMOTE_PORT_VIEW ServerView;
00258 } LPCP_CONNECTION_MESSAGE, *PLPCP_CONNECTION_MESSAGE;
00259 
00260 #endif
00261 
00262 //
00263 // Client Died LPC Message
00264 //
00265 typedef struct _CLIENT_DIED_MSG
00266 {
00267     PORT_MESSAGE h;
00268     LARGE_INTEGER CreateTime;
00269 } CLIENT_DIED_MSG, *PCLIENT_DIED_MSG;
00270 
00271 //
00272 // Maximum total Kernel-Mode LPC Message Structure Size
00273 //
00274 #define LPCP_MAX_MESSAGE_SIZE \
00275     N_ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
00276     sizeof(LPCP_MESSAGE) + \
00277     sizeof(LPCP_CONNECTION_MESSAGE), 16)
00278 
00279 //
00280 // Maximum actual LPC Message Length
00281 //
00282 #define LPC_MAX_MESSAGE_LENGTH \
00283     (LPCP_MAX_MESSAGE_SIZE - \
00284     FIELD_OFFSET(LPCP_MESSAGE, Request))
00285 
00286 //
00287 // Maximum actual size of LPC Message Data
00288 //
00289 #define LPC_MAX_DATA_LENGTH \
00290     (LPC_MAX_MESSAGE_LENGTH - \
00291     sizeof(PORT_MESSAGE) - \
00292     sizeof(LPCP_CONNECTION_MESSAGE))
00293 
00294 #endif // _LPCTYPES_H

Generated on Sun May 27 2012 04:30:56 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.