Skip to content
CONTACT

Windows Update source code leaked (maybe, almost, as a parody)

WINDOWS UPDATE SOURCE LEAKED

Last night, at the bottom of a drawer, under a bundle of IDE cables and a video rental membership card, I found a floppy disk with NEVER OPEN written on it in marker pen. I opened it immediately. Inside was what appears to be the secret code that decides when your PC updates. I am publishing it for the good of humanity and of my own curiosity.

Obligatory disclaimer

This is, of course, a parody. No real code was read, copied or mistreated. The floppy was empty: I dreamed the code. But it was a very detailed dream, with curly brackets.

The main file

/* TOP SECRET - Updates module
   Version: always the next one
   Status: getting ready since 2015 */

int user_patience = 100;

void main()
{
    while (user_is_working())
    {
        if (important_meeting_in_minutes(5))
        {
            show_warning("Your PC will restart shortly");
            hide_button("Postpone");
        }

        if (document_not_saved && hours_of_work > 3)
        {
            restart_gracefully();
        }

        if (current_time() == LUNCH_TIME)
        {
            behave();   /* nobody is watching, no need */
        }
    }
}

The progress bar

Many users have wondered how the percentage is calculated during installation. The code answers with disarming honesty.

int calculate_percentage()
{
    if (percentage < 30) return percentage + 10;  /* raise hopes */
    if (percentage < 99) return percentage + 1;   /* lead them on */
    if (percentage == 99)
    {
        wait(HOURS, roll_a_die());                 /* meditate */
        return 99;
    }
    return 100;  /* never reached during testing */
}

Note the comments: the programmer was a sensitive soul, with a past as a youth football coach.

Message handling

void choose_message()
{
    char *phrases[] = {
        "Getting ready",
        "We're setting things up for you",
        "This will take a little longer",
        "Almost there",
        "Almost there (really)",
        "Hi"
    };
    show(phrases[random()]);
    /* TODO: one day tell the user WHAT is getting ready */
}

The hardware check

if (computer_new_and_fast())
{
    install(cumulative_updates, ALL_AT_ONCE);
}
else if (computer_old_but_happy())
{
    declare(hardware, NOT_COMPATIBLE);
    suggest("Perhaps it's time for a new PC?");
}

if (disk_space < REQUIRED)
{
    ask_to_free_up_space();
    fill_space_just_freed();
}

The best-loved function

At the bottom of the file, after three hundred commented-out lines, is the function we all know and nobody has ever seen. Here it is, finally revealed.

void after_restart()
{
    restore(default_printer, THE_WRONG_ONE);
    reset(default_browser, THE_HOUSE_BRAND);
    move_desktop_icons(RANDOMLY);
    show_welcome("New! Discover the new features");
    /* the new features are the old ones, moved to another menu */
    user_patience = user_patience - 10;
}

A sysadmin's conclusions

I showed the floppy to a colleague. He read it in silence, then said only: “That explains everything.” We lit a candle in front of the server, just in case. The server updated. It restarted. It was at 99%. It still is.

Should anyone from the company in question wish to claim the code, they should know it isn't theirs: I made it up myself, at night, during an update that never ended. I had the time.


Loosely based on an old piece from the teneraerbetta.it archive