+
+ 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);