[PATCH 1/2] wininet: Always set last error in HttpQueryInfoW.

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Sun Jun 23 19:22:51 CDT 2019


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/wininet/http.c       | 4 ++--
 dlls/wininet/tests/http.c | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index cbc95fb8ae..c90213bf46 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3911,8 +3911,8 @@ lend:
          WININET_Release( &request->hdr );
 
     TRACE("%u <--\n", res);
-    if(res != ERROR_SUCCESS)
-        SetLastError(res);
+
+    SetLastError(res);
     return res == ERROR_SUCCESS;
 }
 
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 5a0cc11754..70d57385e5 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -722,8 +722,11 @@ static void InternetReadFile_test(int flags, const test_data_t *test)
 
     length = sizeof(buffer)-2;
     memset(buffer, 0x77, sizeof(buffer));
+    SetLastError(0xdeadbeef);
     res = HttpQueryInfoA(hor,HTTP_QUERY_RAW_HEADERS,buffer,&length,0x0);
     ok(res, "HttpQueryInfoA(HTTP_QUERY_RAW_HEADERS) failed with error %d\n", GetLastError());
+    ok(GetLastError() == 0 ||
+                broken(GetLastError() == 0xdeadbeef /* XP/W2K3 */), "Last Error not reset %u\n", GetLastError());
     /* show that the function writes data past the length returned */
     ok(buffer[length-2], "Expected any header character, got 0x00\n");
     ok(!buffer[length-1], "Expected 0x00, got %02X\n", buffer[length-1]);
-- 
2.17.1



More information about the wine-devel mailing list