oleaut32: Added more arguments with default values handling.

This commit is contained in:
Piotr Caban 2010-02-22 23:12:45 +01:00 committed by Alexandre Julliard
parent 4f555e3cc2
commit f42a73d01f
2 changed files with 39 additions and 2 deletions

View File

@ -1067,6 +1067,14 @@ static void test_CreateTypeLib(void) {
hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc); hres = ICreateTypeInfo_AddFuncDesc(createti, 3, &funcdesc);
ok(hres == S_OK, "got %08x\n", hres); 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); ICreateTypeInfo_Release(createti);
hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti); hres = ICreateTypeLib_CreateTypeInfo(createtl, interface1W, TKIND_INTERFACE, &createti);

View File

@ -1163,8 +1163,37 @@ static HRESULT ctl2_add_default_value(
return S_OK; return S_OK;
} }
FIXME("default values not implemented\n"); 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; 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 ===================================*/ /*================== ICreateTypeInfo2 Implementation ===================================*/