The source code to Windows 3.1 KERNEL has been sitting under our noses since 2004

Discuss MS-DOS, Windows 1, 2 and 3.
Post Reply
winnt32
FTP Access
Posts: 112
Joined: Thu Mar 02, 2017 2:40 pm

The source code to Windows 3.1 KERNEL has been sitting under our noses since 2004

Post by winnt32 »

So I was reviewing the source leaks of Windows recently (782, 1381 sp1, and 2000 shell stuff) and was searching for super early NT related stuff such as i860 references when I hit upon a curious folder in the mdvm source code. One would assume that this would simply contain thunks - and indeed for most parts of Win16 it does - but for KERNEL it seems they just took the source code verbatim. There is even a log of changes going back several years included and comments going back to 1984! I haven't checked every WOW16 component yet, so some more might be found (most of it is just thunking code), but a critical part of Win16 source code jhas been sitting under our noses for about sixteen years now!

Winins
User avatar
FTP Access
Posts: 229
Joined: Wed May 29, 2019 5:36 pm
Location: Bird

Re: The source code to Windows 3.1 KERNEL has been sitting under our noses since 2004

Post by Winins »

May I ask, what is mdvm?
You have never seen Windows like this!
FREE Windows 3.2!
Shareware featuring an upgrade for pre-existing Windows 3.1 users and BONUS PACK
Distributed freely by PC World. March 1996

winnt32
FTP Access
Posts: 112
Joined: Thu Mar 02, 2017 2:40 pm

Re: The source code to Windows 3.1 KERNEL has been sitting under our noses since 2004

Post by winnt32 »

The source code to MMSYSTEM, 16-bit Dr. Watson, 16-bit OLE1, Windows Write, parts of COMMDLG, TOOLHELP, the Win16 timing APIs, a few parts of USER (certain parts of the thunking code are simply directly copied from Win3.1 source), and some "SYSTEM" utility for determining system configuration (copyrighted 1983-1988) are also included.

@Winins: mvdm is an early name for NTVDM - the DOS compatibility box for NT. Presumably it's based off of the OS/2 mdvm name.


jimmsta
Donator
Posts: 804
Joined: Sat Sep 09, 2006 6:43 am
Contact:

Re: The source code to Windows 3.1 KERNEL has been sitting under our noses since 2004

Post by jimmsta »

I ended up taking a look at the nt 3.5 version instead of the nt 4.0 version. It _is_ the 3.1 kernel, with WOW 1.0 ifdef's setup. It appears that it _can_ be compiled as a drop-in KERNEL.EXE for Windows 3.1, as all the makefiles exist (in the 3.5 version, anyway), as well as all includes. While it is a part of the MVDM/SoftPC module, it is provided as a complete copy of the 3.1 kernel with supportive wrappers if you attempt to compile it for NT. That's the key - you don't have to compile it for NT if you don't want to -- all the codepaths are provided for non-NT compilation. I'm not sure why the older 9yr old thread just dies with the second post -- perhaps the nt 4 iteration is changed heavily? I don't think I have that version readily available to look at, but I _do_ suspect that they did some serious modifications to it for NT4 support (there's some hints in the comments that seem to indicate that they weren't done refining the MVDM module, and that they intended to do more work on it after the 1.0 (nt 3.1) release).

There's also bits and pieces in the SoftPC bits that are leftover from the original XT-VDM project that SoftPC was derived from, going back to 1986. There's also the fake DOS 5 source code, implemented as part of the COMMAND.EXE dosbox interpreter, which is derived from the real DOS 5 code. There's a whole lot of neat stuff hidden in this that I don't think many people have taken a deeper look into.

The SoftPC stuff on its own is a whole intricate beast - it was based on project that started in the mid-80's to implement an XT PC in software emulation, and was further developed to allow Macintosh's to run Windows and DOS in the late 80's. There's bits of that leftover in the headers, too. The whole thing is quite a powerful piece of software, and it was hidden within NT for the most part.
Need disks scanned in the USA? I have a Kryoflux, and am willing to help get your disks archived! I also offer xbox and xbox 360 repair and modding services. PM me for details!

AltairMan
Posts: 8
Joined: Thu Sep 03, 2020 1:47 am

Re: The source code to Windows 3.1 KERNEL has been sitting under our noses since 2004

Post by AltairMan »

I never really looked into it before, but Win2K was a big change in how legacy 16-bit apps ran in the NT environment. NTVDM is supposed to be a 486 PC running DOS 5 (so maybe remnants of SoftPC?), and then WOW32 ran on top of that to provide the 16-bit environment.

I pulled my copy of Windows Internals and see how parts of the kernal compared to what Pietrek wrote in the book. I only looked at one file, but it was interesting to follow the book along with the source.

The other thing I'd like to see is VMM and the parts that make up WIN386. I know that sample code exists for some of the VxDs, but not all.

Post Reply