Module: wine Branch: master Commit: fb224429f7f5bcd66798ceb1709c048789238e41 URL: http://source.winehq.org/git/wine.git/?a=commit;h=fb224429f7f5bcd66798ceb170...
Author: Rob Shearman robertshearman@gmail.com Date: Wed Jul 2 00:00:43 2008 +0100
widl: Increment the buffer offset by 8 for embedded pointers inside varying arrays in varying structures.
The 8 bytes are for the variance and offset and are added just before the array, as seen in the marshalling code in rpcrt4. No offset needs to be added for non-varying structures since the buffer mark is set after the conformance in marshalled or unmarshalled.
---
tools/widl/typegen.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index f7a189a..79ae0f4 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -1437,6 +1437,14 @@ static int write_varying_array_pointer_descriptions( if (offset_in_memory && offset_in_buffer) { size_t padding; + + if (is_array(v->type) && v->type->length_is) + { + *offset_in_buffer = ROUND_SIZE(*offset_in_buffer, 4); + /* skip over variance and offset in buffer */ + *offset_in_buffer += 8; + } + align = 0; type_memsize(v->type, &align); padding = ROUNDING(*offset_in_memory, align); @@ -1470,19 +1478,13 @@ static void write_pointer_description(FILE *file, type_t *type, { size_t offset_in_buffer; size_t offset_in_memory; - size_t conformance = 0; - - if (type->type == RPC_FC_CVSTRUCT) - conformance = 8; - else if (type->type == RPC_FC_CSTRUCT || type->type == RPC_FC_CPSTRUCT) - conformance = 4;
/* pass 1: search for single instance of a pointer (i.e. don't descend * into arrays) */ if (!is_array(type)) { offset_in_memory = 0; - offset_in_buffer = conformance; + offset_in_buffer = 0; write_no_repeat_pointer_descriptions( file, type, &offset_in_memory, &offset_in_buffer, typestring_offset); @@ -1490,7 +1492,7 @@ static void write_pointer_description(FILE *file, type_t *type,
/* pass 2: search for pointers in fixed arrays */ offset_in_memory = 0; - offset_in_buffer = conformance; + offset_in_buffer = 0; write_fixed_array_pointer_descriptions( file, NULL, type, &offset_in_memory, &offset_in_buffer, typestring_offset); @@ -1512,7 +1514,7 @@ static void write_pointer_description(FILE *file, type_t *type,
/* pass 4: search for pointers in varying arrays */ offset_in_memory = 0; - offset_in_buffer = conformance; + offset_in_buffer = 0; write_varying_array_pointer_descriptions( file, NULL, type, &offset_in_memory, &offset_in_buffer, typestring_offset);