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!

StevenS
Posts: 4
Joined: Tue Dec 10, 2019 8:39 pm

Conditional logic based on operating environment (wine)

New to AI, making the switch from NSIS.

Our software runs under wine for mac/linux users (part of the reason we are switching is for full x64 support needed for Catalina). Also, due to the Catalina, I will have to use App local deployment for Microsoft's C++ runtimes while running under wine. Rather than force our windows users to do this as well I would like the installer to be able to detect if running under wine and install the runtimes with a simple file copy when wine is present or via the vcredist when it isn't.

Wine can be detected very easily by checking if wine_get_host_version exists in ntdll.dll on the user's system. Is there anyway to do this directly in AI? Or failing the direct method, could I write an external component that runs and provides the results back to the installer?

TIA,
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Conditional logic based on operating environment (wine)

Hello Steven and welcome to Advanced Installer forums,
Wine can be detected very easily by checking if wine_get_host_version exists in ntdll.dll on the user's system.
Unfortunately, we do not have predefined support for getting e version out of a .DLL file.
Is there anyway to do this directly in AI? Or failing the direct method, could I write an external component that runs and provides the results back to the installer?
However, this is possible through a custom action. For instance, you can have your own script (e.g. VBScript, PowerShell, C# DLL) which will check for the version and then set an installer property. After doing so, you can use the property earlier defined in your script to condition the next actions you want to execute.

For more information about setting a property through a custom action, please have a look on our "How to set an installer property using custom actions" article which I think you may find useful.

Hope this helps.

Please let me know if anything is not clear enough and I will be glad to assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
StevenS
Posts: 4
Joined: Tue Dec 10, 2019 8:39 pm

Re: Conditional logic based on operating environment (wine)

Catalin wrote: ↑Wed Dec 11, 2019 10:37 am
Wine can be detected very easily by checking if wine_get_host_version exists in ntdll.dll on the user's system.
Unfortunately, we do not have predefined support for getting e version out of a .DLL file.
Not quite what I'm trying to do. I was hoping to check for the existence of the function and/or call it, not actually check the version number of the dll. I only clarify this for future people that come across this thread.

However, this:
Is there anyway to do this directly in AI? Or failing the direct method, could I write an external component that runs and provides the results back to the installer?
However, this is possible through a custom action. For instance, you can have your own script (e.g. VBScript, PowerShell, C# DLL) which will check for the version and then set an installer property. After doing so, you can use the property earlier defined in your script to condition the next actions you want to execute.

For more information about setting a property through a custom action, please have a look on our "How to set an installer property using custom actions" article which I think you may find useful.

Hope this helps.
Does help. More work than I wanted to do but easily doable since I've already got the code in another app. Just need to put it into a dll instead. And that is MUCH easier than making an x64 build of NSIS.

Thanks
Catalin
Posts: 7853
Joined: Wed Jun 13, 2018 7:49 am

Re: Conditional logic based on operating environment (wine)

Hello Steven,
Not quite what I'm trying to do. I was hoping to check for the existence of the function and/or call it, not actually check the version number of the dll. I only clarify this for future people that come across this thread.
Thank you for the explanation. I misunderstood what you tried to achieve. Please accept my apologies for that.

Actually, I think that this might be easier than creating a custom action of your own. Here is how you can proceed in order to achieve what you want:

1. if you have access to that .DLL file, you can include it in your package (e.g. in the "Files and Folders" page)

2. after doing so, you can use our predefined "Call function from standard DLL" custom action. This will allow you to call the function from the .DLL file. However, this require you to be knowledgeable about the .DLL file (e.g. you should know the type of the function, its return type, etc.). After doing so, you can save the result (if the function is not of VOID type) in an installer property which you can further use to condition your operations.
Does help. More work than I wanted to do but easily doable since I've already got the code in another app. Just need to put it into a dll instead. And that is MUCH easier than making an x64 build of NSIS.
I am glad this works for your and I am also glad this is easier to achieve than the other solution you had before.

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”