Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load 32bit DLL library in 64bit application

Is there a way to load a 32bit DLL library (something with the same usage as LoadLibrary) I would like to use that function along with GetProcAddress.

I looked at WOW, but it does not seem to offer the functionality. The functionality should exist, since tools like DependencyWalker are able to read the symbols of a 32bit dll even though its 64bits.

thanks

like image 340
adk Avatar asked Feb 15 '10 09:02

adk


People also ask

Can we use 32-bit DLL in 64-bit application C#?

You can not run a 32-bit DLL inside a 64-bit process, no matter how hard you try, so you need to run it in a 32-bit process. If compiling your application for 32-bit only is not an option, you have no choice but to create a host application.

How do I run a 32bit program on a 64-bit system?

WOW64 is the x86 emulator that allows 32-bit Windows-based applications to run seamlessly on 64-bit Windows. This allows for 32-bit (x86) Windows applications to run seamlessly in 64-bit (x64) Windows, as well as for 32-bit (x86) and 32-bit (ARM) Windows applications to run seamlessly in 64-bit (ARM64) Windows.


2 Answers

You can only load a 32bit DLL into a 64 bit process when you are loading the dll as a datafile. You can't execute the code. (http://support.microsoft.com/kb/282423)

Microsoft recommends that you use interprocess COM to use 32 bit code with a 64 bit application. Here's an article explaining the process.

like image 159
John Knoeller Avatar answered Sep 28 '22 09:09

John Knoeller


If all you're wanting to do is get resources from it, you can load as a datafile:

LoadLibraryEx(exeName, NULL, LOAD_LIBRARY_AS_DATAFILE); 

Then call FindResource as normal.

like image 23
Dave F Avatar answered Sep 28 '22 08:09

Dave F