Call a function from a standard dll x64 - 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!

RDC
Posts: 7
Joined: Thu Mar 05, 2009 2:17 pm

Call a function from a standard dll x64

I have an existing AI 32 bit installer (enterprise) which I am now copying and converting to an x64 package.

The 32 bit package has many "Call a function from a standard dll" custom actions which call into an 32 bit DLL fine.

When I change both the package type and my DLL to x64 builds at first glance it would seem these are still being run as a 32 bit action?

How do I get these "Call a function from a standard dll" custom actions to call into an x64 DLL from an x64 package?

Thanks
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Call a function from a standard dll x64

Hello,
When I change both the package type and my DLL to x64 builds at first glance it would seem these are still being run as a 32 bit action?
What makes you think that?

You could try making sure the component the DLL belongs to is marked as "64-bit Component" from the Organization page, then try again see if that worked.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
RDC
Posts: 7
Joined: Thu Mar 05, 2009 2:17 pm

Re: Call a function from a standard dll x64

Component is marked a 64 bit.

An installed custom action is run against XXX.dll which works OK. Then the 'call function'

Log file looks like...

MSI (s) (D0:70) [20:46:09:845]: Executing op: CustomActionSchedule(Action=InstallPortMonitor,ActionType=3089,Source=C:\Windows\system32\XXX.dll,Target=OnMSIInstall,)
MSI (s) (D0:98) [20:46:09:923]: Invoking remote custom action. DLL: C:\Windows\system32\XXX.dll, Entrypoint: OnMSIInstall
MSI (s) (D0:68) [20:46:09:970]: Generating random cookie.
MSI (s) (D0:68) [20:46:10:017]: Created Custom Action Server with PID 232 (0xE8).
MSI (s) (D0:2C) [20:46:10:079]: Running as a service.
MSI (s) (D0:2C) [20:46:10:110]: Hello, I'm your 64bit Elevated custom action server.
MSI (s) (D0:70) [20:46:10:266]: Executing op: ActionStart(Name=SetConfigFileName,,)
MSI (s) (D0:70) [20:46:10:329]: Executing op: CustomActionSchedule(Action=SetConfigFileName,ActionType=3073,Source=BinaryData,Target=CallStdFcn,CustomActionData=C:\Windows\system32\XXX.dll?D;SetConfigFileNameResult;S;SetConfigFileName;Q;S;I;C:\Program Files\foo\bar\default.xml?)
MSI (s) (D0:84) [20:46:10:360]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI6D1D.tmp, Entrypoint: CallStdFcn
MSI (s) (D0:68) [20:46:10:485]: Generating random cookie.
MSI (s) (D0:68) [20:46:10:532]: Created Custom Action Server with PID 3036 (0xBDC).
MSI (s) (D0:2C) [20:46:10:688]: Running as a service.
MSI (s) (D0:2C) [20:46:10:953]: Hello, I'm your 32bit Elevated custom action server.
MSI (c) (68:CC) [20:46:11:077]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

Error 4111. File not found: C:\Windows\system32\XXX.dll.
MSI (s) (D0!DC) [20:47:14:037]: Product: foo -- Error 4111. File not found: C:\Windows\system32\XXX.dll.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Call a function from a standard dll x64

Hello,

I am afraid the log you are posting does not offer much information as to why this is failing.

Are you sure the DLL is compiled as a 64bit DLL?
Also, please send your .aip project file to support at advancedinstaller dot com so we can further investigate the issue.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Call a function from a standard dll x64

Hello,

I've studied your .aip project file.
Try placing the custom actions after InstallExecute standard action. During InstallExecute all files, including your XXX.dll are installed. Before then, they are not yet installed and the dll can not be found.

Let me know if this worked.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
RDC
Posts: 7
Joined: Thu Mar 05, 2009 2:17 pm

Re: Call a function from a standard dll x64

Is that really true...? As a 32 bit package this all works perfectly... and whilst the dialog reporting the error is displayed I can do a dir of c:\windows\system32\ and see that the DLL is present and then removed when the dislog is dismissed.

Trying it regardless... exactly the same problem.

Looking at the log extract I sent earlier it says just prior to the error...
MSI (s) (D0:2C) [20:46:10:953]: Hello, I'm your 32bit Elevated custom action server.

Doesn't this mean it's running as 32 bit which implies it won't be able to find the native x64 system32 directory where the .dll is. Even if it did there must be some dark magic going on for it to then to be able to call into the x64 dll where the custom action is...

Or am I missing something?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Call a function from a standard dll x64

Hello,

The custom action launching your dll is currently written for 32bit platforms. Unfortunately this can not launch your 64bit dll.
We will improve this behavior in the future to enable calling functions from 64bit dlls.

In the meanwhile you can call your DLL through an exported function with a signature like the one in the following tutorial:
http://www.advancedinstaller.com/user-g ... n-dll.html

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
RDC
Posts: 7
Joined: Thu Mar 05, 2009 2:17 pm

Re: Call a function from a standard dll x64

GabrielBarbu wrote:The custom action launching your dll is currently written for 32bit platforms. Unfortunately this can not launch your 64bit dll.
We will improve this behavior in the future to enable calling functions from 64bit dlls.
Ouch.

I can't see that they are 32 bit only documented anywhere, if I had seen it then I would have avoided using them... Come to that, why is AI even letting me generate them, isn't AI aware that the target DLL is 64 bit and it won't work?

As I now have 60+ of these custom actions in the full installation that I'll now have to code using native MSI handles and retest just to get a simple installation to work I really have to question if AI is still the right product for us to be using.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Call a function from a standard dll x64

Hello,

Sorry for the bad news. We are definitely planning to implement this support.
There are many things to be done and we do our best to keep up with our customers' needs. Rest assured we have this feature high on our TODO list and will implement it as soon as possible.

Again, sorry for the inconvenience.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”