winemac.drv: Use nameless unions/structs.
[wine.git] / include / wine / condrv.h
blob51534720444c84097b6963d90695083f17fc22a3
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)
30 #define IOCTL_CONDRV_IS_UNIX CTL_CODE(FILE_DEVICE_CONSOLE, 2, METHOD_BUFFERED, FILE_ANY_ACCESS)
32 /* console input ioctls */
33 #define IOCTL_CONDRV_READ_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 10, METHOD_BUFFERED, FILE_READ_ACCESS)
34 #define IOCTL_CONDRV_READ_FILE CTL_CODE(FILE_DEVICE_CONSOLE, 11, METHOD_BUFFERED, FILE_READ_ACCESS)
35 #define IOCTL_CONDRV_READ_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 12, METHOD_BUFFERED, FILE_READ_ACCESS)
36 #define IOCTL_CONDRV_WRITE_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_BUFFERED, FILE_WRITE_ACCESS)
37 #define IOCTL_CONDRV_PEEK CTL_CODE(FILE_DEVICE_CONSOLE, 14, METHOD_BUFFERED, FILE_READ_ACCESS)
38 #define IOCTL_CONDRV_GET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 15, METHOD_BUFFERED, FILE_READ_ACCESS)
39 #define IOCTL_CONDRV_SET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 16, METHOD_BUFFERED, FILE_WRITE_ACCESS)
40 #define IOCTL_CONDRV_GET_TITLE CTL_CODE(FILE_DEVICE_CONSOLE, 17, METHOD_BUFFERED, FILE_READ_ACCESS)
41 #define IOCTL_CONDRV_SET_TITLE CTL_CODE(FILE_DEVICE_CONSOLE, 18, METHOD_BUFFERED, FILE_WRITE_ACCESS)
42 #define IOCTL_CONDRV_CTRL_EVENT CTL_CODE(FILE_DEVICE_CONSOLE, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)
43 #define IOCTL_CONDRV_BEEP CTL_CODE(FILE_DEVICE_CONSOLE, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 #define IOCTL_CONDRV_FLUSH CTL_CODE(FILE_DEVICE_CONSOLE, 21, METHOD_BUFFERED, FILE_ANY_ACCESS)
45 #define IOCTL_CONDRV_GET_WINDOW CTL_CODE(FILE_DEVICE_CONSOLE, 22, METHOD_BUFFERED, FILE_ANY_ACCESS)
46 #define IOCTL_CONDRV_GET_PROCESS_LIST CTL_CODE(FILE_DEVICE_CONSOLE, 23, METHOD_BUFFERED, FILE_ANY_ACCESS)
47 #define IOCTL_CONDRV_READ_CONSOLE_CONTROL CTL_CODE(FILE_DEVICE_CONSOLE, 24, METHOD_BUFFERED, FILE_READ_ACCESS)
49 /* console output ioctls */
50 #define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS)
51 #define IOCTL_CONDRV_WRITE_FILE CTL_CODE(FILE_DEVICE_CONSOLE, 31, METHOD_BUFFERED, FILE_WRITE_ACCESS)
52 #define IOCTL_CONDRV_READ_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 32, METHOD_BUFFERED, FILE_READ_ACCESS)
53 #define IOCTL_CONDRV_WRITE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 33, METHOD_BUFFERED, FILE_WRITE_ACCESS)
54 #define IOCTL_CONDRV_GET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 34, METHOD_BUFFERED, FILE_READ_ACCESS)
55 #define IOCTL_CONDRV_SET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 35, METHOD_BUFFERED, FILE_WRITE_ACCESS)
56 #define IOCTL_CONDRV_ACTIVATE CTL_CODE(FILE_DEVICE_CONSOLE, 36, METHOD_BUFFERED, FILE_WRITE_ACCESS)
57 #define IOCTL_CONDRV_FILL_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 37, METHOD_BUFFERED, FILE_WRITE_ACCESS)
58 #define IOCTL_CONDRV_SCROLL CTL_CODE(FILE_DEVICE_CONSOLE, 38, METHOD_BUFFERED, FILE_WRITE_ACCESS)
60 /* console connection ioctls */
61 #define IOCTL_CONDRV_BIND_PID CTL_CODE(FILE_DEVICE_CONSOLE, 51, METHOD_BUFFERED, FILE_ANY_ACCESS)
63 /* console server ioctls */
64 #define IOCTL_CONDRV_SETUP_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
66 /* ioctls used for communication between driver and host */
67 #define IOCTL_CONDRV_INIT_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 90, METHOD_BUFFERED, 0)
68 #define IOCTL_CONDRV_CLOSE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 91, METHOD_BUFFERED, 0)
70 /* console handle type */
71 typedef unsigned int condrv_handle_t;
73 /* convert an object handle to a server handle */
74 static inline condrv_handle_t condrv_handle( HANDLE handle )
76 if ((int)(INT_PTR)handle != (INT_PTR)handle) return 0xfffffff0; /* some invalid handle */
77 return (INT_PTR)handle;
80 /* structure for console char/attribute info */
81 typedef struct
83 WCHAR ch;
84 unsigned short attr;
85 } char_info_t;
87 /* IOCTL_CONDRV_GET_INPUT_INFO result */
88 struct condrv_input_info
90 unsigned int input_cp; /* console input codepage */
91 unsigned int output_cp; /* console output codepage */
92 unsigned int input_count; /* number of available input records */
95 /* IOCTL_CONDRV_SET_INPUT_INFO params */
96 struct condrv_input_info_params
98 unsigned int mask; /* setting mask */
99 struct condrv_input_info info; /* input_info */
102 #define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE 0x01
103 #define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE 0x02
105 /* IOCTL_CONDRV_WRITE_OUTPUT and IOCTL_CONDRV_READ_OUTPUT params */
106 struct condrv_output_params
108 unsigned int x; /* destination position */
109 unsigned int y;
110 unsigned int mode; /* char info mode */
111 unsigned int width; /* width of output rectangle, 0 for wrapped mode */
112 /* followed by an array of data with type depending on mode */
115 enum char_info_mode
117 CHAR_INFO_MODE_TEXT, /* characters only */
118 CHAR_INFO_MODE_ATTR, /* attributes only */
119 CHAR_INFO_MODE_TEXTATTR, /* both characters and attributes */
122 /* IOCTL_CONDRV_GET_OUTPUT_INFO result */
123 struct condrv_output_info
125 short int cursor_size; /* size of cursor (percentage filled) */
126 short int cursor_visible; /* cursor visibility flag */
127 short int cursor_x; /* position of cursor (x, y) */
128 short int cursor_y;
129 short int width; /* width of the screen buffer */
130 short int height; /* height of the screen buffer */
131 short int attr; /* default fill attributes (screen colors) */
132 short int popup_attr; /* pop-up color attributes */
133 short int win_left; /* window actually displayed by renderer */
134 short int win_top; /* the rect area is expressed within the */
135 short int win_right; /* boundaries of the screen buffer */
136 short int win_bottom;
137 short int max_width; /* maximum size (width x height) for the window */
138 short int max_height;
139 short int font_width; /* font size (width x height) */
140 short int font_height;
141 short int font_weight; /* font weight */
142 short int font_pitch_family; /* font pitch & family */
143 unsigned int color_map[16]; /* color table */
146 /* IOCTL_CONDRV_SET_OUTPUT_INFO params */
147 struct condrv_output_info_params
149 unsigned int mask; /* setting mask */
150 struct condrv_output_info info; /* output info */
153 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x0001
154 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x0002
155 #define SET_CONSOLE_OUTPUT_INFO_SIZE 0x0004
156 #define SET_CONSOLE_OUTPUT_INFO_ATTR 0x0008
157 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x0010
158 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x0020
159 #define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0040
160 #define SET_CONSOLE_OUTPUT_INFO_FONT 0x0080
162 /* IOCTL_CONDRV_GET_TITLE params */
163 struct condrv_title_params
165 unsigned int title_len;
166 WCHAR buffer[1];
169 /* IOCTL_CONDRV_FILL_OUTPUT params */
170 struct condrv_fill_output_params
172 int x; /* position where to start writing */
173 int y;
174 int mode; /* char info mode */
175 int count; /* number to write */
176 int wrap; /* wrap around at end of line? */
177 WCHAR ch; /* character to write */
178 unsigned short attr; /* attribute to write */
181 /* IOCTL_CONDRV_SCROLL params */
182 struct condrv_scroll_params
184 SMALL_RECT scroll; /* source rectangle */
185 COORD origin; /* destination coordinates */
186 SMALL_RECT clip; /* clipping rectangle */
187 char_info_t fill; /* empty character info */
190 /* IOCTL_CONDRV_CTRL_EVENT params */
191 struct condrv_ctrl_event
193 int event; /* the event to send */
194 unsigned int group_id; /* the group to send the event to */
197 /* Wine specific values for console inheritance (params->ConsoleHandle) */
198 #define CONSOLE_HANDLE_ALLOC LongToHandle(-1)
199 #define CONSOLE_HANDLE_ALLOC_NO_WINDOW LongToHandle(-2)
200 #define CONSOLE_HANDLE_SHELL LongToHandle(-3)
201 #define CONSOLE_HANDLE_SHELL_NO_WINDOW LongToHandle(-4)
203 #endif /* _INC_CONDRV */