views:

211

answers:

1

I am writing an installer using Wix 3 which installs a plugin to a 3rd party application. The application uses a group of registry keys to detect installed plugins. Each plugin is required to add a new subkey with a numerical name from 0-9 to the HKEY_LOCAL_MACHINE\SOFTWARE\Vendor\App\Plugins. The key contains a single string value which is the ProgId of a COM component which the application will instantiate. So for example I would need to add the following key to install my plugin:

HKEY_LOCAL_MACHINE\SOFTWARE\Vendor\App\Plugins\0
  REG_SZ   ProgId    "MyCompany.MyPlugin"

However, if the 0 key already exits, my installer needs to be smart enough to create key 1 instead of 0 and on down through key 9. Is there a way to achieve this using the Wix syntax? I know I can write a custom action to do this, but if at all possible I would like to avoid it.

+2  A: 

You could use RegistrySearch to find the first empty value. But it would be easier to use the approach I describe at http://www.joyofsetup.com/2007/07/01/semi-custom-actions/.

Bob Arnson
Thanks for the answer that was very slick and helpful. Just one question, in the post the last parameter passed to `WcaAddTempRecord` is `wzComponent`. Is this supposed to be the ID of a component already in my Wix files or should I use `WcaAddTempRecord` to add a new component to the component table specifically for my registry entry? Thanks again!
heavyd
It should be an existing component that controls whether the registry values are written.
Bob Arnson