sharptooth
sharptooth

Reputation: 170489

Is it possible to prohibit putting my in-proc component into COM+?

I have an ATL C++ in-proc COM component. This component is not for external use - I only need it for use in our application.

Once in a while users put it into COM+ and this leads to all sorts of weird errors - "Access denied", etc which I'd like to just never hear about. The best way would be to do something that would prohibit putting the component into COM+ so that it can only be used as an in-proc server. Is there a way to do this?

Upvotes: 0

Views: 116

Answers (2)

lsalamon
lsalamon

Reputation: 8174

Prevent registering your module is finalized and then use your DLL as described in this article Creating COM objects directly from the dll.

Upvotes: 1

Kim Gräsman
Kim Gräsman

Reputation: 7586

Do you implement only your own interfaces? If so, you should be able to mark them "[local]" in the IDL, and then strip the module of all marshalling information (type library, P/S), etc.

If there's no basis for marshalling available, COM+ shouldn't be able to register the module. COM+'s mechanism for interception relies on forcing objects into a remote context and getting in between the proxy and stub and their corresponding parties. So, if you remove every opportunity for marshalling, it shouldn't be able to intercept your interface methods.

Upvotes: 1

Related Questions