From 9f1cf7b990932303a3b9cb540486c0db5d26b1ac Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Tue, 16 Aug 2005 23:05:33 +0000 Subject: [PATCH] Remove all non-official LPC structures/defines/hardcoded hacks, and use actual correct sizes and structures. svn path=/trunk/; revision=17417 --- .../boot/freeldr/freeldr/include/freeldr.h | 2 - reactos/include/ndk/fixmes.txt | 39 +++++- reactos/include/ndk/lpctypes.h | 112 ++++++++++++++++-- reactos/include/ndk/ntndk.h | 5 +- reactos/include/reactos/helper.h | 3 +- reactos/include/subsys/csrss/csrss.h | 18 +-- reactos/include/subsys/lsass/lsass.h | 2 +- reactos/include/subsys/sm/api.h | 2 +- reactos/lib/lsasrv/lsaport.c | 14 +-- reactos/lib/ntdll/csr/lpc.c | 2 +- reactos/lib/rtl/thread.c | 2 +- reactos/lib/secur32/lsa.c | 48 ++++---- reactos/ntoskrnl/include/internal/port.h | 1 - reactos/ntoskrnl/io/error.c | 14 +-- reactos/ntoskrnl/lpc/send.c | 4 +- reactos/services/eventlog/eventlog.h | 5 + reactos/services/eventlog/logport.c | 9 +- reactos/subsys/csrss/api/process.c | 22 ++-- reactos/subsys/csrss/api/user.c | 2 +- reactos/subsys/csrss/api/wapi.c | 50 ++++---- reactos/subsys/csrss/win32csr/conio.c | 80 ++++++------- reactos/subsys/csrss/win32csr/desktopbg.c | 6 +- reactos/subsys/csrss/win32csr/exitros.c | 6 +- reactos/subsys/smss/debug.c | 12 +- reactos/subsys/smss/smapi.c | 12 +- reactos/subsys/system/dhcp/dhclient.c | 2 - reactos/subsys/win32k/ntuser/csr.c | 2 +- reactos/w32api/include/ddk/ntifs.h | 62 ++++++++++ reactos/w32api/include/ddk/prntfont.h | 5 - 29 files changed, 361 insertions(+), 182 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/include/freeldr.h b/reactos/boot/freeldr/freeldr/include/freeldr.h index 07040e2a487..8192934a542 100644 --- a/reactos/boot/freeldr/freeldr/include/freeldr.h +++ b/reactos/boot/freeldr/freeldr/include/freeldr.h @@ -35,8 +35,6 @@ #include #include -#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 */ diff --git a/reactos/include/ndk/fixmes.txt b/reactos/include/ndk/fixmes.txt index 7814e746d05..b8714319228 100644 --- a/reactos/include/ndk/fixmes.txt +++ b/reactos/include/ndk/fixmes.txt @@ -33,8 +33,45 @@ List: 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. diff --git a/reactos/include/ndk/lpctypes.h b/reactos/include/ndk/lpctypes.h index 5de4377e882..f0b74cbddea 100644 --- a/reactos/include/ndk/lpctypes.h +++ b/reactos/include/ndk/lpctypes.h @@ -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 @@ typedef enum _LPC_TYPE /* 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 @@ typedef struct _REMOTE_PORT_VIEW 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 diff --git a/reactos/include/ndk/ntndk.h b/reactos/include/ndk/ntndk.h index a1dd9c86bff..fb80f257e6d 100644 --- a/reactos/include/ndk/ntndk.h +++ b/reactos/include/ndk/ntndk.h @@ -13,6 +13,9 @@ #include #include +/* Helper Header */ +#include + /* 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 */ diff --git a/reactos/include/reactos/helper.h b/reactos/include/reactos/helper.h index 93415061792..959c48fc03e 100644 --- a/reactos/include/reactos/helper.h +++ b/reactos/include/reactos/helper.h @@ -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 diff --git a/reactos/include/subsys/csrss/csrss.h b/reactos/include/subsys/csrss/csrss.h index 2d56e188178..e4d40ab133e 100644 --- a/reactos/include/subsys/csrss/csrss.h +++ b/reactos/include/subsys/csrss/csrss.h @@ -411,19 +411,19 @@ typedef struct } 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 @@ typedef struct #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 @@ typedef struct _CSR_API_MESSAGE PORT_MESSAGE Header; struct { - BYTE HeaderReserved[LPC_MESSAGE_BASE_SIZE]; + BYTE HeaderReserved[sizeof(PORT_MESSAGE)]; ULONG Type; NTSTATUS Status; union diff --git a/reactos/include/subsys/lsass/lsass.h b/reactos/include/subsys/lsass/lsass.h index 63e7e68dd29..6cb2829a729 100644 --- a/reactos/include/subsys/lsass/lsass.h +++ b/reactos/include/subsys/lsass/lsass.h @@ -98,7 +98,7 @@ typedef union _LSASS_REQUEST { PORT_MESSAGE Header; struct { - UCHAR LpcHeader[LPC_MESSAGE_BASE_SIZE]; + UCHAR LpcHeader[sizeof(PORT_MESSAGE)]; ULONG Type; union { diff --git a/reactos/include/subsys/sm/api.h b/reactos/include/subsys/sm/api.h index f04f6087e46..78b3f7c4c76 100644 --- a/reactos/include/subsys/sm/api.h +++ b/reactos/include/subsys/sm/api.h @@ -112,7 +112,7 @@ typedef union _SM_PORT_MESSAGE /*** LPC common header ***/ PORT_MESSAGE Header; struct { - UCHAR LpcHeader[LPC_MESSAGE_BASE_SIZE]; + UCHAR LpcHeader[sizeof(PORT_MESSAGE)]; /*** SM common header ***/ struct { DWORD ApiIndex; diff --git a/reactos/lib/lsasrv/lsaport.c b/reactos/lib/lsasrv/lsaport.c index fe9ffe3099b..ced6d219d02 100644 --- a/reactos/lib/lsasrv/lsaport.c +++ b/reactos/lib/lsasrv/lsaport.c @@ -19,7 +19,7 @@ InitializeLsaPort(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING PortName; - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; NTSTATUS Status; ConnectPortHandle = NULL; @@ -46,7 +46,7 @@ InitializeLsaPort(VOID) } Status = NtListenPort(ConnectPortHandle, - &Request.Header); + &Request); if (!NT_SUCCESS(Status)) { DPRINT1("NtListenPort() failed (Status %lx)\n", Status); @@ -89,7 +89,7 @@ ByeBye: static NTSTATUS ProcessPortMessage(VOID) { - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; // LPC_MAX_MESSAGE Reply; NTSTATUS Status; @@ -103,7 +103,7 @@ ProcessPortMessage(VOID) Status = NtReplyWaitReceivePort(MessagePortHandle, 0, NULL, - &Request.Header); + &Request); if (!NT_SUCCESS(Status)) { DPRINT1("NtReplyWaitReceivePort() failed (Status %lx)\n", Status); @@ -112,18 +112,18 @@ ProcessPortMessage(VOID) 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"); diff --git a/reactos/lib/ntdll/csr/lpc.c b/reactos/lib/ntdll/csr/lpc.c index 29937d9ab26..8dd1b4bc3bb 100644 --- a/reactos/lib/ntdll/csr/lpc.c +++ b/reactos/lib/ntdll/csr/lpc.c @@ -81,7 +81,7 @@ CsrClientCallServer(PCSR_API_MESSAGE Request, /* 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, diff --git a/reactos/lib/rtl/thread.c b/reactos/lib/rtl/thread.c index 73892914697..748d7ec75b5 100644 --- a/reactos/lib/rtl/thread.c +++ b/reactos/lib/rtl/thread.c @@ -192,7 +192,7 @@ RtlCreateUserThread(HANDLE ProcessHandle, 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, diff --git a/reactos/lib/secur32/lsa.c b/reactos/lib/secur32/lsa.c index 0a9e92132fb..1a14d04e9c6 100644 --- a/reactos/lib/secur32/lsa.c +++ b/reactos/lib/secur32/lsa.c @@ -75,18 +75,18 @@ LsaCallAuthenticationPackage(HANDLE LsaHandle, { 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 @@ LsaLookupAuthenticationPackage(HANDLE LsaHandle, { 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 @@ LsaLogonUser(HANDLE LsaHandle, 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 @@ LsaLogonUser(HANDLE LsaHandle, 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 @@ LsaRegisterLogonProcess(PLSA_STRING LsaLogonProcessName, 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; diff --git a/reactos/ntoskrnl/include/internal/port.h b/reactos/ntoskrnl/include/internal/port.h index 083f58de98d..a859eff532c 100644 --- a/reactos/ntoskrnl/include/internal/port.h +++ b/reactos/ntoskrnl/include/internal/port.h @@ -88,7 +88,6 @@ typedef struct _QUEUEDMESSAGE PEPORT Sender; LIST_ENTRY QueueListEntry; PORT_MESSAGE Message; - UCHAR MessageData [MAX_MESSAGE_DATA]; } QUEUEDMESSAGE, *PQUEUEDMESSAGE; typedef struct _LPC_DBG_MESSAGE diff --git a/reactos/ntoskrnl/io/error.c b/reactos/ntoskrnl/io/error.c index 64ba0b92591..0fdb013bc13 100644 --- a/reactos/ntoskrnl/io/error.c +++ b/reactos/ntoskrnl/io/error.c @@ -159,7 +159,7 @@ static VOID STDCALL 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 @@ IopLogWorker (PVOID Parameter) /* 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 @@ IopLogWorker (PVOID Parameter) } /* 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 @@ IopLogWorker (PVOID Parameter) 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); diff --git a/reactos/ntoskrnl/lpc/send.c b/reactos/ntoskrnl/lpc/send.c index 1ec7ffda23c..924cc5c5785 100644 --- a/reactos/ntoskrnl/lpc/send.c +++ b/reactos/ntoskrnl/lpc/send.c @@ -292,7 +292,7 @@ NtRequestWaitReplyPort (IN HANDLE PortHandle, KeDetachProcess(); } - if (LpcRequestMessageSize > (sizeof(PORT_MESSAGE) + MAX_MESSAGE_DATA)) + if (LpcRequestMessageSize > LPC_MAX_MESSAGE_LENGTH) { if (NULL != AttachedProcess) { @@ -347,7 +347,7 @@ NtRequestWaitReplyPort (IN HANDLE PortHandle, LpcRequestDataSize = LpcRequest->u1.s1.DataLength; } - if (LpcRequestMessageSize > (sizeof(PORT_MESSAGE) + MAX_MESSAGE_DATA)) + if (LpcRequestMessageSize > LPC_MAX_MESSAGE_LENGTH) { ExFreePool(LpcRequest); if (NULL != AttachedProcess) diff --git a/reactos/services/eventlog/eventlog.h b/reactos/services/eventlog/eventlog.h index 4cf1559ea09..965d90d3f29 100644 --- a/reactos/services/eventlog/eventlog.h +++ b/reactos/services/eventlog/eventlog.h @@ -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); diff --git a/reactos/services/eventlog/logport.c b/reactos/services/eventlog/logport.c index 35c9f699bc8..a136bc6e7fb 100644 --- a/reactos/services/eventlog/logport.c +++ b/reactos/services/eventlog/logport.c @@ -50,7 +50,7 @@ InitLogPort(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING PortName; - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; NTSTATUS Status; ConnectPortHandle = NULL; @@ -76,7 +76,7 @@ InitLogPort(VOID) } Status = NtListenPort(ConnectPortHandle, - &Request.Header); + &Request); if (!NT_SUCCESS(Status)) { DPRINT1("NtListenPort() failed (Status %lx)\n", Status); @@ -115,11 +115,10 @@ ByeBye: 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 @@ ProcessPortMessage(VOID) 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); diff --git a/reactos/subsys/csrss/api/process.c b/reactos/subsys/csrss/api/process.c index 69637ae93b5..858177e55b6 100644 --- a/reactos/subsys/csrss/api/process.c +++ b/reactos/subsys/csrss/api/process.c @@ -194,7 +194,7 @@ CSR_API(CsrCreateProcess) 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(CsrCreateProcess) 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(CsrTerminateProcess) 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(CsrConnectProcess) 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(CsrGetShutdownParameters) 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(CsrSetShutdownParameters) 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(CsrGetInputHandle) 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(CsrGetOutputHandle) 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(CsrCloseHandle) 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 @@ CSR_API(CsrDuplicateHandle) 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(CsrDuplicateHandle) 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) { diff --git a/reactos/subsys/csrss/api/user.c b/reactos/subsys/csrss/api/user.c index 6c55ddf0a43..b46d4d652b6 100644 --- a/reactos/subsys/csrss/api/user.c +++ b/reactos/subsys/csrss/api/user.c @@ -27,7 +27,7 @@ CSR_API(CsrRegisterServicesProcess) 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) { diff --git a/reactos/subsys/csrss/api/wapi.c b/reactos/subsys/csrss/api/wapi.c index 01e4b6655f0..484d1f5bc37 100644 --- a/reactos/subsys/csrss/api/wapi.c +++ b/reactos/subsys/csrss/api/wapi.c @@ -97,7 +97,7 @@ CsrApiCallHandler(PCSRSS_PROCESS_DATA ProcessData, { 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 @@ STDCALL 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 @@ ClientConnectionThread(HANDLE ServerPort) Status = NtReplyWaitReceivePort(ServerPort, 0, &Reply->Header, - &LpcRequest.Header); + &Request.Header); if (!NT_SUCCESS(Status)) { DPRINT1("CSR: NtReplyWaitReceivePort failed\n"); @@ -133,34 +132,31 @@ ClientConnectionThread(HANDLE ServerPort) } /* 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 @@ DWORD STDCALL 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 @@ ServerApiPortThread (PVOID PortHandle) 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 @@ ServerApiPortThread (PVOID PortHandle) 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 @@ ServerSbApiPortThread (PVOID PortHandle) { 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 @@ DPRINT("-- 4\n"); 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"); } diff --git a/reactos/subsys/csrss/win32csr/conio.c b/reactos/subsys/csrss/win32csr/conio.c index 8e1c209b074..8bb9b2ebed1 100644 --- a/reactos/subsys/csrss/win32csr/conio.c +++ b/reactos/subsys/csrss/win32csr/conio.c @@ -228,7 +228,7 @@ CSR_API(CsrAllocConsole) 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 @@ CSR_API(CsrFreeConsole) 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 @@ CSR_API(CsrReadConsole) /* 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 @@ CSR_API(CsrWriteConsole) { 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 @@ CSR_API(CsrGetScreenBufferInfo) 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 @@ CSR_API(CsrSetCursor) } 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.SetCursorRequest.ConsoleHandle, &Buff); if (! NT_SUCCESS(Status)) @@ -1562,13 +1562,13 @@ CSR_API(CsrWriteConsoleOutputChar) { 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)) { if(Request->Data.WriteConsoleOutputCharRequest.Unicode) @@ -1660,7 +1660,7 @@ CSR_API(CsrFillOutputChar) DPRINT("CsrFillOutputChar\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 = ConioConsoleFromProcessData(ProcessData, &Console); if (! NT_SUCCESS(Status)) @@ -1729,7 +1729,7 @@ CSR_API(CsrReadInputEvent) DPRINT("CsrReadInputEvent\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); Request->Data.ReadInputRequest.Event = ProcessData->ConsoleEvent; Status = ConioLockConsole(ProcessData, Request->Data.ReadInputRequest.ConsoleHandle, &Console); @@ -1814,13 +1814,13 @@ CSR_API(CsrWriteConsoleOutputAttrib) { 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)) { return Request->Status = Status; @@ -1897,7 +1897,7 @@ CSR_API(CsrFillOutputAttrib) } 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.FillOutputAttribRequest.ConsoleHandle, &Buff); if (! NT_SUCCESS(Status)) { @@ -1953,7 +1953,7 @@ CSR_API(CsrGetCursorInfo) DPRINT("CsrGetCursorInfo\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.GetCursorInfoRequest.ConsoleHandle, &Buff); if (! NT_SUCCESS(Status)) @@ -1977,7 +1977,7 @@ CSR_API(CsrSetCursorInfo) DPRINT("CsrSetCursorInfo\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 = ConioConsoleFromProcessData(ProcessData, &Console); if (! NT_SUCCESS(Status)) @@ -2085,7 +2085,7 @@ CSR_API(CsrSetConsoleMode) DPRINT("CsrSetConsoleMode\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 = Win32CsrGetObject(ProcessData, Request->Data.SetConsoleModeRequest.ConsoleHandle, (Object_t **) &Console); @@ -2122,7 +2122,7 @@ CSR_API(CsrGetConsoleMode) DPRINT("CsrGetConsoleMode\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 = Win32CsrGetObject(ProcessData, Request->Data.GetConsoleModeRequest.ConsoleHandle, (Object_t **) &Console); if (! NT_SUCCESS(Status)) @@ -2171,7 +2171,7 @@ CSR_API(CsrCreateScreenBuffer) } 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); Buff = HeapAlloc(Win32CsrApiHeap, 0, sizeof(CSRSS_SCREEN_BUFFER)); if (NULL == Buff) @@ -2214,7 +2214,7 @@ CSR_API(CsrSetScreenBuffer) } 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.SetScreenBufferRequest.OutputHandle, &Buff); if (! NT_SUCCESS(Status)) @@ -2261,13 +2261,13 @@ CSR_API(CsrSetTitle) { 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 = ConioLockConsole(ProcessData, Request->Data.SetTitleRequest.Console, &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)) { Request->Status = Status; @@ -2299,7 +2299,7 @@ CSR_API(CsrGetTitle) DPRINT("CsrGetTitle\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 = ConioLockConsole(ProcessData, Request->Data.GetTitleRequest.ConsoleHandle, &Console); @@ -2347,7 +2347,7 @@ CSR_API(CsrWriteConsoleOutput) } 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.WriteConsoleOutputRequest.ConsoleHandle, &Buff); @@ -2440,7 +2440,7 @@ CSR_API(CsrFlushInputBuffer) DPRINT("CsrFlushInputBuffer\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 = ConioLockConsole(ProcessData, Request->Data.FlushInputBufferRequest.ConsoleInput, &Console); @@ -2492,7 +2492,7 @@ CSR_API(CsrScrollConsoleScreenBuffer) } 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, ConsoleHandle, &Buff); if (! NT_SUCCESS(Status)) { @@ -2592,7 +2592,7 @@ CSR_API(CsrReadConsoleOutputChar) DPRINT("CsrReadConsoleOutputChar\n"); 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); ReadBuffer = Request->Data.ReadConsoleOutputCharRequest.String; CharSize = (Request->Data.ReadConsoleOutputCharRequest.Unicode ? sizeof(WCHAR) : sizeof(CHAR)); @@ -2668,7 +2668,7 @@ CSR_API(CsrReadConsoleOutputAttrib) DPRINT("CsrReadConsoleOutputAttrib\n"); 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); ReadBuffer = Request->Data.ReadConsoleOutputAttribRequest.String; Status = ConioLockScreenBuffer(ProcessData, Request->Data.ReadConsoleOutputAttribRequest.ConsoleHandle, &Buff); @@ -2724,7 +2724,7 @@ CSR_API(CsrGetNumberOfConsoleInputEvents) DPRINT("CsrGetNumberOfConsoleInputEvents\n"); 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); Status = ConioLockConsole(ProcessData, Request->Data.GetNumInputEventsRequest.ConsoleHandle, &Console); if (! NT_SUCCESS(Status)) @@ -2769,7 +2769,7 @@ CSR_API(CsrPeekConsoleInput) DPRINT("CsrPeekConsoleInput\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 = ConioLockConsole(ProcessData, Request->Data.GetNumInputEventsRequest.ConsoleHandle, &Console); if(! NT_SUCCESS(Status)) @@ -2847,7 +2847,7 @@ CSR_API(CsrReadConsoleOutput) DPRINT("CsrReadConsoleOutput\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.ReadConsoleOutputRequest.ConsoleHandle, &Buff); if (! NT_SUCCESS(Status)) @@ -2936,7 +2936,7 @@ CSR_API(CsrWriteConsoleInput) DPRINT("CsrWriteConsoleInput\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 = ConioLockConsole(ProcessData, Request->Data.WriteConsoleInputRequest.ConsoleHandle, &Console); if (! NT_SUCCESS(Status)) @@ -3027,7 +3027,7 @@ CSR_API(CsrHardwareStateProperty) DPRINT("CsrHardwareStateProperty\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 = ConioLockConsole(ProcessData, Request->Data.ConsoleHardwareStateRequest.ConsoleHandle, @@ -3067,7 +3067,7 @@ CSR_API(CsrGetConsoleWindow) DPRINT("CsrGetConsoleWindow\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 = ConioConsoleFromProcessData(ProcessData, &Console); if (! NT_SUCCESS(Status)) @@ -3089,7 +3089,7 @@ CSR_API(CsrSetConsoleIcon) DPRINT("CsrSetConsoleIcon\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 = ConioConsoleFromProcessData(ProcessData, &Console); if (! NT_SUCCESS(Status)) @@ -3118,7 +3118,7 @@ CSR_API(CsrGetConsoleCodePage) } 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->Data.GetConsoleCodePage.CodePage = Console->CodePage; ConioUnlockConsole(Console); return Request->Status = STATUS_SUCCESS; @@ -3138,7 +3138,7 @@ CSR_API(CsrSetConsoleCodePage) } 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 (IsValidCodePage(Request->Data.SetConsoleCodePage.CodePage)) { Console->CodePage = Request->Data.SetConsoleCodePage.CodePage; @@ -3163,7 +3163,7 @@ CSR_API(CsrGetConsoleOutputCodePage) } 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->Data.GetConsoleOutputCodePage.CodePage = Console->OutputCodePage; ConioUnlockConsole(Console); return Request->Status = STATUS_SUCCESS; @@ -3183,7 +3183,7 @@ CSR_API(CsrSetConsoleOutputCodePage) } 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 (IsValidCodePage(Request->Data.SetConsoleOutputCodePage.CodePage)) { Console->OutputCodePage = Request->Data.SetConsoleOutputCodePage.CodePage; @@ -3207,7 +3207,7 @@ CSR_API(CsrGetProcessList) Buffer = Request->Data.GetProcessListRequest.ProcessId; 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); nItems = nCopied = 0; Request->Data.GetProcessListRequest.nProcessIdsCopied = 0; diff --git a/reactos/subsys/csrss/win32csr/desktopbg.c b/reactos/subsys/csrss/win32csr/desktopbg.c index 207e9f9d824..79efe582a97 100644 --- a/reactos/subsys/csrss/win32csr/desktopbg.c +++ b/reactos/subsys/csrss/win32csr/desktopbg.c @@ -202,7 +202,7 @@ CSR_API(CsrCreateDesktop) DPRINT("CsrCreateDesktop\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 (! BgInitialized) { @@ -252,7 +252,7 @@ CSR_API(CsrShowDesktop) DPRINT("CsrShowDesktop\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); nmh.hdr.hwndFrom = Request->Data.ShowDesktopRequest.DesktopWindow; nmh.hdr.idFrom = 0; @@ -276,7 +276,7 @@ CSR_API(CsrHideDesktop) DPRINT("CsrHideDesktop\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); nmh.hdr.hwndFrom = Request->Data.ShowDesktopRequest.DesktopWindow; nmh.hdr.idFrom = 0; diff --git a/reactos/subsys/csrss/win32csr/exitros.c b/reactos/subsys/csrss/win32csr/exitros.c index d4b19a919a7..e8e5e80c36c 100644 --- a/reactos/subsys/csrss/win32csr/exitros.c +++ b/reactos/subsys/csrss/win32csr/exitros.c @@ -19,7 +19,7 @@ static HANDLE LogonProcess = NULL; CSR_API(CsrRegisterLogonProcess) { 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 (Request->Data.RegisterLogonProcessRequest.Register) { @@ -52,7 +52,7 @@ CSR_API(CsrSetLogonNotifyWindow) DWORD WindowCreator; 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 (0 == GetWindowThreadProcessId(Request->Data.SetLogonNotifyWindowRequest.LogonNotifyWindow, &WindowCreator)) @@ -78,7 +78,7 @@ CSR_API(CsrSetLogonNotifyWindow) CSR_API(CsrExitReactos) { 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 (NULL == LogonNotifyWindow) { diff --git a/reactos/subsys/smss/debug.c b/reactos/subsys/smss/debug.c index 34ca595967e..62619f3d730 100644 --- a/reactos/subsys/smss/debug.c +++ b/reactos/subsys/smss/debug.c @@ -40,12 +40,12 @@ static VOID STDCALL DbgSsApiPortThread (PVOID dummy) { NTSTATUS Status = STATUS_SUCCESS; - LPC_MAX_MESSAGE Request ; + PORT_MESSAGE Request ; - RtlZeroMemory(&Request, sizeof(LPC_MAX_MESSAGE)); + RtlZeroMemory(&Request, sizeof(PORT_MESSAGE)); while (TRUE) { - Status = NtListenPort (DbgSsApiPort, & Request.Header); + Status = NtListenPort (DbgSsApiPort, & Request); if (!NT_SUCCESS(Status)) { DPRINT1("SM: %s: NtListenPort() failed! (Status==x%08lx)\n", __FUNCTION__, Status); @@ -60,12 +60,12 @@ static VOID STDCALL DbgUiApiPortThread (PVOID dummy) { NTSTATUS Status = STATUS_SUCCESS; - LPC_MAX_MESSAGE Request; + PORT_MESSAGE Request; - RtlZeroMemory(&Request, sizeof(LPC_MAX_MESSAGE)); + RtlZeroMemory(&Request, sizeof(PORT_MESSAGE)); while (TRUE) { - Status = NtListenPort (DbgUiApiPort, & Request.Header); + Status = NtListenPort (DbgUiApiPort, & Request); if (!NT_SUCCESS(Status)) { DPRINT1("SM: %s: NtListenPort() failed! (Status==x%08lx)\n", __FUNCTION__, Status); diff --git a/reactos/subsys/smss/smapi.c b/reactos/subsys/smss/smapi.c index cbd107f0a0a..9f5c0042664 100644 --- a/reactos/subsys/smss/smapi.c +++ b/reactos/subsys/smss/smapi.c @@ -40,8 +40,8 @@ SM_PORT_API SmApi [] = * with a macro) */ PSM_CONNECT_DATA FASTCALL SmpGetConnectData (PSM_PORT_MESSAGE Request) { - PLPC_MAX_MESSAGE LpcMaxMessage = (PLPC_MAX_MESSAGE) Request; - return (PSM_CONNECT_DATA) & LpcMaxMessage->Data[0]; + PPORT_MESSAGE PortMessage = (PPORT_MESSAGE) Request; + return (PSM_CONNECT_DATA)(PortMessage + 1); } #if !defined(__USE_NT_LPC__) @@ -127,7 +127,7 @@ SmpApiConnectedThread(PVOID pConnectedPort) { DPRINT("SM: %s: message received (type=%d)\n", __FUNCTION__, - LPC_MESSAGE_TYPE(Request)); + Request.Header.u2.s2.Type); switch (Request.Header.u2.s2.Type) { @@ -318,10 +318,10 @@ VOID STDCALL SmpApiThread (HANDLE ListeningPort) { NTSTATUS Status = STATUS_SUCCESS; - LPC_MAX_MESSAGE Request; + SM_PORT_MESSAGE Request; DPRINT("SM: %s called\n", __FUNCTION__); - RtlZeroMemory(&Request, sizeof(LPC_MAX_MESSAGE)); + RtlZeroMemory(&Request, sizeof(PORT_MESSAGE)); while (TRUE) { @@ -331,7 +331,7 @@ SmpApiThread (HANDLE ListeningPort) DPRINT1("SM: %s: NtListenPort() failed! (Status==x%08lx)\n", __FUNCTION__, Status); break; } - Status = SmpHandleConnectionRequest ((PSM_PORT_MESSAGE) & Request); + Status = SmpHandleConnectionRequest (& Request); if(!NT_SUCCESS(Status)) { DPRINT1("SM: %s: SmpHandleConnectionRequest failed (Status=0x%08lx)\n", diff --git a/reactos/subsys/system/dhcp/dhclient.c b/reactos/subsys/system/dhcp/dhclient.c index 6417f09f983..0734bf09173 100644 --- a/reactos/subsys/system/dhcp/dhclient.c +++ b/reactos/subsys/system/dhcp/dhclient.c @@ -110,8 +110,6 @@ char *option_as_string(unsigned int code, unsigned char *data, int len); int fork_privchld(int, int); int check_arp( struct interface_info *ip, struct client_lease *lp ); -#define ROUNDUP(a) \ - ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) time_t scripttime; diff --git a/reactos/subsys/win32k/ntuser/csr.c b/reactos/subsys/win32k/ntuser/csr.c index 1ebec16e458..18782be9a5e 100644 --- a/reactos/subsys/win32k/ntuser/csr.c +++ b/reactos/subsys/win32k/ntuser/csr.c @@ -54,7 +54,7 @@ CsrNotify(PCSR_API_MESSAGE Request) return STATUS_INVALID_PORT_HANDLE; } - 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); /* Switch to the process in which the WindowsApiPort handle is valid */ diff --git a/reactos/w32api/include/ddk/ntifs.h b/reactos/w32api/include/ddk/ntifs.h index 1efa961d1f8..871830b8677 100644 --- a/reactos/w32api/include/ddk/ntifs.h +++ b/reactos/w32api/include/ddk/ntifs.h @@ -1323,6 +1323,68 @@ typedef struct _RTL_SPLAY_LINKS { struct _RTL_SPLAY_LINKS *RightChild; } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS; +#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 +{ + 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; + +typedef struct _PORT_VIEW +{ + ULONG Length; + LPC_HANDLE SectionHandle; + ULONG SectionOffset; + LPC_SIZE_T ViewSize; + LPC_PVOID ViewBase; + LPC_PVOID ViewRemoteBase; +} PORT_VIEW, *PPORT_VIEW; + +typedef struct _REMOTE_PORT_VIEW +{ + ULONG Length; + LPC_SIZE_T ViewSize; + LPC_PVOID ViewBase; +} REMOTE_PORT_VIEW, *PREMOTE_PORT_VIEW; + typedef struct _SE_EXPORTS { LUID SeCreateTokenPrivilege; diff --git a/reactos/w32api/include/ddk/prntfont.h b/reactos/w32api/include/ddk/prntfont.h index c63e9a63498..523f3abe791 100644 --- a/reactos/w32api/include/ddk/prntfont.h +++ b/reactos/w32api/include/ddk/prntfont.h @@ -23,11 +23,6 @@ #ifndef __PRNTFONT_H #define __PRNTFONT_H -#ifndef TAG -#define TAG(_a, _b, _c, _d) (ULONG) \ - (((_a) << 0) + ((_b) << 8) + ((_c) << 16) + ((_d) << 24)) -#endif - #define UNIFM_VERSION_1_0 0x10000 #define UNI_GLYPHSETDATA_VERSION_1_0 0x10000