image provider

Associations Editor


Disclaimer

This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

The Goal

The goal is to:

Existing Tools

In W95, W98, Me, NT, W2K, XP, W2003, Vista, W2008, W7-32, W7-64, W8-32, W8-64, W2012, W10-32 and W10-64 you can associate a given file extension with a program or programs to process it. The editor that comes with Windows is clumsy for four reasons:

  1. You can’t see the extensions themselves, just the preposterous external names that Microsoft and their ilk have assigned to them.
  2. When you go to set up an extension, you must find it by name, not by extension. If you set up an extension that already exists, your work is discarded. You can’t even sort them alphabetically by name or extension.
  3. To set up DDE (Dynamic Data Exchange) links you must know mysterious commands that no human has a right to know.

So the first order of business is to get the extensions named back to something sensible, possibly beginning with the extension itself. That might be sufficient. If you want to go further, here is what to do:

  1. Allow you to sort by name or extension.
  2. When you switch an association to a different program, don’t discard the information about how to set up the DDE to the first one, in case you ever want to restore it.
  3. Set up some DDE links for common programs automatically. All you need do is select the program from a list of likely candidates.
  4. Wherever possible don’t force the user to go chasing all over the disk to find the apps. Find them for him and let him select from a list.
  5. Allow the user to add an extension not already in the registry.
  6. The editor no longer exists in W10-32 and W10-64.

Registry Format

Just how is this information stored in the registry? Each extension is associated with four different names. Ironically, even though an extension in practice can have more than one use, the only name that is guaranteed unique in the registry is the extension. Starting with the extension you can find the three other names. For example consider the extension ( .exe ), you can find the MIME (Multipurpose Internet Mail Extensions) type ( application/x-msdownload ) and the internal name ( exefile ). With the internal name, you have a link to find the external name ( application ) and the various associated actions (e.g. open ) for the applications. The invisible internal name is the glue between the extension and the set of actions (descriptions of how the associated applications launch). It is actually somewhat simpler than it looks from casual observation of the registry with regedit.exe. This entire information is duplicated in HKEY_CLASSES_ROOT and HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ in Microsoft’s usual scheme of redundant inheritance.

Starting W2K, class registration and file extension information is stored even more redundantly under the HKEY_CURRENT_USER\Software\Classes key as well, ironically with the intent of making the registry more compact. The HKEY_LOCAL_MACHINE\Software\Classes key contains default settings that can apply to all users on the local computer. The HKEY_CURRENT_USER\Software\Classes key contains settings that apply only to the interactive user. The HKEY_CLASSES_ROOT key provides a view of the registry that merges the information from these two sources. See the Microsoft Documentation.

How Windows Stores Extension Associations
Name Example Where Defined Where Referenced
Extension .exe HKEY_CLASSES_ROOT\.exe none
Internal Name exefile HKEY_CLASSES_ROOT\exefile(Default) HKEY_CLASSES_ROOT\.exe
Mime Type application/x-msdownload HKEY_CLASSES_ROOT\.exe(Content Type) none
External Name Application HKEY_CLASSES_ROOT\exefile(Default) none
Action open HKEY_CLASSES_ROOT\exefile\shell\open none

Editing the Registry

Trace a few examples to get the idea. There are many exceptions to the general rules. Just search the registry for relevant strings to find the many places associations are recorded. Some entries, such as exefile, are marked non-editable via the Disk Explorer. Experiment editing some unimportant extension. Registry editing in general is delicate brain surgery. If you screw up the registry you won’t be able to boot your system to restore from a backup. Further, even if you could boot, you can’t restore the registry file since it is in use! Restoring it requires special techniques. See backup. See registry for hints on tools to use.

How Associations Should Work

The second half of this project is work out a replacement for the extension scheme, something that might be used in a sane OS (Operating System), such as ROS. The associations must be much simpler, secure and automatic than in Windows.

Every file has a unique type, similar to MIME, but properly unique, more like Apple’s file type registering scheme. IANA would likely oversee it. Vendors can also create new private file types within their single registered DNS (Domain Name Service) domain, without needing to centrally register them. (In contrast, currently, the same extension in Windows may be used for several totally unrelated formats, e.g. *.doc, deliberately sowing confusion. )

Vendors can register their applications to handle given file types. They can’t unregister other vendors. The originator of a file type must provide a comb program. This studies the file and decides if it is logically consistent. ROS (Roving OS) invokes the comb any time two different vendors operate on the same file. In addition, a vendor may supply his own comb that protects him from rival vendors mucking up the file layouts. ROS also uses the combs when it has nothing better to do to ensure file integrity.

When an application is activated/installed, the OS adds that application to the right click menus on all the files it can process. It does not hijack any current application’s associations. If the user starts to mainly use the new program, its will percolate up the menu. It works by a lazy MRU (Most Recently Used) ordering scheme so that the menu order does not change frequently. The user can freeze menus or manually reorder them.

Users never manually create associations or break them. They merely temporarily hide them from their menus.

In ROS, the associations are self healing. When it has nothing better to do, the OS does a level 1 diagnostic, monitoring their integrity and automatically repairs them if they become damaged.

You might attempt to retrofit some of these features into Windows by maintaining a robust parallel associations database that is used to repair the Windows one.

Utilities

PC (Personal Computer) Mag has one available with source called ContextEdit. It does not deal with the OpenWithList and PersistentHandler options in the registry. It does not give you the ability to order the open, edit, print etc. options. And finally, it is full of technobabble e.g. %1 DDE, &Edit. It needs a veneer put on it so that it could be used by an ordinary human. It presumes you already know how to edit the registry directly and this is primarily a tool to make it easier by finding the parts for you.

I used to have a utility called Creative Element Powertools. Unfortunately, it is no longer sold and it does not work on W10-32 and W10-64.

There are two old built-in cmdline tools ASSOC and FTYPE or the combined tool associate available here or here.

associations java glossary entry
extensions
fileinfo.com: database of file extensions
Filext.com: database of file extensions, MIME types and identifying signatures
MIME
registry
TenForums: how to repair associations in the registry

This page is posted
on the web at:

http://mindprod.com/project/association.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\project\association.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[54.204.198.71]
You are visitor number