oleaut32: Implement CreateDispTypeInfo

Huw D M Davies h.davies1 at physics.ox.ac.uk
Tue Oct 5 06:18:26 CDT 2004


        Huw Davies <huw at codeweavers.com>
        Implement CreateDispTypeInfo
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/oleaut32/dispatch.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/dispatch.c,v
retrieving revision 1.21
diff -u -r1.21 dispatch.c
--- dlls/oleaut32/dispatch.c	24 Sep 2004 01:16:53 -0000	1.21
+++ dlls/oleaut32/dispatch.c	5 Oct 2004 11:08:14 -0000
@@ -180,28 +180,6 @@
     return S_OK;
 }
 
-/******************************************************************************
- * CreateDispTypeInfo [OLEAUT32.31]
- *
- * Build type information for an object so it can be called through an
- * IDispatch interface.
- *
- * RETURNS
- *  Success: S_OK. pptinfo contains the created ITypeInfo object.
- *  Failure: E_INVALIDARG, if one or more arguments is invalid.
- *
- * NOTES
- *  This call allows an objects methods to be accessed through IDispatch, by
- *  building an ITypeInfo object that IDispatch can use to call through.
- */
-HRESULT WINAPI CreateDispTypeInfo(
-	INTERFACEDATA *pidata, /* [I] Description of the interface to build type info for */
-	LCID lcid, /* [I] Locale Id */
-	ITypeInfo **pptinfo) /* [O] Destination for created ITypeInfo object */
-{
-	FIXME("(%p,%ld,%p),stub\n",pidata,lcid,pptinfo);
-	return 0;
-}
 
 /******************************************************************************
  * IDispatch {OLEAUT32}
Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.123
diff -u -r1.123 typelib.c
--- dlls/oleaut32/typelib.c	27 Sep 2004 20:33:27 -0000	1.123
+++ dlls/oleaut32/typelib.c	5 Oct 2004 11:08:15 -0000
@@ -5739,6 +5739,75 @@
     ITypeInfo2_fnGetAllImplTypeCustData,
 };
 
+/******************************************************************************
+ * CreateDispTypeInfo [OLEAUT32.31]
+ *
+ * Build type information for an object so it can be called through an
+ * IDispatch interface.
+ *
+ * RETURNS
+ *  Success: S_OK. pptinfo contains the created ITypeInfo object.
+ *  Failure: E_INVALIDARG, if one or more arguments is invalid.
+ *
+ * NOTES
+ *  This call allows an objects methods to be accessed through IDispatch, by
+ *  building an ITypeInfo object that IDispatch can use to call through.
+ */
+HRESULT WINAPI CreateDispTypeInfo(
+	INTERFACEDATA *pidata, /* [I] Description of the interface to build type info for */
+	LCID lcid, /* [I] Locale Id */
+	ITypeInfo **pptinfo) /* [O] Destination for created ITypeInfo object */
+{
+    ITypeInfoImpl *pTIImpl;
+    int param, func;
+    TLBFuncDesc **ppFuncDesc;
+
+    pTIImpl = (ITypeInfoImpl*)ITypeInfo_Constructor();
+    pTIImpl->pTypeLib = NULL;
+    pTIImpl->index = 0;
+    pTIImpl->Name = NULL;
+    pTIImpl->dwHelpContext = -1;
+    memset(&pTIImpl->TypeAttr.guid, 0, sizeof(GUID));
+    pTIImpl->TypeAttr.lcid = lcid;
+    pTIImpl->TypeAttr.typekind = TKIND_COCLASS;
+    pTIImpl->TypeAttr.wMajorVerNum = 0;
+    pTIImpl->TypeAttr.wMinorVerNum = 0;
+    pTIImpl->TypeAttr.cbAlignment = 2;
+    pTIImpl->TypeAttr.cbSizeInstance = -1;
+    pTIImpl->TypeAttr.cbSizeVft = -1;
+    pTIImpl->TypeAttr.cFuncs = 0;
+    pTIImpl->TypeAttr.cImplTypes = 1;
+    pTIImpl->TypeAttr.cVars = 0;
+    pTIImpl->TypeAttr.wTypeFlags = 0;
+
+    ppFuncDesc = &pTIImpl->funclist;
+    for(func = 0; func < pidata->cMembers; func++) {
+        METHODDATA *md = pidata->pmethdata + func;
+        *ppFuncDesc = HeapAlloc(GetProcessHeap(), 0, sizeof(**ppFuncDesc));
+        (*ppFuncDesc)->Name = SysAllocString(md->szName);
+        (*ppFuncDesc)->funcdesc.memid = md->dispid;
+        (*ppFuncDesc)->funcdesc.invkind = md->wFlags;
+        (*ppFuncDesc)->funcdesc.callconv = md->cc;
+        (*ppFuncDesc)->funcdesc.cParams = md->cArgs;
+        (*ppFuncDesc)->funcdesc.cParamsOpt = 0;
+        (*ppFuncDesc)->funcdesc.oVft = md->iMeth;
+        (*ppFuncDesc)->funcdesc.wFuncFlags = 0; /*??*/
+        (*ppFuncDesc)->funcdesc.elemdescFunc.tdesc.vt = md->vtReturn;
+        (*ppFuncDesc)->funcdesc.lprgelemdescParam = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+                                                              md->cArgs * sizeof(ELEMDESC));
+        (*ppFuncDesc)->pParamDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+                                              md->cArgs * sizeof(TLBParDesc));
+        for(param = 0; param < md->cArgs; param++) {
+            (*ppFuncDesc)->funcdesc.lprgelemdescParam[param].tdesc.vt = md->ppdata[param].vt;
+            (*ppFuncDesc)->pParamDesc[param].Name = SysAllocString(md->ppdata[param].szName);
+        }
+        ppFuncDesc = &(*ppFuncDesc)->next;
+    }        
+    *pptinfo = (ITypeInfo*)pTIImpl;
+    return S_OK;
+
+}
+
 static HRESULT WINAPI ITypeComp_fnQueryInterface(ITypeComp * iface, REFIID riid, LPVOID * ppv)
 {
     ICOM_THIS_From_ITypeComp(ITypeInfoImpl, iface);



More information about the wine-patches mailing list