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
- :
- Problem Solved!
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
‎Jan 15, 2009
03:13 PM
Accessing registry fails in OnEnd
For some reason my RegDBGetKeyValueEx call in the OnEnd function fails everytime - the key exists and has a value, the exact same call works when called in other parts of the script and only fails in this function.
Does anyone know why this would fail?
Here's the code:
And for the getKeyValue function - includes plenty of debug messages
Does anyone know why this would fail?
Here's the code:
function OnEnd()STRING componentSelected, tempKey;begin
BOOL result;tempKey = TEMP_REG_KEY;
// If not removing everything
if (REMOVEALLMODE == 0 && MAINTENANCE == 0) then// If component is selected for install
result = getKeyValue(tempKey, "ComponentSelected", componentSelected);
if (componentSelected= "TRUE") thenMessageBox ("Component selected to install.",INFORMATION);
elseMessageBox ("Component not selected to install.",INFORMATION);
endif;
endif;
deleteKey(tempKey);
return 0;
end;
And for the getKeyValue function - includes plenty of debug messages
prototype BOOL getKeyValue(STRING, STRING, BYREF STRING);
// Assumes STRING value for key
function BOOL getKeyValue(szKey, szName, szValue)
NUMBER nvType, nvSize, result;
STRING szMsg;
begin
// Retrieve key value information.
result = RegDBGetKeyValueEx (szKey, szName, nvType, szValue, nvSize);
if (result < 0) then
MessageBox ("RegDBGetKeyValueEx failed.", SEVERE);
return 1;
else
// Check to see if the value returned is the same as the value set.
if (nvType != REGDB_STRING) then
MessageBox ("Type comparison failed.", SEVERE);
return 1;
endif;
// Display what RegDBGetKeyValueEx retrieved.
szMsg = "%s has value: %s\n\nThis data is %d bytes.";
SprintfBox (INFORMATION, "", szMsg, szName, szValue, nvSize);
endif;
end;
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 15, 2009
04:03 PM
How is getKeyValue defined? Does its return value "result" tell you anything?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 15, 2009
04:53 PM
Thanks for your reply;
I've added the code for the getKeyValue function to my first post. The 'result' is only the success of the function, the value of the registry is stored in a parameter passed in by reference.
I've added the code for the getKeyValue function to my first post. The 'result' is only the success of the function, the value of the registry is stored in a parameter passed in by reference.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 15, 2009
04:57 PM
Perhaps the registry root you're reading from changes between functions? If so, you'll want another call to RegDBSetDefaultRoot before RegDBGetKeyValueEx.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 16, 2009
05:07 AM
Hurrah! I tried setting the root again as you suggested and the registry operations are now working; thanks for your help 🙂