When an email client receives a message with an attached file, the user can execute the file from within the client application or save the file to disk and execute the file outside the client application. Although Windows' treatment of the file can differ slightly depending on the execution location, the OS basically either loads and executes the file (if the file is a program file such as a .bat,.com, .exe, or .pif file) or loads the file in a program that's registered to handle the specified file type (in what is known as a file association). Windows comes with dozens to hundreds of preinstalled file associations, and programs can register file extensions at installation. For example, Microsoft Excel registers the .xls file extension and WinZip registers the .zip and .xxe extensions (among others). Each file association must be unique on each machine, but associations usually are universal across all Windows machines.
Windows' habit of registering file extensions to particular applications has caused no end of grief for programmers and security administrators. (WordPerfect needed to change its default DOS .doc file extension to .wpd in Windows-compatible versions because Windows associates that extension with Microsoft Word by default.) Most other sophisticated OSs provide better means for associating files with installed applications. For example, storing file-type information in a file’s header and using that information to instruct the OS which application to load is a better method. This method lets many applications use the same file extension or lets you rename a file to use any extension, without worrying whether the appropriate application will automatically recognize the file. The Internet is changing things for the better by eroding the importance of file extensions: Downloaded content often is associated with a particular program through a unique program identifier (e.g., a globally unique identifier—GUID—a class ID—CLSID).
You can reassociate any registered file extension to any application, but doing so takes extra effort and can cause unexpected problems unless you're careful to make sure that other installed programs don’t need the extension to work properly. Programs register file types under the HKEY_CLASSES_ROOT registry key (this information replicates under the HKEY_LOCAL_MACHINE\SOFTWARE\Classes subkey). You can view registered file types from a registry editor, as Web Figure A shows. You can also determine registered file types from within Windows Explorer: Look for the Folder Options or Options menu (the exact path differs slightly in each Windows version), then go to the File Types tab to see a list such as the one that Web Figure B shows. You can view more registered file types through a registry editor than you can through Windows Explorer, but manipulating registered file types is easier to do in Windows Explorer.