Fixed small bug in WSOCK32_accept
[wine] / include / wincon.h
1 #ifndef __WINE_WINCON_H
2 #define __WINE_WINCON_H
3
4 #include "winbase.h" /* for COORD */ 
5
6 #define CTRL_C_EVENT 0
7 #define CTRL_BREAK_EVENT 1
8 #define CTRL_CLOSE_EVENT 2
9 #define CTRL_LOGOFF_EVENT 5
10 #define CTRL_SHUTDOWN_EVENT 6
11
12 /* Console Mode flags */
13 #define ENABLE_PROCESSED_INPUT  0x01
14 #define ENABLE_LINE_INPUT       0x02
15 #define ENABLE_ECHO_INPUT       0x04
16 #define ENABLE_WINDOW_INPUT     0x08
17 #define ENABLE_MOUSE_INPUT      0x10
18
19 #define ENABLE_PROCESSED_OUTPUT 0x01
20 #define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
21
22
23 typedef BOOL HANDLER_ROUTINE(WORD);
24
25 /* Attributes flags: */
26
27 #define FOREGROUND_BLUE      0x0001 /* text color contains blue. */
28 #define FOREGROUND_GREEN     0x0002 /* text color contains green. */
29 #define FOREGROUND_RED       0x0004 /* text color contains red. */
30 #define FOREGROUND_INTENSITY 0x0008 /* text color is intensified. */
31 #define BACKGROUND_BLUE      0x0010 /* background color contains blue. */
32 #define BACKGROUND_GREEN     0x0020 /* background color contains green. */
33 #define BACKGROUND_RED       0x0040 /* background color contains red. */
34 #define BACKGROUND_INTENSITY 0x0080 /* background color is intensified. */
35
36 typedef struct _CONSOLE_CURSOR_INFO {
37     DWORD       dwSize;   /* Between 1 & 100 for percentage of cell filled */
38     BOOL        bVisible; /* Visibility of cursor */
39 } CONSOLE_CURSOR_INFO, *LPCONSOLE_CURSOR_INFO;
40
41 /*
42 typedef struct tagCOORD
43 {
44     INT16 x;
45     INT16 y;
46 } COORD,*LPCOORD;
47 */
48
49 typedef struct tagSMALL_RECT
50 {
51     INT16 Left;
52     INT16 Top;
53     INT16 Right;
54     INT16 Bottom;
55 } SMALL_RECT,*LPSMALL_RECT;
56
57 typedef struct tagCONSOLE_SCREEN_BUFFER_INFO
58 {
59     COORD       dwSize;
60     COORD       dwCursorPosition;
61     WORD        wAttributes;
62     SMALL_RECT  srWindow;
63     COORD       dwMaximumWindowSize;
64 } CONSOLE_SCREEN_BUFFER_INFO,*LPCONSOLE_SCREEN_BUFFER_INFO;
65
66 typedef struct tagCHAR_INFO
67 {
68     union
69         {
70         WCHAR UnicodeChar;
71         CHAR AsciiChar;
72         } Char;
73     WORD        Attributes;
74 } CHAR_INFO,*LPCHAR_INFO;
75
76 typedef struct tagKEY_EVENT_RECORD
77 {
78     BOOL        bKeyDown;               /* 04 */
79     WORD        wRepeatCount;           /* 08 */
80     WORD        wVirtualKeyCode;        /* 0A */
81     WORD        wVirtualScanCode;       /* 0C */
82     union                               /* 0E */
83         {
84         WCHAR UniCodeChar;              /* 0E */
85         CHAR AsciiChar;                 /* 0E */
86         } uChar;
87     DWORD       dwControlKeyState;      /* 10 */
88 } KEY_EVENT_RECORD,*LPKEY_EVENT_RECORD;
89
90 /* dwControlKeyState bitmask */
91 #define RIGHT_ALT_PRESSED       0x0001
92 #define LEFT_ALT_PRESSED        0x0002
93 #define RIGHT_CTRL_PRESSED      0x0004
94 #define LEFT_CTRL_PRESSED       0x0008
95 #define SHIFT_PRESSED           0x0010
96 #define NUMLOCK_ON              0x0020
97 #define SCROLLLOCK_ON           0x0040
98 #define CAPSLOCK_ON             0x0080
99 #define ENHANCED_KEY            0x0100
100
101 typedef struct tagMOUSE_EVENT_RECORD
102 {
103     COORD       dwMousePosition;
104     DWORD       dwButtonState;
105     DWORD       dwControlKeyState;
106     DWORD       dwEventFlags;
107 } MOUSE_EVENT_RECORD,*LPMOUSE_EVENT_RECORD;
108
109 typedef struct tagWINDOW_BUFFER_SIZE_RECORD
110 {
111     COORD       dwSize;
112 } WINDOW_BUFFER_SIZE_RECORD,*LPWINDOW_BUFFER_SIZE_RECORD;
113
114 typedef struct tagMENU_EVENT_RECORD
115 {
116     UINT        dwCommandId; /* perhaps UINT16 ??? */
117 } MENU_EVENT_RECORD,*LPMENU_EVENT_RECORD;
118
119 typedef struct tagFOCUS_EVENT_RECORD
120 {
121     BOOL      bSetFocus; /* perhaps BOOL16 ??? */
122 } FOCUS_EVENT_RECORD,*LPFOCUS_EVENT_RECORD;
123
124 typedef struct tagINPUT_RECORD
125 {
126     WORD                EventType;              /* 00 */
127     union
128         {
129         KEY_EVENT_RECORD KeyEvent;
130         MOUSE_EVENT_RECORD MouseEvent;
131         WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
132         MENU_EVENT_RECORD MenuEvent;
133         FOCUS_EVENT_RECORD FocusEvent;
134         } Event;
135 } INPUT_RECORD,*LPINPUT_RECORD;
136
137 /* INPUT_RECORD.wEventType */
138 #define KEY_EVENT                       0x01
139 #define MOUSE_EVENT                     0x02
140 #define WINDOW_BUFFER_SIZE_EVENT        0x04
141 #define MENU_EVENT                      0x08
142 #define FOCUS_EVENT                     0x10
143
144 BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, LPSMALL_RECT lpWriteRegion);
145 BOOL WINAPI WriteConsoleOutputW( HANDLE hConsoleOutput, LPCHAR_INFO lpBuffer, COORD dwBufferSize, COORD dwBufferCoord, LPSMALL_RECT lpWriteRegion);
146 #define WriteConsoleOutput WINELIB_NAME_AW(WriteConsoleOutput)
147 BOOL WINAPI WriteConsoleInputA( HANDLE handle, INPUT_RECORD *buffer,
148                                     DWORD count, LPDWORD written );
149 BOOL WINAPI WriteConsoleInputW( HANDLE handle, INPUT_RECORD *buffer,
150                                     DWORD count, LPDWORD written );
151 #define WriteConsoleInput WINELIB_NAME_AW(WriteConsoleInput)
152 BOOL WINAPI PeekConsoleInputA( HANDLE handle, LPINPUT_RECORD buffer,
153                                    DWORD count, LPDWORD read );
154 BOOL WINAPI PeekConsoleInputW( HANDLE handle, LPINPUT_RECORD buffer,
155                                    DWORD count, LPDWORD read );
156 #define PeekConsoleInput WINELIB_NAME_AW(PeekConsoleInput)
157 BOOL WINAPI ReadConsoleA(       HANDLE hConsoleInput, LPVOID lpBuffer,
158                                 DWORD nNumberOfCharsToRead,
159                                 LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
160 BOOL WINAPI ReadConsoleW(       HANDLE hConsoleInput, LPVOID lpBuffer,
161                                 DWORD nNumberOfCharsToRead,
162                                 LPDWORD lpNumberOfCharsRead, LPVOID lpReserved);
163 #define ReadConsole WINELIB_NAME_AW(ReadConsole)
164 BOOL WINAPI ReadConsoleInputA(HANDLE hConsoleInput,
165                                   LPINPUT_RECORD lpBuffer, DWORD nLength,
166                                   LPDWORD lpNumberOfEventsRead);
167 BOOL WINAPI ReadConsoleInputW(HANDLE hConsoleInput,
168                                   LPINPUT_RECORD lpBuffer, DWORD nLength,
169                                   LPDWORD lpNumberOfEventsRead);
170 #define ReadConsoleInput WINELIB_NAME_AW(ReadConsoleInput)
171
172 BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE hConsoleOutput,
173                                            LPCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
174 BOOL WINAPI SetConsoleCursorPosition(HANDLE hConsoleOutput, COORD dwCursorPosition);
175 BOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput,
176                                            COORD dwSize);
177
178 #ifdef __WINE__
179 extern HANDLE CONSOLE_OpenHandle( BOOL output, DWORD access, LPSECURITY_ATTRIBUTES sa );
180 #endif
181
182 #endif  /* __WINE_WINCON_H */