include: Add a private header for Unix libraries definitions.
[wine.git] / include / wine / condrv.h
blobadd08be20c873a096869ed595e98cd177d0109b6
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)
46 /* console output ioctls */
47 #define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS)
48 #define IOCTL_CONDRV_WRITE_FILE CTL_CODE(FILE_DEVICE_CONSOLE, 31, METHOD_BUFFERED, FILE_WRITE_ACCESS)
49 #define IOCTL_CONDRV_READ_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 32, METHOD_BUFFERED, FILE_READ_ACCESS)
50 #define IOCTL_CONDRV_WRITE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 33, METHOD_BUFFERED, FILE_WRITE_ACCESS)
51 #define IOCTL_CONDRV_GET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 34, METHOD_BUFFERED, FILE_READ_ACCESS)
52 #define IOCTL_CONDRV_SET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 35, METHOD_BUFFERED, FILE_WRITE_ACCESS)
53 #define IOCTL_CONDRV_ACTIVATE CTL_CODE(FILE_DEVICE_CONSOLE, 36, METHOD_BUFFERED, FILE_WRITE_ACCESS)
54 #define IOCTL_CONDRV_FILL_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 37, METHOD_BUFFERED, FILE_WRITE_ACCESS)
55 #define IOCTL_CONDRV_SCROLL CTL_CODE(FILE_DEVICE_CONSOLE, 38, METHOD_BUFFERED, FILE_WRITE_ACCESS)
57 /* console connection ioctls */
58 #define IOCTL_CONDRV_BIND_PID CTL_CODE(FILE_DEVICE_CONSOLE, 51, METHOD_BUFFERED, FILE_ANY_ACCESS)
60 /* console server ioctls */
61 #define IOCTL_CONDRV_SETUP_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
63 /* ioctls used for communication between driver and host */
64 #define IOCTL_CONDRV_INIT_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 90, METHOD_BUFFERED, 0)
65 #define IOCTL_CONDRV_CLOSE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 91, METHOD_BUFFERED, 0)
67 /* console handle type */
68 typedef unsigned int condrv_handle_t;
70 /* convert an object handle to a server handle */
71 static inline condrv_handle_t condrv_handle( HANDLE handle )
73 if ((int)(INT_PTR)handle != (INT_PTR)handle) return 0xfffffff0; /* some invalid handle */
74 return (INT_PTR)handle;
77 /* structure for console char/attribute info */
78 typedef struct
80 WCHAR ch;
81 unsigned short attr;
82 } char_info_t;
84 /* IOCTL_CONDRV_GET_INPUT_INFO result */
85 struct condrv_input_info
87 unsigned int input_cp; /* console input codepage */
88 unsigned int output_cp; /* console output codepage */
89 unsigned int input_count; /* number of available input records */
90 condrv_handle_t win; /* renderer window handle */
93 /* IOCTL_CONDRV_SET_INPUT_INFO params */
94 struct condrv_input_info_params
96 unsigned int mask; /* setting mask */
97 struct condrv_input_info info; /* input_info */
100 #define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE 0x01
101 #define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE 0x02
103 /* IOCTL_CONDRV_WRITE_OUTPUT and IOCTL_CONDRV_READ_OUTPUT params */
104 struct condrv_output_params
106 unsigned int x; /* destination position */
107 unsigned int y;
108 unsigned int mode; /* char info mode */
109 unsigned int width; /* width of output rectangle, 0 for wrapped mode */
110 /* followed by an array of data with type depending on mode */
113 enum char_info_mode
115 CHAR_INFO_MODE_TEXT, /* characters only */
116 CHAR_INFO_MODE_ATTR, /* attributes only */
117 CHAR_INFO_MODE_TEXTATTR, /* both characters and attributes */
120 /* IOCTL_CONDRV_GET_OUTPUT_INFO result */
121 struct condrv_output_info
123 short int cursor_size; /* size of cursor (percentage filled) */
124 short int cursor_visible; /* cursor visibility flag */
125 short int cursor_x; /* position of cursor (x, y) */
126 short int cursor_y;
127 short int width; /* width of the screen buffer */
128 short int height; /* height of the screen buffer */
129 short int attr; /* default fill attributes (screen colors) */
130 short int popup_attr; /* pop-up color attributes */
131 short int win_left; /* window actually displayed by renderer */
132 short int win_top; /* the rect area is expressed within the */
133 short int win_right; /* boundaries of the screen buffer */
134 short int win_bottom;
135 short int max_width; /* maximum size (width x height) for the window */
136 short int max_height;
137 short int font_width; /* font size (width x height) */
138 short int font_height;
139 short int font_weight; /* font weight */
140 short int font_pitch_family; /* font pitch & family */
141 unsigned int color_map[16]; /* color table */
144 /* IOCTL_CONDRV_SET_OUTPUT_INFO params */
145 struct condrv_output_info_params
147 unsigned int mask; /* setting mask */
148 struct condrv_output_info info; /* output info */
151 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_GEOM 0x0001
152 #define SET_CONSOLE_OUTPUT_INFO_CURSOR_POS 0x0002
153 #define SET_CONSOLE_OUTPUT_INFO_SIZE 0x0004
154 #define SET_CONSOLE_OUTPUT_INFO_ATTR 0x0008
155 #define SET_CONSOLE_OUTPUT_INFO_DISPLAY_WINDOW 0x0010
156 #define SET_CONSOLE_OUTPUT_INFO_MAX_SIZE 0x0020
157 #define SET_CONSOLE_OUTPUT_INFO_POPUP_ATTR 0x0040
159 /* IOCTL_CONDRV_FILL_OUTPUT params */
160 struct condrv_fill_output_params
162 int x; /* position where to start writing */
163 int y;
164 int mode; /* char info mode */
165 int count; /* number to write */
166 int wrap; /* wrap around at end of line? */
167 WCHAR ch; /* character to write */
168 unsigned short attr; /* attribute to write */
171 /* IOCTL_CONDRV_SCROLL params */
172 struct condrv_scroll_params
174 SMALL_RECT scroll; /* source rectangle */
175 COORD origin; /* destination coordinates */
176 SMALL_RECT clip; /* clipping rectangle */
177 char_info_t fill; /* empty character info */
180 /* IOCTL_CONDRV_CTRL_EVENT params */
181 struct condrv_ctrl_event
183 int event; /* the event to send */
184 unsigned int group_id; /* the group to send the event to */
187 /* Wine specific values for console inheritance (params->ConsoleHandle) */
188 #define CONSOLE_HANDLE_ALLOC ((HANDLE)1)
189 #define CONSOLE_HANDLE_SHELL ((HANDLE)2)
191 #endif /* _INC_CONDRV */