git classfactory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I thought I had written and submitted this patch before, but couldn't
find it in my tree nor CVS. Was it all just a dream? I don't know, but
here is a reimplementation of it.

ChangeLog:
Provide a classfactory for the global interface table
Index: ./dlls/ole32/git.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/git.c,v
retrieving revision 1.3
diff -u -r1.3 git.c
--- ./dlls/ole32/git.c	10 Apr 2003 18:17:35 -0000	1.3
+++ ./dlls/ole32/git.c	17 May 2003 14:38:37 -0000
@@ -105,6 +105,8 @@
 void* StdGlobalInterfaceTable_Construct() {
   StdGlobalInterfaceTableImpl* newGIT;
 
+  TRACE("constructing\n");
+
   newGIT = HeapAlloc(GetProcessHeap(), 0, sizeof(StdGlobalInterfaceTableImpl));
   if (newGIT == 0) return newGIT;
 
@@ -141,6 +143,7 @@
     if (e->cookie == cookie) return e;
     e = e->next;
   }
+  TRACE("Entry not found\n");
   return NULL;
 }
 
@@ -198,7 +201,7 @@
   HRESULT hres;
   StdGITEntry* entry;
 
-  TRACE("iface=%p, pUnk=%p, riid=%s, pdwCookie=%p\n", iface, pUnk, debugstr_guid(riid), pdwCookie);
+  TRACE("iface=%p, pUnk=%p, riid=%s, pdwCookie=0x%x\n", iface, pUnk, debugstr_guid(riid), pdwCookie);
 
   if (pUnk == NULL) return E_INVALIDARG;
   
@@ -222,6 +225,7 @@
 
   /* and return the cookie */
   *pdwCookie = entry->cookie;
+  TRACE("Cookie is 0x%x\n", entry->cookie);
   return S_OK;
 }
 
@@ -249,6 +253,8 @@
 HRESULT WINAPI StdGlobalInterfaceTable_GetInterfaceFromGlobal(IGlobalInterfaceTable* iface, DWORD dwCookie, REFIID riid, void **ppv) {
   StdGITEntry* entry;
   HRESULT hres;
+
+  TRACE("dwCookie=0x%lx, riid=%s\n", dwCookie, debugstr_guid(riid));
   
   entry = StdGlobalInterfaceTable_FindEntry(iface, dwCookie);
   if (entry == NULL) return E_INVALIDARG;
@@ -258,5 +264,50 @@
   hres = CoGetInterfaceAndReleaseStream(entry->stream, riid, *ppv);
   if (hres) return hres;
   
+  return S_OK;
+}
+
+/* Classfactory definition - despite what MSDN says, some programs need this */
+
+static HRESULT WINAPI GITCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) {
+  *ppv = NULL;
+  if (IsEqualIID(riid,&IID_IUnknown) || IsEqualIID(riid,&IID_IGlobalInterfaceTable)) {
+    *ppv = (LPVOID)iface;
+    return S_OK;
+  }
+  return E_NOINTERFACE;
+}
+static ULONG WINAPI GITCF_AddRef(LPCLASSFACTORY iface) { return 2; }
+static ULONG WINAPI GITCF_Release(LPCLASSFACTORY iface) { return 1; }
+
+static HRESULT WINAPI GITCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv) {
+  if (IsEqualIID(riid,&IID_IGlobalInterfaceTable)) {
+    if (StdGlobalInterfaceTableInstance == NULL) 
+      StdGlobalInterfaceTableInstance = StdGlobalInterfaceTable_Construct();
+    return IGlobalInterfaceTable_QueryInterface( (IGlobalInterfaceTable*) StdGlobalInterfaceTableInstance, riid, ppv);
+  }
+
+  FIXME("(%s), not supported.\n",debugstr_guid(riid));
+  return E_NOINTERFACE;
+}
+
+static HRESULT WINAPI GITCF_LockServer(LPCLASSFACTORY iface, BOOL fLock) {
+    FIXME("(%d), stub!\n",fLock);
+    return S_OK;
+}
+
+static ICOM_VTABLE(IClassFactory) GITClassFactoryVtbl = {
+    ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+    GITCF_QueryInterface,
+    GITCF_AddRef,
+    GITCF_Release,
+    GITCF_CreateInstance,
+    GITCF_LockServer
+};
+static ICOM_VTABLE(IClassFactory) *PGITClassFactoryVtbl = &GITClassFactoryVtbl;
+
+HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) {
+  *ppv = &PGITClassFactoryVtbl;
+  TRACE("Returning GIT classfactory\n");
   return S_OK;
 }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux