在Windows Server 2008 R2上注册DLL文件 [英] Register DLL file on Windows Server 2008 R2
问题描述
我试图在Windows Server 2008 R2上注册一个COM DLL文件。以下是我采取的步骤:
I'm trying to register a COM DLL file on Windows Server 2008 R2. Here are the steps I took:
- 以管理员身份运行
cmd
-
c:\windows\system32\regsvr32.exe c:\tempdl\temp12.dll
- Run
cmd
as administrator c:\windows\system32\regsvr32.exe c:\tempdl\temp12.dll
当我执行该命令时,我得到这个错误:
When I execute that command I get this error:
模块
temp12.dll
无法加载。确保二进制文件存储在指定的路径或首次登录以检查二进制或依赖的.DLL
文件的问题。指定的模块无法找到。
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.
我可以在Windows 2000上注册相同的DLL文件。
I was able to register the same DLL file on Windows 2000.
我也尝试过
c:\windows\syswow64\regsvr32 "c:\tempdl\temp12.dll"
我收到这个错误:
模块
c:\tempdl\temp12.dll
已加载,但调用code> DllRegisterServer 失败,错误代码0x80040154
。有关此问题的更多信息,请使用错误代码搜索在线搜索
the module
c:\tempdl\temp12.dll
was loaded but the call toDllRegisterServer
failed with error code0x80040154
. For more information about this problem, search online using the error code as the search term
推荐答案
当DLL本身需要首先注册另一个COM服务器或者对另一个不可用的DLL有依赖关系时,就会发生这样的错误。 Regsvr32.exe工具很少,它调用LoadLibrary()来加载在命令行参数中传递的DLL。然后,GetProcAddress()在DLL中找到DllRegisterServer()入口点。并呼吁将其留给COM服务器进行注册。
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.
代码所做的是相当无法估量的。然而,从错误代码中可以看到您所得到的诊断,但由于某些原因,该COM服务器需要首先注册另一个。错误信息很糟糕,它不会告诉你什么其他需要的服务器。 COM错误处理方式的一个悲伤的副作用。
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.
要解决此问题,请使用SysInternals的ProcMon工具。它显示注册表项Regsvr32.exe(实际上是:COM服务器)打开以查找服务器。查找对CLSID键的访问。这给你一个提示,它正在寻找什么{guid}。这仍然不完全告诉您服务器DLL,您应该将跟踪与您从可以工作的机器获得的跟踪进行比较。 InprocServer32键具有DLL路径。
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.
这篇关于在Windows Server 2008 R2上注册DLL文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!