Search code examples
windowswinapiwindows-8registrycontrolpanel

settingcontent-ms file tag meaning


Windows 8 has a feature: it can launch an application from the search panel (on the right side of the screen). It works like following:

  • Developer registers his or her application following this instruction. It is a bit legacy instruction, but the project I participate in uses this way to register its settings.
  • At user logon Windows creates (if none exists) a special .xml file in C:\User\<UserName>\AppData\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\en-US with content shown below. This file has extension settingscontent-ms
  • As soon as user clicked on this file, the system launches the specified application (actually explorer calls for it, as I discovered by ProcMon).

Xml file content:

<?xml version="1.0" encoding="UTF-8"?>
<PCSettings>
    <SearchableContent xmlns="http://schemas.microsoft.com/Search/2013/SettingContent">
        <ApplicationInformation>
            <AppID>windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel</AppID>
            <DeepLink>%Canonical name or application path%</DeepLink>
            <Icon>%App path%,-%Resource number%</Icon>
        </ApplicationInformation>
        <SettingIdentity>
            <PageID>%GUID as in instruction above%</PageID>
            <HostID>{7E0522FC-1AC4-41CA-AFD0-3610417A9C41}</HostID>
            <Condition>shcond://v1#RegkeyExists;0;Regkey;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\%GUID as in instruction above%</Condition>
        </SettingIdentity>
        <SettingInformation>
            <Name>@%App path%,-%Resource number%</Name>
            <Description>@%App path%,-%Resource number%</Description>
            <HighKeywords>%App decription%</HighKeywords>
        </SettingInformation>
    </SearchableContent>
</PCSettings>

We can see node with the name HostID. Windows writes specified in code GUID to this node, but it breaks the ability of my application to work. If I try to execute my app through this "shortcut" by clicking on xml file or chosing my app in search panel, the system shows me a message: "Unspecified error".

When I manually change the HostID value to {12B1697E-D3A0-4DBC-B568-CCF64A3F934D}, it starts to wrk fine.

I looked through registry in order to find something about these two GUIDs, but I didn't find anything. Also I looked for the difference between registry values corresponding to my app and to another, but working, app and didn't find any significand differences too.

Also I tried to delete this file and login into the system under ProcMon, I caught some moments: explorer tries to open the file and fails with ERROR_FILE_NOT_FOUND, explorer creates missing file, reads registry and writes something to created file, then it closes the file. But I didn't find anything interesting in between of these messages, that can help me to solve my problem.

I found out that registry key HKEY_CLASSES_ROOT\CLSID\%App GUID%\System.ApplicationName contains exactly the same with DeepLink tag (it was the first error in my app - specified key was empty), but the proble with "wrong" HostID remains.

Does anyone know, what it is and how to make Windows to write the rigth GUID to this tag, or at least some useful info about this tag? I just can't imagine anything else to change, but I think, that I need to change something in corresponding to my app registry keys.


Solution

  • I found the solution: just put app's GUID (the same as in PageID) into DeepLink. To do this, you need to write this GUID as string value to HKEY_CLASSES_ROOT\CLSID\%App GUID%\System.ApplicationName.

    That's the solution. However, I haven't found the meaning of HostID tag :(