Nikolay Sivov : ole32: Fix IClassFactory initialization and QueryInterface behavior for GIT.

Alexandre Julliard julliard at winehq.org
Thu Aug 22 14:18:40 CDT 2013


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Aug 22 00:00:39 2013 +0400

ole32: Fix IClassFactory initialization and QueryInterface behavior for GIT.

---

 dlls/ole32/git.c           |    8 ++++----
 dlls/ole32/tests/marshal.c |   11 +++++++++++
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/dlls/ole32/git.c b/dlls/ole32/git.c
index f5dd00b..f0be9ee 100644
--- a/dlls/ole32/git.c
+++ b/dlls/ole32/git.c
@@ -311,8 +311,8 @@ static HRESULT WINAPI
 GITCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv)
 {
   *ppv = NULL;
-  if (IsEqualIID(riid,&IID_IUnknown) ||
-      IsEqualIID(riid,&IID_IGlobalInterfaceTable))
+  if (IsEqualIID(riid, &IID_IUnknown) ||
+      IsEqualIID(riid, &IID_IClassFactory))
   {
     *ppv = iface;
     return S_OK;
@@ -357,11 +357,11 @@ static const IClassFactoryVtbl GITClassFactoryVtbl = {
     GITCF_LockServer
 };
 
-static const IClassFactoryVtbl *PGITClassFactoryVtbl = &GITClassFactoryVtbl;
+static IClassFactory git_classfactory = { &GITClassFactoryVtbl };
 
 HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv)
 {
-  *ppv = &PGITClassFactoryVtbl;
+  *ppv = &git_classfactory;
   TRACE("Returning GIT classfactory\n");
   return S_OK;
 }
diff --git a/dlls/ole32/tests/marshal.c b/dlls/ole32/tests/marshal.c
index 2baec4b..9566de3 100644
--- a/dlls/ole32/tests/marshal.c
+++ b/dlls/ole32/tests/marshal.c
@@ -40,6 +40,7 @@ DEFINE_GUID(CLSID_ManualResetEvent,       0x0000032c,0x0000,0x0000,0xc0,0x00,0x0
 
 /* functions that are not present on all versions of Windows */
 static HRESULT (WINAPI * pCoInitializeEx)(LPVOID lpReserved, DWORD dwCoInit);
+static HRESULT (WINAPI *pDllGetClassObject)(REFCLSID,REFIID,LPVOID);
 
 /* helper macros to make tests a bit leaner */
 #define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
@@ -2804,10 +2805,19 @@ static void test_globalinterfacetable(void)
 	struct git_params params;
 	DWORD ret;
         IUnknown *object;
+        IClassFactory *cf;
 
         trace("test_globalinterfacetable\n");
 	cLocks = 0;
 
+	hr = pDllGetClassObject(&CLSID_StdGlobalInterfaceTable, &IID_IClassFactory, (void**)&cf);
+	ok(hr == S_OK, "got 0x%08x\n", hr);
+
+	hr = IClassFactory_QueryInterface(cf, &IID_IGlobalInterfaceTable, (void**)&object);
+	ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr);
+
+	IClassFactory_Release(cf);
+
 	hr = CoCreateInstance(&CLSID_StdGlobalInterfaceTable, NULL, CLSCTX_INPROC_SERVER, &IID_IGlobalInterfaceTable, (void **)&git);
 	ok_ole_success(hr, CoCreateInstance);
 
@@ -3149,6 +3159,7 @@ START_TEST(marshal)
     }
 
     pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx");
+    pDllGetClassObject = (void*)GetProcAddress(hOle32, "DllGetClassObject");
 
     argc = winetest_get_mainargs( &argv );
     if (argc > 2 && (!strcmp(argv[2], "-Embedding")))




More information about the wine-cvs mailing list