Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45801 Signed-off-by: Aaro Altonen a.altonen@hotmail.com --- v2: - Fix test breakage on Windows, error for invalid GUID should be WSAEINVAL --- dlls/ws2_32/socket.c | 17 +++++++++++++---- dlls/ws2_32/tests/sock.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index c284f595ab..3beb704c22 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -9006,12 +9006,21 @@ INT WINAPI WSCEnableNSProvider( LPGUID provider, BOOL enable ) */ INT WINAPI WSCGetProviderPath( LPGUID provider, LPWSTR path, LPINT len, LPINT errcode ) { - FIXME( "(%s %p %p %p) Stub!\n", debugstr_guid(provider), path, len, errcode ); + if (!provider || !len) { + if (errcode) + *errcode = WSAEFAULT; + return SOCKET_ERROR; + }
- if (!errcode || !provider || !len) return WSAEFAULT; + FIXME("WSCGetProviderPath not implemented.\n");
- *errcode = WSAEINVAL; - return SOCKET_ERROR; + if (*len <= 0) { + if (errcode) + *errcode = WSAEFAULT; + return SOCKET_ERROR; + } + + return 0; }
/*********************************************************************** diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 60c5dfc63f..83c758d535 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -84,6 +84,7 @@ static int (WINAPI *pWSALookupServiceNextW)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSET static int (WINAPI *pWSAEnumNameSpaceProvidersA)(LPDWORD,LPWSANAMESPACE_INFOA); static int (WINAPI *pWSAEnumNameSpaceProvidersW)(LPDWORD,LPWSANAMESPACE_INFOW); static int (WINAPI *pWSAPoll)(WSAPOLLFD *,ULONG,INT); +static int (WINAPI *pWSCGetProviderPath)(LPGUID, LPWSTR, LPINT, LPINT);
/* Function pointers from iphlpapi */ static DWORD (WINAPI *pGetAdaptersInfo)(PIP_ADAPTER_INFO,PULONG); @@ -1300,6 +1301,7 @@ static void Init (void) pWSAEnumNameSpaceProvidersA = (void *)GetProcAddress(hws2_32, "WSAEnumNameSpaceProvidersA"); pWSAEnumNameSpaceProvidersW = (void *)GetProcAddress(hws2_32, "WSAEnumNameSpaceProvidersW"); pWSAPoll = (void *)GetProcAddress(hws2_32, "WSAPoll"); + pWSCGetProviderPath = (void *)GetProcAddress(hws2_32, "WSCGetProviderPath");
hiphlpapi = LoadLibraryA("iphlpapi.dll"); if (hiphlpapi) @@ -10600,6 +10602,41 @@ static void test_address_list_query(void) closesocket(s); }
+static void test_WSCGetProviderPath(void) +{ + GUID ProviderIdIP = { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0 } }; + wchar_t buffer[256]; + INT ret, err, len; + + ret = pWSCGetProviderPath(NULL, NULL, NULL, NULL); + ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret); + + ret = pWSCGetProviderPath(&ProviderIdIP, NULL, NULL, NULL); + ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret); + + ret = pWSCGetProviderPath(NULL, NULL, NULL, &err); + ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret); + ok(err == WSAEFAULT, "Got unexpected error %d.\n", err); + + ret = pWSCGetProviderPath(&ProviderIdIP, NULL, NULL, &err); + ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret); + ok(err == WSAEFAULT, "Got unexpected error %d.\n", err); + + /* WSCGetProviderPath() can be used determine the path length + * "ret" is SOCKET_ERROR and "len" will contain the length */ + err = 0; + ret = pWSCGetProviderPath(&ProviderIdIP, NULL, &len, &err); + todo_wine ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret); + todo_wine ok(err == WSAEINVAL, "Got unexpected error %d.\n", err); + + /* Valid pointers and length but invalid GUID */ + err = 0; + len = 256; + ret = pWSCGetProviderPath(&ProviderIdIP, buffer, &len, &err); + todo_wine ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret); + todo_wine ok(err == WSAEINVAL, "Got unexpected error %d.\n", err); +} + static DWORD WINAPI inet_ntoa_thread_proc(void *param) { ULONG addr; @@ -11681,6 +11718,8 @@ START_TEST( sock ) test_completion_port(); test_address_list_query();
+ test_WSCGetProviderPath(); + /* this is an io heavy test, do it at the end so the kernel doesn't start dropping packets */ test_send(); test_synchronous_WSAIoctl();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=65835
Your paranoid android.
=== debian10 (32 bit report) ===
ws2_32: sock.c:3059: Test succeeded inside todo block: Test[1]: expected 0, got 0