11

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

Raptor
  • 53,206
  • 45
  • 230
  • 366
Yamen Ajjour
  • 1,422
  • 13
  • 32
  • 1
    Step 3 is supposed to create the key visible to 32-bit programs. The more accurate keyname is HKLM\Software\Wow6432Node\Classes\AppID. Step 6 is supposed to create the key visible to 64-bit programs, same path minus the "Wow6432Node" part. Something very wrong with your machine if the key you created in step 3 is visible at the path in step 6. Don't skip the Wow6432Node part. – Hans Passant Jul 06 '13 at 12:42
  • do you thing the problem can exists becuase i've used or using 32 bits or 64 bits regedit ? can the problem be that i registered the library with 32 or 64 regsrv32.exe ? – Yamen Ajjour Jul 06 '13 at 12:54
  • 1
    Have you considered rebuilding the library as 64? (Or, I suppose a better question would be, do you have access to the library source?) – George Newton Jul 09 '13 at 09:09
  • Perhaps use .net to bridge API calls as Adapter – hB0 Jul 12 '13 at 11:09
  • Possible duplicate of [How to use a 32 bit COM object on Windows Server 2008 (works on 2008 R2 but non 2008)](http://stackoverflow.com/questions/4043954/how-to-use-a-32-bit-com-object-on-windows-server-2008-works-on-2008-r2-but-non). – IInspectable Aug 03 '13 at 15:11

4 Answers4

1

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.

GlynD
  • 422
  • 4
  • 9
0

It could be caused by registry virtualization. Ive had problems like this in the past. The biggest annoyance is that you cant see the values or keys that the editor is complaining already exist. They actually exist in a different part of the registry (likely the users hive).

Good luck

tHand
  • 301
  • 1
  • 5
0

64-bit executable cannot call a 32-bit DLL (and vice versa). You should compile your 64-bit application as 32-bit. That way you will be able to use the DLL and run all that on 32-bit and 64-bit OS.

user1764961
  • 673
  • 7
  • 21
0

Registry is just a suitable way to locate required dll.

If you know path to the 32bit dll on each system or you can pass it with your application, and you control the code of your 64bit app, then you can use following techniques: 1) SxS mechanism + manifests allows to load dll from a local folder without registring it and create COM components from it 2) Make this manually http://www.codeproject.com/Articles/18433/Emulating-CoCreateInstance

The 2nd solution is much simpler...

KKas
  • 5
  • 2