<s>
Windows	B-Application
Console	I-Application
is	O
the	O
infrastructure	O
for	O
console	B-Device
applications	I-Device
in	O
Microsoft	B-Application
Windows	I-Application
.	O
</s>
<s>
An	O
instance	O
of	O
a	O
Windows	B-Application
Console	I-Application
has	O
a	O
screen	B-Algorithm
buffer	I-Algorithm
and	O
an	O
input	B-General_Concept
buffer	I-General_Concept
.	O
</s>
<s>
It	O
allows	O
console	B-Device
apps	I-Device
to	O
run	O
inside	O
a	O
window	O
or	O
in	O
hardware	B-Application
text	I-Application
mode	I-Application
(	O
so	O
as	O
to	O
occupy	O
the	O
entire	O
screen	O
)	O
.	O
</s>
<s>
The	O
text	B-Application
mode	I-Application
is	O
unavailable	O
in	O
Windows	B-Application
Vista	I-Application
and	O
later	O
.	O
</s>
<s>
Starting	O
with	O
Windows	B-Operating_System
10	I-Operating_System
,	O
however	O
,	O
a	O
native	O
full-screen	O
mode	O
is	O
available	O
.	O
</s>
<s>
Windows	B-Application
Console	I-Application
instances	O
are	O
typically	O
used	O
for	O
apps	O
that	O
do	O
not	O
need	O
to	O
display	O
images	O
but	O
might	O
use	O
color	O
.	O
</s>
<s>
Examples	O
include	O
cmd.exe	B-Device
,	O
Windows	B-Application
PowerShell	I-Application
,	O
Far	B-Language
Manager	I-Language
,	O
and	O
Midnight	B-Protocol
Commander	I-Protocol
.	O
</s>
<s>
In	O
2019	O
,	O
the	O
Windows	B-Application
Console	I-Application
infrastructure	O
was	O
open-sourced	B-Application
under	O
the	B-License
MIT	I-License
License	I-License
,	O
alongside	O
Windows	B-Language
Terminal	I-Language
.	O
</s>
<s>
In	O
Windows	O
,	O
a	O
console	B-Device
application	I-Device
may	O
run	O
in	O
two	O
modes	O
.	O
</s>
<s>
This	O
is	O
analogous	O
to	O
X	B-Operating_System
Window	I-Operating_System
System	I-Operating_System
applications	O
such	O
as	O
xterm	B-Language
.	O
</s>
<s>
In	O
Windows	B-Application
XP	I-Application
and	O
earlier	O
,	O
the	O
full-screen	O
console	O
uses	O
a	O
hardware	B-Application
text	I-Application
mode	I-Application
and	O
uploads	O
a	O
raster	O
font	O
to	O
the	O
video	B-Device
adapter	I-Device
.	O
</s>
<s>
This	O
is	O
analogous	O
to	O
a	O
text	O
system	B-Device
console	I-Device
.	O
</s>
<s>
This	O
early	O
full-screen	O
mode	O
only	O
supports	O
VGA-compatible	B-Device
text	I-Device
modes	I-Device
,	O
giving	O
it	O
a	O
maximum	O
character	O
resolution	B-General_Concept
of	O
80	O
columns	O
by	O
28	O
rows	O
.	O
</s>
<s>
This	O
mode	O
was	O
deprecated	O
in	O
Windows	B-Application
Vista	I-Application
.	O
</s>
<s>
It	O
was	O
possible	O
to	O
circumvent	O
this	O
issue	O
by	O
installing	O
a	O
Windows	B-Application
XP	I-Application
display	O
driver	O
;	O
however	O
,	O
Windows	B-Application
8	I-Application
and	O
later	O
do	O
not	O
accept	O
them	O
.	O
</s>
<s>
Windows	B-Operating_System
10	I-Operating_System
features	O
a	O
full-screen	O
mode	O
once	O
again	O
,	O
but	O
this	O
implementation	O
uses	O
the	O
native	O
Windows	O
rendering	O
subsystem	O
,	O
instead	O
of	O
the	O
text	B-Application
mode	I-Application
.	O
</s>
<s>
The	O
input	B-General_Concept
buffer	I-General_Concept
is	O
a	O
queue	O
where	O
events	O
are	O
stored	O
(	O
from	O
keyboard	B-Device
,	O
mouse	B-Device
etc	O
.	O
)	O
.	O
</s>
<s>
The	O
output	O
buffer	B-General_Concept
is	O
a	O
rectangular	O
grid	O
where	O
characters	O
are	O
stored	O
,	O
together	O
with	O
their	O
attributes	O
.	O
</s>
<s>
A	O
console	B-Application
window	I-Application
may	O
have	O
several	O
output	O
buffers	B-General_Concept
,	O
only	O
one	O
of	O
which	O
is	O
active	O
(	O
i.e.	O
</s>
<s>
Apps	O
may	O
programmatically	O
interact	O
with	O
Windows	B-Application
Console	I-Application
through	O
Windows	B-Library
API	I-Library
,	O
which	O
exposes	O
both	O
high-level	O
functions	O
(	O
such	O
as	O
ReadConsole	O
and	O
WriteConsole	O
)	O
and	O
low-level	O
functions	O
(	O
e.g.	O
</s>
<s>
Users	O
can	O
change	O
the	O
color	B-Data_Structure
palette	I-Data_Structure
or	O
font	O
,	O
either	O
on	O
the	O
system-wide	O
level	O
or	O
app-level	O
.	O
</s>
<s>
Each	O
instance	O
of	O
a	O
console	B-Device
app	I-Device
themselves	O
,	O
however	O
,	O
cannot	O
change	O
its	O
color	B-Data_Structure
palette	I-Data_Structure
or	O
font	O
on	O
the	O
fly	O
.	O
</s>
<s>
Windows	B-Application
Console	I-Application
apps	O
are	O
distinct	O
from	O
MS-DOS	B-Application
apps	O
,	O
even	O
though	O
on	O
Windows	O
(	O
especially	O
on	O
Windows	O
9x	O
)	O
,	O
they	O
may	O
not	O
look	O
different	O
.	O
</s>
<s>
Windows	B-Application
Console	I-Application
apps	O
have	O
access	O
to	O
entire	O
Windows	B-Library
API	I-Library
and	O
do	O
not	O
run	O
on	O
MS-DOS	B-Application
or	O
compatible	O
operating	O
systems	O
.	O
</s>
<s>
DOS	O
apps	O
,	O
however	O
,	O
cannot	O
access	O
Windows	B-Library
API	I-Library
and	O
may	O
only	O
run	O
on	O
32-bit	O
versions	O
of	O
Windows	O
with	O
the	O
aid	O
of	O
Virtual	O
DOS	O
machine	O
(	O
VDM	O
)	O
.	O
</s>
<s>
Prior	O
to	O
Windows	B-Application
95	I-Application
,	O
there	O
is	O
no	O
native	O
support	O
for	O
consoles	O
.	O
</s>
<s>
Because	O
Windows	B-Application
3.1	I-Application
and	O
earlier	O
are	O
merely	O
a	O
graphical	O
interface	O
for	O
MS-DOS	B-Application
,	O
most	O
text	O
programs	O
that	O
ran	O
on	O
earlier	O
Windows	O
versions	O
were	O
actually	O
MS-DOS	B-Application
programs	O
running	O
in	O
a	O
window	O
.	O
</s>
<s>
To	O
simplify	O
the	O
task	O
of	O
porting	O
applications	O
to	O
Windows	O
,	O
early	O
versions	O
of	O
Visual	B-Application
C++	I-Application
are	O
supplied	O
with	O
QuickWin	B-Device
,	O
a	O
library	O
that	O
implements	O
basic	O
console	O
functionality	O
inside	O
a	O
regular	O
window	O
.	O
</s>
<s>
A	O
similar	O
library	O
for	O
Borland	B-Application
C++	I-Application
was	O
called	O
EasyWin	O
.	O
</s>
<s>
Windows	O
9x	O
support	O
is	O
relatively	O
poor	O
compared	O
to	O
Windows	B-Device
NT	I-Device
,	O
because	O
the	O
console	B-Application
window	I-Application
runs	O
in	O
the	O
system	O
virtual	O
DOS	O
machine	O
and	O
so	O
keyboard	B-Device
input	O
to	O
a	O
Win32	B-Application
console	I-Application
application	O
had	O
to	O
be	O
directed	O
to	O
it	O
by	O
conagent.exe	O
running	O
in	O
a	O
DOS	O
VM	O
that	O
are	O
also	O
used	O
for	O
real	O
DOS	O
applications	O
by	O
hooking	O
the	O
keyboard	B-Device
interrupt	O
.	O
</s>
<s>
conagent.exe	O
then	O
calls	O
Vcond	O
(	O
which	O
is	O
a	O
VxD	B-Application
)	O
.	O
</s>
<s>
Vcond	O
then	O
had	O
to	O
pass	O
the	O
keyboard	B-Device
input	O
to	O
the	O
System	O
VM	O
,	O
and	O
then	O
finally	O
to	O
the	O
Win32	B-Application
console	I-Application
application	O
.	O
</s>
<s>
Besides	O
performance	O
,	O
another	O
problem	O
with	O
this	O
implementation	O
is	O
that	O
drives	O
that	O
are	O
local	O
to	O
a	O
DOS	O
VM	O
are	O
not	O
visible	O
to	O
a	O
Win32	B-Application
console	I-Application
application	O
.	O
</s>
<s>
Under	O
Windows	O
9x	O
,	O
the	O
screen	B-Algorithm
buffer	I-Algorithm
mirrors	O
the	O
structure	O
of	O
VGA	B-Device
text	I-Device
buffer	I-Device
,	O
with	O
two	O
bytes	O
per	O
character	B-Application
cell	I-Application
:	O
one	O
byte	O
for	O
character	O
code	O
,	O
one	O
byte	O
for	O
attributes	O
(	O
the	O
character	O
must	O
be	O
in	O
OEM	O
character	O
set	O
,	O
the	O
attribute	O
is	O
with	O
high-intensity	O
background/no	O
blinking	O
)	O
.	O
</s>
<s>
This	O
speeds	O
up	O
operation	O
considerably	O
if	O
the	O
actual	O
VGA	B-Device
text	I-Device
mode	I-Device
is	O
used	O
.	O
</s>
<s>
Traditionally	O
,	O
the	O
Client/Server	O
Runtime	O
Subsystem	O
(	O
CSRSS	O
)	O
has	O
been	O
responsible	O
for	O
managing	O
console	B-Application
windows	I-Application
on	O
the	O
Windows	B-Device
NT	I-Device
family	I-Device
of	O
operating	O
systems	O
.	O
</s>
<s>
In	O
Windows	B-Device
7	I-Device
,	O
CSRSS	O
spawns	O
one	O
conhost.exe	B-Application
for	O
each	O
console	B-Application
window	I-Application
,	O
to	O
manage	O
it	O
.	O
</s>
<s>
In	O
Windows	B-Application
8	I-Application
and	O
later	O
,	O
the	O
console	B-Device
apps	I-Device
spawn	O
their	O
conhost.exe	B-Application
processes	O
directly	O
.	O
</s>
<s>
While	O
CSRSS	O
runs	O
in	O
a	O
highly	O
privileged	O
security	O
context	O
,	O
each	O
conhost.exe	B-Application
runs	O
in	O
the	O
same	O
security	O
context	O
as	O
the	O
console	B-Device
app	I-Device
.	O
</s>
<s>
In	O
addition	O
,	O
in	O
Windows	B-Device
7	I-Device
,	O
this	O
change	O
enabled	O
console	B-Application
windows	I-Application
to	O
have	O
the	O
features	O
of	O
the	O
Aero	O
Glass	O
theme	O
.	O
</s>
<s>
On	O
Windows	B-Device
NT	I-Device
and	O
Windows	B-Operating_System
CE	I-Operating_System
,	O
the	O
screen	B-Algorithm
buffer	I-Algorithm
uses	O
four	O
bytes	O
per	O
character	B-Application
cell	I-Application
:	O
two	O
bytes	O
for	O
character	O
code	O
,	O
two	O
bytes	O
for	O
attributes	O
.	O
</s>
<s>
The	O
non-Unicode	O
versions	O
of	O
APIs	O
can	O
use	O
code	O
page	O
switching	O
to	O
extend	O
the	O
range	O
of	O
displayed	O
characters	O
(	O
but	O
only	O
if	O
TrueType	O
fonts	O
are	O
used	O
for	O
the	O
console	B-Application
window	I-Application
,	O
thereby	O
extending	O
the	O
range	O
of	O
codes	O
available	O
)	O
.	O
</s>
<s>
As	O
of	O
the	O
Windows	B-Operating_System
10	I-Operating_System
October	O
2018	O
update	O
,	O
the	O
Windows	B-Application
Console	I-Application
has	O
full	O
Unicode	O
support	O
.	O
</s>
