I have a 3rd-party out-of-process COM server and a client program which is trying to activate it. I've created two ones: on C# and on C++. When I start my client program (any of them) from VS2010 with Ctrl-F5 (which is started in elevated mode) the client can't activate COM server. I get "Class not registered" error. When I start the client from command line/windows explorer the client does active COM server successfully.
So I have the one exe-module which works (activates COM server) in one case and doesn't work (doesn't active COM server) in the other case. The latter case is when the module is run from VS2010 (not in debugging, just by Ctrl-F5).
This makes me think that there's some issue with privileges as the module when it's started by vs2010 inherits its privileges.
With help of processprivileges.codeplex.com I get two sets of privileges:
The case when it doesn't work:
IncreaseQuota => Disabled
Security => Disabled
TakeOwnership => Disabled
LoadDriver => Disabled
SystemProfile => Disabled
SystemTime => Disabled
ProfileSingleProcess => Disabled
IncreaseBasePriority => Disabled
CreatePageFile => Disabled
Backup => Disabled
Restore => Disabled
Shutdown => Disabled
Debug => Enabled
SystemEnvironment => Disabled
ChangeNotify => Enabled
RemoteShutdown => Disabled
Undock => Disabled
ManageVolume => Disabled
Impersonate => Enabled
CreateGlobal => Enabled
IncreaseWorkingSet => Disabled
TimeZone => Disabled
CreateSymbolicLink => Disabled
This' when it works:
Shutdown => Disabled
ChangeNotify => Enabled
Undock => Disabled
IncreaseWorkingSet => Disabled
TimeZone => Disabled
I can't see any suspect privilege related to COM activation. But I don't see any other reasons.
Why out-of-process COM server is being successfully activated in one case and not activated in another?
"Class not registered" is a registry issue. Watch out for the Platform target setting on a 64-bit version of Windows. Use SysInternals' ProcMon to check why it is having trouble finding the registry key. You've got a 'good' and 'bad' trace you can compare so that should help digging through the mountain of data. The CLSID registry key is the important one.