Register 32 bit COM DLL to 64 bit Windows 7
Asked Answered
B

10

32

I have a 32 bit COM component DLL and this DLL is written in Delphi. It's a Win32 DLL. I want to use this DLL in my Visual C# project on .NET platform.

I can't add reference to this DLL in the project. I try to register it in Command Prompt as Administrator in Windows 7 64 bit, but I get this error:

Check if the module is compatible with an x86 (32-bit) or x64 (64-bit) version of regsvr32.exe.

First I put DLL file to windows/system32 folder. Then I open Command Prompt as Administrator. I write regsvr32 huginalpha.dll and execute this command. But I get the error. what can I do?

Bish answered 9/8, 2010 at 12:11 Comment(1)
see this post about the 0x8007000B Error #18008467Spadefish
D
55

The problem is likely you try to register a 32-bit library with 64-bit version of regsvr32. See this KB article - you need to run regsvr32 from windows\SysWOW64 for 32-bit libraries.

Diffuse answered 9/8, 2010 at 13:24 Comment(5)
+1, indeed. And that DLL should not be stored in c:\windows\system32 either, that's for 64-bit components.Jeromyjerreed
Right, so the file called 32 is actually 64 bit, and the 32-bit version is in a directory called WOW64.Brittne
Sounds like more recent versions of regsvr32 may deal with this better: #18935663Forelli
That's curious. It's unclear how a 64-bit version of regsvr32 would identify that the .dll is 32-bit.Diffuse
Thanks a lot for your answer ! Was struggling so much with a way to register correct a 64 bit .dll file and was using the wrong command C:\Windows\SysWOW64\regsvr32.exe .\my.dll instead of using C:\Windows\System32\regsvr32.exe .\my.dll.Feeney
E
30

For 32 bit DLLS in Windows 64 bit platforms:

  1. Copy whatever.dll to c:\windows\sysWOW64\
  2. Open a CMD prompt AS ADMINISTRATOR (very important)

In the CMD window:

  1. CD c:\windows\sysWOW64\
  2. regsvr32 whatever.dll

You will then be executing the 32-bit regsvr (c:\windows\sysWOW64\regsvr.exe) on a 32 bit dll

Embitter answered 28/11, 2012 at 18:7 Comment(2)
+1 Your stressing on the point of running as administrator saved my life! :)Arnie
If you don't run as administrator it will say that the installation was successful, but it won't be registered. No other feedback you will receive (dam you, Microsoft!).Emersonemery
O
4

I believe, things have changed now. On My Win 2008 R2 Box, I was able to register a 32 bit dll with a 64 bit regsvr32 as the 64 bit version can detect the target bitness and spawn a new 32 bit regsvr32 from %SYSWOW% folder.

Refer: Registering a 32 bit DLL with 64 bit regsvr32

Onions answered 22/9, 2013 at 3:1 Comment(2)
regsvr32 has been working around bitness issues for long time, I suppose from the very start. If you a reg'ging a 32-bit DLL with 64-bit regsvr32, the latter detects the problem and starts internally 32-bit version of regsvr32 and forwards registration there. This works well in the opposite direction as well.Aquino
@RomanR.: I would have guessed but seeing this SO question and the KB article support.microsoft.com/kb/282747, this would make me wonder.Onions
B
2

http://onerkaya.blogspot.com/2013/03/register-com-dll-on-windows-64-bit.html

Retrieving the COM class factory for component with CLSID {...} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

if you try this;

c:\windows\system32\regsvr32.exe < filename >.dll

you can still take this exception. so IIS- pool Advanced settings, Enable 32 bit application : true ;)

Brocade answered 6/4, 2013 at 11:51 Comment(1)
IIS-> pool Advanced settings, Enable 32 bit application : true this really solved the problem. +1 for it.Burmeister
B
2

To register a comm .dll or .ocx on Windows 7 32-bit, do the following:

Copy .dll or .ocx to c:\windows\system32 Type cmd in Run menu, it will search cmd.exe, right click and click Run as Administrator

It will show a prompt at c:\windows\system32

Type

regsvr32 ocxname.ocx to register .ocx

or

type regsvr32 dllname.dll to register .dll

Braun answered 12/1, 2017 at 6:23 Comment(1)
for xp also testedBraun
L
0

put the dll in system32 or syswow32 directory, and use appropriate regsvr32 to register it. wiered that even though it gave failed to register error, I rebooted my WIN 7 64 AND my vb app loaded the dll just fine!!

Lilian answered 17/3, 2011 at 19:16 Comment(0)
E
0

If problem not resolved, when using SysWoW64 version of regsvr32, make sure all library dependencies have same archetecture. For example, when

regsvr32 lib_x86.dll fails to register library, and %SystemRoot%\SysWow64\regsvr32 lib_x86 also fails, try to load lib_x86 to Dependency Walker application to see whole list of dependencies. If any item have 64-bit archetecture, here is the reason, why regsvr32 fails to load 32-bit library.

Expressman answered 27/4, 2012 at 10:29 Comment(0)
P
0

Try to run it at Framework64.

Example:

  • 32 bit

    C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe D:\DemoIconOverlaySln\Demo\bin\Debug\HandleOverlayWarning\AsmOverlayIconWarning.dll /codebase 
    
  • 64 bit

    C:\Windows\Microsoft.NET\Framework64\v2.0.50727\RegAsm.exe D:\DemoIconOverlaySln\Demo\bin\Debug\HandleOverlayWarning\AsmOverlayIconWarning.dll /codebase
    
Penang answered 21/2, 2013 at 9:48 Comment(2)
This (regasm.exe) is for .NET assemblies only.Jesusitajet
Ok. I answered the question on, important that you understand the level. NET assemblies howPenang
S
0

I was getting the error "The module may compatible with this version of windows" for both version of RegSvr32 (32 bit and 64 bit). I was trying to register a DLL that was built for XP (32 bit) in Server 2008 R2 (x64) and none of the Regsr32 resolutions worked for me. However, registering the assembly in the appropriate .Net worked perfect for me. C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe

Scevour answered 15/4, 2014 at 10:56 Comment(0)
I
0

Below link saved the day

https://msdn.microsoft.com/en-us/library/ms229076(VS.80).aspx

use the relevant RegSvcs as specified in the above link

c:\Windows\Microsoft. NET\Framework\v4.0.30319\RegSvcs.exe ....\Shared\Your.dll /tlb:Your.tlb

Illtimed answered 5/2, 2015 at 10:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.