Hans Leidekker : winhttp: WinHttpCrackUrl and InternetCrackUrlW use different scheme constants.

Alexandre Julliard julliard at winehq.org
Wed Sep 3 07:44:03 CDT 2008


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Sep  3 12:30:32 2008 +0200

winhttp: WinHttpCrackUrl and InternetCrackUrlW use different scheme constants.

---

 dlls/winhttp/main.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/dlls/winhttp/main.c b/dlls/winhttp/main.c
index 2d3ec2f..5ea3994 100644
--- a/dlls/winhttp/main.c
+++ b/dlls/winhttp/main.c
@@ -27,6 +27,8 @@
 
 #include "wine/debug.h"
 
+#include "winhttp_private.h"
+
 WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
 
 /******************************************************************
@@ -105,6 +107,9 @@ BOOL WINAPI WinHttpSetOption (HINTERNET hInternet, DWORD dwOption, LPVOID lpBuff
     return FALSE;
 }
 
+#define SCHEME_HTTP  3
+#define SCHEME_HTTPS 4
+
 BOOL WINAPI InternetCrackUrlW( LPCWSTR, DWORD, DWORD, LPURL_COMPONENTSW );
 BOOL WINAPI InternetCreateUrlW( LPURL_COMPONENTS, DWORD, LPWSTR, LPDWORD );
 
@@ -113,8 +118,22 @@ BOOL WINAPI InternetCreateUrlW( LPURL_COMPONENTS, DWORD, LPWSTR, LPDWORD );
  */
 BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONENTSW components )
 {
+    BOOL ret;
+
     TRACE("%s, %d, %x, %p\n", debugstr_w(url), len, flags, components);
-    return InternetCrackUrlW( url, len, flags, components );
+
+    if ((ret = InternetCrackUrlW( url, len, flags, components )))
+    {
+        /* fix up an incompatibility between wininet and winhttp */
+        if (components->nScheme == SCHEME_HTTP) components->nScheme = INTERNET_SCHEME_HTTP;
+        else if (components->nScheme == SCHEME_HTTPS) components->nScheme = INTERNET_SCHEME_HTTPS;
+        else
+        {
+            set_last_error( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
+            return FALSE;
+        }
+    }
+    return ret;
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list