[KERNEL32]

This is the first of a series of commits aiming at making kernel32 using the new CSR messaging structures for communicating with Server Dlls.

svn path=/branches/ros-csrss/; revision=57666
This commit is contained in:
Hermès Bélusca-Maïto 2012-11-02 18:00:47 +00:00
parent bd4d83d88f
commit 1e4253f2c0
4 changed files with 108 additions and 94 deletions

View file

@ -90,8 +90,9 @@ DefineDosDeviceW(
{ {
ULONG ArgumentCount; ULONG ArgumentCount;
ULONG BufferSize; ULONG BufferSize;
BASE_API_MESSAGE ApiMessage;
PBASE_DEFINE_DOS_DEVICE DefineDosDeviceRequest = &ApiMessage.Data.DefineDosDeviceRequest;
PCSR_CAPTURE_BUFFER CaptureBuffer; PCSR_CAPTURE_BUFFER CaptureBuffer;
CSR_API_MESSAGE Request;
NTSTATUS Status; NTSTATUS Status;
UNICODE_STRING NtTargetPathU; UNICODE_STRING NtTargetPathU;
UNICODE_STRING DeviceNameU; UNICODE_STRING DeviceNameU;
@ -157,16 +158,16 @@ DefineDosDeviceW(
} }
else else
{ {
Request.Data.DefineDosDeviceRequest.dwFlags = dwFlags; DefineDosDeviceRequest->dwFlags = dwFlags;
CsrCaptureMessageBuffer(CaptureBuffer, CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)DeviceUpcaseNameU.Buffer, (PVOID)DeviceUpcaseNameU.Buffer,
DeviceUpcaseNameU.Length, DeviceUpcaseNameU.Length,
(PVOID*)&Request.Data.DefineDosDeviceRequest.DeviceName.Buffer); (PVOID*)&DefineDosDeviceRequest->DeviceName.Buffer);
Request.Data.DefineDosDeviceRequest.DeviceName.Length = DefineDosDeviceRequest->DeviceName.Length =
DeviceUpcaseNameU.Length; DeviceUpcaseNameU.Length;
Request.Data.DefineDosDeviceRequest.DeviceName.MaximumLength = DefineDosDeviceRequest->DeviceName.MaximumLength =
DeviceUpcaseNameU.Length; DeviceUpcaseNameU.Length;
if (NtTargetPathU.Buffer) if (NtTargetPathU.Buffer)
@ -174,21 +175,20 @@ DefineDosDeviceW(
CsrCaptureMessageBuffer(CaptureBuffer, CsrCaptureMessageBuffer(CaptureBuffer,
(PVOID)NtTargetPathU.Buffer, (PVOID)NtTargetPathU.Buffer,
NtTargetPathU.Length, NtTargetPathU.Length,
(PVOID*)&Request.Data.DefineDosDeviceRequest.TargetName.Buffer); (PVOID*)&DefineDosDeviceRequest->TargetName.Buffer);
} }
Request.Data.DefineDosDeviceRequest.TargetName.Length = DefineDosDeviceRequest->TargetName.Length =
NtTargetPathU.Length; NtTargetPathU.Length;
Request.Data.DefineDosDeviceRequest.TargetName.MaximumLength = DefineDosDeviceRequest->TargetName.MaximumLength =
NtTargetPathU.Length; NtTargetPathU.Length;
Status = CsrClientCallServer(&Request, Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
CaptureBuffer, CaptureBuffer,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepDefineDosDevice), CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepDefineDosDevice),
sizeof(CSR_API_MESSAGE)); sizeof(BASE_DEFINE_DOS_DEVICE));
CsrFreeCaptureBuffer(CaptureBuffer); CsrFreeCaptureBuffer(CaptureBuffer);
if (! NT_SUCCESS(Status) || if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
! NT_SUCCESS(Status = Request.Status))
{ {
WARN("CsrClientCallServer() failed (Status %lx)\n", WARN("CsrClientCallServer() failed (Status %lx)\n",
Status); Status);

View file

@ -1,10 +1,9 @@
/* $Id: proc.c 57086 2012-08-16 15:39:40Z akhaldi $ /*
*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
* FILE: lib/kernel32/proc/proc.c * FILE: lib/kernel32/proc/proc.c
* PURPOSE: Process functions * PURPOSE: Process functions
* PROGRAMMER: Ariadne ( ariadne@xs4all.nl) * PROGRAMMERS: Ariadne (ariadne@xs4all.nl)
* UPDATE HISTORY: * UPDATE HISTORY:
* Created 01/11/98 * Created 01/11/98
*/ */
@ -13,7 +12,7 @@
#include <k32.h> #include <k32.h>
#define NDEBUG // #define NDEBUG
#include <debug.h> #include <debug.h>
/* GLOBALS *******************************************************************/ /* GLOBALS *******************************************************************/
@ -494,25 +493,26 @@ WINAPI
BasepNotifyCsrOfThread(IN HANDLE ThreadHandle, BasepNotifyCsrOfThread(IN HANDLE ThreadHandle,
IN PCLIENT_ID ClientId) IN PCLIENT_ID ClientId)
{ {
CSR_API_MESSAGE CsrRequest;
NTSTATUS Status; NTSTATUS Status;
BASE_API_MESSAGE ApiMessage;
PBASE_CREATE_THREAD CreateThreadRequest = &ApiMessage.Data.CreateThreadRequest;
DPRINT("BasepNotifyCsrOfThread: Thread: %lx, Handle %lx\n", DPRINT("BasepNotifyCsrOfThread: Thread: %lx, Handle %lx\n",
ClientId->UniqueThread, ThreadHandle); ClientId->UniqueThread, ThreadHandle);
/* Fill out the request */ /* Fill out the request */
CsrRequest.Data.CreateThreadRequest.ClientId = *ClientId; CreateThreadRequest->ClientId = *ClientId;
CsrRequest.Data.CreateThreadRequest.ThreadHandle = ThreadHandle; CreateThreadRequest->ThreadHandle = ThreadHandle;
/* Call CSR */ /* Call CSR */
Status = CsrClientCallServer(&CsrRequest, Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateThread), CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateThread),
sizeof(CSR_API_MESSAGE)); sizeof(BASE_CREATE_THREAD));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status))
{ {
DPRINT1("Failed to tell csrss about new thread: %lx %lx\n", Status, CsrRequest.Status); DPRINT1("Failed to tell csrss about new thread: %lx %lx\n", Status, ApiMessage.Status);
return CsrRequest.Status; return ApiMessage.Status;
} }
/* Return Success */ /* Return Success */
@ -531,13 +531,15 @@ BasepCreateFirstThread(HANDLE ProcessHandle,
BOOLEAN InheritHandles, BOOLEAN InheritHandles,
DWORD dwCreationFlags) DWORD dwCreationFlags)
{ {
NTSTATUS Status;
OBJECT_ATTRIBUTES LocalObjectAttributes; OBJECT_ATTRIBUTES LocalObjectAttributes;
POBJECT_ATTRIBUTES ObjectAttributes; POBJECT_ATTRIBUTES ObjectAttributes;
CONTEXT Context; CONTEXT Context;
INITIAL_TEB InitialTeb; INITIAL_TEB InitialTeb;
NTSTATUS Status;
HANDLE hThread; HANDLE hThread;
CSR_API_MESSAGE CsrRequest; BASE_API_MESSAGE ApiMessage;
PBASE_CREATE_PROCESS CreateProcessRequest = &ApiMessage.Data.CreateProcessRequest;
DPRINT("BasepCreateFirstThread. hProcess: %lx\n", ProcessHandle); DPRINT("BasepCreateFirstThread. hProcess: %lx\n", ProcessHandle);
/* Create the Thread's Stack */ /* Create the Thread's Stack */
@ -573,20 +575,21 @@ BasepCreateFirstThread(HANDLE ProcessHandle,
} }
/* Fill out the request to notify CSRSS */ /* Fill out the request to notify CSRSS */
CsrRequest.Data.CreateProcessRequest.ClientId = *ClientId; CreateProcessRequest->ClientId = *ClientId;
CsrRequest.Data.CreateProcessRequest.ProcessHandle = ProcessHandle; CreateProcessRequest->ProcessHandle = ProcessHandle;
CsrRequest.Data.CreateProcessRequest.ThreadHandle = hThread; CreateProcessRequest->ThreadHandle = hThread;
CsrRequest.Data.CreateProcessRequest.CreationFlags = dwCreationFlags; CreateProcessRequest->CreationFlags = dwCreationFlags;
CsrRequest.Data.CreateProcessRequest.bInheritHandles = InheritHandles; CreateProcessRequest->bInheritHandles = InheritHandles;
/* Call CSR */ /* Call CSR */
Status = CsrClientCallServer(&CsrRequest, DPRINT1("Calling CsrClientCallServer from BasepCreateFirstThread...\n");
Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateProcess), CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCreateProcess),
sizeof(CSR_API_MESSAGE)); sizeof(BASE_CREATE_PROCESS));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status))
{ {
DPRINT1("Failed to tell csrss about new process: %lx %lx\n", Status, CsrRequest.Status); DPRINT1("Failed to tell csrss about new process: %lx %lx\n", Status, ApiMessage.Status);
return NULL; return NULL;
} }
@ -1174,24 +1177,25 @@ WINAPI
GetProcessShutdownParameters(OUT LPDWORD lpdwLevel, GetProcessShutdownParameters(OUT LPDWORD lpdwLevel,
OUT LPDWORD lpdwFlags) OUT LPDWORD lpdwFlags)
{ {
CSR_API_MESSAGE CsrRequest;
NTSTATUS Status; NTSTATUS Status;
BASE_API_MESSAGE ApiMessage;
PBASE_GET_PROCESS_SHUTDOWN_PARAMS GetShutdownParametersRequest = &ApiMessage.Data.GetShutdownParametersRequest;
/* Ask CSRSS for shutdown information */ /* Ask CSRSS for shutdown information */
Status = CsrClientCallServer(&CsrRequest, Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetProcessShutdownParam), CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetProcessShutdownParam),
sizeof(CSR_API_MESSAGE)); sizeof(BASE_GET_PROCESS_SHUTDOWN_PARAMS));
if (!(NT_SUCCESS(Status)) || !(NT_SUCCESS(CsrRequest.Status))) if (!(NT_SUCCESS(Status)) || !(NT_SUCCESS(ApiMessage.Status)))
{ {
/* Return the failure from CSRSS */ /* Return the failure from CSRSS */
BaseSetLastNTError(CsrRequest.Status); BaseSetLastNTError(ApiMessage.Status);
return FALSE; return FALSE;
} }
/* Get the data out of the LCP reply */ /* Get the data out of the LCP reply */
*lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level; *lpdwLevel = GetShutdownParametersRequest->Level;
*lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags; *lpdwFlags = GetShutdownParametersRequest->Flags;
return TRUE; return TRUE;
} }
@ -1203,20 +1207,21 @@ WINAPI
SetProcessShutdownParameters(IN DWORD dwLevel, SetProcessShutdownParameters(IN DWORD dwLevel,
IN DWORD dwFlags) IN DWORD dwFlags)
{ {
CSR_API_MESSAGE CsrRequest;
NTSTATUS Status; NTSTATUS Status;
BASE_API_MESSAGE ApiMessage;
PBASE_SET_PROCESS_SHUTDOWN_PARAMS SetShutdownParametersRequest = &ApiMessage.Data.SetShutdownParametersRequest;
/* Write the data into the CSRSS request and send it */ /* Write the data into the CSRSS request and send it */
CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel; SetShutdownParametersRequest->Level = dwLevel;
CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags; SetShutdownParametersRequest->Flags = dwFlags;
Status = CsrClientCallServer(&CsrRequest, Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepSetProcessShutdownParam), CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepSetProcessShutdownParam),
sizeof(CSR_API_MESSAGE)); sizeof(BASE_SET_PROCESS_SHUTDOWN_PARAMS));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) if (!NT_SUCCESS(Status) || !NT_SUCCESS(ApiMessage.Status))
{ {
/* Return the failure from CSRSS */ /* Return the failure from CSRSS */
BaseSetLastNTError(CsrRequest.Status); BaseSetLastNTError(ApiMessage.Status);
return FALSE; return FALSE;
} }
@ -1740,7 +1745,9 @@ VOID
WINAPI WINAPI
ExitProcess(IN UINT uExitCode) ExitProcess(IN UINT uExitCode)
{ {
CSR_API_MESSAGE CsrRequest; BASE_API_MESSAGE ApiMessage;
PBASE_EXIT_PROCESS ExitProcessRequest = &ApiMessage.Data.ExitProcessRequest;
ASSERT(!BaseRunningInServerProcess); ASSERT(!BaseRunningInServerProcess);
_SEH2_TRY _SEH2_TRY
@ -1755,11 +1762,11 @@ ExitProcess(IN UINT uExitCode)
LdrShutdownProcess(); LdrShutdownProcess();
/* Notify Base Server of process termination */ /* Notify Base Server of process termination */
CsrRequest.Data.TerminateProcessRequest.uExitCode = uExitCode; ExitProcessRequest->uExitCode = uExitCode;
CsrClientCallServer(&CsrRequest, CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepExitProcess), CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepExitProcess),
sizeof(CSR_API_MESSAGE)); sizeof(BASE_EXIT_PROCESS));
/* Now do it again */ /* Now do it again */
NtTerminateProcess(NtCurrentProcess(), uExitCode); NtTerminateProcess(NtCurrentProcess(), uExitCode);

View file

@ -70,7 +70,7 @@ BaseCheckVDM(IN ULONG BinaryType,
IN PCWCH CommandLine, IN PCWCH CommandLine,
IN PCWCH CurrentDirectory, IN PCWCH CurrentDirectory,
IN PANSI_STRING AnsiEnvironment, IN PANSI_STRING AnsiEnvironment,
IN PCSR_API_MESSAGE Msg, IN PCSR_API_MESSAGE ApiMessage,
IN OUT PULONG iTask, IN OUT PULONG iTask,
IN DWORD CreationFlags, IN DWORD CreationFlags,
IN LPSTARTUPINFOW StartupInfo) IN LPSTARTUPINFOW StartupInfo)
@ -87,8 +87,10 @@ BaseUpdateVDMEntry(IN ULONG UpdateIndex,
IN ULONG IndexInfo, IN ULONG IndexInfo,
IN ULONG BinaryType) IN ULONG BinaryType)
{ {
#if 0 // Unimplemented in BASESRV
NTSTATUS Status; NTSTATUS Status;
CSR_API_MESSAGE Msg; BASE_API_MESSAGE ApiMessage;
PBASE_UPDATE_VDM_ENTRY UpdateVdmEntry = &ApiMessage.Data.UpdateVdmEntry;
/* Check what update is being sent */ /* Check what update is being sent */
switch (UpdateIndex) switch (UpdateIndex)
@ -97,16 +99,16 @@ BaseUpdateVDMEntry(IN ULONG UpdateIndex,
case VdmEntryUndo: case VdmEntryUndo:
/* Tell the server how far we had gotten along */ /* Tell the server how far we had gotten along */
Msg.Data.UpdateVdmEntry.iTask = (ULONG)*WaitHandle; UpdateVdmEntry->iTask = (ULONG)*WaitHandle;
Msg.Data.UpdateVdmEntry.VDMCreationState = IndexInfo; UpdateVdmEntry->VDMCreationState = IndexInfo;
break; break;
/* VDM is ready with a new process handle */ /* VDM is ready with a new process handle */
case VdmEntryUpdateProcess: case VdmEntryUpdateProcess:
/* Send it the process handle */ /* Send it the process handle */
Msg.Data.UpdateVdmEntry.VDMProcessHandle = *WaitHandle; UpdateVdmEntry->VDMProcessHandle = *WaitHandle;
Msg.Data.UpdateVdmEntry.iTask = IndexInfo; UpdateVdmEntry->iTask = IndexInfo;
break; break;
} }
@ -114,32 +116,32 @@ BaseUpdateVDMEntry(IN ULONG UpdateIndex,
if (BinaryType == BINARY_TYPE_WOW) if (BinaryType == BINARY_TYPE_WOW)
{ {
/* Magic value for 16-bit apps */ /* Magic value for 16-bit apps */
Msg.Data.UpdateVdmEntry.ConsoleHandle = (HANDLE)-1; UpdateVdmEntry->ConsoleHandle = (HANDLE)-1;
} }
else if (Msg.Data.UpdateVdmEntry.iTask) else if (UpdateVdmEntry->iTask)
{ {
/* No handle for true VDM */ /* No handle for true VDM */
Msg.Data.UpdateVdmEntry.ConsoleHandle = 0; UpdateVdmEntry->ConsoleHandle = 0;
} }
else else
{ {
/* Otherwise, send the regular consoel handle */ /* Otherwise, send the regular consoel handle */
Msg.Data.UpdateVdmEntry.ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; UpdateVdmEntry->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
} }
/* Finally write the index and binary type */ /* Finally write the index and binary type */
Msg.Data.UpdateVdmEntry.EntryIndex = UpdateIndex; UpdateVdmEntry->EntryIndex = UpdateIndex;
Msg.Data.UpdateVdmEntry.BinaryType = BinaryType; UpdateVdmEntry->BinaryType = BinaryType;
/* Send the message to CSRSS */ /* Send the message to CSRSS */
Status = CsrClientCallServer(&Msg, Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepUpdateVDMEntry), CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepUpdateVDMEntry),
sizeof(Msg)); sizeof(BASE_UPDATE_VDM_ENTRY));
if (!(NT_SUCCESS(Status)) || !(NT_SUCCESS(Msg.Status))) if (!(NT_SUCCESS(Status)) || !(NT_SUCCESS(ApiMessage.Status)))
{ {
/* Handle failure */ /* Handle failure */
BaseSetLastNTError(Msg.Status); BaseSetLastNTError(ApiMessage.Status);
return FALSE; return FALSE;
} }
@ -147,9 +149,9 @@ BaseUpdateVDMEntry(IN ULONG UpdateIndex,
if (UpdateIndex == VdmEntryUpdateProcess) if (UpdateIndex == VdmEntryUpdateProcess)
{ {
/* Return it to the caller */ /* Return it to the caller */
*WaitHandle = Msg.Data.UpdateVdmEntry.WaitObjectForParent; *WaitHandle = UpdateVdmEntry->WaitObjectForParent;
} }
#endif
/* We made it */ /* We made it */
return TRUE; return TRUE;
} }
@ -159,9 +161,11 @@ WINAPI
BaseCheckForVDM(IN HANDLE ProcessHandle, BaseCheckForVDM(IN HANDLE ProcessHandle,
OUT LPDWORD ExitCode) OUT LPDWORD ExitCode)
{ {
#if 0 // Unimplemented in BASESRV
NTSTATUS Status; NTSTATUS Status;
EVENT_BASIC_INFORMATION EventBasicInfo; EVENT_BASIC_INFORMATION EventBasicInfo;
CSR_API_MESSAGE Msg; BASE_API_MESSAGE ApiMessage;
PBASE_GET_VDM_EXIT_CODE GetVdmExitCode = &ApiMessage.Data.GetVdmExitCode;
/* It's VDM if the process is actually a wait handle (an event) */ /* It's VDM if the process is actually a wait handle (an event) */
Status = NtQueryEvent(ProcessHandle, Status = NtQueryEvent(ProcessHandle,
@ -172,18 +176,19 @@ BaseCheckForVDM(IN HANDLE ProcessHandle,
if (!NT_SUCCESS(Status)) return FALSE; if (!NT_SUCCESS(Status)) return FALSE;
/* Setup the input parameters */ /* Setup the input parameters */
Msg.Data.GetVdmExitCode.ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle; GetVdmExitCode->ConsoleHandle = NtCurrentPeb()->ProcessParameters->ConsoleHandle;
Msg.Data.GetVdmExitCode.hParent = ProcessHandle; GetVdmExitCode->hParent = ProcessHandle;
/* Call CSRSS */ /* Call CSRSS */
Status = CsrClientCallServer(&Msg, Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepCheckVDM /* BasepGetVDMExitCode */), CSR_CREATE_API_NUMBER(BASESRV_SERVERDLL_INDEX, BasepGetVDMExitCode /* BasepCheckVDM */),
sizeof(Msg)); sizeof(BASE_GET_VDM_EXIT_CODE));
if (!NT_SUCCESS(Status)) return FALSE; if (!NT_SUCCESS(Status)) return FALSE;
/* Get the exit code from the reply */ /* Get the exit code from the reply */
*ExitCode = Msg.Data.GetVdmExitCode.ExitCode; *ExitCode = GetVdmExitCode->ExitCode;
#endif
return TRUE; return TRUE;
} }

View file

@ -318,8 +318,9 @@ BOOL
WINAPI WINAPI
GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
{ {
CSR_API_MESSAGE Request;
NTSTATUS Status; NTSTATUS Status;
CONSOLE_API_MESSAGE ApiMessage;
PCSRSS_GET_HISTORY_INFO GetHistoryInfo = &ApiMessage.Data.GetHistoryInfo;
if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO))
{ {
@ -327,19 +328,19 @@ GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
return FALSE; return FALSE;
} }
Status = CsrClientCallServer(&Request, Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(CSR_CONSOLE, GET_HISTORY_INFO), CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepGetHistory),
sizeof(CSR_API_MESSAGE)); sizeof(CSRSS_GET_HISTORY_INFO));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
{ {
BaseSetLastNTError(Status); BaseSetLastNTError(Status);
return FALSE; return FALSE;
} }
lpConsoleHistoryInfo->HistoryBufferSize = Request.Data.GetHistoryInfo.HistoryBufferSize; lpConsoleHistoryInfo->HistoryBufferSize = GetHistoryInfo->HistoryBufferSize;
lpConsoleHistoryInfo->NumberOfHistoryBuffers = Request.Data.GetHistoryInfo.NumberOfHistoryBuffers; lpConsoleHistoryInfo->NumberOfHistoryBuffers = GetHistoryInfo->NumberOfHistoryBuffers;
lpConsoleHistoryInfo->dwFlags = Request.Data.GetHistoryInfo.dwFlags; lpConsoleHistoryInfo->dwFlags = GetHistoryInfo->dwFlags;
return TRUE; return TRUE;
} }
@ -354,8 +355,9 @@ BOOL
WINAPI WINAPI
SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
{ {
CSR_API_MESSAGE Request;
NTSTATUS Status; NTSTATUS Status;
CONSOLE_API_MESSAGE ApiMessage;
PCSRSS_SET_HISTORY_INFO SetHistoryInfo = &ApiMessage.Data.SetHistoryInfo;
if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO))
{ {
@ -363,15 +365,15 @@ SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo)
return FALSE; return FALSE;
} }
Request.Data.SetHistoryInfo.HistoryBufferSize = lpConsoleHistoryInfo->HistoryBufferSize; SetHistoryInfo->HistoryBufferSize = lpConsoleHistoryInfo->HistoryBufferSize;
Request.Data.SetHistoryInfo.NumberOfHistoryBuffers = lpConsoleHistoryInfo->NumberOfHistoryBuffers; SetHistoryInfo->NumberOfHistoryBuffers = lpConsoleHistoryInfo->NumberOfHistoryBuffers;
Request.Data.SetHistoryInfo.dwFlags = lpConsoleHistoryInfo->dwFlags; SetHistoryInfo->dwFlags = lpConsoleHistoryInfo->dwFlags;
Status = CsrClientCallServer(&Request, Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
NULL, NULL,
CSR_CREATE_API_NUMBER(CSR_CONSOLE, GET_HISTORY_INFO), CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, ConsolepSetHistory),
sizeof(CSR_API_MESSAGE)); sizeof(CSRSS_SET_HISTORY_INFO));
if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
{ {
BaseSetLastNTError(Status); BaseSetLastNTError(Status);
return FALSE; return FALSE;