Some compatibility issue with InternetCrackUrlA

wire99 at 21cn.com wire99 at 21cn.com
Mon Feb 23 03:05:43 CST 2004


Hi all.

  I've tried some applications with wine, and discovered the different behavior compare to the real winapi.

  1. If there is no explicit port number in the URL, the value of lpUC->nPort will be assigned to zero in wine, but in winapi it should be the default port number of the corresponding scheme.

  2. Before call InternetCrackUrlA, if the field dwExtraInfoLength of lpUrlComponents set to 0, the ExtraInfo of the URL is not parsed at all; only the dwExtraInfoLength is set to non-zero, ExtraInfo would be filled. But Wine would always do parse. (I just find it has been reported at http://bugs.winehq.com/show_bug.cgi?id=1805)

Below is a rough patch for this issue, some download manager apps (ie. flashget) affected work now.

						Regards.


--- dlls/wininet/internet.c.orig        2003-12-31 03:16:37.000000000 +0800
+++ dlls/wininet/internet.c     2004-02-21 10:49:45.000000000 +0800
@@ -1027,7 +1027,7 @@

     /* Parse <params> */
     lpszParam = strpbrkW(lpszap, lpszSeparators);
-    if (lpszParam != NULL)
+    if (lpszParam != NULL && lpUC->dwExtraInfoLength)
     {
         if (!SetUrlComponentValueW(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength,
                                    lpszParam, dwUrlLength-(lpszParam-lpszUrl)))
@@ -1163,7 +1163,23 @@
                         if (lpszPort != lpszNetLoc)
                             lpUC->nPort = atoiW(++lpszPort);
                         else
-                            lpUC->nPort = 0;
+                           switch(lpUC->nScheme) {
+                               case INTERNET_SCHEME_FTP:
+                                   lpUC->nPort = INTERNET_DEFAULT_FTP_PORT;
+                                   break;
+                               case INTERNET_SCHEME_HTTPS:
+                                   lpUC->nPort = INTERNET_DEFAULT_HTTPS_PORT;
+                                   break;
+                               case INTERNET_SCHEME_HTTP:
+                                   lpUC->nPort = INTERNET_DEFAULT_HTTP_PORT;
+                                   break;
+                               case INTERNET_SCHEME_GOPHER:
+                                   lpUC->nPort = INTERNET_DEFAULT_GOPHER_PORT;
+                                   break;
+                               default:
+                                   lpUC->nPort = 0;
+                                   break;
+                           }
                     }
                 }
             }




More information about the wine-devel mailing list