From 3be526a8954779a22213e7a5beee287983cf4e2c Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Thu, 29 Aug 2013 00:02:15 +0000 Subject: [PATCH] [NTDLL]: Fix CsrpConnectToServer to use the correct CSR_API_CONNECTINFO structure. [CSRSRV]: Fix definition of CSR_API_CONNECTINFO structure. It is now compatible with Server 2003. Also, set the DebugFlag. svn path=/trunk/; revision=59864 --- reactos/dll/ntdll/csr/connect.c | 6 +++--- reactos/include/reactos/subsys/csr/csrmsg.h | 10 +++++----- reactos/subsystems/win32/csrsrv/api.c | 9 +++++++-- reactos/subsystems/win32/csrsrv/server.c | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/reactos/dll/ntdll/csr/connect.c b/reactos/dll/ntdll/csr/connect.c index bf89f9057f2..da2227e86bb 100644 --- a/reactos/dll/ntdll/csr/connect.c +++ b/reactos/dll/ntdll/csr/connect.c @@ -107,7 +107,7 @@ CsrpConnectToServer(IN PWSTR ObjectDirectory) SecurityQos.EffectiveOnly = TRUE; /* Setup the connection info */ - ConnectionInfo.Version = CSRSRV_VERSION; + ConnectionInfo.DebugFlags = 0; /* Create a SID for us */ Status = RtlAllocateAndInitializeSid(&NtSidAuthority, @@ -153,12 +153,12 @@ CsrpConnectToServer(IN PWSTR ObjectDirectory) (ULONG_PTR)LpcWrite.ViewBase; /* Save the Process */ - CsrProcessId = ConnectionInfo.ProcessId; + CsrProcessId = ConnectionInfo.ServerProcessId; /* Save CSR Section data */ NtCurrentPeb()->ReadOnlySharedMemoryBase = ConnectionInfo.SharedSectionBase; NtCurrentPeb()->ReadOnlySharedMemoryHeap = ConnectionInfo.SharedSectionHeap; - NtCurrentPeb()->ReadOnlyStaticServerData = ConnectionInfo.SharedSectionData; + NtCurrentPeb()->ReadOnlyStaticServerData = ConnectionInfo.SharedStaticServerData; /* Create the port heap */ CsrPortHeap = RtlCreateHeap(0, diff --git a/reactos/include/reactos/subsys/csr/csrmsg.h b/reactos/include/reactos/subsys/csr/csrmsg.h index 4d0be5f6982..24e1e770e4d 100644 --- a/reactos/include/reactos/subsys/csr/csrmsg.h +++ b/reactos/include/reactos/subsys/csr/csrmsg.h @@ -46,15 +46,15 @@ typedef ULONG CSR_API_NUMBER; typedef struct _CSR_API_CONNECTINFO { - ULONG Version; - ULONG Unknown; HANDLE ObjectDirectory; PVOID SharedSectionBase; + PVOID SharedStaticServerData; PVOID SharedSectionHeap; - PVOID SharedSectionData; ULONG DebugFlags; - ULONG Unknown2[3]; - HANDLE ProcessId; + ULONG SizeOfPebData; + ULONG SizeOfTebData; + ULONG NumberOfServerDllNames; + HANDLE ServerProcessId; } CSR_API_CONNECTINFO, *PCSR_API_CONNECTINFO; #define CSRSRV_VERSION 0x10000 diff --git a/reactos/subsystems/win32/csrsrv/api.c b/reactos/subsystems/win32/csrsrv/api.c index 123f302be6a..0d7e3850317 100644 --- a/reactos/subsystems/win32/csrsrv/api.c +++ b/reactos/subsystems/win32/csrsrv/api.c @@ -180,7 +180,12 @@ CsrApiHandleConnectionRequest(IN PCSR_API_MESSAGE ApiMessage) Status = CsrSrvAttachSharedSection(CsrProcess, ConnectInfo); /* Check how this went */ - if (NT_SUCCESS(Status)) AllowConnection = TRUE; + if (NT_SUCCESS(Status)) + { + /* Allow the connection, and return debugging flag */ + ConnectInfo->DebugFlags = CsrDebug; + AllowConnection = TRUE; + } } /* Dereference the project */ @@ -197,7 +202,7 @@ CsrApiHandleConnectionRequest(IN PCSR_API_MESSAGE ApiMessage) RemotePortView.ViewBase = NULL; /* Save the Process ID */ - ConnectInfo->ProcessId = NtCurrentTeb()->ClientId.UniqueProcess; + ConnectInfo->ServerProcessId = NtCurrentTeb()->ClientId.UniqueProcess; /* Accept the Connection */ Status = NtAcceptConnectPort(&ServerPort, diff --git a/reactos/subsystems/win32/csrsrv/server.c b/reactos/subsystems/win32/csrsrv/server.c index 668a0f465e3..5943d2a680b 100644 --- a/reactos/subsystems/win32/csrsrv/server.c +++ b/reactos/subsystems/win32/csrsrv/server.c @@ -469,7 +469,7 @@ CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL, /* Write the values in the Connection Info structure */ ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase; ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap; - ConnectInfo->SharedSectionData = CsrSrvSharedStaticServerData; + ConnectInfo->SharedStaticServerData = CsrSrvSharedStaticServerData; /* Return success */ return STATUS_SUCCESS;