[RPCRT4_WINETEST] Sync with Wine Staging 2.9. CORE-13362
authorAmine Khaldi <amine.khaldi@reactos.org>
Sun, 4 Jun 2017 14:02:01 +0000 (14:02 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sun, 4 Jun 2017 14:02:01 +0000 (14:02 +0000)
svn path=/trunk/; revision=74905

rostests/winetests/rpcrt4/rpc.c
rostests/winetests/rpcrt4/server.c

index 36b3de9..f026e99 100644 (file)
@@ -250,10 +250,8 @@ static void test_rpc_ncacn_ip_tcp(void)
     ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status);
 
     status = RpcServerListen(1, 20, TRUE);
     ok(status == RPC_S_OK, "RpcServerListen failed (%u)\n", status);
 
     status = RpcServerListen(1, 20, TRUE);
-todo_wine {
     ok(status == RPC_S_ALREADY_LISTENING,
        "wrong RpcServerListen error (%u)\n", status);
     ok(status == RPC_S_ALREADY_LISTENING,
        "wrong RpcServerListen error (%u)\n", status);
-}
 
     status = RpcStringBindingComposeA(NULL, ncacn_ip_tcp, address,
                                      endpoint, NULL, &binding);
 
     status = RpcStringBindingComposeA(NULL, ncacn_ip_tcp, address,
                                      endpoint, NULL, &binding);
@@ -301,9 +299,7 @@ todo_wine {
     ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%u)\n", status);
 
     status = RpcMgmtWaitServerListen();
     ok(status == RPC_S_OK, "RpcServerUnregisterIf failed (%u)\n", status);
 
     status = RpcMgmtWaitServerListen();
-todo_wine {
     ok(status == RPC_S_OK, "RpcMgmtWaitServerListen failed (%u)\n", status);
     ok(status == RPC_S_OK, "RpcMgmtWaitServerListen failed (%u)\n", status);
-}
 
     status = RpcStringFreeA(&binding);
     ok(status == RPC_S_OK, "RpcStringFree failed (%u)\n", status);
 
     status = RpcStringFreeA(&binding);
     ok(status == RPC_S_OK, "RpcStringFree failed (%u)\n", status);
@@ -1150,7 +1146,7 @@ static HRESULT set_firewall( enum firewall_op op )
     hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
     if (hr != S_OK) goto done;
 
     hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
     if (hr != S_OK) goto done;
 
-    INetFwProfile_get_AuthorizedApplications( profile, &apps );
+    hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
     ok( hr == S_OK, "got %08x\n", hr );
     if (hr != S_OK) goto done;
 
     ok( hr == S_OK, "got %08x\n", hr );
     if (hr != S_OK) goto done;
 
index d7363f6..1831589 100644 (file)
@@ -1752,10 +1752,42 @@ server(void)
   if (ret == WAIT_OBJECT_0)
   {
     status = RpcMgmtWaitServerListen();
   if (ret == WAIT_OBJECT_0)
   {
     status = RpcMgmtWaitServerListen();
-    todo_wine {
-      ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
-    }
+    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
   }
   }
+
+  CloseHandle(stop_event);
+  stop_event = NULL;
+}
+
+static void test_server_listening(void)
+{
+    static unsigned char np[] = "ncacn_np";
+    static unsigned char pipe[] = PIPE "listen_test";
+    RPC_STATUS status;
+
+    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);
+    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);
+    test_is_server_listening(NULL, RPC_S_OK);
+
+    status = RpcServerListen(1, 20, TRUE);
+    ok(status == RPC_S_ALREADY_LISTENING, "RpcServerListen failed with status %d\n", status);
+
+    status = RpcMgmtStopServerListening(NULL);
+    ok(status == RPC_S_OK, "RpcMgmtStopServerListening\n");
+    test_is_server_listening(NULL, RPC_S_NOT_LISTENING);
+
+    status = RpcMgmtWaitServerListen();
+    ok(status == RPC_S_OK, "RpcMgmtWaitServerListening failed with status %d\n", status);
+
+    status = RpcMgmtWaitServerListen();
+    ok(status == RPC_S_NOT_LISTENING, "RpcMgmtWaitServerListening failed with status %d\n", status);
 }
 
 static BOOL is_process_elevated(void)
 }
 
 static BOOL is_process_elevated(void)
@@ -1843,7 +1875,7 @@ static HRESULT set_firewall( enum firewall_op op )
     hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
     if (hr != S_OK) goto done;
 
     hr = INetFwPolicy_get_CurrentProfile( policy, &profile );
     if (hr != S_OK) goto done;
 
-    INetFwProfile_get_AuthorizedApplications( profile, &apps );
+    hr = INetFwProfile_get_AuthorizedApplications( profile, &apps );
     ok( hr == S_OK, "got %08x\n", hr );
     if (hr != S_OK) goto done;
 
     ok( hr == S_OK, "got %08x\n", hr );
     if (hr != S_OK) goto done;
 
@@ -1913,6 +1945,10 @@ START_TEST(server)
     }
     RpcEndExcept
   }
     }
     RpcEndExcept
   }
+  else if (argc == 4)
+  {
+    test_server_listening();
+  }
   else
   {
     if (firewall_enabled)
   else
   {
     if (firewall_enabled)
@@ -1926,6 +1962,7 @@ START_TEST(server)
       }
     }
     server();
       }
     }
     server();
+    run_client("test listen");
     if (firewall_enabled) set_firewall(APP_REMOVE);
   }
 
     if (firewall_enabled) set_firewall(APP_REMOVE);
   }