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 becuase 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 /* Make sure it normalizes partial IPv4 addresses correctly. */
1001 { "http://127.0/", 0, S_OK, FALSE,
1003 {"http://127.0.0.0/",S_OK,FALSE},
1004 {"127.0.0.0",S_OK,FALSE},
1005 {"http://127.0.0.0/",S_OK,FALSE},
1009 {"127.0.0.0",S_OK,FALSE},
1014 {"http://127.0/",S_OK,FALSE},
1015 {"http",S_OK,FALSE},
1020 {Uri_HOST_IPV4,S_OK,FALSE},
1022 {URL_SCHEME_HTTP,S_OK,FALSE},
1023 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1026 /* Make sure it converts implicit IPv4's correctly. */
1027 { "http://123456/", 0, S_OK, FALSE,
1029 {"http://0.1.226.64/",S_OK,FALSE},
1030 {"0.1.226.64",S_OK,FALSE},
1031 {"http://0.1.226.64/",S_OK,FALSE},
1035 {"0.1.226.64",S_OK,FALSE},
1040 {"http://123456/",S_OK,FALSE},
1041 {"http",S_OK,FALSE},
1046 {Uri_HOST_IPV4,S_OK,FALSE},
1048 {URL_SCHEME_HTTP,S_OK,FALSE},
1049 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1053 { "http://4294967295/", 0, S_OK, FALSE,
1055 {"http://255.255.255.255/",S_OK,FALSE},
1056 {"255.255.255.255",S_OK,FALSE},
1057 {"http://255.255.255.255/",S_OK,FALSE},
1061 {"255.255.255.255",S_OK,FALSE},
1066 {"http://4294967295/",S_OK,FALSE},
1067 {"http",S_OK,FALSE},
1072 {Uri_HOST_IPV4,S_OK,FALSE},
1074 {URL_SCHEME_HTTP,S_OK,FALSE},
1075 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1079 { "http://4294967296/", 0, S_OK, FALSE,
1081 {"http://4294967296/",S_OK,FALSE},
1082 {"4294967296",S_OK,FALSE},
1083 {"http://4294967296/",S_OK,FALSE},
1087 {"4294967296",S_OK,FALSE},
1092 {"http://4294967296/",S_OK,FALSE},
1093 {"http",S_OK,FALSE},
1098 {Uri_HOST_DNS,S_OK,FALSE},
1100 {URL_SCHEME_HTTP,S_OK,FALSE},
1101 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1104 /* Window's doesn't normalize IP address for unknown schemes. */
1105 { "1234://4294967295/", 0, S_OK, FALSE,
1107 {"1234://4294967295/",S_OK,FALSE},
1108 {"4294967295",S_OK,FALSE},
1109 {"1234://4294967295/",S_OK,FALSE},
1113 {"4294967295",S_OK,FALSE},
1118 {"1234://4294967295/",S_OK,FALSE},
1119 {"1234",S_OK,FALSE},
1124 {Uri_HOST_IPV4,S_OK,FALSE},
1126 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1127 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1130 /* Window's doesn't normalize IP address for unknown schemes. */
1131 { "1234://127.001/", 0, S_OK, FALSE,
1133 {"1234://127.001/",S_OK,FALSE},
1134 {"127.001",S_OK,FALSE},
1135 {"1234://127.001/",S_OK,FALSE},
1139 {"127.001",S_OK,FALSE},
1144 {"1234://127.001/",S_OK,FALSE},
1145 {"1234",S_OK,FALSE},
1150 {Uri_HOST_IPV4,S_OK,FALSE},
1152 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1153 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1156 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1158 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1159 {"[fedc:ba98::3210]",S_OK,FALSE},
1160 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1164 {"fedc:ba98::3210",S_OK,FALSE},
1169 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1170 {"http",S_OK,FALSE},
1175 {Uri_HOST_IPV6,S_OK,FALSE},
1177 {URL_SCHEME_HTTP,S_OK,FALSE},
1178 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1181 { "http://[::]", 0, S_OK, FALSE,
1183 {"http://[::]/",S_OK,FALSE},
1184 {"[::]",S_OK,FALSE},
1185 {"http://[::]/",S_OK,FALSE},
1194 {"http://[::]",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://[FEDC:BA98::]", 0, S_OK, FALSE,
1208 {"http://[fedc:ba98::]/",S_OK,FALSE},
1209 {"[fedc:ba98::]",S_OK,FALSE},
1210 {"http://[fedc:ba98::]/",S_OK,FALSE},
1214 {"fedc:ba98::",S_OK,FALSE},
1219 {"http://[FEDC:BA98::]",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 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1232 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1234 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1235 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1236 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1240 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1245 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1246 {"http",S_OK,FALSE},
1251 {Uri_HOST_IPV6,S_OK,FALSE},
1253 {URL_SCHEME_HTTP,S_OK,FALSE},
1254 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1257 { "http://[v2.34]/", 0, S_OK, FALSE,
1259 {"http://[v2.34]/",S_OK,FALSE},
1260 {"[v2.34]",S_OK,FALSE},
1261 {"http://[v2.34]/",S_OK,FALSE},
1265 {"[v2.34]",S_OK,FALSE},
1270 {"http://[v2.34]/",S_OK,FALSE},
1271 {"http",S_OK,FALSE},
1276 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1278 {URL_SCHEME_HTTP,S_OK,FALSE},
1279 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1282 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1283 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1285 {"http://[xyz:12345.com/test",S_OK,FALSE},
1286 {"[xyz:12345.com",S_OK,FALSE},
1287 {"http://[xyz:12345.com/test",S_OK,FALSE},
1288 {"[xyz:12345.com",S_OK,FALSE},
1291 {"[xyz:12345.com",S_OK,FALSE},
1293 {"/test",S_OK,FALSE},
1294 {"/test",S_OK,FALSE},
1296 {"http://[xyz:12345.com/test",S_OK,FALSE},
1297 {"http",S_OK,FALSE},
1302 {Uri_HOST_DNS,S_OK,FALSE},
1304 {URL_SCHEME_HTTP,S_OK,FALSE},
1305 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1308 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1309 * of the host name (respectively).
1311 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1313 {"ftp://www.[works].com/",S_OK,FALSE},
1314 {"www.[works].com",S_OK,FALSE},
1315 {"ftp://www.[works].com/",S_OK,FALSE},
1316 {"[works].com",S_OK,FALSE},
1319 {"www.[works].com",S_OK,FALSE},
1324 {"ftp://www.[works].com/",S_OK,FALSE},
1330 {Uri_HOST_DNS,S_OK,FALSE},
1332 {URL_SCHEME_FTP,S_OK,FALSE},
1333 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1336 /* Considers ':' a delimiter since it appears after the ']'. */
1337 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1339 {"http://www.google.com]:12345/",S_OK,FALSE},
1340 {"www.google.com]:12345",S_OK,FALSE},
1341 {"http://www.google.com]:12345/",S_OK,FALSE},
1342 {"google.com]",S_OK,FALSE},
1345 {"www.google.com]",S_OK,FALSE},
1350 {"http://www.google.com]:12345/",S_OK,FALSE},
1351 {"http",S_OK,FALSE},
1356 {Uri_HOST_DNS,S_OK,FALSE},
1358 {URL_SCHEME_HTTP,S_OK,FALSE},
1359 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1362 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1363 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1365 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1366 {"w%XXw%GEw.google.com",S_OK,FALSE},
1367 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1368 {"google.com",S_OK,FALSE},
1371 {"w%XXw%GEw.google.com",S_OK,FALSE},
1376 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1382 {Uri_HOST_DNS,S_OK,FALSE},
1384 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1388 /* Unknown scheme types hostname doesn't get lower cased. */
1389 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1391 {"zip://GOOGLE.com/",S_OK,FALSE},
1392 {"GOOGLE.com",S_OK,FALSE},
1393 {"zip://GOOGLE.com/",S_OK,FALSE},
1394 {"GOOGLE.com",S_OK,FALSE},
1397 {"GOOGLE.com",S_OK,FALSE},
1402 {"zip://GOOGLE.com/",S_OK,FALSE},
1408 {Uri_HOST_DNS,S_OK,FALSE},
1410 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1411 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1414 /* Hostname get's lower cased for known scheme types. */
1415 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1417 {"http://www.google.com/",S_OK,FALSE},
1418 {"www.google.com",S_OK,FALSE},
1419 {"http://www.google.com/",S_OK,FALSE},
1420 {"google.com",S_OK,FALSE},
1423 {"www.google.com",S_OK,FALSE},
1428 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1429 {"http",S_OK,FALSE},
1434 {Uri_HOST_DNS,S_OK,FALSE},
1436 {URL_SCHEME_HTTP,S_OK,FALSE},
1437 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1440 /* Characters that get % encoded in the hostname also have their percent
1441 * encoded forms lower cased.
1443 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1445 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1446 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1447 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1448 {"%7cgoogle%7c.com",S_OK,FALSE},
1451 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1456 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1457 {"http",S_OK,FALSE},
1462 {Uri_HOST_DNS,S_OK,FALSE},
1464 {URL_SCHEME_HTTP,S_OK,FALSE},
1465 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1468 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1469 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1471 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1472 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1473 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1477 {"1:2:3:4:5:6::",S_OK,FALSE},
1482 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1483 {"http",S_OK,FALSE},
1488 {Uri_HOST_IPV6,S_OK,FALSE},
1490 {URL_SCHEME_HTTP,S_OK,FALSE},
1491 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1494 /* IPv4 addresses get normalized. */
1495 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1497 {"http://[::1.2.3.0]/",S_OK,FALSE},
1498 {"[::1.2.3.0]",S_OK,FALSE},
1499 {"http://[::1.2.3.0]/",S_OK,FALSE},
1503 {"::1.2.3.0",S_OK,FALSE},
1508 {"http://[::001.002.003.000]",S_OK,FALSE},
1509 {"http",S_OK,FALSE},
1514 {Uri_HOST_IPV6,S_OK,FALSE},
1516 {URL_SCHEME_HTTP,S_OK,FALSE},
1517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1520 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1521 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1523 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1524 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1525 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1529 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1534 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1540 {Uri_HOST_IPV6,S_OK,FALSE},
1542 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1543 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1546 /* IPv4 address is converted into 2 h16 components. */
1547 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1549 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1550 {"[ffff::c0de:6f20]",S_OK,FALSE},
1551 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1555 {"ffff::c0de:6f20",S_OK,FALSE},
1560 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1561 {"http",S_OK,FALSE},
1566 {Uri_HOST_IPV6,S_OK,FALSE},
1568 {URL_SCHEME_HTTP,S_OK,FALSE},
1569 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1572 /* Max value for a port. */
1573 { "http://google.com:65535", 0, S_OK, FALSE,
1575 {"http://google.com:65535/",S_OK,FALSE},
1576 {"google.com:65535",S_OK,FALSE},
1577 {"http://google.com:65535/",S_OK,FALSE},
1578 {"google.com",S_OK,FALSE},
1581 {"google.com",S_OK,FALSE},
1586 {"http://google.com:65535",S_OK,FALSE},
1587 {"http",S_OK,FALSE},
1592 {Uri_HOST_DNS,S_OK,FALSE},
1594 {URL_SCHEME_HTTP,S_OK,FALSE},
1595 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1598 { "zip://google.com:65536", 0, S_OK, FALSE,
1600 {"zip://google.com:65536/",S_OK,FALSE},
1601 {"google.com:65536",S_OK,FALSE},
1602 {"zip://google.com:65536/",S_OK,FALSE},
1603 {"google.com:65536",S_OK,FALSE},
1606 {"google.com:65536",S_OK,FALSE},
1611 {"zip://google.com:65536",S_OK,FALSE},
1617 {Uri_HOST_DNS,S_OK,FALSE},
1619 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1620 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1623 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1625 {"zip://google.com:65536:25/",S_OK,FALSE},
1626 {"google.com:65536:25",S_OK,FALSE},
1627 {"zip://google.com:65536:25/",S_OK,FALSE},
1628 {"google.com:65536:25",S_OK,FALSE},
1631 {"google.com:65536:25",S_OK,FALSE},
1636 {"zip://google.com:65536:25",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://[::ffff]:abcd", 0, S_OK, FALSE,
1650 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1651 {"[::ffff]:abcd",S_OK,FALSE},
1652 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1656 {"[::ffff]:abcd",S_OK,FALSE},
1661 {"zip://[::ffff]:abcd",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://127.0.0.1:abcd", 0, S_OK, FALSE,
1675 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1676 {"127.0.0.1:abcd",S_OK,FALSE},
1677 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1678 {"0.1:abcd",S_OK,FALSE},
1681 {"127.0.0.1:abcd",S_OK,FALSE},
1686 {"zip://127.0.0.1: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 /* Port is just copied over. */
1699 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1701 {"http://google.com:00035",S_OK,FALSE},
1702 {"google.com:00035",S_OK,FALSE},
1703 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1704 {"google.com",S_OK,FALSE},
1707 {"google.com",S_OK,FALSE},
1712 {"http://google.com:00035",S_OK,FALSE},
1713 {"http",S_OK,FALSE},
1718 {Uri_HOST_DNS,S_OK,FALSE},
1720 {URL_SCHEME_HTTP,S_OK,FALSE},
1721 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1724 /* Default port is copied over. */
1725 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1727 {"http://google.com:80",S_OK,FALSE},
1728 {"google.com:80",S_OK,FALSE},
1729 {"http://google.com:80",S_OK,FALSE},
1730 {"google.com",S_OK,FALSE},
1733 {"google.com",S_OK,FALSE},
1738 {"http://google.com:80",S_OK,FALSE},
1739 {"http",S_OK,FALSE},
1744 {Uri_HOST_DNS,S_OK,FALSE},
1746 {URL_SCHEME_HTTP,S_OK,FALSE},
1747 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1750 { "http://google.com.uk", 0, S_OK, FALSE,
1752 {"http://google.com.uk/",S_OK,FALSE},
1753 {"google.com.uk",S_OK,FALSE},
1754 {"http://google.com.uk/",S_OK,FALSE},
1755 {"google.com.uk",S_OK,FALSE},
1758 {"google.com.uk",S_OK,FALSE},
1763 {"http://google.com.uk",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.com", 0, S_OK, FALSE,
1777 {"http://google.com.com/",S_OK,FALSE},
1778 {"google.com.com",S_OK,FALSE},
1779 {"http://google.com.com/",S_OK,FALSE},
1780 {"com.com",S_OK,FALSE},
1783 {"google.com.com",S_OK,FALSE},
1788 {"http://google.com.com",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.uk.1", 0, S_OK, FALSE,
1802 {"http://google.uk.1/",S_OK,FALSE},
1803 {"google.uk.1",S_OK,FALSE},
1804 {"http://google.uk.1/",S_OK,FALSE},
1805 {"google.uk.1",S_OK,FALSE},
1808 {"google.uk.1",S_OK,FALSE},
1813 {"http://google.uk.1",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 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1826 { "http://google.foo.uk", 0, S_OK, FALSE,
1828 {"http://google.foo.uk/",S_OK,FALSE},
1829 {"google.foo.uk",S_OK,FALSE},
1830 {"http://google.foo.uk/",S_OK,FALSE},
1831 {"foo.uk",S_OK,FALSE},
1834 {"google.foo.uk",S_OK,FALSE},
1839 {"http://google.foo.uk",S_OK,FALSE},
1840 {"http",S_OK,FALSE},
1845 {Uri_HOST_DNS,S_OK,FALSE},
1847 {URL_SCHEME_HTTP,S_OK,FALSE},
1848 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1851 { "http://.com", 0, S_OK, FALSE,
1853 {"http://.com/",S_OK,FALSE},
1854 {".com",S_OK,FALSE},
1855 {"http://.com/",S_OK,FALSE},
1856 {".com",S_OK,FALSE},
1859 {".com",S_OK,FALSE},
1864 {"http://.com",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://.uk", 0, S_OK, FALSE,
1878 {"http://.uk/",S_OK,FALSE},
1880 {"http://.uk/",S_OK,FALSE},
1889 {"http://.uk",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://www.co.google.com.[]", 0, S_OK, FALSE,
1903 {"http://www.co.google.com.[]/",S_OK,FALSE},
1904 {"www.co.google.com.[]",S_OK,FALSE},
1905 {"http://www.co.google.com.[]/",S_OK,FALSE},
1906 {"google.com.[]",S_OK,FALSE},
1909 {"www.co.google.com.[]",S_OK,FALSE},
1914 {"http://www.co.google.com.[]",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://co.uk", 0, S_OK, FALSE,
1928 {"http://co.uk/",S_OK,FALSE},
1929 {"co.uk",S_OK,FALSE},
1930 {"http://co.uk/",S_OK,FALSE},
1934 {"co.uk",S_OK,FALSE},
1939 {"http://co.uk",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://www.co.google.us.test", 0, S_OK, FALSE,
1953 {"http://www.co.google.us.test/",S_OK,FALSE},
1954 {"www.co.google.us.test",S_OK,FALSE},
1955 {"http://www.co.google.us.test/",S_OK,FALSE},
1956 {"us.test",S_OK,FALSE},
1959 {"www.co.google.us.test",S_OK,FALSE},
1964 {"http://www.co.google.us.test",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://gov.uk", 0, S_OK, FALSE,
1978 {"http://gov.uk/",S_OK,FALSE},
1979 {"gov.uk",S_OK,FALSE},
1980 {"http://gov.uk/",S_OK,FALSE},
1984 {"gov.uk",S_OK,FALSE},
1989 {"http://gov.uk",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 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2003 {"zip://www.google.com\\test",S_OK,FALSE},
2004 {"www.google.com\\test",S_OK,FALSE},
2005 {"zip://www.google.com\\test",S_OK,FALSE},
2006 {"google.com\\test",S_OK,FALSE},
2009 {"www.google.com\\test",S_OK,FALSE},
2014 {"zip://www.google.com\\test",S_OK,FALSE},
2020 {Uri_HOST_DNS,S_OK,FALSE},
2022 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2023 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2026 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2028 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2030 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2036 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2037 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2039 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2045 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2047 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2048 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2051 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2052 * are decoded and all '%' are encoded.
2054 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2056 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2058 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2060 {".mp3",S_OK,FALSE},
2064 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2065 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2067 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2068 {"file",S_OK,FALSE},
2073 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2075 {URL_SCHEME_FILE,S_OK,FALSE},
2076 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2079 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2080 * is decoded and only %'s in front of invalid hex digits are encoded.
2082 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2084 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2086 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2088 {".mp3",S_OK,FALSE},
2092 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2093 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2095 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2096 {"file",S_OK,FALSE},
2101 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2103 {URL_SCHEME_FILE,S_OK,FALSE},
2104 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2107 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2108 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2110 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2111 {"[::1.2.3.0]",S_OK,FALSE},
2112 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2116 {"::1.2.3.0",S_OK,FALSE},
2118 {"/%3F%23.T/test",S_OK,FALSE},
2119 {"/%3F%23.T/test",S_OK,FALSE},
2121 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2122 {"http",S_OK,FALSE},
2127 {Uri_HOST_IPV6,S_OK,FALSE},
2129 {URL_SCHEME_HTTP,S_OK,FALSE},
2130 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2133 /* Forbidden characters are always encoded for file URIs. */
2134 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2136 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2138 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2140 {".mp3",S_OK,FALSE},
2144 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2145 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2147 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2148 {"file",S_OK,FALSE},
2153 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2155 {URL_SCHEME_FILE,S_OK,FALSE},
2156 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2159 /* Forbidden characters are never encoded for unknown scheme types. */
2160 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2162 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2163 {"4294967295",S_OK,FALSE},
2164 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2168 {"4294967295",S_OK,FALSE},
2170 {"/<|>\" test<|>",S_OK,FALSE},
2171 {"/<|>\" test<|>",S_OK,FALSE},
2173 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2174 {"1234",S_OK,FALSE},
2179 {Uri_HOST_IPV4,S_OK,FALSE},
2181 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2182 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2185 /* Make sure forbidden characters are percent encoded. */
2186 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2188 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2189 {"gov.uk",S_OK,FALSE},
2190 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2194 {"gov.uk",S_OK,FALSE},
2196 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2197 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2199 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2200 {"http",S_OK,FALSE},
2205 {Uri_HOST_DNS,S_OK,FALSE},
2207 {URL_SCHEME_HTTP,S_OK,FALSE},
2208 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2211 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2213 {"http://gov.uk/",S_OK,FALSE},
2214 {"gov.uk",S_OK,FALSE},
2215 {"http://gov.uk/",S_OK,FALSE},
2219 {"gov.uk",S_OK,FALSE},
2224 {"http://gov.uk/test/../test2/././../test3/.././././",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/../../..", 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/../../..",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 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2288 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2290 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2292 {".mp3",S_OK,FALSE},
2296 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2297 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2299 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2300 {"file",S_OK,FALSE},
2305 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2307 {URL_SCHEME_FILE,S_OK,FALSE},
2308 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2311 /* Dot removal happens for unknown scheme types. */
2312 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2314 {"zip://gov.uk/",S_OK,FALSE},
2315 {"gov.uk",S_OK,FALSE},
2316 {"zip://gov.uk/",S_OK,FALSE},
2320 {"gov.uk",S_OK,FALSE},
2325 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2331 {Uri_HOST_DNS,S_OK,FALSE},
2333 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2334 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2337 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2338 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2340 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2341 {"gov.uk",S_OK,FALSE},
2342 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2346 {"gov.uk",S_OK,FALSE},
2348 {"/test/test2/../../.",S_OK,FALSE},
2349 {"/test/test2/../../.",S_OK,FALSE},
2351 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2352 {"http",S_OK,FALSE},
2357 {Uri_HOST_DNS,S_OK,FALSE},
2359 {URL_SCHEME_HTTP,S_OK,FALSE},
2360 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2363 /* Dot removal doesn't happen for wildcard scheme types. */
2364 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2366 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2367 {"gov.uk",S_OK,FALSE},
2368 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2372 {"gov.uk",S_OK,FALSE},
2374 {"/test/test2/../../.",S_OK,FALSE},
2375 {"/test/test2/../../.",S_OK,FALSE},
2377 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2383 {Uri_HOST_DNS,S_OK,FALSE},
2385 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2386 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2389 /* Forbidden characters are encoded for opaque known scheme types. */
2390 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2392 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2394 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2396 {".com%22",S_OK,FALSE},
2400 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2401 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2403 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2404 {"mailto",S_OK,FALSE},
2409 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2411 {URL_SCHEME_MAILTO,S_OK,FALSE},
2412 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2415 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2417 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2419 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2421 {".com",S_OK,FALSE},
2425 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2426 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2428 {"news:test.tes<|>t.com",S_OK,FALSE},
2429 {"news",S_OK,FALSE},
2434 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2436 {URL_SCHEME_NEWS,S_OK,FALSE},
2437 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2440 /* Don't encode forbidden characters. */
2441 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2443 {"news:test.tes<|>t.com",S_OK,FALSE},
2445 {"news:test.tes<|>t.com",S_OK,FALSE},
2447 {".com",S_OK,FALSE},
2451 {"test.tes<|>t.com",S_OK,FALSE},
2452 {"test.tes<|>t.com",S_OK,FALSE},
2454 {"news:test.tes<|>t.com",S_OK,FALSE},
2455 {"news",S_OK,FALSE},
2460 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2462 {URL_SCHEME_NEWS,S_OK,FALSE},
2463 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2466 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2467 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2469 {"urn:test.tes<|>t.com",S_OK,FALSE},
2471 {"urn:test.tes<|>t.com",S_OK,FALSE},
2473 {".com",S_OK,FALSE},
2477 {"test.tes<|>t.com",S_OK,FALSE},
2478 {"test.tes<|>t.com",S_OK,FALSE},
2480 {"urn:test.tes<|>t.com",S_OK,FALSE},
2486 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2488 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2489 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2492 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2493 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2495 {"news:test.test.com",S_OK,FALSE},
2497 {"news:test.test.com",S_OK,FALSE},
2499 {".com",S_OK,FALSE},
2503 {"test.test.com",S_OK,FALSE},
2504 {"test.test.com",S_OK,FALSE},
2506 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2507 {"news",S_OK,FALSE},
2512 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2514 {URL_SCHEME_NEWS,S_OK,FALSE},
2515 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2518 /* Percent encoded characters are still decoded for known scheme types. */
2519 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2521 {"news:test.test.com",S_OK,FALSE},
2523 {"news:test.test.com",S_OK,FALSE},
2525 {".com",S_OK,FALSE},
2529 {"test.test.com",S_OK,FALSE},
2530 {"test.test.com",S_OK,FALSE},
2532 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2533 {"news",S_OK,FALSE},
2538 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2540 {URL_SCHEME_NEWS,S_OK,FALSE},
2541 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2544 /* Percent encoded characters aren't decoded for unknown scheme types. */
2545 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2547 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2549 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2551 {".com",S_OK,FALSE},
2555 {"test.%74%65%73%74.com",S_OK,FALSE},
2556 {"test.%74%65%73%74.com",S_OK,FALSE},
2558 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2564 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2566 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2567 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2570 /* Unknown scheme types can have invalid % encoded data in query string. */
2571 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2573 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2574 {"www.winehq.org",S_OK,FALSE},
2575 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2576 {"winehq.org",S_OK,FALSE},
2579 {"www.winehq.org",S_OK,FALSE},
2582 {"/?query=%xx&return=y",S_OK,FALSE},
2583 {"?query=%xx&return=y",S_OK,FALSE},
2584 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2590 {Uri_HOST_DNS,S_OK,FALSE},
2592 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2593 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2596 /* Known scheme types can have invalid % encoded data with the right flags. */
2597 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2599 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2600 {"www.winehq.org",S_OK,FALSE},
2601 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2602 {"winehq.org",S_OK,FALSE},
2605 {"www.winehq.org",S_OK,FALSE},
2608 {"/?query=%xx&return=y",S_OK,FALSE},
2609 {"?query=%xx&return=y",S_OK,FALSE},
2610 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2611 {"http",S_OK,FALSE},
2616 {Uri_HOST_DNS,S_OK,FALSE},
2618 {URL_SCHEME_HTTP,S_OK,FALSE},
2619 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2622 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2623 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2625 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2626 {"www.winehq.org",S_OK,FALSE},
2627 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2628 {"winehq.org",S_OK,FALSE},
2631 {"www.winehq.org",S_OK,FALSE},
2634 {"/?query=<|>&return=y",S_OK,FALSE},
2635 {"?query=<|>&return=y",S_OK,FALSE},
2636 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2637 {"http",S_OK,FALSE},
2642 {Uri_HOST_DNS,S_OK,FALSE},
2644 {URL_SCHEME_HTTP,S_OK,FALSE},
2645 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2648 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2649 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2651 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2652 {"www.winehq.org",S_OK,FALSE},
2653 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2654 {"winehq.org",S_OK,FALSE},
2657 {"www.winehq.org",S_OK,FALSE},
2660 {"/?query=<|>&return=y",S_OK,FALSE},
2661 {"?query=<|>&return=y",S_OK,FALSE},
2662 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2663 {"http",S_OK,FALSE},
2668 {Uri_HOST_DNS,S_OK,FALSE},
2670 {URL_SCHEME_HTTP,S_OK,FALSE},
2671 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2674 /* Forbidden characters are encoded for known scheme types. */
2675 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2677 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2678 {"www.winehq.org",S_OK,FALSE},
2679 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2680 {"winehq.org",S_OK,FALSE},
2683 {"www.winehq.org",S_OK,FALSE},
2686 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2687 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2688 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2689 {"http",S_OK,FALSE},
2694 {Uri_HOST_DNS,S_OK,FALSE},
2696 {URL_SCHEME_HTTP,S_OK,FALSE},
2697 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2700 /* Forbidden characters are not encoded for unknown scheme types. */
2701 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2703 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2704 {"www.winehq.org",S_OK,FALSE},
2705 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2706 {"winehq.org",S_OK,FALSE},
2709 {"www.winehq.org",S_OK,FALSE},
2712 {"/?query=<|>&return=y",S_OK,FALSE},
2713 {"?query=<|>&return=y",S_OK,FALSE},
2714 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2720 {Uri_HOST_DNS,S_OK,FALSE},
2722 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2723 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2726 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2727 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2729 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2730 {"www.winehq.org",S_OK,FALSE},
2731 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2732 {"winehq.org",S_OK,FALSE},
2735 {"www.winehq.org",S_OK,FALSE},
2738 {"/?query=01&return=y",S_OK,FALSE},
2739 {"?query=01&return=y",S_OK,FALSE},
2740 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2741 {"http",S_OK,FALSE},
2746 {Uri_HOST_DNS,S_OK,FALSE},
2748 {URL_SCHEME_HTTP,S_OK,FALSE},
2749 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2752 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2753 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2755 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2756 {"www.winehq.org",S_OK,FALSE},
2757 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2758 {"winehq.org",S_OK,FALSE},
2761 {"www.winehq.org",S_OK,FALSE},
2764 {"/?query=%30%31&return=y",S_OK,FALSE},
2765 {"?query=%30%31&return=y",S_OK,FALSE},
2766 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2772 {Uri_HOST_DNS,S_OK,FALSE},
2774 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2775 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2778 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2779 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2781 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2782 {"www.winehq.org",S_OK,FALSE},
2783 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2784 {"winehq.org",S_OK,FALSE},
2787 {"www.winehq.org",S_OK,FALSE},
2790 {"/?query=%30%31&return=y",S_OK,FALSE},
2791 {"?query=%30%31&return=y",S_OK,FALSE},
2792 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2793 {"http",S_OK,FALSE},
2798 {Uri_HOST_DNS,S_OK,FALSE},
2800 {URL_SCHEME_HTTP,S_OK,FALSE},
2801 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2804 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2806 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2807 {"www.winehq.org",S_OK,FALSE},
2808 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2809 {"winehq.org",S_OK,FALSE},
2812 {"www.winehq.org",S_OK,FALSE},
2815 {"?query=12&return=y",S_OK,FALSE},
2816 {"?query=12&return=y",S_OK,FALSE},
2817 {"http://www.winehq.org?query=12&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 /* Unknown scheme types can have invalid % encoded data in fragments. */
2830 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2832 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2833 {"www.winehq.org",S_OK,FALSE},
2834 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2835 {"winehq.org",S_OK,FALSE},
2837 {"#Te%xx",S_OK,FALSE},
2838 {"www.winehq.org",S_OK,FALSE},
2840 {"/tests/",S_OK,FALSE},
2841 {"/tests/",S_OK,FALSE},
2843 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2849 {Uri_HOST_DNS,S_OK,FALSE},
2851 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2852 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2855 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2856 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2858 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2859 {"www.winehq.org",S_OK,FALSE},
2860 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2861 {"winehq.org",S_OK,FALSE},
2863 {"#Te<|>",S_OK,FALSE},
2864 {"www.winehq.org",S_OK,FALSE},
2866 {"/tests/",S_OK,FALSE},
2867 {"/tests/",S_OK,FALSE},
2869 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2875 {Uri_HOST_DNS,S_OK,FALSE},
2877 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2878 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2881 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2882 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2884 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2885 {"www.winehq.org",S_OK,FALSE},
2886 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2887 {"winehq.org",S_OK,FALSE},
2889 {"#Te%3C%7C%3E",S_OK,FALSE},
2890 {"www.winehq.org",S_OK,FALSE},
2892 {"/tests/",S_OK,FALSE},
2893 {"/tests/",S_OK,FALSE},
2895 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2896 {"http",S_OK,FALSE},
2901 {Uri_HOST_DNS,S_OK,FALSE},
2903 {URL_SCHEME_HTTP,S_OK,FALSE},
2904 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2907 /* Forbidden characters aren't encoded in the fragment with this flag. */
2908 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2910 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2911 {"www.winehq.org",S_OK,FALSE},
2912 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2913 {"winehq.org",S_OK,FALSE},
2915 {"#Te<|>",S_OK,FALSE},
2916 {"www.winehq.org",S_OK,FALSE},
2918 {"/tests/",S_OK,FALSE},
2919 {"/tests/",S_OK,FALSE},
2921 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2922 {"http",S_OK,FALSE},
2927 {Uri_HOST_DNS,S_OK,FALSE},
2929 {URL_SCHEME_HTTP,S_OK,FALSE},
2930 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2933 /* Forbidden characters aren't encoded in the fragment with this flag. */
2934 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2936 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2937 {"www.winehq.org",S_OK,FALSE},
2938 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2939 {"winehq.org",S_OK,FALSE},
2941 {"#Te<|>",S_OK,FALSE},
2942 {"www.winehq.org",S_OK,FALSE},
2944 {"/tests/",S_OK,FALSE},
2945 {"/tests/",S_OK,FALSE},
2947 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2948 {"http",S_OK,FALSE},
2953 {Uri_HOST_DNS,S_OK,FALSE},
2955 {URL_SCHEME_HTTP,S_OK,FALSE},
2956 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2959 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
2960 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2962 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2963 {"www.winehq.org",S_OK,FALSE},
2964 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2965 {"winehq.org",S_OK,FALSE},
2967 {"#Te%30%31%32",S_OK,FALSE},
2968 {"www.winehq.org",S_OK,FALSE},
2970 {"/tests/",S_OK,FALSE},
2971 {"/tests/",S_OK,FALSE},
2973 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2979 {Uri_HOST_DNS,S_OK,FALSE},
2981 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2982 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2985 /* Percent encoded, unreserved characters are decoded for known schemes. */
2986 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2988 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2989 {"www.winehq.org",S_OK,FALSE},
2990 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2991 {"winehq.org",S_OK,FALSE},
2993 {"#Te012",S_OK,FALSE},
2994 {"www.winehq.org",S_OK,FALSE},
2996 {"/tests/",S_OK,FALSE},
2997 {"/tests/",S_OK,FALSE},
2999 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3000 {"http",S_OK,FALSE},
3005 {Uri_HOST_DNS,S_OK,FALSE},
3007 {URL_SCHEME_HTTP,S_OK,FALSE},
3008 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3011 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3012 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3014 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3015 {"www.winehq.org",S_OK,FALSE},
3016 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3017 {"winehq.org",S_OK,FALSE},
3019 {"#Te012",S_OK,FALSE},
3020 {"www.winehq.org",S_OK,FALSE},
3022 {"/tests/",S_OK,FALSE},
3023 {"/tests/",S_OK,FALSE},
3025 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3026 {"http",S_OK,FALSE},
3031 {Uri_HOST_DNS,S_OK,FALSE},
3033 {URL_SCHEME_HTTP,S_OK,FALSE},
3034 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3037 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3038 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3040 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3041 {"www.winehq.org",S_OK,FALSE},
3042 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3043 {"winehq.org",S_OK,FALSE},
3045 {"#Te%30%31%32",S_OK,FALSE},
3046 {"www.winehq.org",S_OK,FALSE},
3048 {"/tests/",S_OK,FALSE},
3049 {"/tests/",S_OK,FALSE},
3051 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3052 {"http",S_OK,FALSE},
3057 {Uri_HOST_DNS,S_OK,FALSE},
3059 {URL_SCHEME_HTTP,S_OK,FALSE},
3060 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3063 /* Leading/Trailing whitespace is removed. */
3064 { " http://google.com/ ", 0, S_OK, FALSE,
3066 {"http://google.com/",S_OK,FALSE},
3067 {"google.com",S_OK,FALSE},
3068 {"http://google.com/",S_OK,FALSE},
3069 {"google.com",S_OK,FALSE},
3072 {"google.com",S_OK,FALSE},
3077 {"http://google.com/",S_OK,FALSE},
3078 {"http",S_OK,FALSE},
3083 {Uri_HOST_DNS,S_OK,FALSE},
3085 {URL_SCHEME_HTTP,S_OK,FALSE},
3086 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3089 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 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 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3116 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3117 {"g%0aoogle.co%0dm",S_OK,FALSE},
3118 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3119 {"g%0aoogle.co%0dm",S_OK,FALSE},
3122 {"g%0aoogle.co%0dm",S_OK,FALSE},
3124 {"/%0A%0A%0A",S_OK,FALSE},
3125 {"/%0A%0A%0A",S_OK,FALSE},
3127 {"http://g\noogle.co\rm/\n\n\n",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 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3141 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3142 {"g\noogle.co\rm",S_OK,FALSE},
3143 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3144 {"g\noogle.co\rm",S_OK,FALSE},
3147 {"g\noogle.co\rm",S_OK,FALSE},
3149 {"/\n\n\n",S_OK,FALSE},
3150 {"/\n\n\n",S_OK,FALSE},
3152 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3158 {Uri_HOST_DNS,S_OK,FALSE},
3160 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3161 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3164 /* Since file URLs are usually hierarchical, it returns an empty string
3165 * for the absolute URI property since it was declared as an opaque URI.
3167 { "file:index.html", 0, S_OK, FALSE,
3171 {"file:index.html",S_OK,FALSE},
3173 {".html",S_OK,FALSE},
3177 {"index.html",S_OK,FALSE},
3178 {"index.html",S_OK,FALSE},
3180 {"file:index.html",S_OK,FALSE},
3181 {"file",S_OK,FALSE},
3186 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3188 {URL_SCHEME_FILE,S_OK,FALSE},
3189 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3192 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3193 { "http:test.com/index.html", 0, S_OK, FALSE,
3197 {"http:test.com/index.html",S_OK,FALSE},
3199 {".html",S_OK,FALSE},
3203 {"test.com/index.html",S_OK,FALSE},
3204 {"test.com/index.html",S_OK,FALSE},
3206 {"http:test.com/index.html",S_OK,FALSE},
3207 {"http",S_OK,FALSE},
3212 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3214 {URL_SCHEME_HTTP,S_OK,FALSE},
3215 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3218 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3222 {"ftp: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 {"ftp:test.com/index.html",S_OK,FALSE},
3237 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3239 {URL_SCHEME_FTP,S_OK,FALSE},
3240 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3243 { "file://C|/test.mp3", 0, S_OK, FALSE,
3245 {"file:///C:/test.mp3",S_OK,FALSE},
3247 {"file:///C:/test.mp3",S_OK,FALSE},
3249 {".mp3",S_OK,FALSE},
3253 {"/C:/test.mp3",S_OK,FALSE},
3254 {"/C:/test.mp3",S_OK,FALSE},
3256 {"file://C|/test.mp3",S_OK,FALSE},
3257 {"file",S_OK,FALSE},
3262 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3264 {URL_SCHEME_FILE,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 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3296 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3298 {"file://c:\\dir\\index.html",S_OK,FALSE},
3300 {"file://c:\\dir\\index.html",S_OK,FALSE},
3302 {".html",S_OK,FALSE},
3306 {"c:\\dir\\index.html",S_OK,FALSE},
3307 {"c:\\dir\\index.html",S_OK,FALSE},
3309 {"file://c:/dir/index.html",S_OK,FALSE},
3310 {"file",S_OK,FALSE},
3315 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3317 {URL_SCHEME_FILE,S_OK,FALSE},
3318 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3321 /* Extra '/' after "file://" is removed. */
3322 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3324 {"file://c:\\dir\\index.html",S_OK,FALSE},
3326 {"file://c:\\dir\\index.html",S_OK,FALSE},
3328 {".html",S_OK,FALSE},
3332 {"c:\\dir\\index.html",S_OK,FALSE},
3333 {"c:\\dir\\index.html",S_OK,FALSE},
3335 {"file:///c:/dir/index.html",S_OK,FALSE},
3336 {"file",S_OK,FALSE},
3341 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3343 {URL_SCHEME_FILE,S_OK,FALSE},
3344 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3347 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3348 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3350 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3352 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3354 {".html",S_OK,FALSE},
3358 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3359 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3361 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3362 {"file",S_OK,FALSE},
3367 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3369 {URL_SCHEME_FILE,S_OK,FALSE},
3370 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3373 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3375 {"file://c:\\dir\\index.html",S_OK,FALSE},
3377 {"file://c:\\dir\\index.html",S_OK,FALSE},
3379 {".html",S_OK,FALSE},
3383 {"c:\\dir\\index.html",S_OK,FALSE},
3384 {"c:\\dir\\index.html",S_OK,FALSE},
3386 {"file://c|/dir\\index.html",S_OK,FALSE},
3387 {"file",S_OK,FALSE},
3392 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3394 {URL_SCHEME_FILE,S_OK,FALSE},
3395 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3398 /* The backslashes after the scheme name are converted to forward slashes. */
3399 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3401 {"file://c:\\dir\\index.html",S_OK,FALSE},
3403 {"file://c:\\dir\\index.html",S_OK,FALSE},
3405 {".html",S_OK,FALSE},
3409 {"c:\\dir\\index.html",S_OK,FALSE},
3410 {"c:\\dir\\index.html",S_OK,FALSE},
3412 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3413 {"file",S_OK,FALSE},
3418 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3420 {URL_SCHEME_FILE,S_OK,FALSE},
3421 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3424 { "file:\\\\c:/dir/index.html", 0, 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 { "http:\\\\google.com", 0, S_OK, FALSE,
3451 {"http://google.com/",S_OK,FALSE},
3452 {"google.com",S_OK,FALSE},
3453 {"http://google.com/",S_OK,FALSE},
3454 {"google.com",S_OK,FALSE},
3457 {"google.com",S_OK,FALSE},
3462 {"http:\\\\google.com",S_OK,FALSE},
3463 {"http",S_OK,FALSE},
3468 {Uri_HOST_DNS,S_OK,FALSE},
3470 {URL_SCHEME_HTTP,S_OK,FALSE},
3471 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3474 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3475 { "zip:\\\\google.com", 0, S_OK, FALSE,
3477 {"zip:\\\\google.com",S_OK,FALSE},
3479 {"zip:\\\\google.com",S_OK,FALSE},
3481 {".com",S_OK,FALSE},
3485 {"\\\\google.com",S_OK,FALSE},
3486 {"\\\\google.com",S_OK,FALSE},
3488 {"zip:\\\\google.com",S_OK,FALSE},
3494 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3496 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3497 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3500 /* Dot segments aren't removed. */
3501 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3503 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3505 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3507 {".html",S_OK,FALSE},
3511 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3512 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3514 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3515 {"file",S_OK,FALSE},
3520 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3522 {URL_SCHEME_FILE,S_OK,FALSE},
3523 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3526 /* Forbidden characters aren't percent encoded. */
3527 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3529 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3531 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3533 {".html",S_OK,FALSE},
3537 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3538 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3540 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3541 {"file",S_OK,FALSE},
3546 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3548 {URL_SCHEME_FILE,S_OK,FALSE},
3549 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3552 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3553 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3557 {"file:c:/dir/../../index.html",S_OK,FALSE},
3559 {".html",S_OK,FALSE},
3563 {"c:/dir/../../index.html",S_OK,FALSE},
3564 {"c:/dir/../../index.html",S_OK,FALSE},
3566 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3567 {"file",S_OK,FALSE},
3572 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3574 {URL_SCHEME_FILE,S_OK,FALSE},
3575 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3578 /* '/' are still converted to '\' even though it's an opaque URI. */
3579 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3583 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3585 {".html",S_OK,FALSE},
3589 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3590 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3592 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3593 {"file",S_OK,FALSE},
3598 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3600 {URL_SCHEME_FILE,S_OK,FALSE},
3601 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3604 /* Forbidden characters aren't percent encoded. */
3605 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3609 {"file:c:\\in^|dex.html",S_OK,FALSE},
3611 {".html",S_OK,FALSE},
3615 {"c:\\in^|dex.html",S_OK,FALSE},
3616 {"c:\\in^|dex.html",S_OK,FALSE},
3618 {"file:c:\\in^|dex.html",S_OK,FALSE},
3619 {"file",S_OK,FALSE},
3624 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3626 {URL_SCHEME_FILE,S_OK,FALSE},
3627 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3630 /* Doesn't have a UserName since the ':' appears at the beginning of the
3633 { "http://:password@gov.uk", 0, S_OK, FALSE,
3635 {"http://:password@gov.uk/",S_OK,FALSE},
3636 {":password@gov.uk",S_OK,FALSE},
3637 {"http://gov.uk/",S_OK,FALSE},
3641 {"gov.uk",S_OK,FALSE},
3642 {"password",S_OK,FALSE},
3646 {"http://:password@gov.uk",S_OK,FALSE},
3647 {"http",S_OK,FALSE},
3648 {":password",S_OK,FALSE},
3652 {Uri_HOST_DNS,S_OK,FALSE},
3654 {URL_SCHEME_HTTP,S_OK,FALSE},
3655 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3658 /* Has a UserName since the userinfo section doesn't contain a password. */
3659 { "http://@gov.uk", 0, S_OK, FALSE,
3661 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3662 {"@gov.uk",S_OK,FALSE},
3663 {"http://gov.uk/",S_OK,FALSE},
3667 {"gov.uk",S_OK,FALSE},
3672 {"http://@gov.uk",S_OK,FALSE},
3673 {"http",S_OK,FALSE},
3678 {Uri_HOST_DNS,S_OK,FALSE},
3680 {URL_SCHEME_HTTP,S_OK,FALSE},
3681 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3684 /* ":@" not included in the absolute URI. */
3685 { "http://:@gov.uk", 0, S_OK, FALSE,
3687 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3688 {":@gov.uk",S_OK,FALSE},
3689 {"http://gov.uk/",S_OK,FALSE},
3693 {"gov.uk",S_OK,FALSE},
3698 {"http://:@gov.uk",S_OK,FALSE},
3699 {"http",S_OK,FALSE},
3704 {Uri_HOST_DNS,S_OK,FALSE},
3706 {URL_SCHEME_HTTP,S_OK,FALSE},
3707 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3710 /* '@' is included because it's an unknown scheme type. */
3711 { "zip://@gov.uk", 0, S_OK, FALSE,
3713 {"zip://@gov.uk/",S_OK,FALSE},
3714 {"@gov.uk",S_OK,FALSE},
3715 {"zip://@gov.uk/",S_OK,FALSE},
3719 {"gov.uk",S_OK,FALSE},
3724 {"zip://@gov.uk",S_OK,FALSE},
3730 {Uri_HOST_DNS,S_OK,FALSE},
3732 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3733 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3736 /* ":@" are included because it's an unknown scheme type. */
3737 { "zip://:@gov.uk", 0, S_OK, FALSE,
3739 {"zip://:@gov.uk/",S_OK,FALSE},
3740 {":@gov.uk",S_OK,FALSE},
3741 {"zip://:@gov.uk/",S_OK,FALSE},
3745 {"gov.uk",S_OK,FALSE},
3750 {"zip://:@gov.uk",S_OK,FALSE},
3756 {Uri_HOST_DNS,S_OK,FALSE},
3758 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3759 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3762 { "about:blank", 0, S_OK, FALSE,
3764 {"about:blank",S_OK,FALSE},
3766 {"about:blank",S_OK,FALSE},
3772 {"blank",S_OK,FALSE},
3773 {"blank",S_OK,FALSE},
3775 {"about:blank",S_OK,FALSE},
3776 {"about",S_OK,FALSE},
3781 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3783 {URL_SCHEME_ABOUT,S_OK,FALSE},
3784 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3787 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3789 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3791 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3793 {".htm",S_OK,FALSE},
3797 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3798 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3800 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3806 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3808 {URL_SCHEME_MK,S_OK,FALSE},
3809 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3812 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3814 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3816 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3818 {".htm",S_OK,FALSE},
3822 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3823 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3825 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.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 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3838 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3840 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3841 {"server",S_OK,FALSE},
3842 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3844 {".html",S_OK,FALSE},
3846 {"server",S_OK,FALSE},
3848 {"\\dir\\index.html",S_OK,FALSE},
3849 {"\\dir\\index.html",S_OK,FALSE},
3851 {"file://server/dir/index.html",S_OK,FALSE},
3852 {"file",S_OK,FALSE},
3857 {Uri_HOST_DNS,S_OK,FALSE},
3859 {URL_SCHEME_FILE,S_OK,FALSE},
3860 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3863 /* When CreateUri generates an IUri, it still displays the default port in the
3866 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3868 {"http://google.com:80/",S_OK,FALSE},
3869 {"google.com:80",S_OK,FALSE},
3870 {"http://google.com:80/",S_OK,FALSE},
3871 {"google.com",S_OK,FALSE},
3874 {"google.com",S_OK,FALSE},
3879 {"http://google.com:80/",S_OK,FALSE},
3880 {"http",S_OK,FALSE},
3885 {Uri_HOST_DNS,S_OK,FALSE},
3887 {URL_SCHEME_HTTP,S_OK,FALSE},
3888 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3891 /* For res URIs the host is everything up until the first '/'. */
3892 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3894 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3895 {"C:\\dir\\file.exe",S_OK,FALSE},
3896 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3898 {".html",S_OK,FALSE},
3900 {"C:\\dir\\file.exe",S_OK,FALSE},
3902 {"/DATA/test.html",S_OK,FALSE},
3903 {"/DATA/test.html",S_OK,FALSE},
3905 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3911 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3913 {URL_SCHEME_RES,S_OK,FALSE},
3914 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3917 /* Res URI can contain a '|' in the host name. */
3918 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
3920 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3921 {"c:\\di|r\\file.exe",S_OK,FALSE},
3922 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3926 {"c:\\di|r\\file.exe",S_OK,FALSE},
3928 {"/test",S_OK,FALSE},
3929 {"/test",S_OK,FALSE},
3931 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3937 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3939 {URL_SCHEME_RES,S_OK,FALSE},
3940 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3943 /* Res URIs can have invalid percent encoded values. */
3944 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
3946 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3947 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3948 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3952 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3954 {"/test",S_OK,FALSE},
3955 {"/test",S_OK,FALSE},
3957 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3963 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3965 {URL_SCHEME_RES,S_OK,FALSE},
3966 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3969 /* Res doesn't get forbidden characters percent encoded in it's path. */
3970 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
3972 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3973 {"c:\\test",S_OK,FALSE},
3974 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3978 {"c:\\test",S_OK,FALSE},
3980 {"/tes<|>t",S_OK,FALSE},
3981 {"/tes<|>t",S_OK,FALSE},
3983 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3989 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3991 {URL_SCHEME_RES,S_OK,FALSE},
3992 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3995 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
3997 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
3999 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4001 {".jpg",S_OK,FALSE},
4005 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4006 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4008 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4014 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4016 {URL_SCHEME_MK,S_OK,FALSE},
4017 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4020 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4022 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4024 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4026 {".jpg",S_OK,FALSE},
4030 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4031 {"@MSITStore:Z:\\dir\\test.chm::/html/../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 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4047 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4049 {"xx:@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 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4064 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4066 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4067 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4070 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4072 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4074 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4076 {".jpg",S_OK,FALSE},
4080 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4081 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4083 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4089 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4091 {URL_SCHEME_MK,S_OK,FALSE},
4092 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4095 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\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\\dir2\\..\\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\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4122 {"mk:images/xxx.jpg",S_OK,FALSE},
4124 {"mk:images/xxx.jpg",S_OK,FALSE},
4126 {".jpg",S_OK,FALSE},
4130 {"images/xxx.jpg",S_OK,FALSE},
4131 {"images/xxx.jpg",S_OK,FALSE},
4133 {"mk:@MSITStore:Z:\\dir\\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 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4164 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4166 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4167 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4170 { " \t ", 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}
4198 typedef struct _invalid_uri {
4204 static const invalid_uri invalid_uri_tests[] = {
4205 /* Has to have a scheme name. */
4206 {"://www.winehq.org",0,FALSE},
4207 /* Window's doesn't like URI's which are implicitly file paths without the
4208 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4210 {"C:/test/test.mp3",0,FALSE},
4211 {"\\\\Server/test/test.mp3",0,FALSE},
4212 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4213 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4214 /* Invalid schemes. */
4215 {"*abcd://not.valid.com",0,FALSE},
4216 {"*a*b*c*d://not.valid.com",0,FALSE},
4217 /* Not allowed to have invalid % encoded data. */
4218 {"ftp://google.co%XX/",0,FALSE},
4219 /* To many h16 components. */
4220 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4221 /* Not enough room for IPv4 address. */
4222 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4223 /* Not enough h16 components. */
4224 {"http://[1:2:3:4]",0,FALSE},
4225 /* Not enough components including IPv4. */
4226 {"http://[1:192.0.1.0]",0,FALSE},
4227 /* Not allowed to have partial IPv4 in IPv6. */
4228 {"http://[::192.0]",0,FALSE},
4229 /* Can't have elision of 1 h16 at beginning of address. */
4230 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4231 /* Can't have elision of 1 h16 at end of address. */
4232 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4233 /* Expects a valid IP Literal. */
4234 {"ftp://[not.valid.uri]/",0,FALSE},
4235 /* Expects valid port for a known scheme type. */
4236 {"ftp://www.winehq.org:123fgh",0,FALSE},
4237 /* Port exceeds USHORT_MAX for known scheme type. */
4238 {"ftp://www.winehq.org:65536",0,FALSE},
4239 /* Invalid port with IPv4 address. */
4240 {"http://www.winehq.org:1abcd",0,FALSE},
4241 /* Invalid port with IPv6 address. */
4242 {"http://[::ffff]:32xy",0,FALSE},
4243 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4244 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4245 /* Not allowed to have invalid % encoded data in opaque URI path. */
4246 {"news:test%XX",0,FALSE},
4247 {"mailto:wine@winehq%G8.com",0,FALSE},
4248 /* Known scheme types can't have invalid % encoded data in query string. */
4249 {"http://google.com/?query=te%xx",0,FALSE},
4250 /* Invalid % encoded data in fragment of know scheme type. */
4251 {"ftp://google.com/#Test%xx",0,FALSE},
4252 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4253 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4254 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4255 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4256 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4257 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4258 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4259 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4260 /* res URIs aren't allowed to have forbidden dos path characters in the
4263 {"res://c:\\te<st\\test/test",0,FALSE},
4264 {"res://c:\\te>st\\test/test",0,FALSE},
4265 {"res://c:\\te\"st\\test/test",0,FALSE},
4266 {"res://c:\\test/te%xxst",0,FALSE}
4269 typedef struct _uri_equality {
4271 DWORD create_flags_a;
4274 DWORD create_flags_b;
4280 static const uri_equality equality_tests[] = {
4282 "HTTP://www.winehq.org/test dir/./",0,FALSE,
4283 "http://www.winehq.org/test dir/../test dir/",0,FALSE,
4287 /* http://www.winehq.org/test%20dir */
4288 "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,
4289 "http://www.winehq.org/test dir",0,FALSE,
4293 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,FALSE,
4294 "file:///c:/test.mp3",0,FALSE,
4298 "ftp://ftp.winehq.org/",0,FALSE,
4299 "ftp://ftp.winehq.org",0,FALSE,
4303 "ftp://ftp.winehq.org/test/test2/../../testB/",0,FALSE,
4304 "ftp://ftp.winehq.org/t%45stB/",0,FALSE,
4308 "http://google.com/TEST",0,FALSE,
4309 "http://google.com/test",0,FALSE,
4313 "http://GOOGLE.com/",0,FALSE,
4314 "http://google.com/",0,FALSE,
4317 /* Performs case insensitive compare of host names (for known scheme types). */
4319 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4320 "ftp://google.com/",0,FALSE,
4324 "zip://GOOGLE.com/",0,FALSE,
4325 "zip://google.com/",0,FALSE,
4329 "file:///c:/TEST/TeST/",0,FALSE,
4330 "file:///c:/test/test/",0,FALSE,
4334 "file:///server/TEST",0,FALSE,
4335 "file:///SERVER/TEST",0,FALSE,
4339 "http://google.com",Uri_CREATE_NO_CANONICALIZE,FALSE,
4340 "http://google.com/",0,FALSE,
4344 "ftp://google.com:21/",0,FALSE,
4345 "ftp://google.com/",0,FALSE,
4349 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4350 "http://google.com/",0,FALSE,
4354 "http://google.com:70/",0,FALSE,
4355 "http://google.com:71/",0,FALSE,
4360 typedef struct _uri_with_fragment {
4362 const char* fragment;
4364 HRESULT create_expected;
4367 const char* expected_uri;
4369 } uri_with_fragment;
4371 static const uri_with_fragment uri_fragment_tests[] = {
4373 "http://google.com/","#fragment",0,S_OK,FALSE,
4374 "http://google.com/#fragment",FALSE
4377 "http://google.com/","fragment",0,S_OK,FALSE,
4378 "http://google.com/#fragment",FALSE
4381 "zip://test.com/","?test",0,S_OK,FALSE,
4382 "zip://test.com/#?test",FALSE
4384 /* The fragment can be empty. */
4386 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4387 "ftp://ftp.google.com/#",FALSE
4391 typedef struct _uri_builder_property {
4394 const char *expected_value;
4395 Uri_PROPERTY property;
4398 } uri_builder_property;
4400 typedef struct _uri_builder_port {
4408 typedef struct _uri_builder_str_property {
4409 const char* expected;
4412 } uri_builder_str_property;
4414 typedef struct _uri_builder_dword_property {
4418 } uri_builder_dword_property;
4420 typedef struct _uri_builder_test {
4423 HRESULT create_builder_expected;
4424 BOOL create_builder_todo;
4426 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4428 uri_builder_port port_prop;
4434 DWORD uri_simple_encode_flags;
4435 HRESULT uri_simple_hres;
4436 BOOL uri_simple_todo;
4438 DWORD uri_with_flags;
4439 DWORD uri_with_builder_flags;
4440 DWORD uri_with_encode_flags;
4441 HRESULT uri_with_hres;
4444 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4445 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4448 static const uri_builder_test uri_builder_tests[] = {
4449 { "http://google.com/",0,S_OK,FALSE,
4451 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4452 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4453 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4454 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4461 {"http://username:password@google.com/?query=x#fragment",S_OK},
4462 {"username:password@google.com",S_OK},
4463 {"http://google.com/?query=x#fragment",S_OK},
4464 {"google.com",S_OK},
4467 {"google.com",S_OK},
4472 {"http://username:password@google.com/?query=x#fragment",S_OK},
4474 {"username:password",S_OK},
4478 {Uri_HOST_DNS,S_OK},
4480 {URL_SCHEME_HTTP,S_OK},
4481 {URLZONE_INVALID,E_NOTIMPL}
4484 { "http://google.com/",0,S_OK,FALSE,
4486 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4488 {TRUE,TRUE,120,S_OK,FALSE},
4493 {"test://google.com:120/",S_OK},
4494 {"google.com:120",S_OK},
4495 {"test://google.com:120/",S_OK},
4496 {"google.com",S_OK},
4499 {"google.com",S_OK},
4504 {"test://google.com:120/",S_OK},
4510 {Uri_HOST_DNS,S_OK},
4512 {URL_SCHEME_UNKNOWN,S_OK},
4513 {URLZONE_INVALID,E_NOTIMPL}
4516 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4518 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4519 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4520 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4527 {"http://[::192.2.3.4]/",S_OK},
4528 {"[::192.2.3.4]",S_OK},
4529 {"http://[::192.2.3.4]/",S_OK},
4533 {"::192.2.3.4",S_OK},
4538 {"http://[::192.2.3.4]/",S_OK},
4544 {Uri_HOST_IPV6,S_OK},
4546 {URL_SCHEME_HTTP,S_OK},
4547 {URLZONE_INVALID,E_NOTIMPL}
4550 { "http://google.com/",0,S_OK,FALSE,
4552 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4559 {"http://google.com/#Frag",S_OK},
4560 {"google.com",S_OK},
4561 {"http://google.com/#Frag",S_OK},
4562 {"google.com",S_OK},
4565 {"google.com",S_OK},
4570 {"http://google.com/#Frag",S_OK},
4576 {Uri_HOST_DNS,S_OK},
4578 {URL_SCHEME_HTTP,S_OK},
4579 {URLZONE_INVALID,E_NOTIMPL}
4582 { "http://google.com/",0,S_OK,FALSE,
4584 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4591 {"http://google.com/#",S_OK},
4592 {"google.com",S_OK},
4593 {"http://google.com/#",S_OK},
4594 {"google.com",S_OK},
4597 {"google.com",S_OK},
4602 {"http://google.com/#",S_OK},
4608 {Uri_HOST_DNS,S_OK},
4610 {URL_SCHEME_HTTP,S_OK},
4611 {URLZONE_INVALID,E_NOTIMPL}
4614 { "http://google.com/",0,S_OK,FALSE,
4616 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4623 {"http://::password@google.com/",S_OK},
4624 {"::password@google.com",S_OK},
4625 {"http://google.com/",S_OK},
4626 {"google.com",S_OK},
4629 {"google.com",S_OK},
4634 {"http://::password@google.com/",S_OK},
4636 {"::password",S_OK},
4640 {Uri_HOST_DNS,S_OK},
4642 {URL_SCHEME_HTTP,S_OK},
4643 {URLZONE_INVALID,E_NOTIMPL}
4646 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4648 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4651 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4653 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4655 {":password@test/test",S_OK},
4656 {":password@",S_OK},
4657 {":password@test/test",S_OK},
4666 {":password@test/test",S_OK},
4672 {Uri_HOST_UNKNOWN,S_OK},
4674 {URL_SCHEME_UNKNOWN,S_OK},
4675 {URLZONE_INVALID,E_NOTIMPL}
4678 { "http://google.com/",0,S_OK,FALSE,
4680 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4687 {"http://google.com/test/test",S_OK},
4688 {"google.com",S_OK},
4689 {"http://google.com/test/test",S_OK},
4690 {"google.com",S_OK},
4693 {"google.com",S_OK},
4695 {"/test/test",S_OK},
4696 {"/test/test",S_OK},
4698 {"http://google.com/test/test",S_OK},
4704 {Uri_HOST_DNS,S_OK},
4706 {URL_SCHEME_HTTP,S_OK},
4707 {URLZONE_INVALID,E_NOTIMPL}
4710 { "zip:testing/test",0,S_OK,FALSE,
4712 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4736 {Uri_HOST_UNKNOWN,S_OK},
4738 {URL_SCHEME_UNKNOWN,S_OK},
4739 {URLZONE_INVALID,E_NOTIMPL}
4742 { "http://google.com/",0,S_OK,FALSE,
4746 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4747 {TRUE,FALSE,555,S_OK,FALSE},
4752 {"http://google.com/",S_OK},
4753 {"google.com",S_OK},
4754 {"http://google.com/",S_OK},
4755 {"google.com",S_OK},
4758 {"google.com",S_OK},
4763 {"http://google.com/",S_OK},
4769 {Uri_HOST_DNS,S_OK},
4770 /* Still returns 80, even though earlier the port was disabled. */
4772 {URL_SCHEME_HTTP,S_OK},
4773 {URLZONE_INVALID,E_NOTIMPL}
4776 { "http://google.com/",0,S_OK,FALSE,
4780 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4781 * you'll get 122345 instead.
4783 {TRUE,122345,222,S_OK,FALSE},
4788 {"http://google.com:222/",S_OK},
4789 {"google.com:222",S_OK},
4790 {"http://google.com:222/",S_OK},
4791 {"google.com",S_OK},
4794 {"google.com",S_OK},
4799 {"http://google.com:222/",S_OK},
4805 {Uri_HOST_DNS,S_OK},
4807 {URL_SCHEME_HTTP,S_OK},
4808 {URLZONE_INVALID,E_NOTIMPL}
4811 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
4812 { "http://google.com/",0,S_OK,FALSE,
4816 {TRUE,TRUE,999999,S_OK,FALSE},
4821 {"http://google.com:999999/",S_OK},
4822 {"google.com:999999",S_OK},
4823 {"http://google.com:999999/",S_OK},
4824 {"google.com",S_OK},
4827 {"google.com",S_OK},
4832 {"http://google.com:999999/",S_OK},
4838 {Uri_HOST_DNS,S_OK},
4840 {URL_SCHEME_HTTP,S_OK},
4841 {URLZONE_INVALID,E_NOTIMPL}
4844 { "http://google.com/",0,S_OK,FALSE,
4846 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
4854 {"http://google.com/?test",S_OK},
4855 {"google.com",S_OK},
4856 {"http://google.com/?test",S_OK},
4857 {"google.com",S_OK},
4860 {"google.com",S_OK},
4865 {"http://google.com/?test",S_OK},
4871 {Uri_HOST_DNS,S_OK},
4873 {URL_SCHEME_HTTP,S_OK},
4874 {URLZONE_INVALID,E_NOTIMPL}
4877 { "http://:password@google.com/",0,S_OK,FALSE,
4886 {"http://:password@google.com/",S_OK},
4887 {":password@google.com",S_OK},
4888 {"http://google.com/",S_OK},
4889 {"google.com",S_OK},
4892 {"google.com",S_OK},
4897 {"http://:password@google.com/",S_OK},
4903 {Uri_HOST_DNS,S_OK},
4905 {URL_SCHEME_HTTP,S_OK},
4906 {URLZONE_INVALID,E_NOTIMPL}
4909 /* IUriBuilder doesn't need a base IUri to build a IUri. */
4910 { NULL,0,S_OK,FALSE,
4912 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4913 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
4920 {"http://google.com/",S_OK},
4921 {"google.com",S_OK},
4922 {"http://google.com/",S_OK},
4923 {"google.com",S_OK},
4926 {"google.com",S_OK},
4931 {"http://google.com/",S_OK},
4937 {Uri_HOST_DNS,S_OK},
4939 {URL_SCHEME_HTTP,S_OK},
4940 {URLZONE_INVALID,E_NOTIMPL}
4943 /* Can't set the scheme name to NULL. */
4944 { "zip://google.com/",0,S_OK,FALSE,
4946 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
4953 {"zip://google.com/",S_OK},
4954 {"google.com",S_OK},
4955 {"zip://google.com/",S_OK},
4956 {"google.com",S_OK},
4959 {"google.com",S_OK},
4964 {"zip://google.com/",S_OK},
4970 {Uri_HOST_DNS,S_OK},
4972 {URL_SCHEME_UNKNOWN,S_OK},
4973 {URLZONE_INVALID,E_NOTIMPL}
4976 /* Can't set the scheme name to an empty string. */
4977 { "zip://google.com/",0,S_OK,FALSE,
4979 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
4986 {"zip://google.com/",S_OK},
4987 {"google.com",S_OK},
4988 {"zip://google.com/",S_OK},
4989 {"google.com",S_OK},
4992 {"google.com",S_OK},
4997 {"zip://google.com/",S_OK},
5003 {Uri_HOST_DNS,S_OK},
5005 {URL_SCHEME_UNKNOWN,S_OK},
5006 {URLZONE_INVALID,E_NOTIMPL}
5009 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5010 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5012 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5017 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5019 {"http://google.com/../../",S_OK},
5020 {"google.com",S_OK},
5021 {"http://google.com/../../",S_OK},
5022 {"google.com",S_OK},
5025 {"google.com",S_OK},
5030 {"http://google.com/../../",S_OK},
5036 {Uri_HOST_DNS,S_OK},
5038 {URL_SCHEME_HTTP,S_OK},
5039 {URLZONE_INVALID,E_NOTIMPL}
5042 { "http://google.com/",0,S_OK,FALSE,
5044 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5049 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5051 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5052 {"google.com",S_OK},
5053 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5054 {"google.com",S_OK},
5056 {"#Fr%3C%7C%3Eg",S_OK},
5057 {"google.com",S_OK},
5062 {"http://google.com/#Fr<|>g",S_OK},
5068 {Uri_HOST_DNS,S_OK},
5070 {URL_SCHEME_HTTP,S_OK},
5071 {URLZONE_INVALID,E_NOTIMPL}
5074 { "http://google.com/",0,S_OK,FALSE,
5076 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5079 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5081 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5083 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5084 {"google.com",S_OK},
5085 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5086 {"google.com",S_OK},
5088 {"#Fr%3C%7C%3Eg",S_OK},
5089 {"google.com",S_OK},
5094 {"http://google.com/#Fr<|>g",S_OK},
5100 {Uri_HOST_DNS,S_OK},
5102 {URL_SCHEME_HTTP,S_OK},
5103 {URLZONE_INVALID,E_NOTIMPL}
5106 { NULL,0,S_OK,FALSE,
5108 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5109 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5112 0,INET_E_INVALID_URL,FALSE,
5113 0,INET_E_INVALID_URL,FALSE,
5114 0,0,0,INET_E_INVALID_URL,FALSE
5116 { "http://google.com/",0,S_OK,FALSE,
5118 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5121 0,INET_E_INVALID_URL,FALSE,
5122 0,INET_E_INVALID_URL,FALSE,
5123 0,0,0,INET_E_INVALID_URL,FALSE
5125 /* File scheme's can't have a username set. */
5126 { "file://google.com/",0,S_OK,FALSE,
5128 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5131 0,INET_E_INVALID_URL,FALSE,
5132 0,INET_E_INVALID_URL,FALSE,
5133 0,0,0,INET_E_INVALID_URL,FALSE
5135 /* File schemes can't have a password set. */
5136 { "file://google.com/",0,S_OK,FALSE,
5138 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5141 0,INET_E_INVALID_URL,FALSE,
5142 0,INET_E_INVALID_URL,FALSE,
5143 0,0,0,INET_E_INVALID_URL,FALSE
5145 /* UserName can't contain any character that is a delimeter for another
5146 * component that appears after it in a normal URI.
5148 { "http://google.com/",0,S_OK,FALSE,
5150 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5153 0,INET_E_INVALID_URL,FALSE,
5154 0,INET_E_INVALID_URL,FALSE,
5155 0,0,0,INET_E_INVALID_URL,FALSE
5157 { "http://google.com/",0,S_OK,FALSE,
5159 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5162 0,INET_E_INVALID_URL,FALSE,
5163 0,INET_E_INVALID_URL,FALSE,
5164 0,0,0,INET_E_INVALID_URL,FALSE
5166 { "http://google.com/",0,S_OK,FALSE,
5168 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5171 0,INET_E_INVALID_URL,FALSE,
5172 0,INET_E_INVALID_URL,FALSE,
5173 0,0,0,INET_E_INVALID_URL,FALSE
5175 { "http://google.com/",0,S_OK,FALSE,
5177 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5180 0,INET_E_INVALID_URL,FALSE,
5181 0,INET_E_INVALID_URL,FALSE,
5182 0,0,0,INET_E_INVALID_URL,FALSE
5184 { "http://google.com/",0,S_OK,FALSE,
5186 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5189 0,INET_E_INVALID_URL,FALSE,
5190 0,INET_E_INVALID_URL,FALSE,
5191 0,0,0,INET_E_INVALID_URL,FALSE
5193 { "http://google.com/",0,S_OK,FALSE,
5195 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5198 0,INET_E_INVALID_URL,FALSE,
5199 0,INET_E_INVALID_URL,FALSE,
5200 0,0,0,INET_E_INVALID_URL,FALSE
5202 { "http://google.com/",0,S_OK,FALSE,
5204 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5207 0,INET_E_INVALID_URL,FALSE,
5208 0,INET_E_INVALID_URL,FALSE,
5209 0,0,0,INET_E_INVALID_URL,FALSE
5211 { "http://google.com/",0,S_OK,FALSE,
5213 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5216 0,INET_E_INVALID_URL,FALSE,
5217 0,INET_E_INVALID_URL,FALSE,
5218 0,0,0,INET_E_INVALID_URL,FALSE
5220 { "http://google.com/",0,S_OK,FALSE,
5222 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5225 0,INET_E_INVALID_URL,FALSE,
5226 0,INET_E_INVALID_URL,FALSE,
5227 0,0,0,INET_E_INVALID_URL,FALSE
5229 { "http://google.com/",0,S_OK,FALSE,
5231 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5234 0,INET_E_INVALID_URL,FALSE,
5235 0,INET_E_INVALID_URL,FALSE,
5236 0,0,0,INET_E_INVALID_URL,FALSE
5238 { "http://google.com/",0,S_OK,FALSE,
5240 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5243 0,INET_E_INVALID_URL,FALSE,
5244 0,INET_E_INVALID_URL,FALSE,
5245 0,0,0,INET_E_INVALID_URL,FALSE
5247 { "http://google.com/",0,S_OK,FALSE,
5249 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5252 0,INET_E_INVALID_URL,FALSE,
5253 0,INET_E_INVALID_URL,FALSE,
5254 0,0,0,INET_E_INVALID_URL,FALSE
5256 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5257 { "http://google.com/",0,S_OK,FALSE,
5259 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5266 {"http://winehq.org:test/",S_OK},
5267 {"winehq.org:test",S_OK},
5268 {"http://winehq.org:test/",S_OK},
5269 {"winehq.org:test",S_OK},
5272 {"winehq.org:test",S_OK},
5277 {"http://winehq.org:test/",S_OK},
5283 {Uri_HOST_DNS,S_OK},
5285 {URL_SCHEME_HTTP,S_OK},
5286 {URLZONE_INVALID,E_NOTIMPL}
5289 /* Can't set the host name to NULL. */
5290 { "http://google.com/",0,S_OK,FALSE,
5292 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5299 {"http://google.com/",S_OK},
5300 {"google.com",S_OK},
5301 {"http://google.com/",S_OK},
5302 {"google.com",S_OK},
5305 {"google.com",S_OK},
5310 {"http://google.com/",S_OK},
5316 {Uri_HOST_DNS,S_OK},
5318 {URL_SCHEME_HTTP,S_OK},
5319 {URLZONE_INVALID,E_NOTIMPL}
5322 /* Can set the host name to an empty string. */
5323 { "http://google.com/",0,S_OK,FALSE,
5325 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5349 {Uri_HOST_UNKNOWN,S_OK},
5351 {URL_SCHEME_HTTP,S_OK},
5352 {URLZONE_INVALID,E_NOTIMPL}
5355 { "http://google.com/",0,S_OK,FALSE,
5357 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5360 0,INET_E_INVALID_URL,FALSE,
5361 0,INET_E_INVALID_URL,FALSE,
5362 0,0,0,INET_E_INVALID_URL,FALSE
5364 { "http://google.com/",0,S_OK,FALSE,
5366 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5369 0,INET_E_INVALID_URL,FALSE,
5370 0,INET_E_INVALID_URL,FALSE,
5371 0,0,0,INET_E_INVALID_URL,FALSE
5373 { "http://google.com/",0,S_OK,FALSE,
5375 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5378 0,INET_E_INVALID_URL,FALSE,
5379 0,INET_E_INVALID_URL,FALSE,
5380 0,0,0,INET_E_INVALID_URL,FALSE
5384 typedef struct _uri_builder_remove_test {
5387 HRESULT create_builder_expected;
5388 BOOL create_builder_todo;
5390 DWORD remove_properties;
5391 HRESULT remove_expected;
5394 const char *expected_uri;
5395 DWORD expected_flags;
5396 HRESULT expected_hres;
5398 } uri_builder_remove_test;
5400 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5401 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5402 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5403 "http://google.com/",0,S_OK,FALSE
5405 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5406 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5407 "http://winehq.org/",0,S_OK,FALSE
5409 { "zip://google.com?Test=x",0,S_OK,FALSE,
5410 Uri_HAS_HOST,S_OK,FALSE,
5411 "zip:/?Test=x",0,S_OK,FALSE
5413 /* Doesn't remove the whole userinfo component. */
5414 { "http://username:pass@google.com/",0,S_OK,FALSE,
5415 Uri_HAS_USER_INFO,S_OK,FALSE,
5416 "http://username:pass@google.com/",0,S_OK,FALSE
5418 /* Doesn't remove the domain. */
5419 { "http://google.com/",0,S_OK,FALSE,
5420 Uri_HAS_DOMAIN,S_OK,FALSE,
5421 "http://google.com/",0,S_OK,FALSE
5423 { "http://google.com:120/",0,S_OK,FALSE,
5424 Uri_HAS_AUTHORITY,S_OK,FALSE,
5425 "http://google.com:120/",0,S_OK,FALSE
5427 { "http://google.com/test.com/",0,S_OK,FALSE,
5428 Uri_HAS_EXTENSION,S_OK,FALSE,
5429 "http://google.com/test.com/",0,S_OK,FALSE
5431 { "http://google.com/?test=x",0,S_OK,FALSE,
5432 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5433 "http://google.com/?test=x",0,S_OK,FALSE
5435 /* Can't remove the scheme name. */
5436 { "http://google.com/?test=x",0,S_OK,FALSE,
5437 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5438 "http://google.com/?test=x",0,S_OK,FALSE
5442 typedef struct _uri_combine_str_property {
5446 const char *broken_value;
5447 const char *value_ex;
5448 } uri_combine_str_property;
5450 typedef struct _uri_combine_test {
5451 const char *base_uri;
5452 DWORD base_create_flags;
5453 const char *relative_uri;
5454 DWORD relative_create_flags;
5455 DWORD combine_flags;
5459 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5460 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5463 static const uri_combine_test uri_combine_tests[] = {
5464 { "http://google.com/fun/stuff",0,
5465 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5468 {"http://google.com/not/fun/stuff",S_OK},
5469 {"google.com",S_OK},
5470 {"http://google.com/not/fun/stuff",S_OK},
5471 {"google.com",S_OK},
5474 {"google.com",S_OK},
5476 {"/not/fun/stuff",S_OK},
5477 {"/not/fun/stuff",S_OK},
5479 {"http://google.com/not/fun/stuff",S_OK},
5485 {Uri_HOST_DNS,S_OK},
5487 {URL_SCHEME_HTTP,S_OK},
5488 {URLZONE_INVALID,E_NOTIMPL}
5491 { "http://google.com/test",0,
5492 "zip://test.com/cool",0,
5495 {"zip://test.com/cool",S_OK},
5497 {"zip://test.com/cool",S_OK},
5506 {"zip://test.com/cool",S_OK},
5512 {Uri_HOST_DNS,S_OK},
5514 {URL_SCHEME_UNKNOWN,S_OK},
5515 {URLZONE_INVALID,E_NOTIMPL}
5518 { "http://google.com/use/base/path",0,
5519 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5522 {"http://google.com/use/base/path?relative",S_OK},
5523 {"google.com",S_OK},
5524 {"http://google.com/use/base/path?relative",S_OK},
5525 {"google.com",S_OK},
5528 {"google.com",S_OK},
5530 {"/use/base/path",S_OK},
5531 {"/use/base/path?relative",S_OK},
5533 {"http://google.com/use/base/path?relative",S_OK},
5539 {Uri_HOST_DNS,S_OK},
5541 {URL_SCHEME_HTTP,S_OK},
5542 {URLZONE_INVALID,E_NOTIMPL}
5545 { "http://google.com/path",0,
5546 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5549 {"http://google.com/testing",S_OK},
5550 {"google.com",S_OK},
5551 {"http://google.com/testing",S_OK},
5552 {"google.com",S_OK},
5555 {"google.com",S_OK},
5560 {"http://google.com/testing",S_OK},
5566 {Uri_HOST_DNS,S_OK},
5568 {URL_SCHEME_HTTP,S_OK},
5569 {URLZONE_INVALID,E_NOTIMPL}
5572 { "http://google.com/path",0,
5573 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5574 URL_DONT_SIMPLIFY,S_OK,FALSE,
5576 {"http://google.com:80/test/../test/.././testing",S_OK},
5577 {"google.com",S_OK},
5578 {"http://google.com:80/test/../test/.././testing",S_OK},
5579 {"google.com",S_OK},
5582 {"google.com",S_OK},
5584 {"/test/../test/.././testing",S_OK},
5585 {"/test/../test/.././testing",S_OK},
5587 {"http://google.com:80/test/../test/.././testing",S_OK},
5593 {Uri_HOST_DNS,S_OK},
5595 {URL_SCHEME_HTTP,S_OK},
5596 {URLZONE_INVALID,E_NOTIMPL}
5599 { "http://winehq.org/test/abc",0,
5600 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5603 {"http://winehq.org/test/testing/test",S_OK},
5604 {"winehq.org",S_OK},
5605 {"http://winehq.org/test/testing/test",S_OK},
5606 {"winehq.org",S_OK},
5609 {"winehq.org",S_OK},
5611 {"/test/testing/test",S_OK},
5612 {"/test/testing/test",S_OK},
5614 {"http://winehq.org/test/testing/test",S_OK},
5620 {Uri_HOST_DNS,S_OK},
5622 {URL_SCHEME_HTTP,S_OK},
5623 {URLZONE_INVALID,E_NOTIMPL}
5626 { "http://winehq.org/test/abc",0,
5627 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5628 URL_DONT_SIMPLIFY,S_OK,FALSE,
5630 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5631 /* Default port is hidden in the authority. */
5632 {"winehq.org",S_OK},
5633 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5634 {"winehq.org",S_OK},
5637 {"winehq.org",S_OK},
5639 {"/test/testing/abc/../test",S_OK},
5640 {"/test/testing/abc/../test",S_OK},
5642 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5648 {Uri_HOST_DNS,S_OK},
5650 {URL_SCHEME_HTTP,S_OK},
5651 {URLZONE_INVALID,E_NOTIMPL}
5654 { "http://winehq.org/test?query",0,
5655 "testing",Uri_CREATE_ALLOW_RELATIVE,
5658 {"http://winehq.org/testing",S_OK},
5659 {"winehq.org",S_OK},
5660 {"http://winehq.org/testing",S_OK},
5661 {"winehq.org",S_OK},
5664 {"winehq.org",S_OK},
5669 {"http://winehq.org/testing",S_OK},
5675 {Uri_HOST_DNS,S_OK},
5677 {URL_SCHEME_HTTP,S_OK},
5678 {URLZONE_INVALID,E_NOTIMPL}
5681 { "http://winehq.org/test#frag",0,
5682 "testing",Uri_CREATE_ALLOW_RELATIVE,
5685 {"http://winehq.org/testing",S_OK},
5686 {"winehq.org",S_OK},
5687 {"http://winehq.org/testing",S_OK},
5688 {"winehq.org",S_OK},
5691 {"winehq.org",S_OK},
5696 {"http://winehq.org/testing",S_OK},
5702 {Uri_HOST_DNS,S_OK},
5704 {URL_SCHEME_HTTP,S_OK},
5705 {URLZONE_INVALID,E_NOTIMPL}
5708 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5709 "test",Uri_CREATE_ALLOW_RELATIVE,
5729 {Uri_HOST_UNKNOWN,S_OK},
5731 {URL_SCHEME_UNKNOWN,S_OK},
5732 {URLZONE_INVALID,E_NOTIMPL}
5735 { "file:///c:/test/test",0,
5736 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5737 URL_FILE_USE_PATHURL,S_OK,FALSE,
5739 {"file://c:\\testing.mp3",S_OK},
5741 {"file://c:\\testing.mp3",S_OK},
5747 {"c:\\testing.mp3",S_OK},
5748 {"c:\\testing.mp3",S_OK},
5750 {"file://c:\\testing.mp3",S_OK},
5756 {Uri_HOST_UNKNOWN,S_OK},
5758 {URL_SCHEME_FILE,S_OK},
5759 {URLZONE_INVALID,E_NOTIMPL}
5762 { "file:///c:/test/test",0,
5763 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5766 {"file:///c:/testing.mp3",S_OK},
5768 {"file:///c:/testing.mp3",S_OK},
5774 {"/c:/testing.mp3",S_OK},
5775 {"/c:/testing.mp3",S_OK},
5777 {"file:///c:/testing.mp3",S_OK},
5783 {Uri_HOST_UNKNOWN,S_OK},
5785 {URL_SCHEME_FILE,S_OK},
5786 {URLZONE_INVALID,E_NOTIMPL}
5789 { "file://test.com/test/test",0,
5790 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5791 URL_FILE_USE_PATHURL,S_OK,FALSE,
5793 {"file://\\\\test.com\\testing.mp3",S_OK},
5795 {"file://\\\\test.com\\testing.mp3",S_OK},
5801 {"\\testing.mp3",S_OK},
5802 {"\\testing.mp3",S_OK},
5804 {"file://\\\\test.com\\testing.mp3",S_OK},
5810 {Uri_HOST_DNS,S_OK},
5812 {URL_SCHEME_FILE,S_OK},
5813 {URLZONE_INVALID,E_NOTIMPL}
5816 /* URL_DONT_SIMPLIFY has no effect. */
5817 { "http://google.com/test",0,
5818 "zip://test.com/cool/../cool/test",0,
5819 URL_DONT_SIMPLIFY,S_OK,FALSE,
5821 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5823 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5829 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5830 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5832 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
5833 * On IE 7 it reduces the path in the Raw URI.
5835 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
5841 {Uri_HOST_DNS,S_OK},
5843 {URL_SCHEME_UNKNOWN,S_OK},
5844 {URLZONE_INVALID,E_NOTIMPL}
5847 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
5848 * resulting URI is converted into a dos path.
5850 { "http://google.com/test",0,
5851 "file:///c:/test/",0,
5852 URL_FILE_USE_PATHURL,S_OK,FALSE,
5854 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5856 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5862 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5863 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5865 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5871 {Uri_HOST_UNKNOWN,S_OK},
5873 {URL_SCHEME_FILE,S_OK},
5874 {URLZONE_INVALID,E_NOTIMPL}
5877 { "http://google.com/test",0,
5878 "http://test.com/test#%30test",0,
5879 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
5881 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5883 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5886 {"#0test",S_OK,FALSE,NULL,"#%30test"},
5892 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
5893 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
5899 {Uri_HOST_DNS,S_OK},
5901 {URL_SCHEME_HTTP,S_OK},
5902 {URLZONE_INVALID,E_NOTIMPL}
5905 /* Windows validates the path component from the relative Uri. */
5906 { "http://google.com/test",0,
5907 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
5908 0,E_INVALIDARG,FALSE
5910 /* Windows doesn't validate the query from the relative Uri. */
5911 { "http://google.com/test",0,
5912 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
5915 {"http://google.com/test?Tes%XXt",S_OK},
5916 {"google.com",S_OK},
5917 {"http://google.com/test?Tes%XXt",S_OK},
5918 {"google.com",S_OK},
5921 {"google.com",S_OK},
5924 {"/test?Tes%XXt",S_OK},
5926 {"http://google.com/test?Tes%XXt",S_OK},
5932 {Uri_HOST_DNS,S_OK},
5934 {URL_SCHEME_HTTP,S_OK},
5935 {URLZONE_INVALID,E_NOTIMPL}
5938 /* Windows doesn't validate the fragment from the relative Uri. */
5939 { "http://google.com/test",0,
5940 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
5943 {"http://google.com/test#Tes%XXt",S_OK},
5944 {"google.com",S_OK},
5945 {"http://google.com/test#Tes%XXt",S_OK},
5946 {"google.com",S_OK},
5949 {"google.com",S_OK},
5954 {"http://google.com/test#Tes%XXt",S_OK},
5960 {Uri_HOST_DNS,S_OK},
5962 {URL_SCHEME_HTTP,S_OK},
5963 {URLZONE_INVALID,E_NOTIMPL}
5966 /* Creates an IUri which contains an invalid dos path char. */
5967 { "file:///c:/test",0,
5968 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
5969 URL_FILE_USE_PATHURL,S_OK,FALSE,
5971 {"file://c:\\test<ing",S_OK},
5973 {"file://c:\\test<ing",S_OK},
5979 {"c:\\test<ing",S_OK},
5980 {"c:\\test<ing",S_OK},
5982 {"file://c:\\test<ing",S_OK},
5988 {Uri_HOST_UNKNOWN,S_OK},
5990 {URL_SCHEME_FILE,S_OK},
5991 {URLZONE_INVALID,E_NOTIMPL}
5994 /* Appends the path after the drive letter (if any). */
5995 { "file:///c:/test",0,
5996 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
5999 {"file:///c:/c:/testing",S_OK},
6001 {"file:///c:/c:/testing",S_OK},
6007 {"/c:/c:/testing",S_OK},
6008 {"/c:/c:/testing",S_OK},
6010 {"file:///c:/c:/testing",S_OK},
6016 {Uri_HOST_UNKNOWN,S_OK},
6018 {URL_SCHEME_FILE,S_OK},
6019 {URLZONE_INVALID,E_NOTIMPL}
6022 /* A '/' is added if the base URI doesn't have a path and the
6023 * relative URI doesn't contain a path (since the base URI is
6026 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6027 "?test",Uri_CREATE_ALLOW_RELATIVE,
6030 {"http://google.com/?test",S_OK},
6031 {"google.com",S_OK},
6032 {"http://google.com/?test",S_OK},
6033 {"google.com",S_OK},
6036 {"google.com",S_OK},
6041 {"http://google.com/?test",S_OK},
6047 {Uri_HOST_DNS,S_OK},
6049 {URL_SCHEME_HTTP,S_OK},
6050 {URLZONE_INVALID,E_NOTIMPL}
6053 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6054 "?test",Uri_CREATE_ALLOW_RELATIVE,
6057 {"zip://google.com/?test",S_OK},
6058 {"google.com",S_OK},
6059 {"zip://google.com/?test",S_OK},
6060 {"google.com",S_OK},
6063 {"google.com",S_OK},
6068 {"zip://google.com/?test",S_OK},
6074 {Uri_HOST_DNS,S_OK},
6076 {URL_SCHEME_UNKNOWN,S_OK},
6077 {URLZONE_INVALID,E_NOTIMPL}
6080 /* No path is appended since the base URI is opaque. */
6082 "?test",Uri_CREATE_ALLOW_RELATIVE,
6102 {Uri_HOST_UNKNOWN,S_OK},
6104 {URL_SCHEME_UNKNOWN,S_OK},
6105 {URLZONE_INVALID,E_NOTIMPL}
6109 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6112 {"file:///c:/testing/test",S_OK},
6114 {"file:///c:/testing/test",S_OK},
6120 {"/c:/testing/test",S_OK},
6121 {"/c:/testing/test",S_OK},
6123 {"file:///c:/testing/test",S_OK},
6129 {Uri_HOST_UNKNOWN,S_OK},
6131 {URL_SCHEME_FILE,S_OK},
6132 {URLZONE_INVALID,E_NOTIMPL}
6135 { "http://winehq.org/dir/testfile",0,
6136 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6139 {"http://winehq.org/dir/test?querystring",S_OK},
6140 {"winehq.org",S_OK},
6141 {"http://winehq.org/dir/test?querystring",S_OK},
6142 {"winehq.org",S_OK},
6145 {"winehq.org",S_OK},
6148 {"/dir/test?querystring",S_OK},
6149 {"?querystring",S_OK},
6150 {"http://winehq.org/dir/test?querystring",S_OK},
6156 {Uri_HOST_DNS,S_OK},
6158 {URL_SCHEME_HTTP,S_OK},
6159 {URLZONE_INVALID,E_NOTIMPL}
6162 { "http://winehq.org/dir/test",0,
6163 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6166 {"http://winehq.org/dir/test?querystring",S_OK},
6167 {"winehq.org",S_OK},
6168 {"http://winehq.org/dir/test?querystring",S_OK},
6169 {"winehq.org",S_OK},
6172 {"winehq.org",S_OK},
6175 {"/dir/test?querystring",S_OK},
6176 {"?querystring",S_OK},
6177 {"http://winehq.org/dir/test?querystring",S_OK},
6183 {Uri_HOST_DNS,S_OK},
6185 {URL_SCHEME_HTTP,S_OK},
6186 {URLZONE_INVALID,E_NOTIMPL}
6189 { "http://winehq.org/dir/test?querystring",0,
6190 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6193 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6194 {"winehq.org",S_OK},
6195 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6196 {"winehq.org",S_OK},
6199 {"winehq.org",S_OK},
6202 {"/dir/test?querystring",S_OK},
6203 {"?querystring",S_OK},
6204 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6210 {Uri_HOST_DNS,S_OK},
6212 {URL_SCHEME_HTTP,S_OK},
6213 {URLZONE_INVALID,E_NOTIMPL}
6218 typedef struct _uri_parse_test {
6223 const char *property;
6228 static const uri_parse_test uri_parse_tests[] = {
6229 /* PARSE_CANONICALIZE tests. */
6230 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6231 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6232 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6233 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6234 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6235 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6236 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6237 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6238 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6239 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6240 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6241 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6243 /* PARSE_FRIENDLY tests. */
6244 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6245 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6247 /* PARSE_ROOTDOCUMENT tests. */
6248 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6249 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6250 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6251 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6252 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6253 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6255 /* PARSE_DOCUMENT tests. */
6256 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6257 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6258 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6259 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6260 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6261 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6263 /* PARSE_PATH_FROM_URL tests. */
6264 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6265 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6266 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6267 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6268 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6270 /* PARSE_URL_FROM_PATH tests. */
6271 /* This function almost seems to useless (just returns the absolute uri). */
6272 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6273 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6274 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6275 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6276 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6278 /* PARSE_SCHEMA tests. */
6279 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6280 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6282 /* PARSE_SITE tests. */
6283 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6284 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6285 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6286 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6288 /* PARSE_DOMAIN tests. */
6289 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6290 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6291 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6292 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6294 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6295 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6296 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6297 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6298 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6301 static inline LPWSTR a2w(LPCSTR str) {
6305 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6306 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6307 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6313 static inline BOOL heap_free(void* mem) {
6314 return HeapFree(GetProcessHeap(), 0, mem);
6317 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6318 LPWSTR strAW = a2w(strA);
6319 DWORD ret = lstrcmpW(strAW, strB);
6324 static inline ULONG get_refcnt(IUri *uri) {
6326 return IUri_Release(uri);
6329 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6334 valueW = a2w(prop->value);
6335 switch(prop->property) {
6336 case Uri_PROPERTY_FRAGMENT:
6337 hr = IUriBuilder_SetFragment(builder, valueW);
6340 ok(hr == prop->expected,
6341 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6342 hr, prop->expected, test_index);
6345 ok(hr == prop->expected,
6346 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6347 hr, prop->expected, test_index);
6350 case Uri_PROPERTY_HOST:
6351 hr = IUriBuilder_SetHost(builder, valueW);
6354 ok(hr == prop->expected,
6355 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6356 hr, prop->expected, test_index);
6359 ok(hr == prop->expected,
6360 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6361 hr, prop->expected, test_index);
6364 case Uri_PROPERTY_PASSWORD:
6365 hr = IUriBuilder_SetPassword(builder, valueW);
6368 ok(hr == prop->expected,
6369 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6370 hr, prop->expected, test_index);
6373 ok(hr == prop->expected,
6374 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6375 hr, prop->expected, test_index);
6378 case Uri_PROPERTY_PATH:
6379 hr = IUriBuilder_SetPath(builder, valueW);
6382 ok(hr == prop->expected,
6383 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6384 hr, prop->expected, test_index);
6387 ok(hr == prop->expected,
6388 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6389 hr, prop->expected, test_index);
6392 case Uri_PROPERTY_QUERY:
6393 hr = IUriBuilder_SetQuery(builder, valueW);
6396 ok(hr == prop->expected,
6397 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6398 hr, prop->expected, test_index);
6401 ok(hr == prop->expected,
6402 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6403 hr, prop->expected, test_index);
6406 case Uri_PROPERTY_SCHEME_NAME:
6407 hr = IUriBuilder_SetSchemeName(builder, valueW);
6410 ok(hr == prop->expected,
6411 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6412 hr, prop->expected, test_index);
6415 ok(hr == prop->expected,
6416 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6417 hr, prop->expected, test_index);
6420 case Uri_PROPERTY_USER_NAME:
6421 hr = IUriBuilder_SetUserName(builder, valueW);
6424 ok(hr == prop->expected,
6425 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6426 hr, prop->expected, test_index);
6429 ok(hr == prop->expected,
6430 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6431 hr, prop->expected, test_index);
6435 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6442 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6445 static void test_CreateUri_InvalidFlags(void) {
6448 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6450 IUri *uri = (void*) 0xdeadbeef;
6452 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6453 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6454 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6455 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6459 static void test_CreateUri_InvalidArgs(void) {
6461 IUri *uri = (void*) 0xdeadbeef;
6463 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6464 static const WCHAR emptyW[] = {0};
6466 hr = pCreateUri(http_urlW, 0, 0, NULL);
6467 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6469 hr = pCreateUri(NULL, 0, 0, &uri);
6470 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6471 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6473 uri = (void*) 0xdeadbeef;
6474 hr = pCreateUri(invalidW, 0, 0, &uri);
6475 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6476 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6478 uri = (void*) 0xdeadbeef;
6479 hr = pCreateUri(emptyW, 0, 0, &uri);
6480 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6481 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6484 static void test_CreateUri_InvalidUri(void) {
6487 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6488 invalid_uri test = invalid_uri_tests[i];
6493 uriW = a2w(test.uri);
6494 hr = pCreateUri(uriW, test.flags, 0, &uri);
6497 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6498 hr, E_INVALIDARG, i);
6501 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6502 hr, E_INVALIDARG, i);
6504 if(uri) IUri_Release(uri);
6510 static void test_IUri_GetPropertyBSTR(void) {
6515 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6516 hr = pCreateUri(http_urlW, 0, 0, &uri);
6517 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6519 BSTR received = NULL;
6521 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6522 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6524 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6525 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6526 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6527 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6528 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6529 SysFreeString(received);
6531 /* Make sure it handles the ZONE property correctly. */
6533 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6534 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6535 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6536 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6537 SysFreeString(received);
6539 if(uri) IUri_Release(uri);
6541 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6542 uri_properties test = uri_tests[i];
6546 uriW = a2w(test.uri);
6547 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6548 if(test.create_todo) {
6550 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6551 hr, test.create_expected, i);
6554 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6555 hr, test.create_expected, i);
6561 /* Checks all the string properties of the uri. */
6562 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6563 BSTR received = NULL;
6564 uri_str_property prop = test.str_props[j];
6566 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6569 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6570 hr, prop.expected, i, j);
6573 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6574 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6575 prop.value, wine_dbgstr_w(received), i, j);
6578 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6579 hr, prop.expected, i, j);
6580 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6581 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6582 prop.value, wine_dbgstr_w(received), i, j);
6585 SysFreeString(received);
6589 if(uri) IUri_Release(uri);
6595 static void test_IUri_GetPropertyDWORD(void) {
6600 hr = pCreateUri(http_urlW, 0, 0, &uri);
6601 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6603 DWORD received = 0xdeadbeef;
6605 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6606 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6608 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6609 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6610 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6612 if(uri) IUri_Release(uri);
6614 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6615 uri_properties test = uri_tests[i];
6619 uriW = a2w(test.uri);
6620 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6621 if(test.create_todo) {
6623 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6624 hr, test.create_expected, i);
6627 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6628 hr, test.create_expected, i);
6634 /* Checks all the DWORD properties of the uri. */
6635 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6637 uri_dword_property prop = test.dword_props[j];
6639 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6642 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6643 hr, prop.expected, i, j);
6646 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6647 prop.value, received, i, j);
6650 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6651 hr, prop.expected, i, j);
6652 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6653 prop.value, received, i, j);
6658 if(uri) IUri_Release(uri);
6664 /* Tests all the 'Get*' property functions which deal with strings. */
6665 static void test_IUri_GetStrProperties(void) {
6670 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6671 hr = pCreateUri(http_urlW, 0, 0, &uri);
6672 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6674 hr = IUri_GetAbsoluteUri(uri, NULL);
6675 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6677 hr = IUri_GetAuthority(uri, NULL);
6678 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6680 hr = IUri_GetDisplayUri(uri, NULL);
6681 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6683 hr = IUri_GetDomain(uri, NULL);
6684 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6686 hr = IUri_GetExtension(uri, NULL);
6687 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6689 hr = IUri_GetFragment(uri, NULL);
6690 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6692 hr = IUri_GetHost(uri, NULL);
6693 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6695 hr = IUri_GetPassword(uri, NULL);
6696 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6698 hr = IUri_GetPath(uri, NULL);
6699 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6701 hr = IUri_GetPathAndQuery(uri, NULL);
6702 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6704 hr = IUri_GetQuery(uri, NULL);
6705 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6707 hr = IUri_GetRawUri(uri, NULL);
6708 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6710 hr = IUri_GetSchemeName(uri, NULL);
6711 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6713 hr = IUri_GetUserInfo(uri, NULL);
6714 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6716 hr = IUri_GetUserName(uri, NULL);
6717 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6719 if(uri) IUri_Release(uri);
6721 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6722 uri_properties test = uri_tests[i];
6726 uriW = a2w(test.uri);
6727 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6728 if(test.create_todo) {
6730 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6731 hr, test.create_expected, i);
6734 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6735 hr, test.create_expected, i);
6739 uri_str_property prop;
6740 BSTR received = NULL;
6742 /* GetAbsoluteUri() tests. */
6743 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
6744 hr = IUri_GetAbsoluteUri(uri, &received);
6747 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6748 hr, prop.expected, i);
6751 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6752 "Error: Expected %s but got %s on uri_tests[%d].\n",
6753 prop.value, wine_dbgstr_w(received), i);
6756 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6757 hr, prop.expected, i);
6758 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6759 "Error: Expected %s but got %s on uri_tests[%d].\n",
6760 prop.value, wine_dbgstr_w(received), i);
6762 SysFreeString(received);
6765 /* GetAuthority() tests. */
6766 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
6767 hr = IUri_GetAuthority(uri, &received);
6770 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6771 hr, prop.expected, i);
6774 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6775 prop.value, wine_dbgstr_w(received), i);
6778 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6779 hr, prop.expected, i);
6780 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6781 prop.value, wine_dbgstr_w(received), i);
6783 SysFreeString(received);
6786 /* GetDisplayUri() tests. */
6787 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
6788 hr = IUri_GetDisplayUri(uri, &received);
6791 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6792 hr, prop.expected, i);
6795 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6796 "Error: Expected %s but got %s on uri_test[%d].\n",
6797 prop.value, wine_dbgstr_w(received), i);
6800 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6801 hr, prop.expected, i);
6802 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6803 "Error: Expected %s but got %s on uri_tests[%d].\n",
6804 prop.value, wine_dbgstr_w(received), i);
6806 SysFreeString(received);
6809 /* GetDomain() tests. */
6810 prop = test.str_props[Uri_PROPERTY_DOMAIN];
6811 hr = IUri_GetDomain(uri, &received);
6814 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6815 hr, prop.expected, i);
6818 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6819 prop.value, wine_dbgstr_w(received), i);
6822 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6823 hr, prop.expected, i);
6824 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6825 prop.value, wine_dbgstr_w(received), i);
6827 SysFreeString(received);
6830 /* GetExtension() tests. */
6831 prop = test.str_props[Uri_PROPERTY_EXTENSION];
6832 hr = IUri_GetExtension(uri, &received);
6835 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6836 hr, prop.expected, i);
6839 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6840 prop.value, wine_dbgstr_w(received), i);
6843 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6844 hr, prop.expected, i);
6845 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6846 prop.value, wine_dbgstr_w(received), i);
6848 SysFreeString(received);
6851 /* GetFragment() tests. */
6852 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
6853 hr = IUri_GetFragment(uri, &received);
6856 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6857 hr, prop.expected, i);
6860 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6861 prop.value, wine_dbgstr_w(received), i);
6864 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6865 hr, prop.expected, i);
6866 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6867 prop.value, wine_dbgstr_w(received), i);
6869 SysFreeString(received);
6872 /* GetHost() tests. */
6873 prop = test.str_props[Uri_PROPERTY_HOST];
6874 hr = IUri_GetHost(uri, &received);
6877 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6878 hr, prop.expected, i);
6881 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6882 prop.value, wine_dbgstr_w(received), i);
6885 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6886 hr, prop.expected, i);
6887 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6888 prop.value, wine_dbgstr_w(received), i);
6890 SysFreeString(received);
6893 /* GetPassword() tests. */
6894 prop = test.str_props[Uri_PROPERTY_PASSWORD];
6895 hr = IUri_GetPassword(uri, &received);
6898 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6899 hr, prop.expected, i);
6902 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6903 prop.value, wine_dbgstr_w(received), i);
6906 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6907 hr, prop.expected, i);
6908 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6909 prop.value, wine_dbgstr_w(received), i);
6911 SysFreeString(received);
6914 /* GetPath() tests. */
6915 prop = test.str_props[Uri_PROPERTY_PATH];
6916 hr = IUri_GetPath(uri, &received);
6919 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6920 hr, prop.expected, i);
6923 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6924 prop.value, wine_dbgstr_w(received), i);
6927 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6928 hr, prop.expected, i);
6929 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6930 prop.value, wine_dbgstr_w(received), i);
6932 SysFreeString(received);
6935 /* GetPathAndQuery() tests. */
6936 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
6937 hr = IUri_GetPathAndQuery(uri, &received);
6940 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6941 hr, prop.expected, i);
6944 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6945 prop.value, wine_dbgstr_w(received), i);
6948 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6949 hr, prop.expected, i);
6950 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6951 prop.value, wine_dbgstr_w(received), i);
6953 SysFreeString(received);
6956 /* GetQuery() tests. */
6957 prop = test.str_props[Uri_PROPERTY_QUERY];
6958 hr = IUri_GetQuery(uri, &received);
6961 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6962 hr, prop.expected, i);
6965 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6966 prop.value, wine_dbgstr_w(received), i);
6969 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6970 hr, prop.expected, i);
6971 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6972 prop.value, wine_dbgstr_w(received), i);
6974 SysFreeString(received);
6977 /* GetRawUri() tests. */
6978 prop = test.str_props[Uri_PROPERTY_RAW_URI];
6979 hr = IUri_GetRawUri(uri, &received);
6982 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6983 hr, prop.expected, i);
6986 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6987 prop.value, wine_dbgstr_w(received), i);
6990 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6991 hr, prop.expected, i);
6992 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6993 prop.value, wine_dbgstr_w(received), i);
6995 SysFreeString(received);
6998 /* GetSchemeName() tests. */
6999 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7000 hr = IUri_GetSchemeName(uri, &received);
7003 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7004 hr, prop.expected, i);
7007 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7008 prop.value, wine_dbgstr_w(received), i);
7011 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7012 hr, prop.expected, i);
7013 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7014 prop.value, wine_dbgstr_w(received), i);
7016 SysFreeString(received);
7019 /* GetUserInfo() tests. */
7020 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7021 hr = IUri_GetUserInfo(uri, &received);
7024 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7025 hr, prop.expected, i);
7028 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7029 prop.value, wine_dbgstr_w(received), i);
7032 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7033 hr, prop.expected, i);
7034 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7035 prop.value, wine_dbgstr_w(received), i);
7037 SysFreeString(received);
7040 /* GetUserName() tests. */
7041 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7042 hr = IUri_GetUserName(uri, &received);
7045 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7046 hr, prop.expected, i);
7049 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7050 prop.value, wine_dbgstr_w(received), i);
7053 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7054 hr, prop.expected, i);
7055 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7056 prop.value, wine_dbgstr_w(received), i);
7058 SysFreeString(received);
7061 if(uri) IUri_Release(uri);
7067 static void test_IUri_GetDwordProperties(void) {
7072 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7073 hr = pCreateUri(http_urlW, 0, 0, &uri);
7074 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7076 hr = IUri_GetHostType(uri, NULL);
7077 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7079 hr = IUri_GetPort(uri, NULL);
7080 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7082 hr = IUri_GetScheme(uri, NULL);
7083 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7085 hr = IUri_GetZone(uri, NULL);
7086 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7088 if(uri) IUri_Release(uri);
7090 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7091 uri_properties test = uri_tests[i];
7095 uriW = a2w(test.uri);
7096 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7097 if(test.create_todo) {
7099 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7100 hr, test.create_expected, i);
7103 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7104 hr, test.create_expected, i);
7108 uri_dword_property prop;
7111 /* Assign an insane value so tests don't accidentally pass when
7114 received = -9999999;
7116 /* GetHostType() tests. */
7117 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7118 hr = IUri_GetHostType(uri, &received);
7121 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7122 hr, prop.expected, i);
7125 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7128 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7129 hr, prop.expected, i);
7130 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7132 received = -9999999;
7134 /* GetPort() tests. */
7135 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7136 hr = IUri_GetPort(uri, &received);
7139 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7140 hr, prop.expected, i);
7143 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7146 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7147 hr, prop.expected, i);
7148 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7150 received = -9999999;
7152 /* GetScheme() tests. */
7153 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7154 hr = IUri_GetScheme(uri, &received);
7157 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7158 hr, prop.expected, i);
7161 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7164 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7165 hr, prop.expected, i);
7166 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7168 received = -9999999;
7170 /* GetZone() tests. */
7171 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7172 hr = IUri_GetZone(uri, &received);
7175 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7176 hr, prop.expected, i);
7179 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7182 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7183 hr, prop.expected, i);
7184 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7188 if(uri) IUri_Release(uri);
7194 static void test_IUri_GetPropertyLength(void) {
7199 /* Make sure it handles invalid args correctly. */
7200 hr = pCreateUri(http_urlW, 0, 0, &uri);
7201 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7203 DWORD received = 0xdeadbeef;
7205 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7206 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7208 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7209 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7210 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7212 if(uri) IUri_Release(uri);
7214 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7215 uri_properties test = uri_tests[i];
7219 uriW = a2w(test.uri);
7220 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7221 if(test.create_todo) {
7223 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7224 hr, test.create_expected, i);
7227 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7228 hr, test.create_expected, i);
7234 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7235 DWORD expectedLen, brokenLen, receivedLen;
7236 uri_str_property prop = test.str_props[j];
7238 expectedLen = lstrlen(prop.value);
7239 brokenLen = lstrlen(prop.broken_value);
7241 /* This won't be necessary once GetPropertyLength is implemented. */
7244 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7247 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7248 hr, prop.expected, i, j);
7251 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7252 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7253 expectedLen, receivedLen, i, j);
7256 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7257 hr, prop.expected, i, j);
7258 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7259 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7260 expectedLen, receivedLen, i, j);
7265 if(uri) IUri_Release(uri);
7271 static DWORD compute_expected_props(uri_properties *test)
7275 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7276 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7280 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7281 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7288 static void test_IUri_GetProperties(void) {
7293 hr = pCreateUri(http_urlW, 0, 0, &uri);
7294 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7296 hr = IUri_GetProperties(uri, NULL);
7297 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7299 if(uri) IUri_Release(uri);
7301 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7302 uri_properties test = uri_tests[i];
7306 uriW = a2w(test.uri);
7307 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7308 if(test.create_todo) {
7310 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7313 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7317 DWORD received = 0, expected_props;
7320 hr = IUri_GetProperties(uri, &received);
7321 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7323 expected_props = compute_expected_props(&test);
7325 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7326 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7327 if(expected_props & (1 << j))
7328 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7330 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7334 if(uri) IUri_Release(uri);
7340 static void test_IUri_HasProperty(void) {
7345 hr = pCreateUri(http_urlW, 0, 0, &uri);
7346 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7348 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7349 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7351 if(uri) IUri_Release(uri);
7353 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7354 uri_properties test = uri_tests[i];
7358 uriW = a2w(test.uri);
7360 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7361 if(test.create_todo) {
7363 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7366 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7370 DWORD expected_props, j;
7372 expected_props = compute_expected_props(&test);
7374 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7375 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7378 hr = IUri_HasProperty(uri, j, &received);
7379 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7382 if(expected_props & (1 << j)) {
7383 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7385 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7390 if(uri) IUri_Release(uri);
7396 static void test_IUri_IsEqual(void) {
7403 /* Make sure IsEqual handles invalid args correctly. */
7404 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
7405 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
7406 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7407 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
7408 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7410 hrA = IUri_IsEqual(uriA, NULL, &equal);
7411 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7412 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7414 hrA = IUri_IsEqual(uriA, uriB, NULL);
7415 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
7417 if(uriA) IUri_Release(uriA);
7418 if(uriB) IUri_Release(uriB);
7420 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7421 uri_equality test = equality_tests[i];
7422 LPWSTR uriA_W, uriB_W;
7426 uriA_W = a2w(test.a);
7427 uriB_W = a2w(test.b);
7429 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7430 if(test.create_todo_a) {
7432 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7436 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7440 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7441 if(test.create_todo_b) {
7443 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7447 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7451 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7454 hrA = IUri_IsEqual(uriA, uriB, &equal);
7457 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
7461 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7464 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
7465 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7468 if(uriA) IUri_Release(uriA);
7469 if(uriB) IUri_Release(uriB);
7476 static void test_CreateUriWithFragment_InvalidArgs(void) {
7478 IUri *uri = (void*) 0xdeadbeef;
7479 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7481 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7482 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7483 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7485 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7486 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7488 /* Original URI can't already contain a fragment component. */
7489 uri = (void*) 0xdeadbeef;
7490 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7491 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7492 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7495 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7496 static void test_CreateUriWithFragment_InvalidFlags(void) {
7499 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7501 IUri *uri = (void*) 0xdeadbeef;
7503 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7504 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7505 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7506 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7510 static void test_CreateUriWithFragment(void) {
7513 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7517 uri_with_fragment test = uri_fragment_tests[i];
7519 uriW = a2w(test.uri);
7520 fragW = a2w(test.fragment);
7522 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7523 if(test.expected_todo) {
7525 ok(hr == test.create_expected,
7526 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7527 hr, test.create_expected, i);
7530 ok(hr == test.create_expected,
7531 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7532 hr, test.create_expected, i);
7535 BSTR received = NULL;
7537 hr = IUri_GetAbsoluteUri(uri, &received);
7538 if(test.expected_todo) {
7541 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7545 ok(!strcmp_aw(test.expected_uri, received),
7546 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7547 test.expected_uri, wine_dbgstr_w(received), i);
7550 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7552 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7553 test.expected_uri, wine_dbgstr_w(received), i);
7556 SysFreeString(received);
7559 if(uri) IUri_Release(uri);
7565 static void test_CreateIUriBuilder(void) {
7567 IUriBuilder *builder = NULL;
7570 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7571 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7574 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
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 ULONG cur_count, orig_count;
7580 orig_count = get_refcnt(uri);
7581 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7582 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7583 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7585 cur_count = get_refcnt(uri);
7586 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7588 if(builder) IUriBuilder_Release(builder);
7589 cur_count = get_refcnt(uri);
7590 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7592 if(uri) IUri_Release(uri);
7595 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7600 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7601 if(test->uri_todo) {
7603 ok(hr == test->uri_hres,
7604 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7605 hr, test->uri_hres, test_index);
7608 ok(hr == test->uri_hres,
7609 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7610 hr, test->uri_hres, test_index);
7616 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7617 uri_builder_str_property prop = test->expected_str_props[i];
7618 BSTR received = NULL;
7620 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7623 ok(hr == prop.result,
7624 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7625 hr, prop.result, test_index, i);
7628 ok(hr == prop.result,
7629 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7630 hr, prop.result, test_index, i);
7635 ok(!strcmp_aw(prop.expected, received),
7636 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7637 prop.expected, wine_dbgstr_w(received), test_index, i);
7640 ok(!strcmp_aw(prop.expected, received),
7641 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7642 prop.expected, wine_dbgstr_w(received), test_index, i);
7645 SysFreeString(received);
7648 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7649 uri_builder_dword_property prop = test->expected_dword_props[i];
7650 DWORD received = -2;
7652 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7655 ok(hr == prop.result,
7656 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7657 hr, prop.result, test_index, i);
7660 ok(hr == prop.result,
7661 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7662 hr, prop.result, test_index, i);
7667 ok(received == prop.expected,
7668 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7669 prop.expected, received, test_index, i);
7672 ok(received == prop.expected,
7673 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7674 prop.expected, received, test_index, i);
7679 if(uri) IUri_Release(uri);
7682 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7687 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7688 if(test->uri_simple_todo) {
7690 ok(hr == test->uri_simple_hres,
7691 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7692 hr, test->uri_simple_hres, test_index);
7695 ok(hr == test->uri_simple_hres,
7696 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7697 hr, test->uri_simple_hres, test_index);
7703 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7704 uri_builder_str_property prop = test->expected_str_props[i];
7705 BSTR received = NULL;
7707 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7710 ok(hr == prop.result,
7711 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7712 hr, prop.result, test_index, i);
7715 ok(hr == prop.result,
7716 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7717 hr, prop.result, test_index, i);
7722 ok(!strcmp_aw(prop.expected, received),
7723 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7724 prop.expected, wine_dbgstr_w(received), test_index, i);
7727 ok(!strcmp_aw(prop.expected, received),
7728 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7729 prop.expected, wine_dbgstr_w(received), test_index, i);
7732 SysFreeString(received);
7735 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7736 uri_builder_dword_property prop = test->expected_dword_props[i];
7737 DWORD received = -2;
7739 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7742 ok(hr == prop.result,
7743 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7744 hr, prop.result, test_index, i);
7747 ok(hr == prop.result,
7748 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7749 hr, prop.result, test_index, i);
7754 ok(received == prop.expected,
7755 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7756 prop.expected, received, test_index, i);
7759 ok(received == prop.expected,
7760 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7761 prop.expected, received, test_index, i);
7766 if(uri) IUri_Release(uri);
7769 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
7774 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
7775 test->uri_with_encode_flags, 0, &uri);
7776 if(test->uri_with_todo) {
7778 ok(hr == test->uri_with_hres,
7779 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7780 hr, test->uri_with_hres, test_index);
7783 ok(hr == test->uri_with_hres,
7784 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7785 hr, test->uri_with_hres, test_index);
7791 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7792 uri_builder_str_property prop = test->expected_str_props[i];
7793 BSTR received = NULL;
7795 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7798 ok(hr == prop.result,
7799 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7800 hr, prop.result, test_index, i);
7803 ok(hr == prop.result,
7804 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7805 hr, prop.result, test_index, i);
7810 ok(!strcmp_aw(prop.expected, received),
7811 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7812 prop.expected, wine_dbgstr_w(received), test_index, i);
7815 ok(!strcmp_aw(prop.expected, received),
7816 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7817 prop.expected, wine_dbgstr_w(received), test_index, i);
7820 SysFreeString(received);
7823 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7824 uri_builder_dword_property prop = test->expected_dword_props[i];
7825 DWORD received = -2;
7827 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7830 ok(hr == prop.result,
7831 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7832 hr, prop.result, test_index, i);
7835 ok(hr == prop.result,
7836 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7837 hr, prop.result, test_index, i);
7842 ok(received == prop.expected,
7843 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7844 prop.expected, received, test_index, i);
7847 ok(received == prop.expected,
7848 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7849 prop.expected, received, test_index, i);
7854 if(uri) IUri_Release(uri);
7857 static void test_IUriBuilder_CreateInvalidArgs(void) {
7858 IUriBuilder *builder;
7861 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7862 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7864 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
7866 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
7867 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
7868 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7870 uri = (void*) 0xdeadbeef;
7871 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7872 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
7873 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
7875 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
7876 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7879 uri = (void*) 0xdeadbeef;
7880 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7881 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7883 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
7885 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
7886 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7889 uri = (void*) 0xdeadbeef;
7890 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7891 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7893 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7895 hr = pCreateUri(http_urlW, 0, 0, &test);
7896 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7898 hr = IUriBuilder_SetIUri(builder, test);
7899 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7901 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
7903 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7904 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7905 ok(uri != NULL, "Error: The uri was NULL.\n");
7906 if(uri) IUri_Release(uri);
7909 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7910 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7912 ok(uri != NULL, "Error: uri was NULL.\n");
7913 if(uri) IUri_Release(uri);
7916 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
7917 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7919 ok(uri != NULL, "Error: uri was NULL.\n");
7920 if(uri) IUri_Release(uri);
7922 hr = IUriBuilder_SetFragment(builder, NULL);
7923 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7925 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
7926 uri = (void*) 0xdeadbeef;
7927 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7928 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7929 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
7931 uri = (void*) 0xdeadbeef;
7932 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7933 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7935 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7937 uri = (void*) 0xdeadbeef;
7938 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7939 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7941 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7943 if(test) IUri_Release(test);
7945 if(builder) IUriBuilder_Release(builder);
7948 /* Tests invalid args to the "Get*" functions. */
7949 static void test_IUriBuilder_GetInvalidArgs(void) {
7950 IUriBuilder *builder = NULL;
7953 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7954 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7956 LPCWSTR received = (void*) 0xdeadbeef;
7957 DWORD len = -1, port = -1;
7960 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
7961 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7963 hr = IUriBuilder_GetFragment(builder, NULL, &received);
7964 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7966 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7967 hr = IUriBuilder_GetFragment(builder, &len, NULL);
7968 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7970 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7972 hr = IUriBuilder_GetHost(builder, NULL, NULL);
7973 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7975 received = (void*) 0xdeadbeef;
7976 hr = IUriBuilder_GetHost(builder, NULL, &received);
7977 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7979 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7981 hr = IUriBuilder_GetHost(builder, &len, NULL);
7982 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7984 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7986 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
7987 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7989 received = (void*) 0xdeadbeef;
7990 hr = IUriBuilder_GetPassword(builder, NULL, &received);
7991 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7993 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7995 hr = IUriBuilder_GetPassword(builder, &len, NULL);
7996 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7998 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8000 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8001 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8003 received = (void*) 0xdeadbeef;
8004 hr = IUriBuilder_GetPath(builder, NULL, &received);
8005 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8007 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8009 hr = IUriBuilder_GetPath(builder, &len, NULL);
8010 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8012 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8014 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8015 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8017 hr = IUriBuilder_GetPort(builder, NULL, &port);
8018 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8020 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8021 hr = IUriBuilder_GetPort(builder, &set, NULL);
8022 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8024 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8026 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8027 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8029 received = (void*) 0xdeadbeef;
8030 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8031 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8033 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8035 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8036 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8038 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8040 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8041 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8043 received = (void*) 0xdeadbeef;
8044 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8045 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8047 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8049 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8050 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8052 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8054 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8055 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8057 received = (void*) 0xdeadbeef;
8058 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8059 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8061 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8063 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8064 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8066 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8068 if(builder) IUriBuilder_Release(builder);
8071 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8075 LPCWSTR received = NULL;
8077 const uri_builder_property *prop = NULL;
8079 /* Check if the property was set earlier. */
8080 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8081 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8082 prop = &(test->properties[i]);
8086 /* Use expected_value unless it's NULL, then use value. */
8087 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8088 hr = IUriBuilder_GetFragment(builder, &len, &received);
8091 ok(hr == (expected ? S_OK : S_FALSE),
8092 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8093 hr, (expected ? S_OK : S_FALSE), test_index);
8097 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8098 expected, wine_dbgstr_w(received), test_index);
8101 ok(lstrlen(expected) == len,
8102 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8103 lstrlen(expected), len, test_index);
8107 ok(hr == (expected ? S_OK : S_FALSE),
8108 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8109 hr, (expected ? S_OK : S_FALSE), test_index);
8110 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8111 expected, wine_dbgstr_w(received), test_index);
8112 ok(lstrlen(expected) == len,
8113 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8114 lstrlen(expected), len, test_index);
8117 /* The property wasn't set earlier, so it should return whatever
8118 * the base IUri contains (if anything).
8121 hr = IUriBuilder_GetIUri(builder, &uri);
8123 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8124 hr, S_OK, test_index);
8127 received = (void*) 0xdeadbeef;
8130 hr = IUriBuilder_GetFragment(builder, &len, &received);
8132 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8133 hr, S_FALSE, test_index);
8135 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8137 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8138 received, test_index);
8141 BOOL has_prop = FALSE;
8142 BSTR expected = NULL;
8144 hr = IUri_GetFragment(uri, &expected);
8146 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8148 has_prop = hr == S_OK;
8150 hr = IUriBuilder_GetFragment(builder, &len, &received);
8153 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8154 hr, S_OK, test_index);
8156 ok(!lstrcmpW(expected, received),
8157 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8158 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8159 ok(lstrlenW(expected) == len,
8160 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8161 lstrlenW(expected), len, test_index);
8165 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8166 hr, S_FALSE, test_index);
8168 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8169 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8173 SysFreeString(expected);
8176 if(uri) IUri_Release(uri);
8180 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8184 LPCWSTR received = NULL;
8186 const uri_builder_property *prop = NULL;
8188 /* Check if the property was set earlier. */
8189 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8190 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8191 prop = &(test->properties[i]);
8195 /* Use expected_value unless it's NULL, then use value. */
8196 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8197 hr = IUriBuilder_GetHost(builder, &len, &received);
8200 ok(hr == (expected ? S_OK : S_FALSE),
8201 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8202 hr, (expected ? S_OK : S_FALSE), test_index);
8206 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8207 expected, wine_dbgstr_w(received), test_index);
8210 ok(lstrlen(expected) == len,
8211 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8212 lstrlen(expected), len, test_index);
8216 ok(hr == (expected ? S_OK : S_FALSE),
8217 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8218 hr, (expected ? S_OK : S_FALSE), test_index);
8219 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8220 expected, wine_dbgstr_w(received), test_index);
8221 ok(lstrlen(expected) == len,
8222 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8223 lstrlen(expected), len, test_index);
8226 /* The property wasn't set earlier, so it should return whatever
8227 * the base IUri contains (if anything).
8230 hr = IUriBuilder_GetIUri(builder, &uri);
8232 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8233 hr, S_OK, test_index);
8236 received = (void*) 0xdeadbeef;
8239 hr = IUriBuilder_GetHost(builder, &len, &received);
8241 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8242 hr, S_FALSE, test_index);
8244 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8246 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8247 received, test_index);
8250 BOOL has_prop = FALSE;
8251 BSTR expected = NULL;
8253 hr = IUri_GetHost(uri, &expected);
8255 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8257 has_prop = hr == S_OK;
8259 hr = IUriBuilder_GetHost(builder, &len, &received);
8262 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8263 hr, S_OK, test_index);
8265 ok(!lstrcmpW(expected, received),
8266 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8267 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8268 ok(lstrlenW(expected) == len,
8269 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8270 lstrlenW(expected), len, test_index);
8274 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8275 hr, S_FALSE, test_index);
8277 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8278 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8282 SysFreeString(expected);
8285 if(uri) IUri_Release(uri);
8289 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8293 LPCWSTR received = NULL;
8295 const uri_builder_property *prop = NULL;
8297 /* Check if the property was set earlier. */
8298 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8299 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8300 prop = &(test->properties[i]);
8304 /* Use expected_value unless it's NULL, then use value. */
8305 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8306 hr = IUriBuilder_GetPassword(builder, &len, &received);
8309 ok(hr == (expected ? S_OK : S_FALSE),
8310 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8311 hr, (expected ? S_OK : S_FALSE), test_index);
8315 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8316 expected, wine_dbgstr_w(received), test_index);
8319 ok(lstrlen(expected) == len,
8320 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8321 lstrlen(expected), len, test_index);
8325 ok(hr == (expected ? S_OK : S_FALSE),
8326 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8327 hr, (expected ? S_OK : S_FALSE), test_index);
8328 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8329 expected, wine_dbgstr_w(received), test_index);
8330 ok(lstrlen(expected) == len,
8331 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8332 lstrlen(expected), len, test_index);
8335 /* The property wasn't set earlier, so it should return whatever
8336 * the base IUri contains (if anything).
8339 hr = IUriBuilder_GetIUri(builder, &uri);
8341 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8342 hr, S_OK, test_index);
8345 received = (void*) 0xdeadbeef;
8348 hr = IUriBuilder_GetPassword(builder, &len, &received);
8350 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8351 hr, S_FALSE, test_index);
8353 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8355 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8356 received, test_index);
8359 BOOL has_prop = FALSE;
8360 BSTR expected = NULL;
8362 hr = IUri_GetPassword(uri, &expected);
8364 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8366 has_prop = hr == S_OK;
8368 hr = IUriBuilder_GetPassword(builder, &len, &received);
8371 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8372 hr, S_OK, test_index);
8374 ok(!lstrcmpW(expected, received),
8375 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8376 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8377 ok(lstrlenW(expected) == len,
8378 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8379 lstrlenW(expected), len, test_index);
8383 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8384 hr, S_FALSE, test_index);
8386 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8387 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8391 SysFreeString(expected);
8394 if(uri) IUri_Release(uri);
8398 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8402 LPCWSTR received = NULL;
8404 const uri_builder_property *prop = NULL;
8406 /* Check if the property was set earlier. */
8407 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8408 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8409 prop = &(test->properties[i]);
8413 /* Use expected_value unless it's NULL, then use value. */
8414 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8415 hr = IUriBuilder_GetPath(builder, &len, &received);
8418 ok(hr == (expected ? S_OK : S_FALSE),
8419 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8420 hr, (expected ? S_OK : S_FALSE), test_index);
8424 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8425 expected, wine_dbgstr_w(received), test_index);
8428 ok(lstrlen(expected) == len,
8429 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8430 lstrlen(expected), len, test_index);
8434 ok(hr == (expected ? S_OK : S_FALSE),
8435 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8436 hr, (expected ? S_OK : S_FALSE), test_index);
8437 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8438 expected, wine_dbgstr_w(received), test_index);
8439 ok(lstrlen(expected) == len,
8440 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8441 lstrlen(expected), len, test_index);
8444 /* The property wasn't set earlier, so it should return whatever
8445 * the base IUri contains (if anything).
8448 hr = IUriBuilder_GetIUri(builder, &uri);
8450 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8451 hr, S_OK, test_index);
8454 received = (void*) 0xdeadbeef;
8457 hr = IUriBuilder_GetPath(builder, &len, &received);
8459 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8460 hr, S_FALSE, test_index);
8462 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8464 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8465 received, test_index);
8468 BOOL has_prop = FALSE;
8469 BSTR expected = NULL;
8471 hr = IUri_GetPath(uri, &expected);
8473 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8475 has_prop = hr == S_OK;
8477 hr = IUriBuilder_GetPath(builder, &len, &received);
8480 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8481 hr, S_OK, test_index);
8483 ok(!lstrcmpW(expected, received),
8484 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8485 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8486 ok(lstrlenW(expected) == len,
8487 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8488 lstrlenW(expected), len, test_index);
8492 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8493 hr, S_FALSE, test_index);
8495 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8496 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8500 SysFreeString(expected);
8503 if(uri) IUri_Release(uri);
8507 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8510 BOOL has_port = FALSE;
8511 DWORD received = -1;
8513 if(test->port_prop.change) {
8514 DWORD expected = test->port_prop.value;
8516 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8517 if(test->port_prop.todo) {
8520 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8521 hr, S_OK, test_index);
8525 ok(has_port == test->port_prop.set,
8526 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8527 test->port_prop.set, has_port, test_index);
8530 ok(received == expected,
8531 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8532 expected, received, test_index);
8537 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8538 hr, S_OK, test_index);
8539 ok(has_port == test->port_prop.set,
8540 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8541 test->port_prop.set, has_port, test_index);
8542 ok(received == test->port_prop.value,
8543 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8544 test->port_prop.value, received, test_index);
8549 hr = IUriBuilder_GetIUri(builder, &uri);
8551 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8552 hr, S_OK, test_index);
8555 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8557 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8558 hr, S_OK, test_index);
8560 ok(has_port == FALSE,
8561 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8562 has_port, test_index);
8563 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8564 received, test_index);
8569 hr = IUri_GetPort(uri, &expected);
8571 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8574 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8576 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8577 hr, S_OK, test_index);
8580 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8582 ok(received == expected,
8583 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8584 expected, received, test_index);
8588 if(uri) IUri_Release(uri);
8592 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8596 LPCWSTR received = NULL;
8598 const uri_builder_property *prop = NULL;
8600 /* Check if the property was set earlier. */
8601 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8602 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8603 prop = &(test->properties[i]);
8607 /* Use expected_value unless it's NULL, then use value. */
8608 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8609 hr = IUriBuilder_GetQuery(builder, &len, &received);
8612 ok(hr == (expected ? S_OK : S_FALSE),
8613 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8614 hr, (expected ? S_OK : S_FALSE), test_index);
8618 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8619 expected, wine_dbgstr_w(received), test_index);
8622 ok(lstrlen(expected) == len,
8623 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8624 lstrlen(expected), len, test_index);
8628 ok(hr == (expected ? S_OK : S_FALSE),
8629 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8630 hr, (expected ? S_OK : S_FALSE), test_index);
8631 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8632 expected, wine_dbgstr_w(received), test_index);
8633 ok(lstrlen(expected) == len,
8634 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8635 lstrlen(expected), len, test_index);
8638 /* The property wasn't set earlier, so it should return whatever
8639 * the base IUri contains (if anything).
8642 hr = IUriBuilder_GetIUri(builder, &uri);
8644 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8645 hr, S_OK, test_index);
8648 received = (void*) 0xdeadbeef;
8651 hr = IUriBuilder_GetQuery(builder, &len, &received);
8653 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8654 hr, S_FALSE, test_index);
8656 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8658 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8659 received, test_index);
8662 BOOL has_prop = FALSE;
8663 BSTR expected = NULL;
8665 hr = IUri_GetQuery(uri, &expected);
8667 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8669 has_prop = hr == S_OK;
8671 hr = IUriBuilder_GetQuery(builder, &len, &received);
8674 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8675 hr, S_OK, test_index);
8677 ok(!lstrcmpW(expected, received),
8678 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8679 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8680 ok(lstrlenW(expected) == len,
8681 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8682 lstrlenW(expected), len, test_index);
8686 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8687 hr, S_FALSE, test_index);
8689 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8690 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8694 SysFreeString(expected);
8697 if(uri) IUri_Release(uri);
8701 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8705 LPCWSTR received = NULL;
8707 const uri_builder_property *prop = NULL;
8709 /* Check if the property was set earlier. */
8710 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8711 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8712 prop = &(test->properties[i]);
8716 /* Use expected_value unless it's NULL, then use value. */
8717 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8718 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8721 ok(hr == (expected ? S_OK : S_FALSE),
8722 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8723 hr, (expected ? S_OK : S_FALSE), test_index);
8727 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8728 expected, wine_dbgstr_w(received), test_index);
8731 ok(lstrlen(expected) == len,
8732 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8733 lstrlen(expected), len, test_index);
8737 ok(hr == (expected ? S_OK : S_FALSE),
8738 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8739 hr, (expected ? S_OK : S_FALSE), test_index);
8740 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8741 expected, wine_dbgstr_w(received), test_index);
8742 ok(lstrlen(expected) == len,
8743 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8744 lstrlen(expected), len, test_index);
8747 /* The property wasn't set earlier, so it should return whatever
8748 * the base IUri contains (if anything).
8751 hr = IUriBuilder_GetIUri(builder, &uri);
8753 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8754 hr, S_OK, test_index);
8757 received = (void*) 0xdeadbeef;
8760 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8762 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8763 hr, S_FALSE, test_index);
8765 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8767 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8768 received, test_index);
8771 BOOL has_prop = FALSE;
8772 BSTR expected = NULL;
8774 hr = IUri_GetSchemeName(uri, &expected);
8776 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8778 has_prop = hr == S_OK;
8780 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8783 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8784 hr, S_OK, test_index);
8786 ok(!lstrcmpW(expected, received),
8787 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8788 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8789 ok(lstrlenW(expected) == len,
8790 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8791 lstrlenW(expected), len, test_index);
8795 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8796 hr, S_FALSE, test_index);
8798 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8799 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8803 SysFreeString(expected);
8806 if(uri) IUri_Release(uri);
8810 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
8814 LPCWSTR received = NULL;
8816 const uri_builder_property *prop = NULL;
8818 /* Check if the property was set earlier. */
8819 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8820 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
8821 prop = &(test->properties[i]);
8824 if(prop && prop->value && *prop->value) {
8825 /* Use expected_value unless it's NULL, then use value. */
8826 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8827 hr = IUriBuilder_GetUserName(builder, &len, &received);
8830 ok(hr == (expected ? S_OK : S_FALSE),
8831 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8832 hr, (expected ? S_OK : S_FALSE), test_index);
8836 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8837 expected, wine_dbgstr_w(received), test_index);
8840 ok(lstrlen(expected) == len,
8841 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8842 lstrlen(expected), len, test_index);
8846 ok(hr == (expected ? S_OK : S_FALSE),
8847 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8848 hr, (expected ? S_OK : S_FALSE), test_index);
8849 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8850 expected, wine_dbgstr_w(received), test_index);
8851 ok(lstrlen(expected) == len,
8852 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8853 lstrlen(expected), len, test_index);
8856 /* The property wasn't set earlier, so it should return whatever
8857 * the base IUri contains (if anything).
8860 hr = IUriBuilder_GetIUri(builder, &uri);
8862 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8863 hr, S_OK, test_index);
8866 received = (void*) 0xdeadbeef;
8869 hr = IUriBuilder_GetUserName(builder, &len, &received);
8871 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8872 hr, S_FALSE, test_index);
8874 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8876 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8877 received, test_index);
8880 BSTR expected = NULL;
8881 BOOL has_prop = FALSE;
8883 hr = IUri_GetUserName(uri, &expected);
8885 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8887 has_prop = hr == S_OK;
8889 hr = IUriBuilder_GetUserName(builder, &len, &received);
8892 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8893 hr, S_OK, test_index);
8895 ok(!lstrcmpW(expected, received),
8896 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8897 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8898 ok(lstrlenW(expected) == len,
8899 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8900 lstrlenW(expected), len, test_index);
8904 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8905 hr, S_FALSE, test_index);
8907 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8908 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8912 SysFreeString(expected);
8915 if(uri) IUri_Release(uri);
8919 /* Tests IUriBuilder functions. */
8920 static void test_IUriBuilder(void) {
8922 IUriBuilder *builder;
8925 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
8927 uri_builder_test test = uri_builder_tests[i];
8931 uriW = a2w(test.uri);
8932 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8933 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8935 if(FAILED(hr)) continue;
8937 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8938 if(test.create_builder_todo) {
8940 ok(hr == test.create_builder_expected,
8941 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8942 hr, test.create_builder_expected, i);
8945 ok(hr == test.create_builder_expected,
8946 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8947 hr, test.create_builder_expected, i);
8951 BOOL modified = FALSE, received = FALSE;
8953 /* Perform all the string property changes. */
8954 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
8955 uri_builder_property prop = test.properties[j];
8957 change_property(builder, &prop, i);
8958 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
8959 prop.property != Uri_PROPERTY_HOST)
8961 else if(prop.value && *prop.value)
8963 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
8964 /* Host name property can't be NULL, but it can be empty. */
8969 if(test.port_prop.change) {
8970 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
8972 if(test.port_prop.todo) {
8974 ok(hr == test.port_prop.expected,
8975 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8976 hr, test.port_prop.expected, i);
8979 ok(hr == test.port_prop.expected,
8980 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8981 hr, test.port_prop.expected, i);
8985 hr = IUriBuilder_HasBeenModified(builder, &received);
8987 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8990 ok(received == modified,
8991 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
8992 modified, received, i);
8994 /* Test the "Get*" functions. */
8995 test_IUriBuilder_GetFragment(builder, &test, i);
8996 test_IUriBuilder_GetHost(builder, &test, i);
8997 test_IUriBuilder_GetPassword(builder, &test, i);
8998 test_IUriBuilder_GetPath(builder, &test, i);
8999 test_IUriBuilder_GetPort(builder, &test, i);
9000 test_IUriBuilder_GetQuery(builder, &test, i);
9001 test_IUriBuilder_GetSchemeName(builder, &test, i);
9002 test_IUriBuilder_GetUserName(builder, &test, i);
9004 test_IUriBuilder_CreateUri(builder, &test, i);
9005 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9006 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9008 if(builder) IUriBuilder_Release(builder);
9009 if(uri) IUri_Release(uri);
9014 static void test_IUriBuilder_HasBeenModified(void) {
9016 IUriBuilder *builder = NULL;
9018 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9019 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9021 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9025 hr = IUriBuilder_HasBeenModified(builder, NULL);
9026 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9029 hr = IUriBuilder_SetHost(builder, hostW);
9030 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9033 hr = IUriBuilder_HasBeenModified(builder, &received);
9034 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9037 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9039 hr = pCreateUri(http_urlW, 0, 0, &uri);
9040 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9045 hr = IUriBuilder_SetIUri(builder, uri);
9046 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9049 hr = IUriBuilder_HasBeenModified(builder, &received);
9050 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9053 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9055 /* Test what happens with you call SetIUri with the same IUri again. */
9056 hr = IUriBuilder_SetHost(builder, hostW);
9057 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9059 hr = IUriBuilder_HasBeenModified(builder, &received);
9060 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9063 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9065 hr = IUriBuilder_SetIUri(builder, uri);
9066 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9068 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9069 * reset any of the changes that were made to the IUriBuilder.
9071 hr = IUriBuilder_HasBeenModified(builder, &received);
9072 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9074 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9076 hr = IUriBuilder_GetHost(builder, &len, &prop);
9077 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9079 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9080 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9081 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9082 lstrlenW(hostW), len);
9085 hr = IUriBuilder_SetIUri(builder, NULL);
9086 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9088 hr = IUriBuilder_SetHost(builder, hostW);
9089 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9090 hr = IUriBuilder_HasBeenModified(builder, &received);
9091 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9094 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9096 hr = IUriBuilder_SetIUri(builder, NULL);
9097 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9099 hr = IUriBuilder_HasBeenModified(builder, &received);
9100 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9103 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9105 hr = IUriBuilder_GetHost(builder, &len, &prop);
9106 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9108 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9109 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9110 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9111 lstrlenW(hostW), len);
9114 if(uri) IUri_Release(uri);
9116 if(builder) IUriBuilder_Release(builder);
9119 /* Test IUriBuilder {Get,Set}IUri functions. */
9120 static void test_IUriBuilder_IUriProperty(void) {
9121 IUriBuilder *builder = NULL;
9124 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9125 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9129 hr = IUriBuilder_GetIUri(builder, NULL);
9130 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9133 hr = pCreateUri(http_urlW, 0, 0, &uri);
9136 ULONG cur_count, orig_count;
9138 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9139 orig_count = get_refcnt(uri);
9140 hr = IUriBuilder_SetIUri(builder, uri);
9141 cur_count = get_refcnt(uri);
9143 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9144 orig_count+1, cur_count);
9146 hr = IUriBuilder_SetIUri(builder, NULL);
9147 cur_count = get_refcnt(uri);
9149 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9150 orig_count, cur_count);
9152 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9153 hr = IUriBuilder_SetIUri(builder, uri);
9154 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9155 orig_count = get_refcnt(uri);
9157 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9158 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9160 cur_count = get_refcnt(uri);
9161 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9162 orig_count+1, cur_count);
9163 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9166 if(test) IUri_Release(test);
9169 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9170 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9172 cur_count = get_refcnt(uri);
9173 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9174 orig_count+1, cur_count);
9175 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9177 if(test) IUri_Release(test);
9179 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9183 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9184 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9186 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9188 if(test) IUri_Release(test);
9190 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9191 * explicitly set (because it's a default flags).
9194 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9195 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9197 cur_count = get_refcnt(uri);
9198 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9199 orig_count+1, cur_count);
9200 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9202 if(test) IUri_Release(test);
9205 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9206 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9208 cur_count = get_refcnt(uri);
9209 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9210 orig_count+1, cur_count);
9211 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9213 if(test) IUri_Release(test);
9216 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9217 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9220 cur_count = get_refcnt(uri);
9221 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9222 orig_count+1, cur_count);
9223 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9225 if(test) IUri_Release(test);
9227 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9231 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9232 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9234 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9236 if(test) IUri_Release(test);
9238 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9239 * explicitly set (because it's a default flags).
9242 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9243 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9245 cur_count = get_refcnt(uri);
9246 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9247 orig_count+1, cur_count);
9248 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9250 if(test) IUri_Release(test);
9252 if(uri) IUri_Release(uri);
9254 if(builder) IUriBuilder_Release(builder);
9257 static void test_IUriBuilder_RemoveProperties(void) {
9258 IUriBuilder *builder = NULL;
9262 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9263 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9265 /* Properties that can't be removed. */
9266 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9267 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9269 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9270 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9271 if((i << 1) & invalid) {
9272 ok(hr == E_INVALIDARG,
9273 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9274 hr, E_INVALIDARG, i);
9277 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9282 /* Also doesn't accept anything that's outside the range of the
9285 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9286 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9289 if(builder) IUriBuilder_Release(builder);
9291 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9292 uri_builder_remove_test test = uri_builder_remove_tests[i];
9296 uriW = a2w(test.uri);
9297 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9301 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9302 if(test.create_builder_todo) {
9304 ok(hr == test.create_builder_expected,
9305 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9306 hr, test.create_builder_expected, i);
9309 ok(hr == test.create_builder_expected,
9310 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9311 hr, test.create_builder_expected, i);
9314 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9315 if(test.remove_todo) {
9317 ok(hr == test.remove_expected,
9318 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9319 hr, test.remove_expected, i);
9322 ok(hr == test.remove_expected,
9323 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9324 hr, test.remove_expected, i);
9327 IUri *result = NULL;
9329 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9330 if(test.expected_todo) {
9332 ok(hr == test.expected_hres,
9333 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9334 hr, test.expected_hres, i);
9337 ok(hr == test.expected_hres,
9338 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9339 hr, test.expected_hres, i);
9342 BSTR received = NULL;
9344 hr = IUri_GetAbsoluteUri(result, &received);
9345 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9346 ok(!strcmp_aw(test.expected_uri, received),
9347 "Error: Expected %s but got %s instead on test %d.\n",
9348 test.expected_uri, wine_dbgstr_w(received), i);
9349 SysFreeString(received);
9351 if(result) IUri_Release(result);
9354 if(builder) IUriBuilder_Release(builder);
9356 if(uri) IUri_Release(uri);
9361 static void test_IUriBuilder_Misc(void) {
9365 hr = pCreateUri(http_urlW, 0, 0, &uri);
9367 IUriBuilder *builder;
9369 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9370 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9375 hr = IUriBuilder_GetPort(builder, &has, &port);
9376 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9378 /* 'has' will be set to FALSE, even though uri had a port. */
9379 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9380 /* Still sets 'port' to 80. */
9381 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9384 if(builder) IUriBuilder_Release(builder);
9386 if(uri) IUri_Release(uri);
9389 static void test_IUriBuilderFactory(void) {
9392 IUriBuilderFactory *factory;
9393 IUriBuilder *builder;
9395 hr = pCreateUri(http_urlW, 0, 0, &uri);
9396 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9399 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9400 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9401 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9404 builder = (void*) 0xdeadbeef;
9405 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9406 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9408 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9410 builder = (void*) 0xdeadbeef;
9411 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9412 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9414 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9416 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9417 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9421 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9422 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9425 IUri *tmp = (void*) 0xdeadbeef;
9429 hr = IUriBuilder_GetIUri(builder, &tmp);
9430 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9432 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9434 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9435 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9438 if(builder) IUriBuilder_Release(builder);
9440 builder = (void*) 0xdeadbeef;
9441 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9442 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9444 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9446 builder = (void*) 0xdeadbeef;
9447 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9448 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9450 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9452 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9453 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9457 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9458 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9463 hr = IUriBuilder_GetIUri(builder, &tmp);
9464 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9466 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9467 if(uri) IUri_Release(uri);
9469 if(builder) IUriBuilder_Release(builder);
9471 if(factory) IUriBuilderFactory_Release(factory);
9473 if(uri) IUri_Release(uri);
9476 static void test_CoInternetCombineIUri(void) {
9478 IUri *base, *relative, *result;
9482 hr = pCreateUri(http_urlW, 0, 0, &base);
9483 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9485 result = (void*) 0xdeadbeef;
9486 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9487 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9488 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9492 hr = pCreateUri(http_urlW, 0, 0, &relative);
9493 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9495 result = (void*) 0xdeadbeef;
9496 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9497 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9498 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9501 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9502 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9504 if(base) IUri_Release(base);
9505 if(relative) IUri_Release(relative);
9507 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9508 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9510 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9511 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9513 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9515 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9516 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9520 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9521 if(uri_combine_tests[i].todo) {
9523 ok(hr == uri_combine_tests[i].expected,
9524 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9525 hr, uri_combine_tests[i].expected, i);
9528 ok(hr == uri_combine_tests[i].expected,
9529 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9530 hr, uri_combine_tests[i]. expected, i);
9535 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9536 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9539 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9542 ok(hr == prop.expected,
9543 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9544 hr, prop.expected, i, j);
9547 ok(!strcmp_aw(prop.value, received) ||
9548 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9549 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9550 prop.value, wine_dbgstr_w(received), i, j);
9553 ok(hr == prop.expected,
9554 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9555 hr, prop.expected, i, j);
9556 ok(!strcmp_aw(prop.value, received) ||
9557 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9558 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9559 prop.value, wine_dbgstr_w(received), i, j);
9561 SysFreeString(received);
9564 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9565 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9568 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9571 ok(hr == prop.expected,
9572 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9573 hr, prop.expected, i, j);
9576 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9577 prop.value, received, i, j);
9580 ok(hr == prop.expected,
9581 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9582 hr, prop.expected, i, j);
9583 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9584 prop.value, received, i, j);
9588 if(result) IUri_Release(result);
9590 if(relative) IUri_Release(relative);
9591 heap_free(relativeW);
9593 if(base) IUri_Release(base);
9598 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9599 REFIID riid, void **ppv)
9601 ok(0, "unexpected call\n");
9602 return E_NOINTERFACE;
9605 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9610 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9615 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9616 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9617 DWORD *pcchResult, DWORD dwReserved)
9619 CHECK_EXPECT(ParseUrl);
9620 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
9621 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
9622 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
9623 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
9624 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
9626 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
9627 *pcchResult = lstrlenW(parse_resultW);
9632 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9633 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9634 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9636 CHECK_EXPECT(CombineUrl);
9637 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9638 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9639 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9640 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9641 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9642 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9643 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9645 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9646 *pcchResult = lstrlenW(combine_resultW);
9651 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9652 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9654 ok(0, "unexpected call\n");
9658 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9659 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9660 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9662 ok(0, "unexpected call\n");
9666 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9667 InternetProtocolInfo_QueryInterface,
9668 InternetProtocolInfo_AddRef,
9669 InternetProtocolInfo_Release,
9670 InternetProtocolInfo_ParseUrl,
9671 InternetProtocolInfo_CombineUrl,
9672 InternetProtocolInfo_CompareUrl,
9673 InternetProtocolInfo_QueryInfo
9676 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9678 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9680 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9681 *ppv = &protocol_info;
9685 ok(0, "unexpected call\n");
9686 return E_NOINTERFACE;
9689 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9694 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9699 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9700 REFIID riid, void **ppv)
9702 ok(0, "unexpected call\n");
9706 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9708 ok(0, "unexpected call\n");
9712 static const IClassFactoryVtbl ClassFactoryVtbl = {
9713 ClassFactory_QueryInterface,
9714 ClassFactory_AddRef,
9715 ClassFactory_Release,
9716 ClassFactory_CreateInstance,
9717 ClassFactory_LockServer
9720 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9722 static void register_protocols(void)
9724 IInternetSession *session;
9727 hres = pCoInternetGetSession(0, &session, 0);
9728 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
9732 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
9733 winetestW, 0, NULL, 0);
9734 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
9736 IInternetSession_Release(session);
9739 static void unregister_protocols(void) {
9740 IInternetSession *session;
9743 hr = pCoInternetGetSession(0, &session, 0);
9744 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
9748 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
9749 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
9751 IInternetSession_Release(session);
9754 static void test_CoInternetCombineIUri_Pluggable(void) {
9758 hr = pCreateUri(combine_baseW, 0, 0, &base);
9759 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9761 IUri *relative = NULL;
9763 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
9764 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9766 IUri *result = NULL;
9768 SET_EXPECT(CombineUrl);
9770 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9772 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9774 CHECK_CALLED(CombineUrl);
9777 BSTR received = NULL;
9778 hr = IUri_GetAbsoluteUri(result, &received);
9779 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9781 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9782 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9784 SysFreeString(received);
9786 if(result) IUri_Release(result);
9788 if(relative) IUri_Release(relative);
9790 if(base) IUri_Release(base);
9793 static void test_CoInternetCombineUrlEx(void) {
9795 IUri *base, *result;
9799 hr = pCreateUri(http_urlW, 0, 0, &base);
9800 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9802 result = (void*) 0xdeadbeef;
9803 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
9804 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9806 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
9809 result = (void*) 0xdeadbeef;
9810 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
9811 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9813 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9815 result = (void*) 0xdeadbeef;
9816 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
9817 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9819 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9821 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
9822 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9824 if(base) IUri_Release(base);
9826 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9827 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9829 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9830 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
9832 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9834 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
9836 if(uri_combine_tests[i].todo) {
9838 ok(hr == uri_combine_tests[i].expected,
9839 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9840 hr, uri_combine_tests[i].expected, i);
9843 ok(hr == uri_combine_tests[i].expected,
9844 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9845 hr, uri_combine_tests[i]. expected, i);
9850 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9851 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9853 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
9855 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9858 ok(hr == prop.expected,
9859 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9860 hr, prop.expected, i, j);
9863 ok(!strcmp_aw(value, received) ||
9864 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9865 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9866 value, wine_dbgstr_w(received), i, j);
9869 ok(hr == prop.expected,
9870 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9871 hr, prop.expected, i, j);
9872 ok(!strcmp_aw(value, received) ||
9873 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9874 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9875 value, wine_dbgstr_w(received), i, j);
9877 SysFreeString(received);
9880 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9881 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9884 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9887 ok(hr == prop.expected,
9888 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9889 hr, prop.expected, i, j);
9892 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9893 prop.value, received, i, j);
9896 ok(hr == prop.expected,
9897 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9898 hr, prop.expected, i, j);
9899 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9900 prop.value, received, i, j);
9904 if(result) IUri_Release(result);
9905 heap_free(relativeW);
9907 if(base) IUri_Release(base);
9912 static void test_CoInternetCombineUrlEx_Pluggable(void) {
9916 hr = pCreateUri(combine_baseW, 0, 0, &base);
9917 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9919 IUri *result = NULL;
9921 SET_EXPECT(CombineUrl);
9923 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9925 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9927 CHECK_CALLED(CombineUrl);
9930 BSTR received = NULL;
9931 hr = IUri_GetAbsoluteUri(result, &received);
9932 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9934 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9935 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9937 SysFreeString(received);
9939 if(result) IUri_Release(result);
9941 if(base) IUri_Release(base);
9944 static void test_CoInternetParseIUri_InvalidArgs(void) {
9950 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9951 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9953 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9955 hr = pCreateUri(http_urlW, 0, 0, &uri);
9956 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9961 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
9962 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9964 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9966 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
9967 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9971 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
9972 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
9974 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9977 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
9978 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9980 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9983 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
9984 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9986 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9989 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
9990 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9992 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
9994 expected_len = lstrlenW(http_urlW);
9996 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
9997 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
9998 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
9999 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10000 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10001 expected_len, result);
10003 if(uri) IUri_Release(uri);
10006 static void test_CoInternetParseIUri(void) {
10009 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10013 uri_parse_test test = uri_parse_tests[i];
10015 uriW = a2w(test.uri);
10016 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10017 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10018 if(SUCCEEDED(hr)) {
10019 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10020 DWORD result_len = -1;
10022 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10025 ok(hr == test.expected,
10026 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10027 hr, test.expected, i);
10030 ok(hr == test.expected,
10031 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10032 hr, test.expected, i);
10034 if(SUCCEEDED(hr)) {
10035 DWORD len = lstrlenA(test.property);
10036 ok(!strcmp_aw(test.property, result),
10037 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10038 test.property, wine_dbgstr_w(result), i);
10039 ok(len == result_len,
10040 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10041 len, result_len, i);
10044 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10048 if(uri) IUri_Release(uri);
10053 static void test_CoInternetParseIUri_Pluggable(void) {
10057 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10058 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10059 if(SUCCEEDED(hr)) {
10063 SET_EXPECT(ParseUrl);
10065 parse_action = PARSE_CANONICALIZE;
10066 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10068 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10069 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10071 CHECK_CALLED(ParseUrl);
10073 if(SUCCEEDED(hr)) {
10074 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10075 lstrlenW(parse_resultW), result_len);
10076 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10077 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10080 if(uri) IUri_Release(uri);
10086 const char *base_url;
10087 DWORD base_uri_flags;
10088 const char *legacy_url;
10089 const char *uniform_url;
10090 const char *no_canon_url;
10091 const char *uri_url;
10092 } create_urlmon_test_t;
10094 static const create_urlmon_test_t create_urlmon_tests[] = {
10096 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10098 "http://www.winehq.org/",
10099 "http://www.winehq.org/",
10100 "http://www.winehq.org",
10101 "http://www.winehq.org"
10104 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10106 "file://c:\\dir\\file.txt",
10107 "file:///c:/dir/file.txt",
10108 "file:///c:/dir/file.txt",
10109 "file:///c:/dir/file.txt"
10112 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10114 "file://c:\\dir\\file.txt",
10115 "file:///c:/dir/file.txt",
10116 "file:///c:/dir/file.txt",
10117 "file://c:\\dir\\file.txt"
10120 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10121 "http://www.winehq.org",0,
10122 "http://www.winehq.org/data",
10123 "http://www.winehq.org/data",
10124 "http://www.winehq.org:80/data",
10127 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10128 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10129 "file://c:\\dir\\file.txt",
10130 "file:///c:/dir/file.txt",
10131 "file:///c:/dir/file.txt",
10134 "",Uri_CREATE_ALLOW_RELATIVE,
10142 "test",Uri_CREATE_ALLOW_RELATIVE,
10150 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10152 "file://c:\\dir\\file.txt",
10153 "file:///c:/dir/file.txt",
10154 "file:///c:/dir/file.txt",
10155 "file:///c:/dir/file.txt",
10159 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10160 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10162 WCHAR *display_name;
10165 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10166 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10167 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10168 wine_dbgstr_w(display_name), exurl);
10170 CoTaskMemFree(display_name);
10173 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10174 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10176 IUriContainer *uri_container;
10181 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10182 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10185 hres = IUriContainer_GetIUri(uri_container, &uri);
10186 IUriContainer_Release(uri_container);
10187 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10188 ok(uri != NULL, "uri == NULL\n");
10190 hres = IUri_GetDisplayUri(uri, &display_uri);
10192 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10193 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10194 wine_dbgstr_w(display_uri), exurl);
10195 SysFreeString(display_uri);
10198 static void test_CreateURLMoniker(void)
10200 const create_urlmon_test_t *test;
10201 IMoniker *mon, *base_mon;
10202 WCHAR *url, *base_url;
10203 IUri *uri, *base_uri;
10206 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10207 url = a2w(test->url);
10208 base_url = a2w(test->base_url);
10211 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10212 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10214 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10215 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10221 hres = CreateURLMoniker(base_mon, url, &mon);
10222 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10223 test_urlmon_display_name(mon, test->legacy_url);
10224 test_display_uri(mon, test->legacy_url);
10225 IMoniker_Release(mon);
10227 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10228 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10229 test_urlmon_display_name(mon, test->legacy_url);
10230 test_display_uri(mon, test->legacy_url);
10231 IMoniker_Release(mon);
10233 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10234 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10235 test_urlmon_display_name(mon, test->uniform_url);
10236 test_display_uri(mon, test->uniform_url);
10237 IMoniker_Release(mon);
10239 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10240 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10241 test_urlmon_display_name(mon, test->no_canon_url);
10242 test_display_uri(mon, test->no_canon_url);
10243 IMoniker_Release(mon);
10245 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10246 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10248 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10249 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10250 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10251 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10252 IMoniker_Release(mon);
10254 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10255 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10256 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10257 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10258 IMoniker_Release(mon);
10260 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10261 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10262 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10263 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10264 IMoniker_Release(mon);
10268 heap_free(base_url);
10270 IUri_Release(base_uri);
10272 IMoniker_Release(base_mon);
10279 hurlmon = GetModuleHandle("urlmon.dll");
10280 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
10281 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
10282 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
10283 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
10284 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
10285 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
10286 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
10287 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
10288 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
10291 win_skip("CreateUri is not present, skipping tests.\n");
10295 trace("test CreateUri invalid flags...\n");
10296 test_CreateUri_InvalidFlags();
10298 trace("test CreateUri invalid args...\n");
10299 test_CreateUri_InvalidArgs();
10301 trace("test CreateUri invalid URIs...\n");
10302 test_CreateUri_InvalidUri();
10304 trace("test IUri_GetPropertyBSTR...\n");
10305 test_IUri_GetPropertyBSTR();
10307 trace("test IUri_GetPropertyDWORD...\n");
10308 test_IUri_GetPropertyDWORD();
10310 trace("test IUri_GetStrProperties...\n");
10311 test_IUri_GetStrProperties();
10313 trace("test IUri_GetDwordProperties...\n");
10314 test_IUri_GetDwordProperties();
10316 trace("test IUri_GetPropertyLength...\n");
10317 test_IUri_GetPropertyLength();
10319 trace("test IUri_GetProperties...\n");
10320 test_IUri_GetProperties();
10322 trace("test IUri_HasProperty...\n");
10323 test_IUri_HasProperty();
10325 trace("test IUri_IsEqual...\n");
10326 test_IUri_IsEqual();
10328 trace("test CreateUriWithFragment invalid args...\n");
10329 test_CreateUriWithFragment_InvalidArgs();
10331 trace("test CreateUriWithFragment invalid flags...\n");
10332 test_CreateUriWithFragment_InvalidFlags();
10334 trace("test CreateUriWithFragment...\n");
10335 test_CreateUriWithFragment();
10337 trace("test CreateIUriBuilder...\n");
10338 test_CreateIUriBuilder();
10340 trace("test IUriBuilder_CreateInvalidArgs...\n");
10341 test_IUriBuilder_CreateInvalidArgs();
10343 trace("test IUriBuilder...\n");
10344 test_IUriBuilder();
10346 trace("test IUriBuilder_GetInvalidArgs...\n");
10347 test_IUriBuilder_GetInvalidArgs();
10349 trace("test IUriBuilder_HasBeenModified...\n");
10350 test_IUriBuilder_HasBeenModified();
10352 trace("test IUriBuilder_IUriProperty...\n");
10353 test_IUriBuilder_IUriProperty();
10355 trace("test IUriBuilder_RemoveProperties...\n");
10356 test_IUriBuilder_RemoveProperties();
10358 trace("test IUriBuilder miscellaneous...\n");
10359 test_IUriBuilder_Misc();
10361 trace("test IUriBuilderFactory...\n");
10362 test_IUriBuilderFactory();
10364 trace("test CoInternetCombineIUri...\n");
10365 test_CoInternetCombineIUri();
10367 trace("test CoInternetCombineUrlEx...\n");
10368 test_CoInternetCombineUrlEx();
10370 trace("test CoInternetParseIUri Invalid Args...\n");
10371 test_CoInternetParseIUri_InvalidArgs();
10373 trace("test CoInternetParseIUri...\n");
10374 test_CoInternetParseIUri();
10376 register_protocols();
10378 trace("test CoInternetCombineIUri pluggable...\n");
10379 test_CoInternetCombineIUri_Pluggable();
10381 trace("test CoInternetCombineUrlEx Pluggable...\n");
10382 test_CoInternetCombineUrlEx_Pluggable();
10384 trace("test CoInternetParseIUri pluggable...\n");
10385 test_CoInternetParseIUri_Pluggable();
10387 trace("test CreateURLMoniker...\n");
10388 test_CreateURLMoniker();
10390 unregister_protocols();