Piotr Caban : oleaut32: Added more arguments with default values handling.

Alexandre Julliard julliard at winehq.org
Tue Feb 23 11:17:21 CST 2010


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Feb 22 23:12:45 2010 +0100

oleaut32: Added more arguments with default values handling.

---

 dlls/oleaut32/tests/typelib.c |    8 ++++++++
 dlls/oleaut32/typelib2.c      |   33 +++++++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index b9bb396..9e5d91d 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -1067,6 +1067,14 @@ static void test_CreateTypeLib(void) {
     hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc);
     ok(hres == S_OK, "got %08x\n", hres);
 
+    elemdesc[0].paramdesc.wParamFlags = PARAMFLAG_FHASDEFAULT;
+    elemdesc[0].paramdesc.pparamdescex = &paramdescex;
+    elemdesc[1].tdesc.vt = VT_INT;
+    V_VT(&paramdescex.varDefaultValue) = VT_INT;
+    V_INT(&paramdescex.varDefaultValue) = 0xffffffff;
+    hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc);
+    ok(hres == S_OK, "got %08x\n", hres);
+
     ICreateTypeInfo_Release(createti);
 
     hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti);
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 41b7891..0a4a8bb 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -1163,8 +1163,37 @@ static HRESULT ctl2_add_default_value(
         return S_OK;
     }
 
-    FIXME("default values not implemented\n");
-    return S_OK;
+    switch(arg_type) {
+    case VT_I4:
+    case VT_R4:
+    case VT_UI4:
+    case VT_INT:
+    case VT_UINT:
+    case VT_HRESULT:
+    case VT_PTR: {
+        /* Construct the data to be allocated */
+        int data[2];
+        data[0] = arg_type + (V_UI4(&v)<<16);
+        data[1] = (V_UI4(&v)>>16) + 0x57570000;
+
+        /* Check if the data was already allocated */
+        /* Currently the structures doesn't allow to do it in a nice way */
+        for(*encoded_value=0; *encoded_value<=This->typelib_segdir[MSFT_SEG_CUSTDATA].length-8; *encoded_value+=4)
+            if(!memcmp(&This->typelib_segment_data[MSFT_SEG_CUSTDATA][*encoded_value], data, 8))
+                return S_OK;
+
+        /* Allocate the data */
+        *encoded_value = ctl2_alloc_segment(This, MSFT_SEG_CUSTDATA, 8, 0);
+        if(*encoded_value == -1)
+            return E_OUTOFMEMORY;
+
+        memcpy(&This->typelib_segment_data[MSFT_SEG_CUSTDATA][*encoded_value], data, 8);
+        return S_OK;
+    }
+    default:
+        FIXME("Argument type not yet handled\n");
+        return E_NOTIMPL;
+    }
 }
 
 /*================== ICreateTypeInfo2 Implementation ===================================*/




More information about the wine-cvs mailing list