Module: wine Branch: oldstable Commit: 412d7c8699f7cdb168b3397a209e58c9ded47d27 URL: https://source.winehq.org/git/wine.git/?a=commit;h=412d7c8699f7cdb168b3397a2...
Author: Zebediah Figura z.figura12@gmail.com Date: Fri Feb 17 16:32:12 2017 -0600
compobj.dll16: Implement CoGetClassObject16().
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit 6c2a5ee9172511ed26e5512bd3104771f46a0672) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/compobj.dll16/compobj.c | 69 ++++++++++++++++++++++++++++++++--- dlls/compobj.dll16/compobj.dll16.spec | 2 +- 2 files changed, 65 insertions(+), 6 deletions(-)
diff --git a/dlls/compobj.dll16/compobj.c b/dlls/compobj.dll16/compobj.c index b934a06..af69bf8 100644 --- a/dlls/compobj.dll16/compobj.c +++ b/dlls/compobj.dll16/compobj.c @@ -714,15 +714,74 @@ HRESULT WINAPI CoFileTimeNow16( FILETIME *lpFileTime ) * */ HRESULT WINAPI CoGetClassObject16( - REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, - REFIID iid, LPVOID *ppv) + SEGPTR rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, + SEGPTR riid, SEGPTR ppv) { - FIXME(", stub!\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid)); + LPVOID *ppvl = MapSL(ppv); + + TRACE("CLSID: %s, IID: %s\n", debugstr_guid(MapSL(rclsid)), debugstr_guid(MapSL(riid))); + + *ppvl = NULL;
if (pServerInfo) { - FIXME("\tpServerInfo: name=%s\n",debugstr_w(pServerInfo->pwszName)); - FIXME("\t\tpAuthInfo=%p\n",pServerInfo->pAuthInfo); + FIXME("pServerInfo->name=%s pAuthInfo=%p\n", + debugstr_w(pServerInfo->pwszName), pServerInfo->pAuthInfo); + } + + if (CLSCTX_INPROC_SERVER & dwClsContext) + { + char idstr[CHARS_IN_GUID]; + char buf_key[CHARS_IN_GUID+19], dllpath[MAX_PATH+1]; + LONG dllpath_len = sizeof(dllpath); + + HMODULE16 dll; + FARPROC16 DllGetClassObject; + + WORD args[6]; + DWORD dwRet; + + StringFromGUID216(MapSL(rclsid), idstr, CHARS_IN_GUID); + sprintf(buf_key, "CLSID\%s\InprocServer", idstr); + if (RegQueryValueA(HKEY_CLASSES_ROOT, buf_key, dllpath, &dllpath_len)) + { + ERR("class %s not registered\n", debugstr_guid(MapSL(rclsid))); + return REGDB_E_CLASSNOTREG; + } + + dll = LoadLibrary16(dllpath); + if (!dll) + { + ERR("couldn't load in-process dll %s\n", debugstr_a(dllpath)); + return E_ACCESSDENIED; /* FIXME: or should this be CO_E_DLLNOTFOUND? */ + } + + DllGetClassObject = GetProcAddress16(dll, "DllGetClassObject"); + if (!DllGetClassObject) + { + ERR("couldn't find function DllGetClassObject in %s\n", debugstr_a(dllpath)); + FreeLibrary16(dll); + return CO_E_DLLNOTFOUND; + } + + TRACE("calling DllGetClassObject %p\n", DllGetClassObject); + args[5] = SELECTOROF(rclsid); + args[4] = OFFSETOF(rclsid); + args[3] = SELECTOROF(riid); + args[2] = OFFSETOF(riid); + args[1] = SELECTOROF(ppv); + args[0] = OFFSETOF(ppv); + WOWCallback16Ex((DWORD) DllGetClassObject, WCB16_PASCAL, sizeof(args), args, &dwRet); + if (dwRet != S_OK) + { + ERR("DllGetClassObject returned error 0x%08x\n", dwRet); + FreeLibrary16(dll); + return dwRet; + } + + return S_OK; } + + FIXME("semi-stub\n"); return E_NOTIMPL; }
diff --git a/dlls/compobj.dll16/compobj.dll16.spec b/dlls/compobj.dll16/compobj.dll16.spec index 85dfc42..71dba80 100644 --- a/dlls/compobj.dll16/compobj.dll16.spec +++ b/dlls/compobj.dll16/compobj.dll16.spec @@ -4,7 +4,7 @@ 4 pascal CoGetMalloc(long ptr) CoGetMalloc16 5 pascal CoRegisterClassObject(ptr ptr long long ptr) CoRegisterClassObject16 6 pascal CoRevokeClassObject(long) CoRevokeClassObject16 -7 pascal CoGetClassObject(ptr long ptr ptr ptr) CoGetClassObject16 +7 pascal CoGetClassObject(segptr long ptr segptr segptr) CoGetClassObject16 8 stub COMARSHALINTERFACE 9 stub COUNMARSHALINTERFACE 10 stub COLOADLIBRARY