mirror of
https://github.com/reactos/reactos.git
synced 2024-11-02 21:09:15 +00:00
0473031b87
- Move console-related Vista+ functions from client/vista.c to a dedicated client/console/vista.c file, and add it to compilation. - Move some helper functions from console.c to history.c. - Use the new api index names in history.c. [CONSRV] - Merge CSRSS_GET_HISTORY_INFO and PCSRSS_SET_HISTORY_INFO structures declarations into CSRSS_HISTORY_INFO, and therefore use only one member of it inside CONSOLE_API_MESSAGE structure. - WORD --> UINT for few structure members related to history information. svn path=/branches/ros-csrss/; revision=57713
183 lines
9.3 KiB
C
183 lines
9.3 KiB
C
/*
|
|
* 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:
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#define CSR_DEFAULT_CURSOR_SIZE 25
|
|
|
|
/* Object type magic numbers */
|
|
|
|
#define CONIO_CONSOLE_MAGIC 0x00000001
|
|
#define CONIO_SCREEN_BUFFER_MAGIC 0x00000002
|
|
|
|
/************************************************************************
|
|
* 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 tagCSRSS_SCREEN_BUFFER
|
|
{
|
|
Object_t Header; /* Object header */
|
|
BYTE *Buffer; /* pointer to screen buffer */
|
|
USHORT MaxX, MaxY; /* size of the entire scrollback buffer */
|
|
USHORT ShowX, ShowY; /* beginning offset for the actual display area */
|
|
ULONG CurrentX; /* Current X cursor position */
|
|
ULONG CurrentY; /* Current Y cursor position */
|
|
WORD DefaultAttrib; /* default char attribute */
|
|
USHORT VirtualY; /* top row of buffer being displayed, reported to callers */
|
|
CONSOLE_CURSOR_INFO CursorInfo;
|
|
USHORT Mode;
|
|
LIST_ENTRY ListEntry; /* entry in console's list of buffers */
|
|
} CSRSS_SCREEN_BUFFER, *PCSRSS_SCREEN_BUFFER;
|
|
|
|
typedef struct tagCSRSS_CONSOLE
|
|
{
|
|
Object_t Header; /* Object header */
|
|
LONG ReferenceCount;
|
|
CRITICAL_SECTION Lock;
|
|
struct tagCSRSS_CONSOLE *Prev, *Next; /* Next and Prev consoles in console wheel */
|
|
HANDLE ActiveEvent;
|
|
LIST_ENTRY InputEvents; /* List head for input event queue */
|
|
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 */
|
|
LIST_ENTRY HistoryBuffers;
|
|
UINT HistoryBufferSize; /* size for newly created history buffers */
|
|
UINT NumberOfHistoryBuffers; /* maximum number of history buffers allowed */
|
|
BOOLEAN HistoryNoDup; /* remove old duplicate history entries */
|
|
LIST_ENTRY BufferList; /* List of all screen buffers for this console */
|
|
PCSRSS_SCREEN_BUFFER ActiveBuffer; /* Pointer to currently active screen buffer */
|
|
WORD Mode; /* Console mode flags */
|
|
UNICODE_STRING Title; /* Title of console */
|
|
DWORD HardwareState; /* _GDI_MANAGED, _DIRECT */
|
|
HWND hWindow;
|
|
COORD Size;
|
|
PVOID PrivateData;
|
|
UINT CodePage;
|
|
UINT OutputCodePage;
|
|
struct tagCSRSS_CONSOLE_VTBL *Vtbl;
|
|
LIST_ENTRY ProcessList;
|
|
struct tagALIAS_HEADER *Aliases;
|
|
CONSOLE_SELECTION_INFO Selection;
|
|
BYTE PauseFlags;
|
|
HANDLE UnpauseEvent;
|
|
} CSRSS_CONSOLE, *PCSRSS_CONSOLE;
|
|
|
|
typedef struct tagCSRSS_CONSOLE_VTBL
|
|
{
|
|
VOID (WINAPI *InitScreenBuffer)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
|
|
VOID (WINAPI *WriteStream)(PCSRSS_CONSOLE Console, SMALL_RECT *Block, LONG CursorStartX, LONG CursorStartY,
|
|
UINT ScrolledLines, CHAR *Buffer, UINT Length);
|
|
VOID (WINAPI *DrawRegion)(PCSRSS_CONSOLE Console, SMALL_RECT *Region);
|
|
BOOL (WINAPI *SetCursorInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
|
|
BOOL (WINAPI *SetScreenInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer,
|
|
UINT OldCursorX, UINT OldCursorY);
|
|
BOOL (WINAPI *UpdateScreenInfo)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer);
|
|
BOOL (WINAPI *ChangeTitle)(PCSRSS_CONSOLE Console);
|
|
VOID (WINAPI *CleanupConsole)(PCSRSS_CONSOLE Console);
|
|
BOOL (WINAPI *ChangeIcon)(PCSRSS_CONSOLE Console, HICON hWindowIcon);
|
|
NTSTATUS (WINAPI *ResizeBuffer)(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER ScreenBuffer, COORD Size);
|
|
} CSRSS_CONSOLE_VTBL, *PCSRSS_CONSOLE_VTBL;
|
|
|
|
typedef struct ConsoleInput_t
|
|
{
|
|
LIST_ENTRY ListEntry;
|
|
INPUT_RECORD InputEvent;
|
|
} ConsoleInput;
|
|
|
|
/* CONSOLE_SELECTION_INFO dwFlags values */
|
|
#define CONSOLE_NO_SELECTION 0x0
|
|
#define CONSOLE_SELECTION_IN_PROGRESS 0x1
|
|
#define CONSOLE_SELECTION_NOT_EMPTY 0x2
|
|
#define CONSOLE_MOUSE_SELECTION 0x4
|
|
#define CONSOLE_MOUSE_DOWN 0x8
|
|
/* HistoryFlags values */
|
|
#define HISTORY_NO_DUP_FLAG 0x1
|
|
|
|
/* PauseFlags values (internal only) */
|
|
#define PAUSED_FROM_KEYBOARD 0x1
|
|
#define PAUSED_FROM_SCROLLBAR 0x2
|
|
#define PAUSED_FROM_SELECTION 0x4
|
|
|
|
#define ConioInitScreenBuffer(Console, Buff) (Console)->Vtbl->InitScreenBuffer((Console), (Buff))
|
|
#define ConioDrawRegion(Console, Region) (Console)->Vtbl->DrawRegion((Console), (Region))
|
|
#define ConioWriteStream(Console, Block, CurStartX, CurStartY, ScrolledLines, Buffer, Length) \
|
|
(Console)->Vtbl->WriteStream((Console), (Block), (CurStartX), (CurStartY), \
|
|
(ScrolledLines), (Buffer), (Length))
|
|
#define ConioSetCursorInfo(Console, Buff) (Console)->Vtbl->SetCursorInfo((Console), (Buff))
|
|
#define ConioSetScreenInfo(Console, Buff, OldCursorX, OldCursorY) \
|
|
(Console)->Vtbl->SetScreenInfo((Console), (Buff), (OldCursorX), (OldCursorY))
|
|
#define ConioUpdateScreenInfo(Console, Buff) \
|
|
(Console)->Vtbl->UpdateScreenInfo(Console, Buff)
|
|
#define ConioChangeTitle(Console) (Console)->Vtbl->ChangeTitle(Console)
|
|
#define ConioCleanupConsole(Console) (Console)->Vtbl->CleanupConsole(Console)
|
|
#define ConioChangeIcon(Console, hWindowIcon) (Console)->Vtbl->ChangeIcon(Console, hWindowIcon)
|
|
#define ConioResizeBuffer(Console, Buff, Size) (Console)->Vtbl->ResizeBuffer(Console, Buff, Size)
|
|
|
|
/* console.c */
|
|
NTSTATUS FASTCALL ConioConsoleFromProcessData(PCONSOLE_PROCESS_DATA ProcessData,
|
|
PCSRSS_CONSOLE *Console);
|
|
VOID WINAPI ConioDeleteConsole(Object_t *Object);
|
|
VOID WINAPI CsrInitConsoleSupport(VOID);
|
|
VOID FASTCALL ConioPause(PCSRSS_CONSOLE Console, UINT Flags);
|
|
VOID FASTCALL ConioUnpause(PCSRSS_CONSOLE Console, UINT Flags);
|
|
VOID FASTCALL ConioConsoleCtrlEvent(DWORD Event, PCONSOLE_PROCESS_DATA ProcessData);
|
|
VOID FASTCALL ConioConsoleCtrlEventTimeout(DWORD Event,
|
|
PCONSOLE_PROCESS_DATA ProcessData,
|
|
DWORD Timeout);
|
|
|
|
/* coninput.c */
|
|
#define ConioLockConsole(ProcessData, Handle, Ptr, Access) \
|
|
Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), Access, CONIO_CONSOLE_MAGIC)
|
|
#define ConioUnlockConsole(Console) \
|
|
Win32CsrUnlockObject((Object_t *) Console)
|
|
void WINAPI ConioProcessKey(MSG *msg, PCSRSS_CONSOLE Console, BOOL TextMode);
|
|
|
|
/* 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 ConioLockScreenBuffer(ProcessData, Handle, Ptr, Access) \
|
|
Win32CsrLockObject((ProcessData), (Handle), (Object_t **)(Ptr), Access, CONIO_SCREEN_BUFFER_MAGIC)
|
|
#define ConioUnlockScreenBuffer(Buff) \
|
|
Win32CsrUnlockObject((Object_t *) Buff)
|
|
PBYTE FASTCALL ConioCoordToPointer(PCSRSS_SCREEN_BUFFER Buf, ULONG X, ULONG Y);
|
|
VOID FASTCALL ConioDrawConsole(PCSRSS_CONSOLE Console);
|
|
NTSTATUS FASTCALL ConioWriteConsole(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buff,
|
|
CHAR *Buffer, DWORD Length, BOOL Attrib);
|
|
NTSTATUS FASTCALL CsrInitConsoleScreenBuffer(PCSRSS_CONSOLE Console, PCSRSS_SCREEN_BUFFER Buffer);
|
|
VOID WINAPI ConioDeleteScreenBuffer(PCSRSS_SCREEN_BUFFER Buffer);
|
|
DWORD FASTCALL ConioEffectiveCursorSize(PCSRSS_CONSOLE Console, DWORD Scale);
|
|
|
|
/* alias.c */
|
|
VOID IntDeleteAllAliases(struct tagALIAS_HEADER *RootHeader);
|
|
|
|
/* lineinput.c */
|
|
struct tagHISTORY_BUFFER;
|
|
VOID FASTCALL HistoryDeleteBuffer(struct tagHISTORY_BUFFER *Hist);
|
|
VOID FASTCALL LineInputKeyDown(PCSRSS_CONSOLE Console, KEY_EVENT_RECORD *KeyEvent);
|
|
|
|
/* EOF */
|