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!

wwhyte
Posts: 1
Joined: Sat Jun 25, 2005 7:13 pm
Contact: Website

Additional registry change

Hi everyone,

We're providing a .msi file, built with Advanced Installer, for integration into a larger install package. This larger install package detects whether or not our installation succeeded by the following method:

a) at the start of install, we write the binary value Success/Fail = 0 to HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<ProductCode>.

b) when install completes successfully, we set Success/Fail = 1.

I'm not sure how to use Advanced Installer to do this. Do I have to use a Custom Action? If so, can you suggest the VBScript or JavaScript that I should use?

Thanks in advance for your help,

William
Mike
Posts: 292
Joined: Wed Jun 01, 2005 10:50 am
Location: Craiova, Romania
Contact: Website

Hi William,

In order to write in the registry those values you have to create two custom actions.

1. In case of success, in order to write the value 1:
- place under "Commit" section a "New Attached Custom Action". This will be a VBScript file. See bellow.
- Choose the source path for the VBScript file (on the disk).
- Select source type as VBScript and edit the "Function Name" field to "WriteReg1"
- Choose "Deffered" as type of execution.

2. In case of failure, create in the same way a custom action under "Rollback". The difference is that the "Function Name" is "WriteReg0" and the type is "Rollback".

The VBScript is:

Function WriteReg1()

Dim objShell
Set objShell = CreateObject("WScript.Shell")

Dim pathToUninstall, productCode
pathToUninstall = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\"

productCode = Session.Property("ProductCode")

objShell.RegWrite pathToUninstall + productCode + "\SuccessFail", 1, "REG_BINARY"

End Function


Function WriteReg0()

Dim objShell
Set objShell = CreateObject("WScript.Shell")

Dim pathToUninstall, productCode
pathToUninstall = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\"

productCode = Session.Property("ProductCode")

objShell.RegWrite pathToUninstall + productCode + "\SuccessFail", 0, "REG_BINARY"

End Function


All the best,
Mihai
Mihai Bobaru
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”