@@ -59,8 +59,8 @@ internal interface INdrFormatterInternal : INdrFormatter
5959 string FormatComment ( string comment , params object [ ] args ) ;
6060 string FormatPointer ( string base_type ) ;
6161 string IidToName ( Guid iid ) ;
62- string DemangleComName ( string name ) ;
6362 bool ShowProcedureParameterAttributes { get ; }
63+ string GetProxyName ( NdrComProxyDefinition proxy ) ;
6464 }
6565
6666 /// <summary>
@@ -80,10 +80,12 @@ internal NdrFormatter(IDictionary<Guid, string> iids_to_names, Func<string, stri
8080 _demangle_com_name = demangle_com_name ?? ( s => s ) ;
8181 _flags = flags ;
8282 }
83+
8384 string INdrFormatterInternal . IidToName ( Guid iid )
8485 {
8586 return IidToName ( iid ) ;
8687 }
88+
8789 protected string IidToName ( Guid iid )
8890 {
8991 if ( _iids_to_name . ContainsKey ( iid ) )
@@ -93,9 +95,11 @@ protected string IidToName(Guid iid)
9395 return null ;
9496 }
9597
96- string INdrFormatterInternal . DemangleComName ( string name )
98+ string INdrFormatterInternal . GetProxyName ( NdrComProxyDefinition proxy )
9799 {
98- return _demangle_com_name ( name ) ;
100+ if ( string . IsNullOrWhiteSpace ( proxy . Name ) )
101+ return IidToName ( proxy . Iid ) ?? $ "intf_{ proxy . Iid . ToString ( ) . Replace ( '-' , '_' ) } ";
102+ return _demangle_com_name ( proxy . Name ) ;
99103 }
100104
101105 string INdrFormatterInternal . SimpleTypeToName ( NdrFormatCharacter format )
@@ -312,7 +316,7 @@ string INdrFormatter.FormatComProxy(NdrComProxyDefinition com_proxy)
312316 builder . AppendLine (
313317 "class __declspec(uuid(\" {0}\" )) {1} : public {2} {{\n public:" ,
314318 com_proxy . Iid ,
315- ( this as INdrFormatterInternal ) . DemangleComName ( com_proxy . Name ) ,
319+ ( this as INdrFormatterInternal ) . GetProxyName ( com_proxy ) ,
316320 base_name
317321 ) ;
318322
0 commit comments