From 45d440a219764e863b4145c71794596c157c5d8f Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Sat, 12 Nov 2005 19:11:21 +0000 Subject: [PATCH] Implement CLSCTX_INPROC_HANDLER in CoGetClassObject similar to CLSCTX_INPROC_SERVER by looking at the InprocHandler32 registry key instead of InprocServer32. --- dlls/ole32/compobj.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 91fe4198dae..b2cf72b07cb 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -1554,7 +1554,7 @@ static HRESULT get_inproc_class_object(HKEY hkeydll, REFCLSID rclsid, REFIID rii if ((hLibrary = LoadLibraryExW(dllpath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) { /* failure: DLL could not be loaded */ - ERR("couldn't load InprocServer32 dll %s\n", debugstr_w(dllpath)); + ERR("couldn't load in-process dll %s\n", debugstr_w(dllpath)); return E_ACCESSDENIED; /* FIXME: or should this be CO_E_DLLNOTFOUND? */ } @@ -1612,8 +1612,8 @@ HRESULT WINAPI CoGetClassObject( return hres; } - /* first try: in-process */ - if ((CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER) & dwClsContext) + /* First try in-process server */ + if (CLSCTX_INPROC_SERVER & dwClsContext) { static const WCHAR wszInprocServer32[] = {'I','n','p','r','o','c','S','e','r','v','e','r','3','2',0}; HKEY hkey; @@ -1624,7 +1624,34 @@ HRESULT WINAPI CoGetClassObject( if (hres == REGDB_E_CLASSNOTREG) ERR("class %s not registered\n", debugstr_guid(rclsid)); else - WARN("class %s not registered inproc\n", debugstr_guid(rclsid)); + WARN("class %s not registered as in-proc server\n", debugstr_guid(rclsid)); + } + + if (SUCCEEDED(hres)) + { + hres = get_inproc_class_object(hkey, rclsid, iid, ppv); + RegCloseKey(hkey); + } + + /* return if we got a class, otherwise fall through to one of the + * other types */ + if (SUCCEEDED(hres)) + return hres; + } + + /* Next try in-process handler */ + if (CLSCTX_INPROC_HANDLER & dwClsContext) + { + static const WCHAR wszInprocHandler32[] = {'I','n','p','r','o','c','H','a','n','d','l','e','r','3','2',0}; + HKEY hkey; + + hres = COM_OpenKeyForCLSID(rclsid, wszInprocHandler32, KEY_READ, &hkey); + if (FAILED(hres)) + { + if (hres == REGDB_E_CLASSNOTREG) + ERR("class %s not registered\n", debugstr_guid(rclsid)); + else + WARN("class %s not registered in-proc handler\n", debugstr_guid(rclsid)); } if (SUCCEEDED(hres)) @@ -1652,6 +1679,9 @@ HRESULT WINAPI CoGetClassObject( hres = E_NOINTERFACE; } + if (FAILED(hres)) + ERR("no class object %s could be created for for context 0x%lx\n", + debugstr_guid(rclsid), dwClsContext); return hres; } -- 2.11.4.GIT