The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

"I attack the kobold wearing the headdress made of human ears"
Jan 31, 2006
Post comments count 0
Post likes count 0

"I attack the kobold wearing the headdress made of human ears"

Raymond Chen
Raymond Chen

If you dare, spend eleven minutes of your life watching the most painfully compelling mockumentary on the lives of two basement fantasy role playing gamers. (via Chris Williams.)

Why does the Recycle Bin have different file system names on FAT and NTFS?
Jan 31, 2006
Post comments count 0
Post likes count 0

Why does the Recycle Bin have different file system names on FAT and NTFS?

Raymond Chen
Raymond Chen

On FAT drives, the directory that stores files in the Recycle Bin is called , but on NTFS drives, its name is . Why the name change? The FAT and NTFS Recycle Bins have different internal structure because NTFS has this thing called "security" and FAT doesn't. All recycled files on FAT drives are dumped into a single directory, whereas recycled files on NTFS drives are separated based on the user's SID into directories named . (It has nothing to do with whether you are running English or Swedish Windows.) Suppose the same directory name were used for both file systems, say, . Since it is possible to upgrade a F...

Why does a corrupted binary sometimes result in “Program too big to fit in memory”?
Jan 30, 2006
Post comments count 0
Post likes count 1

Why does a corrupted binary sometimes result in “Program too big to fit in memory”?

Raymond Chen
Raymond Chen

Because the program isn't actually corrupted. Sort of.

Liquefied NBA points apparently cannot be sold on eBay
Jan 30, 2006
Post comments count 0
Post likes count 0

Liquefied NBA points apparently cannot be sold on eBay

Raymond Chen
Raymond Chen

Of course we don't find this out until somebody tries. (Google cache for a limited time only.)

Waiting for all handles with MsgWaitForMultipleObjects is a bug waiting to happen
Jan 27, 2006
Post comments count 0
Post likes count 0

Waiting for all handles with MsgWaitForMultipleObjects is a bug waiting to happen

Raymond Chen
Raymond Chen

The and functions allow you to specify whether you want to want for any or all of the handles (either by passing or by passing , accordingly). But you never want to wait for all handles. Waiting for all handles means that the call does not return unless all the handles are signalled and a window message meeting your wake criteria has arrived. Since you are typically waiting for messages out of a sense of obligation (keeping the UI thread responsive) rather than one of expectation, even if all the handles you pass become signalled, your program will still stall until a window message arrives. (And if you thoug...

Stephen Tolouse's reminiscences of Windows 95 RTM day
Jan 26, 2006
Post comments count 0
Post likes count 0

Stephen Tolouse's reminiscences of Windows 95 RTM day

Raymond Chen
Raymond Chen

Stephen Tolouse (known around Microsoft as "stepto", pronounced "step-toe") from the Microsoft Security Response Center reminisces about Windows 95 RTM. Stephen mentions that "the build numbers were artificially inflated to reach 950". There's actually a technical reason for this inflation, which I intend to write about when I have the time to give the topic the treatment it deserves.

Pumping messages while waiting for a period of time
Jan 26, 2006
Post comments count 0
Post likes count 0

Pumping messages while waiting for a period of time

Raymond Chen
Raymond Chen

We can use the function (or its superset ) to carry out a non-polling "sleep while processing messages". This function pumps messages for up to milliseconds. The kernel of the idea is merely to use the function as a surrogate for , pumping messages until the cumulative timeout has been reached. There are a lot of small details to pay heed to, however. I've linked them to earlier postings that discuss the specific issues, if you need a refresher. The you might find gratuitous, but you'll change your mind when you realize that users might press a keyboard accelerator while you're sleeping, and you presumabl...

Welcome to the United States, unless you're a Canadian technologist who is an invited guest at a Microsoft conference, in which case, keep out
Jan 25, 2006
Post comments count 0
Post likes count 0

Welcome to the United States, unless you're a Canadian technologist who is an invited guest at a Microsoft conference, in which case, keep out

Raymond Chen
Raymond Chen

Vancouver technologist Darren Barefoot was invited to Redmond by the MSN Search team but was stopped by Immigration and denied entry. Ultimately, the customs agents concluded that because Microsoft was covering my flight and accommodation, I was being compensated for consulting activities. In order to enter the country, I'd need a work permit. He says Customs, but I'm pretty sure it was really Immigration that stopped him. Sorry, Darren. We miss you already. We even asked the rain to take a few days off and invited the sun out to play just for you.

You can call MsgWaitForMultipleObjects with zero handles
Jan 25, 2006
Post comments count 0
Post likes count 0

You can call MsgWaitForMultipleObjects with zero handles

Raymond Chen
Raymond Chen

There is no function, but you can create your own with the assistance of the function. To wait for a message with timeout, we use the in a vacuous sense: You pass it a list of objects you want to wait for, as well as a timeout and a set of queue states, asking that the function return when any of the objects is signalled or when a message is ready. By passing no objects, the only thing left to wait for is an incoming message. Next time, we'll see how this basic idea can be used to build a slightly more complex function. [1/26: Fix call to MsgWaitForMultipleObjects; had it confused with MsgWaitForMultip...