bmt22033
Posts: 21
Joined: Tue Jun 26, 2012 2:14 pm

Reading registry values and using them during install

I'm building an installer to deploy a plug-in for a 3rd party application. This application is a 32-bit app and it writes information about its install path to a couple of registry keys. On x86 platforms, these registry keys are located at:

HKLM\Software\CompanyName\ProductName\AppDataPath
HKLM\Software\CompanyName\ProductName\UserDataPath

On x64, they're found at:

HKLM\Software\Wow6432Node\CompanyName\ProductName\AppDataPath
HKLM\Software\Wow6432Node\CompanyName\ProductName\UserDataPath

My question is, is it possible to create one registry search that will check both the x86 and x64 locations for each key? For example, is it possible to create a search that will look at both of these locations?

HKLM\Software\CompanyName\ProductName\AppDataPath
HKLM\Software\Wow6432Node\CompanyName\ProductName\AppDataPath

I see the checkbox that says "Search the 64-bit portion of the registry" but I don't know if that means "in addition to" or what. In other words, if I create a registry search for HKLM\Software\CompanyName\ProductName\AppDataPath and then check the "Search the 64-bit portion of the registry" checkbox, will it also look in HKLM\Software\Wow6432Node\CompanyName\ProductName\AppDataPath?


Also, once I've retrieved these values from the registry, I need to do the following:

- if the "AppDataPath" key doesn't exist, then my installer needs to exit
- if the "AppDataPath" and "UserDataPath" keys *do* exist, I need to use the properties that hold their values to determine where my files should be installed

How do I reference the properties that hold these registry values to perform these actions?

Thanks very much!
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Reading registry values and using them during install

Hi,
My question is, is it possible to create one registry search that will check both the x86 and x64 locations for each key? For example, is it possible to create a search that will look at both of these locations?
Yes, this is the default behavior. A registry search will automatically search under the "Wow6432Node" section on a 64-bit machine.

The "Wow6432Node" is the section where all the 32-bit registry entries are stored on a 64-bit machine. The "Search the 64-bit portion of the registry" option is necessary only if you want to search outside this section on a 64-bit machine(i.e. HKLM\Software\CompanyName\ProductName\AppDataPath).
- if the "AppDataPath" key doesn't exist, then my installer needs to exit
To achieve this, you can add a "Display error message" after the "Wizard Dialogs Stage -> Searches" action group, set it to run only on "Install" and use the search property as a condition for it (i.e. APPDATAPATH_SEARCH).

Then, while the "SHIFT" keyboard button is pressed, drag and drop the custom action after the "Install Execution Stage -> Searches" action group, to duplicate it.

Also check only the "Install" checkbox for it and set the same condition, then click on the "Advanced execution scenarios..." blue link and check the "Skip action in Install Execution Stage if executed in Dialogs Stage" option. The duplicated custom action will be executed only if the package is installed with Basic UI or in silent mode.
- if the "AppDataPath" and "UserDataPath" keys *do* exist, I need to use the properties that hold their values to determine where my files should be installed
The properties that holds the registry entries values are exactly the names of the searches (you can rename those searches as you like). You can create property-based folders using those properties and place your files in those folders or you can go in the "Install Parameters" page and write one of those properties in the "Application folder" field.

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

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bmt22033
Posts: 21
Joined: Tue Jun 26, 2012 2:14 pm

Re: Reading registry values and using them during install

Thank you, Eusebiu. That's exactly the information I was looking for!
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Reading registry values and using them during install

You're welcome. Glad to help.

Just let us know anytime you have a question.

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

Return to “Building Installers”