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://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
285 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
287 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
293 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
294 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
296 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
302 {Uri_HOST_UNKNOWN,S_OK,FALSE},
304 {URL_SCHEME_FILE,S_OK,FALSE},
305 {URLZONE_INVALID,E_NOTIMPL,FALSE}
308 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
310 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
312 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
318 {"/tests/test%20file.README.txt",S_OK,FALSE},
319 {"/tests/test%20file.README.txt",S_OK,FALSE},
321 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
327 {Uri_HOST_UNKNOWN,S_OK,FALSE},
329 {URL_SCHEME_FILE,S_OK,FALSE},
330 {URLZONE_INVALID,E_NOTIMPL,FALSE}
333 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
335 {"urn:nothing:should:happen here",S_OK,FALSE},
337 {"urn:nothing:should:happen here",S_OK,FALSE},
343 {"nothing:should:happen here",S_OK,FALSE},
344 {"nothing:should:happen here",S_OK,FALSE},
346 {"urn:nothing:should:happen here",S_OK,FALSE},
352 {Uri_HOST_UNKNOWN,S_OK,FALSE},
354 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
355 {URLZONE_INVALID,E_NOTIMPL,FALSE}
358 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
360 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
361 {"127.0.0.1",S_OK,FALSE},
362 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
366 {"127.0.0.1",S_OK,FALSE},
368 {"/test%20dir/test.txt",S_OK,FALSE},
369 {"/test%20dir/test.txt",S_OK,FALSE},
371 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
377 {Uri_HOST_IPV4,S_OK,FALSE},
379 {URL_SCHEME_HTTP,S_OK,FALSE},
380 {URLZONE_INVALID,E_NOTIMPL,FALSE}
383 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
385 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
386 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
387 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
391 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
396 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
402 {Uri_HOST_IPV6,S_OK,FALSE},
404 {URL_SCHEME_HTTP,S_OK,FALSE},
405 {URLZONE_INVALID,E_NOTIMPL,FALSE}
408 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
410 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
411 {"[::13.1.68.3]",S_OK,FALSE},
412 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
416 {"::13.1.68.3",S_OK,FALSE},
421 {"ftp://[::13.1.68.3]",S_OK,FALSE},
427 {Uri_HOST_IPV6,S_OK,FALSE},
429 {URL_SCHEME_FTP,S_OK,FALSE},
430 {URLZONE_INVALID,E_NOTIMPL,FALSE}
433 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
435 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
436 {"[fedc:ba98::3210]",S_OK,FALSE},
437 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
441 {"fedc:ba98::3210",S_OK,FALSE},
446 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
452 {Uri_HOST_IPV6,S_OK,FALSE},
454 {URL_SCHEME_HTTP,S_OK,FALSE},
455 {URLZONE_INVALID,E_NOTIMPL,FALSE}
458 { "1234://www.winehq.org", 0, S_OK, FALSE,
460 {"1234://www.winehq.org/",S_OK,FALSE},
461 {"www.winehq.org",S_OK,FALSE},
462 {"1234://www.winehq.org/",S_OK,FALSE},
463 {"winehq.org",S_OK,FALSE},
466 {"www.winehq.org",S_OK,FALSE},
471 {"1234://www.winehq.org",S_OK,FALSE},
477 {Uri_HOST_DNS,S_OK,FALSE},
479 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
480 {URLZONE_INVALID,E_NOTIMPL,FALSE}
483 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
484 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
486 {"file:///C:/test/test.mp3",S_OK,FALSE},
488 {"file:///C:/test/test.mp3",S_OK,FALSE},
494 {"/C:/test/test.mp3",S_OK,FALSE},
495 {"/C:/test/test.mp3",S_OK,FALSE},
497 {"C:/test/test.mp3",S_OK,FALSE},
503 {Uri_HOST_UNKNOWN,S_OK,FALSE},
505 {URL_SCHEME_FILE,S_OK,FALSE},
506 {URLZONE_INVALID,E_NOTIMPL,FALSE}
509 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
510 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
512 {"file://server/test.mp3",S_OK,FALSE},
513 {"server",S_OK,FALSE},
514 {"file://server/test.mp3",S_OK,FALSE},
518 {"server",S_OK,FALSE},
520 {"/test.mp3",S_OK,FALSE},
521 {"/test.mp3",S_OK,FALSE},
523 {"\\\\Server/test.mp3",S_OK,FALSE},
529 {Uri_HOST_DNS,S_OK,FALSE},
531 {URL_SCHEME_FILE,S_OK,FALSE},
532 {URLZONE_INVALID,E_NOTIMPL,FALSE}
535 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
537 {"*:www.winehq.org/test",S_OK,FALSE},
538 {"www.winehq.org",S_OK,FALSE},
539 {"*:www.winehq.org/test",S_OK,FALSE},
540 {"winehq.org",S_OK,FALSE},
543 {"www.winehq.org",S_OK,FALSE},
545 {"/test",S_OK,FALSE},
546 {"/test",S_OK,FALSE},
548 {"www.winehq.org/test",S_OK,FALSE},
554 {Uri_HOST_DNS,S_OK,FALSE},
556 {URL_SCHEME_WILDCARD,S_OK,FALSE},
557 {URLZONE_INVALID,E_NOTIMPL,FALSE}
560 /* Valid since the '*' is the only character in the scheme name. */
561 { "*:www.winehq.org/test", 0, S_OK, FALSE,
563 {"*:www.winehq.org/test",S_OK,FALSE},
564 {"www.winehq.org",S_OK,FALSE},
565 {"*:www.winehq.org/test",S_OK,FALSE},
566 {"winehq.org",S_OK,FALSE},
569 {"www.winehq.org",S_OK,FALSE},
571 {"/test",S_OK,FALSE},
572 {"/test",S_OK,FALSE},
574 {"*:www.winehq.org/test",S_OK,FALSE},
580 {Uri_HOST_DNS,S_OK,FALSE},
582 {URL_SCHEME_WILDCARD,S_OK,FALSE},
583 {URLZONE_INVALID,E_NOTIMPL,FALSE}
586 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
588 {"/../some dir/test.ext",S_OK,FALSE},
590 {"/../some dir/test.ext",S_OK,FALSE},
596 {"/../some dir/test.ext",S_OK,FALSE},
597 {"/../some dir/test.ext",S_OK,FALSE},
599 {"/../some dir/test.ext",S_OK,FALSE},
605 {Uri_HOST_UNKNOWN,S_OK,FALSE},
607 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
608 {URLZONE_INVALID,E_NOTIMPL,FALSE}
611 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
613 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
615 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
621 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
622 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
624 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
630 {Uri_HOST_UNKNOWN,S_OK,FALSE},
632 {URL_SCHEME_WILDCARD,S_OK,FALSE},
633 {URLZONE_INVALID,E_NOTIMPL,FALSE}
636 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
637 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
639 {"zip:/.//google.com",S_OK,FALSE},
641 {"zip:/.//google.com",S_OK,FALSE},
647 {"/.//google.com",S_OK,FALSE},
648 {"/.//google.com",S_OK,FALSE},
650 {"zip://google.com",S_OK,FALSE},
656 {Uri_HOST_UNKNOWN,S_OK,FALSE},
658 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
659 {URLZONE_INVALID,E_NOTIMPL,FALSE}
662 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
663 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
665 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
666 {"user:pass:word@winehq.org",S_OK,FALSE},
667 {"ftp://winehq.org/",S_OK,FALSE},
668 {"winehq.org",S_OK,FALSE},
671 {"winehq.org",S_OK,FALSE},
672 {"pass:word",S_OK,FALSE},
676 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
678 {"user:pass:word",S_OK,FALSE},
682 {Uri_HOST_DNS,S_OK,FALSE},
684 {URL_SCHEME_FTP,S_OK,FALSE},
685 {URLZONE_INVALID,E_NOTIMPL,FALSE}
688 /* Make sure % encoded unreserved characters are decoded. */
689 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
691 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
692 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
693 {"ftp://ftp.google.com/",S_OK,FALSE},
694 {"google.com",S_OK,FALSE},
697 {"ftp.google.com",S_OK,FALSE},
702 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
704 {"wINe:PASS",S_OK,FALSE},
708 {Uri_HOST_DNS,S_OK,FALSE},
710 {URL_SCHEME_FTP,S_OK,FALSE},
711 {URLZONE_INVALID,E_NOTIMPL,FALSE}
714 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
715 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
717 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
718 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
719 {"ftp://ftp.google.com/",S_OK,FALSE},
720 {"google.com",S_OK,FALSE},
723 {"ftp.google.com",S_OK,FALSE},
724 {"PA%7B%7D",S_OK,FALSE},
728 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
730 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
731 {"w%5D%5Be",S_OK,FALSE}
734 {Uri_HOST_DNS,S_OK,FALSE},
736 {URL_SCHEME_FTP,S_OK,FALSE},
737 {URLZONE_INVALID,E_NOTIMPL,FALSE}
740 /* You're allowed to have an empty password portion in the userinfo section. */
741 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
743 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
744 {"empty:@ftp.google.com",S_OK,FALSE},
745 {"ftp://ftp.google.com/",S_OK,FALSE},
746 {"google.com",S_OK,FALSE},
749 {"ftp.google.com",S_OK,FALSE},
754 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
756 {"empty:",S_OK,FALSE},
760 {Uri_HOST_DNS,S_OK,FALSE},
762 {URL_SCHEME_FTP,S_OK,FALSE},
763 {URLZONE_INVALID,E_NOTIMPL,FALSE}
766 /* Make sure forbidden characters in "userinfo" get encoded. */
767 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
769 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
770 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
771 {"ftp://ftp.google.com/",S_OK,FALSE},
772 {"google.com",S_OK,FALSE},
775 {"ftp.google.com",S_OK,FALSE},
780 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
782 {"%22%20%22weird",S_OK,FALSE},
783 {"%22%20%22weird",S_OK,FALSE}
786 {Uri_HOST_DNS,S_OK,FALSE},
788 {URL_SCHEME_FTP,S_OK,FALSE},
789 {URLZONE_INVALID,E_NOTIMPL,FALSE}
792 /* Make sure the forbidden characters don't get percent encoded. */
793 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
795 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
796 {"\" \"weird@ftp.google.com",S_OK,FALSE},
797 {"ftp://ftp.google.com/",S_OK,FALSE},
798 {"google.com",S_OK,FALSE},
801 {"ftp.google.com",S_OK,FALSE},
806 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
808 {"\" \"weird",S_OK,FALSE},
809 {"\" \"weird",S_OK,FALSE}
812 {Uri_HOST_DNS,S_OK,FALSE},
814 {URL_SCHEME_FTP,S_OK,FALSE},
815 {URLZONE_INVALID,E_NOTIMPL,FALSE}
818 /* Make sure already percent encoded characters don't get unencoded. */
819 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
821 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
822 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
823 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
824 {"google.com",S_OK,FALSE},
827 {"ftp.google.com",S_OK,FALSE},
829 {"/\"%20\"weird",S_OK,FALSE},
830 {"/\"%20\"weird",S_OK,FALSE},
832 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
834 {"\"%20\"weird",S_OK,FALSE},
835 {"\"%20\"weird",S_OK,FALSE}
838 {Uri_HOST_DNS,S_OK,FALSE},
840 {URL_SCHEME_FTP,S_OK,FALSE},
841 {URLZONE_INVALID,E_NOTIMPL,FALSE}
844 /* Allowed to have invalid % encoded because its an unknown scheme type. */
845 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
847 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
848 {"%xy:word@winehq.org",S_OK,FALSE},
849 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
850 {"winehq.org",S_OK,FALSE},
853 {"winehq.org",S_OK,FALSE},
858 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
860 {"%xy:word",S_OK,FALSE},
864 {Uri_HOST_DNS,S_OK,FALSE},
866 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
867 {URLZONE_INVALID,E_NOTIMPL,FALSE}
870 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
873 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
875 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
876 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
877 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
878 {"winehq.org",S_OK,FALSE},
881 {"winehq.org",S_OK,FALSE},
882 {"%52%53ord",S_OK,FALSE},
886 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
888 {"%2E:%52%53ord",S_OK,FALSE},
892 {Uri_HOST_DNS,S_OK,FALSE},
894 {URL_SCHEME_UNKNOWN,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},
901 {"[](),'test':word@winehq.org",S_OK,FALSE},
902 {"ftp://winehq.org/",S_OK,FALSE},
903 {"winehq.org",S_OK,FALSE},
906 {"winehq.org",S_OK,FALSE},
911 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
913 {"[](),'test':word",S_OK,FALSE},
914 {"[](),'test'",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},
934 {"/?:word@winehq.org/",S_OK,FALSE},
935 {"?: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 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
950 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
952 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
955 {"#:word@winehq.org/",S_OK,FALSE},
961 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
967 {Uri_HOST_DNS,S_OK,FALSE},
969 {URL_SCHEME_FTP,S_OK,FALSE},
970 {URLZONE_INVALID,E_NOTIMPL,FALSE}
973 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
974 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
976 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
977 {"test\\:word@winehq.org",S_OK,FALSE},
978 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
979 {"winehq.org",S_OK,FALSE},
982 {"winehq.org",S_OK,FALSE},
987 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
989 {"test\\:word",S_OK,FALSE},
990 {"test\\",S_OK,FALSE}
993 {Uri_HOST_DNS,S_OK,FALSE},
995 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
996 {URLZONE_INVALID,E_NOTIMPL,FALSE}
999 /* It normalizes IPv4 addresses correctly. */
1000 { "http://127.000.000.100/", 0, S_OK, FALSE,
1002 {"http://127.0.0.100/",S_OK,FALSE},
1003 {"127.0.0.100",S_OK,FALSE},
1004 {"http://127.0.0.100/",S_OK,FALSE},
1008 {"127.0.0.100",S_OK,FALSE},
1013 {"http://127.000.000.100/",S_OK,FALSE},
1014 {"http",S_OK,FALSE},
1019 {Uri_HOST_IPV4,S_OK,FALSE},
1021 {URL_SCHEME_HTTP,S_OK,FALSE},
1022 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1025 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1027 {"http://127.0.0.1:8000/",S_OK},
1028 {"127.0.0.1:8000",S_OK},
1029 {"http://127.0.0.1:8000/",S_OK},
1038 {"http://127.0.0.1:8000",S_OK},
1044 {Uri_HOST_IPV4,S_OK,FALSE},
1046 {URL_SCHEME_HTTP,S_OK,FALSE},
1047 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1050 /* Make sure it normalizes partial IPv4 addresses correctly. */
1051 { "http://127.0/", 0, S_OK, FALSE,
1053 {"http://127.0.0.0/",S_OK,FALSE},
1054 {"127.0.0.0",S_OK,FALSE},
1055 {"http://127.0.0.0/",S_OK,FALSE},
1059 {"127.0.0.0",S_OK,FALSE},
1064 {"http://127.0/",S_OK,FALSE},
1065 {"http",S_OK,FALSE},
1070 {Uri_HOST_IPV4,S_OK,FALSE},
1072 {URL_SCHEME_HTTP,S_OK,FALSE},
1073 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1076 /* Make sure it converts implicit IPv4's correctly. */
1077 { "http://123456/", 0, S_OK, FALSE,
1079 {"http://0.1.226.64/",S_OK,FALSE},
1080 {"0.1.226.64",S_OK,FALSE},
1081 {"http://0.1.226.64/",S_OK,FALSE},
1085 {"0.1.226.64",S_OK,FALSE},
1090 {"http://123456/",S_OK,FALSE},
1091 {"http",S_OK,FALSE},
1096 {Uri_HOST_IPV4,S_OK,FALSE},
1098 {URL_SCHEME_HTTP,S_OK,FALSE},
1099 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1103 { "http://4294967295/", 0, S_OK, FALSE,
1105 {"http://255.255.255.255/",S_OK,FALSE},
1106 {"255.255.255.255",S_OK,FALSE},
1107 {"http://255.255.255.255/",S_OK,FALSE},
1111 {"255.255.255.255",S_OK,FALSE},
1116 {"http://4294967295/",S_OK,FALSE},
1117 {"http",S_OK,FALSE},
1122 {Uri_HOST_IPV4,S_OK,FALSE},
1124 {URL_SCHEME_HTTP,S_OK,FALSE},
1125 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1129 { "http://4294967296/", 0, S_OK, FALSE,
1131 {"http://4294967296/",S_OK,FALSE},
1132 {"4294967296",S_OK,FALSE},
1133 {"http://4294967296/",S_OK,FALSE},
1137 {"4294967296",S_OK,FALSE},
1142 {"http://4294967296/",S_OK,FALSE},
1143 {"http",S_OK,FALSE},
1148 {Uri_HOST_DNS,S_OK,FALSE},
1150 {URL_SCHEME_HTTP,S_OK,FALSE},
1151 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1154 /* Window's doesn't normalize IP address for unknown schemes. */
1155 { "1234://4294967295/", 0, S_OK, FALSE,
1157 {"1234://4294967295/",S_OK,FALSE},
1158 {"4294967295",S_OK,FALSE},
1159 {"1234://4294967295/",S_OK,FALSE},
1163 {"4294967295",S_OK,FALSE},
1168 {"1234://4294967295/",S_OK,FALSE},
1169 {"1234",S_OK,FALSE},
1174 {Uri_HOST_IPV4,S_OK,FALSE},
1176 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1177 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1180 /* Window's doesn't normalize IP address for unknown schemes. */
1181 { "1234://127.001/", 0, S_OK, FALSE,
1183 {"1234://127.001/",S_OK,FALSE},
1184 {"127.001",S_OK,FALSE},
1185 {"1234://127.001/",S_OK,FALSE},
1189 {"127.001",S_OK,FALSE},
1194 {"1234://127.001/",S_OK,FALSE},
1195 {"1234",S_OK,FALSE},
1200 {Uri_HOST_IPV4,S_OK,FALSE},
1202 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1203 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1206 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1208 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1209 {"[fedc:ba98::3210]",S_OK,FALSE},
1210 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1214 {"fedc:ba98::3210",S_OK,FALSE},
1219 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1220 {"http",S_OK,FALSE},
1225 {Uri_HOST_IPV6,S_OK,FALSE},
1227 {URL_SCHEME_HTTP,S_OK,FALSE},
1228 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1231 { "http://[::]", 0, S_OK, FALSE,
1233 {"http://[::]/",S_OK,FALSE},
1234 {"[::]",S_OK,FALSE},
1235 {"http://[::]/",S_OK,FALSE},
1244 {"http://[::]",S_OK,FALSE},
1245 {"http",S_OK,FALSE},
1250 {Uri_HOST_IPV6,S_OK,FALSE},
1252 {URL_SCHEME_HTTP,S_OK,FALSE},
1253 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1256 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1258 {"http://[fedc:ba98::]/",S_OK,FALSE},
1259 {"[fedc:ba98::]",S_OK,FALSE},
1260 {"http://[fedc:ba98::]/",S_OK,FALSE},
1264 {"fedc:ba98::",S_OK,FALSE},
1269 {"http://[FEDC:BA98::]",S_OK,FALSE},
1270 {"http",S_OK,FALSE},
1275 {Uri_HOST_IPV6,S_OK,FALSE},
1277 {URL_SCHEME_HTTP,S_OK,FALSE},
1278 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1281 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1282 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1284 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1285 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1286 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1290 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1295 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1296 {"http",S_OK,FALSE},
1301 {Uri_HOST_IPV6,S_OK,FALSE},
1303 {URL_SCHEME_HTTP,S_OK,FALSE},
1304 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1307 { "http://[v2.34]/", 0, S_OK, FALSE,
1309 {"http://[v2.34]/",S_OK,FALSE},
1310 {"[v2.34]",S_OK,FALSE},
1311 {"http://[v2.34]/",S_OK,FALSE},
1315 {"[v2.34]",S_OK,FALSE},
1320 {"http://[v2.34]/",S_OK,FALSE},
1321 {"http",S_OK,FALSE},
1326 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1328 {URL_SCHEME_HTTP,S_OK,FALSE},
1329 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1332 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1333 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1335 {"http://[xyz:12345.com/test",S_OK,FALSE},
1336 {"[xyz:12345.com",S_OK,FALSE},
1337 {"http://[xyz:12345.com/test",S_OK,FALSE},
1338 {"[xyz:12345.com",S_OK,FALSE},
1341 {"[xyz:12345.com",S_OK,FALSE},
1343 {"/test",S_OK,FALSE},
1344 {"/test",S_OK,FALSE},
1346 {"http://[xyz:12345.com/test",S_OK,FALSE},
1347 {"http",S_OK,FALSE},
1352 {Uri_HOST_DNS,S_OK,FALSE},
1354 {URL_SCHEME_HTTP,S_OK,FALSE},
1355 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1358 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1359 * of the host name (respectively).
1361 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1363 {"ftp://www.[works].com/",S_OK,FALSE},
1364 {"www.[works].com",S_OK,FALSE},
1365 {"ftp://www.[works].com/",S_OK,FALSE},
1366 {"[works].com",S_OK,FALSE},
1369 {"www.[works].com",S_OK,FALSE},
1374 {"ftp://www.[works].com/",S_OK,FALSE},
1380 {Uri_HOST_DNS,S_OK,FALSE},
1382 {URL_SCHEME_FTP,S_OK,FALSE},
1383 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1386 /* Considers ':' a delimiter since it appears after the ']'. */
1387 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1389 {"http://www.google.com]:12345/",S_OK,FALSE},
1390 {"www.google.com]:12345",S_OK,FALSE},
1391 {"http://www.google.com]:12345/",S_OK,FALSE},
1392 {"google.com]",S_OK,FALSE},
1395 {"www.google.com]",S_OK,FALSE},
1400 {"http://www.google.com]:12345/",S_OK,FALSE},
1401 {"http",S_OK,FALSE},
1406 {Uri_HOST_DNS,S_OK,FALSE},
1408 {URL_SCHEME_HTTP,S_OK,FALSE},
1409 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1412 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1413 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1415 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1416 {"w%XXw%GEw.google.com",S_OK,FALSE},
1417 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1418 {"google.com",S_OK,FALSE},
1421 {"w%XXw%GEw.google.com",S_OK,FALSE},
1426 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1432 {Uri_HOST_DNS,S_OK,FALSE},
1434 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1435 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1438 /* Unknown scheme types hostname doesn't get lower cased. */
1439 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1441 {"zip://GOOGLE.com/",S_OK,FALSE},
1442 {"GOOGLE.com",S_OK,FALSE},
1443 {"zip://GOOGLE.com/",S_OK,FALSE},
1444 {"GOOGLE.com",S_OK,FALSE},
1447 {"GOOGLE.com",S_OK,FALSE},
1452 {"zip://GOOGLE.com/",S_OK,FALSE},
1458 {Uri_HOST_DNS,S_OK,FALSE},
1460 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1461 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1464 /* Hostname gets lower-cased for known scheme types. */
1465 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1467 {"http://www.google.com/",S_OK,FALSE},
1468 {"www.google.com",S_OK,FALSE},
1469 {"http://www.google.com/",S_OK,FALSE},
1470 {"google.com",S_OK,FALSE},
1473 {"www.google.com",S_OK,FALSE},
1478 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1479 {"http",S_OK,FALSE},
1484 {Uri_HOST_DNS,S_OK,FALSE},
1486 {URL_SCHEME_HTTP,S_OK,FALSE},
1487 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1490 /* Characters that get % encoded in the hostname also have their percent
1491 * encoded forms lower cased.
1493 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1495 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1496 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1497 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1498 {"%7cgoogle%7c.com",S_OK,FALSE},
1501 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1506 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1507 {"http",S_OK,FALSE},
1512 {Uri_HOST_DNS,S_OK,FALSE},
1514 {URL_SCHEME_HTTP,S_OK,FALSE},
1515 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1518 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1519 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1521 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1522 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1523 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1527 {"1:2:3:4:5:6::",S_OK,FALSE},
1532 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1533 {"http",S_OK,FALSE},
1538 {Uri_HOST_IPV6,S_OK,FALSE},
1540 {URL_SCHEME_HTTP,S_OK,FALSE},
1541 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1544 /* IPv4 addresses get normalized. */
1545 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1547 {"http://[::1.2.3.0]/",S_OK,FALSE},
1548 {"[::1.2.3.0]",S_OK,FALSE},
1549 {"http://[::1.2.3.0]/",S_OK,FALSE},
1553 {"::1.2.3.0",S_OK,FALSE},
1558 {"http://[::001.002.003.000]",S_OK,FALSE},
1559 {"http",S_OK,FALSE},
1564 {Uri_HOST_IPV6,S_OK,FALSE},
1566 {URL_SCHEME_HTTP,S_OK,FALSE},
1567 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1570 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1571 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1573 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1574 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1575 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1579 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1584 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1590 {Uri_HOST_IPV6,S_OK,FALSE},
1592 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1593 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1596 /* IPv4 address is converted into 2 h16 components. */
1597 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1599 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1600 {"[ffff::c0de:6f20]",S_OK,FALSE},
1601 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1605 {"ffff::c0de:6f20",S_OK,FALSE},
1610 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1611 {"http",S_OK,FALSE},
1616 {Uri_HOST_IPV6,S_OK,FALSE},
1618 {URL_SCHEME_HTTP,S_OK,FALSE},
1619 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1622 /* Max value for a port. */
1623 { "http://google.com:65535", 0, S_OK, FALSE,
1625 {"http://google.com:65535/",S_OK,FALSE},
1626 {"google.com:65535",S_OK,FALSE},
1627 {"http://google.com:65535/",S_OK,FALSE},
1628 {"google.com",S_OK,FALSE},
1631 {"google.com",S_OK,FALSE},
1636 {"http://google.com:65535",S_OK,FALSE},
1637 {"http",S_OK,FALSE},
1642 {Uri_HOST_DNS,S_OK,FALSE},
1644 {URL_SCHEME_HTTP,S_OK,FALSE},
1645 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1648 { "zip://google.com:65536", 0, S_OK, FALSE,
1650 {"zip://google.com:65536/",S_OK,FALSE},
1651 {"google.com:65536",S_OK,FALSE},
1652 {"zip://google.com:65536/",S_OK,FALSE},
1653 {"google.com:65536",S_OK,FALSE},
1656 {"google.com:65536",S_OK,FALSE},
1661 {"zip://google.com:65536",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://google.com:65536:25", 0, S_OK, FALSE,
1675 {"zip://google.com:65536:25/",S_OK,FALSE},
1676 {"google.com:65536:25",S_OK,FALSE},
1677 {"zip://google.com:65536:25/",S_OK,FALSE},
1678 {"google.com:65536:25",S_OK,FALSE},
1681 {"google.com:65536:25",S_OK,FALSE},
1686 {"zip://google.com:65536:25",S_OK,FALSE},
1692 {Uri_HOST_DNS,S_OK,FALSE},
1694 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1695 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1698 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1700 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1701 {"[::ffff]:abcd",S_OK,FALSE},
1702 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1706 {"[::ffff]:abcd",S_OK,FALSE},
1711 {"zip://[::ffff]:abcd",S_OK,FALSE},
1717 {Uri_HOST_DNS,S_OK,FALSE},
1719 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1720 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1723 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1725 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1726 {"127.0.0.1:abcd",S_OK,FALSE},
1727 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1728 {"0.1:abcd",S_OK,FALSE},
1731 {"127.0.0.1:abcd",S_OK,FALSE},
1736 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1742 {Uri_HOST_DNS,S_OK,FALSE},
1744 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1745 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1748 /* Port is just copied over. */
1749 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1751 {"http://google.com:00035",S_OK,FALSE},
1752 {"google.com:00035",S_OK,FALSE},
1753 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1754 {"google.com",S_OK,FALSE},
1757 {"google.com",S_OK,FALSE},
1762 {"http://google.com:00035",S_OK,FALSE},
1763 {"http",S_OK,FALSE},
1768 {Uri_HOST_DNS,S_OK,FALSE},
1770 {URL_SCHEME_HTTP,S_OK,FALSE},
1771 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1774 /* Default port is copied over. */
1775 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1777 {"http://google.com:80",S_OK,FALSE},
1778 {"google.com:80",S_OK,FALSE},
1779 {"http://google.com:80",S_OK,FALSE},
1780 {"google.com",S_OK,FALSE},
1783 {"google.com",S_OK,FALSE},
1788 {"http://google.com:80",S_OK,FALSE},
1789 {"http",S_OK,FALSE},
1794 {Uri_HOST_DNS,S_OK,FALSE},
1796 {URL_SCHEME_HTTP,S_OK,FALSE},
1797 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1800 { "http://google.com.uk", 0, S_OK, FALSE,
1802 {"http://google.com.uk/",S_OK,FALSE},
1803 {"google.com.uk",S_OK,FALSE},
1804 {"http://google.com.uk/",S_OK,FALSE},
1805 {"google.com.uk",S_OK,FALSE},
1808 {"google.com.uk",S_OK,FALSE},
1813 {"http://google.com.uk",S_OK,FALSE},
1814 {"http",S_OK,FALSE},
1819 {Uri_HOST_DNS,S_OK,FALSE},
1821 {URL_SCHEME_HTTP,S_OK,FALSE},
1822 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1825 { "http://google.com.com", 0, S_OK, FALSE,
1827 {"http://google.com.com/",S_OK,FALSE},
1828 {"google.com.com",S_OK,FALSE},
1829 {"http://google.com.com/",S_OK,FALSE},
1830 {"com.com",S_OK,FALSE},
1833 {"google.com.com",S_OK,FALSE},
1838 {"http://google.com.com",S_OK,FALSE},
1839 {"http",S_OK,FALSE},
1844 {Uri_HOST_DNS,S_OK,FALSE},
1846 {URL_SCHEME_HTTP,S_OK,FALSE},
1847 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1850 { "http://google.uk.1", 0, S_OK, FALSE,
1852 {"http://google.uk.1/",S_OK,FALSE},
1853 {"google.uk.1",S_OK,FALSE},
1854 {"http://google.uk.1/",S_OK,FALSE},
1855 {"google.uk.1",S_OK,FALSE},
1858 {"google.uk.1",S_OK,FALSE},
1863 {"http://google.uk.1",S_OK,FALSE},
1864 {"http",S_OK,FALSE},
1869 {Uri_HOST_DNS,S_OK,FALSE},
1871 {URL_SCHEME_HTTP,S_OK,FALSE},
1872 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1875 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1876 { "http://google.foo.uk", 0, S_OK, FALSE,
1878 {"http://google.foo.uk/",S_OK,FALSE},
1879 {"google.foo.uk",S_OK,FALSE},
1880 {"http://google.foo.uk/",S_OK,FALSE},
1881 {"foo.uk",S_OK,FALSE},
1884 {"google.foo.uk",S_OK,FALSE},
1889 {"http://google.foo.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://.com", 0, S_OK, FALSE,
1903 {"http://.com/",S_OK,FALSE},
1904 {".com",S_OK,FALSE},
1905 {"http://.com/",S_OK,FALSE},
1906 {".com",S_OK,FALSE},
1909 {".com",S_OK,FALSE},
1914 {"http://.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://.uk", 0, S_OK, FALSE,
1928 {"http://.uk/",S_OK,FALSE},
1930 {"http://.uk/",S_OK,FALSE},
1939 {"http://.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.com.[]", 0, S_OK, FALSE,
1953 {"http://www.co.google.com.[]/",S_OK,FALSE},
1954 {"www.co.google.com.[]",S_OK,FALSE},
1955 {"http://www.co.google.com.[]/",S_OK,FALSE},
1956 {"google.com.[]",S_OK,FALSE},
1959 {"www.co.google.com.[]",S_OK,FALSE},
1964 {"http://www.co.google.com.[]",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://co.uk", 0, S_OK, FALSE,
1978 {"http://co.uk/",S_OK,FALSE},
1979 {"co.uk",S_OK,FALSE},
1980 {"http://co.uk/",S_OK,FALSE},
1984 {"co.uk",S_OK,FALSE},
1989 {"http://co.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 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2003 {"http://www.co.google.us.test/",S_OK,FALSE},
2004 {"www.co.google.us.test",S_OK,FALSE},
2005 {"http://www.co.google.us.test/",S_OK,FALSE},
2006 {"us.test",S_OK,FALSE},
2009 {"www.co.google.us.test",S_OK,FALSE},
2014 {"http://www.co.google.us.test",S_OK,FALSE},
2015 {"http",S_OK,FALSE},
2020 {Uri_HOST_DNS,S_OK,FALSE},
2022 {URL_SCHEME_HTTP,S_OK,FALSE},
2023 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2026 { "http://gov.uk", 0, S_OK, FALSE,
2028 {"http://gov.uk/",S_OK,FALSE},
2029 {"gov.uk",S_OK,FALSE},
2030 {"http://gov.uk/",S_OK,FALSE},
2034 {"gov.uk",S_OK,FALSE},
2039 {"http://gov.uk",S_OK,FALSE},
2040 {"http",S_OK,FALSE},
2045 {Uri_HOST_DNS,S_OK,FALSE},
2047 {URL_SCHEME_HTTP,S_OK,FALSE},
2048 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2051 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2053 {"zip://www.google.com\\test",S_OK,FALSE},
2054 {"www.google.com\\test",S_OK,FALSE},
2055 {"zip://www.google.com\\test",S_OK,FALSE},
2056 {"google.com\\test",S_OK,FALSE},
2059 {"www.google.com\\test",S_OK,FALSE},
2064 {"zip://www.google.com\\test",S_OK,FALSE},
2070 {Uri_HOST_DNS,S_OK,FALSE},
2072 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2073 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2076 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2078 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2080 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2086 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2087 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2089 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2095 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2097 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2098 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2101 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2102 * are decoded and all '%' are encoded.
2104 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2106 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2108 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2110 {".mp3",S_OK,FALSE},
2114 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2115 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2117 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2118 {"file",S_OK,FALSE},
2123 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2125 {URL_SCHEME_FILE,S_OK,FALSE},
2126 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2129 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2130 * is decoded and only %'s in front of invalid hex digits are encoded.
2132 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2134 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2136 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2138 {".mp3",S_OK,FALSE},
2142 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2143 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2145 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2146 {"file",S_OK,FALSE},
2151 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2153 {URL_SCHEME_FILE,S_OK,FALSE},
2154 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2157 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2158 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2160 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2161 {"[::1.2.3.0]",S_OK,FALSE},
2162 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2166 {"::1.2.3.0",S_OK,FALSE},
2168 {"/%3F%23.T/test",S_OK,FALSE},
2169 {"/%3F%23.T/test",S_OK,FALSE},
2171 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2172 {"http",S_OK,FALSE},
2177 {Uri_HOST_IPV6,S_OK,FALSE},
2179 {URL_SCHEME_HTTP,S_OK,FALSE},
2180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2183 /* Forbidden characters are always encoded for file URIs. */
2184 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2186 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2188 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2190 {".mp3",S_OK,FALSE},
2194 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2195 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2197 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2198 {"file",S_OK,FALSE},
2203 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2205 {URL_SCHEME_FILE,S_OK,FALSE},
2206 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2209 /* Forbidden characters are never encoded for unknown scheme types. */
2210 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2212 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2213 {"4294967295",S_OK,FALSE},
2214 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2218 {"4294967295",S_OK,FALSE},
2220 {"/<|>\" test<|>",S_OK,FALSE},
2221 {"/<|>\" test<|>",S_OK,FALSE},
2223 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2224 {"1234",S_OK,FALSE},
2229 {Uri_HOST_IPV4,S_OK,FALSE},
2231 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2232 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2235 /* Make sure forbidden characters are percent encoded. */
2236 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2238 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2239 {"gov.uk",S_OK,FALSE},
2240 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2244 {"gov.uk",S_OK,FALSE},
2246 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2247 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2249 {"http://gov.uk/<|> test<|>",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/././../test3/.././././", 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/././../test3/.././././",S_OK,FALSE},
2275 {"http",S_OK,FALSE},
2280 {Uri_HOST_DNS,S_OK,FALSE},
2282 {URL_SCHEME_HTTP,S_OK,FALSE},
2283 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2286 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2288 {"http://gov.uk/",S_OK,FALSE},
2289 {"gov.uk",S_OK,FALSE},
2290 {"http://gov.uk/",S_OK,FALSE},
2294 {"gov.uk",S_OK,FALSE},
2299 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2300 {"http",S_OK,FALSE},
2305 {Uri_HOST_DNS,S_OK,FALSE},
2307 {URL_SCHEME_HTTP,S_OK,FALSE},
2308 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2311 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2313 {"http://gov.uk/",S_OK,FALSE},
2314 {"gov.uk",S_OK,FALSE},
2315 {"http://gov.uk/",S_OK,FALSE},
2319 {"gov.uk",S_OK,FALSE},
2324 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2325 {"http",S_OK,FALSE},
2330 {Uri_HOST_DNS,S_OK,FALSE},
2332 {URL_SCHEME_HTTP,S_OK,FALSE},
2333 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2336 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2338 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2340 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2342 {".mp3",S_OK,FALSE},
2346 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2347 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2349 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2350 {"file",S_OK,FALSE},
2355 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2357 {URL_SCHEME_FILE,S_OK,FALSE},
2358 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2361 /* Dot removal happens for unknown scheme types. */
2362 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2364 {"zip://gov.uk/",S_OK,FALSE},
2365 {"gov.uk",S_OK,FALSE},
2366 {"zip://gov.uk/",S_OK,FALSE},
2370 {"gov.uk",S_OK,FALSE},
2375 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2381 {Uri_HOST_DNS,S_OK,FALSE},
2383 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2384 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2387 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2388 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2390 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2391 {"gov.uk",S_OK,FALSE},
2392 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2396 {"gov.uk",S_OK,FALSE},
2398 {"/test/test2/../../.",S_OK,FALSE},
2399 {"/test/test2/../../.",S_OK,FALSE},
2401 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2402 {"http",S_OK,FALSE},
2407 {Uri_HOST_DNS,S_OK,FALSE},
2409 {URL_SCHEME_HTTP,S_OK,FALSE},
2410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2413 /* Dot removal doesn't happen for wildcard scheme types. */
2414 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2416 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2417 {"gov.uk",S_OK,FALSE},
2418 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2422 {"gov.uk",S_OK,FALSE},
2424 {"/test/test2/../../.",S_OK,FALSE},
2425 {"/test/test2/../../.",S_OK,FALSE},
2427 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2433 {Uri_HOST_DNS,S_OK,FALSE},
2435 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2436 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2439 /* Forbidden characters are encoded for opaque known scheme types. */
2440 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2442 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2444 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2446 {".com%22",S_OK,FALSE},
2450 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2451 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2453 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2454 {"mailto",S_OK,FALSE},
2459 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2461 {URL_SCHEME_MAILTO,S_OK,FALSE},
2462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2465 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2467 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2469 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2471 {".com",S_OK,FALSE},
2475 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2476 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2478 {"news:test.tes<|>t.com",S_OK,FALSE},
2479 {"news",S_OK,FALSE},
2484 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2486 {URL_SCHEME_NEWS,S_OK,FALSE},
2487 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2490 /* Don't encode forbidden characters. */
2491 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2493 {"news:test.tes<|>t.com",S_OK,FALSE},
2495 {"news:test.tes<|>t.com",S_OK,FALSE},
2497 {".com",S_OK,FALSE},
2501 {"test.tes<|>t.com",S_OK,FALSE},
2502 {"test.tes<|>t.com",S_OK,FALSE},
2504 {"news:test.tes<|>t.com",S_OK,FALSE},
2505 {"news",S_OK,FALSE},
2510 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2512 {URL_SCHEME_NEWS,S_OK,FALSE},
2513 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2516 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2517 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2519 {"urn:test.tes<|>t.com",S_OK,FALSE},
2521 {"urn:test.tes<|>t.com",S_OK,FALSE},
2523 {".com",S_OK,FALSE},
2527 {"test.tes<|>t.com",S_OK,FALSE},
2528 {"test.tes<|>t.com",S_OK,FALSE},
2530 {"urn:test.tes<|>t.com",S_OK,FALSE},
2536 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2538 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2539 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2542 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2543 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2545 {"news:test.test.com",S_OK,FALSE},
2547 {"news:test.test.com",S_OK,FALSE},
2549 {".com",S_OK,FALSE},
2553 {"test.test.com",S_OK,FALSE},
2554 {"test.test.com",S_OK,FALSE},
2556 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2557 {"news",S_OK,FALSE},
2562 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2564 {URL_SCHEME_NEWS,S_OK,FALSE},
2565 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2568 /* Percent encoded characters are still decoded for known scheme types. */
2569 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2571 {"news:test.test.com",S_OK,FALSE},
2573 {"news:test.test.com",S_OK,FALSE},
2575 {".com",S_OK,FALSE},
2579 {"test.test.com",S_OK,FALSE},
2580 {"test.test.com",S_OK,FALSE},
2582 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2583 {"news",S_OK,FALSE},
2588 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2590 {URL_SCHEME_NEWS,S_OK,FALSE},
2591 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2594 /* Percent encoded characters aren't decoded for unknown scheme types. */
2595 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2597 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2599 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2601 {".com",S_OK,FALSE},
2605 {"test.%74%65%73%74.com",S_OK,FALSE},
2606 {"test.%74%65%73%74.com",S_OK,FALSE},
2608 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2614 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2616 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2617 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2620 /* Unknown scheme types can have invalid % encoded data in query string. */
2621 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2623 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2624 {"www.winehq.org",S_OK,FALSE},
2625 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2626 {"winehq.org",S_OK,FALSE},
2629 {"www.winehq.org",S_OK,FALSE},
2632 {"/?query=%xx&return=y",S_OK,FALSE},
2633 {"?query=%xx&return=y",S_OK,FALSE},
2634 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2640 {Uri_HOST_DNS,S_OK,FALSE},
2642 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2643 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2646 /* Known scheme types can have invalid % encoded data with the right flags. */
2647 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2649 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2650 {"www.winehq.org",S_OK,FALSE},
2651 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2652 {"winehq.org",S_OK,FALSE},
2655 {"www.winehq.org",S_OK,FALSE},
2658 {"/?query=%xx&return=y",S_OK,FALSE},
2659 {"?query=%xx&return=y",S_OK,FALSE},
2660 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2661 {"http",S_OK,FALSE},
2666 {Uri_HOST_DNS,S_OK,FALSE},
2668 {URL_SCHEME_HTTP,S_OK,FALSE},
2669 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2672 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2673 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2675 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2676 {"www.winehq.org",S_OK,FALSE},
2677 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2678 {"winehq.org",S_OK,FALSE},
2681 {"www.winehq.org",S_OK,FALSE},
2684 {"/?query=<|>&return=y",S_OK,FALSE},
2685 {"?query=<|>&return=y",S_OK,FALSE},
2686 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2687 {"http",S_OK,FALSE},
2692 {Uri_HOST_DNS,S_OK,FALSE},
2694 {URL_SCHEME_HTTP,S_OK,FALSE},
2695 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2698 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2699 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2701 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2702 {"www.winehq.org",S_OK,FALSE},
2703 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2704 {"winehq.org",S_OK,FALSE},
2707 {"www.winehq.org",S_OK,FALSE},
2710 {"/?query=<|>&return=y",S_OK,FALSE},
2711 {"?query=<|>&return=y",S_OK,FALSE},
2712 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2713 {"http",S_OK,FALSE},
2718 {Uri_HOST_DNS,S_OK,FALSE},
2720 {URL_SCHEME_HTTP,S_OK,FALSE},
2721 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2724 /* Forbidden characters are encoded for known scheme types. */
2725 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2727 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2728 {"www.winehq.org",S_OK,FALSE},
2729 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2730 {"winehq.org",S_OK,FALSE},
2733 {"www.winehq.org",S_OK,FALSE},
2736 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2737 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2738 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2739 {"http",S_OK,FALSE},
2744 {Uri_HOST_DNS,S_OK,FALSE},
2746 {URL_SCHEME_HTTP,S_OK,FALSE},
2747 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2750 /* Forbidden characters are not encoded for unknown scheme types. */
2751 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2753 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2754 {"www.winehq.org",S_OK,FALSE},
2755 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2756 {"winehq.org",S_OK,FALSE},
2759 {"www.winehq.org",S_OK,FALSE},
2762 {"/?query=<|>&return=y",S_OK,FALSE},
2763 {"?query=<|>&return=y",S_OK,FALSE},
2764 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2770 {Uri_HOST_DNS,S_OK,FALSE},
2772 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2773 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2776 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2777 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2779 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2780 {"www.winehq.org",S_OK,FALSE},
2781 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2782 {"winehq.org",S_OK,FALSE},
2785 {"www.winehq.org",S_OK,FALSE},
2788 {"/?query=01&return=y",S_OK,FALSE},
2789 {"?query=01&return=y",S_OK,FALSE},
2790 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2791 {"http",S_OK,FALSE},
2796 {Uri_HOST_DNS,S_OK,FALSE},
2798 {URL_SCHEME_HTTP,S_OK,FALSE},
2799 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2802 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2803 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2805 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2806 {"www.winehq.org",S_OK,FALSE},
2807 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2808 {"winehq.org",S_OK,FALSE},
2811 {"www.winehq.org",S_OK,FALSE},
2814 {"/?query=%30%31&return=y",S_OK,FALSE},
2815 {"?query=%30%31&return=y",S_OK,FALSE},
2816 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2822 {Uri_HOST_DNS,S_OK,FALSE},
2824 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2825 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2828 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2829 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2831 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2832 {"www.winehq.org",S_OK,FALSE},
2833 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2834 {"winehq.org",S_OK,FALSE},
2837 {"www.winehq.org",S_OK,FALSE},
2840 {"/?query=%30%31&return=y",S_OK,FALSE},
2841 {"?query=%30%31&return=y",S_OK,FALSE},
2842 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2843 {"http",S_OK,FALSE},
2848 {Uri_HOST_DNS,S_OK,FALSE},
2850 {URL_SCHEME_HTTP,S_OK,FALSE},
2851 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2854 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2856 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2857 {"www.winehq.org",S_OK,FALSE},
2858 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2859 {"winehq.org",S_OK,FALSE},
2862 {"www.winehq.org",S_OK,FALSE},
2865 {"?query=12&return=y",S_OK,FALSE},
2866 {"?query=12&return=y",S_OK,FALSE},
2867 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2868 {"http",S_OK,FALSE},
2873 {Uri_HOST_DNS,S_OK,FALSE},
2875 {URL_SCHEME_HTTP,S_OK,FALSE},
2876 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2879 /* Unknown scheme types can have invalid % encoded data in fragments. */
2880 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2882 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2883 {"www.winehq.org",S_OK,FALSE},
2884 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2885 {"winehq.org",S_OK,FALSE},
2887 {"#Te%xx",S_OK,FALSE},
2888 {"www.winehq.org",S_OK,FALSE},
2890 {"/tests/",S_OK,FALSE},
2891 {"/tests/",S_OK,FALSE},
2893 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2899 {Uri_HOST_DNS,S_OK,FALSE},
2901 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2902 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2905 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2906 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2908 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2909 {"www.winehq.org",S_OK,FALSE},
2910 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2911 {"winehq.org",S_OK,FALSE},
2913 {"#Te<|>",S_OK,FALSE},
2914 {"www.winehq.org",S_OK,FALSE},
2916 {"/tests/",S_OK,FALSE},
2917 {"/tests/",S_OK,FALSE},
2919 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2925 {Uri_HOST_DNS,S_OK,FALSE},
2927 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2928 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2931 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2932 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2934 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2935 {"www.winehq.org",S_OK,FALSE},
2936 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2937 {"winehq.org",S_OK,FALSE},
2939 {"#Te%3C%7C%3E",S_OK,FALSE},
2940 {"www.winehq.org",S_OK,FALSE},
2942 {"/tests/",S_OK,FALSE},
2943 {"/tests/",S_OK,FALSE},
2945 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2946 {"http",S_OK,FALSE},
2951 {Uri_HOST_DNS,S_OK,FALSE},
2953 {URL_SCHEME_HTTP,S_OK,FALSE},
2954 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2957 /* Forbidden characters aren't encoded in the fragment with this flag. */
2958 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2960 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2961 {"www.winehq.org",S_OK,FALSE},
2962 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2963 {"winehq.org",S_OK,FALSE},
2965 {"#Te<|>",S_OK,FALSE},
2966 {"www.winehq.org",S_OK,FALSE},
2968 {"/tests/",S_OK,FALSE},
2969 {"/tests/",S_OK,FALSE},
2971 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2972 {"http",S_OK,FALSE},
2977 {Uri_HOST_DNS,S_OK,FALSE},
2979 {URL_SCHEME_HTTP,S_OK,FALSE},
2980 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2983 /* Forbidden characters aren't encoded in the fragment with this flag. */
2984 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2986 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2987 {"www.winehq.org",S_OK,FALSE},
2988 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2989 {"winehq.org",S_OK,FALSE},
2991 {"#Te<|>",S_OK,FALSE},
2992 {"www.winehq.org",S_OK,FALSE},
2994 {"/tests/",S_OK,FALSE},
2995 {"/tests/",S_OK,FALSE},
2997 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2998 {"http",S_OK,FALSE},
3003 {Uri_HOST_DNS,S_OK,FALSE},
3005 {URL_SCHEME_HTTP,S_OK,FALSE},
3006 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3009 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3010 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3012 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3013 {"www.winehq.org",S_OK,FALSE},
3014 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3015 {"winehq.org",S_OK,FALSE},
3017 {"#Te%30%31%32",S_OK,FALSE},
3018 {"www.winehq.org",S_OK,FALSE},
3020 {"/tests/",S_OK,FALSE},
3021 {"/tests/",S_OK,FALSE},
3023 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3029 {Uri_HOST_DNS,S_OK,FALSE},
3031 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3032 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3035 /* Percent encoded, unreserved characters are decoded for known schemes. */
3036 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3038 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3039 {"www.winehq.org",S_OK,FALSE},
3040 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3041 {"winehq.org",S_OK,FALSE},
3043 {"#Te012",S_OK,FALSE},
3044 {"www.winehq.org",S_OK,FALSE},
3046 {"/tests/",S_OK,FALSE},
3047 {"/tests/",S_OK,FALSE},
3049 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3050 {"http",S_OK,FALSE},
3055 {Uri_HOST_DNS,S_OK,FALSE},
3057 {URL_SCHEME_HTTP,S_OK,FALSE},
3058 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3061 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3062 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3064 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3065 {"www.winehq.org",S_OK,FALSE},
3066 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3067 {"winehq.org",S_OK,FALSE},
3069 {"#Te012",S_OK,FALSE},
3070 {"www.winehq.org",S_OK,FALSE},
3072 {"/tests/",S_OK,FALSE},
3073 {"/tests/",S_OK,FALSE},
3075 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3076 {"http",S_OK,FALSE},
3081 {Uri_HOST_DNS,S_OK,FALSE},
3083 {URL_SCHEME_HTTP,S_OK,FALSE},
3084 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3087 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3088 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3090 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3091 {"www.winehq.org",S_OK,FALSE},
3092 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3093 {"winehq.org",S_OK,FALSE},
3095 {"#Te%30%31%32",S_OK,FALSE},
3096 {"www.winehq.org",S_OK,FALSE},
3098 {"/tests/",S_OK,FALSE},
3099 {"/tests/",S_OK,FALSE},
3101 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3102 {"http",S_OK,FALSE},
3107 {Uri_HOST_DNS,S_OK,FALSE},
3109 {URL_SCHEME_HTTP,S_OK,FALSE},
3110 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3113 /* Leading/Trailing whitespace is removed. */
3114 { " http://google.com/ ", 0, S_OK, FALSE,
3116 {"http://google.com/",S_OK,FALSE},
3117 {"google.com",S_OK,FALSE},
3118 {"http://google.com/",S_OK,FALSE},
3119 {"google.com",S_OK,FALSE},
3122 {"google.com",S_OK,FALSE},
3127 {"http://google.com/",S_OK,FALSE},
3128 {"http",S_OK,FALSE},
3133 {Uri_HOST_DNS,S_OK,FALSE},
3135 {URL_SCHEME_HTTP,S_OK,FALSE},
3136 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3139 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3141 {"http://google.com/",S_OK,FALSE},
3142 {"google.com",S_OK,FALSE},
3143 {"http://google.com/",S_OK,FALSE},
3144 {"google.com",S_OK,FALSE},
3147 {"google.com",S_OK,FALSE},
3152 {"http://google.com/",S_OK,FALSE},
3153 {"http",S_OK,FALSE},
3158 {Uri_HOST_DNS,S_OK,FALSE},
3160 {URL_SCHEME_HTTP,S_OK,FALSE},
3161 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3164 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3166 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3167 {"g%0aoogle.co%0dm",S_OK,FALSE},
3168 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3169 {"g%0aoogle.co%0dm",S_OK,FALSE},
3172 {"g%0aoogle.co%0dm",S_OK,FALSE},
3174 {"/%0A%0A%0A",S_OK,FALSE},
3175 {"/%0A%0A%0A",S_OK,FALSE},
3177 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3178 {"http",S_OK,FALSE},
3183 {Uri_HOST_DNS,S_OK,FALSE},
3185 {URL_SCHEME_HTTP,S_OK,FALSE},
3186 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3189 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3191 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3192 {"g\noogle.co\rm",S_OK,FALSE},
3193 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3194 {"g\noogle.co\rm",S_OK,FALSE},
3197 {"g\noogle.co\rm",S_OK,FALSE},
3199 {"/\n\n\n",S_OK,FALSE},
3200 {"/\n\n\n",S_OK,FALSE},
3202 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3208 {Uri_HOST_DNS,S_OK,FALSE},
3210 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3211 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3214 /* Since file URLs are usually hierarchical, it returns an empty string
3215 * for the absolute URI property since it was declared as an opaque URI.
3217 { "file:index.html", 0, S_OK, FALSE,
3221 {"file:index.html",S_OK,FALSE},
3223 {".html",S_OK,FALSE},
3227 {"index.html",S_OK,FALSE},
3228 {"index.html",S_OK,FALSE},
3230 {"file:index.html",S_OK,FALSE},
3231 {"file",S_OK,FALSE},
3236 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3238 {URL_SCHEME_FILE,S_OK,FALSE},
3239 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3242 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3243 { "http:test.com/index.html", 0, S_OK, FALSE,
3247 {"http:test.com/index.html",S_OK,FALSE},
3249 {".html",S_OK,FALSE},
3253 {"test.com/index.html",S_OK,FALSE},
3254 {"test.com/index.html",S_OK,FALSE},
3256 {"http:test.com/index.html",S_OK,FALSE},
3257 {"http",S_OK,FALSE},
3262 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3264 {URL_SCHEME_HTTP,S_OK,FALSE},
3265 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3268 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3272 {"ftp:test.com/index.html",S_OK,FALSE},
3274 {".html",S_OK,FALSE},
3278 {"test.com/index.html",S_OK,FALSE},
3279 {"test.com/index.html",S_OK,FALSE},
3281 {"ftp:test.com/index.html",S_OK,FALSE},
3287 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3289 {URL_SCHEME_FTP,S_OK,FALSE},
3290 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3293 { "file://C|/test.mp3", 0, S_OK, FALSE,
3295 {"file:///C:/test.mp3",S_OK,FALSE},
3297 {"file:///C:/test.mp3",S_OK,FALSE},
3299 {".mp3",S_OK,FALSE},
3303 {"/C:/test.mp3",S_OK,FALSE},
3304 {"/C:/test.mp3",S_OK,FALSE},
3306 {"file://C|/test.mp3",S_OK,FALSE},
3307 {"file",S_OK,FALSE},
3312 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3314 {URL_SCHEME_FILE,S_OK,FALSE},
3315 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3318 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3320 {"file:///C:/test.mp3",S_OK,FALSE},
3322 {"file:///C:/test.mp3",S_OK,FALSE},
3324 {".mp3",S_OK,FALSE},
3328 {"/C:/test.mp3",S_OK,FALSE},
3329 {"/C:/test.mp3",S_OK,FALSE},
3331 {"file:///C|/test.mp3",S_OK,FALSE},
3332 {"file",S_OK,FALSE},
3337 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3339 {URL_SCHEME_FILE,S_OK,FALSE},
3340 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3343 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3346 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3348 {"file://c:\\dir\\index.html",S_OK,FALSE},
3350 {"file://c:\\dir\\index.html",S_OK,FALSE},
3352 {".html",S_OK,FALSE},
3356 {"c:\\dir\\index.html",S_OK,FALSE},
3357 {"c:\\dir\\index.html",S_OK,FALSE},
3359 {"file://c:/dir/index.html",S_OK,FALSE},
3360 {"file",S_OK,FALSE},
3365 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3367 {URL_SCHEME_FILE,S_OK,FALSE},
3368 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3371 /* Extra '/' after "file://" is removed. */
3372 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3374 {"file://c:\\dir\\index.html",S_OK,FALSE},
3376 {"file://c:\\dir\\index.html",S_OK,FALSE},
3378 {".html",S_OK,FALSE},
3382 {"c:\\dir\\index.html",S_OK,FALSE},
3383 {"c:\\dir\\index.html",S_OK,FALSE},
3385 {"file:///c:/dir/index.html",S_OK,FALSE},
3386 {"file",S_OK,FALSE},
3391 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3393 {URL_SCHEME_FILE,S_OK,FALSE},
3394 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3397 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3398 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3400 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3402 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3404 {".html",S_OK,FALSE},
3408 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3409 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3411 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3412 {"file",S_OK,FALSE},
3417 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3419 {URL_SCHEME_FILE,S_OK,FALSE},
3420 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3423 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3425 {"file://c:\\dir\\index.html",S_OK,FALSE},
3427 {"file://c:\\dir\\index.html",S_OK,FALSE},
3429 {".html",S_OK,FALSE},
3433 {"c:\\dir\\index.html",S_OK,FALSE},
3434 {"c:\\dir\\index.html",S_OK,FALSE},
3436 {"file://c|/dir\\index.html",S_OK,FALSE},
3437 {"file",S_OK,FALSE},
3442 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3444 {URL_SCHEME_FILE,S_OK,FALSE},
3445 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3448 /* The backslashes after the scheme name are converted to forward slashes. */
3449 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3451 {"file://c:\\dir\\index.html",S_OK,FALSE},
3453 {"file://c:\\dir\\index.html",S_OK,FALSE},
3455 {".html",S_OK,FALSE},
3459 {"c:\\dir\\index.html",S_OK,FALSE},
3460 {"c:\\dir\\index.html",S_OK,FALSE},
3462 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3463 {"file",S_OK,FALSE},
3468 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3470 {URL_SCHEME_FILE,S_OK,FALSE},
3471 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3474 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3476 {"file:///c:/dir/index.html",S_OK,FALSE},
3478 {"file:///c:/dir/index.html",S_OK,FALSE},
3480 {".html",S_OK,FALSE},
3484 {"/c:/dir/index.html",S_OK,FALSE},
3485 {"/c:/dir/index.html",S_OK,FALSE},
3487 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3488 {"file",S_OK,FALSE},
3493 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3495 {URL_SCHEME_FILE,S_OK,FALSE},
3496 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3499 { "http:\\\\google.com", 0, S_OK, FALSE,
3501 {"http://google.com/",S_OK,FALSE},
3502 {"google.com",S_OK,FALSE},
3503 {"http://google.com/",S_OK,FALSE},
3504 {"google.com",S_OK,FALSE},
3507 {"google.com",S_OK,FALSE},
3512 {"http:\\\\google.com",S_OK,FALSE},
3513 {"http",S_OK,FALSE},
3518 {Uri_HOST_DNS,S_OK,FALSE},
3520 {URL_SCHEME_HTTP,S_OK,FALSE},
3521 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3524 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3525 { "zip:\\\\google.com", 0, S_OK, FALSE,
3527 {"zip:\\\\google.com",S_OK,FALSE},
3529 {"zip:\\\\google.com",S_OK,FALSE},
3531 {".com",S_OK,FALSE},
3535 {"\\\\google.com",S_OK,FALSE},
3536 {"\\\\google.com",S_OK,FALSE},
3538 {"zip:\\\\google.com",S_OK,FALSE},
3544 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3546 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3547 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3550 /* Dot segments aren't removed. */
3551 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3553 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3555 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3557 {".html",S_OK,FALSE},
3561 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3562 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3564 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3565 {"file",S_OK,FALSE},
3570 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3572 {URL_SCHEME_FILE,S_OK,FALSE},
3573 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3576 /* Forbidden characters aren't percent encoded. */
3577 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3579 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3581 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3583 {".html",S_OK,FALSE},
3587 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3588 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3590 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3591 {"file",S_OK,FALSE},
3596 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3598 {URL_SCHEME_FILE,S_OK,FALSE},
3599 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3602 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3603 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3607 {"file:c:/dir/../../index.html",S_OK,FALSE},
3609 {".html",S_OK,FALSE},
3613 {"c:/dir/../../index.html",S_OK,FALSE},
3614 {"c:/dir/../../index.html",S_OK,FALSE},
3616 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3617 {"file",S_OK,FALSE},
3622 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3624 {URL_SCHEME_FILE,S_OK,FALSE},
3625 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3628 /* '/' are still converted to '\' even though it's an opaque URI. */
3629 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3633 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3635 {".html",S_OK,FALSE},
3639 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3640 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3642 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3643 {"file",S_OK,FALSE},
3648 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3650 {URL_SCHEME_FILE,S_OK,FALSE},
3651 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3654 /* Forbidden characters aren't percent encoded. */
3655 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3659 {"file:c:\\in^|dex.html",S_OK,FALSE},
3661 {".html",S_OK,FALSE},
3665 {"c:\\in^|dex.html",S_OK,FALSE},
3666 {"c:\\in^|dex.html",S_OK,FALSE},
3668 {"file:c:\\in^|dex.html",S_OK,FALSE},
3669 {"file",S_OK,FALSE},
3674 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3676 {URL_SCHEME_FILE,S_OK,FALSE},
3677 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3680 /* Doesn't have a UserName since the ':' appears at the beginning of the
3683 { "http://:password@gov.uk", 0, S_OK, FALSE,
3685 {"http://:password@gov.uk/",S_OK,FALSE},
3686 {":password@gov.uk",S_OK,FALSE},
3687 {"http://gov.uk/",S_OK,FALSE},
3691 {"gov.uk",S_OK,FALSE},
3692 {"password",S_OK,FALSE},
3696 {"http://:password@gov.uk",S_OK,FALSE},
3697 {"http",S_OK,FALSE},
3698 {":password",S_OK,FALSE},
3702 {Uri_HOST_DNS,S_OK,FALSE},
3704 {URL_SCHEME_HTTP,S_OK,FALSE},
3705 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3708 /* Has a UserName since the userinfo section doesn't contain a password. */
3709 { "http://@gov.uk", 0, S_OK, FALSE,
3711 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3712 {"@gov.uk",S_OK,FALSE},
3713 {"http://gov.uk/",S_OK,FALSE},
3717 {"gov.uk",S_OK,FALSE},
3722 {"http://@gov.uk",S_OK,FALSE},
3723 {"http",S_OK,FALSE},
3728 {Uri_HOST_DNS,S_OK,FALSE},
3730 {URL_SCHEME_HTTP,S_OK,FALSE},
3731 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3734 /* ":@" not included in the absolute URI. */
3735 { "http://:@gov.uk", 0, S_OK, FALSE,
3737 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3738 {":@gov.uk",S_OK,FALSE},
3739 {"http://gov.uk/",S_OK,FALSE},
3743 {"gov.uk",S_OK,FALSE},
3748 {"http://:@gov.uk",S_OK,FALSE},
3749 {"http",S_OK,FALSE},
3754 {Uri_HOST_DNS,S_OK,FALSE},
3756 {URL_SCHEME_HTTP,S_OK,FALSE},
3757 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3760 /* '@' is included because it's an unknown scheme type. */
3761 { "zip://@gov.uk", 0, S_OK, FALSE,
3763 {"zip://@gov.uk/",S_OK,FALSE},
3764 {"@gov.uk",S_OK,FALSE},
3765 {"zip://@gov.uk/",S_OK,FALSE},
3769 {"gov.uk",S_OK,FALSE},
3774 {"zip://@gov.uk",S_OK,FALSE},
3780 {Uri_HOST_DNS,S_OK,FALSE},
3782 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3783 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3786 /* ":@" are included because it's an unknown scheme type. */
3787 { "zip://:@gov.uk", 0, S_OK, FALSE,
3789 {"zip://:@gov.uk/",S_OK,FALSE},
3790 {":@gov.uk",S_OK,FALSE},
3791 {"zip://:@gov.uk/",S_OK,FALSE},
3795 {"gov.uk",S_OK,FALSE},
3800 {"zip://:@gov.uk",S_OK,FALSE},
3806 {Uri_HOST_DNS,S_OK,FALSE},
3808 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3809 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3812 { "about:blank", 0, S_OK, FALSE,
3814 {"about:blank",S_OK,FALSE},
3816 {"about:blank",S_OK,FALSE},
3822 {"blank",S_OK,FALSE},
3823 {"blank",S_OK,FALSE},
3825 {"about:blank",S_OK,FALSE},
3826 {"about",S_OK,FALSE},
3831 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3833 {URL_SCHEME_ABOUT,S_OK,FALSE},
3834 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3837 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3839 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3841 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3843 {".htm",S_OK,FALSE},
3847 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3848 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3850 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3856 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3858 {URL_SCHEME_MK,S_OK,FALSE},
3859 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3862 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3864 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3866 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3868 {".htm",S_OK,FALSE},
3872 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3873 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3875 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3881 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3883 {URL_SCHEME_MK,S_OK,FALSE},
3884 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3887 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3888 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3890 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3891 {"server",S_OK,FALSE},
3892 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3894 {".html",S_OK,FALSE},
3896 {"server",S_OK,FALSE},
3898 {"\\dir\\index.html",S_OK,FALSE},
3899 {"\\dir\\index.html",S_OK,FALSE},
3901 {"file://server/dir/index.html",S_OK,FALSE},
3902 {"file",S_OK,FALSE},
3907 {Uri_HOST_DNS,S_OK,FALSE},
3909 {URL_SCHEME_FILE,S_OK,FALSE},
3910 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3913 /* When CreateUri generates an IUri, it still displays the default port in the
3916 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3918 {"http://google.com:80/",S_OK,FALSE},
3919 {"google.com:80",S_OK,FALSE},
3920 {"http://google.com:80/",S_OK,FALSE},
3921 {"google.com",S_OK,FALSE},
3924 {"google.com",S_OK,FALSE},
3929 {"http://google.com:80/",S_OK,FALSE},
3930 {"http",S_OK,FALSE},
3935 {Uri_HOST_DNS,S_OK,FALSE},
3937 {URL_SCHEME_HTTP,S_OK,FALSE},
3938 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3941 /* For res URIs the host is everything up until the first '/'. */
3942 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3944 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3945 {"C:\\dir\\file.exe",S_OK,FALSE},
3946 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3948 {".html",S_OK,FALSE},
3950 {"C:\\dir\\file.exe",S_OK,FALSE},
3952 {"/DATA/test.html",S_OK,FALSE},
3953 {"/DATA/test.html",S_OK,FALSE},
3955 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3961 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3963 {URL_SCHEME_RES,S_OK,FALSE},
3964 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3967 /* Res URI can contain a '|' in the host name. */
3968 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
3970 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3971 {"c:\\di|r\\file.exe",S_OK,FALSE},
3972 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3976 {"c:\\di|r\\file.exe",S_OK,FALSE},
3978 {"/test",S_OK,FALSE},
3979 {"/test",S_OK,FALSE},
3981 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3987 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3989 {URL_SCHEME_RES,S_OK,FALSE},
3990 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3993 /* Res URIs can have invalid percent encoded values. */
3994 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
3996 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3997 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3998 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4002 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4004 {"/test",S_OK,FALSE},
4005 {"/test",S_OK,FALSE},
4007 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4013 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4015 {URL_SCHEME_RES,S_OK,FALSE},
4016 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4019 /* Res doesn't get forbidden characters percent encoded in it's path. */
4020 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4022 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4023 {"c:\\test",S_OK,FALSE},
4024 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4028 {"c:\\test",S_OK,FALSE},
4030 {"/tes<|>t",S_OK,FALSE},
4031 {"/tes<|>t",S_OK,FALSE},
4033 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4039 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4041 {URL_SCHEME_RES,S_OK,FALSE},
4042 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4045 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4047 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4049 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4051 {".jpg",S_OK,FALSE},
4055 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4056 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4058 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4064 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4066 {URL_SCHEME_MK,S_OK,FALSE},
4067 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4070 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4072 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4074 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4076 {".jpg",S_OK,FALSE},
4080 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4081 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4083 {"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 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4097 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4099 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4101 {".jpg",S_OK,FALSE},
4105 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4106 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4108 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4114 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4116 {URL_SCHEME_UNKNOWN,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:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4124 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4126 {".jpg",S_OK,FALSE},
4130 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4131 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4133 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4139 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4141 {URL_SCHEME_MK,S_OK,FALSE},
4142 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4145 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4147 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4149 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4151 {".jpg",S_OK,FALSE},
4155 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4156 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4158 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4164 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4166 {URL_SCHEME_MK,S_OK,FALSE},
4167 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4170 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4172 {"mk:images/xxx.jpg",S_OK,FALSE},
4174 {"mk:images/xxx.jpg",S_OK,FALSE},
4176 {".jpg",S_OK,FALSE},
4180 {"images/xxx.jpg",S_OK,FALSE},
4181 {"images/xxx.jpg",S_OK,FALSE},
4183 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4189 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4191 {URL_SCHEME_MK,S_OK,FALSE},
4192 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4195 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4214 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4216 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4217 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4220 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4239 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4241 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4242 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4245 { "javascript:void", 0, S_OK, FALSE,
4247 {"javascript:void",S_OK},
4249 {"javascript:void",S_OK},
4258 {"javascript:void",S_OK},
4259 {"javascript",S_OK},
4264 {Uri_HOST_UNKNOWN,S_OK},
4266 {URL_SCHEME_JAVASCRIPT,S_OK},
4267 {URLZONE_INVALID,E_NOTIMPL}
4270 { "javascript://undefined", 0, S_OK, FALSE,
4272 {"javascript://undefined",S_OK},
4274 {"javascript://undefined",S_OK},
4280 {"//undefined",S_OK},
4281 {"//undefined",S_OK},
4283 {"javascript://undefined",S_OK},
4284 {"javascript",S_OK},
4289 {Uri_HOST_UNKNOWN,S_OK},
4291 {URL_SCHEME_JAVASCRIPT,S_OK},
4292 {URLZONE_INVALID,E_NOTIMPL}
4295 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4297 {"javascript:escape('/\\?#?')",S_OK},
4299 {"javascript:escape('/\\?#?')",S_OK},
4305 {"escape('/\\?#?')",S_OK},
4306 {"escape('/\\?#?')",S_OK},
4308 {"JavaSCript:escape('/\\?#?')",S_OK},
4309 {"javascript",S_OK},
4314 {Uri_HOST_UNKNOWN,S_OK},
4316 {URL_SCHEME_JAVASCRIPT,S_OK},
4317 {URLZONE_INVALID,E_NOTIMPL}
4320 { "*://google.com", 0, S_OK, FALSE,
4322 {"*:google.com/",S_OK,FALSE},
4323 {"google.com",S_OK},
4324 {"*:google.com/",S_OK,FALSE},
4325 {"google.com",S_OK,FALSE},
4328 {"google.com",S_OK,FALSE},
4333 {"*://google.com",S_OK,FALSE},
4339 {Uri_HOST_DNS,S_OK,FALSE},
4341 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4342 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4345 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4347 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4349 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4355 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4356 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4358 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4364 {Uri_HOST_UNKNOWN,S_OK},
4366 {URL_SCHEME_MK,S_OK},
4367 {URLZONE_INVALID,E_NOTIMPL}
4372 typedef struct _invalid_uri {
4378 static const invalid_uri invalid_uri_tests[] = {
4379 /* Has to have a scheme name. */
4380 {"://www.winehq.org",0,FALSE},
4381 /* Window's doesn't like URI's which are implicitly file paths without the
4382 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4384 {"C:/test/test.mp3",0,FALSE},
4385 {"\\\\Server/test/test.mp3",0,FALSE},
4386 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4387 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4388 /* Invalid schemes. */
4389 {"*abcd://not.valid.com",0,FALSE},
4390 {"*a*b*c*d://not.valid.com",0,FALSE},
4391 /* Not allowed to have invalid % encoded data. */
4392 {"ftp://google.co%XX/",0,FALSE},
4393 /* To many h16 components. */
4394 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4395 /* Not enough room for IPv4 address. */
4396 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4397 /* Not enough h16 components. */
4398 {"http://[1:2:3:4]",0,FALSE},
4399 /* Not enough components including IPv4. */
4400 {"http://[1:192.0.1.0]",0,FALSE},
4401 /* Not allowed to have partial IPv4 in IPv6. */
4402 {"http://[::192.0]",0,FALSE},
4403 /* Can't have elision of 1 h16 at beginning of address. */
4404 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4405 /* Can't have elision of 1 h16 at end of address. */
4406 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4407 /* Expects a valid IP Literal. */
4408 {"ftp://[not.valid.uri]/",0,FALSE},
4409 /* Expects valid port for a known scheme type. */
4410 {"ftp://www.winehq.org:123fgh",0,FALSE},
4411 /* Port exceeds USHORT_MAX for known scheme type. */
4412 {"ftp://www.winehq.org:65536",0,FALSE},
4413 /* Invalid port with IPv4 address. */
4414 {"http://www.winehq.org:1abcd",0,FALSE},
4415 /* Invalid port with IPv6 address. */
4416 {"http://[::ffff]:32xy",0,FALSE},
4417 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4418 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4419 /* Not allowed to have invalid % encoded data in opaque URI path. */
4420 {"news:test%XX",0,FALSE},
4421 {"mailto:wine@winehq%G8.com",0,FALSE},
4422 /* Known scheme types can't have invalid % encoded data in query string. */
4423 {"http://google.com/?query=te%xx",0,FALSE},
4424 /* Invalid % encoded data in fragment of know scheme type. */
4425 {"ftp://google.com/#Test%xx",0,FALSE},
4426 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4427 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4428 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4429 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4430 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4431 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4432 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4433 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4434 /* res URIs aren't allowed to have forbidden dos path characters in the
4437 {"res://c:\\te<st\\test/test",0,FALSE},
4438 {"res://c:\\te>st\\test/test",0,FALSE},
4439 {"res://c:\\te\"st\\test/test",0,FALSE},
4440 {"res://c:\\test/te%xxst",0,FALSE}
4443 typedef struct _uri_equality {
4445 DWORD create_flags_a;
4447 DWORD create_flags_b;
4452 static const uri_equality equality_tests[] = {
4454 "HTTP://www.winehq.org/test dir/./",0,
4455 "http://www.winehq.org/test dir/../test dir/",0,
4459 /* http://www.winehq.org/test%20dir */
4460 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4461 "http://www.winehq.org/test dir",0,
4465 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4466 "file:///c:/test.mp3",0,
4470 "ftp://ftp.winehq.org/",0,
4471 "ftp://ftp.winehq.org",0,
4475 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4476 "ftp://ftp.winehq.org/t%45stB/",0,
4480 "http://google.com/TEST",0,
4481 "http://google.com/test",0,
4485 "http://GOOGLE.com/",0,
4486 "http://google.com/",0,
4489 /* Performs case insensitive compare of host names (for known scheme types). */
4491 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4492 "ftp://google.com/",0,
4496 "zip://GOOGLE.com/",0,
4497 "zip://google.com/",0,
4501 "file:///c:/TEST/TeST/",0,
4502 "file:///c:/test/test/",0,
4506 "file:///server/TEST",0,
4507 "file:///SERVER/TEST",0,
4511 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4512 "http://google.com/",0,
4516 "ftp://google.com:21/",0,
4517 "ftp://google.com/",0,
4521 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4522 "http://google.com/",0,
4526 "http://google.com:70/",0,
4527 "http://google.com:71/",0,
4531 "file:///c:/dir/file.txt", 0,
4532 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4536 "file:///c:/dir/file.txt", 0,
4537 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4541 "file:///c:/dir/file.txt", 0,
4542 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4546 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4547 "file:///c:/%20dir/file.txt", 0,
4551 "file:///c:/Dir/file.txt", 0,
4552 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4556 "file:///c:/dir/file.txt", 0,
4557 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4561 "file:///c:/dir/file.txt#a", 0,
4562 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4567 typedef struct _uri_with_fragment {
4569 const char* fragment;
4571 HRESULT create_expected;
4574 const char* expected_uri;
4576 } uri_with_fragment;
4578 static const uri_with_fragment uri_fragment_tests[] = {
4580 "http://google.com/","#fragment",0,S_OK,FALSE,
4581 "http://google.com/#fragment",FALSE
4584 "http://google.com/","fragment",0,S_OK,FALSE,
4585 "http://google.com/#fragment",FALSE
4588 "zip://test.com/","?test",0,S_OK,FALSE,
4589 "zip://test.com/#?test",FALSE
4591 /* The fragment can be empty. */
4593 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4594 "ftp://ftp.google.com/#",FALSE
4598 typedef struct _uri_builder_property {
4601 const char *expected_value;
4602 Uri_PROPERTY property;
4605 } uri_builder_property;
4607 typedef struct _uri_builder_port {
4615 typedef struct _uri_builder_str_property {
4616 const char* expected;
4619 } uri_builder_str_property;
4621 typedef struct _uri_builder_dword_property {
4625 } uri_builder_dword_property;
4627 typedef struct _uri_builder_test {
4630 HRESULT create_builder_expected;
4631 BOOL create_builder_todo;
4633 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4635 uri_builder_port port_prop;
4641 DWORD uri_simple_encode_flags;
4642 HRESULT uri_simple_hres;
4643 BOOL uri_simple_todo;
4645 DWORD uri_with_flags;
4646 DWORD uri_with_builder_flags;
4647 DWORD uri_with_encode_flags;
4648 HRESULT uri_with_hres;
4651 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4652 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4655 static const uri_builder_test uri_builder_tests[] = {
4656 { "http://google.com/",0,S_OK,FALSE,
4658 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4659 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4660 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4661 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4668 {"http://username:password@google.com/?query=x#fragment",S_OK},
4669 {"username:password@google.com",S_OK},
4670 {"http://google.com/?query=x#fragment",S_OK},
4671 {"google.com",S_OK},
4674 {"google.com",S_OK},
4679 {"http://username:password@google.com/?query=x#fragment",S_OK},
4681 {"username:password",S_OK},
4685 {Uri_HOST_DNS,S_OK},
4687 {URL_SCHEME_HTTP,S_OK},
4688 {URLZONE_INVALID,E_NOTIMPL}
4691 { "http://google.com/",0,S_OK,FALSE,
4693 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4695 {TRUE,TRUE,120,S_OK,FALSE},
4700 {"test://google.com:120/",S_OK},
4701 {"google.com:120",S_OK},
4702 {"test://google.com:120/",S_OK},
4703 {"google.com",S_OK},
4706 {"google.com",S_OK},
4711 {"test://google.com:120/",S_OK},
4717 {Uri_HOST_DNS,S_OK},
4719 {URL_SCHEME_UNKNOWN,S_OK},
4720 {URLZONE_INVALID,E_NOTIMPL}
4723 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4725 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4726 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4727 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4734 {"http://[::192.2.3.4]/",S_OK},
4735 {"[::192.2.3.4]",S_OK},
4736 {"http://[::192.2.3.4]/",S_OK},
4740 {"::192.2.3.4",S_OK},
4745 {"http://[::192.2.3.4]/",S_OK},
4751 {Uri_HOST_IPV6,S_OK},
4753 {URL_SCHEME_HTTP,S_OK},
4754 {URLZONE_INVALID,E_NOTIMPL}
4757 { "http://google.com/",0,S_OK,FALSE,
4759 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4766 {"http://google.com/#Frag",S_OK},
4767 {"google.com",S_OK},
4768 {"http://google.com/#Frag",S_OK},
4769 {"google.com",S_OK},
4772 {"google.com",S_OK},
4777 {"http://google.com/#Frag",S_OK},
4783 {Uri_HOST_DNS,S_OK},
4785 {URL_SCHEME_HTTP,S_OK},
4786 {URLZONE_INVALID,E_NOTIMPL}
4789 { "http://google.com/",0,S_OK,FALSE,
4791 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4798 {"http://google.com/#",S_OK},
4799 {"google.com",S_OK},
4800 {"http://google.com/#",S_OK},
4801 {"google.com",S_OK},
4804 {"google.com",S_OK},
4809 {"http://google.com/#",S_OK},
4815 {Uri_HOST_DNS,S_OK},
4817 {URL_SCHEME_HTTP,S_OK},
4818 {URLZONE_INVALID,E_NOTIMPL}
4821 { "http://google.com/",0,S_OK,FALSE,
4823 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4830 {"http://::password@google.com/",S_OK},
4831 {"::password@google.com",S_OK},
4832 {"http://google.com/",S_OK},
4833 {"google.com",S_OK},
4836 {"google.com",S_OK},
4841 {"http://::password@google.com/",S_OK},
4843 {"::password",S_OK},
4847 {Uri_HOST_DNS,S_OK},
4849 {URL_SCHEME_HTTP,S_OK},
4850 {URLZONE_INVALID,E_NOTIMPL}
4853 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4855 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4858 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4860 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4862 {":password@test/test",S_OK},
4863 {":password@",S_OK},
4864 {":password@test/test",S_OK},
4873 {":password@test/test",S_OK},
4879 {Uri_HOST_UNKNOWN,S_OK},
4881 {URL_SCHEME_UNKNOWN,S_OK},
4882 {URLZONE_INVALID,E_NOTIMPL}
4885 { "http://google.com/",0,S_OK,FALSE,
4887 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4894 {"http://google.com/test/test",S_OK},
4895 {"google.com",S_OK},
4896 {"http://google.com/test/test",S_OK},
4897 {"google.com",S_OK},
4900 {"google.com",S_OK},
4902 {"/test/test",S_OK},
4903 {"/test/test",S_OK},
4905 {"http://google.com/test/test",S_OK},
4911 {Uri_HOST_DNS,S_OK},
4913 {URL_SCHEME_HTTP,S_OK},
4914 {URLZONE_INVALID,E_NOTIMPL}
4917 { "zip:testing/test",0,S_OK,FALSE,
4919 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4943 {Uri_HOST_UNKNOWN,S_OK},
4945 {URL_SCHEME_UNKNOWN,S_OK},
4946 {URLZONE_INVALID,E_NOTIMPL}
4949 { "http://google.com/",0,S_OK,FALSE,
4953 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4954 {TRUE,FALSE,555,S_OK,FALSE},
4959 {"http://google.com/",S_OK},
4960 {"google.com",S_OK},
4961 {"http://google.com/",S_OK},
4962 {"google.com",S_OK},
4965 {"google.com",S_OK},
4970 {"http://google.com/",S_OK},
4976 {Uri_HOST_DNS,S_OK},
4977 /* Still returns 80, even though earlier the port was disabled. */
4979 {URL_SCHEME_HTTP,S_OK},
4980 {URLZONE_INVALID,E_NOTIMPL}
4983 { "http://google.com/",0,S_OK,FALSE,
4987 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4988 * you'll get 122345 instead.
4990 {TRUE,122345,222,S_OK,FALSE},
4995 {"http://google.com:222/",S_OK},
4996 {"google.com:222",S_OK},
4997 {"http://google.com:222/",S_OK},
4998 {"google.com",S_OK},
5001 {"google.com",S_OK},
5006 {"http://google.com:222/",S_OK},
5012 {Uri_HOST_DNS,S_OK},
5014 {URL_SCHEME_HTTP,S_OK},
5015 {URLZONE_INVALID,E_NOTIMPL}
5018 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5019 { "http://google.com/",0,S_OK,FALSE,
5023 {TRUE,TRUE,999999,S_OK,FALSE},
5028 {"http://google.com:999999/",S_OK},
5029 {"google.com:999999",S_OK},
5030 {"http://google.com:999999/",S_OK},
5031 {"google.com",S_OK},
5034 {"google.com",S_OK},
5039 {"http://google.com:999999/",S_OK},
5045 {Uri_HOST_DNS,S_OK},
5047 {URL_SCHEME_HTTP,S_OK},
5048 {URLZONE_INVALID,E_NOTIMPL}
5051 { "http://google.com/",0,S_OK,FALSE,
5053 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5061 {"http://google.com/?test",S_OK},
5062 {"google.com",S_OK},
5063 {"http://google.com/?test",S_OK},
5064 {"google.com",S_OK},
5067 {"google.com",S_OK},
5072 {"http://google.com/?test",S_OK},
5078 {Uri_HOST_DNS,S_OK},
5080 {URL_SCHEME_HTTP,S_OK},
5081 {URLZONE_INVALID,E_NOTIMPL}
5084 { "http://:password@google.com/",0,S_OK,FALSE,
5093 {"http://:password@google.com/",S_OK},
5094 {":password@google.com",S_OK},
5095 {"http://google.com/",S_OK},
5096 {"google.com",S_OK},
5099 {"google.com",S_OK},
5104 {"http://:password@google.com/",S_OK},
5110 {Uri_HOST_DNS,S_OK},
5112 {URL_SCHEME_HTTP,S_OK},
5113 {URLZONE_INVALID,E_NOTIMPL}
5116 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5117 { NULL,0,S_OK,FALSE,
5119 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5120 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5127 {"http://google.com/",S_OK},
5128 {"google.com",S_OK},
5129 {"http://google.com/",S_OK},
5130 {"google.com",S_OK},
5133 {"google.com",S_OK},
5138 {"http://google.com/",S_OK},
5144 {Uri_HOST_DNS,S_OK},
5146 {URL_SCHEME_HTTP,S_OK},
5147 {URLZONE_INVALID,E_NOTIMPL}
5150 /* Can't set the scheme name to NULL. */
5151 { "zip://google.com/",0,S_OK,FALSE,
5153 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5160 {"zip://google.com/",S_OK},
5161 {"google.com",S_OK},
5162 {"zip://google.com/",S_OK},
5163 {"google.com",S_OK},
5166 {"google.com",S_OK},
5171 {"zip://google.com/",S_OK},
5177 {Uri_HOST_DNS,S_OK},
5179 {URL_SCHEME_UNKNOWN,S_OK},
5180 {URLZONE_INVALID,E_NOTIMPL}
5183 /* Can't set the scheme name to an empty string. */
5184 { "zip://google.com/",0,S_OK,FALSE,
5186 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5193 {"zip://google.com/",S_OK},
5194 {"google.com",S_OK},
5195 {"zip://google.com/",S_OK},
5196 {"google.com",S_OK},
5199 {"google.com",S_OK},
5204 {"zip://google.com/",S_OK},
5210 {Uri_HOST_DNS,S_OK},
5212 {URL_SCHEME_UNKNOWN,S_OK},
5213 {URLZONE_INVALID,E_NOTIMPL}
5216 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5217 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5219 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5224 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5226 {"http://google.com/../../",S_OK},
5227 {"google.com",S_OK},
5228 {"http://google.com/../../",S_OK},
5229 {"google.com",S_OK},
5232 {"google.com",S_OK},
5237 {"http://google.com/../../",S_OK},
5243 {Uri_HOST_DNS,S_OK},
5245 {URL_SCHEME_HTTP,S_OK},
5246 {URLZONE_INVALID,E_NOTIMPL}
5249 { "http://google.com/",0,S_OK,FALSE,
5251 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5256 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5258 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5259 {"google.com",S_OK},
5260 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5261 {"google.com",S_OK},
5263 {"#Fr%3C%7C%3Eg",S_OK},
5264 {"google.com",S_OK},
5269 {"http://google.com/#Fr<|>g",S_OK},
5275 {Uri_HOST_DNS,S_OK},
5277 {URL_SCHEME_HTTP,S_OK},
5278 {URLZONE_INVALID,E_NOTIMPL}
5281 { "http://google.com/",0,S_OK,FALSE,
5283 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5286 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5288 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5290 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5291 {"google.com",S_OK},
5292 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5293 {"google.com",S_OK},
5295 {"#Fr%3C%7C%3Eg",S_OK},
5296 {"google.com",S_OK},
5301 {"http://google.com/#Fr<|>g",S_OK},
5307 {Uri_HOST_DNS,S_OK},
5309 {URL_SCHEME_HTTP,S_OK},
5310 {URLZONE_INVALID,E_NOTIMPL}
5313 { NULL,0,S_OK,FALSE,
5315 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5316 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5319 0,INET_E_INVALID_URL,FALSE,
5320 0,INET_E_INVALID_URL,FALSE,
5321 0,0,0,INET_E_INVALID_URL,FALSE
5323 { "http://google.com/",0,S_OK,FALSE,
5325 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5328 0,INET_E_INVALID_URL,FALSE,
5329 0,INET_E_INVALID_URL,FALSE,
5330 0,0,0,INET_E_INVALID_URL,FALSE
5332 /* File scheme's can't have a username set. */
5333 { "file://google.com/",0,S_OK,FALSE,
5335 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5338 0,INET_E_INVALID_URL,FALSE,
5339 0,INET_E_INVALID_URL,FALSE,
5340 0,0,0,INET_E_INVALID_URL,FALSE
5342 /* File schemes can't have a password set. */
5343 { "file://google.com/",0,S_OK,FALSE,
5345 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5348 0,INET_E_INVALID_URL,FALSE,
5349 0,INET_E_INVALID_URL,FALSE,
5350 0,0,0,INET_E_INVALID_URL,FALSE
5352 /* UserName can't contain any character that is a delimeter for another
5353 * component that appears after it in a normal URI.
5355 { "http://google.com/",0,S_OK,FALSE,
5357 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,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,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,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,"user/path",NULL,Uri_PROPERTY_USER_NAME,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
5382 { "http://google.com/",0,S_OK,FALSE,
5384 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5387 0,INET_E_INVALID_URL,FALSE,
5388 0,INET_E_INVALID_URL,FALSE,
5389 0,0,0,INET_E_INVALID_URL,FALSE
5391 { "http://google.com/",0,S_OK,FALSE,
5393 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5396 0,INET_E_INVALID_URL,FALSE,
5397 0,INET_E_INVALID_URL,FALSE,
5398 0,0,0,INET_E_INVALID_URL,FALSE
5400 { "http://google.com/",0,S_OK,FALSE,
5402 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5405 0,INET_E_INVALID_URL,FALSE,
5406 0,INET_E_INVALID_URL,FALSE,
5407 0,0,0,INET_E_INVALID_URL,FALSE
5409 { "http://google.com/",0,S_OK,FALSE,
5411 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5414 0,INET_E_INVALID_URL,FALSE,
5415 0,INET_E_INVALID_URL,FALSE,
5416 0,0,0,INET_E_INVALID_URL,FALSE
5418 { "http://google.com/",0,S_OK,FALSE,
5420 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5423 0,INET_E_INVALID_URL,FALSE,
5424 0,INET_E_INVALID_URL,FALSE,
5425 0,0,0,INET_E_INVALID_URL,FALSE
5427 { "http://google.com/",0,S_OK,FALSE,
5429 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5432 0,INET_E_INVALID_URL,FALSE,
5433 0,INET_E_INVALID_URL,FALSE,
5434 0,0,0,INET_E_INVALID_URL,FALSE
5436 { "http://google.com/",0,S_OK,FALSE,
5438 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5441 0,INET_E_INVALID_URL,FALSE,
5442 0,INET_E_INVALID_URL,FALSE,
5443 0,0,0,INET_E_INVALID_URL,FALSE
5445 { "http://google.com/",0,S_OK,FALSE,
5447 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5450 0,INET_E_INVALID_URL,FALSE,
5451 0,INET_E_INVALID_URL,FALSE,
5452 0,0,0,INET_E_INVALID_URL,FALSE
5454 { "http://google.com/",0,S_OK,FALSE,
5456 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5459 0,INET_E_INVALID_URL,FALSE,
5460 0,INET_E_INVALID_URL,FALSE,
5461 0,0,0,INET_E_INVALID_URL,FALSE
5463 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5464 { "http://google.com/",0,S_OK,FALSE,
5466 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5473 {"http://winehq.org:test/",S_OK},
5474 {"winehq.org:test",S_OK},
5475 {"http://winehq.org:test/",S_OK},
5476 {"winehq.org:test",S_OK},
5479 {"winehq.org:test",S_OK},
5484 {"http://winehq.org:test/",S_OK},
5490 {Uri_HOST_DNS,S_OK},
5492 {URL_SCHEME_HTTP,S_OK},
5493 {URLZONE_INVALID,E_NOTIMPL}
5496 /* Can't set the host name to NULL. */
5497 { "http://google.com/",0,S_OK,FALSE,
5499 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5506 {"http://google.com/",S_OK},
5507 {"google.com",S_OK},
5508 {"http://google.com/",S_OK},
5509 {"google.com",S_OK},
5512 {"google.com",S_OK},
5517 {"http://google.com/",S_OK},
5523 {Uri_HOST_DNS,S_OK},
5525 {URL_SCHEME_HTTP,S_OK},
5526 {URLZONE_INVALID,E_NOTIMPL}
5529 /* Can set the host name to an empty string. */
5530 { "http://google.com/",0,S_OK,FALSE,
5532 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5556 {Uri_HOST_UNKNOWN,S_OK},
5558 {URL_SCHEME_HTTP,S_OK},
5559 {URLZONE_INVALID,E_NOTIMPL}
5562 { "http://google.com/",0,S_OK,FALSE,
5564 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5567 0,INET_E_INVALID_URL,FALSE,
5568 0,INET_E_INVALID_URL,FALSE,
5569 0,0,0,INET_E_INVALID_URL,FALSE
5571 { "http://google.com/",0,S_OK,FALSE,
5573 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5576 0,INET_E_INVALID_URL,FALSE,
5577 0,INET_E_INVALID_URL,FALSE,
5578 0,0,0,INET_E_INVALID_URL,FALSE
5580 { "http://google.com/",0,S_OK,FALSE,
5582 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5585 0,INET_E_INVALID_URL,FALSE,
5586 0,INET_E_INVALID_URL,FALSE,
5587 0,0,0,INET_E_INVALID_URL,FALSE
5589 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5591 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5598 {"file:///c:/dir/file.html",S_OK},
5600 {"file:///c:/dir/file.html",S_OK},
5606 {"/c:/dir/file.html",S_OK},
5607 {"/c:/dir/file.html",S_OK},
5609 {"file:///c:/dir/file.html",S_OK},
5615 {Uri_HOST_UNKNOWN,S_OK},
5617 {URL_SCHEME_FILE,S_OK},
5618 {URLZONE_INVALID,E_NOTIMPL}
5621 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5623 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5630 {"file:///c:/dir/file.html#",S_OK},
5632 {"file:///c:/dir/file.html#",S_OK},
5638 {"/c:/dir/file.html",S_OK},
5639 {"/c:/dir/file.html",S_OK},
5641 {"file:///c:/dir/file.html#",S_OK},
5647 {Uri_HOST_UNKNOWN,S_OK},
5649 {URL_SCHEME_FILE,S_OK},
5650 {URLZONE_INVALID,E_NOTIMPL}
5655 typedef struct _uri_builder_remove_test {
5658 HRESULT create_builder_expected;
5659 BOOL create_builder_todo;
5661 DWORD remove_properties;
5662 HRESULT remove_expected;
5665 const char *expected_uri;
5666 DWORD expected_flags;
5667 HRESULT expected_hres;
5669 } uri_builder_remove_test;
5671 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5672 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5673 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5674 "http://google.com/",0,S_OK,FALSE
5676 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5677 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5678 "http://winehq.org/",0,S_OK,FALSE
5680 { "zip://google.com?Test=x",0,S_OK,FALSE,
5681 Uri_HAS_HOST,S_OK,FALSE,
5682 "zip:/?Test=x",0,S_OK,FALSE
5684 /* Doesn't remove the whole userinfo component. */
5685 { "http://username:pass@google.com/",0,S_OK,FALSE,
5686 Uri_HAS_USER_INFO,S_OK,FALSE,
5687 "http://username:pass@google.com/",0,S_OK,FALSE
5689 /* Doesn't remove the domain. */
5690 { "http://google.com/",0,S_OK,FALSE,
5691 Uri_HAS_DOMAIN,S_OK,FALSE,
5692 "http://google.com/",0,S_OK,FALSE
5694 { "http://google.com:120/",0,S_OK,FALSE,
5695 Uri_HAS_AUTHORITY,S_OK,FALSE,
5696 "http://google.com:120/",0,S_OK,FALSE
5698 { "http://google.com/test.com/",0,S_OK,FALSE,
5699 Uri_HAS_EXTENSION,S_OK,FALSE,
5700 "http://google.com/test.com/",0,S_OK,FALSE
5702 { "http://google.com/?test=x",0,S_OK,FALSE,
5703 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5704 "http://google.com/?test=x",0,S_OK,FALSE
5706 /* Can't remove the scheme name. */
5707 { "http://google.com/?test=x",0,S_OK,FALSE,
5708 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5709 "http://google.com/?test=x",0,S_OK,FALSE
5713 typedef struct _uri_combine_str_property {
5717 const char *broken_value;
5718 const char *value_ex;
5719 } uri_combine_str_property;
5721 typedef struct _uri_combine_test {
5722 const char *base_uri;
5723 DWORD base_create_flags;
5724 const char *relative_uri;
5725 DWORD relative_create_flags;
5726 DWORD combine_flags;
5730 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5731 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5734 static const uri_combine_test uri_combine_tests[] = {
5735 { "http://google.com/fun/stuff",0,
5736 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5739 {"http://google.com/not/fun/stuff",S_OK},
5740 {"google.com",S_OK},
5741 {"http://google.com/not/fun/stuff",S_OK},
5742 {"google.com",S_OK},
5745 {"google.com",S_OK},
5747 {"/not/fun/stuff",S_OK},
5748 {"/not/fun/stuff",S_OK},
5750 {"http://google.com/not/fun/stuff",S_OK},
5756 {Uri_HOST_DNS,S_OK},
5758 {URL_SCHEME_HTTP,S_OK},
5759 {URLZONE_INVALID,E_NOTIMPL}
5762 { "http://google.com/test",0,
5763 "zip://test.com/cool",0,
5766 {"zip://test.com/cool",S_OK},
5768 {"zip://test.com/cool",S_OK},
5777 {"zip://test.com/cool",S_OK},
5783 {Uri_HOST_DNS,S_OK},
5785 {URL_SCHEME_UNKNOWN,S_OK},
5786 {URLZONE_INVALID,E_NOTIMPL}
5789 { "http://google.com/use/base/path",0,
5790 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5793 {"http://google.com/use/base/path?relative",S_OK},
5794 {"google.com",S_OK},
5795 {"http://google.com/use/base/path?relative",S_OK},
5796 {"google.com",S_OK},
5799 {"google.com",S_OK},
5801 {"/use/base/path",S_OK},
5802 {"/use/base/path?relative",S_OK},
5804 {"http://google.com/use/base/path?relative",S_OK},
5810 {Uri_HOST_DNS,S_OK},
5812 {URL_SCHEME_HTTP,S_OK},
5813 {URLZONE_INVALID,E_NOTIMPL}
5816 { "http://google.com/path",0,
5817 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5820 {"http://google.com/testing",S_OK},
5821 {"google.com",S_OK},
5822 {"http://google.com/testing",S_OK},
5823 {"google.com",S_OK},
5826 {"google.com",S_OK},
5831 {"http://google.com/testing",S_OK},
5837 {Uri_HOST_DNS,S_OK},
5839 {URL_SCHEME_HTTP,S_OK},
5840 {URLZONE_INVALID,E_NOTIMPL}
5843 { "http://google.com/path",0,
5844 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5845 URL_DONT_SIMPLIFY,S_OK,FALSE,
5847 {"http://google.com:80/test/../test/.././testing",S_OK},
5848 {"google.com",S_OK},
5849 {"http://google.com:80/test/../test/.././testing",S_OK},
5850 {"google.com",S_OK},
5853 {"google.com",S_OK},
5855 {"/test/../test/.././testing",S_OK},
5856 {"/test/../test/.././testing",S_OK},
5858 {"http://google.com:80/test/../test/.././testing",S_OK},
5864 {Uri_HOST_DNS,S_OK},
5866 {URL_SCHEME_HTTP,S_OK},
5867 {URLZONE_INVALID,E_NOTIMPL}
5870 { "http://winehq.org/test/abc",0,
5871 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5874 {"http://winehq.org/test/testing/test",S_OK},
5875 {"winehq.org",S_OK},
5876 {"http://winehq.org/test/testing/test",S_OK},
5877 {"winehq.org",S_OK},
5880 {"winehq.org",S_OK},
5882 {"/test/testing/test",S_OK},
5883 {"/test/testing/test",S_OK},
5885 {"http://winehq.org/test/testing/test",S_OK},
5891 {Uri_HOST_DNS,S_OK},
5893 {URL_SCHEME_HTTP,S_OK},
5894 {URLZONE_INVALID,E_NOTIMPL}
5897 { "http://winehq.org/test/abc",0,
5898 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5899 URL_DONT_SIMPLIFY,S_OK,FALSE,
5901 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5902 /* Default port is hidden in the authority. */
5903 {"winehq.org",S_OK},
5904 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5905 {"winehq.org",S_OK},
5908 {"winehq.org",S_OK},
5910 {"/test/testing/abc/../test",S_OK},
5911 {"/test/testing/abc/../test",S_OK},
5913 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5919 {Uri_HOST_DNS,S_OK},
5921 {URL_SCHEME_HTTP,S_OK},
5922 {URLZONE_INVALID,E_NOTIMPL}
5925 { "http://winehq.org/test?query",0,
5926 "testing",Uri_CREATE_ALLOW_RELATIVE,
5929 {"http://winehq.org/testing",S_OK},
5930 {"winehq.org",S_OK},
5931 {"http://winehq.org/testing",S_OK},
5932 {"winehq.org",S_OK},
5935 {"winehq.org",S_OK},
5940 {"http://winehq.org/testing",S_OK},
5946 {Uri_HOST_DNS,S_OK},
5948 {URL_SCHEME_HTTP,S_OK},
5949 {URLZONE_INVALID,E_NOTIMPL}
5952 { "http://winehq.org/test#frag",0,
5953 "testing",Uri_CREATE_ALLOW_RELATIVE,
5956 {"http://winehq.org/testing",S_OK},
5957 {"winehq.org",S_OK},
5958 {"http://winehq.org/testing",S_OK},
5959 {"winehq.org",S_OK},
5962 {"winehq.org",S_OK},
5967 {"http://winehq.org/testing",S_OK},
5973 {Uri_HOST_DNS,S_OK},
5975 {URL_SCHEME_HTTP,S_OK},
5976 {URLZONE_INVALID,E_NOTIMPL}
5979 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5980 "test",Uri_CREATE_ALLOW_RELATIVE,
6000 {Uri_HOST_UNKNOWN,S_OK},
6002 {URL_SCHEME_UNKNOWN,S_OK},
6003 {URLZONE_INVALID,E_NOTIMPL}
6006 { "file:///c:/test/test",0,
6007 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6008 URL_FILE_USE_PATHURL,S_OK,FALSE,
6010 {"file://c:\\testing.mp3",S_OK},
6012 {"file://c:\\testing.mp3",S_OK},
6018 {"c:\\testing.mp3",S_OK},
6019 {"c:\\testing.mp3",S_OK},
6021 {"file://c:\\testing.mp3",S_OK},
6027 {Uri_HOST_UNKNOWN,S_OK},
6029 {URL_SCHEME_FILE,S_OK},
6030 {URLZONE_INVALID,E_NOTIMPL}
6033 { "file:///c:/test/test",0,
6034 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6037 {"file:///c:/testing.mp3",S_OK},
6039 {"file:///c:/testing.mp3",S_OK},
6045 {"/c:/testing.mp3",S_OK},
6046 {"/c:/testing.mp3",S_OK},
6048 {"file:///c:/testing.mp3",S_OK},
6054 {Uri_HOST_UNKNOWN,S_OK},
6056 {URL_SCHEME_FILE,S_OK},
6057 {URLZONE_INVALID,E_NOTIMPL}
6060 { "file://test.com/test/test",0,
6061 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6062 URL_FILE_USE_PATHURL,S_OK,FALSE,
6064 {"file://\\\\test.com\\testing.mp3",S_OK},
6066 {"file://\\\\test.com\\testing.mp3",S_OK},
6072 {"\\testing.mp3",S_OK},
6073 {"\\testing.mp3",S_OK},
6075 {"file://\\\\test.com\\testing.mp3",S_OK},
6081 {Uri_HOST_DNS,S_OK},
6083 {URL_SCHEME_FILE,S_OK},
6084 {URLZONE_INVALID,E_NOTIMPL}
6087 /* URL_DONT_SIMPLIFY has no effect. */
6088 { "http://google.com/test",0,
6089 "zip://test.com/cool/../cool/test",0,
6090 URL_DONT_SIMPLIFY,S_OK,FALSE,
6092 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6094 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6100 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6101 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6103 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6104 * On IE 7 it reduces the path in the Raw URI.
6106 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6112 {Uri_HOST_DNS,S_OK},
6114 {URL_SCHEME_UNKNOWN,S_OK},
6115 {URLZONE_INVALID,E_NOTIMPL}
6118 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6119 * resulting URI is converted into a dos path.
6121 { "http://google.com/test",0,
6122 "file:///c:/test/",0,
6123 URL_FILE_USE_PATHURL,S_OK,FALSE,
6125 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6127 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6133 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6134 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6136 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6142 {Uri_HOST_UNKNOWN,S_OK},
6144 {URL_SCHEME_FILE,S_OK},
6145 {URLZONE_INVALID,E_NOTIMPL}
6148 { "http://google.com/test",0,
6149 "http://test.com/test#%30test",0,
6150 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6152 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6154 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6157 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6163 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6164 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6170 {Uri_HOST_DNS,S_OK},
6172 {URL_SCHEME_HTTP,S_OK},
6173 {URLZONE_INVALID,E_NOTIMPL}
6176 /* Windows validates the path component from the relative Uri. */
6177 { "http://google.com/test",0,
6178 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6179 0,E_INVALIDARG,FALSE
6181 /* Windows doesn't validate the query from the relative Uri. */
6182 { "http://google.com/test",0,
6183 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6186 {"http://google.com/test?Tes%XXt",S_OK},
6187 {"google.com",S_OK},
6188 {"http://google.com/test?Tes%XXt",S_OK},
6189 {"google.com",S_OK},
6192 {"google.com",S_OK},
6195 {"/test?Tes%XXt",S_OK},
6197 {"http://google.com/test?Tes%XXt",S_OK},
6203 {Uri_HOST_DNS,S_OK},
6205 {URL_SCHEME_HTTP,S_OK},
6206 {URLZONE_INVALID,E_NOTIMPL}
6209 /* Windows doesn't validate the fragment from the relative Uri. */
6210 { "http://google.com/test",0,
6211 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6214 {"http://google.com/test#Tes%XXt",S_OK},
6215 {"google.com",S_OK},
6216 {"http://google.com/test#Tes%XXt",S_OK},
6217 {"google.com",S_OK},
6220 {"google.com",S_OK},
6225 {"http://google.com/test#Tes%XXt",S_OK},
6231 {Uri_HOST_DNS,S_OK},
6233 {URL_SCHEME_HTTP,S_OK},
6234 {URLZONE_INVALID,E_NOTIMPL}
6237 /* Creates an IUri which contains an invalid dos path char. */
6238 { "file:///c:/test",0,
6239 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6240 URL_FILE_USE_PATHURL,S_OK,FALSE,
6242 {"file://c:\\test<ing",S_OK},
6244 {"file://c:\\test<ing",S_OK},
6250 {"c:\\test<ing",S_OK},
6251 {"c:\\test<ing",S_OK},
6253 {"file://c:\\test<ing",S_OK},
6259 {Uri_HOST_UNKNOWN,S_OK},
6261 {URL_SCHEME_FILE,S_OK},
6262 {URLZONE_INVALID,E_NOTIMPL}
6265 /* Appends the path after the drive letter (if any). */
6266 { "file:///c:/test",0,
6267 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6270 {"file:///c:/c:/testing",S_OK},
6272 {"file:///c:/c:/testing",S_OK},
6278 {"/c:/c:/testing",S_OK},
6279 {"/c:/c:/testing",S_OK},
6281 {"file:///c:/c:/testing",S_OK},
6287 {Uri_HOST_UNKNOWN,S_OK},
6289 {URL_SCHEME_FILE,S_OK},
6290 {URLZONE_INVALID,E_NOTIMPL}
6293 /* A '/' is added if the base URI doesn't have a path and the
6294 * relative URI doesn't contain a path (since the base URI is
6297 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6298 "?test",Uri_CREATE_ALLOW_RELATIVE,
6301 {"http://google.com/?test",S_OK},
6302 {"google.com",S_OK},
6303 {"http://google.com/?test",S_OK},
6304 {"google.com",S_OK},
6307 {"google.com",S_OK},
6312 {"http://google.com/?test",S_OK},
6318 {Uri_HOST_DNS,S_OK},
6320 {URL_SCHEME_HTTP,S_OK},
6321 {URLZONE_INVALID,E_NOTIMPL}
6324 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6325 "?test",Uri_CREATE_ALLOW_RELATIVE,
6328 {"zip://google.com/?test",S_OK},
6329 {"google.com",S_OK},
6330 {"zip://google.com/?test",S_OK},
6331 {"google.com",S_OK},
6334 {"google.com",S_OK},
6339 {"zip://google.com/?test",S_OK},
6345 {Uri_HOST_DNS,S_OK},
6347 {URL_SCHEME_UNKNOWN,S_OK},
6348 {URLZONE_INVALID,E_NOTIMPL}
6351 /* No path is appended since the base URI is opaque. */
6353 "?test",Uri_CREATE_ALLOW_RELATIVE,
6373 {Uri_HOST_UNKNOWN,S_OK},
6375 {URL_SCHEME_UNKNOWN,S_OK},
6376 {URLZONE_INVALID,E_NOTIMPL}
6380 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6383 {"file:///c:/testing/test",S_OK},
6385 {"file:///c:/testing/test",S_OK},
6391 {"/c:/testing/test",S_OK},
6392 {"/c:/testing/test",S_OK},
6394 {"file:///c:/testing/test",S_OK},
6400 {Uri_HOST_UNKNOWN,S_OK},
6402 {URL_SCHEME_FILE,S_OK},
6403 {URLZONE_INVALID,E_NOTIMPL}
6406 { "http://winehq.org/dir/testfile",0,
6407 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6410 {"http://winehq.org/dir/test?querystring",S_OK},
6411 {"winehq.org",S_OK},
6412 {"http://winehq.org/dir/test?querystring",S_OK},
6413 {"winehq.org",S_OK},
6416 {"winehq.org",S_OK},
6419 {"/dir/test?querystring",S_OK},
6420 {"?querystring",S_OK},
6421 {"http://winehq.org/dir/test?querystring",S_OK},
6427 {Uri_HOST_DNS,S_OK},
6429 {URL_SCHEME_HTTP,S_OK},
6430 {URLZONE_INVALID,E_NOTIMPL}
6433 { "http://winehq.org/dir/test",0,
6434 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6437 {"http://winehq.org/dir/test?querystring",S_OK},
6438 {"winehq.org",S_OK},
6439 {"http://winehq.org/dir/test?querystring",S_OK},
6440 {"winehq.org",S_OK},
6443 {"winehq.org",S_OK},
6446 {"/dir/test?querystring",S_OK},
6447 {"?querystring",S_OK},
6448 {"http://winehq.org/dir/test?querystring",S_OK},
6454 {Uri_HOST_DNS,S_OK},
6456 {URL_SCHEME_HTTP,S_OK},
6457 {URLZONE_INVALID,E_NOTIMPL}
6460 { "http://winehq.org/dir/test?querystring",0,
6461 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6464 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6465 {"winehq.org",S_OK},
6466 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6467 {"winehq.org",S_OK},
6470 {"winehq.org",S_OK},
6473 {"/dir/test?querystring",S_OK},
6474 {"?querystring",S_OK},
6475 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6481 {Uri_HOST_DNS,S_OK},
6483 {URL_SCHEME_HTTP,S_OK},
6484 {URLZONE_INVALID,E_NOTIMPL}
6487 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6488 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6491 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6493 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6499 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6500 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6502 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6508 {Uri_HOST_UNKNOWN,S_OK},
6510 {URL_SCHEME_MK,S_OK},
6511 {URLZONE_INVALID,E_NOTIMPL}
6514 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6515 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6518 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6520 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6526 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6527 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6529 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6535 {Uri_HOST_UNKNOWN,S_OK},
6537 {URL_SCHEME_MK,S_OK},
6538 {URLZONE_INVALID,E_NOTIMPL}
6541 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6542 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6545 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6547 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6553 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6554 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6556 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6562 {Uri_HOST_UNKNOWN,S_OK},
6564 {URL_SCHEME_MK,S_OK},
6565 {URLZONE_INVALID,E_NOTIMPL}
6570 typedef struct _uri_parse_test {
6575 const char *property;
6580 static const uri_parse_test uri_parse_tests[] = {
6581 /* PARSE_CANONICALIZE tests. */
6582 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6583 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6584 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6585 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6586 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6587 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6588 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6589 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6590 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6591 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6592 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6593 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6595 /* PARSE_FRIENDLY tests. */
6596 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6597 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6599 /* PARSE_ROOTDOCUMENT tests. */
6600 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6601 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6602 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6603 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6604 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6605 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6607 /* PARSE_DOCUMENT tests. */
6608 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6609 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6610 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6611 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6612 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6613 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6615 /* PARSE_PATH_FROM_URL tests. */
6616 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6617 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6618 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6619 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6620 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6622 /* PARSE_URL_FROM_PATH tests. */
6623 /* This function almost seems to useless (just returns the absolute uri). */
6624 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6625 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6626 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6627 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6628 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6630 /* PARSE_SCHEMA tests. */
6631 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6632 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6634 /* PARSE_SITE tests. */
6635 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6636 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6637 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6638 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6640 /* PARSE_DOMAIN tests. */
6641 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6642 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6643 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6644 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6646 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6647 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6648 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6649 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6650 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6653 static inline LPWSTR a2w(LPCSTR str) {
6657 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6658 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6659 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6665 static inline BOOL heap_free(void* mem) {
6666 return HeapFree(GetProcessHeap(), 0, mem);
6669 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6670 LPWSTR strAW = a2w(strA);
6671 DWORD ret = lstrcmpW(strAW, strB);
6676 static inline ULONG get_refcnt(IUri *uri) {
6678 return IUri_Release(uri);
6681 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6686 valueW = a2w(prop->value);
6687 switch(prop->property) {
6688 case Uri_PROPERTY_FRAGMENT:
6689 hr = IUriBuilder_SetFragment(builder, valueW);
6692 ok(hr == prop->expected,
6693 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6694 hr, prop->expected, test_index);
6697 ok(hr == prop->expected,
6698 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6699 hr, prop->expected, test_index);
6702 case Uri_PROPERTY_HOST:
6703 hr = IUriBuilder_SetHost(builder, valueW);
6706 ok(hr == prop->expected,
6707 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6708 hr, prop->expected, test_index);
6711 ok(hr == prop->expected,
6712 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6713 hr, prop->expected, test_index);
6716 case Uri_PROPERTY_PASSWORD:
6717 hr = IUriBuilder_SetPassword(builder, valueW);
6720 ok(hr == prop->expected,
6721 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6722 hr, prop->expected, test_index);
6725 ok(hr == prop->expected,
6726 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6727 hr, prop->expected, test_index);
6730 case Uri_PROPERTY_PATH:
6731 hr = IUriBuilder_SetPath(builder, valueW);
6734 ok(hr == prop->expected,
6735 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6736 hr, prop->expected, test_index);
6739 ok(hr == prop->expected,
6740 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6741 hr, prop->expected, test_index);
6744 case Uri_PROPERTY_QUERY:
6745 hr = IUriBuilder_SetQuery(builder, valueW);
6748 ok(hr == prop->expected,
6749 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6750 hr, prop->expected, test_index);
6753 ok(hr == prop->expected,
6754 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6755 hr, prop->expected, test_index);
6758 case Uri_PROPERTY_SCHEME_NAME:
6759 hr = IUriBuilder_SetSchemeName(builder, valueW);
6762 ok(hr == prop->expected,
6763 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6764 hr, prop->expected, test_index);
6767 ok(hr == prop->expected,
6768 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6769 hr, prop->expected, test_index);
6772 case Uri_PROPERTY_USER_NAME:
6773 hr = IUriBuilder_SetUserName(builder, valueW);
6776 ok(hr == prop->expected,
6777 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6778 hr, prop->expected, test_index);
6781 ok(hr == prop->expected,
6782 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6783 hr, prop->expected, test_index);
6787 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6794 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6797 static void test_CreateUri_InvalidFlags(void) {
6800 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6802 IUri *uri = (void*) 0xdeadbeef;
6804 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6805 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6806 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6807 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6811 static void test_CreateUri_InvalidArgs(void) {
6813 IUri *uri = (void*) 0xdeadbeef;
6815 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6816 static const WCHAR emptyW[] = {0};
6818 hr = pCreateUri(http_urlW, 0, 0, NULL);
6819 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6821 hr = pCreateUri(NULL, 0, 0, &uri);
6822 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6823 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6825 uri = (void*) 0xdeadbeef;
6826 hr = pCreateUri(invalidW, 0, 0, &uri);
6827 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6828 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6830 uri = (void*) 0xdeadbeef;
6831 hr = pCreateUri(emptyW, 0, 0, &uri);
6832 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6833 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6836 static void test_CreateUri_InvalidUri(void) {
6839 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6840 invalid_uri test = invalid_uri_tests[i];
6845 uriW = a2w(test.uri);
6846 hr = pCreateUri(uriW, test.flags, 0, &uri);
6849 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6850 hr, E_INVALIDARG, i);
6853 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6854 hr, E_INVALIDARG, i);
6856 if(uri) IUri_Release(uri);
6862 static void test_IUri_GetPropertyBSTR(void) {
6867 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6868 hr = pCreateUri(http_urlW, 0, 0, &uri);
6869 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6871 BSTR received = NULL;
6873 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6874 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6876 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6877 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6878 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6879 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6880 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6881 SysFreeString(received);
6883 /* Make sure it handles the ZONE property correctly. */
6885 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6886 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6887 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6888 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6889 SysFreeString(received);
6891 if(uri) IUri_Release(uri);
6893 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6894 uri_properties test = uri_tests[i];
6898 uriW = a2w(test.uri);
6899 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6900 if(test.create_todo) {
6902 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6903 hr, test.create_expected, i);
6906 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6907 hr, test.create_expected, i);
6913 /* Checks all the string properties of the uri. */
6914 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6915 BSTR received = NULL;
6916 uri_str_property prop = test.str_props[j];
6918 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6921 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6922 hr, prop.expected, i, j);
6925 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6926 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6927 prop.value, wine_dbgstr_w(received), i, j);
6930 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6931 hr, prop.expected, i, j);
6932 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6933 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6934 prop.value, wine_dbgstr_w(received), i, j);
6937 SysFreeString(received);
6941 if(uri) IUri_Release(uri);
6947 static void test_IUri_GetPropertyDWORD(void) {
6952 hr = pCreateUri(http_urlW, 0, 0, &uri);
6953 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6955 DWORD received = 0xdeadbeef;
6957 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6958 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6960 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6961 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6962 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6964 if(uri) IUri_Release(uri);
6966 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6967 uri_properties test = uri_tests[i];
6971 uriW = a2w(test.uri);
6972 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6973 if(test.create_todo) {
6975 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6976 hr, test.create_expected, i);
6979 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6980 hr, test.create_expected, i);
6986 /* Checks all the DWORD properties of the uri. */
6987 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6989 uri_dword_property prop = test.dword_props[j];
6991 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6994 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6995 hr, prop.expected, i, j);
6998 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6999 prop.value, received, i, j);
7002 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7003 hr, prop.expected, i, j);
7004 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7005 prop.value, received, i, j);
7010 if(uri) IUri_Release(uri);
7016 /* Tests all the 'Get*' property functions which deal with strings. */
7017 static void test_IUri_GetStrProperties(void) {
7022 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7023 hr = pCreateUri(http_urlW, 0, 0, &uri);
7024 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7026 hr = IUri_GetAbsoluteUri(uri, NULL);
7027 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7029 hr = IUri_GetAuthority(uri, NULL);
7030 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7032 hr = IUri_GetDisplayUri(uri, NULL);
7033 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7035 hr = IUri_GetDomain(uri, NULL);
7036 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7038 hr = IUri_GetExtension(uri, NULL);
7039 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7041 hr = IUri_GetFragment(uri, NULL);
7042 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7044 hr = IUri_GetHost(uri, NULL);
7045 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7047 hr = IUri_GetPassword(uri, NULL);
7048 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7050 hr = IUri_GetPath(uri, NULL);
7051 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7053 hr = IUri_GetPathAndQuery(uri, NULL);
7054 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7056 hr = IUri_GetQuery(uri, NULL);
7057 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7059 hr = IUri_GetRawUri(uri, NULL);
7060 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7062 hr = IUri_GetSchemeName(uri, NULL);
7063 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7065 hr = IUri_GetUserInfo(uri, NULL);
7066 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7068 hr = IUri_GetUserName(uri, NULL);
7069 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7071 if(uri) IUri_Release(uri);
7073 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7074 uri_properties test = uri_tests[i];
7078 uriW = a2w(test.uri);
7079 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7080 if(test.create_todo) {
7082 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7083 hr, test.create_expected, i);
7086 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7087 hr, test.create_expected, i);
7091 uri_str_property prop;
7092 BSTR received = NULL;
7094 /* GetAbsoluteUri() tests. */
7095 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7096 hr = IUri_GetAbsoluteUri(uri, &received);
7099 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7100 hr, prop.expected, i);
7103 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7104 "Error: Expected %s but got %s on uri_tests[%d].\n",
7105 prop.value, wine_dbgstr_w(received), i);
7108 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7109 hr, prop.expected, i);
7110 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7111 "Error: Expected %s but got %s on uri_tests[%d].\n",
7112 prop.value, wine_dbgstr_w(received), i);
7114 SysFreeString(received);
7117 /* GetAuthority() tests. */
7118 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7119 hr = IUri_GetAuthority(uri, &received);
7122 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7123 hr, prop.expected, i);
7126 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7127 prop.value, wine_dbgstr_w(received), i);
7130 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7131 hr, prop.expected, i);
7132 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7133 prop.value, wine_dbgstr_w(received), i);
7135 SysFreeString(received);
7138 /* GetDisplayUri() tests. */
7139 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7140 hr = IUri_GetDisplayUri(uri, &received);
7143 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7144 hr, prop.expected, i);
7147 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7148 "Error: Expected %s but got %s on uri_test[%d].\n",
7149 prop.value, wine_dbgstr_w(received), i);
7152 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7153 hr, prop.expected, i);
7154 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7155 "Error: Expected %s but got %s on uri_tests[%d].\n",
7156 prop.value, wine_dbgstr_w(received), i);
7158 SysFreeString(received);
7161 /* GetDomain() tests. */
7162 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7163 hr = IUri_GetDomain(uri, &received);
7166 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7167 hr, prop.expected, i);
7170 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7171 prop.value, wine_dbgstr_w(received), i);
7174 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7175 hr, prop.expected, i);
7176 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7177 prop.value, wine_dbgstr_w(received), i);
7179 SysFreeString(received);
7182 /* GetExtension() tests. */
7183 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7184 hr = IUri_GetExtension(uri, &received);
7187 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7188 hr, prop.expected, i);
7191 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7192 prop.value, wine_dbgstr_w(received), i);
7195 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7196 hr, prop.expected, i);
7197 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7198 prop.value, wine_dbgstr_w(received), i);
7200 SysFreeString(received);
7203 /* GetFragment() tests. */
7204 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7205 hr = IUri_GetFragment(uri, &received);
7208 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7209 hr, prop.expected, i);
7212 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7213 prop.value, wine_dbgstr_w(received), i);
7216 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7217 hr, prop.expected, i);
7218 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7219 prop.value, wine_dbgstr_w(received), i);
7221 SysFreeString(received);
7224 /* GetHost() tests. */
7225 prop = test.str_props[Uri_PROPERTY_HOST];
7226 hr = IUri_GetHost(uri, &received);
7229 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7230 hr, prop.expected, i);
7233 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7234 prop.value, wine_dbgstr_w(received), i);
7237 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7238 hr, prop.expected, i);
7239 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7240 prop.value, wine_dbgstr_w(received), i);
7242 SysFreeString(received);
7245 /* GetPassword() tests. */
7246 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7247 hr = IUri_GetPassword(uri, &received);
7250 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7251 hr, prop.expected, i);
7254 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7255 prop.value, wine_dbgstr_w(received), i);
7258 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7259 hr, prop.expected, i);
7260 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7261 prop.value, wine_dbgstr_w(received), i);
7263 SysFreeString(received);
7266 /* GetPath() tests. */
7267 prop = test.str_props[Uri_PROPERTY_PATH];
7268 hr = IUri_GetPath(uri, &received);
7271 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7272 hr, prop.expected, i);
7275 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7276 prop.value, wine_dbgstr_w(received), i);
7279 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7280 hr, prop.expected, i);
7281 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7282 prop.value, wine_dbgstr_w(received), i);
7284 SysFreeString(received);
7287 /* GetPathAndQuery() tests. */
7288 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7289 hr = IUri_GetPathAndQuery(uri, &received);
7292 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7293 hr, prop.expected, i);
7296 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7297 prop.value, wine_dbgstr_w(received), i);
7300 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7301 hr, prop.expected, i);
7302 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7303 prop.value, wine_dbgstr_w(received), i);
7305 SysFreeString(received);
7308 /* GetQuery() tests. */
7309 prop = test.str_props[Uri_PROPERTY_QUERY];
7310 hr = IUri_GetQuery(uri, &received);
7313 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7314 hr, prop.expected, i);
7317 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7318 prop.value, wine_dbgstr_w(received), i);
7321 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7322 hr, prop.expected, i);
7323 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7324 prop.value, wine_dbgstr_w(received), i);
7326 SysFreeString(received);
7329 /* GetRawUri() tests. */
7330 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7331 hr = IUri_GetRawUri(uri, &received);
7334 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7335 hr, prop.expected, i);
7338 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7339 prop.value, wine_dbgstr_w(received), i);
7342 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7343 hr, prop.expected, i);
7344 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7345 prop.value, wine_dbgstr_w(received), i);
7347 SysFreeString(received);
7350 /* GetSchemeName() tests. */
7351 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7352 hr = IUri_GetSchemeName(uri, &received);
7355 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7356 hr, prop.expected, i);
7359 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7360 prop.value, wine_dbgstr_w(received), i);
7363 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7364 hr, prop.expected, i);
7365 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7366 prop.value, wine_dbgstr_w(received), i);
7368 SysFreeString(received);
7371 /* GetUserInfo() tests. */
7372 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7373 hr = IUri_GetUserInfo(uri, &received);
7376 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7377 hr, prop.expected, i);
7380 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7381 prop.value, wine_dbgstr_w(received), i);
7384 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7385 hr, prop.expected, i);
7386 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7387 prop.value, wine_dbgstr_w(received), i);
7389 SysFreeString(received);
7392 /* GetUserName() tests. */
7393 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7394 hr = IUri_GetUserName(uri, &received);
7397 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7398 hr, prop.expected, i);
7401 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7402 prop.value, wine_dbgstr_w(received), i);
7405 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7406 hr, prop.expected, i);
7407 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7408 prop.value, wine_dbgstr_w(received), i);
7410 SysFreeString(received);
7413 if(uri) IUri_Release(uri);
7419 static void test_IUri_GetDwordProperties(void) {
7424 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7425 hr = pCreateUri(http_urlW, 0, 0, &uri);
7426 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7428 hr = IUri_GetHostType(uri, NULL);
7429 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7431 hr = IUri_GetPort(uri, NULL);
7432 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7434 hr = IUri_GetScheme(uri, NULL);
7435 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7437 hr = IUri_GetZone(uri, NULL);
7438 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7440 if(uri) IUri_Release(uri);
7442 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7443 uri_properties test = uri_tests[i];
7447 uriW = a2w(test.uri);
7448 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7449 if(test.create_todo) {
7451 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7452 hr, test.create_expected, i);
7455 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7456 hr, test.create_expected, i);
7460 uri_dword_property prop;
7463 /* Assign an insane value so tests don't accidentally pass when
7466 received = -9999999;
7468 /* GetHostType() tests. */
7469 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7470 hr = IUri_GetHostType(uri, &received);
7473 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7474 hr, prop.expected, i);
7477 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7480 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7481 hr, prop.expected, i);
7482 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7484 received = -9999999;
7486 /* GetPort() tests. */
7487 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7488 hr = IUri_GetPort(uri, &received);
7491 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7492 hr, prop.expected, i);
7495 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7498 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7499 hr, prop.expected, i);
7500 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7502 received = -9999999;
7504 /* GetScheme() tests. */
7505 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7506 hr = IUri_GetScheme(uri, &received);
7509 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7510 hr, prop.expected, i);
7513 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7516 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7517 hr, prop.expected, i);
7518 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7520 received = -9999999;
7522 /* GetZone() tests. */
7523 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7524 hr = IUri_GetZone(uri, &received);
7527 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7528 hr, prop.expected, i);
7531 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7534 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7535 hr, prop.expected, i);
7536 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7540 if(uri) IUri_Release(uri);
7546 static void test_IUri_GetPropertyLength(void) {
7551 /* Make sure it handles invalid args correctly. */
7552 hr = pCreateUri(http_urlW, 0, 0, &uri);
7553 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7555 DWORD received = 0xdeadbeef;
7557 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7558 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7560 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7561 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7562 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7564 if(uri) IUri_Release(uri);
7566 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7567 uri_properties test = uri_tests[i];
7571 uriW = a2w(test.uri);
7572 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7573 if(test.create_todo) {
7575 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7576 hr, test.create_expected, i);
7579 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7580 hr, test.create_expected, i);
7586 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7587 DWORD expectedLen, brokenLen, receivedLen;
7588 uri_str_property prop = test.str_props[j];
7590 expectedLen = lstrlen(prop.value);
7591 brokenLen = lstrlen(prop.broken_value);
7593 /* This won't be necessary once GetPropertyLength is implemented. */
7596 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7599 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7600 hr, prop.expected, i, j);
7603 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7604 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7605 expectedLen, receivedLen, i, j);
7608 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7609 hr, prop.expected, i, j);
7610 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7611 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7612 expectedLen, receivedLen, i, j);
7617 if(uri) IUri_Release(uri);
7623 static DWORD compute_expected_props(uri_properties *test)
7627 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7628 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7632 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7633 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7640 static void test_IUri_GetProperties(void) {
7645 hr = pCreateUri(http_urlW, 0, 0, &uri);
7646 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7648 hr = IUri_GetProperties(uri, NULL);
7649 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7651 if(uri) IUri_Release(uri);
7653 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7654 uri_properties test = uri_tests[i];
7658 uriW = a2w(test.uri);
7659 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7660 if(test.create_todo) {
7662 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7665 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7669 DWORD received = 0, expected_props;
7672 hr = IUri_GetProperties(uri, &received);
7673 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7675 expected_props = compute_expected_props(&test);
7677 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7678 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7679 if(expected_props & (1 << j))
7680 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7682 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7686 if(uri) IUri_Release(uri);
7692 static void test_IUri_HasProperty(void) {
7697 hr = pCreateUri(http_urlW, 0, 0, &uri);
7698 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7700 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7701 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7703 if(uri) IUri_Release(uri);
7705 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7706 uri_properties test = uri_tests[i];
7710 uriW = a2w(test.uri);
7712 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7713 if(test.create_todo) {
7715 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7718 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7722 DWORD expected_props, j;
7724 expected_props = compute_expected_props(&test);
7726 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7727 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7730 hr = IUri_HasProperty(uri, j, &received);
7731 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7734 if(expected_props & (1 << j)) {
7735 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7737 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7742 if(uri) IUri_Release(uri);
7748 static void test_IUri_IsEqual(void) {
7756 /* Make sure IsEqual handles invalid args correctly. */
7757 hres = pCreateUri(http_urlW, 0, 0, &uriA);
7758 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7759 hres = pCreateUri(http_urlW, 0, 0, &uriB);
7760 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7763 hres = IUri_IsEqual(uriA, NULL, &equal);
7764 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7765 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7767 hres = IUri_IsEqual(uriA, uriB, NULL);
7768 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
7773 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7774 uri_equality test = equality_tests[i];
7775 LPWSTR uriA_W, uriB_W;
7779 uriA_W = a2w(test.a);
7780 uriB_W = a2w(test.b);
7782 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7783 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
7785 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7786 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
7789 hres = IUri_IsEqual(uriA, uriB, &equal);
7790 if(test.todo) todo_wine {
7791 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
7792 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7794 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
7795 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7797 if(uriA) IUri_Release(uriA);
7798 if(uriB) IUri_Release(uriB);
7805 static void test_CreateUriWithFragment_InvalidArgs(void) {
7807 IUri *uri = (void*) 0xdeadbeef;
7808 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7810 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7811 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7812 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7814 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7815 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7817 /* Original URI can't already contain a fragment component. */
7818 uri = (void*) 0xdeadbeef;
7819 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7820 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7821 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7824 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7825 static void test_CreateUriWithFragment_InvalidFlags(void) {
7828 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7830 IUri *uri = (void*) 0xdeadbeef;
7832 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7833 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7834 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7835 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7839 static void test_CreateUriWithFragment(void) {
7842 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7846 uri_with_fragment test = uri_fragment_tests[i];
7848 uriW = a2w(test.uri);
7849 fragW = a2w(test.fragment);
7851 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7852 if(test.expected_todo) {
7854 ok(hr == test.create_expected,
7855 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7856 hr, test.create_expected, i);
7859 ok(hr == test.create_expected,
7860 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7861 hr, test.create_expected, i);
7864 BSTR received = NULL;
7866 hr = IUri_GetAbsoluteUri(uri, &received);
7867 if(test.expected_todo) {
7870 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7874 ok(!strcmp_aw(test.expected_uri, received),
7875 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7876 test.expected_uri, wine_dbgstr_w(received), i);
7879 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7881 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7882 test.expected_uri, wine_dbgstr_w(received), i);
7885 SysFreeString(received);
7888 if(uri) IUri_Release(uri);
7894 static void test_CreateIUriBuilder(void) {
7896 IUriBuilder *builder = NULL;
7899 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7900 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7903 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7904 hr = pCreateUri(http_urlW, 0, 0, &uri);
7905 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7907 ULONG cur_count, orig_count;
7909 orig_count = get_refcnt(uri);
7910 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7911 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7912 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7914 cur_count = get_refcnt(uri);
7915 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7917 if(builder) IUriBuilder_Release(builder);
7918 cur_count = get_refcnt(uri);
7919 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7921 if(uri) IUri_Release(uri);
7924 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7929 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7930 if(test->uri_todo) {
7932 ok(hr == test->uri_hres,
7933 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7934 hr, test->uri_hres, test_index);
7937 ok(hr == test->uri_hres,
7938 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7939 hr, test->uri_hres, test_index);
7945 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7946 uri_builder_str_property prop = test->expected_str_props[i];
7947 BSTR received = NULL;
7949 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7952 ok(hr == prop.result,
7953 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7954 hr, prop.result, test_index, i);
7957 ok(hr == prop.result,
7958 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7959 hr, prop.result, test_index, i);
7964 ok(!strcmp_aw(prop.expected, received),
7965 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7966 prop.expected, wine_dbgstr_w(received), test_index, i);
7969 ok(!strcmp_aw(prop.expected, received),
7970 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7971 prop.expected, wine_dbgstr_w(received), test_index, i);
7974 SysFreeString(received);
7977 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7978 uri_builder_dword_property prop = test->expected_dword_props[i];
7979 DWORD received = -2;
7981 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7984 ok(hr == prop.result,
7985 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7986 hr, prop.result, test_index, i);
7989 ok(hr == prop.result,
7990 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7991 hr, prop.result, test_index, i);
7996 ok(received == prop.expected,
7997 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7998 prop.expected, received, test_index, i);
8001 ok(received == prop.expected,
8002 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8003 prop.expected, received, test_index, i);
8008 if(uri) IUri_Release(uri);
8011 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8016 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8017 if(test->uri_simple_todo) {
8019 ok(hr == test->uri_simple_hres,
8020 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8021 hr, test->uri_simple_hres, test_index);
8024 ok(hr == test->uri_simple_hres,
8025 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8026 hr, test->uri_simple_hres, test_index);
8032 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8033 uri_builder_str_property prop = test->expected_str_props[i];
8034 BSTR received = NULL;
8036 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8039 ok(hr == prop.result,
8040 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8041 hr, prop.result, test_index, i);
8044 ok(hr == prop.result,
8045 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8046 hr, prop.result, test_index, i);
8051 ok(!strcmp_aw(prop.expected, received),
8052 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8053 prop.expected, wine_dbgstr_w(received), test_index, i);
8056 ok(!strcmp_aw(prop.expected, received),
8057 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8058 prop.expected, wine_dbgstr_w(received), test_index, i);
8061 SysFreeString(received);
8064 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8065 uri_builder_dword_property prop = test->expected_dword_props[i];
8066 DWORD received = -2;
8068 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8071 ok(hr == prop.result,
8072 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8073 hr, prop.result, test_index, i);
8076 ok(hr == prop.result,
8077 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8078 hr, prop.result, test_index, i);
8083 ok(received == prop.expected,
8084 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8085 prop.expected, received, test_index, i);
8088 ok(received == prop.expected,
8089 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8090 prop.expected, received, test_index, i);
8095 if(uri) IUri_Release(uri);
8098 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8103 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8104 test->uri_with_encode_flags, 0, &uri);
8105 if(test->uri_with_todo) {
8107 ok(hr == test->uri_with_hres,
8108 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8109 hr, test->uri_with_hres, test_index);
8112 ok(hr == test->uri_with_hres,
8113 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8114 hr, test->uri_with_hres, test_index);
8120 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8121 uri_builder_str_property prop = test->expected_str_props[i];
8122 BSTR received = NULL;
8124 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8127 ok(hr == prop.result,
8128 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8129 hr, prop.result, test_index, i);
8132 ok(hr == prop.result,
8133 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8134 hr, prop.result, test_index, i);
8139 ok(!strcmp_aw(prop.expected, received),
8140 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8141 prop.expected, wine_dbgstr_w(received), test_index, i);
8144 ok(!strcmp_aw(prop.expected, received),
8145 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8146 prop.expected, wine_dbgstr_w(received), test_index, i);
8149 SysFreeString(received);
8152 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8153 uri_builder_dword_property prop = test->expected_dword_props[i];
8154 DWORD received = -2;
8156 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8159 ok(hr == prop.result,
8160 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8161 hr, prop.result, test_index, i);
8164 ok(hr == prop.result,
8165 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8166 hr, prop.result, test_index, i);
8171 ok(received == prop.expected,
8172 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8173 prop.expected, received, test_index, i);
8176 ok(received == prop.expected,
8177 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8178 prop.expected, received, test_index, i);
8183 if(uri) IUri_Release(uri);
8186 static void test_IUriBuilder_CreateInvalidArgs(void) {
8187 IUriBuilder *builder;
8190 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8191 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8193 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8195 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8196 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8197 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8199 uri = (void*) 0xdeadbeef;
8200 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8201 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8202 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8204 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8205 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8208 uri = (void*) 0xdeadbeef;
8209 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8210 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8212 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8214 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8215 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8218 uri = (void*) 0xdeadbeef;
8219 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8220 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8222 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8224 hr = pCreateUri(http_urlW, 0, 0, &test);
8225 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8227 hr = IUriBuilder_SetIUri(builder, test);
8228 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8230 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8232 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8233 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8234 ok(uri != NULL, "Error: The uri was NULL.\n");
8235 if(uri) IUri_Release(uri);
8238 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8239 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8241 ok(uri != NULL, "Error: uri was NULL.\n");
8242 if(uri) IUri_Release(uri);
8245 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8246 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8248 ok(uri != NULL, "Error: uri was NULL.\n");
8249 if(uri) IUri_Release(uri);
8251 hr = IUriBuilder_SetFragment(builder, NULL);
8252 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8254 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8255 uri = (void*) 0xdeadbeef;
8256 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8257 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8258 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8260 uri = (void*) 0xdeadbeef;
8261 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8262 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8264 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8266 uri = (void*) 0xdeadbeef;
8267 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8268 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8270 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8272 if(test) IUri_Release(test);
8274 if(builder) IUriBuilder_Release(builder);
8277 /* Tests invalid args to the "Get*" functions. */
8278 static void test_IUriBuilder_GetInvalidArgs(void) {
8279 IUriBuilder *builder = NULL;
8282 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8283 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8285 LPCWSTR received = (void*) 0xdeadbeef;
8286 DWORD len = -1, port = -1;
8289 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8290 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8292 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8293 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8295 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8296 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8297 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8299 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8301 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8302 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8304 received = (void*) 0xdeadbeef;
8305 hr = IUriBuilder_GetHost(builder, NULL, &received);
8306 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8308 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8310 hr = IUriBuilder_GetHost(builder, &len, NULL);
8311 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8313 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8315 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8316 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8318 received = (void*) 0xdeadbeef;
8319 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8320 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8322 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8324 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8325 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8327 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8329 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8330 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8332 received = (void*) 0xdeadbeef;
8333 hr = IUriBuilder_GetPath(builder, NULL, &received);
8334 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8336 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8338 hr = IUriBuilder_GetPath(builder, &len, NULL);
8339 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8341 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8343 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8344 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8346 hr = IUriBuilder_GetPort(builder, NULL, &port);
8347 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8349 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8350 hr = IUriBuilder_GetPort(builder, &set, NULL);
8351 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8353 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8355 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8356 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8358 received = (void*) 0xdeadbeef;
8359 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8360 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8362 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8364 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8365 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8367 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8369 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8370 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8372 received = (void*) 0xdeadbeef;
8373 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8374 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8376 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8378 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8379 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8381 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8383 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8384 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8386 received = (void*) 0xdeadbeef;
8387 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8388 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8390 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8392 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8393 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8395 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8397 if(builder) IUriBuilder_Release(builder);
8400 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8404 LPCWSTR received = NULL;
8406 const uri_builder_property *prop = NULL;
8408 /* Check if the property was set earlier. */
8409 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8410 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8411 prop = &(test->properties[i]);
8415 /* Use expected_value unless it's NULL, then use value. */
8416 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8417 hr = IUriBuilder_GetFragment(builder, &len, &received);
8420 ok(hr == (expected ? S_OK : S_FALSE),
8421 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8422 hr, (expected ? S_OK : S_FALSE), test_index);
8426 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8427 expected, wine_dbgstr_w(received), test_index);
8430 ok(lstrlen(expected) == len,
8431 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8432 lstrlen(expected), len, test_index);
8436 ok(hr == (expected ? S_OK : S_FALSE),
8437 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8438 hr, (expected ? S_OK : S_FALSE), test_index);
8439 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8440 expected, wine_dbgstr_w(received), test_index);
8441 ok(lstrlen(expected) == len,
8442 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8443 lstrlen(expected), len, test_index);
8446 /* The property wasn't set earlier, so it should return whatever
8447 * the base IUri contains (if anything).
8450 hr = IUriBuilder_GetIUri(builder, &uri);
8452 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8453 hr, S_OK, test_index);
8456 received = (void*) 0xdeadbeef;
8459 hr = IUriBuilder_GetFragment(builder, &len, &received);
8461 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8462 hr, S_FALSE, test_index);
8464 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8466 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8467 received, test_index);
8470 BOOL has_prop = FALSE;
8471 BSTR expected = NULL;
8473 hr = IUri_GetFragment(uri, &expected);
8475 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8477 has_prop = hr == S_OK;
8479 hr = IUriBuilder_GetFragment(builder, &len, &received);
8482 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8483 hr, S_OK, test_index);
8485 ok(!lstrcmpW(expected, received),
8486 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8487 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8488 ok(lstrlenW(expected) == len,
8489 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8490 lstrlenW(expected), len, test_index);
8494 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8495 hr, S_FALSE, test_index);
8497 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8498 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8502 SysFreeString(expected);
8505 if(uri) IUri_Release(uri);
8509 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8513 LPCWSTR received = NULL;
8515 const uri_builder_property *prop = NULL;
8517 /* Check if the property was set earlier. */
8518 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8519 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8520 prop = &(test->properties[i]);
8524 /* Use expected_value unless it's NULL, then use value. */
8525 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8526 hr = IUriBuilder_GetHost(builder, &len, &received);
8529 ok(hr == (expected ? S_OK : S_FALSE),
8530 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8531 hr, (expected ? S_OK : S_FALSE), test_index);
8535 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8536 expected, wine_dbgstr_w(received), test_index);
8539 ok(lstrlen(expected) == len,
8540 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8541 lstrlen(expected), len, test_index);
8545 ok(hr == (expected ? S_OK : S_FALSE),
8546 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8547 hr, (expected ? S_OK : S_FALSE), test_index);
8548 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8549 expected, wine_dbgstr_w(received), test_index);
8550 ok(lstrlen(expected) == len,
8551 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8552 lstrlen(expected), len, test_index);
8555 /* The property wasn't set earlier, so it should return whatever
8556 * the base IUri contains (if anything).
8559 hr = IUriBuilder_GetIUri(builder, &uri);
8561 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8562 hr, S_OK, test_index);
8565 received = (void*) 0xdeadbeef;
8568 hr = IUriBuilder_GetHost(builder, &len, &received);
8570 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8571 hr, S_FALSE, test_index);
8573 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8575 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8576 received, test_index);
8579 BOOL has_prop = FALSE;
8580 BSTR expected = NULL;
8582 hr = IUri_GetHost(uri, &expected);
8584 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8586 has_prop = hr == S_OK;
8588 hr = IUriBuilder_GetHost(builder, &len, &received);
8591 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8592 hr, S_OK, test_index);
8594 ok(!lstrcmpW(expected, received),
8595 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8596 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8597 ok(lstrlenW(expected) == len,
8598 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8599 lstrlenW(expected), len, test_index);
8603 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8604 hr, S_FALSE, test_index);
8606 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8607 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8611 SysFreeString(expected);
8614 if(uri) IUri_Release(uri);
8618 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8622 LPCWSTR received = NULL;
8624 const uri_builder_property *prop = NULL;
8626 /* Check if the property was set earlier. */
8627 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8628 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8629 prop = &(test->properties[i]);
8633 /* Use expected_value unless it's NULL, then use value. */
8634 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8635 hr = IUriBuilder_GetPassword(builder, &len, &received);
8638 ok(hr == (expected ? S_OK : S_FALSE),
8639 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8640 hr, (expected ? S_OK : S_FALSE), test_index);
8644 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8645 expected, wine_dbgstr_w(received), test_index);
8648 ok(lstrlen(expected) == len,
8649 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8650 lstrlen(expected), len, test_index);
8654 ok(hr == (expected ? S_OK : S_FALSE),
8655 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8656 hr, (expected ? S_OK : S_FALSE), test_index);
8657 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8658 expected, wine_dbgstr_w(received), test_index);
8659 ok(lstrlen(expected) == len,
8660 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8661 lstrlen(expected), len, test_index);
8664 /* The property wasn't set earlier, so it should return whatever
8665 * the base IUri contains (if anything).
8668 hr = IUriBuilder_GetIUri(builder, &uri);
8670 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8671 hr, S_OK, test_index);
8674 received = (void*) 0xdeadbeef;
8677 hr = IUriBuilder_GetPassword(builder, &len, &received);
8679 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8680 hr, S_FALSE, test_index);
8682 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8684 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8685 received, test_index);
8688 BOOL has_prop = FALSE;
8689 BSTR expected = NULL;
8691 hr = IUri_GetPassword(uri, &expected);
8693 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8695 has_prop = hr == S_OK;
8697 hr = IUriBuilder_GetPassword(builder, &len, &received);
8700 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8701 hr, S_OK, test_index);
8703 ok(!lstrcmpW(expected, received),
8704 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8705 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8706 ok(lstrlenW(expected) == len,
8707 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8708 lstrlenW(expected), len, test_index);
8712 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8713 hr, S_FALSE, test_index);
8715 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8716 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8720 SysFreeString(expected);
8723 if(uri) IUri_Release(uri);
8727 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8731 LPCWSTR received = NULL;
8733 const uri_builder_property *prop = NULL;
8735 /* Check if the property was set earlier. */
8736 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8737 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8738 prop = &(test->properties[i]);
8742 /* Use expected_value unless it's NULL, then use value. */
8743 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8744 hr = IUriBuilder_GetPath(builder, &len, &received);
8747 ok(hr == (expected ? S_OK : S_FALSE),
8748 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8749 hr, (expected ? S_OK : S_FALSE), test_index);
8753 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8754 expected, wine_dbgstr_w(received), test_index);
8757 ok(lstrlen(expected) == len,
8758 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8759 lstrlen(expected), len, test_index);
8763 ok(hr == (expected ? S_OK : S_FALSE),
8764 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8765 hr, (expected ? S_OK : S_FALSE), test_index);
8766 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8767 expected, wine_dbgstr_w(received), test_index);
8768 ok(lstrlen(expected) == len,
8769 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8770 lstrlen(expected), len, test_index);
8773 /* The property wasn't set earlier, so it should return whatever
8774 * the base IUri contains (if anything).
8777 hr = IUriBuilder_GetIUri(builder, &uri);
8779 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8780 hr, S_OK, test_index);
8783 received = (void*) 0xdeadbeef;
8786 hr = IUriBuilder_GetPath(builder, &len, &received);
8788 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8789 hr, S_FALSE, test_index);
8791 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8793 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8794 received, test_index);
8797 BOOL has_prop = FALSE;
8798 BSTR expected = NULL;
8800 hr = IUri_GetPath(uri, &expected);
8802 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8804 has_prop = hr == S_OK;
8806 hr = IUriBuilder_GetPath(builder, &len, &received);
8809 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8810 hr, S_OK, test_index);
8812 ok(!lstrcmpW(expected, received),
8813 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8814 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8815 ok(lstrlenW(expected) == len,
8816 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8817 lstrlenW(expected), len, test_index);
8821 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8822 hr, S_FALSE, test_index);
8824 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8825 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8829 SysFreeString(expected);
8832 if(uri) IUri_Release(uri);
8836 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8839 BOOL has_port = FALSE;
8840 DWORD received = -1;
8842 if(test->port_prop.change) {
8843 DWORD expected = test->port_prop.value;
8845 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8846 if(test->port_prop.todo) {
8849 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8850 hr, S_OK, test_index);
8854 ok(has_port == test->port_prop.set,
8855 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8856 test->port_prop.set, has_port, test_index);
8859 ok(received == expected,
8860 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8861 expected, received, test_index);
8866 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8867 hr, S_OK, test_index);
8868 ok(has_port == test->port_prop.set,
8869 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8870 test->port_prop.set, has_port, test_index);
8871 ok(received == test->port_prop.value,
8872 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8873 test->port_prop.value, received, test_index);
8878 hr = IUriBuilder_GetIUri(builder, &uri);
8880 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8881 hr, S_OK, test_index);
8884 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8886 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8887 hr, S_OK, test_index);
8889 ok(has_port == FALSE,
8890 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8891 has_port, test_index);
8892 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8893 received, test_index);
8898 hr = IUri_GetPort(uri, &expected);
8900 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8903 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8905 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8906 hr, S_OK, test_index);
8909 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8911 ok(received == expected,
8912 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8913 expected, received, test_index);
8917 if(uri) IUri_Release(uri);
8921 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8925 LPCWSTR received = NULL;
8927 const uri_builder_property *prop = NULL;
8929 /* Check if the property was set earlier. */
8930 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8931 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8932 prop = &(test->properties[i]);
8936 /* Use expected_value unless it's NULL, then use value. */
8937 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8938 hr = IUriBuilder_GetQuery(builder, &len, &received);
8941 ok(hr == (expected ? S_OK : S_FALSE),
8942 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8943 hr, (expected ? S_OK : S_FALSE), test_index);
8947 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8948 expected, wine_dbgstr_w(received), test_index);
8951 ok(lstrlen(expected) == len,
8952 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8953 lstrlen(expected), len, test_index);
8957 ok(hr == (expected ? S_OK : S_FALSE),
8958 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8959 hr, (expected ? S_OK : S_FALSE), test_index);
8960 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8961 expected, wine_dbgstr_w(received), test_index);
8962 ok(lstrlen(expected) == len,
8963 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8964 lstrlen(expected), len, test_index);
8967 /* The property wasn't set earlier, so it should return whatever
8968 * the base IUri contains (if anything).
8971 hr = IUriBuilder_GetIUri(builder, &uri);
8973 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8974 hr, S_OK, test_index);
8977 received = (void*) 0xdeadbeef;
8980 hr = IUriBuilder_GetQuery(builder, &len, &received);
8982 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8983 hr, S_FALSE, test_index);
8985 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8987 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8988 received, test_index);
8991 BOOL has_prop = FALSE;
8992 BSTR expected = NULL;
8994 hr = IUri_GetQuery(uri, &expected);
8996 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8998 has_prop = hr == S_OK;
9000 hr = IUriBuilder_GetQuery(builder, &len, &received);
9003 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9004 hr, S_OK, test_index);
9006 ok(!lstrcmpW(expected, received),
9007 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9008 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9009 ok(lstrlenW(expected) == len,
9010 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9011 lstrlenW(expected), len, test_index);
9015 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9016 hr, S_FALSE, test_index);
9018 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9019 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9023 SysFreeString(expected);
9026 if(uri) IUri_Release(uri);
9030 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9034 LPCWSTR received = NULL;
9036 const uri_builder_property *prop = NULL;
9038 /* Check if the property was set earlier. */
9039 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9040 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9041 prop = &(test->properties[i]);
9045 /* Use expected_value unless it's NULL, then use value. */
9046 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9047 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9050 ok(hr == (expected ? S_OK : S_FALSE),
9051 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9052 hr, (expected ? S_OK : S_FALSE), test_index);
9056 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9057 expected, wine_dbgstr_w(received), test_index);
9060 ok(lstrlen(expected) == len,
9061 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9062 lstrlen(expected), len, test_index);
9066 ok(hr == (expected ? S_OK : S_FALSE),
9067 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9068 hr, (expected ? S_OK : S_FALSE), test_index);
9069 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9070 expected, wine_dbgstr_w(received), test_index);
9071 ok(lstrlen(expected) == len,
9072 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9073 lstrlen(expected), len, test_index);
9076 /* The property wasn't set earlier, so it should return whatever
9077 * the base IUri contains (if anything).
9080 hr = IUriBuilder_GetIUri(builder, &uri);
9082 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9083 hr, S_OK, test_index);
9086 received = (void*) 0xdeadbeef;
9089 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9091 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9092 hr, S_FALSE, test_index);
9094 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9096 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9097 received, test_index);
9100 BOOL has_prop = FALSE;
9101 BSTR expected = NULL;
9103 hr = IUri_GetSchemeName(uri, &expected);
9105 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9107 has_prop = hr == S_OK;
9109 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9112 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9113 hr, S_OK, test_index);
9115 ok(!lstrcmpW(expected, received),
9116 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9117 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9118 ok(lstrlenW(expected) == len,
9119 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9120 lstrlenW(expected), len, test_index);
9124 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9125 hr, S_FALSE, test_index);
9127 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9128 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9132 SysFreeString(expected);
9135 if(uri) IUri_Release(uri);
9139 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9143 LPCWSTR received = NULL;
9145 const uri_builder_property *prop = NULL;
9147 /* Check if the property was set earlier. */
9148 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9149 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9150 prop = &(test->properties[i]);
9153 if(prop && prop->value && *prop->value) {
9154 /* Use expected_value unless it's NULL, then use value. */
9155 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9156 hr = IUriBuilder_GetUserName(builder, &len, &received);
9159 ok(hr == (expected ? S_OK : S_FALSE),
9160 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9161 hr, (expected ? S_OK : S_FALSE), test_index);
9165 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9166 expected, wine_dbgstr_w(received), test_index);
9169 ok(lstrlen(expected) == len,
9170 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9171 lstrlen(expected), len, test_index);
9175 ok(hr == (expected ? S_OK : S_FALSE),
9176 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9177 hr, (expected ? S_OK : S_FALSE), test_index);
9178 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9179 expected, wine_dbgstr_w(received), test_index);
9180 ok(lstrlen(expected) == len,
9181 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9182 lstrlen(expected), len, test_index);
9185 /* The property wasn't set earlier, so it should return whatever
9186 * the base IUri contains (if anything).
9189 hr = IUriBuilder_GetIUri(builder, &uri);
9191 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9192 hr, S_OK, test_index);
9195 received = (void*) 0xdeadbeef;
9198 hr = IUriBuilder_GetUserName(builder, &len, &received);
9200 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9201 hr, S_FALSE, test_index);
9203 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9205 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9206 received, test_index);
9209 BSTR expected = NULL;
9210 BOOL has_prop = FALSE;
9212 hr = IUri_GetUserName(uri, &expected);
9214 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9216 has_prop = hr == S_OK;
9218 hr = IUriBuilder_GetUserName(builder, &len, &received);
9221 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9222 hr, S_OK, test_index);
9224 ok(!lstrcmpW(expected, received),
9225 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9226 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9227 ok(lstrlenW(expected) == len,
9228 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9229 lstrlenW(expected), len, test_index);
9233 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9234 hr, S_FALSE, test_index);
9236 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9237 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9241 SysFreeString(expected);
9244 if(uri) IUri_Release(uri);
9248 /* Tests IUriBuilder functions. */
9249 static void test_IUriBuilder(void) {
9251 IUriBuilder *builder;
9254 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9256 uri_builder_test test = uri_builder_tests[i];
9260 uriW = a2w(test.uri);
9261 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9262 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9264 if(FAILED(hr)) continue;
9266 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9267 if(test.create_builder_todo) {
9269 ok(hr == test.create_builder_expected,
9270 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9271 hr, test.create_builder_expected, i);
9274 ok(hr == test.create_builder_expected,
9275 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9276 hr, test.create_builder_expected, i);
9280 BOOL modified = FALSE, received = FALSE;
9282 /* Perform all the string property changes. */
9283 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9284 uri_builder_property prop = test.properties[j];
9286 change_property(builder, &prop, i);
9287 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9288 prop.property != Uri_PROPERTY_HOST)
9290 else if(prop.value && *prop.value)
9292 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9293 /* Host name property can't be NULL, but it can be empty. */
9298 if(test.port_prop.change) {
9299 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9301 if(test.port_prop.todo) {
9303 ok(hr == test.port_prop.expected,
9304 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9305 hr, test.port_prop.expected, i);
9308 ok(hr == test.port_prop.expected,
9309 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9310 hr, test.port_prop.expected, i);
9314 hr = IUriBuilder_HasBeenModified(builder, &received);
9316 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9319 ok(received == modified,
9320 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9321 modified, received, i);
9323 /* Test the "Get*" functions. */
9324 test_IUriBuilder_GetFragment(builder, &test, i);
9325 test_IUriBuilder_GetHost(builder, &test, i);
9326 test_IUriBuilder_GetPassword(builder, &test, i);
9327 test_IUriBuilder_GetPath(builder, &test, i);
9328 test_IUriBuilder_GetPort(builder, &test, i);
9329 test_IUriBuilder_GetQuery(builder, &test, i);
9330 test_IUriBuilder_GetSchemeName(builder, &test, i);
9331 test_IUriBuilder_GetUserName(builder, &test, i);
9333 test_IUriBuilder_CreateUri(builder, &test, i);
9334 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9335 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9337 if(builder) IUriBuilder_Release(builder);
9338 if(uri) IUri_Release(uri);
9343 static void test_IUriBuilder_HasBeenModified(void) {
9345 IUriBuilder *builder = NULL;
9347 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9348 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9350 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9354 hr = IUriBuilder_HasBeenModified(builder, NULL);
9355 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9358 hr = IUriBuilder_SetHost(builder, hostW);
9359 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9362 hr = IUriBuilder_HasBeenModified(builder, &received);
9363 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9366 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9368 hr = pCreateUri(http_urlW, 0, 0, &uri);
9369 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9374 hr = IUriBuilder_SetIUri(builder, uri);
9375 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9378 hr = IUriBuilder_HasBeenModified(builder, &received);
9379 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9382 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9384 /* Test what happens with you call SetIUri with the same IUri again. */
9385 hr = IUriBuilder_SetHost(builder, hostW);
9386 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9388 hr = IUriBuilder_HasBeenModified(builder, &received);
9389 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9392 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9394 hr = IUriBuilder_SetIUri(builder, uri);
9395 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9397 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9398 * reset any of the changes that were made to the IUriBuilder.
9400 hr = IUriBuilder_HasBeenModified(builder, &received);
9401 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9403 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9405 hr = IUriBuilder_GetHost(builder, &len, &prop);
9406 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9408 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9409 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9410 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9411 lstrlenW(hostW), len);
9414 hr = IUriBuilder_SetIUri(builder, NULL);
9415 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9417 hr = IUriBuilder_SetHost(builder, hostW);
9418 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9419 hr = IUriBuilder_HasBeenModified(builder, &received);
9420 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9423 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9425 hr = IUriBuilder_SetIUri(builder, NULL);
9426 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9428 hr = IUriBuilder_HasBeenModified(builder, &received);
9429 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9432 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9434 hr = IUriBuilder_GetHost(builder, &len, &prop);
9435 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9437 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9438 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9439 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9440 lstrlenW(hostW), len);
9443 if(uri) IUri_Release(uri);
9445 if(builder) IUriBuilder_Release(builder);
9448 /* Test IUriBuilder {Get,Set}IUri functions. */
9449 static void test_IUriBuilder_IUriProperty(void) {
9450 IUriBuilder *builder = NULL;
9453 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9454 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9458 hr = IUriBuilder_GetIUri(builder, NULL);
9459 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9462 hr = pCreateUri(http_urlW, 0, 0, &uri);
9465 ULONG cur_count, orig_count;
9467 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9468 orig_count = get_refcnt(uri);
9469 hr = IUriBuilder_SetIUri(builder, uri);
9470 cur_count = get_refcnt(uri);
9472 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9473 orig_count+1, cur_count);
9475 hr = IUriBuilder_SetIUri(builder, NULL);
9476 cur_count = get_refcnt(uri);
9478 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9479 orig_count, cur_count);
9481 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9482 hr = IUriBuilder_SetIUri(builder, uri);
9483 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9484 orig_count = get_refcnt(uri);
9486 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9487 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9489 cur_count = get_refcnt(uri);
9490 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9491 orig_count+1, cur_count);
9492 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9495 if(test) IUri_Release(test);
9498 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9499 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9501 cur_count = get_refcnt(uri);
9502 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9503 orig_count+1, cur_count);
9504 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9506 if(test) IUri_Release(test);
9508 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9512 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9513 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9515 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9517 if(test) IUri_Release(test);
9519 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9520 * explicitly set (because it's a default flags).
9523 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9524 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9526 cur_count = get_refcnt(uri);
9527 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9528 orig_count+1, cur_count);
9529 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9531 if(test) IUri_Release(test);
9534 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9535 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9537 cur_count = get_refcnt(uri);
9538 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9539 orig_count+1, cur_count);
9540 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9542 if(test) IUri_Release(test);
9545 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9546 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9549 cur_count = get_refcnt(uri);
9550 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9551 orig_count+1, cur_count);
9552 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9554 if(test) IUri_Release(test);
9556 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9560 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9561 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9563 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9565 if(test) IUri_Release(test);
9567 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9568 * explicitly set (because it's a default flags).
9571 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9572 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9574 cur_count = get_refcnt(uri);
9575 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9576 orig_count+1, cur_count);
9577 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9579 if(test) IUri_Release(test);
9581 if(uri) IUri_Release(uri);
9583 if(builder) IUriBuilder_Release(builder);
9586 static void test_IUriBuilder_RemoveProperties(void) {
9587 IUriBuilder *builder = NULL;
9591 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9592 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9594 /* Properties that can't be removed. */
9595 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9596 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9598 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9599 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9600 if((i << 1) & invalid) {
9601 ok(hr == E_INVALIDARG,
9602 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9603 hr, E_INVALIDARG, i);
9606 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9611 /* Also doesn't accept anything that's outside the range of the
9614 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9615 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9618 if(builder) IUriBuilder_Release(builder);
9620 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9621 uri_builder_remove_test test = uri_builder_remove_tests[i];
9625 uriW = a2w(test.uri);
9626 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9630 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9631 if(test.create_builder_todo) {
9633 ok(hr == test.create_builder_expected,
9634 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9635 hr, test.create_builder_expected, i);
9638 ok(hr == test.create_builder_expected,
9639 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9640 hr, test.create_builder_expected, i);
9643 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9644 if(test.remove_todo) {
9646 ok(hr == test.remove_expected,
9647 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9648 hr, test.remove_expected, i);
9651 ok(hr == test.remove_expected,
9652 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9653 hr, test.remove_expected, i);
9656 IUri *result = NULL;
9658 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9659 if(test.expected_todo) {
9661 ok(hr == test.expected_hres,
9662 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9663 hr, test.expected_hres, i);
9666 ok(hr == test.expected_hres,
9667 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9668 hr, test.expected_hres, i);
9671 BSTR received = NULL;
9673 hr = IUri_GetAbsoluteUri(result, &received);
9674 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9675 ok(!strcmp_aw(test.expected_uri, received),
9676 "Error: Expected %s but got %s instead on test %d.\n",
9677 test.expected_uri, wine_dbgstr_w(received), i);
9678 SysFreeString(received);
9680 if(result) IUri_Release(result);
9683 if(builder) IUriBuilder_Release(builder);
9685 if(uri) IUri_Release(uri);
9690 static void test_IUriBuilder_Misc(void) {
9694 hr = pCreateUri(http_urlW, 0, 0, &uri);
9696 IUriBuilder *builder;
9698 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9699 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9704 hr = IUriBuilder_GetPort(builder, &has, &port);
9705 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9707 /* 'has' will be set to FALSE, even though uri had a port. */
9708 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9709 /* Still sets 'port' to 80. */
9710 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9713 if(builder) IUriBuilder_Release(builder);
9715 if(uri) IUri_Release(uri);
9718 static void test_IUriBuilderFactory(void) {
9721 IUriBuilderFactory *factory;
9722 IUriBuilder *builder;
9724 hr = pCreateUri(http_urlW, 0, 0, &uri);
9725 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9728 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9729 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9730 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9733 builder = (void*) 0xdeadbeef;
9734 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9735 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9737 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9739 builder = (void*) 0xdeadbeef;
9740 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9741 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9743 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9745 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9746 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9750 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9751 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9754 IUri *tmp = (void*) 0xdeadbeef;
9758 hr = IUriBuilder_GetIUri(builder, &tmp);
9759 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9761 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9763 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9764 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9767 if(builder) IUriBuilder_Release(builder);
9769 builder = (void*) 0xdeadbeef;
9770 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9771 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9773 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9775 builder = (void*) 0xdeadbeef;
9776 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9777 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9779 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9781 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9782 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9786 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9787 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9792 hr = IUriBuilder_GetIUri(builder, &tmp);
9793 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9795 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9796 if(uri) IUri_Release(uri);
9798 if(builder) IUriBuilder_Release(builder);
9800 if(factory) IUriBuilderFactory_Release(factory);
9802 if(uri) IUri_Release(uri);
9805 static void test_CoInternetCombineIUri(void) {
9807 IUri *base, *relative, *result;
9811 hr = pCreateUri(http_urlW, 0, 0, &base);
9812 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9814 result = (void*) 0xdeadbeef;
9815 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9816 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9817 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9821 hr = pCreateUri(http_urlW, 0, 0, &relative);
9822 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9824 result = (void*) 0xdeadbeef;
9825 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9826 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9827 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9830 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9831 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9833 if(base) IUri_Release(base);
9834 if(relative) IUri_Release(relative);
9836 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9837 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9839 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9840 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9842 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9844 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9845 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9849 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9850 if(uri_combine_tests[i].todo) {
9852 ok(hr == uri_combine_tests[i].expected,
9853 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9854 hr, uri_combine_tests[i].expected, i);
9857 ok(hr == uri_combine_tests[i].expected,
9858 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9859 hr, uri_combine_tests[i]. expected, i);
9864 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9865 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9868 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9871 ok(hr == prop.expected,
9872 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9873 hr, prop.expected, i, j);
9876 ok(!strcmp_aw(prop.value, received) ||
9877 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9878 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9879 prop.value, wine_dbgstr_w(received), i, j);
9882 ok(hr == prop.expected,
9883 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9884 hr, prop.expected, i, j);
9885 ok(!strcmp_aw(prop.value, received) ||
9886 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9887 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9888 prop.value, wine_dbgstr_w(received), i, j);
9890 SysFreeString(received);
9893 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9894 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9897 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9900 ok(hr == prop.expected,
9901 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9902 hr, prop.expected, i, j);
9905 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9906 prop.value, received, i, j);
9909 ok(hr == prop.expected,
9910 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9911 hr, prop.expected, i, j);
9912 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9913 prop.value, received, i, j);
9917 if(result) IUri_Release(result);
9919 if(relative) IUri_Release(relative);
9920 heap_free(relativeW);
9922 if(base) IUri_Release(base);
9927 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9928 REFIID riid, void **ppv)
9930 ok(0, "unexpected call\n");
9931 return E_NOINTERFACE;
9934 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9939 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9944 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9945 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9946 DWORD *pcchResult, DWORD dwReserved)
9948 CHECK_EXPECT(ParseUrl);
9949 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
9950 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
9951 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
9952 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
9953 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
9955 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
9956 *pcchResult = lstrlenW(parse_resultW);
9961 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9962 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9963 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9965 CHECK_EXPECT(CombineUrl);
9966 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9967 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9968 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9969 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9970 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9971 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9972 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9974 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9975 *pcchResult = lstrlenW(combine_resultW);
9980 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9981 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9983 ok(0, "unexpected call\n");
9987 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9988 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9989 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9991 ok(0, "unexpected call\n");
9995 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9996 InternetProtocolInfo_QueryInterface,
9997 InternetProtocolInfo_AddRef,
9998 InternetProtocolInfo_Release,
9999 InternetProtocolInfo_ParseUrl,
10000 InternetProtocolInfo_CombineUrl,
10001 InternetProtocolInfo_CompareUrl,
10002 InternetProtocolInfo_QueryInfo
10005 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10007 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10009 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10010 *ppv = &protocol_info;
10014 ok(0, "unexpected call\n");
10015 return E_NOINTERFACE;
10018 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10023 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10028 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10029 REFIID riid, void **ppv)
10031 ok(0, "unexpected call\n");
10035 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10037 ok(0, "unexpected call\n");
10041 static const IClassFactoryVtbl ClassFactoryVtbl = {
10042 ClassFactory_QueryInterface,
10043 ClassFactory_AddRef,
10044 ClassFactory_Release,
10045 ClassFactory_CreateInstance,
10046 ClassFactory_LockServer
10049 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10051 static void register_protocols(void)
10053 IInternetSession *session;
10056 hres = pCoInternetGetSession(0, &session, 0);
10057 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10061 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10062 winetestW, 0, NULL, 0);
10063 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10065 IInternetSession_Release(session);
10068 static void unregister_protocols(void) {
10069 IInternetSession *session;
10072 hr = pCoInternetGetSession(0, &session, 0);
10073 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10077 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10078 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10080 IInternetSession_Release(session);
10083 static void test_CoInternetCombineIUri_Pluggable(void) {
10087 hr = pCreateUri(combine_baseW, 0, 0, &base);
10088 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10089 if(SUCCEEDED(hr)) {
10090 IUri *relative = NULL;
10092 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10093 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10094 if(SUCCEEDED(hr)) {
10095 IUri *result = NULL;
10097 SET_EXPECT(CombineUrl);
10099 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10101 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10103 CHECK_CALLED(CombineUrl);
10105 if(SUCCEEDED(hr)) {
10106 BSTR received = NULL;
10107 hr = IUri_GetAbsoluteUri(result, &received);
10108 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10109 if(SUCCEEDED(hr)) {
10110 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10111 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10113 SysFreeString(received);
10115 if(result) IUri_Release(result);
10117 if(relative) IUri_Release(relative);
10119 if(base) IUri_Release(base);
10122 static void test_CoInternetCombineUrlEx(void) {
10124 IUri *base, *result;
10128 hr = pCreateUri(http_urlW, 0, 0, &base);
10129 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10130 if(SUCCEEDED(hr)) {
10131 result = (void*) 0xdeadbeef;
10132 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10133 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10135 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10138 result = (void*) 0xdeadbeef;
10139 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10140 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10142 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10144 result = (void*) 0xdeadbeef;
10145 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10146 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10148 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10150 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10151 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10153 if(base) IUri_Release(base);
10155 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10156 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10158 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10159 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10160 if(SUCCEEDED(hr)) {
10161 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10163 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10165 if(uri_combine_tests[i].todo) {
10167 ok(hr == uri_combine_tests[i].expected,
10168 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10169 hr, uri_combine_tests[i].expected, i);
10172 ok(hr == uri_combine_tests[i].expected,
10173 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10174 hr, uri_combine_tests[i]. expected, i);
10176 if(SUCCEEDED(hr)) {
10179 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10180 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10182 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10184 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10187 ok(hr == prop.expected,
10188 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10189 hr, prop.expected, i, j);
10192 ok(!strcmp_aw(value, received) ||
10193 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10194 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10195 value, wine_dbgstr_w(received), i, j);
10198 ok(hr == prop.expected,
10199 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10200 hr, prop.expected, i, j);
10201 ok(!strcmp_aw(value, received) ||
10202 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10203 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10204 value, wine_dbgstr_w(received), i, j);
10206 SysFreeString(received);
10209 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10210 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10213 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10216 ok(hr == prop.expected,
10217 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10218 hr, prop.expected, i, j);
10221 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10222 prop.value, received, i, j);
10225 ok(hr == prop.expected,
10226 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10227 hr, prop.expected, i, j);
10228 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10229 prop.value, received, i, j);
10233 if(result) IUri_Release(result);
10234 heap_free(relativeW);
10236 if(base) IUri_Release(base);
10241 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10245 hr = pCreateUri(combine_baseW, 0, 0, &base);
10246 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10247 if(SUCCEEDED(hr)) {
10248 IUri *result = NULL;
10250 SET_EXPECT(CombineUrl);
10252 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10254 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10256 CHECK_CALLED(CombineUrl);
10258 if(SUCCEEDED(hr)) {
10259 BSTR received = NULL;
10260 hr = IUri_GetAbsoluteUri(result, &received);
10261 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10262 if(SUCCEEDED(hr)) {
10263 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10264 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10266 SysFreeString(received);
10268 if(result) IUri_Release(result);
10270 if(base) IUri_Release(base);
10273 static void test_CoInternetParseIUri_InvalidArgs(void) {
10279 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10280 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10282 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10284 hr = pCreateUri(http_urlW, 0, 0, &uri);
10285 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10286 if(SUCCEEDED(hr)) {
10287 DWORD expected_len;
10290 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10291 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10293 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10295 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10296 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10300 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10301 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10303 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10306 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10307 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10309 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10312 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10313 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10315 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10318 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10319 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10321 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10323 expected_len = lstrlenW(http_urlW);
10325 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10326 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10327 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10328 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10329 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10330 expected_len, result);
10332 if(uri) IUri_Release(uri);
10335 static void test_CoInternetParseIUri(void) {
10338 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10342 uri_parse_test test = uri_parse_tests[i];
10344 uriW = a2w(test.uri);
10345 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10346 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10347 if(SUCCEEDED(hr)) {
10348 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10349 DWORD result_len = -1;
10351 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10354 ok(hr == test.expected,
10355 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10356 hr, test.expected, i);
10359 ok(hr == test.expected,
10360 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10361 hr, test.expected, i);
10363 if(SUCCEEDED(hr)) {
10364 DWORD len = lstrlenA(test.property);
10365 ok(!strcmp_aw(test.property, result),
10366 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10367 test.property, wine_dbgstr_w(result), i);
10368 ok(len == result_len,
10369 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10370 len, result_len, i);
10373 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10377 if(uri) IUri_Release(uri);
10382 static void test_CoInternetParseIUri_Pluggable(void) {
10386 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10387 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10388 if(SUCCEEDED(hr)) {
10392 SET_EXPECT(ParseUrl);
10394 parse_action = PARSE_CANONICALIZE;
10395 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10397 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10398 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10400 CHECK_CALLED(ParseUrl);
10402 if(SUCCEEDED(hr)) {
10403 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10404 lstrlenW(parse_resultW), result_len);
10405 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10406 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10409 if(uri) IUri_Release(uri);
10415 const char *base_url;
10416 DWORD base_uri_flags;
10417 const char *legacy_url;
10418 const char *uniform_url;
10419 const char *no_canon_url;
10420 const char *uri_url;
10421 } create_urlmon_test_t;
10423 static const create_urlmon_test_t create_urlmon_tests[] = {
10425 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10427 "http://www.winehq.org/",
10428 "http://www.winehq.org/",
10429 "http://www.winehq.org",
10430 "http://www.winehq.org"
10433 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10435 "file://c:\\dir\\file.txt",
10436 "file:///c:/dir/file.txt",
10437 "file:///c:/dir/file.txt",
10438 "file:///c:/dir/file.txt"
10441 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10443 "file://c:\\dir\\file.txt",
10444 "file:///c:/dir/file.txt",
10445 "file:///c:/dir/file.txt",
10446 "file://c:\\dir\\file.txt"
10449 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10450 "http://www.winehq.org",0,
10451 "http://www.winehq.org/data",
10452 "http://www.winehq.org/data",
10453 "http://www.winehq.org:80/data",
10456 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10457 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10458 "file://c:\\dir\\file.txt",
10459 "file:///c:/dir/file.txt",
10460 "file:///c:/dir/file.txt",
10463 "",Uri_CREATE_ALLOW_RELATIVE,
10471 "test",Uri_CREATE_ALLOW_RELATIVE,
10479 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10481 "file://c:\\dir\\file.txt",
10482 "file:///c:/dir/file.txt",
10483 "file:///c:/dir/file.txt",
10484 "file:///c:/dir/file.txt",
10488 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10489 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10491 WCHAR *display_name;
10494 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10495 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10496 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10497 wine_dbgstr_w(display_name), exurl);
10499 CoTaskMemFree(display_name);
10502 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10503 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10505 IUriContainer *uri_container;
10510 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10511 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10514 hres = IUriContainer_GetIUri(uri_container, &uri);
10515 IUriContainer_Release(uri_container);
10516 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10517 ok(uri != NULL, "uri == NULL\n");
10519 hres = IUri_GetDisplayUri(uri, &display_uri);
10521 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10522 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10523 wine_dbgstr_w(display_uri), exurl);
10524 SysFreeString(display_uri);
10527 static void test_CreateURLMoniker(void)
10529 const create_urlmon_test_t *test;
10530 IMoniker *mon, *base_mon;
10531 WCHAR *url, *base_url;
10532 IUri *uri, *base_uri;
10535 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10536 url = a2w(test->url);
10537 base_url = a2w(test->base_url);
10540 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10541 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10543 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10544 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10550 hres = CreateURLMoniker(base_mon, url, &mon);
10551 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10552 test_urlmon_display_name(mon, test->legacy_url);
10553 test_display_uri(mon, test->legacy_url);
10554 IMoniker_Release(mon);
10556 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10557 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10558 test_urlmon_display_name(mon, test->legacy_url);
10559 test_display_uri(mon, test->legacy_url);
10560 IMoniker_Release(mon);
10562 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10563 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10564 test_urlmon_display_name(mon, test->uniform_url);
10565 test_display_uri(mon, test->uniform_url);
10566 IMoniker_Release(mon);
10568 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10569 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10570 test_urlmon_display_name(mon, test->no_canon_url);
10571 test_display_uri(mon, test->no_canon_url);
10572 IMoniker_Release(mon);
10574 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10575 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10577 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10578 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10579 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10580 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10581 IMoniker_Release(mon);
10583 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10584 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10585 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10586 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10587 IMoniker_Release(mon);
10589 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10590 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10591 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10592 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10593 IMoniker_Release(mon);
10597 heap_free(base_url);
10599 IUri_Release(base_uri);
10601 IMoniker_Release(base_mon);
10608 hurlmon = GetModuleHandle("urlmon.dll");
10609 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
10610 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
10611 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
10612 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
10613 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
10614 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
10615 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
10616 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
10617 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
10620 win_skip("CreateUri is not present, skipping tests.\n");
10624 trace("test CreateUri invalid flags...\n");
10625 test_CreateUri_InvalidFlags();
10627 trace("test CreateUri invalid args...\n");
10628 test_CreateUri_InvalidArgs();
10630 trace("test CreateUri invalid URIs...\n");
10631 test_CreateUri_InvalidUri();
10633 trace("test IUri_GetPropertyBSTR...\n");
10634 test_IUri_GetPropertyBSTR();
10636 trace("test IUri_GetPropertyDWORD...\n");
10637 test_IUri_GetPropertyDWORD();
10639 trace("test IUri_GetStrProperties...\n");
10640 test_IUri_GetStrProperties();
10642 trace("test IUri_GetDwordProperties...\n");
10643 test_IUri_GetDwordProperties();
10645 trace("test IUri_GetPropertyLength...\n");
10646 test_IUri_GetPropertyLength();
10648 trace("test IUri_GetProperties...\n");
10649 test_IUri_GetProperties();
10651 trace("test IUri_HasProperty...\n");
10652 test_IUri_HasProperty();
10654 trace("test IUri_IsEqual...\n");
10655 test_IUri_IsEqual();
10657 trace("test CreateUriWithFragment invalid args...\n");
10658 test_CreateUriWithFragment_InvalidArgs();
10660 trace("test CreateUriWithFragment invalid flags...\n");
10661 test_CreateUriWithFragment_InvalidFlags();
10663 trace("test CreateUriWithFragment...\n");
10664 test_CreateUriWithFragment();
10666 trace("test CreateIUriBuilder...\n");
10667 test_CreateIUriBuilder();
10669 trace("test IUriBuilder_CreateInvalidArgs...\n");
10670 test_IUriBuilder_CreateInvalidArgs();
10672 trace("test IUriBuilder...\n");
10673 test_IUriBuilder();
10675 trace("test IUriBuilder_GetInvalidArgs...\n");
10676 test_IUriBuilder_GetInvalidArgs();
10678 trace("test IUriBuilder_HasBeenModified...\n");
10679 test_IUriBuilder_HasBeenModified();
10681 trace("test IUriBuilder_IUriProperty...\n");
10682 test_IUriBuilder_IUriProperty();
10684 trace("test IUriBuilder_RemoveProperties...\n");
10685 test_IUriBuilder_RemoveProperties();
10687 trace("test IUriBuilder miscellaneous...\n");
10688 test_IUriBuilder_Misc();
10690 trace("test IUriBuilderFactory...\n");
10691 test_IUriBuilderFactory();
10693 trace("test CoInternetCombineIUri...\n");
10694 test_CoInternetCombineIUri();
10696 trace("test CoInternetCombineUrlEx...\n");
10697 test_CoInternetCombineUrlEx();
10699 trace("test CoInternetParseIUri Invalid Args...\n");
10700 test_CoInternetParseIUri_InvalidArgs();
10702 trace("test CoInternetParseIUri...\n");
10703 test_CoInternetParseIUri();
10705 register_protocols();
10707 trace("test CoInternetCombineIUri pluggable...\n");
10708 test_CoInternetCombineIUri_Pluggable();
10710 trace("test CoInternetCombineUrlEx Pluggable...\n");
10711 test_CoInternetCombineUrlEx_Pluggable();
10713 trace("test CoInternetParseIUri pluggable...\n");
10714 test_CoInternetParseIUri_Pluggable();
10716 trace("test CreateURLMoniker...\n");
10717 test_CreateURLMoniker();
10719 unregister_protocols();