Replace a COM class implementation at runtime
This is a bit of a long shot but does anyone know how to replace the implementation of a COM class开发者_Go百科 at runtime (or, if it is actually possible)?
My problem is that we have a COM DLL out there in the wild but we aren't completely sure which version it is and we don't want to have to do a complete rebuild of the software just to replace this one component. There is a single line fix that needs to be deployed and what would be great is if I could simply write another COM DLL or something similar that just replaces that class, and then force the COM runtime to point at that DLL file just for that class.
I've had a look at the OLE/COM Object Viewer and there are options for changing the implementation but I've no idea how to configure it properly as it doesn't seem to do very much.
If anyone has any information (even a "nope, not possible" answer which I suspect is the case) that would be excellent.
Cheers, Dan.
I don't get it, why a complete rebuild? You are just changing the implementation, the interface and coclass GUIDs as well as the interface definition should not change. That's all that COM clients know about a COM server.
If you do change an interface definition then you have to assign new GUIDs. Very hard rule in COM, skipping it buys enormous DLL Hell. Yes, that requires a complete rebuild.
The implementation of a COM object is determined by which DLL is registered as the "server" for that CLSID. So just make an object that is identical to the original apart from the bug fix, and register it.
精彩评论