[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
This commit is contained in:
Alex Ionescu 2013-08-29 00:02:15 +00:00
parent c29aaf5ec8
commit 3be526a895
4 changed files with 16 additions and 11 deletions

View file

@ -107,7 +107,7 @@ CsrpConnectToServer(IN PWSTR ObjectDirectory)
SecurityQos.EffectiveOnly = TRUE; SecurityQos.EffectiveOnly = TRUE;
/* Setup the connection info */ /* Setup the connection info */
ConnectionInfo.Version = CSRSRV_VERSION; ConnectionInfo.DebugFlags = 0;
/* Create a SID for us */ /* Create a SID for us */
Status = RtlAllocateAndInitializeSid(&NtSidAuthority, Status = RtlAllocateAndInitializeSid(&NtSidAuthority,
@ -153,12 +153,12 @@ CsrpConnectToServer(IN PWSTR ObjectDirectory)
(ULONG_PTR)LpcWrite.ViewBase; (ULONG_PTR)LpcWrite.ViewBase;
/* Save the Process */ /* Save the Process */
CsrProcessId = ConnectionInfo.ProcessId; CsrProcessId = ConnectionInfo.ServerProcessId;
/* Save CSR Section data */ /* Save CSR Section data */
NtCurrentPeb()->ReadOnlySharedMemoryBase = ConnectionInfo.SharedSectionBase; NtCurrentPeb()->ReadOnlySharedMemoryBase = ConnectionInfo.SharedSectionBase;
NtCurrentPeb()->ReadOnlySharedMemoryHeap = ConnectionInfo.SharedSectionHeap; NtCurrentPeb()->ReadOnlySharedMemoryHeap = ConnectionInfo.SharedSectionHeap;
NtCurrentPeb()->ReadOnlyStaticServerData = ConnectionInfo.SharedSectionData; NtCurrentPeb()->ReadOnlyStaticServerData = ConnectionInfo.SharedStaticServerData;
/* Create the port heap */ /* Create the port heap */
CsrPortHeap = RtlCreateHeap(0, CsrPortHeap = RtlCreateHeap(0,

View file

@ -46,15 +46,15 @@ typedef ULONG CSR_API_NUMBER;
typedef struct _CSR_API_CONNECTINFO typedef struct _CSR_API_CONNECTINFO
{ {
ULONG Version;
ULONG Unknown;
HANDLE ObjectDirectory; HANDLE ObjectDirectory;
PVOID SharedSectionBase; PVOID SharedSectionBase;
PVOID SharedStaticServerData;
PVOID SharedSectionHeap; PVOID SharedSectionHeap;
PVOID SharedSectionData;
ULONG DebugFlags; ULONG DebugFlags;
ULONG Unknown2[3]; ULONG SizeOfPebData;
HANDLE ProcessId; ULONG SizeOfTebData;
ULONG NumberOfServerDllNames;
HANDLE ServerProcessId;
} CSR_API_CONNECTINFO, *PCSR_API_CONNECTINFO; } CSR_API_CONNECTINFO, *PCSR_API_CONNECTINFO;
#define CSRSRV_VERSION 0x10000 #define CSRSRV_VERSION 0x10000

View file

@ -180,7 +180,12 @@ CsrApiHandleConnectionRequest(IN PCSR_API_MESSAGE ApiMessage)
Status = CsrSrvAttachSharedSection(CsrProcess, ConnectInfo); Status = CsrSrvAttachSharedSection(CsrProcess, ConnectInfo);
/* Check how this went */ /* 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 */ /* Dereference the project */
@ -197,7 +202,7 @@ CsrApiHandleConnectionRequest(IN PCSR_API_MESSAGE ApiMessage)
RemotePortView.ViewBase = NULL; RemotePortView.ViewBase = NULL;
/* Save the Process ID */ /* Save the Process ID */
ConnectInfo->ProcessId = NtCurrentTeb()->ClientId.UniqueProcess; ConnectInfo->ServerProcessId = NtCurrentTeb()->ClientId.UniqueProcess;
/* Accept the Connection */ /* Accept the Connection */
Status = NtAcceptConnectPort(&ServerPort, Status = NtAcceptConnectPort(&ServerPort,

View file

@ -469,7 +469,7 @@ CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL,
/* Write the values in the Connection Info structure */ /* Write the values in the Connection Info structure */
ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase; ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase;
ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap; ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap;
ConnectInfo->SharedSectionData = CsrSrvSharedStaticServerData; ConnectInfo->SharedStaticServerData = CsrSrvSharedStaticServerData;
/* Return success */ /* Return success */
return STATUS_SUCCESS; return STATUS_SUCCESS;