Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Check registry value before installation


4 replies to this topic

maxk

maxk
  • Full Members
  • 38 posts

Posted 03 February 2014 - 22:22

Hello,

 

I've created a basic MSI project to install several files.

I want my install to check the registry value before installation.

If the value in the registry exist, I want the install to abort (with message dialog).

Do I need to write an install script or any other ways to do this?

If I need to use install script, please provide the script. 

 

Thanks in advance,

M



aakash.tiwari12@gmail.com

aakash.tiwari12@gmail.com
  • Full Members
  • 34 posts

Posted 04 February 2014 - 11:37

Hi,

 

Yes you have  to write script, add new script file in your project and add registry checking in OnFirstUIBefore function

 

>>I want my install to check the registry value before installation.

 

for checking registry value use fucntion RegDBkeyExist. get this value on NUMBER variable and check that number value for 0 or other condition with If statement.

 

for abort use Abort; keyword.

 

I hope this will work for you.

 

Thanks 

Aakash


Edited by aakash.tiwari12@gmail.com, 04 February 2014 - 11:38.


deramor

deramor
  • Full Members
  • 187 posts

Posted 05 February 2014 - 01:25

In a Basic MSI project, I would not use a script.  I would rather create a new Public Property through the property view.  Call it MY_REG_PROP.  Note public properties are written in all caps.  Then, create a system search for the registry value you want to key from.  If there is a value of the key it would be best.  Tell the system search to just store the value in the property you created.

 

Lastly, I would create a new Custom Action of type error.  I would schedule this action to occur in both the UI and Execute Sequence after app seach with the condition for both that your property contains the value you either do or don't expect.  If the value is true, the error will pop, your message will be displayed, and the setup will abort.  Note the error message is defined when you create the Error CA.

 

Some considerations:

Make sure you have a default value for your public property.

Test your condition by making changes to the registry that app search is looking.



Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 05 February 2014 - 10:42

In general, I want to second deramor's advice. However: don't set a default value for the property (leave it empty in property manager). Then you can test for the existance of the property, regardless of its actual value, by simply using the property name as condition:

MY_REG_PROP

will evaluate to true if the property is set to any value, and to false if it's not set (i.e. system search didn't find the registry value)



maxk

maxk
  • Full Members
  • 38 posts

Posted 06 February 2014 - 16:24

Much appreciated for all your responses.

 

I used a script to verify the version using RegDBGetKeyValueEx and message box to confirm return value 

    //MessageBox("The value of svValue" +svValue, INFORMATION);
 
Thanks again.