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>
35 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
36 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
37 #define URI_BUILDER_STR_PROPERTY_COUNT 7
39 #define DEFINE_EXPECT(func) \
40 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
42 #define SET_EXPECT(func) \
43 expect_ ## func = TRUE
45 #define CHECK_EXPECT(func) \
47 ok(expect_ ##func, "unexpected call " #func "\n"); \
48 expect_ ## func = FALSE; \
49 called_ ## func = TRUE; \
52 #define CHECK_EXPECT2(func) \
54 ok(expect_ ##func, "unexpected call " #func "\n"); \
55 called_ ## func = TRUE; \
58 #define CHECK_CALLED(func) \
60 ok(called_ ## func, "expected " #func "\n"); \
61 expect_ ## func = called_ ## func = FALSE; \
64 DEFINE_EXPECT(CombineUrl);
65 DEFINE_EXPECT(ParseUrl);
67 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
68 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
69 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
70 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
71 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
72 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
73 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
74 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
75 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
77 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
78 '.','o','r','g','/',0};
79 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
80 '.','o','r','g','/','#','F','r','a','g',0};
82 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
83 'e','s','t','i','n','g',0};
84 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
85 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
87 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
89 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
90 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
92 static PARSEACTION parse_action;
93 static DWORD parse_flags;
95 typedef struct _uri_create_flag_test {
98 } uri_create_flag_test;
100 static const uri_create_flag_test invalid_flag_tests[] = {
101 /* Set of invalid flag combinations to test for. */
102 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
103 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
104 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
105 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
106 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
109 typedef struct _uri_str_property {
113 const char* broken_value;
116 typedef struct _uri_dword_property {
120 } uri_dword_property;
122 typedef struct _uri_properties {
125 HRESULT create_expected;
128 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
129 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
132 static const uri_properties uri_tests[] = {
133 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
135 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
136 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
137 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
138 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
139 {"",S_FALSE,FALSE}, /* EXTENSION */
140 {"",S_FALSE,FALSE}, /* FRAGMENT */
141 {"www.winehq.org",S_OK,FALSE}, /* HOST */
142 {"",S_FALSE,FALSE}, /* PASSWORD */
143 {"/",S_OK,FALSE}, /* PATH */
144 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
145 {"",S_FALSE,FALSE}, /* QUERY */
146 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
147 {"http",S_OK,FALSE}, /* SCHEME_NAME */
148 {"",S_FALSE,FALSE}, /* USER_INFO */
149 {"",S_FALSE,FALSE} /* USER_NAME */
152 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
153 {80,S_OK,FALSE}, /* PORT */
154 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
155 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
158 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
160 {"http://winehq.org/tests",S_OK,FALSE},
161 {"winehq.org",S_OK,FALSE},
162 {"http://winehq.org/tests",S_OK,FALSE},
163 {"winehq.org",S_OK,FALSE},
166 {"winehq.org",S_OK,FALSE},
168 {"/tests",S_OK,FALSE},
169 {"/tests",S_OK,FALSE},
171 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
177 {Uri_HOST_DNS,S_OK,FALSE},
179 {URL_SCHEME_HTTP,S_OK,FALSE},
180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
183 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
185 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
186 {"www.winehq.org",S_OK,FALSE},
187 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
188 {"winehq.org",S_OK,FALSE},
191 {"www.winehq.org",S_OK,FALSE},
194 {"/?query=x&return=y",S_OK,FALSE},
195 {"?query=x&return=y",S_OK,FALSE},
196 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
202 {Uri_HOST_DNS,S_OK,FALSE},
204 {URL_SCHEME_HTTP,S_OK,FALSE},
205 {URLZONE_INVALID,E_NOTIMPL,FALSE},
208 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
210 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
211 {"usEr%3Ainfo@example.com",S_OK,FALSE},
212 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
213 {"example.com",S_OK,FALSE},
216 {"example.com",S_OK,FALSE},
218 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
219 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
221 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
223 {"usEr%3Ainfo",S_OK,FALSE},
224 {"usEr%3Ainfo",S_OK,FALSE}
227 {Uri_HOST_DNS,S_OK,FALSE},
229 {URL_SCHEME_HTTP,S_OK,FALSE},
230 {URLZONE_INVALID,E_NOTIMPL,FALSE},
233 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
235 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
236 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
237 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
238 {"winehq.org",S_OK,FALSE},
241 {"ftp.winehq.org",S_OK,FALSE},
243 {"/dir/foo%20bar.txt",S_OK,FALSE},
244 {"/dir/foo%20bar.txt",S_OK,FALSE},
246 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
248 {"winepass:wine",S_OK,FALSE},
249 {"winepass",S_OK,FALSE}
252 {Uri_HOST_DNS,S_OK,FALSE},
254 {URL_SCHEME_FTP,S_OK,FALSE},
255 {URLZONE_INVALID,E_NOTIMPL,FALSE}
258 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
260 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
262 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
268 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
269 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
271 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
277 {Uri_HOST_UNKNOWN,S_OK,FALSE},
279 {URL_SCHEME_FILE,S_OK,FALSE},
280 {URLZONE_INVALID,E_NOTIMPL,FALSE}
283 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
285 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
287 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
293 {"/tests/test%20file.README.txt",S_OK,FALSE},
294 {"/tests/test%20file.README.txt",S_OK,FALSE},
296 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
302 {Uri_HOST_UNKNOWN,S_OK,FALSE},
304 {URL_SCHEME_FILE,S_OK,FALSE},
305 {URLZONE_INVALID,E_NOTIMPL,FALSE}
308 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
310 {"urn:nothing:should:happen here",S_OK,FALSE},
312 {"urn:nothing:should:happen here",S_OK,FALSE},
318 {"nothing:should:happen here",S_OK,FALSE},
319 {"nothing:should:happen here",S_OK,FALSE},
321 {"urn:nothing:should:happen here",S_OK,FALSE},
327 {Uri_HOST_UNKNOWN,S_OK,FALSE},
329 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
330 {URLZONE_INVALID,E_NOTIMPL,FALSE}
333 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
335 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
336 {"127.0.0.1",S_OK,FALSE},
337 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
341 {"127.0.0.1",S_OK,FALSE},
343 {"/test%20dir/test.txt",S_OK,FALSE},
344 {"/test%20dir/test.txt",S_OK,FALSE},
346 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
352 {Uri_HOST_IPV4,S_OK,FALSE},
354 {URL_SCHEME_HTTP,S_OK,FALSE},
355 {URLZONE_INVALID,E_NOTIMPL,FALSE}
358 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
360 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
361 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
362 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
366 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
371 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
377 {Uri_HOST_IPV6,S_OK,FALSE},
379 {URL_SCHEME_HTTP,S_OK,FALSE},
380 {URLZONE_INVALID,E_NOTIMPL,FALSE}
383 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
385 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
386 {"[::13.1.68.3]",S_OK,FALSE},
387 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
391 {"::13.1.68.3",S_OK,FALSE},
396 {"ftp://[::13.1.68.3]",S_OK,FALSE},
402 {Uri_HOST_IPV6,S_OK,FALSE},
404 {URL_SCHEME_FTP,S_OK,FALSE},
405 {URLZONE_INVALID,E_NOTIMPL,FALSE}
408 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
410 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
411 {"[fedc:ba98::3210]",S_OK,FALSE},
412 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
416 {"fedc:ba98::3210",S_OK,FALSE},
421 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
427 {Uri_HOST_IPV6,S_OK,FALSE},
429 {URL_SCHEME_HTTP,S_OK,FALSE},
430 {URLZONE_INVALID,E_NOTIMPL,FALSE}
433 { "1234://www.winehq.org", 0, S_OK, FALSE,
435 {"1234://www.winehq.org/",S_OK,FALSE},
436 {"www.winehq.org",S_OK,FALSE},
437 {"1234://www.winehq.org/",S_OK,FALSE},
438 {"winehq.org",S_OK,FALSE},
441 {"www.winehq.org",S_OK,FALSE},
446 {"1234://www.winehq.org",S_OK,FALSE},
452 {Uri_HOST_DNS,S_OK,FALSE},
454 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
455 {URLZONE_INVALID,E_NOTIMPL,FALSE}
458 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
459 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
461 {"file:///C:/test/test.mp3",S_OK,FALSE},
463 {"file:///C:/test/test.mp3",S_OK,FALSE},
469 {"/C:/test/test.mp3",S_OK,FALSE},
470 {"/C:/test/test.mp3",S_OK,FALSE},
472 {"C:/test/test.mp3",S_OK,FALSE},
478 {Uri_HOST_UNKNOWN,S_OK,FALSE},
480 {URL_SCHEME_FILE,S_OK,FALSE},
481 {URLZONE_INVALID,E_NOTIMPL,FALSE}
484 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
485 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
487 {"file://server/test.mp3",S_OK,FALSE},
488 {"server",S_OK,FALSE},
489 {"file://server/test.mp3",S_OK,FALSE},
493 {"server",S_OK,FALSE},
495 {"/test.mp3",S_OK,FALSE},
496 {"/test.mp3",S_OK,FALSE},
498 {"\\\\Server/test.mp3",S_OK,FALSE},
504 {Uri_HOST_DNS,S_OK,FALSE},
506 {URL_SCHEME_FILE,S_OK,FALSE},
507 {URLZONE_INVALID,E_NOTIMPL,FALSE}
510 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
512 {"*:www.winehq.org/test",S_OK,FALSE},
513 {"www.winehq.org",S_OK,FALSE},
514 {"*:www.winehq.org/test",S_OK,FALSE},
515 {"winehq.org",S_OK,FALSE},
518 {"www.winehq.org",S_OK,FALSE},
520 {"/test",S_OK,FALSE},
521 {"/test",S_OK,FALSE},
523 {"www.winehq.org/test",S_OK,FALSE},
529 {Uri_HOST_DNS,S_OK,FALSE},
531 {URL_SCHEME_WILDCARD,S_OK,FALSE},
532 {URLZONE_INVALID,E_NOTIMPL,FALSE}
535 /* Valid since the '*' is the only character in the scheme name. */
536 { "*:www.winehq.org/test", 0, 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 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
563 {"/../some dir/test.ext",S_OK,FALSE},
565 {"/../some dir/test.ext",S_OK,FALSE},
571 {"/../some dir/test.ext",S_OK,FALSE},
572 {"/../some dir/test.ext",S_OK,FALSE},
574 {"/../some dir/test.ext",S_OK,FALSE},
580 {Uri_HOST_UNKNOWN,S_OK,FALSE},
582 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
583 {URLZONE_INVALID,E_NOTIMPL,FALSE}
586 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
588 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
590 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
596 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
597 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
599 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
605 {Uri_HOST_UNKNOWN,S_OK,FALSE},
607 {URL_SCHEME_WILDCARD,S_OK,FALSE},
608 {URLZONE_INVALID,E_NOTIMPL,FALSE}
611 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
612 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
614 {"zip:/.//google.com",S_OK,FALSE},
616 {"zip:/.//google.com",S_OK,FALSE},
622 {"/.//google.com",S_OK,FALSE},
623 {"/.//google.com",S_OK,FALSE},
625 {"zip://google.com",S_OK,FALSE},
631 {Uri_HOST_UNKNOWN,S_OK,FALSE},
633 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
634 {URLZONE_INVALID,E_NOTIMPL,FALSE}
637 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
638 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
640 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
641 {"user:pass:word@winehq.org",S_OK,FALSE},
642 {"ftp://winehq.org/",S_OK,FALSE},
643 {"winehq.org",S_OK,FALSE},
646 {"winehq.org",S_OK,FALSE},
647 {"pass:word",S_OK,FALSE},
651 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
653 {"user:pass:word",S_OK,FALSE},
657 {Uri_HOST_DNS,S_OK,FALSE},
659 {URL_SCHEME_FTP,S_OK,FALSE},
660 {URLZONE_INVALID,E_NOTIMPL,FALSE}
663 /* Make sure % encoded unreserved characters are decoded. */
664 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
666 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
667 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
668 {"ftp://ftp.google.com/",S_OK,FALSE},
669 {"google.com",S_OK,FALSE},
672 {"ftp.google.com",S_OK,FALSE},
677 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
679 {"wINe:PASS",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 characters which are NOT unreserved are NOT decoded. */
690 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
692 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
693 {"w%5D%5Be:PA%7B%7D@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},
699 {"PA%7B%7D",S_OK,FALSE},
703 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
705 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
706 {"w%5D%5Be",S_OK,FALSE}
709 {Uri_HOST_DNS,S_OK,FALSE},
711 {URL_SCHEME_FTP,S_OK,FALSE},
712 {URLZONE_INVALID,E_NOTIMPL,FALSE}
715 /* You're allowed to have an empty password portion in the userinfo section. */
716 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
718 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
719 {"empty:@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},
729 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
731 {"empty:",S_OK,FALSE},
735 {Uri_HOST_DNS,S_OK,FALSE},
737 {URL_SCHEME_FTP,S_OK,FALSE},
738 {URLZONE_INVALID,E_NOTIMPL,FALSE}
741 /* Make sure forbidden characters in "userinfo" get encoded. */
742 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
744 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
745 {"%22%20%22weird@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://\" \"weird@ftp.google.com/",S_OK,FALSE},
757 {"%22%20%22weird",S_OK,FALSE},
758 {"%22%20%22weird",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 the forbidden characters don't get percent encoded. */
768 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
770 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
771 {"\" \"weird@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 {"\" \"weird",S_OK,FALSE},
784 {"\" \"weird",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 already percent encoded characters don't get unencoded. */
794 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
796 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
797 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
798 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
799 {"google.com",S_OK,FALSE},
802 {"ftp.google.com",S_OK,FALSE},
804 {"/\"%20\"weird",S_OK,FALSE},
805 {"/\"%20\"weird",S_OK,FALSE},
807 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
809 {"\"%20\"weird",S_OK,FALSE},
810 {"\"%20\"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 /* Allowed to have invalid % encoded because its an unknown scheme type. */
820 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
822 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
823 {"%xy:word@winehq.org",S_OK,FALSE},
824 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
825 {"winehq.org",S_OK,FALSE},
828 {"winehq.org",S_OK,FALSE},
833 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
835 {"%xy:word",S_OK,FALSE},
839 {Uri_HOST_DNS,S_OK,FALSE},
841 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
842 {URLZONE_INVALID,E_NOTIMPL,FALSE}
845 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
848 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
850 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
851 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
852 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
853 {"winehq.org",S_OK,FALSE},
856 {"winehq.org",S_OK,FALSE},
857 {"%52%53ord",S_OK,FALSE},
861 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
863 {"%2E:%52%53ord",S_OK,FALSE},
867 {Uri_HOST_DNS,S_OK,FALSE},
869 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
870 {URLZONE_INVALID,E_NOTIMPL,FALSE}
873 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
875 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
876 {"[](),'test':word@winehq.org",S_OK,FALSE},
877 {"ftp://winehq.org/",S_OK,FALSE},
878 {"winehq.org",S_OK,FALSE},
881 {"winehq.org",S_OK,FALSE},
886 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
888 {"[](),'test':word",S_OK,FALSE},
889 {"[](),'test'",S_OK,FALSE}
892 {Uri_HOST_DNS,S_OK,FALSE},
894 {URL_SCHEME_FTP,S_OK,FALSE},
895 {URLZONE_INVALID,E_NOTIMPL,FALSE}
898 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
900 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
902 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
909 {"/?:word@winehq.org/",S_OK,FALSE},
910 {"?:word@winehq.org/",S_OK,FALSE},
911 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
917 {Uri_HOST_DNS,S_OK,FALSE},
919 {URL_SCHEME_FTP,S_OK,FALSE},
920 {URLZONE_INVALID,E_NOTIMPL,FALSE}
923 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
925 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
927 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
930 {"#:word@winehq.org/",S_OK,FALSE},
936 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
942 {Uri_HOST_DNS,S_OK,FALSE},
944 {URL_SCHEME_FTP,S_OK,FALSE},
945 {URLZONE_INVALID,E_NOTIMPL,FALSE}
948 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
949 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
951 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
952 {"test\\:word@winehq.org",S_OK,FALSE},
953 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
954 {"winehq.org",S_OK,FALSE},
957 {"winehq.org",S_OK,FALSE},
962 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
964 {"test\\:word",S_OK,FALSE},
965 {"test\\",S_OK,FALSE}
968 {Uri_HOST_DNS,S_OK,FALSE},
970 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
971 {URLZONE_INVALID,E_NOTIMPL,FALSE}
974 /* It normalizes IPv4 addresses correctly. */
975 { "http://127.000.000.100/", 0, S_OK, FALSE,
977 {"http://127.0.0.100/",S_OK,FALSE},
978 {"127.0.0.100",S_OK,FALSE},
979 {"http://127.0.0.100/",S_OK,FALSE},
983 {"127.0.0.100",S_OK,FALSE},
988 {"http://127.000.000.100/",S_OK,FALSE},
994 {Uri_HOST_IPV4,S_OK,FALSE},
996 {URL_SCHEME_HTTP,S_OK,FALSE},
997 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1000 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1002 {"http://127.0.0.1:8000/",S_OK},
1003 {"127.0.0.1:8000",S_OK},
1004 {"http://127.0.0.1:8000/",S_OK},
1013 {"http://127.0.0.1:8000",S_OK},
1019 {Uri_HOST_IPV4,S_OK,FALSE},
1021 {URL_SCHEME_HTTP,S_OK,FALSE},
1022 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1025 /* Make sure it normalizes partial IPv4 addresses correctly. */
1026 { "http://127.0/", 0, S_OK, FALSE,
1028 {"http://127.0.0.0/",S_OK,FALSE},
1029 {"127.0.0.0",S_OK,FALSE},
1030 {"http://127.0.0.0/",S_OK,FALSE},
1034 {"127.0.0.0",S_OK,FALSE},
1039 {"http://127.0/",S_OK,FALSE},
1040 {"http",S_OK,FALSE},
1045 {Uri_HOST_IPV4,S_OK,FALSE},
1047 {URL_SCHEME_HTTP,S_OK,FALSE},
1048 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1051 /* Make sure it converts implicit IPv4's correctly. */
1052 { "http://123456/", 0, S_OK, FALSE,
1054 {"http://0.1.226.64/",S_OK,FALSE},
1055 {"0.1.226.64",S_OK,FALSE},
1056 {"http://0.1.226.64/",S_OK,FALSE},
1060 {"0.1.226.64",S_OK,FALSE},
1065 {"http://123456/",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}
1078 { "http://4294967295/", 0, S_OK, FALSE,
1080 {"http://255.255.255.255/",S_OK,FALSE},
1081 {"255.255.255.255",S_OK,FALSE},
1082 {"http://255.255.255.255/",S_OK,FALSE},
1086 {"255.255.255.255",S_OK,FALSE},
1091 {"http://4294967295/",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://4294967296/", 0, S_OK, FALSE,
1106 {"http://4294967296/",S_OK,FALSE},
1107 {"4294967296",S_OK,FALSE},
1108 {"http://4294967296/",S_OK,FALSE},
1112 {"4294967296",S_OK,FALSE},
1117 {"http://4294967296/",S_OK,FALSE},
1118 {"http",S_OK,FALSE},
1123 {Uri_HOST_DNS,S_OK,FALSE},
1125 {URL_SCHEME_HTTP,S_OK,FALSE},
1126 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1129 /* Window's doesn't normalize IP address for unknown schemes. */
1130 { "1234://4294967295/", 0, S_OK, FALSE,
1132 {"1234://4294967295/",S_OK,FALSE},
1133 {"4294967295",S_OK,FALSE},
1134 {"1234://4294967295/",S_OK,FALSE},
1138 {"4294967295",S_OK,FALSE},
1143 {"1234://4294967295/",S_OK,FALSE},
1144 {"1234",S_OK,FALSE},
1149 {Uri_HOST_IPV4,S_OK,FALSE},
1151 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1152 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1155 /* Window's doesn't normalize IP address for unknown schemes. */
1156 { "1234://127.001/", 0, S_OK, FALSE,
1158 {"1234://127.001/",S_OK,FALSE},
1159 {"127.001",S_OK,FALSE},
1160 {"1234://127.001/",S_OK,FALSE},
1164 {"127.001",S_OK,FALSE},
1169 {"1234://127.001/",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 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1183 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1184 {"[fedc:ba98::3210]",S_OK,FALSE},
1185 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1189 {"fedc:ba98::3210",S_OK,FALSE},
1194 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1195 {"http",S_OK,FALSE},
1200 {Uri_HOST_IPV6,S_OK,FALSE},
1202 {URL_SCHEME_HTTP,S_OK,FALSE},
1203 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1206 { "http://[::]", 0, S_OK, FALSE,
1208 {"http://[::]/",S_OK,FALSE},
1209 {"[::]",S_OK,FALSE},
1210 {"http://[::]/",S_OK,FALSE},
1219 {"http://[::]",S_OK,FALSE},
1220 {"http",S_OK,FALSE},
1225 {Uri_HOST_IPV6,S_OK,FALSE},
1227 {URL_SCHEME_HTTP,S_OK,FALSE},
1228 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1231 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1233 {"http://[fedc:ba98::]/",S_OK,FALSE},
1234 {"[fedc:ba98::]",S_OK,FALSE},
1235 {"http://[fedc:ba98::]/",S_OK,FALSE},
1239 {"fedc:ba98::",S_OK,FALSE},
1244 {"http://[FEDC:BA98::]",S_OK,FALSE},
1245 {"http",S_OK,FALSE},
1250 {Uri_HOST_IPV6,S_OK,FALSE},
1252 {URL_SCHEME_HTTP,S_OK,FALSE},
1253 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1256 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1257 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1259 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1260 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1261 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1265 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1270 {"http://[1::3:4:5:6:7:8]",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 { "http://[v2.34]/", 0, S_OK, FALSE,
1284 {"http://[v2.34]/",S_OK,FALSE},
1285 {"[v2.34]",S_OK,FALSE},
1286 {"http://[v2.34]/",S_OK,FALSE},
1290 {"[v2.34]",S_OK,FALSE},
1295 {"http://[v2.34]/",S_OK,FALSE},
1296 {"http",S_OK,FALSE},
1301 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1303 {URL_SCHEME_HTTP,S_OK,FALSE},
1304 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1307 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1308 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1310 {"http://[xyz:12345.com/test",S_OK,FALSE},
1311 {"[xyz:12345.com",S_OK,FALSE},
1312 {"http://[xyz:12345.com/test",S_OK,FALSE},
1313 {"[xyz:12345.com",S_OK,FALSE},
1316 {"[xyz:12345.com",S_OK,FALSE},
1318 {"/test",S_OK,FALSE},
1319 {"/test",S_OK,FALSE},
1321 {"http://[xyz:12345.com/test",S_OK,FALSE},
1322 {"http",S_OK,FALSE},
1327 {Uri_HOST_DNS,S_OK,FALSE},
1329 {URL_SCHEME_HTTP,S_OK,FALSE},
1330 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1333 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1334 * of the host name (respectively).
1336 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1338 {"ftp://www.[works].com/",S_OK,FALSE},
1339 {"www.[works].com",S_OK,FALSE},
1340 {"ftp://www.[works].com/",S_OK,FALSE},
1341 {"[works].com",S_OK,FALSE},
1344 {"www.[works].com",S_OK,FALSE},
1349 {"ftp://www.[works].com/",S_OK,FALSE},
1355 {Uri_HOST_DNS,S_OK,FALSE},
1357 {URL_SCHEME_FTP,S_OK,FALSE},
1358 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1361 /* Considers ':' a delimiter since it appears after the ']'. */
1362 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1364 {"http://www.google.com]:12345/",S_OK,FALSE},
1365 {"www.google.com]:12345",S_OK,FALSE},
1366 {"http://www.google.com]:12345/",S_OK,FALSE},
1367 {"google.com]",S_OK,FALSE},
1370 {"www.google.com]",S_OK,FALSE},
1375 {"http://www.google.com]:12345/",S_OK,FALSE},
1376 {"http",S_OK,FALSE},
1381 {Uri_HOST_DNS,S_OK,FALSE},
1383 {URL_SCHEME_HTTP,S_OK,FALSE},
1384 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1387 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1388 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1390 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1391 {"w%XXw%GEw.google.com",S_OK,FALSE},
1392 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1393 {"google.com",S_OK,FALSE},
1396 {"w%XXw%GEw.google.com",S_OK,FALSE},
1401 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1407 {Uri_HOST_DNS,S_OK,FALSE},
1409 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1413 /* Unknown scheme types hostname doesn't get lower cased. */
1414 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1416 {"zip://GOOGLE.com/",S_OK,FALSE},
1417 {"GOOGLE.com",S_OK,FALSE},
1418 {"zip://GOOGLE.com/",S_OK,FALSE},
1419 {"GOOGLE.com",S_OK,FALSE},
1422 {"GOOGLE.com",S_OK,FALSE},
1427 {"zip://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 /* Hostname gets lower-cased for known scheme types. */
1440 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1442 {"http://www.google.com/",S_OK,FALSE},
1443 {"www.google.com",S_OK,FALSE},
1444 {"http://www.google.com/",S_OK,FALSE},
1445 {"google.com",S_OK,FALSE},
1448 {"www.google.com",S_OK,FALSE},
1453 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1454 {"http",S_OK,FALSE},
1459 {Uri_HOST_DNS,S_OK,FALSE},
1461 {URL_SCHEME_HTTP,S_OK,FALSE},
1462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1465 /* Characters that get % encoded in the hostname also have their percent
1466 * encoded forms lower cased.
1468 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1470 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1471 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1472 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1473 {"%7cgoogle%7c.com",S_OK,FALSE},
1476 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1481 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1482 {"http",S_OK,FALSE},
1487 {Uri_HOST_DNS,S_OK,FALSE},
1489 {URL_SCHEME_HTTP,S_OK,FALSE},
1490 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1493 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1494 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1496 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1497 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1498 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1502 {"1:2:3:4:5:6::",S_OK,FALSE},
1507 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1508 {"http",S_OK,FALSE},
1513 {Uri_HOST_IPV6,S_OK,FALSE},
1515 {URL_SCHEME_HTTP,S_OK,FALSE},
1516 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1519 /* IPv4 addresses get normalized. */
1520 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1522 {"http://[::1.2.3.0]/",S_OK,FALSE},
1523 {"[::1.2.3.0]",S_OK,FALSE},
1524 {"http://[::1.2.3.0]/",S_OK,FALSE},
1528 {"::1.2.3.0",S_OK,FALSE},
1533 {"http://[::001.002.003.000]",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 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1546 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1548 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1549 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1550 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1554 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1559 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1565 {Uri_HOST_IPV6,S_OK,FALSE},
1567 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1568 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1571 /* IPv4 address is converted into 2 h16 components. */
1572 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1574 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1575 {"[ffff::c0de:6f20]",S_OK,FALSE},
1576 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1580 {"ffff::c0de:6f20",S_OK,FALSE},
1585 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1586 {"http",S_OK,FALSE},
1591 {Uri_HOST_IPV6,S_OK,FALSE},
1593 {URL_SCHEME_HTTP,S_OK,FALSE},
1594 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1597 /* Max value for a port. */
1598 { "http://google.com:65535", 0, S_OK, FALSE,
1600 {"http://google.com:65535/",S_OK,FALSE},
1601 {"google.com:65535",S_OK,FALSE},
1602 {"http://google.com:65535/",S_OK,FALSE},
1603 {"google.com",S_OK,FALSE},
1606 {"google.com",S_OK,FALSE},
1611 {"http://google.com:65535",S_OK,FALSE},
1612 {"http",S_OK,FALSE},
1617 {Uri_HOST_DNS,S_OK,FALSE},
1619 {URL_SCHEME_HTTP,S_OK,FALSE},
1620 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1623 { "zip://google.com:65536", 0, S_OK, FALSE,
1625 {"zip://google.com:65536/",S_OK,FALSE},
1626 {"google.com:65536",S_OK,FALSE},
1627 {"zip://google.com:65536/",S_OK,FALSE},
1628 {"google.com:65536",S_OK,FALSE},
1631 {"google.com:65536",S_OK,FALSE},
1636 {"zip://google.com:65536",S_OK,FALSE},
1642 {Uri_HOST_DNS,S_OK,FALSE},
1644 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1645 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1648 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1650 {"zip://google.com:65536:25/",S_OK,FALSE},
1651 {"google.com:65536:25",S_OK,FALSE},
1652 {"zip://google.com:65536:25/",S_OK,FALSE},
1653 {"google.com:65536:25",S_OK,FALSE},
1656 {"google.com:65536:25",S_OK,FALSE},
1661 {"zip://google.com:65536:25",S_OK,FALSE},
1667 {Uri_HOST_DNS,S_OK,FALSE},
1669 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1670 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1673 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1675 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1676 {"[::ffff]:abcd",S_OK,FALSE},
1677 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1681 {"[::ffff]:abcd",S_OK,FALSE},
1686 {"zip://[::ffff]:abcd",S_OK,FALSE},
1692 {Uri_HOST_DNS,S_OK,FALSE},
1694 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1695 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1698 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1700 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1701 {"127.0.0.1:abcd",S_OK,FALSE},
1702 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1703 {"0.1:abcd",S_OK,FALSE},
1706 {"127.0.0.1:abcd",S_OK,FALSE},
1711 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1717 {Uri_HOST_DNS,S_OK,FALSE},
1719 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1720 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1723 /* Port is just copied over. */
1724 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1726 {"http://google.com:00035",S_OK,FALSE},
1727 {"google.com:00035",S_OK,FALSE},
1728 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1729 {"google.com",S_OK,FALSE},
1732 {"google.com",S_OK,FALSE},
1737 {"http://google.com:00035",S_OK,FALSE},
1738 {"http",S_OK,FALSE},
1743 {Uri_HOST_DNS,S_OK,FALSE},
1745 {URL_SCHEME_HTTP,S_OK,FALSE},
1746 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1749 /* Default port is copied over. */
1750 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1752 {"http://google.com:80",S_OK,FALSE},
1753 {"google.com:80",S_OK,FALSE},
1754 {"http://google.com:80",S_OK,FALSE},
1755 {"google.com",S_OK,FALSE},
1758 {"google.com",S_OK,FALSE},
1763 {"http://google.com:80",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 { "http://google.com.uk", 0, S_OK, FALSE,
1777 {"http://google.com.uk/",S_OK,FALSE},
1778 {"google.com.uk",S_OK,FALSE},
1779 {"http://google.com.uk/",S_OK,FALSE},
1780 {"google.com.uk",S_OK,FALSE},
1783 {"google.com.uk",S_OK,FALSE},
1788 {"http://google.com.uk",S_OK,FALSE},
1789 {"http",S_OK,FALSE},
1794 {Uri_HOST_DNS,S_OK,FALSE},
1796 {URL_SCHEME_HTTP,S_OK,FALSE},
1797 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1800 { "http://google.com.com", 0, S_OK, FALSE,
1802 {"http://google.com.com/",S_OK,FALSE},
1803 {"google.com.com",S_OK,FALSE},
1804 {"http://google.com.com/",S_OK,FALSE},
1805 {"com.com",S_OK,FALSE},
1808 {"google.com.com",S_OK,FALSE},
1813 {"http://google.com.com",S_OK,FALSE},
1814 {"http",S_OK,FALSE},
1819 {Uri_HOST_DNS,S_OK,FALSE},
1821 {URL_SCHEME_HTTP,S_OK,FALSE},
1822 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1825 { "http://google.uk.1", 0, S_OK, FALSE,
1827 {"http://google.uk.1/",S_OK,FALSE},
1828 {"google.uk.1",S_OK,FALSE},
1829 {"http://google.uk.1/",S_OK,FALSE},
1830 {"google.uk.1",S_OK,FALSE},
1833 {"google.uk.1",S_OK,FALSE},
1838 {"http://google.uk.1",S_OK,FALSE},
1839 {"http",S_OK,FALSE},
1844 {Uri_HOST_DNS,S_OK,FALSE},
1846 {URL_SCHEME_HTTP,S_OK,FALSE},
1847 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1850 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1851 { "http://google.foo.uk", 0, S_OK, FALSE,
1853 {"http://google.foo.uk/",S_OK,FALSE},
1854 {"google.foo.uk",S_OK,FALSE},
1855 {"http://google.foo.uk/",S_OK,FALSE},
1856 {"foo.uk",S_OK,FALSE},
1859 {"google.foo.uk",S_OK,FALSE},
1864 {"http://google.foo.uk",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 { "http://.com", 0, S_OK, FALSE,
1878 {"http://.com/",S_OK,FALSE},
1879 {".com",S_OK,FALSE},
1880 {"http://.com/",S_OK,FALSE},
1881 {".com",S_OK,FALSE},
1884 {".com",S_OK,FALSE},
1889 {"http://.com",S_OK,FALSE},
1890 {"http",S_OK,FALSE},
1895 {Uri_HOST_DNS,S_OK,FALSE},
1897 {URL_SCHEME_HTTP,S_OK,FALSE},
1898 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1901 { "http://.uk", 0, S_OK, FALSE,
1903 {"http://.uk/",S_OK,FALSE},
1905 {"http://.uk/",S_OK,FALSE},
1914 {"http://.uk",S_OK,FALSE},
1915 {"http",S_OK,FALSE},
1920 {Uri_HOST_DNS,S_OK,FALSE},
1922 {URL_SCHEME_HTTP,S_OK,FALSE},
1923 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1926 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
1928 {"http://www.co.google.com.[]/",S_OK,FALSE},
1929 {"www.co.google.com.[]",S_OK,FALSE},
1930 {"http://www.co.google.com.[]/",S_OK,FALSE},
1931 {"google.com.[]",S_OK,FALSE},
1934 {"www.co.google.com.[]",S_OK,FALSE},
1939 {"http://www.co.google.com.[]",S_OK,FALSE},
1940 {"http",S_OK,FALSE},
1945 {Uri_HOST_DNS,S_OK,FALSE},
1947 {URL_SCHEME_HTTP,S_OK,FALSE},
1948 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1951 { "http://co.uk", 0, S_OK, FALSE,
1953 {"http://co.uk/",S_OK,FALSE},
1954 {"co.uk",S_OK,FALSE},
1955 {"http://co.uk/",S_OK,FALSE},
1959 {"co.uk",S_OK,FALSE},
1964 {"http://co.uk",S_OK,FALSE},
1965 {"http",S_OK,FALSE},
1970 {Uri_HOST_DNS,S_OK,FALSE},
1972 {URL_SCHEME_HTTP,S_OK,FALSE},
1973 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1976 { "http://www.co.google.us.test", 0, S_OK, FALSE,
1978 {"http://www.co.google.us.test/",S_OK,FALSE},
1979 {"www.co.google.us.test",S_OK,FALSE},
1980 {"http://www.co.google.us.test/",S_OK,FALSE},
1981 {"us.test",S_OK,FALSE},
1984 {"www.co.google.us.test",S_OK,FALSE},
1989 {"http://www.co.google.us.test",S_OK,FALSE},
1990 {"http",S_OK,FALSE},
1995 {Uri_HOST_DNS,S_OK,FALSE},
1997 {URL_SCHEME_HTTP,S_OK,FALSE},
1998 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2001 { "http://gov.uk", 0, S_OK, FALSE,
2003 {"http://gov.uk/",S_OK,FALSE},
2004 {"gov.uk",S_OK,FALSE},
2005 {"http://gov.uk/",S_OK,FALSE},
2009 {"gov.uk",S_OK,FALSE},
2014 {"http://gov.uk",S_OK,FALSE},
2015 {"http",S_OK,FALSE},
2020 {Uri_HOST_DNS,S_OK,FALSE},
2022 {URL_SCHEME_HTTP,S_OK,FALSE},
2023 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2026 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2028 {"zip://www.google.com\\test",S_OK,FALSE},
2029 {"www.google.com\\test",S_OK,FALSE},
2030 {"zip://www.google.com\\test",S_OK,FALSE},
2031 {"google.com\\test",S_OK,FALSE},
2034 {"www.google.com\\test",S_OK,FALSE},
2039 {"zip://www.google.com\\test",S_OK,FALSE},
2045 {Uri_HOST_DNS,S_OK,FALSE},
2047 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2048 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2051 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2053 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2055 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2061 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2062 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2064 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2070 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2072 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2073 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2076 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2077 * are decoded and all '%' are encoded.
2079 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2081 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2083 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2085 {".mp3",S_OK,FALSE},
2089 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2090 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2092 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2093 {"file",S_OK,FALSE},
2098 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2100 {URL_SCHEME_FILE,S_OK,FALSE},
2101 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2104 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2105 * is decoded and only %'s in front of invalid hex digits are encoded.
2107 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2109 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2111 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2113 {".mp3",S_OK,FALSE},
2117 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2118 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2120 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2121 {"file",S_OK,FALSE},
2126 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2128 {URL_SCHEME_FILE,S_OK,FALSE},
2129 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2132 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2133 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2135 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2136 {"[::1.2.3.0]",S_OK,FALSE},
2137 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2141 {"::1.2.3.0",S_OK,FALSE},
2143 {"/%3F%23.T/test",S_OK,FALSE},
2144 {"/%3F%23.T/test",S_OK,FALSE},
2146 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2147 {"http",S_OK,FALSE},
2152 {Uri_HOST_IPV6,S_OK,FALSE},
2154 {URL_SCHEME_HTTP,S_OK,FALSE},
2155 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2158 /* Forbidden characters are always encoded for file URIs. */
2159 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2161 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2163 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2165 {".mp3",S_OK,FALSE},
2169 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2170 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2172 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2173 {"file",S_OK,FALSE},
2178 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2180 {URL_SCHEME_FILE,S_OK,FALSE},
2181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2184 /* Forbidden characters are never encoded for unknown scheme types. */
2185 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2187 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2188 {"4294967295",S_OK,FALSE},
2189 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2193 {"4294967295",S_OK,FALSE},
2195 {"/<|>\" test<|>",S_OK,FALSE},
2196 {"/<|>\" test<|>",S_OK,FALSE},
2198 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2199 {"1234",S_OK,FALSE},
2204 {Uri_HOST_IPV4,S_OK,FALSE},
2206 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2207 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2210 /* Make sure forbidden characters are percent encoded. */
2211 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2213 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2214 {"gov.uk",S_OK,FALSE},
2215 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2219 {"gov.uk",S_OK,FALSE},
2221 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2222 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2224 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2225 {"http",S_OK,FALSE},
2230 {Uri_HOST_DNS,S_OK,FALSE},
2232 {URL_SCHEME_HTTP,S_OK,FALSE},
2233 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2236 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2238 {"http://gov.uk/",S_OK,FALSE},
2239 {"gov.uk",S_OK,FALSE},
2240 {"http://gov.uk/",S_OK,FALSE},
2244 {"gov.uk",S_OK,FALSE},
2249 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2250 {"http",S_OK,FALSE},
2255 {Uri_HOST_DNS,S_OK,FALSE},
2257 {URL_SCHEME_HTTP,S_OK,FALSE},
2258 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2261 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2263 {"http://gov.uk/",S_OK,FALSE},
2264 {"gov.uk",S_OK,FALSE},
2265 {"http://gov.uk/",S_OK,FALSE},
2269 {"gov.uk",S_OK,FALSE},
2274 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2275 {"http",S_OK,FALSE},
2280 {Uri_HOST_DNS,S_OK,FALSE},
2282 {URL_SCHEME_HTTP,S_OK,FALSE},
2283 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2286 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2288 {"http://gov.uk/",S_OK,FALSE},
2289 {"gov.uk",S_OK,FALSE},
2290 {"http://gov.uk/",S_OK,FALSE},
2294 {"gov.uk",S_OK,FALSE},
2299 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2300 {"http",S_OK,FALSE},
2305 {Uri_HOST_DNS,S_OK,FALSE},
2307 {URL_SCHEME_HTTP,S_OK,FALSE},
2308 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2311 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2313 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2315 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2317 {".mp3",S_OK,FALSE},
2321 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2322 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2324 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2325 {"file",S_OK,FALSE},
2330 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2332 {URL_SCHEME_FILE,S_OK,FALSE},
2333 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2336 /* Dot removal happens for unknown scheme types. */
2337 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2339 {"zip://gov.uk/",S_OK,FALSE},
2340 {"gov.uk",S_OK,FALSE},
2341 {"zip://gov.uk/",S_OK,FALSE},
2345 {"gov.uk",S_OK,FALSE},
2350 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2356 {Uri_HOST_DNS,S_OK,FALSE},
2358 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2359 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2362 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2363 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2365 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2366 {"gov.uk",S_OK,FALSE},
2367 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2371 {"gov.uk",S_OK,FALSE},
2373 {"/test/test2/../../.",S_OK,FALSE},
2374 {"/test/test2/../../.",S_OK,FALSE},
2376 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2377 {"http",S_OK,FALSE},
2382 {Uri_HOST_DNS,S_OK,FALSE},
2384 {URL_SCHEME_HTTP,S_OK,FALSE},
2385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2388 /* Dot removal doesn't happen for wildcard scheme types. */
2389 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2391 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2392 {"gov.uk",S_OK,FALSE},
2393 {"*: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 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2408 {Uri_HOST_DNS,S_OK,FALSE},
2410 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2411 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2414 /* Forbidden characters are encoded for opaque known scheme types. */
2415 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2417 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2419 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2421 {".com%22",S_OK,FALSE},
2425 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2426 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2428 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2429 {"mailto",S_OK,FALSE},
2434 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2436 {URL_SCHEME_MAILTO,S_OK,FALSE},
2437 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2440 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2442 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2444 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2446 {".com",S_OK,FALSE},
2450 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2451 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2453 {"news:test.tes<|>t.com",S_OK,FALSE},
2454 {"news",S_OK,FALSE},
2459 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2461 {URL_SCHEME_NEWS,S_OK,FALSE},
2462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2465 /* Don't encode forbidden characters. */
2466 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2468 {"news:test.tes<|>t.com",S_OK,FALSE},
2470 {"news:test.tes<|>t.com",S_OK,FALSE},
2472 {".com",S_OK,FALSE},
2476 {"test.tes<|>t.com",S_OK,FALSE},
2477 {"test.tes<|>t.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 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2492 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2494 {"urn:test.tes<|>t.com",S_OK,FALSE},
2496 {"urn: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 {"urn:test.tes<|>t.com",S_OK,FALSE},
2511 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2513 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2514 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2517 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2518 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2520 {"news:test.test.com",S_OK,FALSE},
2522 {"news:test.test.com",S_OK,FALSE},
2524 {".com",S_OK,FALSE},
2528 {"test.test.com",S_OK,FALSE},
2529 {"test.test.com",S_OK,FALSE},
2531 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2532 {"news",S_OK,FALSE},
2537 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2539 {URL_SCHEME_NEWS,S_OK,FALSE},
2540 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2543 /* Percent encoded characters are still decoded for known scheme types. */
2544 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, 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 aren't decoded for unknown scheme types. */
2570 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2572 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2574 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2576 {".com",S_OK,FALSE},
2580 {"test.%74%65%73%74.com",S_OK,FALSE},
2581 {"test.%74%65%73%74.com",S_OK,FALSE},
2583 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2589 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2591 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2592 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2595 /* Unknown scheme types can have invalid % encoded data in query string. */
2596 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2598 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2599 {"www.winehq.org",S_OK,FALSE},
2600 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2601 {"winehq.org",S_OK,FALSE},
2604 {"www.winehq.org",S_OK,FALSE},
2607 {"/?query=%xx&return=y",S_OK,FALSE},
2608 {"?query=%xx&return=y",S_OK,FALSE},
2609 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2615 {Uri_HOST_DNS,S_OK,FALSE},
2617 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2618 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2621 /* Known scheme types can have invalid % encoded data with the right flags. */
2622 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2624 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2625 {"www.winehq.org",S_OK,FALSE},
2626 {"http://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 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2636 {"http",S_OK,FALSE},
2641 {Uri_HOST_DNS,S_OK,FALSE},
2643 {URL_SCHEME_HTTP,S_OK,FALSE},
2644 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2647 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2648 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2650 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2651 {"www.winehq.org",S_OK,FALSE},
2652 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2653 {"winehq.org",S_OK,FALSE},
2656 {"www.winehq.org",S_OK,FALSE},
2659 {"/?query=<|>&return=y",S_OK,FALSE},
2660 {"?query=<|>&return=y",S_OK,FALSE},
2661 {"http://www.winehq.org/tests/..?query=<|>&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_ENCODE_FORBIDDEN_CHARACTERS, 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 are encoded for known scheme types. */
2700 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2702 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2703 {"www.winehq.org",S_OK,FALSE},
2704 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2705 {"winehq.org",S_OK,FALSE},
2708 {"www.winehq.org",S_OK,FALSE},
2711 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2712 {"?query=%3C%7C%3E&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 not encoded for unknown scheme types. */
2726 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2728 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2729 {"www.winehq.org",S_OK,FALSE},
2730 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2731 {"winehq.org",S_OK,FALSE},
2734 {"www.winehq.org",S_OK,FALSE},
2737 {"/?query=<|>&return=y",S_OK,FALSE},
2738 {"?query=<|>&return=y",S_OK,FALSE},
2739 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2745 {Uri_HOST_DNS,S_OK,FALSE},
2747 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2748 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2751 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2752 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2754 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2755 {"www.winehq.org",S_OK,FALSE},
2756 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2757 {"winehq.org",S_OK,FALSE},
2760 {"www.winehq.org",S_OK,FALSE},
2763 {"/?query=01&return=y",S_OK,FALSE},
2764 {"?query=01&return=y",S_OK,FALSE},
2765 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2766 {"http",S_OK,FALSE},
2771 {Uri_HOST_DNS,S_OK,FALSE},
2773 {URL_SCHEME_HTTP,S_OK,FALSE},
2774 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2777 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2778 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2780 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2781 {"www.winehq.org",S_OK,FALSE},
2782 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2783 {"winehq.org",S_OK,FALSE},
2786 {"www.winehq.org",S_OK,FALSE},
2789 {"/?query=%30%31&return=y",S_OK,FALSE},
2790 {"?query=%30%31&return=y",S_OK,FALSE},
2791 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2797 {Uri_HOST_DNS,S_OK,FALSE},
2799 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2800 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2803 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2804 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2806 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2807 {"www.winehq.org",S_OK,FALSE},
2808 {"http://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 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2818 {"http",S_OK,FALSE},
2823 {Uri_HOST_DNS,S_OK,FALSE},
2825 {URL_SCHEME_HTTP,S_OK,FALSE},
2826 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2829 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2831 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2832 {"www.winehq.org",S_OK,FALSE},
2833 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2834 {"winehq.org",S_OK,FALSE},
2837 {"www.winehq.org",S_OK,FALSE},
2840 {"?query=12&return=y",S_OK,FALSE},
2841 {"?query=12&return=y",S_OK,FALSE},
2842 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2843 {"http",S_OK,FALSE},
2848 {Uri_HOST_DNS,S_OK,FALSE},
2850 {URL_SCHEME_HTTP,S_OK,FALSE},
2851 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2854 /* Unknown scheme types can have invalid % encoded data in fragments. */
2855 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2857 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2858 {"www.winehq.org",S_OK,FALSE},
2859 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2860 {"winehq.org",S_OK,FALSE},
2862 {"#Te%xx",S_OK,FALSE},
2863 {"www.winehq.org",S_OK,FALSE},
2865 {"/tests/",S_OK,FALSE},
2866 {"/tests/",S_OK,FALSE},
2868 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2874 {Uri_HOST_DNS,S_OK,FALSE},
2876 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2877 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2880 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2881 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2883 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2884 {"www.winehq.org",S_OK,FALSE},
2885 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2886 {"winehq.org",S_OK,FALSE},
2888 {"#Te<|>",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<|>",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 the fragment are percent encoded for known schemes. */
2907 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2909 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2910 {"www.winehq.org",S_OK,FALSE},
2911 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2912 {"winehq.org",S_OK,FALSE},
2914 {"#Te%3C%7C%3E",S_OK,FALSE},
2915 {"www.winehq.org",S_OK,FALSE},
2917 {"/tests/",S_OK,FALSE},
2918 {"/tests/",S_OK,FALSE},
2920 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2921 {"http",S_OK,FALSE},
2926 {Uri_HOST_DNS,S_OK,FALSE},
2928 {URL_SCHEME_HTTP,S_OK,FALSE},
2929 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2932 /* Forbidden characters aren't encoded in the fragment with this flag. */
2933 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2935 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2936 {"www.winehq.org",S_OK,FALSE},
2937 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2938 {"winehq.org",S_OK,FALSE},
2940 {"#Te<|>",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_ENCODE_FORBIDDEN_CHARACTERS, 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 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
2985 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2987 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2988 {"www.winehq.org",S_OK,FALSE},
2989 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2990 {"winehq.org",S_OK,FALSE},
2992 {"#Te%30%31%32",S_OK,FALSE},
2993 {"www.winehq.org",S_OK,FALSE},
2995 {"/tests/",S_OK,FALSE},
2996 {"/tests/",S_OK,FALSE},
2998 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3004 {Uri_HOST_DNS,S_OK,FALSE},
3006 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3007 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3010 /* Percent encoded, unreserved characters are decoded for known schemes. */
3011 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3013 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3014 {"www.winehq.org",S_OK,FALSE},
3015 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3016 {"winehq.org",S_OK,FALSE},
3018 {"#Te012",S_OK,FALSE},
3019 {"www.winehq.org",S_OK,FALSE},
3021 {"/tests/",S_OK,FALSE},
3022 {"/tests/",S_OK,FALSE},
3024 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3025 {"http",S_OK,FALSE},
3030 {Uri_HOST_DNS,S_OK,FALSE},
3032 {URL_SCHEME_HTTP,S_OK,FALSE},
3033 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3036 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3037 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, 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 aren't decoded when NO_DECODE_EXTRA is set. */
3063 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3065 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3066 {"www.winehq.org",S_OK,FALSE},
3067 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3068 {"winehq.org",S_OK,FALSE},
3070 {"#Te%30%31%32",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 /* Leading/Trailing whitespace is removed. */
3089 { " http://google.com/ ", 0, S_OK, FALSE,
3091 {"http://google.com/",S_OK,FALSE},
3092 {"google.com",S_OK,FALSE},
3093 {"http://google.com/",S_OK,FALSE},
3094 {"google.com",S_OK,FALSE},
3097 {"google.com",S_OK,FALSE},
3102 {"http://google.com/",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 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3116 {"http://google.com/",S_OK,FALSE},
3117 {"google.com",S_OK,FALSE},
3118 {"http://google.com/",S_OK,FALSE},
3119 {"google.com",S_OK,FALSE},
3122 {"google.com",S_OK,FALSE},
3127 {"http://google.com/",S_OK,FALSE},
3128 {"http",S_OK,FALSE},
3133 {Uri_HOST_DNS,S_OK,FALSE},
3135 {URL_SCHEME_HTTP,S_OK,FALSE},
3136 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3139 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3141 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3142 {"g%0aoogle.co%0dm",S_OK,FALSE},
3143 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3144 {"g%0aoogle.co%0dm",S_OK,FALSE},
3147 {"g%0aoogle.co%0dm",S_OK,FALSE},
3149 {"/%0A%0A%0A",S_OK,FALSE},
3150 {"/%0A%0A%0A",S_OK,FALSE},
3152 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3153 {"http",S_OK,FALSE},
3158 {Uri_HOST_DNS,S_OK,FALSE},
3160 {URL_SCHEME_HTTP,S_OK,FALSE},
3161 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3164 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3166 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3167 {"g\noogle.co\rm",S_OK,FALSE},
3168 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3169 {"g\noogle.co\rm",S_OK,FALSE},
3172 {"g\noogle.co\rm",S_OK,FALSE},
3174 {"/\n\n\n",S_OK,FALSE},
3175 {"/\n\n\n",S_OK,FALSE},
3177 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3183 {Uri_HOST_DNS,S_OK,FALSE},
3185 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3186 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3189 /* Since file URLs are usually hierarchical, it returns an empty string
3190 * for the absolute URI property since it was declared as an opaque URI.
3192 { "file:index.html", 0, S_OK, FALSE,
3196 {"file:index.html",S_OK,FALSE},
3198 {".html",S_OK,FALSE},
3202 {"index.html",S_OK,FALSE},
3203 {"index.html",S_OK,FALSE},
3205 {"file:index.html",S_OK,FALSE},
3206 {"file",S_OK,FALSE},
3211 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3213 {URL_SCHEME_FILE,S_OK,FALSE},
3214 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3217 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3218 { "http:test.com/index.html", 0, S_OK, FALSE,
3222 {"http:test.com/index.html",S_OK,FALSE},
3224 {".html",S_OK,FALSE},
3228 {"test.com/index.html",S_OK,FALSE},
3229 {"test.com/index.html",S_OK,FALSE},
3231 {"http:test.com/index.html",S_OK,FALSE},
3232 {"http",S_OK,FALSE},
3237 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3239 {URL_SCHEME_HTTP,S_OK,FALSE},
3240 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3243 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3247 {"ftp:test.com/index.html",S_OK,FALSE},
3249 {".html",S_OK,FALSE},
3253 {"test.com/index.html",S_OK,FALSE},
3254 {"test.com/index.html",S_OK,FALSE},
3256 {"ftp:test.com/index.html",S_OK,FALSE},
3262 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3264 {URL_SCHEME_FTP,S_OK,FALSE},
3265 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3268 { "file://C|/test.mp3", 0, S_OK, FALSE,
3270 {"file:///C:/test.mp3",S_OK,FALSE},
3272 {"file:///C:/test.mp3",S_OK,FALSE},
3274 {".mp3",S_OK,FALSE},
3278 {"/C:/test.mp3",S_OK,FALSE},
3279 {"/C:/test.mp3",S_OK,FALSE},
3281 {"file://C|/test.mp3",S_OK,FALSE},
3282 {"file",S_OK,FALSE},
3287 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3289 {URL_SCHEME_FILE,S_OK,FALSE},
3290 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3293 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3295 {"file:///C:/test.mp3",S_OK,FALSE},
3297 {"file:///C:/test.mp3",S_OK,FALSE},
3299 {".mp3",S_OK,FALSE},
3303 {"/C:/test.mp3",S_OK,FALSE},
3304 {"/C:/test.mp3",S_OK,FALSE},
3306 {"file:///C|/test.mp3",S_OK,FALSE},
3307 {"file",S_OK,FALSE},
3312 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3314 {URL_SCHEME_FILE,S_OK,FALSE},
3315 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3318 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3321 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3323 {"file://c:\\dir\\index.html",S_OK,FALSE},
3325 {"file://c:\\dir\\index.html",S_OK,FALSE},
3327 {".html",S_OK,FALSE},
3331 {"c:\\dir\\index.html",S_OK,FALSE},
3332 {"c:\\dir\\index.html",S_OK,FALSE},
3334 {"file://c:/dir/index.html",S_OK,FALSE},
3335 {"file",S_OK,FALSE},
3340 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3342 {URL_SCHEME_FILE,S_OK,FALSE},
3343 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3346 /* Extra '/' after "file://" is removed. */
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 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3373 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3375 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3377 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3379 {".html",S_OK,FALSE},
3383 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3384 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3386 {"file:///c:/dir\\%%61%20%5Fname/file%2A.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 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3400 {"file://c:\\dir\\index.html",S_OK,FALSE},
3402 {"file://c:\\dir\\index.html",S_OK,FALSE},
3404 {".html",S_OK,FALSE},
3408 {"c:\\dir\\index.html",S_OK,FALSE},
3409 {"c:\\dir\\index.html",S_OK,FALSE},
3411 {"file://c|/dir\\index.html",S_OK,FALSE},
3412 {"file",S_OK,FALSE},
3417 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3419 {URL_SCHEME_FILE,S_OK,FALSE},
3420 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3423 /* The backslashes after the scheme name are converted to forward slashes. */
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 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3451 {"file:///c:/dir/index.html",S_OK,FALSE},
3453 {"file:///c:/dir/index.html",S_OK,FALSE},
3455 {".html",S_OK,FALSE},
3459 {"/c:/dir/index.html",S_OK,FALSE},
3460 {"/c:/dir/index.html",S_OK,FALSE},
3462 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3463 {"file",S_OK,FALSE},
3468 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3470 {URL_SCHEME_FILE,S_OK,FALSE},
3471 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3474 { "http:\\\\google.com", 0, S_OK, FALSE,
3476 {"http://google.com/",S_OK,FALSE},
3477 {"google.com",S_OK,FALSE},
3478 {"http://google.com/",S_OK,FALSE},
3479 {"google.com",S_OK,FALSE},
3482 {"google.com",S_OK,FALSE},
3487 {"http:\\\\google.com",S_OK,FALSE},
3488 {"http",S_OK,FALSE},
3493 {Uri_HOST_DNS,S_OK,FALSE},
3495 {URL_SCHEME_HTTP,S_OK,FALSE},
3496 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3499 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3500 { "zip:\\\\google.com", 0, S_OK, FALSE,
3502 {"zip:\\\\google.com",S_OK,FALSE},
3504 {"zip:\\\\google.com",S_OK,FALSE},
3506 {".com",S_OK,FALSE},
3510 {"\\\\google.com",S_OK,FALSE},
3511 {"\\\\google.com",S_OK,FALSE},
3513 {"zip:\\\\google.com",S_OK,FALSE},
3519 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3521 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3522 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3525 /* Dot segments aren't removed. */
3526 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3528 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3530 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3532 {".html",S_OK,FALSE},
3536 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3537 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3539 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3540 {"file",S_OK,FALSE},
3545 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3547 {URL_SCHEME_FILE,S_OK,FALSE},
3548 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3551 /* Forbidden characters aren't percent encoded. */
3552 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3554 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3556 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3558 {".html",S_OK,FALSE},
3562 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3563 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3565 {"file://c:\\dir\\i^|ndex.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 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3578 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3582 {"file:c:/dir/../../index.html",S_OK,FALSE},
3584 {".html",S_OK,FALSE},
3588 {"c:/dir/../../index.html",S_OK,FALSE},
3589 {"c:/dir/../../index.html",S_OK,FALSE},
3591 {"file:c:\\dir\\../..\\index.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 /* '/' are still converted to '\' even though it's an opaque URI. */
3604 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, 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 /* Forbidden characters aren't percent encoded. */
3630 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3634 {"file:c:\\in^|dex.html",S_OK,FALSE},
3636 {".html",S_OK,FALSE},
3640 {"c:\\in^|dex.html",S_OK,FALSE},
3641 {"c:\\in^|dex.html",S_OK,FALSE},
3643 {"file:c:\\in^|dex.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 /* Doesn't have a UserName since the ':' appears at the beginning of the
3658 { "http://:password@gov.uk", 0, S_OK, FALSE,
3660 {"http://:password@gov.uk/",S_OK,FALSE},
3661 {":password@gov.uk",S_OK,FALSE},
3662 {"http://gov.uk/",S_OK,FALSE},
3666 {"gov.uk",S_OK,FALSE},
3667 {"password",S_OK,FALSE},
3671 {"http://:password@gov.uk",S_OK,FALSE},
3672 {"http",S_OK,FALSE},
3673 {":password",S_OK,FALSE},
3677 {Uri_HOST_DNS,S_OK,FALSE},
3679 {URL_SCHEME_HTTP,S_OK,FALSE},
3680 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3683 /* Has a UserName since the userinfo section doesn't contain a password. */
3684 { "http://@gov.uk", 0, S_OK, FALSE,
3686 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3687 {"@gov.uk",S_OK,FALSE},
3688 {"http://gov.uk/",S_OK,FALSE},
3692 {"gov.uk",S_OK,FALSE},
3697 {"http://@gov.uk",S_OK,FALSE},
3698 {"http",S_OK,FALSE},
3703 {Uri_HOST_DNS,S_OK,FALSE},
3705 {URL_SCHEME_HTTP,S_OK,FALSE},
3706 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3709 /* ":@" not included in the absolute URI. */
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 /* '@' is included because it's an unknown scheme type. */
3736 { "zip://@gov.uk", 0, S_OK, FALSE,
3738 {"zip://@gov.uk/",S_OK,FALSE},
3739 {"@gov.uk",S_OK,FALSE},
3740 {"zip://@gov.uk/",S_OK,FALSE},
3744 {"gov.uk",S_OK,FALSE},
3749 {"zip://@gov.uk",S_OK,FALSE},
3755 {Uri_HOST_DNS,S_OK,FALSE},
3757 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3758 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3761 /* ":@" are 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 { "about:blank", 0, S_OK, FALSE,
3789 {"about:blank",S_OK,FALSE},
3791 {"about:blank",S_OK,FALSE},
3797 {"blank",S_OK,FALSE},
3798 {"blank",S_OK,FALSE},
3800 {"about:blank",S_OK,FALSE},
3801 {"about",S_OK,FALSE},
3806 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3808 {URL_SCHEME_ABOUT,S_OK,FALSE},
3809 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3812 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3814 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3816 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3818 {".htm",S_OK,FALSE},
3822 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3823 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3825 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3831 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3833 {URL_SCHEME_MK,S_OK,FALSE},
3834 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3837 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3839 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3841 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3843 {".htm",S_OK,FALSE},
3847 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3848 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3850 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3856 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3858 {URL_SCHEME_MK,S_OK,FALSE},
3859 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3862 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3863 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3865 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3866 {"server",S_OK,FALSE},
3867 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3869 {".html",S_OK,FALSE},
3871 {"server",S_OK,FALSE},
3873 {"\\dir\\index.html",S_OK,FALSE},
3874 {"\\dir\\index.html",S_OK,FALSE},
3876 {"file://server/dir/index.html",S_OK,FALSE},
3877 {"file",S_OK,FALSE},
3882 {Uri_HOST_DNS,S_OK,FALSE},
3884 {URL_SCHEME_FILE,S_OK,FALSE},
3885 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3888 /* When CreateUri generates an IUri, it still displays the default port in the
3891 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3893 {"http://google.com:80/",S_OK,FALSE},
3894 {"google.com:80",S_OK,FALSE},
3895 {"http://google.com:80/",S_OK,FALSE},
3896 {"google.com",S_OK,FALSE},
3899 {"google.com",S_OK,FALSE},
3904 {"http://google.com:80/",S_OK,FALSE},
3905 {"http",S_OK,FALSE},
3910 {Uri_HOST_DNS,S_OK,FALSE},
3912 {URL_SCHEME_HTTP,S_OK,FALSE},
3913 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3916 /* For res URIs the host is everything up until the first '/'. */
3917 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3919 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3920 {"C:\\dir\\file.exe",S_OK,FALSE},
3921 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3923 {".html",S_OK,FALSE},
3925 {"C:\\dir\\file.exe",S_OK,FALSE},
3927 {"/DATA/test.html",S_OK,FALSE},
3928 {"/DATA/test.html",S_OK,FALSE},
3930 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3936 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3938 {URL_SCHEME_RES,S_OK,FALSE},
3939 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3942 /* Res URI can contain a '|' in the host name. */
3943 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
3945 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3946 {"c:\\di|r\\file.exe",S_OK,FALSE},
3947 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3951 {"c:\\di|r\\file.exe",S_OK,FALSE},
3953 {"/test",S_OK,FALSE},
3954 {"/test",S_OK,FALSE},
3956 {"res://c:\\di|r\\file.exe/test",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 URIs can have invalid percent encoded values. */
3969 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
3971 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3972 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3973 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3977 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3979 {"/test",S_OK,FALSE},
3980 {"/test",S_OK,FALSE},
3982 {"res://c:\\dir%xx\\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 doesn't get forbidden characters percent encoded in it's path. */
3995 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
3997 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3998 {"c:\\test",S_OK,FALSE},
3999 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4003 {"c:\\test",S_OK,FALSE},
4005 {"/tes<|>t",S_OK,FALSE},
4006 {"/tes<|>t",S_OK,FALSE},
4008 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4014 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4016 {URL_SCHEME_RES,S_OK,FALSE},
4017 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4020 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4022 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4024 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4026 {".jpg",S_OK,FALSE},
4030 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4031 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4033 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4039 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4041 {URL_SCHEME_MK,S_OK,FALSE},
4042 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4045 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4047 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4049 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4051 {".jpg",S_OK,FALSE},
4055 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4056 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4058 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4064 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4066 {URL_SCHEME_MK,S_OK,FALSE},
4067 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4070 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4072 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4074 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4076 {".jpg",S_OK,FALSE},
4080 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4081 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4083 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4089 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4091 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4092 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4095 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4097 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4099 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4101 {".jpg",S_OK,FALSE},
4105 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4106 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4108 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4114 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4116 {URL_SCHEME_MK,S_OK,FALSE},
4117 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4120 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4122 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4124 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4126 {".jpg",S_OK,FALSE},
4130 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4131 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4133 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4139 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4141 {URL_SCHEME_MK,S_OK,FALSE},
4142 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4145 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4147 {"mk:images/xxx.jpg",S_OK,FALSE},
4149 {"mk:images/xxx.jpg",S_OK,FALSE},
4151 {".jpg",S_OK,FALSE},
4155 {"images/xxx.jpg",S_OK,FALSE},
4156 {"images/xxx.jpg",S_OK,FALSE},
4158 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4164 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4166 {URL_SCHEME_MK,S_OK,FALSE},
4167 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4170 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4189 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4191 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4192 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4195 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4214 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4216 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4217 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4220 { "javascript:void", 0, S_OK, FALSE,
4222 {"javascript:void",S_OK},
4224 {"javascript:void",S_OK},
4233 {"javascript:void",S_OK},
4234 {"javascript",S_OK},
4239 {Uri_HOST_UNKNOWN,S_OK},
4241 {URL_SCHEME_JAVASCRIPT,S_OK},
4242 {URLZONE_INVALID,E_NOTIMPL}
4245 { "javascript://undefined", 0, S_OK, FALSE,
4247 {"javascript://undefined",S_OK},
4249 {"javascript://undefined",S_OK},
4255 {"//undefined",S_OK},
4256 {"//undefined",S_OK},
4258 {"javascript://undefined",S_OK},
4259 {"javascript",S_OK},
4264 {Uri_HOST_UNKNOWN,S_OK},
4266 {URL_SCHEME_JAVASCRIPT,S_OK},
4267 {URLZONE_INVALID,E_NOTIMPL}
4270 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4272 {"javascript:escape('/\\?#?')",S_OK},
4274 {"javascript:escape('/\\?#?')",S_OK},
4280 {"escape('/\\?#?')",S_OK},
4281 {"escape('/\\?#?')",S_OK},
4283 {"JavaSCript:escape('/\\?#?')",S_OK},
4284 {"javascript",S_OK},
4289 {Uri_HOST_UNKNOWN,S_OK},
4291 {URL_SCHEME_JAVASCRIPT,S_OK},
4292 {URLZONE_INVALID,E_NOTIMPL}
4295 { "*://google.com", 0, S_OK, FALSE,
4297 {"*:google.com/",S_OK,FALSE},
4298 {"google.com",S_OK},
4299 {"*:google.com/",S_OK,FALSE},
4300 {"google.com",S_OK,FALSE},
4303 {"google.com",S_OK,FALSE},
4308 {"*://google.com",S_OK,FALSE},
4314 {Uri_HOST_DNS,S_OK,FALSE},
4316 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4317 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4320 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4322 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4324 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4330 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4331 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4333 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4339 {Uri_HOST_UNKNOWN,S_OK},
4341 {URL_SCHEME_MK,S_OK},
4342 {URLZONE_INVALID,E_NOTIMPL}
4347 typedef struct _invalid_uri {
4353 static const invalid_uri invalid_uri_tests[] = {
4354 /* Has to have a scheme name. */
4355 {"://www.winehq.org",0,FALSE},
4356 /* Window's doesn't like URI's which are implicitly file paths without the
4357 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4359 {"C:/test/test.mp3",0,FALSE},
4360 {"\\\\Server/test/test.mp3",0,FALSE},
4361 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4362 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4363 /* Invalid schemes. */
4364 {"*abcd://not.valid.com",0,FALSE},
4365 {"*a*b*c*d://not.valid.com",0,FALSE},
4366 /* Not allowed to have invalid % encoded data. */
4367 {"ftp://google.co%XX/",0,FALSE},
4368 /* To many h16 components. */
4369 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4370 /* Not enough room for IPv4 address. */
4371 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4372 /* Not enough h16 components. */
4373 {"http://[1:2:3:4]",0,FALSE},
4374 /* Not enough components including IPv4. */
4375 {"http://[1:192.0.1.0]",0,FALSE},
4376 /* Not allowed to have partial IPv4 in IPv6. */
4377 {"http://[::192.0]",0,FALSE},
4378 /* Can't have elision of 1 h16 at beginning of address. */
4379 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4380 /* Can't have elision of 1 h16 at end of address. */
4381 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4382 /* Expects a valid IP Literal. */
4383 {"ftp://[not.valid.uri]/",0,FALSE},
4384 /* Expects valid port for a known scheme type. */
4385 {"ftp://www.winehq.org:123fgh",0,FALSE},
4386 /* Port exceeds USHORT_MAX for known scheme type. */
4387 {"ftp://www.winehq.org:65536",0,FALSE},
4388 /* Invalid port with IPv4 address. */
4389 {"http://www.winehq.org:1abcd",0,FALSE},
4390 /* Invalid port with IPv6 address. */
4391 {"http://[::ffff]:32xy",0,FALSE},
4392 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4393 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4394 /* Not allowed to have invalid % encoded data in opaque URI path. */
4395 {"news:test%XX",0,FALSE},
4396 {"mailto:wine@winehq%G8.com",0,FALSE},
4397 /* Known scheme types can't have invalid % encoded data in query string. */
4398 {"http://google.com/?query=te%xx",0,FALSE},
4399 /* Invalid % encoded data in fragment of know scheme type. */
4400 {"ftp://google.com/#Test%xx",0,FALSE},
4401 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4402 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4403 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4404 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4405 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4406 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4407 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4408 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4409 /* res URIs aren't allowed to have forbidden dos path characters in the
4412 {"res://c:\\te<st\\test/test",0,FALSE},
4413 {"res://c:\\te>st\\test/test",0,FALSE},
4414 {"res://c:\\te\"st\\test/test",0,FALSE},
4415 {"res://c:\\test/te%xxst",0,FALSE}
4418 typedef struct _uri_equality {
4420 DWORD create_flags_a;
4422 DWORD create_flags_b;
4427 static const uri_equality equality_tests[] = {
4429 "HTTP://www.winehq.org/test dir/./",0,
4430 "http://www.winehq.org/test dir/../test dir/",0,
4434 /* http://www.winehq.org/test%20dir */
4435 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4436 "http://www.winehq.org/test dir",0,
4440 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4441 "file:///c:/test.mp3",0,
4445 "ftp://ftp.winehq.org/",0,
4446 "ftp://ftp.winehq.org",0,
4450 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4451 "ftp://ftp.winehq.org/t%45stB/",0,
4455 "http://google.com/TEST",0,
4456 "http://google.com/test",0,
4460 "http://GOOGLE.com/",0,
4461 "http://google.com/",0,
4464 /* Performs case insensitive compare of host names (for known scheme types). */
4466 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4467 "ftp://google.com/",0,
4471 "zip://GOOGLE.com/",0,
4472 "zip://google.com/",0,
4476 "file:///c:/TEST/TeST/",0,
4477 "file:///c:/test/test/",0,
4481 "file:///server/TEST",0,
4482 "file:///SERVER/TEST",0,
4486 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4487 "http://google.com/",0,
4491 "ftp://google.com:21/",0,
4492 "ftp://google.com/",0,
4496 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4497 "http://google.com/",0,
4501 "http://google.com:70/",0,
4502 "http://google.com:71/",0,
4507 typedef struct _uri_with_fragment {
4509 const char* fragment;
4511 HRESULT create_expected;
4514 const char* expected_uri;
4516 } uri_with_fragment;
4518 static const uri_with_fragment uri_fragment_tests[] = {
4520 "http://google.com/","#fragment",0,S_OK,FALSE,
4521 "http://google.com/#fragment",FALSE
4524 "http://google.com/","fragment",0,S_OK,FALSE,
4525 "http://google.com/#fragment",FALSE
4528 "zip://test.com/","?test",0,S_OK,FALSE,
4529 "zip://test.com/#?test",FALSE
4531 /* The fragment can be empty. */
4533 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4534 "ftp://ftp.google.com/#",FALSE
4538 typedef struct _uri_builder_property {
4541 const char *expected_value;
4542 Uri_PROPERTY property;
4545 } uri_builder_property;
4547 typedef struct _uri_builder_port {
4555 typedef struct _uri_builder_str_property {
4556 const char* expected;
4559 } uri_builder_str_property;
4561 typedef struct _uri_builder_dword_property {
4565 } uri_builder_dword_property;
4567 typedef struct _uri_builder_test {
4570 HRESULT create_builder_expected;
4571 BOOL create_builder_todo;
4573 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4575 uri_builder_port port_prop;
4581 DWORD uri_simple_encode_flags;
4582 HRESULT uri_simple_hres;
4583 BOOL uri_simple_todo;
4585 DWORD uri_with_flags;
4586 DWORD uri_with_builder_flags;
4587 DWORD uri_with_encode_flags;
4588 HRESULT uri_with_hres;
4591 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4592 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4595 static const uri_builder_test uri_builder_tests[] = {
4596 { "http://google.com/",0,S_OK,FALSE,
4598 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4599 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4600 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4601 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4608 {"http://username:password@google.com/?query=x#fragment",S_OK},
4609 {"username:password@google.com",S_OK},
4610 {"http://google.com/?query=x#fragment",S_OK},
4611 {"google.com",S_OK},
4614 {"google.com",S_OK},
4619 {"http://username:password@google.com/?query=x#fragment",S_OK},
4621 {"username:password",S_OK},
4625 {Uri_HOST_DNS,S_OK},
4627 {URL_SCHEME_HTTP,S_OK},
4628 {URLZONE_INVALID,E_NOTIMPL}
4631 { "http://google.com/",0,S_OK,FALSE,
4633 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4635 {TRUE,TRUE,120,S_OK,FALSE},
4640 {"test://google.com:120/",S_OK},
4641 {"google.com:120",S_OK},
4642 {"test://google.com:120/",S_OK},
4643 {"google.com",S_OK},
4646 {"google.com",S_OK},
4651 {"test://google.com:120/",S_OK},
4657 {Uri_HOST_DNS,S_OK},
4659 {URL_SCHEME_UNKNOWN,S_OK},
4660 {URLZONE_INVALID,E_NOTIMPL}
4663 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4665 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4666 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4667 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4674 {"http://[::192.2.3.4]/",S_OK},
4675 {"[::192.2.3.4]",S_OK},
4676 {"http://[::192.2.3.4]/",S_OK},
4680 {"::192.2.3.4",S_OK},
4685 {"http://[::192.2.3.4]/",S_OK},
4691 {Uri_HOST_IPV6,S_OK},
4693 {URL_SCHEME_HTTP,S_OK},
4694 {URLZONE_INVALID,E_NOTIMPL}
4697 { "http://google.com/",0,S_OK,FALSE,
4699 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4706 {"http://google.com/#Frag",S_OK},
4707 {"google.com",S_OK},
4708 {"http://google.com/#Frag",S_OK},
4709 {"google.com",S_OK},
4712 {"google.com",S_OK},
4717 {"http://google.com/#Frag",S_OK},
4723 {Uri_HOST_DNS,S_OK},
4725 {URL_SCHEME_HTTP,S_OK},
4726 {URLZONE_INVALID,E_NOTIMPL}
4729 { "http://google.com/",0,S_OK,FALSE,
4731 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4738 {"http://google.com/#",S_OK},
4739 {"google.com",S_OK},
4740 {"http://google.com/#",S_OK},
4741 {"google.com",S_OK},
4744 {"google.com",S_OK},
4749 {"http://google.com/#",S_OK},
4755 {Uri_HOST_DNS,S_OK},
4757 {URL_SCHEME_HTTP,S_OK},
4758 {URLZONE_INVALID,E_NOTIMPL}
4761 { "http://google.com/",0,S_OK,FALSE,
4763 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4770 {"http://::password@google.com/",S_OK},
4771 {"::password@google.com",S_OK},
4772 {"http://google.com/",S_OK},
4773 {"google.com",S_OK},
4776 {"google.com",S_OK},
4781 {"http://::password@google.com/",S_OK},
4783 {"::password",S_OK},
4787 {Uri_HOST_DNS,S_OK},
4789 {URL_SCHEME_HTTP,S_OK},
4790 {URLZONE_INVALID,E_NOTIMPL}
4793 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4795 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4798 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4800 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4802 {":password@test/test",S_OK},
4803 {":password@",S_OK},
4804 {":password@test/test",S_OK},
4813 {":password@test/test",S_OK},
4819 {Uri_HOST_UNKNOWN,S_OK},
4821 {URL_SCHEME_UNKNOWN,S_OK},
4822 {URLZONE_INVALID,E_NOTIMPL}
4825 { "http://google.com/",0,S_OK,FALSE,
4827 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4834 {"http://google.com/test/test",S_OK},
4835 {"google.com",S_OK},
4836 {"http://google.com/test/test",S_OK},
4837 {"google.com",S_OK},
4840 {"google.com",S_OK},
4842 {"/test/test",S_OK},
4843 {"/test/test",S_OK},
4845 {"http://google.com/test/test",S_OK},
4851 {Uri_HOST_DNS,S_OK},
4853 {URL_SCHEME_HTTP,S_OK},
4854 {URLZONE_INVALID,E_NOTIMPL}
4857 { "zip:testing/test",0,S_OK,FALSE,
4859 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4883 {Uri_HOST_UNKNOWN,S_OK},
4885 {URL_SCHEME_UNKNOWN,S_OK},
4886 {URLZONE_INVALID,E_NOTIMPL}
4889 { "http://google.com/",0,S_OK,FALSE,
4893 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4894 {TRUE,FALSE,555,S_OK,FALSE},
4899 {"http://google.com/",S_OK},
4900 {"google.com",S_OK},
4901 {"http://google.com/",S_OK},
4902 {"google.com",S_OK},
4905 {"google.com",S_OK},
4910 {"http://google.com/",S_OK},
4916 {Uri_HOST_DNS,S_OK},
4917 /* Still returns 80, even though earlier the port was disabled. */
4919 {URL_SCHEME_HTTP,S_OK},
4920 {URLZONE_INVALID,E_NOTIMPL}
4923 { "http://google.com/",0,S_OK,FALSE,
4927 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4928 * you'll get 122345 instead.
4930 {TRUE,122345,222,S_OK,FALSE},
4935 {"http://google.com:222/",S_OK},
4936 {"google.com:222",S_OK},
4937 {"http://google.com:222/",S_OK},
4938 {"google.com",S_OK},
4941 {"google.com",S_OK},
4946 {"http://google.com:222/",S_OK},
4952 {Uri_HOST_DNS,S_OK},
4954 {URL_SCHEME_HTTP,S_OK},
4955 {URLZONE_INVALID,E_NOTIMPL}
4958 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
4959 { "http://google.com/",0,S_OK,FALSE,
4963 {TRUE,TRUE,999999,S_OK,FALSE},
4968 {"http://google.com:999999/",S_OK},
4969 {"google.com:999999",S_OK},
4970 {"http://google.com:999999/",S_OK},
4971 {"google.com",S_OK},
4974 {"google.com",S_OK},
4979 {"http://google.com:999999/",S_OK},
4985 {Uri_HOST_DNS,S_OK},
4987 {URL_SCHEME_HTTP,S_OK},
4988 {URLZONE_INVALID,E_NOTIMPL}
4991 { "http://google.com/",0,S_OK,FALSE,
4993 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5001 {"http://google.com/?test",S_OK},
5002 {"google.com",S_OK},
5003 {"http://google.com/?test",S_OK},
5004 {"google.com",S_OK},
5007 {"google.com",S_OK},
5012 {"http://google.com/?test",S_OK},
5018 {Uri_HOST_DNS,S_OK},
5020 {URL_SCHEME_HTTP,S_OK},
5021 {URLZONE_INVALID,E_NOTIMPL}
5024 { "http://:password@google.com/",0,S_OK,FALSE,
5033 {"http://:password@google.com/",S_OK},
5034 {":password@google.com",S_OK},
5035 {"http://google.com/",S_OK},
5036 {"google.com",S_OK},
5039 {"google.com",S_OK},
5044 {"http://:password@google.com/",S_OK},
5050 {Uri_HOST_DNS,S_OK},
5052 {URL_SCHEME_HTTP,S_OK},
5053 {URLZONE_INVALID,E_NOTIMPL}
5056 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5057 { NULL,0,S_OK,FALSE,
5059 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5060 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5067 {"http://google.com/",S_OK},
5068 {"google.com",S_OK},
5069 {"http://google.com/",S_OK},
5070 {"google.com",S_OK},
5073 {"google.com",S_OK},
5078 {"http://google.com/",S_OK},
5084 {Uri_HOST_DNS,S_OK},
5086 {URL_SCHEME_HTTP,S_OK},
5087 {URLZONE_INVALID,E_NOTIMPL}
5090 /* Can't set the scheme name to NULL. */
5091 { "zip://google.com/",0,S_OK,FALSE,
5093 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5100 {"zip://google.com/",S_OK},
5101 {"google.com",S_OK},
5102 {"zip://google.com/",S_OK},
5103 {"google.com",S_OK},
5106 {"google.com",S_OK},
5111 {"zip://google.com/",S_OK},
5117 {Uri_HOST_DNS,S_OK},
5119 {URL_SCHEME_UNKNOWN,S_OK},
5120 {URLZONE_INVALID,E_NOTIMPL}
5123 /* Can't set the scheme name to an empty string. */
5124 { "zip://google.com/",0,S_OK,FALSE,
5126 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5133 {"zip://google.com/",S_OK},
5134 {"google.com",S_OK},
5135 {"zip://google.com/",S_OK},
5136 {"google.com",S_OK},
5139 {"google.com",S_OK},
5144 {"zip://google.com/",S_OK},
5150 {Uri_HOST_DNS,S_OK},
5152 {URL_SCHEME_UNKNOWN,S_OK},
5153 {URLZONE_INVALID,E_NOTIMPL}
5156 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5157 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5159 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5164 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5166 {"http://google.com/../../",S_OK},
5167 {"google.com",S_OK},
5168 {"http://google.com/../../",S_OK},
5169 {"google.com",S_OK},
5172 {"google.com",S_OK},
5177 {"http://google.com/../../",S_OK},
5183 {Uri_HOST_DNS,S_OK},
5185 {URL_SCHEME_HTTP,S_OK},
5186 {URLZONE_INVALID,E_NOTIMPL}
5189 { "http://google.com/",0,S_OK,FALSE,
5191 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5196 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5198 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5199 {"google.com",S_OK},
5200 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5201 {"google.com",S_OK},
5203 {"#Fr%3C%7C%3Eg",S_OK},
5204 {"google.com",S_OK},
5209 {"http://google.com/#Fr<|>g",S_OK},
5215 {Uri_HOST_DNS,S_OK},
5217 {URL_SCHEME_HTTP,S_OK},
5218 {URLZONE_INVALID,E_NOTIMPL}
5221 { "http://google.com/",0,S_OK,FALSE,
5223 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5226 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5228 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5230 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5231 {"google.com",S_OK},
5232 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5233 {"google.com",S_OK},
5235 {"#Fr%3C%7C%3Eg",S_OK},
5236 {"google.com",S_OK},
5241 {"http://google.com/#Fr<|>g",S_OK},
5247 {Uri_HOST_DNS,S_OK},
5249 {URL_SCHEME_HTTP,S_OK},
5250 {URLZONE_INVALID,E_NOTIMPL}
5253 { NULL,0,S_OK,FALSE,
5255 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5256 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5259 0,INET_E_INVALID_URL,FALSE,
5260 0,INET_E_INVALID_URL,FALSE,
5261 0,0,0,INET_E_INVALID_URL,FALSE
5263 { "http://google.com/",0,S_OK,FALSE,
5265 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5268 0,INET_E_INVALID_URL,FALSE,
5269 0,INET_E_INVALID_URL,FALSE,
5270 0,0,0,INET_E_INVALID_URL,FALSE
5272 /* File scheme's can't have a username set. */
5273 { "file://google.com/",0,S_OK,FALSE,
5275 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5278 0,INET_E_INVALID_URL,FALSE,
5279 0,INET_E_INVALID_URL,FALSE,
5280 0,0,0,INET_E_INVALID_URL,FALSE
5282 /* File schemes can't have a password set. */
5283 { "file://google.com/",0,S_OK,FALSE,
5285 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5288 0,INET_E_INVALID_URL,FALSE,
5289 0,INET_E_INVALID_URL,FALSE,
5290 0,0,0,INET_E_INVALID_URL,FALSE
5292 /* UserName can't contain any character that is a delimeter for another
5293 * component that appears after it in a normal URI.
5295 { "http://google.com/",0,S_OK,FALSE,
5297 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5300 0,INET_E_INVALID_URL,FALSE,
5301 0,INET_E_INVALID_URL,FALSE,
5302 0,0,0,INET_E_INVALID_URL,FALSE
5304 { "http://google.com/",0,S_OK,FALSE,
5306 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5309 0,INET_E_INVALID_URL,FALSE,
5310 0,INET_E_INVALID_URL,FALSE,
5311 0,0,0,INET_E_INVALID_URL,FALSE
5313 { "http://google.com/",0,S_OK,FALSE,
5315 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5318 0,INET_E_INVALID_URL,FALSE,
5319 0,INET_E_INVALID_URL,FALSE,
5320 0,0,0,INET_E_INVALID_URL,FALSE
5322 { "http://google.com/",0,S_OK,FALSE,
5324 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5327 0,INET_E_INVALID_URL,FALSE,
5328 0,INET_E_INVALID_URL,FALSE,
5329 0,0,0,INET_E_INVALID_URL,FALSE
5331 { "http://google.com/",0,S_OK,FALSE,
5333 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5336 0,INET_E_INVALID_URL,FALSE,
5337 0,INET_E_INVALID_URL,FALSE,
5338 0,0,0,INET_E_INVALID_URL,FALSE
5340 { "http://google.com/",0,S_OK,FALSE,
5342 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5345 0,INET_E_INVALID_URL,FALSE,
5346 0,INET_E_INVALID_URL,FALSE,
5347 0,0,0,INET_E_INVALID_URL,FALSE
5349 { "http://google.com/",0,S_OK,FALSE,
5351 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5354 0,INET_E_INVALID_URL,FALSE,
5355 0,INET_E_INVALID_URL,FALSE,
5356 0,0,0,INET_E_INVALID_URL,FALSE
5358 { "http://google.com/",0,S_OK,FALSE,
5360 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5363 0,INET_E_INVALID_URL,FALSE,
5364 0,INET_E_INVALID_URL,FALSE,
5365 0,0,0,INET_E_INVALID_URL,FALSE
5367 { "http://google.com/",0,S_OK,FALSE,
5369 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5372 0,INET_E_INVALID_URL,FALSE,
5373 0,INET_E_INVALID_URL,FALSE,
5374 0,0,0,INET_E_INVALID_URL,FALSE
5376 { "http://google.com/",0,S_OK,FALSE,
5378 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5381 0,INET_E_INVALID_URL,FALSE,
5382 0,INET_E_INVALID_URL,FALSE,
5383 0,0,0,INET_E_INVALID_URL,FALSE
5385 { "http://google.com/",0,S_OK,FALSE,
5387 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5390 0,INET_E_INVALID_URL,FALSE,
5391 0,INET_E_INVALID_URL,FALSE,
5392 0,0,0,INET_E_INVALID_URL,FALSE
5394 { "http://google.com/",0,S_OK,FALSE,
5396 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5399 0,INET_E_INVALID_URL,FALSE,
5400 0,INET_E_INVALID_URL,FALSE,
5401 0,0,0,INET_E_INVALID_URL,FALSE
5403 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5404 { "http://google.com/",0,S_OK,FALSE,
5406 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5413 {"http://winehq.org:test/",S_OK},
5414 {"winehq.org:test",S_OK},
5415 {"http://winehq.org:test/",S_OK},
5416 {"winehq.org:test",S_OK},
5419 {"winehq.org:test",S_OK},
5424 {"http://winehq.org:test/",S_OK},
5430 {Uri_HOST_DNS,S_OK},
5432 {URL_SCHEME_HTTP,S_OK},
5433 {URLZONE_INVALID,E_NOTIMPL}
5436 /* Can't set the host name to NULL. */
5437 { "http://google.com/",0,S_OK,FALSE,
5439 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5446 {"http://google.com/",S_OK},
5447 {"google.com",S_OK},
5448 {"http://google.com/",S_OK},
5449 {"google.com",S_OK},
5452 {"google.com",S_OK},
5457 {"http://google.com/",S_OK},
5463 {Uri_HOST_DNS,S_OK},
5465 {URL_SCHEME_HTTP,S_OK},
5466 {URLZONE_INVALID,E_NOTIMPL}
5469 /* Can set the host name to an empty string. */
5470 { "http://google.com/",0,S_OK,FALSE,
5472 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5496 {Uri_HOST_UNKNOWN,S_OK},
5498 {URL_SCHEME_HTTP,S_OK},
5499 {URLZONE_INVALID,E_NOTIMPL}
5502 { "http://google.com/",0,S_OK,FALSE,
5504 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5507 0,INET_E_INVALID_URL,FALSE,
5508 0,INET_E_INVALID_URL,FALSE,
5509 0,0,0,INET_E_INVALID_URL,FALSE
5511 { "http://google.com/",0,S_OK,FALSE,
5513 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5516 0,INET_E_INVALID_URL,FALSE,
5517 0,INET_E_INVALID_URL,FALSE,
5518 0,0,0,INET_E_INVALID_URL,FALSE
5520 { "http://google.com/",0,S_OK,FALSE,
5522 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5525 0,INET_E_INVALID_URL,FALSE,
5526 0,INET_E_INVALID_URL,FALSE,
5527 0,0,0,INET_E_INVALID_URL,FALSE
5529 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5531 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5538 {"file:///c:/dir/file.html",S_OK},
5540 {"file:///c:/dir/file.html",S_OK},
5546 {"/c:/dir/file.html",S_OK},
5547 {"/c:/dir/file.html",S_OK},
5549 {"file:///c:/dir/file.html",S_OK},
5555 {Uri_HOST_UNKNOWN,S_OK},
5557 {URL_SCHEME_FILE,S_OK},
5558 {URLZONE_INVALID,E_NOTIMPL}
5561 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5563 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5570 {"file:///c:/dir/file.html#",S_OK},
5572 {"file:///c:/dir/file.html#",S_OK},
5578 {"/c:/dir/file.html",S_OK},
5579 {"/c:/dir/file.html",S_OK},
5581 {"file:///c:/dir/file.html#",S_OK},
5587 {Uri_HOST_UNKNOWN,S_OK},
5589 {URL_SCHEME_FILE,S_OK},
5590 {URLZONE_INVALID,E_NOTIMPL}
5595 typedef struct _uri_builder_remove_test {
5598 HRESULT create_builder_expected;
5599 BOOL create_builder_todo;
5601 DWORD remove_properties;
5602 HRESULT remove_expected;
5605 const char *expected_uri;
5606 DWORD expected_flags;
5607 HRESULT expected_hres;
5609 } uri_builder_remove_test;
5611 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5612 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5613 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5614 "http://google.com/",0,S_OK,FALSE
5616 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5617 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5618 "http://winehq.org/",0,S_OK,FALSE
5620 { "zip://google.com?Test=x",0,S_OK,FALSE,
5621 Uri_HAS_HOST,S_OK,FALSE,
5622 "zip:/?Test=x",0,S_OK,FALSE
5624 /* Doesn't remove the whole userinfo component. */
5625 { "http://username:pass@google.com/",0,S_OK,FALSE,
5626 Uri_HAS_USER_INFO,S_OK,FALSE,
5627 "http://username:pass@google.com/",0,S_OK,FALSE
5629 /* Doesn't remove the domain. */
5630 { "http://google.com/",0,S_OK,FALSE,
5631 Uri_HAS_DOMAIN,S_OK,FALSE,
5632 "http://google.com/",0,S_OK,FALSE
5634 { "http://google.com:120/",0,S_OK,FALSE,
5635 Uri_HAS_AUTHORITY,S_OK,FALSE,
5636 "http://google.com:120/",0,S_OK,FALSE
5638 { "http://google.com/test.com/",0,S_OK,FALSE,
5639 Uri_HAS_EXTENSION,S_OK,FALSE,
5640 "http://google.com/test.com/",0,S_OK,FALSE
5642 { "http://google.com/?test=x",0,S_OK,FALSE,
5643 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5644 "http://google.com/?test=x",0,S_OK,FALSE
5646 /* Can't remove the scheme name. */
5647 { "http://google.com/?test=x",0,S_OK,FALSE,
5648 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5649 "http://google.com/?test=x",0,S_OK,FALSE
5653 typedef struct _uri_combine_str_property {
5657 const char *broken_value;
5658 const char *value_ex;
5659 } uri_combine_str_property;
5661 typedef struct _uri_combine_test {
5662 const char *base_uri;
5663 DWORD base_create_flags;
5664 const char *relative_uri;
5665 DWORD relative_create_flags;
5666 DWORD combine_flags;
5670 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5671 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5674 static const uri_combine_test uri_combine_tests[] = {
5675 { "http://google.com/fun/stuff",0,
5676 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5679 {"http://google.com/not/fun/stuff",S_OK},
5680 {"google.com",S_OK},
5681 {"http://google.com/not/fun/stuff",S_OK},
5682 {"google.com",S_OK},
5685 {"google.com",S_OK},
5687 {"/not/fun/stuff",S_OK},
5688 {"/not/fun/stuff",S_OK},
5690 {"http://google.com/not/fun/stuff",S_OK},
5696 {Uri_HOST_DNS,S_OK},
5698 {URL_SCHEME_HTTP,S_OK},
5699 {URLZONE_INVALID,E_NOTIMPL}
5702 { "http://google.com/test",0,
5703 "zip://test.com/cool",0,
5706 {"zip://test.com/cool",S_OK},
5708 {"zip://test.com/cool",S_OK},
5717 {"zip://test.com/cool",S_OK},
5723 {Uri_HOST_DNS,S_OK},
5725 {URL_SCHEME_UNKNOWN,S_OK},
5726 {URLZONE_INVALID,E_NOTIMPL}
5729 { "http://google.com/use/base/path",0,
5730 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5733 {"http://google.com/use/base/path?relative",S_OK},
5734 {"google.com",S_OK},
5735 {"http://google.com/use/base/path?relative",S_OK},
5736 {"google.com",S_OK},
5739 {"google.com",S_OK},
5741 {"/use/base/path",S_OK},
5742 {"/use/base/path?relative",S_OK},
5744 {"http://google.com/use/base/path?relative",S_OK},
5750 {Uri_HOST_DNS,S_OK},
5752 {URL_SCHEME_HTTP,S_OK},
5753 {URLZONE_INVALID,E_NOTIMPL}
5756 { "http://google.com/path",0,
5757 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5760 {"http://google.com/testing",S_OK},
5761 {"google.com",S_OK},
5762 {"http://google.com/testing",S_OK},
5763 {"google.com",S_OK},
5766 {"google.com",S_OK},
5771 {"http://google.com/testing",S_OK},
5777 {Uri_HOST_DNS,S_OK},
5779 {URL_SCHEME_HTTP,S_OK},
5780 {URLZONE_INVALID,E_NOTIMPL}
5783 { "http://google.com/path",0,
5784 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5785 URL_DONT_SIMPLIFY,S_OK,FALSE,
5787 {"http://google.com:80/test/../test/.././testing",S_OK},
5788 {"google.com",S_OK},
5789 {"http://google.com:80/test/../test/.././testing",S_OK},
5790 {"google.com",S_OK},
5793 {"google.com",S_OK},
5795 {"/test/../test/.././testing",S_OK},
5796 {"/test/../test/.././testing",S_OK},
5798 {"http://google.com:80/test/../test/.././testing",S_OK},
5804 {Uri_HOST_DNS,S_OK},
5806 {URL_SCHEME_HTTP,S_OK},
5807 {URLZONE_INVALID,E_NOTIMPL}
5810 { "http://winehq.org/test/abc",0,
5811 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5814 {"http://winehq.org/test/testing/test",S_OK},
5815 {"winehq.org",S_OK},
5816 {"http://winehq.org/test/testing/test",S_OK},
5817 {"winehq.org",S_OK},
5820 {"winehq.org",S_OK},
5822 {"/test/testing/test",S_OK},
5823 {"/test/testing/test",S_OK},
5825 {"http://winehq.org/test/testing/test",S_OK},
5831 {Uri_HOST_DNS,S_OK},
5833 {URL_SCHEME_HTTP,S_OK},
5834 {URLZONE_INVALID,E_NOTIMPL}
5837 { "http://winehq.org/test/abc",0,
5838 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5839 URL_DONT_SIMPLIFY,S_OK,FALSE,
5841 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5842 /* Default port is hidden in the authority. */
5843 {"winehq.org",S_OK},
5844 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5845 {"winehq.org",S_OK},
5848 {"winehq.org",S_OK},
5850 {"/test/testing/abc/../test",S_OK},
5851 {"/test/testing/abc/../test",S_OK},
5853 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5859 {Uri_HOST_DNS,S_OK},
5861 {URL_SCHEME_HTTP,S_OK},
5862 {URLZONE_INVALID,E_NOTIMPL}
5865 { "http://winehq.org/test?query",0,
5866 "testing",Uri_CREATE_ALLOW_RELATIVE,
5869 {"http://winehq.org/testing",S_OK},
5870 {"winehq.org",S_OK},
5871 {"http://winehq.org/testing",S_OK},
5872 {"winehq.org",S_OK},
5875 {"winehq.org",S_OK},
5880 {"http://winehq.org/testing",S_OK},
5886 {Uri_HOST_DNS,S_OK},
5888 {URL_SCHEME_HTTP,S_OK},
5889 {URLZONE_INVALID,E_NOTIMPL}
5892 { "http://winehq.org/test#frag",0,
5893 "testing",Uri_CREATE_ALLOW_RELATIVE,
5896 {"http://winehq.org/testing",S_OK},
5897 {"winehq.org",S_OK},
5898 {"http://winehq.org/testing",S_OK},
5899 {"winehq.org",S_OK},
5902 {"winehq.org",S_OK},
5907 {"http://winehq.org/testing",S_OK},
5913 {Uri_HOST_DNS,S_OK},
5915 {URL_SCHEME_HTTP,S_OK},
5916 {URLZONE_INVALID,E_NOTIMPL}
5919 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5920 "test",Uri_CREATE_ALLOW_RELATIVE,
5940 {Uri_HOST_UNKNOWN,S_OK},
5942 {URL_SCHEME_UNKNOWN,S_OK},
5943 {URLZONE_INVALID,E_NOTIMPL}
5946 { "file:///c:/test/test",0,
5947 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5948 URL_FILE_USE_PATHURL,S_OK,FALSE,
5950 {"file://c:\\testing.mp3",S_OK},
5952 {"file://c:\\testing.mp3",S_OK},
5958 {"c:\\testing.mp3",S_OK},
5959 {"c:\\testing.mp3",S_OK},
5961 {"file://c:\\testing.mp3",S_OK},
5967 {Uri_HOST_UNKNOWN,S_OK},
5969 {URL_SCHEME_FILE,S_OK},
5970 {URLZONE_INVALID,E_NOTIMPL}
5973 { "file:///c:/test/test",0,
5974 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5977 {"file:///c:/testing.mp3",S_OK},
5979 {"file:///c:/testing.mp3",S_OK},
5985 {"/c:/testing.mp3",S_OK},
5986 {"/c:/testing.mp3",S_OK},
5988 {"file:///c:/testing.mp3",S_OK},
5994 {Uri_HOST_UNKNOWN,S_OK},
5996 {URL_SCHEME_FILE,S_OK},
5997 {URLZONE_INVALID,E_NOTIMPL}
6000 { "file://test.com/test/test",0,
6001 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6002 URL_FILE_USE_PATHURL,S_OK,FALSE,
6004 {"file://\\\\test.com\\testing.mp3",S_OK},
6006 {"file://\\\\test.com\\testing.mp3",S_OK},
6012 {"\\testing.mp3",S_OK},
6013 {"\\testing.mp3",S_OK},
6015 {"file://\\\\test.com\\testing.mp3",S_OK},
6021 {Uri_HOST_DNS,S_OK},
6023 {URL_SCHEME_FILE,S_OK},
6024 {URLZONE_INVALID,E_NOTIMPL}
6027 /* URL_DONT_SIMPLIFY has no effect. */
6028 { "http://google.com/test",0,
6029 "zip://test.com/cool/../cool/test",0,
6030 URL_DONT_SIMPLIFY,S_OK,FALSE,
6032 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6034 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6040 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6041 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6043 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6044 * On IE 7 it reduces the path in the Raw URI.
6046 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6052 {Uri_HOST_DNS,S_OK},
6054 {URL_SCHEME_UNKNOWN,S_OK},
6055 {URLZONE_INVALID,E_NOTIMPL}
6058 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6059 * resulting URI is converted into a dos path.
6061 { "http://google.com/test",0,
6062 "file:///c:/test/",0,
6063 URL_FILE_USE_PATHURL,S_OK,FALSE,
6065 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6067 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6073 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6074 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6076 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6082 {Uri_HOST_UNKNOWN,S_OK},
6084 {URL_SCHEME_FILE,S_OK},
6085 {URLZONE_INVALID,E_NOTIMPL}
6088 { "http://google.com/test",0,
6089 "http://test.com/test#%30test",0,
6090 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6092 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6094 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6097 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6103 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6104 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6110 {Uri_HOST_DNS,S_OK},
6112 {URL_SCHEME_HTTP,S_OK},
6113 {URLZONE_INVALID,E_NOTIMPL}
6116 /* Windows validates the path component from the relative Uri. */
6117 { "http://google.com/test",0,
6118 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6119 0,E_INVALIDARG,FALSE
6121 /* Windows doesn't validate the query from the relative Uri. */
6122 { "http://google.com/test",0,
6123 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6126 {"http://google.com/test?Tes%XXt",S_OK},
6127 {"google.com",S_OK},
6128 {"http://google.com/test?Tes%XXt",S_OK},
6129 {"google.com",S_OK},
6132 {"google.com",S_OK},
6135 {"/test?Tes%XXt",S_OK},
6137 {"http://google.com/test?Tes%XXt",S_OK},
6143 {Uri_HOST_DNS,S_OK},
6145 {URL_SCHEME_HTTP,S_OK},
6146 {URLZONE_INVALID,E_NOTIMPL}
6149 /* Windows doesn't validate the fragment from the relative Uri. */
6150 { "http://google.com/test",0,
6151 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6154 {"http://google.com/test#Tes%XXt",S_OK},
6155 {"google.com",S_OK},
6156 {"http://google.com/test#Tes%XXt",S_OK},
6157 {"google.com",S_OK},
6160 {"google.com",S_OK},
6165 {"http://google.com/test#Tes%XXt",S_OK},
6171 {Uri_HOST_DNS,S_OK},
6173 {URL_SCHEME_HTTP,S_OK},
6174 {URLZONE_INVALID,E_NOTIMPL}
6177 /* Creates an IUri which contains an invalid dos path char. */
6178 { "file:///c:/test",0,
6179 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6180 URL_FILE_USE_PATHURL,S_OK,FALSE,
6182 {"file://c:\\test<ing",S_OK},
6184 {"file://c:\\test<ing",S_OK},
6190 {"c:\\test<ing",S_OK},
6191 {"c:\\test<ing",S_OK},
6193 {"file://c:\\test<ing",S_OK},
6199 {Uri_HOST_UNKNOWN,S_OK},
6201 {URL_SCHEME_FILE,S_OK},
6202 {URLZONE_INVALID,E_NOTIMPL}
6205 /* Appends the path after the drive letter (if any). */
6206 { "file:///c:/test",0,
6207 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6210 {"file:///c:/c:/testing",S_OK},
6212 {"file:///c:/c:/testing",S_OK},
6218 {"/c:/c:/testing",S_OK},
6219 {"/c:/c:/testing",S_OK},
6221 {"file:///c:/c:/testing",S_OK},
6227 {Uri_HOST_UNKNOWN,S_OK},
6229 {URL_SCHEME_FILE,S_OK},
6230 {URLZONE_INVALID,E_NOTIMPL}
6233 /* A '/' is added if the base URI doesn't have a path and the
6234 * relative URI doesn't contain a path (since the base URI is
6237 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6238 "?test",Uri_CREATE_ALLOW_RELATIVE,
6241 {"http://google.com/?test",S_OK},
6242 {"google.com",S_OK},
6243 {"http://google.com/?test",S_OK},
6244 {"google.com",S_OK},
6247 {"google.com",S_OK},
6252 {"http://google.com/?test",S_OK},
6258 {Uri_HOST_DNS,S_OK},
6260 {URL_SCHEME_HTTP,S_OK},
6261 {URLZONE_INVALID,E_NOTIMPL}
6264 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6265 "?test",Uri_CREATE_ALLOW_RELATIVE,
6268 {"zip://google.com/?test",S_OK},
6269 {"google.com",S_OK},
6270 {"zip://google.com/?test",S_OK},
6271 {"google.com",S_OK},
6274 {"google.com",S_OK},
6279 {"zip://google.com/?test",S_OK},
6285 {Uri_HOST_DNS,S_OK},
6287 {URL_SCHEME_UNKNOWN,S_OK},
6288 {URLZONE_INVALID,E_NOTIMPL}
6291 /* No path is appended since the base URI is opaque. */
6293 "?test",Uri_CREATE_ALLOW_RELATIVE,
6313 {Uri_HOST_UNKNOWN,S_OK},
6315 {URL_SCHEME_UNKNOWN,S_OK},
6316 {URLZONE_INVALID,E_NOTIMPL}
6320 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6323 {"file:///c:/testing/test",S_OK},
6325 {"file:///c:/testing/test",S_OK},
6331 {"/c:/testing/test",S_OK},
6332 {"/c:/testing/test",S_OK},
6334 {"file:///c:/testing/test",S_OK},
6340 {Uri_HOST_UNKNOWN,S_OK},
6342 {URL_SCHEME_FILE,S_OK},
6343 {URLZONE_INVALID,E_NOTIMPL}
6346 { "http://winehq.org/dir/testfile",0,
6347 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6350 {"http://winehq.org/dir/test?querystring",S_OK},
6351 {"winehq.org",S_OK},
6352 {"http://winehq.org/dir/test?querystring",S_OK},
6353 {"winehq.org",S_OK},
6356 {"winehq.org",S_OK},
6359 {"/dir/test?querystring",S_OK},
6360 {"?querystring",S_OK},
6361 {"http://winehq.org/dir/test?querystring",S_OK},
6367 {Uri_HOST_DNS,S_OK},
6369 {URL_SCHEME_HTTP,S_OK},
6370 {URLZONE_INVALID,E_NOTIMPL}
6373 { "http://winehq.org/dir/test",0,
6374 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6377 {"http://winehq.org/dir/test?querystring",S_OK},
6378 {"winehq.org",S_OK},
6379 {"http://winehq.org/dir/test?querystring",S_OK},
6380 {"winehq.org",S_OK},
6383 {"winehq.org",S_OK},
6386 {"/dir/test?querystring",S_OK},
6387 {"?querystring",S_OK},
6388 {"http://winehq.org/dir/test?querystring",S_OK},
6394 {Uri_HOST_DNS,S_OK},
6396 {URL_SCHEME_HTTP,S_OK},
6397 {URLZONE_INVALID,E_NOTIMPL}
6400 { "http://winehq.org/dir/test?querystring",0,
6401 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6404 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6405 {"winehq.org",S_OK},
6406 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6407 {"winehq.org",S_OK},
6410 {"winehq.org",S_OK},
6413 {"/dir/test?querystring",S_OK},
6414 {"?querystring",S_OK},
6415 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6421 {Uri_HOST_DNS,S_OK},
6423 {URL_SCHEME_HTTP,S_OK},
6424 {URLZONE_INVALID,E_NOTIMPL}
6427 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6428 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6431 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6433 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6439 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6440 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6442 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6448 {Uri_HOST_UNKNOWN,S_OK},
6450 {URL_SCHEME_MK,S_OK},
6451 {URLZONE_INVALID,E_NOTIMPL}
6454 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6455 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6458 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6460 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6466 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6467 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6469 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6475 {Uri_HOST_UNKNOWN,S_OK},
6477 {URL_SCHEME_MK,S_OK},
6478 {URLZONE_INVALID,E_NOTIMPL}
6481 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6482 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6485 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6487 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6493 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6494 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6496 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6502 {Uri_HOST_UNKNOWN,S_OK},
6504 {URL_SCHEME_MK,S_OK},
6505 {URLZONE_INVALID,E_NOTIMPL}
6510 typedef struct _uri_parse_test {
6515 const char *property;
6520 static const uri_parse_test uri_parse_tests[] = {
6521 /* PARSE_CANONICALIZE tests. */
6522 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6523 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6524 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6525 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6526 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6527 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6528 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6529 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6530 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6531 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6532 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6533 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6535 /* PARSE_FRIENDLY tests. */
6536 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6537 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6539 /* PARSE_ROOTDOCUMENT tests. */
6540 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6541 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6542 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6543 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6544 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6545 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6547 /* PARSE_DOCUMENT tests. */
6548 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6549 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6550 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6551 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6552 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6553 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6555 /* PARSE_PATH_FROM_URL tests. */
6556 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6557 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6558 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6559 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6560 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6562 /* PARSE_URL_FROM_PATH tests. */
6563 /* This function almost seems to useless (just returns the absolute uri). */
6564 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6565 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6566 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6567 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6568 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6570 /* PARSE_SCHEMA tests. */
6571 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6572 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6574 /* PARSE_SITE tests. */
6575 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6576 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6577 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6578 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6580 /* PARSE_DOMAIN tests. */
6581 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6582 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6583 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6584 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6586 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6587 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6588 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6589 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6590 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6593 static inline LPWSTR a2w(LPCSTR str) {
6597 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6598 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6599 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6605 static inline BOOL heap_free(void* mem) {
6606 return HeapFree(GetProcessHeap(), 0, mem);
6609 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6610 LPWSTR strAW = a2w(strA);
6611 DWORD ret = lstrcmpW(strAW, strB);
6616 static inline ULONG get_refcnt(IUri *uri) {
6618 return IUri_Release(uri);
6621 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6626 valueW = a2w(prop->value);
6627 switch(prop->property) {
6628 case Uri_PROPERTY_FRAGMENT:
6629 hr = IUriBuilder_SetFragment(builder, valueW);
6632 ok(hr == prop->expected,
6633 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6634 hr, prop->expected, test_index);
6637 ok(hr == prop->expected,
6638 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6639 hr, prop->expected, test_index);
6642 case Uri_PROPERTY_HOST:
6643 hr = IUriBuilder_SetHost(builder, valueW);
6646 ok(hr == prop->expected,
6647 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6648 hr, prop->expected, test_index);
6651 ok(hr == prop->expected,
6652 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6653 hr, prop->expected, test_index);
6656 case Uri_PROPERTY_PASSWORD:
6657 hr = IUriBuilder_SetPassword(builder, valueW);
6660 ok(hr == prop->expected,
6661 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6662 hr, prop->expected, test_index);
6665 ok(hr == prop->expected,
6666 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6667 hr, prop->expected, test_index);
6670 case Uri_PROPERTY_PATH:
6671 hr = IUriBuilder_SetPath(builder, valueW);
6674 ok(hr == prop->expected,
6675 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6676 hr, prop->expected, test_index);
6679 ok(hr == prop->expected,
6680 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6681 hr, prop->expected, test_index);
6684 case Uri_PROPERTY_QUERY:
6685 hr = IUriBuilder_SetQuery(builder, valueW);
6688 ok(hr == prop->expected,
6689 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6690 hr, prop->expected, test_index);
6693 ok(hr == prop->expected,
6694 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6695 hr, prop->expected, test_index);
6698 case Uri_PROPERTY_SCHEME_NAME:
6699 hr = IUriBuilder_SetSchemeName(builder, valueW);
6702 ok(hr == prop->expected,
6703 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6704 hr, prop->expected, test_index);
6707 ok(hr == prop->expected,
6708 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6709 hr, prop->expected, test_index);
6712 case Uri_PROPERTY_USER_NAME:
6713 hr = IUriBuilder_SetUserName(builder, valueW);
6716 ok(hr == prop->expected,
6717 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6718 hr, prop->expected, test_index);
6721 ok(hr == prop->expected,
6722 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6723 hr, prop->expected, test_index);
6727 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6734 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6737 static void test_CreateUri_InvalidFlags(void) {
6740 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6742 IUri *uri = (void*) 0xdeadbeef;
6744 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6745 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6746 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6747 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6751 static void test_CreateUri_InvalidArgs(void) {
6753 IUri *uri = (void*) 0xdeadbeef;
6755 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6756 static const WCHAR emptyW[] = {0};
6758 hr = pCreateUri(http_urlW, 0, 0, NULL);
6759 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6761 hr = pCreateUri(NULL, 0, 0, &uri);
6762 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6763 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6765 uri = (void*) 0xdeadbeef;
6766 hr = pCreateUri(invalidW, 0, 0, &uri);
6767 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6768 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6770 uri = (void*) 0xdeadbeef;
6771 hr = pCreateUri(emptyW, 0, 0, &uri);
6772 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6773 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6776 static void test_CreateUri_InvalidUri(void) {
6779 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6780 invalid_uri test = invalid_uri_tests[i];
6785 uriW = a2w(test.uri);
6786 hr = pCreateUri(uriW, test.flags, 0, &uri);
6789 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6790 hr, E_INVALIDARG, i);
6793 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6794 hr, E_INVALIDARG, i);
6796 if(uri) IUri_Release(uri);
6802 static void test_IUri_GetPropertyBSTR(void) {
6807 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6808 hr = pCreateUri(http_urlW, 0, 0, &uri);
6809 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6811 BSTR received = NULL;
6813 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6814 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6816 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6817 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6818 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6819 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6820 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6821 SysFreeString(received);
6823 /* Make sure it handles the ZONE property correctly. */
6825 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6826 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6827 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6828 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6829 SysFreeString(received);
6831 if(uri) IUri_Release(uri);
6833 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6834 uri_properties test = uri_tests[i];
6838 uriW = a2w(test.uri);
6839 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6840 if(test.create_todo) {
6842 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6843 hr, test.create_expected, i);
6846 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6847 hr, test.create_expected, i);
6853 /* Checks all the string properties of the uri. */
6854 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6855 BSTR received = NULL;
6856 uri_str_property prop = test.str_props[j];
6858 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6861 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6862 hr, prop.expected, i, j);
6865 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6866 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6867 prop.value, wine_dbgstr_w(received), i, j);
6870 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6871 hr, prop.expected, i, j);
6872 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6873 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6874 prop.value, wine_dbgstr_w(received), i, j);
6877 SysFreeString(received);
6881 if(uri) IUri_Release(uri);
6887 static void test_IUri_GetPropertyDWORD(void) {
6892 hr = pCreateUri(http_urlW, 0, 0, &uri);
6893 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6895 DWORD received = 0xdeadbeef;
6897 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6898 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6900 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6901 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6902 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6904 if(uri) IUri_Release(uri);
6906 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6907 uri_properties test = uri_tests[i];
6911 uriW = a2w(test.uri);
6912 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6913 if(test.create_todo) {
6915 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6916 hr, test.create_expected, i);
6919 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6920 hr, test.create_expected, i);
6926 /* Checks all the DWORD properties of the uri. */
6927 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6929 uri_dword_property prop = test.dword_props[j];
6931 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6934 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6935 hr, prop.expected, i, j);
6938 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6939 prop.value, received, i, j);
6942 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6943 hr, prop.expected, i, j);
6944 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6945 prop.value, received, i, j);
6950 if(uri) IUri_Release(uri);
6956 /* Tests all the 'Get*' property functions which deal with strings. */
6957 static void test_IUri_GetStrProperties(void) {
6962 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6963 hr = pCreateUri(http_urlW, 0, 0, &uri);
6964 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6966 hr = IUri_GetAbsoluteUri(uri, NULL);
6967 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6969 hr = IUri_GetAuthority(uri, NULL);
6970 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6972 hr = IUri_GetDisplayUri(uri, NULL);
6973 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6975 hr = IUri_GetDomain(uri, NULL);
6976 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6978 hr = IUri_GetExtension(uri, NULL);
6979 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6981 hr = IUri_GetFragment(uri, NULL);
6982 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6984 hr = IUri_GetHost(uri, NULL);
6985 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6987 hr = IUri_GetPassword(uri, NULL);
6988 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6990 hr = IUri_GetPath(uri, NULL);
6991 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6993 hr = IUri_GetPathAndQuery(uri, NULL);
6994 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6996 hr = IUri_GetQuery(uri, NULL);
6997 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6999 hr = IUri_GetRawUri(uri, NULL);
7000 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7002 hr = IUri_GetSchemeName(uri, NULL);
7003 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7005 hr = IUri_GetUserInfo(uri, NULL);
7006 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7008 hr = IUri_GetUserName(uri, NULL);
7009 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7011 if(uri) IUri_Release(uri);
7013 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7014 uri_properties test = uri_tests[i];
7018 uriW = a2w(test.uri);
7019 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7020 if(test.create_todo) {
7022 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7023 hr, test.create_expected, i);
7026 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7027 hr, test.create_expected, i);
7031 uri_str_property prop;
7032 BSTR received = NULL;
7034 /* GetAbsoluteUri() tests. */
7035 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7036 hr = IUri_GetAbsoluteUri(uri, &received);
7039 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7040 hr, prop.expected, i);
7043 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7044 "Error: Expected %s but got %s on uri_tests[%d].\n",
7045 prop.value, wine_dbgstr_w(received), i);
7048 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7049 hr, prop.expected, i);
7050 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7051 "Error: Expected %s but got %s on uri_tests[%d].\n",
7052 prop.value, wine_dbgstr_w(received), i);
7054 SysFreeString(received);
7057 /* GetAuthority() tests. */
7058 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7059 hr = IUri_GetAuthority(uri, &received);
7062 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7063 hr, prop.expected, i);
7066 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7067 prop.value, wine_dbgstr_w(received), i);
7070 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7071 hr, prop.expected, i);
7072 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7073 prop.value, wine_dbgstr_w(received), i);
7075 SysFreeString(received);
7078 /* GetDisplayUri() tests. */
7079 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7080 hr = IUri_GetDisplayUri(uri, &received);
7083 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7084 hr, prop.expected, i);
7087 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7088 "Error: Expected %s but got %s on uri_test[%d].\n",
7089 prop.value, wine_dbgstr_w(received), i);
7092 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7093 hr, prop.expected, i);
7094 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7095 "Error: Expected %s but got %s on uri_tests[%d].\n",
7096 prop.value, wine_dbgstr_w(received), i);
7098 SysFreeString(received);
7101 /* GetDomain() tests. */
7102 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7103 hr = IUri_GetDomain(uri, &received);
7106 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7107 hr, prop.expected, i);
7110 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7111 prop.value, wine_dbgstr_w(received), i);
7114 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7115 hr, prop.expected, i);
7116 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7117 prop.value, wine_dbgstr_w(received), i);
7119 SysFreeString(received);
7122 /* GetExtension() tests. */
7123 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7124 hr = IUri_GetExtension(uri, &received);
7127 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7128 hr, prop.expected, i);
7131 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7132 prop.value, wine_dbgstr_w(received), i);
7135 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7136 hr, prop.expected, i);
7137 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7138 prop.value, wine_dbgstr_w(received), i);
7140 SysFreeString(received);
7143 /* GetFragment() tests. */
7144 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7145 hr = IUri_GetFragment(uri, &received);
7148 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7149 hr, prop.expected, i);
7152 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7153 prop.value, wine_dbgstr_w(received), i);
7156 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7157 hr, prop.expected, i);
7158 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7159 prop.value, wine_dbgstr_w(received), i);
7161 SysFreeString(received);
7164 /* GetHost() tests. */
7165 prop = test.str_props[Uri_PROPERTY_HOST];
7166 hr = IUri_GetHost(uri, &received);
7169 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7170 hr, prop.expected, i);
7173 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7174 prop.value, wine_dbgstr_w(received), i);
7177 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7178 hr, prop.expected, i);
7179 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7180 prop.value, wine_dbgstr_w(received), i);
7182 SysFreeString(received);
7185 /* GetPassword() tests. */
7186 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7187 hr = IUri_GetPassword(uri, &received);
7190 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7191 hr, prop.expected, i);
7194 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7195 prop.value, wine_dbgstr_w(received), i);
7198 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7199 hr, prop.expected, i);
7200 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7201 prop.value, wine_dbgstr_w(received), i);
7203 SysFreeString(received);
7206 /* GetPath() tests. */
7207 prop = test.str_props[Uri_PROPERTY_PATH];
7208 hr = IUri_GetPath(uri, &received);
7211 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7212 hr, prop.expected, i);
7215 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7216 prop.value, wine_dbgstr_w(received), i);
7219 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7220 hr, prop.expected, i);
7221 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7222 prop.value, wine_dbgstr_w(received), i);
7224 SysFreeString(received);
7227 /* GetPathAndQuery() tests. */
7228 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7229 hr = IUri_GetPathAndQuery(uri, &received);
7232 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7233 hr, prop.expected, i);
7236 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7237 prop.value, wine_dbgstr_w(received), i);
7240 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7241 hr, prop.expected, i);
7242 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7243 prop.value, wine_dbgstr_w(received), i);
7245 SysFreeString(received);
7248 /* GetQuery() tests. */
7249 prop = test.str_props[Uri_PROPERTY_QUERY];
7250 hr = IUri_GetQuery(uri, &received);
7253 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7254 hr, prop.expected, i);
7257 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7258 prop.value, wine_dbgstr_w(received), i);
7261 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7262 hr, prop.expected, i);
7263 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7264 prop.value, wine_dbgstr_w(received), i);
7266 SysFreeString(received);
7269 /* GetRawUri() tests. */
7270 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7271 hr = IUri_GetRawUri(uri, &received);
7274 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7275 hr, prop.expected, i);
7278 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7279 prop.value, wine_dbgstr_w(received), i);
7282 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7283 hr, prop.expected, i);
7284 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7285 prop.value, wine_dbgstr_w(received), i);
7287 SysFreeString(received);
7290 /* GetSchemeName() tests. */
7291 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7292 hr = IUri_GetSchemeName(uri, &received);
7295 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7296 hr, prop.expected, i);
7299 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7300 prop.value, wine_dbgstr_w(received), i);
7303 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7304 hr, prop.expected, i);
7305 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7306 prop.value, wine_dbgstr_w(received), i);
7308 SysFreeString(received);
7311 /* GetUserInfo() tests. */
7312 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7313 hr = IUri_GetUserInfo(uri, &received);
7316 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7317 hr, prop.expected, i);
7320 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7321 prop.value, wine_dbgstr_w(received), i);
7324 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7325 hr, prop.expected, i);
7326 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7327 prop.value, wine_dbgstr_w(received), i);
7329 SysFreeString(received);
7332 /* GetUserName() tests. */
7333 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7334 hr = IUri_GetUserName(uri, &received);
7337 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7338 hr, prop.expected, i);
7341 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7342 prop.value, wine_dbgstr_w(received), i);
7345 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7346 hr, prop.expected, i);
7347 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7348 prop.value, wine_dbgstr_w(received), i);
7350 SysFreeString(received);
7353 if(uri) IUri_Release(uri);
7359 static void test_IUri_GetDwordProperties(void) {
7364 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7365 hr = pCreateUri(http_urlW, 0, 0, &uri);
7366 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7368 hr = IUri_GetHostType(uri, NULL);
7369 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7371 hr = IUri_GetPort(uri, NULL);
7372 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7374 hr = IUri_GetScheme(uri, NULL);
7375 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7377 hr = IUri_GetZone(uri, NULL);
7378 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7380 if(uri) IUri_Release(uri);
7382 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7383 uri_properties test = uri_tests[i];
7387 uriW = a2w(test.uri);
7388 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7389 if(test.create_todo) {
7391 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7392 hr, test.create_expected, i);
7395 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7396 hr, test.create_expected, i);
7400 uri_dword_property prop;
7403 /* Assign an insane value so tests don't accidentally pass when
7406 received = -9999999;
7408 /* GetHostType() tests. */
7409 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7410 hr = IUri_GetHostType(uri, &received);
7413 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7414 hr, prop.expected, i);
7417 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7420 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7421 hr, prop.expected, i);
7422 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7424 received = -9999999;
7426 /* GetPort() tests. */
7427 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7428 hr = IUri_GetPort(uri, &received);
7431 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7432 hr, prop.expected, i);
7435 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7438 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7439 hr, prop.expected, i);
7440 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7442 received = -9999999;
7444 /* GetScheme() tests. */
7445 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7446 hr = IUri_GetScheme(uri, &received);
7449 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7450 hr, prop.expected, i);
7453 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7456 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7457 hr, prop.expected, i);
7458 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7460 received = -9999999;
7462 /* GetZone() tests. */
7463 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7464 hr = IUri_GetZone(uri, &received);
7467 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7468 hr, prop.expected, i);
7471 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7474 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7475 hr, prop.expected, i);
7476 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7480 if(uri) IUri_Release(uri);
7486 static void test_IUri_GetPropertyLength(void) {
7491 /* Make sure it handles invalid args correctly. */
7492 hr = pCreateUri(http_urlW, 0, 0, &uri);
7493 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7495 DWORD received = 0xdeadbeef;
7497 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7498 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7500 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7501 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7502 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7504 if(uri) IUri_Release(uri);
7506 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7507 uri_properties test = uri_tests[i];
7511 uriW = a2w(test.uri);
7512 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7513 if(test.create_todo) {
7515 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7516 hr, test.create_expected, i);
7519 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7520 hr, test.create_expected, i);
7526 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7527 DWORD expectedLen, brokenLen, receivedLen;
7528 uri_str_property prop = test.str_props[j];
7530 expectedLen = lstrlen(prop.value);
7531 brokenLen = lstrlen(prop.broken_value);
7533 /* This won't be necessary once GetPropertyLength is implemented. */
7536 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7539 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7540 hr, prop.expected, i, j);
7543 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7544 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7545 expectedLen, receivedLen, i, j);
7548 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7549 hr, prop.expected, i, j);
7550 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7551 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7552 expectedLen, receivedLen, i, j);
7557 if(uri) IUri_Release(uri);
7563 static DWORD compute_expected_props(uri_properties *test)
7567 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7568 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7572 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7573 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7580 static void test_IUri_GetProperties(void) {
7585 hr = pCreateUri(http_urlW, 0, 0, &uri);
7586 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7588 hr = IUri_GetProperties(uri, NULL);
7589 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7591 if(uri) IUri_Release(uri);
7593 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7594 uri_properties test = uri_tests[i];
7598 uriW = a2w(test.uri);
7599 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7600 if(test.create_todo) {
7602 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7605 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7609 DWORD received = 0, expected_props;
7612 hr = IUri_GetProperties(uri, &received);
7613 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7615 expected_props = compute_expected_props(&test);
7617 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7618 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7619 if(expected_props & (1 << j))
7620 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7622 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7626 if(uri) IUri_Release(uri);
7632 static void test_IUri_HasProperty(void) {
7637 hr = pCreateUri(http_urlW, 0, 0, &uri);
7638 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7640 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7641 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7643 if(uri) IUri_Release(uri);
7645 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7646 uri_properties test = uri_tests[i];
7650 uriW = a2w(test.uri);
7652 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7653 if(test.create_todo) {
7655 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7658 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7662 DWORD expected_props, j;
7664 expected_props = compute_expected_props(&test);
7666 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7667 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7670 hr = IUri_HasProperty(uri, j, &received);
7671 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7674 if(expected_props & (1 << j)) {
7675 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7677 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7682 if(uri) IUri_Release(uri);
7688 static void test_IUri_IsEqual(void) {
7696 /* Make sure IsEqual handles invalid args correctly. */
7697 hres = pCreateUri(http_urlW, 0, 0, &uriA);
7698 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7699 hres = pCreateUri(http_urlW, 0, 0, &uriB);
7700 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7703 hres = IUri_IsEqual(uriA, NULL, &equal);
7704 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7705 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7707 hres = IUri_IsEqual(uriA, uriB, NULL);
7708 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
7713 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7714 uri_equality test = equality_tests[i];
7715 LPWSTR uriA_W, uriB_W;
7719 uriA_W = a2w(test.a);
7720 uriB_W = a2w(test.b);
7722 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7723 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
7725 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7726 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
7729 hres = IUri_IsEqual(uriA, uriB, &equal);
7730 if(test.todo) todo_wine {
7731 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
7732 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7734 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
7735 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7737 if(uriA) IUri_Release(uriA);
7738 if(uriB) IUri_Release(uriB);
7745 static void test_CreateUriWithFragment_InvalidArgs(void) {
7747 IUri *uri = (void*) 0xdeadbeef;
7748 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7750 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7751 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7752 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7754 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7755 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7757 /* Original URI can't already contain a fragment component. */
7758 uri = (void*) 0xdeadbeef;
7759 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7760 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7761 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7764 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7765 static void test_CreateUriWithFragment_InvalidFlags(void) {
7768 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7770 IUri *uri = (void*) 0xdeadbeef;
7772 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7773 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7774 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7775 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7779 static void test_CreateUriWithFragment(void) {
7782 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7786 uri_with_fragment test = uri_fragment_tests[i];
7788 uriW = a2w(test.uri);
7789 fragW = a2w(test.fragment);
7791 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7792 if(test.expected_todo) {
7794 ok(hr == test.create_expected,
7795 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7796 hr, test.create_expected, i);
7799 ok(hr == test.create_expected,
7800 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7801 hr, test.create_expected, i);
7804 BSTR received = NULL;
7806 hr = IUri_GetAbsoluteUri(uri, &received);
7807 if(test.expected_todo) {
7810 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7814 ok(!strcmp_aw(test.expected_uri, received),
7815 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7816 test.expected_uri, wine_dbgstr_w(received), i);
7819 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7821 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7822 test.expected_uri, wine_dbgstr_w(received), i);
7825 SysFreeString(received);
7828 if(uri) IUri_Release(uri);
7834 static void test_CreateIUriBuilder(void) {
7836 IUriBuilder *builder = NULL;
7839 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7840 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7843 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7844 hr = pCreateUri(http_urlW, 0, 0, &uri);
7845 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7847 ULONG cur_count, orig_count;
7849 orig_count = get_refcnt(uri);
7850 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7851 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7852 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7854 cur_count = get_refcnt(uri);
7855 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7857 if(builder) IUriBuilder_Release(builder);
7858 cur_count = get_refcnt(uri);
7859 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7861 if(uri) IUri_Release(uri);
7864 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7869 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7870 if(test->uri_todo) {
7872 ok(hr == test->uri_hres,
7873 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7874 hr, test->uri_hres, test_index);
7877 ok(hr == test->uri_hres,
7878 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7879 hr, test->uri_hres, test_index);
7885 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7886 uri_builder_str_property prop = test->expected_str_props[i];
7887 BSTR received = NULL;
7889 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7892 ok(hr == prop.result,
7893 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7894 hr, prop.result, test_index, i);
7897 ok(hr == prop.result,
7898 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7899 hr, prop.result, test_index, i);
7904 ok(!strcmp_aw(prop.expected, received),
7905 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7906 prop.expected, wine_dbgstr_w(received), test_index, i);
7909 ok(!strcmp_aw(prop.expected, received),
7910 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7911 prop.expected, wine_dbgstr_w(received), test_index, i);
7914 SysFreeString(received);
7917 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7918 uri_builder_dword_property prop = test->expected_dword_props[i];
7919 DWORD received = -2;
7921 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7924 ok(hr == prop.result,
7925 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7926 hr, prop.result, test_index, i);
7929 ok(hr == prop.result,
7930 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7931 hr, prop.result, test_index, i);
7936 ok(received == prop.expected,
7937 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7938 prop.expected, received, test_index, i);
7941 ok(received == prop.expected,
7942 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7943 prop.expected, received, test_index, i);
7948 if(uri) IUri_Release(uri);
7951 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7956 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7957 if(test->uri_simple_todo) {
7959 ok(hr == test->uri_simple_hres,
7960 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7961 hr, test->uri_simple_hres, test_index);
7964 ok(hr == test->uri_simple_hres,
7965 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7966 hr, test->uri_simple_hres, test_index);
7972 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7973 uri_builder_str_property prop = test->expected_str_props[i];
7974 BSTR received = NULL;
7976 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7979 ok(hr == prop.result,
7980 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7981 hr, prop.result, test_index, i);
7984 ok(hr == prop.result,
7985 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7986 hr, prop.result, test_index, i);
7991 ok(!strcmp_aw(prop.expected, received),
7992 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7993 prop.expected, wine_dbgstr_w(received), test_index, i);
7996 ok(!strcmp_aw(prop.expected, received),
7997 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7998 prop.expected, wine_dbgstr_w(received), test_index, i);
8001 SysFreeString(received);
8004 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8005 uri_builder_dword_property prop = test->expected_dword_props[i];
8006 DWORD received = -2;
8008 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8011 ok(hr == prop.result,
8012 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8013 hr, prop.result, test_index, i);
8016 ok(hr == prop.result,
8017 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8018 hr, prop.result, test_index, i);
8023 ok(received == prop.expected,
8024 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8025 prop.expected, received, test_index, i);
8028 ok(received == prop.expected,
8029 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8030 prop.expected, received, test_index, i);
8035 if(uri) IUri_Release(uri);
8038 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8043 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8044 test->uri_with_encode_flags, 0, &uri);
8045 if(test->uri_with_todo) {
8047 ok(hr == test->uri_with_hres,
8048 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8049 hr, test->uri_with_hres, test_index);
8052 ok(hr == test->uri_with_hres,
8053 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8054 hr, test->uri_with_hres, test_index);
8060 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8061 uri_builder_str_property prop = test->expected_str_props[i];
8062 BSTR received = NULL;
8064 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8067 ok(hr == prop.result,
8068 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8069 hr, prop.result, test_index, i);
8072 ok(hr == prop.result,
8073 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8074 hr, prop.result, test_index, i);
8079 ok(!strcmp_aw(prop.expected, received),
8080 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8081 prop.expected, wine_dbgstr_w(received), test_index, i);
8084 ok(!strcmp_aw(prop.expected, received),
8085 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8086 prop.expected, wine_dbgstr_w(received), test_index, i);
8089 SysFreeString(received);
8092 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8093 uri_builder_dword_property prop = test->expected_dword_props[i];
8094 DWORD received = -2;
8096 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8099 ok(hr == prop.result,
8100 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8101 hr, prop.result, test_index, i);
8104 ok(hr == prop.result,
8105 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8106 hr, prop.result, test_index, i);
8111 ok(received == prop.expected,
8112 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8113 prop.expected, received, test_index, i);
8116 ok(received == prop.expected,
8117 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8118 prop.expected, received, test_index, i);
8123 if(uri) IUri_Release(uri);
8126 static void test_IUriBuilder_CreateInvalidArgs(void) {
8127 IUriBuilder *builder;
8130 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8131 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8133 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8135 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8136 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8137 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8139 uri = (void*) 0xdeadbeef;
8140 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8141 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8142 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8144 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8145 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8148 uri = (void*) 0xdeadbeef;
8149 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8150 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8152 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8154 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8155 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8158 uri = (void*) 0xdeadbeef;
8159 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8160 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8162 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8164 hr = pCreateUri(http_urlW, 0, 0, &test);
8165 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8167 hr = IUriBuilder_SetIUri(builder, test);
8168 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8170 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8172 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8173 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8174 ok(uri != NULL, "Error: The uri was NULL.\n");
8175 if(uri) IUri_Release(uri);
8178 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8179 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8181 ok(uri != NULL, "Error: uri was NULL.\n");
8182 if(uri) IUri_Release(uri);
8185 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8186 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8188 ok(uri != NULL, "Error: uri was NULL.\n");
8189 if(uri) IUri_Release(uri);
8191 hr = IUriBuilder_SetFragment(builder, NULL);
8192 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8194 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8195 uri = (void*) 0xdeadbeef;
8196 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8197 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8198 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8200 uri = (void*) 0xdeadbeef;
8201 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8202 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8204 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8206 uri = (void*) 0xdeadbeef;
8207 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8208 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8210 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8212 if(test) IUri_Release(test);
8214 if(builder) IUriBuilder_Release(builder);
8217 /* Tests invalid args to the "Get*" functions. */
8218 static void test_IUriBuilder_GetInvalidArgs(void) {
8219 IUriBuilder *builder = NULL;
8222 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8223 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8225 LPCWSTR received = (void*) 0xdeadbeef;
8226 DWORD len = -1, port = -1;
8229 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8230 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8232 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8233 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8235 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8236 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8237 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8239 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8241 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8242 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8244 received = (void*) 0xdeadbeef;
8245 hr = IUriBuilder_GetHost(builder, NULL, &received);
8246 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8248 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8250 hr = IUriBuilder_GetHost(builder, &len, NULL);
8251 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8253 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8255 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8256 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8258 received = (void*) 0xdeadbeef;
8259 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8260 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8262 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8264 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8265 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8267 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8269 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8270 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8272 received = (void*) 0xdeadbeef;
8273 hr = IUriBuilder_GetPath(builder, NULL, &received);
8274 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8276 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8278 hr = IUriBuilder_GetPath(builder, &len, NULL);
8279 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8281 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8283 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8284 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8286 hr = IUriBuilder_GetPort(builder, NULL, &port);
8287 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8289 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8290 hr = IUriBuilder_GetPort(builder, &set, NULL);
8291 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8293 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8295 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8296 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8298 received = (void*) 0xdeadbeef;
8299 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8300 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8302 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8304 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8305 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8307 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8309 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8310 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8312 received = (void*) 0xdeadbeef;
8313 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8314 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8316 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8318 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8319 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8321 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8323 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8324 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8326 received = (void*) 0xdeadbeef;
8327 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8328 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8330 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8332 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8333 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8335 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8337 if(builder) IUriBuilder_Release(builder);
8340 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8344 LPCWSTR received = NULL;
8346 const uri_builder_property *prop = NULL;
8348 /* Check if the property was set earlier. */
8349 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8350 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8351 prop = &(test->properties[i]);
8355 /* Use expected_value unless it's NULL, then use value. */
8356 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8357 hr = IUriBuilder_GetFragment(builder, &len, &received);
8360 ok(hr == (expected ? S_OK : S_FALSE),
8361 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8362 hr, (expected ? S_OK : S_FALSE), test_index);
8366 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8367 expected, wine_dbgstr_w(received), test_index);
8370 ok(lstrlen(expected) == len,
8371 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8372 lstrlen(expected), len, test_index);
8376 ok(hr == (expected ? S_OK : S_FALSE),
8377 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8378 hr, (expected ? S_OK : S_FALSE), test_index);
8379 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8380 expected, wine_dbgstr_w(received), test_index);
8381 ok(lstrlen(expected) == len,
8382 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8383 lstrlen(expected), len, test_index);
8386 /* The property wasn't set earlier, so it should return whatever
8387 * the base IUri contains (if anything).
8390 hr = IUriBuilder_GetIUri(builder, &uri);
8392 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8393 hr, S_OK, test_index);
8396 received = (void*) 0xdeadbeef;
8399 hr = IUriBuilder_GetFragment(builder, &len, &received);
8401 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8402 hr, S_FALSE, test_index);
8404 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8406 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8407 received, test_index);
8410 BOOL has_prop = FALSE;
8411 BSTR expected = NULL;
8413 hr = IUri_GetFragment(uri, &expected);
8415 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8417 has_prop = hr == S_OK;
8419 hr = IUriBuilder_GetFragment(builder, &len, &received);
8422 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8423 hr, S_OK, test_index);
8425 ok(!lstrcmpW(expected, received),
8426 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8427 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8428 ok(lstrlenW(expected) == len,
8429 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8430 lstrlenW(expected), len, test_index);
8434 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8435 hr, S_FALSE, test_index);
8437 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8438 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8442 SysFreeString(expected);
8445 if(uri) IUri_Release(uri);
8449 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8453 LPCWSTR received = NULL;
8455 const uri_builder_property *prop = NULL;
8457 /* Check if the property was set earlier. */
8458 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8459 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8460 prop = &(test->properties[i]);
8464 /* Use expected_value unless it's NULL, then use value. */
8465 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8466 hr = IUriBuilder_GetHost(builder, &len, &received);
8469 ok(hr == (expected ? S_OK : S_FALSE),
8470 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8471 hr, (expected ? S_OK : S_FALSE), test_index);
8475 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8476 expected, wine_dbgstr_w(received), test_index);
8479 ok(lstrlen(expected) == len,
8480 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8481 lstrlen(expected), len, test_index);
8485 ok(hr == (expected ? S_OK : S_FALSE),
8486 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8487 hr, (expected ? S_OK : S_FALSE), test_index);
8488 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8489 expected, wine_dbgstr_w(received), test_index);
8490 ok(lstrlen(expected) == len,
8491 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8492 lstrlen(expected), len, test_index);
8495 /* The property wasn't set earlier, so it should return whatever
8496 * the base IUri contains (if anything).
8499 hr = IUriBuilder_GetIUri(builder, &uri);
8501 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8502 hr, S_OK, test_index);
8505 received = (void*) 0xdeadbeef;
8508 hr = IUriBuilder_GetHost(builder, &len, &received);
8510 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8511 hr, S_FALSE, test_index);
8513 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8515 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8516 received, test_index);
8519 BOOL has_prop = FALSE;
8520 BSTR expected = NULL;
8522 hr = IUri_GetHost(uri, &expected);
8524 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8526 has_prop = hr == S_OK;
8528 hr = IUriBuilder_GetHost(builder, &len, &received);
8531 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8532 hr, S_OK, test_index);
8534 ok(!lstrcmpW(expected, received),
8535 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8536 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8537 ok(lstrlenW(expected) == len,
8538 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8539 lstrlenW(expected), len, test_index);
8543 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8544 hr, S_FALSE, test_index);
8546 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8547 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8551 SysFreeString(expected);
8554 if(uri) IUri_Release(uri);
8558 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8562 LPCWSTR received = NULL;
8564 const uri_builder_property *prop = NULL;
8566 /* Check if the property was set earlier. */
8567 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8568 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8569 prop = &(test->properties[i]);
8573 /* Use expected_value unless it's NULL, then use value. */
8574 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8575 hr = IUriBuilder_GetPassword(builder, &len, &received);
8578 ok(hr == (expected ? S_OK : S_FALSE),
8579 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8580 hr, (expected ? S_OK : S_FALSE), test_index);
8584 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8585 expected, wine_dbgstr_w(received), test_index);
8588 ok(lstrlen(expected) == len,
8589 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8590 lstrlen(expected), len, test_index);
8594 ok(hr == (expected ? S_OK : S_FALSE),
8595 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8596 hr, (expected ? S_OK : S_FALSE), test_index);
8597 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8598 expected, wine_dbgstr_w(received), test_index);
8599 ok(lstrlen(expected) == len,
8600 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8601 lstrlen(expected), len, test_index);
8604 /* The property wasn't set earlier, so it should return whatever
8605 * the base IUri contains (if anything).
8608 hr = IUriBuilder_GetIUri(builder, &uri);
8610 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8611 hr, S_OK, test_index);
8614 received = (void*) 0xdeadbeef;
8617 hr = IUriBuilder_GetPassword(builder, &len, &received);
8619 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8620 hr, S_FALSE, test_index);
8622 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8624 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8625 received, test_index);
8628 BOOL has_prop = FALSE;
8629 BSTR expected = NULL;
8631 hr = IUri_GetPassword(uri, &expected);
8633 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8635 has_prop = hr == S_OK;
8637 hr = IUriBuilder_GetPassword(builder, &len, &received);
8640 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8641 hr, S_OK, test_index);
8643 ok(!lstrcmpW(expected, received),
8644 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8645 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8646 ok(lstrlenW(expected) == len,
8647 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8648 lstrlenW(expected), len, test_index);
8652 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8653 hr, S_FALSE, test_index);
8655 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8656 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8660 SysFreeString(expected);
8663 if(uri) IUri_Release(uri);
8667 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8671 LPCWSTR received = NULL;
8673 const uri_builder_property *prop = NULL;
8675 /* Check if the property was set earlier. */
8676 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8677 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8678 prop = &(test->properties[i]);
8682 /* Use expected_value unless it's NULL, then use value. */
8683 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8684 hr = IUriBuilder_GetPath(builder, &len, &received);
8687 ok(hr == (expected ? S_OK : S_FALSE),
8688 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8689 hr, (expected ? S_OK : S_FALSE), test_index);
8693 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8694 expected, wine_dbgstr_w(received), test_index);
8697 ok(lstrlen(expected) == len,
8698 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8699 lstrlen(expected), len, test_index);
8703 ok(hr == (expected ? S_OK : S_FALSE),
8704 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8705 hr, (expected ? S_OK : S_FALSE), test_index);
8706 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8707 expected, wine_dbgstr_w(received), test_index);
8708 ok(lstrlen(expected) == len,
8709 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8710 lstrlen(expected), len, test_index);
8713 /* The property wasn't set earlier, so it should return whatever
8714 * the base IUri contains (if anything).
8717 hr = IUriBuilder_GetIUri(builder, &uri);
8719 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8720 hr, S_OK, test_index);
8723 received = (void*) 0xdeadbeef;
8726 hr = IUriBuilder_GetPath(builder, &len, &received);
8728 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8729 hr, S_FALSE, test_index);
8731 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8733 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8734 received, test_index);
8737 BOOL has_prop = FALSE;
8738 BSTR expected = NULL;
8740 hr = IUri_GetPath(uri, &expected);
8742 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8744 has_prop = hr == S_OK;
8746 hr = IUriBuilder_GetPath(builder, &len, &received);
8749 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8750 hr, S_OK, test_index);
8752 ok(!lstrcmpW(expected, received),
8753 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8754 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8755 ok(lstrlenW(expected) == len,
8756 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8757 lstrlenW(expected), len, test_index);
8761 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8762 hr, S_FALSE, test_index);
8764 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8765 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8769 SysFreeString(expected);
8772 if(uri) IUri_Release(uri);
8776 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8779 BOOL has_port = FALSE;
8780 DWORD received = -1;
8782 if(test->port_prop.change) {
8783 DWORD expected = test->port_prop.value;
8785 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8786 if(test->port_prop.todo) {
8789 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8790 hr, S_OK, test_index);
8794 ok(has_port == test->port_prop.set,
8795 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8796 test->port_prop.set, has_port, test_index);
8799 ok(received == expected,
8800 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8801 expected, received, test_index);
8806 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8807 hr, S_OK, test_index);
8808 ok(has_port == test->port_prop.set,
8809 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8810 test->port_prop.set, has_port, test_index);
8811 ok(received == test->port_prop.value,
8812 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8813 test->port_prop.value, received, test_index);
8818 hr = IUriBuilder_GetIUri(builder, &uri);
8820 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8821 hr, S_OK, test_index);
8824 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8826 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8827 hr, S_OK, test_index);
8829 ok(has_port == FALSE,
8830 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8831 has_port, test_index);
8832 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8833 received, test_index);
8838 hr = IUri_GetPort(uri, &expected);
8840 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8843 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8845 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8846 hr, S_OK, test_index);
8849 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8851 ok(received == expected,
8852 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8853 expected, received, test_index);
8857 if(uri) IUri_Release(uri);
8861 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8865 LPCWSTR received = NULL;
8867 const uri_builder_property *prop = NULL;
8869 /* Check if the property was set earlier. */
8870 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8871 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8872 prop = &(test->properties[i]);
8876 /* Use expected_value unless it's NULL, then use value. */
8877 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8878 hr = IUriBuilder_GetQuery(builder, &len, &received);
8881 ok(hr == (expected ? S_OK : S_FALSE),
8882 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8883 hr, (expected ? S_OK : S_FALSE), test_index);
8887 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8888 expected, wine_dbgstr_w(received), test_index);
8891 ok(lstrlen(expected) == len,
8892 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8893 lstrlen(expected), len, test_index);
8897 ok(hr == (expected ? S_OK : S_FALSE),
8898 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8899 hr, (expected ? S_OK : S_FALSE), test_index);
8900 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8901 expected, wine_dbgstr_w(received), test_index);
8902 ok(lstrlen(expected) == len,
8903 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8904 lstrlen(expected), len, test_index);
8907 /* The property wasn't set earlier, so it should return whatever
8908 * the base IUri contains (if anything).
8911 hr = IUriBuilder_GetIUri(builder, &uri);
8913 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8914 hr, S_OK, test_index);
8917 received = (void*) 0xdeadbeef;
8920 hr = IUriBuilder_GetQuery(builder, &len, &received);
8922 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8923 hr, S_FALSE, test_index);
8925 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8927 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8928 received, test_index);
8931 BOOL has_prop = FALSE;
8932 BSTR expected = NULL;
8934 hr = IUri_GetQuery(uri, &expected);
8936 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8938 has_prop = hr == S_OK;
8940 hr = IUriBuilder_GetQuery(builder, &len, &received);
8943 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8944 hr, S_OK, test_index);
8946 ok(!lstrcmpW(expected, received),
8947 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8948 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8949 ok(lstrlenW(expected) == len,
8950 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8951 lstrlenW(expected), len, test_index);
8955 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8956 hr, S_FALSE, test_index);
8958 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8959 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8963 SysFreeString(expected);
8966 if(uri) IUri_Release(uri);
8970 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8974 LPCWSTR received = NULL;
8976 const uri_builder_property *prop = NULL;
8978 /* Check if the property was set earlier. */
8979 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8980 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8981 prop = &(test->properties[i]);
8985 /* Use expected_value unless it's NULL, then use value. */
8986 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8987 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8990 ok(hr == (expected ? S_OK : S_FALSE),
8991 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8992 hr, (expected ? S_OK : S_FALSE), test_index);
8996 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8997 expected, wine_dbgstr_w(received), test_index);
9000 ok(lstrlen(expected) == len,
9001 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9002 lstrlen(expected), len, test_index);
9006 ok(hr == (expected ? S_OK : S_FALSE),
9007 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9008 hr, (expected ? S_OK : S_FALSE), test_index);
9009 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9010 expected, wine_dbgstr_w(received), test_index);
9011 ok(lstrlen(expected) == len,
9012 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9013 lstrlen(expected), len, test_index);
9016 /* The property wasn't set earlier, so it should return whatever
9017 * the base IUri contains (if anything).
9020 hr = IUriBuilder_GetIUri(builder, &uri);
9022 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9023 hr, S_OK, test_index);
9026 received = (void*) 0xdeadbeef;
9029 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9031 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9032 hr, S_FALSE, test_index);
9034 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9036 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9037 received, test_index);
9040 BOOL has_prop = FALSE;
9041 BSTR expected = NULL;
9043 hr = IUri_GetSchemeName(uri, &expected);
9045 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9047 has_prop = hr == S_OK;
9049 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9052 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9053 hr, S_OK, test_index);
9055 ok(!lstrcmpW(expected, received),
9056 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9057 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9058 ok(lstrlenW(expected) == len,
9059 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9060 lstrlenW(expected), len, test_index);
9064 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9065 hr, S_FALSE, test_index);
9067 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9068 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9072 SysFreeString(expected);
9075 if(uri) IUri_Release(uri);
9079 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9083 LPCWSTR received = NULL;
9085 const uri_builder_property *prop = NULL;
9087 /* Check if the property was set earlier. */
9088 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9089 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9090 prop = &(test->properties[i]);
9093 if(prop && prop->value && *prop->value) {
9094 /* Use expected_value unless it's NULL, then use value. */
9095 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9096 hr = IUriBuilder_GetUserName(builder, &len, &received);
9099 ok(hr == (expected ? S_OK : S_FALSE),
9100 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9101 hr, (expected ? S_OK : S_FALSE), test_index);
9105 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9106 expected, wine_dbgstr_w(received), test_index);
9109 ok(lstrlen(expected) == len,
9110 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9111 lstrlen(expected), len, test_index);
9115 ok(hr == (expected ? S_OK : S_FALSE),
9116 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9117 hr, (expected ? S_OK : S_FALSE), test_index);
9118 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9119 expected, wine_dbgstr_w(received), test_index);
9120 ok(lstrlen(expected) == len,
9121 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9122 lstrlen(expected), len, test_index);
9125 /* The property wasn't set earlier, so it should return whatever
9126 * the base IUri contains (if anything).
9129 hr = IUriBuilder_GetIUri(builder, &uri);
9131 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9132 hr, S_OK, test_index);
9135 received = (void*) 0xdeadbeef;
9138 hr = IUriBuilder_GetUserName(builder, &len, &received);
9140 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9141 hr, S_FALSE, test_index);
9143 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9145 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9146 received, test_index);
9149 BSTR expected = NULL;
9150 BOOL has_prop = FALSE;
9152 hr = IUri_GetUserName(uri, &expected);
9154 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9156 has_prop = hr == S_OK;
9158 hr = IUriBuilder_GetUserName(builder, &len, &received);
9161 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9162 hr, S_OK, test_index);
9164 ok(!lstrcmpW(expected, received),
9165 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9166 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9167 ok(lstrlenW(expected) == len,
9168 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9169 lstrlenW(expected), len, test_index);
9173 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9174 hr, S_FALSE, test_index);
9176 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9177 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9181 SysFreeString(expected);
9184 if(uri) IUri_Release(uri);
9188 /* Tests IUriBuilder functions. */
9189 static void test_IUriBuilder(void) {
9191 IUriBuilder *builder;
9194 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9196 uri_builder_test test = uri_builder_tests[i];
9200 uriW = a2w(test.uri);
9201 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9202 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9204 if(FAILED(hr)) continue;
9206 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9207 if(test.create_builder_todo) {
9209 ok(hr == test.create_builder_expected,
9210 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9211 hr, test.create_builder_expected, i);
9214 ok(hr == test.create_builder_expected,
9215 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9216 hr, test.create_builder_expected, i);
9220 BOOL modified = FALSE, received = FALSE;
9222 /* Perform all the string property changes. */
9223 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9224 uri_builder_property prop = test.properties[j];
9226 change_property(builder, &prop, i);
9227 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9228 prop.property != Uri_PROPERTY_HOST)
9230 else if(prop.value && *prop.value)
9232 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9233 /* Host name property can't be NULL, but it can be empty. */
9238 if(test.port_prop.change) {
9239 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9241 if(test.port_prop.todo) {
9243 ok(hr == test.port_prop.expected,
9244 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9245 hr, test.port_prop.expected, i);
9248 ok(hr == test.port_prop.expected,
9249 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9250 hr, test.port_prop.expected, i);
9254 hr = IUriBuilder_HasBeenModified(builder, &received);
9256 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9259 ok(received == modified,
9260 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9261 modified, received, i);
9263 /* Test the "Get*" functions. */
9264 test_IUriBuilder_GetFragment(builder, &test, i);
9265 test_IUriBuilder_GetHost(builder, &test, i);
9266 test_IUriBuilder_GetPassword(builder, &test, i);
9267 test_IUriBuilder_GetPath(builder, &test, i);
9268 test_IUriBuilder_GetPort(builder, &test, i);
9269 test_IUriBuilder_GetQuery(builder, &test, i);
9270 test_IUriBuilder_GetSchemeName(builder, &test, i);
9271 test_IUriBuilder_GetUserName(builder, &test, i);
9273 test_IUriBuilder_CreateUri(builder, &test, i);
9274 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9275 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9277 if(builder) IUriBuilder_Release(builder);
9278 if(uri) IUri_Release(uri);
9283 static void test_IUriBuilder_HasBeenModified(void) {
9285 IUriBuilder *builder = NULL;
9287 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9288 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9290 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9294 hr = IUriBuilder_HasBeenModified(builder, NULL);
9295 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9298 hr = IUriBuilder_SetHost(builder, hostW);
9299 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9302 hr = IUriBuilder_HasBeenModified(builder, &received);
9303 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9306 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9308 hr = pCreateUri(http_urlW, 0, 0, &uri);
9309 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9314 hr = IUriBuilder_SetIUri(builder, uri);
9315 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9318 hr = IUriBuilder_HasBeenModified(builder, &received);
9319 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9322 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9324 /* Test what happens with you call SetIUri with the same IUri again. */
9325 hr = IUriBuilder_SetHost(builder, hostW);
9326 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9328 hr = IUriBuilder_HasBeenModified(builder, &received);
9329 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9332 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9334 hr = IUriBuilder_SetIUri(builder, uri);
9335 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9337 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9338 * reset any of the changes that were made to the IUriBuilder.
9340 hr = IUriBuilder_HasBeenModified(builder, &received);
9341 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9343 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9345 hr = IUriBuilder_GetHost(builder, &len, &prop);
9346 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9348 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9349 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9350 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9351 lstrlenW(hostW), len);
9354 hr = IUriBuilder_SetIUri(builder, NULL);
9355 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9357 hr = IUriBuilder_SetHost(builder, hostW);
9358 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9359 hr = IUriBuilder_HasBeenModified(builder, &received);
9360 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9363 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9365 hr = IUriBuilder_SetIUri(builder, NULL);
9366 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9368 hr = IUriBuilder_HasBeenModified(builder, &received);
9369 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9372 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9374 hr = IUriBuilder_GetHost(builder, &len, &prop);
9375 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9377 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9378 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9379 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9380 lstrlenW(hostW), len);
9383 if(uri) IUri_Release(uri);
9385 if(builder) IUriBuilder_Release(builder);
9388 /* Test IUriBuilder {Get,Set}IUri functions. */
9389 static void test_IUriBuilder_IUriProperty(void) {
9390 IUriBuilder *builder = NULL;
9393 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9394 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9398 hr = IUriBuilder_GetIUri(builder, NULL);
9399 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9402 hr = pCreateUri(http_urlW, 0, 0, &uri);
9405 ULONG cur_count, orig_count;
9407 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9408 orig_count = get_refcnt(uri);
9409 hr = IUriBuilder_SetIUri(builder, uri);
9410 cur_count = get_refcnt(uri);
9412 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9413 orig_count+1, cur_count);
9415 hr = IUriBuilder_SetIUri(builder, NULL);
9416 cur_count = get_refcnt(uri);
9418 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9419 orig_count, cur_count);
9421 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9422 hr = IUriBuilder_SetIUri(builder, uri);
9423 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9424 orig_count = get_refcnt(uri);
9426 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9427 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9429 cur_count = get_refcnt(uri);
9430 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9431 orig_count+1, cur_count);
9432 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9435 if(test) IUri_Release(test);
9438 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9439 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9441 cur_count = get_refcnt(uri);
9442 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9443 orig_count+1, cur_count);
9444 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9446 if(test) IUri_Release(test);
9448 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9452 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9453 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9455 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9457 if(test) IUri_Release(test);
9459 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9460 * explicitly set (because it's a default flags).
9463 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9464 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9466 cur_count = get_refcnt(uri);
9467 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9468 orig_count+1, cur_count);
9469 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9471 if(test) IUri_Release(test);
9474 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9475 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9477 cur_count = get_refcnt(uri);
9478 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9479 orig_count+1, cur_count);
9480 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9482 if(test) IUri_Release(test);
9485 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9486 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9489 cur_count = get_refcnt(uri);
9490 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9491 orig_count+1, cur_count);
9492 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9494 if(test) IUri_Release(test);
9496 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9500 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9501 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9503 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9505 if(test) IUri_Release(test);
9507 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9508 * explicitly set (because it's a default flags).
9511 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9512 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9514 cur_count = get_refcnt(uri);
9515 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9516 orig_count+1, cur_count);
9517 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9519 if(test) IUri_Release(test);
9521 if(uri) IUri_Release(uri);
9523 if(builder) IUriBuilder_Release(builder);
9526 static void test_IUriBuilder_RemoveProperties(void) {
9527 IUriBuilder *builder = NULL;
9531 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9532 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9534 /* Properties that can't be removed. */
9535 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9536 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9538 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9539 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9540 if((i << 1) & invalid) {
9541 ok(hr == E_INVALIDARG,
9542 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9543 hr, E_INVALIDARG, i);
9546 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9551 /* Also doesn't accept anything that's outside the range of the
9554 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9555 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9558 if(builder) IUriBuilder_Release(builder);
9560 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9561 uri_builder_remove_test test = uri_builder_remove_tests[i];
9565 uriW = a2w(test.uri);
9566 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9570 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9571 if(test.create_builder_todo) {
9573 ok(hr == test.create_builder_expected,
9574 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9575 hr, test.create_builder_expected, i);
9578 ok(hr == test.create_builder_expected,
9579 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9580 hr, test.create_builder_expected, i);
9583 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9584 if(test.remove_todo) {
9586 ok(hr == test.remove_expected,
9587 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9588 hr, test.remove_expected, i);
9591 ok(hr == test.remove_expected,
9592 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9593 hr, test.remove_expected, i);
9596 IUri *result = NULL;
9598 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9599 if(test.expected_todo) {
9601 ok(hr == test.expected_hres,
9602 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9603 hr, test.expected_hres, i);
9606 ok(hr == test.expected_hres,
9607 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9608 hr, test.expected_hres, i);
9611 BSTR received = NULL;
9613 hr = IUri_GetAbsoluteUri(result, &received);
9614 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9615 ok(!strcmp_aw(test.expected_uri, received),
9616 "Error: Expected %s but got %s instead on test %d.\n",
9617 test.expected_uri, wine_dbgstr_w(received), i);
9618 SysFreeString(received);
9620 if(result) IUri_Release(result);
9623 if(builder) IUriBuilder_Release(builder);
9625 if(uri) IUri_Release(uri);
9630 static void test_IUriBuilder_Misc(void) {
9634 hr = pCreateUri(http_urlW, 0, 0, &uri);
9636 IUriBuilder *builder;
9638 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9639 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9644 hr = IUriBuilder_GetPort(builder, &has, &port);
9645 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9647 /* 'has' will be set to FALSE, even though uri had a port. */
9648 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9649 /* Still sets 'port' to 80. */
9650 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9653 if(builder) IUriBuilder_Release(builder);
9655 if(uri) IUri_Release(uri);
9658 static void test_IUriBuilderFactory(void) {
9661 IUriBuilderFactory *factory;
9662 IUriBuilder *builder;
9664 hr = pCreateUri(http_urlW, 0, 0, &uri);
9665 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9668 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9669 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9670 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9673 builder = (void*) 0xdeadbeef;
9674 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9675 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9677 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9679 builder = (void*) 0xdeadbeef;
9680 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9681 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9683 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9685 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9686 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9690 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9691 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9694 IUri *tmp = (void*) 0xdeadbeef;
9698 hr = IUriBuilder_GetIUri(builder, &tmp);
9699 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9701 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9703 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9704 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9707 if(builder) IUriBuilder_Release(builder);
9709 builder = (void*) 0xdeadbeef;
9710 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9711 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9713 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9715 builder = (void*) 0xdeadbeef;
9716 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9717 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9719 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9721 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9722 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9726 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9727 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9732 hr = IUriBuilder_GetIUri(builder, &tmp);
9733 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9735 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9736 if(uri) IUri_Release(uri);
9738 if(builder) IUriBuilder_Release(builder);
9740 if(factory) IUriBuilderFactory_Release(factory);
9742 if(uri) IUri_Release(uri);
9745 static void test_CoInternetCombineIUri(void) {
9747 IUri *base, *relative, *result;
9751 hr = pCreateUri(http_urlW, 0, 0, &base);
9752 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9754 result = (void*) 0xdeadbeef;
9755 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9756 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9757 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9761 hr = pCreateUri(http_urlW, 0, 0, &relative);
9762 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9764 result = (void*) 0xdeadbeef;
9765 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9766 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9767 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9770 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9771 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9773 if(base) IUri_Release(base);
9774 if(relative) IUri_Release(relative);
9776 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9777 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9779 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9780 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9782 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9784 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9785 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9789 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9790 if(uri_combine_tests[i].todo) {
9792 ok(hr == uri_combine_tests[i].expected,
9793 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9794 hr, uri_combine_tests[i].expected, i);
9797 ok(hr == uri_combine_tests[i].expected,
9798 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9799 hr, uri_combine_tests[i]. expected, i);
9804 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9805 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9808 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9811 ok(hr == prop.expected,
9812 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9813 hr, prop.expected, i, j);
9816 ok(!strcmp_aw(prop.value, received) ||
9817 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9818 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9819 prop.value, wine_dbgstr_w(received), i, j);
9822 ok(hr == prop.expected,
9823 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9824 hr, prop.expected, i, j);
9825 ok(!strcmp_aw(prop.value, received) ||
9826 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9827 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9828 prop.value, wine_dbgstr_w(received), i, j);
9830 SysFreeString(received);
9833 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9834 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9837 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9840 ok(hr == prop.expected,
9841 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9842 hr, prop.expected, i, j);
9845 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9846 prop.value, received, i, j);
9849 ok(hr == prop.expected,
9850 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9851 hr, prop.expected, i, j);
9852 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9853 prop.value, received, i, j);
9857 if(result) IUri_Release(result);
9859 if(relative) IUri_Release(relative);
9860 heap_free(relativeW);
9862 if(base) IUri_Release(base);
9867 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9868 REFIID riid, void **ppv)
9870 ok(0, "unexpected call\n");
9871 return E_NOINTERFACE;
9874 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9879 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9884 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9885 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9886 DWORD *pcchResult, DWORD dwReserved)
9888 CHECK_EXPECT(ParseUrl);
9889 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
9890 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
9891 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
9892 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
9893 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
9895 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
9896 *pcchResult = lstrlenW(parse_resultW);
9901 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9902 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9903 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9905 CHECK_EXPECT(CombineUrl);
9906 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9907 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9908 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9909 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9910 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9911 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9912 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9914 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9915 *pcchResult = lstrlenW(combine_resultW);
9920 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9921 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9923 ok(0, "unexpected call\n");
9927 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9928 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9929 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9931 ok(0, "unexpected call\n");
9935 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9936 InternetProtocolInfo_QueryInterface,
9937 InternetProtocolInfo_AddRef,
9938 InternetProtocolInfo_Release,
9939 InternetProtocolInfo_ParseUrl,
9940 InternetProtocolInfo_CombineUrl,
9941 InternetProtocolInfo_CompareUrl,
9942 InternetProtocolInfo_QueryInfo
9945 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9947 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9949 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9950 *ppv = &protocol_info;
9954 ok(0, "unexpected call\n");
9955 return E_NOINTERFACE;
9958 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9963 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9968 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9969 REFIID riid, void **ppv)
9971 ok(0, "unexpected call\n");
9975 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9977 ok(0, "unexpected call\n");
9981 static const IClassFactoryVtbl ClassFactoryVtbl = {
9982 ClassFactory_QueryInterface,
9983 ClassFactory_AddRef,
9984 ClassFactory_Release,
9985 ClassFactory_CreateInstance,
9986 ClassFactory_LockServer
9989 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9991 static void register_protocols(void)
9993 IInternetSession *session;
9996 hres = pCoInternetGetSession(0, &session, 0);
9997 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10001 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10002 winetestW, 0, NULL, 0);
10003 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10005 IInternetSession_Release(session);
10008 static void unregister_protocols(void) {
10009 IInternetSession *session;
10012 hr = pCoInternetGetSession(0, &session, 0);
10013 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10017 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10018 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10020 IInternetSession_Release(session);
10023 static void test_CoInternetCombineIUri_Pluggable(void) {
10027 hr = pCreateUri(combine_baseW, 0, 0, &base);
10028 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10029 if(SUCCEEDED(hr)) {
10030 IUri *relative = NULL;
10032 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10033 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10034 if(SUCCEEDED(hr)) {
10035 IUri *result = NULL;
10037 SET_EXPECT(CombineUrl);
10039 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10041 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10043 CHECK_CALLED(CombineUrl);
10045 if(SUCCEEDED(hr)) {
10046 BSTR received = NULL;
10047 hr = IUri_GetAbsoluteUri(result, &received);
10048 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10049 if(SUCCEEDED(hr)) {
10050 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10051 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10053 SysFreeString(received);
10055 if(result) IUri_Release(result);
10057 if(relative) IUri_Release(relative);
10059 if(base) IUri_Release(base);
10062 static void test_CoInternetCombineUrlEx(void) {
10064 IUri *base, *result;
10068 hr = pCreateUri(http_urlW, 0, 0, &base);
10069 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10070 if(SUCCEEDED(hr)) {
10071 result = (void*) 0xdeadbeef;
10072 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10073 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10075 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10078 result = (void*) 0xdeadbeef;
10079 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10080 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10082 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10084 result = (void*) 0xdeadbeef;
10085 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10086 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10088 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10090 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10091 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10093 if(base) IUri_Release(base);
10095 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10096 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10098 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10099 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10100 if(SUCCEEDED(hr)) {
10101 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10103 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10105 if(uri_combine_tests[i].todo) {
10107 ok(hr == uri_combine_tests[i].expected,
10108 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10109 hr, uri_combine_tests[i].expected, i);
10112 ok(hr == uri_combine_tests[i].expected,
10113 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10114 hr, uri_combine_tests[i]. expected, i);
10116 if(SUCCEEDED(hr)) {
10119 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10120 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10122 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10124 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10127 ok(hr == prop.expected,
10128 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10129 hr, prop.expected, i, j);
10132 ok(!strcmp_aw(value, received) ||
10133 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10134 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10135 value, wine_dbgstr_w(received), i, j);
10138 ok(hr == prop.expected,
10139 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10140 hr, prop.expected, i, j);
10141 ok(!strcmp_aw(value, received) ||
10142 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10143 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10144 value, wine_dbgstr_w(received), i, j);
10146 SysFreeString(received);
10149 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10150 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10153 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10156 ok(hr == prop.expected,
10157 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10158 hr, prop.expected, i, j);
10161 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10162 prop.value, received, i, j);
10165 ok(hr == prop.expected,
10166 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10167 hr, prop.expected, i, j);
10168 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10169 prop.value, received, i, j);
10173 if(result) IUri_Release(result);
10174 heap_free(relativeW);
10176 if(base) IUri_Release(base);
10181 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10185 hr = pCreateUri(combine_baseW, 0, 0, &base);
10186 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10187 if(SUCCEEDED(hr)) {
10188 IUri *result = NULL;
10190 SET_EXPECT(CombineUrl);
10192 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10194 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10196 CHECK_CALLED(CombineUrl);
10198 if(SUCCEEDED(hr)) {
10199 BSTR received = NULL;
10200 hr = IUri_GetAbsoluteUri(result, &received);
10201 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10202 if(SUCCEEDED(hr)) {
10203 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10204 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10206 SysFreeString(received);
10208 if(result) IUri_Release(result);
10210 if(base) IUri_Release(base);
10213 static void test_CoInternetParseIUri_InvalidArgs(void) {
10219 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10220 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10222 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10224 hr = pCreateUri(http_urlW, 0, 0, &uri);
10225 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10226 if(SUCCEEDED(hr)) {
10227 DWORD expected_len;
10230 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10231 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10233 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10235 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10236 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10240 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10241 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10243 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10246 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10247 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10249 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10252 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10253 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10255 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10258 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10259 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10261 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10263 expected_len = lstrlenW(http_urlW);
10265 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10266 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10267 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10268 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10269 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10270 expected_len, result);
10272 if(uri) IUri_Release(uri);
10275 static void test_CoInternetParseIUri(void) {
10278 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10282 uri_parse_test test = uri_parse_tests[i];
10284 uriW = a2w(test.uri);
10285 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10286 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10287 if(SUCCEEDED(hr)) {
10288 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10289 DWORD result_len = -1;
10291 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10294 ok(hr == test.expected,
10295 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10296 hr, test.expected, i);
10299 ok(hr == test.expected,
10300 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10301 hr, test.expected, i);
10303 if(SUCCEEDED(hr)) {
10304 DWORD len = lstrlenA(test.property);
10305 ok(!strcmp_aw(test.property, result),
10306 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10307 test.property, wine_dbgstr_w(result), i);
10308 ok(len == result_len,
10309 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10310 len, result_len, i);
10313 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10317 if(uri) IUri_Release(uri);
10322 static void test_CoInternetParseIUri_Pluggable(void) {
10326 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10327 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10328 if(SUCCEEDED(hr)) {
10332 SET_EXPECT(ParseUrl);
10334 parse_action = PARSE_CANONICALIZE;
10335 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10337 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10338 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10340 CHECK_CALLED(ParseUrl);
10342 if(SUCCEEDED(hr)) {
10343 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10344 lstrlenW(parse_resultW), result_len);
10345 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10346 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10349 if(uri) IUri_Release(uri);
10355 const char *base_url;
10356 DWORD base_uri_flags;
10357 const char *legacy_url;
10358 const char *uniform_url;
10359 const char *no_canon_url;
10360 const char *uri_url;
10361 } create_urlmon_test_t;
10363 static const create_urlmon_test_t create_urlmon_tests[] = {
10365 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10367 "http://www.winehq.org/",
10368 "http://www.winehq.org/",
10369 "http://www.winehq.org",
10370 "http://www.winehq.org"
10373 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10375 "file://c:\\dir\\file.txt",
10376 "file:///c:/dir/file.txt",
10377 "file:///c:/dir/file.txt",
10378 "file:///c:/dir/file.txt"
10381 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10383 "file://c:\\dir\\file.txt",
10384 "file:///c:/dir/file.txt",
10385 "file:///c:/dir/file.txt",
10386 "file://c:\\dir\\file.txt"
10389 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10390 "http://www.winehq.org",0,
10391 "http://www.winehq.org/data",
10392 "http://www.winehq.org/data",
10393 "http://www.winehq.org:80/data",
10396 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10397 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10398 "file://c:\\dir\\file.txt",
10399 "file:///c:/dir/file.txt",
10400 "file:///c:/dir/file.txt",
10403 "",Uri_CREATE_ALLOW_RELATIVE,
10411 "test",Uri_CREATE_ALLOW_RELATIVE,
10419 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10421 "file://c:\\dir\\file.txt",
10422 "file:///c:/dir/file.txt",
10423 "file:///c:/dir/file.txt",
10424 "file:///c:/dir/file.txt",
10428 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10429 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10431 WCHAR *display_name;
10434 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10435 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10436 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10437 wine_dbgstr_w(display_name), exurl);
10439 CoTaskMemFree(display_name);
10442 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10443 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10445 IUriContainer *uri_container;
10450 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10451 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10454 hres = IUriContainer_GetIUri(uri_container, &uri);
10455 IUriContainer_Release(uri_container);
10456 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10457 ok(uri != NULL, "uri == NULL\n");
10459 hres = IUri_GetDisplayUri(uri, &display_uri);
10461 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10462 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10463 wine_dbgstr_w(display_uri), exurl);
10464 SysFreeString(display_uri);
10467 static void test_CreateURLMoniker(void)
10469 const create_urlmon_test_t *test;
10470 IMoniker *mon, *base_mon;
10471 WCHAR *url, *base_url;
10472 IUri *uri, *base_uri;
10475 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10476 url = a2w(test->url);
10477 base_url = a2w(test->base_url);
10480 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10481 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10483 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10484 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10490 hres = CreateURLMoniker(base_mon, url, &mon);
10491 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10492 test_urlmon_display_name(mon, test->legacy_url);
10493 test_display_uri(mon, test->legacy_url);
10494 IMoniker_Release(mon);
10496 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10497 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10498 test_urlmon_display_name(mon, test->legacy_url);
10499 test_display_uri(mon, test->legacy_url);
10500 IMoniker_Release(mon);
10502 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10503 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10504 test_urlmon_display_name(mon, test->uniform_url);
10505 test_display_uri(mon, test->uniform_url);
10506 IMoniker_Release(mon);
10508 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10509 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10510 test_urlmon_display_name(mon, test->no_canon_url);
10511 test_display_uri(mon, test->no_canon_url);
10512 IMoniker_Release(mon);
10514 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10515 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10517 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10518 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10519 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10520 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10521 IMoniker_Release(mon);
10523 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10524 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10525 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10526 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10527 IMoniker_Release(mon);
10529 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10530 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10531 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10532 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10533 IMoniker_Release(mon);
10537 heap_free(base_url);
10539 IUri_Release(base_uri);
10541 IMoniker_Release(base_mon);
10548 hurlmon = GetModuleHandle("urlmon.dll");
10549 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
10550 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
10551 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
10552 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
10553 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
10554 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
10555 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
10556 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
10557 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
10560 win_skip("CreateUri is not present, skipping tests.\n");
10564 trace("test CreateUri invalid flags...\n");
10565 test_CreateUri_InvalidFlags();
10567 trace("test CreateUri invalid args...\n");
10568 test_CreateUri_InvalidArgs();
10570 trace("test CreateUri invalid URIs...\n");
10571 test_CreateUri_InvalidUri();
10573 trace("test IUri_GetPropertyBSTR...\n");
10574 test_IUri_GetPropertyBSTR();
10576 trace("test IUri_GetPropertyDWORD...\n");
10577 test_IUri_GetPropertyDWORD();
10579 trace("test IUri_GetStrProperties...\n");
10580 test_IUri_GetStrProperties();
10582 trace("test IUri_GetDwordProperties...\n");
10583 test_IUri_GetDwordProperties();
10585 trace("test IUri_GetPropertyLength...\n");
10586 test_IUri_GetPropertyLength();
10588 trace("test IUri_GetProperties...\n");
10589 test_IUri_GetProperties();
10591 trace("test IUri_HasProperty...\n");
10592 test_IUri_HasProperty();
10594 trace("test IUri_IsEqual...\n");
10595 test_IUri_IsEqual();
10597 trace("test CreateUriWithFragment invalid args...\n");
10598 test_CreateUriWithFragment_InvalidArgs();
10600 trace("test CreateUriWithFragment invalid flags...\n");
10601 test_CreateUriWithFragment_InvalidFlags();
10603 trace("test CreateUriWithFragment...\n");
10604 test_CreateUriWithFragment();
10606 trace("test CreateIUriBuilder...\n");
10607 test_CreateIUriBuilder();
10609 trace("test IUriBuilder_CreateInvalidArgs...\n");
10610 test_IUriBuilder_CreateInvalidArgs();
10612 trace("test IUriBuilder...\n");
10613 test_IUriBuilder();
10615 trace("test IUriBuilder_GetInvalidArgs...\n");
10616 test_IUriBuilder_GetInvalidArgs();
10618 trace("test IUriBuilder_HasBeenModified...\n");
10619 test_IUriBuilder_HasBeenModified();
10621 trace("test IUriBuilder_IUriProperty...\n");
10622 test_IUriBuilder_IUriProperty();
10624 trace("test IUriBuilder_RemoveProperties...\n");
10625 test_IUriBuilder_RemoveProperties();
10627 trace("test IUriBuilder miscellaneous...\n");
10628 test_IUriBuilder_Misc();
10630 trace("test IUriBuilderFactory...\n");
10631 test_IUriBuilderFactory();
10633 trace("test CoInternetCombineIUri...\n");
10634 test_CoInternetCombineIUri();
10636 trace("test CoInternetCombineUrlEx...\n");
10637 test_CoInternetCombineUrlEx();
10639 trace("test CoInternetParseIUri Invalid Args...\n");
10640 test_CoInternetParseIUri_InvalidArgs();
10642 trace("test CoInternetParseIUri...\n");
10643 test_CoInternetParseIUri();
10645 register_protocols();
10647 trace("test CoInternetCombineIUri pluggable...\n");
10648 test_CoInternetCombineIUri_Pluggable();
10650 trace("test CoInternetCombineUrlEx Pluggable...\n");
10651 test_CoInternetCombineUrlEx_Pluggable();
10653 trace("test CoInternetParseIUri pluggable...\n");
10654 test_CoInternetParseIUri_Pluggable();
10656 trace("test CreateURLMoniker...\n");
10657 test_CreateURLMoniker();
10659 unregister_protocols();