Commit 652f1f96 authored by Aaro Altonen's avatar Aaro Altonen Committed by Alexandre Julliard

ws2_32: Improve WSCGetProviderPath() stub.

parent 09e683ca
......@@ -8940,10 +8940,21 @@ INT WINAPI WSCGetProviderPath( LPGUID provider, LPWSTR path, LPINT len, LPINT er
{
FIXME( "(%s %p %p %p) Stub!\n", debugstr_guid(provider), path, len, errcode );
if (!errcode || !provider || !len) return WSAEFAULT;
if (!provider || !len)
{
if (errcode)
*errcode = WSAEFAULT;
return SOCKET_ERROR;
}
if (*len <= 0)
{
if (errcode)
*errcode = WSAEINVAL;
return SOCKET_ERROR;
}
return 0;
}
/***********************************************************************
......
......@@ -86,6 +86,7 @@ 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);
static int (WINAPI *pWSCGetProviderPath)(LPGUID, LPWSTR, LPINT, LPINT);
/* Function pointers from iphlpapi */
static DWORD (WINAPI *pGetAdaptersInfo)(PIP_ADAPTER_INFO,PULONG);
......@@ -1303,6 +1304,7 @@ static void Init (void)
pWSAEnumNameSpaceProvidersW = (void *)GetProcAddress(hws2_32, "WSAEnumNameSpaceProvidersW");
pWSAPoll = (void *)GetProcAddress(hws2_32, "WSAPoll");
pWSCGetProviderInfo = (void *)GetProcAddress(hws2_32, "WSCGetProviderInfo");
pWSCGetProviderPath = (void *)GetProcAddress(hws2_32, "WSCGetProviderPath");
hiphlpapi = LoadLibraryA("iphlpapi.dll");
if (hiphlpapi)
......@@ -11351,6 +11353,65 @@ static void test_WSCGetProviderInfo(void)
ok(errcode == WSANO_RECOVERY, "got %d, expected WSANO_RECOVERY\n", errcode);
}
static void test_WSCGetProviderPath(void)
{
GUID provider = {};
WCHAR buffer[256];
INT ret, err, len;
if (!pWSCGetProviderPath)
{
skip("WSCGetProviderPath is not available.\n");
return;
}
ret = pWSCGetProviderPath(NULL, NULL, NULL, NULL);
ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret);
ret = pWSCGetProviderPath(&provider, NULL, NULL, NULL);
ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret);
ret = pWSCGetProviderPath(NULL, buffer, NULL, NULL);
ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret);
len = -1;
ret = pWSCGetProviderPath(NULL, NULL, &len, NULL);
ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret);
ok(len == -1, "Got unexpected len %d.\n", len);
err = 0;
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);
err = 0;
ret = pWSCGetProviderPath(&provider, NULL, NULL, &err);
ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret);
ok(err == WSAEFAULT, "Got unexpected error %d.\n", err);
err = 0;
len = -1;
ret = pWSCGetProviderPath(&provider, NULL, &len, &err);
ok(ret == SOCKET_ERROR, "Got unexpected ret %d.\n", ret);
ok(err == WSAEINVAL, "Got unexpected error %d.\n", err);
ok(len == -1, "Got unexpected len %d.\n", len);
err = 0;
len = 256;
ret = pWSCGetProviderPath(&provider, 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);
ok(len == 256, "Got unexpected len %d.\n", len);
/* Valid pointers and length but invalid GUID */
err = 0;
len = 256;
ret = pWSCGetProviderPath(&provider, 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);
ok(len == 256, "Got unexpected len %d.\n", len);
}
START_TEST( sock )
{
int i;
......@@ -11432,6 +11493,7 @@ START_TEST( sock )
test_address_list_query();
test_WSCGetProviderInfo();
test_WSCGetProviderPath();
/* this is an io heavy test, do it at the end so the kernel doesn't start dropping packets */
test_send();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment