Holy cow, I wrote a book!
When you wrote code for 16-bit Windows,
one of the things you spent time doing
as part of performance tuning was
deciding which functions should be grouped together in which segments.
Code in 16-bit Windows executed out of code segments,
each of which could be up to
When a code segment was loaded from disk,
the entire segment was loaded,
and when it was discarded, the entire segment was discarded.
This meant that you could affect your application's performance
in significant ways by choosing which functions go in which segments.
For example, it was to your advantage to keep functions that
are called at the same time in the same segment,
so that they would be loaded as a unit (saving I/O time).
If you chose poorly and put unrelated functions in the same segment,
then calling any function in the segment caused all the functions
to be loaded,
which was a waste of I/O since you loaded a bunch of functions
you didn't need.
Even if the functions were called at the same time,
you also had to keep an eye on their popularity.
If you have one function that is called frequently
and another that is called infrequently (but always
preceded by a call to the first function),
the less popular function will ride the coattails of his
roommate and remain loaded in memory.
This creates unnecessary memory pressure that could cause
a function which is moderately-frequently-called
to be discarded to make room.
Creating lots of small segments allowed your memory usage
to be managed with finer granularity,
but it also costs you in general overhead as well as I/O,
because each segment load was a new round trip to the disk.
You therefore had to balance memory cost against I/O cost.
The process of optimizing the grouping of functions
was known as segment tuning.
During the development of Windows 3.0,
it was customary to have regular meetings with Bill Gates
to brief him on the status of the project.
At one of the reviews,
the topic was performance, and Bill complained,
"You guys are spending all this time with your segment
I could teach a twelve-year-old to segment-tune.
I want to see some real optimization,
not this segment tuning nonsense.
on an airplane, for heaven's sake."
(I can't believe I had to write this:
This is a dramatization, not a courtroom transcript.)
This "I wrote FAT on an airplane"
line was apparently one Bill used
when he wanted to complain that what other people was doing
wasn't Real Programming.
But this time, the development manager decided she'd had enough.
We'll set you up with a machine fully enlisted in the Windows
and you can help us out with some of your programming magic,
why don't you."
This shut him up.
Some time ago, I briefly ran down
how 16-bit Windows managed memory for resources.
But there's a detail that I neglected to mention:
As we saw,
a resource handle HRSRC was really
a pointer to the resource directory entry of the resource
from the corresponding module.
This could be done with a 16-bit pointer because the segment
portion of the pointer could be inferred from the module
the resource belonged to.
In fact, since modules could be relocated
in memory at run time due to compaction,
you had better not try to remember the segment portion of the
pointer since it could change!
The FindResource function located the
resource directory entry.
The LoadResource function allocated memory
for the resource and loaded it from disk.
The LockResource function locked the memory
so you could access it.
If two people tried to load the same resource,
the memory for the resource was re-used so there was only
one copy in memory,
and if both people free the resource,
the resource is cached in case somebody asks for it again soon.
Now things get interesting:
When does the resource get removed from the cache?
What actually controls the lifetime of the resource?
Answer: The resource lifetime is tied to the module it came from.
When the module is unloaded, all its resources are
unloaded along with it.
(Note that even if a resource is cached,
its contents can get
discarded if it is tagged as DISCARDABLE.)
In Win32, modules are directly mapped into memory,
and along with it, the resources.
Therefore, accessing the resources of a module
is a simple matter of figuring out where they got mapped
(FindResource and friends will tell you),
and then reading the memory directly.
So despite the radical change to resources work,
the basic rules haven't changed:
The resources are good as long as the module is still in memory.
But there are resources and then there are resources.
So far, we've been talking about resources in the sense of
FindResource, which I will call
module resources for lack of a better term.
But people often work with objects like icons and bitmaps
which are not literally
resources but which are derived from resources.
we'll look at the relationship between module resources
and resource-derived objects in 16-bit Windows.
The feature now known as Aero Peek wasn't born that way.
It went through several iterations before becoming what eventually
shipped in Windows 7.
At the MIX09 conference,
showed some of the precursors to Aero Peek.
Here are the highlights, and the corresponding time codes
if you want to jump straight to the demos.
Thumbnails in the taskbar
(time code 30:20)
How it worked:
Instead of labeled icons, the taskbar showed miniatures
of the windows themselves.
How it got its name:
Um, it was just named after what it was.
Why it failed:
When shrunk to taskbar size,
most windows looked the same:
white with unreadably tiny text.
Aladdin (time code 42:34)
How it worked:
To bring another window into view temporarily,
shake the mouse over that window.
The longer you shake, the longer the window stays visible.
How it got its name:
From the folk tale in which the hero
summons a genie by rubbing a magic lamp.
Why it failed:
It was too tiresome having to keep
shaking the mouse while you read a document.
Bat Signal (time code 31:10)
How it worked:
When you hover over a taskbar button,
the screen darkens, and a spotlight shines on the
How it got its name:
After the distress signal used in the Batman series.
Why it failed:
People liked the way it helped them find their windows,
but it was too easy to trigger accidentally.
Also, people tried to "ride the light beam", which inadvertently
canceled the bat signal.
Squeegee (time code 33:10)
How it worked:
When you hover over the pop-up thumbnail,
the corresponding window comes to the front, and
all the other windows turn into glass sheets.
How it got its name:
It makes your screen look like somebody took a squeegee
to all the other windows and washed all the pixels off them,
leaving clean sheets of glass.
Squeegee won the day,
and it was given the official name Aero Peek.
Wikipedia entry for Batman clocks in at
the entry for
Bat-Signal is only 857 milliGinsburgs.
Hey, Wikipedians, you're falling down on the job!
In the early 1980's,
Microsoft moved its headquarters from downtown Bellevue
to Northup Way in Bellevue,
a building which later served as a training center
and is now the North Campus of Bellevue Community College.
This is the building in which the infamous
Bill Gates Tiger Beat-style photo
and the one I told a story about
some years ago.
At the time, the company was still very small,
and the task of managing the relocation was shared among all the employees.
After everybody settled in at the new building,
it became apparent that the mail volume was barely a trickle.
checks were not coming in,
which is kind of an important part of running a business.
In the excitement of moving,
nobody remembered to file a Change of Address form with the Post Office.
A visit to the old Bellevue offices
revealed a huge mound of mail at the old location.
A Change of Address was quickly filed,
but in the meantime,
Steve Ballmer became the company mailman.
Every day, he would drive to the old offices,
pick up the mail that had accumulated,
dump it in the trunk of his car,
then deliver it to the Northup offices.
(Today's story is in recognition of the 238th birthday of the
United States Postal Service.)
The magic incantation for updating the last-modified date on a
COPY /B FILE+,,
What strange syntax!
What's with the plus sign and the commas, anyway?
The formal syntax is the much more straightforward
COPY /B A+B+C+D
This means to start with the file A,
then append the files B, C, and D,
treating them all as binary files.
If you omit the
then you get
COPY /B A+
"Start with A, then append nothing."
The side effect is that the last-write time gets updated,
because the command processor opens A for append,
then closes the handle.
That syntax has worked since at least MS-DOS 2.1
(the earliest version I still have a virtual machine for).
I dont know where the two-comma version came from,
but it most likely exploited a parsing glitch in
and somehow this variant gained traction and
became the version everybody used
(even though the other version is two keystrokes shorter).
As a result, this weird syntax has become grandfathered
as a special-case in the CMD.EXE parser.
Here's some actual code from the part of
CMD.EXE which parses the arguments to the
if (parse_state == SEEN_TWO_COMMAS)
copy_mode = TOUCH;
Corporate policies for acquiring hardware
typically require going through a bunch
of procedures, like issuing purchase orders, getting appropriate
approvals, all the usual red tape with the purpose of preventing fraud.
But the Windows 95 project was so notoriously behind schedule
that upper management removed some procedural roadblocks.
To expedite the acquisition of hardware for members of the development
team, the administrative assistant for the core development team
was issued a corporate credit card with a credit limit of $500,000.
what $500,000 in 1994 dollars
corresponds to in today's money.)
I assume the theory here was "buy first, fill out paperwork later."
"It's kind of weird having a credit card in your pocket that you could
buy a house with."
The nickname doesn't get used much at all any more,
but back in the day,
the Windows source code trunk was called the Blue Line.
Where did it get that name?
the color of the whiteboard pen.
the branching structure was worked out,
the trunk was drawn with a blue pen.
If you were in that meeting, and you wanted to raise a point about
the diagram, you might say,
"But when the red line meets the blue line…",
"How do changes get from the green line to the blue line?"
Everybody called the trunk the "blue line" in the meeting,
and that nickname carried forward into the internal documentation.
Of course, if you weren't at that meeting,
it was a giant mystery why
the trunk was called the Blue Line.
A mystery that has now been resolved,
long after everybody stopped using that nickname.
Commenter BAA says that
the -lett part of Marlett comes from the designer Virginia Howlett.
BAA adds, "I forget the 'Mar' but I believe it was a co-creator."
If so, then that co-creator was Suzan Marashi,
Vincent Connare is to be trusted.
On page 17 of the PDF document
From The Dark Side...,
Connare identifies the authors of the font as
Virginia Howlett, Rom Impas, Suzan Marashi, and Alison Grauman-Barnes.
He also identifies Eliyezer Kohen as the person whose idea it was
to use a special-purpose font.
According to Virginia Howlett,
the original name for the font Verdana was
which means window in Spanish.
Lawyers apparently objected to the name,
and the font team explored variations on
verde (which means green in Spanish)
verdigris (a green pigment),
thereby invoking the color associated both with Washington
(The Evergreen State)
(The Emerald City).
The second part of the font name comes from Howlett's granddaughter Ana,
following in the tradition of font designers naming fonts after their
Many years ago, I visited the office of a colleague
who worked on Internet Explorer in order to work on some problem
As we investigated the issue,
we took notes on a 5"×7" tear-off notepad which bore the logo
My colleague then pointed out to me that we were taking notes on
the most expensive notepads in Microsoft history.
was the code name for the project that was the precursor to
the layout engine that powers Internet Explorer.
As I recall the story as it was told to me,
project management thought it would be cool to have custom
notepads made for their project.
The people responsible for converting this idea into reality
designed a logo, laid it out, and found a vendor to produce the notepads.
But there was some sort of misunderstanding
(maybe the asked for too many colors? didn't order enough notepads
to trigger the bulk discount?),
and the price for the notepads ended up being something ridiculous
like $10 for a 50-page notepad.
That's how the most expensive notepads in Microsoft history came to be.
Oh, by the way, the word "precursor" I used up there?
Yeah, that was a euphemism for
"cancelled (but used as a learning opportunity)."
Microsoft engineers are fond of black humor when it comes to software
(especially software made by Microsoft) as a way of coping with adversity,
and after the Forms³ project was cancelled,
there was a subculture of engineers who morbidly called it
Project code names are not arrived at by teams of focus groups
who carefully parse out every semantic and etymological nuance
of the name they choose.
(Though if you read the technology press,
you'd believe otherwise,
because it turns out that taking a code name apart syllable-by-syllable
searching for meaning is a great way to fill column-inches.)
Usually, they are just spontaneous decisions,
inspired by whatever random thoughts jump to mind.
Many years ago, there was an internal user interface research project
code named RedShark.
Not Red Shark but RedShark,
accent on the Red.
Where did this strange name come from?
From a red shark, of course.
When the project started up, the people in charge were sitting around
and realized they needed to give the project a name.
It so happened that the office they were sitting in belonged to a team
member who collected a lot of strange toys.
One of those toys was an small inflatable red shark.
Somebody looked around the room and spotted the red shark.
"Let's call it RedShark."
Nobody else had a better idea, so the name passed by default.
That small inflatable red shark became their mascot and
hung from the ceiling in the hallway.
No deep, hidden meaning.
Just a $3 cheap plastic toy
that happened to be in the right place at the right time.