Re: [v2 3/5] compobj.dll16: Implement CoCreateInstance16().
Zebediah Figura <z.figura12(a)gmail.com> writes:
@@ -899,17 +899,22 @@ HRESULT WINAPI CoCreateGuid16(GUID *pguid) * CoCreateInstance [COMPOBJ.13] */ HRESULT WINAPI CoCreateInstance16( - REFCLSID rclsid, - LPUNKNOWN pUnkOuter, - DWORD dwClsContext, - REFIID iid, - LPVOID *ppv) -{ - FIXME("(%s, %p, %x, %s, %p), stub!\n", - debugstr_guid(rclsid), pUnkOuter, dwClsContext, debugstr_guid(iid), - ppv - ); - return E_NOTIMPL; + REFCLSID rclsid, + LPUNKNOWN pUnkOuter, + DWORD dwClsContext, + REFIID riid, + LPVOID *ppv) +{ + IClassFactory *cf; + HRESULT hr; + + hr = CoGetClassObject16(rclsid, dwClsContext, NULL, &IID_IClassFactory, (void **)&cf); + if (FAILED(hr)) + return hr; + + hr = IClassFactory_CreateInstance(cf, pUnkOuter, riid, ppv); + IClassFactory_Release(cf); + return hr;
CoGetClassObject16 is supposed to return a 16-bit interface, you can't call it like that. How did you test this? -- Alexandre Julliard julliard(a)winehq.org
On 02/09/2017 09:27 AM, Alexandre Julliard wrote:
Zebediah Figura <z.figura12(a)gmail.com> writes:
@@ -899,17 +899,22 @@ HRESULT WINAPI CoCreateGuid16(GUID *pguid) * CoCreateInstance [COMPOBJ.13] */ HRESULT WINAPI CoCreateInstance16( - REFCLSID rclsid, - LPUNKNOWN pUnkOuter, - DWORD dwClsContext, - REFIID iid, - LPVOID *ppv) -{ - FIXME("(%s, %p, %x, %s, %p), stub!\n", - debugstr_guid(rclsid), pUnkOuter, dwClsContext, debugstr_guid(iid), - ppv - ); - return E_NOTIMPL; + REFCLSID rclsid, + LPUNKNOWN pUnkOuter, + DWORD dwClsContext, + REFIID riid, + LPVOID *ppv) +{ + IClassFactory *cf; + HRESULT hr; + + hr = CoGetClassObject16(rclsid, dwClsContext, NULL, &IID_IClassFactory, (void **)&cf); + if (FAILED(hr)) + return hr; + + hr = IClassFactory_CreateInstance(cf, pUnkOuter, riid, ppv); + IClassFactory_Release(cf); + return hr;
CoGetClassObject16 is supposed to return a 16-bit interface, you can't call it like that. How did you test this?
The application in question called CoGetClassObject directly; I just implemented this function as an afterthought. I didn't realize it wouldn't work. This patch can be left out.
participants (2)
-
Alexandre Julliard -
Zebediah Figura