From: Hans Leidekker hans@codeweavers.com
winmd stores high and low word in opposite order from typelib. --- tools/widl/metadata.c | 7 +++---- tools/widl/parser.y | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/tools/widl/metadata.c b/tools/widl/metadata.c index bd953c50d53..3e7f2b911e5 100644 --- a/tools/widl/metadata.c +++ b/tools/widl/metadata.c @@ -1779,13 +1779,12 @@ static UINT make_contract_value( const type_t *type, BYTE *buf )
static UINT make_version_value( const type_t *type, BYTE *buf ) { - UINT version = get_attrv( type->attrs, ATTR_VERSION ); + UINT version = is_attr( type->attrs, ATTR_VERSION ) ? get_attrv( type->attrs, ATTR_VERSION ) : 1;
buf[0] = 1; buf[1] = 0; - buf[2] = is_attr( type->attrs, ATTR_VERSION ) ? 0 : 1; - buf[3] = 0; - memcpy( buf + 4, &version, sizeof(version) ); + memcpy( buf + 2, &version, sizeof(version) ); + buf[6] = buf[7] = 0; return 8; }
diff --git a/tools/widl/parser.y b/tools/widl/parser.y index fb21a2417f1..d31b8b10cc8 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -1386,8 +1386,8 @@ uniondef: tUNION m_typename '{' ne_union_fields '}' ;
version: - aNUM { $$ = MAKEVERSION($1.value, 0); } - | aNUM '.' aNUM { $$ = MAKEVERSION($1.value, $3.value); } + aNUM { $$ = winrt_mode ? MAKEVERSION(0, $1.value) : MAKEVERSION($1.value, 0); } + | aNUM '.' aNUM { $$ = winrt_mode ? MAKEVERSION($3.value, $1.value) : MAKEVERSION($1.value, $3.value); } | aHEXNUM { $$ = $1.value; } ;