Commit 5e13e7f8 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

wininet: Fix InternetGetConnectedStateEx[A|W].

parent 2bf09a9d
......@@ -1276,13 +1276,21 @@ BOOL WINAPI InternetGetConnectedStateExW(LPDWORD lpdwStatus, LPWSTR lpszConnecti
/* Must be zero */
if(dwReserved)
return FALSE;
return FALSE;
if (lpdwStatus) {
WARN("always returning LAN connection.\n");
*lpdwStatus = INTERNET_CONNECTION_LAN;
}
return LoadStringW(WININET_hModule, IDS_LANCONNECTION, lpszConnectionName, dwNameLen) > 0;
/* When the buffer size is zero LoadStringW fills the buffer with a pointer to
* the resource, avoid it as we must not change the buffer in this case */
if(lpszConnectionName && dwNameLen) {
*lpszConnectionName = '\0';
LoadStringW(WININET_hModule, IDS_LANCONNECTION, lpszConnectionName, dwNameLen);
}
return TRUE;
}
......
......@@ -1525,19 +1525,16 @@ static void test_InternetGetConnectedStateExA(void)
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, buffer);
res = pInternetGetConnectedStateExA(NULL, NULL, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
flags = 0;
res = pInternetGetConnectedStateExA(&flags, NULL, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
......@@ -1558,7 +1555,6 @@ todo_wine
flags = 0;
res = pInternetGetConnectedStateExA(&flags, NULL, sizeof(buffer), 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
......@@ -1580,7 +1576,6 @@ todo_wine
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(strlen(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenA(buffer));
......@@ -1595,10 +1590,8 @@ todo_wine
flags = 0;
buffer[0] = 0xDE;
res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
todo_wine
ok(strlen(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenA(buffer));
}
......@@ -1621,12 +1614,10 @@ static void test_InternetGetConnectedStateExW(void)
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, wine_dbgstr_w(buffer));
res = pInternetGetConnectedStateExW(NULL, NULL, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
flags = 0;
res = pInternetGetConnectedStateExW(&flags, NULL, 0, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
......@@ -1635,7 +1626,6 @@ todo_wine
res = pInternetGetConnectedStateExW(&flags, buffer, 0, 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
todo_wine
ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
buffer[0] = 0;
......@@ -1654,7 +1644,6 @@ todo_wine
flags = 0;
res = pInternetGetConnectedStateExW(&flags, NULL, sizeof(buffer) / sizeof(buffer[0]), 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
......@@ -1676,7 +1665,6 @@ todo_wine
buffer[0] = 0;
flags = 0;
res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
ok(lstrlenW(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenW(buffer));
......@@ -1691,10 +1679,8 @@ todo_wine
buffer[0] = 0xDEAD;
flags = 0;
res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0);
todo_wine
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
todo_wine
ok(lstrlenW(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenW(buffer));
}
......
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