MsiAdvertisedShortcuts

An MSI Advertised shortcut can be created with msiexec.exe using /j[u|m] foo.msi. Instead of installing the contents of the MSI database file, MSI "advertises" it using an undocumented interface of shell32.dll's ShellLink object.

MSI Advertised shortcuts are a special kind of shortcut file (.lnk). These "Advertised" shortcuts do not point to an executable or other file, but instead cause shell32.dll to invoke the Microsoft Installer via an undocumented MSI interface. They have a different binary format to normal shortcut files, and cannot be edited on the Windows desktop. (Try clicking on the properties of a Word 2000/XP icon in Windows.)

These shortcuts are created by through ShellLink's IShellLink interface by calling SetPath with a specially formatted path parameter. MSDN says nothing about this feature. It works like this:

   1 HRESULT make_advertised_shortcut( IShellLinkA *sl )
   2 {
   3     char str[200];
   4 
   5     /* add the product id tag and product id guid, this only works on XP/2003 and below */
   6     strcpy(str,"::{9db1186f-40df-11d1-aa8c-00c04fb67863}");
   7     strcat(str,":{00010409-78E1-11D2-B60F-006097C998E7}");
   8 
   9     /* add the component id tag and component id, works on Vista and higher too */
  10     strcat(str,"::{9db1186e-40df-11d1-aa8c-00c04fb67863}");
  11     strcat(str,":26,!!gxsf(Ng]qF`H{LsACCESSFiles>plT]jI{jf(=1&L[-81-]");
  12 
  13     /* add the terminator */
  14     strcat(str, "::");
  15     return sl->SetPath( str );
  16 }

In the string "str" above, the colon characters are separators. The GUIDs starting with {9db...} are tags, and identify the fields. The second GUID {00010409-...} is the product ID of Microsoft Office 2000. The string starting with 26,... is a component identifier. The first and 20 characters are a GUID encoded in base 85, and the middle portion, up to the > character is the feature identifier. For Windows versions below Vista you can include both the product id and the component id, but Vista and higher don't accept a path that contains the product id tag/guid. All versions accept a path consisting of just the component id tag and component id.

The IShellLinkDataList is the interface that is used to store and fetch the MSI advertised information.

MsiAdvertisedShortcuts (last edited 2009-09-02 23:35:56 by GeVanGeldorp)