1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS Console Driver
4  * FILE:            include/reactos/drivers/condrv/ntddcon.h
5  * PURPOSE:         Console Driver IOCTL Interface
6  * PROGRAMMERS:     Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7  */
8 
9 #if (_MSC_VER >= 1020)
10 #pragma once
11 #endif
12 
13 #ifndef _NTDDCON_H_
14 #define _NTDDCON_H_
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 // FIXME: Redo all the drawing since this one is quite old...
21 
22 /************************************************************************************************
23  *                          Architecture of the Generic Terminal Driver
24  ************************************************************************************************
25 
26 IN  = CONIN$  = stdin
27 OUT = CONOUT$ = stdout
28 ERR           = stderr
29 
30                                     +------------------------------+
31         +-------------+             | +-----------------+          |
32         |             |----- ERR ---->|                 |------+   |
33         | Console App |----- OUT ---->| Virtual Console |----+ |   |
34         |      1      |<---- IN  -----|       1-1       |--+ | |   |
35         +-------------+             | +-----------------+  | | |   |
36                                     |                      | | \   |
37         +-------------+             | +-----------------+  | |  >--X----- ERR ---->
38         |             |----- ERR ---->|                 |--|-|-/   |
39         | Console App |----- OUT ---->| Virtual Console |--|-+-----X----- OUT ---->
40         |      2      |<---- IN  -----|       1-2       |--+---\   |
41         +-------------+       ^     | +-----------------+       \--X<---- IN  -----
42                               |     |                              |       ^
43                        --+    |     |        . . .                 |       |
44 \Console +-- \CurrentIn  |    |     |                              |       |
45          +-- \CurrentOut +----+     |                              |       |
46              \CurrentErr |          |          Terminal 1          |       |
47                        --+          |                              |       |
48                                     +------------------------------+       |
49                                                                            |
50                                                                       +----+----+
51                             . . .                                     | \Input  |
52                                                                         \Output
53                                                                         \Error
54 
55 */
56 
57 /*
58  * Remarks on the symbolic links :
59  *
60  * - \DosDevices\ is an alias to \??\
61  *
62  * - Using "\DosDevices\Global\<name>" allows the driver to ALWAYS
63  *   create the symbolic link in the global object namespace. Indeed,
64  *   under Windows NT-2000, the \DosDevices\ directory was always
65  *   global, but starting with Windows XP, it became local to a session.
66  *   One would then use \GLOBAL??\ to access to the global directory.
67  *   However, this name doesn't exist under Windows NT-2000.
68  *   Therefore, we use the trick to use the 'Global' symbolic link
69  *   defined both under Windows NT-2000 and Windows XP and later,
70  *   which exists in \DosDevices\, to access to \??\ (global) under
71  *   Windows NT-2000, and to \GLOBAL??\ under Windows XP and later.
72  */
73 
74 //
75 // Controller device
76 //
77 #define DD_CONDRV_CTRL_DEVICE_NAME    "\\Device\\ConDrv"
78 #define DD_CONDRV_CTRL_DEVICE_NAME_U L"\\Device\\ConDrv"
79 #define DD_CONDRV_CTRL_SYMLNK_NAME    "\\DosDevices\\Global\\ConDrv"
80 #define DD_CONDRV_CTRL_SYMLNK_NAME_U L"\\DosDevices\\Global\\ConDrv"
81 
82 
83 //
84 // Console
85 //
86 #define DD_CONDRV_CONSOLE_DEVICE_NAME    "\\Device\\Console"
87 #define DD_CONDRV_CONSOLE_DEVICE_NAME_U L"\\Device\\Console"
88 #define DD_CONDRV_CONSOLE_SYMLNK_NAME    "\\DosDevices\\Global\\Console"
89 #define DD_CONDRV_CONSOLE_SYMLNK_NAME_U L"\\DosDevices\\Global\\Console"
90 
91 
92 #ifdef TELETYPE
93 //
94 // Virtual files associated with a given console
95 //
96 #define CONDRV_CONSOLE_FILE_CURRIN     "\\CurrentIn"
97 #define CONDRV_CONSOLE_FILE_CURRIN_U  L"\\CurrentIn"
98 
99 #define CONDRV_CONSOLE_FILE_CURROUT    "\\CurrentOut"
100 #define CONDRV_CONSOLE_FILE_CURROUT_U L"\\CurrentOut"
101 
102 //#define CONDRV_CONSOLE_FILE_CURRERR    "\\CurrentErr"
103 //#define CONDRV_CONSOLE_FILE_CURRERR_U L"\\CurrentErr"
104 
105 #define CONDRV_VC_FILE_SCRBUF      "\\ScreenBuffer"
106 #define CONDRV_VC_FILE_SCRBUF_U   L"\\ScreenBuffer"
107 
108 /*** Original names from Windows-8 condrv.sys ***
109 
110 L"\Connect"
111 L"\Reference"
112 L"\Server"
113 L"\Broker"
114 
115 L"\Console"
116 L"\Display"
117 
118 L"\Input"
119 L"\Output"
120 L"\CurrentIn"
121 L"\CurrentOut"
122 L"\ScreenBuffer"
123 
124 ***/
125 
126 #endif
127 
128 
129 //
130 // IO codes
131 //
132 #ifndef CTL_CODE
133     #error "CTL_CODE undefined. Include winioctl.h or wdm.h"
134 #endif
135 
136 #define IOCTL_CONDRV_CREATE_CONSOLE  CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_ALL_ACCESS)
137 #define IOCTL_CONDRV_DELETE_CONSOLE  CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, FILE_WRITE_ACCESS)
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif // _NTDDCON_H_
144 
145 /* EOF */
146