- Use correct, documented, LPC Message structure (PORT_MESSAGE). Fix all caller code to use new member names and structure names.
Modified: trunk/reactos/include/ndk/lpctypes.h
Modified: trunk/reactos/include/ndk/zwfuncs.h
Modified: trunk/reactos/include/subsys/csrss/csrss.h
Modified: trunk/reactos/include/subsys/lsass/lsass.h
Modified: trunk/reactos/include/subsys/sm/api.h
Modified: trunk/reactos/lib/lsasrv/lsaport.c
Modified: trunk/reactos/lib/ntdll/csr/lpc.c
Modified: trunk/reactos/lib/ntdll/dbg/debug.c
Modified: trunk/reactos/lib/secur32/lsa.c
Modified: trunk/reactos/lib/smdll/query.c
Modified: trunk/reactos/lib/smlib/compses.c
Modified: trunk/reactos/lib/smlib/execpgm.c
Modified: trunk/reactos/ntoskrnl/include/internal/port.h
Modified: trunk/reactos/ntoskrnl/io/error.c
Modified: trunk/reactos/ntoskrnl/lpc/close.c
Modified: trunk/reactos/ntoskrnl/lpc/connect.c
Modified: trunk/reactos/ntoskrnl/lpc/create.c
Modified: trunk/reactos/ntoskrnl/lpc/listen.c
Modified: trunk/reactos/ntoskrnl/lpc/port.c
Modified: trunk/reactos/ntoskrnl/lpc/receive.c
Modified: trunk/reactos/ntoskrnl/lpc/reply.c
Modified: trunk/reactos/ntoskrnl/lpc/send.c
Modified: trunk/reactos/subsys/csrss/api/process.c
Modified: trunk/reactos/subsys/csrss/api/user.c
Modified: trunk/reactos/subsys/csrss/api/wapi.c
Modified: trunk/reactos/subsys/csrss/win32csr/conio.c
Modified: trunk/reactos/subsys/csrss/win32csr/desktopbg.c
Modified: trunk/reactos/subsys/csrss/win32csr/exitros.c
Modified: trunk/reactos/subsys/smss/debug.c
Modified: trunk/reactos/subsys/smss/smapi.c

Modified: trunk/reactos/include/ndk/lpctypes.h
--- trunk/reactos/include/ndk/lpctypes.h	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/include/ndk/lpctypes.h	2005-08-11 02:58:54 UTC (rev 17275)
@@ -9,7 +9,7 @@
 #ifndef _LPCTYPES_H
 #define _LPCTYPES_H
 
-#define PORT_MESSAGE_TYPE(m) ((m).Header.MessageType)
+#define LPC_MESSAGE_TYPE(m) ((m).Header.u2.s2.Type)
 
 /* DEPENDENCIES **************************************************************/
 
@@ -18,8 +18,8 @@
 /* CONSTANTS *****************************************************************/
 #define LPC_MESSAGE_BASE_SIZE 24
 #define MAX_MESSAGE_DATA      (0x130)
-#define PORT_MAX_DATA_LENGTH 0x104
-#define PORT_MAX_MESSAGE_LENGTH 0x148
+#define LPC_MAX_DATA_LENGTH 0x104
+#define LPC_MAX_MESSAGE_LENGTH 0x148
 
 /* ENUMERATIONS **************************************************************/
 
@@ -42,17 +42,50 @@
 
 /* TYPES *********************************************************************/
 
-/* FIXME: USE REAL DEFINITION */
-typedef struct _LPC_MESSAGE
+#if defined(USE_LPC6432)
+#define LPC_CLIENT_ID CLIENT_ID64
+#define LPC_SIZE_T ULONGLONG
+#define LPC_PVOID ULONGLONG
+#define LPC_HANDLE ULONGLONG
+#else
+#define LPC_CLIENT_ID CLIENT_ID
+#define LPC_SIZE_T SIZE_T
+#define LPC_PVOID PVOID
+#define LPC_HANDLE HANDLE
+#endif
+
+typedef struct _PORT_MESSAGE
 {
-    USHORT  DataSize;
-    USHORT  MessageSize;
-    USHORT  MessageType;
-    USHORT  VirtualRangesOffset;
-    CLIENT_ID  ClientId;
-    ULONG  MessageId;
-    ULONG  SectionSize;
-} LPC_MESSAGE, *PLPC_MESSAGE;
+    union
+    {
+        struct
+        {
+            CSHORT DataLength;
+            CSHORT TotalLength;
+        } s1;
+        ULONG Length;
+    } u1;
+    union
+    {
+        struct
+        {
+            CSHORT Type;
+            CSHORT DataInfoOffset;
+        } s2;
+        ULONG ZeroInit;
+    } u2;
+    union
+    {
+        LPC_CLIENT_ID ClientId;
+        double DoNotUseThisField;
+    };
+    ULONG MessageId;
+    union
+    {
+        LPC_SIZE_T ClientViewSize;
+        ULONG CallbackId;
+    };
+} PORT_MESSAGE, *PPORT_MESSAGE;
 
 /* FIXME: USE REAL DEFINITION */
 typedef struct _LPC_SECTION_WRITE
@@ -76,7 +109,7 @@
 /* FIXME: USE REAL DEFINITION */
 typedef struct _LPC_MAX_MESSAGE
 {
-    LPC_MESSAGE Header;
+    PORT_MESSAGE Header;
     BYTE Data[MAX_MESSAGE_DATA];
 } LPC_MAX_MESSAGE, *PLPC_MAX_MESSAGE;
 

Modified: trunk/reactos/include/ndk/zwfuncs.h
--- trunk/reactos/include/ndk/zwfuncs.h	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/include/ndk/zwfuncs.h	2005-08-11 02:58:54 UTC (rev 17275)
@@ -25,7 +25,7 @@
 NtAcceptConnectPort(
     PHANDLE PortHandle,
     HANDLE NamedPortHandle,
-    PLPC_MESSAGE ServerReply,
+    PPORT_MESSAGE ServerReply,
     BOOLEAN AcceptIt,
     PLPC_SECTION_WRITE WriteMap,
     PLPC_SECTION_READ ReadMap
@@ -1243,14 +1243,14 @@
 STDCALL
 NtImpersonateClientOfPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE ClientMessage
+    PPORT_MESSAGE ClientMessage
 );
 
 NTSTATUS
 STDCALL
 ZwImpersonateClientOfPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE ClientMessage
+    PPORT_MESSAGE ClientMessage
 );
 
 NTSTATUS
@@ -1316,13 +1316,13 @@
 NTSTATUS
 STDCALL
 NtListenPort(HANDLE PortHandle,
-             PLPC_MESSAGE LpcMessage
+             PPORT_MESSAGE LpcMessage
 );
 
 NTSTATUS
 STDCALL
 ZwListenPort(HANDLE PortHandle,
-             PLPC_MESSAGE LpcMessage
+             PPORT_MESSAGE LpcMessage
 );
 
 NTSTATUS
@@ -2825,7 +2825,7 @@
 STDCALL
 NtReadRequestData(
     HANDLE PortHandle,
-    PLPC_MESSAGE Message,
+    PPORT_MESSAGE Message,
     ULONG Index,
     PVOID Buffer,
     ULONG BufferLength,
@@ -2836,7 +2836,7 @@
 STDCALL
 ZwReadRequestData(
     HANDLE PortHandle,
-    PLPC_MESSAGE Message,
+    PPORT_MESSAGE Message,
     ULONG Index,
     PVOID Buffer,
     ULONG BufferLength,
@@ -2944,14 +2944,14 @@
 STDCALL
 NtReplyPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE LpcReply
+    PPORT_MESSAGE LpcReply
 );
 
 NTSTATUS
 STDCALL
 ZwReplyPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE LpcReply
+    PPORT_MESSAGE LpcReply
 );
 
 NTSTATUS
@@ -2959,8 +2959,8 @@
 NtReplyWaitReceivePort(
     HANDLE PortHandle,
     PULONG PortId,
-    PLPC_MESSAGE MessageReply,
-    PLPC_MESSAGE MessageRequest
+    PPORT_MESSAGE MessageReply,
+    PPORT_MESSAGE MessageRequest
 );
 
 NTSTATUS
@@ -2968,51 +2968,51 @@
 ZwReplyWaitReceivePort(
     HANDLE PortHandle,
     PULONG PortId,
-    PLPC_MESSAGE MessageReply,
-    PLPC_MESSAGE MessageRequest
+    PPORT_MESSAGE MessageReply,
+    PPORT_MESSAGE MessageRequest
 );
 
 NTSTATUS
 STDCALL
 NtReplyWaitReplyPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE ReplyMessage
+    PPORT_MESSAGE ReplyMessage
 );
 
 NTSTATUS
 STDCALL
 ZwReplyWaitReplyPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE ReplyMessage
+    PPORT_MESSAGE ReplyMessage
 );
 
 NTSTATUS
 STDCALL
 NtRequestPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE LpcMessage);
+    PPORT_MESSAGE LpcMessage);
 
 NTSTATUS
 STDCALL
 ZwRequestPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE LpcMessage
+    PPORT_MESSAGE LpcMessage
 );
 
 NTSTATUS
 STDCALL
 NtRequestWaitReplyPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE LpcReply,
-    PLPC_MESSAGE LpcRequest
+    PPORT_MESSAGE LpcReply,
+    PPORT_MESSAGE LpcRequest
 );
 
 NTSTATUS
 STDCALL
 ZwRequestWaitReplyPort(
     HANDLE PortHandle,
-    PLPC_MESSAGE LpcReply,
-    PLPC_MESSAGE LpcRequest
+    PPORT_MESSAGE LpcReply,
+    PPORT_MESSAGE LpcRequest
 );
 
 NTSTATUS
@@ -3975,7 +3975,7 @@
 STDCALL
 NtWriteRequestData(
     HANDLE PortHandle,
-    PLPC_MESSAGE Message,
+    PPORT_MESSAGE Message,
     ULONG Index,
     PVOID Buffer,
     ULONG BufferLength,
@@ -3986,7 +3986,7 @@
 STDCALL
 ZwWriteRequestData(
     HANDLE PortHandle,
-    PLPC_MESSAGE Message,
+    PPORT_MESSAGE Message,
     ULONG Index,
     PVOID Buffer,
     ULONG BufferLength,

Modified: trunk/reactos/include/subsys/csrss/csrss.h
--- trunk/reactos/include/subsys/csrss/csrss.h	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/include/subsys/csrss/csrss.h	2005-08-11 02:58:54 UTC (rev 17275)
@@ -491,7 +491,7 @@
 {
   union
   {
-    LPC_MESSAGE Header;
+    PORT_MESSAGE Header;
     struct
     {
       BYTE HeaderReserved[LPC_MESSAGE_BASE_SIZE];

Modified: trunk/reactos/include/subsys/lsass/lsass.h
--- trunk/reactos/include/subsys/lsass/lsass.h	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/include/subsys/lsass/lsass.h	2005-08-11 02:58:54 UTC (rev 17275)
@@ -96,7 +96,7 @@
 
 typedef union _LSASS_REQUEST
 {
-   LPC_MESSAGE Header;
+   PORT_MESSAGE Header;
    struct {
       UCHAR LpcHeader[LPC_MESSAGE_BASE_SIZE];
       ULONG Type;
@@ -115,7 +115,7 @@
 
 typedef struct _LSASS_REPLY
 {
-   LPC_MESSAGE Header;
+   PORT_MESSAGE Header;
    NTSTATUS Status;
    union
      {

Modified: trunk/reactos/include/subsys/sm/api.h
--- trunk/reactos/include/subsys/sm/api.h	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/include/subsys/sm/api.h	2005-08-11 02:58:54 UTC (rev 17275)
@@ -110,7 +110,7 @@
 typedef union _SM_PORT_MESSAGE
 {
   /*** LPC common header ***/
-  LPC_MESSAGE Header;
+  PORT_MESSAGE Header;
   struct {
     UCHAR LpcHeader[LPC_MESSAGE_BASE_SIZE];
     /*** SM common header ***/
@@ -138,7 +138,7 @@
 
 /*** MACRO ***********************************************************/
 
-#define SM_CONNECT_DATA_SIZE(m)  ((m).Header.DataSize-sizeof(USHORT)-sizeof(WORD))
+#define SM_CONNECT_DATA_SIZE(m)  ((m).Header.u1.s1.DataLength-sizeof(USHORT)-sizeof(WORD))
 #define SM_PORT_DATA_SIZE(c)     (sizeof(DWORD)+sizeof(NTSTATUS)+sizeof(c))
 #define SM_PORT_MESSAGE_SIZE     (sizeof(SM_PORT_MESSAGE))
 

Modified: trunk/reactos/lib/lsasrv/lsaport.c
--- trunk/reactos/lib/lsasrv/lsaport.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/lib/lsasrv/lsaport.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -112,18 +112,18 @@
 
       DPRINT("Received message\n");
 
-      if (Request.Header.MessageType == LPC_PORT_CLOSED)
+      if (Request.Header.u2.s2.Type == LPC_PORT_CLOSED)
 	{
 	  DPRINT("Port closed\n");
 
 //	  return STATUS_UNSUCCESSFUL;
 	}
-      if (Request.Header.MessageType == LPC_REQUEST)
+      if (Request.Header.u2.s2.Type == LPC_REQUEST)
 	{
 	  DPRINT("Received request\n");
 
 	}
-      else if (Request.Header.MessageType == LPC_DATAGRAM)
+      else if (Request.Header.u2.s2.Type == LPC_DATAGRAM)
 	{
 	  DPRINT("Received datagram\n");
 

Modified: trunk/reactos/lib/ntdll/csr/lpc.c
--- trunk/reactos/lib/ntdll/csr/lpc.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/lib/ntdll/csr/lpc.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -81,12 +81,12 @@
 
     /* Fill out the header */
     Request->Type = ApiNumber;
-    Request->Header.DataSize = RequestLength - LPC_MESSAGE_BASE_SIZE;
-    Request->Header.MessageSize = RequestLength;
-    DPRINT("CSR: API: %x, DataSize: %x, MessageSize: %x\n", 
+    Request->Header.u1.s1.DataLength = RequestLength - LPC_MESSAGE_BASE_SIZE;
+    Request->Header.u1.s1.TotalLength = RequestLength;
+    DPRINT("CSR: API: %x, u1.s1.DataLength: %x, u1.s1.TotalLength: %x\n", 
             ApiNumber,
-            Request->Header.DataSize,
-            Request->Header.MessageSize);
+            Request->Header.u1.s1.DataLength,
+            Request->Header.u1.s1.TotalLength);
                 
     /* Send the LPC Message */
     Status = NtRequestWaitReplyPort(WindowsApiPort,

Modified: trunk/reactos/lib/ntdll/dbg/debug.c
--- trunk/reactos/lib/ntdll/dbg/debug.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/lib/ntdll/dbg/debug.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -24,7 +24,7 @@
 
 typedef struct _LPC_DBGSS_MESSAGE
 {
-	LPC_MESSAGE Header;
+	PORT_MESSAGE Header;
 	ULONG Unknown1;
 	ULONG Unknown2;
 	ULONG Unknown3;
@@ -45,7 +45,7 @@
 		Status = NtReplyWaitReceivePort (DbgSsApiPort,
 		                                 NULL,
 		                                 NULL,
-		                                 (PLPC_MESSAGE)&Message);
+		                                 (PPORT_MESSAGE)&Message);
 		if (!NT_SUCCESS(Status))
 		{
 			DbgPrint ("DbgSs: NtReplyWaitReceivePort failed - Status == %lx\n",

Modified: trunk/reactos/lib/secur32/lsa.c
--- trunk/reactos/lib/secur32/lsa.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/lib/secur32/lsa.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -32,8 +32,8 @@
    LSASS_REPLY Reply;
    NTSTATUS Status;
       
-   Request.Header.DataSize = 0;
-   Request.Header.MessageSize = sizeof(LSASS_REQUEST);
+   Request.Header.u1.s1.DataLength = 0;
+   Request.Header.u1.s1.TotalLength = sizeof(LSASS_REQUEST);
    Request.Type = LSASS_REQUEST_DEREGISTER_LOGON_PROCESS;
    Status = NtRequestWaitReplyPort(LsaHandle,
 				   &Request.Header,
@@ -82,10 +82,10 @@
    Request = (PLSASS_REQUEST)RawRequest;
    Reply = (PLSASS_REPLY)RawReply;
    
-   Request->Header.DataSize = sizeof(LSASS_REQUEST) + SubmitBufferLength -
+   Request->Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) + SubmitBufferLength -
      LPC_MESSAGE_BASE_SIZE;
-   Request->Header.MessageSize = 
-     Request->Header.DataSize + LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.TotalLength = 
+     Request->Header.u1.s1.DataLength + LPC_MESSAGE_BASE_SIZE;
    Request->Type = LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE;
    Request->d.CallAuthenticationPackageRequest.AuthenticationPackage =
      AuthenticationPackage;
@@ -145,9 +145,9 @@
    LSASS_REPLY Reply;
    
    Request = (PLSASS_REQUEST)RawRequest;
-   Request->Header.DataSize = sizeof(LSASS_REQUEST) + PackageName->Length -
+   Request->Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) + PackageName->Length -
      LPC_MESSAGE_BASE_SIZE;
-   Request->Header.MessageSize = Request->Header.DataSize +
+   Request->Header.u1.s1.TotalLength = Request->Header.u1.s1.DataLength +
      LPC_MESSAGE_BASE_SIZE;
    Request->Type = LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE;
    
@@ -236,8 +236,8 @@
    Request->d.LogonUserRequest.SourceContext = *SourceContext;
    
    Request->Type = LSASS_REQUEST_LOGON_USER;
-   Request->Header.DataSize = RequestLength - LPC_MESSAGE_BASE_SIZE;
-   Request->Header.MessageSize = RequestLength + LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.DataLength = RequestLength - LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.TotalLength = RequestLength + LPC_MESSAGE_BASE_SIZE;
    
    Reply = (PLSASS_REPLY)RawReply;
    
@@ -302,9 +302,9 @@
      }
    
    Request.Type = LSASS_REQUEST_REGISTER_LOGON_PROCESS;
-   Request.Header.DataSize = sizeof(LSASS_REQUEST) - 
+   Request.Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) - 
      LPC_MESSAGE_BASE_SIZE;
-   Request.Header.MessageSize = sizeof(LSASS_REQUEST);
+   Request.Header.u1.s1.TotalLength = sizeof(LSASS_REQUEST);
    
    Request.d.RegisterLogonProcessRequest.Length = LsaLogonProcessName->Length;
    memcpy(Request.d.RegisterLogonProcessRequest.LogonProcessNameBuffer,

Modified: trunk/reactos/lib/smdll/query.c
--- trunk/reactos/lib/smdll/query.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/lib/smdll/query.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -85,10 +85,10 @@
 	SmReqMsg.SmHeader.ApiIndex = SM_API_QUERY_INFORMATION;
 
 	/* Prepare the port request message */
-	SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE;
-	SmReqMsg.Header.DataSize    = SM_PORT_DATA_SIZE(SmReqMsg.Request);
-	SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE;
-	Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg);
+	SmReqMsg.Header.u2.s2.Type = LPC_NEW_MESSAGE;
+	SmReqMsg.Header.u1.s1.DataLength    = SM_PORT_DATA_SIZE(SmReqMsg.Request);
+	SmReqMsg.Header.u1.s1.TotalLength = SM_PORT_MESSAGE_SIZE;
+	Status = NtRequestWaitReplyPort (hSmApiPort, (PPORT_MESSAGE) & SmReqMsg, (PPORT_MESSAGE) & SmReqMsg);
 	if (NT_SUCCESS(Status))
 	{
 		/* Unmarshal data */

Modified: trunk/reactos/lib/smlib/compses.c
--- trunk/reactos/lib/smlib/compses.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/lib/smlib/compses.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -50,10 +50,10 @@
   SmReqMsg.SmHeader.ApiIndex = SM_API_COMPLETE_SESSION;
 
   /* Port message */
-  SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE;
-  SmReqMsg.Header.DataSize    = SM_PORT_DATA_SIZE(SmReqMsg.Request);
-  SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE;
-  Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg);
+  SmReqMsg.Header.u2.s2.Type = LPC_NEW_MESSAGE;
+  SmReqMsg.Header.u1.s1.DataLength    = SM_PORT_DATA_SIZE(SmReqMsg.Request);
+  SmReqMsg.Header.u1.s1.TotalLength = SM_PORT_MESSAGE_SIZE;
+  Status = NtRequestWaitReplyPort (hSmApiPort, (PPORT_MESSAGE) & SmReqMsg, (PPORT_MESSAGE) & SmReqMsg);
   if (NT_SUCCESS(Status))
   {
     return SmReqMsg.SmHeader.Status;

Modified: trunk/reactos/lib/smlib/execpgm.c
--- trunk/reactos/lib/smlib/execpgm.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/lib/smlib/execpgm.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -60,23 +60,23 @@
   SmReqMsg.SmHeader.ApiIndex = SM_API_EXECUTE_PROGRAMME;
 
   /* LPC message */
-  SmReqMsg.Header.MessageType = LPC_NEW_MESSAGE;
-  SmReqMsg.Header.DataSize    = SM_PORT_DATA_SIZE(SmReqMsg.Request);
-  SmReqMsg.Header.MessageSize = SM_PORT_MESSAGE_SIZE;
+  SmReqMsg.Header.u2.s2.Type = LPC_NEW_MESSAGE;
+  SmReqMsg.Header.u1.s1.DataLength    = SM_PORT_DATA_SIZE(SmReqMsg.Request);
+  SmReqMsg.Header.u1.s1.TotalLength = SM_PORT_MESSAGE_SIZE;
 
   DPRINT("SMLIB: %s:\n"
-	  "  MessageType = %d\n"
-	  "  DataSize    = %d\n"
-	  "  MessageSize = %d\n"
-	  "  sizeof(LPC_MESSAGE)==%d\n",
+	  "  u2.s2.Type = %d\n"
+	  "  u1.s1.DataLength    = %d\n"
+	  "  u1.s1.TotalLength = %d\n"
+	  "  sizeof(PORT_MESSAGE)==%d\n",
 	  __FUNCTION__,
-	  SmReqMsg.Header.MessageType,
-	  SmReqMsg.Header.DataSize,
-	  SmReqMsg.Header.MessageSize,
-	  sizeof(LPC_MESSAGE));
+	  SmReqMsg.Header.u2.s2.Type,
+	  SmReqMsg.Header.u1.s1.DataLength,
+	  SmReqMsg.Header.u1.s1.TotalLength,
+	  sizeof(PORT_MESSAGE));
 
   /* Call SM and wait for a reply */
-  Status = NtRequestWaitReplyPort (hSmApiPort, (PLPC_MESSAGE) & SmReqMsg, (PLPC_MESSAGE) & SmReqMsg);
+  Status = NtRequestWaitReplyPort (hSmApiPort, (PPORT_MESSAGE) & SmReqMsg, (PPORT_MESSAGE) & SmReqMsg);
   if (NT_SUCCESS(Status))
   {
     return SmReqMsg.SmHeader.Status;

Modified: trunk/reactos/ntoskrnl/include/internal/port.h
--- trunk/reactos/ntoskrnl/include/internal/port.h	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/include/internal/port.h	2005-08-11 02:58:54 UTC (rev 17275)
@@ -31,7 +31,7 @@
 
 typedef struct _EPORT_CONNECT_REQUEST_MESSAGE
 {
-  LPC_MESSAGE MessageHeader;
+  PORT_MESSAGE MessageHeader;
   PEPROCESS ConnectingProcess;
   struct _SECTION_OBJECT* SendSectionObject;
   LARGE_INTEGER SendSectionOffset;
@@ -42,7 +42,7 @@
 
 typedef struct _EPORT_CONNECT_REPLY_MESSAGE
 {
-  LPC_MESSAGE MessageHeader;
+  PORT_MESSAGE MessageHeader;
   PVOID SendServerViewBase;
   ULONG ReceiveClientViewSize;
   PVOID ReceiveClientViewBase;
@@ -58,7 +58,7 @@
 
 NTSTATUS STDCALL
 LpcRequestPort (PEPORT		Port,
-		PLPC_MESSAGE	LpcMessage);
+		PPORT_MESSAGE	LpcMessage);
 NTSTATUS
 STDCALL
 LpcSendTerminationPort (PEPORT	Port,
@@ -87,13 +87,13 @@
 {
   PEPORT		Sender;
   LIST_ENTRY	QueueListEntry;
-  LPC_MESSAGE	Message;
+  PORT_MESSAGE	Message;
   UCHAR		MessageData [MAX_MESSAGE_DATA];
 } QUEUEDMESSAGE,  *PQUEUEDMESSAGE;
 
 typedef struct _LPC_DBG_MESSAGE
 {
-   LPC_MESSAGE Header;
+   PORT_MESSAGE Header;
    ULONG Type;
    ULONG Status;
    union
@@ -142,7 +142,7 @@
 
 typedef struct _LPC_TERMINATION_MESSAGE
 {
-   LPC_MESSAGE Header;
+   PORT_MESSAGE Header;
    LARGE_INTEGER CreationTime;
 } LPC_TERMINATION_MESSAGE, *PLPC_TERMINATION_MESSAGE;
 
@@ -196,7 +196,7 @@
 
 NTSTATUS STDCALL
 EiReplyOrRequestPort (IN	PEPORT		Port,
-		      IN	PLPC_MESSAGE	LpcReply,
+		      IN	PPORT_MESSAGE	LpcReply,
 		      IN	ULONG		MessageType,
 		      IN	PEPORT		Sender);
 

Modified: trunk/reactos/ntoskrnl/io/error.c
--- trunk/reactos/ntoskrnl/io/error.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/io/error.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -265,7 +265,7 @@
 
       /* Initialize the log message */
       Message = (PIO_ERROR_LOG_MESSAGE)Request->Data;
-      Message->Type = 0xC; //IO_TYPE_ERROR_MESSAGE;
+      Message->Type = IO_TYPE_ERROR_MESSAGE;
       Message->Size =
 	sizeof(IO_ERROR_LOG_MESSAGE) - sizeof(IO_ERROR_LOG_PACKET) +
 	LogEntry->PacketSize + DriverNameLength;
@@ -285,9 +285,9 @@
 
       DPRINT ("SequenceNumber %lx\n", Packet->SequenceNumber);
 
-      Request->Header.DataSize = Message->Size;
-      Request->Header.MessageSize =
-	Request->Header.DataSize + sizeof(LPC_MESSAGE);
+      Request->Header.u1.s1.DataLength = Message->Size;
+      Request->Header.u1.s1.TotalLength =
+	Request->Header.u1.s1.DataLength + sizeof(PPORT_MESSAGE);
 
       /* Send the error message to the log port */
       Status = ZwRequestPort (IopLogPort,

Modified: trunk/reactos/ntoskrnl/lpc/close.c
--- trunk/reactos/ntoskrnl/lpc/close.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/lpc/close.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -31,7 +31,7 @@
 LpcpClosePort (PVOID	ObjectBody, ULONG	HandleCount)
 {
   PEPORT Port = (PEPORT)ObjectBody;
-  LPC_MESSAGE Message;
+  PORT_MESSAGE Message;
 
   /* FIXME Race conditions here! */
 
@@ -44,8 +44,8 @@
   if (HandleCount == 1 && Port->State == EPORT_CONNECTED_CLIENT)
     {
       DPRINT("Informing server\n");
-      Message.MessageSize = sizeof(LPC_MESSAGE);
-      Message.DataSize = 0;
+      Message.u1.s1.TotalLength = sizeof(PORT_MESSAGE);
+      Message.u1.s1.DataLength = 0;
       EiReplyOrRequestPort (Port->OtherPort,
 			    &Message,
 			    LPC_PORT_CLOSED,

Modified: trunk/reactos/ntoskrnl/lpc/connect.c
--- trunk/reactos/ntoskrnl/lpc/connect.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/lpc/connect.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -90,14 +90,14 @@
   /*
    * Initialize the request message.
    */
-  RequestMessage->MessageHeader.DataSize =
+  RequestMessage->MessageHeader.u1.s1.DataLength =
     sizeof(EPORT_CONNECT_REQUEST_MESSAGE) + RequestConnectDataLength -
-    sizeof(LPC_MESSAGE);
-  RequestMessage->MessageHeader.MessageSize =
+    sizeof(PORT_MESSAGE);
+  RequestMessage->MessageHeader.u1.s1.TotalLength =
     sizeof(EPORT_CONNECT_REQUEST_MESSAGE) + RequestConnectDataLength;
   DPRINT("RequestMessageSize %d\n",
-	 RequestMessage->MessageHeader.MessageSize);
-  RequestMessage->MessageHeader.SectionSize = 0;
+	 RequestMessage->MessageHeader.u1.s1.TotalLength);
+  RequestMessage->MessageHeader.ClientViewSize = 0;
   RequestMessage->ConnectingProcess = PsGetCurrentProcess();
   ObReferenceObjectByPointer(RequestMessage->ConnectingProcess,
 			     PROCESS_VM_OPERATION,
@@ -148,7 +148,7 @@
   /*
    * Check for connection refusal.
    */
-  if (CReply->MessageHeader.MessageType == LPC_CONNECTION_REFUSED)
+  if (CReply->MessageHeader.u2.s2.Type == LPC_CONNECTION_REFUSED)
     {
       ObDereferenceObject(OurPort);
       ExFreePool(Reply);
@@ -656,7 +656,7 @@
 /*EXPORTED*/ NTSTATUS STDCALL
 NtAcceptConnectPort (PHANDLE			ServerPortHandle,
 		     HANDLE			NamedPortHandle,
-		     PLPC_MESSAGE		LpcMessage,
+		     PPORT_MESSAGE		LpcMessage,
 		     BOOLEAN			AcceptIt,
 		     PLPC_SECTION_WRITE	WriteMap,
 		     PLPC_SECTION_READ	ReadMap)
@@ -674,7 +674,7 @@
   Size = sizeof(EPORT_CONNECT_REPLY_MESSAGE);
   if (LpcMessage)
   {
-     Size += LpcMessage->DataSize;
+     Size += LpcMessage->u1.s1.DataLength;
   }
 
   CReply = ExAllocatePool(NonPagedPool, Size);
@@ -746,20 +746,20 @@
    */
   if (LpcMessage != NULL)
     {
-      memcpy(&CReply->MessageHeader, LpcMessage, sizeof(LPC_MESSAGE));
+      memcpy(&CReply->MessageHeader, LpcMessage, sizeof(PORT_MESSAGE));
       memcpy(&CReply->ConnectData, (PVOID)(LpcMessage + 1),
-	     LpcMessage->DataSize);
-      CReply->MessageHeader.MessageSize =
-	sizeof(EPORT_CONNECT_REPLY_MESSAGE) + LpcMessage->DataSize;
-      CReply->MessageHeader.DataSize = CReply->MessageHeader.MessageSize -
-	sizeof(LPC_MESSAGE);
-      CReply->ConnectDataLength = LpcMessage->DataSize;
+	     LpcMessage->u1.s1.DataLength);
+      CReply->MessageHeader.u1.s1.TotalLength =
+	sizeof(EPORT_CONNECT_REPLY_MESSAGE) + LpcMessage->u1.s1.DataLength;
+      CReply->MessageHeader.u1.s1.DataLength = CReply->MessageHeader.u1.s1.TotalLength -
+	sizeof(PORT_MESSAGE);
+      CReply->ConnectDataLength = LpcMessage->u1.s1.DataLength;
     }
   else
     {
-      CReply->MessageHeader.MessageSize = sizeof(EPORT_CONNECT_REPLY_MESSAGE);
-      CReply->MessageHeader.DataSize = sizeof(EPORT_CONNECT_REPLY_MESSAGE) -
-	sizeof(LPC_MESSAGE);
+      CReply->MessageHeader.u1.s1.TotalLength = sizeof(EPORT_CONNECT_REPLY_MESSAGE);
+      CReply->MessageHeader.u1.s1.DataLength = sizeof(EPORT_CONNECT_REPLY_MESSAGE) -
+	sizeof(PORT_MESSAGE);
       CReply->ConnectDataLength = 0;
     }
   if (!AcceptIt)
@@ -872,7 +872,7 @@
     {
       CReply->ReceiveClientViewBase = WriteMap->TargetViewBase;
     }
-  CReply->MaximumMessageSize = PORT_MAX_MESSAGE_LENGTH;
+  CReply->MaximumMessageSize = LPC_MAX_MESSAGE_LENGTH;
 
 
   /*
@@ -881,7 +881,7 @@
   OurPort->OtherPort = ConnectionRequest->Sender;
   OurPort->OtherPort->OtherPort = OurPort;
   EiReplyOrRequestPort(ConnectionRequest->Sender,
-		       (PLPC_MESSAGE)CReply,
+		       (PPORT_MESSAGE)CReply,
 		       LPC_REPLY,
 		       OurPort);
   ExFreePool(ConnectionRequest);

Modified: trunk/reactos/ntoskrnl/lpc/create.c
--- trunk/reactos/ntoskrnl/lpc/create.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/lpc/create.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -49,11 +49,11 @@
   {
     return (STATUS_INVALID_PORT_ATTRIBUTES);
   }
-  if (MaxConnectInfoLength > PORT_MAX_DATA_LENGTH)
+  if (MaxConnectInfoLength > LPC_MAX_DATA_LENGTH)
     {
       return (STATUS_INVALID_PARAMETER_3);
     }
-  if (MaxDataLength > PORT_MAX_MESSAGE_LENGTH)
+  if (MaxDataLength > LPC_MAX_MESSAGE_LENGTH)
     {
       return (STATUS_INVALID_PARAMETER_4);
     }
@@ -128,8 +128,8 @@
     }
 
   Status = LpcpInitializePort (Port, EPORT_TYPE_SERVER_RQST_PORT, NULL);
-  Port->MaxConnectInfoLength = PORT_MAX_DATA_LENGTH;
-  Port->MaxDataLength = PORT_MAX_MESSAGE_LENGTH;
+  Port->MaxConnectInfoLength = LPC_MAX_DATA_LENGTH;
+  Port->MaxDataLength = LPC_MAX_MESSAGE_LENGTH;
   Port->MaxPoolUsage = MaxPoolUsage;
 
   ObDereferenceObject (Port);

Modified: trunk/reactos/ntoskrnl/lpc/listen.c
--- trunk/reactos/ntoskrnl/lpc/listen.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/lpc/listen.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -40,7 +40,7 @@
  */
 /*EXPORTED*/ NTSTATUS STDCALL
 NtListenPort (IN	HANDLE		PortHandle,
-	      IN	PLPC_MESSAGE	ConnectMsg)
+	      IN	PPORT_MESSAGE	ConnectMsg)
 {
   NTSTATUS	Status;
 
@@ -58,12 +58,12 @@
        * Drop any other message.
        */
       if (!NT_SUCCESS(Status) ||
-	  LPC_CONNECTION_REQUEST == ConnectMsg->MessageType)
+	  LPC_CONNECTION_REQUEST == ConnectMsg->u2.s2.Type)
 	{
 	  DPRINT("Got message (type %x)\n", LPC_CONNECTION_REQUEST);
 	  break;
 	}
-      DPRINT("Got message (type %x)\n", ConnectMsg->MessageType);
+      DPRINT("Got message (type %x)\n", ConnectMsg->u2.s2.Type);
     }
 
   return (Status);

Modified: trunk/reactos/ntoskrnl/lpc/port.c
--- trunk/reactos/ntoskrnl/lpc/port.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/lpc/port.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -121,7 +121,7 @@
  */
 NTSTATUS STDCALL
 NtImpersonateClientOfPort (HANDLE		PortHandle,
-			   PLPC_MESSAGE	ClientMessage)
+			   PPORT_MESSAGE	ClientMessage)
 {
   UNIMPLEMENTED;
   return(STATUS_NOT_IMPLEMENTED);

Modified: trunk/reactos/ntoskrnl/lpc/receive.c
--- trunk/reactos/ntoskrnl/lpc/receive.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/lpc/receive.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -27,7 +27,7 @@
  */
 NTSTATUS STDCALL
 NtReadRequestData (HANDLE		PortHandle,
-		   PLPC_MESSAGE	Message,
+		   PPORT_MESSAGE	Message,
 		   ULONG		Index,
 		   PVOID		Buffer,
 		   ULONG		BufferLength,

Modified: trunk/reactos/ntoskrnl/lpc/reply.c
--- trunk/reactos/ntoskrnl/lpc/reply.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/lpc/reply.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -31,7 +31,7 @@
  */
 NTSTATUS STDCALL
 EiReplyOrRequestPort (IN	PEPORT		Port,
-		      IN	PLPC_MESSAGE	LpcReply,
+		      IN	PPORT_MESSAGE	LpcReply,
 		      IN	ULONG		MessageType,
 		      IN	PEPORT		Sender)
 {
@@ -49,12 +49,12 @@
 
    if (LpcReply != NULL)
      {
-	memcpy(&MessageReply->Message, LpcReply, LpcReply->MessageSize);
+	memcpy(&MessageReply->Message, LpcReply, LpcReply->u1.s1.TotalLength);
      }
 
    MessageReply->Message.ClientId.UniqueProcess = PsGetCurrentProcessId();
    MessageReply->Message.ClientId.UniqueThread = PsGetCurrentThreadId();
-   MessageReply->Message.MessageType = MessageType;
+   MessageReply->Message.u2.s2.Type = MessageType;
    MessageReply->Message.MessageId = InterlockedIncrementUL(&LpcpNextMessageId);
 
    KeAcquireSpinLock(&Port->Lock, &oldIrql);
@@ -78,7 +78,7 @@
  */
 NTSTATUS STDCALL
 NtReplyPort (IN	HANDLE		PortHandle,
-	     IN	PLPC_MESSAGE	LpcReply)
+	     IN	PPORT_MESSAGE	LpcReply)
 {
    NTSTATUS Status;
    PEPORT Port;
@@ -137,8 +137,8 @@
 NTSTATUS STDCALL
 NtReplyWaitReceivePortEx(IN  HANDLE		PortHandle,
 			 OUT PULONG		PortId,
-			 IN  PLPC_MESSAGE	LpcReply,
-			 OUT PLPC_MESSAGE	LpcMessage,
+			 IN  PPORT_MESSAGE	LpcReply,
+			 OUT PPORT_MESSAGE	LpcMessage,
 			 IN  PLARGE_INTEGER	Timeout)
 {
    PEPORT Port;
@@ -159,7 +159,7 @@
        _SEH_TRY
          {
            ProbeForWrite(LpcMessage,
-                         sizeof(LPC_MESSAGE),
+                         sizeof(PORT_MESSAGE),
                          1);
          }
        _SEH_HANDLE
@@ -252,15 +252,15 @@
    Request = EiDequeueMessagePort(Port);
    KeReleaseSpinLock(&Port->Lock, oldIrql);
 
-   if (Request->Message.MessageType == LPC_CONNECTION_REQUEST)
+   if (Request->Message.u2.s2.Type == LPC_CONNECTION_REQUEST)
      {
-       LPC_MESSAGE Header;
+       PORT_MESSAGE Header;
        PEPORT_CONNECT_REQUEST_MESSAGE CRequest;
 
        CRequest = (PEPORT_CONNECT_REQUEST_MESSAGE)&Request->Message;
-       memcpy(&Header, &Request->Message, sizeof(LPC_MESSAGE));
-       Header.DataSize = CRequest->ConnectDataLength;
-       Header.MessageSize = Header.DataSize + sizeof(LPC_MESSAGE);
+       memcpy(&Header, &Request->Message, sizeof(PORT_MESSAGE));
+       Header.u1.s1.DataLength = CRequest->ConnectDataLength;
+       Header.u1.s1.TotalLength = Header.u1.s1.DataLength + sizeof(PORT_MESSAGE);
        
        if (PreviousMode != KernelMode)
          {
@@ -272,7 +272,7 @@
 
                RtlCopyMemory(LpcMessage,
                              &Header,
-                             sizeof(LPC_MESSAGE));
+                             sizeof(PORT_MESSAGE));
                RtlCopyMemory((PVOID)(LpcMessage + 1),
                              CRequest->ConnectData,
                              CRequest->ConnectDataLength);
@@ -287,7 +287,7 @@
          {
            RtlCopyMemory(LpcMessage,
                          &Header,
-                         sizeof(LPC_MESSAGE));
+                         sizeof(PORT_MESSAGE));
            RtlCopyMemory((PVOID)(LpcMessage + 1),
                          CRequest->ConnectData,
                          CRequest->ConnectDataLength);
@@ -300,12 +300,12 @@
            _SEH_TRY
              {
                ProbeForWrite(LpcMessage,
-                             Request->Message.MessageSize,
+                             Request->Message.u1.s1.TotalLength,
                              1);
 
                RtlCopyMemory(LpcMessage,
                              &Request->Message,
-                             Request->Message.MessageSize);
+                             Request->Message.u1.s1.TotalLength);
              }
            _SEH_HANDLE
              {
@@ -317,7 +317,7 @@
          {
            RtlCopyMemory(LpcMessage,
                          &Request->Message,
-                         Request->Message.MessageSize);
+                         Request->Message.u1.s1.TotalLength);
          }
      }
    if (!NT_SUCCESS(Status))
@@ -333,7 +333,7 @@
        ObDereferenceObject(Port);
        return(Status);
      }
-   if (Request->Message.MessageType == LPC_CONNECTION_REQUEST)
+   if (Request->Message.u2.s2.Type == LPC_CONNECTION_REQUEST)
      {
        KeAcquireSpinLock(&Port->Lock, &oldIrql);
        EiEnqueueConnectMessagePort(Port, Request);
@@ -372,8 +372,8 @@
 NTSTATUS STDCALL
 NtReplyWaitReceivePort (IN  HANDLE		PortHandle,
 			OUT PULONG		PortId,
-			IN  PLPC_MESSAGE	LpcReply,
-			OUT PLPC_MESSAGE	LpcMessage)
+			IN  PPORT_MESSAGE	LpcReply,
+			OUT PPORT_MESSAGE	LpcMessage)
 {
   return(NtReplyWaitReceivePortEx (PortHandle,
 				   PortId,
@@ -395,7 +395,7 @@
  */
 NTSTATUS STDCALL
 NtReplyWaitReplyPort (HANDLE		PortHandle,
-		      PLPC_MESSAGE	ReplyMessage)
+		      PPORT_MESSAGE	ReplyMessage)
 {
    UNIMPLEMENTED;
    return(STATUS_NOT_IMPLEMENTED);
@@ -408,8 +408,8 @@
 STDCALL
 LpcRequestWaitReplyPort (
 	IN PEPORT		Port,
-	IN PLPC_MESSAGE	LpcMessageRequest,
-	OUT PLPC_MESSAGE	LpcMessageReply
+	IN PPORT_MESSAGE	LpcMessageRequest,
+	OUT PPORT_MESSAGE	LpcMessageReply
 	)
 {
 	UNIMPLEMENTED;

Modified: trunk/reactos/ntoskrnl/lpc/send.c
--- trunk/reactos/ntoskrnl/lpc/send.c	2005-08-11 02:51:51 UTC (rev 17274)
+++ trunk/reactos/ntoskrnl/lpc/send.c	2005-08-11 02:58:54 UTC (rev 17275)
@@ -36,7 +36,7 @@
   LPC_TERMINATION_MESSAGE Msg;
 
[truncated at 1000 lines; 1082 more skipped]