The Old New Thing

Practical development throughout the evolution of Windows.

Latest posts

How do I set an accessible name on an unlabeled control?
Oct 13, 2011
Post comments count 0
Post likes count 0

How do I set an accessible name on an unlabeled control?

Raymond Chen
Raymond Chen

A customer asked for advice on accessibility. This was great news, because it meant that somebody actually cared about accessibility! We have a property sheet page that contains an unlabeled list view. The list view is not labeled because its meaning is implied by its placement on the dialog. This works great as long as you can see the screen, but we also need to associate an accessible name to the list view so that screen readers know what it is. We tried on the list view, but accessibility didn't pick it up. How do I set the accessibility name on the control? Place a static control immediately ahead of the...

Is there a 2048 character limit for OFN_ALLOWMULTISELECT in MFC or isn't there?
Oct 12, 2011
Post comments count 0
Post likes count 0

Is there a 2048 character limit for OFN_ALLOWMULTISELECT in MFC or isn't there?

Raymond Chen
Raymond Chen

The MFC documentation for contains the following strange warning: When the user allocates their own buffer to accommodate , the buffer can't be larger than 2048 or else everything gets corrupted (2048 is the maximum size). The sudden informality of the phrase "or else everything gets corrupted" is surprising but also sounds vaguely familiar to me. I think I was the one who wrote that phrase over a decade ago as part of my investigation into a defect in the common dialog functions. Somebody must have forwarded my analysis to the MFC documentation team (since the problem was originally in an MFC application), ...

Microspeak: Bug jail
Oct 11, 2011
Post comments count 0
Post likes count 0

Microspeak: Bug jail

Raymond Chen
Raymond Chen

Bug jail is not a place where bugs are sent as punishment for their crimes. Rather, it's a (virtual) place that developers are sent when they have too many bugs. Project management establishes some maximum number of bugs (known as a bug cap) each developer is permitted to have on his or her plate, and developers whose bug count exceeds the specified maximum are placed in bug jail. The precise triggers for bug jail vary from team to team, and it may vary based on the nature of the bug. For example, one trigger might be that any Priority 0 bugs more than 24 hours old will land you in bug jail. Once you lan...

Why does copying a file to my USB thumb drive say that the parameter is incorrect?
Oct 11, 2011
Post comments count 0
Post likes count 0

Why does copying a file to my USB thumb drive say that the parameter is incorrect?

Raymond Chen
Raymond Chen

Consider the following sequence of operations, assuming that F: is a USB thumb drive with plenty of disk space. Why is the second file copy failing? The hint is the file extension: *.iso, which suggests that this is a CD or DVD image, and DVD images have the feature that they tend to be really big. Like more than 4GB big. USB thumb drives tend to be formatted with the FAT32 file system rather than with NTFS. And FAT32 has a maximum file size of 4GB minus one byte. The user confirmed that the file was larger than 4GB and that the USB thumb drive was formatted as FAT32. Mind you, the error message ...

How do I access a file without updating its last-access time?
Oct 10, 2011
Post comments count 0
Post likes count 0

How do I access a file without updating its last-access time?

Raymond Chen
Raymond Chen

The first problem with discussing file last-access time is agreeing what you mean by a file's last-access time. The file system folks have one definition of the file last-access time, namely the time the file was most recently opened and either read from or written to. This is the value retrieved by functions like , , and . The problem with this definition is that it doesn't match the intuitive definition of last-access time, which is "the last time I accessed the file," emphasis on the I. In fact, the intuitive definition of access is more specific: It's "the last time I opened, modified, printed, or otherw...

During process termination, slim reader/writer locks are now also electrified
Oct 7, 2011
Post comments count 0
Post likes count 0

During process termination, slim reader/writer locks are now also electrified

Raymond Chen
Raymond Chen

Some time ago I mentioned that during process termination, the gates are now electrified: If you attempt to enter a critical section that is owned by a thread that was terminated by an earlier phase of process termination, the entire process is forcibly terminated. Windows Vista introduced a new lightweight synchronization pseudo-object known as the slim reader/writer lock. And if you tried to enter a slim reader/writer lock during process termination and found yourself waiting for the current owner to release it, you ended up waiting forever since the current owner was terminated by an earlier phase of proce...

Why can't I move the Program Files directory via the unattend file?
Oct 6, 2011
Post comments count 0
Post likes count 0

Why can't I move the Program Files directory via the unattend file?

Raymond Chen
Raymond Chen

We saw last time that the unattend file lets you change some Windows configuration settings that cannot be changed after Setup is complete. But one of the things you can't change is the location of the Program Files directory. Many people wish they could relocate their Program Files directory to another drive in order to relieve disk space pressure on the system partition. Why won't Windows let them do this? Now that NTFS is mandatory for the system volume (it took only 13 years to get there!), Windows itself can start taking advantage of NTFS features. For example, Windows Update can take advantage of transa...

The unattend file lets you configure Windows while it's installing, and in some cases it's your only chance
Oct 5, 2011
Post comments count 0
Post likes count 0

The unattend file lets you configure Windows while it's installing, and in some cases it's your only chance

Raymond Chen
Raymond Chen

Some Windows settings can only be established as part of the installation process. This is done with a so-called unattend file. (Remember, no matter where you put an advanced setting, somebody will tell you that you are an idiot.) In earlier versions of Windows, the unattend file took the form of an INI file, but Windows Vista hopped aboard the XML bandwagon, and the unattend file format changed to XML. The nice thing about using XML is that you can publish a schema so people can validate their unattend file without having to perform a test install (only to discover twenty minutes later that a typo resulted...

Beyoncé, the giant metal chicken has a Facebook page
Oct 4, 2011
Post comments count 0
Post likes count 0

Beyoncé, the giant metal chicken has a Facebook page

Raymond Chen
Raymond Chen

In my 2011 mid-year link clearance, I linked to the story And that's why you should learn to pick your battles. I thought that was the end of the story, but no, it's the gift that keeps on giving. Beyoncé, the giant metal chicken has a Facebook page, populated with all sorts of crazy things like pictures of Beyoncé's relatives spotted in the wild (some of them knocking on doors or peeking in windows), a No Soliciting sign just for giant metal chickens, and an updated version of the chart of anniversary gifts which lists BIG METAL CHICKEN as the modern 15th anniversary present.