November 2004

WARNING: XP’s File Association Web Service May Be Dangerous to Your Organization’s Health

Getting into the “know enough to be dangerous” club just got easier for XP users
RSS
Subscribe to Windows IT Pro | See More Systems Administration Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Configuring File Associations for Users
For the OS shell to know which application to launch when you double-click a data file, two items must be defined: the file-extension key and the associated program class. Files are classified based on their extension (e.g., .doc, .xls), so files with the same extension are considered to be the same type or class. You can instruct the shell to open files of a given class with a specific application—this is known as association.

File-extension keys and program classes are stored in the registry in the HKEY_CLASSES_ROOT subtree. This subtree contains values from the HKEY_LOCAL_MACHINE\SOFTWARE\Classes subkey (which contains global settings) and the HKEY_CURRENT_USER\Software\Classes subkey (which contains individual user settings). If a value exists in both Classes subkeys, the user setting wins over the global setting.

You might be familiar with the GUI methods for associating a file type with a program. If you attempt to open a data file for which no association exists, you're presented with the Open With dialog box, which gives you the option of making your selected application the default association. You can also create file associations in Windows Explorer by selecting Folder Options on the Tools menu, then clicking the File Types tab. These methods are fine if you know what you're doing and you need to create the file associations on only a couple of systems. However, if you need to create file associations for a large group of users, you should familiarize yourself with two XP command-line tools: Assoc, which lets you create a file-extension key, and Ftype, which lets you create a program class.

Listing 1 demonstrates how to use these commands. The first line creates a file-extension key called .elog that has a value of CompanyName Text. In simple terms, Assoc is telling the OS shell that when it encounters a file with the .elog extension, it should refer to the CompanyName Text program class for instructions on how to open that file. The next two lines accomplish the same task for two other file extensions (i.e., .ref and .glo). Note that when you specify the program class name in Assoc and Ftype, you just need to use the friendly name. If necessary, you can elaborate on the name to avoid confusion by adding a period (.) followed by the qualifier (e.g., CompanyName Text.Logfile).

The last line in Listing 1 uses the Ftype command to create the CompanyName Text program class. The Ftype command accomplishes this task by creating the CompanyName Text subkey in the HKEY_LOCAL_MACHINE\SOFTWARE\Classes subkey. The value of the CompanyName Text subkey is the pathname of the executable file that will be used to open associated data files (in this case, C:\Program Files\Microsoft Office\Office\Winword.exe). The "%%1" parameter allows the data file to be passed to the executable as an argument; without that parameter, the application would open, but the data file that launched it wouldn't be loaded.

If you were to double-click a file with an .elog, .ref, or .glo extension after you ran the commands in Listing 1, Microsoft Word would open that file. You can add the Assoc and Ftype commands to a logon script or distribute the commands through other tools to provide consistent application usage among your users.

Note that the values you set using these commands will overwrite previous associations. So, if your users have made their own associations, you can still enforce your organization's standards. If you need to remove an association, it's easy to do so. For example, if you want to delete the .elog association, you'd run the command

Assoc .elog=

An Important Control
Although offering a Web-accessible repository of file extensions and possible associated applications is a noble concept, there are a few factors that make the file association Web service an unsatisfactory solution for end users and IT organizations. By disabling access to the file association Web service and configuring file associations for your users, you can head off frustration and wasted time for users and support staff alike.

Project Snapshot: How to
PROBLEM: If left enabled, XP's file association Web service can lead to frustrated users and numerous IT service calls.
WHAT YOU NEED: XP's built-in Assoc and Ftype command-line tools
DIFFICULTY: 2 out of 5
PROJECT STEPS:
  1. Block the file association Web service by adding an entry in the registry.
  2. Configure file associations for files commonly used within your environment.



End of Article

   Previous  1  [2]  Next  


Windows IT Pro Community
Blogs





Learning Path For more tips about how to customize XP, check out this article:
"“Awesome Windows XP Tips”"


If you need detailed information about how the file association Web service works in XP and Windows 2003, see the following articles:
"“Using Windows XP Professional with Service Pack 1 in a Managed Environment”"

"“Using Windows Server 2003 in a Managed Environment: File Association Web Service”"


Top Viewed ArticlesView all articles
No Jobs, No Excitement at Apple's Last Macworld Keynote

Apple CEO Steve Jobs made the right move in skipping out on his company's last appearance at Macworld: In a Tuesday keynote address at the conference, Apple had no interesting new products to sell, opting instead to spend mind-numbing amounts of time on ...

Where is Microsoft NetMeeting in Windows XP?

...

Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

Related Events Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Cloud Computing Forum: Integrating Software, Server and Storage as a Service into Your Enterprise IT Delivery Model

Virtualization Forum: Optimizing Storage, Networks, Desktops, and Security

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


SQL Server Magazine Office & SharePoint Pro Windows Dev Pro ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2009 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing