[PATCH 2/2] rpcrt4: Add a test for RpcBindingServerFromClient (todo_wine).

Colin Finck mail at colinfinck.de
Fri Aug 19 04:52:58 CDT 2016


Changes in version 3 of this patch: Fixed memory leaks.

Signed-off-by: Colin Finck <mail at colinfinck.de>
---
 dlls/rpcrt4/tests/server.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c
index 0b31d3d..5be7521 100644
--- a/dlls/rpcrt4/tests/server.c
+++ b/dlls/rpcrt4/tests/server.c
@@ -744,6 +744,55 @@ void __cdecl s_context_handle_test(void)
 
         pNDRSContextUnmarshall2(binding, buf, NDR_LOCAL_DATA_REPRESENTATION, &server_if2.InterfaceId, 0);
     }
+
+    /* test RpcBindingServerFromClient */
+    /* skip this on older Windows versions, the NULL parameter is only supported in Windows 2000 and later */
+    if (!old_windows_version)
+    {
+        binding = NULL;
+        status = RpcBindingServerFromClient(NULL, &binding);
+
+        todo_wine
+        {
+            ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+            ok(binding != NULL, "binding is NULL\n");
+        }
+
+        if (status == RPC_S_OK && binding != NULL)
+        {
+            unsigned char* string_binding = NULL;
+            status = RpcBindingToStringBindingA(binding, &string_binding);
+
+            ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+            ok(string_binding != NULL, "string_binding is NULL\n");
+
+            if (status == RPC_S_OK && string_binding != NULL)
+            {
+                unsigned char* computer_name = NULL;
+                status = RpcStringBindingParseA(string_binding, NULL, NULL, &computer_name, NULL, NULL);
+
+                ok(status == RPC_S_OK, "expected RPC_S_OK got %u\n", status);
+                ok(computer_name != NULL, "computer_name is NULL\n");
+
+                RpcStringFreeA(&string_binding);
+
+                if (computer_name != NULL)
+                {
+                    RpcStringFreeA(&computer_name);
+                }
+            }
+            else
+            {
+                skip("RpcStringBindingParseA test skipped due to RpcBindingToStringBindingA failure.\n");
+            }
+
+            RpcBindingFree(&binding);
+        }
+        else
+        {
+            skip("RpcBindingToStringBindingA and RpcStringBindingParseA tests skipped due to RpcBindingServerFromClient failure.\n");
+        }
+    }
 }
 
 void __cdecl s_get_numbers(int length, int size, pints_t n[])
-- 
1.9.1




More information about the wine-patches mailing list