wininet: Append the extra info part in InternetCreateUrl{A, W}.
Hans Leidekker
hans at codeweavers.com
Mon Dec 1 09:37:57 CST 2008
Fixes http://bugs.winehq.org/show_bug.cgi?id=16287
-Hans
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-patches
mailing list