Skip to main content
gamedev.net
🔒 Locked

Registering a COM class

Started by xycsoscyx Aug 29, 2006 at 5:20 PM 0 replies 1.8k views
Original Post
xycsoscyx
xycsoscyx
I am working a bit with Vista and the elevation moniker, but am having trouble properly registering my ATL class. I am just testing out some basic things currently, so I have a project setup via the AppWizards. It's just a simple ATL DLL with a single class in it. I selected the merge option in the ATL wizard so that I don't need to register two DLLs. When I create the class via CoCreateInstance, it works perfectly (yay, since I've never done much with this before). The class is created and I can use it properly, but without elevated privileges in Vista. If I use the CoCreateInstanceAsAdmin function that MicroSoft has supplied (which creates a string and passes it to CoGetObject to create the instance), I get an error code of 0x80040154, which means the class is not registered. I know the class is registered because it creates successfully via CoCreateInstance itself, but I'm guessing there is some additional threading or type lib registration that I am missing? Has anyone worked with this before? As a note, I have the UAC dialog coming up when I call CoCreateInstanceAsAdmin, so things are mostly going well, it see's my extra Elevation and LocalizedString in the register for that class, but it seems to fail half-way through. Anyone encounter this before? I searched the MSDN as well, I found one other instance where someone encountered this, but no solution for it. Thanks.
xycsoscyx
xycsoscyx
Well I figured it out, you need to add an empty DllSurrogate key under the AppID that your class references. My next question, does anyone know what this actually DOES? It does work, I know that, 'cause the class registers properly now, and I can create it and use it in admin mode properly (sweeeeet).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.