在Windows Server 2008 R2上注册DLL文件

发布于 2024-10-09 15:57:44 字数 674 浏览 0 评论 0原文

我正在尝试在 Windows Server 2008 R2 上注册 COM DLL 文件。以下是我采取的步骤:

  1. 以管理员身份运行 cmd
  2. c:\windows\system32\regsvr32.exe c:\tempdl\temp12.dll

当我执行该命令时,我得到这个错误:

模块 temp12.dll 加载失败。确保二进制文件存储在指定路径或首次启动它以检查二进制文件或依赖的 .DLL 文件是否存在问题。找不到指定的模块。

我能够在 Windows 2000 上注册相同的 DLL 文件。

我也尝试过

c:\windows\syswow64\regsvr32 "c:\tempdl\temp12.dll"

,但出现了这个错误:

模块c:\tempdl\temp12.dll已加载,但对DllRegisterServer的调用失败,错误代码为0x80040154。有关此问题的更多信息,请使用错误代码作为搜索词在线搜索

I'm trying to register a COM DLL file on Windows Server 2008 R2. Here are the steps I took:

  1. Run cmd as administrator
  2. c:\windows\system32\regsvr32.exe c:\tempdl\temp12.dll

When I execute that command I get this error:

The module temp12.dll failed to load. Make sure the binary is stored at the specified path or debut it to check for problems with the binary or dependent .DLL files. The specified module could not be found.

I was able to register the same DLL file on Windows 2000.

I also tried

c:\windows\syswow64\regsvr32 "c:\tempdl\temp12.dll"

And I got this error:

the module c:\tempdl\temp12.dll was loaded but the call to DllRegisterServer failed with error code 0x80040154. For more information about this problem, search online using the error code as the search term

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

停顿的约定 2024-10-16 15:57:44

这是当 DLL 本身需要首先注册另一个 COM 服务器或依赖于另一个不可用的 DLL 时出现的错误。 Regsvr32.exe 工具做的事情很少,它调用 LoadLibrary() 来加载命令行参数中传递的 DLL。然后 GetProcAddress() 查找 DLL 中的 DllRegisterServer() 入口点。并调用它,让 COM 服务器自行注册。

该代码的作用是相当难以猜测的。然而,从错误代码中您得到的诊断结果是不言而喻的,由于某种原因,该 COM 服务器需要先注册另一个 COM 服务器。错误消息很糟糕,它没有告诉您它需要什么其他服务器。 COM 错误处理方式的一个令人悲伤的副作用。

要解决此问题,请使用 SysInternals 的 ProcMon 工具。它向您显示 Regsvr32.exe(实际上:COM 服务器)打开哪些注册表项来查找服务器。查找对 CLSID 密钥的访问。这会提示您它正在寻找什么 {guid}。这仍然不能完全告诉您服务器 DLL,您应该将跟踪与从工作机器获得的跟踪进行比较。 InprocServer32 键具有 DLL 路径。

That's the error you get when the DLL itself requires another COM server to be registered first or has a dependency on another DLL that's not available. The Regsvr32.exe tool does very little, it calls LoadLibrary() to load the DLL that's passed in the command line argument. Then GetProcAddress() to find the DllRegisterServer() entry point in the DLL. And calls it to leave it up to the COM server to register itself.

What that code does is fairly unguessable. The diagnostic you got is however pretty self-evident from the error code, for some reason this COM server needs another one to be registered first. The error message is crappy, it doesn't tell you what other server it needs. A sad side-effect of the way COM error handling works.

To troubleshoot this, use SysInternals' ProcMon tool. It shows you what registry keys Regsvr32.exe (actually: the COM server) is opening to find the server. Look for accesses to the CLSID key. That gives you a hint what {guid} it is looking for. That still doesn't quite tell you the server DLL, you should compare the trace with one you get from a machine that works. The InprocServer32 key has the DLL path.

饮湿 2024-10-16 15:57:44

您可能需要使用 32 位版本的 regsvr32.exe 注册此 DLL:

c:\windows\syswow64\regsvr32 c:\tempdl\temp12.dll

You might need to register this DLL using the 32 bit version of regsvr32.exe:

c:\windows\syswow64\regsvr32 c:\tempdl\temp12.dll

左耳近心 2024-10-16 15:57:44

错误0x80040154是COM的REGDB_E_CLASSNOTREG,这意味着“类未注册”。基本上,COM 类不在安装注册表中声明。

如果您在尝试注册 DLL 时遇到此错误,则该 DLL 的注册代码可能正在尝试实例化另一个 COM 服务器(DLL 或 EXE),而该服务器缺少或未在该服务器上注册。安装。

如果您无法访问原始 DLL 源,我建议使用 SysInternal 的 进程Monitor 工具来跟踪 COM 注册表查找(曾经有一个更简单的 RegMon 工具,但它可能不再工作)。

您应该在工作进程上放置一个过滤器(此处:Regsvr32.exe)以仅捕获感兴趣的内容。然后,您应该在 HKEY_CLASSES_ROOT\[a progid, a string] 上查找失败的查询(例如 NAME_NOT_FOUND 错误),或者 HKEY_CLASSES_ROOT\CLSID\[a guid] 上的查询失败。

PS:不幸的是,在完美运行的 Windows 系统上可能有很多事情似乎会失败,因此您必须仔细研究所有错误。祝你好运 :-)

Error 0x80040154 is COM's REGDB_E_CLASSNOTREG, which means "Class not registered". Basically, a COM class is not declared in the installation registry.

If you get this error when trying to register a DLL, it may be possible that the registration code for this DLL is trying to instantiate another COM server (DLL or EXE) which is missing or not registered on this installation.

If you don't have access to the original DLL source, I would suggest to use SysInternal's Process Monitor tool to track COM registry lookups (there use to be a more simple RegMon tool but it may not work any more).

You should put a filter on the working process (here: Regsvr32.exe) to only capture what's interesting. Then you should look for queries on HKEY_CLASSES_ROOT\[a progid, a string] that fail (with the NAME_NOT_FOUND error for example), or queries on HKEY_CLASSES_ROOT\CLSID\[a guid] that fail.

PS: Unfortunately, there may be many thing that seem to fail on a perfectly working Windows system, so you'll have to study all errors carefully. Good luck :-)

清风夜微凉 2024-10-16 15:57:44

我在将我的 ActiveX (OCX) 注册到 Windows Server 2008 R2 时发现了类似的问题。为了解决这个问题,我使用了 http://www.chestysoft.com/dllregsvr/default.asp 工具。我的 ocx 存在一些依赖性问题,因此我收到“模块 temp12.dll 无法加载。请确保二进制文件存储在指定的路径或首次启动它以检查二进制或依赖的 .DLL 文件是否有问题”错误消息。
当您尝试使用此工具注册 OCX 时,如果 ocx 有依赖项,它会提示消息,否则您将收到成功消息。我收到了 mfc70.dll 和 msvcr70.dll 依赖项的消息。所以我将这些 dll 粘贴到 C 的 system32 文件夹中:\windows 就完成了。之后我成功注册了我的 ocx。我在 windows server 2008 R2 64 位机器上使用了 32 位版本的 chestysoft 工具 (dllregsvr.exe)。

I have found similar issue while registering my activeX (OCX) into windows server 2008 R2.To solve this i used http://www.chestysoft.com/dllregsvr/default.asp tool.There is some dependance problem with my ocx so I am getting "The module temp12.dll failed to load. Make sure the binary is stored at the specified path or debut it to check for problems with the binary or dependent .DLL files. The specified module could not be found" error message.
When you try to registered your OCX with this tool it will prompt message if the ocx is having dependency or you will get success message.I got message for mfc70.dll and msvcr70.dll dependency.so i paste these dll into system32 folder of C:\windows and its done.After that I register my ocx sucessfully.I used 32 bit version of chestysoft tool (dllregsvr.exe) on windows server 2008 R2 64bit machine.

待"谢繁草 2024-10-16 15:57:44
星星的軌跡 2024-10-16 15:57:44

如果您的 COM 对象使用 ATL,则可能需要安装 ATL,如本知识库文章所述:

http://support .microsoft.com/kb/201191

这些库可能必须由开发人员提供,以确保版本正确。

You may need to install ATL if your COM objects use ATL, as described by this KB article:

http://support.microsoft.com/kb/201191

These libraries will probably have to be supplied by developers to ensure the correct version.

雪花飘飘的天空 2024-10-16 15:57:44

这是必须发生的事情。

您必须将要注册的 DLL 复制到:
c:\windows\SysWOW64\

然后在“运行”对话框中键入:
C:\Windows\SysWOW64\regsvr32.exe c:\windows\system32\YourDLL.dll

您将收到以下消息:

c:\windows\system32\YourDLL.dll 中的 DllRegisterServer 成功。

This is what has to occur.

You have to copy your DLL that you want to Register to:
c:\windows\SysWOW64\

Then in the Run dialog, type this in:
C:\Windows\SysWOW64\regsvr32.exe c:\windows\system32\YourDLL.dll

and you will get the message:

DllRegisterServer in c:\windows\system32\YourDLL.dll succeeded.

谎言月老 2024-10-16 15:57:44

您需要 regsvr32 的完整路径,因此 %windir$\system32\regsvr32 <*.dll>

You need the full path to the regsvr32 so %windir$\system32\regsvr32 <*.dll>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文