diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index eb8f061..9eaf7cc 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -36,6 +36,8 @@ static const char *progname; static BOOL old_windows_version; +/* To know if the IDL file was parsed with or without widl -Oif or midl /Oif */ +static BOOL old_midl_flags; static HANDLE stop_event; @@ -604,6 +606,10 @@ int __cdecl s_echo_ranged_int(int n) return n; } +void __cdecl s_some_ranged_func(int n) +{ +} + void __cdecl s_get_ranged_enum(renum_t *re) { *re = RE3; @@ -811,6 +817,7 @@ basic_tests(void) str_t str; se_t se; renum_t re; + unsigned long exception; ok(int_return() == INT_CODE, "RPC int_return\n"); @@ -939,6 +946,42 @@ basic_tests(void) x = echo_ranged_int(100); ok(x == 100, "echo_ranged_int() returned %d instead of 100\n", x); +/* Crashes on wine + exception = 0; + RpcTryExcept + { + x = echo_ranged_int(150); + } + RpcExcept(TRUE) + { + exception = RpcExceptionCode(); + } + RpcEndExcept + if(old_midl_flags) + { + ok(x == 150, "echo_ranged_int() returned %d instead of 0\n", x); + ok(exception == 0, "echo_ranged_int() threw an exception : %lu\n", exception); + } + else + { + ok(x == 100, "echo_ranged_int() returned %d instead of throwing exception\n", x); + ok(exception == RPC_X_BAD_STUB_DATA, "Wrong exception : %lu\n", exception); + } + + exception = 0; + RpcTryExcept + { + x = echo_ranged_int(75); + } + RpcExcept(TRUE) + { + exception = RpcExceptionCode(); + } + RpcEndExcept + ok(x == 75, "echo_ranged_int() returned %d instead of 0\n", x); + ok(exception == 0, "echo_ranged_int() threw an exception : %lu\n", exception); +*/ + if (!old_windows_version) { get_ranged_enum(&re); @@ -1626,6 +1669,9 @@ START_TEST(server) InitFunctionPointers(); + /* Detect -Oif flags */ + old_midl_flags = ((RPC_SERVER_INTERFACE*)s_IServer_v0_0_s_ifspec)->Flags == 0; + if (pGetUserNameExA) { ULONG size = 0; diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl index c7c7237..39d6940 100644 --- a/dlls/rpcrt4/tests/server.idl +++ b/dlls/rpcrt4/tests/server.idl @@ -364,6 +364,7 @@ cpp_quote("#endif") typedef [range(RE_MIN, RE_MAX)] enum renum renum_t; typedef [range(0, 100)] int rint_t; rint_t echo_ranged_int([range(0, 100)] int n); + void some_ranged_func([in, range(0,50)] int n); void get_ranged_enum([out] renum_t *re); void context_handle_test(void);