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;
4423 DWORD create_flags_b;
4429 static const uri_equality equality_tests[] = {
4431 "HTTP://www.winehq.org/test dir/./",0,FALSE,
4432 "http://www.winehq.org/test dir/../test dir/",0,FALSE,
4436 /* http://www.winehq.org/test%20dir */
4437 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,FALSE,
4438 "http://www.winehq.org/test dir",0,FALSE,
4442 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,FALSE,
4443 "file:///c:/test.mp3",0,FALSE,
4447 "ftp://ftp.winehq.org/",0,FALSE,
4448 "ftp://ftp.winehq.org",0,FALSE,
4452 "ftp://ftp.winehq.org/test/test2/../../testB/",0,FALSE,
4453 "ftp://ftp.winehq.org/t%45stB/",0,FALSE,
4457 "http://google.com/TEST",0,FALSE,
4458 "http://google.com/test",0,FALSE,
4462 "http://GOOGLE.com/",0,FALSE,
4463 "http://google.com/",0,FALSE,
4466 /* Performs case insensitive compare of host names (for known scheme types). */
4468 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4469 "ftp://google.com/",0,FALSE,
4473 "zip://GOOGLE.com/",0,FALSE,
4474 "zip://google.com/",0,FALSE,
4478 "file:///c:/TEST/TeST/",0,FALSE,
4479 "file:///c:/test/test/",0,FALSE,
4483 "file:///server/TEST",0,FALSE,
4484 "file:///SERVER/TEST",0,FALSE,
4488 "http://google.com",Uri_CREATE_NO_CANONICALIZE,FALSE,
4489 "http://google.com/",0,FALSE,
4493 "ftp://google.com:21/",0,FALSE,
4494 "ftp://google.com/",0,FALSE,
4498 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4499 "http://google.com/",0,FALSE,
4503 "http://google.com:70/",0,FALSE,
4504 "http://google.com:71/",0,FALSE,
4509 typedef struct _uri_with_fragment {
4511 const char* fragment;
4513 HRESULT create_expected;
4516 const char* expected_uri;
4518 } uri_with_fragment;
4520 static const uri_with_fragment uri_fragment_tests[] = {
4522 "http://google.com/","#fragment",0,S_OK,FALSE,
4523 "http://google.com/#fragment",FALSE
4526 "http://google.com/","fragment",0,S_OK,FALSE,
4527 "http://google.com/#fragment",FALSE
4530 "zip://test.com/","?test",0,S_OK,FALSE,
4531 "zip://test.com/#?test",FALSE
4533 /* The fragment can be empty. */
4535 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4536 "ftp://ftp.google.com/#",FALSE
4540 typedef struct _uri_builder_property {
4543 const char *expected_value;
4544 Uri_PROPERTY property;
4547 } uri_builder_property;
4549 typedef struct _uri_builder_port {
4557 typedef struct _uri_builder_str_property {
4558 const char* expected;
4561 } uri_builder_str_property;
4563 typedef struct _uri_builder_dword_property {
4567 } uri_builder_dword_property;
4569 typedef struct _uri_builder_test {
4572 HRESULT create_builder_expected;
4573 BOOL create_builder_todo;
4575 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4577 uri_builder_port port_prop;
4583 DWORD uri_simple_encode_flags;
4584 HRESULT uri_simple_hres;
4585 BOOL uri_simple_todo;
4587 DWORD uri_with_flags;
4588 DWORD uri_with_builder_flags;
4589 DWORD uri_with_encode_flags;
4590 HRESULT uri_with_hres;
4593 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4594 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4597 static const uri_builder_test uri_builder_tests[] = {
4598 { "http://google.com/",0,S_OK,FALSE,
4600 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4601 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4602 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4603 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4610 {"http://username:password@google.com/?query=x#fragment",S_OK},
4611 {"username:password@google.com",S_OK},
4612 {"http://google.com/?query=x#fragment",S_OK},
4613 {"google.com",S_OK},
4616 {"google.com",S_OK},
4621 {"http://username:password@google.com/?query=x#fragment",S_OK},
4623 {"username:password",S_OK},
4627 {Uri_HOST_DNS,S_OK},
4629 {URL_SCHEME_HTTP,S_OK},
4630 {URLZONE_INVALID,E_NOTIMPL}
4633 { "http://google.com/",0,S_OK,FALSE,
4635 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4637 {TRUE,TRUE,120,S_OK,FALSE},
4642 {"test://google.com:120/",S_OK},
4643 {"google.com:120",S_OK},
4644 {"test://google.com:120/",S_OK},
4645 {"google.com",S_OK},
4648 {"google.com",S_OK},
4653 {"test://google.com:120/",S_OK},
4659 {Uri_HOST_DNS,S_OK},
4661 {URL_SCHEME_UNKNOWN,S_OK},
4662 {URLZONE_INVALID,E_NOTIMPL}
4665 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4667 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4668 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4669 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4676 {"http://[::192.2.3.4]/",S_OK},
4677 {"[::192.2.3.4]",S_OK},
4678 {"http://[::192.2.3.4]/",S_OK},
4682 {"::192.2.3.4",S_OK},
4687 {"http://[::192.2.3.4]/",S_OK},
4693 {Uri_HOST_IPV6,S_OK},
4695 {URL_SCHEME_HTTP,S_OK},
4696 {URLZONE_INVALID,E_NOTIMPL}
4699 { "http://google.com/",0,S_OK,FALSE,
4701 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4708 {"http://google.com/#Frag",S_OK},
4709 {"google.com",S_OK},
4710 {"http://google.com/#Frag",S_OK},
4711 {"google.com",S_OK},
4714 {"google.com",S_OK},
4719 {"http://google.com/#Frag",S_OK},
4725 {Uri_HOST_DNS,S_OK},
4727 {URL_SCHEME_HTTP,S_OK},
4728 {URLZONE_INVALID,E_NOTIMPL}
4731 { "http://google.com/",0,S_OK,FALSE,
4733 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4740 {"http://google.com/#",S_OK},
4741 {"google.com",S_OK},
4742 {"http://google.com/#",S_OK},
4743 {"google.com",S_OK},
4746 {"google.com",S_OK},
4751 {"http://google.com/#",S_OK},
4757 {Uri_HOST_DNS,S_OK},
4759 {URL_SCHEME_HTTP,S_OK},
4760 {URLZONE_INVALID,E_NOTIMPL}
4763 { "http://google.com/",0,S_OK,FALSE,
4765 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4772 {"http://::password@google.com/",S_OK},
4773 {"::password@google.com",S_OK},
4774 {"http://google.com/",S_OK},
4775 {"google.com",S_OK},
4778 {"google.com",S_OK},
4783 {"http://::password@google.com/",S_OK},
4785 {"::password",S_OK},
4789 {Uri_HOST_DNS,S_OK},
4791 {URL_SCHEME_HTTP,S_OK},
4792 {URLZONE_INVALID,E_NOTIMPL}
4795 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4797 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4800 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4802 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4804 {":password@test/test",S_OK},
4805 {":password@",S_OK},
4806 {":password@test/test",S_OK},
4815 {":password@test/test",S_OK},
4821 {Uri_HOST_UNKNOWN,S_OK},
4823 {URL_SCHEME_UNKNOWN,S_OK},
4824 {URLZONE_INVALID,E_NOTIMPL}
4827 { "http://google.com/",0,S_OK,FALSE,
4829 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4836 {"http://google.com/test/test",S_OK},
4837 {"google.com",S_OK},
4838 {"http://google.com/test/test",S_OK},
4839 {"google.com",S_OK},
4842 {"google.com",S_OK},
4844 {"/test/test",S_OK},
4845 {"/test/test",S_OK},
4847 {"http://google.com/test/test",S_OK},
4853 {Uri_HOST_DNS,S_OK},
4855 {URL_SCHEME_HTTP,S_OK},
4856 {URLZONE_INVALID,E_NOTIMPL}
4859 { "zip:testing/test",0,S_OK,FALSE,
4861 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4885 {Uri_HOST_UNKNOWN,S_OK},
4887 {URL_SCHEME_UNKNOWN,S_OK},
4888 {URLZONE_INVALID,E_NOTIMPL}
4891 { "http://google.com/",0,S_OK,FALSE,
4895 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4896 {TRUE,FALSE,555,S_OK,FALSE},
4901 {"http://google.com/",S_OK},
4902 {"google.com",S_OK},
4903 {"http://google.com/",S_OK},
4904 {"google.com",S_OK},
4907 {"google.com",S_OK},
4912 {"http://google.com/",S_OK},
4918 {Uri_HOST_DNS,S_OK},
4919 /* Still returns 80, even though earlier the port was disabled. */
4921 {URL_SCHEME_HTTP,S_OK},
4922 {URLZONE_INVALID,E_NOTIMPL}
4925 { "http://google.com/",0,S_OK,FALSE,
4929 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4930 * you'll get 122345 instead.
4932 {TRUE,122345,222,S_OK,FALSE},
4937 {"http://google.com:222/",S_OK},
4938 {"google.com:222",S_OK},
4939 {"http://google.com:222/",S_OK},
4940 {"google.com",S_OK},
4943 {"google.com",S_OK},
4948 {"http://google.com:222/",S_OK},
4954 {Uri_HOST_DNS,S_OK},
4956 {URL_SCHEME_HTTP,S_OK},
4957 {URLZONE_INVALID,E_NOTIMPL}
4960 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
4961 { "http://google.com/",0,S_OK,FALSE,
4965 {TRUE,TRUE,999999,S_OK,FALSE},
4970 {"http://google.com:999999/",S_OK},
4971 {"google.com:999999",S_OK},
4972 {"http://google.com:999999/",S_OK},
4973 {"google.com",S_OK},
4976 {"google.com",S_OK},
4981 {"http://google.com:999999/",S_OK},
4987 {Uri_HOST_DNS,S_OK},
4989 {URL_SCHEME_HTTP,S_OK},
4990 {URLZONE_INVALID,E_NOTIMPL}
4993 { "http://google.com/",0,S_OK,FALSE,
4995 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5003 {"http://google.com/?test",S_OK},
5004 {"google.com",S_OK},
5005 {"http://google.com/?test",S_OK},
5006 {"google.com",S_OK},
5009 {"google.com",S_OK},
5014 {"http://google.com/?test",S_OK},
5020 {Uri_HOST_DNS,S_OK},
5022 {URL_SCHEME_HTTP,S_OK},
5023 {URLZONE_INVALID,E_NOTIMPL}
5026 { "http://:password@google.com/",0,S_OK,FALSE,
5035 {"http://:password@google.com/",S_OK},
5036 {":password@google.com",S_OK},
5037 {"http://google.com/",S_OK},
5038 {"google.com",S_OK},
5041 {"google.com",S_OK},
5046 {"http://:password@google.com/",S_OK},
5052 {Uri_HOST_DNS,S_OK},
5054 {URL_SCHEME_HTTP,S_OK},
5055 {URLZONE_INVALID,E_NOTIMPL}
5058 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5059 { NULL,0,S_OK,FALSE,
5061 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5062 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5069 {"http://google.com/",S_OK},
5070 {"google.com",S_OK},
5071 {"http://google.com/",S_OK},
5072 {"google.com",S_OK},
5075 {"google.com",S_OK},
5080 {"http://google.com/",S_OK},
5086 {Uri_HOST_DNS,S_OK},
5088 {URL_SCHEME_HTTP,S_OK},
5089 {URLZONE_INVALID,E_NOTIMPL}
5092 /* Can't set the scheme name to NULL. */
5093 { "zip://google.com/",0,S_OK,FALSE,
5095 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5102 {"zip://google.com/",S_OK},
5103 {"google.com",S_OK},
5104 {"zip://google.com/",S_OK},
5105 {"google.com",S_OK},
5108 {"google.com",S_OK},
5113 {"zip://google.com/",S_OK},
5119 {Uri_HOST_DNS,S_OK},
5121 {URL_SCHEME_UNKNOWN,S_OK},
5122 {URLZONE_INVALID,E_NOTIMPL}
5125 /* Can't set the scheme name to an empty string. */
5126 { "zip://google.com/",0,S_OK,FALSE,
5128 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5135 {"zip://google.com/",S_OK},
5136 {"google.com",S_OK},
5137 {"zip://google.com/",S_OK},
5138 {"google.com",S_OK},
5141 {"google.com",S_OK},
5146 {"zip://google.com/",S_OK},
5152 {Uri_HOST_DNS,S_OK},
5154 {URL_SCHEME_UNKNOWN,S_OK},
5155 {URLZONE_INVALID,E_NOTIMPL}
5158 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5159 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5161 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5166 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5168 {"http://google.com/../../",S_OK},
5169 {"google.com",S_OK},
5170 {"http://google.com/../../",S_OK},
5171 {"google.com",S_OK},
5174 {"google.com",S_OK},
5179 {"http://google.com/../../",S_OK},
5185 {Uri_HOST_DNS,S_OK},
5187 {URL_SCHEME_HTTP,S_OK},
5188 {URLZONE_INVALID,E_NOTIMPL}
5191 { "http://google.com/",0,S_OK,FALSE,
5193 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5198 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5200 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5201 {"google.com",S_OK},
5202 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5203 {"google.com",S_OK},
5205 {"#Fr%3C%7C%3Eg",S_OK},
5206 {"google.com",S_OK},
5211 {"http://google.com/#Fr<|>g",S_OK},
5217 {Uri_HOST_DNS,S_OK},
5219 {URL_SCHEME_HTTP,S_OK},
5220 {URLZONE_INVALID,E_NOTIMPL}
5223 { "http://google.com/",0,S_OK,FALSE,
5225 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5228 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5230 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5232 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5233 {"google.com",S_OK},
5234 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5235 {"google.com",S_OK},
5237 {"#Fr%3C%7C%3Eg",S_OK},
5238 {"google.com",S_OK},
5243 {"http://google.com/#Fr<|>g",S_OK},
5249 {Uri_HOST_DNS,S_OK},
5251 {URL_SCHEME_HTTP,S_OK},
5252 {URLZONE_INVALID,E_NOTIMPL}
5255 { NULL,0,S_OK,FALSE,
5257 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5258 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5261 0,INET_E_INVALID_URL,FALSE,
5262 0,INET_E_INVALID_URL,FALSE,
5263 0,0,0,INET_E_INVALID_URL,FALSE
5265 { "http://google.com/",0,S_OK,FALSE,
5267 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5270 0,INET_E_INVALID_URL,FALSE,
5271 0,INET_E_INVALID_URL,FALSE,
5272 0,0,0,INET_E_INVALID_URL,FALSE
5274 /* File scheme's can't have a username set. */
5275 { "file://google.com/",0,S_OK,FALSE,
5277 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5280 0,INET_E_INVALID_URL,FALSE,
5281 0,INET_E_INVALID_URL,FALSE,
5282 0,0,0,INET_E_INVALID_URL,FALSE
5284 /* File schemes can't have a password set. */
5285 { "file://google.com/",0,S_OK,FALSE,
5287 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5290 0,INET_E_INVALID_URL,FALSE,
5291 0,INET_E_INVALID_URL,FALSE,
5292 0,0,0,INET_E_INVALID_URL,FALSE
5294 /* UserName can't contain any character that is a delimeter for another
5295 * component that appears after it in a normal URI.
5297 { "http://google.com/",0,S_OK,FALSE,
5299 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5302 0,INET_E_INVALID_URL,FALSE,
5303 0,INET_E_INVALID_URL,FALSE,
5304 0,0,0,INET_E_INVALID_URL,FALSE
5306 { "http://google.com/",0,S_OK,FALSE,
5308 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5311 0,INET_E_INVALID_URL,FALSE,
5312 0,INET_E_INVALID_URL,FALSE,
5313 0,0,0,INET_E_INVALID_URL,FALSE
5315 { "http://google.com/",0,S_OK,FALSE,
5317 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5320 0,INET_E_INVALID_URL,FALSE,
5321 0,INET_E_INVALID_URL,FALSE,
5322 0,0,0,INET_E_INVALID_URL,FALSE
5324 { "http://google.com/",0,S_OK,FALSE,
5326 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5329 0,INET_E_INVALID_URL,FALSE,
5330 0,INET_E_INVALID_URL,FALSE,
5331 0,0,0,INET_E_INVALID_URL,FALSE
5333 { "http://google.com/",0,S_OK,FALSE,
5335 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5338 0,INET_E_INVALID_URL,FALSE,
5339 0,INET_E_INVALID_URL,FALSE,
5340 0,0,0,INET_E_INVALID_URL,FALSE
5342 { "http://google.com/",0,S_OK,FALSE,
5344 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5347 0,INET_E_INVALID_URL,FALSE,
5348 0,INET_E_INVALID_URL,FALSE,
5349 0,0,0,INET_E_INVALID_URL,FALSE
5351 { "http://google.com/",0,S_OK,FALSE,
5353 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5356 0,INET_E_INVALID_URL,FALSE,
5357 0,INET_E_INVALID_URL,FALSE,
5358 0,0,0,INET_E_INVALID_URL,FALSE
5360 { "http://google.com/",0,S_OK,FALSE,
5362 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5365 0,INET_E_INVALID_URL,FALSE,
5366 0,INET_E_INVALID_URL,FALSE,
5367 0,0,0,INET_E_INVALID_URL,FALSE
5369 { "http://google.com/",0,S_OK,FALSE,
5371 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5374 0,INET_E_INVALID_URL,FALSE,
5375 0,INET_E_INVALID_URL,FALSE,
5376 0,0,0,INET_E_INVALID_URL,FALSE
5378 { "http://google.com/",0,S_OK,FALSE,
5380 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5383 0,INET_E_INVALID_URL,FALSE,
5384 0,INET_E_INVALID_URL,FALSE,
5385 0,0,0,INET_E_INVALID_URL,FALSE
5387 { "http://google.com/",0,S_OK,FALSE,
5389 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5392 0,INET_E_INVALID_URL,FALSE,
5393 0,INET_E_INVALID_URL,FALSE,
5394 0,0,0,INET_E_INVALID_URL,FALSE
5396 { "http://google.com/",0,S_OK,FALSE,
5398 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5401 0,INET_E_INVALID_URL,FALSE,
5402 0,INET_E_INVALID_URL,FALSE,
5403 0,0,0,INET_E_INVALID_URL,FALSE
5405 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5406 { "http://google.com/",0,S_OK,FALSE,
5408 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5415 {"http://winehq.org:test/",S_OK},
5416 {"winehq.org:test",S_OK},
5417 {"http://winehq.org:test/",S_OK},
5418 {"winehq.org:test",S_OK},
5421 {"winehq.org:test",S_OK},
5426 {"http://winehq.org:test/",S_OK},
5432 {Uri_HOST_DNS,S_OK},
5434 {URL_SCHEME_HTTP,S_OK},
5435 {URLZONE_INVALID,E_NOTIMPL}
5438 /* Can't set the host name to NULL. */
5439 { "http://google.com/",0,S_OK,FALSE,
5441 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5448 {"http://google.com/",S_OK},
5449 {"google.com",S_OK},
5450 {"http://google.com/",S_OK},
5451 {"google.com",S_OK},
5454 {"google.com",S_OK},
5459 {"http://google.com/",S_OK},
5465 {Uri_HOST_DNS,S_OK},
5467 {URL_SCHEME_HTTP,S_OK},
5468 {URLZONE_INVALID,E_NOTIMPL}
5471 /* Can set the host name to an empty string. */
5472 { "http://google.com/",0,S_OK,FALSE,
5474 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5498 {Uri_HOST_UNKNOWN,S_OK},
5500 {URL_SCHEME_HTTP,S_OK},
5501 {URLZONE_INVALID,E_NOTIMPL}
5504 { "http://google.com/",0,S_OK,FALSE,
5506 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5509 0,INET_E_INVALID_URL,FALSE,
5510 0,INET_E_INVALID_URL,FALSE,
5511 0,0,0,INET_E_INVALID_URL,FALSE
5513 { "http://google.com/",0,S_OK,FALSE,
5515 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5518 0,INET_E_INVALID_URL,FALSE,
5519 0,INET_E_INVALID_URL,FALSE,
5520 0,0,0,INET_E_INVALID_URL,FALSE
5522 { "http://google.com/",0,S_OK,FALSE,
5524 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5527 0,INET_E_INVALID_URL,FALSE,
5528 0,INET_E_INVALID_URL,FALSE,
5529 0,0,0,INET_E_INVALID_URL,FALSE
5533 typedef struct _uri_builder_remove_test {
5536 HRESULT create_builder_expected;
5537 BOOL create_builder_todo;
5539 DWORD remove_properties;
5540 HRESULT remove_expected;
5543 const char *expected_uri;
5544 DWORD expected_flags;
5545 HRESULT expected_hres;
5547 } uri_builder_remove_test;
5549 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5550 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5551 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5552 "http://google.com/",0,S_OK,FALSE
5554 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5555 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5556 "http://winehq.org/",0,S_OK,FALSE
5558 { "zip://google.com?Test=x",0,S_OK,FALSE,
5559 Uri_HAS_HOST,S_OK,FALSE,
5560 "zip:/?Test=x",0,S_OK,FALSE
5562 /* Doesn't remove the whole userinfo component. */
5563 { "http://username:pass@google.com/",0,S_OK,FALSE,
5564 Uri_HAS_USER_INFO,S_OK,FALSE,
5565 "http://username:pass@google.com/",0,S_OK,FALSE
5567 /* Doesn't remove the domain. */
5568 { "http://google.com/",0,S_OK,FALSE,
5569 Uri_HAS_DOMAIN,S_OK,FALSE,
5570 "http://google.com/",0,S_OK,FALSE
5572 { "http://google.com:120/",0,S_OK,FALSE,
5573 Uri_HAS_AUTHORITY,S_OK,FALSE,
5574 "http://google.com:120/",0,S_OK,FALSE
5576 { "http://google.com/test.com/",0,S_OK,FALSE,
5577 Uri_HAS_EXTENSION,S_OK,FALSE,
5578 "http://google.com/test.com/",0,S_OK,FALSE
5580 { "http://google.com/?test=x",0,S_OK,FALSE,
5581 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5582 "http://google.com/?test=x",0,S_OK,FALSE
5584 /* Can't remove the scheme name. */
5585 { "http://google.com/?test=x",0,S_OK,FALSE,
5586 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5587 "http://google.com/?test=x",0,S_OK,FALSE
5591 typedef struct _uri_combine_str_property {
5595 const char *broken_value;
5596 const char *value_ex;
5597 } uri_combine_str_property;
5599 typedef struct _uri_combine_test {
5600 const char *base_uri;
5601 DWORD base_create_flags;
5602 const char *relative_uri;
5603 DWORD relative_create_flags;
5604 DWORD combine_flags;
5608 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5609 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5612 static const uri_combine_test uri_combine_tests[] = {
5613 { "http://google.com/fun/stuff",0,
5614 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5617 {"http://google.com/not/fun/stuff",S_OK},
5618 {"google.com",S_OK},
5619 {"http://google.com/not/fun/stuff",S_OK},
5620 {"google.com",S_OK},
5623 {"google.com",S_OK},
5625 {"/not/fun/stuff",S_OK},
5626 {"/not/fun/stuff",S_OK},
5628 {"http://google.com/not/fun/stuff",S_OK},
5634 {Uri_HOST_DNS,S_OK},
5636 {URL_SCHEME_HTTP,S_OK},
5637 {URLZONE_INVALID,E_NOTIMPL}
5640 { "http://google.com/test",0,
5641 "zip://test.com/cool",0,
5644 {"zip://test.com/cool",S_OK},
5646 {"zip://test.com/cool",S_OK},
5655 {"zip://test.com/cool",S_OK},
5661 {Uri_HOST_DNS,S_OK},
5663 {URL_SCHEME_UNKNOWN,S_OK},
5664 {URLZONE_INVALID,E_NOTIMPL}
5667 { "http://google.com/use/base/path",0,
5668 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5671 {"http://google.com/use/base/path?relative",S_OK},
5672 {"google.com",S_OK},
5673 {"http://google.com/use/base/path?relative",S_OK},
5674 {"google.com",S_OK},
5677 {"google.com",S_OK},
5679 {"/use/base/path",S_OK},
5680 {"/use/base/path?relative",S_OK},
5682 {"http://google.com/use/base/path?relative",S_OK},
5688 {Uri_HOST_DNS,S_OK},
5690 {URL_SCHEME_HTTP,S_OK},
5691 {URLZONE_INVALID,E_NOTIMPL}
5694 { "http://google.com/path",0,
5695 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5698 {"http://google.com/testing",S_OK},
5699 {"google.com",S_OK},
5700 {"http://google.com/testing",S_OK},
5701 {"google.com",S_OK},
5704 {"google.com",S_OK},
5709 {"http://google.com/testing",S_OK},
5715 {Uri_HOST_DNS,S_OK},
5717 {URL_SCHEME_HTTP,S_OK},
5718 {URLZONE_INVALID,E_NOTIMPL}
5721 { "http://google.com/path",0,
5722 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5723 URL_DONT_SIMPLIFY,S_OK,FALSE,
5725 {"http://google.com:80/test/../test/.././testing",S_OK},
5726 {"google.com",S_OK},
5727 {"http://google.com:80/test/../test/.././testing",S_OK},
5728 {"google.com",S_OK},
5731 {"google.com",S_OK},
5733 {"/test/../test/.././testing",S_OK},
5734 {"/test/../test/.././testing",S_OK},
5736 {"http://google.com:80/test/../test/.././testing",S_OK},
5742 {Uri_HOST_DNS,S_OK},
5744 {URL_SCHEME_HTTP,S_OK},
5745 {URLZONE_INVALID,E_NOTIMPL}
5748 { "http://winehq.org/test/abc",0,
5749 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5752 {"http://winehq.org/test/testing/test",S_OK},
5753 {"winehq.org",S_OK},
5754 {"http://winehq.org/test/testing/test",S_OK},
5755 {"winehq.org",S_OK},
5758 {"winehq.org",S_OK},
5760 {"/test/testing/test",S_OK},
5761 {"/test/testing/test",S_OK},
5763 {"http://winehq.org/test/testing/test",S_OK},
5769 {Uri_HOST_DNS,S_OK},
5771 {URL_SCHEME_HTTP,S_OK},
5772 {URLZONE_INVALID,E_NOTIMPL}
5775 { "http://winehq.org/test/abc",0,
5776 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5777 URL_DONT_SIMPLIFY,S_OK,FALSE,
5779 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5780 /* Default port is hidden in the authority. */
5781 {"winehq.org",S_OK},
5782 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5783 {"winehq.org",S_OK},
5786 {"winehq.org",S_OK},
5788 {"/test/testing/abc/../test",S_OK},
5789 {"/test/testing/abc/../test",S_OK},
5791 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5797 {Uri_HOST_DNS,S_OK},
5799 {URL_SCHEME_HTTP,S_OK},
5800 {URLZONE_INVALID,E_NOTIMPL}
5803 { "http://winehq.org/test?query",0,
5804 "testing",Uri_CREATE_ALLOW_RELATIVE,
5807 {"http://winehq.org/testing",S_OK},
5808 {"winehq.org",S_OK},
5809 {"http://winehq.org/testing",S_OK},
5810 {"winehq.org",S_OK},
5813 {"winehq.org",S_OK},
5818 {"http://winehq.org/testing",S_OK},
5824 {Uri_HOST_DNS,S_OK},
5826 {URL_SCHEME_HTTP,S_OK},
5827 {URLZONE_INVALID,E_NOTIMPL}
5830 { "http://winehq.org/test#frag",0,
5831 "testing",Uri_CREATE_ALLOW_RELATIVE,
5834 {"http://winehq.org/testing",S_OK},
5835 {"winehq.org",S_OK},
5836 {"http://winehq.org/testing",S_OK},
5837 {"winehq.org",S_OK},
5840 {"winehq.org",S_OK},
5845 {"http://winehq.org/testing",S_OK},
5851 {Uri_HOST_DNS,S_OK},
5853 {URL_SCHEME_HTTP,S_OK},
5854 {URLZONE_INVALID,E_NOTIMPL}
5857 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5858 "test",Uri_CREATE_ALLOW_RELATIVE,
5878 {Uri_HOST_UNKNOWN,S_OK},
5880 {URL_SCHEME_UNKNOWN,S_OK},
5881 {URLZONE_INVALID,E_NOTIMPL}
5884 { "file:///c:/test/test",0,
5885 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5886 URL_FILE_USE_PATHURL,S_OK,FALSE,
5888 {"file://c:\\testing.mp3",S_OK},
5890 {"file://c:\\testing.mp3",S_OK},
5896 {"c:\\testing.mp3",S_OK},
5897 {"c:\\testing.mp3",S_OK},
5899 {"file://c:\\testing.mp3",S_OK},
5905 {Uri_HOST_UNKNOWN,S_OK},
5907 {URL_SCHEME_FILE,S_OK},
5908 {URLZONE_INVALID,E_NOTIMPL}
5911 { "file:///c:/test/test",0,
5912 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5915 {"file:///c:/testing.mp3",S_OK},
5917 {"file:///c:/testing.mp3",S_OK},
5923 {"/c:/testing.mp3",S_OK},
5924 {"/c:/testing.mp3",S_OK},
5926 {"file:///c:/testing.mp3",S_OK},
5932 {Uri_HOST_UNKNOWN,S_OK},
5934 {URL_SCHEME_FILE,S_OK},
5935 {URLZONE_INVALID,E_NOTIMPL}
5938 { "file://test.com/test/test",0,
5939 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5940 URL_FILE_USE_PATHURL,S_OK,FALSE,
5942 {"file://\\\\test.com\\testing.mp3",S_OK},
5944 {"file://\\\\test.com\\testing.mp3",S_OK},
5950 {"\\testing.mp3",S_OK},
5951 {"\\testing.mp3",S_OK},
5953 {"file://\\\\test.com\\testing.mp3",S_OK},
5959 {Uri_HOST_DNS,S_OK},
5961 {URL_SCHEME_FILE,S_OK},
5962 {URLZONE_INVALID,E_NOTIMPL}
5965 /* URL_DONT_SIMPLIFY has no effect. */
5966 { "http://google.com/test",0,
5967 "zip://test.com/cool/../cool/test",0,
5968 URL_DONT_SIMPLIFY,S_OK,FALSE,
5970 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5972 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5978 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5979 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5981 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
5982 * On IE 7 it reduces the path in the Raw URI.
5984 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
5990 {Uri_HOST_DNS,S_OK},
5992 {URL_SCHEME_UNKNOWN,S_OK},
5993 {URLZONE_INVALID,E_NOTIMPL}
5996 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
5997 * resulting URI is converted into a dos path.
5999 { "http://google.com/test",0,
6000 "file:///c:/test/",0,
6001 URL_FILE_USE_PATHURL,S_OK,FALSE,
6003 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6005 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6011 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6012 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6014 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6020 {Uri_HOST_UNKNOWN,S_OK},
6022 {URL_SCHEME_FILE,S_OK},
6023 {URLZONE_INVALID,E_NOTIMPL}
6026 { "http://google.com/test",0,
6027 "http://test.com/test#%30test",0,
6028 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6030 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6032 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6035 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6041 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6042 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6048 {Uri_HOST_DNS,S_OK},
6050 {URL_SCHEME_HTTP,S_OK},
6051 {URLZONE_INVALID,E_NOTIMPL}
6054 /* Windows validates the path component from the relative Uri. */
6055 { "http://google.com/test",0,
6056 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6057 0,E_INVALIDARG,FALSE
6059 /* Windows doesn't validate the query from the relative Uri. */
6060 { "http://google.com/test",0,
6061 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6064 {"http://google.com/test?Tes%XXt",S_OK},
6065 {"google.com",S_OK},
6066 {"http://google.com/test?Tes%XXt",S_OK},
6067 {"google.com",S_OK},
6070 {"google.com",S_OK},
6073 {"/test?Tes%XXt",S_OK},
6075 {"http://google.com/test?Tes%XXt",S_OK},
6081 {Uri_HOST_DNS,S_OK},
6083 {URL_SCHEME_HTTP,S_OK},
6084 {URLZONE_INVALID,E_NOTIMPL}
6087 /* Windows doesn't validate the fragment from the relative Uri. */
6088 { "http://google.com/test",0,
6089 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6092 {"http://google.com/test#Tes%XXt",S_OK},
6093 {"google.com",S_OK},
6094 {"http://google.com/test#Tes%XXt",S_OK},
6095 {"google.com",S_OK},
6098 {"google.com",S_OK},
6103 {"http://google.com/test#Tes%XXt",S_OK},
6109 {Uri_HOST_DNS,S_OK},
6111 {URL_SCHEME_HTTP,S_OK},
6112 {URLZONE_INVALID,E_NOTIMPL}
6115 /* Creates an IUri which contains an invalid dos path char. */
6116 { "file:///c:/test",0,
6117 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6118 URL_FILE_USE_PATHURL,S_OK,FALSE,
6120 {"file://c:\\test<ing",S_OK},
6122 {"file://c:\\test<ing",S_OK},
6128 {"c:\\test<ing",S_OK},
6129 {"c:\\test<ing",S_OK},
6131 {"file://c:\\test<ing",S_OK},
6137 {Uri_HOST_UNKNOWN,S_OK},
6139 {URL_SCHEME_FILE,S_OK},
6140 {URLZONE_INVALID,E_NOTIMPL}
6143 /* Appends the path after the drive letter (if any). */
6144 { "file:///c:/test",0,
6145 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6148 {"file:///c:/c:/testing",S_OK},
6150 {"file:///c:/c:/testing",S_OK},
6156 {"/c:/c:/testing",S_OK},
6157 {"/c:/c:/testing",S_OK},
6159 {"file:///c:/c:/testing",S_OK},
6165 {Uri_HOST_UNKNOWN,S_OK},
6167 {URL_SCHEME_FILE,S_OK},
6168 {URLZONE_INVALID,E_NOTIMPL}
6171 /* A '/' is added if the base URI doesn't have a path and the
6172 * relative URI doesn't contain a path (since the base URI is
6175 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6176 "?test",Uri_CREATE_ALLOW_RELATIVE,
6179 {"http://google.com/?test",S_OK},
6180 {"google.com",S_OK},
6181 {"http://google.com/?test",S_OK},
6182 {"google.com",S_OK},
6185 {"google.com",S_OK},
6190 {"http://google.com/?test",S_OK},
6196 {Uri_HOST_DNS,S_OK},
6198 {URL_SCHEME_HTTP,S_OK},
6199 {URLZONE_INVALID,E_NOTIMPL}
6202 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6203 "?test",Uri_CREATE_ALLOW_RELATIVE,
6206 {"zip://google.com/?test",S_OK},
6207 {"google.com",S_OK},
6208 {"zip://google.com/?test",S_OK},
6209 {"google.com",S_OK},
6212 {"google.com",S_OK},
6217 {"zip://google.com/?test",S_OK},
6223 {Uri_HOST_DNS,S_OK},
6225 {URL_SCHEME_UNKNOWN,S_OK},
6226 {URLZONE_INVALID,E_NOTIMPL}
6229 /* No path is appended since the base URI is opaque. */
6231 "?test",Uri_CREATE_ALLOW_RELATIVE,
6251 {Uri_HOST_UNKNOWN,S_OK},
6253 {URL_SCHEME_UNKNOWN,S_OK},
6254 {URLZONE_INVALID,E_NOTIMPL}
6258 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6261 {"file:///c:/testing/test",S_OK},
6263 {"file:///c:/testing/test",S_OK},
6269 {"/c:/testing/test",S_OK},
6270 {"/c:/testing/test",S_OK},
6272 {"file:///c:/testing/test",S_OK},
6278 {Uri_HOST_UNKNOWN,S_OK},
6280 {URL_SCHEME_FILE,S_OK},
6281 {URLZONE_INVALID,E_NOTIMPL}
6284 { "http://winehq.org/dir/testfile",0,
6285 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6288 {"http://winehq.org/dir/test?querystring",S_OK},
6289 {"winehq.org",S_OK},
6290 {"http://winehq.org/dir/test?querystring",S_OK},
6291 {"winehq.org",S_OK},
6294 {"winehq.org",S_OK},
6297 {"/dir/test?querystring",S_OK},
6298 {"?querystring",S_OK},
6299 {"http://winehq.org/dir/test?querystring",S_OK},
6305 {Uri_HOST_DNS,S_OK},
6307 {URL_SCHEME_HTTP,S_OK},
6308 {URLZONE_INVALID,E_NOTIMPL}
6311 { "http://winehq.org/dir/test",0,
6312 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6315 {"http://winehq.org/dir/test?querystring",S_OK},
6316 {"winehq.org",S_OK},
6317 {"http://winehq.org/dir/test?querystring",S_OK},
6318 {"winehq.org",S_OK},
6321 {"winehq.org",S_OK},
6324 {"/dir/test?querystring",S_OK},
6325 {"?querystring",S_OK},
6326 {"http://winehq.org/dir/test?querystring",S_OK},
6332 {Uri_HOST_DNS,S_OK},
6334 {URL_SCHEME_HTTP,S_OK},
6335 {URLZONE_INVALID,E_NOTIMPL}
6338 { "http://winehq.org/dir/test?querystring",0,
6339 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6342 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6343 {"winehq.org",S_OK},
6344 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6345 {"winehq.org",S_OK},
6348 {"winehq.org",S_OK},
6351 {"/dir/test?querystring",S_OK},
6352 {"?querystring",S_OK},
6353 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6359 {Uri_HOST_DNS,S_OK},
6361 {URL_SCHEME_HTTP,S_OK},
6362 {URLZONE_INVALID,E_NOTIMPL}
6365 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6366 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6369 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6371 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6377 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6378 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6380 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6386 {Uri_HOST_UNKNOWN,S_OK},
6388 {URL_SCHEME_MK,S_OK},
6389 {URLZONE_INVALID,E_NOTIMPL}
6392 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6393 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6396 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6398 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6404 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6405 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6407 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6413 {Uri_HOST_UNKNOWN,S_OK},
6415 {URL_SCHEME_MK,S_OK},
6416 {URLZONE_INVALID,E_NOTIMPL}
6419 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6420 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6423 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6425 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6431 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6432 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6434 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6440 {Uri_HOST_UNKNOWN,S_OK},
6442 {URL_SCHEME_MK,S_OK},
6443 {URLZONE_INVALID,E_NOTIMPL}
6448 typedef struct _uri_parse_test {
6453 const char *property;
6458 static const uri_parse_test uri_parse_tests[] = {
6459 /* PARSE_CANONICALIZE tests. */
6460 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6461 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6462 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6463 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6464 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6465 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6466 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6467 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6468 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6469 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6470 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6471 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6473 /* PARSE_FRIENDLY tests. */
6474 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6475 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6477 /* PARSE_ROOTDOCUMENT tests. */
6478 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6479 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6480 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6481 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6482 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6483 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6485 /* PARSE_DOCUMENT tests. */
6486 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6487 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6488 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6489 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6490 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6491 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6493 /* PARSE_PATH_FROM_URL tests. */
6494 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6495 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6496 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6497 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6498 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6500 /* PARSE_URL_FROM_PATH tests. */
6501 /* This function almost seems to useless (just returns the absolute uri). */
6502 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6503 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6504 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6505 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6506 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6508 /* PARSE_SCHEMA tests. */
6509 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6510 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6512 /* PARSE_SITE tests. */
6513 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6514 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6515 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6516 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6518 /* PARSE_DOMAIN tests. */
6519 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6520 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6521 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6522 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6524 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6525 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6526 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6527 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6528 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6531 static inline LPWSTR a2w(LPCSTR str) {
6535 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6536 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6537 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6543 static inline BOOL heap_free(void* mem) {
6544 return HeapFree(GetProcessHeap(), 0, mem);
6547 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6548 LPWSTR strAW = a2w(strA);
6549 DWORD ret = lstrcmpW(strAW, strB);
6554 static inline ULONG get_refcnt(IUri *uri) {
6556 return IUri_Release(uri);
6559 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6564 valueW = a2w(prop->value);
6565 switch(prop->property) {
6566 case Uri_PROPERTY_FRAGMENT:
6567 hr = IUriBuilder_SetFragment(builder, valueW);
6570 ok(hr == prop->expected,
6571 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6572 hr, prop->expected, test_index);
6575 ok(hr == prop->expected,
6576 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6577 hr, prop->expected, test_index);
6580 case Uri_PROPERTY_HOST:
6581 hr = IUriBuilder_SetHost(builder, valueW);
6584 ok(hr == prop->expected,
6585 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6586 hr, prop->expected, test_index);
6589 ok(hr == prop->expected,
6590 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6591 hr, prop->expected, test_index);
6594 case Uri_PROPERTY_PASSWORD:
6595 hr = IUriBuilder_SetPassword(builder, valueW);
6598 ok(hr == prop->expected,
6599 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6600 hr, prop->expected, test_index);
6603 ok(hr == prop->expected,
6604 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6605 hr, prop->expected, test_index);
6608 case Uri_PROPERTY_PATH:
6609 hr = IUriBuilder_SetPath(builder, valueW);
6612 ok(hr == prop->expected,
6613 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6614 hr, prop->expected, test_index);
6617 ok(hr == prop->expected,
6618 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6619 hr, prop->expected, test_index);
6622 case Uri_PROPERTY_QUERY:
6623 hr = IUriBuilder_SetQuery(builder, valueW);
6626 ok(hr == prop->expected,
6627 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6628 hr, prop->expected, test_index);
6631 ok(hr == prop->expected,
6632 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6633 hr, prop->expected, test_index);
6636 case Uri_PROPERTY_SCHEME_NAME:
6637 hr = IUriBuilder_SetSchemeName(builder, valueW);
6640 ok(hr == prop->expected,
6641 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6642 hr, prop->expected, test_index);
6645 ok(hr == prop->expected,
6646 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6647 hr, prop->expected, test_index);
6650 case Uri_PROPERTY_USER_NAME:
6651 hr = IUriBuilder_SetUserName(builder, valueW);
6654 ok(hr == prop->expected,
6655 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6656 hr, prop->expected, test_index);
6659 ok(hr == prop->expected,
6660 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6661 hr, prop->expected, test_index);
6665 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6672 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6675 static void test_CreateUri_InvalidFlags(void) {
6678 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6680 IUri *uri = (void*) 0xdeadbeef;
6682 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6683 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6684 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6685 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6689 static void test_CreateUri_InvalidArgs(void) {
6691 IUri *uri = (void*) 0xdeadbeef;
6693 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6694 static const WCHAR emptyW[] = {0};
6696 hr = pCreateUri(http_urlW, 0, 0, NULL);
6697 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6699 hr = pCreateUri(NULL, 0, 0, &uri);
6700 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6701 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6703 uri = (void*) 0xdeadbeef;
6704 hr = pCreateUri(invalidW, 0, 0, &uri);
6705 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6706 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6708 uri = (void*) 0xdeadbeef;
6709 hr = pCreateUri(emptyW, 0, 0, &uri);
6710 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6711 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6714 static void test_CreateUri_InvalidUri(void) {
6717 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6718 invalid_uri test = invalid_uri_tests[i];
6723 uriW = a2w(test.uri);
6724 hr = pCreateUri(uriW, test.flags, 0, &uri);
6727 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6728 hr, E_INVALIDARG, i);
6731 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6732 hr, E_INVALIDARG, i);
6734 if(uri) IUri_Release(uri);
6740 static void test_IUri_GetPropertyBSTR(void) {
6745 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6746 hr = pCreateUri(http_urlW, 0, 0, &uri);
6747 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6749 BSTR received = NULL;
6751 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6752 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6754 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6755 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6756 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6757 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6758 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6759 SysFreeString(received);
6761 /* Make sure it handles the ZONE property correctly. */
6763 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6764 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6765 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6766 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6767 SysFreeString(received);
6769 if(uri) IUri_Release(uri);
6771 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6772 uri_properties test = uri_tests[i];
6776 uriW = a2w(test.uri);
6777 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6778 if(test.create_todo) {
6780 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6781 hr, test.create_expected, i);
6784 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6785 hr, test.create_expected, i);
6791 /* Checks all the string properties of the uri. */
6792 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6793 BSTR received = NULL;
6794 uri_str_property prop = test.str_props[j];
6796 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6799 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6800 hr, prop.expected, i, j);
6803 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6804 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6805 prop.value, wine_dbgstr_w(received), i, j);
6808 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6809 hr, prop.expected, i, j);
6810 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6811 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6812 prop.value, wine_dbgstr_w(received), i, j);
6815 SysFreeString(received);
6819 if(uri) IUri_Release(uri);
6825 static void test_IUri_GetPropertyDWORD(void) {
6830 hr = pCreateUri(http_urlW, 0, 0, &uri);
6831 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6833 DWORD received = 0xdeadbeef;
6835 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6836 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6838 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6839 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6840 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6842 if(uri) IUri_Release(uri);
6844 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6845 uri_properties test = uri_tests[i];
6849 uriW = a2w(test.uri);
6850 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6851 if(test.create_todo) {
6853 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6854 hr, test.create_expected, i);
6857 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6858 hr, test.create_expected, i);
6864 /* Checks all the DWORD properties of the uri. */
6865 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6867 uri_dword_property prop = test.dword_props[j];
6869 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6872 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6873 hr, prop.expected, i, j);
6876 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6877 prop.value, received, i, j);
6880 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6881 hr, prop.expected, i, j);
6882 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6883 prop.value, received, i, j);
6888 if(uri) IUri_Release(uri);
6894 /* Tests all the 'Get*' property functions which deal with strings. */
6895 static void test_IUri_GetStrProperties(void) {
6900 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6901 hr = pCreateUri(http_urlW, 0, 0, &uri);
6902 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6904 hr = IUri_GetAbsoluteUri(uri, NULL);
6905 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6907 hr = IUri_GetAuthority(uri, NULL);
6908 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6910 hr = IUri_GetDisplayUri(uri, NULL);
6911 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6913 hr = IUri_GetDomain(uri, NULL);
6914 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6916 hr = IUri_GetExtension(uri, NULL);
6917 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6919 hr = IUri_GetFragment(uri, NULL);
6920 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6922 hr = IUri_GetHost(uri, NULL);
6923 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6925 hr = IUri_GetPassword(uri, NULL);
6926 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6928 hr = IUri_GetPath(uri, NULL);
6929 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6931 hr = IUri_GetPathAndQuery(uri, NULL);
6932 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6934 hr = IUri_GetQuery(uri, NULL);
6935 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6937 hr = IUri_GetRawUri(uri, NULL);
6938 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6940 hr = IUri_GetSchemeName(uri, NULL);
6941 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6943 hr = IUri_GetUserInfo(uri, NULL);
6944 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6946 hr = IUri_GetUserName(uri, NULL);
6947 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6949 if(uri) IUri_Release(uri);
6951 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6952 uri_properties test = uri_tests[i];
6956 uriW = a2w(test.uri);
6957 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6958 if(test.create_todo) {
6960 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6961 hr, test.create_expected, i);
6964 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6965 hr, test.create_expected, i);
6969 uri_str_property prop;
6970 BSTR received = NULL;
6972 /* GetAbsoluteUri() tests. */
6973 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
6974 hr = IUri_GetAbsoluteUri(uri, &received);
6977 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6978 hr, prop.expected, i);
6981 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6982 "Error: Expected %s but got %s on uri_tests[%d].\n",
6983 prop.value, wine_dbgstr_w(received), i);
6986 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6987 hr, prop.expected, i);
6988 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6989 "Error: Expected %s but got %s on uri_tests[%d].\n",
6990 prop.value, wine_dbgstr_w(received), i);
6992 SysFreeString(received);
6995 /* GetAuthority() tests. */
6996 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
6997 hr = IUri_GetAuthority(uri, &received);
7000 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7001 hr, prop.expected, i);
7004 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7005 prop.value, wine_dbgstr_w(received), i);
7008 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7009 hr, prop.expected, i);
7010 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7011 prop.value, wine_dbgstr_w(received), i);
7013 SysFreeString(received);
7016 /* GetDisplayUri() tests. */
7017 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7018 hr = IUri_GetDisplayUri(uri, &received);
7021 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7022 hr, prop.expected, i);
7025 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7026 "Error: Expected %s but got %s on uri_test[%d].\n",
7027 prop.value, wine_dbgstr_w(received), i);
7030 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7031 hr, prop.expected, i);
7032 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7033 "Error: Expected %s but got %s on uri_tests[%d].\n",
7034 prop.value, wine_dbgstr_w(received), i);
7036 SysFreeString(received);
7039 /* GetDomain() tests. */
7040 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7041 hr = IUri_GetDomain(uri, &received);
7044 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7045 hr, prop.expected, i);
7048 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7049 prop.value, wine_dbgstr_w(received), i);
7052 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7053 hr, prop.expected, i);
7054 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7055 prop.value, wine_dbgstr_w(received), i);
7057 SysFreeString(received);
7060 /* GetExtension() tests. */
7061 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7062 hr = IUri_GetExtension(uri, &received);
7065 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7066 hr, prop.expected, i);
7069 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7070 prop.value, wine_dbgstr_w(received), i);
7073 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7074 hr, prop.expected, i);
7075 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7076 prop.value, wine_dbgstr_w(received), i);
7078 SysFreeString(received);
7081 /* GetFragment() tests. */
7082 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7083 hr = IUri_GetFragment(uri, &received);
7086 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7087 hr, prop.expected, i);
7090 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7091 prop.value, wine_dbgstr_w(received), i);
7094 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7095 hr, prop.expected, i);
7096 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7097 prop.value, wine_dbgstr_w(received), i);
7099 SysFreeString(received);
7102 /* GetHost() tests. */
7103 prop = test.str_props[Uri_PROPERTY_HOST];
7104 hr = IUri_GetHost(uri, &received);
7107 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7108 hr, prop.expected, i);
7111 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7112 prop.value, wine_dbgstr_w(received), i);
7115 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7116 hr, prop.expected, i);
7117 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7118 prop.value, wine_dbgstr_w(received), i);
7120 SysFreeString(received);
7123 /* GetPassword() tests. */
7124 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7125 hr = IUri_GetPassword(uri, &received);
7128 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7129 hr, prop.expected, i);
7132 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7133 prop.value, wine_dbgstr_w(received), i);
7136 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7137 hr, prop.expected, i);
7138 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7139 prop.value, wine_dbgstr_w(received), i);
7141 SysFreeString(received);
7144 /* GetPath() tests. */
7145 prop = test.str_props[Uri_PROPERTY_PATH];
7146 hr = IUri_GetPath(uri, &received);
7149 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7150 hr, prop.expected, i);
7153 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7154 prop.value, wine_dbgstr_w(received), i);
7157 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7158 hr, prop.expected, i);
7159 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7160 prop.value, wine_dbgstr_w(received), i);
7162 SysFreeString(received);
7165 /* GetPathAndQuery() tests. */
7166 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7167 hr = IUri_GetPathAndQuery(uri, &received);
7170 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7171 hr, prop.expected, i);
7174 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7175 prop.value, wine_dbgstr_w(received), i);
7178 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7179 hr, prop.expected, i);
7180 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7181 prop.value, wine_dbgstr_w(received), i);
7183 SysFreeString(received);
7186 /* GetQuery() tests. */
7187 prop = test.str_props[Uri_PROPERTY_QUERY];
7188 hr = IUri_GetQuery(uri, &received);
7191 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7192 hr, prop.expected, i);
7195 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7196 prop.value, wine_dbgstr_w(received), i);
7199 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7200 hr, prop.expected, i);
7201 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7202 prop.value, wine_dbgstr_w(received), i);
7204 SysFreeString(received);
7207 /* GetRawUri() tests. */
7208 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7209 hr = IUri_GetRawUri(uri, &received);
7212 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7213 hr, prop.expected, i);
7216 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7217 prop.value, wine_dbgstr_w(received), i);
7220 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7221 hr, prop.expected, i);
7222 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7223 prop.value, wine_dbgstr_w(received), i);
7225 SysFreeString(received);
7228 /* GetSchemeName() tests. */
7229 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7230 hr = IUri_GetSchemeName(uri, &received);
7233 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7234 hr, prop.expected, i);
7237 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7238 prop.value, wine_dbgstr_w(received), i);
7241 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7242 hr, prop.expected, i);
7243 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7244 prop.value, wine_dbgstr_w(received), i);
7246 SysFreeString(received);
7249 /* GetUserInfo() tests. */
7250 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7251 hr = IUri_GetUserInfo(uri, &received);
7254 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7255 hr, prop.expected, i);
7258 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7259 prop.value, wine_dbgstr_w(received), i);
7262 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7263 hr, prop.expected, i);
7264 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7265 prop.value, wine_dbgstr_w(received), i);
7267 SysFreeString(received);
7270 /* GetUserName() tests. */
7271 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7272 hr = IUri_GetUserName(uri, &received);
7275 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7276 hr, prop.expected, i);
7279 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7280 prop.value, wine_dbgstr_w(received), i);
7283 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7284 hr, prop.expected, i);
7285 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7286 prop.value, wine_dbgstr_w(received), i);
7288 SysFreeString(received);
7291 if(uri) IUri_Release(uri);
7297 static void test_IUri_GetDwordProperties(void) {
7302 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7303 hr = pCreateUri(http_urlW, 0, 0, &uri);
7304 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7306 hr = IUri_GetHostType(uri, NULL);
7307 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7309 hr = IUri_GetPort(uri, NULL);
7310 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7312 hr = IUri_GetScheme(uri, NULL);
7313 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7315 hr = IUri_GetZone(uri, NULL);
7316 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7318 if(uri) IUri_Release(uri);
7320 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7321 uri_properties test = uri_tests[i];
7325 uriW = a2w(test.uri);
7326 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7327 if(test.create_todo) {
7329 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7330 hr, test.create_expected, i);
7333 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7334 hr, test.create_expected, i);
7338 uri_dword_property prop;
7341 /* Assign an insane value so tests don't accidentally pass when
7344 received = -9999999;
7346 /* GetHostType() tests. */
7347 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7348 hr = IUri_GetHostType(uri, &received);
7351 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7352 hr, prop.expected, i);
7355 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7358 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7359 hr, prop.expected, i);
7360 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7362 received = -9999999;
7364 /* GetPort() tests. */
7365 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7366 hr = IUri_GetPort(uri, &received);
7369 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7370 hr, prop.expected, i);
7373 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7376 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7377 hr, prop.expected, i);
7378 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7380 received = -9999999;
7382 /* GetScheme() tests. */
7383 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7384 hr = IUri_GetScheme(uri, &received);
7387 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7388 hr, prop.expected, i);
7391 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7394 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7395 hr, prop.expected, i);
7396 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7398 received = -9999999;
7400 /* GetZone() tests. */
7401 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7402 hr = IUri_GetZone(uri, &received);
7405 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7406 hr, prop.expected, i);
7409 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7412 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7413 hr, prop.expected, i);
7414 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7418 if(uri) IUri_Release(uri);
7424 static void test_IUri_GetPropertyLength(void) {
7429 /* Make sure it handles invalid args correctly. */
7430 hr = pCreateUri(http_urlW, 0, 0, &uri);
7431 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7433 DWORD received = 0xdeadbeef;
7435 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7436 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7438 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7439 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7440 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7442 if(uri) IUri_Release(uri);
7444 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7445 uri_properties test = uri_tests[i];
7449 uriW = a2w(test.uri);
7450 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7451 if(test.create_todo) {
7453 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7454 hr, test.create_expected, i);
7457 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7458 hr, test.create_expected, i);
7464 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7465 DWORD expectedLen, brokenLen, receivedLen;
7466 uri_str_property prop = test.str_props[j];
7468 expectedLen = lstrlen(prop.value);
7469 brokenLen = lstrlen(prop.broken_value);
7471 /* This won't be necessary once GetPropertyLength is implemented. */
7474 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7477 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7478 hr, prop.expected, i, j);
7481 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7482 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7483 expectedLen, receivedLen, i, j);
7486 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7487 hr, prop.expected, i, j);
7488 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7489 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7490 expectedLen, receivedLen, i, j);
7495 if(uri) IUri_Release(uri);
7501 static DWORD compute_expected_props(uri_properties *test)
7505 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7506 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7510 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7511 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7518 static void test_IUri_GetProperties(void) {
7523 hr = pCreateUri(http_urlW, 0, 0, &uri);
7524 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7526 hr = IUri_GetProperties(uri, NULL);
7527 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7529 if(uri) IUri_Release(uri);
7531 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7532 uri_properties test = uri_tests[i];
7536 uriW = a2w(test.uri);
7537 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7538 if(test.create_todo) {
7540 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7543 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7547 DWORD received = 0, expected_props;
7550 hr = IUri_GetProperties(uri, &received);
7551 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7553 expected_props = compute_expected_props(&test);
7555 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7556 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7557 if(expected_props & (1 << j))
7558 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7560 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7564 if(uri) IUri_Release(uri);
7570 static void test_IUri_HasProperty(void) {
7575 hr = pCreateUri(http_urlW, 0, 0, &uri);
7576 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7578 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7579 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7581 if(uri) IUri_Release(uri);
7583 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7584 uri_properties test = uri_tests[i];
7588 uriW = a2w(test.uri);
7590 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7591 if(test.create_todo) {
7593 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7596 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7600 DWORD expected_props, j;
7602 expected_props = compute_expected_props(&test);
7604 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7605 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7608 hr = IUri_HasProperty(uri, j, &received);
7609 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7612 if(expected_props & (1 << j)) {
7613 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7615 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7620 if(uri) IUri_Release(uri);
7626 static void test_IUri_IsEqual(void) {
7633 /* Make sure IsEqual handles invalid args correctly. */
7634 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
7635 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
7636 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7637 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
7638 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7640 hrA = IUri_IsEqual(uriA, NULL, &equal);
7641 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7642 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7644 hrA = IUri_IsEqual(uriA, uriB, NULL);
7645 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
7647 if(uriA) IUri_Release(uriA);
7648 if(uriB) IUri_Release(uriB);
7650 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7651 uri_equality test = equality_tests[i];
7652 LPWSTR uriA_W, uriB_W;
7656 uriA_W = a2w(test.a);
7657 uriB_W = a2w(test.b);
7659 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7660 if(test.create_todo_a) {
7662 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7666 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7670 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7671 if(test.create_todo_b) {
7673 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7677 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7681 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7684 hrA = IUri_IsEqual(uriA, uriB, &equal);
7687 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
7691 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7694 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
7695 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7698 if(uriA) IUri_Release(uriA);
7699 if(uriB) IUri_Release(uriB);
7706 static void test_CreateUriWithFragment_InvalidArgs(void) {
7708 IUri *uri = (void*) 0xdeadbeef;
7709 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7711 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7712 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7713 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7715 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7716 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7718 /* Original URI can't already contain a fragment component. */
7719 uri = (void*) 0xdeadbeef;
7720 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7721 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7722 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7725 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7726 static void test_CreateUriWithFragment_InvalidFlags(void) {
7729 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7731 IUri *uri = (void*) 0xdeadbeef;
7733 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7734 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7735 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7736 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7740 static void test_CreateUriWithFragment(void) {
7743 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7747 uri_with_fragment test = uri_fragment_tests[i];
7749 uriW = a2w(test.uri);
7750 fragW = a2w(test.fragment);
7752 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7753 if(test.expected_todo) {
7755 ok(hr == test.create_expected,
7756 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7757 hr, test.create_expected, i);
7760 ok(hr == test.create_expected,
7761 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7762 hr, test.create_expected, i);
7765 BSTR received = NULL;
7767 hr = IUri_GetAbsoluteUri(uri, &received);
7768 if(test.expected_todo) {
7771 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7775 ok(!strcmp_aw(test.expected_uri, received),
7776 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7777 test.expected_uri, wine_dbgstr_w(received), i);
7780 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7782 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7783 test.expected_uri, wine_dbgstr_w(received), i);
7786 SysFreeString(received);
7789 if(uri) IUri_Release(uri);
7795 static void test_CreateIUriBuilder(void) {
7797 IUriBuilder *builder = NULL;
7800 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7801 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7804 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7805 hr = pCreateUri(http_urlW, 0, 0, &uri);
7806 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7808 ULONG cur_count, orig_count;
7810 orig_count = get_refcnt(uri);
7811 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7812 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7813 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7815 cur_count = get_refcnt(uri);
7816 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7818 if(builder) IUriBuilder_Release(builder);
7819 cur_count = get_refcnt(uri);
7820 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7822 if(uri) IUri_Release(uri);
7825 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7830 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7831 if(test->uri_todo) {
7833 ok(hr == test->uri_hres,
7834 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7835 hr, test->uri_hres, test_index);
7838 ok(hr == test->uri_hres,
7839 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7840 hr, test->uri_hres, test_index);
7846 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7847 uri_builder_str_property prop = test->expected_str_props[i];
7848 BSTR received = NULL;
7850 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7853 ok(hr == prop.result,
7854 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7855 hr, prop.result, test_index, i);
7858 ok(hr == prop.result,
7859 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7860 hr, prop.result, test_index, i);
7865 ok(!strcmp_aw(prop.expected, received),
7866 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7867 prop.expected, wine_dbgstr_w(received), test_index, i);
7870 ok(!strcmp_aw(prop.expected, received),
7871 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7872 prop.expected, wine_dbgstr_w(received), test_index, i);
7875 SysFreeString(received);
7878 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7879 uri_builder_dword_property prop = test->expected_dword_props[i];
7880 DWORD received = -2;
7882 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7885 ok(hr == prop.result,
7886 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7887 hr, prop.result, test_index, i);
7890 ok(hr == prop.result,
7891 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7892 hr, prop.result, test_index, i);
7897 ok(received == prop.expected,
7898 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7899 prop.expected, received, test_index, i);
7902 ok(received == prop.expected,
7903 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7904 prop.expected, received, test_index, i);
7909 if(uri) IUri_Release(uri);
7912 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7917 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7918 if(test->uri_simple_todo) {
7920 ok(hr == test->uri_simple_hres,
7921 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7922 hr, test->uri_simple_hres, test_index);
7925 ok(hr == test->uri_simple_hres,
7926 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7927 hr, test->uri_simple_hres, test_index);
7933 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7934 uri_builder_str_property prop = test->expected_str_props[i];
7935 BSTR received = NULL;
7937 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7940 ok(hr == prop.result,
7941 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7942 hr, prop.result, test_index, i);
7945 ok(hr == prop.result,
7946 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7947 hr, prop.result, test_index, i);
7952 ok(!strcmp_aw(prop.expected, received),
7953 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7954 prop.expected, wine_dbgstr_w(received), test_index, i);
7957 ok(!strcmp_aw(prop.expected, received),
7958 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7959 prop.expected, wine_dbgstr_w(received), test_index, i);
7962 SysFreeString(received);
7965 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7966 uri_builder_dword_property prop = test->expected_dword_props[i];
7967 DWORD received = -2;
7969 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7972 ok(hr == prop.result,
7973 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7974 hr, prop.result, test_index, i);
7977 ok(hr == prop.result,
7978 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7979 hr, prop.result, test_index, i);
7984 ok(received == prop.expected,
7985 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7986 prop.expected, received, test_index, i);
7989 ok(received == prop.expected,
7990 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7991 prop.expected, received, test_index, i);
7996 if(uri) IUri_Release(uri);
7999 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8004 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8005 test->uri_with_encode_flags, 0, &uri);
8006 if(test->uri_with_todo) {
8008 ok(hr == test->uri_with_hres,
8009 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8010 hr, test->uri_with_hres, test_index);
8013 ok(hr == test->uri_with_hres,
8014 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8015 hr, test->uri_with_hres, test_index);
8021 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8022 uri_builder_str_property prop = test->expected_str_props[i];
8023 BSTR received = NULL;
8025 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8028 ok(hr == prop.result,
8029 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8030 hr, prop.result, test_index, i);
8033 ok(hr == prop.result,
8034 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8035 hr, prop.result, test_index, i);
8040 ok(!strcmp_aw(prop.expected, received),
8041 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8042 prop.expected, wine_dbgstr_w(received), test_index, i);
8045 ok(!strcmp_aw(prop.expected, received),
8046 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8047 prop.expected, wine_dbgstr_w(received), test_index, i);
8050 SysFreeString(received);
8053 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8054 uri_builder_dword_property prop = test->expected_dword_props[i];
8055 DWORD received = -2;
8057 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8060 ok(hr == prop.result,
8061 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8062 hr, prop.result, test_index, i);
8065 ok(hr == prop.result,
8066 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8067 hr, prop.result, test_index, i);
8072 ok(received == prop.expected,
8073 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8074 prop.expected, received, test_index, i);
8077 ok(received == prop.expected,
8078 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8079 prop.expected, received, test_index, i);
8084 if(uri) IUri_Release(uri);
8087 static void test_IUriBuilder_CreateInvalidArgs(void) {
8088 IUriBuilder *builder;
8091 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8092 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8094 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8096 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8097 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8098 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8100 uri = (void*) 0xdeadbeef;
8101 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8102 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8103 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8105 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8106 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8109 uri = (void*) 0xdeadbeef;
8110 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8111 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8113 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8115 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8116 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8119 uri = (void*) 0xdeadbeef;
8120 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8121 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8123 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8125 hr = pCreateUri(http_urlW, 0, 0, &test);
8126 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8128 hr = IUriBuilder_SetIUri(builder, test);
8129 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8131 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8133 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8134 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8135 ok(uri != NULL, "Error: The uri was NULL.\n");
8136 if(uri) IUri_Release(uri);
8139 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8140 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8142 ok(uri != NULL, "Error: uri was NULL.\n");
8143 if(uri) IUri_Release(uri);
8146 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8147 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8149 ok(uri != NULL, "Error: uri was NULL.\n");
8150 if(uri) IUri_Release(uri);
8152 hr = IUriBuilder_SetFragment(builder, NULL);
8153 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8155 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8156 uri = (void*) 0xdeadbeef;
8157 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8158 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8159 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8161 uri = (void*) 0xdeadbeef;
8162 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8163 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8165 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8167 uri = (void*) 0xdeadbeef;
8168 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8169 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8171 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8173 if(test) IUri_Release(test);
8175 if(builder) IUriBuilder_Release(builder);
8178 /* Tests invalid args to the "Get*" functions. */
8179 static void test_IUriBuilder_GetInvalidArgs(void) {
8180 IUriBuilder *builder = NULL;
8183 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8184 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8186 LPCWSTR received = (void*) 0xdeadbeef;
8187 DWORD len = -1, port = -1;
8190 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8191 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8193 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8194 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8196 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8197 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8198 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8200 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8202 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8203 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8205 received = (void*) 0xdeadbeef;
8206 hr = IUriBuilder_GetHost(builder, NULL, &received);
8207 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8209 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8211 hr = IUriBuilder_GetHost(builder, &len, NULL);
8212 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8214 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8216 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8217 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8219 received = (void*) 0xdeadbeef;
8220 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8221 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8223 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8225 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8226 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8228 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8230 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8231 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8233 received = (void*) 0xdeadbeef;
8234 hr = IUriBuilder_GetPath(builder, NULL, &received);
8235 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8237 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8239 hr = IUriBuilder_GetPath(builder, &len, NULL);
8240 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8242 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8244 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8245 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8247 hr = IUriBuilder_GetPort(builder, NULL, &port);
8248 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8250 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8251 hr = IUriBuilder_GetPort(builder, &set, NULL);
8252 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8254 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8256 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8257 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8259 received = (void*) 0xdeadbeef;
8260 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8261 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8263 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8265 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8266 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8268 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8270 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8271 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8273 received = (void*) 0xdeadbeef;
8274 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8275 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8277 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8279 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8280 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8282 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8284 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8285 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8287 received = (void*) 0xdeadbeef;
8288 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8289 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8291 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8293 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8294 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8296 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8298 if(builder) IUriBuilder_Release(builder);
8301 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8305 LPCWSTR received = NULL;
8307 const uri_builder_property *prop = NULL;
8309 /* Check if the property was set earlier. */
8310 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8311 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8312 prop = &(test->properties[i]);
8316 /* Use expected_value unless it's NULL, then use value. */
8317 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8318 hr = IUriBuilder_GetFragment(builder, &len, &received);
8321 ok(hr == (expected ? S_OK : S_FALSE),
8322 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8323 hr, (expected ? S_OK : S_FALSE), test_index);
8327 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8328 expected, wine_dbgstr_w(received), test_index);
8331 ok(lstrlen(expected) == len,
8332 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8333 lstrlen(expected), len, test_index);
8337 ok(hr == (expected ? S_OK : S_FALSE),
8338 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8339 hr, (expected ? S_OK : S_FALSE), test_index);
8340 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8341 expected, wine_dbgstr_w(received), test_index);
8342 ok(lstrlen(expected) == len,
8343 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8344 lstrlen(expected), len, test_index);
8347 /* The property wasn't set earlier, so it should return whatever
8348 * the base IUri contains (if anything).
8351 hr = IUriBuilder_GetIUri(builder, &uri);
8353 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8354 hr, S_OK, test_index);
8357 received = (void*) 0xdeadbeef;
8360 hr = IUriBuilder_GetFragment(builder, &len, &received);
8362 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8363 hr, S_FALSE, test_index);
8365 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8367 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8368 received, test_index);
8371 BOOL has_prop = FALSE;
8372 BSTR expected = NULL;
8374 hr = IUri_GetFragment(uri, &expected);
8376 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8378 has_prop = hr == S_OK;
8380 hr = IUriBuilder_GetFragment(builder, &len, &received);
8383 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8384 hr, S_OK, test_index);
8386 ok(!lstrcmpW(expected, received),
8387 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8388 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8389 ok(lstrlenW(expected) == len,
8390 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8391 lstrlenW(expected), len, test_index);
8395 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8396 hr, S_FALSE, test_index);
8398 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8399 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8403 SysFreeString(expected);
8406 if(uri) IUri_Release(uri);
8410 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8414 LPCWSTR received = NULL;
8416 const uri_builder_property *prop = NULL;
8418 /* Check if the property was set earlier. */
8419 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8420 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8421 prop = &(test->properties[i]);
8425 /* Use expected_value unless it's NULL, then use value. */
8426 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8427 hr = IUriBuilder_GetHost(builder, &len, &received);
8430 ok(hr == (expected ? S_OK : S_FALSE),
8431 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8432 hr, (expected ? S_OK : S_FALSE), test_index);
8436 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8437 expected, wine_dbgstr_w(received), test_index);
8440 ok(lstrlen(expected) == len,
8441 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8442 lstrlen(expected), len, test_index);
8446 ok(hr == (expected ? S_OK : S_FALSE),
8447 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8448 hr, (expected ? S_OK : S_FALSE), test_index);
8449 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8450 expected, wine_dbgstr_w(received), test_index);
8451 ok(lstrlen(expected) == len,
8452 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8453 lstrlen(expected), len, test_index);
8456 /* The property wasn't set earlier, so it should return whatever
8457 * the base IUri contains (if anything).
8460 hr = IUriBuilder_GetIUri(builder, &uri);
8462 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8463 hr, S_OK, test_index);
8466 received = (void*) 0xdeadbeef;
8469 hr = IUriBuilder_GetHost(builder, &len, &received);
8471 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8472 hr, S_FALSE, test_index);
8474 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8476 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8477 received, test_index);
8480 BOOL has_prop = FALSE;
8481 BSTR expected = NULL;
8483 hr = IUri_GetHost(uri, &expected);
8485 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8487 has_prop = hr == S_OK;
8489 hr = IUriBuilder_GetHost(builder, &len, &received);
8492 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8493 hr, S_OK, test_index);
8495 ok(!lstrcmpW(expected, received),
8496 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8497 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8498 ok(lstrlenW(expected) == len,
8499 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8500 lstrlenW(expected), len, test_index);
8504 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8505 hr, S_FALSE, test_index);
8507 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8508 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8512 SysFreeString(expected);
8515 if(uri) IUri_Release(uri);
8519 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8523 LPCWSTR received = NULL;
8525 const uri_builder_property *prop = NULL;
8527 /* Check if the property was set earlier. */
8528 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8529 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8530 prop = &(test->properties[i]);
8534 /* Use expected_value unless it's NULL, then use value. */
8535 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8536 hr = IUriBuilder_GetPassword(builder, &len, &received);
8539 ok(hr == (expected ? S_OK : S_FALSE),
8540 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8541 hr, (expected ? S_OK : S_FALSE), test_index);
8545 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8546 expected, wine_dbgstr_w(received), test_index);
8549 ok(lstrlen(expected) == len,
8550 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8551 lstrlen(expected), len, test_index);
8555 ok(hr == (expected ? S_OK : S_FALSE),
8556 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8557 hr, (expected ? S_OK : S_FALSE), test_index);
8558 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8559 expected, wine_dbgstr_w(received), test_index);
8560 ok(lstrlen(expected) == len,
8561 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8562 lstrlen(expected), len, test_index);
8565 /* The property wasn't set earlier, so it should return whatever
8566 * the base IUri contains (if anything).
8569 hr = IUriBuilder_GetIUri(builder, &uri);
8571 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8572 hr, S_OK, test_index);
8575 received = (void*) 0xdeadbeef;
8578 hr = IUriBuilder_GetPassword(builder, &len, &received);
8580 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8581 hr, S_FALSE, test_index);
8583 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8585 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8586 received, test_index);
8589 BOOL has_prop = FALSE;
8590 BSTR expected = NULL;
8592 hr = IUri_GetPassword(uri, &expected);
8594 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8596 has_prop = hr == S_OK;
8598 hr = IUriBuilder_GetPassword(builder, &len, &received);
8601 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8602 hr, S_OK, test_index);
8604 ok(!lstrcmpW(expected, received),
8605 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8606 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8607 ok(lstrlenW(expected) == len,
8608 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8609 lstrlenW(expected), len, test_index);
8613 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8614 hr, S_FALSE, test_index);
8616 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8617 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8621 SysFreeString(expected);
8624 if(uri) IUri_Release(uri);
8628 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8632 LPCWSTR received = NULL;
8634 const uri_builder_property *prop = NULL;
8636 /* Check if the property was set earlier. */
8637 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8638 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8639 prop = &(test->properties[i]);
8643 /* Use expected_value unless it's NULL, then use value. */
8644 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8645 hr = IUriBuilder_GetPath(builder, &len, &received);
8648 ok(hr == (expected ? S_OK : S_FALSE),
8649 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8650 hr, (expected ? S_OK : S_FALSE), test_index);
8654 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8655 expected, wine_dbgstr_w(received), test_index);
8658 ok(lstrlen(expected) == len,
8659 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8660 lstrlen(expected), len, test_index);
8664 ok(hr == (expected ? S_OK : S_FALSE),
8665 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8666 hr, (expected ? S_OK : S_FALSE), test_index);
8667 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8668 expected, wine_dbgstr_w(received), test_index);
8669 ok(lstrlen(expected) == len,
8670 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8671 lstrlen(expected), len, test_index);
8674 /* The property wasn't set earlier, so it should return whatever
8675 * the base IUri contains (if anything).
8678 hr = IUriBuilder_GetIUri(builder, &uri);
8680 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8681 hr, S_OK, test_index);
8684 received = (void*) 0xdeadbeef;
8687 hr = IUriBuilder_GetPath(builder, &len, &received);
8689 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8690 hr, S_FALSE, test_index);
8692 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8694 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8695 received, test_index);
8698 BOOL has_prop = FALSE;
8699 BSTR expected = NULL;
8701 hr = IUri_GetPath(uri, &expected);
8703 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8705 has_prop = hr == S_OK;
8707 hr = IUriBuilder_GetPath(builder, &len, &received);
8710 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8711 hr, S_OK, test_index);
8713 ok(!lstrcmpW(expected, received),
8714 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8715 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8716 ok(lstrlenW(expected) == len,
8717 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8718 lstrlenW(expected), len, test_index);
8722 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8723 hr, S_FALSE, test_index);
8725 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8726 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8730 SysFreeString(expected);
8733 if(uri) IUri_Release(uri);
8737 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8740 BOOL has_port = FALSE;
8741 DWORD received = -1;
8743 if(test->port_prop.change) {
8744 DWORD expected = test->port_prop.value;
8746 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8747 if(test->port_prop.todo) {
8750 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8751 hr, S_OK, test_index);
8755 ok(has_port == test->port_prop.set,
8756 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8757 test->port_prop.set, has_port, test_index);
8760 ok(received == expected,
8761 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8762 expected, received, test_index);
8767 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8768 hr, S_OK, test_index);
8769 ok(has_port == test->port_prop.set,
8770 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8771 test->port_prop.set, has_port, test_index);
8772 ok(received == test->port_prop.value,
8773 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8774 test->port_prop.value, received, test_index);
8779 hr = IUriBuilder_GetIUri(builder, &uri);
8781 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8782 hr, S_OK, test_index);
8785 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8787 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8788 hr, S_OK, test_index);
8790 ok(has_port == FALSE,
8791 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8792 has_port, test_index);
8793 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8794 received, test_index);
8799 hr = IUri_GetPort(uri, &expected);
8801 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8804 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8806 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8807 hr, S_OK, test_index);
8810 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8812 ok(received == expected,
8813 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8814 expected, received, test_index);
8818 if(uri) IUri_Release(uri);
8822 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8826 LPCWSTR received = NULL;
8828 const uri_builder_property *prop = NULL;
8830 /* Check if the property was set earlier. */
8831 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8832 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8833 prop = &(test->properties[i]);
8837 /* Use expected_value unless it's NULL, then use value. */
8838 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8839 hr = IUriBuilder_GetQuery(builder, &len, &received);
8842 ok(hr == (expected ? S_OK : S_FALSE),
8843 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8844 hr, (expected ? S_OK : S_FALSE), test_index);
8848 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8849 expected, wine_dbgstr_w(received), test_index);
8852 ok(lstrlen(expected) == len,
8853 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8854 lstrlen(expected), len, test_index);
8858 ok(hr == (expected ? S_OK : S_FALSE),
8859 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8860 hr, (expected ? S_OK : S_FALSE), test_index);
8861 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8862 expected, wine_dbgstr_w(received), test_index);
8863 ok(lstrlen(expected) == len,
8864 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8865 lstrlen(expected), len, test_index);
8868 /* The property wasn't set earlier, so it should return whatever
8869 * the base IUri contains (if anything).
8872 hr = IUriBuilder_GetIUri(builder, &uri);
8874 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8875 hr, S_OK, test_index);
8878 received = (void*) 0xdeadbeef;
8881 hr = IUriBuilder_GetQuery(builder, &len, &received);
8883 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8884 hr, S_FALSE, test_index);
8886 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8888 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8889 received, test_index);
8892 BOOL has_prop = FALSE;
8893 BSTR expected = NULL;
8895 hr = IUri_GetQuery(uri, &expected);
8897 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8899 has_prop = hr == S_OK;
8901 hr = IUriBuilder_GetQuery(builder, &len, &received);
8904 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8905 hr, S_OK, test_index);
8907 ok(!lstrcmpW(expected, received),
8908 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8909 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8910 ok(lstrlenW(expected) == len,
8911 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8912 lstrlenW(expected), len, test_index);
8916 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8917 hr, S_FALSE, test_index);
8919 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8920 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8924 SysFreeString(expected);
8927 if(uri) IUri_Release(uri);
8931 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8935 LPCWSTR received = NULL;
8937 const uri_builder_property *prop = NULL;
8939 /* Check if the property was set earlier. */
8940 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8941 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8942 prop = &(test->properties[i]);
8946 /* Use expected_value unless it's NULL, then use value. */
8947 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8948 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8951 ok(hr == (expected ? S_OK : S_FALSE),
8952 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8953 hr, (expected ? S_OK : S_FALSE), test_index);
8957 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8958 expected, wine_dbgstr_w(received), test_index);
8961 ok(lstrlen(expected) == len,
8962 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8963 lstrlen(expected), len, test_index);
8967 ok(hr == (expected ? S_OK : S_FALSE),
8968 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8969 hr, (expected ? S_OK : S_FALSE), test_index);
8970 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8971 expected, wine_dbgstr_w(received), test_index);
8972 ok(lstrlen(expected) == len,
8973 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8974 lstrlen(expected), len, test_index);
8977 /* The property wasn't set earlier, so it should return whatever
8978 * the base IUri contains (if anything).
8981 hr = IUriBuilder_GetIUri(builder, &uri);
8983 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8984 hr, S_OK, test_index);
8987 received = (void*) 0xdeadbeef;
8990 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8992 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8993 hr, S_FALSE, test_index);
8995 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8997 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8998 received, test_index);
9001 BOOL has_prop = FALSE;
9002 BSTR expected = NULL;
9004 hr = IUri_GetSchemeName(uri, &expected);
9006 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9008 has_prop = hr == S_OK;
9010 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9013 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9014 hr, S_OK, test_index);
9016 ok(!lstrcmpW(expected, received),
9017 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9018 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9019 ok(lstrlenW(expected) == len,
9020 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9021 lstrlenW(expected), len, test_index);
9025 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9026 hr, S_FALSE, test_index);
9028 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9029 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9033 SysFreeString(expected);
9036 if(uri) IUri_Release(uri);
9040 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9044 LPCWSTR received = NULL;
9046 const uri_builder_property *prop = NULL;
9048 /* Check if the property was set earlier. */
9049 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9050 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9051 prop = &(test->properties[i]);
9054 if(prop && prop->value && *prop->value) {
9055 /* Use expected_value unless it's NULL, then use value. */
9056 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9057 hr = IUriBuilder_GetUserName(builder, &len, &received);
9060 ok(hr == (expected ? S_OK : S_FALSE),
9061 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9062 hr, (expected ? S_OK : S_FALSE), test_index);
9066 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9067 expected, wine_dbgstr_w(received), test_index);
9070 ok(lstrlen(expected) == len,
9071 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9072 lstrlen(expected), len, test_index);
9076 ok(hr == (expected ? S_OK : S_FALSE),
9077 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9078 hr, (expected ? S_OK : S_FALSE), test_index);
9079 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9080 expected, wine_dbgstr_w(received), test_index);
9081 ok(lstrlen(expected) == len,
9082 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9083 lstrlen(expected), len, test_index);
9086 /* The property wasn't set earlier, so it should return whatever
9087 * the base IUri contains (if anything).
9090 hr = IUriBuilder_GetIUri(builder, &uri);
9092 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9093 hr, S_OK, test_index);
9096 received = (void*) 0xdeadbeef;
9099 hr = IUriBuilder_GetUserName(builder, &len, &received);
9101 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9102 hr, S_FALSE, test_index);
9104 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9106 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9107 received, test_index);
9110 BSTR expected = NULL;
9111 BOOL has_prop = FALSE;
9113 hr = IUri_GetUserName(uri, &expected);
9115 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9117 has_prop = hr == S_OK;
9119 hr = IUriBuilder_GetUserName(builder, &len, &received);
9122 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9123 hr, S_OK, test_index);
9125 ok(!lstrcmpW(expected, received),
9126 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9127 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9128 ok(lstrlenW(expected) == len,
9129 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9130 lstrlenW(expected), len, test_index);
9134 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9135 hr, S_FALSE, test_index);
9137 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9138 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9142 SysFreeString(expected);
9145 if(uri) IUri_Release(uri);
9149 /* Tests IUriBuilder functions. */
9150 static void test_IUriBuilder(void) {
9152 IUriBuilder *builder;
9155 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9157 uri_builder_test test = uri_builder_tests[i];
9161 uriW = a2w(test.uri);
9162 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9163 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9165 if(FAILED(hr)) continue;
9167 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9168 if(test.create_builder_todo) {
9170 ok(hr == test.create_builder_expected,
9171 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9172 hr, test.create_builder_expected, i);
9175 ok(hr == test.create_builder_expected,
9176 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9177 hr, test.create_builder_expected, i);
9181 BOOL modified = FALSE, received = FALSE;
9183 /* Perform all the string property changes. */
9184 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9185 uri_builder_property prop = test.properties[j];
9187 change_property(builder, &prop, i);
9188 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9189 prop.property != Uri_PROPERTY_HOST)
9191 else if(prop.value && *prop.value)
9193 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9194 /* Host name property can't be NULL, but it can be empty. */
9199 if(test.port_prop.change) {
9200 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9202 if(test.port_prop.todo) {
9204 ok(hr == test.port_prop.expected,
9205 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9206 hr, test.port_prop.expected, i);
9209 ok(hr == test.port_prop.expected,
9210 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9211 hr, test.port_prop.expected, i);
9215 hr = IUriBuilder_HasBeenModified(builder, &received);
9217 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9220 ok(received == modified,
9221 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9222 modified, received, i);
9224 /* Test the "Get*" functions. */
9225 test_IUriBuilder_GetFragment(builder, &test, i);
9226 test_IUriBuilder_GetHost(builder, &test, i);
9227 test_IUriBuilder_GetPassword(builder, &test, i);
9228 test_IUriBuilder_GetPath(builder, &test, i);
9229 test_IUriBuilder_GetPort(builder, &test, i);
9230 test_IUriBuilder_GetQuery(builder, &test, i);
9231 test_IUriBuilder_GetSchemeName(builder, &test, i);
9232 test_IUriBuilder_GetUserName(builder, &test, i);
9234 test_IUriBuilder_CreateUri(builder, &test, i);
9235 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9236 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9238 if(builder) IUriBuilder_Release(builder);
9239 if(uri) IUri_Release(uri);
9244 static void test_IUriBuilder_HasBeenModified(void) {
9246 IUriBuilder *builder = NULL;
9248 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9249 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9251 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9255 hr = IUriBuilder_HasBeenModified(builder, NULL);
9256 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9259 hr = IUriBuilder_SetHost(builder, hostW);
9260 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9263 hr = IUriBuilder_HasBeenModified(builder, &received);
9264 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9267 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9269 hr = pCreateUri(http_urlW, 0, 0, &uri);
9270 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9275 hr = IUriBuilder_SetIUri(builder, uri);
9276 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9279 hr = IUriBuilder_HasBeenModified(builder, &received);
9280 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9283 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9285 /* Test what happens with you call SetIUri with the same IUri again. */
9286 hr = IUriBuilder_SetHost(builder, hostW);
9287 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9289 hr = IUriBuilder_HasBeenModified(builder, &received);
9290 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9293 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9295 hr = IUriBuilder_SetIUri(builder, uri);
9296 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9298 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9299 * reset any of the changes that were made to the IUriBuilder.
9301 hr = IUriBuilder_HasBeenModified(builder, &received);
9302 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9304 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9306 hr = IUriBuilder_GetHost(builder, &len, &prop);
9307 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9309 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9310 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9311 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9312 lstrlenW(hostW), len);
9315 hr = IUriBuilder_SetIUri(builder, NULL);
9316 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9318 hr = IUriBuilder_SetHost(builder, hostW);
9319 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9320 hr = IUriBuilder_HasBeenModified(builder, &received);
9321 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9324 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9326 hr = IUriBuilder_SetIUri(builder, NULL);
9327 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9329 hr = IUriBuilder_HasBeenModified(builder, &received);
9330 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9333 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9335 hr = IUriBuilder_GetHost(builder, &len, &prop);
9336 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9338 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9339 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9340 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9341 lstrlenW(hostW), len);
9344 if(uri) IUri_Release(uri);
9346 if(builder) IUriBuilder_Release(builder);
9349 /* Test IUriBuilder {Get,Set}IUri functions. */
9350 static void test_IUriBuilder_IUriProperty(void) {
9351 IUriBuilder *builder = NULL;
9354 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9355 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9359 hr = IUriBuilder_GetIUri(builder, NULL);
9360 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9363 hr = pCreateUri(http_urlW, 0, 0, &uri);
9366 ULONG cur_count, orig_count;
9368 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9369 orig_count = get_refcnt(uri);
9370 hr = IUriBuilder_SetIUri(builder, uri);
9371 cur_count = get_refcnt(uri);
9373 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9374 orig_count+1, cur_count);
9376 hr = IUriBuilder_SetIUri(builder, NULL);
9377 cur_count = get_refcnt(uri);
9379 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9380 orig_count, cur_count);
9382 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9383 hr = IUriBuilder_SetIUri(builder, uri);
9384 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9385 orig_count = get_refcnt(uri);
9387 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9388 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9390 cur_count = get_refcnt(uri);
9391 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9392 orig_count+1, cur_count);
9393 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9396 if(test) IUri_Release(test);
9399 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9400 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9402 cur_count = get_refcnt(uri);
9403 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9404 orig_count+1, cur_count);
9405 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9407 if(test) IUri_Release(test);
9409 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9413 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9414 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9416 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9418 if(test) IUri_Release(test);
9420 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9421 * explicitly set (because it's a default flags).
9424 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9425 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9427 cur_count = get_refcnt(uri);
9428 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9429 orig_count+1, cur_count);
9430 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9432 if(test) IUri_Release(test);
9435 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9436 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9438 cur_count = get_refcnt(uri);
9439 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9440 orig_count+1, cur_count);
9441 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9443 if(test) IUri_Release(test);
9446 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9447 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9450 cur_count = get_refcnt(uri);
9451 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9452 orig_count+1, cur_count);
9453 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9455 if(test) IUri_Release(test);
9457 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9461 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9462 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9464 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9466 if(test) IUri_Release(test);
9468 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9469 * explicitly set (because it's a default flags).
9472 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9473 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9475 cur_count = get_refcnt(uri);
9476 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9477 orig_count+1, cur_count);
9478 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9480 if(test) IUri_Release(test);
9482 if(uri) IUri_Release(uri);
9484 if(builder) IUriBuilder_Release(builder);
9487 static void test_IUriBuilder_RemoveProperties(void) {
9488 IUriBuilder *builder = NULL;
9492 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9493 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9495 /* Properties that can't be removed. */
9496 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9497 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9499 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9500 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9501 if((i << 1) & invalid) {
9502 ok(hr == E_INVALIDARG,
9503 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9504 hr, E_INVALIDARG, i);
9507 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9512 /* Also doesn't accept anything that's outside the range of the
9515 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9516 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9519 if(builder) IUriBuilder_Release(builder);
9521 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9522 uri_builder_remove_test test = uri_builder_remove_tests[i];
9526 uriW = a2w(test.uri);
9527 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9531 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9532 if(test.create_builder_todo) {
9534 ok(hr == test.create_builder_expected,
9535 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9536 hr, test.create_builder_expected, i);
9539 ok(hr == test.create_builder_expected,
9540 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9541 hr, test.create_builder_expected, i);
9544 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9545 if(test.remove_todo) {
9547 ok(hr == test.remove_expected,
9548 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9549 hr, test.remove_expected, i);
9552 ok(hr == test.remove_expected,
9553 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9554 hr, test.remove_expected, i);
9557 IUri *result = NULL;
9559 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9560 if(test.expected_todo) {
9562 ok(hr == test.expected_hres,
9563 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9564 hr, test.expected_hres, i);
9567 ok(hr == test.expected_hres,
9568 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9569 hr, test.expected_hres, i);
9572 BSTR received = NULL;
9574 hr = IUri_GetAbsoluteUri(result, &received);
9575 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9576 ok(!strcmp_aw(test.expected_uri, received),
9577 "Error: Expected %s but got %s instead on test %d.\n",
9578 test.expected_uri, wine_dbgstr_w(received), i);
9579 SysFreeString(received);
9581 if(result) IUri_Release(result);
9584 if(builder) IUriBuilder_Release(builder);
9586 if(uri) IUri_Release(uri);
9591 static void test_IUriBuilder_Misc(void) {
9595 hr = pCreateUri(http_urlW, 0, 0, &uri);
9597 IUriBuilder *builder;
9599 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9600 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9605 hr = IUriBuilder_GetPort(builder, &has, &port);
9606 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9608 /* 'has' will be set to FALSE, even though uri had a port. */
9609 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9610 /* Still sets 'port' to 80. */
9611 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9614 if(builder) IUriBuilder_Release(builder);
9616 if(uri) IUri_Release(uri);
9619 static void test_IUriBuilderFactory(void) {
9622 IUriBuilderFactory *factory;
9623 IUriBuilder *builder;
9625 hr = pCreateUri(http_urlW, 0, 0, &uri);
9626 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9629 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9630 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9631 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9634 builder = (void*) 0xdeadbeef;
9635 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9636 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9638 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9640 builder = (void*) 0xdeadbeef;
9641 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9642 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9644 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9646 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9647 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9651 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9652 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9655 IUri *tmp = (void*) 0xdeadbeef;
9659 hr = IUriBuilder_GetIUri(builder, &tmp);
9660 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9662 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9664 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9665 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9668 if(builder) IUriBuilder_Release(builder);
9670 builder = (void*) 0xdeadbeef;
9671 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9672 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9674 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9676 builder = (void*) 0xdeadbeef;
9677 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9678 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9680 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9682 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9683 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9687 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9688 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9693 hr = IUriBuilder_GetIUri(builder, &tmp);
9694 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9696 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9697 if(uri) IUri_Release(uri);
9699 if(builder) IUriBuilder_Release(builder);
9701 if(factory) IUriBuilderFactory_Release(factory);
9703 if(uri) IUri_Release(uri);
9706 static void test_CoInternetCombineIUri(void) {
9708 IUri *base, *relative, *result;
9712 hr = pCreateUri(http_urlW, 0, 0, &base);
9713 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9715 result = (void*) 0xdeadbeef;
9716 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9717 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9718 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9722 hr = pCreateUri(http_urlW, 0, 0, &relative);
9723 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9725 result = (void*) 0xdeadbeef;
9726 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9727 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9728 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9731 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9732 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9734 if(base) IUri_Release(base);
9735 if(relative) IUri_Release(relative);
9737 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9738 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9740 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9741 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9743 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9745 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9746 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9750 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9751 if(uri_combine_tests[i].todo) {
9753 ok(hr == uri_combine_tests[i].expected,
9754 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9755 hr, uri_combine_tests[i].expected, i);
9758 ok(hr == uri_combine_tests[i].expected,
9759 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9760 hr, uri_combine_tests[i]. expected, i);
9765 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9766 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9769 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9772 ok(hr == prop.expected,
9773 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9774 hr, prop.expected, i, j);
9777 ok(!strcmp_aw(prop.value, received) ||
9778 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9779 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9780 prop.value, wine_dbgstr_w(received), i, j);
9783 ok(hr == prop.expected,
9784 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9785 hr, prop.expected, i, j);
9786 ok(!strcmp_aw(prop.value, received) ||
9787 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9788 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9789 prop.value, wine_dbgstr_w(received), i, j);
9791 SysFreeString(received);
9794 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9795 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9798 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9801 ok(hr == prop.expected,
9802 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9803 hr, prop.expected, i, j);
9806 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9807 prop.value, received, i, j);
9810 ok(hr == prop.expected,
9811 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9812 hr, prop.expected, i, j);
9813 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9814 prop.value, received, i, j);
9818 if(result) IUri_Release(result);
9820 if(relative) IUri_Release(relative);
9821 heap_free(relativeW);
9823 if(base) IUri_Release(base);
9828 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9829 REFIID riid, void **ppv)
9831 ok(0, "unexpected call\n");
9832 return E_NOINTERFACE;
9835 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9840 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9845 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9846 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9847 DWORD *pcchResult, DWORD dwReserved)
9849 CHECK_EXPECT(ParseUrl);
9850 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
9851 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
9852 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
9853 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
9854 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
9856 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
9857 *pcchResult = lstrlenW(parse_resultW);
9862 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9863 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9864 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9866 CHECK_EXPECT(CombineUrl);
9867 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9868 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9869 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9870 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9871 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9872 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9873 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9875 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9876 *pcchResult = lstrlenW(combine_resultW);
9881 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9882 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9884 ok(0, "unexpected call\n");
9888 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9889 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9890 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9892 ok(0, "unexpected call\n");
9896 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9897 InternetProtocolInfo_QueryInterface,
9898 InternetProtocolInfo_AddRef,
9899 InternetProtocolInfo_Release,
9900 InternetProtocolInfo_ParseUrl,
9901 InternetProtocolInfo_CombineUrl,
9902 InternetProtocolInfo_CompareUrl,
9903 InternetProtocolInfo_QueryInfo
9906 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9908 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9910 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9911 *ppv = &protocol_info;
9915 ok(0, "unexpected call\n");
9916 return E_NOINTERFACE;
9919 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9924 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9929 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9930 REFIID riid, void **ppv)
9932 ok(0, "unexpected call\n");
9936 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9938 ok(0, "unexpected call\n");
9942 static const IClassFactoryVtbl ClassFactoryVtbl = {
9943 ClassFactory_QueryInterface,
9944 ClassFactory_AddRef,
9945 ClassFactory_Release,
9946 ClassFactory_CreateInstance,
9947 ClassFactory_LockServer
9950 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9952 static void register_protocols(void)
9954 IInternetSession *session;
9957 hres = pCoInternetGetSession(0, &session, 0);
9958 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
9962 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
9963 winetestW, 0, NULL, 0);
9964 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
9966 IInternetSession_Release(session);
9969 static void unregister_protocols(void) {
9970 IInternetSession *session;
9973 hr = pCoInternetGetSession(0, &session, 0);
9974 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
9978 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
9979 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
9981 IInternetSession_Release(session);
9984 static void test_CoInternetCombineIUri_Pluggable(void) {
9988 hr = pCreateUri(combine_baseW, 0, 0, &base);
9989 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9991 IUri *relative = NULL;
9993 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
9994 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9996 IUri *result = NULL;
9998 SET_EXPECT(CombineUrl);
10000 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10002 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10004 CHECK_CALLED(CombineUrl);
10006 if(SUCCEEDED(hr)) {
10007 BSTR received = NULL;
10008 hr = IUri_GetAbsoluteUri(result, &received);
10009 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10010 if(SUCCEEDED(hr)) {
10011 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10012 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10014 SysFreeString(received);
10016 if(result) IUri_Release(result);
10018 if(relative) IUri_Release(relative);
10020 if(base) IUri_Release(base);
10023 static void test_CoInternetCombineUrlEx(void) {
10025 IUri *base, *result;
10029 hr = pCreateUri(http_urlW, 0, 0, &base);
10030 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10031 if(SUCCEEDED(hr)) {
10032 result = (void*) 0xdeadbeef;
10033 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10034 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10036 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10039 result = (void*) 0xdeadbeef;
10040 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10041 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10043 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10045 result = (void*) 0xdeadbeef;
10046 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10047 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10049 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10051 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10052 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10054 if(base) IUri_Release(base);
10056 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10057 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10059 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10060 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10061 if(SUCCEEDED(hr)) {
10062 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10064 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10066 if(uri_combine_tests[i].todo) {
10068 ok(hr == uri_combine_tests[i].expected,
10069 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10070 hr, uri_combine_tests[i].expected, i);
10073 ok(hr == uri_combine_tests[i].expected,
10074 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10075 hr, uri_combine_tests[i]. expected, i);
10077 if(SUCCEEDED(hr)) {
10080 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10081 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10083 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10085 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10088 ok(hr == prop.expected,
10089 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10090 hr, prop.expected, i, j);
10093 ok(!strcmp_aw(value, received) ||
10094 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10095 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10096 value, wine_dbgstr_w(received), i, j);
10099 ok(hr == prop.expected,
10100 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10101 hr, prop.expected, i, j);
10102 ok(!strcmp_aw(value, received) ||
10103 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10104 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10105 value, wine_dbgstr_w(received), i, j);
10107 SysFreeString(received);
10110 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10111 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10114 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10117 ok(hr == prop.expected,
10118 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10119 hr, prop.expected, i, j);
10122 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10123 prop.value, received, i, j);
10126 ok(hr == prop.expected,
10127 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10128 hr, prop.expected, i, j);
10129 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10130 prop.value, received, i, j);
10134 if(result) IUri_Release(result);
10135 heap_free(relativeW);
10137 if(base) IUri_Release(base);
10142 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10146 hr = pCreateUri(combine_baseW, 0, 0, &base);
10147 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10148 if(SUCCEEDED(hr)) {
10149 IUri *result = NULL;
10151 SET_EXPECT(CombineUrl);
10153 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10155 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10157 CHECK_CALLED(CombineUrl);
10159 if(SUCCEEDED(hr)) {
10160 BSTR received = NULL;
10161 hr = IUri_GetAbsoluteUri(result, &received);
10162 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10163 if(SUCCEEDED(hr)) {
10164 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10165 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10167 SysFreeString(received);
10169 if(result) IUri_Release(result);
10171 if(base) IUri_Release(base);
10174 static void test_CoInternetParseIUri_InvalidArgs(void) {
10180 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10181 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10183 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10185 hr = pCreateUri(http_urlW, 0, 0, &uri);
10186 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10187 if(SUCCEEDED(hr)) {
10188 DWORD expected_len;
10191 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10192 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10194 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10196 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10197 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10201 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10202 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10204 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10207 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10208 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10210 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10213 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10214 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10216 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10219 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10220 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10222 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10224 expected_len = lstrlenW(http_urlW);
10226 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10227 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10228 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10229 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10230 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10231 expected_len, result);
10233 if(uri) IUri_Release(uri);
10236 static void test_CoInternetParseIUri(void) {
10239 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10243 uri_parse_test test = uri_parse_tests[i];
10245 uriW = a2w(test.uri);
10246 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10247 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10248 if(SUCCEEDED(hr)) {
10249 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10250 DWORD result_len = -1;
10252 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10255 ok(hr == test.expected,
10256 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10257 hr, test.expected, i);
10260 ok(hr == test.expected,
10261 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10262 hr, test.expected, i);
10264 if(SUCCEEDED(hr)) {
10265 DWORD len = lstrlenA(test.property);
10266 ok(!strcmp_aw(test.property, result),
10267 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10268 test.property, wine_dbgstr_w(result), i);
10269 ok(len == result_len,
10270 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10271 len, result_len, i);
10274 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10278 if(uri) IUri_Release(uri);
10283 static void test_CoInternetParseIUri_Pluggable(void) {
10287 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10288 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10289 if(SUCCEEDED(hr)) {
10293 SET_EXPECT(ParseUrl);
10295 parse_action = PARSE_CANONICALIZE;
10296 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10298 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10299 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10301 CHECK_CALLED(ParseUrl);
10303 if(SUCCEEDED(hr)) {
10304 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10305 lstrlenW(parse_resultW), result_len);
10306 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10307 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10310 if(uri) IUri_Release(uri);
10316 const char *base_url;
10317 DWORD base_uri_flags;
10318 const char *legacy_url;
10319 const char *uniform_url;
10320 const char *no_canon_url;
10321 const char *uri_url;
10322 } create_urlmon_test_t;
10324 static const create_urlmon_test_t create_urlmon_tests[] = {
10326 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10328 "http://www.winehq.org/",
10329 "http://www.winehq.org/",
10330 "http://www.winehq.org",
10331 "http://www.winehq.org"
10334 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10336 "file://c:\\dir\\file.txt",
10337 "file:///c:/dir/file.txt",
10338 "file:///c:/dir/file.txt",
10339 "file:///c:/dir/file.txt"
10342 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10344 "file://c:\\dir\\file.txt",
10345 "file:///c:/dir/file.txt",
10346 "file:///c:/dir/file.txt",
10347 "file://c:\\dir\\file.txt"
10350 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10351 "http://www.winehq.org",0,
10352 "http://www.winehq.org/data",
10353 "http://www.winehq.org/data",
10354 "http://www.winehq.org:80/data",
10357 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10358 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10359 "file://c:\\dir\\file.txt",
10360 "file:///c:/dir/file.txt",
10361 "file:///c:/dir/file.txt",
10364 "",Uri_CREATE_ALLOW_RELATIVE,
10372 "test",Uri_CREATE_ALLOW_RELATIVE,
10380 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10382 "file://c:\\dir\\file.txt",
10383 "file:///c:/dir/file.txt",
10384 "file:///c:/dir/file.txt",
10385 "file:///c:/dir/file.txt",
10389 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10390 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10392 WCHAR *display_name;
10395 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10396 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10397 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10398 wine_dbgstr_w(display_name), exurl);
10400 CoTaskMemFree(display_name);
10403 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10404 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10406 IUriContainer *uri_container;
10411 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10412 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10415 hres = IUriContainer_GetIUri(uri_container, &uri);
10416 IUriContainer_Release(uri_container);
10417 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10418 ok(uri != NULL, "uri == NULL\n");
10420 hres = IUri_GetDisplayUri(uri, &display_uri);
10422 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10423 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10424 wine_dbgstr_w(display_uri), exurl);
10425 SysFreeString(display_uri);
10428 static void test_CreateURLMoniker(void)
10430 const create_urlmon_test_t *test;
10431 IMoniker *mon, *base_mon;
10432 WCHAR *url, *base_url;
10433 IUri *uri, *base_uri;
10436 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10437 url = a2w(test->url);
10438 base_url = a2w(test->base_url);
10441 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10442 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10444 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10445 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10451 hres = CreateURLMoniker(base_mon, url, &mon);
10452 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10453 test_urlmon_display_name(mon, test->legacy_url);
10454 test_display_uri(mon, test->legacy_url);
10455 IMoniker_Release(mon);
10457 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10458 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10459 test_urlmon_display_name(mon, test->legacy_url);
10460 test_display_uri(mon, test->legacy_url);
10461 IMoniker_Release(mon);
10463 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10464 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10465 test_urlmon_display_name(mon, test->uniform_url);
10466 test_display_uri(mon, test->uniform_url);
10467 IMoniker_Release(mon);
10469 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10470 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10471 test_urlmon_display_name(mon, test->no_canon_url);
10472 test_display_uri(mon, test->no_canon_url);
10473 IMoniker_Release(mon);
10475 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10476 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10478 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10479 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10480 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10481 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10482 IMoniker_Release(mon);
10484 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10485 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10486 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10487 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10488 IMoniker_Release(mon);
10490 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10491 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10492 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10493 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10494 IMoniker_Release(mon);
10498 heap_free(base_url);
10500 IUri_Release(base_uri);
10502 IMoniker_Release(base_mon);
10509 hurlmon = GetModuleHandle("urlmon.dll");
10510 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
10511 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
10512 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
10513 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
10514 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
10515 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
10516 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
10517 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
10518 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
10521 win_skip("CreateUri is not present, skipping tests.\n");
10525 trace("test CreateUri invalid flags...\n");
10526 test_CreateUri_InvalidFlags();
10528 trace("test CreateUri invalid args...\n");
10529 test_CreateUri_InvalidArgs();
10531 trace("test CreateUri invalid URIs...\n");
10532 test_CreateUri_InvalidUri();
10534 trace("test IUri_GetPropertyBSTR...\n");
10535 test_IUri_GetPropertyBSTR();
10537 trace("test IUri_GetPropertyDWORD...\n");
10538 test_IUri_GetPropertyDWORD();
10540 trace("test IUri_GetStrProperties...\n");
10541 test_IUri_GetStrProperties();
10543 trace("test IUri_GetDwordProperties...\n");
10544 test_IUri_GetDwordProperties();
10546 trace("test IUri_GetPropertyLength...\n");
10547 test_IUri_GetPropertyLength();
10549 trace("test IUri_GetProperties...\n");
10550 test_IUri_GetProperties();
10552 trace("test IUri_HasProperty...\n");
10553 test_IUri_HasProperty();
10555 trace("test IUri_IsEqual...\n");
10556 test_IUri_IsEqual();
10558 trace("test CreateUriWithFragment invalid args...\n");
10559 test_CreateUriWithFragment_InvalidArgs();
10561 trace("test CreateUriWithFragment invalid flags...\n");
10562 test_CreateUriWithFragment_InvalidFlags();
10564 trace("test CreateUriWithFragment...\n");
10565 test_CreateUriWithFragment();
10567 trace("test CreateIUriBuilder...\n");
10568 test_CreateIUriBuilder();
10570 trace("test IUriBuilder_CreateInvalidArgs...\n");
10571 test_IUriBuilder_CreateInvalidArgs();
10573 trace("test IUriBuilder...\n");
10574 test_IUriBuilder();
10576 trace("test IUriBuilder_GetInvalidArgs...\n");
10577 test_IUriBuilder_GetInvalidArgs();
10579 trace("test IUriBuilder_HasBeenModified...\n");
10580 test_IUriBuilder_HasBeenModified();
10582 trace("test IUriBuilder_IUriProperty...\n");
10583 test_IUriBuilder_IUriProperty();
10585 trace("test IUriBuilder_RemoveProperties...\n");
10586 test_IUriBuilder_RemoveProperties();
10588 trace("test IUriBuilder miscellaneous...\n");
10589 test_IUriBuilder_Misc();
10591 trace("test IUriBuilderFactory...\n");
10592 test_IUriBuilderFactory();
10594 trace("test CoInternetCombineIUri...\n");
10595 test_CoInternetCombineIUri();
10597 trace("test CoInternetCombineUrlEx...\n");
10598 test_CoInternetCombineUrlEx();
10600 trace("test CoInternetParseIUri Invalid Args...\n");
10601 test_CoInternetParseIUri_InvalidArgs();
10603 trace("test CoInternetParseIUri...\n");
10604 test_CoInternetParseIUri();
10606 register_protocols();
10608 trace("test CoInternetCombineIUri pluggable...\n");
10609 test_CoInternetCombineIUri_Pluggable();
10611 trace("test CoInternetCombineUrlEx Pluggable...\n");
10612 test_CoInternetCombineUrlEx_Pluggable();
10614 trace("test CoInternetParseIUri pluggable...\n");
10615 test_CoInternetParseIUri_Pluggable();
10617 trace("test CreateURLMoniker...\n");
10618 test_CreateURLMoniker();
10620 unregister_protocols();