wixshortcutchm

Wix: How can I point `C:\Windows\hh.exe` as the source of the icon for my CHM-file shortcut?


I need to create the shortcut to my CHM-file. Its icon are to be gotten from the C:\Windows\hh.exe file. The Icon attribute requires an Id of component, but hh.exe is absent in my MSI because it always exists in the C:\Windows\ directory. Therefore it will not work:

<Component Id="Help_default" Guid="{BE58A822-637E-4B58-B2AC-690BA9FDF833}">
  <File Name="ProxyTools.chm" KeyPath="yes">
    <Shortcut Id="ProxyTools.exe" Directory="ProgramMenuDir" 
              Name="ProxyTools (English)" 
              WorkingDirectory='INSTALLDIR' Advertise="yes" Icon="hh.exe" IconIndex="0"/>
  </File>
</Component>

Maybe I am to point somehow the hh.exe like the item of

<Directory Id="WindowsFolder"/>

How can I point C:\Windows\hh.exe as the source of the icon for my CHM-file shortcut?

UPD

I added hh.exe into my WiX project and added this:

<Icon Id="hh.exe" SourceFile="hh.exe"/>

Now shortcuts is right.


Solution

  • Windows Installer does not make this possible. To understand the exact capability set, you must examine the underlying tables. First the Shortcut table Icon column is "The external key to column one of the Icon table." The Icon table contains a primary key (referred to by the shortcut table, among others) and a binary entry. The binary data is the icon data to use.

    Since the actual icon data must be stored in the resulting .msi database, and there are no alternate ways to specify an icon, you cannot refer to an icon that may already exist on the system. You can copy the desired icon into a resource of the Icon table, but that's as close as you can come with native Windows Installer functionality.