Author: hbelusca
Date: Fri Sep 5 21:06:36 2014
New Revision: 64042
URL:
http://svn.reactos.org/svn/reactos?rev=64042&view=rev
Log:
[CONSRV]: Code reorganization part 1.
Modified:
branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/coninput.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/conoutput.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.h
branches/condrv_restructure/win32ss/user/winsrv/consrv/conoutput.h
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/coninput.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/coninput.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/coninput.c [iso-8859-1]
Fri Sep 5 21:06:36 2014
@@ -178,7 +178,7 @@
return Status;
}
-VOID
+static VOID
PurgeInputBuffer(PCONSOLE Console)
{
PLIST_ENTRY CurrentEntry;
@@ -191,6 +191,36 @@
ConsoleFreeHeap(Event);
}
+ // CloseHandle(Console->InputBuffer.ActiveEvent);
+}
+
+NTSTATUS NTAPI
+ConDrvInitInputBuffer(IN PCONSOLE Console,
+ IN ULONG InputBufferSize)
+{
+ SECURITY_ATTRIBUTES SecurityAttributes;
+
+ ConSrvInitObject(&Console->InputBuffer.Header, INPUT_BUFFER, Console);
+
+ SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
+ SecurityAttributes.lpSecurityDescriptor = NULL;
+ SecurityAttributes.bInheritHandle = TRUE;
+
+ Console->InputBuffer.ActiveEvent = CreateEventW(&SecurityAttributes, TRUE,
FALSE, NULL);
+ if (Console->InputBuffer.ActiveEvent == NULL) return STATUS_UNSUCCESSFUL;
+
+ Console->InputBuffer.InputBufferSize = InputBufferSize;
+ InitializeListHead(&Console->InputBuffer.InputEvents);
+ Console->InputBuffer.Mode = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
+ ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT;
+
+ return STATUS_SUCCESS;
+}
+
+VOID NTAPI
+ConDrvDeinitInputBuffer(IN PCONSOLE Console)
+{
+ PurgeInputBuffer(Console);
CloseHandle(Console->InputBuffer.ActiveEvent);
}
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/conoutput.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/conoutput.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/conoutput.c [iso-8859-1]
Fri Sep 5 21:06:36 2014
@@ -115,7 +115,7 @@
ConioSetActiveScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
VOID NTAPI
-ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer)
+ConDrvDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer)
{
PCONSOLE Console = Buffer->Header.Console;
PCONSOLE_SCREEN_BUFFER NewBuffer;
@@ -190,7 +190,7 @@
/* If old buffer has no handles, it's now unreferenced */
if (Console->ActiveBuffer->Header.ReferenceCount == 0)
{
- ConioDeleteScreenBuffer(Console->ActiveBuffer);
+ ConDrvDeleteScreenBuffer(Console->ActiveBuffer);
}
/* Tie console to new buffer and signal the change to the frontend */
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c [iso-8859-1]
Fri Sep 5 21:06:36 2014
@@ -190,7 +190,6 @@
IN PCONSOLE_INFO ConsoleInfo)
{
NTSTATUS Status;
- SECURITY_ATTRIBUTES SecurityAttributes;
// CONSOLE_INFO CapturedConsoleInfo;
TEXTMODE_BUFFER_INFO ScreenBufferInfo;
PCONSOLE Console;
@@ -236,26 +235,15 @@
Console->ConsoleSize = ConsoleInfo->ConsoleSize;
Console->FixedSize = FALSE; // Value by default; is reseted by the terminals if
needed.
- /*
- * Initialize the input buffer
- */
- ConSrvInitObject(&Console->InputBuffer.Header, INPUT_BUFFER, Console);
-
- SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
- SecurityAttributes.lpSecurityDescriptor = NULL;
- SecurityAttributes.bInheritHandle = TRUE;
- Console->InputBuffer.ActiveEvent = CreateEventW(&SecurityAttributes, TRUE,
FALSE, NULL);
- if (NULL == Console->InputBuffer.ActiveEvent)
- {
+ /* Initialize the input buffer */
+ Status = ConDrvInitInputBuffer(Console, 0 /* ConsoleInfo->InputBufferSize */);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("ConDrvInitInputBuffer: failed, Status = 0x%08lx\n", Status);
DeleteCriticalSection(&Console->Lock);
ConsoleFreeHeap(Console);
- return STATUS_UNSUCCESSFUL;
- }
-
- Console->InputBuffer.InputBufferSize = 0; // FIXME!
- InitializeListHead(&Console->InputBuffer.InputEvents);
- Console->InputBuffer.Mode = ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT |
- ENABLE_ECHO_INPUT | ENABLE_MOUSE_INPUT;
+ return Status;
+ }
/* Set-up the code page */
Console->InputCodePage = Console->OutputCodePage = ConsoleInfo->CodePage;
@@ -275,7 +263,7 @@
if (!NT_SUCCESS(Status))
{
DPRINT1("ConDrvCreateScreenBuffer: failed, Status = 0x%08lx\n",
Status);
- CloseHandle(Console->InputBuffer.ActiveEvent);
+ ConDrvDeinitInputBuffer(Console);
DeleteCriticalSection(&Console->Lock);
ConsoleFreeHeap(Console);
return Status;
@@ -430,10 +418,10 @@
/* FIXME: Send a terminate message to all the processes owning this console */
- /* Cleanup the UI-oriented part */
- DPRINT("Deregister console\n");
+ /* Deregister the terminal */
+ DPRINT("Deregister terminal\n");
ConDrvDeregisterTerminal(Console);
- DPRINT("Console deregistered\n");
+ DPRINT("Terminal deregistered\n");
/***
* Check that the console is in terminating state before continuing
@@ -458,19 +446,18 @@
/* Remove the console from the list */
RemoveConsole(Console);
- /* Discard all entries in the input event queue */
- PurgeInputBuffer(Console);
-
/* Delete the last screen buffer */
- ConioDeleteScreenBuffer(Console->ActiveBuffer);
+ ConDrvDeleteScreenBuffer(Console->ActiveBuffer);
Console->ActiveBuffer = NULL;
if (!IsListEmpty(&Console->BufferList))
{
- DPRINT1("BUG: screen buffer list not empty\n");
- ASSERT(FALSE);
- }
-
- /**/ CloseHandle(Console->InputBuffer.ActiveEvent); /**/
+ /***ConDrvUnlockConsoleList();***/
+ ASSERTMSG("BUGBUGBUG!! screen buffer list not empty\n", FALSE);
+ }
+
+ /* Deinitialize the input buffer */
+ ConDrvDeinitInputBuffer(Console);
+
if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent);
ConsoleFreeUnicodeString(&Console->OriginalTitle);
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.h
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.h [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.h [iso-8859-1] Fri Sep
5 21:06:36 2014
@@ -9,4 +9,8 @@
#pragma once
-VOID PurgeInputBuffer(PCONSOLE Console);
+NTSTATUS NTAPI
+ConDrvInitInputBuffer(IN PCONSOLE Console,
+ IN ULONG InputBufferSize);
+VOID NTAPI
+ConDrvDeinitInputBuffer(IN PCONSOLE Console);
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/conoutput.h
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/conoutput.h [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/conoutput.h [iso-8859-1] Fri
Sep 5 21:06:36 2014
@@ -37,7 +37,7 @@
IN OUT PCONSOLE Console,
IN ULONG BufferType,
IN PVOID ScreenBufferInfo);
-VOID NTAPI ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
+VOID NTAPI ConDrvDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
// VOID ConioSetActiveScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
PCONSOLE_SCREEN_BUFFER