#pragma once
+#include "rect.h"
+
#define CSR_DEFAULT_CURSOR_SIZE 25
/* Default attributes */
/*
* Internal interface (functions called by the console server only)
*/
- NTSTATUS (NTAPI *InitFrontEnd)(IN OUT PTERMINAL This,
+ NTSTATUS (NTAPI *InitTerminal)(IN OUT PTERMINAL This,
IN struct _CONSOLE* Console);
- VOID (NTAPI *DeinitFrontEnd)(IN OUT PTERMINAL This);
+ VOID (NTAPI *DeinitTerminal)(IN OUT PTERMINAL This);
/* Interface used for both text-mode and graphics screen buffers */
VOID (NTAPI *DrawRegion)(IN OUT PTERMINAL This,
SMALL_RECT* Region);
/* Interface used only for text-mode screen buffers */
VOID (NTAPI *WriteStream)(IN OUT PTERMINAL This,
- SMALL_RECT* Block,
+ SMALL_RECT* Region,
SHORT CursorStartX,
SHORT CursorStartY,
UINT ScrolledLines,
VOID (NTAPI *SetActiveScreenBuffer)(IN OUT PTERMINAL This);
VOID (NTAPI *ReleaseScreenBuffer)(IN OUT PTERMINAL This,
IN PCONSOLE_SCREEN_BUFFER ScreenBuffer);
- BOOL (NTAPI *ProcessKeyCallback)(IN OUT PTERMINAL This,
- MSG* msg,
- BYTE KeyStateMenu,
- DWORD ShiftState,
- UINT VirtualKeyCode,
- BOOL Down);
- VOID (NTAPI *RefreshInternalInfo)(IN OUT PTERMINAL This);
/*
* External interface (functions corresponding to the Console API)
*/
VOID (NTAPI *ChangeTitle)(IN OUT PTERMINAL This);
- BOOL (NTAPI *ChangeIcon)(IN OUT PTERMINAL This,
- HICON IconHandle);
- HWND (NTAPI *GetConsoleWindowHandle)(IN OUT PTERMINAL This);
VOID (NTAPI *GetLargestConsoleWindowSize)(IN OUT PTERMINAL This,
PCOORD pSize);
- BOOL (NTAPI *GetSelectionInfo)(IN OUT PTERMINAL This,
- PCONSOLE_SELECTION_INFO pSelectionInfo);
+ // BOOL (NTAPI *GetSelectionInfo)(IN OUT PTERMINAL This,
+ // PCONSOLE_SELECTION_INFO pSelectionInfo);
BOOL (NTAPI *SetPalette)(IN OUT PTERMINAL This,
HPALETTE PaletteHandle,
UINT PaletteUsage);
- ULONG (NTAPI *GetDisplayMode)(IN OUT PTERMINAL This);
- BOOL (NTAPI *SetDisplayMode)(IN OUT PTERMINAL This,
- ULONG NewMode);
INT (NTAPI *ShowMouseCursor)(IN OUT PTERMINAL This,
BOOL Show);
- BOOL (NTAPI *SetMouseCursor)(IN OUT PTERMINAL This,
- HCURSOR CursorHandle);
- HMENU (NTAPI *MenuControl)(IN OUT PTERMINAL This,
- UINT CmdIdLow,
- UINT CmdIdHigh);
- BOOL (NTAPI *SetMenuClose)(IN OUT PTERMINAL This,
- BOOL Enable);
#if 0 // Possible future front-end interface
- BOOL (NTAPI *GetFrontEndProperty)(IN OUT PTERMINAL This,
+ BOOL (NTAPI *GetTerminalProperty)(IN OUT PTERMINAL This,
ULONG Flag,
PVOID Info,
ULONG Size);
- BOOL (NTAPI *SetFrontEndProperty)(IN OUT PTERMINAL This,
+ BOOL (NTAPI *SetTerminalProperty)(IN OUT PTERMINAL This,
ULONG Flag,
PVOID Info /*,
ULONG Size */);
TERMINAL TermIFace; /* Frontend-specific interface */
ULONG ConsoleID; /* The ID of the console */
+ LIST_ENTRY ListEntry; /* Entry in the list of consoles */
/**************************** Input buffer and data ***************************/
CONSOLE_INPUT_BUFFER InputBuffer; /* Input buffer of the console */
UINT InputCodePage;
- /** Put those things in TEXTMODE_SCREEN_BUFFER ?? **/
- 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 */
+ /** 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 */
- /***************************************************/
+ ULONG LineWakeupMask; /* Bitmap of which control characters will end line input */
+ /*************************************************/
BOOLEAN InsertMode;
PCONSOLE_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */
UINT OutputCodePage;
-/**************************** 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 defined when the console leader is launched; it never changes. Always NULL-terminated */
UNICODE_STRING Title; /* Title of console. Always NULL-terminated */
/* coninput.c */
VOID NTAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
-NTSTATUS ConioAddInputEvent(PCONSOLE Console,
- PINPUT_RECORD InputEvent,
- BOOLEAN AppendToEnd);
-NTSTATUS ConioProcessInputEvent(PCONSOLE Console,
- PINPUT_RECORD InputEvent);
+NTSTATUS
+ConioAddInputEvents(PCONSOLE Console,
+ PINPUT_RECORD InputRecords,
+ ULONG NumEventsToWrite,
+ PULONG NumEventsWritten,
+ BOOLEAN AppendToEnd);
+NTSTATUS
+ConioProcessInputEvent(PCONSOLE Console,
+ PINPUT_RECORD InputEvent);
/* conoutput.c */
-#define ConioInitRect(Rect, top, left, bottom, right) \
-do { \
- ((Rect)->Top) = top; \
- ((Rect)->Left) = left; \
- ((Rect)->Bottom) = bottom; \
- ((Rect)->Right) = right; \
-} while (0)
-#define ConioIsRectEmpty(Rect) \
- (((Rect)->Left > (Rect)->Right) || ((Rect)->Top > (Rect)->Bottom))
-#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)
+/*
+ * 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);