Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Redneckerz

Universal Doom: A single .exe binary which runs DOOM on DOS 6, Windows 95 and Windows 10

Recommended Posts

I was surprised this has not had a thread yet given this went quite viral back in November. This was a challenge given by a Twitter user to craft a single Doom binary that runs on DOS 6 to Windows10.

 

PS: If this needs to be in source ports, let me know.

 

NneonNeo, the alias of Robert Xiao, rose to the challenge and succeeded. The twitter thread for that is found below:

 

 

Introduction:

Much less of a port and more of a clever combination, Universal Doom employs two seperate binaries and a custom script to merge and combine these into one executable that, depending on which OS you are working, automatically start the correct version of the binary.

 

The author provides an overview on how this was succeeded:
 

Quote

DOS and Windows .exe files both start with a common header (the DOS "MZ" header), which might suggest that you can run programs for one OS on the other one. However, this is complicated by a few facts: DOS support was dropped in Windows a long time ago (DOS binaries don't load on Windows 10, for example), and DOS programs use a completely different execution environment.

 

This repo builds a single .exe file with a "polyglot" MZ header which allows it to load one program (the original DOOM) when running inside DOS, and a different program (a custom static build of Chocolate DOOM) when running on Windows.

 

The DOS binary

The DOS binary, DOOMD.EXE, is exactly the original DOOM for DOS, derived from the shareware version that was widely distributed. DOOMDUPX.EXE is the same binary, but packed with UPX to make it smaller.

 

The Windows binary

The Windows binary, DOOMW.EXE, is a custom  build of Chocolate DOOM, a source port of DOOM which hews very closely to the original. Chocolate DOOM is based on libSDL 1.2; this custom build integrates it statically rather than linking to libSDL dynamically. This binary is stripped. DOOMWUPX.EXE is the same binary, but packed with UPX to make it smaller.

 

The merged binary

smash.py merges the two binaries together to produce the merged binary DOOM.EXE. What it basically does is extend the size of the DOS header to make room for a PE header, appends the entire Windows binary to the DOS binary, then inserts the PE header into the slack space and rewrites the section offsets appropriately. On DOS, the next_offset in the header is ignored: DOS/4GW uses the executable size in the second and third WORDs of the DOS header to find the next binary to load. On Windows, the entire DOS header is ignored except for the next_offset, which points to the PE header and thus loads the Windows binary.

 

DOOMUPX.EXE, similarly, is generated by merging together the two UPX'd binaries DOOMDUPX.EXE and DOOMWUPX.EXE. It's quite a bit smaller, but on the use of UPX (plus the unusual file structure) seems to cause a lot of virus scanners to flag it as suspicious. It's the original version that was posted to Twitter.

 

Links:

Share this post


Link to post
3 hours ago, DoomGater said:

Doesn't this belong in Source Ports ?

PS: If this needs to be in source ports, let me know.

 

I originally wrote this for that section, but it then went over my head that this isn't really a source port perse - It uses one, mind you, but its rather a project to combine two binaries into one - Which is more a Doom General thing then a source port thing, i think.

Share this post


Link to post

so, its the original exe but on modern PC?

thats pretty cool!

Way easy than handling with the DosBox.

 

Have you tried the ACE with this?

 

EDIT: Also Where is my download?

i wanna try it right now!
Now we need a BULD for modern OS for the complete experience :P

Share this post


Link to post

I may be wrong but I'm pretty sure mashing two executables into one wasn't the intention of the challenge.

Share this post


Link to post
3 hours ago, P41R47 said:

so, its the original exe but on modern PC?

thats pretty cool!

Way easy than handling with the DosBox.

Its both. The combined executable will use the correct binary depending on OS.

3 hours ago, P41R47 said:

 

Have you tried the ACE with this?

 

EDIT: Also Where is my download?

i wanna try it right now!
Now we need a BULD for modern OS for the complete experience :P

Havent tried ACE yet. There used to be a Download, but the Dropbox link got too popular. In response, Jiroh made a Github with the source.

3 hours ago, P41R47 said:

 

34 minutes ago, Bucket said:

I may be wrong but I'm pretty sure mashing two executables into one wasn't the intention of the challenge.

Open-challenge:

make a standalone Doom executable, both DOS (MZ) and Windows (PE).

Something that will run on all platforms from Dos 6 to Windows 10.

Feel free to include other formats ;)

 

The combined executable meets the rules of the challenge. He also congratulated Jiroh upon seeing Universal Doom.

Share this post


Link to post
1 hour ago, Redneckerz said:

In response, Jiroh made a Github with the source.

code ignorant, me.

hard.

chocolate Doom.

I stay...

Share this post


Link to post

From what I'm reading, it sounds to me like it's loading a completely different executable if you run on a modern OS, and as such ACE shouldn't run on it? Besides, doesn't ACE exploit things in DOS that basic OS security would block?

Share this post


Link to post
10 hours ago, M_W said:

From what I'm reading, it sounds to me like it's loading a completely different executable if you run on a modern OS, and as such ACE shouldn't run on it?

Yes. On Windows, it loads a Chocolate Doom executable. On DOS, it loads the shareware executable of Doom.

 

10 hours ago, M_W said:

Besides, doesn't ACE exploit things in DOS that basic OS security would block?

If you run this in DOS, then ACE likely would work on it. But not on Windows.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×