Win32 console

Last updated
Windows PowerShell using the Win32 console window on Windows Vista. Windows PowerShell 1.0 PD.png
Windows PowerShell using the Win32 console window on Windows Vista.
GNU Midnight Commander using box drawing characters in the Win32 console. GNU Midnight Commander 4.1.36 Windows Vista.png
GNU Midnight Commander using box drawing characters in the Win32 console.

Win32 console is a text user interface implementation within the system of Windows API, which runs console applications. A Win32 console has a screen buffer and an input buffer, and is available both as a window or in text mode screen, with switching back and forth available via Alt-Enter keys. The latter was not supported in Windows Vista, 7, 8, and 8.1, due to the system not supporting fullscreen mode, but was made supported again in Windows 10.

The Windows API, informally WinAPI, is Microsoft's core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems. The name Windows API collectively refers to several different platform implementations that are often referred to by their own names ; see the versions section. Almost all Windows programs interact with the Windows API. On the Windows NT line of operating systems, a small number use the Native API.

Console application computer program designed to be used via a text-only computer interface

A console application is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command line interface of some operating systems or the text-based interface included with most Graphical User Interface (GUI) operating systems, such as the Win32 console in Microsoft Windows, the Terminal in Mac OS X, and xterm in Unix. A user typically interacts with a console application using only a keyboard and display screen, as opposed to GUI applications, which normally require the use of a mouse or other pointing device. Many console applications such as command line interpreters are command line tools, but numerous text-based user interface (TUI) programs also exist.

Window (computing) visual area containing some kind of user interface

In computing, a window is a graphical control element. It consists of a visual area containing some of the graphical user interface of the program it belongs to and is framed by a window decoration. It usually has a rectangular shape that can overlap with the area of other windows. It displays the output of and may allow input to one or more processes.

Contents

Win32 consoles are typically used for applications that do not need to display images but which might use color. Examples include command line interface tools; command line interpreters such as Windows Command Prompt, Windows PowerShell; file managers such as Far Manager and Midnight Commander; and editors such as the MS-DOS Editor.

A file manager or file browser is a computer program that provides a user interface to manage files and folders. The most common operations performed on files or groups of files include creating, opening, renaming, moving or copying, deleting and searching for files, as well as modifying file attributes, properties and file permissions. Folders and files may be displayed in a hierarchical tree based on their directory structure. Some file managers contain features inspired by web browsers, including forward and back navigational buttons.

Far Manager File and Archive Manager

Far Manager is an orthodox file manager for Microsoft Windows and a clone of Norton Commander. Far Manager uses the Win32 console and has a keyboard-oriented user interface.

Midnight Commander file manager

GNU Midnight Commander is a free cross-platform orthodox file manager. It was started by Miguel de Icaza in 1994 as a clone of the then-popular Norton Commander.

Window and full screen modes

A Win32 console application may run in two modes.

One mode places the text in a window and uses an operating system's font rendering. In this mode, an application's interaction with user is controlled by the windowing system. This is analogous to X Window System applications such as xterm.

Human–computer interaction (HCI) researches the design and use of computer technology, focused on the interfaces between people (users) and computers. Researchers in the field of HCI both observe the ways in which humans interact with computers and design technologies that let humans interact with computers in novel ways. As a field of research, human–computer interaction is situated at the intersection of computer science, behavioral sciences, design, media studies, and several other fields of study. The term was popularized by Stuart K. Card, Allen Newell, and Thomas P. Moran in their seminal 1983 book, The Psychology of Human–Computer Interaction, although the authors first used the term in 1980 and the first known use was in 1975. The term connotes that, unlike other tools with only limited uses, a computer has many uses and this takes place as an open-ended dialog between the user and the computer. The notion of dialog likens human–computer interaction to human-to-human interaction, an analogy which is crucial to theoretical considerations in the field.

X Window System windowing system for bitmap displays on UNIX-like systems

The X Window System is a windowing system for bitmap displays, common on Unix-like operating systems.

xterm standard terminal emulator for the X Window system

In computing, xterm is the standard terminal emulator for the X Window System. A user can have many different invocations of xterm running at once on the same display, each of which provides independent input/output for the process running in it.

In a full screen mode Win32 console uses a hardware text mode and uploads a raster font to the video adapter. This is analogous to a text system console. Full screen uses Windows' built-in VGA driver, rather than any installed graphics drivers, unless another driver is VGA-compatible. [1] Therefore, it only supports VGA-compatible text modes, giving it a maximum character resolution of 80 columns by 28 rows. [2] This contrasts with comparable consoles in various other operating systems such as Linux, which are able to display higher resolutions through different drivers. This mode was deprecated in Windows Vista as Windows Display Driver Model (WDDM) ceased to support these VGA modes. [3] It was possible to circumvent this issue by installing a Windows XP display driver; [3] however, Windows 8 and later only accepts WDDM drivers. [4]

System console in early computers, unit used to control the machine

The system console, computer console, root console, operator's console, or simply console is the text entry and display device for system administration messages, particularly those from the BIOS or boot loader, the kernel, from the init system and from the system logger. It is a physical device consisting of a keyboard and a screen, and traditionally is a text terminal, but may also be a graphical terminal. System consoles are generalized to computer terminals, which are abstracted respectively by virtual consoles and terminal emulators. Today communication with system consoles is generally done abstractly, via the standard streams, but there may be system-specific interfaces, for example those used by the system kernel.

Video Graphics Array analog computer display standard and a display resolution

Video Graphics Array (VGA) is a graphics standard for video display controller first introduced with the IBM PS/2 line of computers in 1987, following CGA and EGA introduced in earlier IBM personal computers. Through widespread adoption, the term has also come to mean either an analog computer display standard, the 15-pin D-subminiature VGA connector, or the 640×480 resolution characteristic of the VGA hardware.

Display resolution how many pixels a monitor can display

The display resolution or display modes of a digital television, computer monitor or display device is the number of distinct pixels in each dimension that can be displayed. It can be an ambiguous term especially as the displayed resolution is controlled by different factors in cathode ray tube (CRT) displays, flat-panel displays and projection displays using fixed picture-element (pixel) arrays.

An application can be instantly switched between these two modes with Alt+Return key combination. Text environments in Unix-like systems usually do not have such a feature.

Unix-like operating system that behaves in a manner similar to a Unix system

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-like application is one that behaves like the corresponding Unix command or shell. There is no standard for defining the term, and some difference of opinion is possible as to the degree to which a given operating system or application is "Unix-like".

Details

The input buffer is a queue where events are stored (from keyboard, mouse etc.). The output buffer is a rectangular grid where characters are stored, together with their attributes. A console window may have several output buffers, only one of which is active (i.e. displayed) for a given moment.

Computer keyboard device comprising an arrangement of buttons or keys used to input text in computers

In computing, a computer keyboard is a typewriter-style device which uses an arrangement of buttons or keys to act as mechanical levers or electronic switches. Following the decline of punch cards and paper tape, interaction via teleprinter-style keyboards became the main input method for computers.

Computer mouse pointing device

A computer mouse is a hand-held pointing device that detects two-dimensional motion relative to a surface. This motion is typically translated into the motion of a pointer on a display, which allows a smooth control of the graphical user interface. The first public demonstration of a mouse controlling a computer system was in 1968. Originally wired to a computer, many modern mice are cordless, relying on short-range radio communication with the connected system. Mice originally used a ball rolling on a surface to detect motion, but modern mice often have optical sensors that have no moving parts. In addition to moving a cursor, computer mice have one or more buttons to allow operations such as selection of a menu item on a display. Mice often also feature other elements, such as touch surfaces and "wheels", which enable additional control and dimensional input.

The console window may be displayed as a normal window on the desktop, or may be switched to full screen to use the actual hardware text mode, if a video driver permits a chosen screen size. The display mode is locked in background intensity mode, thus blinking does not work. Also, the underscore attribute is not available.

Programs may access a Win32 console either via high-level functions (such as ReadConsole and WriteConsole) or via low-level functions (e.g. ReadConsoleInput and WriteConsoleOutput). These high-level functions are more limited than a Win32 GUI; for instance it is not possible for a program to change the color palette, nor is it possible to modify the font used by the console using these functions. [5]

Win32 console programs are often mistaken for MS-DOS applications, especially on Windows 9x. However, a Win32 Console application is just a special form of a native Win32 application. 32-bit Windows can run MS-DOS programs in Win32 console through the use of the NT Virtual DOS Machine (NTVDM).

In earlier versions of Windows, there is no native support for consoles. Because Windows 3.1 and earlier are merely a graphical interface for MS-DOS, most text programs that ran on earlier Windows versions were actually MS-DOS programs running in a window. To simplify the task of porting applications to Windows, early versions of Visual C++ are supplied with QuickWin, a library that implements basic console functionality inside a regular window. A similar library for Borland C++ was called EasyWin.

Implementations

Windows 9x

Windows 9x support is relatively poor compared to Windows NT, because the console window runs in the system virtual DOS machine and so keyboard input to a Win32 console application had to be directed to it by conagent.exe running in a DOS VM that are also used for real DOS applications by hooking the keyboard interrupt. conagent.exe then calls Vcond (which is a VxD). Vcond then had to pass the keyboard input to the System VM, and then finally to the Win32 console application. Besides performance, another problem with this implementation is that drives that are local to a DOS VM are not visible to a Win32 console application. This can cause confusion.

Under Windows 9x, the screen buffer mirrors the structure of VGA text buffer, with two bytes per character cell: one byte for character code, one byte for attributes (the character must be in OEM character set, the attribute is with high-intensity background/no blinking). This speeds up operation considerably if the actual VGA text mode is used.

Windows NT and Windows CE

The Client/Server Runtime Subsystem is responsible for Win32 console windows on Windows NT family of operating systems, [6] although since Windows 7 it offloads most of its work to a separate executable, conhost.exe. Further changes came in Windows 8, with the Conhost.exe process now being spawned by the console-based process rather than from Csrss.exe as in Windows 7 [7]

Under Windows NT and Windows CE, the screen buffer uses four bytes per character cell: two bytes for character code, two bytes for attributes. The character is then encoded in a 16-bit subset of Unicode (UCS-2). [8] For backward compatibility, the console APIs exist in two versions: Unicode and non-Unicode. The non-Unicode versions of APIs can use code page switching to extend the range of displayed characters (but only if TrueType fonts are used for the console window, thereby extending the range of codes available). Even UTF-8 is available as "code page 65001" [9] (displaying only from the UCS-2 subset of full Unicode[ citation needed ]).

See also

Related Research Articles

Cygwin Unix subsystem for Windows machines

Cygwin is a POSIX-compatible environment that runs natively on Microsoft Windows. Its goal is to allow programs of Unix-like systems to be recompiled and run natively on Windows with minimal source code modifications by providing them with the same underlying POSIX API they would expect in those systems.

History of the graphical user interface

The history of the graphical user interface, understood as the use of graphic icons and a pointing device to control a computer, covers a five-decade span of incremental refinements, built on some constant core principles. Several vendors have created their own windowing systems based on independent code, but with basic elements in common that define the WIMP "window, icon, menu and pointing device" paradigm.

Scroll Lock computer key

Scroll lock is a lock key on most IBM-compatible computer keyboards.

Notepad is a simple text editor for Microsoft Windows and a basic text-editing program which enables computer users to create documents. It was first released as a mouse-based MS-DOS program in 1983, and has been included in all versions of Microsoft Windows since Windows 1.0 in 1985.

Text-based user interface type of interface based on outputting to or controlling a text display

Text-based user interface (TUI), also called textual user interface or terminal user interface, is a retronym coined sometime after the invention of graphical user interfaces (GUI). TUIs display computer graphics in text mode. An advanced TUI may, like GUIs, use the entire screen area and accept mouse and other inputs.

Text mode is a computer display mode in which content is internally represented on a computer screen in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of character cells, each of which contains one of the characters of a character set. Text mode is contrasted to all points addressable (APA) mode or other kinds of computer graphics modes.

ANSI.SYS is a device driver in the DOS family of operating systems that provides extra console functions through ANSI escape sequences. It is partially based upon a subset of the text terminal control standard proposed by the ANSI X3L2 Technical Committee on Codes and Character Sets.

Architecture of Windows NT

The architecture of Windows NT, a line of operating systems produced and sold by Microsoft, is a layered design that consists of two main components, user mode and kernel mode. It is a preemptive, reentrant operating system, which has been designed to work with uniprocessor and symmetrical multiprocessor (SMP)-based computers. To process input/output (I/O) requests, they use packet-driven I/O, which utilizes I/O request packets (IRPs) and asynchronous I/O. Starting with Windows XP, Microsoft began making 64-bit versions of Windows available; before this, these operating systems only existed in 32-bit versions.

The Windows NT startup process is the process by which Windows NT 4.0, Windows 2000, Windows XP and Windows Server 2003 operating systems initialize. In Windows Vista and later, this process has changed significantly; see Windows Vista startup process for information about what has changed.

The Microsoft Windows operating system supports a form of shared libraries known as "dynamic-link libraries", which are code libraries that can be used by multiple processes while only one copy is loaded into memory. This article provides an overview of the core libraries that are included with every modern Windows installation, on top of which most Windows applications are built.

Client Server Runtime Subsystem, or csrss.exe, is a component of the Windows NT family of operating systems that provides the user mode side of the Win32 subsystem and is included in Windows NT 3.1 and later. Because most of the Win32 subsystem operations have been moved to kernel mode drivers in Windows NT 4 and later, CSRSS is mainly responsible for Win32 console handling and GUI shutdown. It is critical to system operation; therefore, terminating this process will result in system failure. Under normal circumstances, CSRSS cannot be terminated with the taskkill command or with Windows Task Manager, although it is possible in Windows Vista if the Task Manager is run in Administrator mode. On Windows 7 and later, Task Manager will inform the user that terminating the process may result in system failure, and prompt if they want to continue.

The SemWare Editor (TSE) is a text editor computer program for MS-DOS, OS/2, and Windows.

The Windows startup process is the process by which the Microsoft Windows series of operating systems initializes.

Windows 1.0 operating system

Windows 1.0 is a graphical personal computer operating environment developed by Microsoft. Microsoft had worked with Apple Computer to develop applications for Apple's January 1984 original Macintosh, the first mass-produced personal computer with a graphical user interface (GUI) that enabled users to see user friendly icons on screen. Windows 1.0 was released on November 20, 1985, as the first version of the Microsoft Windows line. It runs as a graphical, 16-bit multi-tasking shell on top of an existing MS-DOS installation. It provides an environment which can run graphical programs designed for Windows, as well as existing MS-DOS software. Its development was spearheaded by the company founder Bill Gates after he saw a demonstration of a similar software suite known as Visi On at COMDEX.

Windows 3.0 Third major release of Microsoft Windows

Windows 3.0, a graphical environment, is the third major release of Microsoft Windows, and was released on May 22, 1990. It became the first widely successful version of Windows and a rival to Apple Macintosh and the Commodore Amiga on the graphical user interface (GUI) front. It was followed by Windows 3.1.

MS-DOS Discontinued computer operating system

MS-DOS is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and some operating systems attempting to be compatible with MS-DOS, are sometimes referred to as "DOS". MS-DOS was the main operating system for IBM PC compatible personal computers during the 1980s and the early 1990s, when it was gradually superseded by operating systems offering a graphical user interface (GUI), in various generations of the graphical Microsoft Windows operating system.

Linux console Console of the Linux kernel.

The Linux console is a system console internal to the Linux kernel. The Linux console provides a way for the kernel and other processes to send text output to the user, and to receive text input from the user. The user typically enters text with a computer keyboard and reads the output text on a computer monitor. The Linux kernel supports virtual consoles - consoles that are logically separate, but which access the same physical keyboard and display. The Linux console are implemented by the VT subsystem of the Linux kernel, and do not rely on any user space software. This is in contrast to a terminal emulator, which is a user space process that emulates a terminal, and is typically used in a graphical display environment.

VGA-compatible text mode

The implementation of computer monitor text mode on VGA-compatible hardware is quite complex. Its use on PC-compatible computers was widespread in 1980s–1990s, but persists today for some applications even on modern desktop computers. The main features of VGA text mode are colored characters and their background, blinking, various shapes of the cursor, and loadable fonts. The Linux console traditionally uses hardware VGA-compatible text modes, and the Win32 console environment has an ability to switch the screen to text mode for some text window sizes.

Architecture of Windows 9x

The Windows 9x series of operating systems refers to the kernel which lies at the heart of Windows 9x. Its architecture is monolithic.

References

  1. VGA-Compatible Video Miniport Drivers, 2012-10-16, retrieved 2012-11-14
  2. Julio Sanchez; Maria P. Canton (2003), "VGA Fundamentals, Part II: DOS Graphics", The PC Graphics Handbook (for C++ Programmers) (Book), CRC Press, p. 125, ISBN   0849316782
  3. 1 2 "Some 16-bit DOS-based Programs and the Command Prompt will not run in full-screen mode in Windows Vista and in Windows 7". Support. Microsoft. 2011-09-23.
  4. "Roadmap for Developing Drivers for the Windows 2000 Display Driver Model (XDDM)". Windows Dev Center - Hardware. Microsoft. 16 November 2013. Retrieved 16 December 2013. XDDM and VGA drivers will not compile on Windows 8 and later versions
  5. A hack is available: SetConsolePalette
  6. Microsoft Security Advisory (930181): Exploit Code Published Affecting Windows Client Server Run-Time Subsystem
  7. Yosifovich, Pavel; Ionescu, Alex; Russinovich, Mark E.; Solomon, David A. (2017-05-15). Windows Internals, Part 1: System architecture, processes, threads, memory management, and more (7th Edition). Redmond, Washington: Microsoft Press. p. 67. ISBN   9780735684188.
  8. "Console Reference". Microsoft. 2009. Retrieved 2010-01-01.
  9. "Release Notes". docs.microsoft.com. Console: Fix for no output text being displayed in codepage 65001 (utf8)