LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

distribution kit registry entries rewrite semantics

I'm using CVI 8.0.1 distribution kit to establish registry entries. 

I share a registry entry between two different applications, either or both of which might be present on the system.

I'd like for the behavior to be that if a registry value already exists, don't rewrite it.  It looks to me as if it'll rewrite it no matter what now.

Isn't this different behavior from regedit? 

Is there some way to control this behavior?  Are the registry entries in the .msi file?  Do I need to get into the msi file and diddle a flag to get the behavior I want?

Menchar

0 Kudos
Message 1 of 4
(3,258 Views)
Yes, the installer will always (over)write the keys/values specified in the distribution.  I'm not sure what you mean by "different from regedit".  If you are referring to importing a .reg file, then regedit, too, overwrites existing values.

Conditionally writing the registry value is not nearly so simple as setting a flag.  You must put a condition on the installation on the registry value component.  This condition would be something like "NOT KeyAlreadyDefined", where KeyAlreadyDefined is a property in the Property table.  You would need to use the AppSearch and RegLocator tables to set that properly appropriately.  In short, it's not trivial.

From your other post regarding storing an encrypted password, I assume you wish to initialize a default password that would be shared by your two apps.  One simple solution would be to push the detection and initialization into your app.  That is, when your application starts, it could look for the registry key,and initialize it if it's not found.  The security drawback to this is that a user could just delete the key if he/she wanted to reset the password.  Then again, even if the installer did the intialization, he/she could still delete the key then rerun the installer to achieve the same ends.

Hope this helps.

Mert A.
National Instruments

Message Edited by Mert A. on 11-30-2006 04:18 PM

0 Kudos
Message 2 of 4
(3,256 Views)
Thanks for the reply.

Now that I think about it, regedit does overwrite when you doubleclick a registry entry file, though it does a warning first.

I had hoped it would be straightforward but it looks as if registry entries are treated differently than files in the distribution.  If the target file exists, I think the distribution kit doesn't overwrite it.  So if I had the values in an ini file, the original values would be preserved.

I wasn't thinking of the password, I was thinking of a comport number in this case.

Menchar
0 Kudos
Message 3 of 4
(3,246 Views)
Hi Menchar,

Actually, the file installation logic is like so:

1. Your installer version is checked against any previous installation -- if there is no previous installation, or the new installation has a higher version, the installer will run.
2. Any previous installation is uninstalled.
3. The new installer installs all files, using file versions to resolve situations where the file already exists.

Note that by this logic, if you are updating a previous install, all files will be replaced regardless of version; the original files will be removed first, so the new files will always install.

Though I was mistaken about the application, I think my recommendation is still valid.  Whether it is a registry key or .ini file, you can have your application(s) check for its existence at startup and create it if it's not there.  This guarantees you will always have default values, and any changes will be retained.

Hope this helps.

Mert A.
National Instruments
0 Kudos
Message 4 of 4
(3,209 Views)