Playing with Extensions (How ?)
Filed under:
Wise Package Studio
Installation, Registry, Packaging
Submitted by umara on 20 August, 2008 - 09:06.
What it is a file extension?
A file extension tells the computer and user what kind of information is stored within a file.
The following figure will give you a general idea of file extensions:
How File Extensions Work
Let's see what role extensions play when we open a file.
- When user double clicks on a file Operating System searches for HKCR\ <.ext> key
- If OS finds extension is not registered then user is redirected to open with dialog
- If extension is registered then OS searches for the PROG ID.
- If PROG ID is available OS searches for the shell command in PROG ID
- If PROG ID is not available then OS searches shell command in HKCR\ <.ext>
- If shell command is available then file is opened using shell command
- If shell command is not available the user is redirected to open with dialog
Following Workflow will give the better idea:
Following figure shows PROG-ID and Shell command:
Now here;
- Files types are registered as file Extensions.
- Extensions are associated with a ProgID.
- The ProgID specifies the shell commands.
Let's see what the shell commands are...
Shell Commands are nothing but the Verbs defined in the Verb Table
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\<ProgID>\Shell\ HKEY_LOCAL_MACHINE\SOFTWARE\Classes\<ProgID>\Shell\<Verb>\ @="Display Name" Command\@ = "<Path to EXE> <Parameters>" Command\Command = "<WI Encrypted Value>" ddeexec\@ = "DDE Command" ddeexec\Application\@ = "App Name" ddeexec\Topic\@ = "Topic Name"
Scenario:
We have to create one extension .wrd which would open file with .wrd extension in Word
- Create a key under HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.wrd
- @ = Word.Document.8
So this is how it works!
(28 votes)
- Login or register to post comments
- 2289 reads
- Printer-friendly version





















special cases..
If your application uses special file extensions, you might want to register them so that the application gets started when the icon associated with the file gets double-clicked.
There are special tables for this in the MSI structure (Extension and ProgId). The contents of these tables are used for advertising. You can also make your own registry entries to create application-to-file-extension relations. This example shows how to register the .dvi extensions to be opened with the yap.exe program.
Link the extension .dvi to the DVI.Document class:
Key: HKLM\SOFTWARE\Classes\.dvi
Value: = "DVI.Document"
Describe the DVI.Document class:
Key: HKLM\SOFTWARE\Classes\DVI.Document
Value: = "DVI Document"
Select Icon #0 from yap.exe which is in the MSI:
Key: HKLM\SOFTWARE\Classes\DVI.Document\DefaultIcon
Value: = "[!yap.exe],0"
How to open the .dvi file if it is double clicked in the Explorer:
Key: HKLM\SOFTWARE\Classes\DVI.Document\shell\open\command
Value: = "[!yap.exe]" "%1"