assafka
Posts: 9
Joined: Tue Oct 25, 2016 9:02 am

Access Violation Error when conditioning WriteRegistryValues action on AI_DETECTED_MINOR_UPGRADE

Hi,
we are trying to condition the WriteRegistryValues custom action to occur only when the installation is not part of a Patch.
we've added the following condition:

Code: Select all

"NOT (AI_DETECTED_MINOR_UPGRADE)"
the result in the project file looks like this:

Code: Select all

<ROW Action="WriteRegistryValues" Condition="NOT (AI_DETECTED_MINOR_UPGRADE)" Sequence="5000" SeqType="0" MsiKey="WriteRegistryValues"/>
when saved and built, everything seems to work fine. but when the project is closed and reopened, AdvancedInstalled throws the following error:

Code: Select all

[SEH_AV_READ_BADPTR] ACCESS_VIOLATION (0xc0000005) at address [0x017f416c]

Advanced Installer 13.4 build 74004
*** Stack Trace (x86) ***

[0x017f416c]  -----
[0x0163fa5e]  -----
[0x758714ad]  HeapFree()
[0x013b0000]  MODULE_BASE_ADDRESS
we pinpointed the error by changing the above condition to anything that does not include AI_DETECTED_MINOR_UPGRADE and trying to use the AI_DETECTED_MINOR_UPGRADE value in other custom actions. on both variants the project was opened without any problem, which leads us to the conclusion that this error is thrown only when opening a project in which WriteRegistryValues's condition includes AI_DETECTED_MINOR_UPGRADE.

please help.
Eusebiu
Posts: 4971
Joined: Wed Nov 14, 2012 2:04 pm

Re: Access Violation Error when conditioning WriteRegistryValues action on AI_DETECTED_MINOR_UPGRADE

Hi,

I tested the scenario, but I couldn't reproduce the problem. Can you reproduce it in a new project? If so, can you please send us a project with the problem to support at advancedinstaller dot com, so we can investigate it?

Also, please keep in mind that it is not recommended to set conditions for the standard actions in the "Table Editor" page. If you do not want to install the registry entries during the patch, you can set the "NOT PATCH" condition for their related components in the "Organization" page.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
assafka
Posts: 9
Joined: Tue Oct 25, 2016 9:02 am

Re: Access Violation Error when conditioning WriteRegistryValues action on AI_DETECTED_MINOR_UPGRADE

Hi,
We tried to add "NOT PATCH" in the registry component condition but it's not working.
It seems to work only with non existing registry values,
but in case that the registry value already exists, it will overwrite its value with the default value, completely ignoring the condition field.

To clarify, we're referring to the case of minor update only, not a new installation or upgrade (new product code).
So our goal is to replace a file or update a registry value without changing the rest of the installed configuration (e.g. registry values).


Thanks,
Assaf
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Access Violation Error when conditioning WriteRegistryValues action on AI_DETECTED_MINOR_UPGRADE

Hello Assaf,

To achieve what you want you should just build your updated setup package as a patch. This way the patch will include only the desired updated resources and during patch installation no other file or registry will be reinstalled. Also, if you need your setup to be a standalone installer too, then as an alternative to building a patch you can build an EXE setup type and enable its "Install MSI as minor upgrade (if applicable)" option from "Builds page -> Configuration tab".

Please note that both solutions require to fulfill all patch rules.

Let us know if this helped, otherwise please give us more details about your specific requirements. Maybe exemplify a bit about your test case.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
assafka
Posts: 9
Joined: Tue Oct 25, 2016 9:02 am

Re: Access Violation Error when conditioning WriteRegistryValues action on AI_DETECTED_MINOR_UPGRADE

Thanks for the reply!

I'll try to explain our situation thoroughly.
We have a project containing few files (the application) and several registry keys (various configuration), bundled into 2 main features where each file/key is a single component (by default).
For example:
Main feature:
- app.exe
- hklm\...\app\conf1
- hklm\...\app\conf2


Now, if we want to perform a minor upgrade and only update a single component (e.g. app.exe) using a standalone installer, not a patch, then the entire feature gets reinstalled.
So the reg keys will revert to their default values determined by the installer.

From what we've read we have 2 options:
1) Write a custom action that will detect a minor upgrade, read the registry keys and then re-apply them.
2) Separate the files and keys into 2 features and only reinstall the relevant feature.

The first option is far from optimal for us, as it requires us to maintain the values manually.
The second option won't work if we wish to add another reg key or change the value of one.
Also, the "Install MSI as minor upgrade (if applicable)" option always uses "REINSTALL=ALL", we couldn't find a way to change it other than manually changing the REINSTALL property through a custom action.


I hope this was a bit clearer.
Basically, we need a way to do a selective update to registry keys in a feature during a minor upgrade with a standalone installer, is that possible?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Access Violation Error when conditioning WriteRegistryValues action on AI_DETECTED_MINOR_UPGRADE

Hello,

Thank you for your in depth description. Indeed, the easiest way to achieve what you want will be to use the following condition for the "WriteRegistryValues" action.

Code: Select all

NOT (AI_DETECTED_MINOR_UPGRADE)
Now, I think your first attempt to use the above condition in our "Table Editor" page didn't work because of an Advanced Installer limitation. The "AI_DETECTED_MINOR_UPGRADE" property (and also several AI reserved property) won't be evaluated and set as long as you didn't use the property in a field from our UI which is a smart edit control. So, if you don't use the "AI_DETECTED_MINOR_UPGRADE" property at least in one field which a smart edit control (it is not the case for any fields from our "Table Editor" page), then the "AI_DETECTED_MINOR_UPGRADE" property will be always empty, thus your condition will be always false. We will try to update our help files with this info too.

The solution to this limitation is to also use the "AI_DETECTED_MINOR_UPGRADE" in a condition field which is a smart condition control. For instance you can create a dummy custom launch condition which will use the "AI_DETECTED_MINOR_UPGRADE" property, but will never trigger. Here is what you can do:
1. go to "Launch Conditions" page -> "Custom" tab and add a new launch condition like this:
  • Condition: (AI_DETECTED_MINOR_UPGRADE) OR (1=1)
    Description: Dummy launch condition used to resolve the AI_DETECTED_MINOR_UPGRADE property. This launch condition will never be triggered.
2. go to "Table Editor" page and select the "InstallExecuteSequence" table
3. add the following condition on the "WriteRegistryValues" action

Code: Select all

NOT (AI_DETECTED_MINOR_UPGRADE)
4. rebuild and test again your minor upgrade setup

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
senthilkumar
Posts: 7
Joined: Mon Jan 30, 2017 11:08 am

Re: Access Violation Error when conditioning WriteRegistryValues action on AI_DETECTED_MINOR_UPGRADE

AI_DETECTED_MINOR_UPGRADE is not working for me. Condition always fails.

Below is what I found in the logs:

MSI (c) (4C:40) [19:31:55:515]: Invoking remote custom action. DLL: C:\Users\SENTHI~1.SUB\AppData\Local\Temp\MSI9401.tmp, Entrypoint: OnDetectSoftware
OnDetectSoftware: OnDetectSoftware start.
OnDetectSoftware: Perform searches for property [AI_DETECTED_MINOR_UPGRADE]
OnDetectSoftware: Was not found a predefined search, trying to get a custom detection
OnDetectSoftware: Was specified a custom detector
OnDetectSoftware: Search result []
OnDetectSoftware: OnDetectSoftware end.
Action ended 19:31:55: AI_DetectSoftware. Return value 1.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Access Violation Error when conditioning WriteRegistryValues action on AI_DETECTED_MINOR_UPGRADE

Hello,

This may happen if there is not performed a minor upgrade installation. Please note that two versions of your setup product are minor upgrade compatible only if they fulfill all the patches rules.

In order to further investigate this can you please send us to support at advancedinstaller dot com the following resources:
1. the AIP (project file) of your old product version
2. the AIP (project file) of your new product version
3. a verbose log of the upgrade installation

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

Return to “Building Installers”