Author: hbelusca
Date: Thu Dec 4 22:47:13 2014
New Revision: 65561
URL:
http://svn.reactos.org/svn/reactos?rev=65561&view=rev
Log:
[CONSRV]
- Give the process handle which creates the screenbuffer, to ConDrvCreateScreenBuffer.
- Few code refactoring.
Modified:
trunk/reactos/win32ss/user/winsrv/consrv/condrv/conoutput.c
trunk/reactos/win32ss/user/winsrv/consrv/condrv/console.c
trunk/reactos/win32ss/user/winsrv/consrv/condrv/graphics.c
trunk/reactos/win32ss/user/winsrv/consrv/condrv/text.c
trunk/reactos/win32ss/user/winsrv/consrv/conoutput.c
trunk/reactos/win32ss/user/winsrv/consrv/conoutput.h
Modified: trunk/reactos/win32ss/user/winsrv/consrv/condrv/conoutput.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/condrv/conoutput.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/condrv/conoutput.c [iso-8859-1] Thu Dec 4
22:47:13 2014
@@ -18,11 +18,13 @@
NTSTATUS
TEXTMODE_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
+ IN HANDLE ProcessHandle,
IN PTEXTMODE_BUFFER_INFO TextModeInfo);
NTSTATUS
GRAPHICS_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
+ IN HANDLE ProcessHandle,
IN PGRAPHICS_BUFFER_INFO GraphicsInfo);
VOID
@@ -33,7 +35,7 @@
NTSTATUS
CONSOLE_SCREEN_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
IN PCONSOLE_SCREEN_BUFFER_VTBL Vtbl,
IN SIZE_T Size)
{
@@ -77,7 +79,8 @@
// ConDrvCreateConsoleScreenBuffer
NTSTATUS
ConDrvCreateScreenBuffer(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
+ IN HANDLE ProcessHandle OPTIONAL,
IN ULONG BufferType,
IN PVOID ScreenBufferInfo)
{
@@ -89,14 +92,18 @@
return STATUS_INVALID_PARAMETER;
}
+ /* Use the current process if ProcessHandle is NULL */
+ if (ProcessHandle == NULL)
+ ProcessHandle = NtCurrentProcess();
+
if (BufferType == CONSOLE_TEXTMODE_BUFFER)
{
- Status = TEXTMODE_BUFFER_Initialize(Buffer, Console,
+ Status = TEXTMODE_BUFFER_Initialize(Buffer, Console, ProcessHandle,
(PTEXTMODE_BUFFER_INFO)ScreenBufferInfo);
}
else if (BufferType == CONSOLE_GRAPHICS_BUFFER)
{
- Status = GRAPHICS_BUFFER_Initialize(Buffer, Console,
+ Status = GRAPHICS_BUFFER_Initialize(Buffer, Console, ProcessHandle,
(PGRAPHICS_BUFFER_INFO)ScreenBufferInfo);
}
else
Modified: trunk/reactos/win32ss/user/winsrv/consrv/condrv/console.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/condrv/console.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/condrv/console.c [iso-8859-1] Thu Dec 4
22:47:13 2014
@@ -79,22 +79,24 @@
VOID NTAPI
ConDrvPause(PCONSOLE Console)
{
- if (!Console->UnpauseEvent)
- {
- NtCreateEvent(&Console->UnpauseEvent, EVENT_ALL_ACCESS,
- NULL, NotificationEvent, FALSE);
- }
+ /* In case we already have a pause event, just exit... */
+ if (Console->UnpauseEvent) return;
+
+ /* ... otherwise create it */
+ NtCreateEvent(&Console->UnpauseEvent, EVENT_ALL_ACCESS,
+ NULL, NotificationEvent, FALSE);
}
VOID NTAPI
ConDrvUnpause(PCONSOLE Console)
{
- if (Console->UnpauseEvent)
- {
- NtSetEvent(Console->UnpauseEvent, NULL);
- NtClose(Console->UnpauseEvent);
- Console->UnpauseEvent = NULL;
- }
+ /* In case we already freed the event, just exit... */
+ if (!Console->UnpauseEvent) return;
+
+ /* ... otherwise set and free it */
+ NtSetEvent(Console->UnpauseEvent, NULL);
+ NtClose(Console->UnpauseEvent);
+ Console->UnpauseEvent = NULL;
}
@@ -152,8 +154,6 @@
/* Initialize the console list and its lock */
InitializeListHead(&ConsoleList);
RtlInitializeResource(&ListLock);
-
- /* Should call LoadKeyboardLayout */
}
/* For resetting the terminal - defined in dummyterm.c */
@@ -229,6 +229,7 @@
InitializeListHead(&Console->BufferList);
Status = ConDrvCreateScreenBuffer(&NewBuffer,
Console,
+ NULL,
CONSOLE_TEXTMODE_BUFFER,
&ScreenBufferInfo);
if (!NT_SUCCESS(Status))
@@ -291,14 +292,12 @@
/* We failed, detach the terminal from the console */
Terminal->Console = NULL; // For the caller
ResetTerminal(Console);
-
return Status;
}
/* Copy buffer contents to screen */
// Terminal.Draw();
// ConioDrawConsole(Console);
- DPRINT("Console drawn\n");
DPRINT("Terminal initialization done\n");
return STATUS_SUCCESS;
@@ -364,8 +363,6 @@
*/
LeaveCriticalSection(&Console->Lock);
ConDrvUnlockConsoleList();
-
- /* FIXME: Send a terminate message to all the processes owning this console */
/* Deregister the terminal */
DPRINT("Deregister terminal\n");
Modified: trunk/reactos/win32ss/user/winsrv/consrv/condrv/graphics.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/condrv/graphics.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/condrv/graphics.c [iso-8859-1] Thu Dec 4
22:47:13 2014
@@ -33,7 +33,7 @@
NTSTATUS
CONSOLE_SCREEN_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
IN PCONSOLE_SCREEN_BUFFER_VTBL Vtbl,
IN SIZE_T Size);
VOID
@@ -42,7 +42,8 @@
NTSTATUS
GRAPHICS_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
+ IN HANDLE ProcessHandle,
IN PGRAPHICS_BUFFER_INFO GraphicsInfo)
{
NTSTATUS Status = STATUS_SUCCESS;
@@ -50,7 +51,6 @@
LARGE_INTEGER SectionSize;
ULONG ViewSize = 0;
- HANDLE ProcessHandle;
if (Buffer == NULL || Console == NULL || GraphicsInfo == NULL)
return STATUS_INVALID_PARAMETER;
@@ -69,7 +69,6 @@
* correctly the allocated resources when the client releases the
* screen buffer.
*/
- ProcessHandle = CsrGetClientThread()->Process->ProcessHandle;
NewBuffer->ClientProcess = ProcessHandle;
/* Get infos from the graphics buffer information structure */
Modified: trunk/reactos/win32ss/user/winsrv/consrv/condrv/text.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/condrv/text.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/condrv/text.c [iso-8859-1] Thu Dec 4
22:47:13 2014
@@ -51,7 +51,7 @@
NTSTATUS
CONSOLE_SCREEN_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
IN PCONSOLE_SCREEN_BUFFER_VTBL Vtbl,
IN SIZE_T Size);
VOID
@@ -60,11 +60,14 @@
NTSTATUS
TEXTMODE_BUFFER_Initialize(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
+ IN PCONSOLE Console,
+ IN HANDLE ProcessHandle,
IN PTEXTMODE_BUFFER_INFO TextModeInfo)
{
NTSTATUS Status = STATUS_SUCCESS;
PTEXTMODE_SCREEN_BUFFER NewBuffer = NULL;
+
+ UNREFERENCED_PARAMETER(ProcessHandle);
if (Console == NULL || Buffer == NULL || TextModeInfo == NULL)
return STATUS_INVALID_PARAMETER;
Modified: trunk/reactos/win32ss/user/winsrv/consrv/conoutput.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/conoutput.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/conoutput.c [iso-8859-1] Thu Dec 4 22:47:13
2014
@@ -169,7 +169,8 @@
{
NTSTATUS Status = STATUS_INVALID_PARAMETER;
PCONSOLE_CREATESCREENBUFFER CreateScreenBufferRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.CreateScreenBufferRequest;
- PCONSOLE_PROCESS_DATA ProcessData =
ConsoleGetPerProcessData(CsrGetClientThread()->Process);
+ PCSR_PROCESS Process = CsrGetClientThread()->Process;
+ PCONSOLE_PROCESS_DATA ProcessData = ConsoleGetPerProcessData(Process);
PCONSRV_CONSOLE Console;
PCONSOLE_SCREEN_BUFFER Buff;
@@ -253,6 +254,7 @@
Status = ConDrvCreateScreenBuffer(&Buff,
(PCONSOLE)Console,
+ Process->ProcessHandle,
CreateScreenBufferRequest->ScreenBufferType,
ScreenBufferInfo);
if (!NT_SUCCESS(Status)) goto Quit;
Modified: trunk/reactos/win32ss/user/winsrv/consrv/conoutput.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
==============================================================================
--- trunk/reactos/win32ss/user/winsrv/consrv/conoutput.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/winsrv/consrv/conoutput.h [iso-8859-1] Thu Dec 4 22:47:13
2014
@@ -34,9 +34,10 @@
ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
NTSTATUS ConDrvCreateScreenBuffer(OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN OUT PCONSOLE Console,
- IN ULONG BufferType,
- IN PVOID ScreenBufferInfo);
+ IN PCONSOLE Console,
+ IN HANDLE ProcessHandle OPTIONAL,
+ IN ULONG BufferType,
+ IN PVOID ScreenBufferInfo);
VOID NTAPI ConDrvDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
// VOID ConioSetActiveScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);