[CONSRV]: Rename context members with a more explicit name (code "style" only).
[reactos.git] / win32ss / user / winsrv / consrv / include / conio_winsrv.h
index e076293..d04ad32 100644 (file)
@@ -2,7 +2,8 @@
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS Console Server DLL
  * FILE:            consrv/include/conio_winsrv.h
- * PURPOSE:         Public Console I/O Interface
+ * PURPOSE:         Public Console I/O Interface - Offers wrap-up structures
+ *                  over the console objects exposed by the console driver.
  * PROGRAMMERS:     Gé van Geldorp
  *                  Jeffrey Morlan
  *                  Hermes Belusca-Maito (hermes.belusca@sfr.fr)
 
 // This is ALMOST a HACK!!!!!!!
 // Helpers for code refactoring
+#ifdef USE_NEW_CONSOLE_WAY
+
+#define _CONSRV_CONSOLE  _WINSRV_CONSOLE
+#define  CONSRV_CONSOLE   WINSRV_CONSOLE
+#define PCONSRV_CONSOLE  PWINSRV_CONSOLE
+
+#else
+
 #define _CONSRV_CONSOLE  _CONSOLE
 #define  CONSRV_CONSOLE   CONSOLE
 #define PCONSRV_CONSOLE  PCONSOLE
 
+#endif
 
 #define CSR_DEFAULT_CURSOR_SIZE 25
 
+/* VGA character cell */
+typedef struct _CHAR_CELL
+{
+    CHAR Char;
+    BYTE Attributes;
+} CHAR_CELL, *PCHAR_CELL;
+C_ASSERT(sizeof(CHAR_CELL) == 2);
+
+// HACK!!
+struct _WINSRV_CONSOLE;
+/* HACK: */ typedef struct _WINSRV_CONSOLE *PWINSRV_CONSOLE;
+#ifdef USE_NEW_CONSOLE_WAY
+#include "conio.h"
+#endif
+
 typedef struct _FRONTEND FRONTEND, *PFRONTEND;
 /* HACK: */ typedef struct _CONSOLE_INFO *PCONSOLE_INFO;
 typedef struct _FRONTEND_VTBL
@@ -45,6 +70,7 @@ typedef struct _FRONTEND_VTBL
                               UINT ScrolledLines,
                               PWCHAR Buffer,
                               UINT Length);
+    VOID (NTAPI *RingBell)(IN OUT PFRONTEND This);
     BOOL (NTAPI *SetCursorInfo)(IN OUT PFRONTEND This,
                                 PCONSOLE_SCREEN_BUFFER ScreenBuffer);
     BOOL (NTAPI *SetScreenInfo)(IN OUT PFRONTEND This,
@@ -90,10 +116,9 @@ struct _FRONTEND
     PFRONTEND_VTBL Vtbl;        /* Virtual table */
     NTSTATUS (NTAPI *UnloadFrontEnd)(IN OUT PFRONTEND This);
 
-    // struct _WINSRV_CONSOLE*
     struct _CONSRV_CONSOLE* Console;   /* Console to which the frontend is attached to */
-    PVOID Data;                 /* Private data  */
-    PVOID OldData;              /* Reserved      */
+    PVOID Context;              /* Private context */
+    PVOID Context2;             /* Private context */
 };
 
 /* PauseFlags values (internal only) */
@@ -105,12 +130,18 @@ typedef struct _WINSRV_CONSOLE
 {
 /******************************* Console Set-up *******************************/
     /* This **MUST** be FIRST!! */
-    // CONSOLE;
+#ifdef USE_NEW_CONSOLE_WAY
+    CONSOLE;
+    // CONSOLE Console;
+    // // PCONSOLE Console;
+#endif
 
     // 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 */
 
+    HANDLE InitEvents[MAX_INIT_EVENTS];         /* Initialization events */
+
     FRONTEND FrontEndIFace;                     /* Frontend-specific interface */
 
 /******************************* Process support ******************************/
@@ -118,8 +149,6 @@ typedef struct _WINSRV_CONSOLE
     PCONSOLE_PROCESS_DATA NotifiedLastCloseProcess; /* Pointer to the unique process that needs to be notified when the console leader process is killed */
     BOOLEAN NotifyLastClose;        /* TRUE if the console should send a control event when the console leader process is killed */
 
-    BOOLEAN QuickEdit;
-
 /******************************* Pausing support ******************************/
     BYTE PauseFlags;
     LIST_ENTRY  ReadWaitQueue;      /* List head for the queue of unique input buffer read wait blocks */
@@ -132,6 +161,19 @@ typedef struct _WINSRV_CONSOLE
     ULONG NumberOfHistoryBuffers;           /* Maximum number of history buffers allowed */
     BOOLEAN HistoryNoDup;                   /* Remove old duplicate history entries */
 
+/**************************** Input Line Discipline ***************************/
+    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;
+    BOOLEAN QuickEdit;
+
 /************************ Virtual DOS Machine support *************************/
     COORD   VDMBufferSize;             /* Real size of the VDM buffer, in units of ??? */
     HANDLE  VDMBufferSection;          /* Handle to the memory shared section for the VDM buffer */
@@ -144,9 +186,12 @@ typedef struct _WINSRV_CONSOLE
     HANDLE ErrorHardwareEvent;
 
 /****************************** Other properties ******************************/
-    COLORREF Colors[16];                    /* Colour palette */
+    LIST_ENTRY PopupWindows;                /* List of popup windows */
+    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 */
+    COLORREF   Colors[16];                  /* Colour palette */
 
-} WINSRV_CONSOLE, *PWINSRV_CONSOLE;
+} WINSRV_CONSOLE; // , *PWINSRV_CONSOLE;
 
 /* console.c */
 VOID ConioPause(PCONSRV_CONSOLE Console, UINT Flags);
@@ -168,40 +213,16 @@ DWORD ConioEffectiveCursorSize(PCONSRV_CONSOLE Console,
                                DWORD Scale);
 
 NTSTATUS
-ConioAddInputEvents(PCONSRV_CONSOLE Console,
-                    PINPUT_RECORD InputRecords,
-                    ULONG NumEventsToWrite,
-                    PULONG NumEventsWritten,
-                    BOOLEAN AppendToEnd);
-NTSTATUS
 ConioProcessInputEvent(PCONSRV_CONSOLE 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(PCONSRV_CONSOLE Console);
-NTSTATUS ConioResizeBuffer(PCONSRV_CONSOLE Console,
+NTSTATUS ConioResizeBuffer(PCONSOLE /*PCONSRV_CONSOLE*/ Console,
                            PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
                            COORD Size);
-NTSTATUS ConioWriteConsole(PCONSRV_CONSOLE Console,
-                           PTEXTMODE_SCREEN_BUFFER Buff,
-                           PWCHAR Buffer,
-                           DWORD Length,
-                           BOOL Attrib);
+
+/* terminal.c */
+VOID ConioDrawConsole(PCONSRV_CONSOLE Console);
 
 /* EOF */