Alexandre Julliard : widl: Set the correct stack size for parameters in the proc format string.
Alexandre Julliard
julliard at winehq.org
Thu May 26 10:56:25 CDT 2011
Module: wine
Branch: master
Commit: 52cb5b20f794cd328587f4adabfa1e0bb62ce8a0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=52cb5b20f794cd328587f4adabfa1e0bb62ce8a0
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed May 25 20:32:12 2011 +0200
widl: Set the correct stack size for parameters in the proc format string.
---
tools/widl/typegen.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 4bdc94c..36358a8 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -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 */
More information about the wine-cvs
mailing list