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