widl: Output a registry script for all interfaces written into the typelib.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46005
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-01-28 10:10:27 -06:00 committed by Alexandre Julliard
parent 82044449c4
commit 56995dd322
4 changed files with 18 additions and 8 deletions

View File

@ -1792,6 +1792,7 @@ static type_t *make_safearray(type_t *type)
static typelib_t *make_library(const char *name, const attr_list_t *attrs) static typelib_t *make_library(const char *name, const attr_list_t *attrs)
{ {
typelib_t *typelib = xmalloc(sizeof(*typelib)); typelib_t *typelib = xmalloc(sizeof(*typelib));
memset(typelib, 0, sizeof(*typelib));
typelib->name = xstrdup(name); typelib->name = xstrdup(name);
typelib->attrs = attrs; typelib->attrs = attrs;
list_init( &typelib->importlibs ); list_init( &typelib->importlibs );

View File

@ -119,8 +119,6 @@ static void write_typelib_interface( const type_t *iface, const typelib_t *typel
if (!uuid) return; if (!uuid) return;
if (!is_object( iface )) return; if (!is_object( iface )) return;
if (!is_attr( iface->attrs, ATTR_OLEAUTOMATION ) && !is_attr( iface->attrs, ATTR_DISPINTERFACE ))
return;
put_str( indent, "'%s' = s '%s'\n", format_uuid( uuid ), iface->name ); put_str( indent, "'%s' = s '%s'\n", format_uuid( uuid ), iface->name );
put_str( indent, "{\n" ); put_str( indent, "{\n" );
indent++; indent++;
@ -137,13 +135,10 @@ static void write_typelib_interface( const type_t *iface, const typelib_t *typel
static void write_typelib_interfaces( const typelib_t *typelib ) static void write_typelib_interfaces( const typelib_t *typelib )
{ {
const statement_t *stmt; unsigned int i;
if (typelib->stmts) LIST_FOR_EACH_ENTRY( stmt, typelib->stmts, const statement_t, entry ) for (i = 0; i < typelib->reg_iface_count; ++i)
{ write_typelib_interface( typelib->reg_ifaces[i], typelib );
if (stmt->type == STMT_TYPE && type_get_type( stmt->u.type ) == TYPE_INTERFACE)
write_typelib_interface( stmt->u.type, typelib );
}
} }
static int write_coclass( const type_t *class, const typelib_t *typelib ) static int write_coclass( const type_t *class, const typelib_t *typelib )

View File

@ -538,6 +538,9 @@ struct _typelib_t {
const attr_list_t *attrs; const attr_list_t *attrs;
struct list importlibs; struct list importlibs;
statement_list_t *stmts; statement_list_t *stmts;
type_t **reg_ifaces;
unsigned int reg_iface_count;
}; };
struct _user_type_t { struct _user_type_t {

View File

@ -2068,6 +2068,10 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
if(add_func_desc(msft_typeinfo, func, idx) == S_OK) if(add_func_desc(msft_typeinfo, func, idx) == S_OK)
idx++; idx++;
} }
typelib->typelib->reg_ifaces = xrealloc(typelib->typelib->reg_ifaces,
(typelib->typelib->reg_iface_count + 1) * sizeof(dispinterface));
typelib->typelib->reg_ifaces[typelib->typelib->reg_iface_count++] = dispinterface;
} }
static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface) static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
@ -2142,6 +2146,13 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
if(add_func_desc(msft_typeinfo, func, idx) == S_OK) if(add_func_desc(msft_typeinfo, func, idx) == S_OK)
idx++; idx++;
} }
if (is_attr(interface->attrs, ATTR_OLEAUTOMATION) || is_attr(interface->attrs, ATTR_DUAL))
{
typelib->typelib->reg_ifaces = xrealloc(typelib->typelib->reg_ifaces,
(typelib->typelib->reg_iface_count + 1) * sizeof(interface));
typelib->typelib->reg_ifaces[typelib->typelib->reg_iface_count++] = interface;
}
} }
static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure) static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)