Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Mailbag: Can I set registry values directly instead of using RegisterMceApp.exe?

Mailbag: Can I set registry values directly instead of using RegisterMceApp.exe?

  • Comments 0

Question:

I have written a Windows Media Center application, and now I want to create an MSI-based installer for it.  I have looked at the WiX-based setup for the Q sample application in this blog post and in the Windows Media Center SDK for Windows Vista.  If possible, I would like to avoid creating a custom action in the MSI to run RegisterMceApp.exe to register the application with Media Center.  Is it possible to register my application with Media Center without creating a custom action?

Answer:

Yes, it is technically possible to register a Windows Media Center application without running RegisterMceApp.exe or the RegisterApplication API.  RegisterMceApp.exe performs the following activities to register an application with Media Center:

1.  Creates registry values under 3 specific sub-keys:

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Applications
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Categories
  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Media Center\Extensibility\Entry Points

Note - these values will be created under HKEY_LOCAL_MACHINE if the application is registered for all users by passing the /allusers switch to RegisterMceApp.exe.

2.  Calls an API to refresh the Windows Media Center UI if it is running at the time that the application is registered

It is possible to create an MSI that uses entries in the Registry table to create the same values that would be created by RegisterMceApp.exe in item 1 above.  You can use the following steps to accomplish this:

  1. Create an XML registration file for your application (see the link at the bottom of this post for more details about how to do this)
  2. Manually register the application by running RegisterMceApp.exe <path to XML file created in step 1 above> or RegisterMceApp.exe /allusers <path to XML file>
  3. Locate the registry values that are created by running RegisterMceApp.exe by looking in the sub-keys listed above
  4. Manually unregister the application by running RegisterMceApp.exe /u <path to XML file>
  5. Add the registry values that you located in step 3 above to the Registry table of your MSI

Please note that if you create these registry values directly in the Registry table of your MSI to register your Media Center application, you will lose the ability to automatically refresh the Media Center UI if it is running at the time that the MSI is installed.  However, you can avoid creating a custom action in your MSI to register your application with Media Center if you are willing to make this trade-off.

For reference, the following topics in the Windows Media Center SDK contain useful information about installing and registering Media Center applications:

I also want to emphasize one other point that is not covered above - in order for your Media Center application to appear correctly on Media Center extenders, you should register it for all users by creating registry values for it under HKEY_LOCAL_MACHINE or by running RegisterMceApp.exe with the /allusers switch.

Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post