Typelib changes 4

Nyef nyef at softhome.net
Sat Mar 13 14:25:48 CST 2004


Hello all.

Attached is a patch with:

    An implementation of ICreateTypeInfo2_SetHelpContext.

    A fix to ICreateTypeInfo2_SetVarName to fix a case where
multiple instances of the same name are used in the same typelib.

    An implementation of ICreateTypeInfo2_SetTypeDescAlias.

    An implementation of ITypeLib2_GetTypeInfoCount.

    An implementation of ITypeLib2_GetTypeInfoType.

    An implementation of ITypeLib2_IsName.

I believe that will be all for now.

--Alastair Bridgewater
-------------- next part --------------
Index: typelib2.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib2.c,v
retrieving revision 1.13
diff -u -r1.13 typelib2.c
--- typelib2.c	10 Feb 2004 02:26:06 -0000	1.13
+++ typelib2.c	13 Mar 2004 16:35:39 -0000
@@ -1207,8 +1283,13 @@
         ICreateTypeInfo2* iface,
         DWORD dwHelpContext)
 {
-    FIXME("(%p,%ld), stub!\n", iface, dwHelpContext);
-    return E_OUTOFMEMORY;
+    ICOM_THIS(ICreateTypeInfo2Impl, iface);
+
+    TRACE("(%p,%ld)\n", iface, dwHelpContext);
+
+    This->typeinfo->helpcontext = dwHelpContext;
+
+    return S_OK;
 }
 
 /******************************************************************************
@@ -1666,8 +1747,10 @@
     if (offset == -1) return E_OUTOFMEMORY;
 
     namedata = This->typelib->typelib_segment_data[MSFT_SEG_NAME] + offset;
-    *((INT *)namedata) = This->typelib->typelib_typeinfo_offsets[This->typeinfo->typekind >> 16];
-    namedata[9] = 0x10;
+    if (*((INT *)namedata) == -1) {
+	*((INT *)namedata) = This->typelib->typelib_typeinfo_offsets[This->typeinfo->typekind >> 16];
+	namedata[9] |= 0x10;
+    }
     if ((This->typeinfo->typekind & 15) == TKIND_ENUM) {
 	namedata[9] |= 0x20;
     }
@@ -1685,8 +1768,25 @@
         ICreateTypeInfo2* iface,
         TYPEDESC* pTDescAlias)
 {
-    FIXME("(%p,%p), stub!\n", iface, pTDescAlias);
-    return E_OUTOFMEMORY;
+    ICOM_THIS(ICreateTypeInfo2Impl, iface);
+
+    int encoded_typedesc;
+    int width;
+
+    if ((This->typeinfo->typekind & 15) != TKIND_ALIAS) {
+	return TYPE_E_WRONGTYPEKIND;
+    }
+
+    FIXME("(%p,%p), hack!\n", iface, pTDescAlias);
+
+    if (ctl2_encode_typedesc(This->typelib, pTDescAlias, &encoded_typedesc, &width, NULL, NULL) == -1) {
+	return E_OUTOFMEMORY;
+    }
+
+    This->typeinfo->size = width;
+    This->typeinfo->datatype1 = encoded_typedesc;
+
+    return S_OK;
 }
 
 /******************************************************************************
@@ -3364,11 +3474,11 @@
 static UINT WINAPI ITypeLib2_fnGetTypeInfoCount(
         ITypeLib2 * iface)
 {
-/*     ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+    ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
 
-    FIXME("(%p), stub!\n", iface);
+    TRACE("(%p)\n", iface);
 
-    return 0;
+    return This->typelib_header.nrtypeinfos;
 }
 
 /******************************************************************************
@@ -3398,11 +3512,17 @@
         UINT index,
         TYPEKIND* pTKind)
 {
-/*     ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+    ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
 
-    FIXME("(%p,%d,%p), stub!\n", iface, index, pTKind);
+    TRACE("(%p,%d,%p)\n", iface, index, pTKind);
 
-    return E_OUTOFMEMORY;
+    if ((index < 0) || (index >= This->typelib_header.nrtypeinfos)) {
+	return TYPE_E_ELEMENTNOTFOUND;
+    }
+
+    *pTKind = (This->typelib_segment_data[MSFT_SEG_TYPEINFO][This->typelib_typeinfo_offsets[index]]) & 15;
+
+    return S_OK;
 }
 
 /******************************************************************************
@@ -3485,11 +3614,29 @@
         ULONG lHashVal,
         BOOL* pfName)
 {
-/*     ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface); */
+    ICOM_THIS_From_ITypeLib2(ICreateTypeLib2Impl, iface);
 
-    FIXME("(%p,%s,%lx,%p), stub!\n", iface, debugstr_w(szNameBuf), lHashVal, pfName);
+    char *encoded_name;
+    int nameoffset;
+    MSFT_NameIntro *nameintro;
 
-    return E_OUTOFMEMORY;
+    TRACE("(%p,%s,%lx,%p)\n", iface, debugstr_w(szNameBuf), lHashVal, pfName);
+
+    ctl2_encode_name(This, szNameBuf, &encoded_name);
+    nameoffset = ctl2_find_name(This, encoded_name);
+
+    *pfName = 0;
+
+    if (nameoffset == -1) return S_OK;
+
+    nameintro = (MSFT_NameIntro *)(&This->typelib_segment_data[MSFT_SEG_NAME][nameoffset]);
+    if (nameintro->hreftype == -1) return S_OK;
+
+    *pfName = 1;
+
+    FIXME("Should be decoding our copy of the name over szNameBuf.\n");
+
+    return S_OK;
 }
 
 /******************************************************************************


More information about the wine-patches mailing list