About the Windows interface with Dos

Note: Windows is a trademark of Microsoft Corporation.
Most of this information has NOT been tested by the author.

Please see disclaimer on main page.


What is Windows?

There are two 'flavours' of Windows: One is called 'NT', for 'New Technology', and the other generally goes under the name of 'Windows x.xx' (where x.xx is a version number, the most recent being 3.11; versions below 3.0 barely exist; 3.0 itself is rare; 3.1 was the next version after 3.0) or 'Windows 9x' (where x, together with the 9, give the year in the 20th century in which the version was released. The first released was 95, which supersedes Windows 3.11, but Microsoft have announced plans to release Windows 98, which will be the next version).

Windows NT is an operating system in its own right. Windows x.xx runs 'on top of' MS-DOS (or compatible DOS). Windows 95 claims to be an operating system in its own right, as it comes with a version of DOS specifically tailored to support it (known as DOS 7.0). Essentially, however, Windows 9x operates in exactly the same way as Windows x.xx - it can be considered to be 'running on top of DOS'. For this reason, they will be referred to as 'WinDos' from here on. NT, on the other hand, while it does provide the ability to run DOS programs, does so in a limited environment; it will not be discussed here.

WinDos is a multi-tasking operating system. It is capable of running multiple programs at once. The term 'program' here refers to either a 'native Windows application' or a DOS application(s) running in a 'DOS box'. The DOS boxes are each run in their own 'virtual machine' (VM), so called because devices are virtualised to avoid clashes (the video display, for instance: only the active application will be able to modify the display. Other VMs may make writes to the screen, but Windows traps these, only allowing them to be performed when the VM becomes the active VM.

Windows works by putting the processor in protected mode. This enables it to assume more control than is possible in real mode and may also allow the use of Virtual '86 mode to run DOS-based tasks. In Windows x.xx, There are two 'modes' in which Windows can operate: 'Standard mode' (for 286s) and 'Enhanced Mode' (for 386s, enables 32-bit code and V86 mode). In standard mode, it is necessary for Windows to maintain a temporary disk file for each DOS-based task, and it is necessary for the processor to switch to real mode to allow running time for these tasks. Windows 9x operates only in enhanced mode.


What does Windows provide?

Multi-tasking abilities include: Of the three data sharing techniques, only the clipboard is accessible to DOS applications. Task switching is usually initiated by the user. Windows in enhanced mode will provide 16 and 32-bit DPMI services to DOS programs.

What Windows does...

While windows is running, it may create virtual machines. Each VM is based on the state of the DOS system before Windows is started. Most of the already allocated memory has global scope - that is, if it is altered from any VM, the changes will be reflected in all other VMs (including the real mode DOS - the effects will be visible here after Windows is exited). VDDs and TSRs which were able to hook the init broadcast may have or instantiate local data, and any new programs started within the VM will automatically have local data.


Detecting Windows

Any of the following methods may be used:


What not to do under Windows


Service calls available to DOS programs

Windows start broadcast: AX = 1605h, ES:BX = 0:0, DS:SI = 0:0, CX = 0, DX bit 0 = 0, DI = windows version (major in upper bytes, minor in lower byte, convert each to 2 digit decimal for correct display), INT 2Fh: Called by Windows (enhanced mode) on startup. Set CX to any other value (1 - FFFFh) to avoid having windows load (exit broadcast will be sent immediately). Be careful to allow multiple programs to hook the broadcast (a program should always 'pass through' the interrupt before processing itself). DS:SI remains somewhat of a mystery to me; unless you know what it does, don't change it. ES:BX can be set to point to a 'startup info structure', which allows a program to create areas of memory which will contain data local to the VMs.

Windows exit broadcast: AX = 1606h, DX bit 0 = 0, Int 2Fh: Called by enhanced mode windows (in real mode) as it shuts down.

WINOLDAP services

This module (which is definitely supported by Windows 3.0+) allows access to the windows clipboard. The clipboard is a data area accessible by all tasks. It can simultaneously hold several different formats of information. These are:

Detecting WINOLDAP clipboard functions: AX = 1700h, INT 2Fh. If AX = 1700h on return, functions are not supported, otherwise AL contains the major and AH the minor version.

Putting data in the clipboard:

Retrieving data from the clipboard:

Functions are as follows:

Bitmap format:

 (offset hex)        (desc)
 00  WORD       'type' (must = 0)      
 02  WORD       width in pixels
 04  WORD       height in pixels
 06  WORD       bytes per line
 08  BYTE       number of colour planes
 09  BYTE       'number of adjacent colour bits in pixel' (bits per pixel per plane)
 0A  DWORD      pointer to start of bitmap data
 0E  WORD       desired width in 0.1mm units (currently ignored)
 10  WORD       desired height in 0.1mm units (currently ignored)