com - CoCreateInstance fails with E_FAIL when CLSCTX_LOCAL_SERVER is specified and Surrogate process is used -
i trying use surrogate process, dllhost, run com 64 bit dll in separate 64 bit dllhost process. have made required registry entries same.
when try create object of class using cocreateinstance or cogetclassobject , createinstance e_fail error. error observed if specify clsctx_local_server flag. call works fine clsctx_inproc_server flag of course not in separate process, dllhost.
on using clsctx_local_server, can see dllhost.exe in task bar, indicates surrogate related registry entries correct call cocreateinstance/createinstance fails error e_fail.
here code snippet:-
hr = coinitialize (null); if(failed(hr)) return hr; iclassfactory *ptr; // can see dllhost in task manager after call hr = cogetclassobject(clsid_myid, clsctx_local_server, 0,iid_iclassfactory,(void**)&ptr); // works fine clsctx_inproc_server //hr = cogetclassobject(clsid_myid, clsctx_inproc_server, 0,iid_iclassfactory,(void**)&ptr); if(failed(hr)) return hr; ptr->lockserver(true); hr = ptr->createinstance(null, iid_iunknown, (void**) &mypointer); if(failed(hr)) // e_fail here if clsctx_local_server on. return hr; ptr->lockserver(false); ptr->release();
Comments
Post a Comment