1c2c66affSColin Finck /*
2c2c66affSColin Finck  * COPYRIGHT:       See COPYING in the top level directory
3c2c66affSColin Finck  * PROJECT:         ReactOS Console Server DLL
4c2c66affSColin Finck  * FILE:            win32ss/user/winsrv/consrv/include/conio.h
5c2c66affSColin Finck  * PURPOSE:         Public Console I/O Interface
6c2c66affSColin Finck  * PROGRAMMERS:     G� van Geldorp
7c2c66affSColin Finck  *                  Jeffrey Morlan
8c2c66affSColin Finck  *                  Hermes Belusca-Maito (hermes.belusca@sfr.fr)
9c2c66affSColin Finck  */
10c2c66affSColin Finck 
11c2c66affSColin Finck #pragma once
12c2c66affSColin Finck 
13c2c66affSColin Finck #include "rect.h"
14c2c66affSColin Finck 
15c2c66affSColin Finck /* Default attributes */
16c2c66affSColin Finck #define DEFAULT_SCREEN_ATTRIB   (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED)
17c2c66affSColin Finck #define DEFAULT_POPUP_ATTRIB    (FOREGROUND_BLUE | FOREGROUND_RED   | \
18c2c66affSColin Finck                                  BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY)
19c2c66affSColin Finck 
20c2c66affSColin Finck 
21c2c66affSColin Finck /* Object type magic numbers */
22c2c66affSColin Finck typedef enum _CONSOLE_IO_OBJECT_TYPE
23c2c66affSColin Finck {
24c2c66affSColin Finck     UNKNOWN         = 0x00, // --> Unknown object
25c2c66affSColin Finck     TEXTMODE_BUFFER = 0x01, // --> Output-type object for text SBs
26c2c66affSColin Finck     GRAPHICS_BUFFER = 0x02, // --> Output-type object for graphics SBs
27c2c66affSColin Finck     SCREEN_BUFFER   = 0x03, // --> Any SB type
28c2c66affSColin Finck     INPUT_BUFFER    = 0x04, // --> Input-type object
29c2c66affSColin Finck     ANY_TYPE_BUFFER = 0x07, // --> Any IO object
30c2c66affSColin Finck } CONSOLE_IO_OBJECT_TYPE;
31c2c66affSColin Finck 
32c2c66affSColin Finck typedef struct _CONSOLE_IO_OBJECT
33c2c66affSColin Finck {
34c2c66affSColin Finck     CONSOLE_IO_OBJECT_TYPE Type;
35c2c66affSColin Finck 
36c2c66affSColin Finck     struct _CONSOLE* /* PCONSOLE */ Console;
37c2c66affSColin Finck     LONG ReferenceCount;    /* Is incremented each time a console object gets referenced */
38c2c66affSColin Finck 
39c2c66affSColin Finck     LONG AccessRead, AccessWrite;
40c2c66affSColin Finck     LONG ExclusiveRead, ExclusiveWrite;
41c2c66affSColin Finck } CONSOLE_IO_OBJECT, *PCONSOLE_IO_OBJECT;
42c2c66affSColin Finck 
43c2c66affSColin Finck 
44c2c66affSColin Finck /******************************************************************************\
45c2c66affSColin Finck |*                                                                            *|
46c2c66affSColin Finck |*     Abstract "class" for screen-buffers, be they text-mode or graphics     *|
47c2c66affSColin Finck |*                                                                            *|
48c2c66affSColin Finck \******************************************************************************/
49c2c66affSColin Finck 
50c2c66affSColin Finck /*
51c2c66affSColin Finck  * See conoutput.c for the implementation
52c2c66affSColin Finck  */
53c2c66affSColin Finck 
5483c238e4SHermès Bélusca-Maïto #define GetType(This)   (((PCONSOLE_SCREEN_BUFFER)(This))->Header.Type)
55c2c66affSColin Finck 
5683c238e4SHermès Bélusca-Maïto typedef struct _CONSOLE_SCREEN_BUFFER
57c2c66affSColin Finck {
58c2c66affSColin Finck     CONSOLE_IO_OBJECT Header;           /* Object header - MUST BE IN FIRST PLACE */
59c2c66affSColin Finck 
60c2c66affSColin Finck     LIST_ENTRY ListEntry;               /* Entry in console's list of buffers */
61c2c66affSColin Finck 
62c2c66affSColin Finck     COORD   ScreenBufferSize;           /* Size of this screen buffer. (Rows, Columns) for text-mode and (Width, Height) for graphics-mode */
63c2c66affSColin Finck     COORD   ViewSize;                   /* Associated "view" (i.e. console) size */
64c2c66affSColin Finck 
65c2c66affSColin Finck     COORD   OldScreenBufferSize;        /* Old size of this screen buffer */
66c2c66affSColin Finck     COORD   OldViewSize;                /* Old associated view size */
67c2c66affSColin Finck 
68c2c66affSColin Finck     COORD   ViewOrigin;                 /* Beginning offset for the actual display area */
69c2c66affSColin Finck 
70c2c66affSColin Finck /***** Put that VV in TEXTMODE_SCREEN_BUFFER ?? *****/
71c2c66affSColin Finck     COORD   CursorPosition;             /* Current cursor position */
72c2c66affSColin Finck     BOOLEAN CursorBlinkOn;
73c2c66affSColin Finck     BOOLEAN ForceCursorOff;
74c2c66affSColin Finck //  ULONG   CursorSize;
75c2c66affSColin Finck     CONSOLE_CURSOR_INFO CursorInfo; // FIXME: Keep this member or not ??
76c2c66affSColin Finck /*********************************************/
77c2c66affSColin Finck 
78c2c66affSColin Finck     HPALETTE PaletteHandle;             /* Handle to the color palette associated to this buffer */
79c2c66affSColin Finck     UINT     PaletteUsage;              /* The new use of the system palette. See SetSystemPaletteUse 'uUsage' parameter */
80c2c66affSColin Finck 
811d3fb3e3SHermès Bélusca-Maïto //  USHORT   ScreenDefaultAttrib;       /* Default screen char attribute */
821d3fb3e3SHermès Bélusca-Maïto //  USHORT   PopupDefaultAttrib;        /* Default popup char attribute */
83c2c66affSColin Finck     USHORT Mode;                        /* Output buffer modes */
8483c238e4SHermès Bélusca-Maïto } CONSOLE_SCREEN_BUFFER, *PCONSOLE_SCREEN_BUFFER;
85c2c66affSColin Finck 
86c2c66affSColin Finck 
87c2c66affSColin Finck 
88c2c66affSColin Finck /******************************************************************************\
89c2c66affSColin Finck |*                                                                            *|
90c2c66affSColin Finck |*           Text-mode and graphics-mode screen-buffer "classes"              *|
91c2c66affSColin Finck |*                                                                            *|
92c2c66affSColin Finck \******************************************************************************/
93c2c66affSColin Finck 
94c2c66affSColin Finck /*
95c2c66affSColin Finck  * See text.c for the implementation
96c2c66affSColin Finck  */
97c2c66affSColin Finck 
98c2c66affSColin Finck /************************************************************************
99c2c66affSColin Finck  * Screen buffer structure represents the win32 screen buffer object.   *
100c2c66affSColin Finck  * Internally, the portion of the buffer being shown CAN loop past the  *
101c2c66affSColin Finck  * bottom of the virtual buffer and wrap around to the top.  Win32 does *
102c2c66affSColin Finck  * not do this.  I decided to do this because it eliminates the need to *
103c2c66affSColin Finck  * do a massive memcpy() to scroll the contents of the buffer up to     *
104c2c66affSColin Finck  * scroll the screen on output, instead I just shift down the position  *
105c2c66affSColin Finck  * to be displayed, and let it wrap around to the top again.            *
106c2c66affSColin Finck  * The VirtualY member keeps track of the top Y coord that win32        *
107c2c66affSColin Finck  * clients THINK is currently being displayed, because they think that  *
108c2c66affSColin Finck  * when the display reaches the bottom of the buffer and another line   *
109c2c66affSColin Finck  * being printed causes another line to scroll down, that the buffer IS *
110c2c66affSColin Finck  * memcpy()'s up, and the bottom of the buffer is still displayed, but  *
111c2c66affSColin Finck  * internally, I just wrap back to the top of the buffer.               *
112c2c66affSColin Finck  ************************************************************************/
113c2c66affSColin Finck 
114c2c66affSColin Finck typedef struct _TEXTMODE_BUFFER_INFO
115c2c66affSColin Finck {
116c2c66affSColin Finck     COORD   ScreenBufferSize;
1171d3fb3e3SHermès Bélusca-Maïto     COORD   ViewSize;
118c2c66affSColin Finck     USHORT  ScreenAttrib;
119c2c66affSColin Finck     USHORT  PopupAttrib;
120c2c66affSColin Finck     ULONG   CursorSize;
121c2c66affSColin Finck     BOOLEAN IsCursorVisible;
122c2c66affSColin Finck } TEXTMODE_BUFFER_INFO, *PTEXTMODE_BUFFER_INFO;
123c2c66affSColin Finck 
124c2c66affSColin Finck typedef struct _TEXTMODE_SCREEN_BUFFER
125c2c66affSColin Finck {
126c2c66affSColin Finck     CONSOLE_SCREEN_BUFFER;      /* Screen buffer base class - MUST BE IN FIRST PLACE */
127c2c66affSColin Finck 
1287babd931SHermès Bélusca-Maïto     USHORT     VirtualY;        /* Top row of buffer being displayed, reported to callers */
129c2c66affSColin Finck     PCHAR_INFO Buffer;          /* Pointer to UNICODE screen buffer (Buffer->Char.UnicodeChar only is valid, not Char.AsciiChar) */
130c2c66affSColin Finck 
1311d3fb3e3SHermès Bélusca-Maïto     USHORT ScreenDefaultAttrib; /* Default screen char attribute */
1321d3fb3e3SHermès Bélusca-Maïto     USHORT PopupDefaultAttrib;  /* Default popup char attribute */
133c2c66affSColin Finck } TEXTMODE_SCREEN_BUFFER, *PTEXTMODE_SCREEN_BUFFER;
134c2c66affSColin Finck 
135c2c66affSColin Finck 
136c2c66affSColin Finck /*
137c2c66affSColin Finck  * See graphics.c for the implementation
138c2c66affSColin Finck  */
139c2c66affSColin Finck 
140c2c66affSColin Finck typedef struct _GRAPHICS_BUFFER_INFO
141c2c66affSColin Finck {
142c2c66affSColin Finck     CONSOLE_GRAPHICS_BUFFER_INFO Info;
143c2c66affSColin Finck } GRAPHICS_BUFFER_INFO, *PGRAPHICS_BUFFER_INFO;
144c2c66affSColin Finck 
145c2c66affSColin Finck typedef struct _GRAPHICS_SCREEN_BUFFER
146c2c66affSColin Finck {
147c2c66affSColin Finck     CONSOLE_SCREEN_BUFFER;          /* Screen buffer base class - MUST BE IN FIRST PLACE */
148c2c66affSColin Finck 
149c2c66affSColin Finck     ULONG   BitMapInfoLength;       /* Real size of the structure pointed by BitMapInfo */
150c2c66affSColin Finck     LPBITMAPINFO BitMapInfo;        /* Information on the bitmap buffer */
151c2c66affSColin Finck     ULONG   BitMapUsage;            /* See the uUsage parameter of GetDIBits */
152c2c66affSColin Finck     HANDLE  hSection;               /* Handle to the memory shared section for the bitmap buffer */
153c2c66affSColin Finck     PVOID   BitMap;                 /* Our bitmap buffer */
154c2c66affSColin Finck 
155c2c66affSColin Finck     PVOID   ClientBitMap;           /* A copy of the client view of our bitmap buffer */
156c2c66affSColin Finck     HANDLE  Mutex;                  /* Our mutex, used to synchronize read / writes to the bitmap buffer */
157c2c66affSColin Finck     HANDLE  ClientMutex;            /* A copy of the client handle to our mutex */
158c2c66affSColin Finck     HANDLE  ClientProcess;          /* Handle to the client process who opened the buffer, to unmap the view */
159c2c66affSColin Finck } GRAPHICS_SCREEN_BUFFER, *PGRAPHICS_SCREEN_BUFFER;
160c2c66affSColin Finck 
161c2c66affSColin Finck 
162c2c66affSColin Finck 
163c2c66affSColin Finck typedef struct _CONSOLE_INPUT_BUFFER
164c2c66affSColin Finck {
165c2c66affSColin Finck     CONSOLE_IO_OBJECT Header;       /* Object header - MUST BE IN FIRST PLACE */
166c2c66affSColin Finck 
16790d795b0SHermès Bélusca-Maïto     ULONG       InputBufferSize;    /* Size of this input buffer (maximum number of events) -- UNUSED!! */
16890d795b0SHermès Bélusca-Maïto     ULONG       NumberOfEvents;     /* Current number of events in the queue */
16990d795b0SHermès Bélusca-Maïto     LIST_ENTRY  InputEvents;        /* Input events queue list head */
17090d795b0SHermès Bélusca-Maïto     HANDLE      ActiveEvent;        /* Event set when an input event is added to the queue */
171c2c66affSColin Finck 
172c2c66affSColin Finck     USHORT      Mode;               /* Input buffer modes */
173c2c66affSColin Finck } CONSOLE_INPUT_BUFFER, *PCONSOLE_INPUT_BUFFER;
174c2c66affSColin Finck 
175c2c66affSColin Finck 
176c2c66affSColin Finck /*
177c2c66affSColin Finck  * Structure used to hold console information
178c2c66affSColin Finck  */
179c2c66affSColin Finck typedef struct _CONSOLE_INFO
180c2c66affSColin Finck {
181c2c66affSColin Finck     ULONG   InputBufferSize;
182c2c66affSColin Finck     COORD   ScreenBufferSize;
183c2c66affSColin Finck     COORD   ConsoleSize;    /* The size of the console */
184c2c66affSColin Finck 
185c2c66affSColin Finck     ULONG   CursorSize;
186c2c66affSColin Finck     BOOLEAN CursorBlinkOn;
187c2c66affSColin Finck     BOOLEAN ForceCursorOff;
188c2c66affSColin Finck 
189c2c66affSColin Finck     USHORT  ScreenAttrib; // CHAR_INFO ScreenFillAttrib
190c2c66affSColin Finck     USHORT  PopupAttrib;
191c2c66affSColin Finck 
192c2c66affSColin Finck     ULONG   CodePage;
193c2c66affSColin Finck 
194c2c66affSColin Finck } CONSOLE_INFO, *PCONSOLE_INFO;
195c2c66affSColin Finck 
19683c238e4SHermès Bélusca-Maïto typedef struct _TERMINAL TERMINAL, *PTERMINAL;
19783c238e4SHermès Bélusca-Maïto 
198c2c66affSColin Finck typedef struct _TERMINAL_VTBL
199c2c66affSColin Finck {
200c2c66affSColin Finck     /*
201c2c66affSColin Finck      * Internal interface (functions called by the console server only)
202c2c66affSColin Finck      */
203c2c66affSColin Finck     NTSTATUS (NTAPI *InitTerminal)(IN OUT PTERMINAL This,
204c2c66affSColin Finck                                    IN struct _CONSOLE* Console);
205c2c66affSColin Finck     VOID (NTAPI *DeinitTerminal)(IN OUT PTERMINAL This);
206c2c66affSColin Finck 
207c2c66affSColin Finck 
208c2c66affSColin Finck 
209c2c66affSColin Finck /************ Line discipline ***************/
210c2c66affSColin Finck 
211c2c66affSColin Finck     /* Interface used only for text-mode screen buffers */
212c2c66affSColin Finck 
213c2c66affSColin Finck     NTSTATUS (NTAPI *ReadStream)(IN OUT PTERMINAL This,
214c2c66affSColin Finck                                  IN BOOLEAN Unicode,
215c2c66affSColin Finck                                  /**PWCHAR Buffer,**/
216c2c66affSColin Finck                                  OUT PVOID Buffer,
217c2c66affSColin Finck                                  IN OUT PCONSOLE_READCONSOLE_CONTROL ReadControl,
218c2c66affSColin Finck                                  IN PVOID Parameter OPTIONAL,
219c2c66affSColin Finck                                  IN ULONG NumCharsToRead,
220c2c66affSColin Finck                                  OUT PULONG NumCharsRead OPTIONAL);
221c2c66affSColin Finck     NTSTATUS (NTAPI *WriteStream)(IN OUT PTERMINAL This,
222c2c66affSColin Finck                                   PTEXTMODE_SCREEN_BUFFER Buff,
223c2c66affSColin Finck                                   PWCHAR Buffer,
224c2c66affSColin Finck                                   DWORD Length,
225c2c66affSColin Finck                                   BOOL Attrib);
226c2c66affSColin Finck 
227c2c66affSColin Finck /************ Line discipline ***************/
228c2c66affSColin Finck 
229c2c66affSColin Finck 
230c2c66affSColin Finck 
231c2c66affSColin Finck     /* Interface used for both text-mode and graphics screen buffers */
232c2c66affSColin Finck     VOID (NTAPI *DrawRegion)(IN OUT PTERMINAL This,
233c2c66affSColin Finck                              SMALL_RECT* Region);
234c2c66affSColin Finck     BOOL (NTAPI *SetCursorInfo)(IN OUT PTERMINAL This,
235c2c66affSColin Finck                                 PCONSOLE_SCREEN_BUFFER ScreenBuffer);
236c2c66affSColin Finck     BOOL (NTAPI *SetScreenInfo)(IN OUT PTERMINAL This,
237c2c66affSColin Finck                                 PCONSOLE_SCREEN_BUFFER ScreenBuffer,
238c2c66affSColin Finck                                 SHORT OldCursorX,
239c2c66affSColin Finck                                 SHORT OldCursorY);
240c2c66affSColin Finck     VOID (NTAPI *ResizeTerminal)(IN OUT PTERMINAL This);
241c2c66affSColin Finck     VOID (NTAPI *SetActiveScreenBuffer)(IN OUT PTERMINAL This);
242c2c66affSColin Finck     VOID (NTAPI *ReleaseScreenBuffer)(IN OUT PTERMINAL This,
243c2c66affSColin Finck                                       IN PCONSOLE_SCREEN_BUFFER ScreenBuffer);
244c2c66affSColin Finck 
245c2c66affSColin Finck     /*
246c2c66affSColin Finck      * External interface (functions corresponding to the Console API)
247c2c66affSColin Finck      */
248c2c66affSColin Finck     VOID (NTAPI *GetLargestConsoleWindowSize)(IN OUT PTERMINAL This,
249c2c66affSColin Finck                                               PCOORD pSize);
250c2c66affSColin Finck     BOOL (NTAPI *SetPalette)(IN OUT PTERMINAL This,
251c2c66affSColin Finck                              HPALETTE PaletteHandle,
252c2c66affSColin Finck                              UINT PaletteUsage);
253ac249499SHermès Bélusca-Maïto     BOOL (NTAPI *SetCodePage)(IN OUT PTERMINAL This,
254ac249499SHermès Bélusca-Maïto                               UINT CodePage);
255c2c66affSColin Finck     INT  (NTAPI *ShowMouseCursor)(IN OUT PTERMINAL This,
256c2c66affSColin Finck                                   BOOL Show);
257c2c66affSColin Finck 
258c2c66affSColin Finck #if 0 // Possible future terminal interface
259c2c66affSColin Finck     BOOL (NTAPI *GetTerminalProperty)(IN OUT PTERMINAL This,
260c2c66affSColin Finck                                       ULONG Flag,
261c2c66affSColin Finck                                       PVOID Info,
262c2c66affSColin Finck                                       ULONG Size);
263c2c66affSColin Finck     BOOL (NTAPI *SetTerminalProperty)(IN OUT PTERMINAL This,
264c2c66affSColin Finck                                       ULONG Flag,
265c2c66affSColin Finck                                       PVOID Info /*,
266c2c66affSColin Finck                                       ULONG Size */);
267c2c66affSColin Finck #endif
268c2c66affSColin Finck } TERMINAL_VTBL, *PTERMINAL_VTBL;
269c2c66affSColin Finck 
270c2c66affSColin Finck struct _TERMINAL
271c2c66affSColin Finck {
272c2c66affSColin Finck     PTERMINAL_VTBL Vtbl;        /* Virtual table */
273c2c66affSColin Finck     struct _CONSOLE* Console;   /* Console to which the terminal is attached to */
274c2c66affSColin Finck     PVOID Context;              /* Private context */
275c2c66affSColin Finck };
276c2c66affSColin Finck 
277c2c66affSColin Finck /*
278c2c66affSColin Finck  * WARNING: Change the state of the console ONLY when the console is locked !
279c2c66affSColin Finck  */
280c2c66affSColin Finck typedef enum _CONSOLE_STATE
281c2c66affSColin Finck {
282c2c66affSColin Finck     CONSOLE_INITIALIZING,   /* Console is initializing */
283c2c66affSColin Finck     CONSOLE_RUNNING     ,   /* Console running */
284c2c66affSColin Finck     CONSOLE_TERMINATING ,   /* Console about to be destroyed (but still not) */
285c2c66affSColin Finck     CONSOLE_IN_DESTRUCTION  /* Console in destruction */
286c2c66affSColin Finck } CONSOLE_STATE, *PCONSOLE_STATE;
287c2c66affSColin Finck 
288c2c66affSColin Finck typedef struct _CONSOLE
289c2c66affSColin Finck {
290c2c66affSColin Finck /******************************* Console Set-up *******************************/
291c2c66affSColin Finck     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 */
292c2c66affSColin Finck     CRITICAL_SECTION Lock;
293c2c66affSColin Finck 
294c2c66affSColin Finck     CONSOLE_STATE State;                    /* State of the console */
295c2c66affSColin Finck     TERMINAL TermIFace;                     /* Terminal-specific interface */
296c2c66affSColin Finck 
2977babd931SHermès Bélusca-Maïto     BOOLEAN ConsolePaused;                  /* If TRUE, the console is paused */
298c2c66affSColin Finck 
299c2c66affSColin Finck /******************************** Input buffer ********************************/
300c2c66affSColin Finck     CONSOLE_INPUT_BUFFER InputBuffer;       /* Input buffer of the console */
301c2c66affSColin Finck     UINT InputCodePage;
302c2c66affSColin Finck 
303c2c66affSColin Finck /******************************* Screen buffers *******************************/
304c2c66affSColin Finck     LIST_ENTRY BufferList;                  /* List of all screen buffers for this console */
305c2c66affSColin Finck     PCONSOLE_SCREEN_BUFFER ActiveBuffer;    /* Pointer to currently active screen buffer */
306c2c66affSColin Finck     UINT OutputCodePage;
307c2c66affSColin Finck 
308c2c66affSColin Finck /****************************** Other properties ******************************/
309c2c66affSColin Finck     COORD   ConsoleSize;                    /* The current size of the console, for text-mode only */
310c2c66affSColin Finck     BOOLEAN FixedSize;                      /* TRUE if the console is of fixed size */
311fa42794aSKatayama Hirofumi MZ     BOOLEAN IsCJK;                          /* TRUE if Chinese, Japanese or Korean (CJK) */
31275d0346cSHermès Bélusca-Maïto } CONSOLE, *PCONSOLE;
313c2c66affSColin Finck 
314c2c66affSColin Finck /* console.c */
315c2c66affSColin Finck VOID NTAPI
316c2c66affSColin Finck ConDrvPause(PCONSOLE Console);
317c2c66affSColin Finck VOID NTAPI
318c2c66affSColin Finck ConDrvUnpause(PCONSOLE Console);
319c2c66affSColin Finck 
320c2c66affSColin Finck #define GetConsoleInputBufferMode(Console)  \
321c2c66affSColin Finck     (Console)->InputBuffer.Mode
322c2c66affSColin Finck 
323*f79c02bdSHermès Bélusca-Maïto #define CON_SET_OUTPUT_CP(Console, CodePage)\
324*f79c02bdSHermès Bélusca-Maïto do { \
325*f79c02bdSHermès Bélusca-Maïto     (Console)->OutputCodePage = (CodePage); \
326*f79c02bdSHermès Bélusca-Maïto     (Console)->IsCJK = IsCJKCodePage((Console)->OutputCodePage); \
327*f79c02bdSHermès Bélusca-Maïto } while (0)
328*f79c02bdSHermès Bélusca-Maïto 
329c2c66affSColin Finck 
330c2c66affSColin Finck /* conoutput.c */
331c2c66affSColin Finck PCHAR_INFO ConioCoordToPointer(PTEXTMODE_SCREEN_BUFFER Buff, ULONG X, ULONG Y);
3327babd931SHermès Bélusca-Maïto NTSTATUS ConioResizeBuffer(PCONSOLE Console,
333c2c66affSColin Finck                            PTEXTMODE_SCREEN_BUFFER ScreenBuffer,
334c2c66affSColin Finck                            COORD Size);
335c2c66affSColin Finck 
336fa42794aSKatayama Hirofumi MZ /* wcwidth.c */
337fa42794aSKatayama Hirofumi MZ int mk_wcwidth_cjk(wchar_t ucs);
338fa42794aSKatayama Hirofumi MZ 
339d46e0543SHermès Bélusca-Maïto // NOTE: The check against 0x80 is to avoid calling the helper function
340d46e0543SHermès Bélusca-Maïto // for characters that we already know are not full-width.
341d46e0543SHermès Bélusca-Maïto #define IS_FULL_WIDTH(wch)  \
342d46e0543SHermès Bélusca-Maïto     (((USHORT)(wch) >= 0x0080) && (mk_wcwidth_cjk(wch) == 2))
343d46e0543SHermès Bélusca-Maïto 
344c2c66affSColin Finck /* EOF */
345