Windows Confidential: History -- Gone and Forgotten
The death of the old Windows 95 saved-search file format Tips/Support went largely unnoticed.
When you used the Find Files dialog in Windows 95, you had the option of saving your search into a file so you could issue it again later. The extension for these saved searches was .fnd.
If you double-clicked one of these files, it would open the Find Files dialog and execute your saved search. You may have noticed that these *.fnd files stopped working in Windows 7. Support for them also died, but in an unusual way.
When anyone floats the idea of dropping support for a file format, Microsoft conducts extensive research into how many people are still using that type of file. The idea is to determine how severe a problem it will be to remove support.
Nowadays, the mechanism for this process is more formalized. Part of the deprecation process involves adding instrumentation to Windows to determine how many customers are still using whatever file format is on the chopping block. (To make your voice heard, participate in the Customer Experience Improvement Program.)
Death of a File
The death of the *.fnd file format followed a non-standard route, however. You see, we ran an accidental experiment 10 years ago. Windows 2000 inadvertently broke backward compatibility with saved searches created on earlier versions of Windows. The surprising thing is that nobody outside Microsoft even noticed. This strongly suggested that very few customers actually used saved searches. Obviously, this is not the way you want to find out this information, but it’s good information to have.
Windows Vista introduced a new saved-search format. If you opened an old *.fnd file, it auto-converted that file to the new format. If you saved it back out, it was saved in the new format. Further investigation revealed that nobody was using *.fnd files. Well, almost nobody.
You see, there’s one program that uses *.fnd files. It only uses them in one place, and the way it uses them relies on an error path. This program wants to open the Find Files dialog. This program doesn’t call the SHFindFiles function and pass NULL for the pidlSaveFile, though. It uses ShellExecute to locate a special *.fnd file included with the application. This could be a *.fnd file created by opening a blank search window and saving it, but that’s too easy. Instead, the program passes a zero byte *.fnd file to the ShellExecute function.
The handler for *.fnd files passes the file off to SHFindFiles as the second parameter. This is a circuitous way of calling SHFindFiles with the zero byte *.fnd file. The Find Files dialog opens, and it sees it was given a file from which to restore its state. As it turns out, a zero byte file is not a valid *.fnd file. The Find Files dialog tries to restore its state, but it can't.
The result: The Find Files dialog appears on the screen in its default state. This is a roundabout way of doing a simple thing. Intentionally passing invalid data and relying on the particulars of how to handle the error case does the trick.
Hey, It Works
In Windows 7, Microsoft removed the code to convert *.fnd files to *.search-ms files. Now, all *.fnd files passed to SHFindFiles are treated as if they’re corrupted and result in a default search window.
What if you have a directory filled with old saved searches from Windows XP? You can convert these by loading them into Windows Vista and then saving them back out. The saved versions will be in the new *.search-ms format, which you can then use with your Window 7 machines.