CComModule UnregisterServer error?

1

I have a CComModule that is calling RegisterServer (TRUE) on DllRegisterServer and UnregisterServer (TRUE) on DllUnregisterServer. The UnregisterServer is getting a 0x8002801C (Error accessing the OLE registry.) error and leaving around registery keys. I am using a Windows Server 2k8 R2 machine with UAC enabled. The components are x86 and I am using the 32 bit regsrv32.

Does anyone know why I would be getting this error?

c++
com
winapi
asked on Stack Overflow Jan 14, 2010 by Kyle

2 Answers

1

You must run Regsvr32.exe from a command prompt that's elevated to administrator (i.e. UAC disabled). Make a shortcut on your desktop to "cmd.exe", right-click it and choose "Run as Administrator".

answered on Stack Overflow Jan 14, 2010 by Hans Passant
1

If you're using ATL and VS2008 then you can register your COM object per-user which writes the necessary registry keys to HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. You register your object by passing a special user switch to regsvr32, e.g.:

regsvr32.exe /i:user /n yourobject.dll 

COM servers can be registered with the /RegServerPerUser switch.

I asked a similar question.

answered on Stack Overflow Jan 14, 2010 by Rob • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0