The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Dec 10, 2012
Post comments count 0
Post likes count 0

I'll tell you what I think of the new University of California logo once it finishes loading

Raymond Chen

Dec 10, 2012
Post comments count 0
Post likes count 2

Why do some shortcuts not support editing the command line and other properties?

Raymond Chen

Ben L observed that some shortcuts do not permit the command line and other options to be edited. "Where is this feature controlled? Is there a way to override this mode?" This question is echoed by "Anonymous (Mosquito buzzing around)" (and don't think we don't know who you are), who in a huge laundry list of questions adds, "Why does the Game Explorer limit customizing command line, target, etc?" These questions are looking at the situation backwards. The issue is not "Why do these shortcuts block editing the command line?" The issue is "Why do some shortcuts allow editing the command line?" Recall that ...

Dec 7, 2012
Post comments count 0
Post likes count 2

It rather involved being on the other side of this airtight hatchway: Writing to the application directory

Raymond Chen

We received a security vulnerability report that went roughly like this: There is a security vulnerability in the X component. It loads from the current directory, thereby making it vulnerable to a current directory attack. Here is a sample program that illustrates the problem. Copy a rogue into the current directory and run the program. Observe that the rogue is loaded instead of the system one. If you actually followed the instructions, what you saw depended on your definition of "run the program." Let's assume that the program has been placed in the directory . Setting the current directory to t...

Dec 6, 2012
Post comments count 0
Post likes count 1

Replaying input is not the same as reprocessing it

Raymond Chen

Once upon a time, there was an application that received some input and said, "Okay, this input cancels my temporary state. I want to exit my temporary state, but I also want the input that took me out of the temporary state to go to whatever control would have received the input if I hadn't been in the temporary state in the first place." (For example, you might want the input that dismisses a pop-up window to be acted upon rather than eaten by the pop-up.) The application decided to solve this problem by regenerating the input message via , so that it goes back into the input queue. The theory, is that when the...

Dec 5, 2012
Post comments count 0
Post likes count 1

Why do I get notified for changes to HKEY_CLASSES_ROOT when nobody is writing to HKEY_CLASSES_ROOT?

Raymond Chen

A customer had a question about the function. We are using it to monitor the tree as follows: If I understand the documentation correctly, this registers for notifications when subkeys are added, deleted, or when values are changed. However, it seems that my event becomes signaled at many other times, for example, when I switch folders in an Explorer window. I fired up Process Monitor and confirmed that nobody (not even Explorer) is writing to . Why are we getting spurious notifications? Have we misunderstood what this function does? Everything is working as expected; it's just that your expectation...

Dec 4, 2012
Post comments count 0
Post likes count 1

The QuickCD PowerToy, a brief look back

Raymond Chen

One of the original Windows 95 PowerToys was a tool called QuickCD. Though that wasn't its original name. The original name of the QuickCD PowerToy was FlexiCD. You'd think that it was short for "Flexible CD Player", but you'd be wrong. FlexiCD was actually named after its author, whose name is Felix, but who uses the "Flexi" anagram as a whimsical nickname. We still called him Felix, but he would occasionally use the Flexi nickname to sign off an email message, or use it whenever he had to create a userid for a Web site (if Web sites which required user registration existed in 1994). You can still see rem...

Dec 3, 2012
Post comments count 0
Post likes count 1

Have you found any TheDailyWTF-worthy code during the development of Windows 95?

Raymond Chen

Mott555 is interested in some sloppy/ugly code or strange workarounds or code comments during the development of Windows 95, like "anything TheDailyWTF-worthy." I discovered that opening a particular program churned the hard drive a lot when you opened it. I decided to hook up the debugger to see what the problem was. What I discovered was code that went roughly like this, in pseudo-code: The code enumerated every file in the system directory, Windows directory, Program Files directory, and possibly also the kitchen sink and their uncle's kitchen sink. It tries to load each one as a library, and sees ...

Nov 30, 2012
Post comments count 0
Post likes count 1

The debugger lied to you because the CPU was still juggling data in the air

Raymond Chen

A colleague was studying a very strange failure, which I've simplified for expository purpose. The component in question has the following basic shape, ignoring error checking: There are two parts of the object. One part that is essential to the object's task, and another part that is needed only when updating. The parts related to updating are expensive, so the object sets them up only when an update is active. You indicate that an update is active by calling , and you indicate that you are finished updating by calling . There are a few race conditions here, and one of them manifested itself in a cras...

Nov 29, 2012
Post comments count 0
Post likes count 1

Various ways of performing an operation asynchronously after a delay

Raymond Chen

Okay, if you have a UI thread that pumps messages, then the easiest way to perform an operation after a delay is to set a timer. But let's say you don't have a UI thread that you can count on. One method is to burn a thread: Less expensive is to borrow a thread from the thread pool: But both of these methods hold a thread hostage for the duration of the delay. Better would be to consume a thread only when the action is in progress. For that, you can use a thread pool timer: The timer queue timer technique is complicated by the fact that we want the timer to self-cancel, so it needs to know its handle,...