Thursday 21 July 2011

Wise File association Tab

Every file association is linked with Programmatic Identifier (ProgID).
As you know, when we register a dll (a COM Object) normally the registration information is stored as CLSID, ProgID, TypeLib etc.
One ProgID can have different types of file associations.
For Eg: when you consider .doc extension its progid can be seen in the registry.
HKEY_CLASSES_ROOT\.doc Default Word.Document.8
Here Word.Document.8 is the ProgID. This is in fact a human readable representation of the CLSID. In this example it can be seen from registry as:
HKEY_CLASSES_ROOT\Word.Document.8\CLSID Default {00020906-0000-0000-C000-000000000046}
So in the above shown picture, the executable is AcroRd32.exe (main executable of acrobat reader) who’s progID is AcroExch.XDPDoc. This progID has one extension which is .xdp
Description section (Adobe Acrobat XML Data Package File) is the one that we see in Explorer, what type of extension it is.
Here you can see in the sample.xdp file there is a description which is "Adobe Acrobat XML Data Package File".
Icon is the tab for which we can give a suitable icon file for the extension.
Next tab is:
This is the place we specify the verbs associated with the extension. Verbs are nothing, but we specify all operation that can be performed with the file extensions. Normally this is what we see when we right click the file. Context menu items are the verbs. Here we have a verb called Read which tells it to Open with Adobe Reader 9.
We can have more than one verb item, like Open, Print, etc.
Each verb item should have a command to execute. That is when we click on the verb item (here it is Open with Adobe Reader 7.0) what action is to be performed.
Argument %1 means, the argument which is passed to the exe "Acrord32.exe".
Here this means: Acrord32.exe "sample.xdp"
  • %0 represents Acrord32.exe
  • %1 represents sample.xdp
So when we right click the file and say Open with Adobe Reader 9, the actual thing happening is, run the command Acrord32.exe "sample.xdp".
Now the third tab:
MIME types means, how this particular extension has to be represented in MIME standard. This is called "Multipurpose Internet Mail Extensions"
Normally SMTP protocol supports only 8 characters. To transfer image (any formats which cannot be represented using 8 characters) files through internet MIME defines a standard.
Every MIME type has a header and its content type.
Here the content type is: application/vnd.adobe.xdp+xml. It means the data is an application and its type is vnd.adobe.xdp+xml
What this means is, .xdp is not a well known format for internet transfer, hence it tells that it's a type of application which has a format of "vnd.adobe.xdp+xml".
In our packaging perspective, this will create following registry entries:
HKEY_CLASSES_ROOT\.xdp Content Type "application/vnd.adobe.xdp+xml"
HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/vnd.adobe.xdp+xml
Normally as per standard, when we keep files associated in the Extension table, we don't need to keep the corresponding entries of extensions in the registry table.
Why we are using the extension table?
This is for advertising the file association.
For example: Suppose we install Acrobat reader with /jm switch
Msiexec.exe /jm acrobat.msi
Here it won't really install the application, but it will put shortcuts of the application. And if we create a file "sample.pdf" and try to open, it will first install the application acrobat reader and it opens the file in that. This happening because we add .pdf in extension table.
Same way by instantiating an extension can install a feature also, if it is advertised (added in extension table) in MSI.

No comments:

Post a Comment