Bonum Certa Men Certa

[Resurrected] 'We Are Morons': A Quick Look at the Win2k Source

The last copy of this article is in the Wayback Machine (the original was removed not long ago), so it's outside of search engines' reach. We're fixing that today.




Overview


Several days ago, two files containing Microsoft source code began circulating on the Internet. One contains a majority of the NT4 source code: this is not discussed here. The other contains a fraction of the Windows 2000 source code, reportedly about 15% of the total. This includes some networking code including winsock and inet; as well as some shell code. Some other familiar items include the event log, and some of the default screensavers.

The timestamps on the files generally say 25 July 2000. The source is contained in a Zip file of size 213,748,207 bytes, named windows_2000_source_code.zip, which has been widely circulated on P2P networks. Some dummy files of similar size, containing just strings of zeroes, have also circulated.



There has been some speculation that while the bulk of the source is genuine, some of the comments have been tampered with to embarrass Microsoft. This is difficult to disprove, but I find it implausible. The embarrassing comments occur on thousands of lines, in realistic places. Furthermore, if someone had done that, it would have been easy to make the comments far more incriminating.



Embarrassments
In the struggle to meet deadlines, I think pretty much all programmers have put in comments they might later regret, including swearwords and acerbic comments about other code or requirements. Also, any conscientious coder will put in prominent comments warning others about the trickier parts of the code. Comments like "UGLY TERRIBLE HACK" tend to indicate good code rather than bad: in bad code ugly terrible hacks are considered par for the course. It would therefore be both hypocritical and meaningless to go through the comments looking for embarrassments. But also fun, so let's go.



Curse words: there are a dozen or so "fucks" and "shits", and hundreds of "craps". Some dissatisfaction with the compiler is expressed in private\shell\shell32\util.cpp:

// the fucking alpha cpp compiler seems to fuck up the goddam type "LPITEMIDLIST", so to work
// around the fucking peice of shit compiler we pass the last param as an void *instead of a LPITEMIDLIST


Some insight into Microsoft's famous daily build process is given in private\windows\media\avi\verinfo.16\verinfo.h:

* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!IF YOU CHANGE TABS TO SPACES, YOU WILL BE KILLED!!!!!!!
* !!!!!!!!!!!!!!DOING SO FUCKS THE BUILD PROCESS!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


There are also various references to idiots and morons, some external, some within Microsoft. The file private\ntos\rtl\heap.c, which dates from 1989, tells us

// The specific idiot in this case is Office95, which likes
// to free a random pointer when you start Word95 from a desktop
// shortcut.


The file private\ntos\w32\ntuser\kernel\swp.c from 11-Jul-1991 points at

* for idiots like MS-Access 2.0 who SetWindowPos( SWP_BOZO
* and blow away themselves on the shell, then lets
* just ignore their plea to be removed from the tray


Morons also abound, as in this selection

private\genx\shell\inc\prsht.w:
// we are such morons. Wiz97 underwent a redesign between IE4 and IE5



private\shell\ext\ftp\ftpdrop.cpp:
We have to do this only because Exchange is a moron.



private\shell\shdoc401\unicpp\desktop.cpp:
// We are morons. We changed the IDeskTray interface between IE4



private\shell\browseui\itbar.cpp:
// should be fixed in the apps themselves. Morons!



Microsoft programmers also take their duty to warn others seriously. There are over 4,000 references to "hacks", mostly warnings. These include



private\inet\mshtml\src\core\cdbase\baseprop.cxx:
// HACK! HACK! HACK! (MohanB) In order to fix #64710 at this very late



private\inet\mshtml\src\core\cdutil\genutil.cxx:
// HACK HACK HACK. REMOVE THIS ONCE MARLETT IS AROUND



private\inet\mshtml\src\other\moniker\resprot.cxx:
// <HACK>
goto EndHack;
// </HACK>



private\inet\mshtml\src\site\layout\flowlyt.cxx:
// God, I hate this hack ...



private\inet\wininet\urlcache\cachecfg.cxx:
// Dumb hack for back compat. *sigh*

private\inet\wininet\urlcache\filemgr.cxx:
// ACHTUNG!!! this is a special hack for IBM antivirus software



private\ispu\pkitrust\trustui\acuictl.cpp:
// HACK ALERT, believe it or not there is no way to get the height of the current
// HACK ON TOP OF HACK ALERT,



private\ntos\udfs\devctrl.c:
// Add the hack-o-ramma to fix formats.

private\shell\shdoc401\unicpp\sendto.cpp:
// Mondo hackitude-o-rama.

private\ntos\w32\ntcon\server\link.c:
// HUGE, HUGE hack-o-rama to get NTSD started on this process!

private\ntos\w32\ntuser\client\dlgmgr.c:
// HACK OF DEATH:



private\shell\lib\util.cpp:
// TERRIBLE HORRIBLE NO GOOD VERY BAD HACK



private\ntos\w32\ntuser\client\nt6\user.h:
* The magnitude of this hack compares favorably with that of the national debt.



While surprisingly informal, there are limits to how far the programmers go. There are no derogatory references to Microsoft or Windows themselves. Bill Gates is never mentioned. There are no racist or homophobic slurs. I saw only one drug reference.

private\shell\ext\tweakui\genthunk.c:
* CallProc32W is insane. It's a variadic function that uses
* the pascal calling convention. (It probably makes more sense
* when you're stoned.)


Quality
Despite the above, the quality of the code is generally excellent. Modules are small, and procedures generally fit on a single screen. The commenting is very detailed about intentions, but doesn't fall into "add one to i" redundancy.



There is some variety in the commenting style. Sometimes blocks use a // at every line, sometimes the /* */ style. In some modules functions have a history, some do not. Some functions describe their variables in a comment block, some don't. Microsoft appears not to have fallen into the trap of enforcing over-rigid standards or universal use of over-complicated automatic tools. They seem to trust their developers to comment well, and they do.



However, not everything is so rosy. Some of the modules are clearly suffering from the hacks upon hacks mentioned earlier. As someone who struggled immensely trying to get the MSInet control working not long after this code was released, it's a relief to see that the inet code is as bad as I thought.



From the comments, it also appears that most of the uglier hacks are due to compatibility issues: either backward-compatibility, hardware compatibility or issues caused by particular software. Microsoft's vast compatibility strengths have clearly come at a cost, both in developer-sweat and the elegance (and hence stability and maintainability) of the code.



Open Source
It's been widely rumored for a while that Microsoft relies on stolen open source code. The rumor has faced widespread skepticism too. Microsoft has hundreds of millions of lines of code, most of it highly specialized. Hardly any of that could benefit from stealing: it hardly seems worth the legal risk. It's true that early versions of the TCP-IP stack were (legally) taken from BSD: but that was a long time ago, when Microsoft was much smaller.



Searching the code for "linux" and "GPL" finds no references. "BSD" finds only a couple of references to BSD-convention strings. "GNU" finds a lot of references to a GNUmakefile in private\genx\shell, which in turn mentions a "mode for Emacs." This is apparently legitimate: simply using a makefile does not apply the makefile's copyright to the resulting code.



Therefore, a superficial look at the code finds no evidence that Microsoft has violated the GPL or stolen other open source code. Closer examination might turn something up.

Favoritism
It's noticeable that a lot of the "hacks" refer to individual applications. In some cases they are non-Microsoft, such as this case: a Borland compiler came to depend on an existing bug, so their fix worked to preserve some of the bug's behaviour. But just as often these application-specific fixes are for Microsoft's own apps. There seems to be an informal hierarchy when it comes these: Microsoft apps take precedence, then major software companies like IBM and Borland.

It's also interesting to finally see references to the notorious undocumented features, which Microsoft application developers have long been known to use.

private\mvdm\wow32\wcntl32.c:
// These undocumented messages are used by Excel 5.0



private\mvdm\wow32\wgdi31.c:
// InquireVisRgn is an undocumented Win 3.1 API. This code has been
// suggested by ChuckWh. If this does not fix the s 2.0
// problem, then ChuckWh would be providing us with an private entry
// point.



private\mvdm\wow32\wgfont.c:
* This thunk implements the undocumented Win3.0 and Win3.1 API
* GetCurLogFont (GDI.411). Symantec QA4.0 uses it.
* To implement this undocumented API we will use the NT undocumented API



In some cases, the programmers themselves appear to have been frustrated or surprised.

private\ntos\w32\ntuser\kernel\mnpopup.c:
// Set the GlobalPopupMenu variable so that EndMenu works for popupmenus so
// that WinWart II people can continue to abuse undocumented functions.



private\windows\shell\accesory\hypertrm\emu\minitel.c:
// Guess what? Latent background color is always adopted for mosaics.
// This is a major undocumented find...



private\windows\shell\accesory\hypertrm\emu\minitelf.c:
// Ah, the life of the undocumented. The documentation says
// that this guys does not validate, colors, act as a delimiter
// and fills with spaces. Wrong. It does validate the color.
// As such its a delimiter. If...



Conclusions
The security risks from this code appear to be low. Microsoft do appear to be checking for buffer overruns in the obvious places. The amount of networking code here is small enough for Microsoft to easily check for any vulnerabilities that might be revealed: it's the big applications that pose more of a risk. This code is also nearly four years old: any obvious problems should be patched by now.



Microsoft's fears that this code will be pirated by its competitors also seem largely unfounded. With application code this would be a risk, but it's hard to see Microsoft's operating system competitors taking advantage of it. Neither Apple nor Linux are in a much of position to steal code and get away with it, even if it was useful to them.



In short, there is nothing really surprising in this leak. Microsoft does not steal open-source code. Their older code is flaky, their modern code excellent. Their programmers are skilled and enthusiastic. Problems are generally due to a trade-off of current quality against vast hardware, software and backward compatibility.

Recent Techrights' Posts

Crossbow tragedy, bigger than Kyle Clifford, social media culture
Reprinted with permission from Daniel Pocock
Transcript of Richard Stallman's Interview With Manuel Cuda News in Italy (Debunking Fake "AI")
A rough draft, but checked by two people
Microsoft Collapses While GNU/Linux Rises in Bulgaria, According to statCounter
Microsoft is losing across all sectors
The Fall of the Open Source Initiative (OSI): An Introduction
In a nutshell: there's a massive conflict inside the OSI and the OSI stooges (staff serving Big Sponsors like Microsoft) try to hide it
Paraguay: GNU/Linux Surging to New Usage Levels (7%), According to statCounter
Notice that the gains are at Microsoft Windows' expense
Social Control Media as a Rapid Race to the Bottom - Part I - That Sinking Feeling
When you realise you made an error and things you adopted more than 15 years ago became utterly bad
Microsoft's Entryism as Mortal Risk/Danger: The Example of the Open Source Initiative (OSI)
Microsoft is a cult
FSF Amicus Brief: Aspose.PDF for .NET 24.2.0, OOXML (.docx), and Microsoft Word (Proprietary)
Could the FSF not find any law firm that, in addition to talking about or for Free software, does not use .NET, OOXML, and almost everything Microsoft?
New Interview With Richard Stallman in Italy (Manuel Cuda News)
Due to Google's growing aggression against Free software and proper APIs, this cannot be downloaded and converted to a free format
The UEFI hype and Microsoft's lies
By Sami Tikkanen
Over at Tux Machines...
GNU/Linux news for the past day
 
Luxembourg: GNU/Linux at 8% Based on Estimates
steady increases this year
Gemini Links 04/03/2025: Bicycle, Photos, and Motorola 6809 Assemblers
Links for the day
Microsoft OSI Apparently Still Reading Techrights Closely, Trying to Make Face-Saving PR Moves
They have long had this reactionary rhythm, wherein it feels like we can 'control' what they publish and when by merely highlighting facts about them
Slopwatch: linuxsecurity.com and Other 'Linux' Sites With LLM Slop
SEO spam with machine-generated fodder, plus a person to whom English isn't a first language
Links 04/03/2025: Microsoft/Korea Game Industry Association Workforce Cuts, Outlook and 365 Outage Affects Very Many
Links for the day
Chad: All-Time Lows for Windows, According to statCounter
According to statCounter, many in Chad moved to Android
Links 04/03/2025: Universities Are Under Attack, Windows Attracts Ransom Against Ministry of Health
Links for the day
Links 04/03/2025: Microsoft Issues Policy Instructions to the Cheeto Mussolini Administration, Cloudflare Engages in Mass Censorship Again
Links for the day
Gemini Links 04/03/2025: Athens, Fedora 41, and Yelling at Clouds
Links for the day
The Free Software Foundation (FSF) Belatedly Comments on Case That Tests Copyleft in the United States
"The Free Software Foundation (FSF) announced today it has submitted an amicus brief in the case entitled Neo4j"
If They Try to Censor You on Some Topic, Then You Should Cover This Topic Even More
OSI is only a small part of it
IRC Proceedings: Monday, March 03, 2025
IRC logs for Monday, March 03, 2025
Thorsten Glaser & Open Source Initiative (OSI) resignations due to AI whitewashing
Reprinted with permission from Daniel Pocock
Gemini Links 03/03/2025: Copyrights, GrapheneOS, and SpaceBeans
Links for the day
Links 03/03/2025: Europe Rallies Behind Ukraine, Measles Flourishes in US Again
Links for the day
In Central African Republic Windows Has Pretty Much Fallen to Zero
We need to focus on Software Freedom
Microsoft Windows Down to 8.5% in South Africa
South Africa and Egypt are strategic in Africa
After Fund-raising Campaign the Free Software Foundation Still Raises About $13,000 Per Week (Without Campaigning for New Donors/Members)
Richard Stallman in the Board is not a liability
Links 03/03/2025: 'Monetisation' Myth' and Microsoft's LLMs Helping Criminals
Links for the day
The New Series About the Open Source Initiative (OSI) and the Microsoft Entryism in OSI is Closely Related to the SLAPP Against Techrights
Also based on the leading publication that they want removed
New Series: A Deep Dive Into the Severe Corruption of the Open Source Initiative (OSI), Nowadays a Front Group and Lobbyist of Microsoft
There's a lot to show
Links 03/03/2025: Mass Layoffs in IBM China, Intel Still in Trouble
Links for the day
3 Out of 4 in Cuba Use Linux to Access the Web
Maybe change does come about...
Doing Free Software for a Living in an Era or a Time of Abundance of Code (and Fast Internet to Pass It Around Freely) or Writing When the Web is Attacked by LLM Slop
Tailoring code to needs is the key
Links 02/03/2025: Day Off, POWER9, Console Challenge
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Sunday, March 02, 2025
IRC logs for Sunday, March 02, 2025
Microsoft Windows Falls to All-Time Low in Thailand
We're seeing many all-time records like these so far in 2025
Gemini Links 02/03/2025: Snowdrop Flower and Hostile Leaders
Links for the day
Links 02/03/2025: Microsoft Outlook Goes Offline, Foreign-Owned Social Control Media Interfering With Fair Elections
Links for the day
According to statCounter, Windows Falls Off a Cliff in Maharlika, GNU/Linux Surges to 5%
But mobile is king
New Video Clip of Richard Stallman's Latest Visit to and Talks in Italy
Richard Stallman or RMS giving his latest talk last week
Windows Used by Only One in Six Asians to Access the Web, According to statCounter
maybe more governments in Asia should move away from Microsoft
GNU/Linux Reaches 5% in Brazil, an All-Time High According to statCounter
There are hundreds of millions of people in that country
Google Already Dominates the Global South (via Android/Linux)
If one puts aside Russia and east Europe, not many countries exist that still connect to the Web from Windows more than from Android
GNU/Linux Widespread in Finland, Sweden, and Norway
Sweden has many Chromebooks in schools3 nations
Germany's Incoming Leader Said He'd Seek More Independence from the US, GNU/Linux Soars to 6%
Last month it was 5%
For the First Time GNU/Linux is Measured at Over 4% in Europe (Not Counting ChromeOS/Chromebooks)
Europe, on average, is now estimated to have GNU/Linux on 1 in 25 Web-connected laptops/desktops
Over 2 Years of LLM Hype and Nothing to Show for It
People still use search, not chatbots
Apple's iOS Almost Bigger Than Windows Now (Internationally), Windows Falls to 22% According to statCounter
Without Windows domination, there's not much left going for Microsoft
Putin's Loyal DOGE
We hereby crown Arvind Krishna "Putin's DOGE"
The Media Barely Reported This (Late Friday): IBM Lays Off About 2,000 More Workers, Effective Hours Ago
Maybe some diversity programs can help IBM recruit slaves or grossly-underpaid staff
Microsoft Money Being Spent to Bully Techrights Only Legitimises Techrights
The longer it goes on for, the greater the Streisand Effect
Suing One's Way Out of Real Trouble Won't Work (It Merely Increases the Trouble)
"Guns for hire" in London can only issue "legal" threats
Microsoft Writing Articles About Microsoft, Using Microsoft LLMs
Right now there are many articles about Microsoft Outlook being down completely
Gemini Links 02/03/2025: OFFLFIRSOCH 2025 and Programming
Links for the day
Over at Tux Machines...
GNU/Linux news for the past day
IRC Proceedings: Saturday, March 01, 2025
IRC logs for Saturday, March 01, 2025