Commit 2dc85894 authored by Alexandre Julliard's avatar Alexandre Julliard

widl: Improve registration of coclasses contained in typelibs.

parent a5469283
...@@ -90,15 +90,13 @@ static int write_interfaces( const statement_list_t *stmts ) ...@@ -90,15 +90,13 @@ static int write_interfaces( const statement_list_t *stmts )
if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry ) if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry )
{ {
if (stmt->type == STMT_LIBRARY) if (stmt->type == STMT_TYPE && type_get_type( stmt->u.type ) == TYPE_INTERFACE)
count += write_interfaces( stmt->u.lib->stmts );
else if (stmt->type == STMT_TYPE && type_get_type( stmt->u.type ) == TYPE_INTERFACE)
count += write_interface( stmt->u.type ); count += write_interface( stmt->u.type );
} }
return count; return count;
} }
static int write_coclass( const type_t *class ) static int write_coclass( const type_t *class, const typelib_t *typelib )
{ {
const UUID *uuid = get_attrp( class->attrs, ATTR_UUID ); const UUID *uuid = get_attrp( class->attrs, ATTR_UUID );
const char *descr = get_attrp( class->attrs, ATTR_HELPSTRING ); const char *descr = get_attrp( class->attrs, ATTR_HELPSTRING );
...@@ -107,20 +105,27 @@ static int write_coclass( const type_t *class ) ...@@ -107,20 +105,27 @@ static int write_coclass( const type_t *class )
const char *threading = get_coclass_threading( class ); const char *threading = get_coclass_threading( class );
if (!uuid) return 0; if (!uuid) return 0;
if (typelib && !threading) return 0;
if (!descr) descr = class->name; if (!descr) descr = class->name;
put_str( indent, "ForceRemove '%s' = s '%s'\n", format_uuid( uuid ), descr ); put_str( indent, "ForceRemove '%s' = s '%s'\n", format_uuid( uuid ), descr );
put_str( indent++, "{\n" ); put_str( indent++, "{\n" );
if (threading) put_str( indent, "InprocServer32 = s '%%MODULE%%' { val ThreadingModel = s '%s' }\n", if (threading) put_str( indent, "InprocServer32 = s '%%MODULE%%' { val ThreadingModel = s '%s' }\n",
threading ); threading );
if (progid || vi_progid) put_str( indent, "CLSID = s '%s'\n", descr );
if (progid) put_str( indent, "ProgId = s '%s'\n", progid ); if (progid) put_str( indent, "ProgId = s '%s'\n", progid );
if (typelib)
{
const UUID *typelib_uuid = get_attrp( typelib->attrs, ATTR_UUID );
const unsigned int version = get_attrv( typelib->attrs, ATTR_VERSION );
put_str( indent, "TypeLib = s '%s'\n", format_uuid( typelib_uuid ));
put_str( indent, "Version = s '%u.%u'\n", MAJORVERSION(version), MINORVERSION(version) );
}
if (vi_progid) put_str( indent, "VersionIndependentProgId = s '%s'\n", vi_progid ); if (vi_progid) put_str( indent, "VersionIndependentProgId = s '%s'\n", vi_progid );
put_str( --indent, "}\n" ); put_str( --indent, "}\n" );
return 1; return 1;
} }
static void write_coclasses( const statement_list_t *stmts, const UUID *typelib_uuid ) static void write_coclasses( const statement_list_t *stmts, const typelib_t *typelib )
{ {
const statement_t *stmt; const statement_t *stmt;
...@@ -129,12 +134,12 @@ static void write_coclasses( const statement_list_t *stmts, const UUID *typelib_ ...@@ -129,12 +134,12 @@ static void write_coclasses( const statement_list_t *stmts, const UUID *typelib_
if (stmt->type == STMT_TYPE) if (stmt->type == STMT_TYPE)
{ {
const type_t *type = stmt->u.type; const type_t *type = stmt->u.type;
if (type_get_type(type) == TYPE_COCLASS) write_coclass( type ); if (type_get_type(type) == TYPE_COCLASS) write_coclass( type, typelib );
} }
else if (stmt->type == STMT_LIBRARY) else if (stmt->type == STMT_LIBRARY)
{ {
const UUID *uuid = get_attrp( stmt->u.lib->attrs, ATTR_UUID ); const typelib_t *lib = stmt->u.lib;
write_coclasses( stmt->u.lib->stmts, uuid ); write_coclasses( lib->stmts, lib );
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment