Index

HX DOS Extender

A. About HX DOS-Extender

HX DOS-Extender is a free DOS extender with built-in Win32 PE file format support. Usually the purpose of a DOS extender is to make protected-mode features available for DOS applications. HX fully supports this goal, but goes some steps further. A Win32 API emulation layer is part of HX which allows many Win32 console applications to run in DOS. This emulation goes far beyond similiar approaches in other extenders (Borland's PowerPack, WDOSX or Phar Lab TNT). Furthermore HX implements - limited - support for windows, DirectDraw, GDI and even OpenGL graphics. This allows to run "simple" Win32 GUI apps in DOS as well.
 
Many development environments which support creating Win32 console applications are compatible with HX, among them are: Since HX's built-in Win32 emulation is pretty mature, most of these compilers/assemblers will run with HX in plain DOS as well.
 
Other tools suitable to create HX PE binaries are: HX consists of

 

B. HX Runtime

The extender runtime includes all files needed to execute 32bit DOS extended apps. These are: If you just want to run some Win32 console applications in DOS you don't need to care much about these binaries, because most of them are loaded automatically just when they are needed. The one thing one has to do to activate HX's Win32 support in pure DOS is to run HXLdr32, which is a tiny DOS TSR.

About HDPMI

HDPMI is a free DPMI server. Its features are: See HDPMI's Readme for more details.
 

About DPMILD32

DPMILD32 is a PE file loader required to load binaries into memory. It is not restricted to HX extended applications, but may also be used to load standard Win32 console apps as DPMI clients, provided that all Win32 functions called by the application are included in the emulation layer.
 
View dpmild32.txt for more details.
 

Win32 API Emulation

The Win32 API Emulation included in the HX runtime package consists of: DPMILD32 will provide for the translation of the module names, so if a PE executable has references to KERNEL32.DLL, DPMILD32 will try to resolve these imports by loading DKRNL32.DLL, for example. This means that any development tool being able to create Win32 console applications will most likely be compatible with HX DOS extender. While running under a Win32 OS like win9x or winxp, such console apps are executed as true Win32 apps and neither DPMILD32 nor the Win32 API emulation dlls are loaded. These will only be needed in Non-Win32 environments (that is, plain DOS, DOSEmu, Windows 3.1 or OS/2 Dos boxes) and there exist 2 ways to activate the Win32 emulation:
 
As already mentioned HX supports simple graphics (GUI) applications. These may use Win32 GDI or DirectDraw for their output, both is possible with HX. As with Win32 console applications the GUI apps will run as Win32 processes in Win32 environments, only in DOS they will run as DPMI clients and the GDI/DirectDraw emulation dlls will be used. The emulation requires a VESA 2.0 BIOS to work. Because in DOS there is no acceleration available the emulation may be a bit slow. Some applications may run sufficiently fast, however, and it may be a way to overcome the non-existent support of VESA LFB in Windows NT/2K/XP.
 
View compat.txt for a list of Win32 console apps successfully tested to run with the Win32 emulation.
 

C. HX GUI Extension

Running GUI Applications

With the HXGUI extension it is possible to run simple GUI applications with HX in DOS. "Simple" in this context means applications which use just one window as user interface. Such apps usually are based on SDL, DirectDraw and/or OpenGl. To use HXGUI a VESA V2.0 BIOS with support for linear frame buffer access (LFB) is required.
 
The Win32 API Emulation is enhanced by HX GUI and consists of: Some more dlls are included just as dummies:

Running OpenGL Applications

With the help of the Windows 9x binaries OPENGL32.DLL and GLU32.DLL is is possible to run OpenGL applications on DOS with HXGUI. However, this OpenGL implementation is pure software without hardware acceleration, so don't expect it to be too fast.
 

Screenshot from an OpenGL Win32 sample written by Frank Charlet, running in DOS, 256 colors.
 
If you don't own a copy of Windows 9x: there should be a redistributable version of OpenGL for Windows 95 available. Search for OPENGL95.EXE in the Web. Or download the plain binaries from either the MS FTP Server or here.
 

About SDL

SDL (Simple Directmedia Layer) is an Open Source effort to provide a multi-platform API for games, emulators, .... There are ports for various platforms available. As far as HXGUI is concerned, support for video, (wave) audio, keyboard, mouse, timer and threads is implemented. Please be aware that there is no special version of SDL for HX (or DOS) available. It is the Win32 port of SDL which can be used with HX. The SDL site is at https://www.libsdl.org/index.php, where the source code of all ports can be found.
 

Running QEMU with HX

QEMU is a PC emulator application available for many platforms. The Win32 ports of QEMU 0.7, 0.8 and 0.9, which are based on SDL, were successfully tested to run with HXGUI. The main advantage of QEMU running in DOS with HX is that one can try all kinds of operating systems without the need to install them on the physical HD. Here FreeDOS is booting inside a MS-DOS session:
 

 
Some notes about running QEMU under HX

Running DOSBox with HX

Another interesting SDL application is DOSBox. Running DOSBox in DOS with HX is not that senseless as it might seem at first glance. There are many old DOS games which will not run on modern machines, or they will run too fast. There are also some old games known to have caused lots of trouble even on older machines, which now run flawless in DOSBox. This is one of those:
 

 

D. HX 32-Bit Developer Support

The HXDEV developer support package contains all files required to create 32bit extended DOS apps. Two file formats are supported by the extender:

32bit DOS Applications in Win32-PE Format

This is the standard format for HX DOS extender. Since such binaries are in fact true Win32 applications, all the work to create these apps will be done by your standard development tool. For HX there isn't much left to do. So the only things included are The C runtime libraries are intended to be used by ASM programs, but of course may be used by C/C++ apps as well if no other C runtime is available.
 

32bit DOS Applications in DOS-PE Format

With tool PatchPE one can change a Win32-PE file to a DOS-PE file. This may be necessary if the application uses features usually not available for Win32 applications, i.e. it calls DOS INT 21h or it directly accesses I/O ports. The tool will change just one byte, which ensures that the binary is not loaded in the Win32 subsystem when launched inside Windows.
 

32bit DOS Apps in MZ Format

This format is also supported by HX and consists of Win32 emulation is provided for this format as well, but of course exists on the source code level only. For this OMF libraries (DKRNL32S.LIB, DUSER32S.LIB and DADVAPIS.LIB) are included. The MZ format compared to the PE format has some limitations, though. Advantages/disadvantages are:

E. HX 16-Bit Developer Support

Although most of HX is 32-bit, it still supports 16-bit protected-mode applications. The support consists of

F. HX Source Code

The HXSRC package contains the HX DOS extender source code. This consists of: HX's source code is about 100.000 lines of code.
 

G. Debugging HX DOS Extended Applications

1. Debugging 32-bit DPMI Applications

2. Debugging 16-bit DPMI Applications


H. Running HX under Linux/Unix

Running HX with Emulators

Virtual PC emulators (VMWare, Qemu, Bochs, ...) should have no problem running HX. HX's DPMI server HDPMI, which must run in ring 0, has been verified to be compatible with current versions of VMWare, Qemu and Bochs. Since the 80386's hardware debugging registers usually are not supported by the emulators, debuggers that would like to use them may not always work as expected. This is true for DEB32F, DEB16F and DEB16FW.

Running HX with DosEmu (x86 Linux only)

DosEmu doesn't allow a ring 0 application like HDPMI to run under its control. That's not that bad, because DosEmu installs its own DPMI host, and most of the features required by HX are implemented. If you're running a DosEmu version < 1.3.1, you will have to upgrade (the current release version is 1.4.0).
For developers it might also be interesting that DosEmu supports using the 80386 hardware debug registers.
 
Some issues concerning Dosemu are
 

I. Roadmap

Below are the features which are currently missing in HX. Feel free to contact me if you think there is something missing or if you want to contribute to HX in any way.
 

K. Support

The DosX Forum is intended as a place to ask questions concerning HX.
 

L. Download

Runtime GUI extension Develop. 32-bit Develop. 16-bit Source
v2.16, stable 11/16/2009 HXRT HXGUI HXDEV HXD16 HXSRC
v2.17, release candidate 05/01/2014 HXRT
Password: japheth
HXGUI HXDEV HXD16 HXSRC

Important Note: HXRT217.zip has to be made password-protected, because some anti-virus programs don't like file DKRNL32.DLL (a Win32 emulation dll), which is contained in the package.

List of all versions available for download
 
EXTRSECT v1.3 binary (Win32)

See also: JWasm, JWlink.