ws2_32: Deal with getaddrinfo() returning NULL ai_canonname despite AI_CANONNAME.
[wine.git] / include / wine / condrv.h
blobc20b22e061f03e52aa8809ea7cfa4252a356d3a8
1 /*
2 * Console driver ioctls
4 * Copyright 2020 Jacek Caban for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef _INC_CONDRV
22 #define _INC_CONDRV
24 #include "winioctl.h"
25 #include "wincon.h"
27 /* common console input and output ioctls */
28 #define IOCTL_CONDRV_GET_MODE CTL_CODE(FILE_DEVICE_CONSOLE, 0, METHOD_BUFFERED, FILE_READ_ACCESS)
29 #define IOCTL_CONDRV_SET_MODE CTL_CODE(FILE_DEVICE_CONSOLE, 1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
31 /* console input ioctls */
32 #define IOCTL_CONDRV_READ_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 10, METHOD_BUFFERED, FILE_READ_ACCESS)
33 #define IOCTL_CONDRV_READ_FILE CTL_CODE(FILE_DEVICE_CONSOLE, 11, METHOD_BUFFERED, FILE_READ_ACCESS)
34 #define IOCTL_CONDRV_READ_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 12, METHOD_BUFFERED, FILE_READ_ACCESS)
35 #define IOCTL_CONDRV_WRITE_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_BUFFERED, FILE_WRITE_ACCESS)
36 #define IOCTL_CONDRV_PEEK CTL_CODE(FILE_DEVICE_CONSOLE, 14, METHOD_BUFFERED, FILE_READ_ACCESS)
37 #define IOCTL_CONDRV_GET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 15, METHOD_BUFFERED, FILE_READ_ACCESS)
38 #define IOCTL_CONDRV_SET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 16, METHOD_BUFFERED, FILE_WRITE_ACCESS)
39 #define IOCTL_CONDRV_GET_TITLE CTL_CODE(FILE_DEVICE_CONSOLE, 17, METHOD_BUFFERED, FILE_READ_ACCESS)
40 #define IOCTL_CONDRV_SET_TITLE CTL_CODE(FILE_DEVICE_CONSOLE, 18, METHOD_BUFFERED, FILE_WRITE_ACCESS)
41 #define IOCTL_CONDRV_CTRL_EVENT CTL_CODE(FILE_DEVICE_CONSOLE, 19, METHOD_BUFFERED, FILE_WRITE_ACCESS)
42 #define IOCTL_CONDRV_BEEP CTL_CODE(FILE_DEVICE_CONSOLE, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
43 #define IOCTL_CONDRV_FLUSH CTL_CODE(FILE_DEVICE_CONSOLE, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
45 /* console output ioctls */
46 #define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS)
47 #define IOCTL_CONDRV_WRITE_FILE CTL_CODE(FILE_DEVICE_CONSOLE, 31, METHOD_BUFFERED, FILE_WRITE_ACCESS)
48 #define IOCTL_CONDRV_READ_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 32, METHOD_BUFFERED, FILE_READ_ACCESS)
49 #define IOCTL_CONDRV_WRITE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 33, METHOD_BUFFERED, FILE_WRITE_ACCESS)
50 #define IOCTL_CONDRV_GET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 34, METHOD_BUFFERED, FILE_READ_ACCESS)
51 #define IOCTL_CONDRV_SET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 35, METHOD_BUFFERED, FILE_WRITE_ACCESS)
52 #define IOCTL_CONDRV_ACTIVATE CTL_CODE(FILE_DEVICE_CONSOLE, 36, METHOD_BUFFERED, FILE_WRITE_ACCESS)
53 #define IOCTL_CONDRV_FILL_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 37, METHOD_BUFFERED, FILE_WRITE_ACCESS)
54 #define IOCTL_CONDRV_SCROLL CTL_CODE(FILE_DEVICE_CONSOLE, 38, METHOD_BUFFERED, FILE_WRITE_ACCESS)
56 /* console connection ioctls */
57 #define IOCTL_CONDRV_BIND_PID CTL_CODE(FILE_DEVICE_CONSOLE, 51, METHOD_BUFFERED, FILE_ANY_ACCESS)
59 /* console server ioctls */
60 #define IOCTL_CONDRV_SETUP_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
62 /* ioctls used for communication between driver and host */
63 #define IOCTL_CONDRV_INIT_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 90, METHOD_BUFFERED, 0)
64 #define IOCTL_CONDRV_CLOSE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 91, METHOD_BUFFERED, 0)
66 /* console handle type */
67 typedef unsigned int condrv_handle_t;
69 /* convert an object handle to a server handle */
70 static inline condrv_handle_t condrv_handle( HANDLE handle )
72 if ((int)(INT_PTR)handle != (INT_PTR)handle) return 0xfffffff0; /* some invalid handle */
73 return (INT_PTR)handle;
76 /* structure for console char/attribute info */
77 typedef struct
79 WCHAR ch;
80 unsigned short attr;
81 } char_info_t;
83 /* IOCTL_CONDRV_GET_INPUT_INFO result */
84 struct condrv_input_info
86 unsigned int input_cp; /* console input codepage */
87 unsigned int output_cp; /* console output codepage */
88 unsigned int input_count; /* number of available input records */
89 condrv_handle_t win; /* renderer window handle */
92 /* IOCTL_CONDRV_SET_INPUT_INFO params */
93 struct condrv_input_info_params
95 unsigned int mask; /* setting mask */
96 struct condrv_input_info info; /* input_info */
99 #define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE 0x01
100 #define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE 0x02
102 /* IOCTL_CONDRV_WRITE_OUTPUT and IOCTL_CONDRV_READ_OUTPUT params */
103 struct condrv_output_params
105 unsigned int x; /* destination position */
106 unsigned int y;
107 unsigned int mode; /* char info mode */
108 unsigned int width; /* width of output rectangle, 0 for wrapped mode */
109 /* followed by an array of data with type depending on mode */
112 enum char_info_mode
114 CHAR_INFO_MODE_TEXT, /* characters only */
115 CHAR_INFO_MODE_ATTR, /* attributes only */
116 CHAR_INFO_MODE_TEXTATTR, /* both characters and attributes */
119 /* IOCTL_CONDRV_GET_OUTPUT_INFO result */
120 struct condrv_output_info
122 short int cursor_size; /* size of cursor (percentage filled) */
123 short int cursor_visible; /* cursor visibility flag */
124 short int cursor_x; /* position of cursor (x, y) */
125 short int cursor_y;
126 short int width; /* width of the screen buffer */
127 short int height; /* height of the screen buffer */
128 short int attr; /* default fill attributes (screen colors) */
129 short int popup_attr; /* pop-up color attributes */
130 short int win_left; /* window actually displayed by renderer */
131 short int win_top; /* the rect area is expressed within the */
132 short int win_right; /* boundaries of the screen buffer */
133 short int win_bottom;
134 short int max_width; /* maximum size (width x height) for the window */
135 short int max_height;
136 short int font_width; /* font size (width x height) */
137 short int font_height;
138 short int font_weight; /* font weight */
139 short int font_pitch_family; /* font pitch & family */
140 unsigned int color_map[16]; /* color table */
143 /* IOCTL_CONDRV_SET_OUTPUT_INFO params */
144 struct condrv_output_info_params
146 unsigned int mask; /* setting mask */
147 struct condrv_output_info info; /* output info */
150 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x0001
151 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x0002
152 #define SET_CONSOLE_OUTPUT_INFO_SIZE 0x0004
153 #define SET_CONSOLE_OUTPUT_INFO_ATTR 0x0008
154 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x0010
155 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x0020
156 #define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0040
158 /* IOCTL_CONDRV_FILL_OUTPUT params */
159 struct condrv_fill_output_params
161 int x; /* position where to start writing */
162 int y;
163 int mode; /* char info mode */
164 int count; /* number to write */
165 int wrap; /* wrap around at end of line? */
166 WCHAR ch; /* character to write */
167 unsigned short attr; /* attribute to write */
170 /* IOCTL_CONDRV_SCROLL params */
171 struct condrv_scroll_params
173 SMALL_RECT scroll; /* source rectangle */
174 COORD origin; /* destination coordinates */
175 SMALL_RECT clip; /* clipping rectangle */
176 char_info_t fill; /* empty character info */
179 /* IOCTL_CONDRV_CTRL_EVENT params */
180 struct condrv_ctrl_event
182 int event; /* the event to send */
183 unsigned int group_id; /* the group to send the event to */
186 /* Wine specific values for console inheritance (params->ConsoleHandle) */
187 #define CONSOLE_HANDLE_ALLOC ((HANDLE)1)
188 #define CONSOLE_HANDLE_SHELL ((HANDLE)2)
190 #endif /* _INC_CONDRV */