Understanding Custom-Actions - Advanced Installer Community

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!

McKool
Posts: 113
Joined: Wed Jan 19, 2011 12:35 pm
Location: Darmstadt, Germany
Contact: Website

Understanding Custom-Actions

Hello all,

I'm having some problems to understand a couple of things regarding custom actions...
I have noted that creating an "Attached Custom Action" (if using a dll) requires the use of a Msi dll, that is a dll with functions defined with the form "UINT Func_Name(MSIHANDLE parameter)". According to this:
  • Is it possible to call functions from a "standard" dll, having it also also attached to the installation? ("Calling functions from a standard dll" needs a path on the target computer, as far as I see, and I don't want to deploy a "help-dll")
  • How can I create a rollback action (or rollback information) for a custom action I have ran as Immediate?
  • One can read property values (using MsiGetProperty) from a Custom Action if this is executed as "Immediate". Lets say that this action needs to read a property... how should do the rollback action if it needs to read the property too, in order to roll back the change?
  • For what can I use the field "Action Data" in "Custom Action Properties", when using an Standard Custom Action (those who only receive the MSIHANDLE paramter)? This field is active but, if I don't understand wrong, a function of this kind shouldn't have more parameters, but the MSIHANDLE?
What I'm trying to do is the following: I want to use a custom action to copy a file to the target machine. This file may or may not be available (it will be delivered within the installation exe (all-in-one exe). The custom action should get the path of the bootstrapper, and copy the file (if available) on the target machine. IF something goes wrong, and the file was already copied, then the file should be deleted again.

Thanks in advance for your help,
Keneth
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Understanding Custom-Actions

Hello Keneth,
Is it possible to call functions from a "standard" dll, having it also also attached to the installation?
No, this is not possible. You can only call a function from a standard dll by using a "Call a function from a standard dll" predefined custom action. Also, the dll must be included among the files from the Files and Folders page. For more details here is the reference from our user guide.
How can I create a rollback action (or rollback information) for a custom action I have ran as Immediate?
One can read property values (using MsiGetProperty) from a Custom Action if this is executed as "Immediate". Lets say that this action needs to read a property... how should do the rollback action if it needs to read the property too, in order to roll back the change?
You can achieve this with the help of the CustomActionData property.
For what can I use the field "Action Data" in "Custom Action Properties"
The Action Data field represents the value of the CustomActionData property. This property can be retrieved as a regular property inside Deferred or Rollback custom actions and it is available only for DLL, JScript and VBScript custom actions.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
McKool
Posts: 113
Joined: Wed Jan 19, 2011 12:35 pm
Location: Darmstadt, Germany
Contact: Website

Re: Understanding Custom-Actions

Hello Mihai,

thanks for your reply. About the "action data": I have already used the possibility to pass information to a CA using its name as property (long time ago). I had totally forgotten that this exists - Thanks for remember me that :D.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Understanding Custom-Actions

Hi Keneth,

You are welcome, glad to help.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”