#include "rect.h"
-#define CSR_DEFAULT_CURSOR_SIZE 25
-
/* 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
{
-// ANY_TYPE_BUFFER = 0x00, // --> Match any types of IO handles
- TEXTMODE_BUFFER = 0x01, // --> Output-type handles for text SBs
- GRAPHICS_BUFFER = 0x02, // --> Output-type handles for graphics SBs
+ UNKNOWN = 0x00, // --> Unknown object
+ TEXTMODE_BUFFER = 0x01, // --> Output-type object for text SBs
+ GRAPHICS_BUFFER = 0x02, // --> Output-type object for graphics SBs
SCREEN_BUFFER = 0x03, // --> Any SB type
- INPUT_BUFFER = 0x04 // --> Input-type handles
+ INPUT_BUFFER = 0x04, // --> Input-type object
+ ANY_TYPE_BUFFER = 0x07, // --> Any IO object
} CONSOLE_IO_OBJECT_TYPE;
typedef struct _CONSOLE_IO_OBJECT
{
CONSOLE_IO_OBJECT_TYPE Type;
+
struct _CONSOLE* /* PCONSOLE */ Console;
+ LONG ReferenceCount; /* Is incremented each time a console object gets referenced */
+
LONG AccessRead, AccessWrite;
LONG ExclusiveRead, ExclusiveWrite;
- LONG HandleCount;
} CONSOLE_IO_OBJECT, *PCONSOLE_IO_OBJECT;
/* Interface used for both text-mode and graphics screen buffers */
VOID (NTAPI *DrawRegion)(IN OUT PTERMINAL This,
SMALL_RECT* Region);
+
+
+
+/************ Line discipline ***************/
+
/* Interface used only for text-mode screen buffers */
- VOID (NTAPI *WriteStream)(IN OUT PTERMINAL This,
- SMALL_RECT* Region,
- SHORT CursorStartX,
- SHORT CursorStartY,
- UINT ScrolledLines,
- PWCHAR Buffer,
- UINT Length);
+
+ NTSTATUS (NTAPI *ReadStream)(IN OUT PTERMINAL This,
+ /**/IN PUNICODE_STRING ExeName /**/OPTIONAL/**/,/**/
+ IN BOOLEAN Unicode,
+ /**PWCHAR Buffer,**/
+ OUT PVOID Buffer,
+ IN OUT PCONSOLE_READCONSOLE_CONTROL ReadControl,
+ IN ULONG NumCharsToRead,
+ OUT PULONG NumCharsRead OPTIONAL);
+ NTSTATUS (NTAPI *WriteStream)(IN OUT PTERMINAL This,
+ PTEXTMODE_SCREEN_BUFFER Buff,
+ PWCHAR Buffer,
+ DWORD Length,
+ BOOL Attrib);
+
+/************ Line discipline ***************/
+
+
+
BOOL (NTAPI *SetCursorInfo)(IN OUT PTERMINAL This,
PCONSOLE_SCREEN_BUFFER ScreenBuffer);
BOOL (NTAPI *SetScreenInfo)(IN OUT PTERMINAL This,
// HACK!!
struct _CONSOLE;
-struct _WINSRV_CONSOLE;
/* HACK: */ typedef struct _CONSOLE *PCONSOLE;
#include "conio_winsrv.h"
ULONG ConsoleID; /* The ID of the console */
LIST_ENTRY ListEntry; /* Entry in the list of consoles */
-/**************************** Input buffer and data ***************************/
+ HANDLE UnpauseEvent; /* When != NULL, event for pausing the console */
+
+/******************************** Input buffer ********************************/
CONSOLE_INPUT_BUFFER InputBuffer; /* Input buffer of the console */
UINT InputCodePage;
- /** Put those things in CONSOLE_INPUT_BUFFER ?? **/
- PWCHAR LineBuffer; /* Current line being input, in line buffered mode */
- ULONG LineMaxSize; /* Maximum size of line in characters (including CR+LF) */
- ULONG LineSize; /* Current size of line */
- ULONG 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 InsertMode;
-
/******************************* Screen buffers *******************************/
LIST_ENTRY BufferList; /* List of all screen buffers for this console */
PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */
UNICODE_STRING OriginalTitle; /* Original title of console, the one defined when the console leader is launched; it never changes. Always NULL-terminated */
UNICODE_STRING Title; /* Title of console. Always NULL-terminated */
- HANDLE UnpauseEvent; /* When != NULL, event for pausing the console */
-
COORD ConsoleSize; /* The current size of the console, for text-mode only */
BOOLEAN FixedSize; /* TRUE if the console is of fixed size */
- COLORREF Colors[16]; /* Colour palette */
-
} CONSOLE; // , *PCONSOLE;
-// #include "conio_winsrv.h"
-
/* console.c */
VOID NTAPI
ConDrvPause(PCONSOLE Console);
VOID NTAPI
ConDrvUnpause(PCONSOLE Console);
-PCONSOLE_PROCESS_DATA NTAPI
-ConSrvGetConsoleLeaderProcess(IN PCONSOLE Console);
NTSTATUS
ConSrvConsoleCtrlEvent(IN ULONG CtrlEvent,
IN PCONSOLE_PROCESS_DATA ProcessData);
-NTSTATUS NTAPI
-ConSrvConsoleProcessCtrlEvent(IN PCONSOLE Console,
- IN ULONG ProcessGroupId,
- IN ULONG CtrlEvent);
-
-/* coninput.c */
-VOID NTAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
-NTSTATUS
-ConioAddInputEvents(PCONSOLE Console,
- PINPUT_RECORD InputRecords,
- ULONG NumEventsToWrite,
- PULONG NumEventsWritten,
- BOOLEAN AppendToEnd);
-NTSTATUS
-ConioProcessInputEvent(PCONSOLE Console,
- PINPUT_RECORD InputEvent);
/* conoutput.c */
-
-/*
- * From MSDN:
- * "The lpMultiByteStr and lpWideCharStr pointers must not be the same.
- * If they are the same, the function fails, and GetLastError returns
- * ERROR_INVALID_PARAMETER."
- */
-#define ConsoleUnicodeCharToAnsiChar(Console, dChar, sWChar) \
- ASSERT((ULONG_PTR)dChar != (ULONG_PTR)sWChar); \
- WideCharToMultiByte((Console)->OutputCodePage, 0, (sWChar), 1, (dChar), 1, NULL, NULL)
-
-#define ConsoleAnsiCharToUnicodeChar(Console, dWChar, sChar) \
- ASSERT((ULONG_PTR)dWChar != (ULONG_PTR)sChar); \
- MultiByteToWideChar((Console)->OutputCodePage, 0, (sChar), 1, (dWChar), 1)
-
PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
VOID ConioDrawConsole(PCONSOLE Console);
NTSTATUS ConioResizeBuffer(PCONSOLE Console,
PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
COORD Size);
-NTSTATUS ConioWriteConsole(PCONSOLE Console,
- PTEXTMODE_SCREEN_BUFFER Buff,
- PWCHAR Buffer,
- DWORD Length,
- BOOL Attrib);
-DWORD ConioEffectiveCursorSize(PCONSOLE Console,
- DWORD Scale);
/* EOF */