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
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_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 11, METHOD_BUFFERED, FILE_READ_ACCESS)
34 #define IOCTL_CONDRV_WRITE_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 12, METHOD_BUFFERED, FILE_WRITE_ACCESS)
35 #define IOCTL_CONDRV_PEEK CTL_CODE(FILE_DEVICE_CONSOLE, 13, METHOD_BUFFERED, FILE_READ_ACCESS)
36 #define IOCTL_CONDRV_GET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 14, METHOD_BUFFERED, FILE_READ_ACCESS)
37 #define IOCTL_CONDRV_SET_INPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 15, METHOD_BUFFERED, FILE_WRITE_ACCESS)
38 #define IOCTL_CONDRV_GET_TITLE CTL_CODE(FILE_DEVICE_CONSOLE, 16, METHOD_BUFFERED, FILE_READ_ACCESS)
39 #define IOCTL_CONDRV_SET_TITLE CTL_CODE(FILE_DEVICE_CONSOLE, 17, METHOD_BUFFERED, FILE_WRITE_ACCESS)
40 #define IOCTL_CONDRV_CTRL_EVENT CTL_CODE(FILE_DEVICE_CONSOLE, 18, METHOD_BUFFERED, FILE_WRITE_ACCESS)
41 #define IOCTL_CONDRV_BEEP CTL_CODE(FILE_DEVICE_CONSOLE, 19, METHOD_BUFFERED, FILE_ANY_ACCESS)
42 #define IOCTL_CONDRV_FLUSH CTL_CODE(FILE_DEVICE_CONSOLE, 20, METHOD_BUFFERED, FILE_ANY_ACCESS)
44 /* console output ioctls */
45 #define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS)
46 #define IOCTL_CONDRV_WRITE_FILE CTL_CODE(FILE_DEVICE_CONSOLE, 31, METHOD_BUFFERED, FILE_WRITE_ACCESS)
47 #define IOCTL_CONDRV_READ_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 32, METHOD_BUFFERED, FILE_READ_ACCESS)
48 #define IOCTL_CONDRV_WRITE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 33, METHOD_BUFFERED, FILE_WRITE_ACCESS)
49 #define IOCTL_CONDRV_GET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 34, METHOD_BUFFERED, FILE_READ_ACCESS)
50 #define IOCTL_CONDRV_SET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 35, METHOD_BUFFERED, FILE_WRITE_ACCESS)
51 #define IOCTL_CONDRV_ACTIVATE CTL_CODE(FILE_DEVICE_CONSOLE, 36, METHOD_BUFFERED, FILE_WRITE_ACCESS)
52 #define IOCTL_CONDRV_FILL_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 37, METHOD_BUFFERED, FILE_WRITE_ACCESS)
53 #define IOCTL_CONDRV_SCROLL CTL_CODE(FILE_DEVICE_CONSOLE, 38, METHOD_BUFFERED, FILE_WRITE_ACCESS)
55 /* console connection ioctls */
56 #define IOCTL_CONDRV_BIND_PID CTL_CODE(FILE_DEVICE_CONSOLE, 51, METHOD_BUFFERED, FILE_ANY_ACCESS)
58 /* console server ioctls */
59 #define IOCTL_CONDRV_SETUP_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
61 /* ioctls used for communication between driver and host */
62 #define IOCTL_CONDRV_INIT_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 90, METHOD_BUFFERED, 0)
63 #define IOCTL_CONDRV_CLOSE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 91, METHOD_BUFFERED, 0)
65 /* console handle type */
66 typedef unsigned int condrv_handle_t
;
68 /* convert an object handle to a server handle */
69 static inline condrv_handle_t
condrv_handle( HANDLE handle
)
71 if ((int)(INT_PTR
)handle
!= (INT_PTR
)handle
) return 0xfffffff0; /* some invalid handle */
72 return (INT_PTR
)handle
;
75 /* structure for console char/attribute info */
82 /* IOCTL_CONDRV_GET_INPUT_INFO result */
83 struct condrv_input_info
85 unsigned int input_cp
; /* console input codepage */
86 unsigned int output_cp
; /* console output codepage */
87 unsigned int input_count
; /* number of available input records */
88 condrv_handle_t win
; /* renderer window handle */
91 /* IOCTL_CONDRV_SET_INPUT_INFO params */
92 struct condrv_input_info_params
94 unsigned int mask
; /* setting mask */
95 struct condrv_input_info info
; /* input_info */
98 #define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE 0x01
99 #define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE 0x02
101 /* IOCTL_CONDRV_WRITE_OUTPUT and IOCTL_CONDRV_READ_OUTPUT params */
102 struct condrv_output_params
104 unsigned int x
; /* destination position */
106 unsigned int mode
; /* char info mode */
107 unsigned int width
; /* width of output rectangle, 0 for wrapped mode */
108 /* followed by an array of data with type depending on mode */
113 CHAR_INFO_MODE_TEXT
, /* characters only */
114 CHAR_INFO_MODE_ATTR
, /* attributes only */
115 CHAR_INFO_MODE_TEXTATTR
, /* both characters and attributes */
118 /* IOCTL_CONDRV_GET_OUTPUT_INFO result */
119 struct condrv_output_info
121 short int cursor_size
; /* size of cursor (percentage filled) */
122 short int cursor_visible
; /* cursor visibility flag */
123 short int cursor_x
; /* position of cursor (x, y) */
125 short int width
; /* width of the screen buffer */
126 short int height
; /* height of the screen buffer */
127 short int attr
; /* default fill attributes (screen colors) */
128 short int popup_attr
; /* pop-up color attributes */
129 short int win_left
; /* window actually displayed by renderer */
130 short int win_top
; /* the rect area is expressed within the */
131 short int win_right
; /* boundaries of the screen buffer */
132 short int win_bottom
;
133 short int max_width
; /* maximum size (width x height) for the window */
134 short int max_height
;
135 short int font_width
; /* font size (width x height) */
136 short int font_height
;
137 short int font_weight
; /* font weight */
138 short int font_pitch_family
; /* font pitch & family */
139 unsigned int color_map
[16]; /* color table */
142 /* IOCTL_CONDRV_SET_OUTPUT_INFO params */
143 struct condrv_output_info_params
145 unsigned int mask
; /* setting mask */
146 struct condrv_output_info info
; /* output info */
149 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x0001
150 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x0002
151 #define SET_CONSOLE_OUTPUT_INFO_SIZE 0x0004
152 #define SET_CONSOLE_OUTPUT_INFO_ATTR 0x0008
153 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x0010
154 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x0020
155 #define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0040
157 /* IOCTL_CONDRV_FILL_OUTPUT params */
158 struct condrv_fill_output_params
160 int x
; /* position where to start writing */
162 int mode
; /* char info mode */
163 int count
; /* number to write */
164 int wrap
; /* wrap around at end of line? */
165 WCHAR ch
; /* character to write */
166 unsigned short attr
; /* attribute to write */
169 /* IOCTL_CONDRV_SCROLL params */
170 struct condrv_scroll_params
172 SMALL_RECT scroll
; /* source rectangle */
173 COORD origin
; /* destination coordinates */
174 SMALL_RECT clip
; /* clipping rectangle */
175 char_info_t fill
; /* empty character info */
178 /* IOCTL_CONDRV_CTRL_EVENT params */
179 struct condrv_ctrl_event
181 int event
; /* the event to send */
182 unsigned int group_id
; /* the group to send the event to */
185 /* Wine specific values for console inheritance (params->ConsoleHandle) */
186 #define CONSOLE_HANDLE_ALLOC ((HANDLE)1)
187 #define CONSOLE_HANDLE_SHELL ((HANDLE)2)
189 #endif /* _INC_CONDRV */