https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6b04e463044c7f1f705e4…
commit 6b04e463044c7f1f705e488c7b5bb0d3d4a02ae4
Author:     Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Mar 28 16:20:10 2021 +0200
Commit:     Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Mar 28 16:20:10 2021 +0200
    [WIDL] Do not transfer an explicit primitive binding handle to the server
    This enables us to run WIDL-generated code on Windows XP again.
    This patch has already been sent upstream.
---
 sdk/tools/widl/typegen.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/sdk/tools/widl/typegen.c b/sdk/tools/widl/typegen.c
index baa2b189a0e..2aeb6ebca44 100644
--- a/sdk/tools/widl/typegen.c
+++ b/sdk/tools/widl/typegen.c
@@ -1321,7 +1321,9 @@ 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->type )))
     {
@@ -1428,6 +1430,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->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 );
@@ -1437,11 +1441,18 @@ static void write_procformatstring_func( FILE *file, int indent,
const type_t *i
         const var_t *var;
         LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->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;
+            }
         }
     }