Changes in v3: - Skip the test on WinXP.
Previous version: https://www.winehq.org/pipermail/wine-devel/2020-March/162384.html
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48765 Signed-off-by: Bernhard Übelacker bernhardu@mailbox.org --- dlls/ws2_32/socket.c | 21 ++++++++++++++++++ dlls/ws2_32/tests/sock.c | 46 ++++++++++++++++++++++++++++++++++++++++ dlls/ws2_32/ws2_32.spec | 1 + include/winsock2.h | 5 +++++ include/ws2spi.h | 1 + 5 files changed, 74 insertions(+)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index c284f595ab..5b62767795 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -9001,6 +9001,27 @@ INT WINAPI WSCEnableNSProvider( LPGUID provider, BOOL enable ) return 0; }
+/*********************************************************************** + * WSCGetProviderInfo + */ +INT WINAPI WSCGetProviderInfo( LPGUID provider, WSC_PROVIDER_INFO_TYPE info_type, + PBYTE info, size_t* len, DWORD flags, LPINT errcode ) +{ + FIXME( "(%s 0x%08x %p %p 0x%08x %p) Stub!\n", + debugstr_guid(provider), info_type, info, len, flags, errcode ); + + if (!errcode) + return SOCKET_ERROR; + + if (!provider) { + *errcode = WSAEFAULT; + return SOCKET_ERROR; + } + + *errcode = WSANO_RECOVERY; + return SOCKET_ERROR; +} + /*********************************************************************** * WSCGetProviderPath (WS2_32.86) */ diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 60c5dfc63f..afbf458f1d 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 *pWSCGetProviderInfo)(LPGUID,WSC_PROVIDER_INFO_TYPE,PBYTE,size_t*,DWORD,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"); + pWSCGetProviderInfo = (void *)GetProcAddress(hws2_32, "WSCGetProviderInfo");
hiphlpapi = LoadLibraryA("iphlpapi.dll"); if (hiphlpapi) @@ -11597,6 +11599,48 @@ static void test_iocp(void) closesocket(dst); }
+static void test_WSCGetProviderInfo(void) +{ + int ret; + int errcode; + GUID provider = {}; + char info[1] = {}; + size_t len = 0; + + if (!pWSCGetProviderInfo) { + skip("WSCGetProviderInfo is not available.\n"); + return; + } + + ret = pWSCGetProviderInfo(NULL, -1, NULL, NULL, 0, NULL); + ok(ret == SOCKET_ERROR, "got %d, expected SOCKET_ERROR\n", ret); + + errcode = 0xdeadbeef; + ret = pWSCGetProviderInfo(NULL, ProviderInfoLspCategories, (PBYTE)&info, &len, 0, &errcode); + ok(ret == SOCKET_ERROR, "got %d, expected SOCKET_ERROR\n", ret); + ok(errcode == WSAEFAULT, "got %d, expected WSAEFAULT\n", errcode); + + errcode = 0xdeadbeef; + ret = pWSCGetProviderInfo(&provider, -1, (PBYTE)&info, &len, 0, &errcode); + ok(ret == SOCKET_ERROR, "got %d, expected SOCKET_ERROR\n", ret); + ok(errcode == WSANO_RECOVERY, "got %d, expected WSANO_RECOVERY\n", errcode); + + errcode = 0xdeadbeef; + ret = pWSCGetProviderInfo(&provider, ProviderInfoLspCategories, NULL, &len, 0, &errcode); + ok(ret == SOCKET_ERROR, "got %d, expected SOCKET_ERROR\n", ret); + ok(errcode == WSANO_RECOVERY, "got %d, expected WSANO_RECOVERY\n", errcode); + + errcode = 0xdeadbeef; + ret = pWSCGetProviderInfo(&provider, ProviderInfoLspCategories, (PBYTE)&info, NULL, 0, &errcode); + ok(ret == SOCKET_ERROR, "got %d, expected SOCKET_ERROR\n", ret); + ok(errcode == WSANO_RECOVERY, "got %d, expected WSANO_RECOVERY\n", errcode); + + errcode = 0xdeadbeef; + ret = pWSCGetProviderInfo(&provider, ProviderInfoLspCategories, (PBYTE)&info, &len, 0, &errcode); + ok(ret == SOCKET_ERROR, "got %d, expected SOCKET_ERROR\n", ret); + ok(errcode == WSANO_RECOVERY, "got %d, expected WSANO_RECOVERY\n", errcode); +} + START_TEST( sock ) { int i; @@ -11681,6 +11725,8 @@ START_TEST( sock ) test_completion_port(); test_address_list_query();
+ test_WSCGetProviderInfo(); + /* this is an io heavy test, do it at the end so the kernel doesn't start dropping packets */ test_send(); test_synchronous_WSAIoctl(); diff --git a/dlls/ws2_32/ws2_32.spec b/dlls/ws2_32/ws2_32.spec index 37b02e5712..d3c1e6214a 100644 --- a/dlls/ws2_32/ws2_32.spec +++ b/dlls/ws2_32/ws2_32.spec @@ -117,6 +117,7 @@ @ stdcall WSCDeinstallProvider(ptr ptr) @ stdcall WSCEnableNSProvider(ptr long) @ stdcall WSCEnumProtocols(ptr ptr ptr ptr) +@ stdcall WSCGetProviderInfo(ptr long ptr ptr long ptr) @ stdcall WSCGetProviderPath(ptr ptr ptr ptr) @ stdcall WSCInstallNameSpace(wstr wstr long long ptr) @ stdcall WSCInstallProvider(ptr wstr ptr long ptr) diff --git a/include/winsock2.h b/include/winsock2.h index e8d033976f..04a55c4dbe 100644 --- a/include/winsock2.h +++ b/include/winsock2.h @@ -628,6 +628,11 @@ typedef struct _WSACOMPLETION { } Parameters; } WSACOMPLETION, *PWSACOMPLETION, *LPWSACOMPLETION;
+typedef enum _WSC_PROVIDER_INFO_TYPE { + ProviderInfoLspCategories, + ProviderInfoAudit, +} WSC_PROVIDER_INFO_TYPE; + /* * Winsock Function Typedefs * diff --git a/include/ws2spi.h b/include/ws2spi.h index 3d2ca84dfa..eb8eaec509 100644 --- a/include/ws2spi.h +++ b/include/ws2spi.h @@ -39,6 +39,7 @@ INT WINAPI WSCInstallProvider(const LPGUID,LPCWSTR,const LPWSAPROTOCOL_INFO INT WINAPI WSCDeinstallProvider(LPGUID,LPINT); INT WINAPI WSCEnableNSProvider(LPGUID,BOOL); INT WINAPI WSCEnumProtocols(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD,LPINT); +INT WINAPI WSCGetProviderInfo(LPGUID,WSC_PROVIDER_INFO_TYPE,PBYTE,size_t*,DWORD,LPINT); INT WINAPI WSCGetProviderPath(LPGUID,LPWSTR,LPINT,LPINT); INT WINAPI WSCInstallNameSpace(LPWSTR,LPWSTR,DWORD,DWORD,LPGUID); INT WINAPI WSCSetApplicationCategory(LPCWSTR,DWORD,LPCWSTR,DWORD,DWORD,DWORD*,LPINT);