Author: hbelusca
Date: Sat Nov 17 23:07:59 2012
New Revision: 57724
URL:
http://svn.reactos.org/svn/reactos?rev=57724&view=rev
Log:
[KERNEL32]
- Make some functions compliant with the new structures and server apis indices names.
[KERNEL32/CONSRV]
- Merge CSRSS_SET_CONSOLE_MODE and CSRSS_GET_CONSOLE_MODE into CSRSS_CONSOLE_MODE.
- Rename CSRSS_SETGET_CONSOLE_HW_STATE into CSRSS_CONSOLE_HW_STATE.
Modified:
branches/ros-csrss/dll/win32/kernel32/client/console/console.c
branches/ros-csrss/include/reactos/subsys/win/conmsg.h
branches/ros-csrss/win32ss/user/consrv/console.c
Modified: branches/ros-csrss/dll/win32/kernel32/client/console/console.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/kernel32/cl…
==============================================================================
--- branches/ros-csrss/dll/win32/kernel32/client/console/console.c [iso-8859-1]
(original)
+++ branches/ros-csrss/dll/win32/kernel32/client/console/console.c [iso-8859-1] Sat Nov 17
23:07:59 2012
@@ -202,33 +202,34 @@
BOOL bInheritHandle,
DWORD dwOptions)
{
- CSR_API_MESSAGE Request;
- NTSTATUS Status;
-
- if (dwOptions & ~(DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)
- || (!(dwOptions & DUPLICATE_SAME_ACCESS)
- && dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE)))
+ NTSTATUS Status;
+ CONSOLE_API_MESSAGE ApiMessage;
+ PCSRSS_DUPLICATE_HANDLE DuplicateHandleRequest =
&ApiMessage.Data.DuplicateHandleRequest;
+
+ if ( (dwOptions & ~(DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) ||
+ (!(dwOptions & DUPLICATE_SAME_ACCESS) &&
+ (dwDesiredAccess & ~(GENERIC_READ | GENERIC_WRITE))) )
{
SetLastError (ERROR_INVALID_PARAMETER);
return INVALID_HANDLE_VALUE;
}
- Request.Data.DuplicateHandleRequest.Handle = hConsole;
- Request.Data.DuplicateHandleRequest.Access = dwDesiredAccess;
- Request.Data.DuplicateHandleRequest.Inheritable = bInheritHandle;
- Request.Data.DuplicateHandleRequest.Options = dwOptions;
-
- Status = CsrClientCallServer(&Request,
- NULL,
- CSR_CREATE_API_NUMBER(CSR_NATIVE, DUPLICATE_HANDLE),
- sizeof(CSR_API_MESSAGE));
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status=Request.Status))
+ DuplicateHandleRequest->Handle = hConsole;
+ DuplicateHandleRequest->Access = dwDesiredAccess;
+ DuplicateHandleRequest->Inheritable = bInheritHandle;
+ DuplicateHandleRequest->Options = dwOptions;
+
+ Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ NULL,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepDuplicateHandle),
+ sizeof(CSRSS_DUPLICATE_HANDLE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
{
BaseSetLastNTError(Status);
return INVALID_HANDLE_VALUE;
}
- return Request.Data.DuplicateHandleRequest.Handle;
+ return DuplicateHandleRequest->Handle;
}
@@ -292,23 +293,23 @@
DWORD Flags,
PDWORD State)
{
- CSR_API_MESSAGE Request;
- NTSTATUS Status;
-
- Request.Data.ConsoleHardwareStateRequest.ConsoleHandle = hConsole;
- Request.Data.ConsoleHardwareStateRequest.SetGet = CONSOLE_HARDWARE_STATE_GET;
-
- Status = CsrClientCallServer(&Request,
- NULL,
- CSR_CREATE_API_NUMBER(CSR_CONSOLE,
SETGET_CONSOLE_HW_STATE),
- sizeof(CSR_API_MESSAGE));
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
- {
- BaseSetLastNTError(Status);
- return FALSE;
- }
-
- *State = Request.Data.ConsoleHardwareStateRequest.State;
+ NTSTATUS Status;
+ CONSOLE_API_MESSAGE ApiMessage;
+ PCSRSS_CONSOLE_HW_STATE ConsoleHardwareStateRequest =
&ApiMessage.Data.ConsoleHardwareStateRequest;
+
+ ConsoleHardwareStateRequest->ConsoleHandle = hConsole;
+
+ Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ NULL,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepGetHardwareState),
+ sizeof(CSRSS_CONSOLE_HW_STATE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
+ {
+ BaseSetLastNTError(Status);
+ return FALSE;
+ }
+
+ *State = ConsoleHardwareStateRequest->State;
return TRUE;
}
@@ -498,18 +499,18 @@
DWORD Flags,
DWORD State)
{
- CSR_API_MESSAGE Request;
- NTSTATUS Status;
-
- Request.Data.ConsoleHardwareStateRequest.ConsoleHandle = hConsole;
- Request.Data.ConsoleHardwareStateRequest.SetGet = CONSOLE_HARDWARE_STATE_SET;
- Request.Data.ConsoleHardwareStateRequest.State = State;
-
- Status = CsrClientCallServer(&Request,
- NULL,
- CSR_CREATE_API_NUMBER(CSR_CONSOLE,
SETGET_CONSOLE_HW_STATE),
- sizeof(CSR_API_MESSAGE));
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ NTSTATUS Status;
+ CONSOLE_API_MESSAGE ApiMessage;
+ PCSRSS_CONSOLE_HW_STATE ConsoleHardwareStateRequest =
&ApiMessage.Data.ConsoleHardwareStateRequest;
+
+ ConsoleHardwareStateRequest->ConsoleHandle = hConsole;
+ ConsoleHardwareStateRequest->State = State;
+
+ Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ NULL,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepSetHardwareState),
+ sizeof(CSRSS_CONSOLE_HW_STATE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
{
BaseSetLastNTError(Status);
return FALSE;
@@ -910,22 +911,23 @@
GetConsoleMode(HANDLE hConsoleHandle,
LPDWORD lpMode)
{
- CSR_API_MESSAGE Request;
- NTSTATUS Status;
-
- Request.Data.GetConsoleModeRequest.ConsoleHandle = hConsoleHandle;
-
- Status = CsrClientCallServer(&Request,
- NULL,
- CSR_CREATE_API_NUMBER(CSR_CONSOLE, GET_CONSOLE_MODE),
- sizeof(CSR_API_MESSAGE));
- if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
- {
- BaseSetLastNTError(Status);
- return FALSE;
- }
-
- *lpMode = Request.Data.GetConsoleModeRequest.ConsoleMode;
+ NTSTATUS Status;
+ CONSOLE_API_MESSAGE ApiMessage;
+ PCSRSS_CONSOLE_MODE ConsoleModeRequest = &ApiMessage.Data.ConsoleModeRequest;
+
+ ConsoleModeRequest->ConsoleHandle = hConsoleHandle;
+
+ Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ NULL,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepGetMode),
+ sizeof(CSRSS_CONSOLE_MODE));
+ if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
+ {
+ BaseSetLastNTError(Status);
+ return FALSE;
+ }
+
+ *lpMode = ConsoleModeRequest->ConsoleMode;
return TRUE;
}
@@ -1050,17 +1052,18 @@
SetConsoleMode(HANDLE hConsoleHandle,
DWORD dwMode)
{
- CSR_API_MESSAGE Request;
- NTSTATUS Status;
-
- Request.Data.SetConsoleModeRequest.ConsoleHandle = hConsoleHandle;
- Request.Data.SetConsoleModeRequest.Mode = dwMode;
-
- Status = CsrClientCallServer(&Request,
- NULL,
- CSR_CREATE_API_NUMBER(CSR_CONSOLE, SET_CONSOLE_MODE),
- sizeof(CSR_API_MESSAGE));
- if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status))
+ NTSTATUS Status;
+ CONSOLE_API_MESSAGE ApiMessage;
+ PCSRSS_CONSOLE_MODE ConsoleModeRequest = &ApiMessage.Data.ConsoleModeRequest;
+
+ ConsoleModeRequest->ConsoleHandle = hConsoleHandle;
+ ConsoleModeRequest->ConsoleMode = dwMode;
+
+ Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+ NULL,
+ CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX,
ConsolepSetMode),
+ sizeof(CSRSS_CONSOLE_MODE));
+ if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = ApiMessage.Status))
{
BaseSetLastNTError(Status);
return FALSE;
Modified: branches/ros-csrss/include/reactos/subsys/win/conmsg.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/reactos/subsy…
==============================================================================
--- branches/ros-csrss/include/reactos/subsys/win/conmsg.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/reactos/subsys/win/conmsg.h [iso-8859-1] Sat Nov 17
23:07:59 2012
@@ -52,7 +52,7 @@
ConsolepReadConsole,
ConsolepWriteConsole,
ConsolepDuplicateHandle,
- /**/ ConsolepGetHandleInformation /**/,
+ // ConsolepGetHandleInformation,
// ConsolepSetHandleInformation,
ConsolepCloseHandle,
ConsolepVerifyIoHandle,
@@ -246,14 +246,8 @@
typedef struct
{
HANDLE ConsoleHandle;
- DWORD Mode;
-} CSRSS_SET_CONSOLE_MODE, *PCSRSS_SET_CONSOLE_MODE;
-
-typedef struct
-{
- HANDLE ConsoleHandle;
DWORD ConsoleMode;
-} CSRSS_GET_CONSOLE_MODE, *PCSRSS_GET_CONSOLE_MODE;
+} CSRSS_CONSOLE_MODE, *PCSRSS_CONSOLE_MODE;
typedef struct
{
@@ -415,18 +409,18 @@
HANDLE InputWaitHandle;
} CSRSS_GET_INPUT_WAIT_HANDLE, *PCSRSS_GET_INPUT_WAIT_HANDLE;
-#define CONSOLE_HARDWARE_STATE_GET 0
-#define CONSOLE_HARDWARE_STATE_SET 1
-
+
+/*
+ * Console hardware states.
+ */
#define CONSOLE_HARDWARE_STATE_GDI_MANAGED 0
#define CONSOLE_HARDWARE_STATE_DIRECT 1
typedef struct
{
HANDLE ConsoleHandle;
- DWORD SetGet; /* 0=get; 1=set */
DWORD State;
-} CSRSS_SETGET_CONSOLE_HW_STATE, *PCSRSS_SETGET_CONSOLE_HW_STATE;
+} CSRSS_CONSOLE_HW_STATE, *PCSRSS_CONSOLE_HW_STATE;
typedef struct
{
@@ -607,9 +601,8 @@
CSRSS_GET_CONSOLE_SELECTION_INFO GetConsoleSelectionInfo;
/* Console mode */
- CSRSS_SET_CONSOLE_MODE SetConsoleModeRequest;
- CSRSS_GET_CONSOLE_MODE GetConsoleModeRequest;
- CSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest;
+ CSRSS_CONSOLE_MODE ConsoleModeRequest;
+ CSRSS_CONSOLE_HW_STATE ConsoleHardwareStateRequest;
/* Console window */
CSRSS_SET_TITLE SetTitleRequest;
Modified: branches/ros-csrss/win32ss/user/consrv/console.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/console.c [iso-8859-1] Sat Nov 17 23:07:59
2012
@@ -463,28 +463,26 @@
CSR_API(SrvSetConsoleMode)
{
NTSTATUS Status;
- PCSRSS_SET_CONSOLE_MODE SetConsoleModeRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetConsoleModeRequest;
+ PCSRSS_CONSOLE_MODE ConsoleModeRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
PCSRSS_CONSOLE Console;
PCSRSS_SCREEN_BUFFER Buff;
DPRINT("SrvSetConsoleMode\n");
- Status = Win32CsrLockObject(CsrGetClientThread()->Process,
- SetConsoleModeRequest->ConsoleHandle,
+ Status =
Win32CsrLockObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+ ConsoleModeRequest->ConsoleHandle,
(Object_t **) &Console, GENERIC_WRITE, 0);
- if (! NT_SUCCESS(Status))
- {
- return Status;
- }
+ if (!NT_SUCCESS(Status)) return Status;
Buff = (PCSRSS_SCREEN_BUFFER)Console;
+
if (CONIO_CONSOLE_MAGIC == Console->Header.Type)
{
- Console->Mode = SetConsoleModeRequest->Mode &
CONSOLE_INPUT_MODE_VALID;
+ Console->Mode = ConsoleModeRequest->ConsoleMode &
CONSOLE_INPUT_MODE_VALID;
}
else if (CONIO_SCREEN_BUFFER_MAGIC == Console->Header.Type)
{
- Buff->Mode = SetConsoleModeRequest->Mode & CONSOLE_OUTPUT_MODE_VALID;
+ Buff->Mode = ConsoleModeRequest->ConsoleMode &
CONSOLE_OUTPUT_MODE_VALID;
}
else
{
@@ -499,27 +497,27 @@
CSR_API(SrvGetConsoleMode)
{
NTSTATUS Status;
- PCSRSS_GET_CONSOLE_MODE GetConsoleModeRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetConsoleModeRequest;
+ PCSRSS_CONSOLE_MODE ConsoleModeRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
PCSRSS_CONSOLE Console;
PCSRSS_SCREEN_BUFFER Buff;
DPRINT("SrvGetConsoleMode\n");
- Status = Win32CsrLockObject(CsrGetClientThread()->Process,
GetConsoleModeRequest->ConsoleHandle,
+ Status =
Win32CsrLockObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+ ConsoleModeRequest->ConsoleHandle,
(Object_t **) &Console, GENERIC_READ, 0);
- if (! NT_SUCCESS(Status))
- {
- return Status;
- }
+ if (!NT_SUCCESS(Status)) return Status;
+
Status = STATUS_SUCCESS;
Buff = (PCSRSS_SCREEN_BUFFER) Console;
+
if (CONIO_CONSOLE_MAGIC == Console->Header.Type)
{
- GetConsoleModeRequest->ConsoleMode = Console->Mode;
+ ConsoleModeRequest->ConsoleMode = Console->Mode;
}
else if (CONIO_SCREEN_BUFFER_MAGIC == Buff->Header.Type)
{
- GetConsoleModeRequest->ConsoleMode = Buff->Mode;
+ ConsoleModeRequest->ConsoleMode = Buff->Mode;
}
else
{
@@ -614,18 +612,18 @@
}
/**********************************************************************
- * HardwareStateProperty
+ * HardwareStateProperty
*
- * DESCRIPTION
- * Set/Get the value of the HardwareState and switch
- * between direct video buffer ouput and GDI windowed
- * output.
- * ARGUMENTS
- * Client hands us a CSRSS_CONSOLE_HARDWARE_STATE
- * object. We use the same object to Request.
- * NOTE
- * ConsoleHwState has the correct size to be compatible
- * with NT's, but values are not.
+ * DESCRIPTION
+ * Set/Get the value of the HardwareState and switch
+ * between direct video buffer ouput and GDI windowed
+ * output.
+ * ARGUMENTS
+ * Client hands us a CSRSS_CONSOLE_HARDWARE_STATE
+ * object. We use the same object to Request.
+ * NOTE
+ * ConsoleHwState has the correct size to be compatible
+ * with NT's, but values are not.
*/
static NTSTATUS FASTCALL
SetConsoleHardwareState(PCSRSS_CONSOLE Console, DWORD ConsoleHwState)
@@ -650,37 +648,23 @@
CSR_API(SrvGetConsoleHardwareState)
{
- PCSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleHardwareStateRequest;
- PCSRSS_CONSOLE Console;
- NTSTATUS Status;
+ NTSTATUS Status;
+ PCSRSS_CONSOLE_HW_STATE ConsoleHardwareStateRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleHardwareStateRequest;
+ PCSRSS_CONSOLE Console;
DPRINT("SrvGetConsoleHardwareState\n");
- Status = ConioLockConsole(CsrGetClientThread()->Process,
+ Status =
ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
ConsoleHardwareStateRequest->ConsoleHandle,
&Console,
GENERIC_READ);
- if (! NT_SUCCESS(Status))
- {
- DPRINT1("Failed to get console handle in SetConsoleHardwareState\n");
- return Status;
- }
-
- switch (ConsoleHardwareStateRequest->SetGet)
- {
- case CONSOLE_HARDWARE_STATE_GET:
- ConsoleHardwareStateRequest->State = Console->HardwareState;
- break;
-
- case CONSOLE_HARDWARE_STATE_SET:
- DPRINT("Setting console hardware state.\n");
- Status = SetConsoleHardwareState(Console,
ConsoleHardwareStateRequest->State);
- break;
-
- default:
- Status = STATUS_INVALID_PARAMETER_2; /* Client: (handle, [set_get], mode) */
- break;
- }
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to get console handle in
SrvGetConsoleHardwareState\n");
+ return Status;
+ }
+
+ ConsoleHardwareStateRequest->State = Console->HardwareState;
ConioUnlockConsole(Console);
@@ -689,37 +673,24 @@
CSR_API(SrvSetConsoleHardwareState)
{
- PCSRSS_SETGET_CONSOLE_HW_STATE ConsoleHardwareStateRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleHardwareStateRequest;
- PCSRSS_CONSOLE Console;
- NTSTATUS Status;
+ NTSTATUS Status;
+ PCSRSS_CONSOLE_HW_STATE ConsoleHardwareStateRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleHardwareStateRequest;
+ PCSRSS_CONSOLE Console;
DPRINT("SrvSetConsoleHardwareState\n");
- Status = ConioLockConsole(CsrGetClientThread()->Process,
+ Status =
ConioLockConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
ConsoleHardwareStateRequest->ConsoleHandle,
&Console,
GENERIC_READ);
- if (! NT_SUCCESS(Status))
- {
- DPRINT1("Failed to get console handle in SetConsoleHardwareState\n");
- return Status;
- }
-
- switch (ConsoleHardwareStateRequest->SetGet)
- {
- case CONSOLE_HARDWARE_STATE_GET:
- ConsoleHardwareStateRequest->State = Console->HardwareState;
- break;
-
- case CONSOLE_HARDWARE_STATE_SET:
- DPRINT("Setting console hardware state.\n");
- Status = SetConsoleHardwareState(Console,
ConsoleHardwareStateRequest->State);
- break;
-
- default:
- Status = STATUS_INVALID_PARAMETER_2; /* Client: (handle, [set_get], mode) */
- break;
- }
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to get console handle in
SrvSetConsoleHardwareState\n");
+ return Status;
+ }
+
+ DPRINT("Setting console hardware state.\n");
+ Status = SetConsoleHardwareState(Console, ConsoleHardwareStateRequest->State);
ConioUnlockConsole(Console);