4 * Copyright 2010 Thomas Mullaly
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <wine/test.h>
27 #define WIN32_LEAN_AND_MEAN
37 DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
39 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
40 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
41 #define URI_BUILDER_STR_PROPERTY_COUNT 7
43 #define DEFINE_EXPECT(func) \
44 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
46 #define SET_EXPECT(func) \
47 expect_ ## func = TRUE
49 #define CHECK_EXPECT(func) \
51 ok(expect_ ##func, "unexpected call " #func "\n"); \
52 expect_ ## func = FALSE; \
53 called_ ## func = TRUE; \
56 #define CHECK_EXPECT2(func) \
58 ok(expect_ ##func, "unexpected call " #func "\n"); \
59 called_ ## func = TRUE; \
62 #define CHECK_CALLED(func) \
64 ok(called_ ## func, "expected " #func "\n"); \
65 expect_ ## func = called_ ## func = FALSE; \
68 DEFINE_EXPECT(CombineUrl);
69 DEFINE_EXPECT(ParseUrl);
71 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
72 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
73 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
74 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
75 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
76 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
77 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
78 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
79 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
81 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
82 '.','o','r','g','/',0};
83 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
84 '.','o','r','g','/','#','F','r','a','g',0};
86 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
87 'e','s','t','i','n','g',0};
88 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
89 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
91 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
93 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
94 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
96 static PARSEACTION parse_action;
97 static DWORD parse_flags;
99 typedef struct _uri_create_flag_test {
102 } uri_create_flag_test;
104 static const uri_create_flag_test invalid_flag_tests[] = {
105 /* Set of invalid flag combinations to test for. */
106 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
107 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
108 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
109 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
110 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
113 typedef struct _uri_str_property {
117 const char* broken_value;
120 typedef struct _uri_dword_property {
124 BOOL broken_combine_hres;
125 } uri_dword_property;
127 typedef struct _uri_properties {
130 HRESULT create_expected;
133 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
134 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
137 static const uri_properties uri_tests[] = {
138 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
140 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
141 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
142 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
143 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
144 {"",S_FALSE,FALSE}, /* EXTENSION */
145 {"",S_FALSE,FALSE}, /* FRAGMENT */
146 {"www.winehq.org",S_OK,FALSE}, /* HOST */
147 {"",S_FALSE,FALSE}, /* PASSWORD */
148 {"/",S_OK,FALSE}, /* PATH */
149 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
150 {"",S_FALSE,FALSE}, /* QUERY */
151 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
152 {"http",S_OK,FALSE}, /* SCHEME_NAME */
153 {"",S_FALSE,FALSE}, /* USER_INFO */
154 {"",S_FALSE,FALSE} /* USER_NAME */
157 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
158 {80,S_OK,FALSE}, /* PORT */
159 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
160 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
163 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
165 {"http://winehq.org/tests",S_OK,FALSE},
166 {"winehq.org",S_OK,FALSE},
167 {"http://winehq.org/tests",S_OK,FALSE},
168 {"winehq.org",S_OK,FALSE},
171 {"winehq.org",S_OK,FALSE},
173 {"/tests",S_OK,FALSE},
174 {"/tests",S_OK,FALSE},
176 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
182 {Uri_HOST_DNS,S_OK,FALSE},
184 {URL_SCHEME_HTTP,S_OK,FALSE},
185 {URLZONE_INVALID,E_NOTIMPL,FALSE}
188 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
190 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
191 {"www.winehq.org",S_OK,FALSE},
192 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
193 {"winehq.org",S_OK,FALSE},
196 {"www.winehq.org",S_OK,FALSE},
199 {"/?query=x&return=y",S_OK,FALSE},
200 {"?query=x&return=y",S_OK,FALSE},
201 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
207 {Uri_HOST_DNS,S_OK,FALSE},
209 {URL_SCHEME_HTTP,S_OK,FALSE},
210 {URLZONE_INVALID,E_NOTIMPL,FALSE},
213 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
215 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
216 {"www.winehq.org",S_OK,FALSE},
217 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
218 {"winehq.org",S_OK,FALSE},
221 {"www.winehq.org",S_OK,FALSE},
224 {"/?query=x&return=y",S_OK,FALSE},
225 {"?query=x&return=y",S_OK,FALSE},
226 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
227 {"https",S_OK,FALSE},
232 {Uri_HOST_DNS,S_OK,FALSE},
234 {URL_SCHEME_HTTPS,S_OK,FALSE},
235 {URLZONE_INVALID,E_NOTIMPL,FALSE},
238 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
240 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
241 {"usEr%3Ainfo@example.com",S_OK,FALSE},
242 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
243 {"example.com",S_OK,FALSE},
246 {"example.com",S_OK,FALSE},
248 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
249 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
251 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
253 {"usEr%3Ainfo",S_OK,FALSE},
254 {"usEr%3Ainfo",S_OK,FALSE}
257 {Uri_HOST_DNS,S_OK,FALSE},
259 {URL_SCHEME_HTTP,S_OK,FALSE},
260 {URLZONE_INVALID,E_NOTIMPL,FALSE},
263 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
265 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
266 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
267 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
268 {"winehq.org",S_OK,FALSE},
271 {"ftp.winehq.org",S_OK,FALSE},
273 {"/dir/foo%20bar.txt",S_OK,FALSE},
274 {"/dir/foo%20bar.txt",S_OK,FALSE},
276 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
278 {"winepass:wine",S_OK,FALSE},
279 {"winepass",S_OK,FALSE}
282 {Uri_HOST_DNS,S_OK,FALSE},
284 {URL_SCHEME_FTP,S_OK,FALSE},
285 {URLZONE_INVALID,E_NOTIMPL,FALSE}
288 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
290 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
292 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
298 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
299 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
301 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
307 {Uri_HOST_UNKNOWN,S_OK,FALSE},
309 {URL_SCHEME_FILE,S_OK,FALSE},
310 {URLZONE_INVALID,E_NOTIMPL,FALSE}
313 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
315 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
317 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
323 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
324 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
326 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
332 {Uri_HOST_UNKNOWN,S_OK,FALSE},
334 {URL_SCHEME_FILE,S_OK,FALSE},
335 {URLZONE_INVALID,E_NOTIMPL,FALSE}
338 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
340 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
342 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
348 {"/tests/test%20file.README.txt",S_OK,FALSE},
349 {"/tests/test%20file.README.txt",S_OK,FALSE},
351 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
357 {Uri_HOST_UNKNOWN,S_OK,FALSE},
359 {URL_SCHEME_FILE,S_OK,FALSE},
360 {URLZONE_INVALID,E_NOTIMPL,FALSE}
363 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
365 {"urn:nothing:should:happen here",S_OK,FALSE},
367 {"urn:nothing:should:happen here",S_OK,FALSE},
373 {"nothing:should:happen here",S_OK,FALSE},
374 {"nothing:should:happen here",S_OK,FALSE},
376 {"urn:nothing:should:happen here",S_OK,FALSE},
382 {Uri_HOST_UNKNOWN,S_OK,FALSE},
384 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
388 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
390 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
391 {"127.0.0.1",S_OK,FALSE},
392 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
396 {"127.0.0.1",S_OK,FALSE},
398 {"/test%20dir/test.txt",S_OK,FALSE},
399 {"/test%20dir/test.txt",S_OK,FALSE},
401 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
407 {Uri_HOST_IPV4,S_OK,FALSE},
409 {URL_SCHEME_HTTP,S_OK,FALSE},
410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
413 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
415 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
416 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
417 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
421 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
426 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
432 {Uri_HOST_IPV6,S_OK,FALSE},
434 {URL_SCHEME_HTTP,S_OK,FALSE},
435 {URLZONE_INVALID,E_NOTIMPL,FALSE}
438 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
440 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
441 {"[::13.1.68.3]",S_OK,FALSE},
442 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
446 {"::13.1.68.3",S_OK,FALSE},
451 {"ftp://[::13.1.68.3]",S_OK,FALSE},
457 {Uri_HOST_IPV6,S_OK,FALSE},
459 {URL_SCHEME_FTP,S_OK,FALSE},
460 {URLZONE_INVALID,E_NOTIMPL,FALSE}
463 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
465 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
466 {"[fedc:ba98::3210]",S_OK,FALSE},
467 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
471 {"fedc:ba98::3210",S_OK,FALSE},
476 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
482 {Uri_HOST_IPV6,S_OK,FALSE},
484 {URL_SCHEME_HTTP,S_OK,FALSE},
485 {URLZONE_INVALID,E_NOTIMPL,FALSE}
488 { "1234://www.winehq.org", 0, S_OK, FALSE,
490 {"1234://www.winehq.org/",S_OK,FALSE},
491 {"www.winehq.org",S_OK,FALSE},
492 {"1234://www.winehq.org/",S_OK,FALSE},
493 {"winehq.org",S_OK,FALSE},
496 {"www.winehq.org",S_OK,FALSE},
501 {"1234://www.winehq.org",S_OK,FALSE},
507 {Uri_HOST_DNS,S_OK,FALSE},
509 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
510 {URLZONE_INVALID,E_NOTIMPL,FALSE}
513 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
514 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
516 {"file:///C:/test/test.mp3",S_OK,FALSE},
518 {"file:///C:/test/test.mp3",S_OK,FALSE},
524 {"/C:/test/test.mp3",S_OK,FALSE},
525 {"/C:/test/test.mp3",S_OK,FALSE},
527 {"C:/test/test.mp3",S_OK,FALSE},
533 {Uri_HOST_UNKNOWN,S_OK,FALSE},
535 {URL_SCHEME_FILE,S_OK,FALSE},
536 {URLZONE_INVALID,E_NOTIMPL,FALSE}
539 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
540 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
542 {"file://server/test.mp3",S_OK,FALSE},
543 {"server",S_OK,FALSE},
544 {"file://server/test.mp3",S_OK,FALSE},
548 {"server",S_OK,FALSE},
550 {"/test.mp3",S_OK,FALSE},
551 {"/test.mp3",S_OK,FALSE},
553 {"\\\\Server/test.mp3",S_OK,FALSE},
559 {Uri_HOST_DNS,S_OK,FALSE},
561 {URL_SCHEME_FILE,S_OK,FALSE},
562 {URLZONE_INVALID,E_NOTIMPL,FALSE}
565 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
567 {"*:www.winehq.org/test",S_OK,FALSE},
568 {"www.winehq.org",S_OK,FALSE},
569 {"*:www.winehq.org/test",S_OK,FALSE},
570 {"winehq.org",S_OK,FALSE},
573 {"www.winehq.org",S_OK,FALSE},
575 {"/test",S_OK,FALSE},
576 {"/test",S_OK,FALSE},
578 {"www.winehq.org/test",S_OK,FALSE},
584 {Uri_HOST_DNS,S_OK,FALSE},
586 {URL_SCHEME_WILDCARD,S_OK,FALSE},
587 {URLZONE_INVALID,E_NOTIMPL,FALSE}
590 /* Valid since the '*' is the only character in the scheme name. */
591 { "*:www.winehq.org/test", 0, S_OK, FALSE,
593 {"*:www.winehq.org/test",S_OK,FALSE},
594 {"www.winehq.org",S_OK,FALSE},
595 {"*:www.winehq.org/test",S_OK,FALSE},
596 {"winehq.org",S_OK,FALSE},
599 {"www.winehq.org",S_OK,FALSE},
601 {"/test",S_OK,FALSE},
602 {"/test",S_OK,FALSE},
604 {"*:www.winehq.org/test",S_OK,FALSE},
610 {Uri_HOST_DNS,S_OK,FALSE},
612 {URL_SCHEME_WILDCARD,S_OK,FALSE},
613 {URLZONE_INVALID,E_NOTIMPL,FALSE}
616 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
618 {"/../some dir/test.ext",S_OK,FALSE},
620 {"/../some dir/test.ext",S_OK,FALSE},
626 {"/../some dir/test.ext",S_OK,FALSE},
627 {"/../some dir/test.ext",S_OK,FALSE},
629 {"/../some dir/test.ext",S_OK,FALSE},
635 {Uri_HOST_UNKNOWN,S_OK,FALSE},
637 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
638 {URLZONE_INVALID,E_NOTIMPL,FALSE}
641 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
643 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
645 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
651 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
652 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
654 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
660 {Uri_HOST_UNKNOWN,S_OK,FALSE},
662 {URL_SCHEME_WILDCARD,S_OK,FALSE},
663 {URLZONE_INVALID,E_NOTIMPL,FALSE}
666 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
667 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
669 {"zip:/.//google.com",S_OK,FALSE},
671 {"zip:/.//google.com",S_OK,FALSE},
677 {"/.//google.com",S_OK,FALSE},
678 {"/.//google.com",S_OK,FALSE},
680 {"zip://google.com",S_OK,FALSE},
686 {Uri_HOST_UNKNOWN,S_OK,FALSE},
688 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
689 {URLZONE_INVALID,E_NOTIMPL,FALSE}
692 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
693 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
695 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
696 {"user:pass:word@winehq.org",S_OK,FALSE},
697 {"ftp://winehq.org/",S_OK,FALSE},
698 {"winehq.org",S_OK,FALSE},
701 {"winehq.org",S_OK,FALSE},
702 {"pass:word",S_OK,FALSE},
706 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
708 {"user:pass:word",S_OK,FALSE},
712 {Uri_HOST_DNS,S_OK,FALSE},
714 {URL_SCHEME_FTP,S_OK,FALSE},
715 {URLZONE_INVALID,E_NOTIMPL,FALSE}
718 /* Make sure % encoded unreserved characters are decoded. */
719 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
721 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
722 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
723 {"ftp://ftp.google.com/",S_OK,FALSE},
724 {"google.com",S_OK,FALSE},
727 {"ftp.google.com",S_OK,FALSE},
732 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
734 {"wINe:PASS",S_OK,FALSE},
738 {Uri_HOST_DNS,S_OK,FALSE},
740 {URL_SCHEME_FTP,S_OK,FALSE},
741 {URLZONE_INVALID,E_NOTIMPL,FALSE}
744 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
745 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
747 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
748 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
749 {"ftp://ftp.google.com/",S_OK,FALSE},
750 {"google.com",S_OK,FALSE},
753 {"ftp.google.com",S_OK,FALSE},
754 {"PA%7B%7D",S_OK,FALSE},
758 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
760 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
761 {"w%5D%5Be",S_OK,FALSE}
764 {Uri_HOST_DNS,S_OK,FALSE},
766 {URL_SCHEME_FTP,S_OK,FALSE},
767 {URLZONE_INVALID,E_NOTIMPL,FALSE}
770 /* You're allowed to have an empty password portion in the userinfo section. */
771 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
773 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
774 {"empty:@ftp.google.com",S_OK,FALSE},
775 {"ftp://ftp.google.com/",S_OK,FALSE},
776 {"google.com",S_OK,FALSE},
779 {"ftp.google.com",S_OK,FALSE},
784 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
786 {"empty:",S_OK,FALSE},
790 {Uri_HOST_DNS,S_OK,FALSE},
792 {URL_SCHEME_FTP,S_OK,FALSE},
793 {URLZONE_INVALID,E_NOTIMPL,FALSE}
796 /* Make sure forbidden characters in "userinfo" get encoded. */
797 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
799 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
800 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
801 {"ftp://ftp.google.com/",S_OK,FALSE},
802 {"google.com",S_OK,FALSE},
805 {"ftp.google.com",S_OK,FALSE},
810 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
812 {"%22%20%22weird",S_OK,FALSE},
813 {"%22%20%22weird",S_OK,FALSE}
816 {Uri_HOST_DNS,S_OK,FALSE},
818 {URL_SCHEME_FTP,S_OK,FALSE},
819 {URLZONE_INVALID,E_NOTIMPL,FALSE}
822 /* Make sure the forbidden characters don't get percent encoded. */
823 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
825 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
826 {"\" \"weird@ftp.google.com",S_OK,FALSE},
827 {"ftp://ftp.google.com/",S_OK,FALSE},
828 {"google.com",S_OK,FALSE},
831 {"ftp.google.com",S_OK,FALSE},
836 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
838 {"\" \"weird",S_OK,FALSE},
839 {"\" \"weird",S_OK,FALSE}
842 {Uri_HOST_DNS,S_OK,FALSE},
844 {URL_SCHEME_FTP,S_OK,FALSE},
845 {URLZONE_INVALID,E_NOTIMPL,FALSE}
848 /* Make sure already percent encoded characters don't get unencoded. */
849 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
851 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
852 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
853 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
854 {"google.com",S_OK,FALSE},
857 {"ftp.google.com",S_OK,FALSE},
859 {"/\"%20\"weird",S_OK,FALSE},
860 {"/\"%20\"weird",S_OK,FALSE},
862 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
864 {"\"%20\"weird",S_OK,FALSE},
865 {"\"%20\"weird",S_OK,FALSE}
868 {Uri_HOST_DNS,S_OK,FALSE},
870 {URL_SCHEME_FTP,S_OK,FALSE},
871 {URLZONE_INVALID,E_NOTIMPL,FALSE}
874 /* Allowed to have invalid % encoded because its an unknown scheme type. */
875 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
877 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
878 {"%xy:word@winehq.org",S_OK,FALSE},
879 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
880 {"winehq.org",S_OK,FALSE},
883 {"winehq.org",S_OK,FALSE},
888 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
890 {"%xy:word",S_OK,FALSE},
894 {Uri_HOST_DNS,S_OK,FALSE},
896 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
897 {URLZONE_INVALID,E_NOTIMPL,FALSE}
900 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
903 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
905 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
906 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
907 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
908 {"winehq.org",S_OK,FALSE},
911 {"winehq.org",S_OK,FALSE},
912 {"%52%53ord",S_OK,FALSE},
916 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
918 {"%2E:%52%53ord",S_OK,FALSE},
922 {Uri_HOST_DNS,S_OK,FALSE},
924 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
925 {URLZONE_INVALID,E_NOTIMPL,FALSE}
928 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
930 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
931 {"[](),'test':word@winehq.org",S_OK,FALSE},
932 {"ftp://winehq.org/",S_OK,FALSE},
933 {"winehq.org",S_OK,FALSE},
936 {"winehq.org",S_OK,FALSE},
941 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
943 {"[](),'test':word",S_OK,FALSE},
944 {"[](),'test'",S_OK,FALSE}
947 {Uri_HOST_DNS,S_OK,FALSE},
949 {URL_SCHEME_FTP,S_OK,FALSE},
950 {URLZONE_INVALID,E_NOTIMPL,FALSE}
953 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
955 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
957 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
964 {"/?:word@winehq.org/",S_OK,FALSE},
965 {"?:word@winehq.org/",S_OK,FALSE},
966 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
972 {Uri_HOST_DNS,S_OK,FALSE},
974 {URL_SCHEME_FTP,S_OK,FALSE},
975 {URLZONE_INVALID,E_NOTIMPL,FALSE}
978 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
980 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
982 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
985 {"#:word@winehq.org/",S_OK,FALSE},
991 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
997 {Uri_HOST_DNS,S_OK,FALSE},
999 {URL_SCHEME_FTP,S_OK,FALSE},
1000 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1003 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1004 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1006 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1007 {"test\\:word@winehq.org",S_OK,FALSE},
1008 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1009 {"winehq.org",S_OK,FALSE},
1012 {"winehq.org",S_OK,FALSE},
1013 {"word",S_OK,FALSE},
1017 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1019 {"test\\:word",S_OK,FALSE},
1020 {"test\\",S_OK,FALSE}
1023 {Uri_HOST_DNS,S_OK,FALSE},
1025 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1026 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1029 /* It normalizes IPv4 addresses correctly. */
1030 { "http://127.000.000.100/", 0, S_OK, FALSE,
1032 {"http://127.0.0.100/",S_OK,FALSE},
1033 {"127.0.0.100",S_OK,FALSE},
1034 {"http://127.0.0.100/",S_OK,FALSE},
1038 {"127.0.0.100",S_OK,FALSE},
1043 {"http://127.000.000.100/",S_OK,FALSE},
1044 {"http",S_OK,FALSE},
1049 {Uri_HOST_IPV4,S_OK,FALSE},
1051 {URL_SCHEME_HTTP,S_OK,FALSE},
1052 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1055 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1057 {"http://127.0.0.1:8000/",S_OK},
1058 {"127.0.0.1:8000",S_OK},
1059 {"http://127.0.0.1:8000/",S_OK},
1068 {"http://127.0.0.1:8000",S_OK},
1074 {Uri_HOST_IPV4,S_OK,FALSE},
1076 {URL_SCHEME_HTTP,S_OK,FALSE},
1077 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1080 /* Make sure it normalizes partial IPv4 addresses correctly. */
1081 { "http://127.0/", 0, S_OK, FALSE,
1083 {"http://127.0.0.0/",S_OK,FALSE},
1084 {"127.0.0.0",S_OK,FALSE},
1085 {"http://127.0.0.0/",S_OK,FALSE},
1089 {"127.0.0.0",S_OK,FALSE},
1094 {"http://127.0/",S_OK,FALSE},
1095 {"http",S_OK,FALSE},
1100 {Uri_HOST_IPV4,S_OK,FALSE},
1102 {URL_SCHEME_HTTP,S_OK,FALSE},
1103 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1106 /* Make sure it converts implicit IPv4's correctly. */
1107 { "http://123456/", 0, S_OK, FALSE,
1109 {"http://0.1.226.64/",S_OK,FALSE},
1110 {"0.1.226.64",S_OK,FALSE},
1111 {"http://0.1.226.64/",S_OK,FALSE},
1115 {"0.1.226.64",S_OK,FALSE},
1120 {"http://123456/",S_OK,FALSE},
1121 {"http",S_OK,FALSE},
1126 {Uri_HOST_IPV4,S_OK,FALSE},
1128 {URL_SCHEME_HTTP,S_OK,FALSE},
1129 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1133 { "http://4294967295/", 0, S_OK, FALSE,
1135 {"http://255.255.255.255/",S_OK,FALSE},
1136 {"255.255.255.255",S_OK,FALSE},
1137 {"http://255.255.255.255/",S_OK,FALSE},
1141 {"255.255.255.255",S_OK,FALSE},
1146 {"http://4294967295/",S_OK,FALSE},
1147 {"http",S_OK,FALSE},
1152 {Uri_HOST_IPV4,S_OK,FALSE},
1154 {URL_SCHEME_HTTP,S_OK,FALSE},
1155 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1159 { "http://4294967296/", 0, S_OK, FALSE,
1161 {"http://4294967296/",S_OK,FALSE},
1162 {"4294967296",S_OK,FALSE},
1163 {"http://4294967296/",S_OK,FALSE},
1167 {"4294967296",S_OK,FALSE},
1172 {"http://4294967296/",S_OK,FALSE},
1173 {"http",S_OK,FALSE},
1178 {Uri_HOST_DNS,S_OK,FALSE},
1180 {URL_SCHEME_HTTP,S_OK,FALSE},
1181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1184 /* Window's doesn't normalize IP address for unknown schemes. */
1185 { "1234://4294967295/", 0, S_OK, FALSE,
1187 {"1234://4294967295/",S_OK,FALSE},
1188 {"4294967295",S_OK,FALSE},
1189 {"1234://4294967295/",S_OK,FALSE},
1193 {"4294967295",S_OK,FALSE},
1198 {"1234://4294967295/",S_OK,FALSE},
1199 {"1234",S_OK,FALSE},
1204 {Uri_HOST_IPV4,S_OK,FALSE},
1206 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1207 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1210 /* Window's doesn't normalize IP address for unknown schemes. */
1211 { "1234://127.001/", 0, S_OK, FALSE,
1213 {"1234://127.001/",S_OK,FALSE},
1214 {"127.001",S_OK,FALSE},
1215 {"1234://127.001/",S_OK,FALSE},
1219 {"127.001",S_OK,FALSE},
1224 {"1234://127.001/",S_OK,FALSE},
1225 {"1234",S_OK,FALSE},
1230 {Uri_HOST_IPV4,S_OK,FALSE},
1232 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1233 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1236 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1238 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1239 {"[fedc:ba98::3210]",S_OK,FALSE},
1240 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1244 {"fedc:ba98::3210",S_OK,FALSE},
1249 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1250 {"http",S_OK,FALSE},
1255 {Uri_HOST_IPV6,S_OK,FALSE},
1257 {URL_SCHEME_HTTP,S_OK,FALSE},
1258 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1261 { "http://[::]", 0, S_OK, FALSE,
1263 {"http://[::]/",S_OK,FALSE},
1264 {"[::]",S_OK,FALSE},
1265 {"http://[::]/",S_OK,FALSE},
1274 {"http://[::]",S_OK,FALSE},
1275 {"http",S_OK,FALSE},
1280 {Uri_HOST_IPV6,S_OK,FALSE},
1282 {URL_SCHEME_HTTP,S_OK,FALSE},
1283 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1286 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1288 {"http://[fedc:ba98::]/",S_OK,FALSE},
1289 {"[fedc:ba98::]",S_OK,FALSE},
1290 {"http://[fedc:ba98::]/",S_OK,FALSE},
1294 {"fedc:ba98::",S_OK,FALSE},
1299 {"http://[FEDC:BA98::]",S_OK,FALSE},
1300 {"http",S_OK,FALSE},
1305 {Uri_HOST_IPV6,S_OK,FALSE},
1307 {URL_SCHEME_HTTP,S_OK,FALSE},
1308 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1311 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1312 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1314 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1315 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1316 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1320 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1325 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1326 {"http",S_OK,FALSE},
1331 {Uri_HOST_IPV6,S_OK,FALSE},
1333 {URL_SCHEME_HTTP,S_OK,FALSE},
1334 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1337 { "http://[v2.34]/", 0, S_OK, FALSE,
1339 {"http://[v2.34]/",S_OK,FALSE},
1340 {"[v2.34]",S_OK,FALSE},
1341 {"http://[v2.34]/",S_OK,FALSE},
1345 {"[v2.34]",S_OK,FALSE},
1350 {"http://[v2.34]/",S_OK,FALSE},
1351 {"http",S_OK,FALSE},
1356 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1358 {URL_SCHEME_HTTP,S_OK,FALSE},
1359 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1362 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1363 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1365 {"http://[xyz:12345.com/test",S_OK,FALSE},
1366 {"[xyz:12345.com",S_OK,FALSE},
1367 {"http://[xyz:12345.com/test",S_OK,FALSE},
1368 {"[xyz:12345.com",S_OK,FALSE},
1371 {"[xyz:12345.com",S_OK,FALSE},
1373 {"/test",S_OK,FALSE},
1374 {"/test",S_OK,FALSE},
1376 {"http://[xyz:12345.com/test",S_OK,FALSE},
1377 {"http",S_OK,FALSE},
1382 {Uri_HOST_DNS,S_OK,FALSE},
1384 {URL_SCHEME_HTTP,S_OK,FALSE},
1385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1388 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1389 * of the host name (respectively).
1391 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1393 {"ftp://www.[works].com/",S_OK,FALSE},
1394 {"www.[works].com",S_OK,FALSE},
1395 {"ftp://www.[works].com/",S_OK,FALSE},
1396 {"[works].com",S_OK,FALSE},
1399 {"www.[works].com",S_OK,FALSE},
1404 {"ftp://www.[works].com/",S_OK,FALSE},
1410 {Uri_HOST_DNS,S_OK,FALSE},
1412 {URL_SCHEME_FTP,S_OK,FALSE},
1413 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1416 /* Considers ':' a delimiter since it appears after the ']'. */
1417 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1419 {"http://www.google.com]:12345/",S_OK,FALSE},
1420 {"www.google.com]:12345",S_OK,FALSE},
1421 {"http://www.google.com]:12345/",S_OK,FALSE},
1422 {"google.com]",S_OK,FALSE},
1425 {"www.google.com]",S_OK,FALSE},
1430 {"http://www.google.com]:12345/",S_OK,FALSE},
1431 {"http",S_OK,FALSE},
1436 {Uri_HOST_DNS,S_OK,FALSE},
1438 {URL_SCHEME_HTTP,S_OK,FALSE},
1439 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1442 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1443 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1445 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1446 {"w%XXw%GEw.google.com",S_OK,FALSE},
1447 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1448 {"google.com",S_OK,FALSE},
1451 {"w%XXw%GEw.google.com",S_OK,FALSE},
1456 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1462 {Uri_HOST_DNS,S_OK,FALSE},
1464 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1465 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1468 /* Unknown scheme types hostname doesn't get lower cased. */
1469 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1471 {"zip://GOOGLE.com/",S_OK,FALSE},
1472 {"GOOGLE.com",S_OK,FALSE},
1473 {"zip://GOOGLE.com/",S_OK,FALSE},
1474 {"GOOGLE.com",S_OK,FALSE},
1477 {"GOOGLE.com",S_OK,FALSE},
1482 {"zip://GOOGLE.com/",S_OK,FALSE},
1488 {Uri_HOST_DNS,S_OK,FALSE},
1490 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1491 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1494 /* Hostname gets lower-cased for known scheme types. */
1495 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1497 {"http://www.google.com/",S_OK,FALSE},
1498 {"www.google.com",S_OK,FALSE},
1499 {"http://www.google.com/",S_OK,FALSE},
1500 {"google.com",S_OK,FALSE},
1503 {"www.google.com",S_OK,FALSE},
1508 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1509 {"http",S_OK,FALSE},
1514 {Uri_HOST_DNS,S_OK,FALSE},
1516 {URL_SCHEME_HTTP,S_OK,FALSE},
1517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1520 /* Characters that get % encoded in the hostname also have their percent
1521 * encoded forms lower cased.
1523 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1525 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1526 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1527 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1528 {"%7cgoogle%7c.com",S_OK,FALSE},
1531 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1536 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1537 {"http",S_OK,FALSE},
1542 {Uri_HOST_DNS,S_OK,FALSE},
1544 {URL_SCHEME_HTTP,S_OK,FALSE},
1545 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1548 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1549 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1551 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1552 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1553 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1557 {"1:2:3:4:5:6::",S_OK,FALSE},
1562 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1563 {"http",S_OK,FALSE},
1568 {Uri_HOST_IPV6,S_OK,FALSE},
1570 {URL_SCHEME_HTTP,S_OK,FALSE},
1571 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1574 /* IPv4 addresses get normalized. */
1575 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1577 {"http://[::1.2.3.0]/",S_OK,FALSE},
1578 {"[::1.2.3.0]",S_OK,FALSE},
1579 {"http://[::1.2.3.0]/",S_OK,FALSE},
1583 {"::1.2.3.0",S_OK,FALSE},
1588 {"http://[::001.002.003.000]",S_OK,FALSE},
1589 {"http",S_OK,FALSE},
1594 {Uri_HOST_IPV6,S_OK,FALSE},
1596 {URL_SCHEME_HTTP,S_OK,FALSE},
1597 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1600 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1601 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1603 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1604 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1605 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1609 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1614 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1620 {Uri_HOST_IPV6,S_OK,FALSE},
1622 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1623 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1626 /* IPv4 address is converted into 2 h16 components. */
1627 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1629 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1630 {"[ffff::c0de:6f20]",S_OK,FALSE},
1631 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1635 {"ffff::c0de:6f20",S_OK,FALSE},
1640 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1641 {"http",S_OK,FALSE},
1646 {Uri_HOST_IPV6,S_OK,FALSE},
1648 {URL_SCHEME_HTTP,S_OK,FALSE},
1649 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1652 /* Max value for a port. */
1653 { "http://google.com:65535", 0, S_OK, FALSE,
1655 {"http://google.com:65535/",S_OK,FALSE},
1656 {"google.com:65535",S_OK,FALSE},
1657 {"http://google.com:65535/",S_OK,FALSE},
1658 {"google.com",S_OK,FALSE},
1661 {"google.com",S_OK,FALSE},
1666 {"http://google.com:65535",S_OK,FALSE},
1667 {"http",S_OK,FALSE},
1672 {Uri_HOST_DNS,S_OK,FALSE},
1674 {URL_SCHEME_HTTP,S_OK,FALSE},
1675 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1678 { "zip://google.com:65536", 0, S_OK, FALSE,
1680 {"zip://google.com:65536/",S_OK,FALSE},
1681 {"google.com:65536",S_OK,FALSE},
1682 {"zip://google.com:65536/",S_OK,FALSE},
1683 {"google.com:65536",S_OK,FALSE},
1686 {"google.com:65536",S_OK,FALSE},
1691 {"zip://google.com:65536",S_OK,FALSE},
1697 {Uri_HOST_DNS,S_OK,FALSE},
1699 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1700 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1703 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1705 {"zip://google.com:65536:25/",S_OK,FALSE},
1706 {"google.com:65536:25",S_OK,FALSE},
1707 {"zip://google.com:65536:25/",S_OK,FALSE},
1708 {"google.com:65536:25",S_OK,FALSE},
1711 {"google.com:65536:25",S_OK,FALSE},
1716 {"zip://google.com:65536:25",S_OK,FALSE},
1722 {Uri_HOST_DNS,S_OK,FALSE},
1724 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1725 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1728 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1730 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1731 {"[::ffff]:abcd",S_OK,FALSE},
1732 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1736 {"[::ffff]:abcd",S_OK,FALSE},
1741 {"zip://[::ffff]:abcd",S_OK,FALSE},
1747 {Uri_HOST_DNS,S_OK,FALSE},
1749 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1750 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1753 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1755 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1756 {"127.0.0.1:abcd",S_OK,FALSE},
1757 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1758 {"0.1:abcd",S_OK,FALSE},
1761 {"127.0.0.1:abcd",S_OK,FALSE},
1766 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1772 {Uri_HOST_DNS,S_OK,FALSE},
1774 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1775 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1778 /* Port is just copied over. */
1779 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1781 {"http://google.com:00035",S_OK,FALSE},
1782 {"google.com:00035",S_OK,FALSE},
1783 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1784 {"google.com",S_OK,FALSE},
1787 {"google.com",S_OK,FALSE},
1792 {"http://google.com:00035",S_OK,FALSE},
1793 {"http",S_OK,FALSE},
1798 {Uri_HOST_DNS,S_OK,FALSE},
1800 {URL_SCHEME_HTTP,S_OK,FALSE},
1801 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1804 /* Default port is copied over. */
1805 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1807 {"http://google.com:80",S_OK,FALSE},
1808 {"google.com:80",S_OK,FALSE},
1809 {"http://google.com:80",S_OK,FALSE},
1810 {"google.com",S_OK,FALSE},
1813 {"google.com",S_OK,FALSE},
1818 {"http://google.com:80",S_OK,FALSE},
1819 {"http",S_OK,FALSE},
1824 {Uri_HOST_DNS,S_OK,FALSE},
1826 {URL_SCHEME_HTTP,S_OK,FALSE},
1827 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1830 { "http://google.com.uk", 0, S_OK, FALSE,
1832 {"http://google.com.uk/",S_OK,FALSE},
1833 {"google.com.uk",S_OK,FALSE},
1834 {"http://google.com.uk/",S_OK,FALSE},
1835 {"google.com.uk",S_OK,FALSE},
1838 {"google.com.uk",S_OK,FALSE},
1843 {"http://google.com.uk",S_OK,FALSE},
1844 {"http",S_OK,FALSE},
1849 {Uri_HOST_DNS,S_OK,FALSE},
1851 {URL_SCHEME_HTTP,S_OK,FALSE},
1852 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1855 { "http://google.com.com", 0, S_OK, FALSE,
1857 {"http://google.com.com/",S_OK,FALSE},
1858 {"google.com.com",S_OK,FALSE},
1859 {"http://google.com.com/",S_OK,FALSE},
1860 {"com.com",S_OK,FALSE},
1863 {"google.com.com",S_OK,FALSE},
1868 {"http://google.com.com",S_OK,FALSE},
1869 {"http",S_OK,FALSE},
1874 {Uri_HOST_DNS,S_OK,FALSE},
1876 {URL_SCHEME_HTTP,S_OK,FALSE},
1877 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1880 { "http://google.uk.1", 0, S_OK, FALSE,
1882 {"http://google.uk.1/",S_OK,FALSE},
1883 {"google.uk.1",S_OK,FALSE},
1884 {"http://google.uk.1/",S_OK,FALSE},
1885 {"google.uk.1",S_OK,FALSE},
1888 {"google.uk.1",S_OK,FALSE},
1893 {"http://google.uk.1",S_OK,FALSE},
1894 {"http",S_OK,FALSE},
1899 {Uri_HOST_DNS,S_OK,FALSE},
1901 {URL_SCHEME_HTTP,S_OK,FALSE},
1902 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1905 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1906 { "http://google.foo.uk", 0, S_OK, FALSE,
1908 {"http://google.foo.uk/",S_OK,FALSE},
1909 {"google.foo.uk",S_OK,FALSE},
1910 {"http://google.foo.uk/",S_OK,FALSE},
1911 {"foo.uk",S_OK,FALSE},
1914 {"google.foo.uk",S_OK,FALSE},
1919 {"http://google.foo.uk",S_OK,FALSE},
1920 {"http",S_OK,FALSE},
1925 {Uri_HOST_DNS,S_OK,FALSE},
1927 {URL_SCHEME_HTTP,S_OK,FALSE},
1928 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1931 { "http://.com", 0, S_OK, FALSE,
1933 {"http://.com/",S_OK,FALSE},
1934 {".com",S_OK,FALSE},
1935 {"http://.com/",S_OK,FALSE},
1936 {".com",S_OK,FALSE},
1939 {".com",S_OK,FALSE},
1944 {"http://.com",S_OK,FALSE},
1945 {"http",S_OK,FALSE},
1950 {Uri_HOST_DNS,S_OK,FALSE},
1952 {URL_SCHEME_HTTP,S_OK,FALSE},
1953 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1956 { "http://.uk", 0, S_OK, FALSE,
1958 {"http://.uk/",S_OK,FALSE},
1960 {"http://.uk/",S_OK,FALSE},
1969 {"http://.uk",S_OK,FALSE},
1970 {"http",S_OK,FALSE},
1975 {Uri_HOST_DNS,S_OK,FALSE},
1977 {URL_SCHEME_HTTP,S_OK,FALSE},
1978 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1981 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
1983 {"http://www.co.google.com.[]/",S_OK,FALSE},
1984 {"www.co.google.com.[]",S_OK,FALSE},
1985 {"http://www.co.google.com.[]/",S_OK,FALSE},
1986 {"google.com.[]",S_OK,FALSE},
1989 {"www.co.google.com.[]",S_OK,FALSE},
1994 {"http://www.co.google.com.[]",S_OK,FALSE},
1995 {"http",S_OK,FALSE},
2000 {Uri_HOST_DNS,S_OK,FALSE},
2002 {URL_SCHEME_HTTP,S_OK,FALSE},
2003 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2006 { "http://co.uk", 0, S_OK, FALSE,
2008 {"http://co.uk/",S_OK,FALSE},
2009 {"co.uk",S_OK,FALSE},
2010 {"http://co.uk/",S_OK,FALSE},
2014 {"co.uk",S_OK,FALSE},
2019 {"http://co.uk",S_OK,FALSE},
2020 {"http",S_OK,FALSE},
2025 {Uri_HOST_DNS,S_OK,FALSE},
2027 {URL_SCHEME_HTTP,S_OK,FALSE},
2028 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2031 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2033 {"http://www.co.google.us.test/",S_OK,FALSE},
2034 {"www.co.google.us.test",S_OK,FALSE},
2035 {"http://www.co.google.us.test/",S_OK,FALSE},
2036 {"us.test",S_OK,FALSE},
2039 {"www.co.google.us.test",S_OK,FALSE},
2044 {"http://www.co.google.us.test",S_OK,FALSE},
2045 {"http",S_OK,FALSE},
2050 {Uri_HOST_DNS,S_OK,FALSE},
2052 {URL_SCHEME_HTTP,S_OK,FALSE},
2053 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2056 { "http://gov.uk", 0, S_OK, FALSE,
2058 {"http://gov.uk/",S_OK,FALSE},
2059 {"gov.uk",S_OK,FALSE},
2060 {"http://gov.uk/",S_OK,FALSE},
2064 {"gov.uk",S_OK,FALSE},
2069 {"http://gov.uk",S_OK,FALSE},
2070 {"http",S_OK,FALSE},
2075 {Uri_HOST_DNS,S_OK,FALSE},
2077 {URL_SCHEME_HTTP,S_OK,FALSE},
2078 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2081 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2083 {"zip://www.google.com\\test",S_OK,FALSE},
2084 {"www.google.com\\test",S_OK,FALSE},
2085 {"zip://www.google.com\\test",S_OK,FALSE},
2086 {"google.com\\test",S_OK,FALSE},
2089 {"www.google.com\\test",S_OK,FALSE},
2094 {"zip://www.google.com\\test",S_OK,FALSE},
2100 {Uri_HOST_DNS,S_OK,FALSE},
2102 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2103 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2106 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2108 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2110 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2116 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2117 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2119 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2125 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2127 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2128 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2131 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2132 * are decoded and all '%' are encoded.
2134 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2136 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2138 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2140 {".mp3",S_OK,FALSE},
2144 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2145 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2147 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2148 {"file",S_OK,FALSE},
2153 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2155 {URL_SCHEME_FILE,S_OK,FALSE},
2156 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2159 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2160 * is decoded and only %'s in front of invalid hex digits are encoded.
2162 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2164 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2166 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2168 {".mp3",S_OK,FALSE},
2172 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2173 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2175 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2176 {"file",S_OK,FALSE},
2181 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2183 {URL_SCHEME_FILE,S_OK,FALSE},
2184 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2187 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2188 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2190 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2191 {"[::1.2.3.0]",S_OK,FALSE},
2192 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2196 {"::1.2.3.0",S_OK,FALSE},
2198 {"/%3F%23.T/test",S_OK,FALSE},
2199 {"/%3F%23.T/test",S_OK,FALSE},
2201 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2202 {"http",S_OK,FALSE},
2207 {Uri_HOST_IPV6,S_OK,FALSE},
2209 {URL_SCHEME_HTTP,S_OK,FALSE},
2210 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2213 /* Forbidden characters are always encoded for file URIs. */
2214 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2216 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2218 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2220 {".mp3",S_OK,FALSE},
2224 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2225 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2227 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2228 {"file",S_OK,FALSE},
2233 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2235 {URL_SCHEME_FILE,S_OK,FALSE},
2236 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2239 /* Forbidden characters are never encoded for unknown scheme types. */
2240 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2242 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2243 {"4294967295",S_OK,FALSE},
2244 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2248 {"4294967295",S_OK,FALSE},
2250 {"/<|>\" test<|>",S_OK,FALSE},
2251 {"/<|>\" test<|>",S_OK,FALSE},
2253 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2254 {"1234",S_OK,FALSE},
2259 {Uri_HOST_IPV4,S_OK,FALSE},
2261 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2262 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2265 /* Make sure forbidden characters are percent encoded. */
2266 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2268 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2269 {"gov.uk",S_OK,FALSE},
2270 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2274 {"gov.uk",S_OK,FALSE},
2276 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2277 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2279 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2280 {"http",S_OK,FALSE},
2285 {Uri_HOST_DNS,S_OK,FALSE},
2287 {URL_SCHEME_HTTP,S_OK,FALSE},
2288 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2291 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2293 {"http://gov.uk/",S_OK,FALSE},
2294 {"gov.uk",S_OK,FALSE},
2295 {"http://gov.uk/",S_OK,FALSE},
2299 {"gov.uk",S_OK,FALSE},
2304 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2305 {"http",S_OK,FALSE},
2310 {Uri_HOST_DNS,S_OK,FALSE},
2312 {URL_SCHEME_HTTP,S_OK,FALSE},
2313 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2316 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2318 {"http://gov.uk/",S_OK,FALSE},
2319 {"gov.uk",S_OK,FALSE},
2320 {"http://gov.uk/",S_OK,FALSE},
2324 {"gov.uk",S_OK,FALSE},
2329 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2330 {"http",S_OK,FALSE},
2335 {Uri_HOST_DNS,S_OK,FALSE},
2337 {URL_SCHEME_HTTP,S_OK,FALSE},
2338 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2341 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2343 {"http://gov.uk/",S_OK,FALSE},
2344 {"gov.uk",S_OK,FALSE},
2345 {"http://gov.uk/",S_OK,FALSE},
2349 {"gov.uk",S_OK,FALSE},
2354 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2355 {"http",S_OK,FALSE},
2360 {Uri_HOST_DNS,S_OK,FALSE},
2362 {URL_SCHEME_HTTP,S_OK,FALSE},
2363 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2366 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2368 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2370 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2372 {".mp3",S_OK,FALSE},
2376 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2377 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2379 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2380 {"file",S_OK,FALSE},
2385 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2387 {URL_SCHEME_FILE,S_OK,FALSE},
2388 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2391 /* Dot removal happens for unknown scheme types. */
2392 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2394 {"zip://gov.uk/",S_OK,FALSE},
2395 {"gov.uk",S_OK,FALSE},
2396 {"zip://gov.uk/",S_OK,FALSE},
2400 {"gov.uk",S_OK,FALSE},
2405 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2411 {Uri_HOST_DNS,S_OK,FALSE},
2413 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2414 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2417 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2418 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2420 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2421 {"gov.uk",S_OK,FALSE},
2422 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2426 {"gov.uk",S_OK,FALSE},
2428 {"/test/test2/../../.",S_OK,FALSE},
2429 {"/test/test2/../../.",S_OK,FALSE},
2431 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2432 {"http",S_OK,FALSE},
2437 {Uri_HOST_DNS,S_OK,FALSE},
2439 {URL_SCHEME_HTTP,S_OK,FALSE},
2440 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2443 /* Dot removal doesn't happen for wildcard scheme types. */
2444 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2446 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2447 {"gov.uk",S_OK,FALSE},
2448 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2452 {"gov.uk",S_OK,FALSE},
2454 {"/test/test2/../../.",S_OK,FALSE},
2455 {"/test/test2/../../.",S_OK,FALSE},
2457 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2463 {Uri_HOST_DNS,S_OK,FALSE},
2465 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2466 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2469 /* Forbidden characters are encoded for opaque known scheme types. */
2470 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2472 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2474 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2476 {".com%22",S_OK,FALSE},
2480 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2481 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2483 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2484 {"mailto",S_OK,FALSE},
2489 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2491 {URL_SCHEME_MAILTO,S_OK,FALSE},
2492 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2495 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2497 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2499 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2501 {".com",S_OK,FALSE},
2505 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2506 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2508 {"news:test.tes<|>t.com",S_OK,FALSE},
2509 {"news",S_OK,FALSE},
2514 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2516 {URL_SCHEME_NEWS,S_OK,FALSE},
2517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2520 /* Don't encode forbidden characters. */
2521 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2523 {"news:test.tes<|>t.com",S_OK,FALSE},
2525 {"news:test.tes<|>t.com",S_OK,FALSE},
2527 {".com",S_OK,FALSE},
2531 {"test.tes<|>t.com",S_OK,FALSE},
2532 {"test.tes<|>t.com",S_OK,FALSE},
2534 {"news:test.tes<|>t.com",S_OK,FALSE},
2535 {"news",S_OK,FALSE},
2540 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2542 {URL_SCHEME_NEWS,S_OK,FALSE},
2543 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2546 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2547 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2549 {"urn:test.tes<|>t.com",S_OK,FALSE},
2551 {"urn:test.tes<|>t.com",S_OK,FALSE},
2553 {".com",S_OK,FALSE},
2557 {"test.tes<|>t.com",S_OK,FALSE},
2558 {"test.tes<|>t.com",S_OK,FALSE},
2560 {"urn:test.tes<|>t.com",S_OK,FALSE},
2566 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2568 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2569 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2572 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2573 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2575 {"news:test.test.com",S_OK,FALSE},
2577 {"news:test.test.com",S_OK,FALSE},
2579 {".com",S_OK,FALSE},
2583 {"test.test.com",S_OK,FALSE},
2584 {"test.test.com",S_OK,FALSE},
2586 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2587 {"news",S_OK,FALSE},
2592 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2594 {URL_SCHEME_NEWS,S_OK,FALSE},
2595 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2598 /* Percent encoded characters are still decoded for known scheme types. */
2599 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2601 {"news:test.test.com",S_OK,FALSE},
2603 {"news:test.test.com",S_OK,FALSE},
2605 {".com",S_OK,FALSE},
2609 {"test.test.com",S_OK,FALSE},
2610 {"test.test.com",S_OK,FALSE},
2612 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2613 {"news",S_OK,FALSE},
2618 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2620 {URL_SCHEME_NEWS,S_OK,FALSE},
2621 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2624 /* Percent encoded characters aren't decoded for unknown scheme types. */
2625 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2627 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2629 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2631 {".com",S_OK,FALSE},
2635 {"test.%74%65%73%74.com",S_OK,FALSE},
2636 {"test.%74%65%73%74.com",S_OK,FALSE},
2638 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2644 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2646 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2647 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2650 /* Unknown scheme types can have invalid % encoded data in query string. */
2651 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2653 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2654 {"www.winehq.org",S_OK,FALSE},
2655 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2656 {"winehq.org",S_OK,FALSE},
2659 {"www.winehq.org",S_OK,FALSE},
2662 {"/?query=%xx&return=y",S_OK,FALSE},
2663 {"?query=%xx&return=y",S_OK,FALSE},
2664 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2670 {Uri_HOST_DNS,S_OK,FALSE},
2672 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2673 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2676 /* Known scheme types can have invalid % encoded data with the right flags. */
2677 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2679 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2680 {"www.winehq.org",S_OK,FALSE},
2681 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2682 {"winehq.org",S_OK,FALSE},
2685 {"www.winehq.org",S_OK,FALSE},
2688 {"/?query=%xx&return=y",S_OK,FALSE},
2689 {"?query=%xx&return=y",S_OK,FALSE},
2690 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2691 {"http",S_OK,FALSE},
2696 {Uri_HOST_DNS,S_OK,FALSE},
2698 {URL_SCHEME_HTTP,S_OK,FALSE},
2699 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2702 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2703 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2705 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2706 {"www.winehq.org",S_OK,FALSE},
2707 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2708 {"winehq.org",S_OK,FALSE},
2711 {"www.winehq.org",S_OK,FALSE},
2714 {"/?query=<|>&return=y",S_OK,FALSE},
2715 {"?query=<|>&return=y",S_OK,FALSE},
2716 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2717 {"http",S_OK,FALSE},
2722 {Uri_HOST_DNS,S_OK,FALSE},
2724 {URL_SCHEME_HTTP,S_OK,FALSE},
2725 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2728 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2729 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2731 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2732 {"www.winehq.org",S_OK,FALSE},
2733 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2734 {"winehq.org",S_OK,FALSE},
2737 {"www.winehq.org",S_OK,FALSE},
2740 {"/?query=<|>&return=y",S_OK,FALSE},
2741 {"?query=<|>&return=y",S_OK,FALSE},
2742 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2743 {"http",S_OK,FALSE},
2748 {Uri_HOST_DNS,S_OK,FALSE},
2750 {URL_SCHEME_HTTP,S_OK,FALSE},
2751 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2754 /* Forbidden characters are encoded for known scheme types. */
2755 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2757 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2758 {"www.winehq.org",S_OK,FALSE},
2759 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2760 {"winehq.org",S_OK,FALSE},
2763 {"www.winehq.org",S_OK,FALSE},
2766 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2767 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2768 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2769 {"http",S_OK,FALSE},
2774 {Uri_HOST_DNS,S_OK,FALSE},
2776 {URL_SCHEME_HTTP,S_OK,FALSE},
2777 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2780 /* Forbidden characters are not encoded for unknown scheme types. */
2781 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2783 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2784 {"www.winehq.org",S_OK,FALSE},
2785 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2786 {"winehq.org",S_OK,FALSE},
2789 {"www.winehq.org",S_OK,FALSE},
2792 {"/?query=<|>&return=y",S_OK,FALSE},
2793 {"?query=<|>&return=y",S_OK,FALSE},
2794 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2800 {Uri_HOST_DNS,S_OK,FALSE},
2802 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2803 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2806 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2807 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2809 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2810 {"www.winehq.org",S_OK,FALSE},
2811 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2812 {"winehq.org",S_OK,FALSE},
2815 {"www.winehq.org",S_OK,FALSE},
2818 {"/?query=01&return=y",S_OK,FALSE},
2819 {"?query=01&return=y",S_OK,FALSE},
2820 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2821 {"http",S_OK,FALSE},
2826 {Uri_HOST_DNS,S_OK,FALSE},
2828 {URL_SCHEME_HTTP,S_OK,FALSE},
2829 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2832 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2833 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2835 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2836 {"www.winehq.org",S_OK,FALSE},
2837 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2838 {"winehq.org",S_OK,FALSE},
2841 {"www.winehq.org",S_OK,FALSE},
2844 {"/?query=%30%31&return=y",S_OK,FALSE},
2845 {"?query=%30%31&return=y",S_OK,FALSE},
2846 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2852 {Uri_HOST_DNS,S_OK,FALSE},
2854 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2855 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2858 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2859 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2861 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2862 {"www.winehq.org",S_OK,FALSE},
2863 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2864 {"winehq.org",S_OK,FALSE},
2867 {"www.winehq.org",S_OK,FALSE},
2870 {"/?query=%30%31&return=y",S_OK,FALSE},
2871 {"?query=%30%31&return=y",S_OK,FALSE},
2872 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2873 {"http",S_OK,FALSE},
2878 {Uri_HOST_DNS,S_OK,FALSE},
2880 {URL_SCHEME_HTTP,S_OK,FALSE},
2881 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2884 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2886 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2887 {"www.winehq.org",S_OK,FALSE},
2888 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2889 {"winehq.org",S_OK,FALSE},
2892 {"www.winehq.org",S_OK,FALSE},
2895 {"?query=12&return=y",S_OK,FALSE},
2896 {"?query=12&return=y",S_OK,FALSE},
2897 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2898 {"http",S_OK,FALSE},
2903 {Uri_HOST_DNS,S_OK,FALSE},
2905 {URL_SCHEME_HTTP,S_OK,FALSE},
2906 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2909 /* Unknown scheme types can have invalid % encoded data in fragments. */
2910 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2912 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2913 {"www.winehq.org",S_OK,FALSE},
2914 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2915 {"winehq.org",S_OK,FALSE},
2917 {"#Te%xx",S_OK,FALSE},
2918 {"www.winehq.org",S_OK,FALSE},
2920 {"/tests/",S_OK,FALSE},
2921 {"/tests/",S_OK,FALSE},
2923 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2929 {Uri_HOST_DNS,S_OK,FALSE},
2931 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2932 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2935 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2936 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2938 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2939 {"www.winehq.org",S_OK,FALSE},
2940 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2941 {"winehq.org",S_OK,FALSE},
2943 {"#Te<|>",S_OK,FALSE},
2944 {"www.winehq.org",S_OK,FALSE},
2946 {"/tests/",S_OK,FALSE},
2947 {"/tests/",S_OK,FALSE},
2949 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2955 {Uri_HOST_DNS,S_OK,FALSE},
2957 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2958 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2961 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2962 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2964 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2965 {"www.winehq.org",S_OK,FALSE},
2966 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2967 {"winehq.org",S_OK,FALSE},
2969 {"#Te%3C%7C%3E",S_OK,FALSE},
2970 {"www.winehq.org",S_OK,FALSE},
2972 {"/tests/",S_OK,FALSE},
2973 {"/tests/",S_OK,FALSE},
2975 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2976 {"http",S_OK,FALSE},
2981 {Uri_HOST_DNS,S_OK,FALSE},
2983 {URL_SCHEME_HTTP,S_OK,FALSE},
2984 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2987 /* Forbidden characters aren't encoded in the fragment with this flag. */
2988 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2990 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2991 {"www.winehq.org",S_OK,FALSE},
2992 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2993 {"winehq.org",S_OK,FALSE},
2995 {"#Te<|>",S_OK,FALSE},
2996 {"www.winehq.org",S_OK,FALSE},
2998 {"/tests/",S_OK,FALSE},
2999 {"/tests/",S_OK,FALSE},
3001 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3002 {"http",S_OK,FALSE},
3007 {Uri_HOST_DNS,S_OK,FALSE},
3009 {URL_SCHEME_HTTP,S_OK,FALSE},
3010 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3013 /* Forbidden characters aren't encoded in the fragment with this flag. */
3014 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3016 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3017 {"www.winehq.org",S_OK,FALSE},
3018 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3019 {"winehq.org",S_OK,FALSE},
3021 {"#Te<|>",S_OK,FALSE},
3022 {"www.winehq.org",S_OK,FALSE},
3024 {"/tests/",S_OK,FALSE},
3025 {"/tests/",S_OK,FALSE},
3027 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3028 {"http",S_OK,FALSE},
3033 {Uri_HOST_DNS,S_OK,FALSE},
3035 {URL_SCHEME_HTTP,S_OK,FALSE},
3036 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3039 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3040 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3042 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3043 {"www.winehq.org",S_OK,FALSE},
3044 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3045 {"winehq.org",S_OK,FALSE},
3047 {"#Te%30%31%32",S_OK,FALSE},
3048 {"www.winehq.org",S_OK,FALSE},
3050 {"/tests/",S_OK,FALSE},
3051 {"/tests/",S_OK,FALSE},
3053 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3059 {Uri_HOST_DNS,S_OK,FALSE},
3061 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3062 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3065 /* Percent encoded, unreserved characters are decoded for known schemes. */
3066 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3068 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3069 {"www.winehq.org",S_OK,FALSE},
3070 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3071 {"winehq.org",S_OK,FALSE},
3073 {"#Te012",S_OK,FALSE},
3074 {"www.winehq.org",S_OK,FALSE},
3076 {"/tests/",S_OK,FALSE},
3077 {"/tests/",S_OK,FALSE},
3079 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3080 {"http",S_OK,FALSE},
3085 {Uri_HOST_DNS,S_OK,FALSE},
3087 {URL_SCHEME_HTTP,S_OK,FALSE},
3088 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3091 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3092 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3094 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3095 {"www.winehq.org",S_OK,FALSE},
3096 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3097 {"winehq.org",S_OK,FALSE},
3099 {"#Te012",S_OK,FALSE},
3100 {"www.winehq.org",S_OK,FALSE},
3102 {"/tests/",S_OK,FALSE},
3103 {"/tests/",S_OK,FALSE},
3105 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3106 {"http",S_OK,FALSE},
3111 {Uri_HOST_DNS,S_OK,FALSE},
3113 {URL_SCHEME_HTTP,S_OK,FALSE},
3114 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3117 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3118 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3120 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3121 {"www.winehq.org",S_OK,FALSE},
3122 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3123 {"winehq.org",S_OK,FALSE},
3125 {"#Te%30%31%32",S_OK,FALSE},
3126 {"www.winehq.org",S_OK,FALSE},
3128 {"/tests/",S_OK,FALSE},
3129 {"/tests/",S_OK,FALSE},
3131 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3132 {"http",S_OK,FALSE},
3137 {Uri_HOST_DNS,S_OK,FALSE},
3139 {URL_SCHEME_HTTP,S_OK,FALSE},
3140 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3143 /* Leading/Trailing whitespace is removed. */
3144 { " http://google.com/ ", 0, S_OK, FALSE,
3146 {"http://google.com/",S_OK,FALSE},
3147 {"google.com",S_OK,FALSE},
3148 {"http://google.com/",S_OK,FALSE},
3149 {"google.com",S_OK,FALSE},
3152 {"google.com",S_OK,FALSE},
3157 {"http://google.com/",S_OK,FALSE},
3158 {"http",S_OK,FALSE},
3163 {Uri_HOST_DNS,S_OK,FALSE},
3165 {URL_SCHEME_HTTP,S_OK,FALSE},
3166 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3169 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3171 {"http://google.com/",S_OK,FALSE},
3172 {"google.com",S_OK,FALSE},
3173 {"http://google.com/",S_OK,FALSE},
3174 {"google.com",S_OK,FALSE},
3177 {"google.com",S_OK,FALSE},
3182 {"http://google.com/",S_OK,FALSE},
3183 {"http",S_OK,FALSE},
3188 {Uri_HOST_DNS,S_OK,FALSE},
3190 {URL_SCHEME_HTTP,S_OK,FALSE},
3191 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3194 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3196 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3197 {"g%0aoogle.co%0dm",S_OK,FALSE},
3198 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3199 {"g%0aoogle.co%0dm",S_OK,FALSE},
3202 {"g%0aoogle.co%0dm",S_OK,FALSE},
3204 {"/%0A%0A%0A",S_OK,FALSE},
3205 {"/%0A%0A%0A",S_OK,FALSE},
3207 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3208 {"http",S_OK,FALSE},
3213 {Uri_HOST_DNS,S_OK,FALSE},
3215 {URL_SCHEME_HTTP,S_OK,FALSE},
3216 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3219 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3221 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3222 {"g\noogle.co\rm",S_OK,FALSE},
3223 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3224 {"g\noogle.co\rm",S_OK,FALSE},
3227 {"g\noogle.co\rm",S_OK,FALSE},
3229 {"/\n\n\n",S_OK,FALSE},
3230 {"/\n\n\n",S_OK,FALSE},
3232 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3238 {Uri_HOST_DNS,S_OK,FALSE},
3240 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3241 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3244 /* Since file URLs are usually hierarchical, it returns an empty string
3245 * for the absolute URI property since it was declared as an opaque URI.
3247 { "file:index.html", 0, S_OK, FALSE,
3251 {"file:index.html",S_OK,FALSE},
3253 {".html",S_OK,FALSE},
3257 {"index.html",S_OK,FALSE},
3258 {"index.html",S_OK,FALSE},
3260 {"file:index.html",S_OK,FALSE},
3261 {"file",S_OK,FALSE},
3266 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3268 {URL_SCHEME_FILE,S_OK,FALSE},
3269 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3272 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3273 { "http:test.com/index.html", 0, S_OK, FALSE,
3277 {"http:test.com/index.html",S_OK,FALSE},
3279 {".html",S_OK,FALSE},
3283 {"test.com/index.html",S_OK,FALSE},
3284 {"test.com/index.html",S_OK,FALSE},
3286 {"http:test.com/index.html",S_OK,FALSE},
3287 {"http",S_OK,FALSE},
3292 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3294 {URL_SCHEME_HTTP,S_OK,FALSE},
3295 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3298 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3302 {"ftp:test.com/index.html",S_OK,FALSE},
3304 {".html",S_OK,FALSE},
3308 {"test.com/index.html",S_OK,FALSE},
3309 {"test.com/index.html",S_OK,FALSE},
3311 {"ftp:test.com/index.html",S_OK,FALSE},
3317 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3319 {URL_SCHEME_FTP,S_OK,FALSE},
3320 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3323 { "file://C|/test.mp3", 0, S_OK, FALSE,
3325 {"file:///C:/test.mp3",S_OK,FALSE},
3327 {"file:///C:/test.mp3",S_OK,FALSE},
3329 {".mp3",S_OK,FALSE},
3333 {"/C:/test.mp3",S_OK,FALSE},
3334 {"/C:/test.mp3",S_OK,FALSE},
3336 {"file://C|/test.mp3",S_OK,FALSE},
3337 {"file",S_OK,FALSE},
3342 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3344 {URL_SCHEME_FILE,S_OK,FALSE},
3345 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3348 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3350 {"file:///C:/test.mp3",S_OK,FALSE},
3352 {"file:///C:/test.mp3",S_OK,FALSE},
3354 {".mp3",S_OK,FALSE},
3358 {"/C:/test.mp3",S_OK,FALSE},
3359 {"/C:/test.mp3",S_OK,FALSE},
3361 {"file:///C|/test.mp3",S_OK,FALSE},
3362 {"file",S_OK,FALSE},
3367 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3369 {URL_SCHEME_FILE,S_OK,FALSE},
3370 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3373 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3376 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3378 {"file://c:\\dir\\index.html",S_OK,FALSE},
3380 {"file://c:\\dir\\index.html",S_OK,FALSE},
3382 {".html",S_OK,FALSE},
3386 {"c:\\dir\\index.html",S_OK,FALSE},
3387 {"c:\\dir\\index.html",S_OK,FALSE},
3389 {"file://c:/dir/index.html",S_OK,FALSE},
3390 {"file",S_OK,FALSE},
3395 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3397 {URL_SCHEME_FILE,S_OK,FALSE},
3398 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3401 /* Extra '/' after "file://" is removed. */
3402 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3404 {"file://c:\\dir\\index.html",S_OK,FALSE},
3406 {"file://c:\\dir\\index.html",S_OK,FALSE},
3408 {".html",S_OK,FALSE},
3412 {"c:\\dir\\index.html",S_OK,FALSE},
3413 {"c:\\dir\\index.html",S_OK,FALSE},
3415 {"file:///c:/dir/index.html",S_OK,FALSE},
3416 {"file",S_OK,FALSE},
3421 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3423 {URL_SCHEME_FILE,S_OK,FALSE},
3424 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3427 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3428 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3430 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3432 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3434 {".html",S_OK,FALSE},
3438 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3439 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3441 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3442 {"file",S_OK,FALSE},
3447 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3449 {URL_SCHEME_FILE,S_OK,FALSE},
3450 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3453 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3455 {"file://c:\\dir\\index.html",S_OK,FALSE},
3457 {"file://c:\\dir\\index.html",S_OK,FALSE},
3459 {".html",S_OK,FALSE},
3463 {"c:\\dir\\index.html",S_OK,FALSE},
3464 {"c:\\dir\\index.html",S_OK,FALSE},
3466 {"file://c|/dir\\index.html",S_OK,FALSE},
3467 {"file",S_OK,FALSE},
3472 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3474 {URL_SCHEME_FILE,S_OK,FALSE},
3475 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3478 /* The backslashes after the scheme name are converted to forward slashes. */
3479 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3481 {"file://c:\\dir\\index.html",S_OK,FALSE},
3483 {"file://c:\\dir\\index.html",S_OK,FALSE},
3485 {".html",S_OK,FALSE},
3489 {"c:\\dir\\index.html",S_OK,FALSE},
3490 {"c:\\dir\\index.html",S_OK,FALSE},
3492 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3493 {"file",S_OK,FALSE},
3498 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3500 {URL_SCHEME_FILE,S_OK,FALSE},
3501 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3504 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3506 {"file:///c:/dir/index.html",S_OK,FALSE},
3508 {"file:///c:/dir/index.html",S_OK,FALSE},
3510 {".html",S_OK,FALSE},
3514 {"/c:/dir/index.html",S_OK,FALSE},
3515 {"/c:/dir/index.html",S_OK,FALSE},
3517 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3518 {"file",S_OK,FALSE},
3523 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3525 {URL_SCHEME_FILE,S_OK,FALSE},
3526 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3529 { "http:\\\\google.com", 0, S_OK, FALSE,
3531 {"http://google.com/",S_OK,FALSE},
3532 {"google.com",S_OK,FALSE},
3533 {"http://google.com/",S_OK,FALSE},
3534 {"google.com",S_OK,FALSE},
3537 {"google.com",S_OK,FALSE},
3542 {"http:\\\\google.com",S_OK,FALSE},
3543 {"http",S_OK,FALSE},
3548 {Uri_HOST_DNS,S_OK,FALSE},
3550 {URL_SCHEME_HTTP,S_OK,FALSE},
3551 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3554 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3555 { "zip:\\\\google.com", 0, S_OK, FALSE,
3557 {"zip:\\\\google.com",S_OK,FALSE},
3559 {"zip:\\\\google.com",S_OK,FALSE},
3561 {".com",S_OK,FALSE},
3565 {"\\\\google.com",S_OK,FALSE},
3566 {"\\\\google.com",S_OK,FALSE},
3568 {"zip:\\\\google.com",S_OK,FALSE},
3574 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3576 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3577 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3580 /* Dot segments aren't removed. */
3581 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3583 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3585 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3587 {".html",S_OK,FALSE},
3591 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3592 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3594 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3595 {"file",S_OK,FALSE},
3600 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3602 {URL_SCHEME_FILE,S_OK,FALSE},
3603 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3606 /* Forbidden characters aren't percent encoded. */
3607 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3609 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3611 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3613 {".html",S_OK,FALSE},
3617 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3618 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3620 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3621 {"file",S_OK,FALSE},
3626 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3628 {URL_SCHEME_FILE,S_OK,FALSE},
3629 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3632 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3633 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3637 {"file:c:/dir/../../index.html",S_OK,FALSE},
3639 {".html",S_OK,FALSE},
3643 {"c:/dir/../../index.html",S_OK,FALSE},
3644 {"c:/dir/../../index.html",S_OK,FALSE},
3646 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3647 {"file",S_OK,FALSE},
3652 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3654 {URL_SCHEME_FILE,S_OK,FALSE},
3655 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3658 /* '/' are still converted to '\' even though it's an opaque URI. */
3659 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3663 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3665 {".html",S_OK,FALSE},
3669 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3670 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3672 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3673 {"file",S_OK,FALSE},
3678 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3680 {URL_SCHEME_FILE,S_OK,FALSE},
3681 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3684 /* Forbidden characters aren't percent encoded. */
3685 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3689 {"file:c:\\in^|dex.html",S_OK,FALSE},
3691 {".html",S_OK,FALSE},
3695 {"c:\\in^|dex.html",S_OK,FALSE},
3696 {"c:\\in^|dex.html",S_OK,FALSE},
3698 {"file:c:\\in^|dex.html",S_OK,FALSE},
3699 {"file",S_OK,FALSE},
3704 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3706 {URL_SCHEME_FILE,S_OK,FALSE},
3707 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3710 /* Doesn't have a UserName since the ':' appears at the beginning of the
3713 { "http://:password@gov.uk", 0, S_OK, FALSE,
3715 {"http://:password@gov.uk/",S_OK,FALSE},
3716 {":password@gov.uk",S_OK,FALSE},
3717 {"http://gov.uk/",S_OK,FALSE},
3721 {"gov.uk",S_OK,FALSE},
3722 {"password",S_OK,FALSE},
3726 {"http://:password@gov.uk",S_OK,FALSE},
3727 {"http",S_OK,FALSE},
3728 {":password",S_OK,FALSE},
3732 {Uri_HOST_DNS,S_OK,FALSE},
3734 {URL_SCHEME_HTTP,S_OK,FALSE},
3735 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3738 /* Has a UserName since the userinfo section doesn't contain a password. */
3739 { "http://@gov.uk", 0, S_OK, FALSE,
3741 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3742 {"@gov.uk",S_OK,FALSE},
3743 {"http://gov.uk/",S_OK,FALSE},
3747 {"gov.uk",S_OK,FALSE},
3752 {"http://@gov.uk",S_OK,FALSE},
3753 {"http",S_OK,FALSE},
3758 {Uri_HOST_DNS,S_OK,FALSE},
3760 {URL_SCHEME_HTTP,S_OK,FALSE},
3761 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3764 /* ":@" not included in the absolute URI. */
3765 { "http://:@gov.uk", 0, S_OK, FALSE,
3767 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3768 {":@gov.uk",S_OK,FALSE},
3769 {"http://gov.uk/",S_OK,FALSE},
3773 {"gov.uk",S_OK,FALSE},
3778 {"http://:@gov.uk",S_OK,FALSE},
3779 {"http",S_OK,FALSE},
3784 {Uri_HOST_DNS,S_OK,FALSE},
3786 {URL_SCHEME_HTTP,S_OK,FALSE},
3787 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3790 /* '@' is included because it's an unknown scheme type. */
3791 { "zip://@gov.uk", 0, S_OK, FALSE,
3793 {"zip://@gov.uk/",S_OK,FALSE},
3794 {"@gov.uk",S_OK,FALSE},
3795 {"zip://@gov.uk/",S_OK,FALSE},
3799 {"gov.uk",S_OK,FALSE},
3804 {"zip://@gov.uk",S_OK,FALSE},
3810 {Uri_HOST_DNS,S_OK,FALSE},
3812 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3813 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3816 /* ":@" are included because it's an unknown scheme type. */
3817 { "zip://:@gov.uk", 0, S_OK, FALSE,
3819 {"zip://:@gov.uk/",S_OK,FALSE},
3820 {":@gov.uk",S_OK,FALSE},
3821 {"zip://:@gov.uk/",S_OK,FALSE},
3825 {"gov.uk",S_OK,FALSE},
3830 {"zip://:@gov.uk",S_OK,FALSE},
3836 {Uri_HOST_DNS,S_OK,FALSE},
3838 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3839 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3842 { "about:blank", 0, S_OK, FALSE,
3844 {"about:blank",S_OK,FALSE},
3846 {"about:blank",S_OK,FALSE},
3852 {"blank",S_OK,FALSE},
3853 {"blank",S_OK,FALSE},
3855 {"about:blank",S_OK,FALSE},
3856 {"about",S_OK,FALSE},
3861 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3863 {URL_SCHEME_ABOUT,S_OK,FALSE},
3864 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3867 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3869 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3871 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3873 {".htm",S_OK,FALSE},
3877 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3878 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3880 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3886 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3888 {URL_SCHEME_MK,S_OK,FALSE},
3889 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3892 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3894 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3896 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3898 {".htm",S_OK,FALSE},
3902 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3903 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3905 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3911 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3913 {URL_SCHEME_MK,S_OK,FALSE},
3914 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3917 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3918 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3920 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3921 {"server",S_OK,FALSE},
3922 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3924 {".html",S_OK,FALSE},
3926 {"server",S_OK,FALSE},
3928 {"\\dir\\index.html",S_OK,FALSE},
3929 {"\\dir\\index.html",S_OK,FALSE},
3931 {"file://server/dir/index.html",S_OK,FALSE},
3932 {"file",S_OK,FALSE},
3937 {Uri_HOST_DNS,S_OK,FALSE},
3939 {URL_SCHEME_FILE,S_OK,FALSE},
3940 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3943 /* When CreateUri generates an IUri, it still displays the default port in the
3946 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3948 {"http://google.com:80/",S_OK,FALSE},
3949 {"google.com:80",S_OK,FALSE},
3950 {"http://google.com:80/",S_OK,FALSE},
3951 {"google.com",S_OK,FALSE},
3954 {"google.com",S_OK,FALSE},
3959 {"http://google.com:80/",S_OK,FALSE},
3960 {"http",S_OK,FALSE},
3965 {Uri_HOST_DNS,S_OK,FALSE},
3967 {URL_SCHEME_HTTP,S_OK,FALSE},
3968 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3971 /* For res URIs the host is everything up until the first '/'. */
3972 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3974 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3975 {"C:\\dir\\file.exe",S_OK,FALSE},
3976 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3978 {".html",S_OK,FALSE},
3980 {"C:\\dir\\file.exe",S_OK,FALSE},
3982 {"/DATA/test.html",S_OK,FALSE},
3983 {"/DATA/test.html",S_OK,FALSE},
3985 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3991 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3993 {URL_SCHEME_RES,S_OK,FALSE},
3994 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3997 /* Res URI can contain a '|' in the host name. */
3998 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4000 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4001 {"c:\\di|r\\file.exe",S_OK,FALSE},
4002 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4006 {"c:\\di|r\\file.exe",S_OK,FALSE},
4008 {"/test",S_OK,FALSE},
4009 {"/test",S_OK,FALSE},
4011 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4017 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4019 {URL_SCHEME_RES,S_OK,FALSE},
4020 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4023 /* Res URIs can have invalid percent encoded values. */
4024 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4026 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4027 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4028 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4032 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4034 {"/test",S_OK,FALSE},
4035 {"/test",S_OK,FALSE},
4037 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4043 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4045 {URL_SCHEME_RES,S_OK,FALSE},
4046 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4049 /* Res doesn't get forbidden characters percent encoded in it's path. */
4050 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4052 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4053 {"c:\\test",S_OK,FALSE},
4054 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4058 {"c:\\test",S_OK,FALSE},
4060 {"/tes<|>t",S_OK,FALSE},
4061 {"/tes<|>t",S_OK,FALSE},
4063 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4069 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4071 {URL_SCHEME_RES,S_OK,FALSE},
4072 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4075 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4077 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4079 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4081 {".jpg",S_OK,FALSE},
4085 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4086 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4088 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4094 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4096 {URL_SCHEME_MK,S_OK,FALSE},
4097 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4100 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4102 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4104 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4106 {".jpg",S_OK,FALSE},
4110 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4111 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4113 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4119 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4121 {URL_SCHEME_MK,S_OK,FALSE},
4122 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4125 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4127 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4129 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4131 {".jpg",S_OK,FALSE},
4135 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4136 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4138 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4144 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4146 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4147 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4150 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4152 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4154 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4156 {".jpg",S_OK,FALSE},
4160 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4161 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4163 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4169 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4171 {URL_SCHEME_MK,S_OK,FALSE},
4172 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4175 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4177 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4179 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4181 {".jpg",S_OK,FALSE},
4185 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4186 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4188 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4194 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4196 {URL_SCHEME_MK,S_OK,FALSE},
4197 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4200 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4202 {"mk:images/xxx.jpg",S_OK,FALSE},
4204 {"mk:images/xxx.jpg",S_OK,FALSE},
4206 {".jpg",S_OK,FALSE},
4210 {"images/xxx.jpg",S_OK,FALSE},
4211 {"images/xxx.jpg",S_OK,FALSE},
4213 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4219 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4221 {URL_SCHEME_MK,S_OK,FALSE},
4222 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4225 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4244 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4246 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4247 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4250 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4269 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4271 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4272 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4275 { "javascript:void", 0, S_OK, FALSE,
4277 {"javascript:void",S_OK},
4279 {"javascript:void",S_OK},
4288 {"javascript:void",S_OK},
4289 {"javascript",S_OK},
4294 {Uri_HOST_UNKNOWN,S_OK},
4296 {URL_SCHEME_JAVASCRIPT,S_OK},
4297 {URLZONE_INVALID,E_NOTIMPL}
4300 { "javascript://undefined", 0, S_OK, FALSE,
4302 {"javascript://undefined",S_OK},
4304 {"javascript://undefined",S_OK},
4310 {"//undefined",S_OK},
4311 {"//undefined",S_OK},
4313 {"javascript://undefined",S_OK},
4314 {"javascript",S_OK},
4319 {Uri_HOST_UNKNOWN,S_OK},
4321 {URL_SCHEME_JAVASCRIPT,S_OK},
4322 {URLZONE_INVALID,E_NOTIMPL}
4325 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4327 {"javascript:escape('/\\?#?')",S_OK},
4329 {"javascript:escape('/\\?#?')",S_OK},
4335 {"escape('/\\?#?')",S_OK},
4336 {"escape('/\\?#?')",S_OK},
4338 {"JavaSCript:escape('/\\?#?')",S_OK},
4339 {"javascript",S_OK},
4344 {Uri_HOST_UNKNOWN,S_OK},
4346 {URL_SCHEME_JAVASCRIPT,S_OK},
4347 {URLZONE_INVALID,E_NOTIMPL}
4350 { "*://google.com", 0, S_OK, FALSE,
4352 {"*:google.com/",S_OK,FALSE},
4353 {"google.com",S_OK},
4354 {"*:google.com/",S_OK,FALSE},
4355 {"google.com",S_OK,FALSE},
4358 {"google.com",S_OK,FALSE},
4363 {"*://google.com",S_OK,FALSE},
4369 {Uri_HOST_DNS,S_OK,FALSE},
4371 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4372 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4375 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4377 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4379 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4385 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4386 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4388 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4394 {Uri_HOST_UNKNOWN,S_OK},
4396 {URL_SCHEME_MK,S_OK},
4397 {URLZONE_INVALID,E_NOTIMPL}
4400 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4402 {"gopher://test.winehq.org:151/file.txt",S_OK},
4403 {"test.winehq.org:151",S_OK},
4404 {"gopher://test.winehq.org:151/file.txt",S_OK},
4405 {"winehq.org",S_OK},
4408 {"test.winehq.org",S_OK},
4413 {"gopher://test.winehq.org:151/file.txt",S_OK},
4419 {Uri_HOST_DNS,S_OK},
4421 {URL_SCHEME_GOPHER,S_OK},
4422 {URLZONE_INVALID,E_NOTIMPL}
4425 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4427 {"//host.com/path/file.txt?query",S_OK},
4429 {"//host.com/path/file.txt?query",S_OK},
4435 {"/path/file.txt",S_OK},
4436 {"/path/file.txt?query",S_OK},
4438 {"//host.com/path/file.txt?query",S_OK},
4444 {Uri_HOST_DNS,S_OK},
4446 {URL_SCHEME_UNKNOWN,S_OK},
4447 {URLZONE_INVALID,E_NOTIMPL}
4450 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4452 {"//host/path/file.txt?query",S_OK},
4454 {"//host/path/file.txt?query",S_OK},
4460 {"/path/file.txt",S_OK},
4461 {"/path/file.txt?query",S_OK},
4463 {"//host/path/file.txt?query",S_OK},
4469 {Uri_HOST_DNS,S_OK},
4471 {URL_SCHEME_UNKNOWN,S_OK},
4472 {URLZONE_INVALID,E_NOTIMPL}
4475 { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4494 {Uri_HOST_DNS,S_OK},
4496 {URL_SCHEME_UNKNOWN,S_OK},
4497 {URLZONE_INVALID,E_NOTIMPL}
4502 typedef struct _invalid_uri {
4508 static const invalid_uri invalid_uri_tests[] = {
4509 /* Has to have a scheme name. */
4510 {"://www.winehq.org",0,FALSE},
4511 /* Window's doesn't like URI's which are implicitly file paths without the
4512 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4514 {"C:/test/test.mp3",0,FALSE},
4515 {"\\\\Server/test/test.mp3",0,FALSE},
4516 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4517 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4518 /* Invalid schemes. */
4519 {"*abcd://not.valid.com",0,FALSE},
4520 {"*a*b*c*d://not.valid.com",0,FALSE},
4521 /* Not allowed to have invalid % encoded data. */
4522 {"ftp://google.co%XX/",0,FALSE},
4523 /* To many h16 components. */
4524 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4525 /* Not enough room for IPv4 address. */
4526 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4527 /* Not enough h16 components. */
4528 {"http://[1:2:3:4]",0,FALSE},
4529 /* Not enough components including IPv4. */
4530 {"http://[1:192.0.1.0]",0,FALSE},
4531 /* Not allowed to have partial IPv4 in IPv6. */
4532 {"http://[::192.0]",0,FALSE},
4533 /* Can't have elision of 1 h16 at beginning of address. */
4534 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4535 /* Can't have elision of 1 h16 at end of address. */
4536 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4537 /* Expects a valid IP Literal. */
4538 {"ftp://[not.valid.uri]/",0,FALSE},
4539 /* Expects valid port for a known scheme type. */
4540 {"ftp://www.winehq.org:123fgh",0,FALSE},
4541 /* Port exceeds USHORT_MAX for known scheme type. */
4542 {"ftp://www.winehq.org:65536",0,FALSE},
4543 /* Invalid port with IPv4 address. */
4544 {"http://www.winehq.org:1abcd",0,FALSE},
4545 /* Invalid port with IPv6 address. */
4546 {"http://[::ffff]:32xy",0,FALSE},
4547 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4548 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4549 /* Not allowed to have invalid % encoded data in opaque URI path. */
4550 {"news:test%XX",0,FALSE},
4551 {"mailto:wine@winehq%G8.com",0,FALSE},
4552 /* Known scheme types can't have invalid % encoded data in query string. */
4553 {"http://google.com/?query=te%xx",0,FALSE},
4554 /* Invalid % encoded data in fragment of know scheme type. */
4555 {"ftp://google.com/#Test%xx",0,FALSE},
4556 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4557 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4558 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4559 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4560 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4561 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4562 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4563 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4564 /* res URIs aren't allowed to have forbidden dos path characters in the
4567 {"res://c:\\te<st\\test/test",0,FALSE},
4568 {"res://c:\\te>st\\test/test",0,FALSE},
4569 {"res://c:\\te\"st\\test/test",0,FALSE},
4570 {"res://c:\\test/te%xxst",0,FALSE}
4573 typedef struct _uri_equality {
4575 DWORD create_flags_a;
4577 DWORD create_flags_b;
4582 static const uri_equality equality_tests[] = {
4584 "HTTP://www.winehq.org/test dir/./",0,
4585 "http://www.winehq.org/test dir/../test dir/",0,
4589 /* http://www.winehq.org/test%20dir */
4590 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4591 "http://www.winehq.org/test dir",0,
4595 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4596 "file:///c:/test.mp3",0,
4600 "ftp://ftp.winehq.org/",0,
4601 "ftp://ftp.winehq.org",0,
4605 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4606 "ftp://ftp.winehq.org/t%45stB/",0,
4610 "http://google.com/TEST",0,
4611 "http://google.com/test",0,
4615 "http://GOOGLE.com/",0,
4616 "http://google.com/",0,
4619 /* Performs case insensitive compare of host names (for known scheme types). */
4621 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4622 "ftp://google.com/",0,
4626 "zip://GOOGLE.com/",0,
4627 "zip://google.com/",0,
4631 "file:///c:/TEST/TeST/",0,
4632 "file:///c:/test/test/",0,
4636 "file:///server/TEST",0,
4637 "file:///SERVER/TEST",0,
4641 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4642 "http://google.com/",0,
4646 "ftp://google.com:21/",0,
4647 "ftp://google.com/",0,
4651 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4652 "http://google.com/",0,
4656 "http://google.com:70/",0,
4657 "http://google.com:71/",0,
4661 "file:///c:/dir/file.txt", 0,
4662 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4666 "file:///c:/dir/file.txt", 0,
4667 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4671 "file:///c:/dir/file.txt", 0,
4672 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4676 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4677 "file:///c:/%20dir/file.txt", 0,
4681 "file:///c:/Dir/file.txt", 0,
4682 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4686 "file:///c:/dir/file.txt", 0,
4687 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4691 "file:///c:/dir/file.txt#a", 0,
4692 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4695 /* Tests of an empty hash/fragment part */
4697 "http://google.com/test",0,
4698 "http://google.com/test#",0,
4702 "ftp://ftp.winehq.org/",0,
4703 "ftp://ftp.winehq.org/#",0,
4707 "file:///c:/dir/file.txt#", 0,
4708 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4713 typedef struct _uri_with_fragment {
4715 const char* fragment;
4717 HRESULT create_expected;
4720 const char* expected_uri;
4722 } uri_with_fragment;
4724 static const uri_with_fragment uri_fragment_tests[] = {
4726 "http://google.com/","#fragment",0,S_OK,FALSE,
4727 "http://google.com/#fragment",FALSE
4730 "http://google.com/","fragment",0,S_OK,FALSE,
4731 "http://google.com/#fragment",FALSE
4734 "zip://test.com/","?test",0,S_OK,FALSE,
4735 "zip://test.com/#?test",FALSE
4737 /* The fragment can be empty. */
4739 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4740 "ftp://ftp.google.com/#",FALSE
4744 typedef struct _uri_builder_property {
4747 const char *expected_value;
4748 Uri_PROPERTY property;
4751 } uri_builder_property;
4753 typedef struct _uri_builder_port {
4761 typedef struct _uri_builder_str_property {
4762 const char* expected;
4765 } uri_builder_str_property;
4767 typedef struct _uri_builder_dword_property {
4771 } uri_builder_dword_property;
4773 typedef struct _uri_builder_test {
4776 HRESULT create_builder_expected;
4777 BOOL create_builder_todo;
4779 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4781 uri_builder_port port_prop;
4787 DWORD uri_simple_encode_flags;
4788 HRESULT uri_simple_hres;
4789 BOOL uri_simple_todo;
4791 DWORD uri_with_flags;
4792 DWORD uri_with_builder_flags;
4793 DWORD uri_with_encode_flags;
4794 HRESULT uri_with_hres;
4797 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4798 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4801 static const uri_builder_test uri_builder_tests[] = {
4802 { "http://google.com/",0,S_OK,FALSE,
4804 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4805 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4806 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4807 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4814 {"http://username:password@google.com/?query=x#fragment",S_OK},
4815 {"username:password@google.com",S_OK},
4816 {"http://google.com/?query=x#fragment",S_OK},
4817 {"google.com",S_OK},
4820 {"google.com",S_OK},
4825 {"http://username:password@google.com/?query=x#fragment",S_OK},
4827 {"username:password",S_OK},
4831 {Uri_HOST_DNS,S_OK},
4833 {URL_SCHEME_HTTP,S_OK},
4834 {URLZONE_INVALID,E_NOTIMPL}
4837 { "http://google.com/",0,S_OK,FALSE,
4839 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4841 {TRUE,TRUE,120,S_OK,FALSE},
4846 {"test://google.com:120/",S_OK},
4847 {"google.com:120",S_OK},
4848 {"test://google.com:120/",S_OK},
4849 {"google.com",S_OK},
4852 {"google.com",S_OK},
4857 {"test://google.com:120/",S_OK},
4863 {Uri_HOST_DNS,S_OK},
4865 {URL_SCHEME_UNKNOWN,S_OK},
4866 {URLZONE_INVALID,E_NOTIMPL}
4869 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4871 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4872 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4873 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4880 {"http://[::192.2.3.4]/",S_OK},
4881 {"[::192.2.3.4]",S_OK},
4882 {"http://[::192.2.3.4]/",S_OK},
4886 {"::192.2.3.4",S_OK},
4891 {"http://[::192.2.3.4]/",S_OK},
4897 {Uri_HOST_IPV6,S_OK},
4899 {URL_SCHEME_HTTP,S_OK},
4900 {URLZONE_INVALID,E_NOTIMPL}
4903 { "http://google.com/",0,S_OK,FALSE,
4905 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4912 {"http://google.com/#Frag",S_OK},
4913 {"google.com",S_OK},
4914 {"http://google.com/#Frag",S_OK},
4915 {"google.com",S_OK},
4918 {"google.com",S_OK},
4923 {"http://google.com/#Frag",S_OK},
4929 {Uri_HOST_DNS,S_OK},
4931 {URL_SCHEME_HTTP,S_OK},
4932 {URLZONE_INVALID,E_NOTIMPL}
4935 { "http://google.com/",0,S_OK,FALSE,
4937 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4944 {"http://google.com/#",S_OK},
4945 {"google.com",S_OK},
4946 {"http://google.com/#",S_OK},
4947 {"google.com",S_OK},
4950 {"google.com",S_OK},
4955 {"http://google.com/#",S_OK},
4961 {Uri_HOST_DNS,S_OK},
4963 {URL_SCHEME_HTTP,S_OK},
4964 {URLZONE_INVALID,E_NOTIMPL}
4967 { "http://google.com/",0,S_OK,FALSE,
4969 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4976 {"http://::password@google.com/",S_OK},
4977 {"::password@google.com",S_OK},
4978 {"http://google.com/",S_OK},
4979 {"google.com",S_OK},
4982 {"google.com",S_OK},
4987 {"http://::password@google.com/",S_OK},
4989 {"::password",S_OK},
4993 {Uri_HOST_DNS,S_OK},
4995 {URL_SCHEME_HTTP,S_OK},
4996 {URLZONE_INVALID,E_NOTIMPL}
4999 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5001 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5004 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5006 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5008 {":password@test/test",S_OK},
5009 {":password@",S_OK},
5010 {":password@test/test",S_OK},
5019 {":password@test/test",S_OK},
5025 {Uri_HOST_UNKNOWN,S_OK},
5027 {URL_SCHEME_UNKNOWN,S_OK},
5028 {URLZONE_INVALID,E_NOTIMPL}
5031 { "http://google.com/",0,S_OK,FALSE,
5033 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5040 {"http://google.com/test/test",S_OK},
5041 {"google.com",S_OK},
5042 {"http://google.com/test/test",S_OK},
5043 {"google.com",S_OK},
5046 {"google.com",S_OK},
5048 {"/test/test",S_OK},
5049 {"/test/test",S_OK},
5051 {"http://google.com/test/test",S_OK},
5057 {Uri_HOST_DNS,S_OK},
5059 {URL_SCHEME_HTTP,S_OK},
5060 {URLZONE_INVALID,E_NOTIMPL}
5063 { "zip:testing/test",0,S_OK,FALSE,
5065 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5089 {Uri_HOST_UNKNOWN,S_OK},
5091 {URL_SCHEME_UNKNOWN,S_OK},
5092 {URLZONE_INVALID,E_NOTIMPL}
5095 { "http://google.com/",0,S_OK,FALSE,
5099 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5100 {TRUE,FALSE,555,S_OK,FALSE},
5105 {"http://google.com/",S_OK},
5106 {"google.com",S_OK},
5107 {"http://google.com/",S_OK},
5108 {"google.com",S_OK},
5111 {"google.com",S_OK},
5116 {"http://google.com/",S_OK},
5122 {Uri_HOST_DNS,S_OK},
5123 /* Still returns 80, even though earlier the port was disabled. */
5125 {URL_SCHEME_HTTP,S_OK},
5126 {URLZONE_INVALID,E_NOTIMPL}
5129 { "http://google.com/",0,S_OK,FALSE,
5133 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5134 * you'll get 122345 instead.
5136 {TRUE,122345,222,S_OK,FALSE},
5141 {"http://google.com:222/",S_OK},
5142 {"google.com:222",S_OK},
5143 {"http://google.com:222/",S_OK},
5144 {"google.com",S_OK},
5147 {"google.com",S_OK},
5152 {"http://google.com:222/",S_OK},
5158 {Uri_HOST_DNS,S_OK},
5160 {URL_SCHEME_HTTP,S_OK},
5161 {URLZONE_INVALID,E_NOTIMPL}
5164 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5165 { "http://google.com/",0,S_OK,FALSE,
5169 {TRUE,TRUE,999999,S_OK,FALSE},
5174 {"http://google.com:999999/",S_OK},
5175 {"google.com:999999",S_OK},
5176 {"http://google.com:999999/",S_OK},
5177 {"google.com",S_OK},
5180 {"google.com",S_OK},
5185 {"http://google.com:999999/",S_OK},
5191 {Uri_HOST_DNS,S_OK},
5193 {URL_SCHEME_HTTP,S_OK},
5194 {URLZONE_INVALID,E_NOTIMPL}
5197 { "http://google.com/",0,S_OK,FALSE,
5199 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5207 {"http://google.com/?test",S_OK},
5208 {"google.com",S_OK},
5209 {"http://google.com/?test",S_OK},
5210 {"google.com",S_OK},
5213 {"google.com",S_OK},
5218 {"http://google.com/?test",S_OK},
5224 {Uri_HOST_DNS,S_OK},
5226 {URL_SCHEME_HTTP,S_OK},
5227 {URLZONE_INVALID,E_NOTIMPL}
5230 { "http://:password@google.com/",0,S_OK,FALSE,
5239 {"http://:password@google.com/",S_OK},
5240 {":password@google.com",S_OK},
5241 {"http://google.com/",S_OK},
5242 {"google.com",S_OK},
5245 {"google.com",S_OK},
5250 {"http://:password@google.com/",S_OK},
5256 {Uri_HOST_DNS,S_OK},
5258 {URL_SCHEME_HTTP,S_OK},
5259 {URLZONE_INVALID,E_NOTIMPL}
5262 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5263 { NULL,0,S_OK,FALSE,
5265 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5266 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5273 {"http://google.com/",S_OK},
5274 {"google.com",S_OK},
5275 {"http://google.com/",S_OK},
5276 {"google.com",S_OK},
5279 {"google.com",S_OK},
5284 {"http://google.com/",S_OK},
5290 {Uri_HOST_DNS,S_OK},
5292 {URL_SCHEME_HTTP,S_OK},
5293 {URLZONE_INVALID,E_NOTIMPL}
5296 /* Can't set the scheme name to NULL. */
5297 { "zip://google.com/",0,S_OK,FALSE,
5299 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5306 {"zip://google.com/",S_OK},
5307 {"google.com",S_OK},
5308 {"zip://google.com/",S_OK},
5309 {"google.com",S_OK},
5312 {"google.com",S_OK},
5317 {"zip://google.com/",S_OK},
5323 {Uri_HOST_DNS,S_OK},
5325 {URL_SCHEME_UNKNOWN,S_OK},
5326 {URLZONE_INVALID,E_NOTIMPL}
5329 /* Can't set the scheme name to an empty string. */
5330 { "zip://google.com/",0,S_OK,FALSE,
5332 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5339 {"zip://google.com/",S_OK},
5340 {"google.com",S_OK},
5341 {"zip://google.com/",S_OK},
5342 {"google.com",S_OK},
5345 {"google.com",S_OK},
5350 {"zip://google.com/",S_OK},
5356 {Uri_HOST_DNS,S_OK},
5358 {URL_SCHEME_UNKNOWN,S_OK},
5359 {URLZONE_INVALID,E_NOTIMPL}
5362 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5363 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5365 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5370 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5372 {"http://google.com/../../",S_OK},
5373 {"google.com",S_OK},
5374 {"http://google.com/../../",S_OK},
5375 {"google.com",S_OK},
5378 {"google.com",S_OK},
5383 {"http://google.com/../../",S_OK},
5389 {Uri_HOST_DNS,S_OK},
5391 {URL_SCHEME_HTTP,S_OK},
5392 {URLZONE_INVALID,E_NOTIMPL}
5395 { "http://google.com/",0,S_OK,FALSE,
5397 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5402 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5404 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5405 {"google.com",S_OK},
5406 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5407 {"google.com",S_OK},
5409 {"#Fr%3C%7C%3Eg",S_OK},
5410 {"google.com",S_OK},
5415 {"http://google.com/#Fr<|>g",S_OK},
5421 {Uri_HOST_DNS,S_OK},
5423 {URL_SCHEME_HTTP,S_OK},
5424 {URLZONE_INVALID,E_NOTIMPL}
5427 { "http://google.com/",0,S_OK,FALSE,
5429 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5432 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5434 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5436 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5437 {"google.com",S_OK},
5438 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5439 {"google.com",S_OK},
5441 {"#Fr%3C%7C%3Eg",S_OK},
5442 {"google.com",S_OK},
5447 {"http://google.com/#Fr<|>g",S_OK},
5453 {Uri_HOST_DNS,S_OK},
5455 {URL_SCHEME_HTTP,S_OK},
5456 {URLZONE_INVALID,E_NOTIMPL}
5459 { NULL,0,S_OK,FALSE,
5461 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5462 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5465 0,INET_E_INVALID_URL,FALSE,
5466 0,INET_E_INVALID_URL,FALSE,
5467 0,0,0,INET_E_INVALID_URL,FALSE
5469 { "http://google.com/",0,S_OK,FALSE,
5471 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5474 0,INET_E_INVALID_URL,FALSE,
5475 0,INET_E_INVALID_URL,FALSE,
5476 0,0,0,INET_E_INVALID_URL,FALSE
5478 /* File scheme's can't have a username set. */
5479 { "file://google.com/",0,S_OK,FALSE,
5481 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5484 0,INET_E_INVALID_URL,FALSE,
5485 0,INET_E_INVALID_URL,FALSE,
5486 0,0,0,INET_E_INVALID_URL,FALSE
5488 /* File schemes can't have a password set. */
5489 { "file://google.com/",0,S_OK,FALSE,
5491 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5494 0,INET_E_INVALID_URL,FALSE,
5495 0,INET_E_INVALID_URL,FALSE,
5496 0,0,0,INET_E_INVALID_URL,FALSE
5498 /* UserName can't contain any character that is a delimeter for another
5499 * component that appears after it in a normal URI.
5501 { "http://google.com/",0,S_OK,FALSE,
5503 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5506 0,INET_E_INVALID_URL,FALSE,
5507 0,INET_E_INVALID_URL,FALSE,
5508 0,0,0,INET_E_INVALID_URL,FALSE
5510 { "http://google.com/",0,S_OK,FALSE,
5512 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5515 0,INET_E_INVALID_URL,FALSE,
5516 0,INET_E_INVALID_URL,FALSE,
5517 0,0,0,INET_E_INVALID_URL,FALSE
5519 { "http://google.com/",0,S_OK,FALSE,
5521 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5524 0,INET_E_INVALID_URL,FALSE,
5525 0,INET_E_INVALID_URL,FALSE,
5526 0,0,0,INET_E_INVALID_URL,FALSE
5528 { "http://google.com/",0,S_OK,FALSE,
5530 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5533 0,INET_E_INVALID_URL,FALSE,
5534 0,INET_E_INVALID_URL,FALSE,
5535 0,0,0,INET_E_INVALID_URL,FALSE
5537 { "http://google.com/",0,S_OK,FALSE,
5539 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5542 0,INET_E_INVALID_URL,FALSE,
5543 0,INET_E_INVALID_URL,FALSE,
5544 0,0,0,INET_E_INVALID_URL,FALSE
5546 { "http://google.com/",0,S_OK,FALSE,
5548 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5551 0,INET_E_INVALID_URL,FALSE,
5552 0,INET_E_INVALID_URL,FALSE,
5553 0,0,0,INET_E_INVALID_URL,FALSE
5555 { "http://google.com/",0,S_OK,FALSE,
5557 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5560 0,INET_E_INVALID_URL,FALSE,
5561 0,INET_E_INVALID_URL,FALSE,
5562 0,0,0,INET_E_INVALID_URL,FALSE
5564 { "http://google.com/",0,S_OK,FALSE,
5566 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5569 0,INET_E_INVALID_URL,FALSE,
5570 0,INET_E_INVALID_URL,FALSE,
5571 0,0,0,INET_E_INVALID_URL,FALSE
5573 { "http://google.com/",0,S_OK,FALSE,
5575 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5578 0,INET_E_INVALID_URL,FALSE,
5579 0,INET_E_INVALID_URL,FALSE,
5580 0,0,0,INET_E_INVALID_URL,FALSE
5582 { "http://google.com/",0,S_OK,FALSE,
5584 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5587 0,INET_E_INVALID_URL,FALSE,
5588 0,INET_E_INVALID_URL,FALSE,
5589 0,0,0,INET_E_INVALID_URL,FALSE
5591 { "http://google.com/",0,S_OK,FALSE,
5593 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5596 0,INET_E_INVALID_URL,FALSE,
5597 0,INET_E_INVALID_URL,FALSE,
5598 0,0,0,INET_E_INVALID_URL,FALSE
5600 { "http://google.com/",0,S_OK,FALSE,
5602 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5605 0,INET_E_INVALID_URL,FALSE,
5606 0,INET_E_INVALID_URL,FALSE,
5607 0,0,0,INET_E_INVALID_URL,FALSE
5609 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5610 { "http://google.com/",0,S_OK,FALSE,
5612 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5619 {"http://winehq.org:test/",S_OK},
5620 {"winehq.org:test",S_OK},
5621 {"http://winehq.org:test/",S_OK},
5622 {"winehq.org:test",S_OK},
5625 {"winehq.org:test",S_OK},
5630 {"http://winehq.org:test/",S_OK},
5636 {Uri_HOST_DNS,S_OK},
5638 {URL_SCHEME_HTTP,S_OK},
5639 {URLZONE_INVALID,E_NOTIMPL}
5642 /* Can't set the host name to NULL. */
5643 { "http://google.com/",0,S_OK,FALSE,
5645 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5652 {"http://google.com/",S_OK},
5653 {"google.com",S_OK},
5654 {"http://google.com/",S_OK},
5655 {"google.com",S_OK},
5658 {"google.com",S_OK},
5663 {"http://google.com/",S_OK},
5669 {Uri_HOST_DNS,S_OK},
5671 {URL_SCHEME_HTTP,S_OK},
5672 {URLZONE_INVALID,E_NOTIMPL}
5675 /* Can set the host name to an empty string. */
5676 { "http://google.com/",0,S_OK,FALSE,
5678 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5702 {Uri_HOST_UNKNOWN,S_OK},
5704 {URL_SCHEME_HTTP,S_OK},
5705 {URLZONE_INVALID,E_NOTIMPL}
5708 { "http://google.com/",0,S_OK,FALSE,
5710 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5713 0,INET_E_INVALID_URL,FALSE,
5714 0,INET_E_INVALID_URL,FALSE,
5715 0,0,0,INET_E_INVALID_URL,FALSE
5717 { "http://google.com/",0,S_OK,FALSE,
5719 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5722 0,INET_E_INVALID_URL,FALSE,
5723 0,INET_E_INVALID_URL,FALSE,
5724 0,0,0,INET_E_INVALID_URL,FALSE
5726 { "http://google.com/",0,S_OK,FALSE,
5728 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5731 0,INET_E_INVALID_URL,FALSE,
5732 0,INET_E_INVALID_URL,FALSE,
5733 0,0,0,INET_E_INVALID_URL,FALSE
5735 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5737 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5744 {"file:///c:/dir/file.html",S_OK},
5746 {"file:///c:/dir/file.html",S_OK},
5752 {"/c:/dir/file.html",S_OK},
5753 {"/c:/dir/file.html",S_OK},
5755 {"file:///c:/dir/file.html",S_OK},
5761 {Uri_HOST_UNKNOWN,S_OK},
5763 {URL_SCHEME_FILE,S_OK},
5764 {URLZONE_INVALID,E_NOTIMPL}
5767 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5769 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5776 {"file:///c:/dir/file.html#",S_OK},
5778 {"file:///c:/dir/file.html#",S_OK},
5784 {"/c:/dir/file.html",S_OK},
5785 {"/c:/dir/file.html",S_OK},
5787 {"file:///c:/dir/file.html#",S_OK},
5793 {Uri_HOST_UNKNOWN,S_OK},
5795 {URL_SCHEME_FILE,S_OK},
5796 {URLZONE_INVALID,E_NOTIMPL}
5801 typedef struct _uri_builder_remove_test {
5804 HRESULT create_builder_expected;
5805 BOOL create_builder_todo;
5807 DWORD remove_properties;
5808 HRESULT remove_expected;
5811 const char *expected_uri;
5812 DWORD expected_flags;
5813 HRESULT expected_hres;
5815 } uri_builder_remove_test;
5817 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5818 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5819 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5820 "http://google.com/",0,S_OK,FALSE
5822 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5823 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5824 "http://winehq.org/",0,S_OK,FALSE
5826 { "zip://google.com?Test=x",0,S_OK,FALSE,
5827 Uri_HAS_HOST,S_OK,FALSE,
5828 "zip:/?Test=x",0,S_OK,FALSE
5830 /* Doesn't remove the whole userinfo component. */
5831 { "http://username:pass@google.com/",0,S_OK,FALSE,
5832 Uri_HAS_USER_INFO,S_OK,FALSE,
5833 "http://username:pass@google.com/",0,S_OK,FALSE
5835 /* Doesn't remove the domain. */
5836 { "http://google.com/",0,S_OK,FALSE,
5837 Uri_HAS_DOMAIN,S_OK,FALSE,
5838 "http://google.com/",0,S_OK,FALSE
5840 { "http://google.com:120/",0,S_OK,FALSE,
5841 Uri_HAS_AUTHORITY,S_OK,FALSE,
5842 "http://google.com:120/",0,S_OK,FALSE
5844 { "http://google.com/test.com/",0,S_OK,FALSE,
5845 Uri_HAS_EXTENSION,S_OK,FALSE,
5846 "http://google.com/test.com/",0,S_OK,FALSE
5848 { "http://google.com/?test=x",0,S_OK,FALSE,
5849 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5850 "http://google.com/?test=x",0,S_OK,FALSE
5852 /* Can't remove the scheme name. */
5853 { "http://google.com/?test=x",0,S_OK,FALSE,
5854 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5855 "http://google.com/?test=x",0,S_OK,FALSE
5859 typedef struct _uri_combine_str_property {
5863 const char *broken_value;
5864 const char *value_ex;
5865 } uri_combine_str_property;
5867 typedef struct _uri_combine_test {
5868 const char *base_uri;
5869 DWORD base_create_flags;
5870 const char *relative_uri;
5871 DWORD relative_create_flags;
5872 DWORD combine_flags;
5876 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5877 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5880 static const uri_combine_test uri_combine_tests[] = {
5881 { "http://google.com/fun/stuff",0,
5882 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5885 {"http://google.com/not/fun/stuff",S_OK},
5886 {"google.com",S_OK},
5887 {"http://google.com/not/fun/stuff",S_OK},
5888 {"google.com",S_OK},
5891 {"google.com",S_OK},
5893 {"/not/fun/stuff",S_OK},
5894 {"/not/fun/stuff",S_OK},
5896 {"http://google.com/not/fun/stuff",S_OK},
5902 {Uri_HOST_DNS,S_OK},
5904 {URL_SCHEME_HTTP,S_OK},
5905 {URLZONE_INVALID,E_NOTIMPL}
5908 { "http://google.com/test",0,
5909 "zip://test.com/cool",0,
5912 {"zip://test.com/cool",S_OK},
5914 {"zip://test.com/cool",S_OK},
5923 {"zip://test.com/cool",S_OK},
5929 {Uri_HOST_DNS,S_OK},
5931 {URL_SCHEME_UNKNOWN,S_OK},
5932 {URLZONE_INVALID,E_NOTIMPL}
5935 { "http://google.com/use/base/path",0,
5936 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5939 {"http://google.com/use/base/path?relative",S_OK},
5940 {"google.com",S_OK},
5941 {"http://google.com/use/base/path?relative",S_OK},
5942 {"google.com",S_OK},
5945 {"google.com",S_OK},
5947 {"/use/base/path",S_OK},
5948 {"/use/base/path?relative",S_OK},
5950 {"http://google.com/use/base/path?relative",S_OK},
5956 {Uri_HOST_DNS,S_OK},
5958 {URL_SCHEME_HTTP,S_OK},
5959 {URLZONE_INVALID,E_NOTIMPL}
5962 { "http://google.com/path",0,
5963 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5966 {"http://google.com/testing",S_OK},
5967 {"google.com",S_OK},
5968 {"http://google.com/testing",S_OK},
5969 {"google.com",S_OK},
5972 {"google.com",S_OK},
5977 {"http://google.com/testing",S_OK},
5983 {Uri_HOST_DNS,S_OK},
5985 {URL_SCHEME_HTTP,S_OK},
5986 {URLZONE_INVALID,E_NOTIMPL}
5989 { "http://google.com/path",0,
5990 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5991 URL_DONT_SIMPLIFY,S_OK,FALSE,
5993 {"http://google.com:80/test/../test/.././testing",S_OK},
5994 {"google.com",S_OK},
5995 {"http://google.com:80/test/../test/.././testing",S_OK},
5996 {"google.com",S_OK},
5999 {"google.com",S_OK},
6001 {"/test/../test/.././testing",S_OK},
6002 {"/test/../test/.././testing",S_OK},
6004 {"http://google.com:80/test/../test/.././testing",S_OK},
6010 {Uri_HOST_DNS,S_OK},
6012 {URL_SCHEME_HTTP,S_OK},
6013 {URLZONE_INVALID,E_NOTIMPL}
6016 { "http://winehq.org/test/abc",0,
6017 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6020 {"http://winehq.org/test/testing/test",S_OK},
6021 {"winehq.org",S_OK},
6022 {"http://winehq.org/test/testing/test",S_OK},
6023 {"winehq.org",S_OK},
6026 {"winehq.org",S_OK},
6028 {"/test/testing/test",S_OK},
6029 {"/test/testing/test",S_OK},
6031 {"http://winehq.org/test/testing/test",S_OK},
6037 {Uri_HOST_DNS,S_OK},
6039 {URL_SCHEME_HTTP,S_OK},
6040 {URLZONE_INVALID,E_NOTIMPL}
6043 { "http://winehq.org/test/abc",0,
6044 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6045 URL_DONT_SIMPLIFY,S_OK,FALSE,
6047 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6048 /* Default port is hidden in the authority. */
6049 {"winehq.org",S_OK},
6050 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6051 {"winehq.org",S_OK},
6054 {"winehq.org",S_OK},
6056 {"/test/testing/abc/../test",S_OK},
6057 {"/test/testing/abc/../test",S_OK},
6059 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6065 {Uri_HOST_DNS,S_OK},
6067 {URL_SCHEME_HTTP,S_OK},
6068 {URLZONE_INVALID,E_NOTIMPL}
6071 { "http://winehq.org/test?query",0,
6072 "testing",Uri_CREATE_ALLOW_RELATIVE,
6075 {"http://winehq.org/testing",S_OK},
6076 {"winehq.org",S_OK},
6077 {"http://winehq.org/testing",S_OK},
6078 {"winehq.org",S_OK},
6081 {"winehq.org",S_OK},
6086 {"http://winehq.org/testing",S_OK},
6092 {Uri_HOST_DNS,S_OK},
6094 {URL_SCHEME_HTTP,S_OK},
6095 {URLZONE_INVALID,E_NOTIMPL}
6098 { "http://winehq.org/test#frag",0,
6099 "testing",Uri_CREATE_ALLOW_RELATIVE,
6102 {"http://winehq.org/testing",S_OK},
6103 {"winehq.org",S_OK},
6104 {"http://winehq.org/testing",S_OK},
6105 {"winehq.org",S_OK},
6108 {"winehq.org",S_OK},
6113 {"http://winehq.org/testing",S_OK},
6119 {Uri_HOST_DNS,S_OK},
6121 {URL_SCHEME_HTTP,S_OK},
6122 {URLZONE_INVALID,E_NOTIMPL}
6125 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6126 "test",Uri_CREATE_ALLOW_RELATIVE,
6146 {Uri_HOST_UNKNOWN,S_OK},
6148 {URL_SCHEME_UNKNOWN,S_OK},
6149 {URLZONE_INVALID,E_NOTIMPL}
6152 { "file:///c:/test/test",0,
6153 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6154 URL_FILE_USE_PATHURL,S_OK,FALSE,
6156 {"file://c:\\testing.mp3",S_OK},
6158 {"file://c:\\testing.mp3",S_OK},
6164 {"c:\\testing.mp3",S_OK},
6165 {"c:\\testing.mp3",S_OK},
6167 {"file://c:\\testing.mp3",S_OK},
6173 {Uri_HOST_UNKNOWN,S_OK},
6175 {URL_SCHEME_FILE,S_OK},
6176 {URLZONE_INVALID,E_NOTIMPL}
6179 { "file:///c:/test/test",0,
6180 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6183 {"file:///c:/testing.mp3",S_OK},
6185 {"file:///c:/testing.mp3",S_OK},
6191 {"/c:/testing.mp3",S_OK},
6192 {"/c:/testing.mp3",S_OK},
6194 {"file:///c:/testing.mp3",S_OK},
6200 {Uri_HOST_UNKNOWN,S_OK},
6202 {URL_SCHEME_FILE,S_OK},
6203 {URLZONE_INVALID,E_NOTIMPL}
6206 { "file://test.com/test/test",0,
6207 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6208 URL_FILE_USE_PATHURL,S_OK,FALSE,
6210 {"file://\\\\test.com\\testing.mp3",S_OK},
6212 {"file://\\\\test.com\\testing.mp3",S_OK},
6218 {"\\testing.mp3",S_OK},
6219 {"\\testing.mp3",S_OK},
6221 {"file://\\\\test.com\\testing.mp3",S_OK},
6227 {Uri_HOST_DNS,S_OK},
6229 {URL_SCHEME_FILE,S_OK},
6230 {URLZONE_INVALID,E_NOTIMPL}
6233 /* URL_DONT_SIMPLIFY has no effect. */
6234 { "http://google.com/test",0,
6235 "zip://test.com/cool/../cool/test",0,
6236 URL_DONT_SIMPLIFY,S_OK,FALSE,
6238 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6240 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6246 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6247 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6249 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6250 * On IE 7 it reduces the path in the Raw URI.
6252 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6258 {Uri_HOST_DNS,S_OK},
6260 {URL_SCHEME_UNKNOWN,S_OK},
6261 {URLZONE_INVALID,E_NOTIMPL}
6264 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6265 * resulting URI is converted into a dos path.
6267 { "http://google.com/test",0,
6268 "file:///c:/test/",0,
6269 URL_FILE_USE_PATHURL,S_OK,FALSE,
6271 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6273 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6279 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6280 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6282 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6288 {Uri_HOST_UNKNOWN,S_OK},
6290 {URL_SCHEME_FILE,S_OK},
6291 {URLZONE_INVALID,E_NOTIMPL}
6294 { "http://google.com/test",0,
6295 "http://test.com/test#%30test",0,
6296 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6298 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6300 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6303 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6309 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6310 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6316 {Uri_HOST_DNS,S_OK},
6318 {URL_SCHEME_HTTP,S_OK},
6319 {URLZONE_INVALID,E_NOTIMPL}
6322 /* Windows validates the path component from the relative Uri. */
6323 { "http://google.com/test",0,
6324 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6325 0,E_INVALIDARG,FALSE
6327 /* Windows doesn't validate the query from the relative Uri. */
6328 { "http://google.com/test",0,
6329 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6332 {"http://google.com/test?Tes%XXt",S_OK},
6333 {"google.com",S_OK},
6334 {"http://google.com/test?Tes%XXt",S_OK},
6335 {"google.com",S_OK},
6338 {"google.com",S_OK},
6341 {"/test?Tes%XXt",S_OK},
6343 {"http://google.com/test?Tes%XXt",S_OK},
6349 {Uri_HOST_DNS,S_OK},
6351 {URL_SCHEME_HTTP,S_OK},
6352 {URLZONE_INVALID,E_NOTIMPL}
6355 /* Windows doesn't validate the fragment from the relative Uri. */
6356 { "http://google.com/test",0,
6357 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6360 {"http://google.com/test#Tes%XXt",S_OK},
6361 {"google.com",S_OK},
6362 {"http://google.com/test#Tes%XXt",S_OK},
6363 {"google.com",S_OK},
6366 {"google.com",S_OK},
6371 {"http://google.com/test#Tes%XXt",S_OK},
6377 {Uri_HOST_DNS,S_OK},
6379 {URL_SCHEME_HTTP,S_OK},
6380 {URLZONE_INVALID,E_NOTIMPL}
6383 /* Creates an IUri which contains an invalid dos path char. */
6384 { "file:///c:/test",0,
6385 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6386 URL_FILE_USE_PATHURL,S_OK,FALSE,
6388 {"file://c:\\test<ing",S_OK},
6390 {"file://c:\\test<ing",S_OK},
6396 {"c:\\test<ing",S_OK},
6397 {"c:\\test<ing",S_OK},
6399 {"file://c:\\test<ing",S_OK},
6405 {Uri_HOST_UNKNOWN,S_OK},
6407 {URL_SCHEME_FILE,S_OK},
6408 {URLZONE_INVALID,E_NOTIMPL}
6411 /* Appends the path after the drive letter (if any). */
6412 { "file:///c:/test",0,
6413 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6416 {"file:///c:/c:/testing",S_OK},
6418 {"file:///c:/c:/testing",S_OK},
6424 {"/c:/c:/testing",S_OK},
6425 {"/c:/c:/testing",S_OK},
6427 {"file:///c:/c:/testing",S_OK},
6433 {Uri_HOST_UNKNOWN,S_OK},
6435 {URL_SCHEME_FILE,S_OK},
6436 {URLZONE_INVALID,E_NOTIMPL}
6439 /* A '/' is added if the base URI doesn't have a path and the
6440 * relative URI doesn't contain a path (since the base URI is
6443 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6444 "?test",Uri_CREATE_ALLOW_RELATIVE,
6447 {"http://google.com/?test",S_OK},
6448 {"google.com",S_OK},
6449 {"http://google.com/?test",S_OK},
6450 {"google.com",S_OK},
6453 {"google.com",S_OK},
6458 {"http://google.com/?test",S_OK},
6464 {Uri_HOST_DNS,S_OK},
6466 {URL_SCHEME_HTTP,S_OK},
6467 {URLZONE_INVALID,E_NOTIMPL}
6470 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6471 "?test",Uri_CREATE_ALLOW_RELATIVE,
6474 {"zip://google.com/?test",S_OK},
6475 {"google.com",S_OK},
6476 {"zip://google.com/?test",S_OK},
6477 {"google.com",S_OK},
6480 {"google.com",S_OK},
6485 {"zip://google.com/?test",S_OK},
6491 {Uri_HOST_DNS,S_OK},
6493 {URL_SCHEME_UNKNOWN,S_OK},
6494 {URLZONE_INVALID,E_NOTIMPL}
6497 /* No path is appended since the base URI is opaque. */
6499 "?test",Uri_CREATE_ALLOW_RELATIVE,
6519 {Uri_HOST_UNKNOWN,S_OK},
6521 {URL_SCHEME_UNKNOWN,S_OK},
6522 {URLZONE_INVALID,E_NOTIMPL}
6526 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6529 {"file:///c:/testing/test",S_OK},
6531 {"file:///c:/testing/test",S_OK},
6537 {"/c:/testing/test",S_OK},
6538 {"/c:/testing/test",S_OK},
6540 {"file:///c:/testing/test",S_OK},
6546 {Uri_HOST_UNKNOWN,S_OK},
6548 {URL_SCHEME_FILE,S_OK},
6549 {URLZONE_INVALID,E_NOTIMPL}
6552 { "http://winehq.org/dir/testfile",0,
6553 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6556 {"http://winehq.org/dir/test?querystring",S_OK},
6557 {"winehq.org",S_OK},
6558 {"http://winehq.org/dir/test?querystring",S_OK},
6559 {"winehq.org",S_OK},
6562 {"winehq.org",S_OK},
6565 {"/dir/test?querystring",S_OK},
6566 {"?querystring",S_OK},
6567 {"http://winehq.org/dir/test?querystring",S_OK},
6573 {Uri_HOST_DNS,S_OK},
6575 {URL_SCHEME_HTTP,S_OK},
6576 {URLZONE_INVALID,E_NOTIMPL}
6579 { "http://winehq.org/dir/test",0,
6580 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6583 {"http://winehq.org/dir/test?querystring",S_OK},
6584 {"winehq.org",S_OK},
6585 {"http://winehq.org/dir/test?querystring",S_OK},
6586 {"winehq.org",S_OK},
6589 {"winehq.org",S_OK},
6592 {"/dir/test?querystring",S_OK},
6593 {"?querystring",S_OK},
6594 {"http://winehq.org/dir/test?querystring",S_OK},
6600 {Uri_HOST_DNS,S_OK},
6602 {URL_SCHEME_HTTP,S_OK},
6603 {URLZONE_INVALID,E_NOTIMPL}
6606 { "http://winehq.org/dir/test?querystring",0,
6607 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6610 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6611 {"winehq.org",S_OK},
6612 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6613 {"winehq.org",S_OK},
6616 {"winehq.org",S_OK},
6619 {"/dir/test?querystring",S_OK},
6620 {"?querystring",S_OK},
6621 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6627 {Uri_HOST_DNS,S_OK},
6629 {URL_SCHEME_HTTP,S_OK},
6630 {URLZONE_INVALID,E_NOTIMPL}
6633 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6634 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6637 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6639 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6645 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6646 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6648 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6654 {Uri_HOST_UNKNOWN,S_OK},
6656 {URL_SCHEME_MK,S_OK},
6657 {URLZONE_INVALID,E_NOTIMPL}
6660 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6661 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6664 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6666 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6672 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6673 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6675 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6681 {Uri_HOST_UNKNOWN,S_OK},
6683 {URL_SCHEME_MK,S_OK},
6684 {URLZONE_INVALID,E_NOTIMPL}
6687 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6688 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6691 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6693 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6699 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6700 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6702 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6708 {Uri_HOST_UNKNOWN,S_OK},
6710 {URL_SCHEME_MK,S_OK},
6711 {URLZONE_INVALID,E_NOTIMPL}
6714 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6715 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6718 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6720 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6726 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6727 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6729 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6735 {Uri_HOST_UNKNOWN,S_OK},
6737 {URL_SCHEME_MK,S_OK},
6738 {URLZONE_INVALID,E_NOTIMPL}
6741 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6742 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6745 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6747 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6753 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6754 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6756 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6762 {Uri_HOST_UNKNOWN,S_OK},
6764 {URL_SCHEME_MK,S_OK},
6765 {URLZONE_INVALID,E_NOTIMPL}
6768 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6769 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6772 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6774 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6780 {"@MSITSTORE:/relative/path.txt",S_OK},
6781 {"@MSITSTORE:/relative/path.txt",S_OK},
6783 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6789 {Uri_HOST_UNKNOWN,S_OK},
6791 {URL_SCHEME_MK,S_OK},
6792 {URLZONE_INVALID,E_NOTIMPL}
6795 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6796 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6799 {"mk:@xxx:/relative/path.txt",S_OK},
6801 {"mk:@xxx:/relative/path.txt",S_OK},
6807 {"@xxx:/relative/path.txt",S_OK},
6808 {"@xxx:/relative/path.txt",S_OK},
6810 {"mk:@xxx:/relative/path.txt",S_OK},
6816 {Uri_HOST_UNKNOWN,S_OK},
6818 {URL_SCHEME_MK,S_OK},
6819 {URLZONE_INVALID,E_NOTIMPL}
6822 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6823 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6826 {"mk:/relative/path.txt",S_OK},
6828 {"mk:/relative/path.txt",S_OK},
6834 {"/relative/path.txt",S_OK},
6835 {"/relative/path.txt",S_OK},
6837 {"mk:/relative/path.txt",S_OK},
6843 {Uri_HOST_UNKNOWN,S_OK},
6845 {URL_SCHEME_MK,S_OK},
6846 {URLZONE_INVALID,E_NOTIMPL}
6849 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6850 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6853 {"ml:/relative/path.txt",S_OK},
6855 {"ml:/relative/path.txt",S_OK},
6861 {"/relative/path.txt",S_OK},
6862 {"/relative/path.txt",S_OK},
6864 {"ml:/relative/path.txt",S_OK},
6870 {Uri_HOST_UNKNOWN,S_OK},
6872 {URL_SCHEME_UNKNOWN,S_OK},
6873 {URLZONE_INVALID,E_NOTIMPL}
6876 { "http://winehq.org/dir/test?querystring",0,
6877 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
6880 {"http://winehq.com/#hash",S_OK},
6881 {"winehq.com",S_OK},
6882 {"http://winehq.com/#hash",S_OK},
6883 {"winehq.com",S_OK},
6886 {"winehq.com",S_OK},
6891 {"http://winehq.com/#hash",S_OK},
6897 {Uri_HOST_DNS,S_OK},
6898 {80,S_OK,FALSE,TRUE},
6899 {URL_SCHEME_HTTP,S_OK},
6900 {URLZONE_INVALID,E_NOTIMPL}
6903 { "http://winehq.org/dir/test?querystring",0,
6904 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
6907 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6908 {"winehq.com",S_OK},
6909 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6910 {"winehq.com",S_OK},
6913 {"winehq.com",S_OK},
6915 {"/dir/file.txt",S_OK},
6916 {"/dir/file.txt?query",S_OK},
6918 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6924 {Uri_HOST_DNS,S_OK},
6925 {80,S_OK,FALSE,TRUE},
6926 {URL_SCHEME_HTTP,S_OK},
6927 {URLZONE_INVALID,E_NOTIMPL}
6932 typedef struct _uri_parse_test {
6937 const char *property;
6942 static const uri_parse_test uri_parse_tests[] = {
6943 /* PARSE_CANONICALIZE tests. */
6944 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6945 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6946 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6947 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6948 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6949 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6950 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6951 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6952 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6953 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6954 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6955 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6957 /* PARSE_FRIENDLY tests. */
6958 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6959 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6961 /* PARSE_ROOTDOCUMENT tests. */
6962 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6963 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6964 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6965 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6966 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6967 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6969 /* PARSE_DOCUMENT tests. */
6970 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6971 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6972 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6973 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6974 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6975 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6977 /* PARSE_PATH_FROM_URL tests. */
6978 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6979 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6980 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6981 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6982 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6984 /* PARSE_URL_FROM_PATH tests. */
6985 /* This function almost seems to useless (just returns the absolute uri). */
6986 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6987 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6988 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6989 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6990 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6992 /* PARSE_SCHEMA tests. */
6993 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6994 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6996 /* PARSE_SITE tests. */
6997 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6998 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6999 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7000 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7002 /* PARSE_DOMAIN tests. */
7003 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
7004 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7005 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7006 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7008 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7009 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7010 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7011 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7012 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7015 static inline LPWSTR a2w(LPCSTR str) {
7019 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
7020 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
7021 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
7027 static inline BOOL heap_free(void* mem) {
7028 return HeapFree(GetProcessHeap(), 0, mem);
7031 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7032 LPWSTR strAW = a2w(strA);
7033 DWORD ret = lstrcmpW(strAW, strB);
7038 static inline ULONG get_refcnt(IUri *uri) {
7040 return IUri_Release(uri);
7043 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7048 valueW = a2w(prop->value);
7049 switch(prop->property) {
7050 case Uri_PROPERTY_FRAGMENT:
7051 hr = IUriBuilder_SetFragment(builder, valueW);
7054 ok(hr == prop->expected,
7055 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7056 hr, prop->expected, test_index);
7059 ok(hr == prop->expected,
7060 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7061 hr, prop->expected, test_index);
7064 case Uri_PROPERTY_HOST:
7065 hr = IUriBuilder_SetHost(builder, valueW);
7068 ok(hr == prop->expected,
7069 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7070 hr, prop->expected, test_index);
7073 ok(hr == prop->expected,
7074 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7075 hr, prop->expected, test_index);
7078 case Uri_PROPERTY_PASSWORD:
7079 hr = IUriBuilder_SetPassword(builder, valueW);
7082 ok(hr == prop->expected,
7083 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7084 hr, prop->expected, test_index);
7087 ok(hr == prop->expected,
7088 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7089 hr, prop->expected, test_index);
7092 case Uri_PROPERTY_PATH:
7093 hr = IUriBuilder_SetPath(builder, valueW);
7096 ok(hr == prop->expected,
7097 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7098 hr, prop->expected, test_index);
7101 ok(hr == prop->expected,
7102 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7103 hr, prop->expected, test_index);
7106 case Uri_PROPERTY_QUERY:
7107 hr = IUriBuilder_SetQuery(builder, valueW);
7110 ok(hr == prop->expected,
7111 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7112 hr, prop->expected, test_index);
7115 ok(hr == prop->expected,
7116 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7117 hr, prop->expected, test_index);
7120 case Uri_PROPERTY_SCHEME_NAME:
7121 hr = IUriBuilder_SetSchemeName(builder, valueW);
7124 ok(hr == prop->expected,
7125 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7126 hr, prop->expected, test_index);
7129 ok(hr == prop->expected,
7130 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7131 hr, prop->expected, test_index);
7134 case Uri_PROPERTY_USER_NAME:
7135 hr = IUriBuilder_SetUserName(builder, valueW);
7138 ok(hr == prop->expected,
7139 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7140 hr, prop->expected, test_index);
7143 ok(hr == prop->expected,
7144 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7145 hr, prop->expected, test_index);
7149 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7156 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7159 static void test_CreateUri_InvalidFlags(void) {
7162 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7164 IUri *uri = (void*) 0xdeadbeef;
7166 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7167 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7168 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7169 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7173 static void test_CreateUri_InvalidArgs(void) {
7175 IUri *uri = (void*) 0xdeadbeef;
7177 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7178 static const WCHAR emptyW[] = {0};
7180 hr = pCreateUri(http_urlW, 0, 0, NULL);
7181 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7183 hr = pCreateUri(NULL, 0, 0, &uri);
7184 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7185 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7187 uri = (void*) 0xdeadbeef;
7188 hr = pCreateUri(invalidW, 0, 0, &uri);
7189 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7190 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7192 uri = (void*) 0xdeadbeef;
7193 hr = pCreateUri(emptyW, 0, 0, &uri);
7194 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7195 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7198 static void test_CreateUri_InvalidUri(void) {
7201 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
7202 invalid_uri test = invalid_uri_tests[i];
7207 uriW = a2w(test.uri);
7208 hr = pCreateUri(uriW, test.flags, 0, &uri);
7211 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7212 hr, E_INVALIDARG, i);
7215 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7216 hr, E_INVALIDARG, i);
7218 if(uri) IUri_Release(uri);
7224 static void test_IUri_GetPropertyBSTR(void) {
7229 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7230 hr = pCreateUri(http_urlW, 0, 0, &uri);
7231 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7233 BSTR received = NULL;
7235 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7236 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7238 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
7239 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7240 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7241 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7242 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7243 SysFreeString(received);
7245 /* Make sure it handles the ZONE property correctly. */
7247 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7248 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7249 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7250 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7251 SysFreeString(received);
7253 if(uri) IUri_Release(uri);
7255 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7256 uri_properties test = uri_tests[i];
7260 uriW = a2w(test.uri);
7261 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7262 if(test.create_todo) {
7264 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7265 hr, test.create_expected, i);
7268 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7269 hr, test.create_expected, i);
7275 /* Checks all the string properties of the uri. */
7276 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7277 BSTR received = NULL;
7278 uri_str_property prop = test.str_props[j];
7280 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7283 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7284 hr, prop.expected, i, j);
7287 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7288 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7289 prop.value, wine_dbgstr_w(received), i, j);
7292 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7293 hr, prop.expected, i, j);
7294 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7295 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7296 prop.value, wine_dbgstr_w(received), i, j);
7299 SysFreeString(received);
7303 if(uri) IUri_Release(uri);
7309 static void test_IUri_GetPropertyDWORD(void) {
7314 hr = pCreateUri(http_urlW, 0, 0, &uri);
7315 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7317 DWORD received = 0xdeadbeef;
7319 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7320 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7322 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7323 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7324 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7326 if(uri) IUri_Release(uri);
7328 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7329 uri_properties test = uri_tests[i];
7333 uriW = a2w(test.uri);
7334 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7335 if(test.create_todo) {
7337 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7338 hr, test.create_expected, i);
7341 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7342 hr, test.create_expected, i);
7348 /* Checks all the DWORD properties of the uri. */
7349 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
7351 uri_dword_property prop = test.dword_props[j];
7353 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7356 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7357 hr, prop.expected, i, j);
7360 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7361 prop.value, received, i, j);
7364 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7365 hr, prop.expected, i, j);
7366 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7367 prop.value, received, i, j);
7372 if(uri) IUri_Release(uri);
7378 /* Tests all the 'Get*' property functions which deal with strings. */
7379 static void test_IUri_GetStrProperties(void) {
7384 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7385 hr = pCreateUri(http_urlW, 0, 0, &uri);
7386 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7388 hr = IUri_GetAbsoluteUri(uri, NULL);
7389 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7391 hr = IUri_GetAuthority(uri, NULL);
7392 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7394 hr = IUri_GetDisplayUri(uri, NULL);
7395 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7397 hr = IUri_GetDomain(uri, NULL);
7398 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7400 hr = IUri_GetExtension(uri, NULL);
7401 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7403 hr = IUri_GetFragment(uri, NULL);
7404 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7406 hr = IUri_GetHost(uri, NULL);
7407 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7409 hr = IUri_GetPassword(uri, NULL);
7410 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7412 hr = IUri_GetPath(uri, NULL);
7413 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7415 hr = IUri_GetPathAndQuery(uri, NULL);
7416 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7418 hr = IUri_GetQuery(uri, NULL);
7419 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7421 hr = IUri_GetRawUri(uri, NULL);
7422 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7424 hr = IUri_GetSchemeName(uri, NULL);
7425 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7427 hr = IUri_GetUserInfo(uri, NULL);
7428 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7430 hr = IUri_GetUserName(uri, NULL);
7431 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7433 if(uri) IUri_Release(uri);
7435 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7436 uri_properties test = uri_tests[i];
7440 uriW = a2w(test.uri);
7441 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7442 if(test.create_todo) {
7444 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7445 hr, test.create_expected, i);
7448 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7449 hr, test.create_expected, i);
7453 uri_str_property prop;
7454 BSTR received = NULL;
7456 /* GetAbsoluteUri() tests. */
7457 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7458 hr = IUri_GetAbsoluteUri(uri, &received);
7461 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7462 hr, prop.expected, i);
7465 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7466 "Error: Expected %s but got %s on uri_tests[%d].\n",
7467 prop.value, wine_dbgstr_w(received), i);
7470 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7471 hr, prop.expected, i);
7472 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7473 "Error: Expected %s but got %s on uri_tests[%d].\n",
7474 prop.value, wine_dbgstr_w(received), i);
7476 SysFreeString(received);
7479 /* GetAuthority() tests. */
7480 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7481 hr = IUri_GetAuthority(uri, &received);
7484 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7485 hr, prop.expected, i);
7488 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7489 prop.value, wine_dbgstr_w(received), i);
7492 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7493 hr, prop.expected, i);
7494 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7495 prop.value, wine_dbgstr_w(received), i);
7497 SysFreeString(received);
7500 /* GetDisplayUri() tests. */
7501 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7502 hr = IUri_GetDisplayUri(uri, &received);
7505 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7506 hr, prop.expected, i);
7509 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7510 "Error: Expected %s but got %s on uri_test[%d].\n",
7511 prop.value, wine_dbgstr_w(received), i);
7514 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7515 hr, prop.expected, i);
7516 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7517 "Error: Expected %s but got %s on uri_tests[%d].\n",
7518 prop.value, wine_dbgstr_w(received), i);
7520 SysFreeString(received);
7523 /* GetDomain() tests. */
7524 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7525 hr = IUri_GetDomain(uri, &received);
7528 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7529 hr, prop.expected, i);
7532 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7533 prop.value, wine_dbgstr_w(received), i);
7536 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7537 hr, prop.expected, i);
7538 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7539 prop.value, wine_dbgstr_w(received), i);
7541 SysFreeString(received);
7544 /* GetExtension() tests. */
7545 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7546 hr = IUri_GetExtension(uri, &received);
7549 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7550 hr, prop.expected, i);
7553 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7554 prop.value, wine_dbgstr_w(received), i);
7557 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7558 hr, prop.expected, i);
7559 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7560 prop.value, wine_dbgstr_w(received), i);
7562 SysFreeString(received);
7565 /* GetFragment() tests. */
7566 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7567 hr = IUri_GetFragment(uri, &received);
7570 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7571 hr, prop.expected, i);
7574 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7575 prop.value, wine_dbgstr_w(received), i);
7578 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7579 hr, prop.expected, i);
7580 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7581 prop.value, wine_dbgstr_w(received), i);
7583 SysFreeString(received);
7586 /* GetHost() tests. */
7587 prop = test.str_props[Uri_PROPERTY_HOST];
7588 hr = IUri_GetHost(uri, &received);
7591 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7592 hr, prop.expected, i);
7595 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7596 prop.value, wine_dbgstr_w(received), i);
7599 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7600 hr, prop.expected, i);
7601 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7602 prop.value, wine_dbgstr_w(received), i);
7604 SysFreeString(received);
7607 /* GetPassword() tests. */
7608 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7609 hr = IUri_GetPassword(uri, &received);
7612 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7613 hr, prop.expected, i);
7616 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7617 prop.value, wine_dbgstr_w(received), i);
7620 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7621 hr, prop.expected, i);
7622 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7623 prop.value, wine_dbgstr_w(received), i);
7625 SysFreeString(received);
7628 /* GetPath() tests. */
7629 prop = test.str_props[Uri_PROPERTY_PATH];
7630 hr = IUri_GetPath(uri, &received);
7633 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7634 hr, prop.expected, i);
7637 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7638 prop.value, wine_dbgstr_w(received), i);
7641 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7642 hr, prop.expected, i);
7643 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7644 prop.value, wine_dbgstr_w(received), i);
7646 SysFreeString(received);
7649 /* GetPathAndQuery() tests. */
7650 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7651 hr = IUri_GetPathAndQuery(uri, &received);
7654 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7655 hr, prop.expected, i);
7658 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7659 prop.value, wine_dbgstr_w(received), i);
7662 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7663 hr, prop.expected, i);
7664 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7665 prop.value, wine_dbgstr_w(received), i);
7667 SysFreeString(received);
7670 /* GetQuery() tests. */
7671 prop = test.str_props[Uri_PROPERTY_QUERY];
7672 hr = IUri_GetQuery(uri, &received);
7675 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7676 hr, prop.expected, i);
7679 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7680 prop.value, wine_dbgstr_w(received), i);
7683 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7684 hr, prop.expected, i);
7685 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7686 prop.value, wine_dbgstr_w(received), i);
7688 SysFreeString(received);
7691 /* GetRawUri() tests. */
7692 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7693 hr = IUri_GetRawUri(uri, &received);
7696 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7697 hr, prop.expected, i);
7700 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7701 prop.value, wine_dbgstr_w(received), i);
7704 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7705 hr, prop.expected, i);
7706 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7707 prop.value, wine_dbgstr_w(received), i);
7709 SysFreeString(received);
7712 /* GetSchemeName() tests. */
7713 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7714 hr = IUri_GetSchemeName(uri, &received);
7717 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7718 hr, prop.expected, i);
7721 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7722 prop.value, wine_dbgstr_w(received), i);
7725 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7726 hr, prop.expected, i);
7727 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7728 prop.value, wine_dbgstr_w(received), i);
7730 SysFreeString(received);
7733 /* GetUserInfo() tests. */
7734 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7735 hr = IUri_GetUserInfo(uri, &received);
7738 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7739 hr, prop.expected, i);
7742 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7743 prop.value, wine_dbgstr_w(received), i);
7746 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7747 hr, prop.expected, i);
7748 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7749 prop.value, wine_dbgstr_w(received), i);
7751 SysFreeString(received);
7754 /* GetUserName() tests. */
7755 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7756 hr = IUri_GetUserName(uri, &received);
7759 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7760 hr, prop.expected, i);
7763 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7764 prop.value, wine_dbgstr_w(received), i);
7767 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7768 hr, prop.expected, i);
7769 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7770 prop.value, wine_dbgstr_w(received), i);
7772 SysFreeString(received);
7775 if(uri) IUri_Release(uri);
7781 static void test_IUri_GetDwordProperties(void) {
7786 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7787 hr = pCreateUri(http_urlW, 0, 0, &uri);
7788 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7790 hr = IUri_GetHostType(uri, NULL);
7791 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7793 hr = IUri_GetPort(uri, NULL);
7794 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7796 hr = IUri_GetScheme(uri, NULL);
7797 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7799 hr = IUri_GetZone(uri, NULL);
7800 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7802 if(uri) IUri_Release(uri);
7804 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7805 uri_properties test = uri_tests[i];
7809 uriW = a2w(test.uri);
7810 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7811 if(test.create_todo) {
7813 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7814 hr, test.create_expected, i);
7817 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7818 hr, test.create_expected, i);
7822 uri_dword_property prop;
7825 /* Assign an insane value so tests don't accidentally pass when
7828 received = -9999999;
7830 /* GetHostType() tests. */
7831 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7832 hr = IUri_GetHostType(uri, &received);
7835 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7836 hr, prop.expected, i);
7839 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7842 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7843 hr, prop.expected, i);
7844 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7846 received = -9999999;
7848 /* GetPort() tests. */
7849 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7850 hr = IUri_GetPort(uri, &received);
7853 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7854 hr, prop.expected, i);
7857 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7860 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7861 hr, prop.expected, i);
7862 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7864 received = -9999999;
7866 /* GetScheme() tests. */
7867 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7868 hr = IUri_GetScheme(uri, &received);
7871 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7872 hr, prop.expected, i);
7875 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7878 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7879 hr, prop.expected, i);
7880 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7882 received = -9999999;
7884 /* GetZone() tests. */
7885 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7886 hr = IUri_GetZone(uri, &received);
7889 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7890 hr, prop.expected, i);
7893 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7896 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7897 hr, prop.expected, i);
7898 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7902 if(uri) IUri_Release(uri);
7908 static void test_IUri_GetPropertyLength(void) {
7913 /* Make sure it handles invalid args correctly. */
7914 hr = pCreateUri(http_urlW, 0, 0, &uri);
7915 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7917 DWORD received = 0xdeadbeef;
7919 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7920 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7922 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7923 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7924 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7926 if(uri) IUri_Release(uri);
7928 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7929 uri_properties test = uri_tests[i];
7933 uriW = a2w(test.uri);
7934 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7935 if(test.create_todo) {
7937 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7938 hr, test.create_expected, i);
7941 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7942 hr, test.create_expected, i);
7948 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7949 DWORD expectedLen, brokenLen, receivedLen;
7950 uri_str_property prop = test.str_props[j];
7952 expectedLen = lstrlen(prop.value);
7953 brokenLen = lstrlen(prop.broken_value);
7955 /* This won't be necessary once GetPropertyLength is implemented. */
7958 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7961 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7962 hr, prop.expected, i, j);
7965 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7966 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7967 expectedLen, receivedLen, i, j);
7970 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7971 hr, prop.expected, i, j);
7972 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7973 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7974 expectedLen, receivedLen, i, j);
7979 if(uri) IUri_Release(uri);
7985 static DWORD compute_expected_props(uri_properties *test)
7989 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7990 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7994 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7995 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8002 static void test_IUri_GetProperties(void) {
8007 hr = pCreateUri(http_urlW, 0, 0, &uri);
8008 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8010 hr = IUri_GetProperties(uri, NULL);
8011 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8013 if(uri) IUri_Release(uri);
8015 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8016 uri_properties test = uri_tests[i];
8020 uriW = a2w(test.uri);
8021 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8022 if(test.create_todo) {
8024 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8027 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8031 DWORD received = 0, expected_props;
8034 hr = IUri_GetProperties(uri, &received);
8035 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8037 expected_props = compute_expected_props(&test);
8039 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8040 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8041 if(expected_props & (1 << j))
8042 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8044 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8048 if(uri) IUri_Release(uri);
8054 static void test_IUri_HasProperty(void) {
8059 hr = pCreateUri(http_urlW, 0, 0, &uri);
8060 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8062 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8063 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8065 if(uri) IUri_Release(uri);
8067 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8068 uri_properties test = uri_tests[i];
8072 uriW = a2w(test.uri);
8074 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8075 if(test.create_todo) {
8077 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8080 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8084 DWORD expected_props, j;
8086 expected_props = compute_expected_props(&test);
8088 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8089 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8092 hr = IUri_HasProperty(uri, j, &received);
8093 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8096 if(expected_props & (1 << j)) {
8097 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8099 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8104 if(uri) IUri_Release(uri);
8110 static void test_IUri_IsEqual(void) {
8118 /* Make sure IsEqual handles invalid args correctly. */
8119 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8120 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8121 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8122 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8125 hres = IUri_IsEqual(uriA, NULL, &equal);
8126 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8127 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8129 hres = IUri_IsEqual(uriA, uriB, NULL);
8130 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8135 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
8136 uri_equality test = equality_tests[i];
8137 LPWSTR uriA_W, uriB_W;
8141 uriA_W = a2w(test.a);
8142 uriB_W = a2w(test.b);
8144 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8145 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8147 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8148 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8151 hres = IUri_IsEqual(uriA, uriB, &equal);
8152 if(test.todo) todo_wine {
8153 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8154 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8156 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8157 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8159 if(uriA) IUri_Release(uriA);
8160 if(uriB) IUri_Release(uriB);
8167 static void test_CreateUriWithFragment_InvalidArgs(void) {
8169 IUri *uri = (void*) 0xdeadbeef;
8170 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8172 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8173 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8174 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8176 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8177 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8179 /* Original URI can't already contain a fragment component. */
8180 uri = (void*) 0xdeadbeef;
8181 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8182 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8183 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8186 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8187 static void test_CreateUriWithFragment_InvalidFlags(void) {
8190 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
8192 IUri *uri = (void*) 0xdeadbeef;
8194 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8195 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8196 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8197 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8201 static void test_CreateUriWithFragment(void) {
8204 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
8208 uri_with_fragment test = uri_fragment_tests[i];
8210 uriW = a2w(test.uri);
8211 fragW = a2w(test.fragment);
8213 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8214 if(test.expected_todo) {
8216 ok(hr == test.create_expected,
8217 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8218 hr, test.create_expected, i);
8221 ok(hr == test.create_expected,
8222 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8223 hr, test.create_expected, i);
8226 BSTR received = NULL;
8228 hr = IUri_GetAbsoluteUri(uri, &received);
8229 if(test.expected_todo) {
8232 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8236 ok(!strcmp_aw(test.expected_uri, received),
8237 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8238 test.expected_uri, wine_dbgstr_w(received), i);
8241 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8243 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8244 test.expected_uri, wine_dbgstr_w(received), i);
8247 SysFreeString(received);
8250 if(uri) IUri_Release(uri);
8256 static void test_CreateIUriBuilder(void) {
8258 IUriBuilder *builder = NULL;
8261 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8262 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8265 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8266 hr = pCreateUri(http_urlW, 0, 0, &uri);
8267 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8269 ULONG cur_count, orig_count;
8271 orig_count = get_refcnt(uri);
8272 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8273 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8274 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8276 cur_count = get_refcnt(uri);
8277 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8279 if(builder) IUriBuilder_Release(builder);
8280 cur_count = get_refcnt(uri);
8281 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8283 if(uri) IUri_Release(uri);
8286 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8291 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8292 if(test->uri_todo) {
8294 ok(hr == test->uri_hres,
8295 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8296 hr, test->uri_hres, test_index);
8299 ok(hr == test->uri_hres,
8300 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8301 hr, test->uri_hres, test_index);
8307 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8308 uri_builder_str_property prop = test->expected_str_props[i];
8309 BSTR received = NULL;
8311 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8314 ok(hr == prop.result,
8315 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8316 hr, prop.result, test_index, i);
8319 ok(hr == prop.result,
8320 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8321 hr, prop.result, test_index, i);
8326 ok(!strcmp_aw(prop.expected, received),
8327 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8328 prop.expected, wine_dbgstr_w(received), test_index, i);
8331 ok(!strcmp_aw(prop.expected, received),
8332 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8333 prop.expected, wine_dbgstr_w(received), test_index, i);
8336 SysFreeString(received);
8339 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8340 uri_builder_dword_property prop = test->expected_dword_props[i];
8341 DWORD received = -2;
8343 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8346 ok(hr == prop.result,
8347 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8348 hr, prop.result, test_index, i);
8351 ok(hr == prop.result,
8352 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8353 hr, prop.result, test_index, i);
8358 ok(received == prop.expected,
8359 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8360 prop.expected, received, test_index, i);
8363 ok(received == prop.expected,
8364 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8365 prop.expected, received, test_index, i);
8370 if(uri) IUri_Release(uri);
8373 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8378 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8379 if(test->uri_simple_todo) {
8381 ok(hr == test->uri_simple_hres,
8382 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8383 hr, test->uri_simple_hres, test_index);
8386 ok(hr == test->uri_simple_hres,
8387 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8388 hr, test->uri_simple_hres, test_index);
8394 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8395 uri_builder_str_property prop = test->expected_str_props[i];
8396 BSTR received = NULL;
8398 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8401 ok(hr == prop.result,
8402 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8403 hr, prop.result, test_index, i);
8406 ok(hr == prop.result,
8407 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8408 hr, prop.result, test_index, i);
8413 ok(!strcmp_aw(prop.expected, received),
8414 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8415 prop.expected, wine_dbgstr_w(received), test_index, i);
8418 ok(!strcmp_aw(prop.expected, received),
8419 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8420 prop.expected, wine_dbgstr_w(received), test_index, i);
8423 SysFreeString(received);
8426 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8427 uri_builder_dword_property prop = test->expected_dword_props[i];
8428 DWORD received = -2;
8430 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8433 ok(hr == prop.result,
8434 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8435 hr, prop.result, test_index, i);
8438 ok(hr == prop.result,
8439 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8440 hr, prop.result, test_index, i);
8445 ok(received == prop.expected,
8446 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8447 prop.expected, received, test_index, i);
8450 ok(received == prop.expected,
8451 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8452 prop.expected, received, test_index, i);
8457 if(uri) IUri_Release(uri);
8460 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8465 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8466 test->uri_with_encode_flags, 0, &uri);
8467 if(test->uri_with_todo) {
8469 ok(hr == test->uri_with_hres,
8470 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8471 hr, test->uri_with_hres, test_index);
8474 ok(hr == test->uri_with_hres,
8475 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8476 hr, test->uri_with_hres, test_index);
8482 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8483 uri_builder_str_property prop = test->expected_str_props[i];
8484 BSTR received = NULL;
8486 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8489 ok(hr == prop.result,
8490 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8491 hr, prop.result, test_index, i);
8494 ok(hr == prop.result,
8495 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8496 hr, prop.result, test_index, i);
8501 ok(!strcmp_aw(prop.expected, received),
8502 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8503 prop.expected, wine_dbgstr_w(received), test_index, i);
8506 ok(!strcmp_aw(prop.expected, received),
8507 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8508 prop.expected, wine_dbgstr_w(received), test_index, i);
8511 SysFreeString(received);
8514 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8515 uri_builder_dword_property prop = test->expected_dword_props[i];
8516 DWORD received = -2;
8518 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8521 ok(hr == prop.result,
8522 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8523 hr, prop.result, test_index, i);
8526 ok(hr == prop.result,
8527 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8528 hr, prop.result, test_index, i);
8533 ok(received == prop.expected,
8534 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8535 prop.expected, received, test_index, i);
8538 ok(received == prop.expected,
8539 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8540 prop.expected, received, test_index, i);
8545 if(uri) IUri_Release(uri);
8548 static void test_IUriBuilder_CreateInvalidArgs(void) {
8549 IUriBuilder *builder;
8552 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8553 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8555 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8557 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8558 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8559 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8561 uri = (void*) 0xdeadbeef;
8562 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8563 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8564 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8566 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8567 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8570 uri = (void*) 0xdeadbeef;
8571 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8572 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8574 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8576 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8577 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8580 uri = (void*) 0xdeadbeef;
8581 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8582 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8584 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8586 hr = pCreateUri(http_urlW, 0, 0, &test);
8587 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8589 hr = IUriBuilder_SetIUri(builder, test);
8590 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8592 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8594 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8595 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8596 ok(uri != NULL, "Error: The uri was NULL.\n");
8597 if(uri) IUri_Release(uri);
8600 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8601 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8603 ok(uri != NULL, "Error: uri was NULL.\n");
8604 if(uri) IUri_Release(uri);
8607 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8608 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8610 ok(uri != NULL, "Error: uri was NULL.\n");
8611 if(uri) IUri_Release(uri);
8613 hr = IUriBuilder_SetFragment(builder, NULL);
8614 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8616 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8617 uri = (void*) 0xdeadbeef;
8618 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8619 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8620 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8622 uri = (void*) 0xdeadbeef;
8623 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8624 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8626 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8628 uri = (void*) 0xdeadbeef;
8629 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8630 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8632 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8634 if(test) IUri_Release(test);
8636 if(builder) IUriBuilder_Release(builder);
8639 /* Tests invalid args to the "Get*" functions. */
8640 static void test_IUriBuilder_GetInvalidArgs(void) {
8641 IUriBuilder *builder = NULL;
8644 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8645 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8647 LPCWSTR received = (void*) 0xdeadbeef;
8648 DWORD len = -1, port = -1;
8651 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8652 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8654 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8655 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8657 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8658 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8659 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8661 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8663 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8664 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8666 received = (void*) 0xdeadbeef;
8667 hr = IUriBuilder_GetHost(builder, NULL, &received);
8668 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8670 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8672 hr = IUriBuilder_GetHost(builder, &len, NULL);
8673 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8675 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8677 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8678 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8680 received = (void*) 0xdeadbeef;
8681 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8682 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8684 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8686 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8687 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8689 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8691 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8692 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8694 received = (void*) 0xdeadbeef;
8695 hr = IUriBuilder_GetPath(builder, NULL, &received);
8696 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8698 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8700 hr = IUriBuilder_GetPath(builder, &len, NULL);
8701 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8703 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8705 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8706 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8708 hr = IUriBuilder_GetPort(builder, NULL, &port);
8709 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8711 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8712 hr = IUriBuilder_GetPort(builder, &set, NULL);
8713 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8715 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8717 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8718 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8720 received = (void*) 0xdeadbeef;
8721 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8722 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8724 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8726 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8727 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8729 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8731 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8732 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8734 received = (void*) 0xdeadbeef;
8735 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8736 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8738 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8740 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8741 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8743 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8745 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8746 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8748 received = (void*) 0xdeadbeef;
8749 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8750 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8752 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8754 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8755 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8757 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8759 if(builder) IUriBuilder_Release(builder);
8762 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8766 LPCWSTR received = NULL;
8768 const uri_builder_property *prop = NULL;
8770 /* Check if the property was set earlier. */
8771 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8772 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8773 prop = &(test->properties[i]);
8777 /* Use expected_value unless it's NULL, then use value. */
8778 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8779 hr = IUriBuilder_GetFragment(builder, &len, &received);
8782 ok(hr == (expected ? S_OK : S_FALSE),
8783 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8784 hr, (expected ? S_OK : S_FALSE), test_index);
8788 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8789 expected, wine_dbgstr_w(received), test_index);
8792 ok(lstrlen(expected) == len,
8793 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8794 lstrlen(expected), len, test_index);
8798 ok(hr == (expected ? S_OK : S_FALSE),
8799 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8800 hr, (expected ? S_OK : S_FALSE), test_index);
8801 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8802 expected, wine_dbgstr_w(received), test_index);
8803 ok(lstrlen(expected) == len,
8804 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8805 lstrlen(expected), len, test_index);
8808 /* The property wasn't set earlier, so it should return whatever
8809 * the base IUri contains (if anything).
8812 hr = IUriBuilder_GetIUri(builder, &uri);
8814 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8815 hr, S_OK, test_index);
8818 received = (void*) 0xdeadbeef;
8821 hr = IUriBuilder_GetFragment(builder, &len, &received);
8823 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8824 hr, S_FALSE, test_index);
8826 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8828 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8829 received, test_index);
8832 BOOL has_prop = FALSE;
8833 BSTR expected = NULL;
8835 hr = IUri_GetFragment(uri, &expected);
8837 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8839 has_prop = hr == S_OK;
8841 hr = IUriBuilder_GetFragment(builder, &len, &received);
8844 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8845 hr, S_OK, test_index);
8847 ok(!lstrcmpW(expected, received),
8848 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8849 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8850 ok(lstrlenW(expected) == len,
8851 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8852 lstrlenW(expected), len, test_index);
8856 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8857 hr, S_FALSE, test_index);
8859 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8860 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8864 SysFreeString(expected);
8867 if(uri) IUri_Release(uri);
8871 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8875 LPCWSTR received = NULL;
8877 const uri_builder_property *prop = NULL;
8879 /* Check if the property was set earlier. */
8880 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8881 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8882 prop = &(test->properties[i]);
8886 /* Use expected_value unless it's NULL, then use value. */
8887 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8888 hr = IUriBuilder_GetHost(builder, &len, &received);
8891 ok(hr == (expected ? S_OK : S_FALSE),
8892 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8893 hr, (expected ? S_OK : S_FALSE), test_index);
8897 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8898 expected, wine_dbgstr_w(received), test_index);
8901 ok(lstrlen(expected) == len,
8902 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8903 lstrlen(expected), len, test_index);
8907 ok(hr == (expected ? S_OK : S_FALSE),
8908 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8909 hr, (expected ? S_OK : S_FALSE), test_index);
8910 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8911 expected, wine_dbgstr_w(received), test_index);
8912 ok(lstrlen(expected) == len,
8913 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8914 lstrlen(expected), len, test_index);
8917 /* The property wasn't set earlier, so it should return whatever
8918 * the base IUri contains (if anything).
8921 hr = IUriBuilder_GetIUri(builder, &uri);
8923 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8924 hr, S_OK, test_index);
8927 received = (void*) 0xdeadbeef;
8930 hr = IUriBuilder_GetHost(builder, &len, &received);
8932 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8933 hr, S_FALSE, test_index);
8935 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8937 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8938 received, test_index);
8941 BOOL has_prop = FALSE;
8942 BSTR expected = NULL;
8944 hr = IUri_GetHost(uri, &expected);
8946 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8948 has_prop = hr == S_OK;
8950 hr = IUriBuilder_GetHost(builder, &len, &received);
8953 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8954 hr, S_OK, test_index);
8956 ok(!lstrcmpW(expected, received),
8957 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8958 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8959 ok(lstrlenW(expected) == len,
8960 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8961 lstrlenW(expected), len, test_index);
8965 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8966 hr, S_FALSE, test_index);
8968 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8969 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8973 SysFreeString(expected);
8976 if(uri) IUri_Release(uri);
8980 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8984 LPCWSTR received = NULL;
8986 const uri_builder_property *prop = NULL;
8988 /* Check if the property was set earlier. */
8989 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8990 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8991 prop = &(test->properties[i]);
8995 /* Use expected_value unless it's NULL, then use value. */
8996 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8997 hr = IUriBuilder_GetPassword(builder, &len, &received);
9000 ok(hr == (expected ? S_OK : S_FALSE),
9001 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9002 hr, (expected ? S_OK : S_FALSE), test_index);
9006 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9007 expected, wine_dbgstr_w(received), test_index);
9010 ok(lstrlen(expected) == len,
9011 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9012 lstrlen(expected), len, test_index);
9016 ok(hr == (expected ? S_OK : S_FALSE),
9017 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9018 hr, (expected ? S_OK : S_FALSE), test_index);
9019 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9020 expected, wine_dbgstr_w(received), test_index);
9021 ok(lstrlen(expected) == len,
9022 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9023 lstrlen(expected), len, test_index);
9026 /* The property wasn't set earlier, so it should return whatever
9027 * the base IUri contains (if anything).
9030 hr = IUriBuilder_GetIUri(builder, &uri);
9032 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9033 hr, S_OK, test_index);
9036 received = (void*) 0xdeadbeef;
9039 hr = IUriBuilder_GetPassword(builder, &len, &received);
9041 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9042 hr, S_FALSE, test_index);
9044 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9046 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9047 received, test_index);
9050 BOOL has_prop = FALSE;
9051 BSTR expected = NULL;
9053 hr = IUri_GetPassword(uri, &expected);
9055 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9057 has_prop = hr == S_OK;
9059 hr = IUriBuilder_GetPassword(builder, &len, &received);
9062 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9063 hr, S_OK, test_index);
9065 ok(!lstrcmpW(expected, received),
9066 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9067 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9068 ok(lstrlenW(expected) == len,
9069 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9070 lstrlenW(expected), len, test_index);
9074 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9075 hr, S_FALSE, test_index);
9077 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9078 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9082 SysFreeString(expected);
9085 if(uri) IUri_Release(uri);
9089 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9093 LPCWSTR received = NULL;
9095 const uri_builder_property *prop = NULL;
9097 /* Check if the property was set earlier. */
9098 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9099 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9100 prop = &(test->properties[i]);
9104 /* Use expected_value unless it's NULL, then use value. */
9105 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9106 hr = IUriBuilder_GetPath(builder, &len, &received);
9109 ok(hr == (expected ? S_OK : S_FALSE),
9110 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9111 hr, (expected ? S_OK : S_FALSE), test_index);
9115 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9116 expected, wine_dbgstr_w(received), test_index);
9119 ok(lstrlen(expected) == len,
9120 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9121 lstrlen(expected), len, test_index);
9125 ok(hr == (expected ? S_OK : S_FALSE),
9126 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9127 hr, (expected ? S_OK : S_FALSE), test_index);
9128 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9129 expected, wine_dbgstr_w(received), test_index);
9130 ok(lstrlen(expected) == len,
9131 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9132 lstrlen(expected), len, test_index);
9135 /* The property wasn't set earlier, so it should return whatever
9136 * the base IUri contains (if anything).
9139 hr = IUriBuilder_GetIUri(builder, &uri);
9141 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9142 hr, S_OK, test_index);
9145 received = (void*) 0xdeadbeef;
9148 hr = IUriBuilder_GetPath(builder, &len, &received);
9150 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9151 hr, S_FALSE, test_index);
9153 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9155 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9156 received, test_index);
9159 BOOL has_prop = FALSE;
9160 BSTR expected = NULL;
9162 hr = IUri_GetPath(uri, &expected);
9164 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9166 has_prop = hr == S_OK;
9168 hr = IUriBuilder_GetPath(builder, &len, &received);
9171 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9172 hr, S_OK, test_index);
9174 ok(!lstrcmpW(expected, received),
9175 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9176 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9177 ok(lstrlenW(expected) == len,
9178 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9179 lstrlenW(expected), len, test_index);
9183 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9184 hr, S_FALSE, test_index);
9186 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9187 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9191 SysFreeString(expected);
9194 if(uri) IUri_Release(uri);
9198 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9201 BOOL has_port = FALSE;
9202 DWORD received = -1;
9204 if(test->port_prop.change) {
9205 DWORD expected = test->port_prop.value;
9207 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9208 if(test->port_prop.todo) {
9211 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9212 hr, S_OK, test_index);
9216 ok(has_port == test->port_prop.set,
9217 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
9218 test->port_prop.set, has_port, test_index);
9221 ok(received == expected,
9222 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9223 expected, received, test_index);
9228 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9229 hr, S_OK, test_index);
9230 ok(has_port == test->port_prop.set,
9231 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9232 test->port_prop.set, has_port, test_index);
9233 ok(received == test->port_prop.value,
9234 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9235 test->port_prop.value, received, test_index);
9240 hr = IUriBuilder_GetIUri(builder, &uri);
9242 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9243 hr, S_OK, test_index);
9246 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9248 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9249 hr, S_OK, test_index);
9251 ok(has_port == FALSE,
9252 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9253 has_port, test_index);
9254 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9255 received, test_index);
9260 hr = IUri_GetPort(uri, &expected);
9262 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9265 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9267 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9268 hr, S_OK, test_index);
9271 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9273 ok(received == expected,
9274 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9275 expected, received, test_index);
9279 if(uri) IUri_Release(uri);
9283 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9287 LPCWSTR received = NULL;
9289 const uri_builder_property *prop = NULL;
9291 /* Check if the property was set earlier. */
9292 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9293 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9294 prop = &(test->properties[i]);
9298 /* Use expected_value unless it's NULL, then use value. */
9299 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9300 hr = IUriBuilder_GetQuery(builder, &len, &received);
9303 ok(hr == (expected ? S_OK : S_FALSE),
9304 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9305 hr, (expected ? S_OK : S_FALSE), test_index);
9309 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9310 expected, wine_dbgstr_w(received), test_index);
9313 ok(lstrlen(expected) == len,
9314 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9315 lstrlen(expected), len, test_index);
9319 ok(hr == (expected ? S_OK : S_FALSE),
9320 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9321 hr, (expected ? S_OK : S_FALSE), test_index);
9322 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9323 expected, wine_dbgstr_w(received), test_index);
9324 ok(lstrlen(expected) == len,
9325 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9326 lstrlen(expected), len, test_index);
9329 /* The property wasn't set earlier, so it should return whatever
9330 * the base IUri contains (if anything).
9333 hr = IUriBuilder_GetIUri(builder, &uri);
9335 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9336 hr, S_OK, test_index);
9339 received = (void*) 0xdeadbeef;
9342 hr = IUriBuilder_GetQuery(builder, &len, &received);
9344 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9345 hr, S_FALSE, test_index);
9347 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9349 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9350 received, test_index);
9353 BOOL has_prop = FALSE;
9354 BSTR expected = NULL;
9356 hr = IUri_GetQuery(uri, &expected);
9358 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9360 has_prop = hr == S_OK;
9362 hr = IUriBuilder_GetQuery(builder, &len, &received);
9365 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9366 hr, S_OK, test_index);
9368 ok(!lstrcmpW(expected, received),
9369 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9370 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9371 ok(lstrlenW(expected) == len,
9372 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9373 lstrlenW(expected), len, test_index);
9377 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9378 hr, S_FALSE, test_index);
9380 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9381 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9385 SysFreeString(expected);
9388 if(uri) IUri_Release(uri);
9392 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9396 LPCWSTR received = NULL;
9398 const uri_builder_property *prop = NULL;
9400 /* Check if the property was set earlier. */
9401 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9402 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9403 prop = &(test->properties[i]);
9407 /* Use expected_value unless it's NULL, then use value. */
9408 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9409 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9412 ok(hr == (expected ? S_OK : S_FALSE),
9413 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9414 hr, (expected ? S_OK : S_FALSE), test_index);
9418 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9419 expected, wine_dbgstr_w(received), test_index);
9422 ok(lstrlen(expected) == len,
9423 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9424 lstrlen(expected), len, test_index);
9428 ok(hr == (expected ? S_OK : S_FALSE),
9429 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9430 hr, (expected ? S_OK : S_FALSE), test_index);
9431 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9432 expected, wine_dbgstr_w(received), test_index);
9433 ok(lstrlen(expected) == len,
9434 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9435 lstrlen(expected), len, test_index);
9438 /* The property wasn't set earlier, so it should return whatever
9439 * the base IUri contains (if anything).
9442 hr = IUriBuilder_GetIUri(builder, &uri);
9444 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9445 hr, S_OK, test_index);
9448 received = (void*) 0xdeadbeef;
9451 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9453 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9454 hr, S_FALSE, test_index);
9456 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9458 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9459 received, test_index);
9462 BOOL has_prop = FALSE;
9463 BSTR expected = NULL;
9465 hr = IUri_GetSchemeName(uri, &expected);
9467 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9469 has_prop = hr == S_OK;
9471 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9474 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9475 hr, S_OK, test_index);
9477 ok(!lstrcmpW(expected, received),
9478 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9479 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9480 ok(lstrlenW(expected) == len,
9481 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9482 lstrlenW(expected), len, test_index);
9486 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9487 hr, S_FALSE, test_index);
9489 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9490 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9494 SysFreeString(expected);
9497 if(uri) IUri_Release(uri);
9501 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9505 LPCWSTR received = NULL;
9507 const uri_builder_property *prop = NULL;
9509 /* Check if the property was set earlier. */
9510 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9511 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9512 prop = &(test->properties[i]);
9515 if(prop && prop->value && *prop->value) {
9516 /* Use expected_value unless it's NULL, then use value. */
9517 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9518 hr = IUriBuilder_GetUserName(builder, &len, &received);
9521 ok(hr == (expected ? S_OK : S_FALSE),
9522 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9523 hr, (expected ? S_OK : S_FALSE), test_index);
9527 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9528 expected, wine_dbgstr_w(received), test_index);
9531 ok(lstrlen(expected) == len,
9532 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9533 lstrlen(expected), len, test_index);
9537 ok(hr == (expected ? S_OK : S_FALSE),
9538 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9539 hr, (expected ? S_OK : S_FALSE), test_index);
9540 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9541 expected, wine_dbgstr_w(received), test_index);
9542 ok(lstrlen(expected) == len,
9543 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9544 lstrlen(expected), len, test_index);
9547 /* The property wasn't set earlier, so it should return whatever
9548 * the base IUri contains (if anything).
9551 hr = IUriBuilder_GetIUri(builder, &uri);
9553 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9554 hr, S_OK, test_index);
9557 received = (void*) 0xdeadbeef;
9560 hr = IUriBuilder_GetUserName(builder, &len, &received);
9562 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9563 hr, S_FALSE, test_index);
9565 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9567 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9568 received, test_index);
9571 BSTR expected = NULL;
9572 BOOL has_prop = FALSE;
9574 hr = IUri_GetUserName(uri, &expected);
9576 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9578 has_prop = hr == S_OK;
9580 hr = IUriBuilder_GetUserName(builder, &len, &received);
9583 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9584 hr, S_OK, test_index);
9586 ok(!lstrcmpW(expected, received),
9587 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9588 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9589 ok(lstrlenW(expected) == len,
9590 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9591 lstrlenW(expected), len, test_index);
9595 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9596 hr, S_FALSE, test_index);
9598 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9599 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9603 SysFreeString(expected);
9606 if(uri) IUri_Release(uri);
9610 /* Tests IUriBuilder functions. */
9611 static void test_IUriBuilder(void) {
9613 IUriBuilder *builder;
9616 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9618 uri_builder_test test = uri_builder_tests[i];
9622 uriW = a2w(test.uri);
9623 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9624 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9626 if(FAILED(hr)) continue;
9628 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9629 if(test.create_builder_todo) {
9631 ok(hr == test.create_builder_expected,
9632 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9633 hr, test.create_builder_expected, i);
9636 ok(hr == test.create_builder_expected,
9637 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9638 hr, test.create_builder_expected, i);
9642 BOOL modified = FALSE, received = FALSE;
9644 /* Perform all the string property changes. */
9645 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9646 uri_builder_property prop = test.properties[j];
9648 change_property(builder, &prop, i);
9649 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9650 prop.property != Uri_PROPERTY_HOST)
9652 else if(prop.value && *prop.value)
9654 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9655 /* Host name property can't be NULL, but it can be empty. */
9660 if(test.port_prop.change) {
9661 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9663 if(test.port_prop.todo) {
9665 ok(hr == test.port_prop.expected,
9666 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9667 hr, test.port_prop.expected, i);
9670 ok(hr == test.port_prop.expected,
9671 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9672 hr, test.port_prop.expected, i);
9676 hr = IUriBuilder_HasBeenModified(builder, &received);
9678 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9681 ok(received == modified,
9682 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9683 modified, received, i);
9685 /* Test the "Get*" functions. */
9686 test_IUriBuilder_GetFragment(builder, &test, i);
9687 test_IUriBuilder_GetHost(builder, &test, i);
9688 test_IUriBuilder_GetPassword(builder, &test, i);
9689 test_IUriBuilder_GetPath(builder, &test, i);
9690 test_IUriBuilder_GetPort(builder, &test, i);
9691 test_IUriBuilder_GetQuery(builder, &test, i);
9692 test_IUriBuilder_GetSchemeName(builder, &test, i);
9693 test_IUriBuilder_GetUserName(builder, &test, i);
9695 test_IUriBuilder_CreateUri(builder, &test, i);
9696 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9697 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9699 if(builder) IUriBuilder_Release(builder);
9700 if(uri) IUri_Release(uri);
9705 static void test_IUriBuilder_HasBeenModified(void) {
9707 IUriBuilder *builder = NULL;
9709 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9710 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9712 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9716 hr = IUriBuilder_HasBeenModified(builder, NULL);
9717 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9720 hr = IUriBuilder_SetHost(builder, hostW);
9721 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9724 hr = IUriBuilder_HasBeenModified(builder, &received);
9725 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9728 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9730 hr = pCreateUri(http_urlW, 0, 0, &uri);
9731 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9736 hr = IUriBuilder_SetIUri(builder, uri);
9737 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9740 hr = IUriBuilder_HasBeenModified(builder, &received);
9741 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9744 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9746 /* Test what happens with you call SetIUri with the same IUri again. */
9747 hr = IUriBuilder_SetHost(builder, hostW);
9748 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9750 hr = IUriBuilder_HasBeenModified(builder, &received);
9751 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9754 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9756 hr = IUriBuilder_SetIUri(builder, uri);
9757 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9759 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9760 * reset any of the changes that were made to the IUriBuilder.
9762 hr = IUriBuilder_HasBeenModified(builder, &received);
9763 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9765 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9767 hr = IUriBuilder_GetHost(builder, &len, &prop);
9768 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9770 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9771 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9772 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9773 lstrlenW(hostW), len);
9776 hr = IUriBuilder_SetIUri(builder, NULL);
9777 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9779 hr = IUriBuilder_SetHost(builder, hostW);
9780 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9781 hr = IUriBuilder_HasBeenModified(builder, &received);
9782 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9785 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9787 hr = IUriBuilder_SetIUri(builder, NULL);
9788 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9790 hr = IUriBuilder_HasBeenModified(builder, &received);
9791 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9794 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9796 hr = IUriBuilder_GetHost(builder, &len, &prop);
9797 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9799 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9800 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9801 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9802 lstrlenW(hostW), len);
9805 if(uri) IUri_Release(uri);
9807 if(builder) IUriBuilder_Release(builder);
9810 /* Test IUriBuilder {Get,Set}IUri functions. */
9811 static void test_IUriBuilder_IUriProperty(void) {
9812 IUriBuilder *builder = NULL;
9815 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9816 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9820 hr = IUriBuilder_GetIUri(builder, NULL);
9821 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9824 hr = pCreateUri(http_urlW, 0, 0, &uri);
9827 ULONG cur_count, orig_count;
9829 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9830 orig_count = get_refcnt(uri);
9831 hr = IUriBuilder_SetIUri(builder, uri);
9832 cur_count = get_refcnt(uri);
9834 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9835 orig_count+1, cur_count);
9837 hr = IUriBuilder_SetIUri(builder, NULL);
9838 cur_count = get_refcnt(uri);
9840 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9841 orig_count, cur_count);
9843 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9844 hr = IUriBuilder_SetIUri(builder, uri);
9845 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9846 orig_count = get_refcnt(uri);
9848 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9849 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9851 cur_count = get_refcnt(uri);
9852 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9853 orig_count+1, cur_count);
9854 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9857 if(test) IUri_Release(test);
9860 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9861 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9863 cur_count = get_refcnt(uri);
9864 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9865 orig_count+1, cur_count);
9866 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9868 if(test) IUri_Release(test);
9870 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9874 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9875 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9877 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9879 if(test) IUri_Release(test);
9881 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9882 * explicitly set (because it's a default flags).
9885 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9886 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9888 cur_count = get_refcnt(uri);
9889 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9890 orig_count+1, cur_count);
9891 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9893 if(test) IUri_Release(test);
9896 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9897 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9899 cur_count = get_refcnt(uri);
9900 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9901 orig_count+1, cur_count);
9902 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9904 if(test) IUri_Release(test);
9907 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9908 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9911 cur_count = get_refcnt(uri);
9912 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9913 orig_count+1, cur_count);
9914 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9916 if(test) IUri_Release(test);
9918 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9922 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9923 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9925 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9927 if(test) IUri_Release(test);
9929 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9930 * explicitly set (because it's a default flags).
9933 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9934 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9936 cur_count = get_refcnt(uri);
9937 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9938 orig_count+1, cur_count);
9939 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9941 if(test) IUri_Release(test);
9943 if(uri) IUri_Release(uri);
9945 if(builder) IUriBuilder_Release(builder);
9948 static void test_IUriBuilder_RemoveProperties(void) {
9949 IUriBuilder *builder = NULL;
9953 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9954 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9956 /* Properties that can't be removed. */
9957 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9958 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9960 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9961 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9962 if((i << 1) & invalid) {
9963 ok(hr == E_INVALIDARG,
9964 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9965 hr, E_INVALIDARG, i);
9968 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9973 /* Also doesn't accept anything that's outside the range of the
9976 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9977 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9980 if(builder) IUriBuilder_Release(builder);
9982 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9983 uri_builder_remove_test test = uri_builder_remove_tests[i];
9987 uriW = a2w(test.uri);
9988 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9992 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9993 if(test.create_builder_todo) {
9995 ok(hr == test.create_builder_expected,
9996 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9997 hr, test.create_builder_expected, i);
10000 ok(hr == test.create_builder_expected,
10001 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10002 hr, test.create_builder_expected, i);
10004 if(SUCCEEDED(hr)) {
10005 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10006 if(test.remove_todo) {
10008 ok(hr == test.remove_expected,
10009 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
10010 hr, test.remove_expected, i);
10013 ok(hr == test.remove_expected,
10014 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10015 hr, test.remove_expected, i);
10017 if(SUCCEEDED(hr)) {
10018 IUri *result = NULL;
10020 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10021 if(test.expected_todo) {
10023 ok(hr == test.expected_hres,
10024 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10025 hr, test.expected_hres, i);
10028 ok(hr == test.expected_hres,
10029 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10030 hr, test.expected_hres, i);
10032 if(SUCCEEDED(hr)) {
10033 BSTR received = NULL;
10035 hr = IUri_GetAbsoluteUri(result, &received);
10036 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10037 ok(!strcmp_aw(test.expected_uri, received),
10038 "Error: Expected %s but got %s instead on test %d.\n",
10039 test.expected_uri, wine_dbgstr_w(received), i);
10040 SysFreeString(received);
10042 if(result) IUri_Release(result);
10045 if(builder) IUriBuilder_Release(builder);
10047 if(uri) IUri_Release(uri);
10052 static void test_IUriBuilder_Misc(void) {
10056 hr = pCreateUri(http_urlW, 0, 0, &uri);
10057 if(SUCCEEDED(hr)) {
10058 IUriBuilder *builder;
10060 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10061 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10062 if(SUCCEEDED(hr)) {
10066 hr = IUriBuilder_GetPort(builder, &has, &port);
10067 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10068 if(SUCCEEDED(hr)) {
10069 /* 'has' will be set to FALSE, even though uri had a port. */
10070 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10071 /* Still sets 'port' to 80. */
10072 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
10075 if(builder) IUriBuilder_Release(builder);
10077 if(uri) IUri_Release(uri);
10080 static void test_IUriBuilderFactory(void) {
10083 IUriBuilderFactory *factory;
10084 IUriBuilder *builder;
10086 hr = pCreateUri(http_urlW, 0, 0, &uri);
10087 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10088 if(SUCCEEDED(hr)) {
10090 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10091 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
10092 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10094 if(SUCCEEDED(hr)) {
10095 builder = (void*) 0xdeadbeef;
10096 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10097 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10099 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10101 builder = (void*) 0xdeadbeef;
10102 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10103 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10105 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10107 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10108 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10112 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10113 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10115 if(SUCCEEDED(hr)) {
10116 IUri *tmp = (void*) 0xdeadbeef;
10120 hr = IUriBuilder_GetIUri(builder, &tmp);
10121 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10123 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10125 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10126 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10129 if(builder) IUriBuilder_Release(builder);
10131 builder = (void*) 0xdeadbeef;
10132 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10133 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10135 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10137 builder = (void*) 0xdeadbeef;
10138 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10139 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10141 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10143 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10144 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10148 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10149 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10151 if(SUCCEEDED(hr)) {
10154 hr = IUriBuilder_GetIUri(builder, &tmp);
10155 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10157 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10158 if(uri) IUri_Release(uri);
10160 if(builder) IUriBuilder_Release(builder);
10162 if(factory) IUriBuilderFactory_Release(factory);
10164 if(uri) IUri_Release(uri);
10167 static void test_CoInternetCombineIUri(void) {
10169 IUri *base, *relative, *result;
10173 hr = pCreateUri(http_urlW, 0, 0, &base);
10174 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10175 if(SUCCEEDED(hr)) {
10176 result = (void*) 0xdeadbeef;
10177 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10178 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10179 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10183 hr = pCreateUri(http_urlW, 0, 0, &relative);
10184 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10185 if(SUCCEEDED(hr)) {
10186 result = (void*) 0xdeadbeef;
10187 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10188 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10189 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10192 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10193 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10195 if(base) IUri_Release(base);
10196 if(relative) IUri_Release(relative);
10198 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10199 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10201 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10202 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10203 if(SUCCEEDED(hr)) {
10204 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10206 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10207 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10208 if(SUCCEEDED(hr)) {
10211 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10212 if(uri_combine_tests[i].todo) {
10214 ok(hr == uri_combine_tests[i].expected,
10215 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10216 hr, uri_combine_tests[i].expected, i);
10219 ok(hr == uri_combine_tests[i].expected,
10220 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10221 hr, uri_combine_tests[i]. expected, i);
10223 if(SUCCEEDED(hr)) {
10226 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10227 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10230 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10233 ok(hr == prop.expected,
10234 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10235 hr, prop.expected, i, j);
10238 ok(!strcmp_aw(prop.value, received) ||
10239 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10240 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10241 prop.value, wine_dbgstr_w(received), i, j);
10244 ok(hr == prop.expected,
10245 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10246 hr, prop.expected, i, j);
10247 ok(!strcmp_aw(prop.value, received) ||
10248 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10249 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10250 prop.value, wine_dbgstr_w(received), i, j);
10252 SysFreeString(received);
10255 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10256 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10259 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10262 ok(hr == prop.expected,
10263 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10264 hr, prop.expected, i, j);
10267 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10268 prop.value, received, i, j);
10271 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10272 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10273 hr, prop.expected, i, j);
10274 if(!prop.broken_combine_hres || hr != S_FALSE)
10275 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10276 prop.value, received, i, j);
10280 if(result) IUri_Release(result);
10282 if(relative) IUri_Release(relative);
10283 heap_free(relativeW);
10285 if(base) IUri_Release(base);
10290 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10291 REFIID riid, void **ppv)
10293 ok(0, "unexpected call\n");
10294 return E_NOINTERFACE;
10297 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10302 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10307 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10308 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10309 DWORD *pcchResult, DWORD dwReserved)
10311 CHECK_EXPECT(ParseUrl);
10312 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10313 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10314 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10315 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10316 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10318 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10319 *pcchResult = lstrlenW(parse_resultW);
10324 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10325 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10326 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10328 CHECK_EXPECT(CombineUrl);
10329 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10330 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10331 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10332 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10333 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10334 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10335 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10337 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10338 *pcchResult = lstrlenW(combine_resultW);
10343 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10344 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10346 ok(0, "unexpected call\n");
10350 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10351 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10352 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10354 ok(0, "unexpected call\n");
10358 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10359 InternetProtocolInfo_QueryInterface,
10360 InternetProtocolInfo_AddRef,
10361 InternetProtocolInfo_Release,
10362 InternetProtocolInfo_ParseUrl,
10363 InternetProtocolInfo_CombineUrl,
10364 InternetProtocolInfo_CompareUrl,
10365 InternetProtocolInfo_QueryInfo
10368 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10370 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10372 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10373 *ppv = &protocol_info;
10377 ok(0, "unexpected call\n");
10378 return E_NOINTERFACE;
10381 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10386 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10391 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10392 REFIID riid, void **ppv)
10394 ok(0, "unexpected call\n");
10398 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10400 ok(0, "unexpected call\n");
10404 static const IClassFactoryVtbl ClassFactoryVtbl = {
10405 ClassFactory_QueryInterface,
10406 ClassFactory_AddRef,
10407 ClassFactory_Release,
10408 ClassFactory_CreateInstance,
10409 ClassFactory_LockServer
10412 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10414 static void register_protocols(void)
10416 IInternetSession *session;
10419 hres = pCoInternetGetSession(0, &session, 0);
10420 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10424 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10425 winetestW, 0, NULL, 0);
10426 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10428 IInternetSession_Release(session);
10431 static void unregister_protocols(void) {
10432 IInternetSession *session;
10435 hr = pCoInternetGetSession(0, &session, 0);
10436 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10440 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10441 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10443 IInternetSession_Release(session);
10446 static void test_CoInternetCombineIUri_Pluggable(void) {
10450 hr = pCreateUri(combine_baseW, 0, 0, &base);
10451 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10452 if(SUCCEEDED(hr)) {
10453 IUri *relative = NULL;
10455 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10456 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10457 if(SUCCEEDED(hr)) {
10458 IUri *result = NULL;
10460 SET_EXPECT(CombineUrl);
10462 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10464 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10466 CHECK_CALLED(CombineUrl);
10468 if(SUCCEEDED(hr)) {
10469 BSTR received = NULL;
10470 hr = IUri_GetAbsoluteUri(result, &received);
10471 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10472 if(SUCCEEDED(hr)) {
10473 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10474 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10476 SysFreeString(received);
10478 if(result) IUri_Release(result);
10480 if(relative) IUri_Release(relative);
10482 if(base) IUri_Release(base);
10485 static void test_CoInternetCombineUrlEx(void) {
10487 IUri *base, *result;
10491 hr = pCreateUri(http_urlW, 0, 0, &base);
10492 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10493 if(SUCCEEDED(hr)) {
10494 result = (void*) 0xdeadbeef;
10495 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10496 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10498 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10501 result = (void*) 0xdeadbeef;
10502 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10503 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10505 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10507 result = (void*) 0xdeadbeef;
10508 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10509 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10511 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10513 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10514 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10516 if(base) IUri_Release(base);
10518 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10519 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10521 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10522 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10523 if(SUCCEEDED(hr)) {
10524 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10526 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10528 if(uri_combine_tests[i].todo) {
10530 ok(hr == uri_combine_tests[i].expected,
10531 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10532 hr, uri_combine_tests[i].expected, i);
10535 ok(hr == uri_combine_tests[i].expected,
10536 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10537 hr, uri_combine_tests[i]. expected, i);
10539 if(SUCCEEDED(hr)) {
10542 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10543 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10545 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10547 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10550 ok(hr == prop.expected,
10551 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10552 hr, prop.expected, i, j);
10555 ok(!strcmp_aw(value, received) ||
10556 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10557 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10558 value, wine_dbgstr_w(received), i, j);
10561 ok(hr == prop.expected,
10562 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10563 hr, prop.expected, i, j);
10564 ok(!strcmp_aw(value, received) ||
10565 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10566 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10567 value, wine_dbgstr_w(received), i, j);
10569 SysFreeString(received);
10572 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10573 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10576 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10579 ok(hr == prop.expected,
10580 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10581 hr, prop.expected, i, j);
10584 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10585 prop.value, received, i, j);
10588 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10589 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10590 hr, prop.expected, i, j);
10591 if(!prop.broken_combine_hres || hr != S_FALSE)
10592 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10593 prop.value, received, i, j);
10597 if(result) IUri_Release(result);
10598 heap_free(relativeW);
10600 if(base) IUri_Release(base);
10605 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10609 hr = pCreateUri(combine_baseW, 0, 0, &base);
10610 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10611 if(SUCCEEDED(hr)) {
10612 IUri *result = NULL;
10614 SET_EXPECT(CombineUrl);
10616 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10618 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10620 CHECK_CALLED(CombineUrl);
10622 if(SUCCEEDED(hr)) {
10623 BSTR received = NULL;
10624 hr = IUri_GetAbsoluteUri(result, &received);
10625 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10626 if(SUCCEEDED(hr)) {
10627 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10628 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10630 SysFreeString(received);
10632 if(result) IUri_Release(result);
10634 if(base) IUri_Release(base);
10637 static void test_CoInternetParseIUri_InvalidArgs(void) {
10643 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10644 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10646 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10648 hr = pCreateUri(http_urlW, 0, 0, &uri);
10649 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10650 if(SUCCEEDED(hr)) {
10651 DWORD expected_len;
10654 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10655 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10657 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10659 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10660 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10664 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10665 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10667 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10670 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10671 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10673 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10676 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10677 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10679 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10682 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10683 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10685 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10687 expected_len = lstrlenW(http_urlW);
10689 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10690 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10691 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10692 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10693 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10694 expected_len, result);
10696 if(uri) IUri_Release(uri);
10699 static void test_CoInternetParseIUri(void) {
10702 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10706 uri_parse_test test = uri_parse_tests[i];
10708 uriW = a2w(test.uri);
10709 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10710 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10711 if(SUCCEEDED(hr)) {
10712 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10713 DWORD result_len = -1;
10715 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10718 ok(hr == test.expected,
10719 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10720 hr, test.expected, i);
10723 ok(hr == test.expected,
10724 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10725 hr, test.expected, i);
10727 if(SUCCEEDED(hr)) {
10728 DWORD len = lstrlenA(test.property);
10729 ok(!strcmp_aw(test.property, result),
10730 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10731 test.property, wine_dbgstr_w(result), i);
10732 ok(len == result_len,
10733 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10734 len, result_len, i);
10737 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10741 if(uri) IUri_Release(uri);
10746 static void test_CoInternetParseIUri_Pluggable(void) {
10750 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10751 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10752 if(SUCCEEDED(hr)) {
10756 SET_EXPECT(ParseUrl);
10758 parse_action = PARSE_CANONICALIZE;
10759 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10761 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10762 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10764 CHECK_CALLED(ParseUrl);
10766 if(SUCCEEDED(hr)) {
10767 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10768 lstrlenW(parse_resultW), result_len);
10769 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10770 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10773 if(uri) IUri_Release(uri);
10779 const char *base_url;
10780 DWORD base_uri_flags;
10781 const char *legacy_url;
10782 const char *uniform_url;
10783 const char *no_canon_url;
10784 const char *uri_url;
10785 } create_urlmon_test_t;
10787 static const create_urlmon_test_t create_urlmon_tests[] = {
10789 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10791 "http://www.winehq.org/",
10792 "http://www.winehq.org/",
10793 "http://www.winehq.org",
10794 "http://www.winehq.org"
10797 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10799 "file://c:\\dir\\file.txt",
10800 "file:///c:/dir/file.txt",
10801 "file:///c:/dir/file.txt",
10802 "file:///c:/dir/file.txt"
10805 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10807 "file://c:\\dir\\file.txt",
10808 "file:///c:/dir/file.txt",
10809 "file:///c:/dir/file.txt",
10810 "file://c:\\dir\\file.txt"
10813 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10814 "http://www.winehq.org",0,
10815 "http://www.winehq.org/data",
10816 "http://www.winehq.org/data",
10817 "http://www.winehq.org:80/data",
10820 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10821 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10822 "file://c:\\dir\\file.txt",
10823 "file:///c:/dir/file.txt",
10824 "file:///c:/dir/file.txt",
10827 "",Uri_CREATE_ALLOW_RELATIVE,
10835 "test",Uri_CREATE_ALLOW_RELATIVE,
10843 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10845 "file://c:\\dir\\file.txt",
10846 "file:///c:/dir/file.txt",
10847 "file:///c:/dir/file.txt",
10848 "file:///c:/dir/file.txt",
10852 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10853 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10855 WCHAR *display_name;
10858 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10859 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10860 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10861 wine_dbgstr_w(display_name), exurl);
10863 CoTaskMemFree(display_name);
10866 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10867 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10869 IUriContainer *uri_container;
10874 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10875 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10878 hres = IUriContainer_GetIUri(uri_container, &uri);
10879 IUriContainer_Release(uri_container);
10880 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10881 ok(uri != NULL, "uri == NULL\n");
10883 hres = IUri_GetDisplayUri(uri, &display_uri);
10885 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10886 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10887 wine_dbgstr_w(display_uri), exurl);
10888 SysFreeString(display_uri);
10891 static void test_CreateURLMoniker(void)
10893 const create_urlmon_test_t *test;
10894 IMoniker *mon, *base_mon;
10895 WCHAR *url, *base_url;
10896 IUri *uri, *base_uri;
10899 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10900 url = a2w(test->url);
10901 base_url = a2w(test->base_url);
10904 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10905 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10907 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10908 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10914 hres = CreateURLMoniker(base_mon, url, &mon);
10915 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10916 test_urlmon_display_name(mon, test->legacy_url);
10917 test_display_uri(mon, test->legacy_url);
10918 IMoniker_Release(mon);
10920 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10921 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10922 test_urlmon_display_name(mon, test->legacy_url);
10923 test_display_uri(mon, test->legacy_url);
10924 IMoniker_Release(mon);
10926 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10927 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10928 test_urlmon_display_name(mon, test->uniform_url);
10929 test_display_uri(mon, test->uniform_url);
10930 IMoniker_Release(mon);
10932 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10933 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10934 test_urlmon_display_name(mon, test->no_canon_url);
10935 test_display_uri(mon, test->no_canon_url);
10936 IMoniker_Release(mon);
10938 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10939 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10941 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10942 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10943 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10944 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10945 IMoniker_Release(mon);
10947 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10948 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10949 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10950 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10951 IMoniker_Release(mon);
10953 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10954 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10955 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10956 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10957 IMoniker_Release(mon);
10961 heap_free(base_url);
10963 IUri_Release(base_uri);
10965 IMoniker_Release(base_mon);
10969 static int add_default_flags(DWORD flags) {
10970 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
10971 flags |= Uri_CREATE_CANONICALIZE;
10972 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
10973 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
10974 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
10975 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
10976 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
10977 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
10978 if(!(flags & Uri_CREATE_IE_SETTINGS))
10979 flags |= Uri_CREATE_NO_IE_SETTINGS;
10984 static void test_IPersistStream(void)
10986 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
10988 props_order[Uri_PROPERTY_RAW_URI] = 1;
10989 props_order[Uri_PROPERTY_FRAGMENT] = 2;
10990 props_order[Uri_PROPERTY_HOST] = 3;
10991 props_order[Uri_PROPERTY_PASSWORD] = 4;
10992 props_order[Uri_PROPERTY_PATH] = 5;
10993 props_order[Uri_PROPERTY_PORT] = 6;
10994 props_order[Uri_PROPERTY_QUERY] = 7;
10995 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
10996 props_order[Uri_PROPERTY_USER_NAME] = 9;
10998 for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
10999 const uri_properties *test = uri_tests+i;
11002 IPersistStream *persist_stream;
11005 DWORD props, props_no, dw_data[6];
11006 WCHAR str_data[1024];
11007 ULARGE_INTEGER size, max_size;
11008 LARGE_INTEGER no_off;
11013 if(test->create_todo || test->create_expected!=S_OK)
11016 uriW = a2w(test->uri);
11017 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11018 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
11020 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11021 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11023 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
11024 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
11025 hr = IPersistStream_IsDirty(persist_stream);
11026 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11027 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11028 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
11029 hr = IPersistStream_IsDirty(persist_stream);
11030 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11031 no_off.QuadPart = 0;
11032 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11033 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11034 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11035 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11036 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11037 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
11038 ok(U(size).LowPart+2 == U(max_size).LowPart,
11039 "%d) Written data size is %d, max_size %d.\n",
11040 i, U(size).LowPart, U(max_size).LowPart);
11042 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11043 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11044 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11045 i, dw_data[0]-2, U(size).LowPart);
11046 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11047 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11048 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
11049 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
11050 ok(dw_data[2] == add_default_flags(test->create_flags),
11051 "%d) Incorrect value %x, expected %x (creation flags).\n",
11052 i, dw_data[2], add_default_flags(test->create_flags));
11053 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
11054 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
11055 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
11058 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11059 if(!props_order[props])
11062 if(props <= Uri_PROPERTY_STRING_LAST) {
11063 if(test->str_props[props].expected == S_OK)
11066 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11070 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11071 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11072 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11075 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11076 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11077 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
11082 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11083 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11085 ok(dw_data[2]<props_order[dw_data[0]],
11086 "%d) Incorrect properties order (%d, %d)\n",
11087 i, dw_data[0], dw_data[3]);
11088 dw_data[2] = props_order[dw_data[0]];
11089 dw_data[3] = dw_data[0];
11091 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11092 const uri_str_property *prop = test->str_props+dw_data[0];
11093 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11094 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11095 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11096 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11097 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11098 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11099 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
11100 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11101 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11102 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
11104 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
11108 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11109 i, props, dw_data[0]);
11111 IPersistStream_Release(persist_stream);
11114 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11115 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11116 hr = IPersistStream_GetClassID(persist_stream, &curi);
11117 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
11118 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11119 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11120 &IID_IUri, (void**)&uri);
11121 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11122 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11123 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11124 hr = IPersistStream_Load(persist_stream, stream);
11125 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
11126 hr = IUri_GetRawUri(uri, &raw_uri);
11127 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11128 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11129 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11130 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11131 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11132 wine_dbgstr_w(raw_uri));
11133 SysFreeString(raw_uri);
11135 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11136 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
11137 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11138 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11139 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11140 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11141 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11142 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11143 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11144 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11145 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11146 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11147 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11148 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11149 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11150 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11151 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11152 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11153 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11154 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11155 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11156 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11157 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11158 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11159 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11160 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11161 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11162 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11163 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11165 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11166 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11167 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11168 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11169 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11170 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11171 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11172 i, dw_data[0]-2, U(size).LowPart);
11173 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11175 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11176 i, dw_data[2], dw_data[0]-8);
11177 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11178 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11179 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11180 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11181 U(max_size).LowPart += 3*sizeof(DWORD);
11182 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11183 i, dw_data[2], U(max_size).LowPart);
11184 IMarshal_Release(marshal);
11187 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11188 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11189 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11190 &IID_IUri, (void**)&uri);
11191 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11192 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11193 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11194 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11195 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11196 hr = IUri_GetRawUri(uri, &raw_uri);
11197 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11198 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11199 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11200 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11201 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11202 wine_dbgstr_w(raw_uri));
11203 SysFreeString(raw_uri);
11205 IMarshal_Release(marshal);
11206 IStream_Release(stream);
11207 IPersistStream_Release(persist_stream);
11213 static void test_UninitializedUri(void)
11216 IUriBuilderFactory *ubf;
11217 IPersistStream *ps;
11225 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11226 &IID_IUri, (void**)&uri);
11228 win_skip("Skipping uninitialized Uri tests.\n");
11232 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11233 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11234 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11235 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11237 hr = IUri_GetAbsoluteUri(uri, NULL);
11238 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11239 hr = IUri_GetAbsoluteUri(uri, &bstr);
11240 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11241 hr = IUri_GetAuthority(uri, &bstr);
11242 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11243 hr = IUri_GetDisplayUri(uri, &bstr);
11244 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11245 hr = IUri_GetDomain(uri, &bstr);
11246 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11247 hr = IUri_GetExtension(uri, &bstr);
11248 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11249 hr = IUri_GetFragment(uri, &bstr);
11250 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11251 hr = IUri_GetHost(uri, &bstr);
11252 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11253 hr = IUri_GetHostType(uri, &dword);
11254 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11255 hr = IUri_GetPassword(uri, &bstr);
11256 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11257 hr = IUri_GetPassword(uri, &bstr);
11258 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11259 hr = IUri_GetPathAndQuery(uri, &bstr);
11260 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11261 hr = IUri_GetPort(uri, &dword);
11262 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11263 hr = IUri_GetProperties(uri, &dword);
11264 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11265 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11266 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11267 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11268 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11269 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11270 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11271 hr = IUri_GetQuery(uri, &bstr);
11272 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11273 hr = IUri_GetRawUri(uri, &bstr);
11274 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11275 hr = IUri_GetScheme(uri, &dword);
11276 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11277 hr = IUri_GetSchemeName(uri, &bstr);
11278 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11279 hr = IUri_GetUserInfo(uri, &bstr);
11280 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11281 hr = IUri_GetUserName(uri, &bstr);
11282 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11283 hr = IUri_GetZone(uri, &dword);
11284 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11285 hr = IUri_IsEqual(uri, uri, &eq);
11286 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11288 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11289 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11290 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11291 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11292 IUriBuilder_Release(ub);
11294 hr = IPersistStream_GetSizeMax(ps, &ui);
11295 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11296 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11297 hr = IPersistStream_IsDirty(ps);
11298 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11300 IPersistStream_Release(ps);
11301 IUriBuilderFactory_Release(ubf);
11308 hurlmon = GetModuleHandle("urlmon.dll");
11309 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11310 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11311 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11312 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11313 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11314 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11315 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11316 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11317 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11320 win_skip("CreateUri is not present, skipping tests.\n");
11324 trace("test CreateUri invalid flags...\n");
11325 test_CreateUri_InvalidFlags();
11327 trace("test CreateUri invalid args...\n");
11328 test_CreateUri_InvalidArgs();
11330 trace("test CreateUri invalid URIs...\n");
11331 test_CreateUri_InvalidUri();
11333 trace("test IUri_GetPropertyBSTR...\n");
11334 test_IUri_GetPropertyBSTR();
11336 trace("test IUri_GetPropertyDWORD...\n");
11337 test_IUri_GetPropertyDWORD();
11339 trace("test IUri_GetStrProperties...\n");
11340 test_IUri_GetStrProperties();
11342 trace("test IUri_GetDwordProperties...\n");
11343 test_IUri_GetDwordProperties();
11345 trace("test IUri_GetPropertyLength...\n");
11346 test_IUri_GetPropertyLength();
11348 trace("test IUri_GetProperties...\n");
11349 test_IUri_GetProperties();
11351 trace("test IUri_HasProperty...\n");
11352 test_IUri_HasProperty();
11354 trace("test IUri_IsEqual...\n");
11355 test_IUri_IsEqual();
11357 trace("test CreateUriWithFragment invalid args...\n");
11358 test_CreateUriWithFragment_InvalidArgs();
11360 trace("test CreateUriWithFragment invalid flags...\n");
11361 test_CreateUriWithFragment_InvalidFlags();
11363 trace("test CreateUriWithFragment...\n");
11364 test_CreateUriWithFragment();
11366 trace("test CreateIUriBuilder...\n");
11367 test_CreateIUriBuilder();
11369 trace("test IUriBuilder_CreateInvalidArgs...\n");
11370 test_IUriBuilder_CreateInvalidArgs();
11372 trace("test IUriBuilder...\n");
11373 test_IUriBuilder();
11375 trace("test IUriBuilder_GetInvalidArgs...\n");
11376 test_IUriBuilder_GetInvalidArgs();
11378 trace("test IUriBuilder_HasBeenModified...\n");
11379 test_IUriBuilder_HasBeenModified();
11381 trace("test IUriBuilder_IUriProperty...\n");
11382 test_IUriBuilder_IUriProperty();
11384 trace("test IUriBuilder_RemoveProperties...\n");
11385 test_IUriBuilder_RemoveProperties();
11387 trace("test IUriBuilder miscellaneous...\n");
11388 test_IUriBuilder_Misc();
11390 trace("test IUriBuilderFactory...\n");
11391 test_IUriBuilderFactory();
11393 trace("test CoInternetCombineIUri...\n");
11394 test_CoInternetCombineIUri();
11396 trace("test CoInternetCombineUrlEx...\n");
11397 test_CoInternetCombineUrlEx();
11399 trace("test CoInternetParseIUri Invalid Args...\n");
11400 test_CoInternetParseIUri_InvalidArgs();
11402 trace("test CoInternetParseIUri...\n");
11403 test_CoInternetParseIUri();
11405 register_protocols();
11407 trace("test CoInternetCombineIUri pluggable...\n");
11408 test_CoInternetCombineIUri_Pluggable();
11410 trace("test CoInternetCombineUrlEx Pluggable...\n");
11411 test_CoInternetCombineUrlEx_Pluggable();
11413 trace("test CoInternetParseIUri pluggable...\n");
11414 test_CoInternetParseIUri_Pluggable();
11416 trace("test CreateURLMoniker...\n");
11417 test_CreateURLMoniker();
11419 CoInitialize(NULL);
11421 trace("test IPersistStream...\n");
11422 test_IPersistStream();
11424 trace("test uninitialized Uri...\n");
11425 test_UninitializedUri();
11428 unregister_protocols();