Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

clean dos extender executable format (Developers)

posted by tkchia Homepage, 08.01.2023, 18:10

Hello kerravon,

> And it would be good if the stub cleanly reported
> an issue if it wasn't able to find the external
> loader or some other issue. My a.out executables
> don't do that. They get treated as .com files and
> hang or whatever. So this would be a step up from
> what I am currently doing.

Well, yes — Windows and OS/2 NE, LE, LX, PE, etc. files follow a rather basic sort of "fat binary" format:

(1) There is a classical MS-DOS MZ program stub tacked on at the front;

(2) and the MZ header has an extra offset field which points to the "actual" NE or PE (etc.) payload that Windows or OS/2 (etc.) can immediately run. (This field is usually named e_lfanew.)

The general scheme is kind of described in one of Microsoft's old (~ 1999) Developer's Notes: https://jeffpar.github.io/kbarchive/kb/065/Q65122/ .

You can probably apply the same scheme, or a similar one, to whatever protected mode (?) executable format you wish to stubify. Tack a classical MS-DOS program in front of it, and add an offset pointer to point to the a.out payload, and call it a day.

Thank you!

---
https://gitlab.com/tkchia · https://codeberg.org/tkchia · 😴 "MOV AX,0D500H+CMOS_REG_D+NMI"

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 84 users online (0 registered, 84 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum