Alistair Leslie-Hughes : wininet: Always set last error in HttpQueryInfoW.

Alexandre Julliard julliard at winehq.org
Mon Jun 24 16:06:22 CDT 2019


Module: wine
Branch: master
Commit: 3522b127a3a16949df16d023cc91d7dbbea1a8c5
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3522b127a3a16949df16d023cc91d7dbbea1a8c5

Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date:   Mon Jun 24 00:22:51 2019 +0000

wininet: Always set last error in HttpQueryInfoW.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 782b258..9244393 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3920,8 +3920,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 5a0cc11..70d5738 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]);




More information about the wine-cvs mailing list