Author: hbelusca
Date: Sun Aug 31 14:04:03 2014
New Revision: 64011
URL:
http://svn.reactos.org/svn/reactos?rev=64011&view=rev
Log:
[CONSRV]: Continuing code refactoring of revisions 63866, 63867, 63868 and 63874.
Modified:
branches/condrv_restructure/win32ss/user/winsrv/consrv/alias.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/condrv/console.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/conoutput.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/console.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/console.h
branches/condrv_restructure/win32ss/user/winsrv/consrv/consrv.h
branches/condrv_restructure/win32ss/user/winsrv/consrv/frontendctl.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/terminal.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c
branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h
branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio_winsrv.h
branches/condrv_restructure/win32ss/user/winsrv/consrv/init.c
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/alias.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/alias.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/alias.c [iso-8859-1] Sun Aug 31
14:04:03 2014
@@ -34,7 +34,7 @@
BOOLEAN
-ConvertInputAnsiToUnicode(PCONSOLE Console,
+ConvertInputAnsiToUnicode(PCONSRV_CONSOLE Console,
PVOID Source,
USHORT SourceLength,
// BOOLEAN IsUnicode,
@@ -61,7 +61,7 @@
}
BOOLEAN
-ConvertInputUnicodeToAnsi(PCONSOLE Console,
+ConvertInputUnicodeToAnsi(PCONSRV_CONSOLE Console,
PVOID Source,
USHORT SourceLength,
// BOOLEAN IsAnsi,
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]
Sun Aug 31 14:04:03 2014
@@ -460,7 +460,6 @@
/* Discard all entries in the input event queue */
PurgeInputBuffer(Console);
- if (Console->LineBuffer) ConsoleFreeHeap(Console->LineBuffer);
/* Delete the last screen buffer */
ConioDeleteScreenBuffer(Console->ActiveBuffer);
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/coninput.c [iso-8859-1] Sun Aug
31 14:04:03 2014
@@ -158,7 +158,7 @@
IN ULONG NumEventsToWrite,
OUT PULONG NumEventsWritten OPTIONAL);
static NTSTATUS
-ConioAddInputEvents(PCONSOLE Console,
+ConioAddInputEvents(PCONSRV_CONSOLE Console,
PINPUT_RECORD InputRecords, // InputEvent
ULONG NumEventsToWrite,
PULONG NumEventsWritten,
@@ -177,7 +177,7 @@
// NumEventsWritten,
// AppendToEnd);
- Status = ConDrvWriteConsoleInput(Console,
+ Status = ConDrvWriteConsoleInput((PCONSOLE)Console,
&Console->InputBuffer,
AppendToEnd,
InputRecords,
@@ -192,7 +192,7 @@
/* FIXME: This function can be called by CONDRV, in ConioResizeBuffer() in text.c */
NTSTATUS
-ConioProcessInputEvent(PCONSOLE Console,
+ConioProcessInputEvent(PCONSRV_CONSOLE Console,
PINPUT_RECORD InputEvent)
{
ULONG NumEventsWritten;
@@ -213,13 +213,14 @@
if (CreateWaitBlock)
{
PGET_INPUT_INFO CapturedInputInfo;
+ PCONSRV_CONSOLE Console =
(PCONSRV_CONSOLE)InputInfo->InputBuffer->Header.Console;
CapturedInputInfo = ConsoleAllocHeap(0, sizeof(GET_INPUT_INFO));
if (!CapturedInputInfo) return STATUS_NO_MEMORY;
RtlMoveMemory(CapturedInputInfo, InputInfo, sizeof(GET_INPUT_INFO));
- if
(!CsrCreateWait(&InputInfo->InputBuffer->Header.Console->ReadWaitQueue,
+ if (!CsrCreateWait(&Console->ReadWaitQueue,
WaitFunction,
InputInfo->CallingThread,
ApiMessage,
@@ -728,7 +729,7 @@
/* Now, add the events */
NumEventsWritten = 0;
- Status = ConioAddInputEvents(InputBuffer->Header.Console,
+ Status = ConioAddInputEvents((PCONSRV_CONSOLE)InputBuffer->Header.Console,
// InputBuffer,
InputRecord,
WriteInputRequest->NumRecords,
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/conoutput.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/conoutput.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/conoutput.c [iso-8859-1] Sun
Aug 31 14:04:03 2014
@@ -252,7 +252,7 @@
}
Status = ConDrvCreateScreenBuffer(&Buff,
- Console,
+ (PCONSOLE)Console,
CreateScreenBufferRequest->ScreenBufferType,
ScreenBufferInfo);
if (!NT_SUCCESS(Status)) goto Quit;
@@ -417,7 +417,9 @@
{
if (CreateWaitBlock)
{
- if (!CsrCreateWait(&ScreenBuffer->Header.Console->WriteWaitQueue,
+ PCONSRV_CONSOLE Console = (PCONSRV_CONSOLE)ScreenBuffer->Header.Console;
+
+ if (!CsrCreateWait(&Console->WriteWaitQueue,
WriteConsoleThread,
ClientThread,
ApiMessage,
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/console.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/console.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/console.c [iso-8859-1] Sun Aug
31 14:04:03 2014
@@ -472,6 +472,9 @@
/* Remove the console from the list */
RemoveConsoleByPointer(Console);
+
+ /* Clean the Input Line Discipline */
+ if (Console->LineBuffer) ConsoleFreeHeap(Console->LineBuffer);
/* Clean aliases and history */
IntDeleteAllAliases(Console);
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/console.h
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/console.h [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/console.h [iso-8859-1] Sun Aug
31 14:04:03 2014
@@ -13,22 +13,22 @@
NTSTATUS NTAPI
ConSrvInitConsole(OUT PHANDLE NewConsoleHandle,
- OUT struct _CONSOLE** /* PCONSOLE* */ NewConsole,
+ OUT struct _CONSRV_CONSOLE** /* PCONSRV_CONSOLE* */ NewConsole,
IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
IN ULONG ConsoleLeaderProcessId);
-VOID NTAPI ConSrvDeleteConsole(struct _CONSOLE* /* PCONSOLE */ Console);
+VOID NTAPI ConSrvDeleteConsole(struct _CONSRV_CONSOLE* /* PCONSRV_CONSOLE */ Console);
NTSTATUS
ConSrvGetConsole(IN PCONSOLE_PROCESS_DATA ProcessData,
- OUT struct _CONSOLE** /* PCONSOLE* */ Console,
+ OUT struct _CONSRV_CONSOLE** /* PCONSRV_CONSOLE* */ Console,
IN BOOLEAN LockConsole);
VOID
-ConSrvReleaseConsole(IN struct _CONSOLE* /* PCONSOLE */ Console,
+ConSrvReleaseConsole(IN struct _CONSRV_CONSOLE* /* PCONSRV_CONSOLE */ Console,
IN BOOLEAN WasConsoleLocked);
BOOLEAN NTAPI
-ConSrvValidateConsole(OUT struct _CONSOLE** /* PCONSOLE* */ Console,
+ConSrvValidateConsole(OUT struct _CONSRV_CONSOLE** /* PCONSRV_CONSOLE* */ Console,
IN HANDLE ConsoleHandle,
IN CONSOLE_STATE ExpectedState,
IN BOOLEAN LockConsole);
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/consrv.h
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/consrv.h [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/consrv.h [iso-8859-1] Sun Aug
31 14:04:03 2014
@@ -66,8 +66,16 @@
LPTHREAD_START_ROUTINE PropDispatcher; // We hold the property dialog handler there,
till all the GUI thingie moves out from CSRSS.
} CONSOLE_PROCESS_DATA, *PCONSOLE_PROCESS_DATA;
+
+// Helper for code refactoring
+// #define USE_NEW_CONSOLE_WAY
+
+#ifndef USE_NEW_CONSOLE_WAY
#include "include/conio.h"
-// #include "include/conio_winsrv.h"
+#else
+#include "include/conio_winsrv.h"
+#endif
+
#include "include/console.h"
#include "include/settings.h"
#include "include/term.h"
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/frontendctl.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/frontendctl.c [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/frontendctl.c [iso-8859-1] Sun
Aug 31 14:04:03 2014
@@ -143,7 +143,7 @@
TRUE);
if (!NT_SUCCESS(Status)) return Status;
- Console = Buff->Header.Console;
+ Console = (PCONSRV_CONSOLE)Buff->Header.Console;
if (TermSetDisplayMode(Console, SetDisplayModeRequest->DisplayMode))
{
@@ -163,14 +163,14 @@
{
NTSTATUS Status;
PCONSOLE_GETLARGESTWINDOWSIZE GetLargestWindowSizeRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetLargestWindowSizeRequest;
- PCONSOLE_SCREEN_BUFFER Buff;
- PCONSRV_CONSOLE Console;
+ PCONSOLE /*PCONSRV_CONSOLE*/ Console;
+ PCONSOLE_SCREEN_BUFFER Buff;
Status =
ConSrvGetTextModeBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
- GetLargestWindowSizeRequest->OutputHandle,
- &Buff,
- GENERIC_READ,
- TRUE);
+ GetLargestWindowSizeRequest->OutputHandle,
+ &Buff,
+ GENERIC_READ,
+ TRUE);
if (!NT_SUCCESS(Status)) return Status;
Console = Buff->Header.Console;
@@ -184,7 +184,7 @@
{
NTSTATUS Status;
PCONSOLE_SHOWCURSOR ShowCursorRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ShowCursorRequest;
- PCONSRV_CONSOLE Console;
+ PCONSOLE /*PCONSRV_CONSOLE*/ Console;
PCONSOLE_SCREEN_BUFFER Buff;
Status =
ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
@@ -220,7 +220,7 @@
TRUE);
if (!NT_SUCCESS(Status)) return Status;
- Console = Buff->Header.Console;
+ Console = (PCONSRV_CONSOLE)Buff->Header.Console;
Success = TermSetMouseCursor(Console, SetCursorRequest->CursorHandle);
@@ -242,7 +242,7 @@
TRUE);
if (!NT_SUCCESS(Status)) return Status;
- Console = Buff->Header.Console;
+ Console = (PCONSRV_CONSOLE)Buff->Header.Console;
MenuControlRequest->MenuHandle = TermMenuControl(Console,
MenuControlRequest->CmdIdLow,
@@ -275,7 +275,8 @@
PCONSOLE_GETWINDOW GetWindowRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetWindowRequest;
PCONSRV_CONSOLE Console;
- Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
&Console, TRUE);
+ Status =
ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+ &Console, TRUE);
if (!NT_SUCCESS(Status)) return Status;
GetWindowRequest->WindowHandle = TermGetConsoleWindowHandle(Console);
@@ -290,7 +291,8 @@
PCONSOLE_SETICON SetIconRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetIconRequest;
PCONSRV_CONSOLE Console;
- Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
&Console, TRUE);
+ Status =
ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+ &Console, TRUE);
if (!NT_SUCCESS(Status)) return Status;
Status = (TermChangeIcon(Console, SetIconRequest->IconHandle)
@@ -307,7 +309,8 @@
PCONSOLE_GETSELECTIONINFO GetSelectionInfoRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetSelectionInfoRequest;
PCONSRV_CONSOLE Console;
- Status = ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
&Console, TRUE);
+ Status =
ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+ &Console, TRUE);
if (!NT_SUCCESS(Status)) return Status;
Status = (TermGetSelectionInfo(Console, &GetSelectionInfoRequest->Info)
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/terminal.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
---
branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/terminal.c [iso-8859-1]
(original)
+++
branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/terminal.c [iso-8859-1]
Sun Aug 31 14:04:03 2014
@@ -260,7 +260,7 @@
static NTSTATUS NTAPI
ConSrvTermInitTerminal(IN OUT PTERMINAL This,
- IN PCONSOLE Console)
+ IN PCONSOLE Console)
{
NTSTATUS Status;
PFRONTEND FrontEnd = This->Data;
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
---
branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c [iso-8859-1]
(original)
+++
branches/condrv_restructure/win32ss/user/winsrv/consrv/frontends/tui/tuiterm.c [iso-8859-1]
Sun Aug 31 14:04:03 2014
@@ -12,7 +12,7 @@
#ifdef TUITERM_COMPILE
#include "consrv.h"
-#include "include/conio.h"
+// #include "include/conio.h"
#include "include/console.h"
#include "include/settings.h"
#include "tuiterm.h"
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h [iso-8859-1]
(original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio.h [iso-8859-1]
Sun Aug 31 14:04:03 2014
@@ -11,6 +11,22 @@
#pragma once
#include "rect.h"
+
+// This is ALMOST a HACK!!!!!!!
+// Helpers for code refactoring
+#ifdef USE_NEW_CONSOLE_WAY
+
+#define _CONSRV_CONSOLE _WINSRV_CONSOLE
+#define CONSRV_CONSOLE WINSRV_CONSOLE
+#define PCONSRV_CONSOLE PWINSRV_CONSOLE
+
+#else
+
+#define _CONSRV_CONSOLE _CONSOLE
+#define CONSRV_CONSOLE CONSOLE
+#define PCONSRV_CONSOLE PCONSOLE
+
+#endif
/* Default attributes */
#define DEFAULT_SCREEN_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
@@ -277,7 +293,9 @@
// HACK!!
struct _CONSOLE;
/* HACK: */ typedef struct _CONSOLE *PCONSOLE;
+#ifndef USE_NEW_CONSOLE_WAY
#include "conio_winsrv.h"
+#endif
typedef struct _CONSOLE
{
@@ -285,7 +303,9 @@
LONG ReferenceCount; /* Is incremented each time a handle to
something in the console (a screen-buffer or the input buffer of this console) gets
referenced */
CRITICAL_SECTION Lock;
+#ifndef USE_NEW_CONSOLE_WAY
/**/WINSRV_CONSOLE;/**/ // HACK HACK!!
+#endif
CONSOLE_STATE State; /* State of the console */
TERMINAL TermIFace; /* Frontend-specific interface */
@@ -325,8 +345,8 @@
/* conoutput.c */
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
-VOID ConioDrawConsole(PCONSOLE Console);
-NTSTATUS ConioResizeBuffer(PCONSOLE Console,
+VOID ConioDrawConsole(PCONSOLE /*PCONSRV_CONSOLE*/ Console);
+NTSTATUS ConioResizeBuffer(PCONSOLE /*PCONSRV_CONSOLE*/ Console,
PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
COORD Size);
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio_winsrv.h
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
---
branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio_winsrv.h [iso-8859-1]
(original)
+++
branches/condrv_restructure/win32ss/user/winsrv/consrv/include/conio_winsrv.h [iso-8859-1]
Sun Aug 31 14:04:03 2014
@@ -14,14 +14,19 @@
// This is ALMOST a HACK!!!!!!!
// Helpers for code refactoring
+#ifdef USE_NEW_CONSOLE_WAY
+
+#define _CONSRV_CONSOLE _WINSRV_CONSOLE
+#define CONSRV_CONSOLE WINSRV_CONSOLE
+#define PCONSRV_CONSOLE PWINSRV_CONSOLE
+
+#else
+
#define _CONSRV_CONSOLE _CONSOLE
#define CONSRV_CONSOLE CONSOLE
#define PCONSRV_CONSOLE PCONSOLE
-// #define _CONSRV_CONSOLE _WINSRV_CONSOLE
-// #define CONSRV_CONSOLE WINSRV_CONSOLE
-// #define PCONSRV_CONSOLE PWINSRV_CONSOLE
-
+#endif
#define CSR_DEFAULT_CURSOR_SIZE 25
@@ -33,6 +38,12 @@
} CHAR_CELL, *PCHAR_CELL;
C_ASSERT(sizeof(CHAR_CELL) == 2);
+// HACK!!
+struct _WINSRV_CONSOLE;
+/* HACK: */ typedef struct _WINSRV_CONSOLE *PWINSRV_CONSOLE;
+#ifdef USE_NEW_CONSOLE_WAY
+#include "conio.h"
+#endif
typedef struct _FRONTEND FRONTEND, *PFRONTEND;
/* HACK: */ typedef struct _CONSOLE_INFO *PCONSOLE_INFO;
@@ -118,8 +129,10 @@
{
/******************************* Console Set-up *******************************/
/* This **MUST** be FIRST!! */
- // CONSOLE;
+#ifdef USE_NEW_CONSOLE_WAY
+ CONSOLE;
// PCONSOLE Console;
+#endif
// LONG ReferenceCount; /* Is incremented each time a handle to
something in the console (a screen-buffer or the input buffer of this console) gets
referenced */
// CRITICAL_SECTION Lock;
@@ -172,7 +185,7 @@
LIST_ENTRY PopupWindows; /*List of popup windows */
COLORREF Colors[16]; /* Colour palette */
-} WINSRV_CONSOLE, *PWINSRV_CONSOLE;
+} WINSRV_CONSOLE; // , *PWINSRV_CONSOLE;
/* console.c */
VOID ConioPause(PCONSRV_CONSOLE Console, UINT Flags);
@@ -199,8 +212,8 @@
/* conoutput.c */
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
-VOID ConioDrawConsole(PCONSRV_CONSOLE Console);
-NTSTATUS ConioResizeBuffer(PCONSRV_CONSOLE Console,
+VOID ConioDrawConsole(PCONSOLE /*PCONSRV_CONSOLE*/ Console);
+NTSTATUS ConioResizeBuffer(PCONSOLE /*PCONSRV_CONSOLE*/ Console,
PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
COORD Size);
Modified: branches/condrv_restructure/win32ss/user/winsrv/consrv/init.c
URL:
http://svn.reactos.org/svn/reactos/branches/condrv_restructure/win32ss/user…
==============================================================================
--- branches/condrv_restructure/win32ss/user/winsrv/consrv/init.c [iso-8859-1] (original)
+++ branches/condrv_restructure/win32ss/user/winsrv/consrv/init.c [iso-8859-1] Sun Aug 31
14:04:03 2014
@@ -380,7 +380,7 @@
if (TargetProcessData->ConsoleApp /* && SourceProcessData->ConsoleApp
*/)
{
PCONSOLE_PROCESS_DATA SourceProcessData =
ConsoleGetPerProcessData(SourceProcess);
- PCONSOLE SourceConsole;
+ PCONSRV_CONSOLE SourceConsole;
/* Validate and lock the parent's console */
if (ConSrvValidateConsole(&SourceConsole,