Remove all non-official LPC structures/defines/hardcoded hacks, and use actual correct sizes and structures.
Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h
Modified: trunk/reactos/include/ndk/fixmes.txt
Modified: trunk/reactos/include/ndk/lpctypes.h
Modified: trunk/reactos/include/ndk/ntndk.h
Modified: trunk/reactos/include/reactos/helper.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/rtl/thread.c
Modified: trunk/reactos/lib/secur32/lsa.c
Modified: trunk/reactos/ntoskrnl/include/internal/port.h
Modified: trunk/reactos/ntoskrnl/io/error.c
Modified: trunk/reactos/ntoskrnl/lpc/send.c
Modified: trunk/reactos/services/eventlog/eventlog.h
Modified: trunk/reactos/services/eventlog/logport.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/subsys/system/dhcp/dhclient.c
Modified: trunk/reactos/subsys/win32k/ntuser/csr.c
Modified: trunk/reactos/w32api/include/ddk/ntifs.h
Modified: trunk/reactos/w32api/include/ddk/prntfont.h

Modified: trunk/reactos/boot/freeldr/freeldr/include/freeldr.h
--- trunk/reactos/boot/freeldr/freeldr/include/freeldr.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/boot/freeldr/freeldr/include/freeldr.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -35,8 +35,6 @@
 #include <portio.h>
 #include <reactos.h>
 
-#define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1))
-#define ROUND_DOWN(N, S) ((N) & ~((S) - 1))
 #define Ke386EraseFlags(x)     __asm__ __volatile__("pushl $0 ; popfl\n")
 
 extern BOOL UserInterfaceUp;	/* Tells us if the user interface is displayed */

Modified: trunk/reactos/include/ndk/fixmes.txt
--- trunk/reactos/include/ndk/fixmes.txt	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/include/ndk/fixmes.txt	2005-08-16 23:05:33 UTC (rev 17417)
@@ -33,8 +33,45 @@
 	Priority 4:
 	- FIXED: Kernel and Memory Types are not architecture-specific (Eric) [ketypes.h, mmtypes.h]
 	- FIXED: Win32K Builds with windows.h (Filip) [extypes.h, ketypes.h]
+	- Move out stuff from umtypes.h into the actual header where they should go. Use ifdeffing
+	  directly in that file to protect user-mode versus kernel-mode types. umtypes.h will only
+	  end up containing the misc types that are needed for compatibility. This would create a
+	  significant cleanup.
 
 	Priority 5:
-	- LPC Types are totally wrong. [lpctypes.h]
+	- FIXED: LPC Types are totally wrong. (Alex) [lpctypes.h]
 	- Missing System Info Classes [zwtypes.h]
 	- FIXED: Process Priority Classes are messed up (Alex) [pstypes.h]
+	
+Generic Note:
+	One of the most difficult things is when certain structures require the IFS for some of their
+	members. Up until some time ago, the IFS was 1000$, so it was senseless to require it in order
+	to allow people to use the NDK. Recently, however, the IFS price went down to 100$. This is 
+	still way too much. Even though the GNU NTIFS.H exists, I don't want to fallback on it. The
+	good news is that the WDK (Windows Driver Kit), which will supplant the DDK in about a year,
+	includes the IFS. At that point we can remove all the #ifndef/ifdef NTIFS hacks, since it'll
+	be OK to "force" IFS usage.
+	
+	UPDATE:
+	However, I'm giving serious consideration of making the IFS a requirement, and suggesting
+	usage of the GNU IFS for anyone that needs it. The problem, however, is that the official
+	GNU IFS is outdated and quite invalid in many ways, compared to the ReactOS IFS (which still
+	isn't perfect yet). Also, this would include many more definitions then needed. A third
+	option that I'm considering is creating a new header, until the WDK is out, which will be 
+	called ifstypes. It would be the brother of umtypes, but for kernel mode. Only a small
+	number of types will need to be included, and hence they will be easy to locate in case
+	the official ones change (by the time they do, the WDK will be out however, so no worries).
+	It would reduce all the ifdeffing to a single file.
+	
+	UPDATE2:
+	No. This is a bad idea. I've just added a note to purge out large parts of umtypes.h into the
+	actual xxtypes.h files, and then use iffdefing. This is a direct contradiction to my idea of
+	generalizing all the IFS stuff together.
+	
+	UPDATE3:
+	No. This is different...the user-mode types will always be unavailable in kernel-mode, and 
+	dissipating them into the real files is a good thing, because they will never move out and
+	they are much easier to maintain. However, once the WDK comes out, all #ifdef ntifs will
+	become obsolete, and they will have to be hunted down and removed. Having a single file that
+	is automatically added if the IFS is not detected is much easier to remove once the time
+	comes.

Modified: trunk/reactos/include/ndk/lpctypes.h
--- trunk/reactos/include/ndk/lpctypes.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/include/ndk/lpctypes.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -9,18 +9,10 @@
 #ifndef _LPCTYPES_H
 #define _LPCTYPES_H
 
-#define LPC_MESSAGE_TYPE(m) ((m).Header.u2.s2.Type)
-
 /* DEPENDENCIES **************************************************************/
 
 /* EXPORTED DATA *************************************************************/
 
-/* CONSTANTS *****************************************************************/
-#define LPC_MESSAGE_BASE_SIZE 24
-#define MAX_MESSAGE_DATA      (0x130)
-#define LPC_MAX_DATA_LENGTH 0x104
-#define LPC_MAX_MESSAGE_LENGTH 0x148
-
 /* ENUMERATIONS **************************************************************/
 
 typedef enum _LPC_TYPE
@@ -42,6 +34,13 @@
 
 /* TYPES *********************************************************************/
 
+/* 
+ * 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_))
+
 #if defined(USE_LPC6432)
 #define LPC_CLIENT_ID CLIENT_ID64
 #define LPC_SIZE_T ULONGLONG
@@ -104,11 +103,98 @@
     LPC_PVOID ViewBase;
 } REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW;
 
-/* FIXME: USE REAL DEFINITION */
-typedef struct _LPC_MAX_MESSAGE
+typedef struct _LPCP_MESSAGE
 {
-    PORT_MESSAGE Header;
-    BYTE Data[MAX_MESSAGE_DATA];
-} LPC_MAX_MESSAGE, *PLPC_MAX_MESSAGE;
+    UCHAR Data[0x14];
+    PORT_MESSAGE Request;
+} LPCP_MESSAGE;
 
+typedef struct _LPCP_CONNECTION_MESSAGE
+{
+    UCHAR Data[0x2C];
+} LPCP_CONNECTION_MESSAGE;
+
+/* Kernel-Mode Structures */
+#else
+
+typedef struct _LPCP_NONPAGED_PORT_QUEUE
+{
+    KSEMAPHORE Semaphore;
+    struct _LPCP_PORT_OBJECT *BackPointer;
+} LPCP_NONPAGED_PORT_QUEUE, *PLPCP_NONPAGED_PORT_QUEUE;
+
+typedef struct _LPCP_PORT_QUEUE
+{
+    PLPCP_NONPAGED_PORT_QUEUE NonPagedPortQueue;
+    KSEMAPHORE Semaphore;
+    LIST_ENTRY ReceiveHead;
+} LPCP_PORT_QUEUE, *PLPCP_PORT_QUEUE;
+
+#ifdef _NTIFS_
+typedef struct _LPCP_PORT_OBJECT
+{
+    ULONG Length;
+    ULONG Flags;
+    struct _LPCP_PORT_OBJECT *ConnectionPort;
+    struct _LPCP_PORT_OBJECT *ConnectedPort;
+    LPCP_PORT_QUEUE MsgQueue;
+    CLIENT_ID Creator;
+    PVOID ClientSectionBase;
+    PVOID ServerSectionBase;
+    PVOID PortContext;
+    ULONG MaxMessageLength;
+    ULONG MaxConnectionInfoLength;
+    PETHREAD ClientThread;
+    SECURITY_QUALITY_OF_SERVICE SecurityQos;
+    SECURITY_CLIENT_CONTEXT StaticSecurity;
+    LIST_ENTRY LpcReplyChainHead;
+    LIST_ENTRY LpcDataInfoChainHead;
+} LPCP_PORT_OBJECT, *PLPCP_PORT_OBJECT;
+
+typedef struct _LPCP_MESSAGE
+{
+    union
+    {
+        LIST_ENTRY Entry;
+        struct
+        {
+            SINGLE_LIST_ENTRY FreeEntry;
+            ULONG Reserved0;
+        };
+    };
+    PLPCP_PORT_OBJECT SenderPort;
+    PETHREAD RepliedToThread;
+    PVOID PortContext;
+    PORT_MESSAGE Request;
+} LPCP_MESSAGE, *PLPCP_MESSAGE;
+
+typedef struct _LPCP_CONNECTION_MESSAGE
+{
+    PORT_VIEW ClientView;
+    PLPCP_PORT_OBJECT ClientPort;
+    PVOID SectionToMap;
+    REMOTE_PORT_VIEW ServerView;
+} LPCP_CONNECTION_MESSAGE, *PLPCP_CONNECTION_MESSAGE;
 #endif
+
+#endif
+
+/* CONSTANTS *****************************************************************/
+
+#define PORT_MAXIMUM_MESSAGE_LENGTH 256
+
+#define LPCP_MAX_MESSAGE_SIZE \
+    ROUND_UP(PORT_MAXIMUM_MESSAGE_LENGTH + \
+    sizeof(LPCP_MESSAGE) + \
+    sizeof(LPCP_CONNECTION_MESSAGE), 16)
+
+#define LPC_MAX_MESSAGE_LENGTH \
+    (LPCP_MAX_MESSAGE_SIZE - \
+    FIELD_OFFSET(LPCP_MESSAGE, Request))
+
+#define LPC_MAX_DATA_LENGTH \
+    (LPC_MAX_MESSAGE_LENGTH - \
+    sizeof(PORT_MESSAGE) - \
+    sizeof(LPCP_CONNECTION_MESSAGE))
+
+#endif

Modified: trunk/reactos/include/ndk/ntndk.h
--- trunk/reactos/include/ndk/ntndk.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/include/ndk/ntndk.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -13,6 +13,9 @@
 #include <stdarg.h>
 #include <excpt.h>
 
+/* Helper Header */
+#include <helper.h>
+
 /* Kernel-Mode NDK */
 #ifndef NTOS_MODE_USER
     #include "kdtypes.h"    /* Kernel Debugger Types */
@@ -27,7 +30,6 @@
     #include "iofuncs.h"    /* Input/Output Manager Functions */
     #include "ketypes.h"    /* Kernel Types */
     #include "kefuncs.h"    /* Kernel Functions */
-    #include "lpctypes.h"   /* Local Procedure Call Types */
     #include "mmtypes.h"    /* Memory Manager Types */
     #include "mmfuncs.h"    /* Memory Manager Functions */
     #include "obtypes.h"    /* Object Manager Types */
@@ -45,6 +47,7 @@
 /* Shared NDK */
 #include "ldrfuncs.h"       /* Loader Functions */
 #include "ldrtypes.h"       /* Loader Types */
+#include "lpctypes.h"       /* Local Procedure Call Types */
 #include "pstypes.h"        /* Process Manager Types */
 #include "rtltypes.h"       /* Runtime Library Types */
 #include "rtlfuncs.h"       /* Runtime Library Functions */

Modified: trunk/reactos/include/reactos/helper.h
--- trunk/reactos/include/reactos/helper.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/include/reactos/helper.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -1,6 +1,7 @@
 #ifndef _HELPER_H
 #define _HELPER_H
- 
+
+/* FIXME: clean this mess up and move to NDK */
 #define ROUNDUP(a,b)	((((a)+(b)-1)/(b))*(b))
 #define ROUNDDOWN(a,b)	(((a)/(b))*(b))
 #define ROUND_UP ROUNDUP

Modified: trunk/reactos/include/subsys/csrss/csrss.h
--- trunk/reactos/include/subsys/csrss/csrss.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/include/subsys/csrss/csrss.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -411,19 +411,19 @@
 } CSRSS_GET_INPUT_WAIT_HANDLE, *PCSRSS_GET_INPUT_WAIT_HANDLE;
 
 #define CSRSS_MAX_WRITE_CONSOLE       \
-      (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE))
+      (LPC_MAX_DATA_LENGTH - sizeof(ULONG) - sizeof(CSRSS_WRITE_CONSOLE))
 
-#define CSRSS_MAX_SET_TITLE           (MAX_MESSAGE_DATA - sizeof( HANDLE ) - sizeof( DWORD ) - sizeof( ULONG ) - LPC_MESSAGE_BASE_SIZE)
+#define CSRSS_MAX_SET_TITLE           (LPC_MAX_DATA_LENGTH - sizeof( HANDLE ) - sizeof( DWORD ) - sizeof( ULONG ) - sizeof(PORT_MESSAGE))
 
-#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR   (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_CHAR ))
+#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_CHAR   (LPC_MAX_DATA_LENGTH - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_CHAR ))
 
-#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB   ((MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB )) / 2)
+#define CSRSS_MAX_WRITE_CONSOLE_OUTPUT_ATTRIB   ((LPC_MAX_DATA_LENGTH - sizeof( ULONG ) - sizeof( CSRSS_WRITE_CONSOLE_OUTPUT_ATTRIB )) / 2)
 
-#define CSRSS_MAX_READ_CONSOLE        (MAX_MESSAGE_DATA - sizeof( ULONG ) - sizeof( CSRSS_READ_CONSOLE ))
+#define CSRSS_MAX_READ_CONSOLE        (LPC_MAX_DATA_LENGTH - sizeof( ULONG ) - sizeof( CSRSS_READ_CONSOLE ))
 
-#define CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR    (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_CHAR))
+#define CSRSS_MAX_READ_CONSOLE_OUTPUT_CHAR    (LPC_MAX_DATA_LENGTH - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_CHAR))
 
-#define CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB  (MAX_MESSAGE_DATA - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB))
+#define CSRSS_MAX_READ_CONSOLE_OUTPUT_ATTRIB  (LPC_MAX_DATA_LENGTH - sizeof(ULONG) - sizeof(HANDLE) - sizeof(DWORD) - sizeof(CSRSS_READ_CONSOLE_OUTPUT_ATTRIB))
 
 /* WCHARs, not bytes! */
 #define CSRSS_MAX_TITLE_LENGTH          80
@@ -485,7 +485,7 @@
 #define GET_PROCESS_LIST              (0x36)
 
 /* Keep in sync with definition below. */
-#define CSRSS_HEADER_SIZE (LPC_MESSAGE_BASE_SIZE + sizeof(ULONG) + sizeof(NTSTATUS))
+#define CSRSS_HEADER_SIZE (sizeof(PORT_MESSAGE) + sizeof(ULONG) + sizeof(NTSTATUS))
 
 typedef struct _CSR_API_MESSAGE
 {
@@ -494,7 +494,7 @@
     PORT_MESSAGE Header;
     struct
     {
-      BYTE HeaderReserved[LPC_MESSAGE_BASE_SIZE];
+      BYTE HeaderReserved[sizeof(PORT_MESSAGE)];
       ULONG Type;
       NTSTATUS Status;
       union

Modified: trunk/reactos/include/subsys/lsass/lsass.h
--- trunk/reactos/include/subsys/lsass/lsass.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/include/subsys/lsass/lsass.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -98,7 +98,7 @@
 {
    PORT_MESSAGE Header;
    struct {
-      UCHAR LpcHeader[LPC_MESSAGE_BASE_SIZE];
+      UCHAR LpcHeader[sizeof(PORT_MESSAGE)];
       ULONG Type;
       union
         {

Modified: trunk/reactos/include/subsys/sm/api.h
--- trunk/reactos/include/subsys/sm/api.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/include/subsys/sm/api.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -112,7 +112,7 @@
   /*** LPC common header ***/
   PORT_MESSAGE Header;
   struct {
-    UCHAR LpcHeader[LPC_MESSAGE_BASE_SIZE];
+    UCHAR LpcHeader[sizeof(PORT_MESSAGE)];
     /*** SM common header ***/
     struct {
       DWORD       ApiIndex;

Modified: trunk/reactos/lib/lsasrv/lsaport.c
--- trunk/reactos/lib/lsasrv/lsaport.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/lib/lsasrv/lsaport.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -19,7 +19,7 @@
 {
   OBJECT_ATTRIBUTES ObjectAttributes;
   UNICODE_STRING PortName;
-  LPC_MAX_MESSAGE Request;
+  PORT_MESSAGE Request;
   NTSTATUS Status;
 
   ConnectPortHandle = NULL;
@@ -46,7 +46,7 @@
     }
 
   Status = NtListenPort(ConnectPortHandle,
-			&Request.Header);
+			&Request);
   if (!NT_SUCCESS(Status))
     {
       DPRINT1("NtListenPort() failed (Status %lx)\n", Status);
@@ -89,7 +89,7 @@
 static NTSTATUS
 ProcessPortMessage(VOID)
 {
-  LPC_MAX_MESSAGE Request;
+  PORT_MESSAGE Request;
 //  LPC_MAX_MESSAGE Reply;
   NTSTATUS Status;
 
@@ -103,7 +103,7 @@
       Status = NtReplyWaitReceivePort(MessagePortHandle,
 				      0,
 				      NULL,
-				      &Request.Header);
+				      &Request);
       if (!NT_SUCCESS(Status))
 	{
 	  DPRINT1("NtReplyWaitReceivePort() failed (Status %lx)\n", Status);
@@ -112,18 +112,18 @@
 
       DPRINT("Received message\n");
 
-      if (Request.Header.u2.s2.Type == LPC_PORT_CLOSED)
+      if (Request.u2.s2.Type == LPC_PORT_CLOSED)
 	{
 	  DPRINT("Port closed\n");
 
 //	  return STATUS_UNSUCCESSFUL;
 	}
-      if (Request.Header.u2.s2.Type == LPC_REQUEST)
+      if (Request.u2.s2.Type == LPC_REQUEST)
 	{
 	  DPRINT("Received request\n");
 
 	}
-      else if (Request.Header.u2.s2.Type == LPC_DATAGRAM)
+      else if (Request.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-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/lib/ntdll/csr/lpc.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -81,7 +81,7 @@
 
     /* Fill out the header */
     Request->Type = ApiNumber;
-    Request->Header.u1.s1.DataLength = RequestLength - LPC_MESSAGE_BASE_SIZE;
+    Request->Header.u1.s1.DataLength = RequestLength - sizeof(PORT_MESSAGE);
     Request->Header.u1.s1.TotalLength = RequestLength;
     DPRINT("CSR: API: %x, u1.s1.DataLength: %x, u1.s1.TotalLength: %x\n", 
             ApiNumber,

Modified: trunk/reactos/lib/rtl/thread.c
--- trunk/reactos/lib/rtl/thread.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/lib/rtl/thread.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -192,7 +192,7 @@
     OBJECT_ATTRIBUTES ObjectAttributes;
     CONTEXT Context;
     
-    DPRINT("RtlCreateUserThread: (hProcess: %lx, Suspended: %lx,"
+    DPRINT1("RtlCreateUserThread: (hProcess: %lx, Suspended: %lx,"
             "ZeroBits: %lx, StackReserve: %lx, StackCommit: %lx,"
             "StartAddress: %p, Parameter: %lx)\n", ProcessHandle,
             CreateSuspended, StackZeroBits, StackReserve, StackCommit,

Modified: trunk/reactos/lib/secur32/lsa.c
--- trunk/reactos/lib/secur32/lsa.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/lib/secur32/lsa.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -75,18 +75,18 @@
 {
    PLSASS_REQUEST Request;
    PLSASS_REPLY Reply;
-   UCHAR RawRequest[MAX_MESSAGE_DATA];
-   UCHAR RawReply[MAX_MESSAGE_DATA];
+   LSASS_REQUEST RawRequest;
+   LSASS_REPLY RawReply;
    NTSTATUS Status;
    ULONG OutBufferSize;
 
-   Request = (PLSASS_REQUEST)RawRequest;
-   Reply = (PLSASS_REPLY)RawReply;
+   Request = (PLSASS_REQUEST)&RawRequest;
+   Reply = (PLSASS_REPLY)&RawReply;
    
    Request->Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) + SubmitBufferLength -
-     LPC_MESSAGE_BASE_SIZE;
+     sizeof(PORT_MESSAGE);
    Request->Header.u1.s1.TotalLength = 
-     Request->Header.u1.s1.DataLength + LPC_MESSAGE_BASE_SIZE;
+     Request->Header.u1.s1.DataLength + sizeof(PORT_MESSAGE);
    Request->Type = LSASS_REQUEST_CALL_AUTHENTICATION_PACKAGE;
    Request->d.CallAuthenticationPackageRequest.AuthenticationPackage =
      AuthenticationPackage;
@@ -142,14 +142,14 @@
 {
    NTSTATUS Status;
    PLSASS_REQUEST Request;
-   UCHAR RawRequest[MAX_MESSAGE_DATA];
+   LSASS_REQUEST RawRequest;
    LSASS_REPLY Reply;
    
-   Request = (PLSASS_REQUEST)RawRequest;
+   Request = (PLSASS_REQUEST)&RawRequest;
    Request->Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) + PackageName->Length -
-     LPC_MESSAGE_BASE_SIZE;
+     sizeof(PORT_MESSAGE);
    Request->Header.u1.s1.TotalLength = Request->Header.u1.s1.DataLength +
-     LPC_MESSAGE_BASE_SIZE;
+     sizeof(PORT_MESSAGE);
    Request->Type = LSASS_REQUEST_LOOKUP_AUTHENTICATION_PACKAGE;
    
    Status = NtRequestWaitReplyPort(LsaHandle,
@@ -192,23 +192,23 @@
    ULONG RequestLength;
    ULONG CurrentLength;
    PLSASS_REQUEST Request;
-   UCHAR RawMessage[MAX_MESSAGE_DATA];
+   LSASS_REQUEST RawMessage;
    PLSASS_REPLY Reply;
-   UCHAR RawReply[MAX_MESSAGE_DATA];
+   LSASS_REPLY RawReply;
    NTSTATUS Status;
    
-   RequestLength = sizeof(LSASS_REQUEST) - LPC_MESSAGE_BASE_SIZE;
+   RequestLength = sizeof(LSASS_REQUEST) - sizeof(PORT_MESSAGE);
    RequestLength = RequestLength + (OriginName->Length * sizeof(WCHAR));
    RequestLength = RequestLength + AuthenticationInformationLength;
    RequestLength = RequestLength + 
      (LocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES));
    
    CurrentLength = 0;
-   Request = (PLSASS_REQUEST)RawMessage;
+   Request = (PLSASS_REQUEST)&RawMessage;
    
    Request->d.LogonUserRequest.OriginNameLength = OriginName->Length;
-   Request->d.LogonUserRequest.OriginName = (PWSTR)&RawMessage[CurrentLength];
-   memcpy((PWSTR)&RawMessage[CurrentLength],
+   Request->d.LogonUserRequest.OriginName = (PWSTR)&RawMessage + CurrentLength;
+   memcpy((PWSTR)&RawMessage + CurrentLength,
 	  OriginName->Buffer,
 	  OriginName->Length * sizeof(WCHAR));
    CurrentLength = CurrentLength + (OriginName->Length * sizeof(WCHAR));
@@ -219,28 +219,28 @@
      AuthenticationPackage;
    
    Request->d.LogonUserRequest.AuthenticationInformation = 
-     (PVOID)&RawMessage[CurrentLength];
+     (PVOID)((ULONG_PTR)&RawMessage + CurrentLength);
    Request->d.LogonUserRequest.AuthenticationInformationLength =
      AuthenticationInformationLength;
-   memcpy((PVOID)&RawMessage[CurrentLength],
+   memcpy((PVOID)((ULONG_PTR)&RawMessage + CurrentLength),
 	  AuthenticationInformation,
 	  AuthenticationInformationLength);
    CurrentLength = CurrentLength + AuthenticationInformationLength;
    
    Request->d.LogonUserRequest.LocalGroupsCount = LocalGroups->GroupCount;
    Request->d.LogonUserRequest.LocalGroups = 
-     (PSID_AND_ATTRIBUTES)&RawMessage[CurrentLength];
-   memcpy((PSID_AND_ATTRIBUTES)&RawMessage[CurrentLength],
+     (PSID_AND_ATTRIBUTES)&RawMessage + CurrentLength;
+   memcpy((PSID_AND_ATTRIBUTES)&RawMessage + CurrentLength,
 	  LocalGroups->Groups,
 	  LocalGroups->GroupCount * sizeof(SID_AND_ATTRIBUTES));
    
    Request->d.LogonUserRequest.SourceContext = *SourceContext;
    
    Request->Type = LSASS_REQUEST_LOGON_USER;
-   Request->Header.u1.s1.DataLength = RequestLength - LPC_MESSAGE_BASE_SIZE;
-   Request->Header.u1.s1.TotalLength = RequestLength + LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.DataLength = RequestLength - sizeof(PORT_MESSAGE);
+   Request->Header.u1.s1.TotalLength = RequestLength + sizeof(PORT_MESSAGE);
    
-   Reply = (PLSASS_REPLY)RawReply;
+   Reply = (PLSASS_REPLY)&RawReply;
    
    Status = NtRequestWaitReplyPort(LsaHandle,
 				   &Request->Header,
@@ -304,7 +304,7 @@
    
    Request.Type = LSASS_REQUEST_REGISTER_LOGON_PROCESS;
    Request.Header.u1.s1.DataLength = sizeof(LSASS_REQUEST) - 
-     LPC_MESSAGE_BASE_SIZE;
+     sizeof(PORT_MESSAGE);
    Request.Header.u1.s1.TotalLength = sizeof(LSASS_REQUEST);
    
    Request.d.RegisterLogonProcessRequest.Length = LsaLogonProcessName->Length;

Modified: trunk/reactos/ntoskrnl/include/internal/port.h
--- trunk/reactos/ntoskrnl/include/internal/port.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/ntoskrnl/include/internal/port.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -88,7 +88,6 @@
   PEPORT		Sender;
   LIST_ENTRY	QueueListEntry;
   PORT_MESSAGE	Message;
-  UCHAR		MessageData [MAX_MESSAGE_DATA];
 } QUEUEDMESSAGE,  *PQUEUEDMESSAGE;
 
 typedef struct _LPC_DBG_MESSAGE

Modified: trunk/reactos/ntoskrnl/io/error.c
--- trunk/reactos/ntoskrnl/io/error.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/ntoskrnl/io/error.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -159,7 +159,7 @@
 IopLogWorker (PVOID Parameter)
 {
   PERROR_LOG_ENTRY LogEntry;
-  PLPC_MAX_MESSAGE Request;
+  PPORT_MESSAGE Request;
   PIO_ERROR_LOG_MESSAGE Message;
   PIO_ERROR_LOG_PACKET Packet;
   KIRQL Irql;
@@ -249,7 +249,7 @@
 
       /* Allocate request buffer */
       Request = ExAllocatePool (NonPagedPool,
-				sizeof(LPC_MAX_MESSAGE));
+				sizeof(PORT_MESSAGE) + PORT_MAXIMUM_MESSAGE_LENGTH);
       if (Request == NULL)
 	{
 	  DPRINT ("Failed to allocate request buffer!\n");
@@ -264,7 +264,7 @@
 	}
 
       /* Initialize the log message */
-      Message = (PIO_ERROR_LOG_MESSAGE)Request->Data;
+      Message = (PIO_ERROR_LOG_MESSAGE)(Request + 1);
       Message->Type = IO_TYPE_ERROR_MESSAGE;
       Message->Size =
 	sizeof(IO_ERROR_LOG_MESSAGE) - sizeof(IO_ERROR_LOG_PACKET) +
@@ -285,13 +285,13 @@
 
       DPRINT ("SequenceNumber %lx\n", Packet->SequenceNumber);
 
-      Request->Header.u1.s1.DataLength = Message->Size;
-      Request->Header.u1.s1.TotalLength =
-	Request->Header.u1.s1.DataLength + sizeof(PPORT_MESSAGE);
+      Request->u1.s1.DataLength = Message->Size;
+      Request->u1.s1.TotalLength =
+	Request->u1.s1.DataLength + sizeof(PPORT_MESSAGE);
 
       /* Send the error message to the log port */
       Status = ZwRequestPort (IopLogPort,
-			      &Request->Header);
+			      Request);
 
       /* Release request buffer */
       ExFreePool (Request);

Modified: trunk/reactos/ntoskrnl/lpc/send.c
--- trunk/reactos/ntoskrnl/lpc/send.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/ntoskrnl/lpc/send.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -292,7 +292,7 @@
        KeDetachProcess();
      }
 
-   if (LpcRequestMessageSize > (sizeof(PORT_MESSAGE) + MAX_MESSAGE_DATA))
+   if (LpcRequestMessageSize > LPC_MAX_MESSAGE_LENGTH)
      {
        if (NULL != AttachedProcess)
          {
@@ -347,7 +347,7 @@
        LpcRequestDataSize = LpcRequest->u1.s1.DataLength;
      }
 
-   if (LpcRequestMessageSize > (sizeof(PORT_MESSAGE) + MAX_MESSAGE_DATA))
+   if (LpcRequestMessageSize > LPC_MAX_MESSAGE_LENGTH)
      {
        ExFreePool(LpcRequest);
        if (NULL != AttachedProcess)

Modified: trunk/reactos/services/eventlog/eventlog.h
--- trunk/reactos/services/eventlog/eventlog.h	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/services/eventlog/eventlog.h	2005-08-16 23:05:33 UTC (rev 17417)
@@ -2,6 +2,11 @@
 #ifndef __EVENTLOG_H__
 #define __EVENTLOG_H__
 
+typedef struct _IO_ERROR_LPC
+{
+    PORT_MESSAGE Header;
+    IO_ERROR_LOG_MESSAGE Message;
+} IO_ERROR_LPC, *PIO_ERROR_LPC;
 
 BOOL
 StartPortThread(VOID);

Modified: trunk/reactos/services/eventlog/logport.c
--- trunk/reactos/services/eventlog/logport.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/services/eventlog/logport.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -50,7 +50,7 @@
 {
   OBJECT_ATTRIBUTES ObjectAttributes;
   UNICODE_STRING PortName;
-  LPC_MAX_MESSAGE Request;
+  PORT_MESSAGE Request;
   NTSTATUS Status;
 
   ConnectPortHandle = NULL;
@@ -76,7 +76,7 @@
     }
 
   Status = NtListenPort(ConnectPortHandle,
-			&Request.Header);
+			&Request);
   if (!NT_SUCCESS(Status))
     {
       DPRINT1("NtListenPort() failed (Status %lx)\n", Status);
@@ -115,11 +115,10 @@
   return Status;
 }
 
-
 static NTSTATUS
 ProcessPortMessage(VOID)
 {
-  LPC_MAX_MESSAGE Request;
+  IO_ERROR_LPC Request;
   PIO_ERROR_LOG_MESSAGE Message;
 //#ifndef NDEBUG
   ULONG i;
@@ -162,7 +161,7 @@
 	  DPRINT("Received datagram\n");
 
 
-	  Message = (PIO_ERROR_LOG_MESSAGE)&Request.Data;
+	  Message = (PIO_ERROR_LOG_MESSAGE)&Request.Message;
 
 	  DPRINT("Message->Type %hx\n", Message->Type);
 	  DPRINT("Message->Size %hu\n", Message->Size);

Modified: trunk/reactos/subsys/csrss/api/process.c
--- trunk/reactos/subsys/csrss/api/process.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/subsys/csrss/api/process.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -194,7 +194,7 @@
    PCSRSS_PROCESS_DATA NewProcessData;
    NTSTATUS Status;
 
-   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
    Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
 
    NewProcessData = CsrCreateProcessData(Request->Data.CreateProcessRequest.NewProcessId);
@@ -224,7 +224,7 @@
 
 CSR_API(CsrTerminateProcess)
 {
-   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
    Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE);
 
    if (ProcessData == NULL)
@@ -239,7 +239,7 @@
 CSR_API(CsrConnectProcess)
 {
    Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
    Request->Status = STATUS_SUCCESS;
 
@@ -249,7 +249,7 @@
 CSR_API(CsrGetShutdownParameters)
 {
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
   if (ProcessData == NULL)
   {
@@ -267,7 +267,7 @@
 CSR_API(CsrSetShutdownParameters)
 {
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
   if (ProcessData == NULL)
   {
@@ -285,7 +285,7 @@
 CSR_API(CsrGetInputHandle)
 {
    Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
    if (ProcessData == NULL)
    {
@@ -310,7 +310,7 @@
 CSR_API(CsrGetOutputHandle)
 {
    Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
    if (ProcessData == NULL)
    {
@@ -337,7 +337,7 @@
 CSR_API(CsrCloseHandle)
 {
    Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
    if (ProcessData == NULL)
    {
@@ -353,7 +353,7 @@
 CSR_API(CsrVerifyHandle)
 {
    Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+   Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
    Request->Status = CsrVerifyObject(ProcessData, Request->Data.VerifyHandleRequest.Handle);
    if (!NT_SUCCESS(Request->Status))
@@ -369,7 +369,7 @@
   Object_t *Object;
 
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
   ProcessData = CsrGetProcessData(Request->Data.DuplicateHandleRequest.ProcessId);
   Request->Status = CsrGetObject(ProcessData, Request->Data.DuplicateHandleRequest.Handle, &Object);
@@ -389,7 +389,7 @@
 CSR_API(CsrGetInputWaitHandle)
 {
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
   if (ProcessData == NULL)
   {

Modified: trunk/reactos/subsys/csrss/api/user.c
--- trunk/reactos/subsys/csrss/api/user.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/subsys/csrss/api/user.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -27,7 +27,7 @@
   NTSTATUS Status;
 
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
   if (ServicesProcessIdValid == TRUE)
     {

Modified: trunk/reactos/subsys/csrss/api/wapi.c
--- trunk/reactos/subsys/csrss/api/wapi.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/subsys/csrss/api/wapi.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -97,7 +97,7 @@
     {
       DPRINT1("CSR: Unknown request type 0x%x\n", Request->Type);
       Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-      Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+      Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
       Request->Status = STATUS_INVALID_SYSTEM_SERVICE;
     }
 }
@@ -108,8 +108,7 @@
 ClientConnectionThread(HANDLE ServerPort)
 {
     NTSTATUS Status;
-    LPC_MAX_MESSAGE LpcRequest;
-    PCSR_API_MESSAGE Request;
+    CSR_API_MESSAGE Request;
     PCSR_API_MESSAGE Reply;
     PCSRSS_PROCESS_DATA ProcessData;
   
@@ -125,7 +124,7 @@
         Status = NtReplyWaitReceivePort(ServerPort,
                                         0,
                                         &Reply->Header,
-                                        &LpcRequest.Header);
+                                        &Request.Header);
         if (!NT_SUCCESS(Status))
         {
             DPRINT1("CSR: NtReplyWaitReceivePort failed\n");
@@ -133,34 +132,31 @@
         }
         
         /* If the connection was closed, handle that */
-        if (LpcRequest.Header.u2.s2.Type == LPC_PORT_CLOSED)
+        if (Request.Header.u2.s2.Type == LPC_PORT_CLOSED)
         {
-            CsrFreeProcessData( LpcRequest.Header.ClientId.UniqueProcess );
+            CsrFreeProcessData( Request.Header.ClientId.UniqueProcess );
             break;
         }
-        
-        /* Get the CSR Message */
-        Request = (PCSR_API_MESSAGE)&LpcRequest;
-      
+
         DPRINT("CSR: Got CSR API: %x [Message Origin: %x]\n", 
-                Request->Type, 
-                Request->Header.ClientId.UniqueProcess);
+                Request.Type, 
+                Request.Header.ClientId.UniqueProcess);
 
         /* Get the Process Data */
-        ProcessData = CsrGetProcessData(LpcRequest.Header.ClientId.UniqueProcess);
+        ProcessData = CsrGetProcessData(Request.Header.ClientId.UniqueProcess);
         if (ProcessData == NULL)
         {
             DPRINT1("CSR: Message %d: Unable to find data for process 0x%x\n",
-                    LpcRequest.Header.u2.s2.Type,
-                    LpcRequest.Header.ClientId.UniqueProcess);
+                    Request.Header.u2.s2.Type,
+                    Request.Header.ClientId.UniqueProcess);
             break;
         }
 
         /* Call the Handler */
-        CsrApiCallHandler(ProcessData, Request);
+        CsrApiCallHandler(ProcessData, &Request);
         
         /* Send back the reply */
-        Reply = Request;
+        Reply = &Request;
     }
     
     /* Close the port and exit the thread */
@@ -180,7 +176,7 @@
 ServerApiPortThread (PVOID PortHandle)
 {
    NTSTATUS Status = STATUS_SUCCESS;
-   LPC_MAX_MESSAGE Request;
+   PORT_MESSAGE Request;
    HANDLE hApiListenPort = * (PHANDLE) PortHandle;
    HANDLE ServerPort = (HANDLE) 0;
    HANDLE ServerThread = (HANDLE) 0;
@@ -195,7 +191,7 @@
         REMOTE_PORT_VIEW LpcRead;
         ServerPort = NULL;
 
-	Status = NtListenPort (hApiListenPort, & Request.Header);
+	Status = NtListenPort (hApiListenPort, &Request);
 	if (!NT_SUCCESS(Status))
 	  {
 	     DPRINT1("CSR: NtListenPort() failed\n");
@@ -213,11 +209,11 @@
 	     break;
 	  }
 
-	ProcessData = CsrCreateProcessData(Request.Header.ClientId.UniqueProcess);
+	ProcessData = CsrCreateProcessData(Request.ClientId.UniqueProcess);
 	if (ProcessData == NULL)
 	  {
 	     DPRINT1("Unable to allocate or find data for process 0x%x\n",
-	             Request.Header.ClientId.UniqueProcess);
+	             Request.ClientId.UniqueProcess);
 	     Status = STATUS_UNSUCCESSFUL;
 	     break;
 	  }
@@ -273,14 +269,14 @@
 {
 	HANDLE          hSbApiPortListen = * (PHANDLE) PortHandle;
 	HANDLE          hConnectedPort = (HANDLE) 0;
-	LPC_MAX_MESSAGE Request;
+	PORT_MESSAGE    Request;
 	PVOID           Context = NULL;
 	NTSTATUS        Status = STATUS_SUCCESS;
 
 	DPRINT("CSR: %s called\n", __FUNCTION__);
 
-    RtlZeroMemory(&Request, sizeof(LPC_MAX_MESSAGE));
-	Status = NtListenPort (hSbApiPortListen, & Request.Header);
+    RtlZeroMemory(&Request, sizeof(PORT_MESSAGE));
+	Status = NtListenPort (hSbApiPortListen, & Request);
 	if (!NT_SUCCESS(Status))
 	{
 		DPRINT1("CSR: %s: NtListenPort(SB) failed (Status=0x%08lx)\n",
@@ -324,19 +320,19 @@
 					Status = NtReplyWaitReceivePort(hConnectedPort,
                                       					Context,
 									Reply,
-									& Request.Header);
+									& Request);
 					if(!NT_SUCCESS(Status))
 					{
 						DPRINT1("CSR: %s: NtReplyWaitReceivePort failed (Status=0x%08lx)\n",
 							__FUNCTION__, Status);
 						break;
 					}
-					switch (Request.Header.u2.s2.Type)//fix .h PORT_MESSAGE_TYPE(Request))
+					switch (Request.u2.s2.Type)//fix .h PORT_MESSAGE_TYPE(Request))
 					{
 						/* TODO */
 					default:
 						DPRINT1("CSR: %s received message (type=%d)\n",
-							__FUNCTION__, Request.Header.u2.s2.Type);
+							__FUNCTION__, Request.u2.s2.Type);
 					}
 DPRINT("-- 5\n");
 				}

Modified: trunk/reactos/subsys/csrss/win32csr/conio.c
--- trunk/reactos/subsys/csrss/win32csr/conio.c	2005-08-16 22:16:09 UTC (rev 17416)
+++ trunk/reactos/subsys/csrss/win32csr/conio.c	2005-08-16 23:05:33 UTC (rev 17417)
@@ -228,7 +228,7 @@
     DPRINT("CsrAllocConsole\n");
 
     Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-    Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+    Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
     if (ProcessData == NULL)
     {
@@ -357,7 +357,7 @@
   DPRINT("CsrFreeConsole\n");
 
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
   if (ProcessData == NULL || ProcessData->Console == NULL)
     {
@@ -562,7 +562,7 @@
   /* truncate length to CSRSS_MAX_READ_CONSOLE_REQUEST */
   nNumberOfCharsToRead = min(Request->Data.ReadConsoleRequest.NrCharactersToRead, CSRSS_MAX_READ_CONSOLE / CharSize);
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = Request->Header.u1.s1.TotalLength - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = Request->Header.u1.s1.TotalLength - sizeof(PORT_MESSAGE);
 
   Buffer = Request->Data.ReadConsoleRequest.Buffer;
   UnicodeBuffer = (PWCHAR)Buffer;
@@ -927,13 +927,13 @@
     {
       DPRINT1("Invalid request size\n");
       Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-      Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+      Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
       return Request->Status = STATUS_INVALID_PARAMETER;
     }
   Status = ConioConsoleFromProcessData(ProcessData, &Console);
   
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
   
   if (! NT_SUCCESS(Status))
     {
@@ -1431,7 +1431,7 @@
   DPRINT("CsrGetScreenBufferInfo\n");
 
   Request->Header.u1.s1.TotalLength = sizeof(CSR_API_MESSAGE);
-  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - LPC_MESSAGE_BASE_SIZE;
+  Request->Header.u1.s1.DataLength = sizeof(CSR_API_MESSAGE) - sizeof(PORT_MESSAGE);
 
   Status = ConioLockScreenBuffer(ProcessData, Request->Data.ScreenBufferInfoRequest.ConsoleHandle, &Buff);
   if (! NT_SUCCESS(Status))
@@ -1474,7 +1474,7 @@
[truncated at 1000 lines; 558 more skipped]