ReactOS 0.4.17-dev-414-ge848ce1
condrv.h
Go to the documentation of this file.
1/*
2 * Console driver ioctls
3 *
4 * Copyright 2020 Jacek Caban for CodeWeavers
5 *
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.
10 *
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.
15 *
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
19 */
20
21#ifndef _INC_CONDRV
22#define _INC_CONDRV
23
24#include "winioctl.h"
25#include "wincon.h"
26
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)
31
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)
48#define IOCTL_CONDRV_GET_INPUT_COUNT CTL_CODE(FILE_DEVICE_CONSOLE, 25, METHOD_BUFFERED, FILE_READ_ACCESS)
49
50/* console output ioctls */
51#define IOCTL_CONDRV_WRITE_CONSOLE CTL_CODE(FILE_DEVICE_CONSOLE, 30, METHOD_BUFFERED, FILE_WRITE_ACCESS)
52#define IOCTL_CONDRV_WRITE_FILE CTL_CODE(FILE_DEVICE_CONSOLE, 31, METHOD_BUFFERED, FILE_WRITE_ACCESS)
53#define IOCTL_CONDRV_READ_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 32, METHOD_BUFFERED, FILE_READ_ACCESS)
54#define IOCTL_CONDRV_WRITE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 33, METHOD_BUFFERED, FILE_WRITE_ACCESS)
55#define IOCTL_CONDRV_GET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 34, METHOD_BUFFERED, FILE_READ_ACCESS)
56#define IOCTL_CONDRV_SET_OUTPUT_INFO CTL_CODE(FILE_DEVICE_CONSOLE, 35, METHOD_BUFFERED, FILE_WRITE_ACCESS)
57#define IOCTL_CONDRV_ACTIVATE CTL_CODE(FILE_DEVICE_CONSOLE, 36, METHOD_BUFFERED, FILE_WRITE_ACCESS)
58#define IOCTL_CONDRV_FILL_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 37, METHOD_BUFFERED, FILE_WRITE_ACCESS)
59#define IOCTL_CONDRV_SCROLL CTL_CODE(FILE_DEVICE_CONSOLE, 38, METHOD_BUFFERED, FILE_WRITE_ACCESS)
60
61/* console connection ioctls */
62#define IOCTL_CONDRV_BIND_PID CTL_CODE(FILE_DEVICE_CONSOLE, 51, METHOD_BUFFERED, FILE_ANY_ACCESS)
63
64/* console server ioctls */
65#define IOCTL_CONDRV_SETUP_INPUT CTL_CODE(FILE_DEVICE_CONSOLE, 60, METHOD_BUFFERED, FILE_ANY_ACCESS)
66
67/* ioctls used for communication between driver and host */
68#define IOCTL_CONDRV_INIT_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 90, METHOD_BUFFERED, 0)
69#define IOCTL_CONDRV_CLOSE_OUTPUT CTL_CODE(FILE_DEVICE_CONSOLE, 91, METHOD_BUFFERED, 0)
70
71/* console handle type */
72typedef unsigned int condrv_handle_t;
73
74/* convert an object handle to a server handle */
76{
77 if ((int)(INT_PTR)handle != (INT_PTR)handle) return 0xfffffff0; /* some invalid handle */
78 return (INT_PTR)handle;
79}
80
81/* structure for console char/attribute info */
82typedef struct
83{
85 unsigned short attr;
87
88/* IOCTL_CONDRV_GET_INPUT_INFO result */
90{
91 unsigned int input_cp; /* console input codepage */
92 unsigned int output_cp; /* console output codepage */
93};
94
95/* IOCTL_CONDRV_SET_INPUT_INFO params */
97{
98 unsigned int mask; /* setting mask */
99 struct condrv_input_info info; /* input_info */
100};
101
102#define SET_CONSOLE_INPUT_INFO_INPUT_CODEPAGE 0x01
103#define SET_CONSOLE_INPUT_INFO_OUTPUT_CODEPAGE 0x02
104
105/* IOCTL_CONDRV_WRITE_OUTPUT and IOCTL_CONDRV_READ_OUTPUT params */
107{
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 */
113};
114
116{
117 CHAR_INFO_MODE_TEXT, /* characters only */
118 CHAR_INFO_MODE_ATTR, /* attributes only */
119 CHAR_INFO_MODE_TEXTATTR, /* both characters and attributes */
120};
121
122/* IOCTL_CONDRV_GET_OUTPUT_INFO result */
124{
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 */
144};
145
146/* IOCTL_CONDRV_SET_OUTPUT_INFO params */
148{
149 unsigned int mask; /* setting mask */
150 struct condrv_output_info info; /* output info */
151};
152
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
161
162/* IOCTL_CONDRV_GET_TITLE params */
164{
165 unsigned int title_len;
167};
168
169/* IOCTL_CONDRV_FILL_OUTPUT params */
171{
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 */
179};
180
181/* IOCTL_CONDRV_SCROLL params */
183{
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 */
188};
189
190/* IOCTL_CONDRV_CTRL_EVENT params */
192{
193 int event; /* the event to send */
194 unsigned int group_id; /* the group to send the event to */
195};
196
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)
202
203#endif /* _INC_CONDRV */
GLuint buffer
Definition: glext.h:5915
short WCHAR
Definition: pedump.c:58
static condrv_handle_t condrv_handle(HANDLE handle)
Definition: condrv.h:75
char_info_mode
Definition: condrv.h:116
@ CHAR_INFO_MODE_TEXT
Definition: condrv.h:117
@ CHAR_INFO_MODE_TEXTATTR
Definition: condrv.h:119
@ CHAR_INFO_MODE_ATTR
Definition: condrv.h:118
unsigned int condrv_handle_t
Definition: condrv.h:72
WCHAR ch
Definition: condrv.h:84
unsigned short attr
Definition: condrv.h:85
unsigned int group_id
Definition: condrv.h:194
unsigned short attr
Definition: condrv.h:178
unsigned int mask
Definition: condrv.h:98
unsigned int input_cp
Definition: condrv.h:91
unsigned int output_cp
Definition: condrv.h:92
unsigned int mask
Definition: condrv.h:149
short int cursor_visible
Definition: condrv.h:126
short int cursor_x
Definition: condrv.h:127
short int font_weight
Definition: condrv.h:141
short int attr
Definition: condrv.h:131
short int cursor_y
Definition: condrv.h:128
short int width
Definition: condrv.h:129
short int win_bottom
Definition: condrv.h:136
short int font_pitch_family
Definition: condrv.h:142
short int win_right
Definition: condrv.h:135
short int max_height
Definition: condrv.h:138
short int font_height
Definition: condrv.h:140
short int popup_attr
Definition: condrv.h:132
short int font_width
Definition: condrv.h:139
short int win_top
Definition: condrv.h:134
unsigned int color_map[16]
Definition: condrv.h:143
short int max_width
Definition: condrv.h:137
short int win_left
Definition: condrv.h:133
short int cursor_size
Definition: condrv.h:125
short int height
Definition: condrv.h:130
unsigned int x
Definition: condrv.h:108
unsigned int width
Definition: condrv.h:111
unsigned int y
Definition: condrv.h:109
unsigned int mode
Definition: condrv.h:110
SMALL_RECT scroll
Definition: condrv.h:184
SMALL_RECT clip
Definition: condrv.h:186
char_info_t fill
Definition: condrv.h:187
unsigned int title_len
Definition: condrv.h:165
Definition: blue.h:25
int32_t INT_PTR
Definition: typedefs.h:64