Dan Kegel : wininet: InternetCrackUrlW: For URLs that have no urlpath, native clears lpszUrlPath.

Alexandre Julliard julliard at winehq.org
Tue Jun 24 06:46:17 CDT 2008


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

Author: Dan Kegel <dank at kegel.com>
Date:   Mon Jun 23 21:42:51 2008 -0700

wininet: InternetCrackUrlW: For URLs that have no urlpath, native clears lpszUrlPath.

---

 dlls/wininet/internet.c  |    2 ++
 dlls/wininet/tests/url.c |   27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 41e7b2d..388a2a9 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1490,6 +1490,8 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
     }
     else
     {
+        if (lpUC->lpszUrlPath && (lpUC->dwUrlPathLength > 0))
+            lpUC->lpszUrlPath[0] = 0;
         lpUC->dwUrlPathLength = 0;
     }
 
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index ccc5607..e9f2439 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -268,6 +268,7 @@ static void InternetCrackUrlW_test(void)
         '=','I','D','E','&','A','C','T','I','O','N','=','I','D','E','_','D','E','F','A',
         'U','L','T', 0 };
     static const WCHAR url2[] = { '.','.','/','R','i','t','z','.','x','m','l',0 };
+    static const WCHAR url3[] = { 'h','t','t','p',':','/','/','x','.','o','r','g',0 };
     URL_COMPONENTSW comp;
     WCHAR scheme[20], host[20], user[20], pwd[20], urlpart[50], extra[50];
     DWORD error;
@@ -389,6 +390,32 @@ static void InternetCrackUrlW_test(void)
         "InternetCrackUrl should have failed with error ERROR_INTERNET_UNRECOGNIZED_SCHEME instead of error %d\n",
         GetLastError());
     }
+
+    /* Test to see whether cracking a URL without a filename initializes urlpart */
+    urlpart[0]=0xba;
+    scheme[0]=0;
+    extra[0]=0;
+    host[0]=0;
+    user[0]=0;
+    pwd[0]=0;
+    memset(&comp, 0, sizeof comp);
+    comp.dwStructSize = sizeof comp;
+    comp.lpszScheme = scheme;
+    comp.dwSchemeLength = sizeof scheme;
+    comp.lpszHostName = host;
+    comp.dwHostNameLength = sizeof host;
+    comp.lpszUserName = user;
+    comp.dwUserNameLength = sizeof user;
+    comp.lpszPassword = pwd;
+    comp.dwPasswordLength = sizeof pwd;
+    comp.lpszUrlPath = urlpart;
+    comp.dwUrlPathLength = sizeof urlpart;
+    comp.lpszExtraInfo = extra;
+    comp.dwExtraInfoLength = sizeof extra;
+    r = InternetCrackUrlW(url3, 0, 0, &comp );
+    ok( r, "InternetCrackUrlW failed unexpectedly\n");
+    ok( host[0] == 'x', "host should be x.org\n");
+    ok( urlpart[0] == 0, "urlpart should be empty\n");
 }
 
 static void fill_url_components(LPURL_COMPONENTS lpUrlComponents)




More information about the wine-cvs mailing list