On the result of execution of exe stop MSI execution - 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!

ankitkshah
Posts: 13
Joined: Mon Dec 20, 2010 1:28 pm

On the result of execution of exe stop MSI execution

Hi,

I want to execute exe before MSI installation. On the basis of output of that exe I want to terminate the MSI process. How can I achieve this?

Thanks
Ankit
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: On the result of execution of exe stop MSI execution

Hello Ankit and welcome to the Advanced Installer Forums,

To execute the EXE at the beginning of the installation you can add it as an "Attached Custom Action" after the "Begin" standard action in the "InstallUISequence" and set its execution condition to:

Code: Select all

(NOT Installed)
Although you cannot get the return code of an EXE ran as custom action. Depending on the return code of the custom action(must be 0 for success, any other value is interpreted as failure) the installation will continue or rollback.
The only way to achieve the functionality you mentioned is by setting a property from within a VBScript, DLL or JScript custom action which runs at the beginning of the installation, instead of your EXE.

Regards,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ankitkshah
Posts: 13
Joined: Mon Dec 20, 2010 1:28 pm

Re: On the result of execution of exe stop MSI execution

Hello,

As you mentioned I use dll. I created new dll with 4 functions with 2 parameters(ADD, SUB, DIV and MUL). All this function returns a value. This value could be anything. I can't understand where to pass the values in this functions and where can I get the return out put of particular function. What should I do to stop the installation process when I get the output of dll function?

Thanks,
Ankit
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: On the result of execution of exe stop MSI execution

Hi Ankit,

Please note that the custom action suggested by Mihai can work only if you use public properties to pass and retrieve information from the functions.
You must use a certain function signature, as in the following example.

If you wish to use your standard DLL, you can try to use the predefined custom action "Call function from standard DLL". using this custom action you can pass the return value of your function into a public property. With this return property you can condition a new custom action that will stop the installation with an error message.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ankitkshah
Posts: 13
Joined: Mon Dec 20, 2010 1:28 pm

Re: On the result of execution of exe stop MSI execution

Hello,

As you mentioned I performed following steps.
- I add new call function from standard dll(CallStdFcn) in Custom Action\InstallUISequence\Begin
- Now I add dll from Edit Function window, there I add a dll file which is in my application folder. Then I add return type as integer, return property as property, calling conversion as standard calling conversion, Name as ADD(this is function name of my dll). I pass two argument as integer with value binding option as inline value. For e.g. I passed 2 and 2.

After I perform above step I run the application and I got the error file attached. Please let me know the steps.

Thanks
Ankit
Attachments
Error.JPG
Error.JPG (13.62 KiB) Viewed 7199 times
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: On the result of execution of exe stop MSI execution

Hi,

This is a generic error message that appears whenever a custom action fails. I noticed you said your DLL is an installed file, can you please make sure the custom action is executed after
the files are installed(InstallFiles standard action) on the target machine? If the file is not available the custom action will fail.

If this is not the case please create a verbose log and send it along the aip file to support at advancedinstaller dot com.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ankitkshah
Posts: 13
Joined: Mon Dec 20, 2010 1:28 pm

Re: On the result of execution of exe stop MSI execution

Hi.

I tried all the way as possible. I don't know why it is not working. I added "call function from standard dll" at install standard action. As mentioned in you help, all function in dll will automatically load in drop down. But it is not happened in my case. Is I am wrong? Am I missing any step? Please give me some example or video link from that I can get some help..
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: On the result of execution of exe stop MSI execution

Hi Ankit,

To get the functions listed you must use a certain function signature, as in the following example. Also, here is our user guide to the reference to the "Attached Custom Action".
I added "call function from standard dll" at install standard action. As mentioned in you help, all function in dll will automatically load in drop down.
When using the "Call a function from a standard dll" custom action, you can specify a function with any signature from its Edit Function dialog.
This predefined custom action is also referenced in our user guide at this url location.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ankitkshah
Posts: 13
Joined: Mon Dec 20, 2010 1:28 pm

Re: On the result of execution of exe stop MSI execution

Hi.

As you provided link for dll example, it works. I can see the function return inside the dll. Okay that's fine. It is your example code that's work fine, Can you give me any example in vb or c#? I attached one solution in .NET and Advanced Installer project file. In this installer project I want stop the MSI execution after click on install based on the output of dll. The return o/p of dll is Boolean. If value is false then exit setup with error message else true then proceed.

Thanks
Ankit
Demo Application.rar
Here I attached one Solution in .NET and Advance Installer Project.
(54.01 KiB) Downloaded 261 times
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: On the result of execution of exe stop MSI execution

Hello Ankit,
Can you give me any example in vb or c#?
Unfortunately Windows Installer supports only native C++ DLLs for custom actions. Therefore, Advanced Installer cannot use a .NET DLL.

I have looked into your project and it seems you are not using the "Call a function from a standard dll" predefined custom action as mentioned in the reference from the user guide. This predefined custom action needs to be set only from the Edit Function dialog which pops up when adding the custom action. This dialog can be edited again later on by pressing the [...] button on the right of the Action Data text field.
The Source Path field must remain set to:

Code: Select all

<AI_CUSTACTS>stdDllWrapper.dll
The Source Type combo box must remain set to:

Code: Select all

Dynamic linked library (*.dll)
The Function Name combo box must remain set to:

Code: Select all

CallStdFcn
Again, there is a major difference between the "Attached Custom Action" and the "Call a function from a standard dll" predefined custom action. I underlined this in my previous post.
If value is false then exit setup with error message else true then proceed.
After you decide which of the above custom actions you will use, you can exit the setup with an "Error Message" custom action which has an execution condition set to the return property of your function. Here is the user guide reference for the "Error Message" custom action.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ankitkshah
Posts: 13
Joined: Mon Dec 20, 2010 1:28 pm

Re: On the result of execution of exe stop MSI execution

Hi Mihai,

Thank you for your support. Actually I was totally on different way for last 3-4 days. I can't able to got, what you are trying to say. But after reading lots of articles I get the result what I want. I will get back to you if any further query.

Thanks once again,
Ankit

Return to “Common Problems”