- Add DDK alignment macros and move/rename the ones in the NDK for user-mode only...
[reactos.git] / reactos / include / ndk / lpctypes.h
index f0b74cb..911e4e8 100644 (file)
@@ -1,20 +1,43 @@
-/*
- * PROJECT:         ReactOS Native Headers
- * FILE:            include/ndk/lpctypes.h
- * PURPOSE:         Definitions for Local Procedure Call Types not defined in DDK/IFS
- * PROGRAMMER:      Alex Ionescu (alex@relsoft.net)
- * UPDATE HISTORY:
- *                  Created 06/10/04
- */
+/*++ NDK Version: 0095
+
+Copyright (c) Alex Ionescu.  All rights reserved.
+
+Header Name:
+
+    lpctypes.h
+
+Abstract:
+
+    Type definitions for the Loader.
+
+Author:
+
+    Alex Ionescu (alex.ionescu@reactos.com)   06-Oct-2004
+
+--*/
+
 #ifndef _LPCTYPES_H
 #define _LPCTYPES_H
 
-/* DEPENDENCIES **************************************************************/
+//
+// Dependencies
+//
+#include <umtypes.h>
+#include <pstypes.h>
 
-/* EXPORTED DATA *************************************************************/
+//
+// Maximum message size that can be sent through an LPC Port without a section
+//
+#define PORT_MAXIMUM_MESSAGE_LENGTH     256
 
-/* ENUMERATIONS **************************************************************/
+//
+// Port Object Access Masks
+//
+#define PORT_ALL_ACCESS                 0x1
 
+//
+// LPC Message Types
+//
 typedef enum _LPC_TYPE
 {
     LPC_NEW_MESSAGE,
@@ -32,16 +55,20 @@ typedef enum _LPC_TYPE
     LPC_MAXIMUM
 } LPC_TYPE;
 
-/* TYPES *********************************************************************/
+//
+// Information Classes for NtQueryInformationPort
+//
+typedef enum _PORT_INFORMATION_CLASS
+{
+    PortNoInformation
+} PORT_INFORMATION_CLASS;
 
-/* 
- * Native Structures in IFS. Duplicated here for user-mode.
- * Also duplicated if the IFS is not present. Until the WDK is
- * released, we should not force the usage of a 100$ kit.
- */
-#if defined(NTOS_MODE_USER) || !(defined(_NTIFS_))
+#ifdef NTOS_MODE_USER
 
-#if defined(USE_LPC6432)
+//
+// Portable LPC Types for 32/64-bit compatibility
+//
+#ifdef USE_LPC6432
 #define LPC_CLIENT_ID CLIENT_ID64
 #define LPC_SIZE_T ULONGLONG
 #define LPC_PVOID ULONGLONG
@@ -53,6 +80,9 @@ typedef enum _LPC_TYPE
 #define LPC_HANDLE HANDLE
 #endif
 
+//
+// LPC Port Message
+//
 typedef struct _PORT_MESSAGE
 {
     union
@@ -86,6 +116,9 @@ typedef struct _PORT_MESSAGE
     };
 } PORT_MESSAGE, *PPORT_MESSAGE;
 
+//
+// Local and Remove Port Views
+//
 typedef struct _PORT_VIEW
 {
     ULONG Length;
@@ -103,6 +136,9 @@ typedef struct _REMOTE_PORT_VIEW
     LPC_PVOID ViewBase;
 } REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;
 
+//
+// LPC Kernel-Mode Message Structures defined for size only
+//
 typedef struct _LPCP_MESSAGE
 {
     UCHAR Data[0x14];
@@ -114,9 +150,11 @@ typedef struct _LPCP_CONNECTION_MESSAGE
     UCHAR Data[0x2C];
 } LPCP_CONNECTION_MESSAGE;
 
-/* Kernel-Mode Structures */
 #else
 
+//
+// LPC Paged and Non-Paged Port Queues
+//
 typedef struct _LPCP_NONPAGED_PORT_QUEUE
 {
     KSEMAPHORE Semaphore;
@@ -130,7 +168,9 @@ typedef struct _LPCP_PORT_QUEUE
     LIST_ENTRY ReceiveHead;
 } LPCP_PORT_QUEUE, *PLPCP_PORT_QUEUE;
 
-#ifdef _NTIFS_
+//
+// LPC Port Object
+//
 typedef struct _LPCP_PORT_OBJECT
 {
     ULONG Length;
@@ -151,6 +191,9 @@ typedef struct _LPCP_PORT_OBJECT
     LIST_ENTRY LpcDataInfoChainHead;
 } LPCP_PORT_OBJECT, *PLPCP_PORT_OBJECT;
 
+//
+// LPC Kernel-Mode Message Structures
+//
 typedef struct _LPCP_MESSAGE
 {
     union
@@ -175,26 +218,39 @@ typedef struct _LPCP_CONNECTION_MESSAGE
     PVOID SectionToMap;
     REMOTE_PORT_VIEW ServerView;
 } LPCP_CONNECTION_MESSAGE, *PLPCP_CONNECTION_MESSAGE;
-#endif
 
 #endif
 
-/* CONSTANTS *****************************************************************/
-
-#define PORT_MAXIMUM_MESSAGE_LENGTH 256
+//
+// Client Died LPC Message (FIXME: should go in pstypes.h?)
+//
+typedef struct _CLIENT_DIED_MSG
+{
+    PORT_MESSAGE h;
+    LARGE_INTEGER CreateTime;
+} CLIENT_DIED_MSG, *PCLIENT_DIED_MSG;
 
+//
+// Maximum total Kernel-Mode LPC Message Structure Size
+//
 #define LPCP_MAX_MESSAGE_SIZE \
-    ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
+    ALIGN_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
     sizeof(LPCP_MESSAGE) + \
-    sizeof(LPCP_CONNECTION_MESSAGE), 16)
+    sizeof(LPCP_CONNECTION_MESSAGE), sizeof(ULONGLONG) * 2)
 
+//
+// Maximum actual LPC Message Length
+//
 #define LPC_MAX_MESSAGE_LENGTH \
     (LPCP_MAX_MESSAGE_SIZE - \
     FIELD_OFFSET(LPCP_MESSAGE, Request))
 
+//
+// Maximum actual size of LPC Message Data
+//
 #define LPC_MAX_DATA_LENGTH \
     (LPC_MAX_MESSAGE_LENGTH - \
     sizeof(PORT_MESSAGE) - \
     sizeof(LPCP_CONNECTION_MESSAGE))
 
-#endif
+#endif // _LPCTYPES_H