Calling a function from DLL - Advanced Installer Community
prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Calling a function from DLL

Hello,

I have a DLL which installs SQLite ODBC driver and creates System DSN and some registry entries on the machine. When I call the DLL via command line (admin) as below, everything works fine.

Code: Select all

>rundll32 sqlite3odbc_x64.dll,install
To achieve the same behaviour via an installer, I added the dll file in "Application Folder" and I created a custom action with sequence "Call Function From Installed Native DLL". Below is the screenshot of the customm action:
Untitled.png
Untitled.png (82.94 KiB) Viewed 20295 times
When I run the installer, I do not get any errors but the DSN and registry entries are not created. I am running the installer as admin.
In the logs I get the following:

Code: Select all

Action 15:45:57: sqlite3odbc_x64.dll. 
MSI (s) (68:2C) [15:45:57:685]: Executing op: CustomActionSchedule(Action=sqlite3odbc_x64.dll,ActionType=3089,Source=C:\Program Files\Test\Test\sqlite3odbc_x64.dll,Target=install,)
MSI (s) (68:C0) [15:45:57:685]: Invoking remote custom action. DLL: C:\Program Files\Test\Test\sqlite3odbc_x64.dll, Entrypoint: install
MSI (s) (68:A8) [15:45:57:685]: Generating random cookie.
MSI (s) (68:A8) [15:45:57:685]: Created Custom Action Server with PID 3628 (0xE2C).
MSI (s) (68:B4) [15:45:57:700]: Running as a service.
MSI (s) (68:B4) [15:45:57:700]: Hello, I'm your 64bit Elevated Non-remapped custom action server.
MSI (s) (68:2C) [15:45:57:825]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=3528061)
Action ended 15:45:57: InstallExecute. Return value 1.
Is there anything else that needs to be done to make it work successfully?

Prerak
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Calling a function from DLL

Hello Prerak,

I'm not sure why you encountered this behaviour. In order to further investigate this, can you please sens us the sqlite3odbc_x64.dll to support at advancedinstaller dot com?

Also, please send us the .AIP (project file) and a verbose log of the installation process so we can investigate it? If it contains confidential information you can send us a small test project which reproduce this behavior.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Calling a function from DLL

HI Dan,

I have emailed you the requested files.

Reagrds,
Prerak
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Calling a function from DLL

Hello Prerak,

We answered your e-mail, please see.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Calling a function from DLL

Hi Mihal,

Thank you for the response.
The method suggested, did the work for me.

But I have a second issue now. My requirement is to install SQLite on the user's machine silently. So when I run the following command, it works fine.

Code: Select all

rundll32 sqlite3odbc_x64.dll,install quiet
So in "Call Function fro Standard DLL" customm action I added an argument with the following properties:
  • Type: Unicode String
    Passing Method: By Reference (I am unable to select "By Value")
    Value Binding: Inline value (I also tried with Value Binding: Property)
    Value: quiet
But I get the alert from the dll saying "Installation successful".

I also tried by changing the types of parameter but the result was always the same,

So how can I pass the "quiet" parameter so that it installs without any UI?

Prerak
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Calling a function from DLL

Hello Prerak,

I think this happens because the "quiet" argument is a proprietary command line argument of the "rundll32.exe" tool and not of the "sqlite3odbc_x64.dll" library. To launch the same command from Advanced Installer too you can create your own BAT file and launch it using a "Launch file" custom action.

Also, as a side note, have you tried to use our "ODBC" page support to install your ODBC driver and see how this works?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Calling a function from DLL

Hi Daniel,

Thank you for the update. I'll try it with the Launch File custom action.

Regarding ODBC page, yes I had a look at it before. But I had the following issues:
1. SQLQite Driver is not in the list of drivers for Data Source as its not uninstalled on the machine.
2. I add the driver from ODBC page using thr DLL. After that, while adding the Data Source, if I select the previously added Project Driver, installation fails. It says "Please make sure xxx Driver already exist and you can access it." So I suppose, I can only create a driver or a data source at a time and not both together.

Let me know if anything can be done to solve this.

Prerak
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Calling a function from DLL

Hello Prerak,

You're always welcome.
1. SQLQite Driver is not in the list of drivers for Data Source as its not uninstalled on the machine.
In this case you can simply manually type in the driver name (SQLite3 ODBC Driver) in the "Driver name" field.
2. I add the driver from ODBC page using thr DLL. After that, while adding the Data Source, if I select the previously added Project Driver, installation fails. It says "Please make sure xxx Driver already exist and you can access it." So I suppose, I can only create a driver or a data source at a time and not both together.
No, you should be able to install a data source for a driver installed by the same setup. During installation the ODBC drivers are installed first before the ODBC data sources. I've took a look over the AIP (setup project) you sent us and run some tests. You could get the related error (driver not found) when the component of your driver is marked as a "64-bit Component" whereas the component of your datasource is not, or viceversa. Here is how you should proceed:
1. go to "ODBC" page and add a driver for the "sqlite3odbc_x86.dll" driver
2. from its context menu choose "Go To Component" option and add the following condition on its component:

Code: Select all

NOT VersionNT64
3. add another driver entry in "ODBC" page for the "qlite3odbc_x64.dll" driver too
4. from its context menu choose "Go To Component" option and mark its component as "64-bit Component" and add the following condition on the component:

Code: Select all

VersionNT64
5. go to "ODBC" page and add two data sources: one for the 64-bit systems and the other for 32-bit systems; mark their component accordingly and use the same conditions as for their targeted driver compnents

Also, I've sent you by email a buildable sample which you can test on your side.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
prerak6962
Posts: 112
Joined: Mon Dec 08, 2014 5:26 pm

Re: Calling a function from DLL

Hi Daniel,

Thank you for the details.
I forgot to configure the condition for Driver as per the OS version.
It works fine now.

I have one more question, I can install the driver via a dll that is added in the Application Folder. But is it possible to add the driver using a Temporary file?
I added the DLL as a temporary file but in the ODBC window, when I go for selecting the DLL, I do not see the Temporary files.

Prerak
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Calling a function from DLL

Hello Prerak,

The ODBC Driver support can be used only with regular files. It can't be used with temporary files.

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”