I have an existing COM Exe Server, as well as VBA or .NET code calling it. We would like this to work without the need to install or modify the registry, so that other users who are not admins on their machines can use it.
Assume that changing / changing an Exe COM server is not possible (expensive).
Question 1:
From what I registered in Registering a running EXE server , the EXE server can call CoRegisterClassObject to register the CLSID in the class table. Does this mean that clients should be able to CoGetClassObject from there? (even without registry entries for this type / class?)
Question 2:
If this is correct, my EXE server uses CComModule (deprecated, yes), and I see that this is really a CoRegisterClassObject call. Is there a way to check the class table to make sure this is done correctly?
Question 3:
This is the snippet I'm using. clsid and iid refer to the csid and iid keywords. It does not work with an interface that is not registered (exception from HRESULT: 0x80040155) in the CreateInstance call. Does it upset me, any idea of ββwhat might be wrong?
var factory = UnsafeNativeMethods.CoGetClassObject(
clsid,
RegistrationClassContext.LocalServer,
IntPtr.Zero,
typeof(UnsafeNativeMethods.IClassFactory).GUID)
as UnsafeNativeMethods.IClassFactory;
factory.CreateInstance(null, ref iid, out obj);
source
share