Module: wine Branch: master Commit: 1e2a24e9b8a2164f1c7b7e85d31eecd36e05886d URL: https://gitlab.winehq.org/wine/wine/-/commit/1e2a24e9b8a2164f1c7b7e85d31eecd...
Author: Francois Gouget fgouget@codeweavers.com Date: Fri Apr 7 15:01:43 2023 +0200
wininet/tests: Fix InternetGetConnectedStateEx() parameter checking.
It should set the error code if given a non-zero reserved value.
---
dlls/wininet/internet.c | 3 +++ dlls/wininet/tests/internet.c | 5 +++++ 2 files changed, 8 insertions(+)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 665e339f920..a2d9f00ce6f 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1216,7 +1216,10 @@ BOOL WINAPI InternetGetConnectedStateExW(LPDWORD lpdwStatus, LPWSTR lpszConnecti
/* Must be zero */ if(dwReserved) + { + SetLastError(ERROR_INVALID_PARAMETER); return FALSE; + }
for (;;) { diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index ad3d5b17811..fde1b65f5d2 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -1759,6 +1759,11 @@ static void test_InternetGetConnectedStateExW(void) res = pInternetGetConnectedStateExW(NULL, NULL, 0, 0); ok(res == TRUE, "Expected TRUE, got %d\n", res);
+ SetLastError(0xdeadbeef); + res = pInternetGetConnectedStateExW(NULL, NULL, 0, 1); + ok(res == FALSE, "Expected TRUE, got %d\n", res); + ok(GetLastError() == ERROR_INVALID_PARAMETER, "Unexpected gle %lu\n", GetLastError()); + flags = 0; res = pInternetGetConnectedStateExW(&flags, NULL, 0, 0); ok(res == TRUE, "Expected TRUE, got %d\n", res);