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
36 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
37 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
38 #define URI_BUILDER_STR_PROPERTY_COUNT 7
40 #define DEFINE_EXPECT(func) \
41 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
43 #define SET_EXPECT(func) \
44 expect_ ## func = TRUE
46 #define CHECK_EXPECT(func) \
48 ok(expect_ ##func, "unexpected call " #func "\n"); \
49 expect_ ## func = FALSE; \
50 called_ ## func = TRUE; \
53 #define CHECK_EXPECT2(func) \
55 ok(expect_ ##func, "unexpected call " #func "\n"); \
56 called_ ## func = TRUE; \
59 #define CHECK_CALLED(func) \
61 ok(called_ ## func, "expected " #func "\n"); \
62 expect_ ## func = called_ ## func = FALSE; \
65 DEFINE_EXPECT(CombineUrl);
66 DEFINE_EXPECT(ParseUrl);
68 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
69 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
70 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
71 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
72 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
73 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
74 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
75 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
76 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
78 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
79 '.','o','r','g','/',0};
80 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
81 '.','o','r','g','/','#','F','r','a','g',0};
83 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
84 'e','s','t','i','n','g',0};
85 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
86 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
88 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
90 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
91 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
93 static PARSEACTION parse_action;
94 static DWORD parse_flags;
96 typedef struct _uri_create_flag_test {
99 } uri_create_flag_test;
101 static const uri_create_flag_test invalid_flag_tests[] = {
102 /* Set of invalid flag combinations to test for. */
103 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
104 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
105 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
106 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
107 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
110 typedef struct _uri_str_property {
114 const char* broken_value;
117 typedef struct _uri_dword_property {
121 } uri_dword_property;
123 typedef struct _uri_properties {
126 HRESULT create_expected;
129 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
130 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
133 static const uri_properties uri_tests[] = {
134 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
136 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
137 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
138 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
139 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
140 {"",S_FALSE,FALSE}, /* EXTENSION */
141 {"",S_FALSE,FALSE}, /* FRAGMENT */
142 {"www.winehq.org",S_OK,FALSE}, /* HOST */
143 {"",S_FALSE,FALSE}, /* PASSWORD */
144 {"/",S_OK,FALSE}, /* PATH */
145 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
146 {"",S_FALSE,FALSE}, /* QUERY */
147 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
148 {"http",S_OK,FALSE}, /* SCHEME_NAME */
149 {"",S_FALSE,FALSE}, /* USER_INFO */
150 {"",S_FALSE,FALSE} /* USER_NAME */
153 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
154 {80,S_OK,FALSE}, /* PORT */
155 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
156 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
159 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
161 {"http://winehq.org/tests",S_OK,FALSE},
162 {"winehq.org",S_OK,FALSE},
163 {"http://winehq.org/tests",S_OK,FALSE},
164 {"winehq.org",S_OK,FALSE},
167 {"winehq.org",S_OK,FALSE},
169 {"/tests",S_OK,FALSE},
170 {"/tests",S_OK,FALSE},
172 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
178 {Uri_HOST_DNS,S_OK,FALSE},
180 {URL_SCHEME_HTTP,S_OK,FALSE},
181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
184 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
186 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
187 {"www.winehq.org",S_OK,FALSE},
188 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
189 {"winehq.org",S_OK,FALSE},
192 {"www.winehq.org",S_OK,FALSE},
195 {"/?query=x&return=y",S_OK,FALSE},
196 {"?query=x&return=y",S_OK,FALSE},
197 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
203 {Uri_HOST_DNS,S_OK,FALSE},
205 {URL_SCHEME_HTTP,S_OK,FALSE},
206 {URLZONE_INVALID,E_NOTIMPL,FALSE},
209 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
211 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
212 {"usEr%3Ainfo@example.com",S_OK,FALSE},
213 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
214 {"example.com",S_OK,FALSE},
217 {"example.com",S_OK,FALSE},
219 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
220 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
222 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
224 {"usEr%3Ainfo",S_OK,FALSE},
225 {"usEr%3Ainfo",S_OK,FALSE}
228 {Uri_HOST_DNS,S_OK,FALSE},
230 {URL_SCHEME_HTTP,S_OK,FALSE},
231 {URLZONE_INVALID,E_NOTIMPL,FALSE},
234 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
236 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
237 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
238 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
239 {"winehq.org",S_OK,FALSE},
242 {"ftp.winehq.org",S_OK,FALSE},
244 {"/dir/foo%20bar.txt",S_OK,FALSE},
245 {"/dir/foo%20bar.txt",S_OK,FALSE},
247 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
249 {"winepass:wine",S_OK,FALSE},
250 {"winepass",S_OK,FALSE}
253 {Uri_HOST_DNS,S_OK,FALSE},
255 {URL_SCHEME_FTP,S_OK,FALSE},
256 {URLZONE_INVALID,E_NOTIMPL,FALSE}
259 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
261 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
263 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
269 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
270 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
272 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
278 {Uri_HOST_UNKNOWN,S_OK,FALSE},
280 {URL_SCHEME_FILE,S_OK,FALSE},
281 {URLZONE_INVALID,E_NOTIMPL,FALSE}
284 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
286 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
288 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
294 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
295 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
297 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
303 {Uri_HOST_UNKNOWN,S_OK,FALSE},
305 {URL_SCHEME_FILE,S_OK,FALSE},
306 {URLZONE_INVALID,E_NOTIMPL,FALSE}
309 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
311 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
313 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
319 {"/tests/test%20file.README.txt",S_OK,FALSE},
320 {"/tests/test%20file.README.txt",S_OK,FALSE},
322 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
328 {Uri_HOST_UNKNOWN,S_OK,FALSE},
330 {URL_SCHEME_FILE,S_OK,FALSE},
331 {URLZONE_INVALID,E_NOTIMPL,FALSE}
334 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
336 {"urn:nothing:should:happen here",S_OK,FALSE},
338 {"urn:nothing:should:happen here",S_OK,FALSE},
344 {"nothing:should:happen here",S_OK,FALSE},
345 {"nothing:should:happen here",S_OK,FALSE},
347 {"urn:nothing:should:happen here",S_OK,FALSE},
353 {Uri_HOST_UNKNOWN,S_OK,FALSE},
355 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
356 {URLZONE_INVALID,E_NOTIMPL,FALSE}
359 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
361 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
362 {"127.0.0.1",S_OK,FALSE},
363 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
367 {"127.0.0.1",S_OK,FALSE},
369 {"/test%20dir/test.txt",S_OK,FALSE},
370 {"/test%20dir/test.txt",S_OK,FALSE},
372 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
378 {Uri_HOST_IPV4,S_OK,FALSE},
380 {URL_SCHEME_HTTP,S_OK,FALSE},
381 {URLZONE_INVALID,E_NOTIMPL,FALSE}
384 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
386 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
387 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
388 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
392 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
397 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
403 {Uri_HOST_IPV6,S_OK,FALSE},
405 {URL_SCHEME_HTTP,S_OK,FALSE},
406 {URLZONE_INVALID,E_NOTIMPL,FALSE}
409 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
411 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
412 {"[::13.1.68.3]",S_OK,FALSE},
413 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
417 {"::13.1.68.3",S_OK,FALSE},
422 {"ftp://[::13.1.68.3]",S_OK,FALSE},
428 {Uri_HOST_IPV6,S_OK,FALSE},
430 {URL_SCHEME_FTP,S_OK,FALSE},
431 {URLZONE_INVALID,E_NOTIMPL,FALSE}
434 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
436 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
437 {"[fedc:ba98::3210]",S_OK,FALSE},
438 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
442 {"fedc:ba98::3210",S_OK,FALSE},
447 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
453 {Uri_HOST_IPV6,S_OK,FALSE},
455 {URL_SCHEME_HTTP,S_OK,FALSE},
456 {URLZONE_INVALID,E_NOTIMPL,FALSE}
459 { "1234://www.winehq.org", 0, S_OK, FALSE,
461 {"1234://www.winehq.org/",S_OK,FALSE},
462 {"www.winehq.org",S_OK,FALSE},
463 {"1234://www.winehq.org/",S_OK,FALSE},
464 {"winehq.org",S_OK,FALSE},
467 {"www.winehq.org",S_OK,FALSE},
472 {"1234://www.winehq.org",S_OK,FALSE},
478 {Uri_HOST_DNS,S_OK,FALSE},
480 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
481 {URLZONE_INVALID,E_NOTIMPL,FALSE}
484 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
485 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
487 {"file:///C:/test/test.mp3",S_OK,FALSE},
489 {"file:///C:/test/test.mp3",S_OK,FALSE},
495 {"/C:/test/test.mp3",S_OK,FALSE},
496 {"/C:/test/test.mp3",S_OK,FALSE},
498 {"C:/test/test.mp3",S_OK,FALSE},
504 {Uri_HOST_UNKNOWN,S_OK,FALSE},
506 {URL_SCHEME_FILE,S_OK,FALSE},
507 {URLZONE_INVALID,E_NOTIMPL,FALSE}
510 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
511 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
513 {"file://server/test.mp3",S_OK,FALSE},
514 {"server",S_OK,FALSE},
515 {"file://server/test.mp3",S_OK,FALSE},
519 {"server",S_OK,FALSE},
521 {"/test.mp3",S_OK,FALSE},
522 {"/test.mp3",S_OK,FALSE},
524 {"\\\\Server/test.mp3",S_OK,FALSE},
530 {Uri_HOST_DNS,S_OK,FALSE},
532 {URL_SCHEME_FILE,S_OK,FALSE},
533 {URLZONE_INVALID,E_NOTIMPL,FALSE}
536 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
538 {"*:www.winehq.org/test",S_OK,FALSE},
539 {"www.winehq.org",S_OK,FALSE},
540 {"*:www.winehq.org/test",S_OK,FALSE},
541 {"winehq.org",S_OK,FALSE},
544 {"www.winehq.org",S_OK,FALSE},
546 {"/test",S_OK,FALSE},
547 {"/test",S_OK,FALSE},
549 {"www.winehq.org/test",S_OK,FALSE},
555 {Uri_HOST_DNS,S_OK,FALSE},
557 {URL_SCHEME_WILDCARD,S_OK,FALSE},
558 {URLZONE_INVALID,E_NOTIMPL,FALSE}
561 /* Valid since the '*' is the only character in the scheme name. */
562 { "*:www.winehq.org/test", 0, S_OK, FALSE,
564 {"*:www.winehq.org/test",S_OK,FALSE},
565 {"www.winehq.org",S_OK,FALSE},
566 {"*:www.winehq.org/test",S_OK,FALSE},
567 {"winehq.org",S_OK,FALSE},
570 {"www.winehq.org",S_OK,FALSE},
572 {"/test",S_OK,FALSE},
573 {"/test",S_OK,FALSE},
575 {"*:www.winehq.org/test",S_OK,FALSE},
581 {Uri_HOST_DNS,S_OK,FALSE},
583 {URL_SCHEME_WILDCARD,S_OK,FALSE},
584 {URLZONE_INVALID,E_NOTIMPL,FALSE}
587 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
589 {"/../some dir/test.ext",S_OK,FALSE},
591 {"/../some dir/test.ext",S_OK,FALSE},
597 {"/../some dir/test.ext",S_OK,FALSE},
598 {"/../some dir/test.ext",S_OK,FALSE},
600 {"/../some dir/test.ext",S_OK,FALSE},
606 {Uri_HOST_UNKNOWN,S_OK,FALSE},
608 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
609 {URLZONE_INVALID,E_NOTIMPL,FALSE}
612 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
614 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
616 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
622 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
623 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
625 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
631 {Uri_HOST_UNKNOWN,S_OK,FALSE},
633 {URL_SCHEME_WILDCARD,S_OK,FALSE},
634 {URLZONE_INVALID,E_NOTIMPL,FALSE}
637 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
638 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
640 {"zip:/.//google.com",S_OK,FALSE},
642 {"zip:/.//google.com",S_OK,FALSE},
648 {"/.//google.com",S_OK,FALSE},
649 {"/.//google.com",S_OK,FALSE},
651 {"zip://google.com",S_OK,FALSE},
657 {Uri_HOST_UNKNOWN,S_OK,FALSE},
659 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
660 {URLZONE_INVALID,E_NOTIMPL,FALSE}
663 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
664 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
666 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
667 {"user:pass:word@winehq.org",S_OK,FALSE},
668 {"ftp://winehq.org/",S_OK,FALSE},
669 {"winehq.org",S_OK,FALSE},
672 {"winehq.org",S_OK,FALSE},
673 {"pass:word",S_OK,FALSE},
677 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
679 {"user:pass:word",S_OK,FALSE},
683 {Uri_HOST_DNS,S_OK,FALSE},
685 {URL_SCHEME_FTP,S_OK,FALSE},
686 {URLZONE_INVALID,E_NOTIMPL,FALSE}
689 /* Make sure % encoded unreserved characters are decoded. */
690 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
692 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
693 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
694 {"ftp://ftp.google.com/",S_OK,FALSE},
695 {"google.com",S_OK,FALSE},
698 {"ftp.google.com",S_OK,FALSE},
703 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
705 {"wINe:PASS",S_OK,FALSE},
709 {Uri_HOST_DNS,S_OK,FALSE},
711 {URL_SCHEME_FTP,S_OK,FALSE},
712 {URLZONE_INVALID,E_NOTIMPL,FALSE}
715 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
716 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
718 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
719 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
720 {"ftp://ftp.google.com/",S_OK,FALSE},
721 {"google.com",S_OK,FALSE},
724 {"ftp.google.com",S_OK,FALSE},
725 {"PA%7B%7D",S_OK,FALSE},
729 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
731 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
732 {"w%5D%5Be",S_OK,FALSE}
735 {Uri_HOST_DNS,S_OK,FALSE},
737 {URL_SCHEME_FTP,S_OK,FALSE},
738 {URLZONE_INVALID,E_NOTIMPL,FALSE}
741 /* You're allowed to have an empty password portion in the userinfo section. */
742 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
744 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
745 {"empty:@ftp.google.com",S_OK,FALSE},
746 {"ftp://ftp.google.com/",S_OK,FALSE},
747 {"google.com",S_OK,FALSE},
750 {"ftp.google.com",S_OK,FALSE},
755 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
757 {"empty:",S_OK,FALSE},
761 {Uri_HOST_DNS,S_OK,FALSE},
763 {URL_SCHEME_FTP,S_OK,FALSE},
764 {URLZONE_INVALID,E_NOTIMPL,FALSE}
767 /* Make sure forbidden characters in "userinfo" get encoded. */
768 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
770 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
771 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
772 {"ftp://ftp.google.com/",S_OK,FALSE},
773 {"google.com",S_OK,FALSE},
776 {"ftp.google.com",S_OK,FALSE},
781 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
783 {"%22%20%22weird",S_OK,FALSE},
784 {"%22%20%22weird",S_OK,FALSE}
787 {Uri_HOST_DNS,S_OK,FALSE},
789 {URL_SCHEME_FTP,S_OK,FALSE},
790 {URLZONE_INVALID,E_NOTIMPL,FALSE}
793 /* Make sure the forbidden characters don't get percent encoded. */
794 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
796 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
797 {"\" \"weird@ftp.google.com",S_OK,FALSE},
798 {"ftp://ftp.google.com/",S_OK,FALSE},
799 {"google.com",S_OK,FALSE},
802 {"ftp.google.com",S_OK,FALSE},
807 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
809 {"\" \"weird",S_OK,FALSE},
810 {"\" \"weird",S_OK,FALSE}
813 {Uri_HOST_DNS,S_OK,FALSE},
815 {URL_SCHEME_FTP,S_OK,FALSE},
816 {URLZONE_INVALID,E_NOTIMPL,FALSE}
819 /* Make sure already percent encoded characters don't get unencoded. */
820 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
822 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
823 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
824 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
825 {"google.com",S_OK,FALSE},
828 {"ftp.google.com",S_OK,FALSE},
830 {"/\"%20\"weird",S_OK,FALSE},
831 {"/\"%20\"weird",S_OK,FALSE},
833 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
835 {"\"%20\"weird",S_OK,FALSE},
836 {"\"%20\"weird",S_OK,FALSE}
839 {Uri_HOST_DNS,S_OK,FALSE},
841 {URL_SCHEME_FTP,S_OK,FALSE},
842 {URLZONE_INVALID,E_NOTIMPL,FALSE}
845 /* Allowed to have invalid % encoded because its an unknown scheme type. */
846 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
848 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
849 {"%xy:word@winehq.org",S_OK,FALSE},
850 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
851 {"winehq.org",S_OK,FALSE},
854 {"winehq.org",S_OK,FALSE},
859 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
861 {"%xy:word",S_OK,FALSE},
865 {Uri_HOST_DNS,S_OK,FALSE},
867 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
868 {URLZONE_INVALID,E_NOTIMPL,FALSE}
871 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
874 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
876 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
877 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
878 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
879 {"winehq.org",S_OK,FALSE},
882 {"winehq.org",S_OK,FALSE},
883 {"%52%53ord",S_OK,FALSE},
887 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
889 {"%2E:%52%53ord",S_OK,FALSE},
893 {Uri_HOST_DNS,S_OK,FALSE},
895 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
896 {URLZONE_INVALID,E_NOTIMPL,FALSE}
899 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
901 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
902 {"[](),'test':word@winehq.org",S_OK,FALSE},
903 {"ftp://winehq.org/",S_OK,FALSE},
904 {"winehq.org",S_OK,FALSE},
907 {"winehq.org",S_OK,FALSE},
912 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
914 {"[](),'test':word",S_OK,FALSE},
915 {"[](),'test'",S_OK,FALSE}
918 {Uri_HOST_DNS,S_OK,FALSE},
920 {URL_SCHEME_FTP,S_OK,FALSE},
921 {URLZONE_INVALID,E_NOTIMPL,FALSE}
924 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
926 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
928 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
935 {"/?:word@winehq.org/",S_OK,FALSE},
936 {"?:word@winehq.org/",S_OK,FALSE},
937 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
943 {Uri_HOST_DNS,S_OK,FALSE},
945 {URL_SCHEME_FTP,S_OK,FALSE},
946 {URLZONE_INVALID,E_NOTIMPL,FALSE}
949 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
951 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
953 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
956 {"#:word@winehq.org/",S_OK,FALSE},
962 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
968 {Uri_HOST_DNS,S_OK,FALSE},
970 {URL_SCHEME_FTP,S_OK,FALSE},
971 {URLZONE_INVALID,E_NOTIMPL,FALSE}
974 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
975 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
977 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
978 {"test\\:word@winehq.org",S_OK,FALSE},
979 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
980 {"winehq.org",S_OK,FALSE},
983 {"winehq.org",S_OK,FALSE},
988 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
990 {"test\\:word",S_OK,FALSE},
991 {"test\\",S_OK,FALSE}
994 {Uri_HOST_DNS,S_OK,FALSE},
996 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
997 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1000 /* It normalizes IPv4 addresses correctly. */
1001 { "http://127.000.000.100/", 0, S_OK, FALSE,
1003 {"http://127.0.0.100/",S_OK,FALSE},
1004 {"127.0.0.100",S_OK,FALSE},
1005 {"http://127.0.0.100/",S_OK,FALSE},
1009 {"127.0.0.100",S_OK,FALSE},
1014 {"http://127.000.000.100/",S_OK,FALSE},
1015 {"http",S_OK,FALSE},
1020 {Uri_HOST_IPV4,S_OK,FALSE},
1022 {URL_SCHEME_HTTP,S_OK,FALSE},
1023 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1026 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1028 {"http://127.0.0.1:8000/",S_OK},
1029 {"127.0.0.1:8000",S_OK},
1030 {"http://127.0.0.1:8000/",S_OK},
1039 {"http://127.0.0.1:8000",S_OK},
1045 {Uri_HOST_IPV4,S_OK,FALSE},
1047 {URL_SCHEME_HTTP,S_OK,FALSE},
1048 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1051 /* Make sure it normalizes partial IPv4 addresses correctly. */
1052 { "http://127.0/", 0, S_OK, FALSE,
1054 {"http://127.0.0.0/",S_OK,FALSE},
1055 {"127.0.0.0",S_OK,FALSE},
1056 {"http://127.0.0.0/",S_OK,FALSE},
1060 {"127.0.0.0",S_OK,FALSE},
1065 {"http://127.0/",S_OK,FALSE},
1066 {"http",S_OK,FALSE},
1071 {Uri_HOST_IPV4,S_OK,FALSE},
1073 {URL_SCHEME_HTTP,S_OK,FALSE},
1074 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1077 /* Make sure it converts implicit IPv4's correctly. */
1078 { "http://123456/", 0, S_OK, FALSE,
1080 {"http://0.1.226.64/",S_OK,FALSE},
1081 {"0.1.226.64",S_OK,FALSE},
1082 {"http://0.1.226.64/",S_OK,FALSE},
1086 {"0.1.226.64",S_OK,FALSE},
1091 {"http://123456/",S_OK,FALSE},
1092 {"http",S_OK,FALSE},
1097 {Uri_HOST_IPV4,S_OK,FALSE},
1099 {URL_SCHEME_HTTP,S_OK,FALSE},
1100 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1104 { "http://4294967295/", 0, S_OK, FALSE,
1106 {"http://255.255.255.255/",S_OK,FALSE},
1107 {"255.255.255.255",S_OK,FALSE},
1108 {"http://255.255.255.255/",S_OK,FALSE},
1112 {"255.255.255.255",S_OK,FALSE},
1117 {"http://4294967295/",S_OK,FALSE},
1118 {"http",S_OK,FALSE},
1123 {Uri_HOST_IPV4,S_OK,FALSE},
1125 {URL_SCHEME_HTTP,S_OK,FALSE},
1126 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1130 { "http://4294967296/", 0, S_OK, FALSE,
1132 {"http://4294967296/",S_OK,FALSE},
1133 {"4294967296",S_OK,FALSE},
1134 {"http://4294967296/",S_OK,FALSE},
1138 {"4294967296",S_OK,FALSE},
1143 {"http://4294967296/",S_OK,FALSE},
1144 {"http",S_OK,FALSE},
1149 {Uri_HOST_DNS,S_OK,FALSE},
1151 {URL_SCHEME_HTTP,S_OK,FALSE},
1152 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1155 /* Window's doesn't normalize IP address for unknown schemes. */
1156 { "1234://4294967295/", 0, S_OK, FALSE,
1158 {"1234://4294967295/",S_OK,FALSE},
1159 {"4294967295",S_OK,FALSE},
1160 {"1234://4294967295/",S_OK,FALSE},
1164 {"4294967295",S_OK,FALSE},
1169 {"1234://4294967295/",S_OK,FALSE},
1170 {"1234",S_OK,FALSE},
1175 {Uri_HOST_IPV4,S_OK,FALSE},
1177 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1178 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1181 /* Window's doesn't normalize IP address for unknown schemes. */
1182 { "1234://127.001/", 0, S_OK, FALSE,
1184 {"1234://127.001/",S_OK,FALSE},
1185 {"127.001",S_OK,FALSE},
1186 {"1234://127.001/",S_OK,FALSE},
1190 {"127.001",S_OK,FALSE},
1195 {"1234://127.001/",S_OK,FALSE},
1196 {"1234",S_OK,FALSE},
1201 {Uri_HOST_IPV4,S_OK,FALSE},
1203 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1204 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1207 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1209 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1210 {"[fedc:ba98::3210]",S_OK,FALSE},
1211 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1215 {"fedc:ba98::3210",S_OK,FALSE},
1220 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1221 {"http",S_OK,FALSE},
1226 {Uri_HOST_IPV6,S_OK,FALSE},
1228 {URL_SCHEME_HTTP,S_OK,FALSE},
1229 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1232 { "http://[::]", 0, S_OK, FALSE,
1234 {"http://[::]/",S_OK,FALSE},
1235 {"[::]",S_OK,FALSE},
1236 {"http://[::]/",S_OK,FALSE},
1245 {"http://[::]",S_OK,FALSE},
1246 {"http",S_OK,FALSE},
1251 {Uri_HOST_IPV6,S_OK,FALSE},
1253 {URL_SCHEME_HTTP,S_OK,FALSE},
1254 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1257 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1259 {"http://[fedc:ba98::]/",S_OK,FALSE},
1260 {"[fedc:ba98::]",S_OK,FALSE},
1261 {"http://[fedc:ba98::]/",S_OK,FALSE},
1265 {"fedc:ba98::",S_OK,FALSE},
1270 {"http://[FEDC:BA98::]",S_OK,FALSE},
1271 {"http",S_OK,FALSE},
1276 {Uri_HOST_IPV6,S_OK,FALSE},
1278 {URL_SCHEME_HTTP,S_OK,FALSE},
1279 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1282 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1283 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1285 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1286 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1287 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1291 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1296 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1297 {"http",S_OK,FALSE},
1302 {Uri_HOST_IPV6,S_OK,FALSE},
1304 {URL_SCHEME_HTTP,S_OK,FALSE},
1305 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1308 { "http://[v2.34]/", 0, S_OK, FALSE,
1310 {"http://[v2.34]/",S_OK,FALSE},
1311 {"[v2.34]",S_OK,FALSE},
1312 {"http://[v2.34]/",S_OK,FALSE},
1316 {"[v2.34]",S_OK,FALSE},
1321 {"http://[v2.34]/",S_OK,FALSE},
1322 {"http",S_OK,FALSE},
1327 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1329 {URL_SCHEME_HTTP,S_OK,FALSE},
1330 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1333 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1334 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1336 {"http://[xyz:12345.com/test",S_OK,FALSE},
1337 {"[xyz:12345.com",S_OK,FALSE},
1338 {"http://[xyz:12345.com/test",S_OK,FALSE},
1339 {"[xyz:12345.com",S_OK,FALSE},
1342 {"[xyz:12345.com",S_OK,FALSE},
1344 {"/test",S_OK,FALSE},
1345 {"/test",S_OK,FALSE},
1347 {"http://[xyz:12345.com/test",S_OK,FALSE},
1348 {"http",S_OK,FALSE},
1353 {Uri_HOST_DNS,S_OK,FALSE},
1355 {URL_SCHEME_HTTP,S_OK,FALSE},
1356 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1359 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1360 * of the host name (respectively).
1362 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1364 {"ftp://www.[works].com/",S_OK,FALSE},
1365 {"www.[works].com",S_OK,FALSE},
1366 {"ftp://www.[works].com/",S_OK,FALSE},
1367 {"[works].com",S_OK,FALSE},
1370 {"www.[works].com",S_OK,FALSE},
1375 {"ftp://www.[works].com/",S_OK,FALSE},
1381 {Uri_HOST_DNS,S_OK,FALSE},
1383 {URL_SCHEME_FTP,S_OK,FALSE},
1384 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1387 /* Considers ':' a delimiter since it appears after the ']'. */
1388 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1390 {"http://www.google.com]:12345/",S_OK,FALSE},
1391 {"www.google.com]:12345",S_OK,FALSE},
1392 {"http://www.google.com]:12345/",S_OK,FALSE},
1393 {"google.com]",S_OK,FALSE},
1396 {"www.google.com]",S_OK,FALSE},
1401 {"http://www.google.com]:12345/",S_OK,FALSE},
1402 {"http",S_OK,FALSE},
1407 {Uri_HOST_DNS,S_OK,FALSE},
1409 {URL_SCHEME_HTTP,S_OK,FALSE},
1410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1413 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1414 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1416 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1417 {"w%XXw%GEw.google.com",S_OK,FALSE},
1418 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1419 {"google.com",S_OK,FALSE},
1422 {"w%XXw%GEw.google.com",S_OK,FALSE},
1427 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1433 {Uri_HOST_DNS,S_OK,FALSE},
1435 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1436 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1439 /* Unknown scheme types hostname doesn't get lower cased. */
1440 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1442 {"zip://GOOGLE.com/",S_OK,FALSE},
1443 {"GOOGLE.com",S_OK,FALSE},
1444 {"zip://GOOGLE.com/",S_OK,FALSE},
1445 {"GOOGLE.com",S_OK,FALSE},
1448 {"GOOGLE.com",S_OK,FALSE},
1453 {"zip://GOOGLE.com/",S_OK,FALSE},
1459 {Uri_HOST_DNS,S_OK,FALSE},
1461 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1465 /* Hostname gets lower-cased for known scheme types. */
1466 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1468 {"http://www.google.com/",S_OK,FALSE},
1469 {"www.google.com",S_OK,FALSE},
1470 {"http://www.google.com/",S_OK,FALSE},
1471 {"google.com",S_OK,FALSE},
1474 {"www.google.com",S_OK,FALSE},
1479 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1480 {"http",S_OK,FALSE},
1485 {Uri_HOST_DNS,S_OK,FALSE},
1487 {URL_SCHEME_HTTP,S_OK,FALSE},
1488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1491 /* Characters that get % encoded in the hostname also have their percent
1492 * encoded forms lower cased.
1494 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1496 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1497 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1498 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1499 {"%7cgoogle%7c.com",S_OK,FALSE},
1502 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1507 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1508 {"http",S_OK,FALSE},
1513 {Uri_HOST_DNS,S_OK,FALSE},
1515 {URL_SCHEME_HTTP,S_OK,FALSE},
1516 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1519 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1520 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1522 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1523 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1524 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1528 {"1:2:3:4:5:6::",S_OK,FALSE},
1533 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1534 {"http",S_OK,FALSE},
1539 {Uri_HOST_IPV6,S_OK,FALSE},
1541 {URL_SCHEME_HTTP,S_OK,FALSE},
1542 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1545 /* IPv4 addresses get normalized. */
1546 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1548 {"http://[::1.2.3.0]/",S_OK,FALSE},
1549 {"[::1.2.3.0]",S_OK,FALSE},
1550 {"http://[::1.2.3.0]/",S_OK,FALSE},
1554 {"::1.2.3.0",S_OK,FALSE},
1559 {"http://[::001.002.003.000]",S_OK,FALSE},
1560 {"http",S_OK,FALSE},
1565 {Uri_HOST_IPV6,S_OK,FALSE},
1567 {URL_SCHEME_HTTP,S_OK,FALSE},
1568 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1571 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1572 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1574 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1575 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1576 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1580 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1585 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1591 {Uri_HOST_IPV6,S_OK,FALSE},
1593 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1594 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1597 /* IPv4 address is converted into 2 h16 components. */
1598 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1600 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1601 {"[ffff::c0de:6f20]",S_OK,FALSE},
1602 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1606 {"ffff::c0de:6f20",S_OK,FALSE},
1611 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1612 {"http",S_OK,FALSE},
1617 {Uri_HOST_IPV6,S_OK,FALSE},
1619 {URL_SCHEME_HTTP,S_OK,FALSE},
1620 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1623 /* Max value for a port. */
1624 { "http://google.com:65535", 0, S_OK, FALSE,
1626 {"http://google.com:65535/",S_OK,FALSE},
1627 {"google.com:65535",S_OK,FALSE},
1628 {"http://google.com:65535/",S_OK,FALSE},
1629 {"google.com",S_OK,FALSE},
1632 {"google.com",S_OK,FALSE},
1637 {"http://google.com:65535",S_OK,FALSE},
1638 {"http",S_OK,FALSE},
1643 {Uri_HOST_DNS,S_OK,FALSE},
1645 {URL_SCHEME_HTTP,S_OK,FALSE},
1646 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1649 { "zip://google.com:65536", 0, S_OK, FALSE,
1651 {"zip://google.com:65536/",S_OK,FALSE},
1652 {"google.com:65536",S_OK,FALSE},
1653 {"zip://google.com:65536/",S_OK,FALSE},
1654 {"google.com:65536",S_OK,FALSE},
1657 {"google.com:65536",S_OK,FALSE},
1662 {"zip://google.com:65536",S_OK,FALSE},
1668 {Uri_HOST_DNS,S_OK,FALSE},
1670 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1671 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1674 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1676 {"zip://google.com:65536:25/",S_OK,FALSE},
1677 {"google.com:65536:25",S_OK,FALSE},
1678 {"zip://google.com:65536:25/",S_OK,FALSE},
1679 {"google.com:65536:25",S_OK,FALSE},
1682 {"google.com:65536:25",S_OK,FALSE},
1687 {"zip://google.com:65536:25",S_OK,FALSE},
1693 {Uri_HOST_DNS,S_OK,FALSE},
1695 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1696 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1699 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1701 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1702 {"[::ffff]:abcd",S_OK,FALSE},
1703 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1707 {"[::ffff]:abcd",S_OK,FALSE},
1712 {"zip://[::ffff]:abcd",S_OK,FALSE},
1718 {Uri_HOST_DNS,S_OK,FALSE},
1720 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1721 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1724 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1726 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1727 {"127.0.0.1:abcd",S_OK,FALSE},
1728 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1729 {"0.1:abcd",S_OK,FALSE},
1732 {"127.0.0.1:abcd",S_OK,FALSE},
1737 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1743 {Uri_HOST_DNS,S_OK,FALSE},
1745 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1746 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1749 /* Port is just copied over. */
1750 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1752 {"http://google.com:00035",S_OK,FALSE},
1753 {"google.com:00035",S_OK,FALSE},
1754 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1755 {"google.com",S_OK,FALSE},
1758 {"google.com",S_OK,FALSE},
1763 {"http://google.com:00035",S_OK,FALSE},
1764 {"http",S_OK,FALSE},
1769 {Uri_HOST_DNS,S_OK,FALSE},
1771 {URL_SCHEME_HTTP,S_OK,FALSE},
1772 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1775 /* Default port is copied over. */
1776 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1778 {"http://google.com:80",S_OK,FALSE},
1779 {"google.com:80",S_OK,FALSE},
1780 {"http://google.com:80",S_OK,FALSE},
1781 {"google.com",S_OK,FALSE},
1784 {"google.com",S_OK,FALSE},
1789 {"http://google.com:80",S_OK,FALSE},
1790 {"http",S_OK,FALSE},
1795 {Uri_HOST_DNS,S_OK,FALSE},
1797 {URL_SCHEME_HTTP,S_OK,FALSE},
1798 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1801 { "http://google.com.uk", 0, S_OK, FALSE,
1803 {"http://google.com.uk/",S_OK,FALSE},
1804 {"google.com.uk",S_OK,FALSE},
1805 {"http://google.com.uk/",S_OK,FALSE},
1806 {"google.com.uk",S_OK,FALSE},
1809 {"google.com.uk",S_OK,FALSE},
1814 {"http://google.com.uk",S_OK,FALSE},
1815 {"http",S_OK,FALSE},
1820 {Uri_HOST_DNS,S_OK,FALSE},
1822 {URL_SCHEME_HTTP,S_OK,FALSE},
1823 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1826 { "http://google.com.com", 0, S_OK, FALSE,
1828 {"http://google.com.com/",S_OK,FALSE},
1829 {"google.com.com",S_OK,FALSE},
1830 {"http://google.com.com/",S_OK,FALSE},
1831 {"com.com",S_OK,FALSE},
1834 {"google.com.com",S_OK,FALSE},
1839 {"http://google.com.com",S_OK,FALSE},
1840 {"http",S_OK,FALSE},
1845 {Uri_HOST_DNS,S_OK,FALSE},
1847 {URL_SCHEME_HTTP,S_OK,FALSE},
1848 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1851 { "http://google.uk.1", 0, S_OK, FALSE,
1853 {"http://google.uk.1/",S_OK,FALSE},
1854 {"google.uk.1",S_OK,FALSE},
1855 {"http://google.uk.1/",S_OK,FALSE},
1856 {"google.uk.1",S_OK,FALSE},
1859 {"google.uk.1",S_OK,FALSE},
1864 {"http://google.uk.1",S_OK,FALSE},
1865 {"http",S_OK,FALSE},
1870 {Uri_HOST_DNS,S_OK,FALSE},
1872 {URL_SCHEME_HTTP,S_OK,FALSE},
1873 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1876 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1877 { "http://google.foo.uk", 0, S_OK, FALSE,
1879 {"http://google.foo.uk/",S_OK,FALSE},
1880 {"google.foo.uk",S_OK,FALSE},
1881 {"http://google.foo.uk/",S_OK,FALSE},
1882 {"foo.uk",S_OK,FALSE},
1885 {"google.foo.uk",S_OK,FALSE},
1890 {"http://google.foo.uk",S_OK,FALSE},
1891 {"http",S_OK,FALSE},
1896 {Uri_HOST_DNS,S_OK,FALSE},
1898 {URL_SCHEME_HTTP,S_OK,FALSE},
1899 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1902 { "http://.com", 0, S_OK, FALSE,
1904 {"http://.com/",S_OK,FALSE},
1905 {".com",S_OK,FALSE},
1906 {"http://.com/",S_OK,FALSE},
1907 {".com",S_OK,FALSE},
1910 {".com",S_OK,FALSE},
1915 {"http://.com",S_OK,FALSE},
1916 {"http",S_OK,FALSE},
1921 {Uri_HOST_DNS,S_OK,FALSE},
1923 {URL_SCHEME_HTTP,S_OK,FALSE},
1924 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1927 { "http://.uk", 0, S_OK, FALSE,
1929 {"http://.uk/",S_OK,FALSE},
1931 {"http://.uk/",S_OK,FALSE},
1940 {"http://.uk",S_OK,FALSE},
1941 {"http",S_OK,FALSE},
1946 {Uri_HOST_DNS,S_OK,FALSE},
1948 {URL_SCHEME_HTTP,S_OK,FALSE},
1949 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1952 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
1954 {"http://www.co.google.com.[]/",S_OK,FALSE},
1955 {"www.co.google.com.[]",S_OK,FALSE},
1956 {"http://www.co.google.com.[]/",S_OK,FALSE},
1957 {"google.com.[]",S_OK,FALSE},
1960 {"www.co.google.com.[]",S_OK,FALSE},
1965 {"http://www.co.google.com.[]",S_OK,FALSE},
1966 {"http",S_OK,FALSE},
1971 {Uri_HOST_DNS,S_OK,FALSE},
1973 {URL_SCHEME_HTTP,S_OK,FALSE},
1974 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1977 { "http://co.uk", 0, S_OK, FALSE,
1979 {"http://co.uk/",S_OK,FALSE},
1980 {"co.uk",S_OK,FALSE},
1981 {"http://co.uk/",S_OK,FALSE},
1985 {"co.uk",S_OK,FALSE},
1990 {"http://co.uk",S_OK,FALSE},
1991 {"http",S_OK,FALSE},
1996 {Uri_HOST_DNS,S_OK,FALSE},
1998 {URL_SCHEME_HTTP,S_OK,FALSE},
1999 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2002 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2004 {"http://www.co.google.us.test/",S_OK,FALSE},
2005 {"www.co.google.us.test",S_OK,FALSE},
2006 {"http://www.co.google.us.test/",S_OK,FALSE},
2007 {"us.test",S_OK,FALSE},
2010 {"www.co.google.us.test",S_OK,FALSE},
2015 {"http://www.co.google.us.test",S_OK,FALSE},
2016 {"http",S_OK,FALSE},
2021 {Uri_HOST_DNS,S_OK,FALSE},
2023 {URL_SCHEME_HTTP,S_OK,FALSE},
2024 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2027 { "http://gov.uk", 0, S_OK, FALSE,
2029 {"http://gov.uk/",S_OK,FALSE},
2030 {"gov.uk",S_OK,FALSE},
2031 {"http://gov.uk/",S_OK,FALSE},
2035 {"gov.uk",S_OK,FALSE},
2040 {"http://gov.uk",S_OK,FALSE},
2041 {"http",S_OK,FALSE},
2046 {Uri_HOST_DNS,S_OK,FALSE},
2048 {URL_SCHEME_HTTP,S_OK,FALSE},
2049 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2052 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2054 {"zip://www.google.com\\test",S_OK,FALSE},
2055 {"www.google.com\\test",S_OK,FALSE},
2056 {"zip://www.google.com\\test",S_OK,FALSE},
2057 {"google.com\\test",S_OK,FALSE},
2060 {"www.google.com\\test",S_OK,FALSE},
2065 {"zip://www.google.com\\test",S_OK,FALSE},
2071 {Uri_HOST_DNS,S_OK,FALSE},
2073 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2074 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2077 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2079 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2081 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2087 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2088 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2090 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2096 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2098 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2099 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2102 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2103 * are decoded and all '%' are encoded.
2105 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2107 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2109 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2111 {".mp3",S_OK,FALSE},
2115 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2116 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2118 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2119 {"file",S_OK,FALSE},
2124 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2126 {URL_SCHEME_FILE,S_OK,FALSE},
2127 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2130 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2131 * is decoded and only %'s in front of invalid hex digits are encoded.
2133 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2135 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2137 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2139 {".mp3",S_OK,FALSE},
2143 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2144 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2146 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2147 {"file",S_OK,FALSE},
2152 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2154 {URL_SCHEME_FILE,S_OK,FALSE},
2155 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2158 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2159 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2161 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2162 {"[::1.2.3.0]",S_OK,FALSE},
2163 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2167 {"::1.2.3.0",S_OK,FALSE},
2169 {"/%3F%23.T/test",S_OK,FALSE},
2170 {"/%3F%23.T/test",S_OK,FALSE},
2172 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2173 {"http",S_OK,FALSE},
2178 {Uri_HOST_IPV6,S_OK,FALSE},
2180 {URL_SCHEME_HTTP,S_OK,FALSE},
2181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2184 /* Forbidden characters are always encoded for file URIs. */
2185 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2187 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2189 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2191 {".mp3",S_OK,FALSE},
2195 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2196 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2198 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2199 {"file",S_OK,FALSE},
2204 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2206 {URL_SCHEME_FILE,S_OK,FALSE},
2207 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2210 /* Forbidden characters are never encoded for unknown scheme types. */
2211 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2213 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2214 {"4294967295",S_OK,FALSE},
2215 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2219 {"4294967295",S_OK,FALSE},
2221 {"/<|>\" test<|>",S_OK,FALSE},
2222 {"/<|>\" test<|>",S_OK,FALSE},
2224 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2225 {"1234",S_OK,FALSE},
2230 {Uri_HOST_IPV4,S_OK,FALSE},
2232 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2233 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2236 /* Make sure forbidden characters are percent encoded. */
2237 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2239 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2240 {"gov.uk",S_OK,FALSE},
2241 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2245 {"gov.uk",S_OK,FALSE},
2247 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2248 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2250 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2251 {"http",S_OK,FALSE},
2256 {Uri_HOST_DNS,S_OK,FALSE},
2258 {URL_SCHEME_HTTP,S_OK,FALSE},
2259 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2262 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2264 {"http://gov.uk/",S_OK,FALSE},
2265 {"gov.uk",S_OK,FALSE},
2266 {"http://gov.uk/",S_OK,FALSE},
2270 {"gov.uk",S_OK,FALSE},
2275 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2276 {"http",S_OK,FALSE},
2281 {Uri_HOST_DNS,S_OK,FALSE},
2283 {URL_SCHEME_HTTP,S_OK,FALSE},
2284 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2287 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2289 {"http://gov.uk/",S_OK,FALSE},
2290 {"gov.uk",S_OK,FALSE},
2291 {"http://gov.uk/",S_OK,FALSE},
2295 {"gov.uk",S_OK,FALSE},
2300 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2301 {"http",S_OK,FALSE},
2306 {Uri_HOST_DNS,S_OK,FALSE},
2308 {URL_SCHEME_HTTP,S_OK,FALSE},
2309 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2312 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2314 {"http://gov.uk/",S_OK,FALSE},
2315 {"gov.uk",S_OK,FALSE},
2316 {"http://gov.uk/",S_OK,FALSE},
2320 {"gov.uk",S_OK,FALSE},
2325 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2326 {"http",S_OK,FALSE},
2331 {Uri_HOST_DNS,S_OK,FALSE},
2333 {URL_SCHEME_HTTP,S_OK,FALSE},
2334 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2337 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2339 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2341 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2343 {".mp3",S_OK,FALSE},
2347 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2348 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2350 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2351 {"file",S_OK,FALSE},
2356 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2358 {URL_SCHEME_FILE,S_OK,FALSE},
2359 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2362 /* Dot removal happens for unknown scheme types. */
2363 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2365 {"zip://gov.uk/",S_OK,FALSE},
2366 {"gov.uk",S_OK,FALSE},
2367 {"zip://gov.uk/",S_OK,FALSE},
2371 {"gov.uk",S_OK,FALSE},
2376 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2382 {Uri_HOST_DNS,S_OK,FALSE},
2384 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2388 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2389 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2391 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2392 {"gov.uk",S_OK,FALSE},
2393 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2397 {"gov.uk",S_OK,FALSE},
2399 {"/test/test2/../../.",S_OK,FALSE},
2400 {"/test/test2/../../.",S_OK,FALSE},
2402 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2403 {"http",S_OK,FALSE},
2408 {Uri_HOST_DNS,S_OK,FALSE},
2410 {URL_SCHEME_HTTP,S_OK,FALSE},
2411 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2414 /* Dot removal doesn't happen for wildcard scheme types. */
2415 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2417 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2418 {"gov.uk",S_OK,FALSE},
2419 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2423 {"gov.uk",S_OK,FALSE},
2425 {"/test/test2/../../.",S_OK,FALSE},
2426 {"/test/test2/../../.",S_OK,FALSE},
2428 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2434 {Uri_HOST_DNS,S_OK,FALSE},
2436 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2437 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2440 /* Forbidden characters are encoded for opaque known scheme types. */
2441 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2443 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2445 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2447 {".com%22",S_OK,FALSE},
2451 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2452 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2454 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2455 {"mailto",S_OK,FALSE},
2460 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2462 {URL_SCHEME_MAILTO,S_OK,FALSE},
2463 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2466 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2468 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2470 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2472 {".com",S_OK,FALSE},
2476 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2477 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2479 {"news:test.tes<|>t.com",S_OK,FALSE},
2480 {"news",S_OK,FALSE},
2485 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2487 {URL_SCHEME_NEWS,S_OK,FALSE},
2488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2491 /* Don't encode forbidden characters. */
2492 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2494 {"news:test.tes<|>t.com",S_OK,FALSE},
2496 {"news:test.tes<|>t.com",S_OK,FALSE},
2498 {".com",S_OK,FALSE},
2502 {"test.tes<|>t.com",S_OK,FALSE},
2503 {"test.tes<|>t.com",S_OK,FALSE},
2505 {"news:test.tes<|>t.com",S_OK,FALSE},
2506 {"news",S_OK,FALSE},
2511 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2513 {URL_SCHEME_NEWS,S_OK,FALSE},
2514 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2517 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2518 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2520 {"urn:test.tes<|>t.com",S_OK,FALSE},
2522 {"urn:test.tes<|>t.com",S_OK,FALSE},
2524 {".com",S_OK,FALSE},
2528 {"test.tes<|>t.com",S_OK,FALSE},
2529 {"test.tes<|>t.com",S_OK,FALSE},
2531 {"urn:test.tes<|>t.com",S_OK,FALSE},
2537 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2539 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2540 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2543 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2544 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2546 {"news:test.test.com",S_OK,FALSE},
2548 {"news:test.test.com",S_OK,FALSE},
2550 {".com",S_OK,FALSE},
2554 {"test.test.com",S_OK,FALSE},
2555 {"test.test.com",S_OK,FALSE},
2557 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2558 {"news",S_OK,FALSE},
2563 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2565 {URL_SCHEME_NEWS,S_OK,FALSE},
2566 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2569 /* Percent encoded characters are still decoded for known scheme types. */
2570 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2572 {"news:test.test.com",S_OK,FALSE},
2574 {"news:test.test.com",S_OK,FALSE},
2576 {".com",S_OK,FALSE},
2580 {"test.test.com",S_OK,FALSE},
2581 {"test.test.com",S_OK,FALSE},
2583 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2584 {"news",S_OK,FALSE},
2589 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2591 {URL_SCHEME_NEWS,S_OK,FALSE},
2592 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2595 /* Percent encoded characters aren't decoded for unknown scheme types. */
2596 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2598 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2600 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2602 {".com",S_OK,FALSE},
2606 {"test.%74%65%73%74.com",S_OK,FALSE},
2607 {"test.%74%65%73%74.com",S_OK,FALSE},
2609 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2615 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2617 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2618 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2621 /* Unknown scheme types can have invalid % encoded data in query string. */
2622 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2624 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2625 {"www.winehq.org",S_OK,FALSE},
2626 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2627 {"winehq.org",S_OK,FALSE},
2630 {"www.winehq.org",S_OK,FALSE},
2633 {"/?query=%xx&return=y",S_OK,FALSE},
2634 {"?query=%xx&return=y",S_OK,FALSE},
2635 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2641 {Uri_HOST_DNS,S_OK,FALSE},
2643 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2644 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2647 /* Known scheme types can have invalid % encoded data with the right flags. */
2648 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2650 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2651 {"www.winehq.org",S_OK,FALSE},
2652 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2653 {"winehq.org",S_OK,FALSE},
2656 {"www.winehq.org",S_OK,FALSE},
2659 {"/?query=%xx&return=y",S_OK,FALSE},
2660 {"?query=%xx&return=y",S_OK,FALSE},
2661 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2662 {"http",S_OK,FALSE},
2667 {Uri_HOST_DNS,S_OK,FALSE},
2669 {URL_SCHEME_HTTP,S_OK,FALSE},
2670 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2673 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2674 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2676 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2677 {"www.winehq.org",S_OK,FALSE},
2678 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2679 {"winehq.org",S_OK,FALSE},
2682 {"www.winehq.org",S_OK,FALSE},
2685 {"/?query=<|>&return=y",S_OK,FALSE},
2686 {"?query=<|>&return=y",S_OK,FALSE},
2687 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2688 {"http",S_OK,FALSE},
2693 {Uri_HOST_DNS,S_OK,FALSE},
2695 {URL_SCHEME_HTTP,S_OK,FALSE},
2696 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2699 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2700 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2702 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2703 {"www.winehq.org",S_OK,FALSE},
2704 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2705 {"winehq.org",S_OK,FALSE},
2708 {"www.winehq.org",S_OK,FALSE},
2711 {"/?query=<|>&return=y",S_OK,FALSE},
2712 {"?query=<|>&return=y",S_OK,FALSE},
2713 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2714 {"http",S_OK,FALSE},
2719 {Uri_HOST_DNS,S_OK,FALSE},
2721 {URL_SCHEME_HTTP,S_OK,FALSE},
2722 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2725 /* Forbidden characters are encoded for known scheme types. */
2726 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2728 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2729 {"www.winehq.org",S_OK,FALSE},
2730 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2731 {"winehq.org",S_OK,FALSE},
2734 {"www.winehq.org",S_OK,FALSE},
2737 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2738 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2739 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2740 {"http",S_OK,FALSE},
2745 {Uri_HOST_DNS,S_OK,FALSE},
2747 {URL_SCHEME_HTTP,S_OK,FALSE},
2748 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2751 /* Forbidden characters are not encoded for unknown scheme types. */
2752 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2754 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2755 {"www.winehq.org",S_OK,FALSE},
2756 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2757 {"winehq.org",S_OK,FALSE},
2760 {"www.winehq.org",S_OK,FALSE},
2763 {"/?query=<|>&return=y",S_OK,FALSE},
2764 {"?query=<|>&return=y",S_OK,FALSE},
2765 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2771 {Uri_HOST_DNS,S_OK,FALSE},
2773 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2774 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2777 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2778 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2780 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2781 {"www.winehq.org",S_OK,FALSE},
2782 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2783 {"winehq.org",S_OK,FALSE},
2786 {"www.winehq.org",S_OK,FALSE},
2789 {"/?query=01&return=y",S_OK,FALSE},
2790 {"?query=01&return=y",S_OK,FALSE},
2791 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2792 {"http",S_OK,FALSE},
2797 {Uri_HOST_DNS,S_OK,FALSE},
2799 {URL_SCHEME_HTTP,S_OK,FALSE},
2800 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2803 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2804 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2806 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2807 {"www.winehq.org",S_OK,FALSE},
2808 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2809 {"winehq.org",S_OK,FALSE},
2812 {"www.winehq.org",S_OK,FALSE},
2815 {"/?query=%30%31&return=y",S_OK,FALSE},
2816 {"?query=%30%31&return=y",S_OK,FALSE},
2817 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2823 {Uri_HOST_DNS,S_OK,FALSE},
2825 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2826 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2829 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2830 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2832 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2833 {"www.winehq.org",S_OK,FALSE},
2834 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2835 {"winehq.org",S_OK,FALSE},
2838 {"www.winehq.org",S_OK,FALSE},
2841 {"/?query=%30%31&return=y",S_OK,FALSE},
2842 {"?query=%30%31&return=y",S_OK,FALSE},
2843 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2844 {"http",S_OK,FALSE},
2849 {Uri_HOST_DNS,S_OK,FALSE},
2851 {URL_SCHEME_HTTP,S_OK,FALSE},
2852 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2855 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2857 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2858 {"www.winehq.org",S_OK,FALSE},
2859 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2860 {"winehq.org",S_OK,FALSE},
2863 {"www.winehq.org",S_OK,FALSE},
2866 {"?query=12&return=y",S_OK,FALSE},
2867 {"?query=12&return=y",S_OK,FALSE},
2868 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2869 {"http",S_OK,FALSE},
2874 {Uri_HOST_DNS,S_OK,FALSE},
2876 {URL_SCHEME_HTTP,S_OK,FALSE},
2877 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2880 /* Unknown scheme types can have invalid % encoded data in fragments. */
2881 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2883 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2884 {"www.winehq.org",S_OK,FALSE},
2885 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2886 {"winehq.org",S_OK,FALSE},
2888 {"#Te%xx",S_OK,FALSE},
2889 {"www.winehq.org",S_OK,FALSE},
2891 {"/tests/",S_OK,FALSE},
2892 {"/tests/",S_OK,FALSE},
2894 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2900 {Uri_HOST_DNS,S_OK,FALSE},
2902 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2903 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2906 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2907 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2909 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2910 {"www.winehq.org",S_OK,FALSE},
2911 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2912 {"winehq.org",S_OK,FALSE},
2914 {"#Te<|>",S_OK,FALSE},
2915 {"www.winehq.org",S_OK,FALSE},
2917 {"/tests/",S_OK,FALSE},
2918 {"/tests/",S_OK,FALSE},
2920 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2926 {Uri_HOST_DNS,S_OK,FALSE},
2928 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2929 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2932 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2933 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2935 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2936 {"www.winehq.org",S_OK,FALSE},
2937 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2938 {"winehq.org",S_OK,FALSE},
2940 {"#Te%3C%7C%3E",S_OK,FALSE},
2941 {"www.winehq.org",S_OK,FALSE},
2943 {"/tests/",S_OK,FALSE},
2944 {"/tests/",S_OK,FALSE},
2946 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2947 {"http",S_OK,FALSE},
2952 {Uri_HOST_DNS,S_OK,FALSE},
2954 {URL_SCHEME_HTTP,S_OK,FALSE},
2955 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2958 /* Forbidden characters aren't encoded in the fragment with this flag. */
2959 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2961 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2962 {"www.winehq.org",S_OK,FALSE},
2963 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2964 {"winehq.org",S_OK,FALSE},
2966 {"#Te<|>",S_OK,FALSE},
2967 {"www.winehq.org",S_OK,FALSE},
2969 {"/tests/",S_OK,FALSE},
2970 {"/tests/",S_OK,FALSE},
2972 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2973 {"http",S_OK,FALSE},
2978 {Uri_HOST_DNS,S_OK,FALSE},
2980 {URL_SCHEME_HTTP,S_OK,FALSE},
2981 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2984 /* Forbidden characters aren't encoded in the fragment with this flag. */
2985 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2987 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2988 {"www.winehq.org",S_OK,FALSE},
2989 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2990 {"winehq.org",S_OK,FALSE},
2992 {"#Te<|>",S_OK,FALSE},
2993 {"www.winehq.org",S_OK,FALSE},
2995 {"/tests/",S_OK,FALSE},
2996 {"/tests/",S_OK,FALSE},
2998 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2999 {"http",S_OK,FALSE},
3004 {Uri_HOST_DNS,S_OK,FALSE},
3006 {URL_SCHEME_HTTP,S_OK,FALSE},
3007 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3010 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3011 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3013 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3014 {"www.winehq.org",S_OK,FALSE},
3015 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3016 {"winehq.org",S_OK,FALSE},
3018 {"#Te%30%31%32",S_OK,FALSE},
3019 {"www.winehq.org",S_OK,FALSE},
3021 {"/tests/",S_OK,FALSE},
3022 {"/tests/",S_OK,FALSE},
3024 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3030 {Uri_HOST_DNS,S_OK,FALSE},
3032 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3033 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3036 /* Percent encoded, unreserved characters are decoded for known schemes. */
3037 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3039 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3040 {"www.winehq.org",S_OK,FALSE},
3041 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3042 {"winehq.org",S_OK,FALSE},
3044 {"#Te012",S_OK,FALSE},
3045 {"www.winehq.org",S_OK,FALSE},
3047 {"/tests/",S_OK,FALSE},
3048 {"/tests/",S_OK,FALSE},
3050 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3051 {"http",S_OK,FALSE},
3056 {Uri_HOST_DNS,S_OK,FALSE},
3058 {URL_SCHEME_HTTP,S_OK,FALSE},
3059 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3062 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3063 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3065 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3066 {"www.winehq.org",S_OK,FALSE},
3067 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3068 {"winehq.org",S_OK,FALSE},
3070 {"#Te012",S_OK,FALSE},
3071 {"www.winehq.org",S_OK,FALSE},
3073 {"/tests/",S_OK,FALSE},
3074 {"/tests/",S_OK,FALSE},
3076 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3077 {"http",S_OK,FALSE},
3082 {Uri_HOST_DNS,S_OK,FALSE},
3084 {URL_SCHEME_HTTP,S_OK,FALSE},
3085 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3088 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3089 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3091 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3092 {"www.winehq.org",S_OK,FALSE},
3093 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3094 {"winehq.org",S_OK,FALSE},
3096 {"#Te%30%31%32",S_OK,FALSE},
3097 {"www.winehq.org",S_OK,FALSE},
3099 {"/tests/",S_OK,FALSE},
3100 {"/tests/",S_OK,FALSE},
3102 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3103 {"http",S_OK,FALSE},
3108 {Uri_HOST_DNS,S_OK,FALSE},
3110 {URL_SCHEME_HTTP,S_OK,FALSE},
3111 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3114 /* Leading/Trailing whitespace is removed. */
3115 { " http://google.com/ ", 0, S_OK, FALSE,
3117 {"http://google.com/",S_OK,FALSE},
3118 {"google.com",S_OK,FALSE},
3119 {"http://google.com/",S_OK,FALSE},
3120 {"google.com",S_OK,FALSE},
3123 {"google.com",S_OK,FALSE},
3128 {"http://google.com/",S_OK,FALSE},
3129 {"http",S_OK,FALSE},
3134 {Uri_HOST_DNS,S_OK,FALSE},
3136 {URL_SCHEME_HTTP,S_OK,FALSE},
3137 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3140 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3142 {"http://google.com/",S_OK,FALSE},
3143 {"google.com",S_OK,FALSE},
3144 {"http://google.com/",S_OK,FALSE},
3145 {"google.com",S_OK,FALSE},
3148 {"google.com",S_OK,FALSE},
3153 {"http://google.com/",S_OK,FALSE},
3154 {"http",S_OK,FALSE},
3159 {Uri_HOST_DNS,S_OK,FALSE},
3161 {URL_SCHEME_HTTP,S_OK,FALSE},
3162 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3165 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3167 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3168 {"g%0aoogle.co%0dm",S_OK,FALSE},
3169 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3170 {"g%0aoogle.co%0dm",S_OK,FALSE},
3173 {"g%0aoogle.co%0dm",S_OK,FALSE},
3175 {"/%0A%0A%0A",S_OK,FALSE},
3176 {"/%0A%0A%0A",S_OK,FALSE},
3178 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3179 {"http",S_OK,FALSE},
3184 {Uri_HOST_DNS,S_OK,FALSE},
3186 {URL_SCHEME_HTTP,S_OK,FALSE},
3187 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3190 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3192 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3193 {"g\noogle.co\rm",S_OK,FALSE},
3194 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3195 {"g\noogle.co\rm",S_OK,FALSE},
3198 {"g\noogle.co\rm",S_OK,FALSE},
3200 {"/\n\n\n",S_OK,FALSE},
3201 {"/\n\n\n",S_OK,FALSE},
3203 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3209 {Uri_HOST_DNS,S_OK,FALSE},
3211 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3212 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3215 /* Since file URLs are usually hierarchical, it returns an empty string
3216 * for the absolute URI property since it was declared as an opaque URI.
3218 { "file:index.html", 0, S_OK, FALSE,
3222 {"file:index.html",S_OK,FALSE},
3224 {".html",S_OK,FALSE},
3228 {"index.html",S_OK,FALSE},
3229 {"index.html",S_OK,FALSE},
3231 {"file:index.html",S_OK,FALSE},
3232 {"file",S_OK,FALSE},
3237 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3239 {URL_SCHEME_FILE,S_OK,FALSE},
3240 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3243 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3244 { "http:test.com/index.html", 0, S_OK, FALSE,
3248 {"http:test.com/index.html",S_OK,FALSE},
3250 {".html",S_OK,FALSE},
3254 {"test.com/index.html",S_OK,FALSE},
3255 {"test.com/index.html",S_OK,FALSE},
3257 {"http:test.com/index.html",S_OK,FALSE},
3258 {"http",S_OK,FALSE},
3263 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3265 {URL_SCHEME_HTTP,S_OK,FALSE},
3266 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3269 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3273 {"ftp:test.com/index.html",S_OK,FALSE},
3275 {".html",S_OK,FALSE},
3279 {"test.com/index.html",S_OK,FALSE},
3280 {"test.com/index.html",S_OK,FALSE},
3282 {"ftp:test.com/index.html",S_OK,FALSE},
3288 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3290 {URL_SCHEME_FTP,S_OK,FALSE},
3291 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3294 { "file://C|/test.mp3", 0, S_OK, FALSE,
3296 {"file:///C:/test.mp3",S_OK,FALSE},
3298 {"file:///C:/test.mp3",S_OK,FALSE},
3300 {".mp3",S_OK,FALSE},
3304 {"/C:/test.mp3",S_OK,FALSE},
3305 {"/C:/test.mp3",S_OK,FALSE},
3307 {"file://C|/test.mp3",S_OK,FALSE},
3308 {"file",S_OK,FALSE},
3313 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3315 {URL_SCHEME_FILE,S_OK,FALSE},
3316 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3319 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3321 {"file:///C:/test.mp3",S_OK,FALSE},
3323 {"file:///C:/test.mp3",S_OK,FALSE},
3325 {".mp3",S_OK,FALSE},
3329 {"/C:/test.mp3",S_OK,FALSE},
3330 {"/C:/test.mp3",S_OK,FALSE},
3332 {"file:///C|/test.mp3",S_OK,FALSE},
3333 {"file",S_OK,FALSE},
3338 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3340 {URL_SCHEME_FILE,S_OK,FALSE},
3341 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3344 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3347 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3349 {"file://c:\\dir\\index.html",S_OK,FALSE},
3351 {"file://c:\\dir\\index.html",S_OK,FALSE},
3353 {".html",S_OK,FALSE},
3357 {"c:\\dir\\index.html",S_OK,FALSE},
3358 {"c:\\dir\\index.html",S_OK,FALSE},
3360 {"file://c:/dir/index.html",S_OK,FALSE},
3361 {"file",S_OK,FALSE},
3366 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3368 {URL_SCHEME_FILE,S_OK,FALSE},
3369 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3372 /* Extra '/' after "file://" is removed. */
3373 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3375 {"file://c:\\dir\\index.html",S_OK,FALSE},
3377 {"file://c:\\dir\\index.html",S_OK,FALSE},
3379 {".html",S_OK,FALSE},
3383 {"c:\\dir\\index.html",S_OK,FALSE},
3384 {"c:\\dir\\index.html",S_OK,FALSE},
3386 {"file:///c:/dir/index.html",S_OK,FALSE},
3387 {"file",S_OK,FALSE},
3392 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3394 {URL_SCHEME_FILE,S_OK,FALSE},
3395 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3398 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3399 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3401 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3403 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3405 {".html",S_OK,FALSE},
3409 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3410 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3412 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3413 {"file",S_OK,FALSE},
3418 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3420 {URL_SCHEME_FILE,S_OK,FALSE},
3421 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3424 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3426 {"file://c:\\dir\\index.html",S_OK,FALSE},
3428 {"file://c:\\dir\\index.html",S_OK,FALSE},
3430 {".html",S_OK,FALSE},
3434 {"c:\\dir\\index.html",S_OK,FALSE},
3435 {"c:\\dir\\index.html",S_OK,FALSE},
3437 {"file://c|/dir\\index.html",S_OK,FALSE},
3438 {"file",S_OK,FALSE},
3443 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3445 {URL_SCHEME_FILE,S_OK,FALSE},
3446 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3449 /* The backslashes after the scheme name are converted to forward slashes. */
3450 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3452 {"file://c:\\dir\\index.html",S_OK,FALSE},
3454 {"file://c:\\dir\\index.html",S_OK,FALSE},
3456 {".html",S_OK,FALSE},
3460 {"c:\\dir\\index.html",S_OK,FALSE},
3461 {"c:\\dir\\index.html",S_OK,FALSE},
3463 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3464 {"file",S_OK,FALSE},
3469 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3471 {URL_SCHEME_FILE,S_OK,FALSE},
3472 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3475 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3477 {"file:///c:/dir/index.html",S_OK,FALSE},
3479 {"file:///c:/dir/index.html",S_OK,FALSE},
3481 {".html",S_OK,FALSE},
3485 {"/c:/dir/index.html",S_OK,FALSE},
3486 {"/c:/dir/index.html",S_OK,FALSE},
3488 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3489 {"file",S_OK,FALSE},
3494 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3496 {URL_SCHEME_FILE,S_OK,FALSE},
3497 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3500 { "http:\\\\google.com", 0, S_OK, FALSE,
3502 {"http://google.com/",S_OK,FALSE},
3503 {"google.com",S_OK,FALSE},
3504 {"http://google.com/",S_OK,FALSE},
3505 {"google.com",S_OK,FALSE},
3508 {"google.com",S_OK,FALSE},
3513 {"http:\\\\google.com",S_OK,FALSE},
3514 {"http",S_OK,FALSE},
3519 {Uri_HOST_DNS,S_OK,FALSE},
3521 {URL_SCHEME_HTTP,S_OK,FALSE},
3522 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3525 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3526 { "zip:\\\\google.com", 0, S_OK, FALSE,
3528 {"zip:\\\\google.com",S_OK,FALSE},
3530 {"zip:\\\\google.com",S_OK,FALSE},
3532 {".com",S_OK,FALSE},
3536 {"\\\\google.com",S_OK,FALSE},
3537 {"\\\\google.com",S_OK,FALSE},
3539 {"zip:\\\\google.com",S_OK,FALSE},
3545 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3547 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3548 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3551 /* Dot segments aren't removed. */
3552 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3554 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3556 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3558 {".html",S_OK,FALSE},
3562 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3563 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3565 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3566 {"file",S_OK,FALSE},
3571 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3573 {URL_SCHEME_FILE,S_OK,FALSE},
3574 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3577 /* Forbidden characters aren't percent encoded. */
3578 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3580 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3582 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3584 {".html",S_OK,FALSE},
3588 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3589 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3591 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3592 {"file",S_OK,FALSE},
3597 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3599 {URL_SCHEME_FILE,S_OK,FALSE},
3600 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3603 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3604 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3608 {"file:c:/dir/../../index.html",S_OK,FALSE},
3610 {".html",S_OK,FALSE},
3614 {"c:/dir/../../index.html",S_OK,FALSE},
3615 {"c:/dir/../../index.html",S_OK,FALSE},
3617 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3618 {"file",S_OK,FALSE},
3623 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3625 {URL_SCHEME_FILE,S_OK,FALSE},
3626 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3629 /* '/' are still converted to '\' even though it's an opaque URI. */
3630 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3634 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3636 {".html",S_OK,FALSE},
3640 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3641 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3643 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3644 {"file",S_OK,FALSE},
3649 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3651 {URL_SCHEME_FILE,S_OK,FALSE},
3652 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3655 /* Forbidden characters aren't percent encoded. */
3656 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3660 {"file:c:\\in^|dex.html",S_OK,FALSE},
3662 {".html",S_OK,FALSE},
3666 {"c:\\in^|dex.html",S_OK,FALSE},
3667 {"c:\\in^|dex.html",S_OK,FALSE},
3669 {"file:c:\\in^|dex.html",S_OK,FALSE},
3670 {"file",S_OK,FALSE},
3675 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3677 {URL_SCHEME_FILE,S_OK,FALSE},
3678 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3681 /* Doesn't have a UserName since the ':' appears at the beginning of the
3684 { "http://:password@gov.uk", 0, S_OK, FALSE,
3686 {"http://:password@gov.uk/",S_OK,FALSE},
3687 {":password@gov.uk",S_OK,FALSE},
3688 {"http://gov.uk/",S_OK,FALSE},
3692 {"gov.uk",S_OK,FALSE},
3693 {"password",S_OK,FALSE},
3697 {"http://:password@gov.uk",S_OK,FALSE},
3698 {"http",S_OK,FALSE},
3699 {":password",S_OK,FALSE},
3703 {Uri_HOST_DNS,S_OK,FALSE},
3705 {URL_SCHEME_HTTP,S_OK,FALSE},
3706 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3709 /* Has a UserName since the userinfo section doesn't contain a password. */
3710 { "http://@gov.uk", 0, S_OK, FALSE,
3712 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3713 {"@gov.uk",S_OK,FALSE},
3714 {"http://gov.uk/",S_OK,FALSE},
3718 {"gov.uk",S_OK,FALSE},
3723 {"http://@gov.uk",S_OK,FALSE},
3724 {"http",S_OK,FALSE},
3729 {Uri_HOST_DNS,S_OK,FALSE},
3731 {URL_SCHEME_HTTP,S_OK,FALSE},
3732 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3735 /* ":@" not included in the absolute URI. */
3736 { "http://:@gov.uk", 0, S_OK, FALSE,
3738 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3739 {":@gov.uk",S_OK,FALSE},
3740 {"http://gov.uk/",S_OK,FALSE},
3744 {"gov.uk",S_OK,FALSE},
3749 {"http://:@gov.uk",S_OK,FALSE},
3750 {"http",S_OK,FALSE},
3755 {Uri_HOST_DNS,S_OK,FALSE},
3757 {URL_SCHEME_HTTP,S_OK,FALSE},
3758 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3761 /* '@' is included because it's an unknown scheme type. */
3762 { "zip://@gov.uk", 0, S_OK, FALSE,
3764 {"zip://@gov.uk/",S_OK,FALSE},
3765 {"@gov.uk",S_OK,FALSE},
3766 {"zip://@gov.uk/",S_OK,FALSE},
3770 {"gov.uk",S_OK,FALSE},
3775 {"zip://@gov.uk",S_OK,FALSE},
3781 {Uri_HOST_DNS,S_OK,FALSE},
3783 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3784 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3787 /* ":@" are included because it's an unknown scheme type. */
3788 { "zip://:@gov.uk", 0, S_OK, FALSE,
3790 {"zip://:@gov.uk/",S_OK,FALSE},
3791 {":@gov.uk",S_OK,FALSE},
3792 {"zip://:@gov.uk/",S_OK,FALSE},
3796 {"gov.uk",S_OK,FALSE},
3801 {"zip://:@gov.uk",S_OK,FALSE},
3807 {Uri_HOST_DNS,S_OK,FALSE},
3809 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3810 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3813 { "about:blank", 0, S_OK, FALSE,
3815 {"about:blank",S_OK,FALSE},
3817 {"about:blank",S_OK,FALSE},
3823 {"blank",S_OK,FALSE},
3824 {"blank",S_OK,FALSE},
3826 {"about:blank",S_OK,FALSE},
3827 {"about",S_OK,FALSE},
3832 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3834 {URL_SCHEME_ABOUT,S_OK,FALSE},
3835 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3838 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3840 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3842 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3844 {".htm",S_OK,FALSE},
3848 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3849 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3851 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3857 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3859 {URL_SCHEME_MK,S_OK,FALSE},
3860 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3863 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3865 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3867 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3869 {".htm",S_OK,FALSE},
3873 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3874 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3876 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3882 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3884 {URL_SCHEME_MK,S_OK,FALSE},
3885 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3888 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3889 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3891 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3892 {"server",S_OK,FALSE},
3893 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3895 {".html",S_OK,FALSE},
3897 {"server",S_OK,FALSE},
3899 {"\\dir\\index.html",S_OK,FALSE},
3900 {"\\dir\\index.html",S_OK,FALSE},
3902 {"file://server/dir/index.html",S_OK,FALSE},
3903 {"file",S_OK,FALSE},
3908 {Uri_HOST_DNS,S_OK,FALSE},
3910 {URL_SCHEME_FILE,S_OK,FALSE},
3911 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3914 /* When CreateUri generates an IUri, it still displays the default port in the
3917 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3919 {"http://google.com:80/",S_OK,FALSE},
3920 {"google.com:80",S_OK,FALSE},
3921 {"http://google.com:80/",S_OK,FALSE},
3922 {"google.com",S_OK,FALSE},
3925 {"google.com",S_OK,FALSE},
3930 {"http://google.com:80/",S_OK,FALSE},
3931 {"http",S_OK,FALSE},
3936 {Uri_HOST_DNS,S_OK,FALSE},
3938 {URL_SCHEME_HTTP,S_OK,FALSE},
3939 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3942 /* For res URIs the host is everything up until the first '/'. */
3943 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3945 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3946 {"C:\\dir\\file.exe",S_OK,FALSE},
3947 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3949 {".html",S_OK,FALSE},
3951 {"C:\\dir\\file.exe",S_OK,FALSE},
3953 {"/DATA/test.html",S_OK,FALSE},
3954 {"/DATA/test.html",S_OK,FALSE},
3956 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3962 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3964 {URL_SCHEME_RES,S_OK,FALSE},
3965 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3968 /* Res URI can contain a '|' in the host name. */
3969 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
3971 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3972 {"c:\\di|r\\file.exe",S_OK,FALSE},
3973 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3977 {"c:\\di|r\\file.exe",S_OK,FALSE},
3979 {"/test",S_OK,FALSE},
3980 {"/test",S_OK,FALSE},
3982 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3988 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3990 {URL_SCHEME_RES,S_OK,FALSE},
3991 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3994 /* Res URIs can have invalid percent encoded values. */
3995 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
3997 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3998 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3999 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4003 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4005 {"/test",S_OK,FALSE},
4006 {"/test",S_OK,FALSE},
4008 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4014 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4016 {URL_SCHEME_RES,S_OK,FALSE},
4017 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4020 /* Res doesn't get forbidden characters percent encoded in it's path. */
4021 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4023 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4024 {"c:\\test",S_OK,FALSE},
4025 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4029 {"c:\\test",S_OK,FALSE},
4031 {"/tes<|>t",S_OK,FALSE},
4032 {"/tes<|>t",S_OK,FALSE},
4034 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4040 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4042 {URL_SCHEME_RES,S_OK,FALSE},
4043 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4046 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4048 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4050 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4052 {".jpg",S_OK,FALSE},
4056 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4057 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4059 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4065 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4067 {URL_SCHEME_MK,S_OK,FALSE},
4068 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4071 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4073 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4075 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4077 {".jpg",S_OK,FALSE},
4081 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4082 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4084 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4090 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4092 {URL_SCHEME_MK,S_OK,FALSE},
4093 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4096 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4098 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4100 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4102 {".jpg",S_OK,FALSE},
4106 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4107 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4109 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4115 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4117 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4118 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4121 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4123 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4125 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4127 {".jpg",S_OK,FALSE},
4131 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4132 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4134 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4140 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4142 {URL_SCHEME_MK,S_OK,FALSE},
4143 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4146 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4148 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4150 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4152 {".jpg",S_OK,FALSE},
4156 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4157 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4159 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4165 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4167 {URL_SCHEME_MK,S_OK,FALSE},
4168 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4171 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4173 {"mk:images/xxx.jpg",S_OK,FALSE},
4175 {"mk:images/xxx.jpg",S_OK,FALSE},
4177 {".jpg",S_OK,FALSE},
4181 {"images/xxx.jpg",S_OK,FALSE},
4182 {"images/xxx.jpg",S_OK,FALSE},
4184 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4190 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4192 {URL_SCHEME_MK,S_OK,FALSE},
4193 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4196 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4215 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4217 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4218 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4221 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4240 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4242 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4243 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4246 { "javascript:void", 0, S_OK, FALSE,
4248 {"javascript:void",S_OK},
4250 {"javascript:void",S_OK},
4259 {"javascript:void",S_OK},
4260 {"javascript",S_OK},
4265 {Uri_HOST_UNKNOWN,S_OK},
4267 {URL_SCHEME_JAVASCRIPT,S_OK},
4268 {URLZONE_INVALID,E_NOTIMPL}
4271 { "javascript://undefined", 0, S_OK, FALSE,
4273 {"javascript://undefined",S_OK},
4275 {"javascript://undefined",S_OK},
4281 {"//undefined",S_OK},
4282 {"//undefined",S_OK},
4284 {"javascript://undefined",S_OK},
4285 {"javascript",S_OK},
4290 {Uri_HOST_UNKNOWN,S_OK},
4292 {URL_SCHEME_JAVASCRIPT,S_OK},
4293 {URLZONE_INVALID,E_NOTIMPL}
4296 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4298 {"javascript:escape('/\\?#?')",S_OK},
4300 {"javascript:escape('/\\?#?')",S_OK},
4306 {"escape('/\\?#?')",S_OK},
4307 {"escape('/\\?#?')",S_OK},
4309 {"JavaSCript:escape('/\\?#?')",S_OK},
4310 {"javascript",S_OK},
4315 {Uri_HOST_UNKNOWN,S_OK},
4317 {URL_SCHEME_JAVASCRIPT,S_OK},
4318 {URLZONE_INVALID,E_NOTIMPL}
4321 { "*://google.com", 0, S_OK, FALSE,
4323 {"*:google.com/",S_OK,FALSE},
4324 {"google.com",S_OK},
4325 {"*:google.com/",S_OK,FALSE},
4326 {"google.com",S_OK,FALSE},
4329 {"google.com",S_OK,FALSE},
4334 {"*://google.com",S_OK,FALSE},
4340 {Uri_HOST_DNS,S_OK,FALSE},
4342 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4343 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4346 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4348 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4350 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4356 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4357 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4359 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4365 {Uri_HOST_UNKNOWN,S_OK},
4367 {URL_SCHEME_MK,S_OK},
4368 {URLZONE_INVALID,E_NOTIMPL}
4373 typedef struct _invalid_uri {
4379 static const invalid_uri invalid_uri_tests[] = {
4380 /* Has to have a scheme name. */
4381 {"://www.winehq.org",0,FALSE},
4382 /* Window's doesn't like URI's which are implicitly file paths without the
4383 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4385 {"C:/test/test.mp3",0,FALSE},
4386 {"\\\\Server/test/test.mp3",0,FALSE},
4387 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4388 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4389 /* Invalid schemes. */
4390 {"*abcd://not.valid.com",0,FALSE},
4391 {"*a*b*c*d://not.valid.com",0,FALSE},
4392 /* Not allowed to have invalid % encoded data. */
4393 {"ftp://google.co%XX/",0,FALSE},
4394 /* To many h16 components. */
4395 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4396 /* Not enough room for IPv4 address. */
4397 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4398 /* Not enough h16 components. */
4399 {"http://[1:2:3:4]",0,FALSE},
4400 /* Not enough components including IPv4. */
4401 {"http://[1:192.0.1.0]",0,FALSE},
4402 /* Not allowed to have partial IPv4 in IPv6. */
4403 {"http://[::192.0]",0,FALSE},
4404 /* Can't have elision of 1 h16 at beginning of address. */
4405 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4406 /* Can't have elision of 1 h16 at end of address. */
4407 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4408 /* Expects a valid IP Literal. */
4409 {"ftp://[not.valid.uri]/",0,FALSE},
4410 /* Expects valid port for a known scheme type. */
4411 {"ftp://www.winehq.org:123fgh",0,FALSE},
4412 /* Port exceeds USHORT_MAX for known scheme type. */
4413 {"ftp://www.winehq.org:65536",0,FALSE},
4414 /* Invalid port with IPv4 address. */
4415 {"http://www.winehq.org:1abcd",0,FALSE},
4416 /* Invalid port with IPv6 address. */
4417 {"http://[::ffff]:32xy",0,FALSE},
4418 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4419 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4420 /* Not allowed to have invalid % encoded data in opaque URI path. */
4421 {"news:test%XX",0,FALSE},
4422 {"mailto:wine@winehq%G8.com",0,FALSE},
4423 /* Known scheme types can't have invalid % encoded data in query string. */
4424 {"http://google.com/?query=te%xx",0,FALSE},
4425 /* Invalid % encoded data in fragment of know scheme type. */
4426 {"ftp://google.com/#Test%xx",0,FALSE},
4427 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4428 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4429 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4430 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4431 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4432 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4433 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4434 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4435 /* res URIs aren't allowed to have forbidden dos path characters in the
4438 {"res://c:\\te<st\\test/test",0,FALSE},
4439 {"res://c:\\te>st\\test/test",0,FALSE},
4440 {"res://c:\\te\"st\\test/test",0,FALSE},
4441 {"res://c:\\test/te%xxst",0,FALSE}
4444 typedef struct _uri_equality {
4446 DWORD create_flags_a;
4448 DWORD create_flags_b;
4453 static const uri_equality equality_tests[] = {
4455 "HTTP://www.winehq.org/test dir/./",0,
4456 "http://www.winehq.org/test dir/../test dir/",0,
4460 /* http://www.winehq.org/test%20dir */
4461 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4462 "http://www.winehq.org/test dir",0,
4466 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4467 "file:///c:/test.mp3",0,
4471 "ftp://ftp.winehq.org/",0,
4472 "ftp://ftp.winehq.org",0,
4476 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4477 "ftp://ftp.winehq.org/t%45stB/",0,
4481 "http://google.com/TEST",0,
4482 "http://google.com/test",0,
4486 "http://GOOGLE.com/",0,
4487 "http://google.com/",0,
4490 /* Performs case insensitive compare of host names (for known scheme types). */
4492 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4493 "ftp://google.com/",0,
4497 "zip://GOOGLE.com/",0,
4498 "zip://google.com/",0,
4502 "file:///c:/TEST/TeST/",0,
4503 "file:///c:/test/test/",0,
4507 "file:///server/TEST",0,
4508 "file:///SERVER/TEST",0,
4512 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4513 "http://google.com/",0,
4517 "ftp://google.com:21/",0,
4518 "ftp://google.com/",0,
4522 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4523 "http://google.com/",0,
4527 "http://google.com:70/",0,
4528 "http://google.com:71/",0,
4532 "file:///c:/dir/file.txt", 0,
4533 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4537 "file:///c:/dir/file.txt", 0,
4538 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4542 "file:///c:/dir/file.txt", 0,
4543 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4547 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4548 "file:///c:/%20dir/file.txt", 0,
4552 "file:///c:/Dir/file.txt", 0,
4553 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4557 "file:///c:/dir/file.txt", 0,
4558 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4562 "file:///c:/dir/file.txt#a", 0,
4563 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4568 typedef struct _uri_with_fragment {
4570 const char* fragment;
4572 HRESULT create_expected;
4575 const char* expected_uri;
4577 } uri_with_fragment;
4579 static const uri_with_fragment uri_fragment_tests[] = {
4581 "http://google.com/","#fragment",0,S_OK,FALSE,
4582 "http://google.com/#fragment",FALSE
4585 "http://google.com/","fragment",0,S_OK,FALSE,
4586 "http://google.com/#fragment",FALSE
4589 "zip://test.com/","?test",0,S_OK,FALSE,
4590 "zip://test.com/#?test",FALSE
4592 /* The fragment can be empty. */
4594 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4595 "ftp://ftp.google.com/#",FALSE
4599 typedef struct _uri_builder_property {
4602 const char *expected_value;
4603 Uri_PROPERTY property;
4606 } uri_builder_property;
4608 typedef struct _uri_builder_port {
4616 typedef struct _uri_builder_str_property {
4617 const char* expected;
4620 } uri_builder_str_property;
4622 typedef struct _uri_builder_dword_property {
4626 } uri_builder_dword_property;
4628 typedef struct _uri_builder_test {
4631 HRESULT create_builder_expected;
4632 BOOL create_builder_todo;
4634 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4636 uri_builder_port port_prop;
4642 DWORD uri_simple_encode_flags;
4643 HRESULT uri_simple_hres;
4644 BOOL uri_simple_todo;
4646 DWORD uri_with_flags;
4647 DWORD uri_with_builder_flags;
4648 DWORD uri_with_encode_flags;
4649 HRESULT uri_with_hres;
4652 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4653 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4656 static const uri_builder_test uri_builder_tests[] = {
4657 { "http://google.com/",0,S_OK,FALSE,
4659 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4660 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4661 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4662 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4669 {"http://username:password@google.com/?query=x#fragment",S_OK},
4670 {"username:password@google.com",S_OK},
4671 {"http://google.com/?query=x#fragment",S_OK},
4672 {"google.com",S_OK},
4675 {"google.com",S_OK},
4680 {"http://username:password@google.com/?query=x#fragment",S_OK},
4682 {"username:password",S_OK},
4686 {Uri_HOST_DNS,S_OK},
4688 {URL_SCHEME_HTTP,S_OK},
4689 {URLZONE_INVALID,E_NOTIMPL}
4692 { "http://google.com/",0,S_OK,FALSE,
4694 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4696 {TRUE,TRUE,120,S_OK,FALSE},
4701 {"test://google.com:120/",S_OK},
4702 {"google.com:120",S_OK},
4703 {"test://google.com:120/",S_OK},
4704 {"google.com",S_OK},
4707 {"google.com",S_OK},
4712 {"test://google.com:120/",S_OK},
4718 {Uri_HOST_DNS,S_OK},
4720 {URL_SCHEME_UNKNOWN,S_OK},
4721 {URLZONE_INVALID,E_NOTIMPL}
4724 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4726 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4727 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4728 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4735 {"http://[::192.2.3.4]/",S_OK},
4736 {"[::192.2.3.4]",S_OK},
4737 {"http://[::192.2.3.4]/",S_OK},
4741 {"::192.2.3.4",S_OK},
4746 {"http://[::192.2.3.4]/",S_OK},
4752 {Uri_HOST_IPV6,S_OK},
4754 {URL_SCHEME_HTTP,S_OK},
4755 {URLZONE_INVALID,E_NOTIMPL}
4758 { "http://google.com/",0,S_OK,FALSE,
4760 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4767 {"http://google.com/#Frag",S_OK},
4768 {"google.com",S_OK},
4769 {"http://google.com/#Frag",S_OK},
4770 {"google.com",S_OK},
4773 {"google.com",S_OK},
4778 {"http://google.com/#Frag",S_OK},
4784 {Uri_HOST_DNS,S_OK},
4786 {URL_SCHEME_HTTP,S_OK},
4787 {URLZONE_INVALID,E_NOTIMPL}
4790 { "http://google.com/",0,S_OK,FALSE,
4792 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4799 {"http://google.com/#",S_OK},
4800 {"google.com",S_OK},
4801 {"http://google.com/#",S_OK},
4802 {"google.com",S_OK},
4805 {"google.com",S_OK},
4810 {"http://google.com/#",S_OK},
4816 {Uri_HOST_DNS,S_OK},
4818 {URL_SCHEME_HTTP,S_OK},
4819 {URLZONE_INVALID,E_NOTIMPL}
4822 { "http://google.com/",0,S_OK,FALSE,
4824 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4831 {"http://::password@google.com/",S_OK},
4832 {"::password@google.com",S_OK},
4833 {"http://google.com/",S_OK},
4834 {"google.com",S_OK},
4837 {"google.com",S_OK},
4842 {"http://::password@google.com/",S_OK},
4844 {"::password",S_OK},
4848 {Uri_HOST_DNS,S_OK},
4850 {URL_SCHEME_HTTP,S_OK},
4851 {URLZONE_INVALID,E_NOTIMPL}
4854 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4856 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4859 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4861 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4863 {":password@test/test",S_OK},
4864 {":password@",S_OK},
4865 {":password@test/test",S_OK},
4874 {":password@test/test",S_OK},
4880 {Uri_HOST_UNKNOWN,S_OK},
4882 {URL_SCHEME_UNKNOWN,S_OK},
4883 {URLZONE_INVALID,E_NOTIMPL}
4886 { "http://google.com/",0,S_OK,FALSE,
4888 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4895 {"http://google.com/test/test",S_OK},
4896 {"google.com",S_OK},
4897 {"http://google.com/test/test",S_OK},
4898 {"google.com",S_OK},
4901 {"google.com",S_OK},
4903 {"/test/test",S_OK},
4904 {"/test/test",S_OK},
4906 {"http://google.com/test/test",S_OK},
4912 {Uri_HOST_DNS,S_OK},
4914 {URL_SCHEME_HTTP,S_OK},
4915 {URLZONE_INVALID,E_NOTIMPL}
4918 { "zip:testing/test",0,S_OK,FALSE,
4920 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4944 {Uri_HOST_UNKNOWN,S_OK},
4946 {URL_SCHEME_UNKNOWN,S_OK},
4947 {URLZONE_INVALID,E_NOTIMPL}
4950 { "http://google.com/",0,S_OK,FALSE,
4954 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4955 {TRUE,FALSE,555,S_OK,FALSE},
4960 {"http://google.com/",S_OK},
4961 {"google.com",S_OK},
4962 {"http://google.com/",S_OK},
4963 {"google.com",S_OK},
4966 {"google.com",S_OK},
4971 {"http://google.com/",S_OK},
4977 {Uri_HOST_DNS,S_OK},
4978 /* Still returns 80, even though earlier the port was disabled. */
4980 {URL_SCHEME_HTTP,S_OK},
4981 {URLZONE_INVALID,E_NOTIMPL}
4984 { "http://google.com/",0,S_OK,FALSE,
4988 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4989 * you'll get 122345 instead.
4991 {TRUE,122345,222,S_OK,FALSE},
4996 {"http://google.com:222/",S_OK},
4997 {"google.com:222",S_OK},
4998 {"http://google.com:222/",S_OK},
4999 {"google.com",S_OK},
5002 {"google.com",S_OK},
5007 {"http://google.com:222/",S_OK},
5013 {Uri_HOST_DNS,S_OK},
5015 {URL_SCHEME_HTTP,S_OK},
5016 {URLZONE_INVALID,E_NOTIMPL}
5019 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5020 { "http://google.com/",0,S_OK,FALSE,
5024 {TRUE,TRUE,999999,S_OK,FALSE},
5029 {"http://google.com:999999/",S_OK},
5030 {"google.com:999999",S_OK},
5031 {"http://google.com:999999/",S_OK},
5032 {"google.com",S_OK},
5035 {"google.com",S_OK},
5040 {"http://google.com:999999/",S_OK},
5046 {Uri_HOST_DNS,S_OK},
5048 {URL_SCHEME_HTTP,S_OK},
5049 {URLZONE_INVALID,E_NOTIMPL}
5052 { "http://google.com/",0,S_OK,FALSE,
5054 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5062 {"http://google.com/?test",S_OK},
5063 {"google.com",S_OK},
5064 {"http://google.com/?test",S_OK},
5065 {"google.com",S_OK},
5068 {"google.com",S_OK},
5073 {"http://google.com/?test",S_OK},
5079 {Uri_HOST_DNS,S_OK},
5081 {URL_SCHEME_HTTP,S_OK},
5082 {URLZONE_INVALID,E_NOTIMPL}
5085 { "http://:password@google.com/",0,S_OK,FALSE,
5094 {"http://:password@google.com/",S_OK},
5095 {":password@google.com",S_OK},
5096 {"http://google.com/",S_OK},
5097 {"google.com",S_OK},
5100 {"google.com",S_OK},
5105 {"http://:password@google.com/",S_OK},
5111 {Uri_HOST_DNS,S_OK},
5113 {URL_SCHEME_HTTP,S_OK},
5114 {URLZONE_INVALID,E_NOTIMPL}
5117 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5118 { NULL,0,S_OK,FALSE,
5120 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5121 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5128 {"http://google.com/",S_OK},
5129 {"google.com",S_OK},
5130 {"http://google.com/",S_OK},
5131 {"google.com",S_OK},
5134 {"google.com",S_OK},
5139 {"http://google.com/",S_OK},
5145 {Uri_HOST_DNS,S_OK},
5147 {URL_SCHEME_HTTP,S_OK},
5148 {URLZONE_INVALID,E_NOTIMPL}
5151 /* Can't set the scheme name to NULL. */
5152 { "zip://google.com/",0,S_OK,FALSE,
5154 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5161 {"zip://google.com/",S_OK},
5162 {"google.com",S_OK},
5163 {"zip://google.com/",S_OK},
5164 {"google.com",S_OK},
5167 {"google.com",S_OK},
5172 {"zip://google.com/",S_OK},
5178 {Uri_HOST_DNS,S_OK},
5180 {URL_SCHEME_UNKNOWN,S_OK},
5181 {URLZONE_INVALID,E_NOTIMPL}
5184 /* Can't set the scheme name to an empty string. */
5185 { "zip://google.com/",0,S_OK,FALSE,
5187 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5194 {"zip://google.com/",S_OK},
5195 {"google.com",S_OK},
5196 {"zip://google.com/",S_OK},
5197 {"google.com",S_OK},
5200 {"google.com",S_OK},
5205 {"zip://google.com/",S_OK},
5211 {Uri_HOST_DNS,S_OK},
5213 {URL_SCHEME_UNKNOWN,S_OK},
5214 {URLZONE_INVALID,E_NOTIMPL}
5217 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5218 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5220 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5225 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5227 {"http://google.com/../../",S_OK},
5228 {"google.com",S_OK},
5229 {"http://google.com/../../",S_OK},
5230 {"google.com",S_OK},
5233 {"google.com",S_OK},
5238 {"http://google.com/../../",S_OK},
5244 {Uri_HOST_DNS,S_OK},
5246 {URL_SCHEME_HTTP,S_OK},
5247 {URLZONE_INVALID,E_NOTIMPL}
5250 { "http://google.com/",0,S_OK,FALSE,
5252 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5257 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5259 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5260 {"google.com",S_OK},
5261 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5262 {"google.com",S_OK},
5264 {"#Fr%3C%7C%3Eg",S_OK},
5265 {"google.com",S_OK},
5270 {"http://google.com/#Fr<|>g",S_OK},
5276 {Uri_HOST_DNS,S_OK},
5278 {URL_SCHEME_HTTP,S_OK},
5279 {URLZONE_INVALID,E_NOTIMPL}
5282 { "http://google.com/",0,S_OK,FALSE,
5284 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5287 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5289 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5291 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5292 {"google.com",S_OK},
5293 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5294 {"google.com",S_OK},
5296 {"#Fr%3C%7C%3Eg",S_OK},
5297 {"google.com",S_OK},
5302 {"http://google.com/#Fr<|>g",S_OK},
5308 {Uri_HOST_DNS,S_OK},
5310 {URL_SCHEME_HTTP,S_OK},
5311 {URLZONE_INVALID,E_NOTIMPL}
5314 { NULL,0,S_OK,FALSE,
5316 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5317 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5320 0,INET_E_INVALID_URL,FALSE,
5321 0,INET_E_INVALID_URL,FALSE,
5322 0,0,0,INET_E_INVALID_URL,FALSE
5324 { "http://google.com/",0,S_OK,FALSE,
5326 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5329 0,INET_E_INVALID_URL,FALSE,
5330 0,INET_E_INVALID_URL,FALSE,
5331 0,0,0,INET_E_INVALID_URL,FALSE
5333 /* File scheme's can't have a username set. */
5334 { "file://google.com/",0,S_OK,FALSE,
5336 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5339 0,INET_E_INVALID_URL,FALSE,
5340 0,INET_E_INVALID_URL,FALSE,
5341 0,0,0,INET_E_INVALID_URL,FALSE
5343 /* File schemes can't have a password set. */
5344 { "file://google.com/",0,S_OK,FALSE,
5346 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5349 0,INET_E_INVALID_URL,FALSE,
5350 0,INET_E_INVALID_URL,FALSE,
5351 0,0,0,INET_E_INVALID_URL,FALSE
5353 /* UserName can't contain any character that is a delimeter for another
5354 * component that appears after it in a normal URI.
5356 { "http://google.com/",0,S_OK,FALSE,
5358 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5361 0,INET_E_INVALID_URL,FALSE,
5362 0,INET_E_INVALID_URL,FALSE,
5363 0,0,0,INET_E_INVALID_URL,FALSE
5365 { "http://google.com/",0,S_OK,FALSE,
5367 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5370 0,INET_E_INVALID_URL,FALSE,
5371 0,INET_E_INVALID_URL,FALSE,
5372 0,0,0,INET_E_INVALID_URL,FALSE
5374 { "http://google.com/",0,S_OK,FALSE,
5376 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5379 0,INET_E_INVALID_URL,FALSE,
5380 0,INET_E_INVALID_URL,FALSE,
5381 0,0,0,INET_E_INVALID_URL,FALSE
5383 { "http://google.com/",0,S_OK,FALSE,
5385 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5388 0,INET_E_INVALID_URL,FALSE,
5389 0,INET_E_INVALID_URL,FALSE,
5390 0,0,0,INET_E_INVALID_URL,FALSE
5392 { "http://google.com/",0,S_OK,FALSE,
5394 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5397 0,INET_E_INVALID_URL,FALSE,
5398 0,INET_E_INVALID_URL,FALSE,
5399 0,0,0,INET_E_INVALID_URL,FALSE
5401 { "http://google.com/",0,S_OK,FALSE,
5403 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5406 0,INET_E_INVALID_URL,FALSE,
5407 0,INET_E_INVALID_URL,FALSE,
5408 0,0,0,INET_E_INVALID_URL,FALSE
5410 { "http://google.com/",0,S_OK,FALSE,
5412 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5415 0,INET_E_INVALID_URL,FALSE,
5416 0,INET_E_INVALID_URL,FALSE,
5417 0,0,0,INET_E_INVALID_URL,FALSE
5419 { "http://google.com/",0,S_OK,FALSE,
5421 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5424 0,INET_E_INVALID_URL,FALSE,
5425 0,INET_E_INVALID_URL,FALSE,
5426 0,0,0,INET_E_INVALID_URL,FALSE
5428 { "http://google.com/",0,S_OK,FALSE,
5430 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5433 0,INET_E_INVALID_URL,FALSE,
5434 0,INET_E_INVALID_URL,FALSE,
5435 0,0,0,INET_E_INVALID_URL,FALSE
5437 { "http://google.com/",0,S_OK,FALSE,
5439 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5442 0,INET_E_INVALID_URL,FALSE,
5443 0,INET_E_INVALID_URL,FALSE,
5444 0,0,0,INET_E_INVALID_URL,FALSE
5446 { "http://google.com/",0,S_OK,FALSE,
5448 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5451 0,INET_E_INVALID_URL,FALSE,
5452 0,INET_E_INVALID_URL,FALSE,
5453 0,0,0,INET_E_INVALID_URL,FALSE
5455 { "http://google.com/",0,S_OK,FALSE,
5457 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5460 0,INET_E_INVALID_URL,FALSE,
5461 0,INET_E_INVALID_URL,FALSE,
5462 0,0,0,INET_E_INVALID_URL,FALSE
5464 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5465 { "http://google.com/",0,S_OK,FALSE,
5467 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5474 {"http://winehq.org:test/",S_OK},
5475 {"winehq.org:test",S_OK},
5476 {"http://winehq.org:test/",S_OK},
5477 {"winehq.org:test",S_OK},
5480 {"winehq.org:test",S_OK},
5485 {"http://winehq.org:test/",S_OK},
5491 {Uri_HOST_DNS,S_OK},
5493 {URL_SCHEME_HTTP,S_OK},
5494 {URLZONE_INVALID,E_NOTIMPL}
5497 /* Can't set the host name to NULL. */
5498 { "http://google.com/",0,S_OK,FALSE,
5500 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5507 {"http://google.com/",S_OK},
5508 {"google.com",S_OK},
5509 {"http://google.com/",S_OK},
5510 {"google.com",S_OK},
5513 {"google.com",S_OK},
5518 {"http://google.com/",S_OK},
5524 {Uri_HOST_DNS,S_OK},
5526 {URL_SCHEME_HTTP,S_OK},
5527 {URLZONE_INVALID,E_NOTIMPL}
5530 /* Can set the host name to an empty string. */
5531 { "http://google.com/",0,S_OK,FALSE,
5533 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5557 {Uri_HOST_UNKNOWN,S_OK},
5559 {URL_SCHEME_HTTP,S_OK},
5560 {URLZONE_INVALID,E_NOTIMPL}
5563 { "http://google.com/",0,S_OK,FALSE,
5565 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5568 0,INET_E_INVALID_URL,FALSE,
5569 0,INET_E_INVALID_URL,FALSE,
5570 0,0,0,INET_E_INVALID_URL,FALSE
5572 { "http://google.com/",0,S_OK,FALSE,
5574 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5577 0,INET_E_INVALID_URL,FALSE,
5578 0,INET_E_INVALID_URL,FALSE,
5579 0,0,0,INET_E_INVALID_URL,FALSE
5581 { "http://google.com/",0,S_OK,FALSE,
5583 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5586 0,INET_E_INVALID_URL,FALSE,
5587 0,INET_E_INVALID_URL,FALSE,
5588 0,0,0,INET_E_INVALID_URL,FALSE
5590 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5592 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5599 {"file:///c:/dir/file.html",S_OK},
5601 {"file:///c:/dir/file.html",S_OK},
5607 {"/c:/dir/file.html",S_OK},
5608 {"/c:/dir/file.html",S_OK},
5610 {"file:///c:/dir/file.html",S_OK},
5616 {Uri_HOST_UNKNOWN,S_OK},
5618 {URL_SCHEME_FILE,S_OK},
5619 {URLZONE_INVALID,E_NOTIMPL}
5622 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5624 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5631 {"file:///c:/dir/file.html#",S_OK},
5633 {"file:///c:/dir/file.html#",S_OK},
5639 {"/c:/dir/file.html",S_OK},
5640 {"/c:/dir/file.html",S_OK},
5642 {"file:///c:/dir/file.html#",S_OK},
5648 {Uri_HOST_UNKNOWN,S_OK},
5650 {URL_SCHEME_FILE,S_OK},
5651 {URLZONE_INVALID,E_NOTIMPL}
5656 typedef struct _uri_builder_remove_test {
5659 HRESULT create_builder_expected;
5660 BOOL create_builder_todo;
5662 DWORD remove_properties;
5663 HRESULT remove_expected;
5666 const char *expected_uri;
5667 DWORD expected_flags;
5668 HRESULT expected_hres;
5670 } uri_builder_remove_test;
5672 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5673 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5674 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5675 "http://google.com/",0,S_OK,FALSE
5677 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5678 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5679 "http://winehq.org/",0,S_OK,FALSE
5681 { "zip://google.com?Test=x",0,S_OK,FALSE,
5682 Uri_HAS_HOST,S_OK,FALSE,
5683 "zip:/?Test=x",0,S_OK,FALSE
5685 /* Doesn't remove the whole userinfo component. */
5686 { "http://username:pass@google.com/",0,S_OK,FALSE,
5687 Uri_HAS_USER_INFO,S_OK,FALSE,
5688 "http://username:pass@google.com/",0,S_OK,FALSE
5690 /* Doesn't remove the domain. */
5691 { "http://google.com/",0,S_OK,FALSE,
5692 Uri_HAS_DOMAIN,S_OK,FALSE,
5693 "http://google.com/",0,S_OK,FALSE
5695 { "http://google.com:120/",0,S_OK,FALSE,
5696 Uri_HAS_AUTHORITY,S_OK,FALSE,
5697 "http://google.com:120/",0,S_OK,FALSE
5699 { "http://google.com/test.com/",0,S_OK,FALSE,
5700 Uri_HAS_EXTENSION,S_OK,FALSE,
5701 "http://google.com/test.com/",0,S_OK,FALSE
5703 { "http://google.com/?test=x",0,S_OK,FALSE,
5704 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5705 "http://google.com/?test=x",0,S_OK,FALSE
5707 /* Can't remove the scheme name. */
5708 { "http://google.com/?test=x",0,S_OK,FALSE,
5709 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5710 "http://google.com/?test=x",0,S_OK,FALSE
5714 typedef struct _uri_combine_str_property {
5718 const char *broken_value;
5719 const char *value_ex;
5720 } uri_combine_str_property;
5722 typedef struct _uri_combine_test {
5723 const char *base_uri;
5724 DWORD base_create_flags;
5725 const char *relative_uri;
5726 DWORD relative_create_flags;
5727 DWORD combine_flags;
5731 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5732 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5735 static const uri_combine_test uri_combine_tests[] = {
5736 { "http://google.com/fun/stuff",0,
5737 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5740 {"http://google.com/not/fun/stuff",S_OK},
5741 {"google.com",S_OK},
5742 {"http://google.com/not/fun/stuff",S_OK},
5743 {"google.com",S_OK},
5746 {"google.com",S_OK},
5748 {"/not/fun/stuff",S_OK},
5749 {"/not/fun/stuff",S_OK},
5751 {"http://google.com/not/fun/stuff",S_OK},
5757 {Uri_HOST_DNS,S_OK},
5759 {URL_SCHEME_HTTP,S_OK},
5760 {URLZONE_INVALID,E_NOTIMPL}
5763 { "http://google.com/test",0,
5764 "zip://test.com/cool",0,
5767 {"zip://test.com/cool",S_OK},
5769 {"zip://test.com/cool",S_OK},
5778 {"zip://test.com/cool",S_OK},
5784 {Uri_HOST_DNS,S_OK},
5786 {URL_SCHEME_UNKNOWN,S_OK},
5787 {URLZONE_INVALID,E_NOTIMPL}
5790 { "http://google.com/use/base/path",0,
5791 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5794 {"http://google.com/use/base/path?relative",S_OK},
5795 {"google.com",S_OK},
5796 {"http://google.com/use/base/path?relative",S_OK},
5797 {"google.com",S_OK},
5800 {"google.com",S_OK},
5802 {"/use/base/path",S_OK},
5803 {"/use/base/path?relative",S_OK},
5805 {"http://google.com/use/base/path?relative",S_OK},
5811 {Uri_HOST_DNS,S_OK},
5813 {URL_SCHEME_HTTP,S_OK},
5814 {URLZONE_INVALID,E_NOTIMPL}
5817 { "http://google.com/path",0,
5818 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5821 {"http://google.com/testing",S_OK},
5822 {"google.com",S_OK},
5823 {"http://google.com/testing",S_OK},
5824 {"google.com",S_OK},
5827 {"google.com",S_OK},
5832 {"http://google.com/testing",S_OK},
5838 {Uri_HOST_DNS,S_OK},
5840 {URL_SCHEME_HTTP,S_OK},
5841 {URLZONE_INVALID,E_NOTIMPL}
5844 { "http://google.com/path",0,
5845 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5846 URL_DONT_SIMPLIFY,S_OK,FALSE,
5848 {"http://google.com:80/test/../test/.././testing",S_OK},
5849 {"google.com",S_OK},
5850 {"http://google.com:80/test/../test/.././testing",S_OK},
5851 {"google.com",S_OK},
5854 {"google.com",S_OK},
5856 {"/test/../test/.././testing",S_OK},
5857 {"/test/../test/.././testing",S_OK},
5859 {"http://google.com:80/test/../test/.././testing",S_OK},
5865 {Uri_HOST_DNS,S_OK},
5867 {URL_SCHEME_HTTP,S_OK},
5868 {URLZONE_INVALID,E_NOTIMPL}
5871 { "http://winehq.org/test/abc",0,
5872 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5875 {"http://winehq.org/test/testing/test",S_OK},
5876 {"winehq.org",S_OK},
5877 {"http://winehq.org/test/testing/test",S_OK},
5878 {"winehq.org",S_OK},
5881 {"winehq.org",S_OK},
5883 {"/test/testing/test",S_OK},
5884 {"/test/testing/test",S_OK},
5886 {"http://winehq.org/test/testing/test",S_OK},
5892 {Uri_HOST_DNS,S_OK},
5894 {URL_SCHEME_HTTP,S_OK},
5895 {URLZONE_INVALID,E_NOTIMPL}
5898 { "http://winehq.org/test/abc",0,
5899 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5900 URL_DONT_SIMPLIFY,S_OK,FALSE,
5902 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5903 /* Default port is hidden in the authority. */
5904 {"winehq.org",S_OK},
5905 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5906 {"winehq.org",S_OK},
5909 {"winehq.org",S_OK},
5911 {"/test/testing/abc/../test",S_OK},
5912 {"/test/testing/abc/../test",S_OK},
5914 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5920 {Uri_HOST_DNS,S_OK},
5922 {URL_SCHEME_HTTP,S_OK},
5923 {URLZONE_INVALID,E_NOTIMPL}
5926 { "http://winehq.org/test?query",0,
5927 "testing",Uri_CREATE_ALLOW_RELATIVE,
5930 {"http://winehq.org/testing",S_OK},
5931 {"winehq.org",S_OK},
5932 {"http://winehq.org/testing",S_OK},
5933 {"winehq.org",S_OK},
5936 {"winehq.org",S_OK},
5941 {"http://winehq.org/testing",S_OK},
5947 {Uri_HOST_DNS,S_OK},
5949 {URL_SCHEME_HTTP,S_OK},
5950 {URLZONE_INVALID,E_NOTIMPL}
5953 { "http://winehq.org/test#frag",0,
5954 "testing",Uri_CREATE_ALLOW_RELATIVE,
5957 {"http://winehq.org/testing",S_OK},
5958 {"winehq.org",S_OK},
5959 {"http://winehq.org/testing",S_OK},
5960 {"winehq.org",S_OK},
5963 {"winehq.org",S_OK},
5968 {"http://winehq.org/testing",S_OK},
5974 {Uri_HOST_DNS,S_OK},
5976 {URL_SCHEME_HTTP,S_OK},
5977 {URLZONE_INVALID,E_NOTIMPL}
5980 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5981 "test",Uri_CREATE_ALLOW_RELATIVE,
6001 {Uri_HOST_UNKNOWN,S_OK},
6003 {URL_SCHEME_UNKNOWN,S_OK},
6004 {URLZONE_INVALID,E_NOTIMPL}
6007 { "file:///c:/test/test",0,
6008 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6009 URL_FILE_USE_PATHURL,S_OK,FALSE,
6011 {"file://c:\\testing.mp3",S_OK},
6013 {"file://c:\\testing.mp3",S_OK},
6019 {"c:\\testing.mp3",S_OK},
6020 {"c:\\testing.mp3",S_OK},
6022 {"file://c:\\testing.mp3",S_OK},
6028 {Uri_HOST_UNKNOWN,S_OK},
6030 {URL_SCHEME_FILE,S_OK},
6031 {URLZONE_INVALID,E_NOTIMPL}
6034 { "file:///c:/test/test",0,
6035 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6038 {"file:///c:/testing.mp3",S_OK},
6040 {"file:///c:/testing.mp3",S_OK},
6046 {"/c:/testing.mp3",S_OK},
6047 {"/c:/testing.mp3",S_OK},
6049 {"file:///c:/testing.mp3",S_OK},
6055 {Uri_HOST_UNKNOWN,S_OK},
6057 {URL_SCHEME_FILE,S_OK},
6058 {URLZONE_INVALID,E_NOTIMPL}
6061 { "file://test.com/test/test",0,
6062 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6063 URL_FILE_USE_PATHURL,S_OK,FALSE,
6065 {"file://\\\\test.com\\testing.mp3",S_OK},
6067 {"file://\\\\test.com\\testing.mp3",S_OK},
6073 {"\\testing.mp3",S_OK},
6074 {"\\testing.mp3",S_OK},
6076 {"file://\\\\test.com\\testing.mp3",S_OK},
6082 {Uri_HOST_DNS,S_OK},
6084 {URL_SCHEME_FILE,S_OK},
6085 {URLZONE_INVALID,E_NOTIMPL}
6088 /* URL_DONT_SIMPLIFY has no effect. */
6089 { "http://google.com/test",0,
6090 "zip://test.com/cool/../cool/test",0,
6091 URL_DONT_SIMPLIFY,S_OK,FALSE,
6093 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6095 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6101 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6102 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6104 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6105 * On IE 7 it reduces the path in the Raw URI.
6107 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6113 {Uri_HOST_DNS,S_OK},
6115 {URL_SCHEME_UNKNOWN,S_OK},
6116 {URLZONE_INVALID,E_NOTIMPL}
6119 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6120 * resulting URI is converted into a dos path.
6122 { "http://google.com/test",0,
6123 "file:///c:/test/",0,
6124 URL_FILE_USE_PATHURL,S_OK,FALSE,
6126 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6128 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6134 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6135 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6137 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6143 {Uri_HOST_UNKNOWN,S_OK},
6145 {URL_SCHEME_FILE,S_OK},
6146 {URLZONE_INVALID,E_NOTIMPL}
6149 { "http://google.com/test",0,
6150 "http://test.com/test#%30test",0,
6151 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6153 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6155 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6158 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6164 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6165 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6171 {Uri_HOST_DNS,S_OK},
6173 {URL_SCHEME_HTTP,S_OK},
6174 {URLZONE_INVALID,E_NOTIMPL}
6177 /* Windows validates the path component from the relative Uri. */
6178 { "http://google.com/test",0,
6179 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6180 0,E_INVALIDARG,FALSE
6182 /* Windows doesn't validate the query from the relative Uri. */
6183 { "http://google.com/test",0,
6184 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6187 {"http://google.com/test?Tes%XXt",S_OK},
6188 {"google.com",S_OK},
6189 {"http://google.com/test?Tes%XXt",S_OK},
6190 {"google.com",S_OK},
6193 {"google.com",S_OK},
6196 {"/test?Tes%XXt",S_OK},
6198 {"http://google.com/test?Tes%XXt",S_OK},
6204 {Uri_HOST_DNS,S_OK},
6206 {URL_SCHEME_HTTP,S_OK},
6207 {URLZONE_INVALID,E_NOTIMPL}
6210 /* Windows doesn't validate the fragment from the relative Uri. */
6211 { "http://google.com/test",0,
6212 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6215 {"http://google.com/test#Tes%XXt",S_OK},
6216 {"google.com",S_OK},
6217 {"http://google.com/test#Tes%XXt",S_OK},
6218 {"google.com",S_OK},
6221 {"google.com",S_OK},
6226 {"http://google.com/test#Tes%XXt",S_OK},
6232 {Uri_HOST_DNS,S_OK},
6234 {URL_SCHEME_HTTP,S_OK},
6235 {URLZONE_INVALID,E_NOTIMPL}
6238 /* Creates an IUri which contains an invalid dos path char. */
6239 { "file:///c:/test",0,
6240 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6241 URL_FILE_USE_PATHURL,S_OK,FALSE,
6243 {"file://c:\\test<ing",S_OK},
6245 {"file://c:\\test<ing",S_OK},
6251 {"c:\\test<ing",S_OK},
6252 {"c:\\test<ing",S_OK},
6254 {"file://c:\\test<ing",S_OK},
6260 {Uri_HOST_UNKNOWN,S_OK},
6262 {URL_SCHEME_FILE,S_OK},
6263 {URLZONE_INVALID,E_NOTIMPL}
6266 /* Appends the path after the drive letter (if any). */
6267 { "file:///c:/test",0,
6268 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6271 {"file:///c:/c:/testing",S_OK},
6273 {"file:///c:/c:/testing",S_OK},
6279 {"/c:/c:/testing",S_OK},
6280 {"/c:/c:/testing",S_OK},
6282 {"file:///c:/c:/testing",S_OK},
6288 {Uri_HOST_UNKNOWN,S_OK},
6290 {URL_SCHEME_FILE,S_OK},
6291 {URLZONE_INVALID,E_NOTIMPL}
6294 /* A '/' is added if the base URI doesn't have a path and the
6295 * relative URI doesn't contain a path (since the base URI is
6298 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6299 "?test",Uri_CREATE_ALLOW_RELATIVE,
6302 {"http://google.com/?test",S_OK},
6303 {"google.com",S_OK},
6304 {"http://google.com/?test",S_OK},
6305 {"google.com",S_OK},
6308 {"google.com",S_OK},
6313 {"http://google.com/?test",S_OK},
6319 {Uri_HOST_DNS,S_OK},
6321 {URL_SCHEME_HTTP,S_OK},
6322 {URLZONE_INVALID,E_NOTIMPL}
6325 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6326 "?test",Uri_CREATE_ALLOW_RELATIVE,
6329 {"zip://google.com/?test",S_OK},
6330 {"google.com",S_OK},
6331 {"zip://google.com/?test",S_OK},
6332 {"google.com",S_OK},
6335 {"google.com",S_OK},
6340 {"zip://google.com/?test",S_OK},
6346 {Uri_HOST_DNS,S_OK},
6348 {URL_SCHEME_UNKNOWN,S_OK},
6349 {URLZONE_INVALID,E_NOTIMPL}
6352 /* No path is appended since the base URI is opaque. */
6354 "?test",Uri_CREATE_ALLOW_RELATIVE,
6374 {Uri_HOST_UNKNOWN,S_OK},
6376 {URL_SCHEME_UNKNOWN,S_OK},
6377 {URLZONE_INVALID,E_NOTIMPL}
6381 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6384 {"file:///c:/testing/test",S_OK},
6386 {"file:///c:/testing/test",S_OK},
6392 {"/c:/testing/test",S_OK},
6393 {"/c:/testing/test",S_OK},
6395 {"file:///c:/testing/test",S_OK},
6401 {Uri_HOST_UNKNOWN,S_OK},
6403 {URL_SCHEME_FILE,S_OK},
6404 {URLZONE_INVALID,E_NOTIMPL}
6407 { "http://winehq.org/dir/testfile",0,
6408 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6411 {"http://winehq.org/dir/test?querystring",S_OK},
6412 {"winehq.org",S_OK},
6413 {"http://winehq.org/dir/test?querystring",S_OK},
6414 {"winehq.org",S_OK},
6417 {"winehq.org",S_OK},
6420 {"/dir/test?querystring",S_OK},
6421 {"?querystring",S_OK},
6422 {"http://winehq.org/dir/test?querystring",S_OK},
6428 {Uri_HOST_DNS,S_OK},
6430 {URL_SCHEME_HTTP,S_OK},
6431 {URLZONE_INVALID,E_NOTIMPL}
6434 { "http://winehq.org/dir/test",0,
6435 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6438 {"http://winehq.org/dir/test?querystring",S_OK},
6439 {"winehq.org",S_OK},
6440 {"http://winehq.org/dir/test?querystring",S_OK},
6441 {"winehq.org",S_OK},
6444 {"winehq.org",S_OK},
6447 {"/dir/test?querystring",S_OK},
6448 {"?querystring",S_OK},
6449 {"http://winehq.org/dir/test?querystring",S_OK},
6455 {Uri_HOST_DNS,S_OK},
6457 {URL_SCHEME_HTTP,S_OK},
6458 {URLZONE_INVALID,E_NOTIMPL}
6461 { "http://winehq.org/dir/test?querystring",0,
6462 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6465 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6466 {"winehq.org",S_OK},
6467 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6468 {"winehq.org",S_OK},
6471 {"winehq.org",S_OK},
6474 {"/dir/test?querystring",S_OK},
6475 {"?querystring",S_OK},
6476 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6482 {Uri_HOST_DNS,S_OK},
6484 {URL_SCHEME_HTTP,S_OK},
6485 {URLZONE_INVALID,E_NOTIMPL}
6488 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6489 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6492 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6494 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6500 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6501 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6503 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6509 {Uri_HOST_UNKNOWN,S_OK},
6511 {URL_SCHEME_MK,S_OK},
6512 {URLZONE_INVALID,E_NOTIMPL}
6515 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6516 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6519 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6521 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6527 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6528 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6530 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6536 {Uri_HOST_UNKNOWN,S_OK},
6538 {URL_SCHEME_MK,S_OK},
6539 {URLZONE_INVALID,E_NOTIMPL}
6542 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6543 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6546 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6548 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6554 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6555 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6557 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6563 {Uri_HOST_UNKNOWN,S_OK},
6565 {URL_SCHEME_MK,S_OK},
6566 {URLZONE_INVALID,E_NOTIMPL}
6571 typedef struct _uri_parse_test {
6576 const char *property;
6581 static const uri_parse_test uri_parse_tests[] = {
6582 /* PARSE_CANONICALIZE tests. */
6583 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6584 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6585 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6586 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6587 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6588 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6589 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6590 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6591 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6592 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6593 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6594 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6596 /* PARSE_FRIENDLY tests. */
6597 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6598 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6600 /* PARSE_ROOTDOCUMENT tests. */
6601 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6602 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6603 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6604 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6605 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6606 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6608 /* PARSE_DOCUMENT tests. */
6609 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6610 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6611 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6612 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6613 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6614 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6616 /* PARSE_PATH_FROM_URL tests. */
6617 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6618 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6619 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6620 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6621 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6623 /* PARSE_URL_FROM_PATH tests. */
6624 /* This function almost seems to useless (just returns the absolute uri). */
6625 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6626 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6627 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6628 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6629 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6631 /* PARSE_SCHEMA tests. */
6632 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6633 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6635 /* PARSE_SITE tests. */
6636 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6637 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6638 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6639 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6641 /* PARSE_DOMAIN tests. */
6642 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6643 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6644 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6645 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6647 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6648 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6649 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6650 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6651 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6654 static inline LPWSTR a2w(LPCSTR str) {
6658 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6659 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6660 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6666 static inline BOOL heap_free(void* mem) {
6667 return HeapFree(GetProcessHeap(), 0, mem);
6670 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6671 LPWSTR strAW = a2w(strA);
6672 DWORD ret = lstrcmpW(strAW, strB);
6677 static inline ULONG get_refcnt(IUri *uri) {
6679 return IUri_Release(uri);
6682 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6687 valueW = a2w(prop->value);
6688 switch(prop->property) {
6689 case Uri_PROPERTY_FRAGMENT:
6690 hr = IUriBuilder_SetFragment(builder, valueW);
6693 ok(hr == prop->expected,
6694 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6695 hr, prop->expected, test_index);
6698 ok(hr == prop->expected,
6699 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6700 hr, prop->expected, test_index);
6703 case Uri_PROPERTY_HOST:
6704 hr = IUriBuilder_SetHost(builder, valueW);
6707 ok(hr == prop->expected,
6708 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6709 hr, prop->expected, test_index);
6712 ok(hr == prop->expected,
6713 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6714 hr, prop->expected, test_index);
6717 case Uri_PROPERTY_PASSWORD:
6718 hr = IUriBuilder_SetPassword(builder, valueW);
6721 ok(hr == prop->expected,
6722 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6723 hr, prop->expected, test_index);
6726 ok(hr == prop->expected,
6727 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6728 hr, prop->expected, test_index);
6731 case Uri_PROPERTY_PATH:
6732 hr = IUriBuilder_SetPath(builder, valueW);
6735 ok(hr == prop->expected,
6736 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6737 hr, prop->expected, test_index);
6740 ok(hr == prop->expected,
6741 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6742 hr, prop->expected, test_index);
6745 case Uri_PROPERTY_QUERY:
6746 hr = IUriBuilder_SetQuery(builder, valueW);
6749 ok(hr == prop->expected,
6750 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6751 hr, prop->expected, test_index);
6754 ok(hr == prop->expected,
6755 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6756 hr, prop->expected, test_index);
6759 case Uri_PROPERTY_SCHEME_NAME:
6760 hr = IUriBuilder_SetSchemeName(builder, valueW);
6763 ok(hr == prop->expected,
6764 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6765 hr, prop->expected, test_index);
6768 ok(hr == prop->expected,
6769 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6770 hr, prop->expected, test_index);
6773 case Uri_PROPERTY_USER_NAME:
6774 hr = IUriBuilder_SetUserName(builder, valueW);
6777 ok(hr == prop->expected,
6778 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6779 hr, prop->expected, test_index);
6782 ok(hr == prop->expected,
6783 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6784 hr, prop->expected, test_index);
6788 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6795 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6798 static void test_CreateUri_InvalidFlags(void) {
6801 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6803 IUri *uri = (void*) 0xdeadbeef;
6805 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6806 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6807 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6808 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6812 static void test_CreateUri_InvalidArgs(void) {
6814 IUri *uri = (void*) 0xdeadbeef;
6816 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6817 static const WCHAR emptyW[] = {0};
6819 hr = pCreateUri(http_urlW, 0, 0, NULL);
6820 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6822 hr = pCreateUri(NULL, 0, 0, &uri);
6823 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6824 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6826 uri = (void*) 0xdeadbeef;
6827 hr = pCreateUri(invalidW, 0, 0, &uri);
6828 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6829 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6831 uri = (void*) 0xdeadbeef;
6832 hr = pCreateUri(emptyW, 0, 0, &uri);
6833 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6834 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6837 static void test_CreateUri_InvalidUri(void) {
6840 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6841 invalid_uri test = invalid_uri_tests[i];
6846 uriW = a2w(test.uri);
6847 hr = pCreateUri(uriW, test.flags, 0, &uri);
6850 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6851 hr, E_INVALIDARG, i);
6854 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6855 hr, E_INVALIDARG, i);
6857 if(uri) IUri_Release(uri);
6863 static void test_IUri_GetPropertyBSTR(void) {
6868 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6869 hr = pCreateUri(http_urlW, 0, 0, &uri);
6870 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6872 BSTR received = NULL;
6874 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6875 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6877 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6878 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6879 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6880 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6881 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6882 SysFreeString(received);
6884 /* Make sure it handles the ZONE property correctly. */
6886 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6887 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6888 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6889 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6890 SysFreeString(received);
6892 if(uri) IUri_Release(uri);
6894 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6895 uri_properties test = uri_tests[i];
6899 uriW = a2w(test.uri);
6900 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6901 if(test.create_todo) {
6903 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6904 hr, test.create_expected, i);
6907 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6908 hr, test.create_expected, i);
6914 /* Checks all the string properties of the uri. */
6915 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6916 BSTR received = NULL;
6917 uri_str_property prop = test.str_props[j];
6919 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6922 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6923 hr, prop.expected, i, j);
6926 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6927 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6928 prop.value, wine_dbgstr_w(received), i, j);
6931 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6932 hr, prop.expected, i, j);
6933 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6934 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6935 prop.value, wine_dbgstr_w(received), i, j);
6938 SysFreeString(received);
6942 if(uri) IUri_Release(uri);
6948 static void test_IUri_GetPropertyDWORD(void) {
6953 hr = pCreateUri(http_urlW, 0, 0, &uri);
6954 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6956 DWORD received = 0xdeadbeef;
6958 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6959 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6961 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6962 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6963 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6965 if(uri) IUri_Release(uri);
6967 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6968 uri_properties test = uri_tests[i];
6972 uriW = a2w(test.uri);
6973 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6974 if(test.create_todo) {
6976 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6977 hr, test.create_expected, i);
6980 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6981 hr, test.create_expected, i);
6987 /* Checks all the DWORD properties of the uri. */
6988 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6990 uri_dword_property prop = test.dword_props[j];
6992 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6995 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6996 hr, prop.expected, i, j);
6999 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7000 prop.value, received, i, j);
7003 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7004 hr, prop.expected, i, j);
7005 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7006 prop.value, received, i, j);
7011 if(uri) IUri_Release(uri);
7017 /* Tests all the 'Get*' property functions which deal with strings. */
7018 static void test_IUri_GetStrProperties(void) {
7023 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7024 hr = pCreateUri(http_urlW, 0, 0, &uri);
7025 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7027 hr = IUri_GetAbsoluteUri(uri, NULL);
7028 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7030 hr = IUri_GetAuthority(uri, NULL);
7031 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7033 hr = IUri_GetDisplayUri(uri, NULL);
7034 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7036 hr = IUri_GetDomain(uri, NULL);
7037 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7039 hr = IUri_GetExtension(uri, NULL);
7040 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7042 hr = IUri_GetFragment(uri, NULL);
7043 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7045 hr = IUri_GetHost(uri, NULL);
7046 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7048 hr = IUri_GetPassword(uri, NULL);
7049 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7051 hr = IUri_GetPath(uri, NULL);
7052 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7054 hr = IUri_GetPathAndQuery(uri, NULL);
7055 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7057 hr = IUri_GetQuery(uri, NULL);
7058 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7060 hr = IUri_GetRawUri(uri, NULL);
7061 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7063 hr = IUri_GetSchemeName(uri, NULL);
7064 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7066 hr = IUri_GetUserInfo(uri, NULL);
7067 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7069 hr = IUri_GetUserName(uri, NULL);
7070 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7072 if(uri) IUri_Release(uri);
7074 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7075 uri_properties test = uri_tests[i];
7079 uriW = a2w(test.uri);
7080 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7081 if(test.create_todo) {
7083 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7084 hr, test.create_expected, i);
7087 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7088 hr, test.create_expected, i);
7092 uri_str_property prop;
7093 BSTR received = NULL;
7095 /* GetAbsoluteUri() tests. */
7096 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7097 hr = IUri_GetAbsoluteUri(uri, &received);
7100 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7101 hr, prop.expected, i);
7104 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7105 "Error: Expected %s but got %s on uri_tests[%d].\n",
7106 prop.value, wine_dbgstr_w(received), i);
7109 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7110 hr, prop.expected, i);
7111 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7112 "Error: Expected %s but got %s on uri_tests[%d].\n",
7113 prop.value, wine_dbgstr_w(received), i);
7115 SysFreeString(received);
7118 /* GetAuthority() tests. */
7119 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7120 hr = IUri_GetAuthority(uri, &received);
7123 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7124 hr, prop.expected, i);
7127 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7128 prop.value, wine_dbgstr_w(received), i);
7131 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7132 hr, prop.expected, i);
7133 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7134 prop.value, wine_dbgstr_w(received), i);
7136 SysFreeString(received);
7139 /* GetDisplayUri() tests. */
7140 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7141 hr = IUri_GetDisplayUri(uri, &received);
7144 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7145 hr, prop.expected, i);
7148 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7149 "Error: Expected %s but got %s on uri_test[%d].\n",
7150 prop.value, wine_dbgstr_w(received), i);
7153 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7154 hr, prop.expected, i);
7155 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7156 "Error: Expected %s but got %s on uri_tests[%d].\n",
7157 prop.value, wine_dbgstr_w(received), i);
7159 SysFreeString(received);
7162 /* GetDomain() tests. */
7163 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7164 hr = IUri_GetDomain(uri, &received);
7167 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7168 hr, prop.expected, i);
7171 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7172 prop.value, wine_dbgstr_w(received), i);
7175 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7176 hr, prop.expected, i);
7177 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7178 prop.value, wine_dbgstr_w(received), i);
7180 SysFreeString(received);
7183 /* GetExtension() tests. */
7184 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7185 hr = IUri_GetExtension(uri, &received);
7188 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7189 hr, prop.expected, i);
7192 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7193 prop.value, wine_dbgstr_w(received), i);
7196 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7197 hr, prop.expected, i);
7198 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7199 prop.value, wine_dbgstr_w(received), i);
7201 SysFreeString(received);
7204 /* GetFragment() tests. */
7205 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7206 hr = IUri_GetFragment(uri, &received);
7209 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7210 hr, prop.expected, i);
7213 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7214 prop.value, wine_dbgstr_w(received), i);
7217 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7218 hr, prop.expected, i);
7219 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7220 prop.value, wine_dbgstr_w(received), i);
7222 SysFreeString(received);
7225 /* GetHost() tests. */
7226 prop = test.str_props[Uri_PROPERTY_HOST];
7227 hr = IUri_GetHost(uri, &received);
7230 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7231 hr, prop.expected, i);
7234 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7235 prop.value, wine_dbgstr_w(received), i);
7238 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7239 hr, prop.expected, i);
7240 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7241 prop.value, wine_dbgstr_w(received), i);
7243 SysFreeString(received);
7246 /* GetPassword() tests. */
7247 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7248 hr = IUri_GetPassword(uri, &received);
7251 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7252 hr, prop.expected, i);
7255 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7256 prop.value, wine_dbgstr_w(received), i);
7259 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7260 hr, prop.expected, i);
7261 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7262 prop.value, wine_dbgstr_w(received), i);
7264 SysFreeString(received);
7267 /* GetPath() tests. */
7268 prop = test.str_props[Uri_PROPERTY_PATH];
7269 hr = IUri_GetPath(uri, &received);
7272 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7273 hr, prop.expected, i);
7276 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7277 prop.value, wine_dbgstr_w(received), i);
7280 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7281 hr, prop.expected, i);
7282 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7283 prop.value, wine_dbgstr_w(received), i);
7285 SysFreeString(received);
7288 /* GetPathAndQuery() tests. */
7289 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7290 hr = IUri_GetPathAndQuery(uri, &received);
7293 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7294 hr, prop.expected, i);
7297 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7298 prop.value, wine_dbgstr_w(received), i);
7301 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7302 hr, prop.expected, i);
7303 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7304 prop.value, wine_dbgstr_w(received), i);
7306 SysFreeString(received);
7309 /* GetQuery() tests. */
7310 prop = test.str_props[Uri_PROPERTY_QUERY];
7311 hr = IUri_GetQuery(uri, &received);
7314 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7315 hr, prop.expected, i);
7318 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7319 prop.value, wine_dbgstr_w(received), i);
7322 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7323 hr, prop.expected, i);
7324 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7325 prop.value, wine_dbgstr_w(received), i);
7327 SysFreeString(received);
7330 /* GetRawUri() tests. */
7331 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7332 hr = IUri_GetRawUri(uri, &received);
7335 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7336 hr, prop.expected, i);
7339 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7340 prop.value, wine_dbgstr_w(received), i);
7343 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7344 hr, prop.expected, i);
7345 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7346 prop.value, wine_dbgstr_w(received), i);
7348 SysFreeString(received);
7351 /* GetSchemeName() tests. */
7352 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7353 hr = IUri_GetSchemeName(uri, &received);
7356 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7357 hr, prop.expected, i);
7360 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7361 prop.value, wine_dbgstr_w(received), i);
7364 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7365 hr, prop.expected, i);
7366 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7367 prop.value, wine_dbgstr_w(received), i);
7369 SysFreeString(received);
7372 /* GetUserInfo() tests. */
7373 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7374 hr = IUri_GetUserInfo(uri, &received);
7377 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7378 hr, prop.expected, i);
7381 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7382 prop.value, wine_dbgstr_w(received), i);
7385 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7386 hr, prop.expected, i);
7387 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7388 prop.value, wine_dbgstr_w(received), i);
7390 SysFreeString(received);
7393 /* GetUserName() tests. */
7394 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7395 hr = IUri_GetUserName(uri, &received);
7398 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7399 hr, prop.expected, i);
7402 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7403 prop.value, wine_dbgstr_w(received), i);
7406 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7407 hr, prop.expected, i);
7408 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7409 prop.value, wine_dbgstr_w(received), i);
7411 SysFreeString(received);
7414 if(uri) IUri_Release(uri);
7420 static void test_IUri_GetDwordProperties(void) {
7425 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7426 hr = pCreateUri(http_urlW, 0, 0, &uri);
7427 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7429 hr = IUri_GetHostType(uri, NULL);
7430 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7432 hr = IUri_GetPort(uri, NULL);
7433 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7435 hr = IUri_GetScheme(uri, NULL);
7436 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7438 hr = IUri_GetZone(uri, NULL);
7439 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7441 if(uri) IUri_Release(uri);
7443 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7444 uri_properties test = uri_tests[i];
7448 uriW = a2w(test.uri);
7449 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7450 if(test.create_todo) {
7452 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7453 hr, test.create_expected, i);
7456 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7457 hr, test.create_expected, i);
7461 uri_dword_property prop;
7464 /* Assign an insane value so tests don't accidentally pass when
7467 received = -9999999;
7469 /* GetHostType() tests. */
7470 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7471 hr = IUri_GetHostType(uri, &received);
7474 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7475 hr, prop.expected, i);
7478 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7481 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7482 hr, prop.expected, i);
7483 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7485 received = -9999999;
7487 /* GetPort() tests. */
7488 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7489 hr = IUri_GetPort(uri, &received);
7492 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7493 hr, prop.expected, i);
7496 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7499 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7500 hr, prop.expected, i);
7501 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7503 received = -9999999;
7505 /* GetScheme() tests. */
7506 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7507 hr = IUri_GetScheme(uri, &received);
7510 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7511 hr, prop.expected, i);
7514 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7517 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7518 hr, prop.expected, i);
7519 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7521 received = -9999999;
7523 /* GetZone() tests. */
7524 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7525 hr = IUri_GetZone(uri, &received);
7528 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7529 hr, prop.expected, i);
7532 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7535 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7536 hr, prop.expected, i);
7537 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7541 if(uri) IUri_Release(uri);
7547 static void test_IUri_GetPropertyLength(void) {
7552 /* Make sure it handles invalid args correctly. */
7553 hr = pCreateUri(http_urlW, 0, 0, &uri);
7554 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7556 DWORD received = 0xdeadbeef;
7558 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7559 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7561 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7562 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7563 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7565 if(uri) IUri_Release(uri);
7567 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7568 uri_properties test = uri_tests[i];
7572 uriW = a2w(test.uri);
7573 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7574 if(test.create_todo) {
7576 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7577 hr, test.create_expected, i);
7580 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7581 hr, test.create_expected, i);
7587 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7588 DWORD expectedLen, brokenLen, receivedLen;
7589 uri_str_property prop = test.str_props[j];
7591 expectedLen = lstrlen(prop.value);
7592 brokenLen = lstrlen(prop.broken_value);
7594 /* This won't be necessary once GetPropertyLength is implemented. */
7597 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7600 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7601 hr, prop.expected, i, j);
7604 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7605 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7606 expectedLen, receivedLen, i, j);
7609 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7610 hr, prop.expected, i, j);
7611 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7612 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7613 expectedLen, receivedLen, i, j);
7618 if(uri) IUri_Release(uri);
7624 static DWORD compute_expected_props(uri_properties *test)
7628 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7629 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7633 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7634 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7641 static void test_IUri_GetProperties(void) {
7646 hr = pCreateUri(http_urlW, 0, 0, &uri);
7647 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7649 hr = IUri_GetProperties(uri, NULL);
7650 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7652 if(uri) IUri_Release(uri);
7654 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7655 uri_properties test = uri_tests[i];
7659 uriW = a2w(test.uri);
7660 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7661 if(test.create_todo) {
7663 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7666 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7670 DWORD received = 0, expected_props;
7673 hr = IUri_GetProperties(uri, &received);
7674 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7676 expected_props = compute_expected_props(&test);
7678 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7679 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7680 if(expected_props & (1 << j))
7681 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7683 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7687 if(uri) IUri_Release(uri);
7693 static void test_IUri_HasProperty(void) {
7698 hr = pCreateUri(http_urlW, 0, 0, &uri);
7699 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7701 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7702 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7704 if(uri) IUri_Release(uri);
7706 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7707 uri_properties test = uri_tests[i];
7711 uriW = a2w(test.uri);
7713 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7714 if(test.create_todo) {
7716 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7719 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7723 DWORD expected_props, j;
7725 expected_props = compute_expected_props(&test);
7727 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7728 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7731 hr = IUri_HasProperty(uri, j, &received);
7732 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7735 if(expected_props & (1 << j)) {
7736 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7738 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7743 if(uri) IUri_Release(uri);
7749 static void test_IUri_IsEqual(void) {
7757 /* Make sure IsEqual handles invalid args correctly. */
7758 hres = pCreateUri(http_urlW, 0, 0, &uriA);
7759 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7760 hres = pCreateUri(http_urlW, 0, 0, &uriB);
7761 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7764 hres = IUri_IsEqual(uriA, NULL, &equal);
7765 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7766 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7768 hres = IUri_IsEqual(uriA, uriB, NULL);
7769 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
7774 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7775 uri_equality test = equality_tests[i];
7776 LPWSTR uriA_W, uriB_W;
7780 uriA_W = a2w(test.a);
7781 uriB_W = a2w(test.b);
7783 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7784 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
7786 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7787 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
7790 hres = IUri_IsEqual(uriA, uriB, &equal);
7791 if(test.todo) todo_wine {
7792 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
7793 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7795 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
7796 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7798 if(uriA) IUri_Release(uriA);
7799 if(uriB) IUri_Release(uriB);
7806 static void test_CreateUriWithFragment_InvalidArgs(void) {
7808 IUri *uri = (void*) 0xdeadbeef;
7809 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7811 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7812 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7813 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7815 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7816 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7818 /* Original URI can't already contain a fragment component. */
7819 uri = (void*) 0xdeadbeef;
7820 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7821 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7822 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7825 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7826 static void test_CreateUriWithFragment_InvalidFlags(void) {
7829 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7831 IUri *uri = (void*) 0xdeadbeef;
7833 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7834 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7835 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7836 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7840 static void test_CreateUriWithFragment(void) {
7843 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7847 uri_with_fragment test = uri_fragment_tests[i];
7849 uriW = a2w(test.uri);
7850 fragW = a2w(test.fragment);
7852 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7853 if(test.expected_todo) {
7855 ok(hr == test.create_expected,
7856 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7857 hr, test.create_expected, i);
7860 ok(hr == test.create_expected,
7861 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7862 hr, test.create_expected, i);
7865 BSTR received = NULL;
7867 hr = IUri_GetAbsoluteUri(uri, &received);
7868 if(test.expected_todo) {
7871 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7875 ok(!strcmp_aw(test.expected_uri, received),
7876 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7877 test.expected_uri, wine_dbgstr_w(received), i);
7880 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7882 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7883 test.expected_uri, wine_dbgstr_w(received), i);
7886 SysFreeString(received);
7889 if(uri) IUri_Release(uri);
7895 static void test_CreateIUriBuilder(void) {
7897 IUriBuilder *builder = NULL;
7900 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7901 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7904 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7905 hr = pCreateUri(http_urlW, 0, 0, &uri);
7906 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7908 ULONG cur_count, orig_count;
7910 orig_count = get_refcnt(uri);
7911 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7912 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7913 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7915 cur_count = get_refcnt(uri);
7916 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7918 if(builder) IUriBuilder_Release(builder);
7919 cur_count = get_refcnt(uri);
7920 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7922 if(uri) IUri_Release(uri);
7925 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7930 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7931 if(test->uri_todo) {
7933 ok(hr == test->uri_hres,
7934 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7935 hr, test->uri_hres, test_index);
7938 ok(hr == test->uri_hres,
7939 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7940 hr, test->uri_hres, test_index);
7946 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7947 uri_builder_str_property prop = test->expected_str_props[i];
7948 BSTR received = NULL;
7950 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7953 ok(hr == prop.result,
7954 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7955 hr, prop.result, test_index, i);
7958 ok(hr == prop.result,
7959 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7960 hr, prop.result, test_index, i);
7965 ok(!strcmp_aw(prop.expected, received),
7966 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7967 prop.expected, wine_dbgstr_w(received), test_index, i);
7970 ok(!strcmp_aw(prop.expected, received),
7971 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7972 prop.expected, wine_dbgstr_w(received), test_index, i);
7975 SysFreeString(received);
7978 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7979 uri_builder_dword_property prop = test->expected_dword_props[i];
7980 DWORD received = -2;
7982 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7985 ok(hr == prop.result,
7986 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7987 hr, prop.result, test_index, i);
7990 ok(hr == prop.result,
7991 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7992 hr, prop.result, test_index, i);
7997 ok(received == prop.expected,
7998 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7999 prop.expected, received, test_index, i);
8002 ok(received == prop.expected,
8003 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8004 prop.expected, received, test_index, i);
8009 if(uri) IUri_Release(uri);
8012 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8017 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8018 if(test->uri_simple_todo) {
8020 ok(hr == test->uri_simple_hres,
8021 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8022 hr, test->uri_simple_hres, test_index);
8025 ok(hr == test->uri_simple_hres,
8026 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8027 hr, test->uri_simple_hres, test_index);
8033 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8034 uri_builder_str_property prop = test->expected_str_props[i];
8035 BSTR received = NULL;
8037 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8040 ok(hr == prop.result,
8041 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8042 hr, prop.result, test_index, i);
8045 ok(hr == prop.result,
8046 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8047 hr, prop.result, test_index, i);
8052 ok(!strcmp_aw(prop.expected, received),
8053 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8054 prop.expected, wine_dbgstr_w(received), test_index, i);
8057 ok(!strcmp_aw(prop.expected, received),
8058 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8059 prop.expected, wine_dbgstr_w(received), test_index, i);
8062 SysFreeString(received);
8065 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8066 uri_builder_dword_property prop = test->expected_dword_props[i];
8067 DWORD received = -2;
8069 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8072 ok(hr == prop.result,
8073 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8074 hr, prop.result, test_index, i);
8077 ok(hr == prop.result,
8078 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8079 hr, prop.result, test_index, i);
8084 ok(received == prop.expected,
8085 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8086 prop.expected, received, test_index, i);
8089 ok(received == prop.expected,
8090 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8091 prop.expected, received, test_index, i);
8096 if(uri) IUri_Release(uri);
8099 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8104 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8105 test->uri_with_encode_flags, 0, &uri);
8106 if(test->uri_with_todo) {
8108 ok(hr == test->uri_with_hres,
8109 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8110 hr, test->uri_with_hres, test_index);
8113 ok(hr == test->uri_with_hres,
8114 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8115 hr, test->uri_with_hres, test_index);
8121 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8122 uri_builder_str_property prop = test->expected_str_props[i];
8123 BSTR received = NULL;
8125 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8128 ok(hr == prop.result,
8129 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8130 hr, prop.result, test_index, i);
8133 ok(hr == prop.result,
8134 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8135 hr, prop.result, test_index, i);
8140 ok(!strcmp_aw(prop.expected, received),
8141 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8142 prop.expected, wine_dbgstr_w(received), test_index, i);
8145 ok(!strcmp_aw(prop.expected, received),
8146 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8147 prop.expected, wine_dbgstr_w(received), test_index, i);
8150 SysFreeString(received);
8153 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8154 uri_builder_dword_property prop = test->expected_dword_props[i];
8155 DWORD received = -2;
8157 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8160 ok(hr == prop.result,
8161 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8162 hr, prop.result, test_index, i);
8165 ok(hr == prop.result,
8166 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8167 hr, prop.result, test_index, i);
8172 ok(received == prop.expected,
8173 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8174 prop.expected, received, test_index, i);
8177 ok(received == prop.expected,
8178 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8179 prop.expected, received, test_index, i);
8184 if(uri) IUri_Release(uri);
8187 static void test_IUriBuilder_CreateInvalidArgs(void) {
8188 IUriBuilder *builder;
8191 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8192 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8194 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8196 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8197 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8198 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8200 uri = (void*) 0xdeadbeef;
8201 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8202 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8203 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8205 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8206 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8209 uri = (void*) 0xdeadbeef;
8210 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8211 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8213 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8215 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8216 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8219 uri = (void*) 0xdeadbeef;
8220 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8221 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8223 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8225 hr = pCreateUri(http_urlW, 0, 0, &test);
8226 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8228 hr = IUriBuilder_SetIUri(builder, test);
8229 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8231 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8233 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8234 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8235 ok(uri != NULL, "Error: The uri was NULL.\n");
8236 if(uri) IUri_Release(uri);
8239 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8240 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8242 ok(uri != NULL, "Error: uri was NULL.\n");
8243 if(uri) IUri_Release(uri);
8246 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8247 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8249 ok(uri != NULL, "Error: uri was NULL.\n");
8250 if(uri) IUri_Release(uri);
8252 hr = IUriBuilder_SetFragment(builder, NULL);
8253 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8255 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8256 uri = (void*) 0xdeadbeef;
8257 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8258 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8259 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8261 uri = (void*) 0xdeadbeef;
8262 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8263 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8265 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8267 uri = (void*) 0xdeadbeef;
8268 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8269 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8271 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8273 if(test) IUri_Release(test);
8275 if(builder) IUriBuilder_Release(builder);
8278 /* Tests invalid args to the "Get*" functions. */
8279 static void test_IUriBuilder_GetInvalidArgs(void) {
8280 IUriBuilder *builder = NULL;
8283 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8284 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8286 LPCWSTR received = (void*) 0xdeadbeef;
8287 DWORD len = -1, port = -1;
8290 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8291 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8293 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8294 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8296 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8297 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8298 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8300 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8302 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8303 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8305 received = (void*) 0xdeadbeef;
8306 hr = IUriBuilder_GetHost(builder, NULL, &received);
8307 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8309 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8311 hr = IUriBuilder_GetHost(builder, &len, NULL);
8312 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8314 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8316 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8317 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8319 received = (void*) 0xdeadbeef;
8320 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8321 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8323 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8325 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8326 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8328 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8330 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8331 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8333 received = (void*) 0xdeadbeef;
8334 hr = IUriBuilder_GetPath(builder, NULL, &received);
8335 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8337 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8339 hr = IUriBuilder_GetPath(builder, &len, NULL);
8340 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8342 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8344 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8345 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8347 hr = IUriBuilder_GetPort(builder, NULL, &port);
8348 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8350 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8351 hr = IUriBuilder_GetPort(builder, &set, NULL);
8352 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8354 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8356 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8357 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8359 received = (void*) 0xdeadbeef;
8360 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8361 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8363 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8365 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8366 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8368 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8370 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8371 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8373 received = (void*) 0xdeadbeef;
8374 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8375 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8377 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8379 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8380 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8382 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8384 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8385 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8387 received = (void*) 0xdeadbeef;
8388 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8389 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8391 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8393 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8394 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8396 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8398 if(builder) IUriBuilder_Release(builder);
8401 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8405 LPCWSTR received = NULL;
8407 const uri_builder_property *prop = NULL;
8409 /* Check if the property was set earlier. */
8410 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8411 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8412 prop = &(test->properties[i]);
8416 /* Use expected_value unless it's NULL, then use value. */
8417 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8418 hr = IUriBuilder_GetFragment(builder, &len, &received);
8421 ok(hr == (expected ? S_OK : S_FALSE),
8422 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8423 hr, (expected ? S_OK : S_FALSE), test_index);
8427 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8428 expected, wine_dbgstr_w(received), test_index);
8431 ok(lstrlen(expected) == len,
8432 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8433 lstrlen(expected), len, test_index);
8437 ok(hr == (expected ? S_OK : S_FALSE),
8438 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8439 hr, (expected ? S_OK : S_FALSE), test_index);
8440 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8441 expected, wine_dbgstr_w(received), test_index);
8442 ok(lstrlen(expected) == len,
8443 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8444 lstrlen(expected), len, test_index);
8447 /* The property wasn't set earlier, so it should return whatever
8448 * the base IUri contains (if anything).
8451 hr = IUriBuilder_GetIUri(builder, &uri);
8453 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8454 hr, S_OK, test_index);
8457 received = (void*) 0xdeadbeef;
8460 hr = IUriBuilder_GetFragment(builder, &len, &received);
8462 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8463 hr, S_FALSE, test_index);
8465 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8467 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8468 received, test_index);
8471 BOOL has_prop = FALSE;
8472 BSTR expected = NULL;
8474 hr = IUri_GetFragment(uri, &expected);
8476 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8478 has_prop = hr == S_OK;
8480 hr = IUriBuilder_GetFragment(builder, &len, &received);
8483 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8484 hr, S_OK, test_index);
8486 ok(!lstrcmpW(expected, received),
8487 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8488 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8489 ok(lstrlenW(expected) == len,
8490 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8491 lstrlenW(expected), len, test_index);
8495 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8496 hr, S_FALSE, test_index);
8498 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8499 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8503 SysFreeString(expected);
8506 if(uri) IUri_Release(uri);
8510 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8514 LPCWSTR received = NULL;
8516 const uri_builder_property *prop = NULL;
8518 /* Check if the property was set earlier. */
8519 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8520 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8521 prop = &(test->properties[i]);
8525 /* Use expected_value unless it's NULL, then use value. */
8526 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8527 hr = IUriBuilder_GetHost(builder, &len, &received);
8530 ok(hr == (expected ? S_OK : S_FALSE),
8531 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8532 hr, (expected ? S_OK : S_FALSE), test_index);
8536 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8537 expected, wine_dbgstr_w(received), test_index);
8540 ok(lstrlen(expected) == len,
8541 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8542 lstrlen(expected), len, test_index);
8546 ok(hr == (expected ? S_OK : S_FALSE),
8547 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8548 hr, (expected ? S_OK : S_FALSE), test_index);
8549 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8550 expected, wine_dbgstr_w(received), test_index);
8551 ok(lstrlen(expected) == len,
8552 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8553 lstrlen(expected), len, test_index);
8556 /* The property wasn't set earlier, so it should return whatever
8557 * the base IUri contains (if anything).
8560 hr = IUriBuilder_GetIUri(builder, &uri);
8562 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8563 hr, S_OK, test_index);
8566 received = (void*) 0xdeadbeef;
8569 hr = IUriBuilder_GetHost(builder, &len, &received);
8571 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8572 hr, S_FALSE, test_index);
8574 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8576 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8577 received, test_index);
8580 BOOL has_prop = FALSE;
8581 BSTR expected = NULL;
8583 hr = IUri_GetHost(uri, &expected);
8585 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8587 has_prop = hr == S_OK;
8589 hr = IUriBuilder_GetHost(builder, &len, &received);
8592 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8593 hr, S_OK, test_index);
8595 ok(!lstrcmpW(expected, received),
8596 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8597 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8598 ok(lstrlenW(expected) == len,
8599 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8600 lstrlenW(expected), len, test_index);
8604 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8605 hr, S_FALSE, test_index);
8607 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8608 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8612 SysFreeString(expected);
8615 if(uri) IUri_Release(uri);
8619 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8623 LPCWSTR received = NULL;
8625 const uri_builder_property *prop = NULL;
8627 /* Check if the property was set earlier. */
8628 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8629 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8630 prop = &(test->properties[i]);
8634 /* Use expected_value unless it's NULL, then use value. */
8635 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8636 hr = IUriBuilder_GetPassword(builder, &len, &received);
8639 ok(hr == (expected ? S_OK : S_FALSE),
8640 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8641 hr, (expected ? S_OK : S_FALSE), test_index);
8645 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8646 expected, wine_dbgstr_w(received), test_index);
8649 ok(lstrlen(expected) == len,
8650 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8651 lstrlen(expected), len, test_index);
8655 ok(hr == (expected ? S_OK : S_FALSE),
8656 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8657 hr, (expected ? S_OK : S_FALSE), test_index);
8658 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8659 expected, wine_dbgstr_w(received), test_index);
8660 ok(lstrlen(expected) == len,
8661 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8662 lstrlen(expected), len, test_index);
8665 /* The property wasn't set earlier, so it should return whatever
8666 * the base IUri contains (if anything).
8669 hr = IUriBuilder_GetIUri(builder, &uri);
8671 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8672 hr, S_OK, test_index);
8675 received = (void*) 0xdeadbeef;
8678 hr = IUriBuilder_GetPassword(builder, &len, &received);
8680 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8681 hr, S_FALSE, test_index);
8683 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8685 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8686 received, test_index);
8689 BOOL has_prop = FALSE;
8690 BSTR expected = NULL;
8692 hr = IUri_GetPassword(uri, &expected);
8694 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8696 has_prop = hr == S_OK;
8698 hr = IUriBuilder_GetPassword(builder, &len, &received);
8701 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8702 hr, S_OK, test_index);
8704 ok(!lstrcmpW(expected, received),
8705 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8706 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8707 ok(lstrlenW(expected) == len,
8708 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8709 lstrlenW(expected), len, test_index);
8713 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8714 hr, S_FALSE, test_index);
8716 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8717 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8721 SysFreeString(expected);
8724 if(uri) IUri_Release(uri);
8728 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8732 LPCWSTR received = NULL;
8734 const uri_builder_property *prop = NULL;
8736 /* Check if the property was set earlier. */
8737 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8738 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8739 prop = &(test->properties[i]);
8743 /* Use expected_value unless it's NULL, then use value. */
8744 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8745 hr = IUriBuilder_GetPath(builder, &len, &received);
8748 ok(hr == (expected ? S_OK : S_FALSE),
8749 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8750 hr, (expected ? S_OK : S_FALSE), test_index);
8754 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8755 expected, wine_dbgstr_w(received), test_index);
8758 ok(lstrlen(expected) == len,
8759 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8760 lstrlen(expected), len, test_index);
8764 ok(hr == (expected ? S_OK : S_FALSE),
8765 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8766 hr, (expected ? S_OK : S_FALSE), test_index);
8767 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8768 expected, wine_dbgstr_w(received), test_index);
8769 ok(lstrlen(expected) == len,
8770 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8771 lstrlen(expected), len, test_index);
8774 /* The property wasn't set earlier, so it should return whatever
8775 * the base IUri contains (if anything).
8778 hr = IUriBuilder_GetIUri(builder, &uri);
8780 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8781 hr, S_OK, test_index);
8784 received = (void*) 0xdeadbeef;
8787 hr = IUriBuilder_GetPath(builder, &len, &received);
8789 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8790 hr, S_FALSE, test_index);
8792 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8794 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8795 received, test_index);
8798 BOOL has_prop = FALSE;
8799 BSTR expected = NULL;
8801 hr = IUri_GetPath(uri, &expected);
8803 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8805 has_prop = hr == S_OK;
8807 hr = IUriBuilder_GetPath(builder, &len, &received);
8810 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8811 hr, S_OK, test_index);
8813 ok(!lstrcmpW(expected, received),
8814 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8815 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8816 ok(lstrlenW(expected) == len,
8817 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8818 lstrlenW(expected), len, test_index);
8822 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8823 hr, S_FALSE, test_index);
8825 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8826 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8830 SysFreeString(expected);
8833 if(uri) IUri_Release(uri);
8837 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8840 BOOL has_port = FALSE;
8841 DWORD received = -1;
8843 if(test->port_prop.change) {
8844 DWORD expected = test->port_prop.value;
8846 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8847 if(test->port_prop.todo) {
8850 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8851 hr, S_OK, test_index);
8855 ok(has_port == test->port_prop.set,
8856 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8857 test->port_prop.set, has_port, test_index);
8860 ok(received == expected,
8861 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8862 expected, received, test_index);
8867 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8868 hr, S_OK, test_index);
8869 ok(has_port == test->port_prop.set,
8870 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8871 test->port_prop.set, has_port, test_index);
8872 ok(received == test->port_prop.value,
8873 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8874 test->port_prop.value, received, test_index);
8879 hr = IUriBuilder_GetIUri(builder, &uri);
8881 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8882 hr, S_OK, test_index);
8885 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8887 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8888 hr, S_OK, test_index);
8890 ok(has_port == FALSE,
8891 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8892 has_port, test_index);
8893 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8894 received, test_index);
8899 hr = IUri_GetPort(uri, &expected);
8901 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8904 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8906 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8907 hr, S_OK, test_index);
8910 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8912 ok(received == expected,
8913 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8914 expected, received, test_index);
8918 if(uri) IUri_Release(uri);
8922 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8926 LPCWSTR received = NULL;
8928 const uri_builder_property *prop = NULL;
8930 /* Check if the property was set earlier. */
8931 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8932 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8933 prop = &(test->properties[i]);
8937 /* Use expected_value unless it's NULL, then use value. */
8938 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8939 hr = IUriBuilder_GetQuery(builder, &len, &received);
8942 ok(hr == (expected ? S_OK : S_FALSE),
8943 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8944 hr, (expected ? S_OK : S_FALSE), test_index);
8948 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8949 expected, wine_dbgstr_w(received), test_index);
8952 ok(lstrlen(expected) == len,
8953 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8954 lstrlen(expected), len, test_index);
8958 ok(hr == (expected ? S_OK : S_FALSE),
8959 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8960 hr, (expected ? S_OK : S_FALSE), test_index);
8961 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8962 expected, wine_dbgstr_w(received), test_index);
8963 ok(lstrlen(expected) == len,
8964 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8965 lstrlen(expected), len, test_index);
8968 /* The property wasn't set earlier, so it should return whatever
8969 * the base IUri contains (if anything).
8972 hr = IUriBuilder_GetIUri(builder, &uri);
8974 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8975 hr, S_OK, test_index);
8978 received = (void*) 0xdeadbeef;
8981 hr = IUriBuilder_GetQuery(builder, &len, &received);
8983 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8984 hr, S_FALSE, test_index);
8986 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8988 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8989 received, test_index);
8992 BOOL has_prop = FALSE;
8993 BSTR expected = NULL;
8995 hr = IUri_GetQuery(uri, &expected);
8997 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8999 has_prop = hr == S_OK;
9001 hr = IUriBuilder_GetQuery(builder, &len, &received);
9004 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9005 hr, S_OK, test_index);
9007 ok(!lstrcmpW(expected, received),
9008 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9009 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9010 ok(lstrlenW(expected) == len,
9011 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9012 lstrlenW(expected), len, test_index);
9016 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9017 hr, S_FALSE, test_index);
9019 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9020 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9024 SysFreeString(expected);
9027 if(uri) IUri_Release(uri);
9031 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9035 LPCWSTR received = NULL;
9037 const uri_builder_property *prop = NULL;
9039 /* Check if the property was set earlier. */
9040 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9041 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9042 prop = &(test->properties[i]);
9046 /* Use expected_value unless it's NULL, then use value. */
9047 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9048 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9051 ok(hr == (expected ? S_OK : S_FALSE),
9052 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9053 hr, (expected ? S_OK : S_FALSE), test_index);
9057 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9058 expected, wine_dbgstr_w(received), test_index);
9061 ok(lstrlen(expected) == len,
9062 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9063 lstrlen(expected), len, test_index);
9067 ok(hr == (expected ? S_OK : S_FALSE),
9068 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9069 hr, (expected ? S_OK : S_FALSE), test_index);
9070 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9071 expected, wine_dbgstr_w(received), test_index);
9072 ok(lstrlen(expected) == len,
9073 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9074 lstrlen(expected), len, test_index);
9077 /* The property wasn't set earlier, so it should return whatever
9078 * the base IUri contains (if anything).
9081 hr = IUriBuilder_GetIUri(builder, &uri);
9083 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9084 hr, S_OK, test_index);
9087 received = (void*) 0xdeadbeef;
9090 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9092 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9093 hr, S_FALSE, test_index);
9095 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9097 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9098 received, test_index);
9101 BOOL has_prop = FALSE;
9102 BSTR expected = NULL;
9104 hr = IUri_GetSchemeName(uri, &expected);
9106 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9108 has_prop = hr == S_OK;
9110 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9113 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9114 hr, S_OK, test_index);
9116 ok(!lstrcmpW(expected, received),
9117 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9118 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9119 ok(lstrlenW(expected) == len,
9120 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9121 lstrlenW(expected), len, test_index);
9125 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9126 hr, S_FALSE, test_index);
9128 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9129 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9133 SysFreeString(expected);
9136 if(uri) IUri_Release(uri);
9140 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9144 LPCWSTR received = NULL;
9146 const uri_builder_property *prop = NULL;
9148 /* Check if the property was set earlier. */
9149 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9150 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9151 prop = &(test->properties[i]);
9154 if(prop && prop->value && *prop->value) {
9155 /* Use expected_value unless it's NULL, then use value. */
9156 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9157 hr = IUriBuilder_GetUserName(builder, &len, &received);
9160 ok(hr == (expected ? S_OK : S_FALSE),
9161 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9162 hr, (expected ? S_OK : S_FALSE), test_index);
9166 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9167 expected, wine_dbgstr_w(received), test_index);
9170 ok(lstrlen(expected) == len,
9171 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9172 lstrlen(expected), len, test_index);
9176 ok(hr == (expected ? S_OK : S_FALSE),
9177 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9178 hr, (expected ? S_OK : S_FALSE), test_index);
9179 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9180 expected, wine_dbgstr_w(received), test_index);
9181 ok(lstrlen(expected) == len,
9182 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9183 lstrlen(expected), len, test_index);
9186 /* The property wasn't set earlier, so it should return whatever
9187 * the base IUri contains (if anything).
9190 hr = IUriBuilder_GetIUri(builder, &uri);
9192 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9193 hr, S_OK, test_index);
9196 received = (void*) 0xdeadbeef;
9199 hr = IUriBuilder_GetUserName(builder, &len, &received);
9201 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9202 hr, S_FALSE, test_index);
9204 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9206 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9207 received, test_index);
9210 BSTR expected = NULL;
9211 BOOL has_prop = FALSE;
9213 hr = IUri_GetUserName(uri, &expected);
9215 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9217 has_prop = hr == S_OK;
9219 hr = IUriBuilder_GetUserName(builder, &len, &received);
9222 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9223 hr, S_OK, test_index);
9225 ok(!lstrcmpW(expected, received),
9226 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9227 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9228 ok(lstrlenW(expected) == len,
9229 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9230 lstrlenW(expected), len, test_index);
9234 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9235 hr, S_FALSE, test_index);
9237 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9238 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9242 SysFreeString(expected);
9245 if(uri) IUri_Release(uri);
9249 /* Tests IUriBuilder functions. */
9250 static void test_IUriBuilder(void) {
9252 IUriBuilder *builder;
9255 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9257 uri_builder_test test = uri_builder_tests[i];
9261 uriW = a2w(test.uri);
9262 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9263 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9265 if(FAILED(hr)) continue;
9267 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9268 if(test.create_builder_todo) {
9270 ok(hr == test.create_builder_expected,
9271 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9272 hr, test.create_builder_expected, i);
9275 ok(hr == test.create_builder_expected,
9276 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9277 hr, test.create_builder_expected, i);
9281 BOOL modified = FALSE, received = FALSE;
9283 /* Perform all the string property changes. */
9284 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9285 uri_builder_property prop = test.properties[j];
9287 change_property(builder, &prop, i);
9288 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9289 prop.property != Uri_PROPERTY_HOST)
9291 else if(prop.value && *prop.value)
9293 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9294 /* Host name property can't be NULL, but it can be empty. */
9299 if(test.port_prop.change) {
9300 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9302 if(test.port_prop.todo) {
9304 ok(hr == test.port_prop.expected,
9305 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9306 hr, test.port_prop.expected, i);
9309 ok(hr == test.port_prop.expected,
9310 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9311 hr, test.port_prop.expected, i);
9315 hr = IUriBuilder_HasBeenModified(builder, &received);
9317 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9320 ok(received == modified,
9321 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9322 modified, received, i);
9324 /* Test the "Get*" functions. */
9325 test_IUriBuilder_GetFragment(builder, &test, i);
9326 test_IUriBuilder_GetHost(builder, &test, i);
9327 test_IUriBuilder_GetPassword(builder, &test, i);
9328 test_IUriBuilder_GetPath(builder, &test, i);
9329 test_IUriBuilder_GetPort(builder, &test, i);
9330 test_IUriBuilder_GetQuery(builder, &test, i);
9331 test_IUriBuilder_GetSchemeName(builder, &test, i);
9332 test_IUriBuilder_GetUserName(builder, &test, i);
9334 test_IUriBuilder_CreateUri(builder, &test, i);
9335 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9336 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9338 if(builder) IUriBuilder_Release(builder);
9339 if(uri) IUri_Release(uri);
9344 static void test_IUriBuilder_HasBeenModified(void) {
9346 IUriBuilder *builder = NULL;
9348 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9349 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9351 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9355 hr = IUriBuilder_HasBeenModified(builder, NULL);
9356 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9359 hr = IUriBuilder_SetHost(builder, hostW);
9360 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9363 hr = IUriBuilder_HasBeenModified(builder, &received);
9364 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9367 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9369 hr = pCreateUri(http_urlW, 0, 0, &uri);
9370 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9375 hr = IUriBuilder_SetIUri(builder, uri);
9376 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9379 hr = IUriBuilder_HasBeenModified(builder, &received);
9380 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9383 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9385 /* Test what happens with you call SetIUri with the same IUri again. */
9386 hr = IUriBuilder_SetHost(builder, hostW);
9387 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9389 hr = IUriBuilder_HasBeenModified(builder, &received);
9390 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9393 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9395 hr = IUriBuilder_SetIUri(builder, uri);
9396 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9398 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9399 * reset any of the changes that were made to the IUriBuilder.
9401 hr = IUriBuilder_HasBeenModified(builder, &received);
9402 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9404 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9406 hr = IUriBuilder_GetHost(builder, &len, &prop);
9407 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9409 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9410 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9411 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9412 lstrlenW(hostW), len);
9415 hr = IUriBuilder_SetIUri(builder, NULL);
9416 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9418 hr = IUriBuilder_SetHost(builder, hostW);
9419 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9420 hr = IUriBuilder_HasBeenModified(builder, &received);
9421 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9424 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9426 hr = IUriBuilder_SetIUri(builder, NULL);
9427 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9429 hr = IUriBuilder_HasBeenModified(builder, &received);
9430 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9433 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9435 hr = IUriBuilder_GetHost(builder, &len, &prop);
9436 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9438 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9439 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9440 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9441 lstrlenW(hostW), len);
9444 if(uri) IUri_Release(uri);
9446 if(builder) IUriBuilder_Release(builder);
9449 /* Test IUriBuilder {Get,Set}IUri functions. */
9450 static void test_IUriBuilder_IUriProperty(void) {
9451 IUriBuilder *builder = NULL;
9454 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9455 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9459 hr = IUriBuilder_GetIUri(builder, NULL);
9460 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9463 hr = pCreateUri(http_urlW, 0, 0, &uri);
9466 ULONG cur_count, orig_count;
9468 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9469 orig_count = get_refcnt(uri);
9470 hr = IUriBuilder_SetIUri(builder, uri);
9471 cur_count = get_refcnt(uri);
9473 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9474 orig_count+1, cur_count);
9476 hr = IUriBuilder_SetIUri(builder, NULL);
9477 cur_count = get_refcnt(uri);
9479 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9480 orig_count, cur_count);
9482 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9483 hr = IUriBuilder_SetIUri(builder, uri);
9484 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9485 orig_count = get_refcnt(uri);
9487 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9488 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9490 cur_count = get_refcnt(uri);
9491 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9492 orig_count+1, cur_count);
9493 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9496 if(test) IUri_Release(test);
9499 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9500 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9502 cur_count = get_refcnt(uri);
9503 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9504 orig_count+1, cur_count);
9505 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9507 if(test) IUri_Release(test);
9509 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9513 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9514 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9516 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9518 if(test) IUri_Release(test);
9520 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9521 * explicitly set (because it's a default flags).
9524 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9525 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9527 cur_count = get_refcnt(uri);
9528 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9529 orig_count+1, cur_count);
9530 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9532 if(test) IUri_Release(test);
9535 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9536 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9538 cur_count = get_refcnt(uri);
9539 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9540 orig_count+1, cur_count);
9541 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9543 if(test) IUri_Release(test);
9546 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9547 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9550 cur_count = get_refcnt(uri);
9551 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9552 orig_count+1, cur_count);
9553 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9555 if(test) IUri_Release(test);
9557 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9561 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9562 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9564 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9566 if(test) IUri_Release(test);
9568 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9569 * explicitly set (because it's a default flags).
9572 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9573 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9575 cur_count = get_refcnt(uri);
9576 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9577 orig_count+1, cur_count);
9578 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9580 if(test) IUri_Release(test);
9582 if(uri) IUri_Release(uri);
9584 if(builder) IUriBuilder_Release(builder);
9587 static void test_IUriBuilder_RemoveProperties(void) {
9588 IUriBuilder *builder = NULL;
9592 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9593 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9595 /* Properties that can't be removed. */
9596 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9597 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9599 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9600 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9601 if((i << 1) & invalid) {
9602 ok(hr == E_INVALIDARG,
9603 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9604 hr, E_INVALIDARG, i);
9607 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9612 /* Also doesn't accept anything that's outside the range of the
9615 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9616 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9619 if(builder) IUriBuilder_Release(builder);
9621 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9622 uri_builder_remove_test test = uri_builder_remove_tests[i];
9626 uriW = a2w(test.uri);
9627 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9631 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9632 if(test.create_builder_todo) {
9634 ok(hr == test.create_builder_expected,
9635 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9636 hr, test.create_builder_expected, i);
9639 ok(hr == test.create_builder_expected,
9640 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9641 hr, test.create_builder_expected, i);
9644 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9645 if(test.remove_todo) {
9647 ok(hr == test.remove_expected,
9648 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9649 hr, test.remove_expected, i);
9652 ok(hr == test.remove_expected,
9653 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9654 hr, test.remove_expected, i);
9657 IUri *result = NULL;
9659 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9660 if(test.expected_todo) {
9662 ok(hr == test.expected_hres,
9663 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9664 hr, test.expected_hres, i);
9667 ok(hr == test.expected_hres,
9668 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9669 hr, test.expected_hres, i);
9672 BSTR received = NULL;
9674 hr = IUri_GetAbsoluteUri(result, &received);
9675 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9676 ok(!strcmp_aw(test.expected_uri, received),
9677 "Error: Expected %s but got %s instead on test %d.\n",
9678 test.expected_uri, wine_dbgstr_w(received), i);
9679 SysFreeString(received);
9681 if(result) IUri_Release(result);
9684 if(builder) IUriBuilder_Release(builder);
9686 if(uri) IUri_Release(uri);
9691 static void test_IUriBuilder_Misc(void) {
9695 hr = pCreateUri(http_urlW, 0, 0, &uri);
9697 IUriBuilder *builder;
9699 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9700 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9705 hr = IUriBuilder_GetPort(builder, &has, &port);
9706 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9708 /* 'has' will be set to FALSE, even though uri had a port. */
9709 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9710 /* Still sets 'port' to 80. */
9711 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9714 if(builder) IUriBuilder_Release(builder);
9716 if(uri) IUri_Release(uri);
9719 static void test_IUriBuilderFactory(void) {
9722 IUriBuilderFactory *factory;
9723 IUriBuilder *builder;
9725 hr = pCreateUri(http_urlW, 0, 0, &uri);
9726 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9729 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9730 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9731 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9734 builder = (void*) 0xdeadbeef;
9735 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9736 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9738 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9740 builder = (void*) 0xdeadbeef;
9741 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9742 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9744 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9746 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9747 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9751 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9752 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9755 IUri *tmp = (void*) 0xdeadbeef;
9759 hr = IUriBuilder_GetIUri(builder, &tmp);
9760 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9762 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9764 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9765 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9768 if(builder) IUriBuilder_Release(builder);
9770 builder = (void*) 0xdeadbeef;
9771 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9772 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9774 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9776 builder = (void*) 0xdeadbeef;
9777 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9778 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9780 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9782 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9783 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9787 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9788 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9793 hr = IUriBuilder_GetIUri(builder, &tmp);
9794 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9796 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9797 if(uri) IUri_Release(uri);
9799 if(builder) IUriBuilder_Release(builder);
9801 if(factory) IUriBuilderFactory_Release(factory);
9803 if(uri) IUri_Release(uri);
9806 static void test_CoInternetCombineIUri(void) {
9808 IUri *base, *relative, *result;
9812 hr = pCreateUri(http_urlW, 0, 0, &base);
9813 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9815 result = (void*) 0xdeadbeef;
9816 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9817 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9818 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9822 hr = pCreateUri(http_urlW, 0, 0, &relative);
9823 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9825 result = (void*) 0xdeadbeef;
9826 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9827 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9828 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9831 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9832 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9834 if(base) IUri_Release(base);
9835 if(relative) IUri_Release(relative);
9837 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9838 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9840 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9841 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9843 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9845 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9846 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9850 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9851 if(uri_combine_tests[i].todo) {
9853 ok(hr == uri_combine_tests[i].expected,
9854 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9855 hr, uri_combine_tests[i].expected, i);
9858 ok(hr == uri_combine_tests[i].expected,
9859 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9860 hr, uri_combine_tests[i]. expected, i);
9865 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9866 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9869 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9872 ok(hr == prop.expected,
9873 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9874 hr, prop.expected, i, j);
9877 ok(!strcmp_aw(prop.value, received) ||
9878 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9879 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9880 prop.value, wine_dbgstr_w(received), i, j);
9883 ok(hr == prop.expected,
9884 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9885 hr, prop.expected, i, j);
9886 ok(!strcmp_aw(prop.value, received) ||
9887 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9888 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9889 prop.value, wine_dbgstr_w(received), i, j);
9891 SysFreeString(received);
9894 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9895 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9898 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9901 ok(hr == prop.expected,
9902 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9903 hr, prop.expected, i, j);
9906 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9907 prop.value, received, i, j);
9910 ok(hr == prop.expected,
9911 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9912 hr, prop.expected, i, j);
9913 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9914 prop.value, received, i, j);
9918 if(result) IUri_Release(result);
9920 if(relative) IUri_Release(relative);
9921 heap_free(relativeW);
9923 if(base) IUri_Release(base);
9928 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9929 REFIID riid, void **ppv)
9931 ok(0, "unexpected call\n");
9932 return E_NOINTERFACE;
9935 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9940 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9945 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9946 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9947 DWORD *pcchResult, DWORD dwReserved)
9949 CHECK_EXPECT(ParseUrl);
9950 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
9951 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
9952 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
9953 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
9954 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
9956 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
9957 *pcchResult = lstrlenW(parse_resultW);
9962 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9963 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9964 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9966 CHECK_EXPECT(CombineUrl);
9967 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9968 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9969 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9970 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9971 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9972 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9973 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9975 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9976 *pcchResult = lstrlenW(combine_resultW);
9981 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9982 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9984 ok(0, "unexpected call\n");
9988 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9989 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9990 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9992 ok(0, "unexpected call\n");
9996 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9997 InternetProtocolInfo_QueryInterface,
9998 InternetProtocolInfo_AddRef,
9999 InternetProtocolInfo_Release,
10000 InternetProtocolInfo_ParseUrl,
10001 InternetProtocolInfo_CombineUrl,
10002 InternetProtocolInfo_CompareUrl,
10003 InternetProtocolInfo_QueryInfo
10006 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10008 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10010 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10011 *ppv = &protocol_info;
10015 ok(0, "unexpected call\n");
10016 return E_NOINTERFACE;
10019 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10024 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10029 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10030 REFIID riid, void **ppv)
10032 ok(0, "unexpected call\n");
10036 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10038 ok(0, "unexpected call\n");
10042 static const IClassFactoryVtbl ClassFactoryVtbl = {
10043 ClassFactory_QueryInterface,
10044 ClassFactory_AddRef,
10045 ClassFactory_Release,
10046 ClassFactory_CreateInstance,
10047 ClassFactory_LockServer
10050 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10052 static void register_protocols(void)
10054 IInternetSession *session;
10057 hres = pCoInternetGetSession(0, &session, 0);
10058 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10062 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10063 winetestW, 0, NULL, 0);
10064 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10066 IInternetSession_Release(session);
10069 static void unregister_protocols(void) {
10070 IInternetSession *session;
10073 hr = pCoInternetGetSession(0, &session, 0);
10074 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10078 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10079 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10081 IInternetSession_Release(session);
10084 static void test_CoInternetCombineIUri_Pluggable(void) {
10088 hr = pCreateUri(combine_baseW, 0, 0, &base);
10089 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10090 if(SUCCEEDED(hr)) {
10091 IUri *relative = NULL;
10093 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10094 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10095 if(SUCCEEDED(hr)) {
10096 IUri *result = NULL;
10098 SET_EXPECT(CombineUrl);
10100 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10102 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10104 CHECK_CALLED(CombineUrl);
10106 if(SUCCEEDED(hr)) {
10107 BSTR received = NULL;
10108 hr = IUri_GetAbsoluteUri(result, &received);
10109 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10110 if(SUCCEEDED(hr)) {
10111 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10112 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10114 SysFreeString(received);
10116 if(result) IUri_Release(result);
10118 if(relative) IUri_Release(relative);
10120 if(base) IUri_Release(base);
10123 static void test_CoInternetCombineUrlEx(void) {
10125 IUri *base, *result;
10129 hr = pCreateUri(http_urlW, 0, 0, &base);
10130 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10131 if(SUCCEEDED(hr)) {
10132 result = (void*) 0xdeadbeef;
10133 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10134 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10136 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10139 result = (void*) 0xdeadbeef;
10140 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10141 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10143 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10145 result = (void*) 0xdeadbeef;
10146 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10147 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10149 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10151 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10152 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10154 if(base) IUri_Release(base);
10156 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10157 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10159 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10160 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10161 if(SUCCEEDED(hr)) {
10162 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10164 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10166 if(uri_combine_tests[i].todo) {
10168 ok(hr == uri_combine_tests[i].expected,
10169 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10170 hr, uri_combine_tests[i].expected, i);
10173 ok(hr == uri_combine_tests[i].expected,
10174 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10175 hr, uri_combine_tests[i]. expected, i);
10177 if(SUCCEEDED(hr)) {
10180 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10181 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10183 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10185 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10188 ok(hr == prop.expected,
10189 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10190 hr, prop.expected, i, j);
10193 ok(!strcmp_aw(value, received) ||
10194 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10195 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10196 value, wine_dbgstr_w(received), i, j);
10199 ok(hr == prop.expected,
10200 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10201 hr, prop.expected, i, j);
10202 ok(!strcmp_aw(value, received) ||
10203 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10204 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10205 value, wine_dbgstr_w(received), i, j);
10207 SysFreeString(received);
10210 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10211 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10214 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10217 ok(hr == prop.expected,
10218 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10219 hr, prop.expected, i, j);
10222 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10223 prop.value, received, i, j);
10226 ok(hr == prop.expected,
10227 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10228 hr, prop.expected, i, j);
10229 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10230 prop.value, received, i, j);
10234 if(result) IUri_Release(result);
10235 heap_free(relativeW);
10237 if(base) IUri_Release(base);
10242 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10246 hr = pCreateUri(combine_baseW, 0, 0, &base);
10247 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10248 if(SUCCEEDED(hr)) {
10249 IUri *result = NULL;
10251 SET_EXPECT(CombineUrl);
10253 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10255 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10257 CHECK_CALLED(CombineUrl);
10259 if(SUCCEEDED(hr)) {
10260 BSTR received = NULL;
10261 hr = IUri_GetAbsoluteUri(result, &received);
10262 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10263 if(SUCCEEDED(hr)) {
10264 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10265 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10267 SysFreeString(received);
10269 if(result) IUri_Release(result);
10271 if(base) IUri_Release(base);
10274 static void test_CoInternetParseIUri_InvalidArgs(void) {
10280 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10281 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10283 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10285 hr = pCreateUri(http_urlW, 0, 0, &uri);
10286 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10287 if(SUCCEEDED(hr)) {
10288 DWORD expected_len;
10291 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10292 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10294 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10296 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10297 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10301 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10302 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10304 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10307 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10308 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10310 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10313 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10314 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10316 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10319 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10320 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10322 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10324 expected_len = lstrlenW(http_urlW);
10326 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10327 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10328 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10329 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10330 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10331 expected_len, result);
10333 if(uri) IUri_Release(uri);
10336 static void test_CoInternetParseIUri(void) {
10339 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10343 uri_parse_test test = uri_parse_tests[i];
10345 uriW = a2w(test.uri);
10346 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10347 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10348 if(SUCCEEDED(hr)) {
10349 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10350 DWORD result_len = -1;
10352 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10355 ok(hr == test.expected,
10356 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10357 hr, test.expected, i);
10360 ok(hr == test.expected,
10361 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10362 hr, test.expected, i);
10364 if(SUCCEEDED(hr)) {
10365 DWORD len = lstrlenA(test.property);
10366 ok(!strcmp_aw(test.property, result),
10367 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10368 test.property, wine_dbgstr_w(result), i);
10369 ok(len == result_len,
10370 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10371 len, result_len, i);
10374 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10378 if(uri) IUri_Release(uri);
10383 static void test_CoInternetParseIUri_Pluggable(void) {
10387 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10388 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10389 if(SUCCEEDED(hr)) {
10393 SET_EXPECT(ParseUrl);
10395 parse_action = PARSE_CANONICALIZE;
10396 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10398 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10399 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10401 CHECK_CALLED(ParseUrl);
10403 if(SUCCEEDED(hr)) {
10404 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10405 lstrlenW(parse_resultW), result_len);
10406 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10407 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10410 if(uri) IUri_Release(uri);
10416 const char *base_url;
10417 DWORD base_uri_flags;
10418 const char *legacy_url;
10419 const char *uniform_url;
10420 const char *no_canon_url;
10421 const char *uri_url;
10422 } create_urlmon_test_t;
10424 static const create_urlmon_test_t create_urlmon_tests[] = {
10426 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10428 "http://www.winehq.org/",
10429 "http://www.winehq.org/",
10430 "http://www.winehq.org",
10431 "http://www.winehq.org"
10434 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10436 "file://c:\\dir\\file.txt",
10437 "file:///c:/dir/file.txt",
10438 "file:///c:/dir/file.txt",
10439 "file:///c:/dir/file.txt"
10442 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10444 "file://c:\\dir\\file.txt",
10445 "file:///c:/dir/file.txt",
10446 "file:///c:/dir/file.txt",
10447 "file://c:\\dir\\file.txt"
10450 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10451 "http://www.winehq.org",0,
10452 "http://www.winehq.org/data",
10453 "http://www.winehq.org/data",
10454 "http://www.winehq.org:80/data",
10457 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10458 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10459 "file://c:\\dir\\file.txt",
10460 "file:///c:/dir/file.txt",
10461 "file:///c:/dir/file.txt",
10464 "",Uri_CREATE_ALLOW_RELATIVE,
10472 "test",Uri_CREATE_ALLOW_RELATIVE,
10480 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10482 "file://c:\\dir\\file.txt",
10483 "file:///c:/dir/file.txt",
10484 "file:///c:/dir/file.txt",
10485 "file:///c:/dir/file.txt",
10489 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10490 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10492 WCHAR *display_name;
10495 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10496 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10497 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10498 wine_dbgstr_w(display_name), exurl);
10500 CoTaskMemFree(display_name);
10503 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10504 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10506 IUriContainer *uri_container;
10511 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10512 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10515 hres = IUriContainer_GetIUri(uri_container, &uri);
10516 IUriContainer_Release(uri_container);
10517 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10518 ok(uri != NULL, "uri == NULL\n");
10520 hres = IUri_GetDisplayUri(uri, &display_uri);
10522 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10523 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10524 wine_dbgstr_w(display_uri), exurl);
10525 SysFreeString(display_uri);
10528 static void test_CreateURLMoniker(void)
10530 const create_urlmon_test_t *test;
10531 IMoniker *mon, *base_mon;
10532 WCHAR *url, *base_url;
10533 IUri *uri, *base_uri;
10536 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10537 url = a2w(test->url);
10538 base_url = a2w(test->base_url);
10541 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10542 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10544 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10545 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10551 hres = CreateURLMoniker(base_mon, url, &mon);
10552 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10553 test_urlmon_display_name(mon, test->legacy_url);
10554 test_display_uri(mon, test->legacy_url);
10555 IMoniker_Release(mon);
10557 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10558 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10559 test_urlmon_display_name(mon, test->legacy_url);
10560 test_display_uri(mon, test->legacy_url);
10561 IMoniker_Release(mon);
10563 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10564 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10565 test_urlmon_display_name(mon, test->uniform_url);
10566 test_display_uri(mon, test->uniform_url);
10567 IMoniker_Release(mon);
10569 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10570 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10571 test_urlmon_display_name(mon, test->no_canon_url);
10572 test_display_uri(mon, test->no_canon_url);
10573 IMoniker_Release(mon);
10575 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10576 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10578 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10579 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10580 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10581 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10582 IMoniker_Release(mon);
10584 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10585 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10586 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10587 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10588 IMoniker_Release(mon);
10590 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10591 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10592 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10593 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10594 IMoniker_Release(mon);
10598 heap_free(base_url);
10600 IUri_Release(base_uri);
10602 IMoniker_Release(base_mon);
10609 hurlmon = GetModuleHandle("urlmon.dll");
10610 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
10611 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
10612 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
10613 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
10614 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
10615 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
10616 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
10617 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
10618 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
10621 win_skip("CreateUri is not present, skipping tests.\n");
10625 trace("test CreateUri invalid flags...\n");
10626 test_CreateUri_InvalidFlags();
10628 trace("test CreateUri invalid args...\n");
10629 test_CreateUri_InvalidArgs();
10631 trace("test CreateUri invalid URIs...\n");
10632 test_CreateUri_InvalidUri();
10634 trace("test IUri_GetPropertyBSTR...\n");
10635 test_IUri_GetPropertyBSTR();
10637 trace("test IUri_GetPropertyDWORD...\n");
10638 test_IUri_GetPropertyDWORD();
10640 trace("test IUri_GetStrProperties...\n");
10641 test_IUri_GetStrProperties();
10643 trace("test IUri_GetDwordProperties...\n");
10644 test_IUri_GetDwordProperties();
10646 trace("test IUri_GetPropertyLength...\n");
10647 test_IUri_GetPropertyLength();
10649 trace("test IUri_GetProperties...\n");
10650 test_IUri_GetProperties();
10652 trace("test IUri_HasProperty...\n");
10653 test_IUri_HasProperty();
10655 trace("test IUri_IsEqual...\n");
10656 test_IUri_IsEqual();
10658 trace("test CreateUriWithFragment invalid args...\n");
10659 test_CreateUriWithFragment_InvalidArgs();
10661 trace("test CreateUriWithFragment invalid flags...\n");
10662 test_CreateUriWithFragment_InvalidFlags();
10664 trace("test CreateUriWithFragment...\n");
10665 test_CreateUriWithFragment();
10667 trace("test CreateIUriBuilder...\n");
10668 test_CreateIUriBuilder();
10670 trace("test IUriBuilder_CreateInvalidArgs...\n");
10671 test_IUriBuilder_CreateInvalidArgs();
10673 trace("test IUriBuilder...\n");
10674 test_IUriBuilder();
10676 trace("test IUriBuilder_GetInvalidArgs...\n");
10677 test_IUriBuilder_GetInvalidArgs();
10679 trace("test IUriBuilder_HasBeenModified...\n");
10680 test_IUriBuilder_HasBeenModified();
10682 trace("test IUriBuilder_IUriProperty...\n");
10683 test_IUriBuilder_IUriProperty();
10685 trace("test IUriBuilder_RemoveProperties...\n");
10686 test_IUriBuilder_RemoveProperties();
10688 trace("test IUriBuilder miscellaneous...\n");
10689 test_IUriBuilder_Misc();
10691 trace("test IUriBuilderFactory...\n");
10692 test_IUriBuilderFactory();
10694 trace("test CoInternetCombineIUri...\n");
10695 test_CoInternetCombineIUri();
10697 trace("test CoInternetCombineUrlEx...\n");
10698 test_CoInternetCombineUrlEx();
10700 trace("test CoInternetParseIUri Invalid Args...\n");
10701 test_CoInternetParseIUri_InvalidArgs();
10703 trace("test CoInternetParseIUri...\n");
10704 test_CoInternetParseIUri();
10706 register_protocols();
10708 trace("test CoInternetCombineIUri pluggable...\n");
10709 test_CoInternetCombineIUri_Pluggable();
10711 trace("test CoInternetCombineUrlEx Pluggable...\n");
10712 test_CoInternetCombineUrlEx_Pluggable();
10714 trace("test CoInternetParseIUri pluggable...\n");
10715 test_CoInternetParseIUri_Pluggable();
10717 trace("test CreateURLMoniker...\n");
10718 test_CreateURLMoniker();
10720 unregister_protocols();