Virtual DOS machine
The English used in this article or section may not be easy for everybody to understand. (July 2017)
A Virtual DOS machine (VDM) permits the users of computers to run 16-bit or 32-bit DOS and 16-bit Windows programs on 32-bit computers when there already is a different operating system using the hardware.
Overview[change | change source]
Virtual DOS machines normally use the virtual 8086 mode of the Intel 80386 (or later) processor, allowing many 8086 applications to function by translating operating system commands to make applications think that they are running on an 8086. The operating system can then emulate the DOS software.
If a DOS program in a VDM needs to use a peripheral, Windows will give the DOS program a virtual device driver (VDD) which emulates the hardware using commands that the operating system it is running on can understand.
DOS VDMs[change | change source]
Similar to Windows 3.x, VDMs can let you run many DOS applications at one time if you use the EMM386 /MULTI option. Digital Research / Novell was working on a similar system since 1991 under the codename "Vladivar" (originally a device driver KRNL386.SYS and not part of EMM386). It was made for the next version of DR DOS, released as Novell DOS 7 in 1994, but it was also used in their "Star Trek" project, which they stopped working on before finishing.
OS/2 MVDM[change | change source]
VDMs called MVDM (Multiple Virtual DOS Machine) are used in OS/2 2.0 and later. OS/2 MVDMs are better than NTVDM in many ways, for example with block devices. While the OS/2 1.x emulated DOS 3.0, 2.x emulated DOS 5.0.
Running Windows 3.1 applications in OS/2 looks similar to XP Mode in Windows 7, but the technologies used are very different. A "guest" VDM permits programs to use the disks of the OS/2 or NT operating system that is running the VDM. Applications in a VDM can use named pipes to talk to their "host".[source?]
Windows NTVDM[change | change source]
NTVDM is included in all x86 versions of Windows made on NT, and let 16-bit Windows and 16-/32-bit DOS applications run. It is not included with 64-bit versions (see Limitations). ntvdm.exe helps emulate the APIs needed to run 16-bit DOS and Windows applications.
NTVDM uses NTIO.SYS and NTDOS.SYS, which runs a changed version of COMMAND.COM. The 16-bit system files are smaller versions of their MS-DOS 5.0 counterparts, including IO.SYS, MSDOS.SYS and COMMAND.COM, which remove biases with the FAT file system and can also call the 32-bit NTVDM if needed. NTDOS originally gave a DOS version of 30.00 to programs, but this soon was changed to 5.00 to let more programs to run without being changed However, there are many newer MS-DOS functions and commands added to MS-DOS versions 6.x and in Windows 9x which are not there.
16-bit programs run separately within one 32-bit NTVDM process. Checking "Run in separate memory space" in the Run dialog box or shortcut of the program creates a new process instead. NTVDM emulates BIOS functions, the Windows 3.1 kernel, and its 16-bit API.
32-bit DOS emulation is used for DPMI and using 32-bit memory. wowexec.exe is the emulator process for 16-bit Windows. Windows 2000 added Sound Blaster 2.0 emulation to 32-bit NTVDM. 16-bit and DOS virtual device drivers can't be run. Win16 programs can communicate with other parts of Windows using OLE, DDE and named pipes.
Security issues[change | change source]
In January 2010, Google security researcher Tavis Ormandy discovered a large security problem in NTVDM system letting non-Administrators to increase their permissions to the SYSTEM level. Ormandy claimed it was a problem for all x86 versions of Windows NT after 1993. 32-bit versions of NT 3.X/4.0, 2000, XP, 2003, Vista, 2008, and 7 were affected. Ormandy published how the problem works. Before Microsoft could fix it, you could turn off 16-bit application support to solve the problem, but it made so you couldn't run 16-bit programs. x64 Windows never had this problem because it doesn't use NTVDM. After applying the security fixes Microsoft made available, NTVDM could be turned on safely.[nb 1]
Limitations[change | change source]
NTVDM and wowexec had limitations on Windows XP and later because of a GDI object limit per session, which might cause GDI handles to be moved two bits to the right when changing 32 to 16 bits. Handles thus couldn't be larger than 14 bits, so 16-bit programs with a GDI handle larger than 16384 would crash.
On x86-64 CPUs, virtual 8086 mode is only available as a legacy sub-mode (if running a 32-bit operating system), but not in 64-bit long mode, which is why NTVDM is not included with 64-bit versions of Windows, so 16-bit applications cannot be run on 64-bit Windows. You'll need Windows XP Mode or similar virtualization software to run 16-bit programs within a 64-bit operating system.
NTVDM cannot run DOS games on computers of today. Emulation is only provided for simple peripherals. For example, sound in NTVDM can be limited. Windows NT only updates the screen a few times per second when DOS programs write on it, and they can't emulate high-resolution graphics options. As software runs at the speed of the CPU, all timing loops stop too early. This either makes games run too fast, or causes the software to not see some emulated hardware peripherals, because it can not wait that long for an answer.
Related pages[change | change source]
Notes[change | change source]
- A disabled VDM could be reenabled by setting the corresponding registry key back to
References[change | change source]
- Schulman, Andrew; Brown, Ralf; Maxey, David; Michels, Raymond J.; Kyle, Jim (1994). Undocumented DOS - A programmer's guide to reserved MS-DOS functions and data structures - expanded to include MS-DOS 6, Novell DOS and Windows 3.1 (2 ed.). Addison Wesley. ISBN 0-201-63287-X. ISBN 978-0-201-63287-3.
- Paul, Matthias (1997-07-30). NWDOS-TIPs — Tips & Tricks rund um Novell DOS 7, mit Blick auf undokumentierte Details, Bugs und Workarounds. MPDOSTIP (e-book) (in German) (edition 3, release 157 ed.). Archived from the original on 2016-11-02. Retrieved 2014-09-06. NWDOSTIP.TXT is a comprehensive work on Novell DOS 7 and OpenDOS 7.01, including the description of many undocumented features and internals. It is part of the author's yet larger MPDOSTIP.ZIP collection maintained up to 2001 and distributed on many sites at the time. The provided link points to a HTML-converted older version of the NWDOSTIP.TXT file.
- OpenDOS Developer's Reference Series — OpenDOS Multitasking API Guide — Programmer's Guide. UK: Caldera, Inc. August 1997. Caldera Part No. 200-DOMG-004. Retrieved 2016-11-02.
- DR-DOS 7.02 User Guide. Caldera, Inc. 1998. Retrieved 2014-09-06.
- "OS/2 Workplace Shell Configuration Techniques" (PDF). IBM redbook. 1994. pp. 68–80. Retrieved 2011-07-05.
- Chapter 27 - Windows Compatibility and Migration: Windows NT 4.0 Resource Kit
- How do I troubleshoot MS-DOS programs running on Windows XP?
- INFO: How Windows handles floating-point calculations
- "Microsoft Security Bulletin MS10-015 - Important: Vulnerabilities in Windows Kernel Could Allow Elevation of Privilege (977165)". Security TechCenter. Microsoft. 2010-03-17. Retrieved 2012-11-02.
- Ormandy, Tavis (2010-01-19). "Microsoft Windows NT #GP Trap Handler Allows Users to Switch Kernel Stack". CVE-2010-0232. Full-disclosure. Retrieved 2013-04-13.
- Farrell, Nick (2010-01-20). "Ancient Windows flaw found after 17 years". The Inquirer. Incisive. Retrieved 2010-01-21.
- "Microsoft Security Advisory (979682): Vulnerability in Windows Kernel Could Allow Elevation of Privilege". TechNet. Microsoft. 2010-01-20. Retrieved 2010-01-21.
- The "Win 16 Subsystem has insufficient resources to continue running" problem on Windows XP
- Intel 64 and IA-32 Architectures Software Developer's Manual Combined Volumes: 1, 2A, 2B, 2C, 3A, 3B, and 3C (PDF) (PDF). Intel. June 2013 . 325462-047US. Retrieved 2013-07-02.