Misha Koshelev : wininet: Fix reference count on internet handle for asynchronous InternetReadFileEx call .

Alexandre Julliard julliard at wine.codeweavers.com
Wed Aug 22 06:23:12 CDT 2007


Module: wine
Branch: master
Commit: 1ee9ea91a5e60c3839235c4d6b55a0da2d85a11a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1ee9ea91a5e60c3839235c4d6b55a0da2d85a11a

Author: Misha Koshelev <mk144210 at bcm.edu>
Date:   Wed Aug 22 00:12:52 2007 -0500

wininet: Fix reference count on internet handle for asynchronous InternetReadFileEx call.

---

 dlls/wininet/internet.c   |   11 ++++++-----
 dlls/wininet/tests/http.c |   12 ++++++++++++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index bfad36c..d24eed3 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1883,11 +1883,11 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu
             req = &workRequest.u.InternetReadFileExA;
             req->lpBuffersOut = lpBuffersOut;
 
-            retval = INTERNET_AsyncCall(&workRequest);
-            if (!retval) return FALSE;
-
-            INTERNET_SetLastError(ERROR_IO_PENDING);
-            return FALSE;
+            if (!INTERNET_AsyncCall(&workRequest))
+                WININET_Release( lpwh );
+            else
+                INTERNET_SetLastError(ERROR_IO_PENDING);
+            goto end;
         }
     }
 
@@ -1903,6 +1903,7 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu
                               sizeof(dwBytesReceived));
     }
 
+end:
     WININET_Release( lpwh );
 
     TRACE("-- %s (bytes read: %d)\n", retval ? "TRUE": "FALSE", lpBuffersOut->dwBufferLength);
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 699aaa0..d699998 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -704,6 +704,8 @@ static void InternetReadFileExA_test(int flags)
 abort:
     SET_EXPECT2(INTERNET_STATUS_HANDLE_CLOSING, (hor != 0x0) + (hic != 0x0));
     if (hor) {
+        SET_WINE_ALLOW(INTERNET_STATUS_CLOSING_CONNECTION);
+        SET_WINE_ALLOW(INTERNET_STATUS_CONNECTION_CLOSED);
         rc = InternetCloseHandle(hor);
         ok ((rc != 0), "InternetCloseHandle of handle opened by HttpOpenRequestA failed\n");
         rc = InternetCloseHandle(hor);
@@ -721,6 +723,16 @@ abort:
           Sleep(100);
       CHECK_NOTIFIED2(INTERNET_STATUS_HANDLE_CLOSING, (hor != 0x0) + (hic != 0x0));
     }
+    if (hor != 0x0) todo_wine
+    {
+        CHECK_NOT_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
+        CHECK_NOT_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
+    }
+    else
+    {
+        CHECK_NOT_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION);
+        CHECK_NOT_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED);
+    }
     CloseHandle(hCompleteEvent);
     first_connection_to_test_url = FALSE;
 }




More information about the wine-cvs mailing list