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
- :
- Getting a false positive on a RegDBKeyExist check.
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
‎May 18, 2010
01:48 PM
Getting a false positive on a RegDBKeyExist check.
I created a copy of a functioning installer I created to create a similar installer with slightly different requirements. In my OnAppSearch funtion I had some logic that used RegDBKeyExist to determine if a required piece of software is installed before proceeding. I have verified that the registry key I'm checking against does not exist on my test machine but the function is returning a postive anyway. Any ideas?
(6) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 18, 2010
03:39 PM
Perhaps post the code that fails, including any preliminaries such as RegDBSetDefaultRoot? Any difference between systems, such as 32-bit vs. 64-bit?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 18, 2010
03:43 PM
I have modified some of this for non disclosure. Note I put an additional message box in to assure that this was the path I was falling into:
//---------------------------------------------------------------------------
// OnAppSearch
//
// The OnAppSearch event is called after OnBegin and can be used to search
// for previous versions of the current application. This event is called
// only when the setup is running in first install mode.
//---------------------------------------------------------------------------
function OnAppSearch()
NUMBER nResult;
STRING svInstallPath;
NUMBER nSize;
NUMBER nType;
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if (RegDBKeyExist(" MessageBox("False Positive!", SEVERE);
abort;
FeatureSetTarget(MEDIA,"",svInstallPath + "");
else
MessageBox("Error Message", SEVERE);
abort;
endif;
end;
//---------------------------------------------------------------------------
// OnAppSearch
//
// The OnAppSearch event is called after OnBegin and can be used to search
// for previous versions of the current application. This event is called
// only when the setup is running in first install mode.
//---------------------------------------------------------------------------
function OnAppSearch()
NUMBER nResult;
STRING svInstallPath;
NUMBER nSize;
NUMBER nType;
begin
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
if (RegDBKeyExist("
abort;
FeatureSetTarget(MEDIA,"
else
MessageBox("Error Message", SEVERE);
abort;
endif;
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 18, 2010
03:49 PM
Perhaps change the return value test to
if (RegDBKeyExist("...") != 1) then // etc.RegDBKeyExist is odd in that it returns 1 for success, not 0.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 18, 2010
04:31 PM
It is still falling into that loop with that code change. The only difference between this code and what I had working in the previous copy of this installer is that had a further check on a registry value. Perhaps the RegDBKeyExist call never actually worked to begin with.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 19, 2010
09:26 AM
As a test, does this work as expected?
function OnAppSearch( )
begin
RegDBSetDefaultRoot(HKEY_CLASSES_ROOT);
if (RegDBKeyExist("no\\such\\key") != 1) then
MessageBox("No such key exists, which is no surprise.", INFORMATION);
else
MessageBox("Found it, though I shouldn't have.", INFORMATION);
endif;
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 19, 2010
01:21 PM
Oh dear...when you posted that code sample I realized something. Your original suggestion was to use != 1 but I wanted to fall into that if it was equal to 1. Changed it to == 1 and now it works fine. Thanks for your help!
