Registering proxy/stub for Side by Side COM Components 
Author Message
 Registering proxy/stub for Side by Side COM Components

Registering the proxy / stub pair for side by side COM
components does not seem to be address by the
documentation. I am generating my proxy by using the /Oicf
MIDL.exe switch. The DllRegisterServer method exported
by the proxy eventually calls NdrDllRegisterProxy to
handle the work of actually registering each interface.

NdrDllRegisterProxy creates the key HKCR\CLSID\{GUID}
\InProcServer32. The default value of this key is the
absolute path of the proxy's executable. For a side by
side component a relative path should be registered. I
don't see a way to control the path registered by
NdrDllRegisterProxy.

I see how I can disable the MIDL generated registration
code by not defining the macro REGISTER_PROXY_DLL. If I
attempt to write my own implementation of
DllRegisterServer is there a documented way of extracting
the supported interface IIDs from the Interpretive
Marshaler.

It was easy to modify the .rgs file to register CLSID of
my ATL component with a relative path, but I am unsure how
to handle the proxy / stub registration. I normally merge
my proxy stub code with ATL generated COM component, but
the absolute paths would seem to be a problem even with a
standalone proxy.



Wed, 23 Feb 2005 01:58:22 GMT  
 Registering proxy/stub for Side by Side COM Components
Why on earth would you want a relative path???

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> Registering the proxy / stub pair for side by side COM
> components does not seem to be address by the
> documentation. I am generating my proxy by using the /Oicf
> MIDL.exe switch. The DllRegisterServer method exported
> by the proxy eventually calls NdrDllRegisterProxy to
> handle the work of actually registering each interface.

> NdrDllRegisterProxy creates the key HKCR\CLSID\{GUID}
> \InProcServer32. The default value of this key is the
> absolute path of the proxy's executable. For a side by
> side component a relative path should be registered. I
> don't see a way to control the path registered by
> NdrDllRegisterProxy.

> I see how I can disable the MIDL generated registration
> code by not defining the macro REGISTER_PROXY_DLL. If I
> attempt to write my own implementation of
> DllRegisterServer is there a documented way of extracting
> the supported interface IIDs from the Interpretive
> Marshaler.

> It was easy to modify the .rgs file to register CLSID of
> my ATL component with a relative path, but I am unsure how
> to handle the proxy / stub registration. I normally merge
> my proxy stub code with ATL generated COM component, but
> the absolute paths would seem to be a problem even with a
> standalone proxy.



Wed, 23 Feb 2005 02:21:00 GMT  
 Registering proxy/stub for Side by Side COM Components
Haven't you heard of Side-by-Side Components? Side-by-Side
components reduce DLL hell problems.

Read the link:

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnsetup/html/sidebyside.asp



Wed, 23 Feb 2005 03:26:56 GMT  
 Registering proxy/stub for Side by Side COM Components
Hmm, interesting article. All I can says is that the NDR layer does
not support side-by-side sharing. Subsequently, you must install
all proxy/stub DLLs in shared locations. Note there's no DLL hell
here since these only support already immutable interfaces. The
biggest issue is to ensure each newer version supports all interfaces
supported by any previous version, and subsequently always install
the latest version.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> Haven't you heard of Side-by-Side Components? Side-by-Side
> components reduce DLL hell problems.

> Read the link:

> http://msdn.microsoft.com/library/default.asp?
> url=/library/en-us/dnsetup/html/sidebyside.asp



Wed, 23 Feb 2005 04:17:24 GMT  
 Registering proxy/stub for Side by Side COM Components

Quote:
> Hmm, interesting article. All I can says is that the NDR layer does
> not support side-by-side sharing. Subsequently, you must install
> all proxy/stub DLLs in shared locations. Note there's no DLL hell
> here since these only support already immutable interfaces. The
> biggest issue is to ensure each newer version supports all interfaces
> supported by any previous version, and subsequently always install
> the latest version.

Actually this is not exactly correct. I can manually edit the registry
to change the HKCR\CLSID\{GUID}\InProcServer32 default key to a relative
path and it works great.

I would agree with you "that NDR layer does not support side-by-side
sharing" if I was trying to use the proxy stub pair for DCOM. I just
need the proxy for marshaling across apartment boundaries in the same
process.

There is definitely a possibility for DLL hell problems with the proxy /
stub. When multiple copies of an application using absolute paths the
registry key can only point to one of the installations. If the pointed
to application is uninstalled the other installations will break.

If the registry entries are created with relative paths the registry
entry can be referenced counted. The entry would only delete when the
last copy of the proxy is uninstalled.

The issue is not trying to make an interface mutable. I merge the proxy
and stub code into the component DLL. Since the proxy is in the same
DLL as the component it can't be installed in a shared location. I
simply want the install for an application to stand alone.

I have found several articles from Microsoft recommending that new COM
components be designed to run side-by-side. The problem is none of these
articles addresses the issue of registering the proxy.



Wed, 23 Feb 2005 13:49:14 GMT  
 Registering proxy/stub for Side by Side COM Components
Ah, you missed the design problem in the very beginning :).
Shared interfaces must NOT have their marshaling support
merged with other code. Put the marshaling code in a separate
DLL and register it in a shared place, then reference count it
for multiple installations.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:


> > Hmm, interesting article. All I can says is that the NDR layer does
> > not support side-by-side sharing. Subsequently, you must install
> > all proxy/stub DLLs in shared locations. Note there's no DLL hell
> > here since these only support already immutable interfaces. The
> > biggest issue is to ensure each newer version supports all interfaces
> > supported by any previous version, and subsequently always install
> > the latest version.

> Actually this is not exactly correct. I can manually edit the registry
> to change the HKCR\CLSID\{GUID}\InProcServer32 default key to a relative
> path and it works great.

> I would agree with you "that NDR layer does not support side-by-side
> sharing" if I was trying to use the proxy stub pair for DCOM. I just
> need the proxy for marshaling across apartment boundaries in the same
> process.

> There is definitely a possibility for DLL hell problems with the proxy /
> stub. When multiple copies of an application using absolute paths the
> registry key can only point to one of the installations. If the pointed
> to application is uninstalled the other installations will break.

> If the registry entries are created with relative paths the registry
> entry can be referenced counted. The entry would only delete when the
> last copy of the proxy is uninstalled.

> The issue is not trying to make an interface mutable. I merge the proxy
> and stub code into the component DLL. Since the proxy is in the same
> DLL as the component it can't be installed in a shared location. I
> simply want the install for an application to stand alone.

> I have found several articles from Microsoft recommending that new COM
> components be designed to run side-by-side. The problem is none of these
> articles addresses the issue of registering the proxy.



Sat, 26 Feb 2005 02:23:55 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. ATL 7 side-by-side component registration

2. Side by Side COMponent install

3. Events from Server Side COM Components

4. Installing VS.Net and VS 6.0 side by side

5. Raise event from client side on server side, passing parameter

6. Side-by-side VC6 and C# debug sessions.

7. Client Side Validation preventing client side script from running

8. 2 Windows Side by Side

9. Docking toolbars side-by-side

10. Docking Toolbars side-by-side

11. How to posistion multiple toolbars side by side?

12. Docking toolbars side-by-side in MDI child frame

 

 
Powered by phpBB® Forum Software