This test replicates what Microsoft-MPI (https://github.com/microsoft/Microsoft-MPI/tree/master/src) and its backend NetworkDirect (https://github.com/microsoft/NetworkDirect/blob/master/src/ndutil/ndfrmwrk.c...) depend on.
From: Dmitry Timoshkov dmitry@baikal.ru
This test replicates what Microsoft-MPI and its backend NetworkDirect (ND) depend on.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/ws2_32/tests/protocol.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/dlls/ws2_32/tests/protocol.c b/dlls/ws2_32/tests/protocol.c index bad3e6648b5..12188646bf5 100644 --- a/dlls/ws2_32/tests/protocol.c +++ b/dlls/ws2_32/tests/protocol.c @@ -3135,6 +3135,34 @@ static void test_startup(void) } }
+static void test_WSAProviderConfigChange(void) +{ + SOCKET sock; + OVERLAPPED ov = { 0 }; + int ret; + HANDLE port, port2, change; + DWORD bytes; + + port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0); + ok(!!port, "CreateIoCompletionPort() error %lu\n", GetLastError()); + sock = WSASocketW(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED); + ok(sock != SOCKET_ERROR, "WSASocketW() error %u\n", WSAGetLastError()); + port2 = CreateIoCompletionPort((HANDLE)sock, port, 123, 0); + ok(port2 == port, "got %p/%p\n", port, port2); + ret = WSAProviderConfigChange(&change, NULL, NULL); + todo_wine + ok(ret != SOCKET_ERROR, "WSAProviderConfigChange() error %u\n", WSAGetLastError()); + port2 = CreateIoCompletionPort(change, port, 456, 0); + todo_wine + ok(port2 == port, "got %p/%p\n", port, port2); + ret = WSAIoctl(sock, SIO_ADDRESS_LIST_CHANGE, NULL, 0, NULL, 0, &bytes, &ov, NULL); + ok(ret, "WSAIoctl() error %u\n", WSAGetLastError()); + + CloseHandle(change); + CloseHandle(port); + closesocket(sock); +} + START_TEST( protocol ) { WSADATA data; @@ -3184,6 +3212,7 @@ START_TEST( protocol ) test_WSCGetApplicationCategory(); test_WSCGetProviderInfo(); test_WSCGetProviderPath(); + test_WSAProviderConfigChange();
WSACleanup();
From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/ws2_32/protocol.c | 20 +++++++++++++++++++- dlls/ws2_32/tests/protocol.c | 2 -- 2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/ws2_32/protocol.c b/dlls/ws2_32/protocol.c index 2699593a2f3..c0add6b5dc4 100644 --- a/dlls/ws2_32/protocol.c +++ b/dlls/ws2_32/protocol.c @@ -2174,8 +2174,26 @@ int WINAPI WSAEnumNameSpaceProvidersW( DWORD *len, WSANAMESPACE_INFOW *buffer ) int WINAPI WSAProviderConfigChange( HANDLE *handle, OVERLAPPED *overlapped, LPWSAOVERLAPPED_COMPLETION_ROUTINE completion ) { + SOCKET s; + FIXME( "(%p %p %p) Stub!\n", handle, overlapped, completion ); - return -1; + + if (!handle) + { + SetLastError( WSAEFAULT ); + return SOCKET_ERROR; + } + + if (*handle != NULL) return 0; + + s = WSASocketW( AF_INET, SOCK_STREAM, 0, NULL, 0, WSA_FLAG_OVERLAPPED ); + if (s != INVALID_SOCKET) + { + *handle = (HANDLE)s; + return 0; + } + + return SOCKET_ERROR; }
diff --git a/dlls/ws2_32/tests/protocol.c b/dlls/ws2_32/tests/protocol.c index 12188646bf5..7e628ffc4dd 100644 --- a/dlls/ws2_32/tests/protocol.c +++ b/dlls/ws2_32/tests/protocol.c @@ -3150,10 +3150,8 @@ static void test_WSAProviderConfigChange(void) port2 = CreateIoCompletionPort((HANDLE)sock, port, 123, 0); ok(port2 == port, "got %p/%p\n", port, port2); ret = WSAProviderConfigChange(&change, NULL, NULL); - todo_wine ok(ret != SOCKET_ERROR, "WSAProviderConfigChange() error %u\n", WSAGetLastError()); port2 = CreateIoCompletionPort(change, port, 456, 0); - todo_wine ok(port2 == port, "got %p/%p\n", port, port2); ret = WSAIoctl(sock, SIO_ADDRESS_LIST_CHANGE, NULL, 0, NULL, 0, &bytes, &ov, NULL); ok(ret, "WSAIoctl() error %u\n", WSAGetLastError());