widl: Set the correct stack size for parameters in the proc format string.

This commit is contained in:
Alexandre Julliard 2011-05-25 20:32:12 +02:00
parent 56e65b4534
commit 52cb5b20f7
1 changed files with 27 additions and 1 deletions

View File

@ -342,6 +342,31 @@ static int get_padding(const var_list_t *fields)
return ROUNDING(offset, salign);
}
static unsigned int get_stack_size( const type_t *type, const attr_list_t *attrs, int *by_value )
{
unsigned int stack_size;
int by_val;
switch (typegen_detect_type( type, attrs, TDT_ALL_TYPES ))
{
case TGT_BASIC:
case TGT_ENUM:
case TGT_RANGE:
case TGT_STRUCT:
case TGT_UNION:
case TGT_USER_TYPE:
stack_size = type_memsize( type );
by_val = (pointer_size < 8 || stack_size <= pointer_size); /* FIXME: should be platform-specific */
break;
default:
by_val = 0;
break;
}
if (!by_val) stack_size = pointer_size;
if (by_value) *by_value = by_val;
return ROUND_SIZE( stack_size, pointer_size );
}
unsigned char get_struct_fc(const type_t *type)
{
int has_pointer = 0;
@ -871,7 +896,8 @@ static unsigned int write_procformatstring_type(FILE *file, int indent,
else
print_file(file, indent, "0x4d, /* FC_IN_PARAM */\n");
print_file(file, indent, "0x01,\n");
size = get_stack_size( type, attrs, NULL );
print_file(file, indent, "0x%02x,\n", size / pointer_size );
print_file(file, indent, "NdrFcShort(0x%x), /* type offset = %u */\n",
type->typestring_offset, type->typestring_offset);
size = 4; /* includes param type prefix */