widl: Don't output callback conformances for non-interpreted functions.

The Windows marshaller calls the callback with an invalid stack.
This commit is contained in:
Alexandre Julliard 2011-05-28 13:38:25 +02:00
parent 9a21e823ff
commit 0486140c3d
2 changed files with 21 additions and 1 deletions

View File

@ -908,6 +908,19 @@ static unsigned int write_procformatstring_type(FILE *file, int indent,
return size;
}
int is_interpreted_func( const type_t *iface, const var_t *func )
{
const char *str;
const type_t *ret_type = type_function_get_rettype( func->type );
/* return value must fit in a long_ptr for interpreted functions */
if (type_get_type( ret_type ) == TYPE_BASIC && type_memsize( ret_type ) > pointer_size)
return 0;
if ((str = get_attrp( func->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
if ((str = get_attrp( iface->attrs, ATTR_OPTIMIZE ))) return !strcmp( str, "i" );
return 0;
}
static void write_procformatstring_func( FILE *file, int indent,
const var_t *func, unsigned int *offset )
{
@ -1229,7 +1242,7 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
print_file(file, 2, "NdrFcShort(0x%hx),\t/* offset = %d */\n",
(unsigned short)offset, offset);
}
else
else if (!iface || is_interpreted_func( iface, current_func ))
{
unsigned int callback_offset = 0;
struct expr_eval_routine *eval;
@ -1267,6 +1280,12 @@ static unsigned int write_conf_or_var_desc(FILE *file, const type_t *cont_type,
print_file(file, 2, "0x%x,\t/* %s */\n", RPC_FC_CALLBACK, "FC_CALLBACK");
print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", (unsigned short)callback_offset, callback_offset);
}
else /* output a dummy corr desc that isn't used */
{
print_file(file, 2, "0x%x,\t/* Corr desc: unused for %s */\n", conftype, name);
print_file(file, 2, "0x0,\n" );
print_file(file, 2, "NdrFcShort(0x0),\n" );
}
return 4;
}

View File

@ -82,6 +82,7 @@ void write_endpoints( FILE *f, const char *prefix, const str_list_t *list );
void write_exceptions( FILE *file );
unsigned int type_memsize(const type_t *t);
int decl_indirect(const type_t *t);
int is_interpreted_func(const type_t *iface, const var_t *func);
void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix);
void print(FILE *file, int indent, const char *format, va_list ap);
expr_t *get_size_is_expr(const type_t *t, const char *name);