|Sorry, I just saw the "Community Content" bit at the end of the .net article saying the return value is the dwRegister value for the Revoke method.
I have a windows service which instantiates a class and would like to register this object in the ROT. I have found that testing this registry to the ROT works fine when it's done in a standalone exe but not within a windows service. I have read a case for why it doesn't work when in the Windows Service, that there is this flag ROTFLAGS_ALLOWANYCLIENT which you can pass to the Register method to allow any client to see it. Have I understood that the .net's IRunningObjectTable is the one that accepts this flag whereas the Ole32 one does not?
private int myRegisterActiveObject(object pUnk)
string sDelim = "!";
string sProgID = "MyNamespace.ClassName";
Ole32.CreateBindCtx(0, out bc);
Ole32.CreateItemMoniker(sDelim,sProgID, out moniker);
int register = rot.Register((ROTFLAGS_REGISTRATIONKEEPSALIVE | ROTFLAGS_ALLOWANYCLIENT), pUnk, moniker);
I get in the EventLog, "Service cannot be started. System.Runtime.InteropServices.COMException (0x80004015): The class is configured to run as a security id different from the caller (Exception from HRESULT: 0x80004015)..."
The Service is run under account type LocalSystem.