开发者

Download and instantiate COM control

I am using ff-activex-host to host a .NET ActiveX control in Firefox and Chrome. It will instantiate a registered COM control, or download one in a cab file, register it, then instantiate the COM control. Unfortunately, the first means that I can't update the control's dll with changes from the server, and the second one requires administrator privileges.

I'd like to extend the p开发者_如何转开发lugin to support downloading a dll and instantiating it without requiring administrator privileges, but I'm not sure how to go about doing that. Does anyone have an example of doing this?

I'd be happy to skip the COM layer entirely and instantiate the underlying .NET control instead, but it would mean re-writing parts of the plugin, and the examples I've been able to find suggest that the best way to communicate is over COM anyway. Could you point me towards a C++ example of interacting with a .NET component without COM? The best I can find is ExecuteInDefaultAppDomain which seems quite limited - I'd like to be able to attach event handlers too.


Unfortunately, the COM DllRegisterServer entry point is usually hard coded to install component registrations into the HKEY_CLASSES_ROOT hive, which will result in them being created in HKEY_LOCAL_MACHINE\Software\Classes, making it impossible to install without administrator access.

If you know ahead of time what COM registrations will be created, you can directly create the keys in HKEY_CURRENT_USER\Software\Classes yourself instead of invoking DllRegisterServer; this will allow you to register the control for the current user only without administrative rights.

Another option, which I urge you to avoid if possible, would be to attempt to patch the windows registry APIs in memory to redirect the DllRegisterServer writes to the HKEY_CURRENT_USER\Software\Classes tree. While this would work, patching such APIs is a non-trivial exercise, particularly if you do it inside a multi-threaded application.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜