cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
carryr
Level 5

Load dlls

Hello

I have a dll on 64bits, and I need to load it, With the same dll on 32bits I used "useDLL" and it works fine, but I have read that this funcion (usedll) does not working with 64bits dlls, it is ok?

Somebody knows how can I load the dll??

thanks
Labels (1)
0 Kudos
8 Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

UseDLL does not support 64-bit DLLs. If you are using an MSI-based project, you can launch 64-bit MSI DLLs as MSI custom actions. Otherwise, at this point, you will have to manually host calls to this DLL in some sort of 64-bit exe.
0 Kudos
Cary_R
Level 11

MichaelU wrote:
UseDLL does not support 64-bit DLLs. If you are using an MSI-based project, you can launch 64-bit MSI DLLs as MSI custom actions. Otherwise, at this point, you will have to manually host calls to this DLL in some sort of 64-bit exe.


To that effect, if the function call is simple enough, you could try RunDll32.exe. The major downside to this approach in a custom action is that even if the call fails, it will always appear to be successful:

http://support.microsoft.com/kb/164787/en-us

Your best bet is to write a wrapper of some sort to call it, as Michael said. Particularly if the success or failure of the call is of importance.
0 Kudos
carryr
Level 5

Cary R wrote:
To that effect, if the function call is simple enough, you could try RunDll32.exe. The major downside to this approach in a custom action is that even if the call fails, it will always appear to be successful:

http://support.microsoft.com/kb/164787/en-us

Your best bet is to write a wrapper of some sort to call it, as Michael said. Particularly if the success or failure of the call is of importance.


Thanks for your help
Sorry for this but, how must I create that custom? I don't created that king of custom, so I'm a little lost...
Thanks
0 Kudos
Cary_R
Level 11

Hi There,

For the custom action using RunDll32.exe, you'd just follow this KB for the 64 bit RunDll32.exe, and the path to the *.dll:

http://kb.flexerasoftware.com/selfservice/viewContent.do?externalId=Q111515

The 64 bit location is "[System64Folder]RunDll32.exe"

For writing an executable wrapper, I'd start by taking a look at samples in C++ for calling *.dll's, and just make a small console app in Visual Studio that does nothing more than call the function and interpret the return code to be 0 for Success and non-zero for a failed call to the *.dll (which will halt the installation with an error).

There should be lots of examples on MSDN for this to get you started, or even CodeProject.
0 Kudos
carryr
Level 5

Cary R wrote:
Hi There,

For the custom action using RunDll32.exe, you'd just follow this KB for the 64 bit RunDll32.exe, and the path to the *.dll:

http://kb.flexerasoftware.com/selfservice/viewContent.do?externalId=Q111515

The 64 bit location is "[System64Folder]RunDll32.exe"

For writing an executable wrapper, I'd start by taking a look at samples in C++ for calling *.dll's, and just make a small console app in Visual Studio that does nothing more than call the function and interpret the return code to be 0 for Success and non-zero for a failed call to the *.dll (which will halt the installation with an error).

There should be lots of examples on MSDN for this to get you started, or even CodeProject.


Thanks for your help, again...
The first thing I have done is to try loading with "rundll32". First I have disable WOW64FSREDIRECTION, then with a Launch run it. And the result of the launch is ok :eek: but the installation finish bad. With what I believe the custom is going to have the same result, no?
Really I tried to create a custom but in the log I see an error in the function..
With what I think I'll have to create an executable wrapper 😞
0 Kudos
carryr
Level 5

Hello again...

One thing, it is possible to use "LoadLybrary" to do this? How can I use it??

Thankssssss
0 Kudos
MichaelU
Level 12 Flexeran
Level 12 Flexeran

Nope; UseDLL is built on LoadLibrary and related APIs, and this is the step that will fail if a 32-bit program tries to load a 64-bit DLL (or vice versa).
0 Kudos
carryr
Level 5

MichaelU wrote:
Nope; UseDLL is built on LoadLibrary and related APIs, and this is the step that will fail if a 32-bit program tries to load a 64-bit DLL (or vice versa).


Thanks Michael
I hope that they change the installscript engine to 64, because we are beginning to need with urgent...
0 Kudos