Add VARIANT_BOOL.
Fix CURRENCY alignment. A function with a [retval] param has a bit set in the FKCCIC bitfield. Two functions with the same name share the same id. The param names of propput and propputref functions don't go into the typelib.
This commit is contained in:
parent
e3e89294d9
commit
13e36059a8
|
@ -45,15 +45,16 @@ static struct oatype {
|
|||
const char *kw;
|
||||
unsigned short vt;
|
||||
} oatypes[] = {
|
||||
{"BSTR", VT_BSTR},
|
||||
{"CURRENCY", VT_CY},
|
||||
{"DATE", VT_DATE},
|
||||
{"DECIMAL", VT_DECIMAL},
|
||||
{"HRESULT", VT_HRESULT},
|
||||
{"LPSTR", VT_LPSTR},
|
||||
{"LPWSTR", VT_LPWSTR},
|
||||
{"SCODE", VT_ERROR},
|
||||
{"VARIANT", VT_VARIANT}
|
||||
{"BSTR", VT_BSTR},
|
||||
{"CURRENCY", VT_CY},
|
||||
{"DATE", VT_DATE},
|
||||
{"DECIMAL", VT_DECIMAL},
|
||||
{"HRESULT", VT_HRESULT},
|
||||
{"LPSTR", VT_LPSTR},
|
||||
{"LPWSTR", VT_LPWSTR},
|
||||
{"SCODE", VT_ERROR},
|
||||
{"VARIANT", VT_VARIANT},
|
||||
{"VARIANT_BOOL", VT_BOOL}
|
||||
};
|
||||
#define NTYPES (sizeof(oatypes)/sizeof(oatypes[0]))
|
||||
#define KWP(p) ((const struct oatype *)(p))
|
||||
|
|
|
@ -182,6 +182,7 @@ typedef struct {
|
|||
/* bits 8 - 11: CALLCONV */
|
||||
/* bit 12: parameters have default values */
|
||||
/* bit 13: oEntry is numeric */
|
||||
/* bit 14: has retval param */
|
||||
/* bits 16 - 31: index of next function with same id */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
INT16 nroargs; /* nr of optional arguments */
|
||||
|
|
|
@ -758,7 +758,7 @@ static int encode_type(
|
|||
case VT_CY:
|
||||
*encoded_type = default_type;
|
||||
*width = 8;
|
||||
*alignment = 4; /* guess? */
|
||||
*alignment = 8;
|
||||
break;
|
||||
|
||||
case VT_VOID:
|
||||
|
@ -1151,7 +1151,7 @@ static HRESULT set_custdata(msft_typelib_t *typelib, REFGUID guid,
|
|||
|
||||
static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index)
|
||||
{
|
||||
int offset;
|
||||
int offset, name_offset;
|
||||
int *typedata, typedata_size;
|
||||
int i, id, next_idx;
|
||||
int decoded_size, extra_attr = 0;
|
||||
|
@ -1190,6 +1190,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index)
|
|||
|
||||
chat("add_func_desc: num of params %d\n", num_params);
|
||||
|
||||
name_offset = ctl2_alloc_name(typeinfo->typelib, func->def->name);
|
||||
|
||||
for(attr = func->def->attrs; attr; attr = NEXT_LINK(attr)) {
|
||||
expr_t *expr = attr->u.pval;
|
||||
switch(attr->type) {
|
||||
|
@ -1233,7 +1235,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index)
|
|||
|
||||
switch(invokekind) {
|
||||
case 0x2: /* INVOKE_PROPERTYGET */
|
||||
if(num_params != 0) {
|
||||
if((num_params != 0 && (typeinfo->typeinfo->typekind & 15) == TKIND_DISPATCH)
|
||||
|| (num_params != 1 && (typeinfo->typeinfo->typekind & 15) == TKIND_INTERFACE)) {
|
||||
error("expecting no args on a propget func\n");
|
||||
return S_FALSE;
|
||||
}
|
||||
|
@ -1268,6 +1271,15 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index)
|
|||
typeinfo->func_data[0] += typedata_size;
|
||||
typedata = typeinfo->func_data + (offset >> 2) + 1;
|
||||
|
||||
|
||||
/* find func with the same name - if it exists use its id */
|
||||
for(i = 0; i < (typeinfo->typeinfo->cElement & 0xffff); i++) {
|
||||
if(name_offset == typeinfo->func_names[i]) {
|
||||
id = typeinfo->func_indices[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* find the first func with the same id and link via the hiword of typedata[4] */
|
||||
next_idx = index;
|
||||
for(i = 0; i < (typeinfo->typeinfo->cElement & 0xffff); i++) {
|
||||
|
@ -1344,6 +1356,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index)
|
|||
break;
|
||||
case ATTR_RETVAL:
|
||||
paramflags |= 0x08; /* PARAMFLAG_FRETVAL */
|
||||
typedata[4] |= 0x4000;
|
||||
break;
|
||||
default:
|
||||
chat("unhandled param attr %d\n", attr->type);
|
||||
|
@ -1371,9 +1384,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index)
|
|||
/* update the index data */
|
||||
typeinfo->func_indices[typeinfo->typeinfo->cElement & 0xffff] = id;
|
||||
typeinfo->func_offsets[typeinfo->typeinfo->cElement & 0xffff] = offset;
|
||||
|
||||
offset = ctl2_alloc_name(typeinfo->typelib, func->def->name);
|
||||
typeinfo->func_names[typeinfo->typeinfo->cElement & 0xffff] = offset;
|
||||
typeinfo->func_names[typeinfo->typeinfo->cElement & 0xffff] = name_offset;
|
||||
|
||||
/* ??? */
|
||||
if (!typeinfo->typeinfo->res2) typeinfo->typeinfo->res2 = 0x20;
|
||||
|
@ -1391,13 +1402,14 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index)
|
|||
/* Increment the number of function elements */
|
||||
typeinfo->typeinfo->cElement += 1;
|
||||
|
||||
namedata = typeinfo->typelib->typelib_segment_data[MSFT_SEG_NAME] + offset;
|
||||
namedata = typeinfo->typelib->typelib_segment_data[MSFT_SEG_NAME] + name_offset;
|
||||
if (*((INT *)namedata) == -1) {
|
||||
*((INT *)namedata) = typeinfo->typelib->typelib_typeinfo_offsets[typeinfo->typeinfo->typekind >> 16];
|
||||
namedata[9] &= ~0x10;
|
||||
}
|
||||
|
||||
if(invokekind == 0x1 /* INVOKE_FUNC */) { /* don't give the arg of a [prop*] func a name */
|
||||
if(invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */) {
|
||||
/* don't give the arg of a [propput*] func a name */
|
||||
for (arg = last_arg, i = 0; arg; arg = PREV_LINK(arg), i++) {
|
||||
int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
|
||||
offset = ctl2_alloc_name(typeinfo->typelib, arg->name);
|
||||
|
|
Loading…
Reference in New Issue