Nikolay Sivov : oleaut32: Implement IClassFactory::QueryInterface() for StdFont object.

Alexandre Julliard julliard at winehq.org
Fri Aug 26 10:18:11 CDT 2016


Module: wine
Branch: master
Commit: e57ab97f6f2749906573d93571381c0fb221b480
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e57ab97f6f2749906573d93571381c0fb221b480

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Aug 25 21:50:40 2016 +0300

oleaut32: Implement IClassFactory::QueryInterface() for StdFont object.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/oleaut32/olefont.c       | 20 +++++++++++++++-----
 dlls/oleaut32/tests/olefont.c | 15 +++++++++++++++
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index 7f8ab5d..4b3411e 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -2229,12 +2229,22 @@ static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
         return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
 }
 
-static HRESULT WINAPI
-SFCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
-	IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+static HRESULT WINAPI SFCF_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
+{
+    IClassFactoryImpl *This = impl_from_IClassFactory(iface);
+
+    TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), obj);
+
+    *obj = NULL;
 
-	FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
-	return E_NOINTERFACE;
+    if (IsEqualIID(&IID_IClassFactory, riid) || IsEqualIID(&IID_IUnknown, riid))
+    {
+        *obj = iface;
+        IClassFactory_AddRef(iface);
+        return S_OK;
+    }
+
+    return E_NOINTERFACE;
 }
 
 static ULONG WINAPI
diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c
index 1536619..f9c5625 100644
--- a/dlls/oleaut32/tests/olefont.c
+++ b/dlls/oleaut32/tests/olefont.c
@@ -1230,6 +1230,7 @@ static void test_realization(void)
 static void test_OleCreateFontIndirect(void)
 {
     FONTDESC fontdesc;
+    IUnknown *unk, *unk2;
     IFont *font;
     HRESULT hr;
 
@@ -1261,6 +1262,20 @@ static void test_OleCreateFontIndirect(void)
     hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font);
     EXPECT_HR(hr, S_OK);
     IFont_Release(font);
+
+    hr = OleInitialize(NULL);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    hr = CoGetClassObject(&CLSID_StdFont, CLSCTX_INPROC_SERVER, NULL, &IID_IClassFactory, (void**)&unk);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void**)&unk2);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+
+    IUnknown_Release(unk);
+    IUnknown_Release(unk2);
+
+    OleUninitialize();
 }
 
 START_TEST(olefont)




More information about the wine-cvs mailing list