[PATCH] Do not transfer primitive explicit binding handles to the server

Eric Kohl eric.kohl at reactos.org
Sat Mar 27 09:34:29 CDT 2021


This patch fixes an incompatibility with MIDL. WIDL must not generate
code that passes explicit primitive binding handles to the server. Calls
to such functions fail on Windows XP.

Signed-off-by: Eric Kohl <eric.kohl at reactos.org>
---
 tools/widl/typegen.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

-------------- next part --------------
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 2c1017b9f2b..7071fecca8e 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -1346,7 +1346,8 @@ static void write_proc_func_header( FILE *file, int indent, const type_t *iface,
         }
         stack_size += get_stack_size( var, NULL );
         param_num++;
-        nb_args++;
+        if (var != handle_var || implicit_fc || explicit_fc != FC_BIND_PRIMITIVE)
+            nb_args++;
     }
     if (!is_void( type_function_get_rettype( func->declspec.type )))
     {
@@ -1453,6 +1454,8 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i
     int is_interpreted = is_interpreted_func( iface, func );
     int is_new_style = is_interpreted && (get_stub_mode() == MODE_Oif);
     var_t *retval = type_function_get_retval( func->declspec.type );
+    unsigned char explicit_fc, implicit_fc;
+    const var_t *handle_var = get_func_handle_var( iface, func, &explicit_fc, &implicit_fc );
 
     if (is_interpreted) write_proc_func_header( file, indent, iface, func, offset, num_proc );
 
@@ -1462,11 +1465,18 @@ static void write_procformatstring_func( FILE *file, int indent, const type_t *i
         const var_t *var;
         LIST_FOR_EACH_ENTRY( var, type_function_get_args(func->declspec.type), const var_t, entry )
         {
-            print_file( file, 0, "/* %u (parameter %s) */\n", *offset, var->name );
-            if (is_new_style)
-                *offset += write_new_procformatstring_type(file, indent, var, FALSE, &stack_offset);
+            if (var != handle_var || implicit_fc || explicit_fc != FC_BIND_PRIMITIVE)
+            {
+                print_file( file, 0, "/* %u (parameter %s) */\n", *offset, var->name );
+                if (is_new_style)
+                    *offset += write_new_procformatstring_type(file, indent, var, FALSE, &stack_offset);
+                else
+                    *offset += write_old_procformatstring_type(file, indent, var, FALSE, is_interpreted);
+            }
             else
-                *offset += write_old_procformatstring_type(file, indent, var, FALSE, is_interpreted);
+            {
+                stack_offset += pointer_size;
+            }
         }
     }
 


More information about the wine-devel mailing list