English 中文(简体)
How do I register a proxy/stub for a COM interface defined by a third party?
原标题:

There s Another Company that ships the product that consumes IAnotherCompanyInterface. We want to ship a COM object that implements IAnotherCompanyInterface. That interface is not Automation-compatible, so the next easiest option to enable marshalling is using a proxy/stub. Another Company doesn t ship the proxy/stub and doesn t want to.

Compiling and registering the proxy/stub is not a problem by itself but consider the following situation. There s our company shipping a COM object implementing IAnotherCompanyInterface and the ThirdPartyCompany that does the same. So both components might end up being deployed on the same machine.

Proxy/stub registration is system-wide for an interface. How should their proxy/stub implementations co-reside?

问题回答

You can skip the registry in your client altogether by using reg-free COM or activation context. You can provide "custom" comInterfaceExternalProxyStub entries in the manifest file that reference you proxy/stub implementation.

It s a while since I worked with this stuff, so this is "thinking aloud" but hopefully it ll be some help...

I presume that you can see a type library that describes the interface you want to implement. If so, load it into oleview.exe. Copy the IDL it gives you into a new .idl file of your own, and base your own implementation on that file.

I know your question is actually about the proxy/stub DLL. That s fine. Yours will be generated along with your actual COM server, and it will work on your machines and those of your users. If your code is installed on a machine that also has "Another Company s" bits installed, it shouldn t matter...

The proxy/stub is just a bit of code that tells COM how to transfer params and return values between COM client and COM server. If yours is built from IDL that was generated from their typelib, they will be functionally equivalent. Your COM server can be successfully called via their proxy/stub and vice versa.

However, if they change their proxy/stub, they might no longer be functionally equivalent. But in that case, they probably also changed the interface and your COM server would no longer be usable by their client.





相关问题
How can i add a button to all windows explorer instances?

I am trying to add a button to one of the existing tool bars in any windows explorer instance. After much research i figured out that BHO (browser helper objects) are the best way to hook to ...

Hunting memory leaks

I m finding leaked heap blocks by using the following command in WinDbg !heap –l With each leaked heap block I get, I m running to following to get the stack trace. !heap -p -a leakedheapblock The ...

Why use CComBSTR instead of just passing a WCHAR*?

I m new to COM. What exactly is the advantage of replacing: L"String" with CComBSTR(L"String") I can see a changelist in the COM part of my .NET application where all strings are replaced in this ...

IThumbnailProvider and IInitializeWithItem

I am trying to develop an IThumbnailProvider for use in Windows 7. Since this particular thumbnail would also be dependant on some other files in the same directory, I need to use something other than ...

Getting a byte array from out of process C++ COM to C#

What s the best way to get a chunk of memory (i.e. void*) from a COM server to C#? We have been using an IStream (using CreateStreamOnHGlobal) and passing that back, which worked. However when we ...

COM Basic links

folks can you provide me the tutorial link or .pdf for learning basic COM?. i do google it.. still i recommend answers of stackoverflow so please pass me.. Thanks

热门标签