Lobsters - 03 Dec 2026

Page 1 of 10

An interactive reading of the leaked Windows XP source code

Windows XP turns 25 very soon.Windows XP anniversary It came out on the 25th of October 2001, a lot of people learned what a computer is on it, maybe not for the best as I argued before.

Six years ago an image board user leaked Windows Server 2003 source code along with other older leaks and I was expecting to read some kind of analysis and people digging into it, perhaps someone finally validating claims about the NSA backdoor or some fun readings, kind of Computer History Museum stuff. I really enjoy reading historical code, especially now that most code I read is LLM generated, I was expecting someone doing something with that leak very soon, but so far all what I could find are low-quality videos showing funny comments in the source code and looking for curses.

I wanted to know what was going on, how they built it, because the development of Windows really predates a lot of the things I know about building software. So last month I started having inside looks into the source.

The demos in the blog post run the code visualized, with a great help of LLM free usage, I was able to port them to JavaScript, if I had to approximate something, the demo says so. A few of them load data that also shipped inside retail XP files (for example the boot bitmaps are resources in ntoskrnl.exe, and the compatibility entries end up in sysmain.sdb).

Abandoned projects

Windows XP shell has an unshipped alternative to the familiar Start menu, behind a build flag called FEATURE_STARTPAGE, a full-screen "Start page prototype", written in DirectUI. Press Start and, instead of a menu, the desktop rises over your open windows as a page with "Welcome" and your name in large Trebuchet, reminded me a bit of the beloved Windows 8 Metro Start Menu. It stays off unless a registry value called FaultID is set to 101. The comments say FaultID is a decoy. They picked 101 because it would be hard to guess.

// FaultID is a decoy so that hackers won't think of trying to enable this feature.

LONG lRet = SHRegGetUSValue(REGSTR_PATH_EXPLORER, TEXT("FaultID"), &dwType, &dwData, &cbData, FALSE, &dwDefault, sizeof(dwDefault));

if (lRet == ERROR_SUCCESS && dwData == 101) // Some random value not easily guessed

s_fEnabled = TRUE;

else

s_fEnabled = FALSE;

One detail if you were thinking of trying this on a copy of XP. Explorer checks FaultID. It still needs a build with FEATURE_STARTPAGE defined for there to be anything to switch on. I don't see one in the tree, which as far as I can tell rules out the page in retail XP.

For the version on my blog I had the original artwork and the markup for the page. The rest is a browser putting it on the screen. I put the familiar XP panel next to the reconstructed page.

I was talking about alternative Start menus, but even the Start button could have looked quite different. There is a theme under shell/themes/themedir/candy where you get a rounded Start button, glassy little radio buttons and push buttons that look like shiny capsules. It looks an awful lot like early Mac OS X to me, especially beside the blue and green of XP. Apple introduced Aqua in January 2000. The date in Candy's metadata is July 13, 2000, for the last update.

[documentation]

DisplayName = Candy

LastUpdated = 07/13/00

ToolTip = Ryan's Candy Skeme (for internal use only)

Author = t-ryanb

Company = Microsoft Corporation

Copyright = Copyright (c) Microsoft Corporation, 2000

URL = http://www.microsoft.com

Version = .10

Description = Whistler skin with eye candy

In the blog demo the pictures are from Candy and Luna. I put together the controls I had images for, so you can hold the button down or move the mouse over it, tick the checkbox, etc. The browser still does the layout and the text (on a smaller screen it's just a picture). There's been coverage of Candy since the 2020 leak. The source gives little indication why work on Candy stopped.

Window text

Candy (internal)

There is actually a note of that kind in shell/ext/neptune, three lines somebody left to explain the continued existence of a whole directory. Even at the time they figured the code probably wouldn't compile. They hung on to it "if we ever want to pillage it".

This directory is for long-term storage of old code from the Neptune project.

This code probably doesn't compile; it isn't intended to. It's here so that

the work we did then isn't lost if we ever want to pillage it.

One thing they might have wanted again was the bit that lets you take files and folders in the shell and copy them to a WebDAV server. You even get the address of somebody's test server, http://aidanl:8088/dav/aidanl/. The little driver gathers up the files and folders, makes a DAVStorage object for that address and copies them into it.

Suppose all your data lived on the server. What would you keep on the PC? Ben Slivka, who did the RedShark prototype in 1998 with Joe Belfiore and Steve Capps, describes a secure cache you could work with even if the connection went down. In their Neptune service you'd organise your work into projects. Reading the mail from February 1999, I don't think the fight was really over the cache. Brad Schick opened the discussion by asking who Neptune should serve.

... target AOL customers ...

Schick circulated a memo proposing a shift away from the existing Windows market. Brad Schick, February 7, 1999, page 4.

Slivka thought they were going to lose if they tried to win the Internet through Windows.

... win the Internet using Windows is a losing strategy.

He agreed with Schick and wanted separate mandates for the Windows and Internet teams. They could still work together where it helped both. Ben Slivka, February 10, 1999, page 3.

Brad Silverberg wanted the team to set its release schedule without taking on Windows's compatibility obligations.

... compatible with existing apps [...] windows release schedules ...

Silverberg asked whether Neptune would have to run applications like Office. He thought the project needed a separate name and an independent team so it could address the needs of connected consumers and ship without waiting for the next Windows release. He pointed to Internet Explorer as a precedent for releasing separately. Brad Silverberg, February 14, 1999, pages 2-3.

David Cole wanted the connected experience in Windows itself.

... simple connected user experience in Windows.

Cole wanted that experience available to all Windows users and said the IE team was calling it IE 5.5. He used Neptune for the broader work of making PCs simpler and more useful. He supported doing both. David Cole, February 10, 1999, pages 3-4.

Abandoned web

Some of the web stuff is even older. In multimedia/danim/doc/homepage there's Microsoft's homepage for ActiveVRML, and the bit of animation they used their web language for there was a blinking star. They had a much wider use in mind, you can see it in the 1996 research report. An image or a sound or some geometry could have a value that varied with time. If I were making an animation I could describe continuous motion and discrete events, then leave the work of producing the frames to the engine. The star on their page takes two definitions.

starImage(x, y, delay) =

let

s0 = dimImage until after(delay) => function(x) . s1;

s1 = brightImage until after(0.25) => function(x) . s0;

in

transformImage(

translate(

x * backXSize,

y * backYSize

),

s0

);

One is s0, the dim star, which waits for a delay and becomes s1. The other is s1, the bright star, which waits a quarter of a second and becomes s0 again. Those dated web graphics also have a place in the history of functional reactive programming. Conal Elliott wrote in 1997 that ActiveVRML was where both Fran and DirectAnimation came from. With Fran the idea went into Haskell and what we'd call functional reactive programming. With DirectAnimation you could use some of the same ideas alongside imperative programming from a mainstream language. That one ended up being bundled with Internet Explorer.

I reconstructed the homepage from its original images and the timings in that script.

In July 1998 Microsoft proposed putting HTML on the faces of a cube. You could turn it to find something else to read, and the menu bars could bend out of your way. The name was Chromeffects and it was an add-on for Windows 98. You wrote the page in HTML and XML and got animation, sound and 3D from DirectX. Come November, Microsoft said it was stepping back to rethink Chromeffects after hearing from developers. Its Windows source sits in multimedia/danim/src/lm/chrome.

// File: factory.cpp

// Author: jeff ort

// Date Created: Sept 26, 1998

//

// Abstract: Implementation of CCrBehaviorFactory object which implements

// the chromeffects factory for DHTML behaviors

//

// Modification List:

// Date Author Change

// 09/26/98 jeffort Created this file

// 10/21/98 jeffort Changed FindBehavior from using class to using the tag

// to determine the behavior type being created

// 11/12/98 markhal FindBehavior now accepts null arguments

Classic spam filter

Outlook Express has, in inetcore/outlookexpress/oejunk, a machine-learned spam filter from 1998. Robert Rounthwaite's header describes a support vector machine that checks the mail as it comes in.

/*

SVMHANDLER.CPP

(c) copyright 1998 Microsoft Corp

Contains the class encapsulating the Support Vector Machine used to do on the fly spam detection

The model, junkmail.lko, is a plain text file with four constants for a sigmoid (the engine reads two of them), a threshold that's subtracted from the score before the sigmoid, three cut-offs for the sensitivity setting (the default, the strictest and the loosest; the two settings in between are halfway points), and 1,264 weighted features: 1,230 words and phrases to look for in the body, 22 in the subject, and 12 hand-written rules.

aa = 1.000000 bb = 0.000000 cc = -5.825104 dd = -3.615463

Threshold = 1.090667 dThresh = 0.990028

mThresh = 0.999978 lThresh = 0.986543

NumDim = 1264

Weights

-0.717402 5:16

0.323676 1:4:FREE

0.319125 1:5:MONEY

0.380937 1:6:REMOVE

-0.306643 2:2:RE

In that file you can tell where a word has to appear by the number at the start of the feature. For example 1: is something to look for in the body of the message, 2: in the subject line, 5: is one of their hand-written rules. All the engine does with the features that turned up is total their weights and subtract the threshold. Have a look at the end of _DblDoSVMCalc and there's the conversion of that number x to 1/(1 + e^(cx + d)).

// Apply threshold;

dblAccum -= m_dblThresh;

// Apply sigmoid

dblResult = (1 / (1 + exp((m_dblCC * dblAccum) + m_dblDD)));

return dblResult;

There happen to be two numbers in there worth looking up, cc = -5.825104 and dd = -3.615463. They're the constants this filter uses for what is now the standard Platt scaling of an SVM score into a probability. John Platt actually came up with the scaling for this filter if you go by David Heckerman's memoir. In the 1998 paper by Heckerman, Eric Horvitz, Susan Dumais and Mehran Sahami, the filter was naive Bayes. Many of the features are already there in the paper. The SVM did a better job, hence Platt's version in the source. It makes for a nice record of email at the time too, because FREE, MONEY, REMOVE, !!! and OPPORTUNITY were votes for junk, while EDU, THANKS and FORWARDED went the other way. The strongest feature they had was being addressed to you directly (-0.717).

It never shipped switched on, because of a greeting card company. The filter was in the Outlook Express that came with the Internet Explorer 5 beta in 1998, off by default, and with its threshold turned towards "catch more" it sent Blue Mountain Arts' e-cards to the junk folder. Heckerman says his team promised a fix by the end of the week; before the week was out Blue Mountain sued, the press decided Microsoft was trying to kill a competitor, a court ordered Microsoft to help Blue Mountain's mail get through (Microsoft's statement, December 1998), and "the spam filter was promptly removed from Outlook Express".

In XP's Outlook Express the settings page is still there. Put a non-zero value under the meaningless name bhgcc in HKLM\Software\Microsoft\Outlook Express\5.0, and a Junk Mail page appears in the message rules. Outlook Express checks once as it starts up (c_szRegJunkMailOn is the string "bhgcc", and Athena was Outlook Express's code name).

void _CheckForJunkMail()

{

HKEY hkey;

DWORD dw=0, cb;

if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, c_szRegRoot, 0, KEY_QUERY_VALUE, &hkey))

{

cb = sizeof(dw);

RegQueryValueEx(hkey, c_szRegJunkMailOn, 0, NULL, (LPBYTE)&dw, &cb);

if (dw)

g_dwAthenaMode |= MODE_JUNKMAIL;

RegCloseKey(hkey);

}

}

XP's setup deletes oejunk.dll and its model, junkmail.lko, when it installs Outlook Express, and the model is commented out of the install package under CONDITIONAL_JUNKMAIL. But XP's upgrade database lists an oejunk.dll among Internet Explorer 5's files and a 28,370-byte junkmail.lko among the system files of Windows 98 Second Edition, and the model in this tree is 27,099 bytes with Unix line endings, exactly 28,370 with Windows ones, with the same checksum setup records. So the filter a lawsuit took out of Outlook Express very probably went out anyway, switched off, with Windows 98 Second Edition in 1999. Microsoft finally shipped machine-learned spam filtering in MSN 8 in 2002, because, Heckerman writes, a programmer on that team found the old code and sneaked it in.

junkmail.lko, all 1,264 features, with the matching rules ported from , all 1,264 features, with the matching rules ported from

junkutil.cpp and and

junkeng.cpp. Try the presets, then write a message. The biggest push towards "legitimate" is being addressed directly to you, an empty To line counts against you more than any word does, and dating the same spam 1998 is enough to get it into the inbox.

. Try the presets, then write a message. The biggest push towards "legitimate" is being addressed directly to you, an empty To line counts against you more than any word does, and dating the same spam 1998 is enough to get it into the inbox.

About the backdoor

Of all the stories I had in mind when I started looking at the leak, the NSA one seemed the easiest to put a question to. A very odd name had once fallen out of a Microsoft binary. What did the thing with that name actually do?

That accusation is _NSAKEY. In 1999 a researcher poking at a Windows NT service pack found that the part of Windows that checks cryptographic modules carried two public keys, and that a leftover debug symbol had named the second one _NSAKEY. The possibility that Microsoft had given the NSA a separate signing key quickly made news around the world. Microsoft said the second key was a backup in case the first was ever lost, and that its name came from work on export rules. The name alone couldn't establish who held the corresponding private key.

Now there's a source tree to put beside that story. The Windows code for verifying signatures on cryptographic providers calls the two production keys KEY and KEY2. It also distinguishes keys for development and test builds. The pair in the shipping configuration agrees with the number the researcher found in 1999.

if (CRYPT_SUCCEED == (fRet = CheckSignature(rgbKey, 128, pbSig,

cbSig, pbHash, fUnknownLen)))

{

fRet = TRUE;

goto Ret;

}

#ifdef MS_INTERNAL_KEY

if (CRYPT_SUCCEED == (fRet = CheckSignature(rgbMSKey, 128, pbSig,

cbSig, pbHash, fUnknownLen)))

{

fRet = TRUE;

goto Ret;

}

#endif

if (CRYPT_SUCCEED == (fRet = CheckSignature(rgbKey2, 128, pbSig,

cbSig, pbHash, fUnknownLen)))

{

fRet = TRUE;

goto Ret;

}

Nothing around KEY2 calls it a backup, an escrow, a spare or the NSA's. I couldn't find the string nsakey in this tree. The change log starts in December 1994, records "Increased signature key to 1024 bits" in April 1995 and "Added Microsoft's signing key" that September. It doesn't say when or why the second one came along. Both are public keys for verifying signatures. Seeing them in Windows tells us nothing about decrypting somebody's data, and the public half doesn't identify the custodian of the private half. Microsoft's backup explanation fits what I found, but I can't prove it from this code.

I looked at the rest of the usual suspects too, with help. Windows does carry Microsoft's test root certificates. On an ordinary installation these were not trusted by default, and for HTTPS there is a dated comment, "On July 26, 2000, disabled the use of the test root". In the account code the cases I found turned out to belong to domain setup or to autologon configured by the administrator. The network destinations I identified included the crash reporter at watson.microsoft.com, Windows Update, time.windows.com and Passport. These were identifiable Microsoft services. I didn't find a hidden login or a covert reporting destination in the cases I examined.

There are places where the engineers recorded their security worries quite plainly. Comments in the C runtime, the kernel and the DNS server explain why particular features were withheld from ordinary builds. I also found a developer's removal note in the 64-bit Terminal Server source. It concerned an administrative feature absent from the 32-bit version most people ran. A note like that records what the developer wanted done. It doesn't settle what finally shipped. I found no evidence for the alleged backdoor in the code I examined.

What you can find a government doing in Windows is deciding where people may encrypt things. NTLM once looked up the default locale in IsEncryptionPermitted. Standard French as the language or France as the country was enough for it to decline encryption. Whoever maintained the code put the paperwork right next to it, "permission to remove FRANCE check obtained 08-21-1999".

//

// sfield: permission to remove FRANCE check obtained 08-21-1999

//

#if 0

By the time of this source the routine returned true on every machine. The old test was still there, excluded from the build, and the description still said to check France. French rules had changed that March to allow the use and import of systems up to 128 bits under specified conditions. I don't know whose approval the note referred to in August. A function with practically nothing left to do had kept the date the restriction came out.

Next page | More Lobsters | Headlines

Original: https://lr0.org/blog/p/winxp/