错误0x80040154:未注册类 [英] Error 0x80040154: Class Not Registered

查看:195
本文介绍了错误0x80040154:未注册类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,最后一个障碍,我很清楚。我一切都工作正常,类正确注册(最后),我可以调用CoCreateInstance并以非提升的方式使用它(安全调用返回Access拒绝的错误,就像他们应该的那样),如果我使用CoCreateInstanceAsAdmin函数,它弹出UAC对话框以允许或拒绝该类。问题就在于此之后,如果我选择Allow,则CoCreateInstanceAsAdmin返回错误代码0x80040154,这意味着该类未注册。

Okay, one last hurdle and I am all clear.  I have everything mostly working, the class registers properly (finally), I can call CoCreateInstance and use it in a non-elevated manner (the secure calls return an error of Access Denied like they should), and if I use the CoCreateInstanceAsAdmin function, it pops up the UAC dialog to allow or deny the class.  The problem is right after that, if I select Allow, then CoCreateInstanceAsAdmin returns an error code of 0x80040154, which means that the class is not registered.

我知道该类(大多数)已注册,因为它在调用CoCreateInstance本身时正确实例化,而不是作为管理员。我想我错过了一些小步骤,但我不知道是什么。这是我正在做的事情的破败。出于测试目的,该应用程序只是一个通过VC ATL向导创建的简单ATL DLL。在向导期间,我选择了合并选项,以便它只是一个DLL,而不是代理/存根。我在我的测试应用程序中添加了一个我想要创建的类。 DLL本身已在我的Vista系统上正确注册(显然,因为CoCreateInstance正确创建它)。我注册时添加了LocalizedString和Elevation\Enabled注册表值(我知道这是有效的,因为当我尝试将其创建为管理员时会弹出对话框)。

I know the class is (mostly) registered, as it instantiates properly during a call to CoCreateInstance itself, just not as admin.  I assume I am missing some little step,  but I dunno what.  Here's the rundown of what I'm doing.  For testing purposes, the app is just a simple ATL DLL created via the VC ATL Wizard.  During the Wizard, I selected the merge option so that it's all a single DLL, instead of the proxy/stub.  I added one class to it that I am trying to create in my test application.  The DLL itself is properly registered on my Vista system (obviously, since CoCreateInstance creates it properly).  I have the LocalizedString and Elevation\Enabled registry values added when it registers (and I know this is working since it does pop up the dialog when I try to create it as admin).

我在论坛上看到有人发布了另一个这样的实例,但没有回答它是如何解决的。以前有人遇到这个,知道怎么解决吗?

I see one other instance of this posted by someone on the forums, but no response as to how it was solved.  Anyone encounter this before, know how to resolve it?

推荐答案

啊哈,我弄清楚了。它实际上是在另一个线程中提到的,但直到我开始通过注册表跟踪事情之前我才完全理解。基本上,该类的AppID值与其他地方的注册AppID相对应。在THAT键下需要一个空的DllSurrogate值。我不知道为什么这样做或它做什么,但它做了一些事情,并且它有效。您可以将其添加到基本DLL注册表脚本,只需在DLL AppID下添加DllSurrogate键。
Aha, I figured it out.  It was actually mentioned in another thread, but I didn't quite understand until I started tracing things through the registry.  Basically, the class has an AppID value in it that corresponds to a registered AppID elsewhere.  Under THAT key needs to be an empty DllSurrogate value.  I don't know why this works or what it does, but it does something, and it works.  You can add this to the base DLL registry script, just add the DllSurrogate key under the DLLs AppID.


这篇关于错误0x80040154:未注册类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆