windows-installerinstallshield

Windows Installer can't find registry entry


I'm building a multi-instance installer with InstallShield 2014 Premier and adding a key to the registry (from the Registry table):

Registry   | Root | Key                                                    | Name | Value | Component           | ISAttributes
Registry34 | 2    | SOFTWARE\MyCompany\MyProduct\[InstanceId]\InstanceData | ENV  | [ENV] | ISRegistryComponent | 0

Key from registry after install:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyCompany\MyProduct\0\InstanceData
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyCompany\MyProduct\1\InstanceData

Both contain the values I am expecting. However, when I search for them, I don't seem to be finding them (RegLocator table):

Signature     | Root | Key                                                    | Name | Type
NewSignature1 | 2    | SOFTWARE\MyCompany\MyProduct\[InstanceId]\InstanceData | ENV  | 18

Appsearch table has ENV | NewSignature1

I've tried on various occasions with and without the 64 bit search flag set (2 vs 18 in the Type).

From the install Log after uninstall, you will see the ENV property is not being set with the value from the registry ('PROD' is the default value of the ENV property):

Action start 16:58:38: INSTALL.
MSI (s) (5C:C8) [16:58:38:080]: Running ExecuteSequence
MSI (s) (5C:C8) [16:58:38:080]: Doing action: AppSearch
Action start 16:58:38: AppSearch.
MSI (s) (5C:C8) [16:58:38:080]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (s) (5C:C8) [16:58:38:081]: PROPERTY CHANGE: Adding IISROOTFOLDER property. Its value is 'C:\inetpub\wwwroot\'.
MSI (s) (5C:C8) [16:58:38:081]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (s) (5C:C8) [16:58:38:081]: PROPERTY CHANGE: Adding DOTNETVERSION40FULL property. Its value is '#1'.
MSI (s) (5C:C8) [16:58:38:081]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (s) (5C:C8) [16:58:38:081]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\MyProduct\1\InstanceData 3: 2 
MSI (s) (5C:C8) [16:58:38:081]: Note: 1: 2262 2: Signature 3: -2147287038 
MSI (s) (5C:C8) [16:58:38:081]: PROPERTY CHANGE: Adding IIS_VERSION property. Its value is '#8'.
MSI (s) (5C:C8) [16:58:38:082]: Doing action: UpdateProductName_setProp
Action ended 16:58:38: AppSearch. Return value 1.
MSI (s) (5C:C8) [16:58:38:082]: PROPERTY CHANGE: Modifying ProductName property. Its current value is 'MyCompany MyProduct Server Components'. Its new value: 'MyCompany MyProduct Server Components - PROD'.
Action start 16:58:38: UpdateProductName_setProp.

What am I doing wrong?


Solution

  • The following line in the log file has the information what you should be looking at:

    MSI (s) (5C:C8) [16:58:38:081]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\MyProduct\1\InstanceData 3: 2

    The above line is interpreted as follows: Windows installer error code of 1402, which the MSI SDK defines as follows:

    Could not open key: [2]. System error [3].

    System error code of 2 indicates: ERROR_FILE_NOT_FOUND

    The log file clearly indicates that the registry key was not found. I am assuming that the snippet of the log is when the 64 bit search flag was set in the RegLocator table. However, your registry entries are created in the 32 bit hive(Wow6432Node).

    To fix this issue, this is what you should be doing:

    Probably, what is happening here is that , the value of the property ENV is not passed into the Execute sequence. For the value of the property to be passed to the execute sequence, you need to secure the property ie. add the ENV property to SecureCustomProperties in the Property table.

    Once you do this, you code snippet should start working.

    In general, under normal circumstances, the values of public properties are passed from the UI sequence to the execute sequence. However, there could be lockdown conditions where the property needs to be explicitly added to the SecureCustomProperties list in the Property table for the value to propagate to the Execute sequence.