The_Mundane
The_Mundane

Reputation: 107

Is it possible to load a 64-bit dll into a 32-bit process?

Is it possible to load a 64-bit dll into a 32-bit process ?
Generally speaking, I know it can not happen.
Yet, maybe there are some exceptions ?

Upvotes: 1

Views: 2264

Answers (4)

Darwin Zou
Darwin Zou

Reputation: 26

Yes, you can load 64 code in 32 bit module. example: vmprotect metatrader4 above software mixed x86 and x64 in one process. I found metatrade4 for win7 has a function it exeucte a instruction like : jmp 0x33:0x175328 segment selector 33 is a 64bit segment. after execution this instruction, cpu will switch to 64bit mode from 32bit mode.

if you use windbg to trace some windows api on windows x64 OS, you will find similar code. for example: NtQueryInformationProcess

Upvotes: 0

gehho
gehho

Reputation: 9238

In .NET, it is possible to load a 64-bit DLL into a 32-bit process for reflection only. For details please check "Analyze 64-bit DLL from within T4 template in Visual Studio (32-bit) using Reflection".

I know that this is a special case, but I thought I'd add it anyway because it might help others looking for a similar solution as me.

Upvotes: 1

linquize
linquize

Reputation: 20366

But new computer bought today at least have 4G ram. We cannot prevent using 64-bit OS to avoid problem. We must face 64-bit positively! Server 2008 R2 only have 64-bit. Issues around EXE AnyCPU / x86, 32-bit COM / C++ dll must be handled. Ideally compile both 32 and 64 bit COM / C++ dll.

Upvotes: -1

CharlesB
CharlesB

Reputation: 90276

No, and neither a 64-bit process can load a 32-bit DLL.

If you're on a 64 bit OS, you can load the DLL in a 64-bit process and have it communicate with your 32-bit process through IPC.

If you're on a 32 bit OS, you're out of luck.

Upvotes: 2

Related Questions