CreateInstance 返回“无法找到指定的模块。”

发布于 2024-11-27 13:16:00 字数 3383 浏览 2 评论 0原文

我一直在尝试让在 Windows 2000 上运行的程序也能在 Windows 2003 上运行。到目前为止,为了让程序在 Windows 2003 上运行,我必须做的所有事情都与不正确的配置有关。现在,这段代码:

chr = pAdapterEnvPtr.CreateInstance(__uuidof(PFADAPTERMNGLib::PFAdapterEnv));

正在返回:

0x8007007E

或者换句话说:

The specified module could not be found.

我有两个其他程序和另一个.dll,我可以成功创建这些类的实例。但这似乎失败了。

我已使用 Procmon 尝试找出程序找不到的内容,但 Procmon 没有显示任何可能表明程序找不到某些内容的内容。

OleView 中,如果我尝试创建该类的实例,我会看到以下图像:

IClassFactory::CreateInstance 失败。严重性:SEVERITY_ERROR,设施:FACILITY_WIN32 ($8007007E

如果您查看图像的左侧,尝试创建 PFComgMng 的实例会出现相同的错误。(PFAdapterEnv code> 和 PFCompMng 使用相同的进程,PFAdapterMng.exe。)但是,PFMQMonitorPFSendPFTrace 均正常工作(其中使用 PFMQListen.exePFSend.dll>PFTraceService.exe。)

我想注意的另一件事是下面的代码:

hr = pPFCompMng.CreateInstance(__uuidof(PFADAPTERMNGLib::PFCompMng));

当它之前从 PFAdapterMng.exe 调用时工作得很好。 PFAdapterMng.exe 可以成功找到模块并创建实例,但尝试在 PFAdapterMng.exe 中创建类实例的任何其他进程都无法找到模块,导致此错误。

由于 Procmon 对这种特定情况没有帮助,有谁知道我可以做什么来找出是什么阻止其他进程找到该模块?

更新:

我无法通过分析运行 Dependency Walker,因为 PFAdapterMng.exePFTraceService.exe 必须作为服务运行。我尝试在分析 OleView 时运行 Dependency Walker 并尝试创建 PFAdapterEnvPFCompMng 的实例以尝试查找弄清楚为什么我收到找不到模块消息框。不幸的是,Dependency Walker 没有表明缺少任何内容。

UPDATE2:

也许我错过了 Procmon 日志中的某些内容,因此我通过在对 CreateInstance 的调用之前和调用之后捕获事件来创建一个新日志。也许其他人可以看一下并告诉我我是否错过了?我根本找不到任何迹象表明 PFMQListen.exe 无法找到某些内容。

这是一个包含 Procmon 文件(.csv)的压缩文件夹的链接 文件和 .xml 文件。

http://www.mediafire.com/?07jq8zj7emmpsvd

UPDATE3:

所以,我设法得到< code>Dependency Walker 在 Profile 模式下运行以创建 PFAdapterEnv 实例。 Dependency Walker 未找到任何丢失的 .dll

因此,Procmon 不会显示任何内容,Dependency Walker 也不会显示任何内容。我使用 ollydbg 在汇编级别单步执行代码,我注意到错误是在函数 NdrClientCall2 中创建的。我不知道这是否意味着什么。

关于我还可以尝试什么的任何想法?人们需要更多信息来帮助我解决这个问题吗?如果是这样,请询问。

UPDATE4:

我尝试使用 /RegServer 来注册应用程序,并且它有效。我之前尝试过使用 /RegServer,只是使用 /UnregServer 取消注册了所有内容。这次,我还从 Component Services 中删除了我需要的组件,因为我想在另一个身份下运行 PFAdapterMng

因此,在 /RegServer 上运行并双击应用程序时,似乎一切正常。但是,我希望一切都在不同的配置下运行。

如何配置一切以使应用程序按如下方式工作:

PFAdapterMng.exe - 注册为 /Service 并通过 services.msc 在另一个身份下运行代码> PFTraceServer.exe - 注册为 /Service 并通过 services.msc 以另一个身份运行

PFMQListen.exe - 注册作为 /RegServer ,将由 PFAdapterMng 启动 PFMQSend.dll - 注册到 Regsvr32 并由 PFAdapterMng 加载

谢谢, 克日什

I've been trying to get a program that worked on Windows 2000 to work on Windows 2003. Everything I've had to do so far to get the program to work on Windows 2003 has had to do with incorrect configuration. Right now, this piece of code:

chr = pAdapterEnvPtr.CreateInstance(__uuidof(PFADAPTERMNGLib::PFAdapterEnv));

is returning:

0x8007007E

or in other words:

The specified module could not be found.

I have two other programs and another .dll and I can successfully create instances of those classes. But this seems to fail.

I have used Procmon to try to figure out what the program can't find, but Procmon did not display anything that could indicate that the program could not find something.

In OleView, if I try to create an instance of the class, I see the following image:

IClassFactory::CreateInstance failed.  The specified module could not be found.  severity: SEVERITY_ERROR, facility: FACILITY_WIN32 ($8007007E

If you look on the left side of the image, trying to create an instance of PFComgMng gives me the same error. (PFAdapterEnv and PFCompMng use the same process, PFAdapterMng.exe.) However, PFMQMonitor, PFSend, and PFTrace all work correctly. (Which use PFMQListen.exe, PFSend.dll, and PFTraceService.exe.)

Another thing that I wanted to note is that the following piece of code:

hr = pPFCompMng.CreateInstance(__uuidof(PFADAPTERMNGLib::PFCompMng));

works perfectly fine when it gets called earlier from PFAdapterMng.exe. So it seems like PFAdapterMng.exe can successfully find the module and create the instance, but any other processes that try to create either of the instances of the classes within PFAdapterMng.exe can't find the module, resulting in this error.

Since Procmon isn't helping with this specific case, does anyone know what I could do to figure out what's keeping other processes from finding the module?

UPDATE:

I can't run Dependency Walker with profiling because PFAdapterMng.exe and PFTraceService.exe must be run as services. I tried to run Dependency Walker while profiling OleView and tried to create instances of PFAdapterEnv and PFCompMng to try to find out why I was getting the Module not found message box. Unfortunately, Dependency Walker didn't show that anything was missing.

UPDATE2:

Maybe I missed something in the Procmon log, so I created a new log by capturing events right before I stepped over the call to CreateInstance and right after the call. Maybe someone else could take a look and tell me if i missed it? I simply can't find any indications that PFMQListen.exe could not find something..

Here's a link to a zipped folder with a Procmon file, a .csv file, and a .xml file.

http://www.mediafire.com/?07jq8zj7emmpsvd

UPDATE3:

So, I managed to get Dependency Walker running under Profile mode to create an instance of PFAdapterEnv. Dependency Walker did not find any missing .dll's.

So, Procmon doesn't show anything, and neither does Dependency Walker. I was stepping through the code at the assembly level with ollydbg, and I noticed that the error was created in the function NdrClientCall2. I don't know if this means anything.

Any ideas as to what else I can try? Do people need more information to help me solve this problem? If so, please ask.

UPDATE4:

I tried using /RegServer to register the applications, and it worked. I tried using /RegServer previously, where I just unregistered everything using /UnregServer. This time, I also deleted the component from Component Services which I needed to have because I wanted to run PFAdapterMng under another identity.

So, it seems like everything works when running on /RegServer and double-clicking the applications. However, I would like everything to run under a different configuration.

How do I configure everything to get the applications to work as follows:

PFAdapterMng.exe - Register as /Service and run under another identity through services.msc
PFTraceServer.exe - Register as /Service and run under another identity through services.msc

PFMQListen.exe - Register as /RegServer which will be started by PFAdapterMng
PFMQSend.dll - Registered with Regsvr32 and loaded by PFAdapterMng

Thanks,
Krzys

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

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

发布评论

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

评论(1

榆西 2024-12-04 13:16:00

我的猜测是它与可执行文件的某些DLL依赖项的搜索路径有关。
您可以在每个模块上尝试“Dependency Walker”以查看所有 DLL 是否可用: http://www.dependencywalker.com /
并根据需要更新搜索路径。

My guess is that it is related to the search path of some DLL dependencies of the executable.
You can try the "Dependency Walker" on every module to see if all DLL are available: http://www.dependencywalker.com/
And update the search PATH if needed.

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