Hans Leidekker : wininet: Append the extra info part in InternetCreateUrl{A , W}.

Alexandre Julliard julliard at winehq.org
Tue Dec 2 11:02:00 CST 2008


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Dec  1 16:37:57 2008 +0100

wininet: Append the extra info part in InternetCreateUrl{A, W}.

---

 dlls/wininet/internet.c  |   11 ++++++++++-
 dlls/wininet/tests/url.c |   24 ++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 5f67334..ed92536 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -3487,6 +3487,9 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
     if (lpUrlComponents->lpszUrlPath)
         *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
 
+    if (lpUrlComponents->lpszExtraInfo)
+        *lpdwUrlLength += URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
+
     return TRUE;
 }
 
@@ -3735,7 +3738,6 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
         }
     }
 
-
     if (lpUrlComponents->lpszUrlPath)
     {
         dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, UrlPath);
@@ -3743,6 +3745,13 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags,
         lpszUrl += dwLen;
     }
 
+    if (lpUrlComponents->lpszExtraInfo)
+    {
+        dwLen = URL_GET_COMP_LENGTH(lpUrlComponents, ExtraInfo);
+        memcpy(lpszUrl, lpUrlComponents->lpszExtraInfo, dwLen * sizeof(WCHAR));
+        lpszUrl += dwLen;
+    }
+
     *lpszUrl = '\0';
 
     return TRUE;
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index e9f2439..f10e53b 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -52,6 +52,7 @@
 #define CREATE_URL10 "about://host/blank"
 #define CREATE_URL11 "about:"
 #define CREATE_URL12 "http://www.winehq.org:65535"
+#define CREATE_URL13 "http://localhost/?test=123"
 
 static void copy_compsA(
     URL_COMPONENTSA *src, 
@@ -455,9 +456,12 @@ static void InternetCreateUrlA_test(void)
                     http[]       = "http",
                     https[]      = "https",
                     winehq[]     = "www.winehq.org",
+                    localhost[]  = "localhost",
                     username[]   = "username",
                     password[]   = "password",
+                    root[]       = "/",
                     site_about[] = "/site/about",
+                    extra_info[] = "?test=123",
                     about[]      = "about",
                     blank[]      = "blank",
                     host[]       = "host";
@@ -771,6 +775,26 @@ static void InternetCreateUrlA_test(void)
 	ok(!strcmp(szUrl, CREATE_URL12), "Expected %s, got %s\n", CREATE_URL12, szUrl);
 
 	HeapFree(GetProcessHeap(), 0, szUrl);
+
+    memset(&urlComp, 0, sizeof(urlComp));
+    urlComp.dwStructSize = sizeof(URL_COMPONENTS);
+    urlComp.lpszScheme = http;
+    urlComp.dwSchemeLength = strlen(urlComp.lpszScheme);
+    urlComp.lpszHostName = localhost;
+    urlComp.dwHostNameLength = strlen(urlComp.lpszHostName);
+    urlComp.nPort = 80;
+    urlComp.lpszUrlPath = root;
+    urlComp.dwUrlPathLength = strlen(urlComp.lpszUrlPath);
+    urlComp.lpszExtraInfo = extra_info;
+    urlComp.dwExtraInfoLength = strlen(urlComp.lpszExtraInfo);
+    len = 256;
+    szUrl = HeapAlloc(GetProcessHeap(), 0, len);
+    InternetCreateUrlA(&urlComp, ICU_ESCAPE, szUrl, &len);
+    ok(ret, "Expected success\n");
+    ok(len == strlen(CREATE_URL13), "Expected len %u, got %u\n", strlen(CREATE_URL13), len);
+    ok(!strcmp(szUrl, CREATE_URL13), "Expected \"%s\", got \"%s\"\n", CREATE_URL13, szUrl);
+
+    HeapFree(GetProcessHeap(), 0, szUrl);
 }
 
 START_TEST(url)




More information about the wine-cvs mailing list