Windows NT 4.0 Source Build Guide

Important!

This guide is incomplete, so we recommend you to make this guide more fully, by submitting more instructions and researches into [email protected] and help to contribute the guide.

This guide was built by internet researches and explorations, and may help you to understand how to build not only Windows NT 4.0, but also 3.5, Windows 2000 (partial), Windows XP and even MS-DOS! Mostly part of tools for build are old, so them will be easy to find and download from various sites, such as WinWorldPC.com or OLD-DOS.ru. Source in some parts are incomplete, so if you have enough knowledge of assembler (MASM) and C/C++ (Visual), you may maintain it yourself, or even create your custom Windows versions with other work principles.

History

Source code of Windows NT 4.0 have been leaked earlier than XP (mid of 2000s). It was ~80% complete, and didn't have any libraries and SDK components to make build work.

First success (1) compile mentions in BetaArchive, when Kenneth (Windows OCManage) successfully compiled the NTOSKRNL.EXE (Windows NT Kernel). He also published a simple guide of how to build that sources, in base of which this guide has built on.

Next one (2) done by Stephanos, who also finalized and ported entire source code into GCC, by the way improving Razzle (Windows DDK Compiler) for compatibility with these tools. This project called "OpenNT" and had a big potential to be improved and become something as open-source Windows, but year later OpenNT was abandoned, official website (3) along with repositories gone down. Maybe due to copyright reasons, or something else, anyways, project was been bumped and nobody remembered about it's compilation for a while.

After September 2020's leak of Windows XP/2003 source code, that torrent included Windows NT 3.5, 4.0, partial 2000 and MS-DOS source code, with OpenNT too. People done maintaining of NT 5 code, thankfully to porting of several components from 2000 (winlogon.exe), but people forgot about older NT's sources.

References

  1. First mention about NT 4 compile: https://www.betaarchive.com/forum/viewtopic.php?t=8306 (Archive)
  2. Compilation by Stephanos: https://www.betaarchive.com/forum/viewtopic.php?t=33250 (Archive)
  3. OpenNT official website: https://opennt.net (Archive)

Getting Started

So, now it's time to build! Do the following:

  • Download Windows 2000 Professional with SP4 ISO or VMware Virtual Machine. If you downloaded VM, expand it's space, otherwise, install with up to minimum 20 GB. Make sure that you have two partitions - C & D.
  • Set up Windows NT 4.0's DDK into D:\ disk and Windows Server 2003 Platform SDK into D:\PSDK because of some errors of razzle with identifying paths which contains spaces.
  • Install Visual Studio 6.0, and optionally, MSDN.
  • Install 7-Zip or any other desired archiver, and extract NT source code into D:\NT.
  • Download the required files package (MEGA, MediaFire) and place them into following paths:
  • Create a map into D:\ drive and choose letter W:\.
  • Run the Free Build Environment shortcut from the Windows NT 4.0 DDK program group.
  • Execute D:\nt\ntos.cmd command.

Your environment is almost ready, and the remaining step is get the neccesary libraries, headers and SDK tools, and copy them all into D:\NT\public\sdk\ then build some libraries and tools for build. You must start your compilation with D:\NT\private\sdktools\, and try to make following tools strongly in turn:

  • masm
  • gensrv
  • hextract
  • hsplit
  • listmung
  • structo
  • ztools
  • touch
  • wcshdr
  • ws2hdr
  • chmode
  • ech

The executables should be copied into D:\NT\public\tools directory, and you're done.

Also, there's exist a special build drone disk, which is a Microsoft Virtual PC virtual drive. You can make it work in Oracle VirtualBox, by just entering into safe mode and deleting the Virtual PC extensions.

Source Code

The sources of NT 4.0 is kinda ... mess. Some parts of code builds successfully, some of them requires MFC older libraries (which you need to fetch from older Visual C++), and a lot of source code have bunch of mistakes such as repeating == operators where it isn't need actually, or disturbing redefinitions and messy write style, which makes me disgusting to maintain and "fix" the source code. Yeah it's very old file bunch, and I maybe will continue bug fixing and actual source publishing, but I don't even know it worth it or no.

Edit

Pub: 05 Jan 2023 11:54 UTC

Edit: 08 Jan 2023 16:04 UTC

Views: 214