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:
Huw Davies 2005-02-08 12:09:42 +00:00 committed by Alexandre Julliard
parent e3e89294d9
commit 13e36059a8
3 changed files with 31 additions and 17 deletions

View File

@ -53,7 +53,8 @@ static struct oatype {
{"LPSTR", VT_LPSTR}, {"LPSTR", VT_LPSTR},
{"LPWSTR", VT_LPWSTR}, {"LPWSTR", VT_LPWSTR},
{"SCODE", VT_ERROR}, {"SCODE", VT_ERROR},
{"VARIANT", VT_VARIANT} {"VARIANT", VT_VARIANT},
{"VARIANT_BOOL", VT_BOOL}
}; };
#define NTYPES (sizeof(oatypes)/sizeof(oatypes[0])) #define NTYPES (sizeof(oatypes)/sizeof(oatypes[0]))
#define KWP(p) ((const struct oatype *)(p)) #define KWP(p) ((const struct oatype *)(p))

View File

@ -182,6 +182,7 @@ typedef struct {
/* bits 8 - 11: CALLCONV */ /* bits 8 - 11: CALLCONV */
/* bit 12: parameters have default values */ /* bit 12: parameters have default values */
/* bit 13: oEntry is numeric */ /* bit 13: oEntry is numeric */
/* bit 14: has retval param */
/* bits 16 - 31: index of next function with same id */ /* bits 16 - 31: index of next function with same id */
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
INT16 nroargs; /* nr of optional arguments */ INT16 nroargs; /* nr of optional arguments */

View File

@ -758,7 +758,7 @@ static int encode_type(
case VT_CY: case VT_CY:
*encoded_type = default_type; *encoded_type = default_type;
*width = 8; *width = 8;
*alignment = 4; /* guess? */ *alignment = 8;
break; break;
case VT_VOID: 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) 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 *typedata, typedata_size;
int i, id, next_idx; int i, id, next_idx;
int decoded_size, extra_attr = 0; 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); 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)) { for(attr = func->def->attrs; attr; attr = NEXT_LINK(attr)) {
expr_t *expr = attr->u.pval; expr_t *expr = attr->u.pval;
switch(attr->type) { switch(attr->type) {
@ -1233,7 +1235,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, func_t *func, int index)
switch(invokekind) { switch(invokekind) {
case 0x2: /* INVOKE_PROPERTYGET */ 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"); error("expecting no args on a propget func\n");
return S_FALSE; 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; typeinfo->func_data[0] += typedata_size;
typedata = typeinfo->func_data + (offset >> 2) + 1; 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] */ /* find the first func with the same id and link via the hiword of typedata[4] */
next_idx = index; next_idx = index;
for(i = 0; i < (typeinfo->typeinfo->cElement & 0xffff); i++) { 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; break;
case ATTR_RETVAL: case ATTR_RETVAL:
paramflags |= 0x08; /* PARAMFLAG_FRETVAL */ paramflags |= 0x08; /* PARAMFLAG_FRETVAL */
typedata[4] |= 0x4000;
break; break;
default: default:
chat("unhandled param attr %d\n", attr->type); 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 */ /* update the index data */
typeinfo->func_indices[typeinfo->typeinfo->cElement & 0xffff] = id; typeinfo->func_indices[typeinfo->typeinfo->cElement & 0xffff] = id;
typeinfo->func_offsets[typeinfo->typeinfo->cElement & 0xffff] = offset; typeinfo->func_offsets[typeinfo->typeinfo->cElement & 0xffff] = offset;
typeinfo->func_names[typeinfo->typeinfo->cElement & 0xffff] = name_offset;
offset = ctl2_alloc_name(typeinfo->typelib, func->def->name);
typeinfo->func_names[typeinfo->typeinfo->cElement & 0xffff] = offset;
/* ??? */ /* ??? */
if (!typeinfo->typeinfo->res2) typeinfo->typeinfo->res2 = 0x20; 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 */ /* Increment the number of function elements */
typeinfo->typeinfo->cElement += 1; 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) { if (*((INT *)namedata) == -1) {
*((INT *)namedata) = typeinfo->typelib->typelib_typeinfo_offsets[typeinfo->typeinfo->typekind >> 16]; *((INT *)namedata) = typeinfo->typelib->typelib_typeinfo_offsets[typeinfo->typeinfo->typekind >> 16];
namedata[9] &= ~0x10; 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++) { 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; int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
offset = ctl2_alloc_name(typeinfo->typelib, arg->name); offset = ctl2_alloc_name(typeinfo->typelib, arg->name);