Robert Shearman : oleaut: Fix function support for SLTG dispinterfaces.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 6 06:08:45 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 4b6b51ae99eb372b38143e58eaee16035d65f7d9
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=4b6b51ae99eb372b38143e58eaee16035d65f7d9

Author: Robert Shearman <rob at codeweavers.com>
Date:   Mon Jul  3 13:54:34 2006 +0100

oleaut: Fix function support for SLTG dispinterfaces.

---

 dlls/oleaut32/typelib.c |   19 ++++++++++++++-----
 dlls/oleaut32/typelib.h |    1 +
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index c61bd36..d65fd64 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -2897,7 +2897,8 @@ static void SLTG_DoFuncs(char *pBlk, cha
 	WORD *pType, *pArg;
 
 	if(pFunc->magic != SLTG_FUNCTION_MAGIC &&
-	   pFunc->magic != SLTG_FUNCTION_WITH_FLAGS_MAGIC) {
+	   pFunc->magic != SLTG_FUNCTION_WITH_FLAGS_MAGIC &&
+           pFunc->magic != SLTG_DISPATCH_FUNCTION_MAGIC) {
 	    FIXME("func magic = %02x\n", pFunc->magic);
 	    return;
 	}
@@ -3070,6 +3071,14 @@ static void SLTG_ProcessDispatch(char *p
 
   if (pTITail->funcs_off != 0xffff)
     SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable);
+
+  /* this is necessary to cope with MSFT typelibs that set cFuncs to the number
+   * of dispinterface functons including the IDispatch ones, so
+   * ITypeInfo::GetFuncDesc takes the real value for cFuncs from cbSizeVft */
+  pTI->TypeAttr.cbSizeVft = pTI->TypeAttr.cFuncs * sizeof(void *);
+
+  if (TRACE_ON(typelib))
+      dump_TLBFuncDesc(pTI->funclist);
 }
 
 static void SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI,
@@ -3317,6 +3326,10 @@ static ITypeLib2* ITypeLib2_Constructor_
 
       pTITail = (SLTG_TypeInfoTail*)((char *)(pMemHeader + 1) + pMemHeader->cbExtra);
 
+      (*ppTypeInfoImpl)->TypeAttr.cbAlignment = pTITail->cbAlignment;
+      (*ppTypeInfoImpl)->TypeAttr.cbSizeInstance = pTITail->cbSizeInstance;
+      (*ppTypeInfoImpl)->TypeAttr.cbSizeVft = pTITail->cbSizeVft;
+
       switch(pTIHeader->typekind) {
       case TKIND_ENUM:
 	SLTG_ProcessEnum((char *)(pMemHeader + 1), *ppTypeInfoImpl, pNameTable,
@@ -3356,10 +3369,6 @@ static ITypeLib2* ITypeLib2_Constructor_
 
       if(pTITail) { /* could get cFuncs, cVars and cImplTypes from here
 		       but we've already set those */
-	  (*ppTypeInfoImpl)->TypeAttr.cbAlignment = pTITail->cbAlignment;
-	  (*ppTypeInfoImpl)->TypeAttr.cbSizeInstance = pTITail->cbSizeInstance;
-	  (*ppTypeInfoImpl)->TypeAttr.cbSizeVft = pTITail->cbSizeVft;
-
 #define X(x) TRACE_(typelib)("tt "#x": %x\n",pTITail->res##x);
 	  X(06);
 	  X(16);
diff --git a/dlls/oleaut32/typelib.h b/dlls/oleaut32/typelib.h
index 8ebe1ee..4ac98ad 100644
--- a/dlls/oleaut32/typelib.h
+++ b/dlls/oleaut32/typelib.h
@@ -501,6 +501,7 @@ #endif
 
 #define SLTG_FUNCTION_MAGIC 0x4c
 #define SLTG_FUNCTION_WITH_FLAGS_MAGIC 0x6c
+#define SLTG_DISPATCH_FUNCTION_MAGIC 0xcb
 
 typedef struct {
 /*00*/	BYTE magic;		/* 0xdf */




More information about the wine-cvs mailing list