iMic Posted June 17, 2023 Posted June 17, 2023 (edited) I recently had some free time on my hands, and started working on putting Real Mode DOS support back into Windows Millennium. Not only the common patches available around the internet, but all of it - Restart to MS-DOS mode enabled, AUTOEXEC and CONFIG processed on boot, advanced PIF options in DOS application properties panels, and applications can be instructed to reboot into DOS and back into Windows when they’ve completed. It accomplishes this by redirecting the rewrites of AUTOEXEC and CONFIG in REGENV32.EXE, using a specialised IO.SYS and COMMAND.COM from the Windows Millennium CD NETTOOLS (CBS.DTA and LTOOLS.DTA), and using the MS-DOS application layer (WINOA386.MOD and PIFMGR.DLL) and command line utilities (SYS.COM) from Millennium Developer Release 1. The current testing version also includes WIN.COM from Windows 98 Second Edition as this allows the user to type "exit" from DOS and restart back into Windows, however the aim would be to eventually re-integrate this functionality back into Windows Me's WIN.COM instead. "Restart in MS-DOS mode" is restored by removing the "NoRealMode" value from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WinOldApp in the Windows registry. So, what currently works? "Restart in MS-DOS mode" from the shutdown dialog restarts to a command prompt - with a caveat. (See Issue 1 below.) Typing EXIT or WIN from MS-DOS mode restarts the computer back into Windows. DOS applications can be configured to restart in MS-DOS mode from the Properties window, and custom AUTOEXEC.BAT and CONFIG.SYS entries can be specified per application. The IO.SYS included with NETTOOLS automatically loads IFSHLP.SYS, and automatically calls WIN on startup, so these lines are not required in AUTOEXEC and CONFIG. The Windows Me boot logo is preserved. Windows XMS driver, integrated into IO.SYS, loads and mostly replaces the functionality of HIMEM.SYS. EMM386 loads and works, both in DOS mode and within Windows, although it currently requires the IO8EMMOK driver (https://github.com/pufengdu/IO8EMMOK) to be loaded first in CONFIG.SYS to make the built-in XMS driver behave more like a standard HIMEM. AUTOEXEC.BAT and CONFIG.SYS are processed and loaded at startup. Holding CTRL on startup brings up the Windows Millennium Startup menu, and it now includes "Command Prompt Only" in addition to the normal startup options. Creating a MS-DOS boot disk by using the SYS command line utility has been re-enabled. When editing PIF properties, "DEVICE=C:\Windows\Himem.Sys" is no longer autofilled in CONFIG.SYS as this is not required on MS-DOS 8 / Windows Millennium. The modifications can be installed via a Setup INF, without the need to disable System Restore or System File Protection. There are still some issues to work on however - Selecting "Use current MS-DOS configuration" in an application's MS-DOS mode properties / PIF and using it to restart into MS-DOS mode just shuts down the computer. Selecting "Specify a new MS-DOS configuration" and entering a custom AUTOEXEC and CONFIG works fine. This includes the "Exit to DOS" PIF used when selecting "Restart in MS-DOS mode" from the Start > Shut Down menu, which just shuts down the system if the Exit to DOS PIF doesn't have a custom AUTOEXEC and CONFIG specified. Because resuming from Hibernation is handled partly in IO.SYS, the alterations to this file mean that Hibernation still needs to be tested. Likewise, System Restore needs to be tested to ensure it can still create and restore system snapshots correctly. Update KB311561 contains an updated IO.SYS with some bug fixes. The IO.SYS used to currently boot into DOS mode does not contain these fixes. The first issue above has been the sticking point for this project. When "Use current MS-DOS configuration" is selected, or "Restart in MS-DOS mode" is selected from the shutdown dialog without an "Exit to DOS.pif" specifying a new MS-DOS configuration present in the WINDOWS folder, the computer just shuts down instead of restarting into DOS mode. After experimenting side-by-side with Windows 98, I think I know what the problem is. When restarting into MS-DOS mode in Windows 98 using "Use current MS-DOS configuration", Windows shuts down and returns the computer to an MS-DOS command prompt without restarting the computer, using the already-loaded AUTOEXEC.BAT and CONFIG.SYS. However when "Specify a new MS-DOS configuration" is selected, because the AUTOEXEC and CONFIG files need to be replaced temporarily and DOS loaded from the ground up, Windows does restart the computer. Therein lies the problem - the functionality that allowed Windows 98 to end its session, unload and drop back to a DOS prompt without restarting the computer isn't present in Windows Millennium, so instead, the computer just shuts down when "Use current MS-DOS configuration" is selected. When a custom MS-DOS configuration is specified, it forces a warm restart instead, bypassing whatever function of the OS is broken, and it works - but because we had to specify a custom configuration in the PIF, the existing AUTOEXEC.BAT and CONFIG.SYS in the root of the C drive is ignored. Dencorso over in this thread may have an explanation as to why this occurs - Quote If I remember my own code spelunking right (I did that way back when), the Start --> "Restart in MS-DOS Mode" option reappears if you manage to coerce Win ME to use the Win 98SE Shell32.DLL. However, even then, when you attempt to use it, it'll call Kernel32.dll, which will thunk it down to KRNL386.EXE, which will pass the command to VWin32.Vxd (see Matt Pietrek's great "Win 95 Sys Programming Secrets" for much more details about the interaction of Kernel32/KRNL386/VWin32), which will call VMM.VxD, which will fail the call, unless you use all these modules from Win 98SE, too. But, in case you manage to do that, you'll be using a less well-known variant version of Win 98SE with 98SE2ME, not Win ME anymore. In short: no, Win ME cannot do it because the code to do it is absent from its two key VxDs, period. So the problem is likely deep within the Windows Kernel itself. This is about as far as I can go, with my current knowledge, at least without some assistance to either point me in the right direction or to come up with a suitable workaround for this issue. As it stands, it means that *any* DOS application needs to have its own AUTOEXEC and CONFIG entries specified in the properties dialog - it can't inherit the existing entries from the AUTOEXEC.BAT and CONFIG.SYS already in the root of the C drive. Now this isn't inherently a bad thing - if an application does require DOS mode, then set it up in properties, include EMM386, MSCDEX, MOUSE, whatever it needs, and double click to restart the computer and run it. That part works fine. Likewise if you want to run something before Windows Me boots in AUTOEXEC and CONFIG, that's fine too. Or if you want to reboot to a command prompt by holding down CTRL and selecting Command Prompt Only, that also works. But you can't double-click a DOS application icon in Windows and have it use the existing AUTOEXEC and CONFIG. And at the moment, to make "Restart in MS-DOS mode" work, I'm bundling "Exit to DOS.pif" with the package and anyone that wants to have a custom AUTOEXEC or CONFIG in that MS-DOS mode session just needs to specify their contents in that PIF file instead. It works, but it's a "95% of the way there" solution when ideally, we want that last 5 percent. Edited June 17, 2023 by iMic 5
iMic Posted June 17, 2023 Author Posted June 17, 2023 If anyone wants to see what I currently have, I've made it available for download here. https://app.box.com/s/jfiy8p0m2p2vbvh4zzolznh3lp2yanfe Keep in mind it is for testing, is in no way complete, and should not be installed on critical use systems. Testing in a Virtual Machine is recommended.
iMic Posted June 18, 2023 Author Posted June 18, 2023 (edited) I'm currently experimenting with a workaround that permits restarting to MS-DOS mode using the existing AUTOEXEC.BAT and CONFIG.SYS configuration. When "Restart in MS-DOS mode" is selected, Windows checks for the presence of "Exit to DOS.pif" in C:\WINDOWS. This PIF can contain absolutely anything - you can instruct it to launch any DOS application, in MS-DOS mode or in an MS-DOS Prompt window, it doesn't matter. This could also be - for example - a script or application that does the necessary setup for restarting to a command prompt from within Windows, effectively bypassing Windows' own internal mechanisms. I've created a proof-of-concept "EXITDOS.BAT" that is called from "Exit to DOS.pif". This script performs the following operations - Checks for AUTOEXEC.BAT and CONFIG.SYS. If either file is not found, it creates new ones from the AUTOEXEC.WIN and CONFIG.WIN files generated by the patched REGENV32. Ensures those AUTOEXEC.BAT and CONFIG.SYS files are not hidden, and are writable (not read-only). Checks for AUTOEXEC.APP and CONFIG.APP, and removes them if present. These are generated when returning to Windows from an MS-DOS mode session, and should be automatically removed, but sometimes they can persist. If the .APP files from a previous MS-DOS mode session are not removed before restarting to a new MS-DOS mode session, it can prevent the computer from returning to Windows when EXIT or WIN /WX is typed, until those .APP files are removed. Copies the current contents of AUTOEXEC.BAT to AUTOEXEC.WOS. WIN.COM removes the AUTOEXEC.BAT containing our temporary entries and renames AUTOEXEC.WOS back to AUTOEXEC.BAT when the computer restarts from MS-DOS mode. Checks if COMMAND.COM is to be launched after restart, or if a different application path is specified as a parameter instead. Adds some temporary commands to the end of AUTOEXEC.BAT for the MS-DOS session. (See Below.) Issues a command to restart the computer. When the computer is in MS-DOS mode, typing EXIT or WIN /WX removes the temporary AUTOEXEC.BAT containing the temporary commands we added, and restores the temporary backup version created earlier (AUTOEXEC.WOS) to AUTOEXEC.BAT. This is a documented function of Windows, and actually how applications that restart into MS-DOS mode with "Specify a new MS-DOS configuration" selected are handled - we're just exploiting its abilities for our own purposes. If only WIN is typed, Windows Millennium will still start up, but will return to an MS-DOS mode when the computer is restarted again. Typing EXIT or WIN /WX is what instructs the computer to re-configure itself and return to a normal startup again. The temporary commands added to the end of AUTOEXEC.BAT are: ECHO Type EXIT to return to Windows. CALL %WINDIR%\COMMAND.COM %WINDIR%\WIN.COM /WX Calling COMMAND.COM is what drops the computer to a command prompt instead of immediately launching Windows. When EXIT is typed, the command interpreter closes, and the next line - WIN.COM /WX - is called, setting the computer up for a normal startup and rebooting the system again. What all this means is that "Restart in MS-DOS mode" works. It's not particularly elegant, but there are some ways it could be improved - The EXITDOS.BAT file could be rewritten as a dedicated .COM or .EXE executable with the same functionality instead, which would improve performance, and reliability if it isn't calling out to a bunch of extra DOS utilities like XCOPY and ATTRIB. "Exit to DOS.pif" could be skipped entirely if the filename were patched to "EXITDOS.COM" (or whatever it would be) in SHELL32.DLL, removing one extra file and bypassing the PIF manager. However this would prevent the user from specifying their own "Exit to DOS.pif" with different functionality if they wished. On the other hand, this method has an advantage - you can also restart into MS-DOS mode simply by typing "EXITDOS", or restarting into MS-DOS mode and launching a different application by typing "EXITDOS PATH\TO\EXAMPLE\PROGRAM.EXE", either from an MS-DOS Prompt, a Batch File, or the Start > Run dialog. This leaves one feature broken - right clicking a DOS application, selecting Properties > Program > Advanced > MS-DOS mode > "Use current MS-DOS configuration" to launch an application. Fixing this would involve finding out where this function is handled in the OS, and patching it to call out to EXITDOS instead. Of course patching it here would probably eliminate the need for "Exit to DOS.pif" in Start > Shutdown as well, as it's likely these are hooked to the same or similar functions. I think if this were achieved, most would consider this a satisfactory solution to handling MS-DOS mode in Windows Millennium, since it would contain all the functionality present in Windows 95/98, handled a little differently, but without the need for any compromise. Any improvements made thereafter would just be polishing it up. Edited June 18, 2023 by iMic
matti157 Posted June 27, 2023 Posted June 27, 2023 Very interesting, I've been wanting to install a pc with Windows ME for a while.
systremor Posted October 12, 2023 Posted October 12, 2023 (edited) I've tested this on my Win9x build, so far so good, everything works okay. I can test out hibernation functionality if you wish. Edited October 12, 2023 by systremor
Omores Posted November 16, 2023 Posted November 16, 2023 Nice work. I just installed Windows Millennium on an Intel 13gen CPU... and the MS-DOS mode patch is not optional in this situation. Now there is a tiny patch that clears some CPU control register flags or else you run into VCACHE Windows Protection Error on modern systems. (9th gen + ) Obviously, this patch needs autoexec.bat to be executed. Is there a way to patch the installation files to have MS-DOS mode active during the setup? Because without MS-DOS mode you cannot perform a fresh install. I used the files from another Windows ME installation to get it done. I made an Youtube video and I put the download link you listed above into description:
g00424223 Posted March 20 Posted March 20 I just create a Windows 98 boot disk with Windows Millenium and reboot when I want pure MS-DOS with real mode only for low level tests. I use RAWRITE under either 98 or Me to set the disk, or another USB stick, hard disk or computer to exchange between 98 and Me. MS-DOS 8 will probably always have something like V86 enabled. I just install Windows 98 and Millenium side by side with 2 BAT scripts to change between them, because there are some programs to plainly refuse to run under Windows Millenium when they detect that the Windows version number doesn't match Windows 98 or SE. Given that MS-DOS 8 is incapable of Real Mode, you could make a disk image with a Windows 98 boot disk, or a Windows 98 DOS bootable USB, CD-ROM, or use a second computer. Then you could install Windows 98 and Windows Millenium together, and two BAT scripts that run/enable either 98 or Me, and rename themselves to prevent renaming WINDOWS and Program Files for each OS, they could be WinME.bat or Win98.bat. If you boot to DOS with a Windows 98 boot disk and have Me and 98, you have the full and most modern 9x system, you can use Windows 98 to run programs that detect Me and refuse to run and to have full DOS.
user57 Posted March 20 Posted March 20 my "DOS" got a little old, but i remember that "going to DOS mode" from windows often resultet in a non "well-working" DOS i also remember you had to press the menu button ( i think it was F8 before windows starts) , and select the DOS boot (instead of windows) then you had a nativ DOS , where most DOS apps actually then function in the windows to dos not all DOS apps worked so this one fix this problem ?
iMic Posted March 20 Author Posted March 20 13 hours ago, g00424223 said: Given that MS-DOS 8 is incapable of Real Mode, you could make a disk image with a Windows 98 boot disk, or a Windows 98 DOS bootable USB, CD-ROM, or use a second computer. Then you could install Windows 98 and Windows Millenium together, and two BAT scripts that run/enable either 98 or Me, and rename themselves to prevent renaming WINDOWS and Program Files for each OS, they could be WinME.bat or Win98.bat. If you boot to DOS with a Windows 98 boot disk and have Me and 98, you have the full and most modern 9x system, you can use Windows 98 to run programs that detect Me and refuse to run and to have full DOS. It's a workaround, but it essentially equates to "run Windows 98 for Real Mode DOS applications". Works for some, but we want to run Windows Millennium throughout. 5 hours ago, user57 said: my "DOS" got a little old, but i remember that "going to DOS mode" from windows often resultet in a non "well-working" DOS i also remember you had to press the menu button ( i think it was F8 before windows starts) , and select the DOS boot (instead of windows) then you had a nativ DOS , where most DOS apps actually then function My recollection of how DOS mode under Windows worked is rusty, but from what I understand, "Restart in MS-DOS Mode" would exit Windows and return to DOS mode, but anything that was loaded in AUTOEXEC.BAT or CONFIG.SYS before Windows was loaded is still present after Windows has shut down. So it's not a completely clean DOS environment, but it does allow you to rapidly jump back into Windows when you're done. Rebooting the computer and pressing F8 on startup to boot to a Command Prompt starts a clean DOS environment. I haven't had a lot of time to revisit this project, and even if I did, I think I'd get stuck on the "Restart in MS-DOS Mode" issue. At this stage it isn't cancelled, but it's going to take quite a while and it might look a bit different by the time it's done.
FantasyAcquiesce Posted March 21 Posted March 21 By chance, is there a driver for real-time DOS mode for Windows ME? It's a bit annoying the mouse doesn't work while under DOS.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now