The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

Oct 10, 2012
Post comments count 0
Post likes count 1

Why does Windows Compressed Folders (Zip folders) reject paths that begin with a slash?

Raymond Chen

A customer asked, "Does NTFS support files with a null string as the name?" No, NTFS does not support files with no name. None of the commonly-used Windows file systems do. Files must have a name. But what a strange question that is. The customer was kind enough to explain why they cared. "We have a zip file that the Compressed Folders (Zip folders) feature that comes with Windows cannot deal with. When we try to extract the contents of the zip file, we get the error message 'Windows has blocked access to these files to help protect your computer.' We've attached a copy of the file." The Compressed Folders fun...

Oct 9, 2012
Post comments count 0
Post likes count 1

Usage guidance for a popcorn machine in the kitchenette

Raymond Chen

My colleague KC Lemson tipped me off to a sign hanging next to a popcorn machine in one of the kitchens: A friend of mine happened to have a chat with a fire fighter who used to be assigned to the fire station nearest to Microsoft main campus. According to him, the top three reasons for being called to a Microsoft building are (in no particular order) This week is Fire Prevention Week.

Oct 8, 2012
Post comments count 0
Post likes count 1

How does Explorer deal with recent files that were renamed?

Raymond Chen

Roni wonders how Explorer manages to keep track of files that were moved or renamed. Specifically, "opening a shortcut to a renamed file actually updates the shortcut's destination and opens the renamed file. How is this done? Is it an NTFS feature?" This feature has been around since Windows 95. If the target of a shortcut no longer exists, the shell tries to resolve the shortcut; i.e., find the object, wherever it ended up moving to. As I explained several months before the question was posted, the algorithm used by the shell varies depending on the operating system and the file system and your domain p...

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

How do I override the default icon selection algorithm?

Raymond Chen

The usual way of loading an icon from a resource is to use the or function and letting the window manager's icon selection algorithm decide which image to use based on the images available in the icon, the desired icon size, and the current color depth. A customer wanted to override that algorithm, because the window manager uses the current display color depth to select an image, but they were obtaining the icon for printing purposes, so they wanted to get the highest-color-quality icon rather than the one that matched the screen's color depth. How do you override the default algorithm? You basically do the...

Oct 4, 2012
Post comments count 0
Post likes count 0

An unexpected application of negative numbers to gift-giving

Raymond Chen

A college classmate of mine informed me that one of his colleagues had planned his wedding so far in advance that on his negative-first anniversary (i.e., precisely one year before his anticipated wedding date), he gave paper to all of his friends. Said my classmate, "It's too bad that neither of us had been born on his −50th anniversary. That would have been more lucrative."

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

Why does RegOpenKey sometimes (but not always) fail if I use two backslashes instead of one?

Raymond Chen

A customer reported that on Windows XP, they observed that their program would very rarely get the error when they passed two backslashes instead of one to the function: After removing C++ escapes, the resulting string passed to is The failure was very sporadic and not reproducible under controlled conditions. Well, first of all, doubled backslashes are not legal in registry key paths in the first place, so the first recommendation is stop doubling the backslashes. Once you fix that, the problem will go away. But the next question is why the error was detected sometimes but not always. When a...

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

How do I suppress the default animation that occurs when I hide or show a window?

Raymond Chen

A customer wanted to know how they can disable the default fade-in/fade-out animation that occurs when a window is hidden or shown. "I don't want to use because that causes my window to disappear from the taskbar. I tried but that affects the entire desktop and is too jarring. We want to suppress the effect because our program replaces one window with another, and we want the operation to be invisible to the user." Whoa, heading straight for ? That's using a global solution to a local problem. To disable the animations on a specific window, use something like this: Re-enabling the animations is left as ...

Oct 2, 2012
Post comments count 0
Post likes count 1

Microspeak: Granular

Raymond Chen

Today's Microspeak word is granular. Here are some citations. Please bring your cost estimates at the granularity of 3, 5 or 10 days. The archive function archives all data older than the date specified. Is there a way to get the archive to be more granular than just a date? Our database covers multiple accounts, and we'd like to choose a different date for each account. There are about 2000 warnings to be investigated. I've assigned them at component granularity. Granularity is roughly equivalent to level of detail or unit of separation. In the first example, the cost estimates should be broken down int...

Oct 1, 2012
Post comments count 0
Post likes count 1

What's the difference between F5 and F8 at the boot screen?

Raymond Chen

Ian B wondered what the difference is between pressing F5 and F8 while Windows is booting. I have no idea either. My strategy was to just mash on the function keys, space bar, DEL key, anything else I can think of. Keep pressing them all through the boot process, and maybe a boot menu will show up. The F5 hotkey was introduced in Windows 95, where the boot sequence hotkeys were as follows: Man, that's an insane number of boot options all buried behind obscure function keys. Boy am I glad we got rid of them. This frees up room in my brain for things like Beanie Baby trivia. Bonus chatter: The next gen...