Wininet: InternetSetStatusCallback Fix

Robert Shearman rob at codeweavers.com
Mon Sep 13 05:35:10 CDT 2004


Hi,

You can call InternetSetStatusCallback on a HTTP handle, not just a 
InternetOpen handle, so we should search up through the parents to find it.

Rob

Changelog:
InternetSetStatusCallback should try harder to find the WH_HINIT handle.
-------------- next part --------------
Index: wine/dlls/wininet/internet.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/internet.c,v
retrieving revision 1.97
diff -u -p -r1.97 internet.c
--- wine/dlls/wininet/internet.c	8 Sep 2004 21:46:33 -0000	1.97
+++ wine/dlls/wininet/internet.c	13 Sep 2004 10:29:04 -0000
@@ -1491,20 +1491,28 @@ INTERNET_STATUS_CALLBACK WINAPI Internet
 {
     INTERNET_STATUS_CALLBACK retVal = INTERNET_INVALID_STATUS_CALLBACK;
     LPWININETAPPINFOW lpwai;
+    LPWININETHANDLEHEADER lpwh, parent;
 
     TRACE("(%p, %p)\n", hInternet, lpfnIntCB);
-    
-    lpwai = (LPWININETAPPINFOW)WININET_GetObject(hInternet);
-    if (!lpwai)
-        return retVal;
 
-    if (lpwai->hdr.htype == WH_HINIT)
+    lpwh = parent = WININET_GetObject(hInternet);
+
+    while (parent && parent->htype != WH_HINIT)
+        parent = parent->lpwhparent;
+
+    if (!parent)
     {
-        lpwai->hdr.dwInternalFlags &= ~INET_CALLBACKW;
-        retVal = lpwai->lpfnStatusCB;
-        lpwai->lpfnStatusCB = lpfnIntCB;
+        WARN("Couldn't find WH_HINIT handle\n");
+        return retVal;
     }
-    WININET_Release( &lpwai->hdr );
+
+    lpwai = (LPWININETAPPINFOW)parent;
+
+    lpwai->hdr.dwInternalFlags &= ~INET_CALLBACKW;
+    retVal = lpwai->lpfnStatusCB;
+    lpwai->lpfnStatusCB = lpfnIntCB;
+
+    WININET_Release( lpwh );
 
     return retVal;
 }
@@ -1525,19 +1533,26 @@ INTERNET_STATUS_CALLBACK WINAPI Internet
 {
     INTERNET_STATUS_CALLBACK retVal = INTERNET_INVALID_STATUS_CALLBACK;
     LPWININETAPPINFOW lpwai;
+    LPWININETHANDLEHEADER lpwh, parent;
 
     TRACE("(%p, %p)\n", hInternet, lpfnIntCB);
     
-    lpwai = (LPWININETAPPINFOW)WININET_GetObject(hInternet);
-    if (!lpwai)
-        return retVal;
+    lpwh = parent = WININET_GetObject(hInternet);
+
+    while (parent && parent->htype != WH_HINIT)
+        parent = parent->lpwhparent;
 
-    if (lpwai->hdr.htype == WH_HINIT)
+    if (!parent)
     {
-        lpwai->hdr.dwInternalFlags |= INET_CALLBACKW;
-        retVal = lpwai->lpfnStatusCB;
-        lpwai->lpfnStatusCB = lpfnIntCB;
+        WARN("Couldn't find WH_HINIT handle\n");
+        return retVal;
     }
+
+    lpwai = (LPWININETAPPINFOW)parent;
+
+    lpwai->hdr.dwInternalFlags |= INET_CALLBACKW;
+    retVal = lpwai->lpfnStatusCB;
+    lpwai->lpfnStatusCB = lpfnIntCB;
 
     WININET_Release( &lpwai->hdr );
 


More information about the wine-patches mailing list