Raymond Chen

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

Post by this author

Using fibers to simplify enumerators, part 4: Filtering

One type of higher-order enumeration is filtering, where one enumerator takes the output of another enumerator and removes some elements. In a producer-driven enumerator, you would implement filtering by substituting a new callback function that responds to callbacks on behalf of the client for items that should be filtered, and forwarding ...

Using fibers to simplify enumerators, part 3: Having it both ways

As we discovered in the previous two entries [second], the problem with enumeration is that somebody always loses. Now we will use fibers to fight back. Before you decide to use fibers in your programs, make sure to read the dire warnings at the end of this article. My goal here is to show one use of fibers, not to say that fibers are the ...

Using fibers to simplify enumerators, part 2: When life is easier for the caller

Last time, we looked at how a directory tree enumerator function would have been written if the person writing the enumerator (the producer) got to write the spec. Now let's look at what it would look like if the person consuming the enumerator wrote the spec: #include <windows.h> #include <shlwapi.h> #include <stdio.h> #...

Using fibers to simplify enumerators, part 1: When life is easier for the enumerator

The COM model for enumeration (enumeration objects) is biased towards making life easy for the consumer and hard for the producer. The enumeration object (producer) needs to be structured as a state machine, which can be quite onerous for complicated enumerators, for example, tree walking or composite enumeration. On the other hand, the ...

Computing the size of a directory is more than just adding file sizes

One might think that computing the size of a directory would be a simple matter of adding up the sizes of all the files in it. Oh if it were only that simple. There are many things that make computing the size of a directory difficult, some of which even throw into doubt the even existence of the concept "size of a directory". Reparse ...

Alton Brown book tour 2005: I’m Just Here for More Food

Alton Brown, geek cooking hero and Bon Appetit Magazine Cooking Teacher of the Year 2004 will be spending January 2005 promoting his latest book, Food × Mixing + Heat = Baking (I'm Just Here for More Food), sequel to his award-winning debut cookbook Food + Heat = Cooking (I'm Just Here for the Food). ...

You can create an infinitely recursive directory tree

It is possible to create an infinitely recursive directory tree. This throws many recursive directory-traversal functions into disarray. Here's how you do it. (Note: Requires NTFS.) Create a directory in the root of your C: drive, call it C:\C, for lack of a more creative name. Right-click My Computer and select Manage. click on the Disk ...

Why does the system convert TEMP to a short file name?

When you set environment variables with the System control panel, the and variables are silently converted to their short file name equivalents (if possible). Why is that? For compatibility, of course. It is very common for batch files to assume that the paths referred to by the and environment variables do not contain any embedded ...

How to open those plastic packages of electronics without injuring yourself

Small electronics nowadays come in those impossible-to-open plastic packages. A few weeks ago I tried to open one and managed not to slice my hand with the knife I was using. (Those who know me know that knives and I don't get along well.) Unfortunately, I failed to pay close attention to the sharp edges of the cut plastic and ended up cutting...

Do you need clean up one-shot timers?

The CreateTimerQueueTimer function allows you to create one-shot timers by passing the WT_EXECUTEONLYONCE flag. The documentation says that you need to call the DeleteTimerQueueTimer function when you no longer need the timer. Why do you need to clean up one-shot timers? To answer this, I would like to introduce you to one of my ...