On 09.08.2017 20:12, Zebediah Figura wrote:
On 08/09/2017 06:07 AM, Jacek Caban wrote:
Hi Zebediah,
On 08.08.2017 20:04, Zebediah Figura wrote:
HRESULT register_class_object(BOOL do_reg) { HRESULT hres; - static DWORD cookie; + static DWORD ie_cookie, iem_cookie; if(do_reg) { hres = CoRegisterClassObject(&CLSID_InternetExplorer, (IUnknown*)&InternetExplorerFactory, CLSCTX_SERVER, - REGCLS_MULTIPLEUSE|REGCLS_SUSPENDED, &cookie); - if (FAILED(hres)) { + REGCLS_MULTIPLEUSE, &ie_cookie); + if (FAILED(hres)) + ERR("failed to register object %08x\n", hres); + hres = CoRegisterClassObject(&CLSID_InternetExplorerManager, + (IUnknown*)&InternetExplorerManagerFactory, CLSCTX_SERVER, + REGCLS_MULTIPLEUSE, &iem_cookie); + if (FAILED(hres)) ERR("failed to register object %08x\n", hres); - return hres; - } - - hres = CoResumeClassObjects(); - if(SUCCEEDED(hres)) - return hres; - - ERR("failed to resume object %08x\n", hres); } - - return CoRevokeClassObject(cookie); + else + { + hres = CoRevokeClassObject(ie_cookie); + if (FAILED(hres)) + ERR("failed to register object %08x\n", hres); + hres = CoRevokeClassObject(iem_cookie); + if (FAILED(hres)) + ERR("failed to register object %08x\n", hres); + } + return hres; }
Are you sure that's how it's supposed to work? I didn't test it myself, but given how it's registered and documented, I'd expect that CLSID_InternetExplorerManager should live in a different process from CLSID_InternetExplorer. It should be easy to distinguish those processes with -startmanager command line argument.
I'm sorry, I don't understand what you mean. Isn't CoRegisterClassObject process-agnostic?
It is in a sense that created proxy/stub abstract where the object lives, yes. But note that the actual instance of IE object must live in one process or another. There is a lot of different aspects like pluggable protocols, script engines, ActiveX objects, document objects that live in its process and it's quite important for them which process it is. I did a bit of testing and it seems to be a separated process on Windows, so we should follow that. Jacek