test: output.h Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# output.h

Go to the documentation of this file.

    00001 /*++
    00002
    00003 Copyright (c) 1985 - 1999, Microsoft Corporation
    00004
    00005 Module Name:
    00006
    00007     output.h
    00008
    00009 Abstract:
    00010
    00011     This module contains the internal structures and definitions used
    00012     by the output (screen) component of the NT console subsystem.
    00013
    00014 Author:
    00015
    00016     Therese Stowell (thereses) 12-Nov-1990
    00017
    00018 Revision History:
    00019
    00020 --*/
    00021
    00022 // the characters of one row of screen buffer
    00023 // we keep the following values so that we don't write
    00024 // more pixels to the screen than we have to:
    00025 // left is initialized to screenbuffer width.  right is
    00026 // initialized to zero.
    00027 //
    00028 //      [     foo.bar    12-12-61                       ]
    00029 //       ^    ^                  ^                     ^
    00030 //       |    |                  |                     |
    00031 //     Chars Left               Right                end of Chars buffer
    00032
    00033 typedef struct _CHAR_ROW {
    00034     SHORT Right;            // one past rightmost bound of chars in Chars array (array will be full width)
    00035     SHORT OldRight;         // old one past rightmost bound of chars in Chars array (array will be full width)
    00036     SHORT Left;             // leftmost bound of chars in Chars array (array will be full width)
    00037     SHORT OldLeft;          // old leftmost bound of chars in Chars array (array will be full width)
    00038     PWCHAR Chars;            // all chars in row up to last non-space char
    00039 #if defined(FE_SB)
    00040     PBYTE KAttrs;            // all DBCS lead & trail bit in row
    00041         #define ATTR_LEADING_BYTE  0x01
    00042         #define ATTR_TRAILING_BYTE 0x02
    00043         #define ATTR_DBCSSBCS_BYTE 0x03
    00044         #define ATTR_SEPARATE_BYTE 0x10
    00045         #define ATTR_EUDCFLAG_BYTE 0x20
    00046 #endif
    00047 } CHAR_ROW, *PCHAR_ROW;
    00048
    00049 // run-length encoded data structure for attributes
    00050
    00051 typedef struct _ATTR_PAIR {
    00052     SHORT Length;            // number of times attribute appears
    00053     WORD Attr;              // attribute
    00054 } ATTR_PAIR, *PATTR_PAIR;
    00055
    00056 // the attributes of one row of screen buffer
    00057
    00058 typedef struct _ATTR_ROW {
    00059     SHORT Length;            // length of attr pair array
    00060     ATTR_PAIR AttrPair;     // use this if only one pair
    00061     PATTR_PAIR Attrs;       // attr pair array
    00062 } ATTR_ROW, *PATTR_ROW;
    00063
    00064 // information associated with one row of screen buffer
    00065
    00066 typedef struct _ROW {
    00067     CHAR_ROW CharRow;
    00068     ATTR_ROW AttrRow;
    00069 } ROW, *PROW;
    00070
    00071 #if defined(FE_SB)
    00072 typedef struct _DBCS_SCREEN_BUFFER {
    00073     /*
    00074      * all DBCS lead & trail bit buffer
    00075      */
    00076     PBYTE KAttrRows;
    00077     /*
    00078      * Temporary buffer for translate Unicode<--ASCII.
    00079      *
    00080      * Used as follows routine:
    00081      *   WriteOutputString
    00082      *   WriteRegionToScreen
    00083      *   DoWriteConsole
    00084      */
    00085     PWCHAR TransBufferCharacter;
    00086     PBYTE  TransBufferAttribute;
    00087     /*
    00088      * Used as follows routine:
    00089      *   SrvWriteConsole
    00090      */
    00091     PWCHAR TransWriteConsole;
    00092 } DBCS_SCREEN_BUFFER, *PDBCS_SCREEN_BUFFER;
    00093 #endif
    00094
    00095 typedef struct _TEXT_BUFFER_FONT_INFO {
    00096     struct _TEXT_BUFFER_FONT_INFO *NextTextBufferFont;
    00097     COORD FontSize;     // Desired size.  Pixels (x,y) or Points (0, -p)
    00098     DWORD FontNumber;   // index into fontinfo[]  -  sometimes out of date
    00099     WCHAR FaceName[LF_FACESIZE];
    00100     LONG Weight;
    00101     BYTE Family;
    00102     UINT FontCodePage;  // Code page for this font
    00103 } TEXT_BUFFER_FONT_INFO, *PTEXT_BUFFER_FONT_INFO;
    00104
    00105 typedef struct _TEXT_BUFFER_INFO {
    00106     PROW Rows;
    00107     PWCHAR TextRows;
    00108     SHORT FirstRow;  // indexes top row (not necessarily 0)
    00109     BOOLEAN CursorMoved;
    00110     BOOLEAN CursorVisible;  // whether cursor is visible (set by user)
    00111     BOOLEAN CursorOn;       // whether blinking cursor is on or not
    00112     BOOLEAN DoubleCursor;   // whether the cursor size should be doubled
    00113     BOOLEAN DelayCursor;    // don't toggle cursor on next timer message
    00114     COORD CursorPosition;   // current position on screen (in screen buffer coords).
    00115     ULONG CursorSize;
    00116     WORD CursorYSize;
    00117     WORD  UpdatingScreen;   // whether cursor is visible (set by console)
    00118     ULONG ModeIndex;     // fullscreen font and mode
    00119 #ifdef i386
    00120     // the following fields are used only by fullscreen textmode
    00121     COORD WindowedWindowSize; // window size in windowed mode
    00122     COORD WindowedScreenSize; // screen buffer size in windowed mode
    00123     COORD MousePosition;
    00124 #endif
    00125     ULONG Flags;        // indicate screen update hint state
    00126
    00127     PTEXT_BUFFER_FONT_INFO ListOfTextBufferFont;
    00128     TEXT_BUFFER_FONT_INFO  CurrentTextBufferFont;
    00129
    00130 #if defined(FE_SB)
    00131     BOOLEAN CursorBlink;
    00132     BOOLEAN CursorDBEnable;
    00133     DBCS_SCREEN_BUFFER DbcsScreenBuffer;
    00134 #endif
    00135 } TEXT_BUFFER_INFO, *PTEXT_BUFFER_INFO;
    00136
    00137 typedef struct _GRAPHICS_BUFFER_INFO {
    00138     ULONG BitMapInfoLength;
    00139     LPBITMAPINFO lpBitMapInfo;
    00140     PVOID BitMap;
    00141     PVOID ClientBitMap;
    00142     HANDLE ClientProcess;
    00143     HANDLE hMutex;
    00144     HANDLE hSection;
    00145     DWORD dwUsage;
    00146 } GRAPHICS_BUFFER_INFO, *PGRAPHICS_BUFFER_INFO;
    00147
    00148 #define CONSOLE_TEXTMODE_BUFFER 1
    00149 #define CONSOLE_GRAPHICS_BUFFER 2
    00150 #define CONSOLE_OEMFONT_DISPLAY 4
    00151
    00152 typedef struct _SCREEN_INFORMATION {
    00153     struct _CONSOLE_INFORMATION *Console;
    00154     ULONG Flags;
    00155     DWORD OutputMode;
    00156     ULONG RefCount;
    00157     CONSOLE_SHARE_ACCESS ShareAccess;   // share mode
    00158     COORD ScreenBufferSize; // dimensions of buffer
    00159     SMALL_RECT  Window;       // window location in screen buffer coordinates
    00160     WORD ResizingWindow;   // > 0 if we should ignore WM_SIZE messages
    00161     WORD Attributes;        // attributes of written text
    00162     WORD PopupAttributes;   // attributes of popup text
    00163     BOOLEAN WindowMaximizedX;
    00164     BOOLEAN WindowMaximizedY;
    00165     BOOLEAN WindowMaximized;
    00166     UINT CommandIdLow;
    00167     UINT CommandIdHigh;
    00168     HCURSOR CursorHandle;
    00169     HPALETTE hPalette;
    00170     UINT dwUsage;
    00171     int CursorDisplayCount;
    00172     int WheelDelta;
    00173     union {
    00174         TEXT_BUFFER_INFO TextInfo;
    00175         GRAPHICS_BUFFER_INFO GraphicsInfo;
    00176     } BufferInfo;
    00177     struct _SCREEN_INFORMATION *Next;
    00178 #if defined(FE_SB)
    00179     BYTE   WriteConsoleDbcsLeadByte[2];
    00180     BYTE   FillOutDbcsLeadChar;
    00181     WCHAR  LineChar[6];
    00182         #define UPPER_LEFT_CORNER   0
    00183         #define UPPER_RIGHT_CORNER  1
    00184         #define HORIZONTAL_LINE     2
    00185         #define VERTICAL_LINE       3
    00186         #define BOTTOM_LEFT_CORNER  4
    00187         #define BOTTOM_RIGHT_CORNER 5
    00188     BYTE BisectFlag;
    00189         #define BISECT_LEFT   0x01
    00190         #define BISECT_TOP    0x02
    00191         #define BISECT_RIGHT  0x04
    00192         #define BISECT_BOTTOM 0x08
    00193 #if defined(FE_IME)
    00194     struct _CONVERSIONAREA_INFORMATION *ConvScreenInfo;
    00195 #else
    00196     PVOID ConvScreenInfo;
    00197 #endif // FE_IME
    00198 #endif
    00199 } SCREEN_INFORMATION, *PSCREEN_INFORMATION;
    00200
    00201 typedef struct _WINDOW_LIMITS {
    00202     COORD MinimumWindowSize;    // minimum dimensions of window
    00203     COORD MaximumWindowSize;    // maximum dimensions of window
    00204     COORD MaxWindow;            // in pixels
    00205     COORD FullScreenSize;
    00206 } WINDOW_LIMITS, *PWINDOW_LIMITS;
    00207
    00208 //
    00209 // the following values are used for TextInfo.Flags
    00210 //
    00211
    00212 #define TEXT_VALID_HINT 1
    00213 #define SINGLE_ATTRIBUTES_PER_LINE 2    // only one attribute per line
    00214 #if defined(FE_IME)
    00215 #define CONSOLE_CONVERSION_AREA_REDRAW 4
    00216 #endif
    00217
    00218 //
    00219 // the following value is put in CharInfo.OldLength if the value shouldn't
    00220 // be used.
    00221 //
    00222
    00223 #define INVALID_OLD_LENGTH -1
    00224
    00225 //
    00226 // the following mask is used to test for valid text attributes.
    00227 //
    00228
    00229 #if defined(FE_SB)
    00230 #define VALID_TEXT_ATTRIBUTES (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY | \
    00231 COMMON_LVB_LEADING_BYTE | COMMON_LVB_TRAILING_BYTE | COMMON_LVB_GRID_HORIZONTAL | COMMON_LVB_GRID_LVERTICAL | COMMON_LVB_GRID_RVERTICAL | COMMON_LVB_REVERSE_VIDEO | COMMON_LVB_UNDERSCORE )
    00232 #else
    00233 #define VALID_TEXT_ATTRIBUTES (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY)
    00234 #endif
    00235
    00236 //
    00237 // the following macros are used to calculate 1) the cursor size in pixels
    00238 // and 2) the upper left pixel in the cursor, given the font size and
    00239 // the cursor size.
    00240 //
    00241
    00242 #define CURSOR_SIZE_IN_PIXELS(FONT_SIZE_Y,SIZE) ((((FONT_SIZE_Y)*(SIZE))+99)/100)
    00243 #define CURSOR_Y_OFFSET_IN_PIXELS(FONT_SIZE_Y,YSIZE) ((FONT_SIZE_Y) - (YSIZE))
    00244
    00245 //
    00246 // the following values are used to create the textmode cursor.
    00247 //
    00248
    00249 #define CURSOR_TIMER 1
    00250 #define CURSOR_SMALL_SIZE 25    // large enough to be one pixel on a six pixel font
    00251 #define CURSOR_BIG_SIZE 50
    00252
    00253 //
    00254 // the following macro returns TRUE if the given screen buffer is the
    00255 // active screen buffer.
    00256 //
    00257
    00258 #define ACTIVE_SCREEN_BUFFER(SCREEN_INFO) ((SCREEN_INFO)->Console->CurrentScreenBuffer == SCREEN_INFO)
    00259
    00260 //
    00261 // the following mask is used to create console windows.
    00262 //
    00263
    00264 #define CONSOLE_WINDOW_FLAGS (WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL)
    00265 #define CONSOLE_WINDOW_EX_FLAGS (WS_EX_OVERLAPPEDWINDOW | WS_EX_ACCEPTFILES | WS_EX_APPWINDOW )
    00266
    00267 #define WINDOW_SIZE_X(WINDOW) ((SHORT)(((WINDOW)->Right - (WINDOW)->Left + 1)))
    00268 #define WINDOW_SIZE_Y(WINDOW) ((SHORT)(((WINDOW)->Bottom - (WINDOW)->Top + 1)))
    00269 #define CONSOLE_WINDOW_SIZE_X(SCREEN) (WINDOW_SIZE_X(&(SCREEN)->Window))
    00270 #define CONSOLE_WINDOW_SIZE_Y(SCREEN) (WINDOW_SIZE_Y(&(SCREEN)->Window))
    00271
    00272 #define CONSOLE_MIN_SCREENBUFFER_X 1
    00273 #define CONSOLE_MIN_SCREENBUFFER_Y 1