oleaut32: Improve ICreateTypeInfo_LayOut implementation.
authorPiotr Caban <piotr@codeweavers.com>
Mon, 15 Mar 2010 22:40:31 +0000 (23:40 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 16 Mar 2010 10:48:51 +0000 (11:48 +0100)
dlls/oleaut32/typelib2.c

index 3a92badaa16daf50a9bb84f2b59f492635774872..a275845753ac6594fa970306cf0273a98e29ad92 100644 (file)
@@ -2360,6 +2360,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
 
     TRACE("(%p)\n", iface);
 
+    /* FIXME: LayOut should be run on all ImplTypes */
     if(This->typekind == TKIND_COCLASS)
         return S_OK;
 
@@ -2429,7 +2430,34 @@ static HRESULT WINAPI ICreateTypeInfo2_fnLayOut(
         ITypeInfo_Release(cur);
     }
 
-    This->typeinfo->cbSizeVft = (This->typeinfo->datatype2>>16) * 4;
+    /* Get cbSizeVft of inherited interface */
+    /* Makes LayOut running recursively */
+    if(This->typeinfo->datatype1 != -1) {
+        ITypeInfo *cur, *inherited;
+        TYPEATTR *typeattr;
+
+        hres = ICreateTypeInfo_QueryInterface(iface, &IID_ITypeInfo, (void**)&cur);
+        if(FAILED(hres))
+            return hres;
+
+        hres = ITypeInfo_GetRefTypeInfo(cur, This->typeinfo->datatype1, &inherited);
+        ITypeInfo_Release(cur);
+        if(FAILED(hres))
+            return hres;
+
+        hres = ITypeInfo_GetTypeAttr(inherited, &typeattr);
+        if(FAILED(hres)) {
+            ITypeInfo_Release(inherited);
+            return hres;
+        }
+
+        This->typeinfo->cbSizeVft = typeattr->cbSizeVft;
+
+        ITypeInfo_ReleaseTypeAttr(inherited, typeattr);
+        ITypeInfo_Release(inherited);
+    } else
+        This->typeinfo->cbSizeVft = 0;
+
     if(!This->typedata)
         return S_OK;