Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using com 32 bits library on 64 bits application

Tags:

c++

com

com+

i have a 32 com library and would like to use its functionality by a 64 bits application , i 've searched on the internet and managed to get this workaround

  1. Locate your COM object GUID under the HKey_Classes_Root\Wow6432Node\CLSID\[GUID]
  2. Once located add a new REG_SZ (string) Value. Name should be AppID and data should be the same COM object GUID you have just searched for
  3. Add a new key under HKey_Classes_Root\Wow6432Node\AppID\
  4. The new key should be called the same as the com object GUID
  5. Under the new key you just added, add a new REG_SZ (string) Value, and call it DllSurrogate. Leave the value empty
  6. Create a new Key under HKey_Local_Machine\Software\Classes\AppID\

but it does not work on Windows 7 64 bits , the main problem is when i do the step 6 i found the key already existed, any body knows why ? or how can i overcome it ?

the documentation here is very brief

like image 956
Yamen Ajjour Avatar asked Jul 06 '13 12:07

Yamen Ajjour


People also ask

Can a 64-bit application use a 32-bit library?

On 64-bit Windows, a 64-bit process cannot load a 32-bit dynamic-link library (DLL). Additionally, a 32-bit process cannot load a 64-bit DLL.

What happens if you use 32-bit on 64-bit?

To put it in simple words, if you run a 32-bit program on a 64-bit machine, it will work fine, and you won't encounter any problems. Backward compatibility is an important part when it comes to computer technology. Therefore, 64 bit systems can support and run 32-bit applications.

Will 32-bit and 64-bit combination compatible and will work together?

In short: You can't link a 32-bit app to a 64-bit library. You can run a 32-bit application, using 32-bit shared libraries on a 64-bit OS (at least all the popular 32-/64-bit processors such as AMD, Intel and Sparc). But that doesn't involve any libraries.


1 Answers

So, what you need to do here is start up this 32bit COM component in its own process, ie by calling CoCreateInstance with CLSCTX_LOCAL_SERVER.

Either this will be straight forward with the existing DLL, or if not you should wrap it with your own 32bit simple COM component which supports running as a local server...

Trying to tweak the registry is a no-win game - use the Dll as it was intended and save yourself the pain.

like image 146
GlynD Avatar answered Sep 24 '22 21:09

GlynD