Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

new HACKWRAP fix for MS-DOS7+, aka smashing the bug (Miscellaneous)

posted by Ninho(R) E-mail, 11.12.2009, 00:17

Been busy trying my newborn idea for a definitively better HACKWRAP, and Guys! is it cool !!!

You'll be delighted to learn that it doesn't cost ONE byte !

The way this apparently impossible yet simple prodigy is going to work without disturbing Win-DOS's fragile equilibrium is simple yet elegant (small+simple==beautiful, almost always)

- There is a byte in MS-DOS 7+ data segment, call it Win386Flags, of which MS uses three bits as 3 flags related to DOS/Win interaction. The other bits are unused and we can be pretty sure they'll stay available in eternity :)

- The byte is checked at many places in the Kernel and modified in several more, but they did it properly whether by chance or thru art, using TEST/AND/OR instructions that never touch unassigned bits. So, then :

- I pick an unused bit in the SAME byte for a new flag which HACKWRAP, or dare I say FIXDOS ;=) will set during of Config.sys. An other instance of HACKWRAP, or a companion program will later unset the flag, restoring the usual DOS working (an oxymoron?)

- We need be concerned by just 1 TEST instruction in the DOS Kernel ! When doing an int 21/AH=31 "go TSR", it checks Win386.bit_zero and, if that bit of theirs is 1, meaning Windows is running in "386 enhanced" mode, then they correctly SKIP over the TSR bookkeeping.

So, what FIXDOS/HACKWRAP does is we'll FLIP one bit in that instruction, in memory, that will change it to TESTing for both OUR new bit and THEIRS and the following JNZ will take the proper action in all cases, skipping over the bookkeeping whenever it is unwanted !

- Of course I've checked all the other uses of the byte I'm going to "hijack", this should not harm anything else and all should work smoothly afterwards. The method doesn't even require us to flip back the instruction bit when we're done loading TSRs from Config.sys, although we might do it for a supplement of tranquility...
I'm not going to make the speech longer, for fear it would be longer than the actual program...

I did first tests "by hand" today (in Bochs), now back to proper programming and we'll have something neat to test together.

But I didn't want to delay a short description of what we're going to do, and I'm confident it'll work out neatly. Comments very welcome of course !



Complete thread:

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