请输入您要查询的百科知识:

 

词条 Win32 console
释义

  1. Window and full screen modes

  2. Details

  3. Implementations

     Windows 9x  Windows NT and Windows CE 

  4. See also

  5. Notes

  6. External links

{{One source|date=June 2008}}

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.

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.

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.

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]

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.

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.

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{{cn|date=September 2014}}).

See also

  • Command line interface
  • Shell (computing)
  • System console
  • Linux console
  • Text-based (computing)

Notes

1. ^{{cite|url=http://msdn.microsoft.com/en-us/library/windows/hardware/ff570169(v=vs.85).aspx|accessdate=2012-11-14|title=VGA-Compatible Video Miniport Drivers|date=2012-10-16}}
2. ^{{cite|chapter=VGA Fundamentals, Part II: DOS Graphics|title=The PC Graphics Handbook (for C++ Programmers)|author=Julio Sanchez|author2=Maria P. Canton|year=2003|type=Book|page=125|isbn=0849316782|publisher=CRC Press}}
3. ^{{cite web|title=Some 16-bit DOS-based Programs and the Command Prompt will not run in full-screen mode in Windows Vista and in Windows 7|url=http://support.microsoft.com/kb/926657|date=2011-09-23|work=Support |publisher=Microsoft}}
4. ^{{cite web|title=Roadmap for Developing Drivers for the Windows 2000 Display Driver Model (XDDM)|url=http://msdn.microsoft.com/en-us/library/windows/hardware/ff569512.aspx|work=Windows Dev Center - Hardware|publisher=Microsoft|accessdate=16 December 2013|date=16 November 2013|quote=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. ^{{cite book |last1=Yosifovich |first1=Pavel |last2=Ionescu |first2=Alex |last3=Russinovich |first3=Mark E. |last4=Solomon |first4=David A. |date=2017-05-15 |title=Windows Internals, Part 1: System architecture, processes, threads, memory management, and more (7th Edition) |url=https://blogs.msdn.microsoft.com/microsoft_press/2017/05/09/new-book-windows-internals-seventh-edition-part-1/ |location=Redmond, Washington |publisher=Microsoft Press |page=67 |isbn=9780735684188 }}
8. ^{{cite web |url=http://msdn.microsoft.com/en-us/library/ms682087(VS.85).aspx |title=Console Reference |publisher=Microsoft |year=2009 |accessdate=2010-01-01}}
9. ^{{cite web|title=Release Notes|url=https://docs.microsoft.com/en-us/windows/wsl/release-notes|website=docs.microsoft.com|language=en-us|quote=Console: Fix for no output text being displayed in codepage 65001 (utf8)}}

External links

  • MSDN console API reference
  • [https://blogs.msdn.microsoft.com/commandline/2018/06/20/windows-command-line-backgrounder/ MS blog about the evolution, current state and future of the console]
{{Microsoft APIs}}{{Windows Components}}{{DEFAULTSORT:Win32 Console}}

2 : Windows administration|Text user interface

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/10 12:19:49