Geoff Chappell - Software Analyst
Instances of the Unknown ProgID type of assocation element are created by passing the corresponding CLSID to the AssocCreateElement function:
CLSID_AssocUnknownProgidElement | {E337427C-C96D-4183-9C00-B7B8671DF7B5} |
As with all assocation elements, the Unknown ProgID element implements the IAssociationElement, IObjectWithQuerySource and IPersistString2 interfaces. However, all the methods of an Unknown ProgID element are the same as for the basic ProgID element except for SetString and GetClassID. In effect, an Unknown ProgID element is just a ProgID element with a specified query source.
When an Unknown ProgID element is initialised through its SetString method, its ProgID is necessarily Unknown. The registry key that is used as the query source is:
Key: | HKEY_CLASSES_ROOT\Unknown |
Here, Unknown is the string data from the following registry value:
Key: | HKEY_CLASSES_ROOT\Unknown\CurVer |
Value: | default |
Type: | REG_SZ or REG_EXPAND_SZ |
If this value cannot be read or is empty, which it typically is, then Unknown defaults to Unknown. If the Unknown key does not have a shell subkey that can be opened for reading but the Unknown key does, then Unknown is just Unknown.
The initialisation string is not irrelevant, however. It provides the element with a secondary query source when queries 0x80070002 and 0x81470002 are put to the QueryString or QueryGuid methods:
Query | Key | Value |
---|---|---|
0x80070002 | HKEY_CLASSES_ROOT\InitString | Content Type |
0x81470002 | HKEY_CLASSES_ROOT\Unknown\ShellEx\extra
HKEY_CLASSES_ROOT\InitString\ShellEx\extra |
default |
where extra is provided as the second argument to the query method and InitString is whatever was passed to SetString when initialising the element. Query 0x80070002 is valid only for ProgID elements and is answered only from the secondary query source. For query 0x81470002, if the query cannot be answered from the Unknown key it is answered instead from the InitString key.