reading from registry at runtime. - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

CarlAarnes
Posts: 58
Joined: Tue May 24, 2011 3:43 pm

reading from registry at runtime.

Hi,

Im running an attaced file (custom action, .EXE), which writes to the registry when it returns to advanced installer i would like to read the registry key the .exe has just updated/written. and perform some actions based on the results.

How can i read from registry when custom action returns ?

/carl
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: reading from registry at runtime.

Hello,

In order to obtain what you want you can add your EXE custom action as a "Launch attached file" custom action with sequence scheduled before "Wizard Dialogs Stage" -> "Searches" action group. Then, you can read the related registry value using a registry search added on "Search" page.

Another solution would be to set a custom property with the created/updated registry value from your EXE custom action.

Let us know if this helps, otherwise give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
CarlAarnes
Posts: 58
Joined: Tue May 24, 2011 3:43 pm

Re: reading from registry at runtime.

Tx for the suggestion, i dont think the sequence part would work due to how the exe is started.
e.g. its an option page with radio buttons and the exe is started by selecting an option an pushing the next button.

The exe has its own options which it stores in the registry, and is run somewhat recursive, taking the result from the first run in the registry and and then calling it with new options which reads the registry key from previous run.

Im not sure how to do this with a custom property...


/carl
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: reading from registry at runtime.

Hello Carl,
Im not sure how to do this with a custom property...
I'm sorry, I made a mistake. You cannot set an installer property using an exe custom action. An installer property can be set only from Win32 DLL or VBScript custom actions.

So, instead of using an exe custom action you could use a dll custom action which will create/update the related registry value and, then set an installer property using "MsiSetProperty function". Also, you can take a look on our "Serial Number Validation DLL" article in order to create a dll custom action.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
CarlAarnes
Posts: 58
Joined: Tue May 24, 2011 3:43 pm

Re: reading from registry at runtime.

Ok, so there are no way to access (updated) registry values from within the installer when its been launched? (It just needs to be read)

The exe file is part of a previous installer(Made with wise) and for some reason, my colleuges want to reuse it .. it might be possible to rewrite as a dll im not sure, it has it own gui so some consideration must be taken about how to recreate that as well.

/Carl
CarlAarnes
Posts: 58
Joined: Tue May 24, 2011 3:43 pm

Re: reading from registry at runtime.

Looks like i can do this with a vbscript and wmi, calling the vbscript after each run of the exe and eventually restarting exe regarding to options ....

But there might be some problems im unaware of :?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: reading from registry at runtime.

Hello Carl,
Ok, so there are no way to access (updated) registry values from within the installer when its been launched? (It just needs to be read)
As I mentioned in my previous post, you can access the related registry value using a registry search added on "Search" page. But, if your custom action will be scheduled after "Wizard Dialogs Stage" -> "Searches" -> "AppSearch" standard action, then the registry search will read original value of the registry.

Since you need to read the updated value of the registry, it is recommended to use a DLL custom action which will set an installer property with the related value after the registry will be updated. Also, you can use a separate VB Script custom action, despite this type of custom actions are not very recommended.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”