The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

I thought I was so clever, salvaging an old floppy drive from a dead computer, but I didn't think *two* steps ahead…

When one of the oldest computers at Microsoft still doing useful work finally died, I had the presence of mind to salvage the 5¼″ floppy drive from the machine, so that I could (someday) extract the data off all the old 5¼″ floppy discs I have packed away in boxes meaning to convert someday. (Mind you, the data capacity of a giant box of 5¼″ floppy disks is approximately equal to half of a CD.) Oh, and by the way, if you know what a floppy drive is, then this question on superuser.com will make you feel old. I thought I was so clever, salvaging an old floppy drive fro...

Why are programs allowed to use normal characters as hotkeys?

alv wonders why programs are allowed to create hotkeys for normal characters. The example given is the famous AltGr modifier, equivalent to Ctrl+Alt. Programs which ignore the guidance and use Ctrl+Alt as a shortcut modifier end up stealing keys from many non-English keyboard layouts, thereby preventing users from typing things like the Euro sign € (which is an AltGr combination on most keyboards that support it), or even worse, preventing Polish users with the Polish programmer keyboard layout from typing the letter Ż. Given that using Ctrl+Alt as a keyboard shortcut modifier can prevent people fro...

What does INIT_ONCE_CTX_RESERVED_BITS mean?

Windows Vista adds the One-Time Initialization family of functions which address a common coding pattern: I want a specific chunk of code to run exactly once, even in the face of multiple calls from different threads. There are many implementations of this pattern, such as the infamous double-checked lock. The double-checked lock is very easy to get wrong, due to memory ordering and race conditions, so the kernel folks decided to write it for you. The straightforward way of using a one-time-initialization object is to have it protect the initialization of some other object. For example, you might have it pr...

Why don't I get a Caps Lock warning balloon any more?

A customer asked for help diagnosing a problem they were experiencing on Windows XP: My customer reports that on their machines, they do not get the warning balloon that appears when Caps Lock is set while you are typing into a password field. I searched for relevant KB articles but couldn't find anything related to that. Can you help? Time for the psychic powers. My psychic powers tell me that the customer disabled all balloon tips. The customer liaison replied You are right. Thanks for the help. This is a not uncommon situation with some customers. They change a setting, and then later report tha...

Why doesn't the Version tab show up for very large files?

If you have a really large file and try to view its properties in Explorer, you may find that the Version tab doesn't appear. What's going on? The Version tab uses the family of functions to obtain version information from files. It so happens that the function works by calling and then using functions like to locate the version resource so it can allocate a buffer to hold the version resource plus additional data to assist in character set translation. If the file is larger than the available address space in the Explorer process, then the call to will fail due to lack of address space into which to map ...

There's the kernel, and there's kernel mode – confusing historical terminology

A few weeks ago, I mentioned that the kernel folks decided not to expose bonus bytes to applications. Some people were confused by this statement, not for what it said, but for what it implied. "Wait, you're telling me that the heap is implemented in kernel mode?" Let's turn the clock back to 1983. The core components of Windows fell into three categories: Windows 1.0 ran on the 8086, which had no concept of CPU modes or memory protection or any stuff we take for granted nowadays. Everything ran in a single mode, and since there was only one mode, it didn't have a name. Although future versions of Win...

Why do we need IsDialogMessage at all?

alv wonders why we need the function at all. "All its activity could take place inside the window procedure of the modeless dialog itself", since when it doesn't have focus, it shouldn't be responding to messages anyway. Sure, that works great if the modeless dialog has focus. But it almost never does. What has focus is a control inside the modeless dialog. And in that case, the modeless dialog never sees the message, since the rule is that keyboard messages go to the window with focus. And that ain't the modeless dialog box. Consider, for example, a message box with OK and Cancel buttons. Focus defaults to t...

You already know the answer since you do it yourself

A customer was writing a program that performed virtual drag/drop. They were using the technique but found that many applications don't support drag/drop of virtual content. They support only . What's more, often these applications query for on not because they want to access the file, but just because they want to get the file names (for example, because they want to put up the no-entry cursor if the file types are not ones the application supports). Given that we want to be able to drop content onto applications which do not support drag/drop of virtual content, we have the problem of knowing exactly when ...

What is the real maximum length of a DNS name?

It's 255, but you have to count it the right way.