Piotr Caban : oleaut32: Add support of VT_USERDEFINED arguments with default value in AddFuncDesc.

Alexandre Julliard julliard at winehq.org
Tue Apr 9 13:41:29 CDT 2013


Module: wine
Branch: master
Commit: 3f7c07f5608f54cc043a04a8a9b3ff813dfe2ab0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3f7c07f5608f54cc043a04a8a9b3ff813dfe2ab0

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Tue Apr  9 12:13:13 2013 +0200

oleaut32: Add support of VT_USERDEFINED arguments with default value in AddFuncDesc.

---

 dlls/oleaut32/tests/typelib.c |   15 +++++++++++----
 dlls/oleaut32/typelib2.c      |    2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 33d1139..a20b3bf 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -2048,8 +2048,10 @@ static void test_CreateTypeLib(void) {
 
     elemdesc[0].tdesc.vt = VT_USERDEFINED;
     U(elemdesc[0].tdesc).hreftype = hreftype;
-    U(elemdesc[0]).paramdesc.pparamdescex = NULL;
-    U(elemdesc[0]).paramdesc.wParamFlags = 0;
+    U(elemdesc[0]).paramdesc.pparamdescex = ¶mdescex;
+    U(elemdesc[0]).paramdesc.wParamFlags = PARAMFLAG_FHASDEFAULT;
+    V_VT(&paramdescex.varDefaultValue) = VT_INT;
+    V_INT(&paramdescex.varDefaultValue) = 0x789;
 
     funcdesc.lprgelemdescParam = elemdesc;
     funcdesc.invkind = INVOKE_FUNC;
@@ -2077,10 +2079,15 @@ static void test_CreateTypeLib(void) {
     ok(pfuncdesc->wFuncFlags == 0, "got 0x%x\n", pfuncdesc->wFuncFlags);
 
     edesc = pfuncdesc->lprgelemdescParam;
-    ok(U(*edesc).paramdesc.pparamdescex == NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
-    ok(U(*edesc).paramdesc.wParamFlags == 0, "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
+    ok(U(*edesc).paramdesc.pparamdescex != NULL, "got: %p\n", U(*edesc).paramdesc.pparamdescex);
+    ok(U(*edesc).paramdesc.wParamFlags == PARAMFLAG_FHASDEFAULT,
+            "got: 0x%x\n", U(*edesc).paramdesc.wParamFlags);
     ok(edesc->tdesc.vt == VT_USERDEFINED, "got: %d\n", edesc->tdesc.vt);
     ok(U(edesc->tdesc).hreftype == hreftype, "got: 0x%x\n", U(edesc->tdesc).hreftype);
+    ok(V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == VT_INT, "got: %d\n",
+            V_VT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
+    ok(V_INT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue) == 0x789, "got: %d\n",
+            V_INT(&U(*edesc).paramdesc.pparamdescex->varDefaultValue));
 
     ITypeInfo2_ReleaseFuncDesc(ti2, pfuncdesc);
 
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 7d5b1c8..97f61a4 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -886,7 +886,7 @@ static HRESULT ctl2_encode_variant(
         arg_type = VT_UI4;
 
     v = *value;
-    if(arg_type == VT_VARIANT) {
+    if(arg_type==VT_VARIANT || arg_type==VT_USERDEFINED) {
         arg_type = V_VT(value);
     }else if(V_VT(value) != arg_type) {
         hres = VariantChangeType(&v, value, 0, arg_type);




More information about the wine-cvs mailing list