/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Console Server DLL
- * FILE: win32ss/user/winsrv/consrv/include/conio.h
+ * FILE: consrv/include/conio.h
* PURPOSE: Public Console I/O Interface
* PROGRAMMERS: Gé van Geldorp
* Jeffrey Morlan
LIST_ENTRY ListEntry; /* Entry in console's list of buffers */
- COORD ScreenBufferSize; /* Size of this screen buffer. (Rows, Columns) for text-mode and (Width, Height) for graphics */
+ COORD ScreenBufferSize; /* Size of this screen buffer. (Rows, Columns) for text-mode and (Width, Height) for graphics-mode */
COORD ViewSize; /* Associated "view" (i.e. console) size */
COORD OldScreenBufferSize; /* Old size of this screen buffer */
CONSOLE_CURSOR_INFO CursorInfo; // FIXME: Keep this member or not ??
/*********************************************/
+ HPALETTE PaletteHandle; /* Handle to the color palette associated to this buffer */
+ UINT PaletteUsage; /* The new use of the system palette. See SetSystemPaletteUse 'uUsage' parameter */
+
// WORD ScreenDefaultAttrib; /* Default screen char attribute */
// WORD PopupDefaultAttrib; /* Default popup char attribute */
USHORT Mode; /* Output buffer modes */
+
+ // PVOID Data; /* Private data for the frontend to use */
};
COORD ScreenBufferSize;
USHORT ScreenAttrib;
USHORT PopupAttrib;
- BOOLEAN IsCursorVisible;
ULONG CursorSize;
+ BOOLEAN IsCursorVisible;
} TEXTMODE_BUFFER_INFO, *PTEXTMODE_BUFFER_INFO;
typedef struct _TEXTMODE_SCREEN_BUFFER
ULONG BitMapUsage; /* See the uUsage parameter of GetDIBits */
HANDLE hSection; /* Handle to the memory shared section for the bitmap buffer */
PVOID BitMap; /* Our bitmap buffer */
+
PVOID ClientBitMap; /* A copy of the client view of our bitmap buffer */
HANDLE Mutex; /* Our mutex, used to synchronize read / writes to the bitmap buffer */
HANDLE ClientMutex; /* A copy of the client handle to our mutex */
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; /* Input buffer modes */
} CONSOLE_INPUT_BUFFER, *PCONSOLE_INPUT_BUFFER;
-typedef struct _FRONTEND FRONTEND, *PFRONTEND;
+typedef struct _TERMINAL TERMINAL, *PTERMINAL;
/* HACK: */ typedef struct _CONSOLE_INFO *PCONSOLE_INFO;
-typedef struct _FRONTEND_VTBL
+typedef struct _TERMINAL_VTBL
{
/*
* Internal interface (functions called by the console server only)
*/
- NTSTATUS (WINAPI *InitFrontEnd)(IN OUT PFRONTEND This,
- IN struct _CONSOLE* Console);
- VOID (WINAPI *DeinitFrontEnd)(IN OUT PFRONTEND This);
+ NTSTATUS (NTAPI *InitTerminal)(IN OUT PTERMINAL This,
+ IN struct _CONSOLE* Console);
+ VOID (NTAPI *DeinitTerminal)(IN OUT PTERMINAL This);
/* Interface used for both text-mode and graphics screen buffers */
- VOID (WINAPI *DrawRegion)(IN OUT PFRONTEND This,
- SMALL_RECT* Region);
+ VOID (NTAPI *DrawRegion)(IN OUT PTERMINAL This,
+ SMALL_RECT* Region);
/* Interface used only for text-mode screen buffers */
- VOID (WINAPI *WriteStream)(IN OUT PFRONTEND This,
- SMALL_RECT* Block,
- SHORT CursorStartX,
- SHORT CursorStartY,
- UINT ScrolledLines,
- PWCHAR Buffer,
- UINT Length);
- BOOL (WINAPI *SetCursorInfo)(IN OUT PFRONTEND This,
- PCONSOLE_SCREEN_BUFFER ScreenBuffer);
- BOOL (WINAPI *SetScreenInfo)(IN OUT PFRONTEND This,
- PCONSOLE_SCREEN_BUFFER ScreenBuffer,
- SHORT OldCursorX,
- SHORT OldCursorY);
- VOID (WINAPI *ResizeTerminal)(IN OUT PFRONTEND This);
- BOOL (WINAPI *ProcessKeyCallback)(IN OUT PFRONTEND This,
- MSG* msg,
- BYTE KeyStateMenu,
- DWORD ShiftState,
- UINT VirtualKeyCode,
- BOOL Down);
- VOID (WINAPI *RefreshInternalInfo)(IN OUT PFRONTEND This);
+ VOID (NTAPI *WriteStream)(IN OUT PTERMINAL This,
+ SMALL_RECT* Region,
+ SHORT CursorStartX,
+ SHORT CursorStartY,
+ UINT ScrolledLines,
+ PWCHAR Buffer,
+ UINT Length);
+ BOOL (NTAPI *SetCursorInfo)(IN OUT PTERMINAL This,
+ PCONSOLE_SCREEN_BUFFER ScreenBuffer);
+ BOOL (NTAPI *SetScreenInfo)(IN OUT PTERMINAL This,
+ PCONSOLE_SCREEN_BUFFER ScreenBuffer,
+ SHORT OldCursorX,
+ SHORT OldCursorY);
+ VOID (NTAPI *ResizeTerminal)(IN OUT PTERMINAL This);
+ VOID (NTAPI *SetActiveScreenBuffer)(IN OUT PTERMINAL This);
+ VOID (NTAPI *ReleaseScreenBuffer)(IN OUT PTERMINAL This,
+ IN PCONSOLE_SCREEN_BUFFER ScreenBuffer);
/*
* External interface (functions corresponding to the Console API)
*/
- VOID (WINAPI *ChangeTitle)(IN OUT PFRONTEND This);
- BOOL (WINAPI *ChangeIcon)(IN OUT PFRONTEND This,
- HICON hWindowIcon);
- HWND (WINAPI *GetConsoleWindowHandle)(IN OUT PFRONTEND This);
- VOID (WINAPI *GetLargestConsoleWindowSize)(IN OUT PFRONTEND This,
- PCOORD pSize);
- ULONG (WINAPI *GetDisplayMode)(IN OUT PFRONTEND This);
- BOOL (WINAPI *SetDisplayMode)(IN OUT PFRONTEND This,
- ULONG NewMode);
- INT (WINAPI *ShowMouseCursor)(IN OUT PFRONTEND This,
- BOOL Show);
- BOOL (WINAPI *SetMouseCursor)(IN OUT PFRONTEND This,
- HCURSOR hCursor);
- HMENU (WINAPI *MenuControl)(IN OUT PFRONTEND This,
- UINT cmdIdLow,
- UINT cmdIdHigh);
- BOOL (WINAPI *SetMenuClose)(IN OUT PFRONTEND This,
- BOOL Enable);
+ VOID (NTAPI *ChangeTitle)(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 *SetPalette)(IN OUT PTERMINAL This,
+ HPALETTE PaletteHandle,
+ UINT PaletteUsage);
+ INT (NTAPI *ShowMouseCursor)(IN OUT PTERMINAL This,
+ BOOL Show);
#if 0 // Possible future front-end interface
- BOOL (WINAPI *GetFrontEndProperty)(IN OUT PFRONTEND This,
- ULONG Flag,
- PVOID Info,
- ULONG Size);
- BOOL (WINAPI *SetFrontEndProperty)(IN OUT PFRONTEND This,
- ULONG Flag,
- PVOID Info /*,
- ULONG Size */);
+ BOOL (NTAPI *GetTerminalProperty)(IN OUT PTERMINAL This,
+ ULONG Flag,
+ PVOID Info,
+ ULONG Size);
+ BOOL (NTAPI *SetTerminalProperty)(IN OUT PTERMINAL This,
+ ULONG Flag,
+ PVOID Info /*,
+ ULONG Size */);
#endif
-} FRONTEND_VTBL, *PFRONTEND_VTBL;
+} TERMINAL_VTBL, *PTERMINAL_VTBL;
-struct _FRONTEND
+struct _TERMINAL
{
- PFRONTEND_VTBL Vtbl; /* Virtual table */
+ PTERMINAL_VTBL Vtbl; /* Virtual table */
struct _CONSOLE* Console; /* Console to which the frontend is attached to */
PVOID Data; /* Private data */
- PVOID OldData; /* Reserved */
};
/*
CONSOLE_IN_DESTRUCTION /* Console in destruction */
} CONSOLE_STATE, *PCONSOLE_STATE;
+// HACK!!
+struct _CONSOLE;
+struct _WINSRV_CONSOLE;
+/* HACK: */ typedef struct _CONSOLE *PCONSOLE;
+#include "conio_winsrv.h"
+
typedef struct _CONSOLE
{
+/******************************* Console Set-up *******************************/
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 */
- LIST_ENTRY ProcessList; /* List of processes owning the console. The first one is the so-called "Console Leader Process" */
+ /**/WINSRV_CONSOLE;/**/ // HACK HACK!!
- FRONTEND TermIFace; /* Frontend-specific interface */
+ CONSOLE_STATE State; /* State of the console */
+ 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 */
ULONG LineWakeupMask; /* Bitmap of which control characters will end line input */
/***************************************************/
- BOOLEAN QuickEdit;
BOOLEAN InsertMode;
- UINT CodePage;
-
- 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 */
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 */
+ 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;
+} CONSOLE; // , *PCONSOLE;
-/* PauseFlags values (internal only) */
-#define PAUSED_FROM_KEYBOARD 0x1
-#define PAUSED_FROM_SCROLLBAR 0x2
-#define PAUSED_FROM_SELECTION 0x4
+// #include "conio_winsrv.h"
/* console.c */
-VOID FASTCALL ConioPause(PCONSOLE Console, UINT Flags);
-VOID FASTCALL ConioUnpause(PCONSOLE Console, UINT Flags);
-
+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
-ConDrvConsoleProcessCtrlEvent(IN PCONSOLE Console,
+ConSrvConsoleProcessCtrlEvent(IN PCONSOLE Console,
IN ULONG ProcessGroupId,
- IN ULONG Event);
+ IN ULONG CtrlEvent);
/* coninput.c */
-VOID WINAPI ConioProcessKey(PCONSOLE Console, MSG* msg);
-NTSTATUS FASTCALL ConioProcessInputEvent(PCONSOLE Console,
- PINPUT_RECORD InputEvent);
+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 */
#define ConioInitRect(Rect, top, left, bottom, right) \
#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);
-VOID FASTCALL ConioDrawConsole(PCONSOLE Console);
+VOID ConioDrawConsole(PCONSOLE Console);
NTSTATUS ConioResizeBuffer(PCONSOLE Console,
PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
COORD Size);
PWCHAR Buffer,
DWORD Length,
BOOL Attrib);
-DWORD FASTCALL ConioEffectiveCursorSize(PCONSOLE Console,
+DWORD ConioEffectiveCursorSize(PCONSOLE Console,
DWORD Scale);
/* EOF */