= Dual Bound Executable

$Header: /home/cvs/src/dox/technote/DualBound-Executable.txt,v 1.16 2019/01/19 15:10:03 ralph Exp $

NOTE: This documentation is written in ASCIIDOC!

----------------------------------------------------------------------------
                   ___            _   ___                   _
                  |   \ _  _ __ _| | | _ ) ___ _  _ _ _  __| |
                  | |) | || / _` | | | _ \/ _ \ || | ' \/ _` |
                  |___/ \_,_\__,_|_| |___/\___/\_,_|_||_\__,_|

                     ___                 _        _    _
                    | __|_ _____ __ _  _| |_ __ _| |__| |___
                    | _|\ \ / -_) _| || |  _/ _` | '_ \ / -_|
                    |___/_\_\___\__|\_,_|\__\__,_|_.__/_\___/


                        DUAL BOUND EXECUTABLE BY ROSE SWE
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----------------------------------------------------------------------------

== Dual Bound Executable
=== Overview

Dual bound executable are special crafted executable programs for the DOS and
Windows operating systems.

This program was compiled as a dual bound executable for DOS 16 and Windows 32
bit. The program checks if it runs under Win32 (Win9x, NT, ME, 2000, XP, 7-10)
or DOS/Win3.x and executes the applicable part. The program will not work under
WinNT 3.5x and Win 3.11/Win32, but these operation systems (OS) are meanwhile
extinct. You must use under this extinct operation systems the DOS16 part!

If you shutdown Windows 95/98 or ME in MS-DOS mode then the DOS16 part is
executed. In this case a Win32 program won't run, but a dual bound executable!
:-)

=== About the PE format

Microsoft migrated to the PE format with the introduction of the Windows NT 3.1
operating system. All later versions of Windows, including Windows 95/98/ME,
support the file structure. The format has retained limited legacy support to
bridge the gap between DOS-based and NT systems. For example, PE/COFF headers
still include an MS-DOS executable program, which is by default a stub that
displays the simple message "This program cannot be run in DOS mode" (or
similar). PE also continues to serve the changing Windows platform. Some
extensions include the .NET PE format, a 64-bit version called PE32+
(sometimes PE+), and a specification for Windows CE.

The windows executable format (PE format) contains two entry points, one
pointing to the actual window program (Win32) and one pointing to a DOS program.
In most cases the DOS entry point refers to a short procedure (stub) that
outputs a short message like "This program must be run under Win32" or "Win32
req." and exits.  A dual bound executable doesn't contain a stub, instead the
DOS 16 bit program version.

Please note that the term "Dual Bound Executable" comes from dual linked files
for DOS and OS/2 and is misused by me to describe this unique behavior!

If you want to execute the DOS part under Windows I suggest to download the
EXEC.COM utility from Martin Korth.

[NOTE]
http://www.work.de/nocash/[Old Homepage, not reachable anymore] and
https://web.archive.org/web/20070615192100/http://www.work.de:80/nocash/exec.zip[Direct Download via Wayback Machine]

== Requirements

Depending on the used executable you must satisfy the following minimum
requirements (no real requirement to today's equipment :)

* DOS16           - MS-DOS 5.0 or better (or compatible DOS version), 550 KB
                  free memory, 80286+Coprozessor or better
* DOS32/DPMI      - MS-DOS 5.0, 80386 or better, Coprozessor (387 or better),
                  4 MB memory
* Win32           - Win32 (Win9x, NT, XP,2000), Pentium-II+MMX or better,
                  16 MB memory
* Linux           - i586 architecture or better, 16 MB memory,
                  Kernel 2.4.xx or higher

All 32 bit programs are optimized for Pentium MMX and better CPUs. They still
may run on 80486 and 80386 CPU.

All "Dual Bound Executable" are normally portable to other platforms. I you
have the need you can request native executable for this platforms:

- DOS16
- DOS32 (DPMI via extender)
- Win32
- Linux (i586, x64, arm32)


== PE Description

The Portable Executable (PE) format is a file format for executable, object
code, and DLLs, used in 32-bit and 64-bit versions of Windows operating
systems. The term "portable" refers to the format's portability across all
32-bit (and by extension 64-bit) Windows operating systems. The PE format is
basically a data structure that encapsulates the information necessary for the
Windows OS loader to manage the wrapped executable code. This includes dynamic
library references for linking, API export and import tables, resource
management data and thread- local storage (TLS) data. On NT operating systems,
the PE format is used for EXE, DLL, OBJ, SYS (device driver), and other file
types.

The PE format is a modified version of the Unix COFF file format. PE/COFF is an
alternative term in Windows development. On Windows NT operating systems, PE
currently supports the IA-32, IA-64, and AMD64/EM64T (or "x86-64") instruction
set architectures. Before Windows 2000, Windows NT, and thus PE, the MIPS, DEC
Alpha, and PowerPC instruction set architectures was supported. Because PE is
used on Windows CE, it continues to support several variants of the MIPS
architecture, and also supports the ARM (including Thumb) and SuperH
instruction set architectures.

== The Author

****

Regards, +
   Ralph Roth, ROSE SWE


http://rose.rult.at +
http://www.cfg2html.com

****

// atom:set fileencoding=utf8 fileformat=dos filetype=asciidoc tabstop=2 expandtab:
