This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: facing issue RegDBSetKeyValueEx Creating new key even though the key exists?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 14, 2016
09:02 AM
facing issue RegDBSetKeyValueEx Creating new key even though the key exists?
Hey guys,
I am new to installshield scripting. I have basic MSI project, where I needed to write custom InstallScript function to update the value of existing key. Now by definition RegDBSetKeyValueEx creates the key if it doesnt find it but in my case the key already exists, so it shouldn't be creating a new key. I have verified it with RegDBKeyExist function. Any idea why it is doing that?
I am new to installshield scripting. I have basic MSI project, where I needed to write custom InstallScript function to update the value of existing key. Now by definition RegDBSetKeyValueEx creates the key if it doesnt find it but in my case the key already exists, so it shouldn't be creating a new key. I have verified it with RegDBKeyExist function. Any idea why it is doing that?
RegDBSetDefaultRoot ( HKEY_CLASSES_ROOT );
if (RegDBKeyExist(szKey) < 0) then
MessageBox ("Key Exists.", INFORMATION);
endif;
if (RegDBSetKeyValueEx (szKey, "", nType, szNumValue,
nSize) < 0) then
MessageBox ("RegDBSetKeyValueEx failed.", SEVERE);
abort;
else
MessageBox ("RegDBSetKeyValueEx passed.", INFORMATION);
endif;
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 18, 2016
06:46 AM
Bumping this thread!
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 18, 2016
08:49 AM
You are creating a new 'default' key by passing "" as a parameter, but you are only checking for the key root. Would that perhaps be the reason?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 18, 2016
11:49 AM
Hysteresis wrote:
You are creating a new 'default' key by passing "" as a parameter, but you are only checking for the key root. Would that perhaps be the reason?
Thank you for responding. I am passing "" to set the value of the key for (Default).
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 01, 2016
02:56 PM
Finally fixed it. It was mistake. There was a space at the end of key name, InstallScript doesnt trim tailoring space. Which was causing in creation of new key in the registry.
Thanks!
Thanks!
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)