[PATCH v2 13/13] oleaut32: Load GetVarCustData from MSFT-format typelib.

Puetz Kevin A PuetzKevinA at JohnDeere.com
Thu Aug 6 23:53:27 CDT 2020


Signed-off-by: Kevin Puetz <PuetzKevinA at JohnDeere.com>
---
Drop the hunk that moved into v2 07/13 (where it belongs)
---
 dlls/oleaut32/tests/test_tlb.idl |  51 ++++++++++-
 dlls/oleaut32/tests/typelib.c    | 146 +++++++++++++++++++++++++++++++
 dlls/oleaut32/typelib.c          |   3 +
 3 files changed, 199 insertions(+), 1 deletion(-)

diff --git a/dlls/oleaut32/tests/test_tlb.idl b/dlls/oleaut32/tests/test_tlb.idl
index b8fecc9a01..251897c91e 100644
--- a/dlls/oleaut32/tests/test_tlb.idl
+++ b/dlls/oleaut32/tests/test_tlb.idl
@@ -26,7 +26,17 @@ import "oaidl.idl"; /* needed by widl */
 
 midl_pragma warning ( disable : 2368 )
 
-[uuid(8b05fe77-4a6c-4133-b9cd-8f81747af784)]
+#define CUSTDATA_BSTR c8768723-e6d2-4442-b039-92e9c82429c4
+
+#define CUSTDATA_STRLIT c8768723-e6d2-4442-b039-92e9c82429c4
+#define CUSTDATA_NUM b481b478-a181-4eb6-b6e0-df63069e8c80
+#define CUSTDATA_HEXNUM a09d7c06-cf38-4db3-9450-10641651c35b
+
+[uuid(8b05fe77-4a6c-4133-b9cd-8f81747af784),
+custom(CUSTDATA_STRLIT,"ITypeLib2::GetCustData"),
+custom(CUSTDATA_NUM,42),
+custom(CUSTDATA_HEXNUM,0x1337C0D3),
+]
 library Test
 {
 	importlib("stdole2.tlb");
@@ -170,4 +180,43 @@ library Test
 	{
 		interface ITestDispDual;
 	}
+
+	[uuid(786ee4ff-c5dd-4bf4-9578-0d22fb5369cc),custom(CUSTDATA_STRLIT,"ITypeInfo2::GetCustData interface")]
+	interface custdata_interface : IDispatch
+	{
+		[custom(CUSTDATA_STRLIT,"ITypeInfo2::GetFuncCustData custdata_interface::test_method")]
+		HRESULT test_method([in,custom(CUSTDATA_STRLIT,"ITypeInfo2::GetParamCustData custdata_interface::test_method(x)")] int x);
+	}
+
+	[uuid(6ca99f5e-c86a-42ad-a5ee-5bd4c8e5553c),custom(CUSTDATA_STRLIT,"ITypeInfo2::GetCustData enum")]
+	enum custdata_enum {
+		One, Two
+	};
+
+	[uuid(62fabe17-f733-4b09-b859-3f455dcda450),custom(CUSTDATA_STRLIT,"ITypeInfo2::GetCustData struct")]
+	struct custdata_struct {
+		[custom(CUSTDATA_STRLIT,"ITypeInfo2::GetVarCustData struct")]
+		int test_field;
+	};
+
+	[/* uuid(...) not allowed on union */ custom(CUSTDATA_STRLIT,"ITypeInfo2::GetCustData union")]
+	union custdata_union {
+		[custom(CUSTDATA_STRLIT,"ITypeInfo2::GetVarCustData union")]
+		int test_field;
+	};
+
+	[public,uuid(d58744d6-63f9-467c-87e5-c95158098b18),custom(CUSTDATA_STRLIT,"ITypeInfo2::GetCustData typedef")]
+	typedef custdata_interface * custdata_typedef;
+
+	[uuid(bffc216e-2159-465a-80df-b85fd4f4f122),custom(CUSTDATA_STRLIT,"ITypeInfo2::GetCustData dispinterface")]
+	dispinterface custdata_dispatch
+	{
+properties:
+		[id(0),custom(CUSTDATA_STRLIT,"ITypeInfo2::GetVarCustData dispinterface property")]
+		int test_property;
+methods:
+		[id(1),custom(CUSTDATA_STRLIT,"ITypeInfo2::GetFuncCustData dispinterface method")]
+		// FIXME: if the custom strings were identical, midl would de-duplicate them; widl writes them twice.
+		void test_method([in,custom(CUSTDATA_STRLIT,"ITypeInfo2::GetParamCustData test_dispatch::test_method(x)")] int x);
+	}
 }
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 8ecdec4c13..66b9f7f25a 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -6124,6 +6124,152 @@ static const type_info info[] = {
     },
   },
   { /* vars */ },
+},
+{
+  "custdata_interface",
+  "{786ee4ff-c5dd-4bf4-9578-0d22fb5369cc}",
+  /*kind*/ TKIND_INTERFACE, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ TYPE_ALIGNMENT(custdata_interface*), /*size*/ sizeof(custdata_interface*),
+  /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 8, /*#func*/ 1, /*#var*/ 0,
+  /*#custdata*/ 1, {
+    { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetCustData interface" } } },
+  },
+  { /* funcs */
+    {
+      /*id*/ 0x60020000, /*func*/ FUNC_PUREVIRTUAL, /*inv*/ INVOKE_FUNC, /*call*/ CC_STDCALL,
+      /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 7, /*#scodes*/ 0, /*flags*/ 0,
+      {VT_HRESULT, -1, PARAMFLAG_NONE}, /* ret */
+      /*#custdata*/ 1, {
+        { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetFuncCustData custdata_interface::test_method" } } },
+      },
+      { /* params */
+        {VT_INT, -1, PARAMFLAG_FIN, /*#custdata*/ 1, {
+          { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetParamCustData custdata_interface::test_method(x)" } } },
+        } },
+        {-1, 0, 0}
+      },
+      { /* names */
+        "test_method",
+        "x",
+        NULL,
+      },
+    },
+  },
+  { /* vars */ },
+},
+{
+  "custdata_enum",
+  "{6ca99f5e-c86a-42ad-a5ee-5bd4c8e5553c}",
+  /*kind*/ TKIND_ENUM, /*flags*/ 0, /*align*/ 4, /*size*/ 4,
+  /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 2,
+  /*#custdata*/ 1, {
+    { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetCustData enum" } } },
+  },
+  { /* funcs */ },
+  { /* vars */
+    {
+      /*id*/ 0x40000000, /*name*/ "One", /*flags*/ 0, /*kind*/ VAR_CONST,
+      { .varValue = { VT_I4, { .value_int = 0 } } },
+      /*#custdata*/ 0, {},
+      {VT_INT, -1, PARAMFLAG_NONE}, /* ret */
+    },
+    {
+      /*id*/ 0x40000001, /*name*/ "Two", /*flags*/ 0, /*kind*/ VAR_CONST,
+      { .varValue = { VT_I4, { .value_int = 1 } } },
+      /*#custdata*/ 0, {},
+      {VT_INT, -1, PARAMFLAG_NONE}, /* ret */
+    },
+  },
+},
+{
+  "custdata_struct",
+  "{62fabe17-f733-4b09-b859-3f455dcda450}",
+  /*kind*/ TKIND_RECORD, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(struct custdata_struct), /*size*/ sizeof(struct custdata_struct),
+  /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
+  /*#custdata*/ 1, {
+    { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetCustData struct" } } },
+  },
+  { /* funcs */ },
+  { /* vars */
+    {
+      /*id*/ 0x40000000, /*name*/ "test_field", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE,
+      { .oInst = 0 },
+      /*#custdata*/ 1, {
+        { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetVarCustData struct" } } },
+      },
+      {VT_INT, -1, PARAMFLAG_NONE}, /* ret */
+    },
+  },
+},
+{
+  "custdata_union",
+  "{00000000-0000-0000-0000-000000000000}",
+  /*kind*/ TKIND_UNION, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(union custdata_union), /*size*/ sizeof(union custdata_union),
+  /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 1,
+  /*#custdata*/ 1, {
+    { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetCustData union" } } },
+  },
+  { /* funcs */ },
+  { /* vars */
+    {
+      /*id*/ 0x40000000, /*name*/ "test_field", /*flags*/ 0, /*kind*/ VAR_PERINSTANCE,
+      { .oInst = 0 },
+      /*#custdata*/ 1, {
+        { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetVarCustData union" } } },
+      },
+      {VT_INT, -1, PARAMFLAG_NONE}, /* ret */
+    },
+  },
+},
+{
+  "custdata_typedef",
+  "{d58744d6-63f9-467c-87e5-c95158098b18}",
+  /*kind*/ TKIND_ALIAS, /*flags*/ 0, /*align*/ TYPE_ALIGNMENT(custdata_typedef), /*size*/ sizeof(custdata_typedef),
+  /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 0, /*#func*/ 0, /*#var*/ 0,
+  /*#custdata*/ 1, {
+    { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetCustData typedef" } } },
+  },
+  { /* funcs */ },
+  { /* vars */ },
+},
+{
+  "custdata_dispatch",
+  "{bffc216e-2159-465a-80df-b85fd4f4f122}",
+  /*kind*/ TKIND_DISPATCH, /*flags*/ TYPEFLAG_FDISPATCHABLE, /*align*/ TYPE_ALIGNMENT(custdata_dispatch*), /*size*/ sizeof(custdata_dispatch*),
+  /*helpctx*/ 0x0000, /*version*/ 0x00000000, /*#vtbl*/ 7, /*#func*/ 1, /*#var*/ 1,
+  /*#custdata*/ 1, {
+    { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetCustData dispinterface" } } },
+  },
+  { /* funcs */
+    {
+      /*id*/ 0x1, /*func*/ FUNC_DISPATCH, /*inv*/ INVOKE_FUNC, /*call*/ CC_STDCALL,
+      /*#param*/ 1, /*#opt*/ 0, /*vtbl*/ 0, /*#scodes*/ 0, /*flags*/ 0,
+      {VT_VOID, -1, PARAMFLAG_NONE}, /* ret */
+      /*#custdata*/ 1, {
+        { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetFuncCustData dispinterface method" } } },
+      },
+      { /* params */
+        {VT_INT, -1, PARAMFLAG_FIN, /*#custdata*/ 1, {
+          { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetParamCustData test_dispatch::test_method(x)" } } },
+        } },
+        {-1, 0, 0}
+      },
+      { /* names */
+        "test_method",
+        "x",
+        NULL,
+      },
+    },
+  },
+  { /* vars */
+    {
+      /*id*/ 0x0, /*name*/ "test_property", /*flags*/ 0, /*kind*/ VAR_DISPATCH,
+      { /* DUMMYUNIONNAME unused*/ },
+      /*#custdata*/ 1, {
+        { "{c8768723-e6d2-4442-b039-92e9c82429c4}", { VT_BSTR, { .value_str = "ITypeInfo2::GetVarCustData dispinterface property" } } },
+      },
+      {VT_INT, -1, PARAMFLAG_NONE}, /* ret */
+    },
+  },
 }
 };
 
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 6dbd8c39b2..99181e206e 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -2600,6 +2600,9 @@ static void MSFT_DoVars(TLBContext *pcx, ITypeInfoImpl *pTI, int cFuncs,
         if(reclength > FIELD_OFFSET(MSFT_VarRecord, HelpString))
             ptvd->HelpString = MSFT_ReadString(pcx, pVarRec->HelpString);
 
+        if (reclength > FIELD_OFFSET(MSFT_VarRecord, oCustData))
+            MSFT_CustData(pcx, pVarRec->oCustData, &ptvd->custdata_list);
+
         if(reclength > FIELD_OFFSET(MSFT_VarRecord, HelpStringContext))
             ptvd->HelpStringContext = pVarRec->HelpStringContext;
 
-- 
2.27.0.windows.1




More information about the wine-devel mailing list