[RPCRT4_WINETEST] Sync with Wine Staging 4.18. CORE-16441
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 23 Nov 2019 11:12:54 +0000 (12:12 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 23 Nov 2019 11:12:54 +0000 (12:12 +0100)
modules/rostests/winetests/rpcrt4/CMakeLists.txt
modules/rostests/winetests/rpcrt4/server.c
modules/rostests/winetests/rpcrt4/server.idl
modules/rostests/winetests/rpcrt4/server_interp.idl [new file with mode: 0644]

index 4eeac9d..e92f9bb 100644 (file)
@@ -8,10 +8,14 @@ add_definitions(
 
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 set(OLD_IDL_FLAGS ${IDL_FLAGS})
-set(IDL_FLAGS ${IDL_FLAGS} --prefix-server=s_)
+set(IDL_FLAGS ${IDL_FLAGS} --prefix-server=s_ -Os --prefix-client=mixed_)
 add_rpc_files(client server.idl)
 add_rpc_files(server server.idl)
 set(IDL_FLAGS ${OLD_IDL_FLAGS})
+set(IDL_FLAGS ${IDL_FLAGS} --prefix-server=s_ -Oicf --prefix-client=interp_)
+add_rpc_files(client server_interp.idl)
+add_rpc_files(server server_interp.idl)
+set(IDL_FLAGS ${OLD_IDL_FLAGS})
 add_rpcproxy_files(cstub.idl)
 
 list(APPEND SOURCE
@@ -25,7 +29,9 @@ list(APPEND SOURCE
     ${CMAKE_CURRENT_BINARY_DIR}/cstub_p.c
     ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c
     ${CMAKE_CURRENT_BINARY_DIR}/server_c.c
-    ${CMAKE_CURRENT_BINARY_DIR}/server_s.c)
+    ${CMAKE_CURRENT_BINARY_DIR}/server_s.c
+    ${CMAKE_CURRENT_BINARY_DIR}/server_interp_c.c
+    ${CMAKE_CURRENT_BINARY_DIR}/server_interp_s.c)
 
 if(MSVC)
     # The nmake generator misses this dependency, so set it explicitly until this bug is fixed.
index 2a66a38..592ee9d 100644 (file)
@@ -27,6 +27,8 @@
 #include <netfw.h>
 #include "wine/test.h"
 #include "server_s.h"
+#define SKIP_TYPE_DECLS
+#include "server_interp_s.h"
 #include "server_defines.h"
 
 #include <stddef.h>
@@ -53,12 +55,213 @@ static RPC_STATUS (WINAPI *pRpcServerRegisterAuthInfoA)(RPC_CSTR, ULONG, RPC_AUT
 
 static char *domain_and_user;
 
+static int (__cdecl *int_return)(void);
+static int (__cdecl *square)(int x);
+static int (__cdecl *sum)(int x, int y);
+static signed char (__cdecl *sum_char)(signed char x, signed char y);
+static short (__cdecl *sum_short)(short x, short y);
+static int (__cdecl *sum_float)(float x, float y);
+static int (__cdecl *sum_double_int)(int x, double y);
+static hyper (__cdecl *sum_hyper)(hyper x, hyper y);
+static int (__cdecl *sum_hyper_int)(hyper x, hyper y);
+static int (__cdecl *sum_char_hyper)(signed char x, hyper y);
+static void (__cdecl *square_out)(int x, int *y);
+static void (__cdecl *square_ref)(int *x);
+static int (__cdecl *str_length)(const char *s);
+static int (__cdecl *str_t_length)(str_t s);
+static int (__cdecl *cstr_length)(const char *s, int n);
+static int (__cdecl *dot_self)(vector_t *v);
+static double (__cdecl *square_half)(double x, double *y);
+static float (__cdecl *square_half_float)(float x, float *y);
+static LONG (__cdecl *square_half_long)(LONG x, LONG *y);
+static int (__cdecl *sum_fixed_array)(int a[5]);
+static int (__cdecl *pints_sum)(pints_t *pints);
+static double (__cdecl *ptypes_sum)(ptypes_t *ptypes);
+static int (__cdecl *dot_pvectors)(pvectors_t *pvectors);
+static int (__cdecl *sum_sp)(sp_t *sp);
+static double (__cdecl *square_sun)(sun_t *su);
+static int (__cdecl *test_list_length)(test_list_t *ls);
+static int (__cdecl *sum_fixed_int_3d)(int m[2][3][4]);
+static int (__cdecl *sum_conf_array)(int x[], int n);
+static int (__cdecl *sum_conf_ptr_by_conf_ptr)(int n1, int *n2_then_x1, int *x2);
+static int (__cdecl *sum_unique_conf_array)(int x[], int n);
+static int (__cdecl *sum_unique_conf_ptr)(int *x, int n);
+static int (__cdecl *sum_var_array)(int x[20], int n);
+static int (__cdecl *dot_two_vectors)(vector_t vs[2]);
+static void (__cdecl *get_number_array)(int x[20], int *n);
+static int (__cdecl *sum_cs)(cs_t *cs);
+static int (__cdecl *sum_cps)(cps_t *cps);
+static int (__cdecl *sum_cpsc)(cpsc_t *cpsc);
+static int (__cdecl *get_cpsc)(int n, cpsc_t *cpsc);
+static int (__cdecl *sum_complex_array)(int n, refpint_t pi[]);
+static int (__cdecl *square_puint)(puint_t p);
+static int (__cdecl *sum_puints)(puints_t *p);
+static int (__cdecl *sum_cpuints)(cpuints_t *p);
+static int (__cdecl *dot_copy_vectors)(vector_t u, vector_t v);
+static double (__cdecl *square_encu)(encu_t *eu);
+static double (__cdecl *square_unencu)(int t, unencu_t *eu);
+static int (__cdecl *sum_parr)(int *a[3]);
+static int (__cdecl *sum_pcarr)(int *a[], int n);
+static int (__cdecl *enum_ord)(e_t e);
+static double (__cdecl *square_encue)(encue_t *eue);
+static void (__cdecl *check_se2)(se_t *s);
+static int (__cdecl *sum_toplev_conf_2n)(int *x, int n);
+static int (__cdecl *sum_toplev_conf_cond)(int *x, int a, int b, int c);
+static int (__cdecl *square_test_us)(test_us_t *tus);
+static double (__cdecl *sum_aligns)(aligns_t *a);
+static int (__cdecl *sum_padded)(padded_t *p);
+static int (__cdecl *sum_padded2)(padded_t ps[2]);
+static int (__cdecl *sum_padded_conf)(padded_t *ps, int n);
+static int (__cdecl *sum_bogus)(bogus_t *b);
+static void (__cdecl *check_null)(int *null);
+static int (__cdecl *str_struct_len)(str_struct_t *s);
+static int (__cdecl *wstr_struct_len)(wstr_struct_t *s);
+static int (__cdecl *sum_doub_carr)(doub_carr_t *dc);
+static void (__cdecl *make_pyramid_doub_carr)(unsigned char n, doub_carr_t **dc);
+static unsigned (__cdecl *hash_bstr)(bstr_t s);
+static void (__cdecl *get_a_bstr)(bstr_t *s);
+static void (__cdecl *get_name)(name_t *name);
+static void (__cdecl *get_names)(int *n, str_array_t *names);
+static void (__cdecl *get_namesw)(int *n, wstr_array_t *names);
+static int (__cdecl *sum_pcarr2)(int n, int **pa);
+static int (__cdecl *sum_L1_norms)(int n, vector_t *vs);
+static s123_t* (__cdecl *get_s123)(void);
+static void (__cdecl *get_numbers)(int length, int size, pints_t pn[]);
+static void (__cdecl *get_numbers_struct)(numbers_struct_t **ns);
+static str_t (__cdecl *get_filename)(void);
+static rint_t (__cdecl *echo_ranged_int)(int i, int j, int k);
+static rint_t (__cdecl *echo_ranged_int2)(int i);
+static void (__cdecl *get_ranged_enum)(renum_t *re);
+static void (__cdecl *context_handle_test)(void);
+static void (__cdecl *full_pointer_test)(int *a, int *b);
+static void (__cdecl *full_pointer_null_test)(int *a, int *b);
+static void (__cdecl *authinfo_test)(unsigned int protseq, int secure);
+static void (__cdecl *stop)(void);
+static void (__cdecl *stop_autolisten)(void);
+static void (__cdecl *ip_test)(ipu_t *a);
+static int (__cdecl *sum_ptr_array)(int *a[2]);
+static int (__cdecl *sum_array_ptr)(int (*a)[2]);
+static ctx_handle_t (__cdecl *get_handle)(void);
+static void (__cdecl *get_handle_by_ptr)(ctx_handle_t *r);
+static void (__cdecl *test_handle)(ctx_handle_t ctx_handle);
+
+#define SERVER_FUNCTIONS \
+    X(int_return) \
+    X(square) \
+    X(sum) \
+    X(sum_char) \
+    X(sum_short) \
+    X(sum_float) \
+    X(sum_double_int) \
+    X(sum_hyper) \
+    X(sum_hyper_int) \
+    X(sum_char_hyper) \
+    X(square_out) \
+    X(square_ref) \
+    X(str_length) \
+    X(str_t_length) \
+    X(cstr_length) \
+    X(dot_self) \
+    X(square_half) \
+    X(square_half_float) \
+    X(square_half_long) \
+    X(sum_fixed_array) \
+    X(pints_sum) \
+    X(ptypes_sum) \
+    X(dot_pvectors) \
+    X(sum_sp) \
+    X(square_sun) \
+    X(test_list_length) \
+    X(sum_fixed_int_3d) \
+    X(sum_conf_array) \
+    X(sum_conf_ptr_by_conf_ptr) \
+    X(sum_unique_conf_array) \
+    X(sum_unique_conf_ptr) \
+    X(sum_var_array) \
+    X(dot_two_vectors) \
+    X(get_number_array) \
+    X(sum_cs) \
+    X(sum_cps) \
+    X(sum_cpsc) \
+    X(get_cpsc) \
+    X(sum_complex_array) \
+    X(square_puint) \
+    X(sum_puints) \
+    X(sum_cpuints) \
+    X(dot_copy_vectors) \
+    X(square_encu) \
+    X(square_unencu) \
+    X(sum_parr) \
+    X(sum_pcarr) \
+    X(enum_ord) \
+    X(square_encue) \
+    X(check_se2) \
+    X(sum_toplev_conf_2n) \
+    X(sum_toplev_conf_cond) \
+    X(square_test_us) \
+    X(sum_aligns) \
+    X(sum_padded) \
+    X(sum_padded2) \
+    X(sum_padded_conf) \
+    X(sum_bogus) \
+    X(check_null) \
+    X(str_struct_len) \
+    X(wstr_struct_len) \
+    X(sum_doub_carr) \
+    X(make_pyramid_doub_carr) \
+    X(hash_bstr) \
+    X(get_a_bstr) \
+    X(get_name) \
+    X(get_names) \
+    X(get_namesw) \
+    X(sum_pcarr2) \
+    X(sum_L1_norms) \
+    X(get_s123) \
+    X(get_numbers) \
+    X(get_numbers_struct) \
+    X(get_filename) \
+    X(echo_ranged_int) \
+    X(echo_ranged_int2) \
+    X(get_ranged_enum) \
+    X(context_handle_test) \
+    X(full_pointer_test) \
+    X(full_pointer_null_test) \
+    X(authinfo_test) \
+    X(stop) \
+    X(stop_autolisten) \
+    X(ip_test) \
+    X(sum_ptr_array) \
+    X(sum_array_ptr) \
+    X(get_handle) \
+    X(get_handle_by_ptr) \
+    X(test_handle)
+
 /* type check statements generated in header file */
 fnprintf *p_printf = printf;
 
 static const WCHAR helloW[] = { 'H','e','l','l','o',0 };
 static const WCHAR worldW[] = { 'W','o','r','l','d','!',0 };
 
+static BOOL is_interp;
+
+static void set_interp_interface(void)
+{
+    is_interp = TRUE;
+
+#define X(name) name = interp_##name;
+    SERVER_FUNCTIONS
+#undef X
+}
+
+static void set_mixed_interface(void)
+{
+    is_interp = FALSE;
+
+#define X(name) name = mixed_##name;
+    SERVER_FUNCTIONS
+#undef X
+}
+
 static void InitFunctionPointers(void)
 {
     HMODULE hrpcrt4 = GetModuleHandleA("rpcrt4.dll");
@@ -871,6 +1074,26 @@ int __cdecl s_sum_array_ptr(int (*a)[2])
     return (*a)[0] + (*a)[1];
 }
 
+ctx_handle_t __cdecl s_get_handle(void)
+{
+    return (ctx_handle_t)0xdeadbeef;
+}
+
+void __cdecl s_get_handle_by_ptr(ctx_handle_t *r)
+{
+    *r = (ctx_handle_t)0xdeadbeef;
+}
+
+void __cdecl s_test_handle(ctx_handle_t ctx_handle)
+{
+    ok(ctx_handle == (ctx_handle_t)0xdeadbeef, "Unexpected ctx_handle %p\n", ctx_handle);
+}
+
+void __RPC_USER ctx_handle_t_rundown(ctx_handle_t ctx_handle)
+{
+    ok(ctx_handle == (ctx_handle_t)0xdeadbeef, "Unexpected ctx_handle %p\n", ctx_handle);
+}
+
 static void
 make_cmdline(char buffer[MAX_PATH], const char *test)
 {
@@ -1043,9 +1266,11 @@ basic_tests(void)
 
   check_null(NULL);
 
+  if (!is_interp || sizeof(void*) != 8) { /* broken in widl for win64 */
   str = get_filename();
   ok(!strcmp(str, __FILE__), "get_filename() returned %s instead of %s\n", str, __FILE__);
   midl_user_free(str);
+  }
 
   x = echo_ranged_int(0,0,0);
   ok(x == 0, "echo_ranged_int() returned %d instead of 0\n", x);
@@ -1323,6 +1548,7 @@ pointer_tests(void)
       ok(!strcmp(name.name, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name.name);
       HeapFree(GetProcessHeap(), 0, name.name);
 
+      if (!is_interp) { /* broken in widl */
       n = -1;
       names = NULL;
       get_names(&n, &names);
@@ -1342,10 +1568,13 @@ pointer_tests(void)
       MIDL_user_free(namesw[0]);
       MIDL_user_free(namesw[1]);
       MIDL_user_free(namesw);
+      }
   }
 
+  if (!is_interp) { /* broken in widl */
   pa2 = a;
   ok(sum_pcarr2(4, &pa2) == 10, "RPC sum_pcarr2\n");
+  }
 
   s123 = get_s123();
   ok(s123->f1 == 1 && s123->f2 == 2 && s123->f3 == 3, "RPC get_s123\n");
@@ -1606,6 +1835,16 @@ void __cdecl s_authinfo_test(unsigned int protseq, int secure)
     }
 }
 
+static void test_handle_return(void)
+{
+    ctx_handle_t handle, handle2;
+
+    handle = get_handle();
+    test_handle(handle);
+    get_handle_by_ptr(&handle2);
+    test_handle(handle2);
+}
+
 static void
 run_tests(void)
 {
@@ -1614,6 +1853,7 @@ run_tests(void)
   pointer_tests();
   array_tests();
   context_handle_test();
+  test_handle_return();
 }
 
 static void
@@ -1669,81 +1909,96 @@ client(const char *test)
   if (strcmp(test, "tcp_basic") == 0)
   {
     ok(RPC_S_OK == RpcStringBindingComposeA(NULL, iptcp, address, port, NULL, &binding), "RpcStringBindingCompose\n");
-    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
+    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
 
     run_tests();
     authinfo_test(RPC_PROTSEQ_TCP, 0);
-    test_is_server_listening2(IServer_IfHandle, RPC_S_OK, RPC_S_ACCESS_DENIED);
+    test_is_server_listening2(IMixedServer_IfHandle, RPC_S_OK, RPC_S_ACCESS_DENIED);
 
     ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
-    ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
+    ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
   }
   else if (strcmp(test, "tcp_secure") == 0)
   {
     ok(RPC_S_OK == RpcStringBindingComposeA(NULL, iptcp, address, port, NULL, &binding), "RpcStringBindingCompose\n");
-    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
+    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
 
-    set_auth_info(IServer_IfHandle);
+    set_auth_info(IMixedServer_IfHandle);
     authinfo_test(RPC_PROTSEQ_TCP, 1);
-    test_is_server_listening(IServer_IfHandle, RPC_S_ACCESS_DENIED);
+    test_is_server_listening(IMixedServer_IfHandle, RPC_S_ACCESS_DENIED);
 
     ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
-    ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
+    ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
   }
   else if (strcmp(test, "ncalrpc_basic") == 0)
   {
     ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
-    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
+    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
 
     run_tests(); /* can cause RPC_X_BAD_STUB_DATA exception */
     authinfo_test(RPC_PROTSEQ_LRPC, 0);
-    test_is_server_listening(IServer_IfHandle, RPC_S_OK);
+    test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
 
     ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
-    ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
+    ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
   }
   else if (strcmp(test, "ncalrpc_autolisten") == 0)
   {
     ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
-    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
+    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
 
     run_tests();
     authinfo_test(RPC_PROTSEQ_LRPC, 0);
 todo_wine
-    test_is_server_listening(IServer_IfHandle, RPC_S_NOT_LISTENING);
+    test_is_server_listening(IMixedServer_IfHandle, RPC_S_NOT_LISTENING);
 
     stop_autolisten();
     ok(int_return() == INT_CODE, "RPC int_return\n");
 
     ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
-    ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
+    ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
   }
   else if (strcmp(test, "ncalrpc_secure") == 0)
   {
     ok(RPC_S_OK == RpcStringBindingComposeA(NULL, ncalrpc, NULL, guid, NULL, &binding), "RpcStringBindingCompose\n");
-    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
+    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
 
-    set_auth_info(IServer_IfHandle);
+    set_auth_info(IMixedServer_IfHandle);
     authinfo_test(RPC_PROTSEQ_LRPC, 1);
-    test_is_server_listening(IServer_IfHandle, RPC_S_OK);
+    test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
 
     ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
-    ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
+    ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
   }
   else if (strcmp(test, "np_basic") == 0)
   {
     ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
-    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
+    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
 
-    test_is_server_listening(IServer_IfHandle, RPC_S_OK);
+    test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
     run_tests();
     authinfo_test(RPC_PROTSEQ_NMP, 0);
-    test_is_server_listening(IServer_IfHandle, RPC_S_OK);
+    test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
     stop();
-    test_is_server_listening(IServer_IfHandle, RPC_S_NOT_LISTENING);
+    test_is_server_listening(IMixedServer_IfHandle, RPC_S_NOT_LISTENING);
 
     ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
-    ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
+    ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
+  }
+  else if (strcmp(test, "np_basic_interp") == 0)
+  {
+    set_interp_interface();
+
+    ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
+    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IInterpServer_IfHandle), "RpcBindingFromStringBinding\n");
+
+    test_is_server_listening(IInterpServer_IfHandle, RPC_S_OK);
+    run_tests();
+    authinfo_test(RPC_PROTSEQ_NMP, 0);
+    test_is_server_listening(IInterpServer_IfHandle, RPC_S_OK);
+
+    ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
+    ok(RPC_S_OK == RpcBindingFree(&IInterpServer_IfHandle), "RpcBindingFree\n");
   }
 }
 
@@ -1777,13 +2032,22 @@ server(void)
   if (pRpcServerRegisterIfEx)
   {
     trace("Using RpcServerRegisterIfEx\n");
-    status = pRpcServerRegisterIfEx(s_IServer_v0_0_s_ifspec, NULL, NULL,
+    status = pRpcServerRegisterIfEx(s_IMixedServer_v0_0_s_ifspec, NULL, NULL,
+                                    RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH,
+                                    RPC_C_LISTEN_MAX_CALLS_DEFAULT, NULL);
+    ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %d\n", status);
+    status = pRpcServerRegisterIfEx(s_IInterpServer_v0_0_s_ifspec, NULL, NULL,
                                     RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH,
                                     RPC_C_LISTEN_MAX_CALLS_DEFAULT, NULL);
+    ok(status == RPC_S_OK, "RpcServerRegisterIfEx failed with status %d\n", status);
   }
   else
-    status = RpcServerRegisterIf(s_IServer_v0_0_s_ifspec, NULL, NULL);
-  ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
+  {
+    status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
+    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
+    status = RpcServerRegisterIf(s_IInterpServer_v0_0_s_ifspec, NULL, NULL);
+    ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
+  }
   test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
   status = RpcServerListen(1, 20, TRUE);
   ok(status == RPC_S_OK, "RpcServerListen failed with status %d\n", status);
@@ -1807,7 +2071,10 @@ server(void)
     skip("lrpc tests skipped due to earlier failure\n");
 
   if (np_status == RPC_S_OK)
+  {
+    run_client("np_basic_interp");
     run_client("np_basic");
+  }
   else
   {
     skip("np_basic tests skipped due to earlier failure\n");
@@ -1817,6 +2084,7 @@ server(void)
 
   ret = WaitForSingleObject(stop_event, 1000);
   ok(WAIT_OBJECT_0 == ret, "WaitForSingleObject\n");
+
   /* if the stop event didn't fire then RpcMgmtWaitServerListen will wait
    * forever, so don't bother calling it in this case */
   if (ret == WAIT_OBJECT_0)
@@ -1830,14 +2098,14 @@ server(void)
 
   if (pRpcServerRegisterIfEx)
   {
-    status = pRpcServerRegisterIfEx(s_IServer_v0_0_s_ifspec, NULL, NULL,
+    status = pRpcServerRegisterIfEx(s_IMixedServer_v0_0_s_ifspec, NULL, NULL,
         RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH | RPC_IF_AUTOLISTEN,
         RPC_C_LISTEN_MAX_CALLS_DEFAULT, NULL);
     ok(status == RPC_S_OK, "RpcServerRegisterIf() failed: %u\n", status);
 
     run_client("ncalrpc_autolisten");
 
-    status = RpcServerUnregisterIf(s_IServer_v0_0_s_ifspec, NULL, TRUE);
+    status = RpcServerUnregisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, TRUE);
     ok(status == RPC_S_OK, "RpcServerUnregisterIf() failed: %u\n", status);
   }
 
@@ -1848,14 +2116,14 @@ static DWORD WINAPI listen_test_client_thread(void *binding)
 {
     RPC_STATUS status;
 
-    status = RpcBindingFromStringBindingA(binding, &IServer_IfHandle);
+    status = RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle);
     ok(status == RPC_S_OK, "RpcBindingFromStringBinding\n");
 
-    test_is_server_listening(IServer_IfHandle, RPC_S_OK);
+    test_is_server_listening(IMixedServer_IfHandle, RPC_S_OK);
     stop();
     trace("stopped\n");
 
-    status = RpcBindingFree(&IServer_IfHandle);
+    status = RpcBindingFree(&IMixedServer_IfHandle);
     ok(status == RPC_S_OK, "RpcBindingFree\n");
     return 0;
 }
@@ -1930,7 +2198,7 @@ static void test_server_listening(void)
     status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
     ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", status);
 
-    status = RpcServerRegisterIf(s_IServer_v0_0_s_ifspec, NULL, NULL);
+    status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
     ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
 
     test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
@@ -2009,7 +2277,7 @@ static void run_server(HANDLE ready_event)
     status = RpcServerUseProtseqEpA(np, 0, pipe, NULL);
     ok(status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %d\n", status);
 
-    status = RpcServerRegisterIf(s_IServer_v0_0_s_ifspec, NULL, NULL);
+    status = RpcServerRegisterIf(s_IMixedServer_v0_0_s_ifspec, NULL, NULL);
     ok(status == RPC_S_OK, "RpcServerRegisterIf failed with status %d\n", status);
 
     test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
@@ -2052,7 +2320,7 @@ static void test_reconnect(void)
     server_process = create_server_process();
 
     ok(RPC_S_OK == RpcStringBindingComposeA(NULL, np, address_np, pipe, NULL, &binding), "RpcStringBindingCompose\n");
-    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IServer_IfHandle), "RpcBindingFromStringBinding\n");
+    ok(RPC_S_OK == RpcBindingFromStringBindingA(binding, &IMixedServer_IfHandle), "RpcBindingFromStringBinding\n");
 
     for (i = 0; i < ARRAY_SIZE(threads); i++)
     {
@@ -2082,7 +2350,7 @@ static void test_reconnect(void)
     ok(CloseHandle(server_process), "CloseHandle\n");
 
     ok(RPC_S_OK == RpcStringFreeA(&binding), "RpcStringFree\n");
-    ok(RPC_S_OK == RpcBindingFree(&IServer_IfHandle), "RpcBindingFree\n");
+    ok(RPC_S_OK == RpcBindingFree(&IMixedServer_IfHandle), "RpcBindingFree\n");
 }
 
 static BOOL is_process_elevated(void)
@@ -2214,6 +2482,7 @@ START_TEST(server)
   BOOL firewall_enabled = is_firewall_enabled(), firewall_disabled = FALSE;
 
   InitFunctionPointers();
+  set_mixed_interface();
 
   ok(!GetUserNameExA(NameSamCompatible, NULL, &size), "GetUserNameExA\n");
   domain_and_user = HeapAlloc(GetProcessHeap(), 0, size);
index 7d89445..afda2ed 100644 (file)
@@ -25,6 +25,19 @@ import "objidl.idl";
 
 #include "server_defines.h"
 
+#ifndef IFACE_NAME
+#define IFACE_NAME IMixedServer
+#endif
+
+#ifndef IFACE_HANDLE
+#define IFACE_HANDLE IMixedServer_IfHandle
+#endif
+
+#ifndef ISERVER_UUID
+#define ISERVER_UUID 00000000-4114-0704-2301-000000000000
+#endif
+
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
 typedef struct tag_vector
 {
   int x;
@@ -33,17 +46,19 @@ typedef struct tag_vector
 } vector_t;
 
 typedef int fnprintf(const char *format, ...);
+cpp_quote("#endif")
 
 [
-  uuid(00000000-4114-0704-2301-000000000000),
-  implicit_handle(handle_t IServer_IfHandle)
+  uuid(ISERVER_UUID),
+  implicit_handle(handle_t IFACE_HANDLE)
 ]
-interface IServer
+interface IFACE_NAME
 {
 cpp_quote("#if 0")
   typedef wchar_t WCHAR;
 cpp_quote("#endif")
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef [string] char *str_t;
   typedef [string] WCHAR *wstr_t;
 
@@ -80,6 +95,7 @@ cpp_quote("#endif")
 
     int s;
   } sun_t;
+cpp_quote("#endif")
 
   int int_return(void);
   int square(int x);
@@ -105,6 +121,7 @@ cpp_quote("#endif")
   double ptypes_sum(ptypes_t *ptypes);
   int dot_pvectors(pvectors_t *pvectors);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   /* don't use this anywhere except in sp_t */
   typedef struct
   {
@@ -116,10 +133,12 @@ cpp_quote("#endif")
     int x;
     sp_inner_t *s;
   } sp_t;
+cpp_quote("#endif")
 
   int sum_sp(sp_t *sp);
   double square_sun(sun_t *su);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct test_list
   {
     int t;
@@ -131,6 +150,7 @@ cpp_quote("#endif")
   } test_list_t;
 
   typedef [ref] int *refpint_t;
+cpp_quote("#endif")
 
   int test_list_length(test_list_t *ls);
   int sum_fixed_int_3d(int m[2][3][4]);
@@ -142,6 +162,7 @@ cpp_quote("#endif")
   int dot_two_vectors(vector_t vs[2]);
   void get_number_array([out, length_is(*n)] int x[20], [out] int *n);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     int n;
@@ -163,6 +184,7 @@ cpp_quote("#endif")
     int b;
     int c;
   } cpsc_t;
+cpp_quote("#endif")
 
   int sum_cs(cs_t *cs);
   int sum_cps(cps_t *cps);
@@ -170,9 +192,12 @@ cpp_quote("#endif")
   int get_cpsc(int n, [out] cpsc_t *cpsc );
   int sum_complex_array(int n, [size_is(n)] refpint_t pi[]);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef [wire_marshal(int)] void *puint_t;
+cpp_quote("#endif")
   int square_puint(puint_t p);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     [size_is(n)] puint_t *ps;
@@ -185,11 +210,13 @@ cpp_quote("#endif")
     [size_is(n)] puint_t *ps;
     char n;
   } cpuints_t;
+cpp_quote("#endif")
 
   int sum_puints(puints_t *p);
   int sum_cpuints(cpuints_t *p);
   int dot_copy_vectors(vector_t u, vector_t v);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct wire_us *wire_us_t;
   typedef [wire_marshal(wire_us_t)] struct us us_t;
   struct us
@@ -204,9 +231,11 @@ cpp_quote("#endif")
   {
     us_t us;
   } test_us_t;
+cpp_quote("#endif")
 
   int square_test_us(test_us_t *tus);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef union encu switch (int t)
   {
   case ENCU_I: int i;
@@ -237,6 +266,7 @@ cpp_quote("#endif")
   {
     e_t f;
   } se_t;
+cpp_quote("#endif")
 
   double square_encu(encu_t *eu);
   double square_unencu(int t, [switch_is(t)] unencu_t *eu);
@@ -249,6 +279,7 @@ cpp_quote("#endif")
   int sum_toplev_conf_2n([size_is(n * 2)] int *x, int n);
   int sum_toplev_conf_cond([size_is(c ? a : b)] int *x, int a, int b, int c);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     char c;
@@ -256,19 +287,23 @@ cpp_quote("#endif")
     short s;
     double d;
   } aligns_t;
+cpp_quote("#endif")
 
   double sum_aligns(aligns_t *a);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     int i;
     char c;
   } padded_t;
+cpp_quote("#endif")
 
   int sum_padded(padded_t *p);
   int sum_padded2(padded_t ps[2]);
   int sum_padded_conf([size_is(n)] padded_t *ps, int n);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     int *p1;
@@ -281,10 +316,12 @@ cpp_quote("#endif")
     int *p3;
     char c;
   } bogus_t;
+cpp_quote("#endif")
 
   int sum_bogus(bogus_t *b);
   void check_null([unique] int *null);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     str_t s;
@@ -294,10 +331,12 @@ cpp_quote("#endif")
   {
     wstr_t s;
   } wstr_struct_t;
+cpp_quote("#endif")
 
   int str_struct_len(str_struct_t *s);
   int wstr_struct_len(wstr_struct_t *s);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     unsigned int n;
@@ -309,10 +348,12 @@ cpp_quote("#endif")
     int n;
     [size_is(n)] doub_carr_1_t *a[];
   } doub_carr_t;
+cpp_quote("#endif")
 
   int sum_doub_carr(doub_carr_t *dc);
   void make_pyramid_doub_carr(unsigned char n, [out] doub_carr_t **dc);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     short n;
@@ -321,23 +362,29 @@ cpp_quote("#endif")
 
   typedef [unique] user_bstr_t *wire_bstr_t;
   typedef [wire_marshal(wire_bstr_t)] short *bstr_t;
+cpp_quote("#endif")
   unsigned hash_bstr(bstr_t s);
   void get_a_bstr([out]bstr_t *s);
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     [string, size_is(size)] char *name;
     unsigned int size;
   } name_t;
+cpp_quote("#endif")
   void get_name([in,out] name_t *name);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef char **str_array_t;
-  void get_names([out] int *n, [out, string, size_is(,*n)] str_array_t *names);
   typedef WCHAR **wstr_array_t;
+cpp_quote("#endif")
+  void get_names([out] int *n, [out, string, size_is(,*n)] str_array_t *names);
   void get_namesw([out] int *n, [out, string, size_is(,*n)] wstr_array_t *names);
 
   int sum_pcarr2(int n, [size_is(, n)] int **pa);
   int sum_L1_norms(int n, [size_is(n)] vector_t *vs);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   /* Don't use this except in the get_s123 test.  */
   typedef struct
   {
@@ -345,23 +392,27 @@ cpp_quote("#endif")
     int f2;
     int f3;
   } s123_t;
+cpp_quote("#endif")
 
   /* Make sure WIDL generates a type format string for a previously unseen
      type as a return value.  */
   s123_t *get_s123(void);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef struct
   {
     unsigned int length;
     unsigned int size;
     [size_is(size), length_is(length)] pints_t numbers[];
   } numbers_struct_t;
+cpp_quote("#endif")
 
   void get_numbers([in] int length, [in] int size, [out, length_is(length), size_is(size)] pints_t pn[]);
   void get_numbers_struct([out] numbers_struct_t **ns);
 
   str_t get_filename(void);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   enum renum
   {
     RE0,
@@ -373,6 +424,7 @@ cpp_quote("#endif")
   const int RE_MAX = RE3;
   typedef [range(RE_MIN, RE_MAX)] enum renum renum_t;
   typedef [range(0, 100)] int rint_t;
+cpp_quote("#endif")
   rint_t echo_ranged_int([range(0, 10)] int i, [range(0, 20)] int j, [range(0, 100)] int k);
   rint_t echo_ranged_int2([range(0, 40)] int i);
   void get_ranged_enum([out] renum_t *re);
@@ -387,13 +439,23 @@ cpp_quote("#endif")
   void stop(void);
   void stop_autolisten(void);
 
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
   typedef union ipu switch(int t)
   {
     default: IStream *stream;
   } ipu_t;
+cpp_quote("#endif")
 
   void ip_test([in] ipu_t *a);
 
   int sum_ptr_array([in] int *a[2]);
   int sum_array_ptr([in] int (*a)[2]);
+
+cpp_quote("#ifndef SKIP_TYPE_DECLS")
+  typedef [context_handle] void *ctx_handle_t;
+cpp_quote("#endif")
+
+  ctx_handle_t get_handle();
+  void get_handle_by_ptr([out] ctx_handle_t *r);
+  void test_handle(ctx_handle_t ctx_handle);
 }
diff --git a/modules/rostests/winetests/rpcrt4/server_interp.idl b/modules/rostests/winetests/rpcrt4/server_interp.idl
new file mode 100644 (file)
index 0000000..befa31f
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2019 Jacek Caban for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#pragma makedep client
+#pragma makedep server
+
+#define IFACE_NAME IInterpServer
+#define IFACE_HANDLE IInterpServer_IfHandle
+#define ISERVER_UUID 00000000-4114-0704-2301-000000000001
+
+#include "server.idl"