Author: hbelusca
Date: Sun Apr 7 23:18:59 2013
New Revision: 58717
URL:
http://svn.reactos.org/svn/reactos?rev=58717&view=rev
Log:
[CONSRV]
Code reorganization. Common functions declarations, shared between the console server and
the frontends, are put inside a include/ subdirectory. Functions needed only for the
console server are in the usual root directory. Functions used only for the frontends are
in their corresponding directories in under frontends/.
Added:
branches/ros-csrss/win32ss/user/consrv/api.h (with props)
branches/ros-csrss/win32ss/user/consrv/coninput.h (with props)
branches/ros-csrss/win32ss/user/consrv/conoutput.h (with props)
branches/ros-csrss/win32ss/user/consrv/handle.h (with props)
branches/ros-csrss/win32ss/user/consrv/include/
branches/ros-csrss/win32ss/user/consrv/include/conio.h
- copied, changed from r58689, branches/ros-csrss/win32ss/user/consrv/conio.h
branches/ros-csrss/win32ss/user/consrv/include/console.h
- copied, changed from r58689, branches/ros-csrss/win32ss/user/consrv/console.h
branches/ros-csrss/win32ss/user/consrv/include/settings.h
- copied, changed from r58689, branches/ros-csrss/win32ss/user/consrv/settings.h
branches/ros-csrss/win32ss/user/consrv/procinit.h (with props)
Removed:
branches/ros-csrss/win32ss/user/consrv/settings.h
Modified:
branches/ros-csrss/win32ss/user/consrv/alias.c
branches/ros-csrss/win32ss/user/consrv/alias.h
branches/ros-csrss/win32ss/user/consrv/coninput.c
branches/ros-csrss/win32ss/user/consrv/conio.h
branches/ros-csrss/win32ss/user/consrv/conoutput.c
branches/ros-csrss/win32ss/user/consrv/console.c
branches/ros-csrss/win32ss/user/consrv/console.h
branches/ros-csrss/win32ss/user/consrv/consrv.h
branches/ros-csrss/win32ss/user/consrv/frontends/gui/consolecpl.h
branches/ros-csrss/win32ss/user/consrv/frontends/gui/guisettings.c
branches/ros-csrss/win32ss/user/consrv/frontends/gui/guisettings.h
branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c
branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.h
branches/ros-csrss/win32ss/user/consrv/frontends/tui/tuiterm.c
branches/ros-csrss/win32ss/user/consrv/frontends/tui/tuiterm.h
branches/ros-csrss/win32ss/user/consrv/handle.c
branches/ros-csrss/win32ss/user/consrv/init.c
branches/ros-csrss/win32ss/user/consrv/lineinput.c
branches/ros-csrss/win32ss/user/consrv/settings.c
Modified: branches/ros-csrss/win32ss/user/consrv/alias.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/a…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/alias.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/alias.c [iso-8859-1] Sun Apr 7 23:18:59 2013
@@ -10,7 +10,8 @@
/* INCLUDES *******************************************************************/
#include "consrv.h"
-#include "conio.h"
+#include "console.h"
+#include "include/conio.h"
#define NDEBUG
#include <debug.h>
@@ -254,12 +255,12 @@
}
VOID
-IntDeleteAllAliases(PALIAS_HEADER RootHeader)
+IntDeleteAllAliases(PCONSOLE Console)
{
PALIAS_HEADER Header, NextHeader;
PALIAS_ENTRY Entry, NextEntry;
- for (Header = RootHeader; Header; Header = NextHeader)
+ for (Header = Console->Aliases; Header; Header = NextHeader)
{
NextHeader = Header->Next;
for (Entry = Header->Data; Entry; Entry = NextEntry)
Modified: branches/ros-csrss/win32ss/user/consrv/alias.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/a…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/alias.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/alias.h [iso-8859-1] Sun Apr 7 23:18:59 2013
@@ -9,6 +9,6 @@
#pragma once
-VOID IntDeleteAllAliases(struct _ALIAS_HEADER *RootHeader);
+VOID IntDeleteAllAliases(PCONSOLE Console);
/* EOF */
Added: branches/ros-csrss/win32ss/user/consrv/api.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/a…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/api.h (added)
+++ branches/ros-csrss/win32ss/user/consrv/api.h [iso-8859-1] Sun Apr 7 23:18:59 2013
@@ -1,0 +1,77 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Console Server DLL
+ * FILE: win32ss/user/consrv/api.h
+ * PURPOSE: Public server APIs definitions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+#pragma once
+
+/* alias.c */
+CSR_API(SrvAddConsoleAlias);
+CSR_API(SrvGetConsoleAlias);
+CSR_API(SrvGetConsoleAliases);
+CSR_API(SrvGetConsoleAliasesLength);
+CSR_API(SrvGetConsoleAliasExes);
+CSR_API(SrvGetConsoleAliasExesLength);
+
+/* coninput.c */
+CSR_API(SrvGetConsoleInput);
+CSR_API(SrvWriteConsoleInput);
+CSR_API(SrvReadConsole);
+CSR_API(SrvFlushConsoleInputBuffer);
+CSR_API(SrvGetConsoleNumberOfInputEvents);
+
+/* conoutput.c */
+CSR_API(SrvReadConsoleOutput);
+CSR_API(SrvWriteConsoleOutput);
+CSR_API(SrvReadConsoleOutputString);
+CSR_API(SrvWriteConsoleOutputString);
+CSR_API(SrvFillConsoleOutput);
+CSR_API(SrvWriteConsole);
+CSR_API(SrvSetConsoleCursorPosition);
+CSR_API(SrvGetConsoleCursorInfo);
+CSR_API(SrvSetConsoleCursorInfo);
+CSR_API(SrvSetConsoleTextAttribute);
+CSR_API(SrvCreateConsoleScreenBuffer);
+CSR_API(SrvGetConsoleScreenBufferInfo);
+CSR_API(SrvSetConsoleActiveScreenBuffer);
+CSR_API(SrvScrollConsoleScreenBuffer);
+CSR_API(SrvSetConsoleScreenBufferSize);
+
+/* console.c */
+CSR_API(SrvOpenConsole);
+CSR_API(SrvAllocConsole);
+CSR_API(SrvAttachConsole);
+CSR_API(SrvFreeConsole);
+CSR_API(SrvSetConsoleMode);
+CSR_API(SrvGetConsoleMode);
+CSR_API(SrvSetConsoleTitle);
+CSR_API(SrvGetConsoleTitle);
+CSR_API(SrvGetConsoleHardwareState);
+CSR_API(SrvSetConsoleHardwareState);
+CSR_API(SrvGetConsoleDisplayMode);
+CSR_API(SrvSetConsoleDisplayMode);
+CSR_API(SrvGetConsoleWindow);
+CSR_API(SrvSetConsoleIcon);
+CSR_API(SrvGetConsoleCP);
+CSR_API(SrvSetConsoleCP);
+CSR_API(SrvGetConsoleProcessList);
+CSR_API(SrvGenerateConsoleCtrlEvent);
+CSR_API(SrvGetConsoleSelectionInfo);
+
+/* handle.c */
+CSR_API(SrvCloseHandle);
+CSR_API(SrvVerifyConsoleIoHandle);
+CSR_API(SrvDuplicateHandle);
+
+/* lineinput.c */
+CSR_API(SrvGetConsoleCommandHistoryLength);
+CSR_API(SrvGetConsoleCommandHistory);
+CSR_API(SrvExpungeConsoleCommandHistory);
+CSR_API(SrvSetConsoleNumberOfCommands);
+CSR_API(SrvGetConsoleHistory);
+CSR_API(SrvSetConsoleHistory);
+
+/* EOF */
Propchange: branches/ros-csrss/win32ss/user/consrv/api.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/ros-csrss/win32ss/user/consrv/coninput.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/coninput.c [iso-8859-1] Sun Apr 7 23:18:59
2013
@@ -2,14 +2,16 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/coninput.c
- * PURPOSE: Console I/O functions
- * PROGRAMMERS:
+ * PURPOSE: Console Input functions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
/* INCLUDES *******************************************************************/
#include "consrv.h"
+#include "include/conio.h"
#include "conio.h"
+#include "handle.h"
#include "lineinput.h"
#define NDEBUG
@@ -18,17 +20,32 @@
/* GLOBALS ********************************************************************/
+#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
+ ConSrvGetObject((ProcessData), (Handle), (PCONSOLE_IO_OBJECT*)(Ptr), NULL, \
+ (Access), (LockConsole), INPUT_BUFFER)
+#define ConSrvGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access,
LockConsole) \
+ ConSrvGetObject((ProcessData), (Handle), (PCONSOLE_IO_OBJECT*)(Ptr), (Entry),
\
+ (Access), (LockConsole), INPUT_BUFFER)
+#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked) \
+ ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
+
+
#define ConsoleInputUnicodeCharToAnsiChar(Console, dChar, sWChar) \
WideCharToMultiByte((Console)->CodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL)
#define ConsoleInputAnsiCharToUnicodeChar(Console, dWChar, sChar) \
MultiByteToWideChar((Console)->CodePage, 0, (sChar), 1, (dWChar), 1)
+typedef struct ConsoleInput_t
+{
+ LIST_ENTRY ListEntry;
+ INPUT_RECORD InputEvent;
+} ConsoleInput;
typedef struct _GET_INPUT_INFO
{
PCSR_THREAD CallingThread; // The thread which called the input API.
- PCONSOLE_IO_HANDLE HandleEntry; // The handle data associated with the wait
thread.
+ PVOID HandleEntry; // The handle data associated with the wait
thread.
PCONSOLE_INPUT_BUFFER InputBuffer; // The input buffer corresponding to the
handle.
} GET_INPUT_INFO, *PGET_INPUT_INFO;
@@ -99,6 +116,22 @@
}
return STATUS_SUCCESS;
+}
+
+VOID FASTCALL
+PurgeInputBuffer(PCONSOLE Console)
+{
+ PLIST_ENTRY CurrentEntry;
+ ConsoleInput* Event;
+
+ while (!IsListEmpty(&Console->InputBuffer.InputEvents))
+ {
+ CurrentEntry = RemoveHeadList(&Console->InputBuffer.InputEvents);
+ Event = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry);
+ RtlFreeHeap(ConSrvHeap, 0, Event);
+ }
+
+ CloseHandle(Console->InputBuffer.ActiveEvent);
}
static DWORD FASTCALL
@@ -331,7 +364,7 @@
PCONSOLE_GETINPUT GetInputRequest =
&((PCONSOLE_API_MESSAGE)WaitApiMessage)->Data.GetInputRequest;
PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext;
- PCONSOLE_IO_HANDLE InputHandle = (PCONSOLE_IO_HANDLE)WaitArgument2;
+ PVOID InputHandle = WaitArgument2;
DPRINT1("ReadInputBufferThread - WaitContext = 0x%p, WaitArgument1 = 0x%p,
WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2,
WaitFlags);
@@ -464,7 +497,7 @@
NTSTATUS Status;
PGET_INPUT_INFO InputInfo = (PGET_INPUT_INFO)WaitContext;
- PCONSOLE_IO_HANDLE InputHandle = (PCONSOLE_IO_HANDLE)WaitArgument2;
+ PVOID InputHandle = WaitArgument2;
DPRINT1("ReadCharsThread - WaitContext = 0x%p, WaitArgument1 = 0x%p,
WaitArgument2 = 0x%p, WaitFlags = %lu\n", WaitContext, WaitArgument1, WaitArgument2,
WaitFlags);
@@ -676,7 +709,7 @@
NTSTATUS Status;
PCONSOLE_READCONSOLE ReadConsoleRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ReadConsoleRequest;
PCONSOLE_PROCESS_DATA ProcessData =
ConsoleGetPerProcessData(CsrGetClientThread()->Process);
- PCONSOLE_IO_HANDLE HandleEntry;
+ PVOID HandleEntry;
PCONSOLE_INPUT_BUFFER InputBuffer;
GET_INPUT_INFO InputInfo;
@@ -721,7 +754,7 @@
NTSTATUS Status;
PCONSOLE_GETINPUT GetInputRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.GetInputRequest;
PCONSOLE_PROCESS_DATA ProcessData =
ConsoleGetPerProcessData(CsrGetClientThread()->Process);
- PCONSOLE_IO_HANDLE HandleEntry;
+ PVOID HandleEntry;
PCONSOLE_INPUT_BUFFER InputBuffer;
GET_INPUT_INFO InputInfo;
Added: branches/ros-csrss/win32ss/user/consrv/coninput.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/coninput.h (added)
+++ branches/ros-csrss/win32ss/user/consrv/coninput.h [iso-8859-1] Sun Apr 7 23:18:59
2013
@@ -1,0 +1,13 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Console Server DLL
+ * FILE: win32ss/user/consrv/coninput.h
+ * PURPOSE: Console Input functions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+#pragma once
+
+VOID FASTCALL PurgeInputBuffer(PCONSOLE Console);
+
+/* EOF */
Propchange: branches/ros-csrss/win32ss/user/consrv/coninput.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/ros-csrss/win32ss/user/consrv/conio.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] Sun Apr 7 23:18:59 2013
@@ -2,124 +2,13 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/conio.h
- * PURPOSE: Internal console I/O interface
- * PROGRAMMERS:
+ * PURPOSE: Internal Console I/O Interface
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#pragma once
-#define CSR_DEFAULT_CURSOR_SIZE 25
-#define CURSOR_BLINK_TIME 500
-
-/* Default attributes */
-#define DEFAULT_SCREEN_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
-#define DEFAULT_POPUP_ATTRIB (FOREGROUND_BLUE | FOREGROUND_RED | \
- BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED |
BACKGROUND_INTENSITY)
-
-
-/************************************************************************
- * Screen buffer structure represents the win32 screen buffer object. *
- * Internally, the portion of the buffer being shown CAN loop past the *
- * bottom of the virtual buffer and wrap around to the top. Win32 does *
- * not do this. I decided to do this because it eliminates the need to *
- * do a massive memcpy() to scroll the contents of the buffer up to *
- * scroll the screen on output, instead I just shift down the position *
- * to be displayed, and let it wrap around to the top again. *
- * The VirtualY member keeps track of the top Y coord that win32 *
- * clients THINK is currently being displayed, because they think that *
- * when the display reaches the bottom of the buffer and another line *
- * being printed causes another line to scroll down, that the buffer IS *
- * memcpy()'s up, and the bottom of the buffer is still displayed, but *
- * internally, I just wrap back to the top of the buffer. *
- ************************************************************************/
-
-typedef struct _CONSOLE_SCREEN_BUFFER
-{
- Object_t Header; /* Object header */
- LIST_ENTRY ListEntry; /* Entry in console's list of buffers */
-
- BYTE *Buffer; /* CHAR_INFO */ /* Pointer to screen buffer */
-
- COORD ScreenBufferSize; /* Size of this screen buffer */
- COORD CursorPosition; /* Current cursor position */
-
- USHORT ShowX, ShowY; /* Beginning offset for the actual display area */
- USHORT VirtualY; /* Top row of buffer being displayed, reported to
callers */
-
- BOOLEAN CursorBlinkOn;
- BOOLEAN ForceCursorOff;
- ULONG CursorSize;
- CONSOLE_CURSOR_INFO CursorInfo; // FIXME: Keep this member or not ??
-
- WORD ScreenDefaultAttrib; /* Default screen char attribute */
- WORD PopupDefaultAttrib; /* Default popup char attribute */
- USHORT Mode;
- ULONG DisplayMode;
-} CONSOLE_SCREEN_BUFFER, *PCONSOLE_SCREEN_BUFFER;
-
-typedef struct _CONSOLE_INPUT_BUFFER
-{
- Object_t Header; /* Object header */
-
- ULONG InputBufferSize; /* Size of this input buffer */
- LIST_ENTRY InputEvents; /* List head for input event queue */
- HANDLE ActiveEvent; /* Event set when an input event is added in its
queue */
- LIST_ENTRY ReadWaitQueue; /* List head for the queue of read wait blocks */
-
- USHORT Mode; /* Console Input Buffer mode flags */
-} CONSOLE_INPUT_BUFFER, *PCONSOLE_INPUT_BUFFER;
-
-typedef struct ConsoleInput_t
-{
- LIST_ENTRY ListEntry;
- INPUT_RECORD InputEvent;
-} ConsoleInput;
-
-typedef struct _FRONTEND_VTBL
-{
- /*
- * Internal interface (functions called by the console server only)
- */
- VOID (WINAPI *CleanupConsole)(struct _CONSOLE* Console);
- VOID (WINAPI *WriteStream)(struct _CONSOLE* Console,
- SMALL_RECT* Block,
- LONG CursorStartX,
- LONG CursorStartY,
- UINT ScrolledLines,
- CHAR *Buffer,
- UINT Length);
- VOID (WINAPI *DrawRegion)(struct _CONSOLE* Console,
- SMALL_RECT* Region);
- BOOL (WINAPI *SetCursorInfo)(struct _CONSOLE* Console,
- PCONSOLE_SCREEN_BUFFER ScreenBuffer);
- BOOL (WINAPI *SetScreenInfo)(struct _CONSOLE* Console,
- PCONSOLE_SCREEN_BUFFER ScreenBuffer,
- UINT OldCursorX,
- UINT OldCursorY);
- BOOL (WINAPI *UpdateScreenInfo)(struct _CONSOLE* Console,
- PCONSOLE_SCREEN_BUFFER ScreenBuffer);
- NTSTATUS (WINAPI *ResizeBuffer)(struct _CONSOLE* Console,
- PCONSOLE_SCREEN_BUFFER ScreenBuffer,
- COORD Size);
- VOID (WINAPI *ResizeTerminal)(struct _CONSOLE* Console);
- BOOL (WINAPI *ProcessKeyCallback)(struct _CONSOLE* Console,
- MSG* msg,
- BYTE KeyStateMenu,
- DWORD ShiftState,
- UINT VirtualKeyCode,
- BOOL Down);
- VOID (WINAPI *RefreshInternalInfo)(struct _CONSOLE* Console);
-
- /*
- * External interface (functions corresponding to the Console API)
- */
- VOID (WINAPI *ChangeTitle)(struct _CONSOLE* Console);
- BOOL (WINAPI *ChangeIcon)(struct _CONSOLE* Console,
- HICON hWindowIcon);
- HWND (WINAPI *GetConsoleWindowHandle)(struct _CONSOLE* Console);
-
-} FRONTEND_VTBL, *PFRONTEND_VTBL;
-
+/* Macros used to call functions in the FRONTEND_VTBL virtual table */
#define ConioDrawRegion(Console, Region)
(Console)->TermIFace.Vtbl->DrawRegion((Console), (Region))
#define ConioWriteStream(Console, Block, CurStartX, CurStartY, ScrolledLines, Buffer,
Length) \
(Console)->TermIFace.Vtbl->WriteStream((Console), (Block), (CurStartX),
(CurStartY), \
@@ -141,134 +30,4 @@
#define ConioRefreshInternalInfo(Console) \
(Console)->TermIFace.Vtbl->RefreshInternalInfo((Console))
-typedef struct _FRONTEND_IFACE
-{
- PFRONTEND_VTBL Vtbl; /* Virtual table */
- PVOID Data; /* Private data */
- PVOID OldData; /* Reserved */
-} FRONTEND_IFACE, *PFRONTEND_IFACE;
-
-#if 0 // Temporarily put in consrv.h
-/*
- * WARNING: Change the state of the console ONLY when the console is locked !
- */
-typedef enum _CONSOLE_STATE
-{
- CONSOLE_INITIALIZING, /* Console is initializing */
- CONSOLE_RUNNING , /* Console running */
- CONSOLE_TERMINATING , /* Console about to be destroyed (but still not) */
- CONSOLE_IN_DESTRUCTION /* Console in destruction */
-} CONSOLE_STATE, *PCONSOLE_STATE;
-#endif
-
-typedef struct _CONSOLE
-{
- 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;
- CONSOLE_STATE State; /* State of the console */
-
- // struct _CONSOLE *Prev, *Next; /* Next and Prev consoles in console wheel
*/
- LIST_ENTRY Entry; /* Entry in the list of consoles */
- LIST_ENTRY ProcessList; /* List of processes owning the console. The
first one is the so-called "Console Leader Process" */
-
- FRONTEND_IFACE TermIFace; /* Frontend-specific interface */
-
-/**************************** Input buffer and data ***************************/
- CONSOLE_INPUT_BUFFER InputBuffer; /* Input buffer of the console */
-
- PWCHAR LineBuffer; /* Current line being input, in line buffered
mode */
- WORD LineMaxSize; /* Maximum size of line in characters
(including CR+LF) */
- WORD LineSize; /* Current size of line */
- WORD LinePos; /* Current position within line */
- BOOLEAN LineComplete; /* User pressed enter, ready to send back to
client */
- BOOLEAN LineUpPressed;
- BOOLEAN LineInsertToggle; /* Replace character over cursor instead of
inserting */
- ULONG LineWakeupMask; /* Bitmap of which control characters will
end line input */
-
- BOOLEAN QuickEdit;
- BOOLEAN InsertMode;
- UINT CodePage;
- UINT OutputCodePage;
-
- CONSOLE_SELECTION_INFO Selection; /* Contains information about the selection
*/
- COORD dwSelectionCursor; /* Selection cursor position, most of the
time different from Selection.dwSelectionAnchor */
-
-/******************************* Screen buffers *******************************/
- LIST_ENTRY BufferList; /* List of all screen buffers for this
console */
- PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer
*/
- BYTE PauseFlags;
- HANDLE UnpauseEvent;
- LIST_ENTRY WriteWaitQueue; /* List head for the queue of write wait
blocks */
-
- ULONG HardwareState; /* _GDI_MANAGED, _DIRECT */
-
-/**************************** Aliases and Histories ***************************/
- struct _ALIAS_HEADER *Aliases;
- LIST_ENTRY HistoryBuffers;
- ULONG HistoryBufferSize; /* Size for newly created history buffers */
- ULONG NumberOfHistoryBuffers; /* Maximum number of history buffers allowed
*/
- BOOLEAN HistoryNoDup; /* Remove old duplicate history entries */
-
-/****************************** Other properties ******************************/
- UNICODE_STRING OriginalTitle; /* Original title of console, the one when
the console leader is launched. Always NULL-terminated */
- UNICODE_STRING Title; /* Title of console. Always NULL-terminated
*/
-
-/* SIZE */ COORD ConsoleSize; /* The size of the console */
- COLORREF Colors[16]; /* Colour palette */
-
-} CONSOLE, *PCONSOLE;
-
-/* PauseFlags values (internal only) */
-#define PAUSED_FROM_KEYBOARD 0x1
-#define PAUSED_FROM_SCROLLBAR 0x2
-#define PAUSED_FROM_SELECTION 0x4
-
-/* console.c */
-VOID FASTCALL ConioPause(PCONSOLE Console, UINT Flags);
-VOID FASTCALL ConioUnpause(PCONSOLE Console, UINT Flags);
-ULONG FASTCALL ConSrvConsoleProcessCtrlEvent(PCONSOLE Console,
- ULONG ProcessGroupId,
- DWORD Event);
-
-/* coninput.c */
-#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
- ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \
- (Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC)
-#define ConSrvGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access,
LockConsole) \
- ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry),
\
- (Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC)
-#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked) \
- ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
-VOID WINAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
-NTSTATUS FASTCALL ConioProcessInputEvent(PCONSOLE Console,
- PINPUT_RECORD InputEvent);
-
-/* conoutput.c */
-#define ConioRectHeight(Rect) \
- (((Rect)->Top) > ((Rect)->Bottom) ? 0 : ((Rect)->Bottom) -
((Rect)->Top) + 1)
-#define ConioRectWidth(Rect) \
- (((Rect)->Left) > ((Rect)->Right) ? 0 : ((Rect)->Right) -
((Rect)->Left) + 1)
-#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
- ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \
- (Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC)
-#define ConSrvGetScreenBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access,
LockConsole) \
- ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry),
\
- (Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC)
-#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked) \
- ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
-PBYTE FASTCALL ConioCoordToPointer(PCONSOLE_SCREEN_BUFFER Buf, ULONG X, ULONG Y);
-VOID FASTCALL ConioDrawConsole(PCONSOLE Console);
-NTSTATUS FASTCALL ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
- CHAR *Buffer, DWORD Length, BOOL Attrib);
-NTSTATUS FASTCALL ConSrvCreateScreenBuffer(IN OUT PCONSOLE Console,
- OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN COORD ScreenBufferSize,
- IN USHORT ScreenAttrib,
- IN USHORT PopupAttrib,
- IN ULONG DisplayMode,
- IN BOOLEAN IsCursorVisible,
- IN ULONG CursorSize);
-VOID WINAPI ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
-DWORD FASTCALL ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale);
-
/* EOF */
Modified: branches/ros-csrss/win32ss/user/consrv/conoutput.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/conoutput.c [iso-8859-1] Sun Apr 7 23:18:59
2013
@@ -2,14 +2,18 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/conoutput.c
- * PURPOSE: Console I/O functions
- * PROGRAMMERS:
+ * PURPOSE: Console Output functions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
/* INCLUDES *******************************************************************/
#include "consrv.h"
+#include "console.h"
+#include "include/conio.h"
#include "conio.h"
+#include "conoutput.h"
+#include "handle.h"
#define NDEBUG
#include <debug.h>
@@ -78,7 +82,7 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
- (*Buffer)->Header.Type = CONIO_SCREEN_BUFFER_MAGIC;
+ (*Buffer)->Header.Type = SCREEN_BUFFER;
(*Buffer)->Header.Console = Console;
(*Buffer)->Header.HandleCount = 0;
(*Buffer)->ScreenBufferSize = ScreenBufferSize;
@@ -1282,16 +1286,8 @@
DPRINT("SrvCreateConsoleScreenBuffer\n");
- // RtlEnterCriticalSection(&ProcessData->HandleTableLock);
-
Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
- if (!NT_SUCCESS(Status))
- {
- // RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
- return Status;
- }
-
- RtlEnterCriticalSection(&ProcessData->HandleTableLock);
+ if (!NT_SUCCESS(Status)) return Status;
/*
if (Console->ActiveBuffer)
@@ -1335,6 +1331,8 @@
CursorSize);
if (NT_SUCCESS(Status))
{
+ RtlEnterCriticalSection(&ProcessData->HandleTableLock);
+
/* Insert the new handle inside the process handles table */
Status = ConSrvInsertObject(ProcessData,
&CreateScreenBufferRequest->OutputHandle,
@@ -1342,11 +1340,9 @@
CreateScreenBufferRequest->Access,
CreateScreenBufferRequest->Inheritable,
CreateScreenBufferRequest->ShareMode);
- }
-
- // ConSrvReleaseConsole(Console, TRUE);
-
- RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
+
+ RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
+ }
ConSrvReleaseConsole(Console, TRUE);
return Status;
Added: branches/ros-csrss/win32ss/user/consrv/conoutput.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/conoutput.h (added)
+++ branches/ros-csrss/win32ss/user/consrv/conoutput.h [iso-8859-1] Sun Apr 7 23:18:59
2013
@@ -1,0 +1,30 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Console Server DLL
+ * FILE: win32ss/user/consrv/conoutput.h
+ * PURPOSE: Console Output functions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+#pragma once
+
+#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
+ ConSrvGetObject((ProcessData), (Handle), (PCONSOLE_IO_OBJECT*)(Ptr), NULL, \
+ (Access), (LockConsole), SCREEN_BUFFER)
+#define ConSrvGetScreenBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access,
LockConsole) \
+ ConSrvGetObject((ProcessData), (Handle), (PCONSOLE_IO_OBJECT*)(Ptr), (Entry),
\
+ (Access), (LockConsole), SCREEN_BUFFER)
+#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked) \
+ ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
+
+NTSTATUS FASTCALL ConSrvCreateScreenBuffer(IN OUT PCONSOLE Console,
+ OUT PCONSOLE_SCREEN_BUFFER* Buffer,
+ IN COORD ScreenBufferSize,
+ IN USHORT ScreenAttrib,
+ IN USHORT PopupAttrib,
+ IN ULONG DisplayMode,
+ IN BOOLEAN IsCursorVisible,
+ IN ULONG CursorSize);
+VOID WINAPI ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
+
+/* EOF */
Propchange: branches/ros-csrss/win32ss/user/consrv/conoutput.h
------------------------------------------------------------------------------
svn:eol-style = native
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] Sun Apr 7 23:18:59
2013
@@ -2,8 +2,8 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/console.c
- * PURPOSE: Console I/O functions
- * PROGRAMMERS:
+ * PURPOSE: Console Management Functions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
/* INCLUDES *******************************************************************/
@@ -12,10 +12,15 @@
#define NONAMELESSUNION
#include "consrv.h"
+#include "include/conio.h"
#include "conio.h"
+#include "handle.h"
+#include "procinit.h"
#include "alias.h"
+#include "coninput.h"
+#include "conoutput.h"
#include "lineinput.h"
-#include "settings.h"
+#include "include/settings.h"
#include "frontends/gui/guiterm.h"
@@ -23,6 +28,7 @@
#include "frontends/tui/tuiterm.h"
#endif
+#include "include/console.h"
#include "console.h"
#include "resource.h"
@@ -181,6 +187,149 @@
}
}
+BOOL FASTCALL
+ConSrvValidateConsolePointer(PCONSOLE Console)
+{
+ PLIST_ENTRY ConsoleEntry;
+ PCONSOLE CurrentConsole = NULL;
+
+ if (!Console) return FALSE;
+
+ /* The console list must be locked */
+ // ASSERT(Console_list_locked);
+
+ ConsoleEntry = ConsoleList.Flink;
+ while (ConsoleEntry != &ConsoleList)
+ {
+ CurrentConsole = CONTAINING_RECORD(ConsoleEntry, CONSOLE, Entry);
+ ConsoleEntry = ConsoleEntry->Flink;
+ if (CurrentConsole == Console) return TRUE;
+ }
+
+ return FALSE;
+}
+
+BOOL FASTCALL
+ConSrvValidateConsoleState(PCONSOLE Console,
+ CONSOLE_STATE ExpectedState)
+{
+ // if (!Console) return FALSE;
+
+ /* The console must be locked */
+ // ASSERT(Console_locked);
+
+ return (Console->State == ExpectedState);
+}
+
+BOOL FASTCALL
+ConSrvValidateConsoleUnsafe(PCONSOLE Console,
+ CONSOLE_STATE ExpectedState,
+ BOOL LockConsole)
+{
+ if (!Console) return FALSE;
+
+ /*
+ * Lock the console to forbid possible console's state changes
+ * (which must be done when the console is already locked).
+ * If we don't want to lock it, it's because the lock is already
+ * held. So there must be no problems.
+ */
+ if (LockConsole) EnterCriticalSection(&Console->Lock);
+
+ // ASSERT(Console_locked);
+
+ /* Check whether the console's state is what we expect */
+ if (!ConSrvValidateConsoleState(Console, ExpectedState))
+ {
+ if (LockConsole) LeaveCriticalSection(&Console->Lock);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+BOOL FASTCALL
+ConSrvValidateConsole(PCONSOLE Console,
+ CONSOLE_STATE ExpectedState,
+ BOOL LockConsole)
+{
+ BOOL RetVal = FALSE;
+
+ if (!Console) return FALSE;
+
+ /*
+ * Forbid creation or deletion of consoles when
+ * checking for the existence of a console.
+ */
+ ConSrvLockConsoleListShared();
+
+ if (ConSrvValidateConsolePointer(Console))
+ {
+ RetVal = ConSrvValidateConsoleUnsafe(Console,
+ ExpectedState,
+ LockConsole);
+ }
+
+ /* Unlock the console list and return */
+ ConSrvUnlockConsoleList();
+ return RetVal;
+}
+
+NTSTATUS
+FASTCALL
+ConSrvGetConsole(PCONSOLE_PROCESS_DATA ProcessData,
+ PCONSOLE* Console,
+ BOOL LockConsole)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+ PCONSOLE ProcessConsole;
+
+ RtlEnterCriticalSection(&ProcessData->HandleTableLock);
+ ProcessConsole = ProcessData->Console;
+
+ if (ConSrvValidateConsole(ProcessConsole, CONSOLE_RUNNING, LockConsole))
+ {
+ InterlockedIncrement(&ProcessConsole->ReferenceCount);
+ *Console = ProcessConsole;
+ }
+ else
+ {
+ *Console = NULL;
+ Status = STATUS_INVALID_HANDLE;
+ }
+
+ RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
+ return Status;
+}
+
+VOID FASTCALL
+ConSrvReleaseConsole(PCONSOLE Console,
+ BOOL WasConsoleLocked)
+{
+ LONG RefCount = 0;
+
+ if (!Console) return;
+ // if (Console->ReferenceCount == 0) return; // This shouldn't happen
+ ASSERT(Console->ReferenceCount > 0);
+
+ /* The console must be locked */
+ // ASSERT(Console_locked);
+
+ /*
+ * Decrement the reference count. Save the new value too,
+ * because Console->ReferenceCount might be modified after
+ * the console gets unlocked but before we check whether we
+ * can destroy it.
+ */
+ RefCount = _InterlockedDecrement(&Console->ReferenceCount);
+
+ /* Unlock the console if needed */
+ if (WasConsoleLocked) LeaveCriticalSection(&Console->Lock);
+
+ /* Delete the console if needed */
+ if (RefCount <= 0) ConSrvDeleteConsole(Console);
+}
+
VOID WINAPI
ConSrvInitConsoleSupport(VOID)
{
@@ -409,7 +558,7 @@
/*
* Initialize the input buffer
*/
- Console->InputBuffer.Header.Type = CONIO_INPUT_BUFFER_MAGIC;
+ Console->InputBuffer.Header.Type = INPUT_BUFFER;
Console->InputBuffer.Header.Console = Console;
SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
@@ -573,9 +722,6 @@
VOID WINAPI
ConSrvDeleteConsole(PCONSOLE Console)
{
- PLIST_ENTRY CurrentEntry;
- ConsoleInput* Event;
-
DPRINT("ConSrvDeleteConsole\n");
/*
@@ -658,16 +804,11 @@
Console->ReferenceCount = 0;
/* Discard all entries in the input event queue */
- while (!IsListEmpty(&Console->InputBuffer.InputEvents))
- {
- CurrentEntry = RemoveHeadList(&Console->InputBuffer.InputEvents);
- Event = CONTAINING_RECORD(CurrentEntry, ConsoleInput, ListEntry);
- RtlFreeHeap(ConSrvHeap, 0, Event);
- }
-
- if (Console->LineBuffer)
- RtlFreeHeap(ConSrvHeap, 0, Console->LineBuffer);
-
+ PurgeInputBuffer(Console);
+
+ if (Console->LineBuffer) RtlFreeHeap(ConSrvHeap, 0, Console->LineBuffer);
+
+ IntDeleteAllAliases(Console);
HistoryDeleteBuffers(Console);
ConioDeleteScreenBuffer(Console->ActiveBuffer);
@@ -676,12 +817,11 @@
DPRINT1("BUG: screen buffer list not empty\n");
}
- CloseHandle(Console->InputBuffer.ActiveEvent);
+ // CloseHandle(Console->InputBuffer.ActiveEvent);
if (Console->UnpauseEvent) CloseHandle(Console->UnpauseEvent);
RtlFreeUnicodeString(&Console->OriginalTitle);
RtlFreeUnicodeString(&Console->Title);
- IntDeleteAllAliases(Console->Aliases);
DPRINT("ConSrvDeleteConsole - Unlocking\n");
LeaveCriticalSection(&Console->Lock);
@@ -696,154 +836,8 @@
ConSrvUnlockConsoleList();
}
-BOOL FASTCALL
-ConSrvValidateConsolePointer(PCONSOLE Console)
-{
- PLIST_ENTRY ConsoleEntry;
- PCONSOLE CurrentConsole = NULL;
-
- if (!Console) return FALSE;
-
- /* The console list must be locked */
- // ASSERT(Console_list_locked);
-
- ConsoleEntry = ConsoleList.Flink;
- while (ConsoleEntry != &ConsoleList)
- {
- CurrentConsole = CONTAINING_RECORD(ConsoleEntry, CONSOLE, Entry);
- ConsoleEntry = ConsoleEntry->Flink;
- if (CurrentConsole == Console) return TRUE;
- }
-
- return FALSE;
-}
-
-BOOL FASTCALL
-ConSrvValidateConsoleState(PCONSOLE Console,
- CONSOLE_STATE ExpectedState)
-{
- // if (!Console) return FALSE;
-
- /* The console must be locked */
- // ASSERT(Console_locked);
-
- return (Console->State == ExpectedState);
-}
-
-BOOL FASTCALL
-ConSrvValidateConsoleUnsafe(PCONSOLE Console,
- CONSOLE_STATE ExpectedState,
- BOOL LockConsole)
-{
- if (!Console) return FALSE;
-
- /*
- * Lock the console to forbid possible console's state changes
- * (which must be done when the console is already locked).
- * If we don't want to lock it, it's because the lock is already
- * held. So there must be no problems.
- */
- if (LockConsole) EnterCriticalSection(&Console->Lock);
-
- // ASSERT(Console_locked);
-
- /* Check whether the console's state is what we expect */
- if (!ConSrvValidateConsoleState(Console, ExpectedState))
- {
- if (LockConsole) LeaveCriticalSection(&Console->Lock);
- return FALSE;
- }
-
- return TRUE;
-}
-
-BOOL FASTCALL
-ConSrvValidateConsole(PCONSOLE Console,
- CONSOLE_STATE ExpectedState,
- BOOL LockConsole)
-{
- BOOL RetVal = FALSE;
-
- if (!Console) return FALSE;
-
- /*
- * Forbid creation or deletion of consoles when
- * checking for the existence of a console.
- */
- ConSrvLockConsoleListShared();
-
- if (ConSrvValidateConsolePointer(Console))
- {
- RetVal = ConSrvValidateConsoleUnsafe(Console,
- ExpectedState,
- LockConsole);
- }
-
- /* Unlock the console list and return */
- ConSrvUnlockConsoleList();
- return RetVal;
-}
-
/* PUBLIC SERVER APIS *********************************************************/
-
-CSR_API(SrvOpenConsole)
-{
- NTSTATUS Status;
- PCONSOLE_OPENCONSOLE OpenConsoleRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.OpenConsoleRequest;
- PCONSOLE_PROCESS_DATA ProcessData =
ConsoleGetPerProcessData(CsrGetClientThread()->Process);
- PCONSOLE Console;
-
- DWORD DesiredAccess = OpenConsoleRequest->Access;
- DWORD ShareMode = OpenConsoleRequest->ShareMode;
- Object_t *Object;
-
- OpenConsoleRequest->ConsoleHandle = INVALID_HANDLE_VALUE;
-
- Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Can't get console\n");
- return Status;
- }
-
- RtlEnterCriticalSection(&ProcessData->HandleTableLock);
-
- /*
- * Open a handle to either the active screen buffer or the input buffer.
- */
- if (OpenConsoleRequest->HandleType == HANDLE_OUTPUT)
- {
- Object = &Console->ActiveBuffer->Header;
- }
- else // HANDLE_INPUT
- {
- Object = &Console->InputBuffer.Header;
- }
-
- if (((DesiredAccess & GENERIC_READ) && Object->ExclusiveRead != 0)
||
- ((DesiredAccess & GENERIC_WRITE) && Object->ExclusiveWrite != 0)
||
- (!(ShareMode & FILE_SHARE_READ) && Object->AccessRead != 0)
||
- (!(ShareMode & FILE_SHARE_WRITE) && Object->AccessWrite != 0))
- {
- DPRINT1("Sharing violation\n");
- Status = STATUS_SHARING_VIOLATION;
- }
- else
- {
- Status = ConSrvInsertObject(ProcessData,
- &OpenConsoleRequest->ConsoleHandle,
- Object,
- DesiredAccess,
- OpenConsoleRequest->Inheritable,
- ShareMode);
- }
-
- RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
-
- ConSrvReleaseConsole(Console, TRUE);
- return Status;
-}
CSR_API(SrvAllocConsole)
{
@@ -1020,7 +1014,7 @@
NTSTATUS Status;
PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
DWORD ConsoleMode = ConsoleModeRequest->ConsoleMode;
- Object_t* Object = NULL;
+ PCONSOLE_IO_OBJECT Object = NULL;
Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
ConsoleModeRequest->ConsoleHandle,
@@ -1029,7 +1023,7 @@
Status = STATUS_SUCCESS;
- if (CONIO_INPUT_BUFFER_MAGIC == Object->Type)
+ if (INPUT_BUFFER == Object->Type)
{
PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object;
PCONSOLE Console = InputBuffer->Header.Console;
@@ -1067,7 +1061,7 @@
}
InputBuffer->Mode = (ConsoleMode & CONSOLE_VALID_INPUT_MODES);
}
- else if (CONIO_SCREEN_BUFFER_MAGIC == Object->Type)
+ else if (SCREEN_BUFFER == Object->Type)
{
PCONSOLE_SCREEN_BUFFER Buffer = (PCONSOLE_SCREEN_BUFFER)Object;
@@ -1096,7 +1090,7 @@
{
NTSTATUS Status;
PCONSOLE_GETSETCONSOLEMODE ConsoleModeRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.ConsoleModeRequest;
- Object_t* Object = NULL;
+ PCONSOLE_IO_OBJECT Object = NULL;
Status = ConSrvGetObject(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
ConsoleModeRequest->ConsoleHandle,
@@ -1105,7 +1099,7 @@
Status = STATUS_SUCCESS;
- if (CONIO_INPUT_BUFFER_MAGIC == Object->Type)
+ if (INPUT_BUFFER == Object->Type)
{
PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object;
PCONSOLE Console = InputBuffer->Header.Console;
@@ -1122,7 +1116,7 @@
ConsoleModeRequest->ConsoleMode = ConsoleMode;
}
- else if (CONIO_SCREEN_BUFFER_MAGIC == Object->Type)
+ else if (SCREEN_BUFFER == Object->Type)
{
PCONSOLE_SCREEN_BUFFER Buffer = (PCONSOLE_SCREEN_BUFFER)Object;
ConsoleModeRequest->ConsoleMode = Buffer->Mode;
Modified: branches/ros-csrss/win32ss/user/consrv/console.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/console.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/console.h [iso-8859-1] Sun Apr 7 23:18:59
2013
@@ -2,39 +2,22 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/console.h
- * PURPOSE: Consoles Management
- * PROGRAMMERS: Hermes Belusca-Maito
+ * PURPOSE: Console Initialization Functions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#pragma once
-#if 0
-/*
- * WARNING: Change the state of the console ONLY when the console is locked !
- */
-typedef enum _CONSOLE_STATE
-{
- CONSOLE_INITIALIZING, /* Console is initializing */
- CONSOLE_RUNNING , /* Console running */
- CONSOLE_TERMINATING , /* Console about to be destroyed (but still not) */
- CONSOLE_IN_DESTRUCTION /* Console in destruction */
-} CONSOLE_STATE, *PCONSOLE_STATE;
-#endif
+VOID WINAPI ConSrvInitConsoleSupport(VOID);
-
-VOID WINAPI ConSrvInitConsoleSupport(VOID);
NTSTATUS WINAPI ConSrvInitConsole(OUT PCONSOLE* NewConsole,
IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
IN PCSR_PROCESS ConsoleLeaderProcess);
VOID WINAPI ConSrvDeleteConsole(PCONSOLE Console);
-BOOL FASTCALL ConSrvValidateConsolePointer(PCONSOLE Console);
-BOOL FASTCALL ConSrvValidateConsoleState(PCONSOLE Console,
- CONSOLE_STATE ExpectedState);
-BOOL FASTCALL ConSrvValidateConsoleUnsafe(PCONSOLE Console,
- CONSOLE_STATE ExpectedState,
- BOOL LockConsole);
-BOOL FASTCALL ConSrvValidateConsole(PCONSOLE Console,
- CONSOLE_STATE ExpectedState,
- BOOL LockConsole);
+NTSTATUS FASTCALL ConSrvGetConsole(PCONSOLE_PROCESS_DATA ProcessData,
+ PCONSOLE* Console,
+ BOOL LockConsole);
+VOID FASTCALL ConSrvReleaseConsole(PCONSOLE Console,
+ BOOL WasConsoleLocked);
/* EOF */
Modified: branches/ros-csrss/win32ss/user/consrv/consrv.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/c…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/consrv.h [iso-8859-1] Sun Apr 7 23:18:59 2013
@@ -45,32 +45,13 @@
#include <win/conmsg.h>
+/* Globals */
extern HINSTANCE ConSrvDllInstance;
extern HANDLE ConSrvHeap;
-/* Object type magic numbers */
-#define CONIO_INPUT_BUFFER_MAGIC 0x00000001 // --> Input-type handles
-#define CONIO_SCREEN_BUFFER_MAGIC 0x00000002 // --> Output-type handles
-
-/* Common things to input/output/console objects */
-typedef struct Object_tt
-{
- ULONG Type;
- struct _CONSOLE *Console;
- LONG AccessRead, AccessWrite;
- LONG ExclusiveRead, ExclusiveWrite;
- LONG HandleCount;
-} Object_t;
-
-
-typedef struct _CONSOLE_IO_HANDLE
-{
- Object_t *Object; /* The object on which the handle points to */
- DWORD Access;
- BOOL Inheritable;
- DWORD ShareMode;
-} CONSOLE_IO_HANDLE, *PCONSOLE_IO_HANDLE;
-
+/* Opaque pointers */
+typedef struct _CONSOLE_IO_HANDLE *PCONSOLE_IO_HANDLE;
+typedef struct _CONSOLE *PCONSOLE;
#define ConsoleGetPerProcessData(Process) \
((PCONSOLE_PROCESS_DATA)((Process)->ServerData[CONSRV_SERVERDLL_INDEX]))
@@ -80,8 +61,8 @@
LIST_ENTRY ConsoleLink;
PCSR_PROCESS Process; // Process owning this structure.
HANDLE ConsoleEvent;
- /* PCONSOLE */ struct _CONSOLE* Console;
- /* PCONSOLE */ struct _CONSOLE* ParentConsole;
+ PCONSOLE Console;
+ PCONSOLE ParentConsole;
BOOL ConsoleApp; // TRUE if it is a CUI app, FALSE otherwise.
@@ -93,129 +74,6 @@
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;
-
-#if 1 // Temporarily put there.
-/*
- * WARNING: Change the state of the console ONLY when the console is locked !
- */
-typedef enum _CONSOLE_STATE
-{
- CONSOLE_INITIALIZING, /* Console is initializing */
- CONSOLE_RUNNING , /* Console running */
- CONSOLE_TERMINATING , /* Console about to be destroyed (but still not) */
- CONSOLE_IN_DESTRUCTION /* Console in destruction */
-} CONSOLE_STATE, *PCONSOLE_STATE;
-#endif
-
-
-/* alias.c */
-CSR_API(SrvAddConsoleAlias);
-CSR_API(SrvGetConsoleAlias);
-CSR_API(SrvGetConsoleAliases);
-CSR_API(SrvGetConsoleAliasesLength);
-CSR_API(SrvGetConsoleAliasExes);
-CSR_API(SrvGetConsoleAliasExesLength);
-
-/* coninput.c */
-CSR_API(SrvGetConsoleInput);
-CSR_API(SrvWriteConsoleInput);
-CSR_API(SrvReadConsole);
-CSR_API(SrvFlushConsoleInputBuffer);
-CSR_API(SrvGetConsoleNumberOfInputEvents);
-
-/* conoutput.c */
-CSR_API(SrvReadConsoleOutput);
-CSR_API(SrvWriteConsoleOutput);
-CSR_API(SrvReadConsoleOutputString);
-CSR_API(SrvWriteConsoleOutputString);
-CSR_API(SrvFillConsoleOutput);
-CSR_API(SrvWriteConsole);
-CSR_API(SrvSetConsoleCursorPosition);
-CSR_API(SrvGetConsoleCursorInfo);
-CSR_API(SrvSetConsoleCursorInfo);
-CSR_API(SrvSetConsoleTextAttribute);
-CSR_API(SrvCreateConsoleScreenBuffer);
-CSR_API(SrvGetConsoleScreenBufferInfo);
-CSR_API(SrvSetConsoleActiveScreenBuffer);
-CSR_API(SrvScrollConsoleScreenBuffer);
-CSR_API(SrvSetConsoleScreenBufferSize);
-
-/* console.c */
-CSR_API(SrvOpenConsole);
-CSR_API(SrvAllocConsole);
-CSR_API(SrvAttachConsole);
-CSR_API(SrvFreeConsole);
-CSR_API(SrvSetConsoleMode);
-CSR_API(SrvGetConsoleMode);
-CSR_API(SrvSetConsoleTitle);
-CSR_API(SrvGetConsoleTitle);
-CSR_API(SrvGetConsoleHardwareState);
-CSR_API(SrvSetConsoleHardwareState);
-CSR_API(SrvGetConsoleDisplayMode);
-CSR_API(SrvSetConsoleDisplayMode);
-CSR_API(SrvGetConsoleWindow);
-CSR_API(SrvSetConsoleIcon);
-CSR_API(SrvGetConsoleCP);
-CSR_API(SrvSetConsoleCP);
-CSR_API(SrvGetConsoleProcessList);
-CSR_API(SrvGenerateConsoleCtrlEvent);
-CSR_API(SrvGetConsoleSelectionInfo);
-
-/* handle.c */
-CSR_API(SrvCloseHandle);
-CSR_API(SrvVerifyConsoleIoHandle);
-CSR_API(SrvDuplicateHandle);
-
-NTSTATUS FASTCALL ConSrvInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
- PHANDLE Handle,
- Object_t *Object,
- DWORD Access,
- BOOL Inheritable,
- DWORD ShareMode);
-NTSTATUS FASTCALL ConSrvRemoveObject(PCONSOLE_PROCESS_DATA ProcessData,
- HANDLE Handle);
-NTSTATUS FASTCALL ConSrvGetObject(PCONSOLE_PROCESS_DATA ProcessData,
- HANDLE Handle,
- Object_t** Object,
- PCONSOLE_IO_HANDLE* Entry OPTIONAL,
- DWORD Access,
- BOOL LockConsole,
- ULONG Type);
-VOID FASTCALL ConSrvReleaseObject(Object_t *Object,
- BOOL IsConsoleLocked);
-NTSTATUS FASTCALL ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
- PHANDLE pInputHandle,
- PHANDLE pOutputHandle,
- PHANDLE pErrorHandle,
- PCONSOLE_START_INFO ConsoleStartInfo);
-NTSTATUS FASTCALL ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData,
- struct _CONSOLE* Console,
- BOOL CreateNewHandlesTable,
- PHANDLE pInputHandle,
- PHANDLE pOutputHandle,
- PHANDLE pErrorHandle);
-NTSTATUS FASTCALL ConSrvGetConsole(PCONSOLE_PROCESS_DATA ProcessData,
- struct _CONSOLE** Console,
- BOOL LockConsole);
-VOID FASTCALL ConSrvReleaseConsole(struct _CONSOLE* Console,
- BOOL WasConsoleLocked);
-VOID FASTCALL ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData);
-
-NTSTATUS NTAPI ConSrvNewProcess(PCSR_PROCESS SourceProcess,
- PCSR_PROCESS TargetProcess);
-NTSTATUS NTAPI ConSrvConnect(IN PCSR_PROCESS CsrProcess,
- IN OUT PVOID ConnectionInfo,
- IN OUT PULONG ConnectionInfoLength);
-VOID NTAPI ConSrvDisconnect(PCSR_PROCESS Process);
-
-/* lineinput.c */
-CSR_API(SrvGetConsoleCommandHistoryLength);
-CSR_API(SrvGetConsoleCommandHistory);
-CSR_API(SrvExpungeConsoleCommandHistory);
-CSR_API(SrvSetConsoleNumberOfCommands);
-CSR_API(SrvGetConsoleHistory);
-CSR_API(SrvSetConsoleHistory);
-
#endif // __CONSRV_H__
/* EOF */
Modified: branches/ros-csrss/win32ss/user/consrv/frontends/gui/consolecpl.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/f…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/frontends/gui/consolecpl.h [iso-8859-1]
(original)
+++ branches/ros-csrss/win32ss/user/consrv/frontends/gui/consolecpl.h [iso-8859-1] Sun Apr
7 23:18:59 2013
@@ -3,12 +3,12 @@
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/consolecpl.h
* PURPOSE: GUI front-end settings management - Header for console.dll
- * PROGRAMMERS: Hermes Belusca - Maito
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#pragma once
-#include "settings.h"
+#include "include/settings.h"
#include "guisettings.h"
/* EOF */
Modified: branches/ros-csrss/win32ss/user/consrv/frontends/gui/guisettings.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/f…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/frontends/gui/guisettings.c [iso-8859-1]
(original)
+++ branches/ros-csrss/win32ss/user/consrv/frontends/gui/guisettings.c [iso-8859-1] Sun
Apr 7 23:18:59 2013
@@ -3,15 +3,14 @@
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/frontends/gui/guisettings.c
* PURPOSE: GUI Terminal Front-End Settings Management
- * PROGRAMMERS: Hermes Belusca - Maito
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
/* INCLUDES *******************************************************************/
#include "consrv.h"
-#include "conio.h"
-#include "settings.h"
-#include "guiterm.h"
+#include "include/conio.h"
+#include "include/settings.h"
#include "guisettings.h"
#define NDEBUG
Modified: branches/ros-csrss/win32ss/user/consrv/frontends/gui/guisettings.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/f…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/frontends/gui/guisettings.h [iso-8859-1]
(original)
+++ branches/ros-csrss/win32ss/user/consrv/frontends/gui/guisettings.h [iso-8859-1] Sun
Apr 7 23:18:59 2013
@@ -3,14 +3,12 @@
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/guisettings.h
* PURPOSE: GUI front-end settings management
- * PROGRAMMERS: Hermes Belusca - Maito
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*
* NOTE: Also used by console.dll
*/
#pragma once
-
-// #include "guiconsole.h"
#ifndef WM_APP
#define WM_APP 0x8000
Modified: branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/f…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c [iso-8859-1]
(original)
+++ branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.c [iso-8859-1] Sun Apr 7
23:18:59 2013
@@ -3,15 +3,15 @@
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/frontends/gui/guiterm.c
* PURPOSE: GUI Terminal Front-End
- * PROGRAMMERS:
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
/* INCLUDES *******************************************************************/
#include "consrv.h"
-#include "conio.h"
-#include "console.h"
-#include "settings.h"
+#include "include/conio.h"
+#include "include/console.h"
+#include "include/settings.h"
#include "guiterm.h"
#include "guisettings.h"
#include "resource.h"
Modified: branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/f…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.h [iso-8859-1]
(original)
+++ branches/ros-csrss/win32ss/user/consrv/frontends/gui/guiterm.h [iso-8859-1] Sun Apr 7
23:18:59 2013
@@ -3,17 +3,17 @@
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/frontends/gui/guiterm.h
* PURPOSE: GUI Terminal Front-End
- * PROGRAMMERS:
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#pragma once
-
-// #include "guisettings.h"
#define CONGUI_MIN_WIDTH 10
#define CONGUI_MIN_HEIGHT 10
#define CONGUI_UPDATE_TIME 0
#define CONGUI_UPDATE_TIMER 1
+
+#define CURSOR_BLINK_TIME 500
NTSTATUS FASTCALL GuiInitConsole(PCONSOLE Console,
/*IN*/ PCONSOLE_START_INFO ConsoleStartInfo,
Modified: branches/ros-csrss/win32ss/user/consrv/frontends/tui/tuiterm.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/f…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/frontends/tui/tuiterm.c [iso-8859-1]
(original)
+++ branches/ros-csrss/win32ss/user/consrv/frontends/tui/tuiterm.c [iso-8859-1] Sun Apr 7
23:18:59 2013
@@ -3,7 +3,7 @@
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/frontends/tui/tuiterm.c
* PURPOSE: TUI Terminal Front-End
- * PROGRAMMERS:
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#ifdef TUI_CONSOLE
Modified: branches/ros-csrss/win32ss/user/consrv/frontends/tui/tuiterm.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/f…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/frontends/tui/tuiterm.h [iso-8859-1]
(original)
+++ branches/ros-csrss/win32ss/user/consrv/frontends/tui/tuiterm.h [iso-8859-1] Sun Apr 7
23:18:59 2013
@@ -3,7 +3,7 @@
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/frontends/tui/tuiterm.h
* PURPOSE: TUI Terminal Front-End
- * PROGRAMMERS:
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#include "conio.h"
Modified: branches/ros-csrss/win32ss/user/consrv/handle.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/handle.c [iso-8859-1] Sun Apr 7 23:18:59 2013
@@ -3,25 +3,40 @@
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/handle.c
* PURPOSE: Console I/O Handles functions
- * PROGRAMMERS:
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
/* INCLUDES *******************************************************************/
#include "consrv.h"
+#include "include/conio.h"
#include "conio.h"
+#include "handle.h"
+#include "include/console.h"
#include "console.h"
+#include "conoutput.h"
#define NDEBUG
#include <debug.h>
+/* GLOBALS ********************************************************************/
+
+typedef struct _CONSOLE_IO_HANDLE
+{
+ PCONSOLE_IO_OBJECT Object; /* The object on which the handle points to */
+ DWORD Access;
+ BOOL Inheritable;
+ DWORD ShareMode;
+} CONSOLE_IO_HANDLE, *PCONSOLE_IO_HANDLE;
+
+
/* PRIVATE FUNCTIONS **********************************************************/
static INT
AdjustHandleCounts(PCONSOLE_IO_HANDLE Entry, INT Change)
{
- Object_t *Object = Entry->Object;
+ PCONSOLE_IO_OBJECT Object = Entry->Object;
DPRINT("AdjustHandleCounts(0x%p, %d), Object = 0x%p, Object->HandleCount =
%d, Object->Type = %lu\n", Entry, Change, Object, Object->HandleCount,
Object->Type);
@@ -38,7 +53,7 @@
static VOID
ConSrvCreateHandleEntry(PCONSOLE_IO_HANDLE Entry)
{
- /// LOCK /// Object_t *Object = Entry->Object;
+ /// LOCK /// PCONSOLE_IO_OBJECT Object = Entry->Object;
/// LOCK /// EnterCriticalSection(&Object->Console->Lock);
AdjustHandleCounts(Entry, +1);
/// LOCK /// LeaveCriticalSection(&Object->Console->Lock);
@@ -47,7 +62,7 @@
static VOID
ConSrvCloseHandleEntry(PCONSOLE_IO_HANDLE Entry)
{
- Object_t *Object = Entry->Object;
+ PCONSOLE_IO_OBJECT Object = Entry->Object;
if (Object != NULL)
{
/// LOCK /// PCONSOLE Console = Object->Console;
@@ -57,7 +72,7 @@
* If this is a input handle, notify and dereference
* all the waits related to this handle.
*/
- if (Object->Type == CONIO_INPUT_BUFFER_MAGIC)
+ if (Object->Type == INPUT_BUFFER)
{
PCONSOLE_INPUT_BUFFER InputBuffer = (PCONSOLE_INPUT_BUFFER)Object;
@@ -83,7 +98,7 @@
/* If the last handle to a screen buffer is closed, delete it... */
if (AdjustHandleCounts(Entry, -1) == 0)
{
- if (Object->Type == CONIO_SCREEN_BUFFER_MAGIC)
+ if (Object->Type == SCREEN_BUFFER)
{
PCONSOLE_SCREEN_BUFFER Buffer = (PCONSOLE_SCREEN_BUFFER)Object;
/* ...unless it's the only buffer left. Windows allows deletion
@@ -92,7 +107,7 @@
if (Buffer->ListEntry.Flink != Buffer->ListEntry.Blink)
ConioDeleteScreenBuffer(Buffer);
}
- else if (Object->Type == CONIO_INPUT_BUFFER_MAGIC)
+ else if (Object->Type == INPUT_BUFFER)
{
DPRINT("Closing the input buffer\n");
}
@@ -261,7 +276,7 @@
FASTCALL
ConSrvInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
PHANDLE Handle,
- Object_t *Object,
+ PCONSOLE_IO_OBJECT Object,
DWORD Access,
BOOL Inheritable,
DWORD ShareMode)
@@ -318,7 +333,7 @@
HANDLE Handle)
{
ULONG_PTR h = (ULONG_PTR)Handle >> 2;
- Object_t *Object;
+ PCONSOLE_IO_OBJECT Object;
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
@@ -339,15 +354,15 @@
FASTCALL
ConSrvGetObject(PCONSOLE_PROCESS_DATA ProcessData,
HANDLE Handle,
- Object_t** Object,
- PCONSOLE_IO_HANDLE* Entry OPTIONAL,
+ PCONSOLE_IO_OBJECT* Object,
+ PVOID* Entry OPTIONAL,
DWORD Access,
BOOL LockConsole,
- ULONG Type)
+ CONSOLE_IO_OBJECT_TYPE Type)
{
ULONG_PTR h = (ULONG_PTR)Handle >> 2;
PCONSOLE_IO_HANDLE HandleEntry = NULL;
- Object_t* ObjectEntry = NULL;
+ PCONSOLE_IO_OBJECT ObjectEntry = NULL;
ASSERT(Object);
if (Entry) *Entry = NULL;
@@ -396,7 +411,7 @@
VOID
FASTCALL
-ConSrvReleaseObject(Object_t *Object,
+ConSrvReleaseObject(PCONSOLE_IO_OBJECT Object,
BOOL IsConsoleLocked)
{
ConSrvReleaseConsole(Object->Console, IsConsoleLocked);
@@ -564,63 +579,71 @@
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
}
-NTSTATUS
-FASTCALL
-ConSrvGetConsole(PCONSOLE_PROCESS_DATA ProcessData,
- PCONSOLE* Console,
- BOOL LockConsole)
-{
- NTSTATUS Status = STATUS_SUCCESS;
- PCONSOLE ProcessConsole;
+
+/* PUBLIC SERVER APIS *********************************************************/
+
+CSR_API(SrvOpenConsole)
+{
+ /*
+ * This API opens a handle to either the input buffer or to
+ * a screen-buffer of the console of the current process.
+ */
+
+ NTSTATUS Status;
+ PCONSOLE_OPENCONSOLE OpenConsoleRequest =
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.OpenConsoleRequest;
+ PCONSOLE_PROCESS_DATA ProcessData =
ConsoleGetPerProcessData(CsrGetClientThread()->Process);
+ PCONSOLE Console;
+
+ DWORD DesiredAccess = OpenConsoleRequest->Access;
+ DWORD ShareMode = OpenConsoleRequest->ShareMode;
+ PCONSOLE_IO_OBJECT Object;
+
+ OpenConsoleRequest->ConsoleHandle = INVALID_HANDLE_VALUE;
+
+ Status = ConSrvGetConsole(ProcessData, &Console, TRUE);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Can't get console\n");
+ return Status;
+ }
RtlEnterCriticalSection(&ProcessData->HandleTableLock);
- ProcessConsole = ProcessData->Console;
-
- if (ConSrvValidateConsole(ProcessConsole, CONSOLE_RUNNING, LockConsole))
- {
- InterlockedIncrement(&ProcessConsole->ReferenceCount);
- *Console = ProcessConsole;
+
+ /*
+ * Open a handle to either the active screen buffer or the input buffer.
+ */
+ if (OpenConsoleRequest->HandleType == HANDLE_OUTPUT)
+ {
+ Object = &Console->ActiveBuffer->Header;
+ }
+ else // HANDLE_INPUT
+ {
+ Object = &Console->InputBuffer.Header;
+ }
+
+ if (((DesiredAccess & GENERIC_READ) && Object->ExclusiveRead != 0)
||
+ ((DesiredAccess & GENERIC_WRITE) && Object->ExclusiveWrite != 0)
||
+ (!(ShareMode & FILE_SHARE_READ) && Object->AccessRead != 0)
||
+ (!(ShareMode & FILE_SHARE_WRITE) && Object->AccessWrite != 0))
+ {
+ DPRINT1("Sharing violation\n");
+ Status = STATUS_SHARING_VIOLATION;
}
else
{
- *Console = NULL;
- Status = STATUS_INVALID_HANDLE;
+ Status = ConSrvInsertObject(ProcessData,
+ &OpenConsoleRequest->ConsoleHandle,
+ Object,
+ DesiredAccess,
+ OpenConsoleRequest->Inheritable,
+ ShareMode);
}
RtlLeaveCriticalSection(&ProcessData->HandleTableLock);
+
+ ConSrvReleaseConsole(Console, TRUE);
return Status;
}
-
-VOID FASTCALL
-ConSrvReleaseConsole(PCONSOLE Console,
- BOOL WasConsoleLocked)
-{
- LONG RefCount = 0;
-
- if (!Console) return;
- // if (Console->ReferenceCount == 0) return; // This shouldn't happen
- ASSERT(Console->ReferenceCount > 0);
-
- /* The console must be locked */
- // ASSERT(Console_locked);
-
- /*
- * Decrement the reference count. Save the new value too,
- * because Console->ReferenceCount might be modified after
- * the console gets unlocked but before we check whether we
- * can destroy it.
- */
- RefCount = _InterlockedDecrement(&Console->ReferenceCount);
-
- /* Unlock the console if needed */
- if (WasConsoleLocked) LeaveCriticalSection(&Console->Lock);
-
- /* Delete the console if needed */
- if (RefCount <= 0) ConSrvDeleteConsole(Console);
-}
-
-
-/* PUBLIC SERVER APIS *********************************************************/
CSR_API(SrvCloseHandle)
{
Added: branches/ros-csrss/win32ss/user/consrv/handle.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/h…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/handle.h (added)
+++ branches/ros-csrss/win32ss/user/consrv/handle.h [iso-8859-1] Sun Apr 7 23:18:59 2013
@@ -1,0 +1,29 @@
+/*
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS Console Server DLL
+ * FILE: win32ss/user/consrv/handle.h
+ * PURPOSE: Console I/O Handles functions
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+#pragma once
+
+NTSTATUS FASTCALL ConSrvInsertObject(PCONSOLE_PROCESS_DATA ProcessData,
+ PHANDLE Handle,
+ PCONSOLE_IO_OBJECT Object,
+ DWORD Access,
+ BOOL Inheritable,
+ DWORD ShareMode);
+NTSTATUS FASTCALL ConSrvRemoveObject(PCONSOLE_PROCESS_DATA ProcessData,
+ HANDLE Handle);
+NTSTATUS FASTCALL ConSrvGetObject(PCONSOLE_PROCESS_DATA ProcessData,
+ HANDLE Handle,
+ PCONSOLE_IO_OBJECT* Object,
+ PVOID* Entry OPTIONAL,
+ DWORD Access,
+ BOOL LockConsole,
+ CONSOLE_IO_OBJECT_TYPE Type);
+VOID FASTCALL ConSrvReleaseObject(PCONSOLE_IO_OBJECT Object,
+ BOOL IsConsoleLocked);
+
+/* EOF */
Propchange: branches/ros-csrss/win32ss/user/consrv/handle.h
------------------------------------------------------------------------------
svn:eol-style = native
Copied: branches/ros-csrss/win32ss/user/consrv/include/conio.h (from r58689,
branches/ros-csrss/win32ss/user/consrv/conio.h)
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/i…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/conio.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/include/conio.h [iso-8859-1] Sun Apr 7
23:18:59 2013
@@ -1,21 +1,35 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/consrv/conio.h
- * PURPOSE: Internal console I/O interface
- * PROGRAMMERS:
+ * FILE: win32ss/user/consrv/include/conio.h
+ * PURPOSE: Public Console I/O Interface
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#pragma once
#define CSR_DEFAULT_CURSOR_SIZE 25
-#define CURSOR_BLINK_TIME 500
/* Default attributes */
#define DEFAULT_SCREEN_ATTRIB (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
#define DEFAULT_POPUP_ATTRIB (FOREGROUND_BLUE | FOREGROUND_RED | \
BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED |
BACKGROUND_INTENSITY)
+/* Object type magic numbers */
+typedef enum _CONSOLE_IO_OBJECT_TYPE
+{
+ INPUT_BUFFER = 0x01, // --> Input-type handles
+ SCREEN_BUFFER = 0x02 // --> Output-type handles
+} CONSOLE_IO_OBJECT_TYPE;
+
+typedef struct _CONSOLE_IO_OBJECT
+{
+ CONSOLE_IO_OBJECT_TYPE Type;
+ PCONSOLE Console;
+ LONG AccessRead, AccessWrite;
+ LONG ExclusiveRead, ExclusiveWrite;
+ LONG HandleCount;
+} CONSOLE_IO_OBJECT, *PCONSOLE_IO_OBJECT;
/************************************************************************
* Screen buffer structure represents the win32 screen buffer object. *
@@ -35,7 +49,7 @@
typedef struct _CONSOLE_SCREEN_BUFFER
{
- Object_t Header; /* Object header */
+ CONSOLE_IO_OBJECT Header; /* Object header */
LIST_ENTRY ListEntry; /* Entry in console's list of buffers */
BYTE *Buffer; /* CHAR_INFO */ /* Pointer to screen buffer */
@@ -59,7 +73,7 @@
typedef struct _CONSOLE_INPUT_BUFFER
{
- Object_t Header; /* Object header */
+ CONSOLE_IO_OBJECT Header; /* Object header */
ULONG InputBufferSize; /* Size of this input buffer */
LIST_ENTRY InputEvents; /* List head for input event queue */
@@ -69,77 +83,50 @@
USHORT Mode; /* Console Input Buffer mode flags */
} CONSOLE_INPUT_BUFFER, *PCONSOLE_INPUT_BUFFER;
-typedef struct ConsoleInput_t
-{
- LIST_ENTRY ListEntry;
- INPUT_RECORD InputEvent;
-} ConsoleInput;
-
typedef struct _FRONTEND_VTBL
{
/*
* Internal interface (functions called by the console server only)
*/
- VOID (WINAPI *CleanupConsole)(struct _CONSOLE* Console);
- VOID (WINAPI *WriteStream)(struct _CONSOLE* Console,
+ VOID (WINAPI *CleanupConsole)(PCONSOLE Console);
+ VOID (WINAPI *WriteStream)(PCONSOLE Console,
SMALL_RECT* Block,
LONG CursorStartX,
LONG CursorStartY,
UINT ScrolledLines,
CHAR *Buffer,
UINT Length);
- VOID (WINAPI *DrawRegion)(struct _CONSOLE* Console,
+ VOID (WINAPI *DrawRegion)(PCONSOLE Console,
SMALL_RECT* Region);
- BOOL (WINAPI *SetCursorInfo)(struct _CONSOLE* Console,
+ BOOL (WINAPI *SetCursorInfo)(PCONSOLE Console,
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
- BOOL (WINAPI *SetScreenInfo)(struct _CONSOLE* Console,
+ BOOL (WINAPI *SetScreenInfo)(PCONSOLE Console,
PCONSOLE_SCREEN_BUFFER ScreenBuffer,
UINT OldCursorX,
UINT OldCursorY);
- BOOL (WINAPI *UpdateScreenInfo)(struct _CONSOLE* Console,
+ BOOL (WINAPI *UpdateScreenInfo)(PCONSOLE Console,
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
- NTSTATUS (WINAPI *ResizeBuffer)(struct _CONSOLE* Console,
+ NTSTATUS (WINAPI *ResizeBuffer)(PCONSOLE Console,
PCONSOLE_SCREEN_BUFFER ScreenBuffer,
COORD Size);
- VOID (WINAPI *ResizeTerminal)(struct _CONSOLE* Console);
- BOOL (WINAPI *ProcessKeyCallback)(struct _CONSOLE* Console,
+ VOID (WINAPI *ResizeTerminal)(PCONSOLE Console);
+ BOOL (WINAPI *ProcessKeyCallback)(PCONSOLE Console,
MSG* msg,
BYTE KeyStateMenu,
DWORD ShiftState,
UINT VirtualKeyCode,
BOOL Down);
- VOID (WINAPI *RefreshInternalInfo)(struct _CONSOLE* Console);
+ VOID (WINAPI *RefreshInternalInfo)(PCONSOLE Console);
/*
* External interface (functions corresponding to the Console API)
*/
- VOID (WINAPI *ChangeTitle)(struct _CONSOLE* Console);
- BOOL (WINAPI *ChangeIcon)(struct _CONSOLE* Console,
+ VOID (WINAPI *ChangeTitle)(PCONSOLE Console);
+ BOOL (WINAPI *ChangeIcon)(PCONSOLE Console,
HICON hWindowIcon);
- HWND (WINAPI *GetConsoleWindowHandle)(struct _CONSOLE* Console);
+ HWND (WINAPI *GetConsoleWindowHandle)(PCONSOLE Console);
} FRONTEND_VTBL, *PFRONTEND_VTBL;
-
-#define ConioDrawRegion(Console, Region)
(Console)->TermIFace.Vtbl->DrawRegion((Console), (Region))
-#define ConioWriteStream(Console, Block, CurStartX, CurStartY, ScrolledLines, Buffer,
Length) \
- (Console)->TermIFace.Vtbl->WriteStream((Console), (Block), (CurStartX),
(CurStartY), \
- (ScrolledLines), (Buffer), (Length))
-#define ConioSetCursorInfo(Console, Buff)
(Console)->TermIFace.Vtbl->SetCursorInfo((Console), (Buff))
-#define ConioSetScreenInfo(Console, Buff, OldCursorX, OldCursorY) \
- (Console)->TermIFace.Vtbl->SetScreenInfo((Console), (Buff), (OldCursorX),
(OldCursorY))
-#define ConioUpdateScreenInfo(Console, Buff) \
- (Console)->TermIFace.Vtbl->UpdateScreenInfo((Console), (Buff))
-#define ConioChangeTitle(Console) (Console)->TermIFace.Vtbl->ChangeTitle(Console)
-#define ConioCleanupConsole(Console)
(Console)->TermIFace.Vtbl->CleanupConsole(Console)
-#define ConioChangeIcon(Console, hWindowIcon)
(Console)->TermIFace.Vtbl->ChangeIcon((Console), (hWindowIcon))
-#define ConioResizeBuffer(Console, Buff, Size)
(Console)->TermIFace.Vtbl->ResizeBuffer((Console), (Buff), (Size))
-#define ConioResizeTerminal(Console)
(Console)->TermIFace.Vtbl->ResizeTerminal((Console))
-#define ConioProcessKeyCallback(Console, Msg, KeyStateMenu, ShiftState, VirtualKeyCode,
Down) \
- (Console)->TermIFace.Vtbl->ProcessKeyCallback((Console), (Msg),
(KeyStateMenu), (ShiftState), (VirtualKeyCode), (Down))
-#define ConioGetConsoleWindowHandle(Console) \
- (Console)->TermIFace.Vtbl->GetConsoleWindowHandle((Console))
-#define ConioRefreshInternalInfo(Console) \
- (Console)->TermIFace.Vtbl->RefreshInternalInfo((Console))
typedef struct _FRONTEND_IFACE
{
@@ -148,7 +135,6 @@
PVOID OldData; /* Reserved */
} FRONTEND_IFACE, *PFRONTEND_IFACE;
-#if 0 // Temporarily put in consrv.h
/*
* WARNING: Change the state of the console ONLY when the console is locked !
*/
@@ -159,7 +145,6 @@
CONSOLE_TERMINATING , /* Console about to be destroyed (but still not) */
CONSOLE_IN_DESTRUCTION /* Console in destruction */
} CONSOLE_STATE, *PCONSOLE_STATE;
-#endif
typedef struct _CONSOLE
{
@@ -231,14 +216,6 @@
DWORD Event);
/* coninput.c */
-#define ConSrvGetInputBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
- ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \
- (Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC)
-#define ConSrvGetInputBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access,
LockConsole) \
- ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry),
\
- (Access), (LockConsole), CONIO_INPUT_BUFFER_MAGIC)
-#define ConSrvReleaseInputBuffer(Buff, IsConsoleLocked) \
- ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
VOID WINAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
NTSTATUS FASTCALL ConioProcessInputEvent(PCONSOLE Console,
PINPUT_RECORD InputEvent);
@@ -248,27 +225,11 @@
(((Rect)->Top) > ((Rect)->Bottom) ? 0 : ((Rect)->Bottom) -
((Rect)->Top) + 1)
#define ConioRectWidth(Rect) \
(((Rect)->Left) > ((Rect)->Right) ? 0 : ((Rect)->Right) -
((Rect)->Left) + 1)
-#define ConSrvGetScreenBuffer(ProcessData, Handle, Ptr, Access, LockConsole) \
- ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), NULL, \
- (Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC)
-#define ConSrvGetScreenBufferAndHandleEntry(ProcessData, Handle, Ptr, Entry, Access,
LockConsole) \
- ConSrvGetObject((ProcessData), (Handle), (Object_t **)(Ptr), (Entry),
\
- (Access), (LockConsole), CONIO_SCREEN_BUFFER_MAGIC)
-#define ConSrvReleaseScreenBuffer(Buff, IsConsoleLocked) \
- ConSrvReleaseObject(&(Buff)->Header, (IsConsoleLocked))
+
PBYTE FASTCALL ConioCoordToPointer(PCONSOLE_SCREEN_BUFFER Buf, ULONG X, ULONG Y);
VOID FASTCALL ConioDrawConsole(PCONSOLE Console);
NTSTATUS FASTCALL ConioWriteConsole(PCONSOLE Console, PCONSOLE_SCREEN_BUFFER Buff,
CHAR *Buffer, DWORD Length, BOOL Attrib);
-NTSTATUS FASTCALL ConSrvCreateScreenBuffer(IN OUT PCONSOLE Console,
- OUT PCONSOLE_SCREEN_BUFFER* Buffer,
- IN COORD ScreenBufferSize,
- IN USHORT ScreenAttrib,
- IN USHORT PopupAttrib,
- IN ULONG DisplayMode,
- IN BOOLEAN IsCursorVisible,
- IN ULONG CursorSize);
-VOID WINAPI ConioDeleteScreenBuffer(PCONSOLE_SCREEN_BUFFER Buffer);
DWORD FASTCALL ConioEffectiveCursorSize(PCONSOLE Console, DWORD Scale);
/* EOF */
Copied: branches/ros-csrss/win32ss/user/consrv/include/console.h (from r58689,
branches/ros-csrss/win32ss/user/consrv/console.h)
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/i…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/console.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/include/console.h [iso-8859-1] Sun Apr 7
23:18:59 2013
@@ -1,32 +1,13 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/consrv/console.h
- * PURPOSE: Consoles Management
- * PROGRAMMERS: Hermes Belusca-Maito
+ * FILE: win32ss/user/consrv/include/console.h
+ * PURPOSE: Public Console Management Interface
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*/
#pragma once
-#if 0
-/*
- * WARNING: Change the state of the console ONLY when the console is locked !
- */
-typedef enum _CONSOLE_STATE
-{
- CONSOLE_INITIALIZING, /* Console is initializing */
- CONSOLE_RUNNING , /* Console running */
- CONSOLE_TERMINATING , /* Console about to be destroyed (but still not) */
- CONSOLE_IN_DESTRUCTION /* Console in destruction */
-} CONSOLE_STATE, *PCONSOLE_STATE;
-#endif
-
-
-VOID WINAPI ConSrvInitConsoleSupport(VOID);
-NTSTATUS WINAPI ConSrvInitConsole(OUT PCONSOLE* NewConsole,
- IN OUT PCONSOLE_START_INFO ConsoleStartInfo,
- IN PCSR_PROCESS ConsoleLeaderProcess);
-VOID WINAPI ConSrvDeleteConsole(PCONSOLE Console);
BOOL FASTCALL ConSrvValidateConsolePointer(PCONSOLE Console);
BOOL FASTCALL ConSrvValidateConsoleState(PCONSOLE Console,
CONSOLE_STATE ExpectedState);
Copied: branches/ros-csrss/win32ss/user/consrv/include/settings.h (from r58689,
branches/ros-csrss/win32ss/user/consrv/settings.h)
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/i…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/settings.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/include/settings.h [iso-8859-1] Sun Apr 7
23:18:59 2013
@@ -1,9 +1,9 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/consrv/settings.h
- * PURPOSE: Consoles settings management
- * PROGRAMMERS: Hermes Belusca - Maito
+ * FILE: win32ss/user/consrv/include/settings.h
+ * PURPOSE: Public Console Settings Management Interface
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*
* NOTE: Adapted from existing code.
*/
Modified: branches/ros-csrss/win32ss/user/consrv/init.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/i…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/init.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/init.c [iso-8859-1] Sun Apr 7 23:18:59 2013
@@ -9,7 +9,8 @@
/* INCLUDES *******************************************************************/
#include "consrv.h"
-#include "conio.h"
+#include "api.h"
+#include "procinit.h"
#include "console.h"
#define NDEBUG
Modified: branches/ros-csrss/win32ss/user/consrv/lineinput.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/l…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/lineinput.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/lineinput.c [iso-8859-1] Sun Apr 7 23:18:59
2013
@@ -9,6 +9,8 @@
/* INCLUDES *******************************************************************/
#include "consrv.h"
+#include "console.h"
+#include "include/conio.h"
#include "conio.h"
#define NDEBUG
Added: branches/ros-csrss/win32ss/user/consrv/procinit.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/p…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/procinit.h (added)
+++ branches/ros-csrss/win32ss/user/consrv/procinit.h [iso-8859-1] Sun Apr 7 23:18:59
2013
@@ -1,0 +1,24 @@
+/*
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PROJECT: ReactOS Console Server DLL
+ * FILE: win32ss/user/consrv/procinit.h
+ * PURPOSE: Functions for console processes initialization
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
+ */
+
+#pragma once
+
+NTSTATUS FASTCALL ConSrvAllocateConsole(PCONSOLE_PROCESS_DATA ProcessData,
+ PHANDLE pInputHandle,
+ PHANDLE pOutputHandle,
+ PHANDLE pErrorHandle,
+ PCONSOLE_START_INFO ConsoleStartInfo);
+NTSTATUS FASTCALL ConSrvInheritConsole(PCONSOLE_PROCESS_DATA ProcessData,
+ PCONSOLE Console,
+ BOOL CreateNewHandlesTable,
+ PHANDLE pInputHandle,
+ PHANDLE pOutputHandle,
+ PHANDLE pErrorHandle);
+VOID FASTCALL ConSrvRemoveConsole(PCONSOLE_PROCESS_DATA ProcessData);
+
+/* EOF */
Propchange: branches/ros-csrss/win32ss/user/consrv/procinit.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/ros-csrss/win32ss/user/consrv/settings.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/s…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/settings.c [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/settings.c [iso-8859-1] Sun Apr 7 23:18:59
2013
@@ -2,8 +2,8 @@
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
* FILE: win32ss/user/consrv/settings.c
- * PURPOSE: Consoles settings management
- * PROGRAMMERS: Hermes Belusca - Maito
+ * PURPOSE: Console settings management
+ * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca(a)sfr.fr)
*
* NOTE: Adapted from existing code.
*/
@@ -11,8 +11,9 @@
/* INCLUDES *******************************************************************/
#include "consrv.h"
+#include "include/conio.h"
#include "conio.h"
-#include "settings.h"
+#include "include/settings.h"
#include <stdio.h> // for swprintf
Removed: branches/ros-csrss/win32ss/user/consrv/settings.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-csrss/win32ss/user/consrv/s…
==============================================================================
--- branches/ros-csrss/win32ss/user/consrv/settings.h [iso-8859-1] (original)
+++ branches/ros-csrss/win32ss/user/consrv/settings.h (removed)
@@ -1,95 +1,0 @@
-/*
- * COPYRIGHT: See COPYING in the top level directory
- * PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/consrv/settings.h
- * PURPOSE: Consoles settings management
- * PROGRAMMERS: Hermes Belusca - Maito
- *
- * NOTE: Adapted from existing code.
- */
-
-#pragma once
-
-/* STRUCTURES *****************************************************************/
-
-/*
- * Structure used to hold terminal-specific information
- */
-typedef struct _TERMINAL_INFO
-{
- ULONG Size; /* Size of the memory buffer pointed by TermInfo */
- PVOID TermInfo; /* Address (or offset when talking to console.dll) of the memory
buffer holding terminal information */
-} TERMINAL_INFO, *PTERMINAL_INFO;
-
-/*
- * Structure used to hold console information
- */
-typedef struct _CONSOLE_INFO
-{
- ULONG HistoryBufferSize;
- ULONG NumberOfHistoryBuffers;
- BOOLEAN HistoryNoDup;
-
-/* BOOLEAN */ ULONG FullScreen; /* Give the type of console: GUI (windowed) or TUI
(fullscreen) */
- BOOLEAN QuickEdit;
- BOOLEAN InsertMode;
- ULONG InputBufferSize;
- COORD ScreenBufferSize;
-/* SIZE */ COORD ConsoleSize; /* The size of the console */
-
- BOOLEAN CursorBlinkOn;
- BOOLEAN ForceCursorOff;
- ULONG CursorSize;
-
- USHORT ScreenAttrib; // CHAR_INFO ScreenFillAttrib
- USHORT PopupAttrib;
-
- COLORREF Colors[16]; /* Color palette */
-
- ULONG CodePage;
-
- WCHAR ConsoleTitle[MAX_PATH + 1];
-} CONSOLE_INFO, *PCONSOLE_INFO;
-
-#define RGBFromAttrib(Console, Attribute) ((Console)->Colors[(Attribute) &
0xF])
-#define TextAttribFromAttrib(Attribute) ((Attribute) & 0xF)
-#define BkgdAttribFromAttrib(Attribute) (((Attribute) >> 4) & 0xF)
-#define MakeAttrib(TextAttrib, BkgdAttrib) (DWORD)((((BkgdAttrib) & 0xF) << 4)
| ((TextAttrib) & 0xF))
-
-/*
- * Structure used to communicate with console.dll
- */
-typedef struct _CONSOLE_PROPS
-{
- HWND hConsoleWindow;
- BOOL ShowDefaultParams;
-
- BOOLEAN AppliedConfig;
- DWORD ActiveStaticControl;
-
- CONSOLE_INFO ci; /* Console-specific informations */
- TERMINAL_INFO TerminalInfo; /* Frontend-specific parameters */
-} CONSOLE_PROPS, *PCONSOLE_PROPS;
-
-/* FUNCTIONS ******************************************************************/
-
-#ifndef CONSOLE_H__ // If we aren't included by console.dll
-
-BOOL ConSrvOpenUserSettings(DWORD ProcessId,
- LPCWSTR ConsoleTitle,
- PHKEY hSubKey,
- REGSAM samDesired,
- BOOL bCreate);
-
-BOOL ConSrvReadUserSettings(IN OUT PCONSOLE_INFO ConsoleInfo,
- IN DWORD ProcessId);
-BOOL ConSrvWriteUserSettings(IN PCONSOLE_INFO ConsoleInfo,
- IN DWORD ProcessId);
-VOID ConSrvGetDefaultSettings(IN OUT PCONSOLE_INFO ConsoleInfo,
- IN DWORD ProcessId);
-VOID ConSrvApplyUserSettings(IN PCONSOLE Console,
- IN PCONSOLE_INFO ConsoleInfo);
-
-#endif
-
-/* EOF */