Reading Registry values - Advanced Installer Community
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Reading Registry values

Hi,


The installer is placing the registry key values in HKEY_LOCAL_MACHIINE\SOFTWARE\WOW6432Node\companyname\registryfolder.
but some times it places the registry values in HKEY_USERS\SOFTWARE\WOW6432Node\companyname\registryfolder and HKEY_CURRENT_USER\SOFTWARE\WOW6432Node\companyname\registryfolder nodes.

Problem:
I need to read the registry key.When I am reading a key (using c# in custom action) from HKEY_LOCAL_MACHIINE node, the key is coming as "null".
I am able to read registry from HKEY_CURRENT_USER and HKEY_USERS.Becasuse installer keeps them in these nodes.


My Question is how to know under which node the installer places the registry entries?
Where does Advanced installer keeps the registry values by default?

Please suggest me.

Thanks
Raghu
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Reading Registry values

Hi Raghu,

In the "Registry" page there is a special hive in the left pane, named "Current user / Local machine". The registry entries added under this section will be installed in either HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE nodes, depending on the "Installation Type" of the package that can be set in the "Install Parameters" page.

For instance, if the installation type is per-machine ("Per-machine only" or "Per-machine if user is administrator") the registry entries will be installed under the "HKEY_LOCAL_MACHINE" node. In case the installation type is "Per-user only" or "Per-user only(with administrator rights required)", the registry entries will be installed under the "HKEY_CURRENT_USER" node.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
raghu.00a@gmail.com
Posts: 27
Joined: Tue May 10, 2016 11:18 am

Re: Reading Registry values

Hi,

Thanks for your quick reply.
while setting a value to Registry key through custom action, it is throwing UnAuthorizedAccess Exception.
I am assigning the encrypted password at end of installation to session, but its value is not stored in registry entry.

I want to set the registry key value using custom action.

Please suggest me, how can we store the value to registry at the end of installation?

Thanks
Raghu
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Reading Registry values

Hi Raghu,

That error might be encountered if your custom action does not have the necessary permissions to write to the registry. In order to overcome this, you can try to give it administrator rights.

However, in order to add registry entries from your package, you can add them in the "Registry" page, so they will be added during the "Add Resources" action group.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”