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>
34 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
35 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
36 #define URI_BUILDER_STR_PROPERTY_COUNT 7
38 #define DEFINE_EXPECT(func) \
39 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
41 #define SET_EXPECT(func) \
42 expect_ ## func = TRUE
44 #define CHECK_EXPECT(func) \
46 ok(expect_ ##func, "unexpected call " #func "\n"); \
47 expect_ ## func = FALSE; \
48 called_ ## func = TRUE; \
51 #define CHECK_EXPECT2(func) \
53 ok(expect_ ##func, "unexpected call " #func "\n"); \
54 called_ ## func = TRUE; \
57 #define CHECK_CALLED(func) \
59 ok(called_ ## func, "expected " #func "\n"); \
60 expect_ ## func = called_ ## func = FALSE; \
63 DEFINE_EXPECT(CombineUrl);
65 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
66 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
67 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
68 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
69 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
70 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
72 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
73 '.','o','r','g','/',0};
74 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
75 '.','o','r','g','/','#','F','r','a','g',0};
77 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
78 'e','s','t','i','n','g',0};
79 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
80 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
82 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
84 typedef struct _uri_create_flag_test {
87 } uri_create_flag_test;
89 static const uri_create_flag_test invalid_flag_tests[] = {
90 /* Set of invalid flag combinations to test for. */
91 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
92 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
93 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
94 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
95 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
98 typedef struct _uri_str_property {
102 const char* broken_value;
105 typedef struct _uri_dword_property {
109 } uri_dword_property;
111 typedef struct _uri_properties {
114 HRESULT create_expected;
117 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
118 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
121 static const uri_properties uri_tests[] = {
122 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
124 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
125 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
126 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
127 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
128 {"",S_FALSE,FALSE}, /* EXTENSION */
129 {"",S_FALSE,FALSE}, /* FRAGMENT */
130 {"www.winehq.org",S_OK,FALSE}, /* HOST */
131 {"",S_FALSE,FALSE}, /* PASSWORD */
132 {"/",S_OK,FALSE}, /* PATH */
133 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
134 {"",S_FALSE,FALSE}, /* QUERY */
135 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
136 {"http",S_OK,FALSE}, /* SCHEME_NAME */
137 {"",S_FALSE,FALSE}, /* USER_INFO */
138 {"",S_FALSE,FALSE} /* USER_NAME */
141 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
142 {80,S_OK,FALSE}, /* PORT */
143 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
144 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
147 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
149 {"http://winehq.org/tests",S_OK,FALSE},
150 {"winehq.org",S_OK,FALSE},
151 {"http://winehq.org/tests",S_OK,FALSE},
152 {"winehq.org",S_OK,FALSE},
155 {"winehq.org",S_OK,FALSE},
157 {"/tests",S_OK,FALSE},
158 {"/tests",S_OK,FALSE},
160 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
166 {Uri_HOST_DNS,S_OK,FALSE},
168 {URL_SCHEME_HTTP,S_OK,FALSE},
169 {URLZONE_INVALID,E_NOTIMPL,FALSE}
172 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
174 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
175 {"www.winehq.org",S_OK,FALSE},
176 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
177 {"winehq.org",S_OK,FALSE},
180 {"www.winehq.org",S_OK,FALSE},
183 {"/?query=x&return=y",S_OK,FALSE},
184 {"?query=x&return=y",S_OK,FALSE},
185 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
191 {Uri_HOST_DNS,S_OK,FALSE},
193 {URL_SCHEME_HTTP,S_OK,FALSE},
194 {URLZONE_INVALID,E_NOTIMPL,FALSE},
197 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
199 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
200 {"usEr%3Ainfo@example.com",S_OK,FALSE},
201 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
202 {"example.com",S_OK,FALSE},
205 {"example.com",S_OK,FALSE},
207 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
208 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
210 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
212 {"usEr%3Ainfo",S_OK,FALSE},
213 {"usEr%3Ainfo",S_OK,FALSE}
216 {Uri_HOST_DNS,S_OK,FALSE},
218 {URL_SCHEME_HTTP,S_OK,FALSE},
219 {URLZONE_INVALID,E_NOTIMPL,FALSE},
222 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
224 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
225 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
226 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
227 {"winehq.org",S_OK,FALSE},
230 {"ftp.winehq.org",S_OK,FALSE},
232 {"/dir/foo%20bar.txt",S_OK,FALSE},
233 {"/dir/foo%20bar.txt",S_OK,FALSE},
235 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
237 {"winepass:wine",S_OK,FALSE},
238 {"winepass",S_OK,FALSE}
241 {Uri_HOST_DNS,S_OK,FALSE},
243 {URL_SCHEME_FTP,S_OK,FALSE},
244 {URLZONE_INVALID,E_NOTIMPL,FALSE}
247 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
249 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
251 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
257 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
258 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
260 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
266 {Uri_HOST_UNKNOWN,S_OK,FALSE},
268 {URL_SCHEME_FILE,S_OK,FALSE},
269 {URLZONE_INVALID,E_NOTIMPL,FALSE}
272 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
274 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
276 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
282 {"/tests/test%20file.README.txt",S_OK,FALSE},
283 {"/tests/test%20file.README.txt",S_OK,FALSE},
285 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
291 {Uri_HOST_UNKNOWN,S_OK,FALSE},
293 {URL_SCHEME_FILE,S_OK,FALSE},
294 {URLZONE_INVALID,E_NOTIMPL,FALSE}
297 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
299 {"urn:nothing:should:happen here",S_OK,FALSE},
301 {"urn:nothing:should:happen here",S_OK,FALSE},
307 {"nothing:should:happen here",S_OK,FALSE},
308 {"nothing:should:happen here",S_OK,FALSE},
310 {"urn:nothing:should:happen here",S_OK,FALSE},
316 {Uri_HOST_UNKNOWN,S_OK,FALSE},
318 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
319 {URLZONE_INVALID,E_NOTIMPL,FALSE}
322 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
324 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
325 {"127.0.0.1",S_OK,FALSE},
326 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
330 {"127.0.0.1",S_OK,FALSE},
332 {"/test%20dir/test.txt",S_OK,FALSE},
333 {"/test%20dir/test.txt",S_OK,FALSE},
335 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
341 {Uri_HOST_IPV4,S_OK,FALSE},
343 {URL_SCHEME_HTTP,S_OK,FALSE},
344 {URLZONE_INVALID,E_NOTIMPL,FALSE}
347 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
349 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
350 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
351 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
355 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
360 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
366 {Uri_HOST_IPV6,S_OK,FALSE},
368 {URL_SCHEME_HTTP,S_OK,FALSE},
369 {URLZONE_INVALID,E_NOTIMPL,FALSE}
372 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
374 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
375 {"[::13.1.68.3]",S_OK,FALSE},
376 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
380 {"::13.1.68.3",S_OK,FALSE},
385 {"ftp://[::13.1.68.3]",S_OK,FALSE},
391 {Uri_HOST_IPV6,S_OK,FALSE},
393 {URL_SCHEME_FTP,S_OK,FALSE},
394 {URLZONE_INVALID,E_NOTIMPL,FALSE}
397 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
399 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
400 {"[fedc:ba98::3210]",S_OK,FALSE},
401 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
405 {"fedc:ba98::3210",S_OK,FALSE},
410 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
416 {Uri_HOST_IPV6,S_OK,FALSE},
418 {URL_SCHEME_HTTP,S_OK,FALSE},
419 {URLZONE_INVALID,E_NOTIMPL,FALSE}
422 { "1234://www.winehq.org", 0, S_OK, FALSE,
424 {"1234://www.winehq.org/",S_OK,FALSE},
425 {"www.winehq.org",S_OK,FALSE},
426 {"1234://www.winehq.org/",S_OK,FALSE},
427 {"winehq.org",S_OK,FALSE},
430 {"www.winehq.org",S_OK,FALSE},
435 {"1234://www.winehq.org",S_OK,FALSE},
441 {Uri_HOST_DNS,S_OK,FALSE},
443 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
444 {URLZONE_INVALID,E_NOTIMPL,FALSE}
447 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
448 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
450 {"file:///C:/test/test.mp3",S_OK,FALSE},
452 {"file:///C:/test/test.mp3",S_OK,FALSE},
458 {"/C:/test/test.mp3",S_OK,FALSE},
459 {"/C:/test/test.mp3",S_OK,FALSE},
461 {"C:/test/test.mp3",S_OK,FALSE},
467 {Uri_HOST_UNKNOWN,S_OK,FALSE},
469 {URL_SCHEME_FILE,S_OK,FALSE},
470 {URLZONE_INVALID,E_NOTIMPL,FALSE}
473 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
474 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
476 {"file://server/test.mp3",S_OK,FALSE},
477 {"server",S_OK,FALSE},
478 {"file://server/test.mp3",S_OK,FALSE},
482 {"server",S_OK,FALSE},
484 {"/test.mp3",S_OK,FALSE},
485 {"/test.mp3",S_OK,FALSE},
487 {"\\\\Server/test.mp3",S_OK,FALSE},
493 {Uri_HOST_DNS,S_OK,FALSE},
495 {URL_SCHEME_FILE,S_OK,FALSE},
496 {URLZONE_INVALID,E_NOTIMPL,FALSE}
499 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
501 {"*:www.winehq.org/test",S_OK,FALSE},
502 {"www.winehq.org",S_OK,FALSE},
503 {"*:www.winehq.org/test",S_OK,FALSE},
504 {"winehq.org",S_OK,FALSE},
507 {"www.winehq.org",S_OK,FALSE},
509 {"/test",S_OK,FALSE},
510 {"/test",S_OK,FALSE},
512 {"www.winehq.org/test",S_OK,FALSE},
518 {Uri_HOST_DNS,S_OK,FALSE},
520 {URL_SCHEME_WILDCARD,S_OK,FALSE},
521 {URLZONE_INVALID,E_NOTIMPL,FALSE}
524 /* Valid since the '*' is the only character in the scheme name. */
525 { "*:www.winehq.org/test", 0, S_OK, FALSE,
527 {"*:www.winehq.org/test",S_OK,FALSE},
528 {"www.winehq.org",S_OK,FALSE},
529 {"*:www.winehq.org/test",S_OK,FALSE},
530 {"winehq.org",S_OK,FALSE},
533 {"www.winehq.org",S_OK,FALSE},
535 {"/test",S_OK,FALSE},
536 {"/test",S_OK,FALSE},
538 {"*:www.winehq.org/test",S_OK,FALSE},
544 {Uri_HOST_DNS,S_OK,FALSE},
546 {URL_SCHEME_WILDCARD,S_OK,FALSE},
547 {URLZONE_INVALID,E_NOTIMPL,FALSE}
550 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
552 {"/../some dir/test.ext",S_OK,FALSE},
554 {"/../some dir/test.ext",S_OK,FALSE},
560 {"/../some dir/test.ext",S_OK,FALSE},
561 {"/../some dir/test.ext",S_OK,FALSE},
563 {"/../some dir/test.ext",S_OK,FALSE},
569 {Uri_HOST_UNKNOWN,S_OK,FALSE},
571 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
572 {URLZONE_INVALID,E_NOTIMPL,FALSE}
575 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
577 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
579 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
585 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
586 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
588 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
594 {Uri_HOST_UNKNOWN,S_OK,FALSE},
596 {URL_SCHEME_WILDCARD,S_OK,FALSE},
597 {URLZONE_INVALID,E_NOTIMPL,FALSE}
600 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
601 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
603 {"zip:/.//google.com",S_OK,FALSE},
605 {"zip:/.//google.com",S_OK,FALSE},
611 {"/.//google.com",S_OK,FALSE},
612 {"/.//google.com",S_OK,FALSE},
614 {"zip://google.com",S_OK,FALSE},
620 {Uri_HOST_UNKNOWN,S_OK,FALSE},
622 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
623 {URLZONE_INVALID,E_NOTIMPL,FALSE}
626 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
627 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
629 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
630 {"user:pass:word@winehq.org",S_OK,FALSE},
631 {"ftp://winehq.org/",S_OK,FALSE},
632 {"winehq.org",S_OK,FALSE},
635 {"winehq.org",S_OK,FALSE},
636 {"pass:word",S_OK,FALSE},
640 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
642 {"user:pass:word",S_OK,FALSE},
646 {Uri_HOST_DNS,S_OK,FALSE},
648 {URL_SCHEME_FTP,S_OK,FALSE},
649 {URLZONE_INVALID,E_NOTIMPL,FALSE}
652 /* Make sure % encoded unreserved characters are decoded. */
653 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
655 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
656 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
657 {"ftp://ftp.google.com/",S_OK,FALSE},
658 {"google.com",S_OK,FALSE},
661 {"ftp.google.com",S_OK,FALSE},
666 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
668 {"wINe:PASS",S_OK,FALSE},
672 {Uri_HOST_DNS,S_OK,FALSE},
674 {URL_SCHEME_FTP,S_OK,FALSE},
675 {URLZONE_INVALID,E_NOTIMPL,FALSE}
678 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
679 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
681 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
682 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
683 {"ftp://ftp.google.com/",S_OK,FALSE},
684 {"google.com",S_OK,FALSE},
687 {"ftp.google.com",S_OK,FALSE},
688 {"PA%7B%7D",S_OK,FALSE},
692 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
694 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
695 {"w%5D%5Be",S_OK,FALSE}
698 {Uri_HOST_DNS,S_OK,FALSE},
700 {URL_SCHEME_FTP,S_OK,FALSE},
701 {URLZONE_INVALID,E_NOTIMPL,FALSE}
704 /* You're allowed to have an empty password portion in the userinfo section. */
705 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
707 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
708 {"empty:@ftp.google.com",S_OK,FALSE},
709 {"ftp://ftp.google.com/",S_OK,FALSE},
710 {"google.com",S_OK,FALSE},
713 {"ftp.google.com",S_OK,FALSE},
718 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
720 {"empty:",S_OK,FALSE},
724 {Uri_HOST_DNS,S_OK,FALSE},
726 {URL_SCHEME_FTP,S_OK,FALSE},
727 {URLZONE_INVALID,E_NOTIMPL,FALSE}
730 /* Make sure forbidden characters in "userinfo" get encoded. */
731 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
733 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
734 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
735 {"ftp://ftp.google.com/",S_OK,FALSE},
736 {"google.com",S_OK,FALSE},
739 {"ftp.google.com",S_OK,FALSE},
744 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
746 {"%22%20%22weird",S_OK,FALSE},
747 {"%22%20%22weird",S_OK,FALSE}
750 {Uri_HOST_DNS,S_OK,FALSE},
752 {URL_SCHEME_FTP,S_OK,FALSE},
753 {URLZONE_INVALID,E_NOTIMPL,FALSE}
756 /* Make sure the forbidden characters don't get percent encoded. */
757 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
759 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
760 {"\" \"weird@ftp.google.com",S_OK,FALSE},
761 {"ftp://ftp.google.com/",S_OK,FALSE},
762 {"google.com",S_OK,FALSE},
765 {"ftp.google.com",S_OK,FALSE},
770 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
772 {"\" \"weird",S_OK,FALSE},
773 {"\" \"weird",S_OK,FALSE}
776 {Uri_HOST_DNS,S_OK,FALSE},
778 {URL_SCHEME_FTP,S_OK,FALSE},
779 {URLZONE_INVALID,E_NOTIMPL,FALSE}
782 /* Allowed to have invalid % encoded because its an unknown scheme type. */
783 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
785 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
786 {"%xy:word@winehq.org",S_OK,FALSE},
787 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
788 {"winehq.org",S_OK,FALSE},
791 {"winehq.org",S_OK,FALSE},
796 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
798 {"%xy:word",S_OK,FALSE},
802 {Uri_HOST_DNS,S_OK,FALSE},
804 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
805 {URLZONE_INVALID,E_NOTIMPL,FALSE}
808 /* Unreserved, percent encoded characters aren't decoded in the userinfo becuase the scheme
811 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
813 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
814 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
815 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
816 {"winehq.org",S_OK,FALSE},
819 {"winehq.org",S_OK,FALSE},
820 {"%52%53ord",S_OK,FALSE},
824 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
826 {"%2E:%52%53ord",S_OK,FALSE},
830 {Uri_HOST_DNS,S_OK,FALSE},
832 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
833 {URLZONE_INVALID,E_NOTIMPL,FALSE}
836 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
838 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
839 {"[](),'test':word@winehq.org",S_OK,FALSE},
840 {"ftp://winehq.org/",S_OK,FALSE},
841 {"winehq.org",S_OK,FALSE},
844 {"winehq.org",S_OK,FALSE},
849 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
851 {"[](),'test':word",S_OK,FALSE},
852 {"[](),'test'",S_OK,FALSE}
855 {Uri_HOST_DNS,S_OK,FALSE},
857 {URL_SCHEME_FTP,S_OK,FALSE},
858 {URLZONE_INVALID,E_NOTIMPL,FALSE}
861 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
863 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
865 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
872 {"/?:word@winehq.org/",S_OK,FALSE},
873 {"?:word@winehq.org/",S_OK,FALSE},
874 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
880 {Uri_HOST_DNS,S_OK,FALSE},
882 {URL_SCHEME_FTP,S_OK,FALSE},
883 {URLZONE_INVALID,E_NOTIMPL,FALSE}
886 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
888 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
890 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
893 {"#:word@winehq.org/",S_OK,FALSE},
899 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
905 {Uri_HOST_DNS,S_OK,FALSE},
907 {URL_SCHEME_FTP,S_OK,FALSE},
908 {URLZONE_INVALID,E_NOTIMPL,FALSE}
911 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
912 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
914 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
915 {"test\\:word@winehq.org",S_OK,FALSE},
916 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
917 {"winehq.org",S_OK,FALSE},
920 {"winehq.org",S_OK,FALSE},
925 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
927 {"test\\:word",S_OK,FALSE},
928 {"test\\",S_OK,FALSE}
931 {Uri_HOST_DNS,S_OK,FALSE},
933 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
934 {URLZONE_INVALID,E_NOTIMPL,FALSE}
937 /* It normalizes IPv4 addresses correctly. */
938 { "http://127.000.000.100/", 0, S_OK, FALSE,
940 {"http://127.0.0.100/",S_OK,FALSE},
941 {"127.0.0.100",S_OK,FALSE},
942 {"http://127.0.0.100/",S_OK,FALSE},
946 {"127.0.0.100",S_OK,FALSE},
951 {"http://127.000.000.100/",S_OK,FALSE},
957 {Uri_HOST_IPV4,S_OK,FALSE},
959 {URL_SCHEME_HTTP,S_OK,FALSE},
960 {URLZONE_INVALID,E_NOTIMPL,FALSE}
963 /* Make sure it normalizes partial IPv4 addresses correctly. */
964 { "http://127.0/", 0, S_OK, FALSE,
966 {"http://127.0.0.0/",S_OK,FALSE},
967 {"127.0.0.0",S_OK,FALSE},
968 {"http://127.0.0.0/",S_OK,FALSE},
972 {"127.0.0.0",S_OK,FALSE},
977 {"http://127.0/",S_OK,FALSE},
983 {Uri_HOST_IPV4,S_OK,FALSE},
985 {URL_SCHEME_HTTP,S_OK,FALSE},
986 {URLZONE_INVALID,E_NOTIMPL,FALSE}
989 /* Make sure it converts implicit IPv4's correctly. */
990 { "http://123456/", 0, S_OK, FALSE,
992 {"http://0.1.226.64/",S_OK,FALSE},
993 {"0.1.226.64",S_OK,FALSE},
994 {"http://0.1.226.64/",S_OK,FALSE},
998 {"0.1.226.64",S_OK,FALSE},
1003 {"http://123456/",S_OK,FALSE},
1004 {"http",S_OK,FALSE},
1009 {Uri_HOST_IPV4,S_OK,FALSE},
1011 {URL_SCHEME_HTTP,S_OK,FALSE},
1012 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1016 { "http://4294967295/", 0, S_OK, FALSE,
1018 {"http://255.255.255.255/",S_OK,FALSE},
1019 {"255.255.255.255",S_OK,FALSE},
1020 {"http://255.255.255.255/",S_OK,FALSE},
1024 {"255.255.255.255",S_OK,FALSE},
1029 {"http://4294967295/",S_OK,FALSE},
1030 {"http",S_OK,FALSE},
1035 {Uri_HOST_IPV4,S_OK,FALSE},
1037 {URL_SCHEME_HTTP,S_OK,FALSE},
1038 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1042 { "http://4294967296/", 0, S_OK, FALSE,
1044 {"http://4294967296/",S_OK,FALSE},
1045 {"4294967296",S_OK,FALSE},
1046 {"http://4294967296/",S_OK,FALSE},
1050 {"4294967296",S_OK,FALSE},
1055 {"http://4294967296/",S_OK,FALSE},
1056 {"http",S_OK,FALSE},
1061 {Uri_HOST_DNS,S_OK,FALSE},
1063 {URL_SCHEME_HTTP,S_OK,FALSE},
1064 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1067 /* Window's doesn't normalize IP address for unknown schemes. */
1068 { "1234://4294967295/", 0, S_OK, FALSE,
1070 {"1234://4294967295/",S_OK,FALSE},
1071 {"4294967295",S_OK,FALSE},
1072 {"1234://4294967295/",S_OK,FALSE},
1076 {"4294967295",S_OK,FALSE},
1081 {"1234://4294967295/",S_OK,FALSE},
1082 {"1234",S_OK,FALSE},
1087 {Uri_HOST_IPV4,S_OK,FALSE},
1089 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1090 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1093 /* Window's doesn't normalize IP address for unknown schemes. */
1094 { "1234://127.001/", 0, S_OK, FALSE,
1096 {"1234://127.001/",S_OK,FALSE},
1097 {"127.001",S_OK,FALSE},
1098 {"1234://127.001/",S_OK,FALSE},
1102 {"127.001",S_OK,FALSE},
1107 {"1234://127.001/",S_OK,FALSE},
1108 {"1234",S_OK,FALSE},
1113 {Uri_HOST_IPV4,S_OK,FALSE},
1115 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1116 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1119 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1121 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1122 {"[fedc:ba98::3210]",S_OK,FALSE},
1123 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1127 {"fedc:ba98::3210",S_OK,FALSE},
1132 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1133 {"http",S_OK,FALSE},
1138 {Uri_HOST_IPV6,S_OK,FALSE},
1140 {URL_SCHEME_HTTP,S_OK,FALSE},
1141 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1144 { "http://[::]", 0, S_OK, FALSE,
1146 {"http://[::]/",S_OK,FALSE},
1147 {"[::]",S_OK,FALSE},
1148 {"http://[::]/",S_OK,FALSE},
1157 {"http://[::]",S_OK,FALSE},
1158 {"http",S_OK,FALSE},
1163 {Uri_HOST_IPV6,S_OK,FALSE},
1165 {URL_SCHEME_HTTP,S_OK,FALSE},
1166 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1169 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1171 {"http://[fedc:ba98::]/",S_OK,FALSE},
1172 {"[fedc:ba98::]",S_OK,FALSE},
1173 {"http://[fedc:ba98::]/",S_OK,FALSE},
1177 {"fedc:ba98::",S_OK,FALSE},
1182 {"http://[FEDC:BA98::]",S_OK,FALSE},
1183 {"http",S_OK,FALSE},
1188 {Uri_HOST_IPV6,S_OK,FALSE},
1190 {URL_SCHEME_HTTP,S_OK,FALSE},
1191 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1194 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1195 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1197 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1198 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1199 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1203 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1208 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1209 {"http",S_OK,FALSE},
1214 {Uri_HOST_IPV6,S_OK,FALSE},
1216 {URL_SCHEME_HTTP,S_OK,FALSE},
1217 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1220 { "http://[v2.34]/", 0, S_OK, FALSE,
1222 {"http://[v2.34]/",S_OK,FALSE},
1223 {"[v2.34]",S_OK,FALSE},
1224 {"http://[v2.34]/",S_OK,FALSE},
1228 {"[v2.34]",S_OK,FALSE},
1233 {"http://[v2.34]/",S_OK,FALSE},
1234 {"http",S_OK,FALSE},
1239 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1241 {URL_SCHEME_HTTP,S_OK,FALSE},
1242 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1245 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1246 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1248 {"http://[xyz:12345.com/test",S_OK,FALSE},
1249 {"[xyz:12345.com",S_OK,FALSE},
1250 {"http://[xyz:12345.com/test",S_OK,FALSE},
1251 {"[xyz:12345.com",S_OK,FALSE},
1254 {"[xyz:12345.com",S_OK,FALSE},
1256 {"/test",S_OK,FALSE},
1257 {"/test",S_OK,FALSE},
1259 {"http://[xyz:12345.com/test",S_OK,FALSE},
1260 {"http",S_OK,FALSE},
1265 {Uri_HOST_DNS,S_OK,FALSE},
1267 {URL_SCHEME_HTTP,S_OK,FALSE},
1268 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1271 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1272 * of the host name (respectively).
1274 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1276 {"ftp://www.[works].com/",S_OK,FALSE},
1277 {"www.[works].com",S_OK,FALSE},
1278 {"ftp://www.[works].com/",S_OK,FALSE},
1279 {"[works].com",S_OK,FALSE},
1282 {"www.[works].com",S_OK,FALSE},
1287 {"ftp://www.[works].com/",S_OK,FALSE},
1293 {Uri_HOST_DNS,S_OK,FALSE},
1295 {URL_SCHEME_FTP,S_OK,FALSE},
1296 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1299 /* Considers ':' a delimiter since it appears after the ']'. */
1300 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1302 {"http://www.google.com]:12345/",S_OK,FALSE},
1303 {"www.google.com]:12345",S_OK,FALSE},
1304 {"http://www.google.com]:12345/",S_OK,FALSE},
1305 {"google.com]",S_OK,FALSE},
1308 {"www.google.com]",S_OK,FALSE},
1313 {"http://www.google.com]:12345/",S_OK,FALSE},
1314 {"http",S_OK,FALSE},
1319 {Uri_HOST_DNS,S_OK,FALSE},
1321 {URL_SCHEME_HTTP,S_OK,FALSE},
1322 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1325 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1326 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1328 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1329 {"w%XXw%GEw.google.com",S_OK,FALSE},
1330 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1331 {"google.com",S_OK,FALSE},
1334 {"w%XXw%GEw.google.com",S_OK,FALSE},
1339 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1345 {Uri_HOST_DNS,S_OK,FALSE},
1347 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1348 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1351 /* Unknown scheme types hostname doesn't get lower cased. */
1352 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1354 {"zip://GOOGLE.com/",S_OK,FALSE},
1355 {"GOOGLE.com",S_OK,FALSE},
1356 {"zip://GOOGLE.com/",S_OK,FALSE},
1357 {"GOOGLE.com",S_OK,FALSE},
1360 {"GOOGLE.com",S_OK,FALSE},
1365 {"zip://GOOGLE.com/",S_OK,FALSE},
1371 {Uri_HOST_DNS,S_OK,FALSE},
1373 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1374 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1377 /* Hostname get's lower cased for known scheme types. */
1378 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1380 {"http://www.google.com/",S_OK,FALSE},
1381 {"www.google.com",S_OK,FALSE},
1382 {"http://www.google.com/",S_OK,FALSE},
1383 {"google.com",S_OK,FALSE},
1386 {"www.google.com",S_OK,FALSE},
1391 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1392 {"http",S_OK,FALSE},
1397 {Uri_HOST_DNS,S_OK,FALSE},
1399 {URL_SCHEME_HTTP,S_OK,FALSE},
1400 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1403 /* Characters that get % encoded in the hostname also have their percent
1404 * encoded forms lower cased.
1406 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1408 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1409 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1410 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1411 {"%7cgoogle%7c.com",S_OK,FALSE},
1414 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1419 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1420 {"http",S_OK,FALSE},
1425 {Uri_HOST_DNS,S_OK,FALSE},
1427 {URL_SCHEME_HTTP,S_OK,FALSE},
1428 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1431 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1432 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1434 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1435 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1436 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1440 {"1:2:3:4:5:6::",S_OK,FALSE},
1445 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1446 {"http",S_OK,FALSE},
1451 {Uri_HOST_IPV6,S_OK,FALSE},
1453 {URL_SCHEME_HTTP,S_OK,FALSE},
1454 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1457 /* IPv4 addresses get normalized. */
1458 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1460 {"http://[::1.2.3.0]/",S_OK,FALSE},
1461 {"[::1.2.3.0]",S_OK,FALSE},
1462 {"http://[::1.2.3.0]/",S_OK,FALSE},
1466 {"::1.2.3.0",S_OK,FALSE},
1471 {"http://[::001.002.003.000]",S_OK,FALSE},
1472 {"http",S_OK,FALSE},
1477 {Uri_HOST_IPV6,S_OK,FALSE},
1479 {URL_SCHEME_HTTP,S_OK,FALSE},
1480 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1483 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1484 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1486 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1487 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1488 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1492 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1497 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1503 {Uri_HOST_IPV6,S_OK,FALSE},
1505 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1506 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1509 /* IPv4 address is converted into 2 h16 components. */
1510 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1512 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1513 {"[ffff::c0de:6f20]",S_OK,FALSE},
1514 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1518 {"ffff::c0de:6f20",S_OK,FALSE},
1523 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1524 {"http",S_OK,FALSE},
1529 {Uri_HOST_IPV6,S_OK,FALSE},
1531 {URL_SCHEME_HTTP,S_OK,FALSE},
1532 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1535 /* Max value for a port. */
1536 { "http://google.com:65535", 0, S_OK, FALSE,
1538 {"http://google.com:65535/",S_OK,FALSE},
1539 {"google.com:65535",S_OK,FALSE},
1540 {"http://google.com:65535/",S_OK,FALSE},
1541 {"google.com",S_OK,FALSE},
1544 {"google.com",S_OK,FALSE},
1549 {"http://google.com:65535",S_OK,FALSE},
1550 {"http",S_OK,FALSE},
1555 {Uri_HOST_DNS,S_OK,FALSE},
1557 {URL_SCHEME_HTTP,S_OK,FALSE},
1558 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1561 { "zip://google.com:65536", 0, S_OK, FALSE,
1563 {"zip://google.com:65536/",S_OK,FALSE},
1564 {"google.com:65536",S_OK,FALSE},
1565 {"zip://google.com:65536/",S_OK,FALSE},
1566 {"google.com:65536",S_OK,FALSE},
1569 {"google.com:65536",S_OK,FALSE},
1574 {"zip://google.com:65536",S_OK,FALSE},
1580 {Uri_HOST_DNS,S_OK,FALSE},
1582 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1583 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1586 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1588 {"zip://google.com:65536:25/",S_OK,FALSE},
1589 {"google.com:65536:25",S_OK,FALSE},
1590 {"zip://google.com:65536:25/",S_OK,FALSE},
1591 {"google.com:65536:25",S_OK,FALSE},
1594 {"google.com:65536:25",S_OK,FALSE},
1599 {"zip://google.com:65536:25",S_OK,FALSE},
1605 {Uri_HOST_DNS,S_OK,FALSE},
1607 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1608 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1611 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1613 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1614 {"[::ffff]:abcd",S_OK,FALSE},
1615 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1619 {"[::ffff]:abcd",S_OK,FALSE},
1624 {"zip://[::ffff]:abcd",S_OK,FALSE},
1630 {Uri_HOST_DNS,S_OK,FALSE},
1632 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1633 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1636 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1638 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1639 {"127.0.0.1:abcd",S_OK,FALSE},
1640 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1641 {"0.1:abcd",S_OK,FALSE},
1644 {"127.0.0.1:abcd",S_OK,FALSE},
1649 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1655 {Uri_HOST_DNS,S_OK,FALSE},
1657 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1658 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1661 /* Port is just copied over. */
1662 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1664 {"http://google.com:00035",S_OK,FALSE},
1665 {"google.com:00035",S_OK,FALSE},
1666 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1667 {"google.com",S_OK,FALSE},
1670 {"google.com",S_OK,FALSE},
1675 {"http://google.com:00035",S_OK,FALSE},
1676 {"http",S_OK,FALSE},
1681 {Uri_HOST_DNS,S_OK,FALSE},
1683 {URL_SCHEME_HTTP,S_OK,FALSE},
1684 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1687 /* Default port is copied over. */
1688 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1690 {"http://google.com:80",S_OK,FALSE},
1691 {"google.com:80",S_OK,FALSE},
1692 {"http://google.com:80",S_OK,FALSE},
1693 {"google.com",S_OK,FALSE},
1696 {"google.com",S_OK,FALSE},
1701 {"http://google.com:80",S_OK,FALSE},
1702 {"http",S_OK,FALSE},
1707 {Uri_HOST_DNS,S_OK,FALSE},
1709 {URL_SCHEME_HTTP,S_OK,FALSE},
1710 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1713 { "http://google.com.uk", 0, S_OK, FALSE,
1715 {"http://google.com.uk/",S_OK,FALSE},
1716 {"google.com.uk",S_OK,FALSE},
1717 {"http://google.com.uk/",S_OK,FALSE},
1718 {"google.com.uk",S_OK,FALSE},
1721 {"google.com.uk",S_OK,FALSE},
1726 {"http://google.com.uk",S_OK,FALSE},
1727 {"http",S_OK,FALSE},
1732 {Uri_HOST_DNS,S_OK,FALSE},
1734 {URL_SCHEME_HTTP,S_OK,FALSE},
1735 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1738 { "http://google.com.com", 0, S_OK, FALSE,
1740 {"http://google.com.com/",S_OK,FALSE},
1741 {"google.com.com",S_OK,FALSE},
1742 {"http://google.com.com/",S_OK,FALSE},
1743 {"com.com",S_OK,FALSE},
1746 {"google.com.com",S_OK,FALSE},
1751 {"http://google.com.com",S_OK,FALSE},
1752 {"http",S_OK,FALSE},
1757 {Uri_HOST_DNS,S_OK,FALSE},
1759 {URL_SCHEME_HTTP,S_OK,FALSE},
1760 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1763 { "http://google.uk.1", 0, S_OK, FALSE,
1765 {"http://google.uk.1/",S_OK,FALSE},
1766 {"google.uk.1",S_OK,FALSE},
1767 {"http://google.uk.1/",S_OK,FALSE},
1768 {"google.uk.1",S_OK,FALSE},
1771 {"google.uk.1",S_OK,FALSE},
1776 {"http://google.uk.1",S_OK,FALSE},
1777 {"http",S_OK,FALSE},
1782 {Uri_HOST_DNS,S_OK,FALSE},
1784 {URL_SCHEME_HTTP,S_OK,FALSE},
1785 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1788 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1789 { "http://google.foo.uk", 0, S_OK, FALSE,
1791 {"http://google.foo.uk/",S_OK,FALSE},
1792 {"google.foo.uk",S_OK,FALSE},
1793 {"http://google.foo.uk/",S_OK,FALSE},
1794 {"foo.uk",S_OK,FALSE},
1797 {"google.foo.uk",S_OK,FALSE},
1802 {"http://google.foo.uk",S_OK,FALSE},
1803 {"http",S_OK,FALSE},
1808 {Uri_HOST_DNS,S_OK,FALSE},
1810 {URL_SCHEME_HTTP,S_OK,FALSE},
1811 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1814 { "http://.com", 0, S_OK, FALSE,
1816 {"http://.com/",S_OK,FALSE},
1817 {".com",S_OK,FALSE},
1818 {"http://.com/",S_OK,FALSE},
1819 {".com",S_OK,FALSE},
1822 {".com",S_OK,FALSE},
1827 {"http://.com",S_OK,FALSE},
1828 {"http",S_OK,FALSE},
1833 {Uri_HOST_DNS,S_OK,FALSE},
1835 {URL_SCHEME_HTTP,S_OK,FALSE},
1836 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1839 { "http://.uk", 0, S_OK, FALSE,
1841 {"http://.uk/",S_OK,FALSE},
1843 {"http://.uk/",S_OK,FALSE},
1852 {"http://.uk",S_OK,FALSE},
1853 {"http",S_OK,FALSE},
1858 {Uri_HOST_DNS,S_OK,FALSE},
1860 {URL_SCHEME_HTTP,S_OK,FALSE},
1861 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1864 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
1866 {"http://www.co.google.com.[]/",S_OK,FALSE},
1867 {"www.co.google.com.[]",S_OK,FALSE},
1868 {"http://www.co.google.com.[]/",S_OK,FALSE},
1869 {"google.com.[]",S_OK,FALSE},
1872 {"www.co.google.com.[]",S_OK,FALSE},
1877 {"http://www.co.google.com.[]",S_OK,FALSE},
1878 {"http",S_OK,FALSE},
1883 {Uri_HOST_DNS,S_OK,FALSE},
1885 {URL_SCHEME_HTTP,S_OK,FALSE},
1886 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1889 { "http://co.uk", 0, S_OK, FALSE,
1891 {"http://co.uk/",S_OK,FALSE},
1892 {"co.uk",S_OK,FALSE},
1893 {"http://co.uk/",S_OK,FALSE},
1897 {"co.uk",S_OK,FALSE},
1902 {"http://co.uk",S_OK,FALSE},
1903 {"http",S_OK,FALSE},
1908 {Uri_HOST_DNS,S_OK,FALSE},
1910 {URL_SCHEME_HTTP,S_OK,FALSE},
1911 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1914 { "http://www.co.google.us.test", 0, S_OK, FALSE,
1916 {"http://www.co.google.us.test/",S_OK,FALSE},
1917 {"www.co.google.us.test",S_OK,FALSE},
1918 {"http://www.co.google.us.test/",S_OK,FALSE},
1919 {"us.test",S_OK,FALSE},
1922 {"www.co.google.us.test",S_OK,FALSE},
1927 {"http://www.co.google.us.test",S_OK,FALSE},
1928 {"http",S_OK,FALSE},
1933 {Uri_HOST_DNS,S_OK,FALSE},
1935 {URL_SCHEME_HTTP,S_OK,FALSE},
1936 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1939 { "http://gov.uk", 0, S_OK, FALSE,
1941 {"http://gov.uk/",S_OK,FALSE},
1942 {"gov.uk",S_OK,FALSE},
1943 {"http://gov.uk/",S_OK,FALSE},
1947 {"gov.uk",S_OK,FALSE},
1952 {"http://gov.uk",S_OK,FALSE},
1953 {"http",S_OK,FALSE},
1958 {Uri_HOST_DNS,S_OK,FALSE},
1960 {URL_SCHEME_HTTP,S_OK,FALSE},
1961 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1964 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1966 {"zip://www.google.com\\test",S_OK,FALSE},
1967 {"www.google.com\\test",S_OK,FALSE},
1968 {"zip://www.google.com\\test",S_OK,FALSE},
1969 {"google.com\\test",S_OK,FALSE},
1972 {"www.google.com\\test",S_OK,FALSE},
1977 {"zip://www.google.com\\test",S_OK,FALSE},
1983 {Uri_HOST_DNS,S_OK,FALSE},
1985 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1986 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1989 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
1991 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
1993 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
1999 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2000 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2002 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2008 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2010 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2011 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2014 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2015 * are decoded and all '%' are encoded.
2017 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2019 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2021 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2023 {".mp3",S_OK,FALSE},
2027 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2028 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2030 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2031 {"file",S_OK,FALSE},
2036 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2038 {URL_SCHEME_FILE,S_OK,FALSE},
2039 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2042 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2043 * is decoded and only %'s in front of invalid hex digits are encoded.
2045 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2047 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2049 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2051 {".mp3",S_OK,FALSE},
2055 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2056 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2058 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2059 {"file",S_OK,FALSE},
2064 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2066 {URL_SCHEME_FILE,S_OK,FALSE},
2067 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2070 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2071 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2073 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2074 {"[::1.2.3.0]",S_OK,FALSE},
2075 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2079 {"::1.2.3.0",S_OK,FALSE},
2081 {"/%3F%23.T/test",S_OK,FALSE},
2082 {"/%3F%23.T/test",S_OK,FALSE},
2084 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2085 {"http",S_OK,FALSE},
2090 {Uri_HOST_IPV6,S_OK,FALSE},
2092 {URL_SCHEME_HTTP,S_OK,FALSE},
2093 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2096 /* Forbidden characters are always encoded for file URIs. */
2097 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2099 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2101 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2103 {".mp3",S_OK,FALSE},
2107 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2108 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2110 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2111 {"file",S_OK,FALSE},
2116 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2118 {URL_SCHEME_FILE,S_OK,FALSE},
2119 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2122 /* Forbidden characters are never encoded for unknown scheme types. */
2123 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2125 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2126 {"4294967295",S_OK,FALSE},
2127 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2131 {"4294967295",S_OK,FALSE},
2133 {"/<|>\" test<|>",S_OK,FALSE},
2134 {"/<|>\" test<|>",S_OK,FALSE},
2136 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2137 {"1234",S_OK,FALSE},
2142 {Uri_HOST_IPV4,S_OK,FALSE},
2144 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2145 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2148 /* Make sure forbidden characters are percent encoded. */
2149 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2151 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2152 {"gov.uk",S_OK,FALSE},
2153 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2157 {"gov.uk",S_OK,FALSE},
2159 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2160 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2162 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2163 {"http",S_OK,FALSE},
2168 {Uri_HOST_DNS,S_OK,FALSE},
2170 {URL_SCHEME_HTTP,S_OK,FALSE},
2171 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2174 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2176 {"http://gov.uk/",S_OK,FALSE},
2177 {"gov.uk",S_OK,FALSE},
2178 {"http://gov.uk/",S_OK,FALSE},
2182 {"gov.uk",S_OK,FALSE},
2187 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2188 {"http",S_OK,FALSE},
2193 {Uri_HOST_DNS,S_OK,FALSE},
2195 {URL_SCHEME_HTTP,S_OK,FALSE},
2196 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2199 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2201 {"http://gov.uk/",S_OK,FALSE},
2202 {"gov.uk",S_OK,FALSE},
2203 {"http://gov.uk/",S_OK,FALSE},
2207 {"gov.uk",S_OK,FALSE},
2212 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2213 {"http",S_OK,FALSE},
2218 {Uri_HOST_DNS,S_OK,FALSE},
2220 {URL_SCHEME_HTTP,S_OK,FALSE},
2221 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2224 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2226 {"http://gov.uk/",S_OK,FALSE},
2227 {"gov.uk",S_OK,FALSE},
2228 {"http://gov.uk/",S_OK,FALSE},
2232 {"gov.uk",S_OK,FALSE},
2237 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2238 {"http",S_OK,FALSE},
2243 {Uri_HOST_DNS,S_OK,FALSE},
2245 {URL_SCHEME_HTTP,S_OK,FALSE},
2246 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2249 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2251 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2253 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2255 {".mp3",S_OK,FALSE},
2259 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2260 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2262 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2263 {"file",S_OK,FALSE},
2268 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2270 {URL_SCHEME_FILE,S_OK,FALSE},
2271 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2274 /* Dot removal happens for unknown scheme types. */
2275 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2277 {"zip://gov.uk/",S_OK,FALSE},
2278 {"gov.uk",S_OK,FALSE},
2279 {"zip://gov.uk/",S_OK,FALSE},
2283 {"gov.uk",S_OK,FALSE},
2288 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2294 {Uri_HOST_DNS,S_OK,FALSE},
2296 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2297 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2300 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2301 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2303 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2304 {"gov.uk",S_OK,FALSE},
2305 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2309 {"gov.uk",S_OK,FALSE},
2311 {"/test/test2/../../.",S_OK,FALSE},
2312 {"/test/test2/../../.",S_OK,FALSE},
2314 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2315 {"http",S_OK,FALSE},
2320 {Uri_HOST_DNS,S_OK,FALSE},
2322 {URL_SCHEME_HTTP,S_OK,FALSE},
2323 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2326 /* Dot removal doesn't happen for wildcard scheme types. */
2327 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2329 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2330 {"gov.uk",S_OK,FALSE},
2331 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2335 {"gov.uk",S_OK,FALSE},
2337 {"/test/test2/../../.",S_OK,FALSE},
2338 {"/test/test2/../../.",S_OK,FALSE},
2340 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2346 {Uri_HOST_DNS,S_OK,FALSE},
2348 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2349 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2352 /* Forbidden characters are encoded for opaque known scheme types. */
2353 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2355 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2357 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2359 {".com%22",S_OK,FALSE},
2363 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2364 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2366 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2367 {"mailto",S_OK,FALSE},
2372 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2374 {URL_SCHEME_MAILTO,S_OK,FALSE},
2375 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2378 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2380 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2382 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2384 {".com",S_OK,FALSE},
2388 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2389 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2391 {"news:test.tes<|>t.com",S_OK,FALSE},
2392 {"news",S_OK,FALSE},
2397 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2399 {URL_SCHEME_NEWS,S_OK,FALSE},
2400 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2403 /* Don't encode forbidden characters. */
2404 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2406 {"news:test.tes<|>t.com",S_OK,FALSE},
2408 {"news:test.tes<|>t.com",S_OK,FALSE},
2410 {".com",S_OK,FALSE},
2414 {"test.tes<|>t.com",S_OK,FALSE},
2415 {"test.tes<|>t.com",S_OK,FALSE},
2417 {"news:test.tes<|>t.com",S_OK,FALSE},
2418 {"news",S_OK,FALSE},
2423 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2425 {URL_SCHEME_NEWS,S_OK,FALSE},
2426 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2429 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2430 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2432 {"urn:test.tes<|>t.com",S_OK,FALSE},
2434 {"urn:test.tes<|>t.com",S_OK,FALSE},
2436 {".com",S_OK,FALSE},
2440 {"test.tes<|>t.com",S_OK,FALSE},
2441 {"test.tes<|>t.com",S_OK,FALSE},
2443 {"urn:test.tes<|>t.com",S_OK,FALSE},
2449 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2451 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2452 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2455 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2456 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2458 {"news:test.test.com",S_OK,FALSE},
2460 {"news:test.test.com",S_OK,FALSE},
2462 {".com",S_OK,FALSE},
2466 {"test.test.com",S_OK,FALSE},
2467 {"test.test.com",S_OK,FALSE},
2469 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2470 {"news",S_OK,FALSE},
2475 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2477 {URL_SCHEME_NEWS,S_OK,FALSE},
2478 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2481 /* Percent encoded characters are still decoded for known scheme types. */
2482 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2484 {"news:test.test.com",S_OK,FALSE},
2486 {"news:test.test.com",S_OK,FALSE},
2488 {".com",S_OK,FALSE},
2492 {"test.test.com",S_OK,FALSE},
2493 {"test.test.com",S_OK,FALSE},
2495 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2496 {"news",S_OK,FALSE},
2501 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2503 {URL_SCHEME_NEWS,S_OK,FALSE},
2504 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2507 /* Percent encoded characters aren't decoded for unknown scheme types. */
2508 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2510 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2512 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2514 {".com",S_OK,FALSE},
2518 {"test.%74%65%73%74.com",S_OK,FALSE},
2519 {"test.%74%65%73%74.com",S_OK,FALSE},
2521 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2527 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2529 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2530 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2533 /* Unknown scheme types can have invalid % encoded data in query string. */
2534 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2536 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2537 {"www.winehq.org",S_OK,FALSE},
2538 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2539 {"winehq.org",S_OK,FALSE},
2542 {"www.winehq.org",S_OK,FALSE},
2545 {"/?query=%xx&return=y",S_OK,FALSE},
2546 {"?query=%xx&return=y",S_OK,FALSE},
2547 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2553 {Uri_HOST_DNS,S_OK,FALSE},
2555 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2556 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2559 /* Known scheme types can have invalid % encoded data with the right flags. */
2560 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2562 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2563 {"www.winehq.org",S_OK,FALSE},
2564 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2565 {"winehq.org",S_OK,FALSE},
2568 {"www.winehq.org",S_OK,FALSE},
2571 {"/?query=%xx&return=y",S_OK,FALSE},
2572 {"?query=%xx&return=y",S_OK,FALSE},
2573 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2574 {"http",S_OK,FALSE},
2579 {Uri_HOST_DNS,S_OK,FALSE},
2581 {URL_SCHEME_HTTP,S_OK,FALSE},
2582 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2585 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2586 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2588 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2589 {"www.winehq.org",S_OK,FALSE},
2590 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2591 {"winehq.org",S_OK,FALSE},
2594 {"www.winehq.org",S_OK,FALSE},
2597 {"/?query=<|>&return=y",S_OK,FALSE},
2598 {"?query=<|>&return=y",S_OK,FALSE},
2599 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2600 {"http",S_OK,FALSE},
2605 {Uri_HOST_DNS,S_OK,FALSE},
2607 {URL_SCHEME_HTTP,S_OK,FALSE},
2608 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2611 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2612 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2614 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2615 {"www.winehq.org",S_OK,FALSE},
2616 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2617 {"winehq.org",S_OK,FALSE},
2620 {"www.winehq.org",S_OK,FALSE},
2623 {"/?query=<|>&return=y",S_OK,FALSE},
2624 {"?query=<|>&return=y",S_OK,FALSE},
2625 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2626 {"http",S_OK,FALSE},
2631 {Uri_HOST_DNS,S_OK,FALSE},
2633 {URL_SCHEME_HTTP,S_OK,FALSE},
2634 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2637 /* Forbidden characters are encoded for known scheme types. */
2638 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2640 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2641 {"www.winehq.org",S_OK,FALSE},
2642 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2643 {"winehq.org",S_OK,FALSE},
2646 {"www.winehq.org",S_OK,FALSE},
2649 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2650 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2651 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2652 {"http",S_OK,FALSE},
2657 {Uri_HOST_DNS,S_OK,FALSE},
2659 {URL_SCHEME_HTTP,S_OK,FALSE},
2660 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2663 /* Forbidden characters are not encoded for unknown scheme types. */
2664 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2666 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2667 {"www.winehq.org",S_OK,FALSE},
2668 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2669 {"winehq.org",S_OK,FALSE},
2672 {"www.winehq.org",S_OK,FALSE},
2675 {"/?query=<|>&return=y",S_OK,FALSE},
2676 {"?query=<|>&return=y",S_OK,FALSE},
2677 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2683 {Uri_HOST_DNS,S_OK,FALSE},
2685 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2686 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2689 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2690 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2692 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2693 {"www.winehq.org",S_OK,FALSE},
2694 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2695 {"winehq.org",S_OK,FALSE},
2698 {"www.winehq.org",S_OK,FALSE},
2701 {"/?query=01&return=y",S_OK,FALSE},
2702 {"?query=01&return=y",S_OK,FALSE},
2703 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2704 {"http",S_OK,FALSE},
2709 {Uri_HOST_DNS,S_OK,FALSE},
2711 {URL_SCHEME_HTTP,S_OK,FALSE},
2712 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2715 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2716 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2718 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2719 {"www.winehq.org",S_OK,FALSE},
2720 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2721 {"winehq.org",S_OK,FALSE},
2724 {"www.winehq.org",S_OK,FALSE},
2727 {"/?query=%30%31&return=y",S_OK,FALSE},
2728 {"?query=%30%31&return=y",S_OK,FALSE},
2729 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2735 {Uri_HOST_DNS,S_OK,FALSE},
2737 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2738 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2741 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2742 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2744 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2745 {"www.winehq.org",S_OK,FALSE},
2746 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2747 {"winehq.org",S_OK,FALSE},
2750 {"www.winehq.org",S_OK,FALSE},
2753 {"/?query=%30%31&return=y",S_OK,FALSE},
2754 {"?query=%30%31&return=y",S_OK,FALSE},
2755 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2756 {"http",S_OK,FALSE},
2761 {Uri_HOST_DNS,S_OK,FALSE},
2763 {URL_SCHEME_HTTP,S_OK,FALSE},
2764 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2767 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2769 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2770 {"www.winehq.org",S_OK,FALSE},
2771 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2772 {"winehq.org",S_OK,FALSE},
2775 {"www.winehq.org",S_OK,FALSE},
2778 {"?query=12&return=y",S_OK,FALSE},
2779 {"?query=12&return=y",S_OK,FALSE},
2780 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2781 {"http",S_OK,FALSE},
2786 {Uri_HOST_DNS,S_OK,FALSE},
2788 {URL_SCHEME_HTTP,S_OK,FALSE},
2789 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2792 /* Unknown scheme types can have invalid % encoded data in fragments. */
2793 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2795 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2796 {"www.winehq.org",S_OK,FALSE},
2797 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2798 {"winehq.org",S_OK,FALSE},
2800 {"#Te%xx",S_OK,FALSE},
2801 {"www.winehq.org",S_OK,FALSE},
2803 {"/tests/",S_OK,FALSE},
2804 {"/tests/",S_OK,FALSE},
2806 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2812 {Uri_HOST_DNS,S_OK,FALSE},
2814 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2815 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2818 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2819 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2821 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2822 {"www.winehq.org",S_OK,FALSE},
2823 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2824 {"winehq.org",S_OK,FALSE},
2826 {"#Te<|>",S_OK,FALSE},
2827 {"www.winehq.org",S_OK,FALSE},
2829 {"/tests/",S_OK,FALSE},
2830 {"/tests/",S_OK,FALSE},
2832 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2838 {Uri_HOST_DNS,S_OK,FALSE},
2840 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2841 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2844 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2845 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2847 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2848 {"www.winehq.org",S_OK,FALSE},
2849 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2850 {"winehq.org",S_OK,FALSE},
2852 {"#Te%3C%7C%3E",S_OK,FALSE},
2853 {"www.winehq.org",S_OK,FALSE},
2855 {"/tests/",S_OK,FALSE},
2856 {"/tests/",S_OK,FALSE},
2858 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2859 {"http",S_OK,FALSE},
2864 {Uri_HOST_DNS,S_OK,FALSE},
2866 {URL_SCHEME_HTTP,S_OK,FALSE},
2867 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2870 /* Forbidden characters aren't encoded in the fragment with this flag. */
2871 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2873 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2874 {"www.winehq.org",S_OK,FALSE},
2875 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2876 {"winehq.org",S_OK,FALSE},
2878 {"#Te<|>",S_OK,FALSE},
2879 {"www.winehq.org",S_OK,FALSE},
2881 {"/tests/",S_OK,FALSE},
2882 {"/tests/",S_OK,FALSE},
2884 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2885 {"http",S_OK,FALSE},
2890 {Uri_HOST_DNS,S_OK,FALSE},
2892 {URL_SCHEME_HTTP,S_OK,FALSE},
2893 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2896 /* Forbidden characters aren't encoded in the fragment with this flag. */
2897 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2899 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2900 {"www.winehq.org",S_OK,FALSE},
2901 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2902 {"winehq.org",S_OK,FALSE},
2904 {"#Te<|>",S_OK,FALSE},
2905 {"www.winehq.org",S_OK,FALSE},
2907 {"/tests/",S_OK,FALSE},
2908 {"/tests/",S_OK,FALSE},
2910 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2911 {"http",S_OK,FALSE},
2916 {Uri_HOST_DNS,S_OK,FALSE},
2918 {URL_SCHEME_HTTP,S_OK,FALSE},
2919 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2922 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
2923 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2925 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2926 {"www.winehq.org",S_OK,FALSE},
2927 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2928 {"winehq.org",S_OK,FALSE},
2930 {"#Te%30%31%32",S_OK,FALSE},
2931 {"www.winehq.org",S_OK,FALSE},
2933 {"/tests/",S_OK,FALSE},
2934 {"/tests/",S_OK,FALSE},
2936 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2942 {Uri_HOST_DNS,S_OK,FALSE},
2944 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2945 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2948 /* Percent encoded, unreserved characters are decoded for known schemes. */
2949 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2951 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2952 {"www.winehq.org",S_OK,FALSE},
2953 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2954 {"winehq.org",S_OK,FALSE},
2956 {"#Te012",S_OK,FALSE},
2957 {"www.winehq.org",S_OK,FALSE},
2959 {"/tests/",S_OK,FALSE},
2960 {"/tests/",S_OK,FALSE},
2962 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2963 {"http",S_OK,FALSE},
2968 {Uri_HOST_DNS,S_OK,FALSE},
2970 {URL_SCHEME_HTTP,S_OK,FALSE},
2971 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2974 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
2975 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2977 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2978 {"www.winehq.org",S_OK,FALSE},
2979 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
2980 {"winehq.org",S_OK,FALSE},
2982 {"#Te012",S_OK,FALSE},
2983 {"www.winehq.org",S_OK,FALSE},
2985 {"/tests/",S_OK,FALSE},
2986 {"/tests/",S_OK,FALSE},
2988 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2989 {"http",S_OK,FALSE},
2994 {Uri_HOST_DNS,S_OK,FALSE},
2996 {URL_SCHEME_HTTP,S_OK,FALSE},
2997 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3000 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3001 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3003 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3004 {"www.winehq.org",S_OK,FALSE},
3005 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3006 {"winehq.org",S_OK,FALSE},
3008 {"#Te%30%31%32",S_OK,FALSE},
3009 {"www.winehq.org",S_OK,FALSE},
3011 {"/tests/",S_OK,FALSE},
3012 {"/tests/",S_OK,FALSE},
3014 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3015 {"http",S_OK,FALSE},
3020 {Uri_HOST_DNS,S_OK,FALSE},
3022 {URL_SCHEME_HTTP,S_OK,FALSE},
3023 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3026 /* Leading/Trailing whitespace is removed. */
3027 { " http://google.com/ ", 0, S_OK, FALSE,
3029 {"http://google.com/",S_OK,FALSE},
3030 {"google.com",S_OK,FALSE},
3031 {"http://google.com/",S_OK,FALSE},
3032 {"google.com",S_OK,FALSE},
3035 {"google.com",S_OK,FALSE},
3040 {"http://google.com/",S_OK,FALSE},
3041 {"http",S_OK,FALSE},
3046 {Uri_HOST_DNS,S_OK,FALSE},
3048 {URL_SCHEME_HTTP,S_OK,FALSE},
3049 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3052 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3054 {"http://google.com/",S_OK,FALSE},
3055 {"google.com",S_OK,FALSE},
3056 {"http://google.com/",S_OK,FALSE},
3057 {"google.com",S_OK,FALSE},
3060 {"google.com",S_OK,FALSE},
3065 {"http://google.com/",S_OK,FALSE},
3066 {"http",S_OK,FALSE},
3071 {Uri_HOST_DNS,S_OK,FALSE},
3073 {URL_SCHEME_HTTP,S_OK,FALSE},
3074 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3077 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3079 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3080 {"g%0aoogle.co%0dm",S_OK,FALSE},
3081 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3082 {"g%0aoogle.co%0dm",S_OK,FALSE},
3085 {"g%0aoogle.co%0dm",S_OK,FALSE},
3087 {"/%0A%0A%0A",S_OK,FALSE},
3088 {"/%0A%0A%0A",S_OK,FALSE},
3090 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3091 {"http",S_OK,FALSE},
3096 {Uri_HOST_DNS,S_OK,FALSE},
3098 {URL_SCHEME_HTTP,S_OK,FALSE},
3099 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3102 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3104 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3105 {"g\noogle.co\rm",S_OK,FALSE},
3106 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3107 {"g\noogle.co\rm",S_OK,FALSE},
3110 {"g\noogle.co\rm",S_OK,FALSE},
3112 {"/\n\n\n",S_OK,FALSE},
3113 {"/\n\n\n",S_OK,FALSE},
3115 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3121 {Uri_HOST_DNS,S_OK,FALSE},
3123 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3124 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3127 /* Since file URLs are usually hierarchical, it returns an empty string
3128 * for the absolute URI property since it was declared as an opaque URI.
3130 { "file:index.html", 0, S_OK, FALSE,
3134 {"file:index.html",S_OK,FALSE},
3136 {".html",S_OK,FALSE},
3140 {"index.html",S_OK,FALSE},
3141 {"index.html",S_OK,FALSE},
3143 {"file:index.html",S_OK,FALSE},
3144 {"file",S_OK,FALSE},
3149 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3151 {URL_SCHEME_FILE,S_OK,FALSE},
3152 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3155 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3156 { "http:test.com/index.html", 0, S_OK, FALSE,
3160 {"http:test.com/index.html",S_OK,FALSE},
3162 {".html",S_OK,FALSE},
3166 {"test.com/index.html",S_OK,FALSE},
3167 {"test.com/index.html",S_OK,FALSE},
3169 {"http:test.com/index.html",S_OK,FALSE},
3170 {"http",S_OK,FALSE},
3175 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3177 {URL_SCHEME_HTTP,S_OK,FALSE},
3178 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3181 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3185 {"ftp:test.com/index.html",S_OK,FALSE},
3187 {".html",S_OK,FALSE},
3191 {"test.com/index.html",S_OK,FALSE},
3192 {"test.com/index.html",S_OK,FALSE},
3194 {"ftp:test.com/index.html",S_OK,FALSE},
3200 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3202 {URL_SCHEME_FTP,S_OK,FALSE},
3203 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3206 { "file://C|/test.mp3", 0, S_OK, FALSE,
3208 {"file:///C:/test.mp3",S_OK,FALSE},
3210 {"file:///C:/test.mp3",S_OK,FALSE},
3212 {".mp3",S_OK,FALSE},
3216 {"/C:/test.mp3",S_OK,FALSE},
3217 {"/C:/test.mp3",S_OK,FALSE},
3219 {"file://C|/test.mp3",S_OK,FALSE},
3220 {"file",S_OK,FALSE},
3225 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3227 {URL_SCHEME_FILE,S_OK,FALSE},
3228 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3231 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3233 {"file:///C:/test.mp3",S_OK,FALSE},
3235 {"file:///C:/test.mp3",S_OK,FALSE},
3237 {".mp3",S_OK,FALSE},
3241 {"/C:/test.mp3",S_OK,FALSE},
3242 {"/C:/test.mp3",S_OK,FALSE},
3244 {"file:///C|/test.mp3",S_OK,FALSE},
3245 {"file",S_OK,FALSE},
3250 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3252 {URL_SCHEME_FILE,S_OK,FALSE},
3253 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3256 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3259 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3261 {"file://c:\\dir\\index.html",S_OK,FALSE},
3263 {"file://c:\\dir\\index.html",S_OK,FALSE},
3265 {".html",S_OK,FALSE},
3269 {"c:\\dir\\index.html",S_OK,FALSE},
3270 {"c:\\dir\\index.html",S_OK,FALSE},
3272 {"file://c:/dir/index.html",S_OK,FALSE},
3273 {"file",S_OK,FALSE},
3278 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3280 {URL_SCHEME_FILE,S_OK,FALSE},
3281 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3284 /* Extra '/' after "file://" is removed. */
3285 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3287 {"file://c:\\dir\\index.html",S_OK,FALSE},
3289 {"file://c:\\dir\\index.html",S_OK,FALSE},
3291 {".html",S_OK,FALSE},
3295 {"c:\\dir\\index.html",S_OK,FALSE},
3296 {"c:\\dir\\index.html",S_OK,FALSE},
3298 {"file:///c:/dir/index.html",S_OK,FALSE},
3299 {"file",S_OK,FALSE},
3304 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3306 {URL_SCHEME_FILE,S_OK,FALSE},
3307 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3310 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3311 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3313 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3315 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3317 {".html",S_OK,FALSE},
3321 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3322 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3324 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3325 {"file",S_OK,FALSE},
3330 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3332 {URL_SCHEME_FILE,S_OK,FALSE},
3333 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3336 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3338 {"file://c:\\dir\\index.html",S_OK,FALSE},
3340 {"file://c:\\dir\\index.html",S_OK,FALSE},
3342 {".html",S_OK,FALSE},
3346 {"c:\\dir\\index.html",S_OK,FALSE},
3347 {"c:\\dir\\index.html",S_OK,FALSE},
3349 {"file://c|/dir\\index.html",S_OK,FALSE},
3350 {"file",S_OK,FALSE},
3355 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3357 {URL_SCHEME_FILE,S_OK,FALSE},
3358 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3361 /* The backslashes after the scheme name are converted to forward slashes. */
3362 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3364 {"file://c:\\dir\\index.html",S_OK,FALSE},
3366 {"file://c:\\dir\\index.html",S_OK,FALSE},
3368 {".html",S_OK,FALSE},
3372 {"c:\\dir\\index.html",S_OK,FALSE},
3373 {"c:\\dir\\index.html",S_OK,FALSE},
3375 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3376 {"file",S_OK,FALSE},
3381 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3383 {URL_SCHEME_FILE,S_OK,FALSE},
3384 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3387 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3389 {"file:///c:/dir/index.html",S_OK,FALSE},
3391 {"file:///c:/dir/index.html",S_OK,FALSE},
3393 {".html",S_OK,FALSE},
3397 {"/c:/dir/index.html",S_OK,FALSE},
3398 {"/c:/dir/index.html",S_OK,FALSE},
3400 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3401 {"file",S_OK,FALSE},
3406 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3408 {URL_SCHEME_FILE,S_OK,FALSE},
3409 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3412 { "http:\\\\google.com", 0, S_OK, FALSE,
3414 {"http://google.com/",S_OK,FALSE},
3415 {"google.com",S_OK,FALSE},
3416 {"http://google.com/",S_OK,FALSE},
3417 {"google.com",S_OK,FALSE},
3420 {"google.com",S_OK,FALSE},
3425 {"http:\\\\google.com",S_OK,FALSE},
3426 {"http",S_OK,FALSE},
3431 {Uri_HOST_DNS,S_OK,FALSE},
3433 {URL_SCHEME_HTTP,S_OK,FALSE},
3434 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3437 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3438 { "zip:\\\\google.com", 0, S_OK, FALSE,
3440 {"zip:\\\\google.com",S_OK,FALSE},
3442 {"zip:\\\\google.com",S_OK,FALSE},
3444 {".com",S_OK,FALSE},
3448 {"\\\\google.com",S_OK,FALSE},
3449 {"\\\\google.com",S_OK,FALSE},
3451 {"zip:\\\\google.com",S_OK,FALSE},
3457 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3459 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3460 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3463 /* Dot segments aren't removed. */
3464 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3466 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3468 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3470 {".html",S_OK,FALSE},
3474 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3475 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3477 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3478 {"file",S_OK,FALSE},
3483 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3485 {URL_SCHEME_FILE,S_OK,FALSE},
3486 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3489 /* Forbidden characters aren't percent encoded. */
3490 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3492 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3494 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3496 {".html",S_OK,FALSE},
3500 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3501 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3503 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3504 {"file",S_OK,FALSE},
3509 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3511 {URL_SCHEME_FILE,S_OK,FALSE},
3512 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3515 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3516 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3520 {"file:c:/dir/../../index.html",S_OK,FALSE},
3522 {".html",S_OK,FALSE},
3526 {"c:/dir/../../index.html",S_OK,FALSE},
3527 {"c:/dir/../../index.html",S_OK,FALSE},
3529 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3530 {"file",S_OK,FALSE},
3535 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3537 {URL_SCHEME_FILE,S_OK,FALSE},
3538 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3541 /* '/' are still converted to '\' even though it's an opaque URI. */
3542 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3546 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3548 {".html",S_OK,FALSE},
3552 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3553 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3555 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3556 {"file",S_OK,FALSE},
3561 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3563 {URL_SCHEME_FILE,S_OK,FALSE},
3564 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3567 /* Forbidden characters aren't percent encoded. */
3568 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3572 {"file:c:\\in^|dex.html",S_OK,FALSE},
3574 {".html",S_OK,FALSE},
3578 {"c:\\in^|dex.html",S_OK,FALSE},
3579 {"c:\\in^|dex.html",S_OK,FALSE},
3581 {"file:c:\\in^|dex.html",S_OK,FALSE},
3582 {"file",S_OK,FALSE},
3587 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3589 {URL_SCHEME_FILE,S_OK,FALSE},
3590 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3593 /* Doesn't have a UserName since the ':' appears at the beginning of the
3596 { "http://:password@gov.uk", 0, S_OK, FALSE,
3598 {"http://:password@gov.uk/",S_OK,FALSE},
3599 {":password@gov.uk",S_OK,FALSE},
3600 {"http://gov.uk/",S_OK,FALSE},
3604 {"gov.uk",S_OK,FALSE},
3605 {"password",S_OK,FALSE},
3609 {"http://:password@gov.uk",S_OK,FALSE},
3610 {"http",S_OK,FALSE},
3611 {":password",S_OK,FALSE},
3615 {Uri_HOST_DNS,S_OK,FALSE},
3617 {URL_SCHEME_HTTP,S_OK,FALSE},
3618 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3621 /* Has a UserName since the userinfo section doesn't contain a password. */
3622 { "http://@gov.uk", 0, S_OK, FALSE,
3624 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3625 {"@gov.uk",S_OK,FALSE},
3626 {"http://gov.uk/",S_OK,FALSE},
3630 {"gov.uk",S_OK,FALSE},
3635 {"http://@gov.uk",S_OK,FALSE},
3636 {"http",S_OK,FALSE},
3641 {Uri_HOST_DNS,S_OK,FALSE},
3643 {URL_SCHEME_HTTP,S_OK,FALSE},
3644 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3647 /* ":@" not included in the absolute URI. */
3648 { "http://:@gov.uk", 0, S_OK, FALSE,
3650 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3651 {":@gov.uk",S_OK,FALSE},
3652 {"http://gov.uk/",S_OK,FALSE},
3656 {"gov.uk",S_OK,FALSE},
3661 {"http://:@gov.uk",S_OK,FALSE},
3662 {"http",S_OK,FALSE},
3667 {Uri_HOST_DNS,S_OK,FALSE},
3669 {URL_SCHEME_HTTP,S_OK,FALSE},
3670 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3673 /* '@' is included because it's an unknown scheme type. */
3674 { "zip://@gov.uk", 0, S_OK, FALSE,
3676 {"zip://@gov.uk/",S_OK,FALSE},
3677 {"@gov.uk",S_OK,FALSE},
3678 {"zip://@gov.uk/",S_OK,FALSE},
3682 {"gov.uk",S_OK,FALSE},
3687 {"zip://@gov.uk",S_OK,FALSE},
3693 {Uri_HOST_DNS,S_OK,FALSE},
3695 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3696 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3699 /* ":@" are included because it's an unknown scheme type. */
3700 { "zip://:@gov.uk", 0, S_OK, FALSE,
3702 {"zip://:@gov.uk/",S_OK,FALSE},
3703 {":@gov.uk",S_OK,FALSE},
3704 {"zip://:@gov.uk/",S_OK,FALSE},
3708 {"gov.uk",S_OK,FALSE},
3713 {"zip://:@gov.uk",S_OK,FALSE},
3719 {Uri_HOST_DNS,S_OK,FALSE},
3721 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3722 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3725 { "about:blank", 0, S_OK, FALSE,
3727 {"about:blank",S_OK,FALSE},
3729 {"about:blank",S_OK,FALSE},
3735 {"blank",S_OK,FALSE},
3736 {"blank",S_OK,FALSE},
3738 {"about:blank",S_OK,FALSE},
3739 {"about",S_OK,FALSE},
3744 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3746 {URL_SCHEME_ABOUT,S_OK,FALSE},
3747 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3750 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3752 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3754 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3756 {".htm",S_OK,FALSE},
3760 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3761 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3763 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3769 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3771 {URL_SCHEME_MK,S_OK,FALSE},
3772 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3775 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3777 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3779 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3781 {".htm",S_OK,FALSE},
3785 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3786 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3788 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3794 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3796 {URL_SCHEME_MK,S_OK,FALSE},
3797 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3800 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3801 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3803 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3804 {"server",S_OK,FALSE},
3805 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3807 {".html",S_OK,FALSE},
3809 {"server",S_OK,FALSE},
3811 {"\\dir\\index.html",S_OK,FALSE},
3812 {"\\dir\\index.html",S_OK,FALSE},
3814 {"file://server/dir/index.html",S_OK,FALSE},
3815 {"file",S_OK,FALSE},
3820 {Uri_HOST_DNS,S_OK,FALSE},
3822 {URL_SCHEME_FILE,S_OK,FALSE},
3823 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3826 /* When CreateUri generates an IUri, it still displays the default port in the
3829 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3831 {"http://google.com:80/",S_OK,FALSE},
3832 {"google.com:80",S_OK,FALSE},
3833 {"http://google.com:80/",S_OK,FALSE},
3834 {"google.com",S_OK,FALSE},
3837 {"google.com",S_OK,FALSE},
3842 {"http://google.com:80/",S_OK,FALSE},
3843 {"http",S_OK,FALSE},
3848 {Uri_HOST_DNS,S_OK,FALSE},
3850 {URL_SCHEME_HTTP,S_OK,FALSE},
3851 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3854 /* For res URIs the host is everything up until the first '/'. */
3855 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3857 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3858 {"C:\\dir\\file.exe",S_OK,FALSE},
3859 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3861 {".html",S_OK,FALSE},
3863 {"C:\\dir\\file.exe",S_OK,FALSE},
3865 {"/DATA/test.html",S_OK,FALSE},
3866 {"/DATA/test.html",S_OK,FALSE},
3868 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3874 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3876 {URL_SCHEME_RES,S_OK,FALSE},
3877 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3880 /* Res URI can contain a '|' in the host name. */
3881 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
3883 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3884 {"c:\\di|r\\file.exe",S_OK,FALSE},
3885 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3889 {"c:\\di|r\\file.exe",S_OK,FALSE},
3891 {"/test",S_OK,FALSE},
3892 {"/test",S_OK,FALSE},
3894 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3900 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3902 {URL_SCHEME_RES,S_OK,FALSE},
3903 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3906 /* Res URIs can have invalid percent encoded values. */
3907 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
3909 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3910 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3911 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3915 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3917 {"/test",S_OK,FALSE},
3918 {"/test",S_OK,FALSE},
3920 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3926 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3928 {URL_SCHEME_RES,S_OK,FALSE},
3929 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3932 /* Res doesn't get forbidden characters percent encoded in it's path. */
3933 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
3935 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3936 {"c:\\test",S_OK,FALSE},
3937 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3941 {"c:\\test",S_OK,FALSE},
3943 {"/tes<|>t",S_OK,FALSE},
3944 {"/tes<|>t",S_OK,FALSE},
3946 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3952 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3954 {URL_SCHEME_RES,S_OK,FALSE},
3955 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3960 typedef struct _invalid_uri {
3966 static const invalid_uri invalid_uri_tests[] = {
3967 /* Has to have a scheme name. */
3968 {"://www.winehq.org",0,FALSE},
3969 /* Window's doesn't like URI's which are implicitly file paths without the
3970 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
3972 {"C:/test/test.mp3",0,FALSE},
3973 {"\\\\Server/test/test.mp3",0,FALSE},
3974 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
3975 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
3976 /* Invalid schemes. */
3977 {"*abcd://not.valid.com",0,FALSE},
3978 {"*a*b*c*d://not.valid.com",0,FALSE},
3979 /* Not allowed to have invalid % encoded data. */
3980 {"ftp://google.co%XX/",0,FALSE},
3981 /* To many h16 components. */
3982 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
3983 /* Not enough room for IPv4 address. */
3984 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
3985 /* Not enough h16 components. */
3986 {"http://[1:2:3:4]",0,FALSE},
3987 /* Not enough components including IPv4. */
3988 {"http://[1:192.0.1.0]",0,FALSE},
3989 /* Not allowed to have partial IPv4 in IPv6. */
3990 {"http://[::192.0]",0,FALSE},
3991 /* Can't have elision of 1 h16 at beginning of address. */
3992 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
3993 /* Can't have elision of 1 h16 at end of address. */
3994 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
3995 /* Expects a valid IP Literal. */
3996 {"ftp://[not.valid.uri]/",0,FALSE},
3997 /* Expects valid port for a known scheme type. */
3998 {"ftp://www.winehq.org:123fgh",0,FALSE},
3999 /* Port exceeds USHORT_MAX for known scheme type. */
4000 {"ftp://www.winehq.org:65536",0,FALSE},
4001 /* Invalid port with IPv4 address. */
4002 {"http://www.winehq.org:1abcd",0,FALSE},
4003 /* Invalid port with IPv6 address. */
4004 {"http://[::ffff]:32xy",0,FALSE},
4005 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4006 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4007 /* Not allowed to have invalid % encoded data in opaque URI path. */
4008 {"news:test%XX",0,FALSE},
4009 {"mailto:wine@winehq%G8.com",0,FALSE},
4010 /* Known scheme types can't have invalid % encoded data in query string. */
4011 {"http://google.com/?query=te%xx",0,FALSE},
4012 /* Invalid % encoded data in fragment of know scheme type. */
4013 {"ftp://google.com/#Test%xx",0,FALSE},
4014 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4015 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4016 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4017 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4018 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4019 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4020 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4021 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4022 /* res URIs aren't allowed to have forbidden dos path characters in the
4025 {"res://c:\\te<st\\test/test",0,FALSE},
4026 {"res://c:\\te>st\\test/test",0,FALSE},
4027 {"res://c:\\te\"st\\test/test",0,FALSE},
4028 {"res://c:\\test/te%xxst",0,FALSE}
4031 typedef struct _uri_equality {
4033 DWORD create_flags_a;
4036 DWORD create_flags_b;
4042 static const uri_equality equality_tests[] = {
4044 "HTTP://www.winehq.org/test dir/./",0,FALSE,
4045 "http://www.winehq.org/test dir/../test dir/",0,FALSE,
4049 /* http://www.winehq.org/test%20dir */
4050 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,FALSE,
4051 "http://www.winehq.org/test dir",0,FALSE,
4055 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,FALSE,
4056 "file:///c:/test.mp3",0,FALSE,
4060 "ftp://ftp.winehq.org/",0,FALSE,
4061 "ftp://ftp.winehq.org",0,FALSE,
4065 "ftp://ftp.winehq.org/test/test2/../../testB/",0,FALSE,
4066 "ftp://ftp.winehq.org/t%45stB/",0,FALSE,
4070 "http://google.com/TEST",0,FALSE,
4071 "http://google.com/test",0,FALSE,
4075 "http://GOOGLE.com/",0,FALSE,
4076 "http://google.com/",0,FALSE,
4079 /* Performs case insensitive compare of host names (for known scheme types). */
4081 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4082 "ftp://google.com/",0,FALSE,
4086 "zip://GOOGLE.com/",0,FALSE,
4087 "zip://google.com/",0,FALSE,
4091 "file:///c:/TEST/TeST/",0,FALSE,
4092 "file:///c:/test/test/",0,FALSE,
4096 "file:///server/TEST",0,FALSE,
4097 "file:///SERVER/TEST",0,FALSE,
4101 "http://google.com",Uri_CREATE_NO_CANONICALIZE,FALSE,
4102 "http://google.com/",0,FALSE,
4106 "ftp://google.com:21/",0,FALSE,
4107 "ftp://google.com/",0,FALSE,
4111 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4112 "http://google.com/",0,FALSE,
4116 "http://google.com:70/",0,FALSE,
4117 "http://google.com:71/",0,FALSE,
4122 typedef struct _uri_with_fragment {
4124 const char* fragment;
4126 HRESULT create_expected;
4129 const char* expected_uri;
4131 } uri_with_fragment;
4133 static const uri_with_fragment uri_fragment_tests[] = {
4135 "http://google.com/","#fragment",0,S_OK,FALSE,
4136 "http://google.com/#fragment",FALSE
4139 "http://google.com/","fragment",0,S_OK,FALSE,
4140 "http://google.com/#fragment",FALSE
4143 "zip://test.com/","?test",0,S_OK,FALSE,
4144 "zip://test.com/#?test",FALSE
4146 /* The fragment can be empty. */
4148 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4149 "ftp://ftp.google.com/#",FALSE
4153 typedef struct _uri_builder_property {
4156 const char *expected_value;
4157 Uri_PROPERTY property;
4160 } uri_builder_property;
4162 typedef struct _uri_builder_port {
4170 typedef struct _uri_builder_str_property {
4171 const char* expected;
4174 } uri_builder_str_property;
4176 typedef struct _uri_builder_dword_property {
4180 } uri_builder_dword_property;
4182 typedef struct _uri_builder_test {
4185 HRESULT create_builder_expected;
4186 BOOL create_builder_todo;
4188 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4190 uri_builder_port port_prop;
4196 DWORD uri_simple_encode_flags;
4197 HRESULT uri_simple_hres;
4198 BOOL uri_simple_todo;
4200 DWORD uri_with_flags;
4201 DWORD uri_with_builder_flags;
4202 DWORD uri_with_encode_flags;
4203 HRESULT uri_with_hres;
4206 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4207 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4210 static const uri_builder_test uri_builder_tests[] = {
4211 { "http://google.com/",0,S_OK,FALSE,
4213 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4214 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4215 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4216 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4223 {"http://username:password@google.com/?query=x#fragment",S_OK},
4224 {"username:password@google.com",S_OK},
4225 {"http://google.com/?query=x#fragment",S_OK},
4226 {"google.com",S_OK},
4229 {"google.com",S_OK},
4234 {"http://username:password@google.com/?query=x#fragment",S_OK},
4236 {"username:password",S_OK},
4240 {Uri_HOST_DNS,S_OK},
4242 {URL_SCHEME_HTTP,S_OK},
4243 {URLZONE_INVALID,E_NOTIMPL}
4246 { "http://google.com/",0,S_OK,FALSE,
4248 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4250 {TRUE,TRUE,120,S_OK,FALSE},
4255 {"test://google.com:120/",S_OK},
4256 {"google.com:120",S_OK},
4257 {"test://google.com:120/",S_OK},
4258 {"google.com",S_OK},
4261 {"google.com",S_OK},
4266 {"test://google.com:120/",S_OK},
4272 {Uri_HOST_DNS,S_OK},
4274 {URL_SCHEME_UNKNOWN,S_OK},
4275 {URLZONE_INVALID,E_NOTIMPL}
4278 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4280 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4281 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4282 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4289 {"http://[::192.2.3.4]/",S_OK},
4290 {"[::192.2.3.4]",S_OK},
4291 {"http://[::192.2.3.4]/",S_OK},
4295 {"::192.2.3.4",S_OK},
4300 {"http://[::192.2.3.4]/",S_OK},
4306 {Uri_HOST_IPV6,S_OK},
4308 {URL_SCHEME_HTTP,S_OK},
4309 {URLZONE_INVALID,E_NOTIMPL}
4312 { "http://google.com/",0,S_OK,FALSE,
4314 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4321 {"http://google.com/#Frag",S_OK},
4322 {"google.com",S_OK},
4323 {"http://google.com/#Frag",S_OK},
4324 {"google.com",S_OK},
4327 {"google.com",S_OK},
4332 {"http://google.com/#Frag",S_OK},
4338 {Uri_HOST_DNS,S_OK},
4340 {URL_SCHEME_HTTP,S_OK},
4341 {URLZONE_INVALID,E_NOTIMPL}
4344 { "http://google.com/",0,S_OK,FALSE,
4346 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4353 {"http://google.com/#",S_OK},
4354 {"google.com",S_OK},
4355 {"http://google.com/#",S_OK},
4356 {"google.com",S_OK},
4359 {"google.com",S_OK},
4364 {"http://google.com/#",S_OK},
4370 {Uri_HOST_DNS,S_OK},
4372 {URL_SCHEME_HTTP,S_OK},
4373 {URLZONE_INVALID,E_NOTIMPL}
4376 { "http://google.com/",0,S_OK,FALSE,
4378 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4385 {"http://::password@google.com/",S_OK},
4386 {"::password@google.com",S_OK},
4387 {"http://google.com/",S_OK},
4388 {"google.com",S_OK},
4391 {"google.com",S_OK},
4396 {"http://::password@google.com/",S_OK},
4398 {"::password",S_OK},
4402 {Uri_HOST_DNS,S_OK},
4404 {URL_SCHEME_HTTP,S_OK},
4405 {URLZONE_INVALID,E_NOTIMPL}
4408 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4410 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4413 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4415 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4417 {":password@test/test",S_OK},
4418 {":password@",S_OK},
4419 {":password@test/test",S_OK},
4428 {":password@test/test",S_OK},
4434 {Uri_HOST_UNKNOWN,S_OK},
4436 {URL_SCHEME_UNKNOWN,S_OK},
4437 {URLZONE_INVALID,E_NOTIMPL}
4440 { "http://google.com/",0,S_OK,FALSE,
4442 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4449 {"http://google.com/test/test",S_OK},
4450 {"google.com",S_OK},
4451 {"http://google.com/test/test",S_OK},
4452 {"google.com",S_OK},
4455 {"google.com",S_OK},
4457 {"/test/test",S_OK},
4458 {"/test/test",S_OK},
4460 {"http://google.com/test/test",S_OK},
4466 {Uri_HOST_DNS,S_OK},
4468 {URL_SCHEME_HTTP,S_OK},
4469 {URLZONE_INVALID,E_NOTIMPL}
4472 { "zip:testing/test",0,S_OK,FALSE,
4474 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4498 {Uri_HOST_UNKNOWN,S_OK},
4500 {URL_SCHEME_UNKNOWN,S_OK},
4501 {URLZONE_INVALID,E_NOTIMPL}
4504 { "http://google.com/",0,S_OK,FALSE,
4508 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4509 {TRUE,FALSE,555,S_OK,FALSE},
4514 {"http://google.com/",S_OK},
4515 {"google.com",S_OK},
4516 {"http://google.com/",S_OK},
4517 {"google.com",S_OK},
4520 {"google.com",S_OK},
4525 {"http://google.com/",S_OK},
4531 {Uri_HOST_DNS,S_OK},
4532 /* Still returns 80, even though earlier the port was disabled. */
4534 {URL_SCHEME_HTTP,S_OK},
4535 {URLZONE_INVALID,E_NOTIMPL}
4538 { "http://google.com/",0,S_OK,FALSE,
4542 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4543 * you'll get 122345 instead.
4545 {TRUE,122345,222,S_OK,FALSE},
4550 {"http://google.com:222/",S_OK},
4551 {"google.com:222",S_OK},
4552 {"http://google.com:222/",S_OK},
4553 {"google.com",S_OK},
4556 {"google.com",S_OK},
4561 {"http://google.com:222/",S_OK},
4567 {Uri_HOST_DNS,S_OK},
4569 {URL_SCHEME_HTTP,S_OK},
4570 {URLZONE_INVALID,E_NOTIMPL}
4573 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
4574 { "http://google.com/",0,S_OK,FALSE,
4578 {TRUE,TRUE,999999,S_OK,FALSE},
4583 {"http://google.com:999999/",S_OK},
4584 {"google.com:999999",S_OK},
4585 {"http://google.com:999999/",S_OK},
4586 {"google.com",S_OK},
4589 {"google.com",S_OK},
4594 {"http://google.com:999999/",S_OK},
4600 {Uri_HOST_DNS,S_OK},
4602 {URL_SCHEME_HTTP,S_OK},
4603 {URLZONE_INVALID,E_NOTIMPL}
4606 { "http://google.com/",0,S_OK,FALSE,
4608 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
4616 {"http://google.com/?test",S_OK},
4617 {"google.com",S_OK},
4618 {"http://google.com/?test",S_OK},
4619 {"google.com",S_OK},
4622 {"google.com",S_OK},
4627 {"http://google.com/?test",S_OK},
4633 {Uri_HOST_DNS,S_OK},
4635 {URL_SCHEME_HTTP,S_OK},
4636 {URLZONE_INVALID,E_NOTIMPL}
4639 { "http://:password@google.com/",0,S_OK,FALSE,
4648 {"http://:password@google.com/",S_OK},
4649 {":password@google.com",S_OK},
4650 {"http://google.com/",S_OK},
4651 {"google.com",S_OK},
4654 {"google.com",S_OK},
4659 {"http://:password@google.com/",S_OK},
4665 {Uri_HOST_DNS,S_OK},
4667 {URL_SCHEME_HTTP,S_OK},
4668 {URLZONE_INVALID,E_NOTIMPL}
4671 /* IUriBuilder doesn't need a base IUri to build a IUri. */
4672 { NULL,0,S_OK,FALSE,
4674 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4675 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
4682 {"http://google.com/",S_OK},
4683 {"google.com",S_OK},
4684 {"http://google.com/",S_OK},
4685 {"google.com",S_OK},
4688 {"google.com",S_OK},
4693 {"http://google.com/",S_OK},
4699 {Uri_HOST_DNS,S_OK},
4701 {URL_SCHEME_HTTP,S_OK},
4702 {URLZONE_INVALID,E_NOTIMPL}
4705 /* Can't set the scheme name to NULL. */
4706 { "zip://google.com/",0,S_OK,FALSE,
4708 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
4715 {"zip://google.com/",S_OK},
4716 {"google.com",S_OK},
4717 {"zip://google.com/",S_OK},
4718 {"google.com",S_OK},
4721 {"google.com",S_OK},
4726 {"zip://google.com/",S_OK},
4732 {Uri_HOST_DNS,S_OK},
4734 {URL_SCHEME_UNKNOWN,S_OK},
4735 {URLZONE_INVALID,E_NOTIMPL}
4738 /* Can't set the scheme name to an empty string. */
4739 { "zip://google.com/",0,S_OK,FALSE,
4741 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
4748 {"zip://google.com/",S_OK},
4749 {"google.com",S_OK},
4750 {"zip://google.com/",S_OK},
4751 {"google.com",S_OK},
4754 {"google.com",S_OK},
4759 {"zip://google.com/",S_OK},
4765 {Uri_HOST_DNS,S_OK},
4767 {URL_SCHEME_UNKNOWN,S_OK},
4768 {URLZONE_INVALID,E_NOTIMPL}
4771 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
4772 * CreateUriSimple always uses the flags the base IUri was created with (if any).
4774 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
4779 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
4781 {"http://google.com/../../",S_OK},
4782 {"google.com",S_OK},
4783 {"http://google.com/../../",S_OK},
4784 {"google.com",S_OK},
4787 {"google.com",S_OK},
4792 {"http://google.com/../../",S_OK},
4798 {Uri_HOST_DNS,S_OK},
4800 {URL_SCHEME_HTTP,S_OK},
4801 {URLZONE_INVALID,E_NOTIMPL}
4804 { "http://google.com/",0,S_OK,FALSE,
4806 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4811 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
4813 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4814 {"google.com",S_OK},
4815 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4816 {"google.com",S_OK},
4818 {"#Fr%3C%7C%3Eg",S_OK},
4819 {"google.com",S_OK},
4824 {"http://google.com/#Fr<|>g",S_OK},
4830 {Uri_HOST_DNS,S_OK},
4832 {URL_SCHEME_HTTP,S_OK},
4833 {URLZONE_INVALID,E_NOTIMPL}
4836 { "http://google.com/",0,S_OK,FALSE,
4838 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4841 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
4843 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
4845 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4846 {"google.com",S_OK},
4847 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
4848 {"google.com",S_OK},
4850 {"#Fr%3C%7C%3Eg",S_OK},
4851 {"google.com",S_OK},
4856 {"http://google.com/#Fr<|>g",S_OK},
4862 {Uri_HOST_DNS,S_OK},
4864 {URL_SCHEME_HTTP,S_OK},
4865 {URLZONE_INVALID,E_NOTIMPL}
4868 { NULL,0,S_OK,FALSE,
4870 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4871 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4874 0,INET_E_INVALID_URL,FALSE,
4875 0,INET_E_INVALID_URL,FALSE,
4876 0,0,0,INET_E_INVALID_URL,FALSE
4878 { "http://google.com/",0,S_OK,FALSE,
4880 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4883 0,INET_E_INVALID_URL,FALSE,
4884 0,INET_E_INVALID_URL,FALSE,
4885 0,0,0,INET_E_INVALID_URL,FALSE
4887 /* File scheme's can't have a username set. */
4888 { "file://google.com/",0,S_OK,FALSE,
4890 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4893 0,INET_E_INVALID_URL,FALSE,
4894 0,INET_E_INVALID_URL,FALSE,
4895 0,0,0,INET_E_INVALID_URL,FALSE
4897 /* File schemes can't have a password set. */
4898 { "file://google.com/",0,S_OK,FALSE,
4900 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4903 0,INET_E_INVALID_URL,FALSE,
4904 0,INET_E_INVALID_URL,FALSE,
4905 0,0,0,INET_E_INVALID_URL,FALSE
4907 /* UserName can't contain any character that is a delimeter for another
4908 * component that appears after it in a normal URI.
4910 { "http://google.com/",0,S_OK,FALSE,
4912 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4915 0,INET_E_INVALID_URL,FALSE,
4916 0,INET_E_INVALID_URL,FALSE,
4917 0,0,0,INET_E_INVALID_URL,FALSE
4919 { "http://google.com/",0,S_OK,FALSE,
4921 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4924 0,INET_E_INVALID_URL,FALSE,
4925 0,INET_E_INVALID_URL,FALSE,
4926 0,0,0,INET_E_INVALID_URL,FALSE
4928 { "http://google.com/",0,S_OK,FALSE,
4930 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4933 0,INET_E_INVALID_URL,FALSE,
4934 0,INET_E_INVALID_URL,FALSE,
4935 0,0,0,INET_E_INVALID_URL,FALSE
4937 { "http://google.com/",0,S_OK,FALSE,
4939 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4942 0,INET_E_INVALID_URL,FALSE,
4943 0,INET_E_INVALID_URL,FALSE,
4944 0,0,0,INET_E_INVALID_URL,FALSE
4946 { "http://google.com/",0,S_OK,FALSE,
4948 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4951 0,INET_E_INVALID_URL,FALSE,
4952 0,INET_E_INVALID_URL,FALSE,
4953 0,0,0,INET_E_INVALID_URL,FALSE
4955 { "http://google.com/",0,S_OK,FALSE,
4957 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4960 0,INET_E_INVALID_URL,FALSE,
4961 0,INET_E_INVALID_URL,FALSE,
4962 0,0,0,INET_E_INVALID_URL,FALSE
4964 { "http://google.com/",0,S_OK,FALSE,
4966 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4969 0,INET_E_INVALID_URL,FALSE,
4970 0,INET_E_INVALID_URL,FALSE,
4971 0,0,0,INET_E_INVALID_URL,FALSE
4973 { "http://google.com/",0,S_OK,FALSE,
4975 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4978 0,INET_E_INVALID_URL,FALSE,
4979 0,INET_E_INVALID_URL,FALSE,
4980 0,0,0,INET_E_INVALID_URL,FALSE
4982 { "http://google.com/",0,S_OK,FALSE,
4984 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4987 0,INET_E_INVALID_URL,FALSE,
4988 0,INET_E_INVALID_URL,FALSE,
4989 0,0,0,INET_E_INVALID_URL,FALSE
4991 { "http://google.com/",0,S_OK,FALSE,
4993 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
4996 0,INET_E_INVALID_URL,FALSE,
4997 0,INET_E_INVALID_URL,FALSE,
4998 0,0,0,INET_E_INVALID_URL,FALSE
5000 { "http://google.com/",0,S_OK,FALSE,
5002 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5005 0,INET_E_INVALID_URL,FALSE,
5006 0,INET_E_INVALID_URL,FALSE,
5007 0,0,0,INET_E_INVALID_URL,FALSE
5009 { "http://google.com/",0,S_OK,FALSE,
5011 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5014 0,INET_E_INVALID_URL,FALSE,
5015 0,INET_E_INVALID_URL,FALSE,
5016 0,0,0,INET_E_INVALID_URL,FALSE
5018 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5019 { "http://google.com/",0,S_OK,FALSE,
5021 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5028 {"http://winehq.org:test/",S_OK},
5029 {"winehq.org:test",S_OK},
5030 {"http://winehq.org:test/",S_OK},
5031 {"winehq.org:test",S_OK},
5034 {"winehq.org:test",S_OK},
5039 {"http://winehq.org:test/",S_OK},
5045 {Uri_HOST_DNS,S_OK},
5047 {URL_SCHEME_HTTP,S_OK},
5048 {URLZONE_INVALID,E_NOTIMPL}
5051 /* Can't set the host name to NULL. */
5052 { "http://google.com/",0,S_OK,FALSE,
5054 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5061 {"http://google.com/",S_OK},
5062 {"google.com",S_OK},
5063 {"http://google.com/",S_OK},
5064 {"google.com",S_OK},
5067 {"google.com",S_OK},
5072 {"http://google.com/",S_OK},
5078 {Uri_HOST_DNS,S_OK},
5080 {URL_SCHEME_HTTP,S_OK},
5081 {URLZONE_INVALID,E_NOTIMPL}
5084 /* Can set the host name to an empty string. */
5085 { "http://google.com/",0,S_OK,FALSE,
5087 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5111 {Uri_HOST_UNKNOWN,S_OK},
5113 {URL_SCHEME_HTTP,S_OK},
5114 {URLZONE_INVALID,E_NOTIMPL}
5117 { "http://google.com/",0,S_OK,FALSE,
5119 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5122 0,INET_E_INVALID_URL,FALSE,
5123 0,INET_E_INVALID_URL,FALSE,
5124 0,0,0,INET_E_INVALID_URL,FALSE
5126 { "http://google.com/",0,S_OK,FALSE,
5128 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5131 0,INET_E_INVALID_URL,FALSE,
5132 0,INET_E_INVALID_URL,FALSE,
5133 0,0,0,INET_E_INVALID_URL,FALSE
5135 { "http://google.com/",0,S_OK,FALSE,
5137 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5140 0,INET_E_INVALID_URL,FALSE,
5141 0,INET_E_INVALID_URL,FALSE,
5142 0,0,0,INET_E_INVALID_URL,FALSE
5146 typedef struct _uri_builder_remove_test {
5149 HRESULT create_builder_expected;
5150 BOOL create_builder_todo;
5152 DWORD remove_properties;
5153 HRESULT remove_expected;
5156 const char *expected_uri;
5157 DWORD expected_flags;
5158 HRESULT expected_hres;
5160 } uri_builder_remove_test;
5162 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5163 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5164 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5165 "http://google.com/",0,S_OK,FALSE
5167 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5168 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5169 "http://winehq.org/",0,S_OK,FALSE
5171 { "zip://google.com?Test=x",0,S_OK,FALSE,
5172 Uri_HAS_HOST,S_OK,FALSE,
5173 "zip:/?Test=x",0,S_OK,FALSE
5175 /* Doesn't remove the whole userinfo component. */
5176 { "http://username:pass@google.com/",0,S_OK,FALSE,
5177 Uri_HAS_USER_INFO,S_OK,FALSE,
5178 "http://username:pass@google.com/",0,S_OK,FALSE
5180 /* Doesn't remove the domain. */
5181 { "http://google.com/",0,S_OK,FALSE,
5182 Uri_HAS_DOMAIN,S_OK,FALSE,
5183 "http://google.com/",0,S_OK,FALSE
5185 { "http://google.com:120/",0,S_OK,FALSE,
5186 Uri_HAS_AUTHORITY,S_OK,FALSE,
5187 "http://google.com:120/",0,S_OK,FALSE
5189 { "http://google.com/test.com/",0,S_OK,FALSE,
5190 Uri_HAS_EXTENSION,S_OK,FALSE,
5191 "http://google.com/test.com/",0,S_OK,FALSE
5193 { "http://google.com/?test=x",0,S_OK,FALSE,
5194 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5195 "http://google.com/?test=x",0,S_OK,FALSE
5197 /* Can't remove the scheme name. */
5198 { "http://google.com/?test=x",0,S_OK,FALSE,
5199 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5200 "http://google.com/?test=x",0,S_OK,FALSE
5204 typedef struct _uri_combine_str_property {
5208 const char *broken_value;
5209 const char *value_ex;
5210 } uri_combine_str_property;
5212 typedef struct _uri_combine_test {
5213 const char *base_uri;
5214 DWORD base_create_flags;
5215 const char *relative_uri;
5216 DWORD relative_create_flags;
5217 DWORD combine_flags;
5221 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5222 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5225 static const uri_combine_test uri_combine_tests[] = {
5226 { "http://google.com/fun/stuff",0,
5227 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5230 {"http://google.com/not/fun/stuff",S_OK},
5231 {"google.com",S_OK},
5232 {"http://google.com/not/fun/stuff",S_OK},
5233 {"google.com",S_OK},
5236 {"google.com",S_OK},
5238 {"/not/fun/stuff",S_OK},
5239 {"/not/fun/stuff",S_OK},
5241 {"http://google.com/not/fun/stuff",S_OK},
5247 {Uri_HOST_DNS,S_OK},
5249 {URL_SCHEME_HTTP,S_OK},
5250 {URLZONE_INVALID,E_NOTIMPL}
5253 { "http://google.com/test",0,
5254 "zip://test.com/cool",0,
5257 {"zip://test.com/cool",S_OK},
5259 {"zip://test.com/cool",S_OK},
5268 {"zip://test.com/cool",S_OK},
5274 {Uri_HOST_DNS,S_OK},
5276 {URL_SCHEME_UNKNOWN,S_OK},
5277 {URLZONE_INVALID,E_NOTIMPL}
5280 { "http://google.com/use/base/path",0,
5281 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5284 {"http://google.com/use/base/path?relative",S_OK},
5285 {"google.com",S_OK},
5286 {"http://google.com/use/base/path?relative",S_OK},
5287 {"google.com",S_OK},
5290 {"google.com",S_OK},
5292 {"/use/base/path",S_OK},
5293 {"/use/base/path?relative",S_OK},
5295 {"http://google.com/use/base/path?relative",S_OK},
5301 {Uri_HOST_DNS,S_OK},
5303 {URL_SCHEME_HTTP,S_OK},
5304 {URLZONE_INVALID,E_NOTIMPL}
5307 { "http://google.com/path",0,
5308 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5311 {"http://google.com/testing",S_OK},
5312 {"google.com",S_OK},
5313 {"http://google.com/testing",S_OK},
5314 {"google.com",S_OK},
5317 {"google.com",S_OK},
5322 {"http://google.com/testing",S_OK},
5328 {Uri_HOST_DNS,S_OK},
5330 {URL_SCHEME_HTTP,S_OK},
5331 {URLZONE_INVALID,E_NOTIMPL}
5334 { "http://google.com/path",0,
5335 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5336 URL_DONT_SIMPLIFY,S_OK,FALSE,
5338 {"http://google.com:80/test/../test/.././testing",S_OK},
5339 {"google.com",S_OK},
5340 {"http://google.com:80/test/../test/.././testing",S_OK},
5341 {"google.com",S_OK},
5344 {"google.com",S_OK},
5346 {"/test/../test/.././testing",S_OK},
5347 {"/test/../test/.././testing",S_OK},
5349 {"http://google.com:80/test/../test/.././testing",S_OK},
5355 {Uri_HOST_DNS,S_OK},
5357 {URL_SCHEME_HTTP,S_OK},
5358 {URLZONE_INVALID,E_NOTIMPL}
5361 { "http://winehq.org/test/abc",0,
5362 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5365 {"http://winehq.org/test/testing/test",S_OK},
5366 {"winehq.org",S_OK},
5367 {"http://winehq.org/test/testing/test",S_OK},
5368 {"winehq.org",S_OK},
5371 {"winehq.org",S_OK},
5373 {"/test/testing/test",S_OK},
5374 {"/test/testing/test",S_OK},
5376 {"http://winehq.org/test/testing/test",S_OK},
5382 {Uri_HOST_DNS,S_OK},
5384 {URL_SCHEME_HTTP,S_OK},
5385 {URLZONE_INVALID,E_NOTIMPL}
5388 { "http://winehq.org/test/abc",0,
5389 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5390 URL_DONT_SIMPLIFY,S_OK,FALSE,
5392 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5393 /* Default port is hidden in the authority. */
5394 {"winehq.org",S_OK},
5395 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5396 {"winehq.org",S_OK},
5399 {"winehq.org",S_OK},
5401 {"/test/testing/abc/../test",S_OK},
5402 {"/test/testing/abc/../test",S_OK},
5404 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5410 {Uri_HOST_DNS,S_OK},
5412 {URL_SCHEME_HTTP,S_OK},
5413 {URLZONE_INVALID,E_NOTIMPL}
5416 { "http://winehq.org/test?query",0,
5417 "testing",Uri_CREATE_ALLOW_RELATIVE,
5420 {"http://winehq.org/testing",S_OK},
5421 {"winehq.org",S_OK},
5422 {"http://winehq.org/testing",S_OK},
5423 {"winehq.org",S_OK},
5426 {"winehq.org",S_OK},
5431 {"http://winehq.org/testing",S_OK},
5437 {Uri_HOST_DNS,S_OK},
5439 {URL_SCHEME_HTTP,S_OK},
5440 {URLZONE_INVALID,E_NOTIMPL}
5443 { "http://winehq.org/test#frag",0,
5444 "testing",Uri_CREATE_ALLOW_RELATIVE,
5447 {"http://winehq.org/testing",S_OK},
5448 {"winehq.org",S_OK},
5449 {"http://winehq.org/testing",S_OK},
5450 {"winehq.org",S_OK},
5453 {"winehq.org",S_OK},
5458 {"http://winehq.org/testing",S_OK},
5464 {Uri_HOST_DNS,S_OK},
5466 {URL_SCHEME_HTTP,S_OK},
5467 {URLZONE_INVALID,E_NOTIMPL}
5470 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5471 "test",Uri_CREATE_ALLOW_RELATIVE,
5491 {Uri_HOST_UNKNOWN,S_OK},
5493 {URL_SCHEME_UNKNOWN,S_OK},
5494 {URLZONE_INVALID,E_NOTIMPL}
5497 { "file:///c:/test/test",0,
5498 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5499 URL_FILE_USE_PATHURL,S_OK,FALSE,
5501 {"file://c:\\testing.mp3",S_OK},
5503 {"file://c:\\testing.mp3",S_OK},
5509 {"c:\\testing.mp3",S_OK},
5510 {"c:\\testing.mp3",S_OK},
5512 {"file://c:\\testing.mp3",S_OK},
5518 {Uri_HOST_UNKNOWN,S_OK},
5520 {URL_SCHEME_FILE,S_OK},
5521 {URLZONE_INVALID,E_NOTIMPL}
5524 { "file:///c:/test/test",0,
5525 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5528 {"file:///c:/testing.mp3",S_OK},
5530 {"file:///c:/testing.mp3",S_OK},
5536 {"/c:/testing.mp3",S_OK},
5537 {"/c:/testing.mp3",S_OK},
5539 {"file:///c:/testing.mp3",S_OK},
5545 {Uri_HOST_UNKNOWN,S_OK},
5547 {URL_SCHEME_FILE,S_OK},
5548 {URLZONE_INVALID,E_NOTIMPL}
5551 { "file://test.com/test/test",0,
5552 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5553 URL_FILE_USE_PATHURL,S_OK,FALSE,
5555 {"file://\\\\test.com\\testing.mp3",S_OK},
5557 {"file://\\\\test.com\\testing.mp3",S_OK},
5563 {"\\testing.mp3",S_OK},
5564 {"\\testing.mp3",S_OK},
5566 {"file://\\\\test.com\\testing.mp3",S_OK},
5572 {Uri_HOST_DNS,S_OK},
5574 {URL_SCHEME_FILE,S_OK},
5575 {URLZONE_INVALID,E_NOTIMPL}
5578 /* URL_DONT_SIMPLIFY has no effect. */
5579 { "http://google.com/test",0,
5580 "zip://test.com/cool/../cool/test",0,
5581 URL_DONT_SIMPLIFY,S_OK,FALSE,
5583 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5585 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5591 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5592 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5594 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
5595 * On IE 7 it reduces the path in the Raw URI.
5597 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
5603 {Uri_HOST_DNS,S_OK},
5605 {URL_SCHEME_UNKNOWN,S_OK},
5606 {URLZONE_INVALID,E_NOTIMPL}
5609 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
5610 * resulting URI is converted into a dos path.
5612 { "http://google.com/test",0,
5613 "file:///c:/test/",0,
5614 URL_FILE_USE_PATHURL,S_OK,FALSE,
5616 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5618 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5624 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5625 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5627 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5633 {Uri_HOST_UNKNOWN,S_OK},
5635 {URL_SCHEME_FILE,S_OK},
5636 {URLZONE_INVALID,E_NOTIMPL}
5639 { "http://google.com/test",0,
5640 "http://test.com/test#%30test",0,
5641 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
5643 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5645 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5648 {"#0test",S_OK,FALSE,NULL,"#%30test"},
5654 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
5655 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
5661 {Uri_HOST_DNS,S_OK},
5663 {URL_SCHEME_HTTP,S_OK},
5664 {URLZONE_INVALID,E_NOTIMPL}
5667 /* Windows validates the path component from the relative Uri. */
5668 { "http://google.com/test",0,
5669 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
5670 0,E_INVALIDARG,FALSE
5672 /* Windows doesn't validate the query from the relative Uri. */
5673 { "http://google.com/test",0,
5674 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
5677 {"http://google.com/test?Tes%XXt",S_OK},
5678 {"google.com",S_OK},
5679 {"http://google.com/test?Tes%XXt",S_OK},
5680 {"google.com",S_OK},
5683 {"google.com",S_OK},
5686 {"/test?Tes%XXt",S_OK},
5688 {"http://google.com/test?Tes%XXt",S_OK},
5694 {Uri_HOST_DNS,S_OK},
5696 {URL_SCHEME_HTTP,S_OK},
5697 {URLZONE_INVALID,E_NOTIMPL}
5700 /* Windows doesn't validate the fragment from the relative Uri. */
5701 { "http://google.com/test",0,
5702 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
5705 {"http://google.com/test#Tes%XXt",S_OK},
5706 {"google.com",S_OK},
5707 {"http://google.com/test#Tes%XXt",S_OK},
5708 {"google.com",S_OK},
5711 {"google.com",S_OK},
5716 {"http://google.com/test#Tes%XXt",S_OK},
5722 {Uri_HOST_DNS,S_OK},
5724 {URL_SCHEME_HTTP,S_OK},
5725 {URLZONE_INVALID,E_NOTIMPL}
5728 /* Creates an IUri which contains an invalid dos path char. */
5729 { "file:///c:/test",0,
5730 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
5731 URL_FILE_USE_PATHURL,S_OK,FALSE,
5733 {"file://c:\\test<ing",S_OK},
5735 {"file://c:\\test<ing",S_OK},
5741 {"c:\\test<ing",S_OK},
5742 {"c:\\test<ing",S_OK},
5744 {"file://c:\\test<ing",S_OK},
5750 {Uri_HOST_UNKNOWN,S_OK},
5752 {URL_SCHEME_FILE,S_OK},
5753 {URLZONE_INVALID,E_NOTIMPL}
5756 /* Appends the path after the drive letter (if any). */
5757 { "file:///c:/test",0,
5758 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
5761 {"file:///c:/c:/testing",S_OK},
5763 {"file:///c:/c:/testing",S_OK},
5769 {"/c:/c:/testing",S_OK},
5770 {"/c:/c:/testing",S_OK},
5772 {"file:///c:/c:/testing",S_OK},
5778 {Uri_HOST_UNKNOWN,S_OK},
5780 {URL_SCHEME_FILE,S_OK},
5781 {URLZONE_INVALID,E_NOTIMPL}
5784 /* A '/' is added if the base URI doesn't have a path and the
5785 * relative URI doesn't contain a path (since the base URI is
5788 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
5789 "?test",Uri_CREATE_ALLOW_RELATIVE,
5792 {"http://google.com/?test",S_OK},
5793 {"google.com",S_OK},
5794 {"http://google.com/?test",S_OK},
5795 {"google.com",S_OK},
5798 {"google.com",S_OK},
5803 {"http://google.com/?test",S_OK},
5809 {Uri_HOST_DNS,S_OK},
5811 {URL_SCHEME_HTTP,S_OK},
5812 {URLZONE_INVALID,E_NOTIMPL}
5815 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
5816 "?test",Uri_CREATE_ALLOW_RELATIVE,
5819 {"zip://google.com/?test",S_OK},
5820 {"google.com",S_OK},
5821 {"zip://google.com/?test",S_OK},
5822 {"google.com",S_OK},
5825 {"google.com",S_OK},
5830 {"zip://google.com/?test",S_OK},
5836 {Uri_HOST_DNS,S_OK},
5838 {URL_SCHEME_UNKNOWN,S_OK},
5839 {URLZONE_INVALID,E_NOTIMPL}
5842 /* No path is appended since the base URI is opaque. */
5844 "?test",Uri_CREATE_ALLOW_RELATIVE,
5864 {Uri_HOST_UNKNOWN,S_OK},
5866 {URL_SCHEME_UNKNOWN,S_OK},
5867 {URLZONE_INVALID,E_NOTIMPL}
5871 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
5874 {"file:///c:/testing/test",S_OK},
5876 {"file:///c:/testing/test",S_OK},
5882 {"/c:/testing/test",S_OK},
5883 {"/c:/testing/test",S_OK},
5885 {"file:///c:/testing/test",S_OK},
5891 {Uri_HOST_UNKNOWN,S_OK},
5893 {URL_SCHEME_FILE,S_OK},
5894 {URLZONE_INVALID,E_NOTIMPL}
5899 static inline LPWSTR a2w(LPCSTR str) {
5903 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
5904 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
5905 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
5911 static inline BOOL heap_free(void* mem) {
5912 return HeapFree(GetProcessHeap(), 0, mem);
5915 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
5916 LPWSTR strAW = a2w(strA);
5917 DWORD ret = lstrcmpW(strAW, strB);
5922 static inline ULONG get_refcnt(IUri *uri) {
5924 return IUri_Release(uri);
5927 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
5932 valueW = a2w(prop->value);
5933 switch(prop->property) {
5934 case Uri_PROPERTY_FRAGMENT:
5935 hr = IUriBuilder_SetFragment(builder, valueW);
5938 ok(hr == prop->expected,
5939 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5940 hr, prop->expected, test_index);
5943 ok(hr == prop->expected,
5944 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5945 hr, prop->expected, test_index);
5948 case Uri_PROPERTY_HOST:
5949 hr = IUriBuilder_SetHost(builder, valueW);
5952 ok(hr == prop->expected,
5953 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5954 hr, prop->expected, test_index);
5957 ok(hr == prop->expected,
5958 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5959 hr, prop->expected, test_index);
5962 case Uri_PROPERTY_PASSWORD:
5963 hr = IUriBuilder_SetPassword(builder, valueW);
5966 ok(hr == prop->expected,
5967 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5968 hr, prop->expected, test_index);
5971 ok(hr == prop->expected,
5972 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5973 hr, prop->expected, test_index);
5976 case Uri_PROPERTY_PATH:
5977 hr = IUriBuilder_SetPath(builder, valueW);
5980 ok(hr == prop->expected,
5981 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5982 hr, prop->expected, test_index);
5985 ok(hr == prop->expected,
5986 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5987 hr, prop->expected, test_index);
5990 case Uri_PROPERTY_QUERY:
5991 hr = IUriBuilder_SetQuery(builder, valueW);
5994 ok(hr == prop->expected,
5995 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
5996 hr, prop->expected, test_index);
5999 ok(hr == prop->expected,
6000 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6001 hr, prop->expected, test_index);
6004 case Uri_PROPERTY_SCHEME_NAME:
6005 hr = IUriBuilder_SetSchemeName(builder, valueW);
6008 ok(hr == prop->expected,
6009 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6010 hr, prop->expected, test_index);
6013 ok(hr == prop->expected,
6014 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6015 hr, prop->expected, test_index);
6018 case Uri_PROPERTY_USER_NAME:
6019 hr = IUriBuilder_SetUserName(builder, valueW);
6022 ok(hr == prop->expected,
6023 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6024 hr, prop->expected, test_index);
6027 ok(hr == prop->expected,
6028 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6029 hr, prop->expected, test_index);
6033 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6040 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6043 static void test_CreateUri_InvalidFlags(void) {
6046 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6048 IUri *uri = (void*) 0xdeadbeef;
6050 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6051 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6052 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6053 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6057 static void test_CreateUri_InvalidArgs(void) {
6059 IUri *uri = (void*) 0xdeadbeef;
6061 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6062 static const WCHAR emptyW[] = {0};
6064 hr = pCreateUri(http_urlW, 0, 0, NULL);
6065 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6067 hr = pCreateUri(NULL, 0, 0, &uri);
6068 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6069 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6071 uri = (void*) 0xdeadbeef;
6072 hr = pCreateUri(invalidW, 0, 0, &uri);
6073 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6074 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6076 uri = (void*) 0xdeadbeef;
6077 hr = pCreateUri(emptyW, 0, 0, &uri);
6078 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6079 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6082 static void test_CreateUri_InvalidUri(void) {
6085 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6086 invalid_uri test = invalid_uri_tests[i];
6091 uriW = a2w(test.uri);
6092 hr = pCreateUri(uriW, test.flags, 0, &uri);
6095 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6096 hr, E_INVALIDARG, i);
6099 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6100 hr, E_INVALIDARG, i);
6102 if(uri) IUri_Release(uri);
6108 static void test_IUri_GetPropertyBSTR(void) {
6113 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6114 hr = pCreateUri(http_urlW, 0, 0, &uri);
6115 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6117 BSTR received = NULL;
6119 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6120 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6122 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6123 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6124 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6125 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6126 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6127 SysFreeString(received);
6129 /* Make sure it handles the ZONE property correctly. */
6131 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6132 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6133 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6134 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6135 SysFreeString(received);
6137 if(uri) IUri_Release(uri);
6139 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6140 uri_properties test = uri_tests[i];
6144 uriW = a2w(test.uri);
6145 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6146 if(test.create_todo) {
6148 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6149 hr, test.create_expected, i);
6152 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6153 hr, test.create_expected, i);
6159 /* Checks all the string properties of the uri. */
6160 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6161 BSTR received = NULL;
6162 uri_str_property prop = test.str_props[j];
6164 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6167 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6168 hr, prop.expected, i, j);
6171 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6172 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6173 prop.value, wine_dbgstr_w(received), i, j);
6176 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6177 hr, prop.expected, i, j);
6178 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6179 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6180 prop.value, wine_dbgstr_w(received), i, j);
6183 SysFreeString(received);
6187 if(uri) IUri_Release(uri);
6193 static void test_IUri_GetPropertyDWORD(void) {
6198 hr = pCreateUri(http_urlW, 0, 0, &uri);
6199 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6201 DWORD received = 0xdeadbeef;
6203 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6204 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6206 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6207 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6208 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6210 if(uri) IUri_Release(uri);
6212 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6213 uri_properties test = uri_tests[i];
6217 uriW = a2w(test.uri);
6218 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6219 if(test.create_todo) {
6221 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6222 hr, test.create_expected, i);
6225 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6226 hr, test.create_expected, i);
6232 /* Checks all the DWORD properties of the uri. */
6233 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6235 uri_dword_property prop = test.dword_props[j];
6237 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6240 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6241 hr, prop.expected, i, j);
6244 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6245 prop.value, received, i, j);
6248 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6249 hr, prop.expected, i, j);
6250 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6251 prop.value, received, i, j);
6256 if(uri) IUri_Release(uri);
6262 /* Tests all the 'Get*' property functions which deal with strings. */
6263 static void test_IUri_GetStrProperties(void) {
6268 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6269 hr = pCreateUri(http_urlW, 0, 0, &uri);
6270 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6272 hr = IUri_GetAbsoluteUri(uri, NULL);
6273 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6275 hr = IUri_GetAuthority(uri, NULL);
6276 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6278 hr = IUri_GetDisplayUri(uri, NULL);
6279 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6281 hr = IUri_GetDomain(uri, NULL);
6282 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6284 hr = IUri_GetExtension(uri, NULL);
6285 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6287 hr = IUri_GetFragment(uri, NULL);
6288 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6290 hr = IUri_GetHost(uri, NULL);
6291 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6293 hr = IUri_GetPassword(uri, NULL);
6294 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6296 hr = IUri_GetPath(uri, NULL);
6297 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6299 hr = IUri_GetPathAndQuery(uri, NULL);
6300 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6302 hr = IUri_GetQuery(uri, NULL);
6303 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6305 hr = IUri_GetRawUri(uri, NULL);
6306 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6308 hr = IUri_GetSchemeName(uri, NULL);
6309 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6311 hr = IUri_GetUserInfo(uri, NULL);
6312 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6314 hr = IUri_GetUserName(uri, NULL);
6315 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6317 if(uri) IUri_Release(uri);
6319 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6320 uri_properties test = uri_tests[i];
6324 uriW = a2w(test.uri);
6325 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6326 if(test.create_todo) {
6328 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6329 hr, test.create_expected, i);
6332 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6333 hr, test.create_expected, i);
6337 uri_str_property prop;
6338 BSTR received = NULL;
6340 /* GetAbsoluteUri() tests. */
6341 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
6342 hr = IUri_GetAbsoluteUri(uri, &received);
6345 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6346 hr, prop.expected, i);
6349 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6350 "Error: Expected %s but got %s on uri_tests[%d].\n",
6351 prop.value, wine_dbgstr_w(received), i);
6354 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6355 hr, prop.expected, i);
6356 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6357 "Error: Expected %s but got %s on uri_tests[%d].\n",
6358 prop.value, wine_dbgstr_w(received), i);
6360 SysFreeString(received);
6363 /* GetAuthority() tests. */
6364 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
6365 hr = IUri_GetAuthority(uri, &received);
6368 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6369 hr, prop.expected, i);
6372 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6373 prop.value, wine_dbgstr_w(received), i);
6376 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6377 hr, prop.expected, i);
6378 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6379 prop.value, wine_dbgstr_w(received), i);
6381 SysFreeString(received);
6384 /* GetDisplayUri() tests. */
6385 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
6386 hr = IUri_GetDisplayUri(uri, &received);
6389 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6390 hr, prop.expected, i);
6393 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6394 "Error: Expected %s but got %s on uri_test[%d].\n",
6395 prop.value, wine_dbgstr_w(received), i);
6398 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6399 hr, prop.expected, i);
6400 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6401 "Error: Expected %s but got %s on uri_tests[%d].\n",
6402 prop.value, wine_dbgstr_w(received), i);
6404 SysFreeString(received);
6407 /* GetDomain() tests. */
6408 prop = test.str_props[Uri_PROPERTY_DOMAIN];
6409 hr = IUri_GetDomain(uri, &received);
6412 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6413 hr, prop.expected, i);
6416 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6417 prop.value, wine_dbgstr_w(received), i);
6420 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6421 hr, prop.expected, i);
6422 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6423 prop.value, wine_dbgstr_w(received), i);
6425 SysFreeString(received);
6428 /* GetExtension() tests. */
6429 prop = test.str_props[Uri_PROPERTY_EXTENSION];
6430 hr = IUri_GetExtension(uri, &received);
6433 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6434 hr, prop.expected, i);
6437 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6438 prop.value, wine_dbgstr_w(received), i);
6441 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6442 hr, prop.expected, i);
6443 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6444 prop.value, wine_dbgstr_w(received), i);
6446 SysFreeString(received);
6449 /* GetFragment() tests. */
6450 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
6451 hr = IUri_GetFragment(uri, &received);
6454 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6455 hr, prop.expected, i);
6458 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6459 prop.value, wine_dbgstr_w(received), i);
6462 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6463 hr, prop.expected, i);
6464 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6465 prop.value, wine_dbgstr_w(received), i);
6467 SysFreeString(received);
6470 /* GetHost() tests. */
6471 prop = test.str_props[Uri_PROPERTY_HOST];
6472 hr = IUri_GetHost(uri, &received);
6475 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6476 hr, prop.expected, i);
6479 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6480 prop.value, wine_dbgstr_w(received), i);
6483 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6484 hr, prop.expected, i);
6485 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6486 prop.value, wine_dbgstr_w(received), i);
6488 SysFreeString(received);
6491 /* GetPassword() tests. */
6492 prop = test.str_props[Uri_PROPERTY_PASSWORD];
6493 hr = IUri_GetPassword(uri, &received);
6496 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6497 hr, prop.expected, i);
6500 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6501 prop.value, wine_dbgstr_w(received), i);
6504 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6505 hr, prop.expected, i);
6506 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6507 prop.value, wine_dbgstr_w(received), i);
6509 SysFreeString(received);
6512 /* GetPath() tests. */
6513 prop = test.str_props[Uri_PROPERTY_PATH];
6514 hr = IUri_GetPath(uri, &received);
6517 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6518 hr, prop.expected, i);
6521 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6522 prop.value, wine_dbgstr_w(received), i);
6525 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6526 hr, prop.expected, i);
6527 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6528 prop.value, wine_dbgstr_w(received), i);
6530 SysFreeString(received);
6533 /* GetPathAndQuery() tests. */
6534 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
6535 hr = IUri_GetPathAndQuery(uri, &received);
6538 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6539 hr, prop.expected, i);
6542 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6543 prop.value, wine_dbgstr_w(received), i);
6546 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6547 hr, prop.expected, i);
6548 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6549 prop.value, wine_dbgstr_w(received), i);
6551 SysFreeString(received);
6554 /* GetQuery() tests. */
6555 prop = test.str_props[Uri_PROPERTY_QUERY];
6556 hr = IUri_GetQuery(uri, &received);
6559 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6560 hr, prop.expected, i);
6563 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6564 prop.value, wine_dbgstr_w(received), i);
6567 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6568 hr, prop.expected, i);
6569 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6570 prop.value, wine_dbgstr_w(received), i);
6572 SysFreeString(received);
6575 /* GetRawUri() tests. */
6576 prop = test.str_props[Uri_PROPERTY_RAW_URI];
6577 hr = IUri_GetRawUri(uri, &received);
6580 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6581 hr, prop.expected, i);
6584 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6585 prop.value, wine_dbgstr_w(received), i);
6588 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6589 hr, prop.expected, i);
6590 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6591 prop.value, wine_dbgstr_w(received), i);
6593 SysFreeString(received);
6596 /* GetSchemeName() tests. */
6597 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
6598 hr = IUri_GetSchemeName(uri, &received);
6601 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6602 hr, prop.expected, i);
6605 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6606 prop.value, wine_dbgstr_w(received), i);
6609 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6610 hr, prop.expected, i);
6611 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6612 prop.value, wine_dbgstr_w(received), i);
6614 SysFreeString(received);
6617 /* GetUserInfo() tests. */
6618 prop = test.str_props[Uri_PROPERTY_USER_INFO];
6619 hr = IUri_GetUserInfo(uri, &received);
6622 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6623 hr, prop.expected, i);
6626 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6627 prop.value, wine_dbgstr_w(received), i);
6630 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6631 hr, prop.expected, i);
6632 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6633 prop.value, wine_dbgstr_w(received), i);
6635 SysFreeString(received);
6638 /* GetUserName() tests. */
6639 prop = test.str_props[Uri_PROPERTY_USER_NAME];
6640 hr = IUri_GetUserName(uri, &received);
6643 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6644 hr, prop.expected, i);
6647 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6648 prop.value, wine_dbgstr_w(received), i);
6651 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6652 hr, prop.expected, i);
6653 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6654 prop.value, wine_dbgstr_w(received), i);
6656 SysFreeString(received);
6659 if(uri) IUri_Release(uri);
6665 static void test_IUri_GetDwordProperties(void) {
6670 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
6671 hr = pCreateUri(http_urlW, 0, 0, &uri);
6672 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6674 hr = IUri_GetHostType(uri, NULL);
6675 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6677 hr = IUri_GetPort(uri, NULL);
6678 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6680 hr = IUri_GetScheme(uri, NULL);
6681 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6683 hr = IUri_GetZone(uri, NULL);
6684 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6686 if(uri) IUri_Release(uri);
6688 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6689 uri_properties test = uri_tests[i];
6693 uriW = a2w(test.uri);
6694 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6695 if(test.create_todo) {
6697 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6698 hr, test.create_expected, i);
6701 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6702 hr, test.create_expected, i);
6706 uri_dword_property prop;
6709 /* Assign an insane value so tests don't accidentally pass when
6712 received = -9999999;
6714 /* GetHostType() tests. */
6715 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
6716 hr = IUri_GetHostType(uri, &received);
6719 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6720 hr, prop.expected, i);
6723 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6726 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6727 hr, prop.expected, i);
6728 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6730 received = -9999999;
6732 /* GetPort() tests. */
6733 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
6734 hr = IUri_GetPort(uri, &received);
6737 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6738 hr, prop.expected, i);
6741 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6744 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6745 hr, prop.expected, i);
6746 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6748 received = -9999999;
6750 /* GetScheme() tests. */
6751 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
6752 hr = IUri_GetScheme(uri, &received);
6755 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6756 hr, prop.expected, i);
6759 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6762 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6763 hr, prop.expected, i);
6764 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6766 received = -9999999;
6768 /* GetZone() tests. */
6769 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
6770 hr = IUri_GetZone(uri, &received);
6773 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6774 hr, prop.expected, i);
6777 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6780 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6781 hr, prop.expected, i);
6782 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
6786 if(uri) IUri_Release(uri);
6792 static void test_IUri_GetPropertyLength(void) {
6797 /* Make sure it handles invalid args correctly. */
6798 hr = pCreateUri(http_urlW, 0, 0, &uri);
6799 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6801 DWORD received = 0xdeadbeef;
6803 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
6804 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6806 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
6807 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6808 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
6810 if(uri) IUri_Release(uri);
6812 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6813 uri_properties test = uri_tests[i];
6817 uriW = a2w(test.uri);
6818 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6819 if(test.create_todo) {
6821 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6822 hr, test.create_expected, i);
6825 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
6826 hr, test.create_expected, i);
6832 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6833 DWORD expectedLen, brokenLen, receivedLen;
6834 uri_str_property prop = test.str_props[j];
6836 expectedLen = lstrlen(prop.value);
6837 brokenLen = lstrlen(prop.broken_value);
6839 /* This won't be necessary once GetPropertyLength is implemented. */
6842 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
6845 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
6846 hr, prop.expected, i, j);
6849 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
6850 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
6851 expectedLen, receivedLen, i, j);
6854 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
6855 hr, prop.expected, i, j);
6856 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
6857 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
6858 expectedLen, receivedLen, i, j);
6863 if(uri) IUri_Release(uri);
6869 static DWORD compute_expected_props(uri_properties *test)
6873 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
6874 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
6878 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
6879 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
6886 static void test_IUri_GetProperties(void) {
6891 hr = pCreateUri(http_urlW, 0, 0, &uri);
6892 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6894 hr = IUri_GetProperties(uri, NULL);
6895 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6897 if(uri) IUri_Release(uri);
6899 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6900 uri_properties test = uri_tests[i];
6904 uriW = a2w(test.uri);
6905 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6906 if(test.create_todo) {
6908 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
6911 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
6915 DWORD received = 0, expected_props;
6918 hr = IUri_GetProperties(uri, &received);
6919 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6921 expected_props = compute_expected_props(&test);
6923 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
6924 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
6925 if(expected_props & (1 << j))
6926 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
6928 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
6932 if(uri) IUri_Release(uri);
6938 static void test_IUri_HasProperty(void) {
6943 hr = pCreateUri(http_urlW, 0, 0, &uri);
6944 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6946 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
6947 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6949 if(uri) IUri_Release(uri);
6951 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6952 uri_properties test = uri_tests[i];
6956 uriW = a2w(test.uri);
6958 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6959 if(test.create_todo) {
6961 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
6964 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
6968 DWORD expected_props, j;
6970 expected_props = compute_expected_props(&test);
6972 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
6973 /* Assign -1, then explicitly test for TRUE or FALSE later. */
6976 hr = IUri_HasProperty(uri, j, &received);
6977 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
6980 if(expected_props & (1 << j)) {
6981 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
6983 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
6988 if(uri) IUri_Release(uri);
6994 static void test_IUri_IsEqual(void) {
7001 /* Make sure IsEqual handles invalid args correctly. */
7002 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
7003 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
7004 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7005 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
7006 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7008 hrA = IUri_IsEqual(uriA, NULL, &equal);
7009 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7010 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7012 hrA = IUri_IsEqual(uriA, uriB, NULL);
7013 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
7015 if(uriA) IUri_Release(uriA);
7016 if(uriB) IUri_Release(uriB);
7018 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7019 uri_equality test = equality_tests[i];
7020 LPWSTR uriA_W, uriB_W;
7024 uriA_W = a2w(test.a);
7025 uriB_W = a2w(test.b);
7027 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7028 if(test.create_todo_a) {
7030 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7034 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7038 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7039 if(test.create_todo_b) {
7041 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7045 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7049 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7052 hrA = IUri_IsEqual(uriA, uriB, &equal);
7055 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
7059 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7062 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
7063 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7066 if(uriA) IUri_Release(uriA);
7067 if(uriB) IUri_Release(uriB);
7074 static void test_CreateUriWithFragment_InvalidArgs(void) {
7076 IUri *uri = (void*) 0xdeadbeef;
7077 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7079 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7080 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7081 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7083 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7084 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7086 /* Original URI can't already contain a fragment component. */
7087 uri = (void*) 0xdeadbeef;
7088 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7089 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7090 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7093 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7094 static void test_CreateUriWithFragment_InvalidFlags(void) {
7097 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7099 IUri *uri = (void*) 0xdeadbeef;
7101 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7102 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7103 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7104 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7108 static void test_CreateUriWithFragment(void) {
7111 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7115 uri_with_fragment test = uri_fragment_tests[i];
7117 uriW = a2w(test.uri);
7118 fragW = a2w(test.fragment);
7120 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7121 if(test.expected_todo) {
7123 ok(hr == test.create_expected,
7124 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7125 hr, test.create_expected, i);
7128 ok(hr == test.create_expected,
7129 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7130 hr, test.create_expected, i);
7133 BSTR received = NULL;
7135 hr = IUri_GetAbsoluteUri(uri, &received);
7136 if(test.expected_todo) {
7139 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7143 ok(!strcmp_aw(test.expected_uri, received),
7144 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7145 test.expected_uri, wine_dbgstr_w(received), i);
7148 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7150 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7151 test.expected_uri, wine_dbgstr_w(received), i);
7154 SysFreeString(received);
7157 if(uri) IUri_Release(uri);
7162 static void test_CreateIUriBuilder(void) {
7164 IUriBuilder *builder = NULL;
7167 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7168 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7171 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7172 hr = pCreateUri(http_urlW, 0, 0, &uri);
7173 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7175 ULONG cur_count, orig_count;
7177 orig_count = get_refcnt(uri);
7178 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7179 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7180 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7182 cur_count = get_refcnt(uri);
7183 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7185 if(builder) IUriBuilder_Release(builder);
7186 cur_count = get_refcnt(uri);
7187 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7189 if(uri) IUri_Release(uri);
7192 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7197 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7198 if(test->uri_todo) {
7200 ok(hr == test->uri_hres,
7201 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7202 hr, test->uri_hres, test_index);
7205 ok(hr == test->uri_hres,
7206 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7207 hr, test->uri_hres, test_index);
7213 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7214 uri_builder_str_property prop = test->expected_str_props[i];
7215 BSTR received = NULL;
7217 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7220 ok(hr == prop.result,
7221 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7222 hr, prop.result, test_index, i);
7225 ok(hr == prop.result,
7226 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7227 hr, prop.result, test_index, i);
7232 ok(!strcmp_aw(prop.expected, received),
7233 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7234 prop.expected, wine_dbgstr_w(received), test_index, i);
7237 ok(!strcmp_aw(prop.expected, received),
7238 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7239 prop.expected, wine_dbgstr_w(received), test_index, i);
7242 SysFreeString(received);
7245 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7246 uri_builder_dword_property prop = test->expected_dword_props[i];
7247 DWORD received = -2;
7249 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7252 ok(hr == prop.result,
7253 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7254 hr, prop.result, test_index, i);
7257 ok(hr == prop.result,
7258 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7259 hr, prop.result, test_index, i);
7264 ok(received == prop.expected,
7265 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7266 prop.expected, received, test_index, i);
7269 ok(received == prop.expected,
7270 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7271 prop.expected, received, test_index, i);
7276 if(uri) IUri_Release(uri);
7279 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7284 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7285 if(test->uri_simple_todo) {
7287 ok(hr == test->uri_simple_hres,
7288 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7289 hr, test->uri_simple_hres, test_index);
7292 ok(hr == test->uri_simple_hres,
7293 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7294 hr, test->uri_simple_hres, test_index);
7300 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7301 uri_builder_str_property prop = test->expected_str_props[i];
7302 BSTR received = NULL;
7304 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7307 ok(hr == prop.result,
7308 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7309 hr, prop.result, test_index, i);
7312 ok(hr == prop.result,
7313 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7314 hr, prop.result, test_index, i);
7319 ok(!strcmp_aw(prop.expected, received),
7320 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7321 prop.expected, wine_dbgstr_w(received), test_index, i);
7324 ok(!strcmp_aw(prop.expected, received),
7325 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7326 prop.expected, wine_dbgstr_w(received), test_index, i);
7329 SysFreeString(received);
7332 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7333 uri_builder_dword_property prop = test->expected_dword_props[i];
7334 DWORD received = -2;
7336 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7339 ok(hr == prop.result,
7340 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7341 hr, prop.result, test_index, i);
7344 ok(hr == prop.result,
7345 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7346 hr, prop.result, test_index, i);
7351 ok(received == prop.expected,
7352 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7353 prop.expected, received, test_index, i);
7356 ok(received == prop.expected,
7357 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7358 prop.expected, received, test_index, i);
7363 if(uri) IUri_Release(uri);
7366 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
7371 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
7372 test->uri_with_encode_flags, 0, &uri);
7373 if(test->uri_with_todo) {
7375 ok(hr == test->uri_with_hres,
7376 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7377 hr, test->uri_with_hres, test_index);
7380 ok(hr == test->uri_with_hres,
7381 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7382 hr, test->uri_with_hres, test_index);
7388 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7389 uri_builder_str_property prop = test->expected_str_props[i];
7390 BSTR received = NULL;
7392 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7395 ok(hr == prop.result,
7396 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7397 hr, prop.result, test_index, i);
7400 ok(hr == prop.result,
7401 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7402 hr, prop.result, test_index, i);
7407 ok(!strcmp_aw(prop.expected, received),
7408 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7409 prop.expected, wine_dbgstr_w(received), test_index, i);
7412 ok(!strcmp_aw(prop.expected, received),
7413 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7414 prop.expected, wine_dbgstr_w(received), test_index, i);
7417 SysFreeString(received);
7420 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7421 uri_builder_dword_property prop = test->expected_dword_props[i];
7422 DWORD received = -2;
7424 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7427 ok(hr == prop.result,
7428 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7429 hr, prop.result, test_index, i);
7432 ok(hr == prop.result,
7433 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7434 hr, prop.result, test_index, i);
7439 ok(received == prop.expected,
7440 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7441 prop.expected, received, test_index, i);
7444 ok(received == prop.expected,
7445 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7446 prop.expected, received, test_index, i);
7451 if(uri) IUri_Release(uri);
7454 static void test_IUriBuilder_CreateInvalidArgs(void) {
7455 IUriBuilder *builder;
7458 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7459 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7461 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
7463 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
7464 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
7465 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7467 uri = (void*) 0xdeadbeef;
7468 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7469 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
7470 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
7472 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
7473 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7476 uri = (void*) 0xdeadbeef;
7477 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7478 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7480 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
7482 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
7483 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7486 uri = (void*) 0xdeadbeef;
7487 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7488 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7490 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7492 hr = pCreateUri(http_urlW, 0, 0, &test);
7493 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7495 hr = IUriBuilder_SetIUri(builder, test);
7496 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7498 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
7500 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7501 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7502 ok(uri != NULL, "Error: The uri was NULL.\n");
7503 if(uri) IUri_Release(uri);
7506 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7507 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7509 ok(uri != NULL, "Error: uri was NULL.\n");
7510 if(uri) IUri_Release(uri);
7513 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
7514 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7516 ok(uri != NULL, "Error: uri was NULL.\n");
7517 if(uri) IUri_Release(uri);
7519 hr = IUriBuilder_SetFragment(builder, NULL);
7520 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7522 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
7523 uri = (void*) 0xdeadbeef;
7524 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7525 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7526 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
7528 uri = (void*) 0xdeadbeef;
7529 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7530 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7532 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7534 uri = (void*) 0xdeadbeef;
7535 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7536 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7538 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7540 if(test) IUri_Release(test);
7542 if(builder) IUriBuilder_Release(builder);
7545 /* Tests invalid args to the "Get*" functions. */
7546 static void test_IUriBuilder_GetInvalidArgs(void) {
7547 IUriBuilder *builder = NULL;
7550 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7551 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7553 LPCWSTR received = (void*) 0xdeadbeef;
7554 DWORD len = -1, port = -1;
7557 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
7558 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7560 hr = IUriBuilder_GetFragment(builder, NULL, &received);
7561 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7563 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7564 hr = IUriBuilder_GetFragment(builder, &len, NULL);
7565 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
7567 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7569 hr = IUriBuilder_GetHost(builder, NULL, NULL);
7570 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7572 received = (void*) 0xdeadbeef;
7573 hr = IUriBuilder_GetHost(builder, NULL, &received);
7574 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7576 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7578 hr = IUriBuilder_GetHost(builder, &len, NULL);
7579 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
7581 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7583 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
7584 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7586 received = (void*) 0xdeadbeef;
7587 hr = IUriBuilder_GetPassword(builder, NULL, &received);
7588 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7590 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7592 hr = IUriBuilder_GetPassword(builder, &len, NULL);
7593 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
7595 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7597 hr = IUriBuilder_GetPath(builder, NULL, NULL);
7598 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7600 received = (void*) 0xdeadbeef;
7601 hr = IUriBuilder_GetPath(builder, NULL, &received);
7602 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7604 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7606 hr = IUriBuilder_GetPath(builder, &len, NULL);
7607 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
7609 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7611 hr = IUriBuilder_GetPort(builder, NULL, NULL);
7612 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7614 hr = IUriBuilder_GetPort(builder, NULL, &port);
7615 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7617 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
7618 hr = IUriBuilder_GetPort(builder, &set, NULL);
7619 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
7621 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
7623 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
7624 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7626 received = (void*) 0xdeadbeef;
7627 hr = IUriBuilder_GetQuery(builder, NULL, &received);
7628 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7630 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7632 hr = IUriBuilder_GetQuery(builder, &len, NULL);
7633 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
7635 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7637 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
7638 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7640 received = (void*) 0xdeadbeef;
7641 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
7642 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7644 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7646 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
7647 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
7649 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7651 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
7652 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7654 received = (void*) 0xdeadbeef;
7655 hr = IUriBuilder_GetUserName(builder, NULL, &received);
7656 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7658 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
7660 hr = IUriBuilder_GetUserName(builder, &len, NULL);
7661 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
7663 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
7665 if(builder) IUriBuilder_Release(builder);
7668 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
7672 LPCWSTR received = NULL;
7674 const uri_builder_property *prop = NULL;
7676 /* Check if the property was set earlier. */
7677 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7678 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
7679 prop = &(test->properties[i]);
7683 /* Use expected_value unless it's NULL, then use value. */
7684 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7685 hr = IUriBuilder_GetFragment(builder, &len, &received);
7688 ok(hr == (expected ? S_OK : S_FALSE),
7689 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7690 hr, (expected ? S_OK : S_FALSE), test_index);
7694 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7695 expected, wine_dbgstr_w(received), test_index);
7698 ok(lstrlen(expected) == len,
7699 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7700 lstrlen(expected), len, test_index);
7704 ok(hr == (expected ? S_OK : S_FALSE),
7705 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7706 hr, (expected ? S_OK : S_FALSE), test_index);
7707 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7708 expected, wine_dbgstr_w(received), test_index);
7709 ok(lstrlen(expected) == len,
7710 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7711 lstrlen(expected), len, test_index);
7714 /* The property wasn't set earlier, so it should return whatever
7715 * the base IUri contains (if anything).
7718 hr = IUriBuilder_GetIUri(builder, &uri);
7720 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7721 hr, S_OK, test_index);
7724 received = (void*) 0xdeadbeef;
7727 hr = IUriBuilder_GetFragment(builder, &len, &received);
7729 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7730 hr, S_FALSE, test_index);
7732 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
7734 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
7735 received, test_index);
7738 BOOL has_prop = FALSE;
7739 BSTR expected = NULL;
7741 hr = IUri_GetFragment(uri, &expected);
7743 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
7745 has_prop = hr == S_OK;
7747 hr = IUriBuilder_GetFragment(builder, &len, &received);
7750 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7751 hr, S_OK, test_index);
7753 ok(!lstrcmpW(expected, received),
7754 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
7755 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
7756 ok(lstrlenW(expected) == len,
7757 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7758 lstrlenW(expected), len, test_index);
7762 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7763 hr, S_FALSE, test_index);
7765 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
7766 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
7770 SysFreeString(expected);
7773 if(uri) IUri_Release(uri);
7777 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
7781 LPCWSTR received = NULL;
7783 const uri_builder_property *prop = NULL;
7785 /* Check if the property was set earlier. */
7786 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7787 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
7788 prop = &(test->properties[i]);
7792 /* Use expected_value unless it's NULL, then use value. */
7793 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7794 hr = IUriBuilder_GetHost(builder, &len, &received);
7797 ok(hr == (expected ? S_OK : S_FALSE),
7798 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7799 hr, (expected ? S_OK : S_FALSE), test_index);
7803 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7804 expected, wine_dbgstr_w(received), test_index);
7807 ok(lstrlen(expected) == len,
7808 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7809 lstrlen(expected), len, test_index);
7813 ok(hr == (expected ? S_OK : S_FALSE),
7814 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7815 hr, (expected ? S_OK : S_FALSE), test_index);
7816 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7817 expected, wine_dbgstr_w(received), test_index);
7818 ok(lstrlen(expected) == len,
7819 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7820 lstrlen(expected), len, test_index);
7823 /* The property wasn't set earlier, so it should return whatever
7824 * the base IUri contains (if anything).
7827 hr = IUriBuilder_GetIUri(builder, &uri);
7829 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7830 hr, S_OK, test_index);
7833 received = (void*) 0xdeadbeef;
7836 hr = IUriBuilder_GetHost(builder, &len, &received);
7838 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7839 hr, S_FALSE, test_index);
7841 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
7843 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
7844 received, test_index);
7847 BOOL has_prop = FALSE;
7848 BSTR expected = NULL;
7850 hr = IUri_GetHost(uri, &expected);
7852 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
7854 has_prop = hr == S_OK;
7856 hr = IUriBuilder_GetHost(builder, &len, &received);
7859 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7860 hr, S_OK, test_index);
7862 ok(!lstrcmpW(expected, received),
7863 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
7864 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
7865 ok(lstrlenW(expected) == len,
7866 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7867 lstrlenW(expected), len, test_index);
7871 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7872 hr, S_FALSE, test_index);
7874 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
7875 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
7879 SysFreeString(expected);
7882 if(uri) IUri_Release(uri);
7886 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
7890 LPCWSTR received = NULL;
7892 const uri_builder_property *prop = NULL;
7894 /* Check if the property was set earlier. */
7895 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
7896 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
7897 prop = &(test->properties[i]);
7901 /* Use expected_value unless it's NULL, then use value. */
7902 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
7903 hr = IUriBuilder_GetPassword(builder, &len, &received);
7906 ok(hr == (expected ? S_OK : S_FALSE),
7907 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7908 hr, (expected ? S_OK : S_FALSE), test_index);
7912 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7913 expected, wine_dbgstr_w(received), test_index);
7916 ok(lstrlen(expected) == len,
7917 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7918 lstrlen(expected), len, test_index);
7922 ok(hr == (expected ? S_OK : S_FALSE),
7923 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7924 hr, (expected ? S_OK : S_FALSE), test_index);
7925 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
7926 expected, wine_dbgstr_w(received), test_index);
7927 ok(lstrlen(expected) == len,
7928 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7929 lstrlen(expected), len, test_index);
7932 /* The property wasn't set earlier, so it should return whatever
7933 * the base IUri contains (if anything).
7936 hr = IUriBuilder_GetIUri(builder, &uri);
7938 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7939 hr, S_OK, test_index);
7942 received = (void*) 0xdeadbeef;
7945 hr = IUriBuilder_GetPassword(builder, &len, &received);
7947 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7948 hr, S_FALSE, test_index);
7950 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
7952 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
7953 received, test_index);
7956 BOOL has_prop = FALSE;
7957 BSTR expected = NULL;
7959 hr = IUri_GetPassword(uri, &expected);
7961 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
7963 has_prop = hr == S_OK;
7965 hr = IUriBuilder_GetPassword(builder, &len, &received);
7968 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7969 hr, S_OK, test_index);
7971 ok(!lstrcmpW(expected, received),
7972 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
7973 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
7974 ok(lstrlenW(expected) == len,
7975 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
7976 lstrlenW(expected), len, test_index);
7980 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7981 hr, S_FALSE, test_index);
7983 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
7984 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
7988 SysFreeString(expected);
7991 if(uri) IUri_Release(uri);
7995 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
7999 LPCWSTR received = NULL;
8001 const uri_builder_property *prop = NULL;
8003 /* Check if the property was set earlier. */
8004 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8005 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8006 prop = &(test->properties[i]);
8010 /* Use expected_value unless it's NULL, then use value. */
8011 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8012 hr = IUriBuilder_GetPath(builder, &len, &received);
8015 ok(hr == (expected ? S_OK : S_FALSE),
8016 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8017 hr, (expected ? S_OK : S_FALSE), test_index);
8021 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8022 expected, wine_dbgstr_w(received), test_index);
8025 ok(lstrlen(expected) == len,
8026 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8027 lstrlen(expected), len, test_index);
8031 ok(hr == (expected ? S_OK : S_FALSE),
8032 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8033 hr, (expected ? S_OK : S_FALSE), test_index);
8034 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8035 expected, wine_dbgstr_w(received), test_index);
8036 ok(lstrlen(expected) == len,
8037 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8038 lstrlen(expected), len, test_index);
8041 /* The property wasn't set earlier, so it should return whatever
8042 * the base IUri contains (if anything).
8045 hr = IUriBuilder_GetIUri(builder, &uri);
8047 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8048 hr, S_OK, test_index);
8051 received = (void*) 0xdeadbeef;
8054 hr = IUriBuilder_GetPath(builder, &len, &received);
8056 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8057 hr, S_FALSE, test_index);
8059 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8061 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8062 received, test_index);
8065 BOOL has_prop = FALSE;
8066 BSTR expected = NULL;
8068 hr = IUri_GetPath(uri, &expected);
8070 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8072 has_prop = hr == S_OK;
8074 hr = IUriBuilder_GetPath(builder, &len, &received);
8077 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8078 hr, S_OK, test_index);
8080 ok(!lstrcmpW(expected, received),
8081 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8082 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8083 ok(lstrlenW(expected) == len,
8084 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8085 lstrlenW(expected), len, test_index);
8089 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8090 hr, S_FALSE, test_index);
8092 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8093 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8097 SysFreeString(expected);
8100 if(uri) IUri_Release(uri);
8104 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8107 BOOL has_port = FALSE;
8108 DWORD received = -1;
8110 if(test->port_prop.change) {
8111 DWORD expected = test->port_prop.value;
8113 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8114 if(test->port_prop.todo) {
8117 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8118 hr, S_OK, test_index);
8122 ok(has_port == test->port_prop.set,
8123 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8124 test->port_prop.set, has_port, test_index);
8127 ok(received == expected,
8128 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8129 expected, received, test_index);
8134 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8135 hr, S_OK, test_index);
8136 ok(has_port == test->port_prop.set,
8137 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8138 test->port_prop.set, has_port, test_index);
8139 ok(received == test->port_prop.value,
8140 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8141 test->port_prop.value, received, test_index);
8146 hr = IUriBuilder_GetIUri(builder, &uri);
8148 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8149 hr, S_OK, test_index);
8152 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8154 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8155 hr, S_OK, test_index);
8157 ok(has_port == FALSE,
8158 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8159 has_port, test_index);
8160 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8161 received, test_index);
8166 hr = IUri_GetPort(uri, &expected);
8168 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8171 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8173 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8174 hr, S_OK, test_index);
8177 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8179 ok(received == expected,
8180 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8181 expected, received, test_index);
8185 if(uri) IUri_Release(uri);
8189 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8193 LPCWSTR received = NULL;
8195 const uri_builder_property *prop = NULL;
8197 /* Check if the property was set earlier. */
8198 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8199 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8200 prop = &(test->properties[i]);
8204 /* Use expected_value unless it's NULL, then use value. */
8205 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8206 hr = IUriBuilder_GetQuery(builder, &len, &received);
8209 ok(hr == (expected ? S_OK : S_FALSE),
8210 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8211 hr, (expected ? S_OK : S_FALSE), test_index);
8215 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8216 expected, wine_dbgstr_w(received), test_index);
8219 ok(lstrlen(expected) == len,
8220 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8221 lstrlen(expected), len, test_index);
8225 ok(hr == (expected ? S_OK : S_FALSE),
8226 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8227 hr, (expected ? S_OK : S_FALSE), test_index);
8228 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8229 expected, wine_dbgstr_w(received), test_index);
8230 ok(lstrlen(expected) == len,
8231 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8232 lstrlen(expected), len, test_index);
8235 /* The property wasn't set earlier, so it should return whatever
8236 * the base IUri contains (if anything).
8239 hr = IUriBuilder_GetIUri(builder, &uri);
8241 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8242 hr, S_OK, test_index);
8245 received = (void*) 0xdeadbeef;
8248 hr = IUriBuilder_GetQuery(builder, &len, &received);
8250 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8251 hr, S_FALSE, test_index);
8253 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8255 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8256 received, test_index);
8259 BOOL has_prop = FALSE;
8260 BSTR expected = NULL;
8262 hr = IUri_GetQuery(uri, &expected);
8264 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8266 has_prop = hr == S_OK;
8268 hr = IUriBuilder_GetQuery(builder, &len, &received);
8271 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8272 hr, S_OK, test_index);
8274 ok(!lstrcmpW(expected, received),
8275 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8276 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8277 ok(lstrlenW(expected) == len,
8278 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8279 lstrlenW(expected), len, test_index);
8283 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8284 hr, S_FALSE, test_index);
8286 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8287 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8291 SysFreeString(expected);
8294 if(uri) IUri_Release(uri);
8298 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8302 LPCWSTR received = NULL;
8304 const uri_builder_property *prop = NULL;
8306 /* Check if the property was set earlier. */
8307 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8308 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8309 prop = &(test->properties[i]);
8313 /* Use expected_value unless it's NULL, then use value. */
8314 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8315 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8318 ok(hr == (expected ? S_OK : S_FALSE),
8319 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8320 hr, (expected ? S_OK : S_FALSE), test_index);
8324 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8325 expected, wine_dbgstr_w(received), test_index);
8328 ok(lstrlen(expected) == len,
8329 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8330 lstrlen(expected), len, test_index);
8334 ok(hr == (expected ? S_OK : S_FALSE),
8335 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8336 hr, (expected ? S_OK : S_FALSE), test_index);
8337 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8338 expected, wine_dbgstr_w(received), test_index);
8339 ok(lstrlen(expected) == len,
8340 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8341 lstrlen(expected), len, test_index);
8344 /* The property wasn't set earlier, so it should return whatever
8345 * the base IUri contains (if anything).
8348 hr = IUriBuilder_GetIUri(builder, &uri);
8350 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8351 hr, S_OK, test_index);
8354 received = (void*) 0xdeadbeef;
8357 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8359 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8360 hr, S_FALSE, test_index);
8362 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8364 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8365 received, test_index);
8368 BOOL has_prop = FALSE;
8369 BSTR expected = NULL;
8371 hr = IUri_GetSchemeName(uri, &expected);
8373 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8375 has_prop = hr == S_OK;
8377 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8380 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8381 hr, S_OK, test_index);
8383 ok(!lstrcmpW(expected, received),
8384 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8385 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8386 ok(lstrlenW(expected) == len,
8387 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8388 lstrlenW(expected), len, test_index);
8392 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8393 hr, S_FALSE, test_index);
8395 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8396 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8400 SysFreeString(expected);
8403 if(uri) IUri_Release(uri);
8407 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
8411 LPCWSTR received = NULL;
8413 const uri_builder_property *prop = NULL;
8415 /* Check if the property was set earlier. */
8416 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8417 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
8418 prop = &(test->properties[i]);
8421 if(prop && prop->value && *prop->value) {
8422 /* Use expected_value unless it's NULL, then use value. */
8423 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8424 hr = IUriBuilder_GetUserName(builder, &len, &received);
8427 ok(hr == (expected ? S_OK : S_FALSE),
8428 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8429 hr, (expected ? S_OK : S_FALSE), test_index);
8433 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8434 expected, wine_dbgstr_w(received), test_index);
8437 ok(lstrlen(expected) == len,
8438 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8439 lstrlen(expected), len, test_index);
8443 ok(hr == (expected ? S_OK : S_FALSE),
8444 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8445 hr, (expected ? S_OK : S_FALSE), test_index);
8446 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8447 expected, wine_dbgstr_w(received), test_index);
8448 ok(lstrlen(expected) == len,
8449 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8450 lstrlen(expected), len, test_index);
8453 /* The property wasn't set earlier, so it should return whatever
8454 * the base IUri contains (if anything).
8457 hr = IUriBuilder_GetIUri(builder, &uri);
8459 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8460 hr, S_OK, test_index);
8463 received = (void*) 0xdeadbeef;
8466 hr = IUriBuilder_GetUserName(builder, &len, &received);
8468 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8469 hr, S_FALSE, test_index);
8471 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8473 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8474 received, test_index);
8477 BSTR expected = NULL;
8478 BOOL has_prop = FALSE;
8480 hr = IUri_GetUserName(uri, &expected);
8482 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8484 has_prop = hr == S_OK;
8486 hr = IUriBuilder_GetUserName(builder, &len, &received);
8489 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8490 hr, S_OK, test_index);
8492 ok(!lstrcmpW(expected, received),
8493 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8494 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8495 ok(lstrlenW(expected) == len,
8496 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8497 lstrlenW(expected), len, test_index);
8501 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8502 hr, S_FALSE, test_index);
8504 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8505 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8509 SysFreeString(expected);
8512 if(uri) IUri_Release(uri);
8516 /* Tests IUriBuilder functions. */
8517 static void test_IUriBuilder(void) {
8519 IUriBuilder *builder;
8522 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
8524 uri_builder_test test = uri_builder_tests[i];
8528 uriW = a2w(test.uri);
8529 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8530 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8532 if(FAILED(hr)) continue;
8534 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8535 if(test.create_builder_todo) {
8537 ok(hr == test.create_builder_expected,
8538 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8539 hr, test.create_builder_expected, i);
8542 ok(hr == test.create_builder_expected,
8543 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8544 hr, test.create_builder_expected, i);
8548 BOOL modified = FALSE, received = FALSE;
8550 /* Perform all the string property changes. */
8551 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
8552 uri_builder_property prop = test.properties[j];
8554 change_property(builder, &prop, i);
8555 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
8556 prop.property != Uri_PROPERTY_HOST)
8558 else if(prop.value && *prop.value)
8560 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
8561 /* Host name property can't be NULL, but it can be empty. */
8566 if(test.port_prop.change) {
8567 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
8569 if(test.port_prop.todo) {
8571 ok(hr == test.port_prop.expected,
8572 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8573 hr, test.port_prop.expected, i);
8576 ok(hr == test.port_prop.expected,
8577 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8578 hr, test.port_prop.expected, i);
8582 hr = IUriBuilder_HasBeenModified(builder, &received);
8584 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8587 ok(received == modified,
8588 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
8589 modified, received, i);
8591 /* Test the "Get*" functions. */
8592 test_IUriBuilder_GetFragment(builder, &test, i);
8593 test_IUriBuilder_GetHost(builder, &test, i);
8594 test_IUriBuilder_GetPassword(builder, &test, i);
8595 test_IUriBuilder_GetPath(builder, &test, i);
8596 test_IUriBuilder_GetPort(builder, &test, i);
8597 test_IUriBuilder_GetQuery(builder, &test, i);
8598 test_IUriBuilder_GetSchemeName(builder, &test, i);
8599 test_IUriBuilder_GetUserName(builder, &test, i);
8601 test_IUriBuilder_CreateUri(builder, &test, i);
8602 test_IUriBuilder_CreateUriSimple(builder, &test, i);
8603 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
8605 if(builder) IUriBuilder_Release(builder);
8606 if(uri) IUri_Release(uri);
8611 static void test_IUriBuilder_HasBeenModified(void) {
8613 IUriBuilder *builder = NULL;
8615 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8616 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8618 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
8622 hr = IUriBuilder_HasBeenModified(builder, NULL);
8623 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8626 hr = IUriBuilder_SetHost(builder, hostW);
8627 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
8630 hr = IUriBuilder_HasBeenModified(builder, &received);
8631 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8634 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8636 hr = pCreateUri(http_urlW, 0, 0, &uri);
8637 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8642 hr = IUriBuilder_SetIUri(builder, uri);
8643 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
8646 hr = IUriBuilder_HasBeenModified(builder, &received);
8647 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8650 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
8652 /* Test what happens with you call SetIUri with the same IUri again. */
8653 hr = IUriBuilder_SetHost(builder, hostW);
8654 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8656 hr = IUriBuilder_HasBeenModified(builder, &received);
8657 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8660 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8662 hr = IUriBuilder_SetIUri(builder, uri);
8663 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8665 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
8666 * reset any of the changes that were made to the IUriBuilder.
8668 hr = IUriBuilder_HasBeenModified(builder, &received);
8669 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8671 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8673 hr = IUriBuilder_GetHost(builder, &len, &prop);
8674 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8676 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
8677 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
8678 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
8679 lstrlenW(hostW), len);
8682 hr = IUriBuilder_SetIUri(builder, NULL);
8683 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8685 hr = IUriBuilder_SetHost(builder, hostW);
8686 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8687 hr = IUriBuilder_HasBeenModified(builder, &received);
8688 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8691 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8693 hr = IUriBuilder_SetIUri(builder, NULL);
8694 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
8696 hr = IUriBuilder_HasBeenModified(builder, &received);
8697 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
8700 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
8702 hr = IUriBuilder_GetHost(builder, &len, &prop);
8703 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8705 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
8706 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
8707 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
8708 lstrlenW(hostW), len);
8711 if(uri) IUri_Release(uri);
8713 if(builder) IUriBuilder_Release(builder);
8716 /* Test IUriBuilder {Get,Set}IUri functions. */
8717 static void test_IUriBuilder_IUriProperty(void) {
8718 IUriBuilder *builder = NULL;
8721 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8722 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8726 hr = IUriBuilder_GetIUri(builder, NULL);
8727 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
8730 hr = pCreateUri(http_urlW, 0, 0, &uri);
8733 ULONG cur_count, orig_count;
8735 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
8736 orig_count = get_refcnt(uri);
8737 hr = IUriBuilder_SetIUri(builder, uri);
8738 cur_count = get_refcnt(uri);
8740 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8741 orig_count+1, cur_count);
8743 hr = IUriBuilder_SetIUri(builder, NULL);
8744 cur_count = get_refcnt(uri);
8746 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8747 orig_count, cur_count);
8749 /* CreateUri* functions will return back the same IUri if nothing has changed. */
8750 hr = IUriBuilder_SetIUri(builder, uri);
8751 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8752 orig_count = get_refcnt(uri);
8754 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
8755 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8757 cur_count = get_refcnt(uri);
8758 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8759 orig_count+1, cur_count);
8760 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
8763 if(test) IUri_Release(test);
8766 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
8767 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8769 cur_count = get_refcnt(uri);
8770 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8771 orig_count+1, cur_count);
8772 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
8774 if(test) IUri_Release(test);
8776 /* Doesn't return the same IUri, if the flag combination is different then the one that created
8780 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
8781 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8783 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
8785 if(test) IUri_Release(test);
8787 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
8788 * explicitly set (because it's a default flags).
8791 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
8792 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8794 cur_count = get_refcnt(uri);
8795 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8796 orig_count+1, cur_count);
8797 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
8799 if(test) IUri_Release(test);
8802 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
8803 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8805 cur_count = get_refcnt(uri);
8806 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8807 orig_count+1, cur_count);
8808 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
8810 if(test) IUri_Release(test);
8813 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
8814 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8817 cur_count = get_refcnt(uri);
8818 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8819 orig_count+1, cur_count);
8820 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
8822 if(test) IUri_Release(test);
8824 /* Doesn't return the same IUri, if the flag combination is different then the one that created
8828 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
8829 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8831 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
8833 if(test) IUri_Release(test);
8835 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
8836 * explicitly set (because it's a default flags).
8839 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
8840 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8842 cur_count = get_refcnt(uri);
8843 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
8844 orig_count+1, cur_count);
8845 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
8847 if(test) IUri_Release(test);
8849 if(uri) IUri_Release(uri);
8851 if(builder) IUriBuilder_Release(builder);
8854 static void test_IUriBuilder_RemoveProperties(void) {
8855 IUriBuilder *builder = NULL;
8859 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8860 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8862 /* Properties that can't be removed. */
8863 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
8864 Uri_HAS_SCHEME|Uri_HAS_ZONE;
8866 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
8867 hr = IUriBuilder_RemoveProperties(builder, i << 1);
8868 if((i << 1) & invalid) {
8869 ok(hr == E_INVALIDARG,
8870 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
8871 hr, E_INVALIDARG, i);
8874 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
8879 /* Also doesn't accept anything that's outside the range of the
8882 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
8883 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
8886 if(builder) IUriBuilder_Release(builder);
8888 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
8889 uri_builder_remove_test test = uri_builder_remove_tests[i];
8893 uriW = a2w(test.uri);
8894 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8898 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8899 if(test.create_builder_todo) {
8901 ok(hr == test.create_builder_expected,
8902 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
8903 hr, test.create_builder_expected, i);
8906 ok(hr == test.create_builder_expected,
8907 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
8908 hr, test.create_builder_expected, i);
8911 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
8912 if(test.remove_todo) {
8914 ok(hr == test.remove_expected,
8915 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
8916 hr, test.remove_expected, i);
8919 ok(hr == test.remove_expected,
8920 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
8921 hr, test.remove_expected, i);
8924 IUri *result = NULL;
8926 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
8927 if(test.expected_todo) {
8929 ok(hr == test.expected_hres,
8930 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
8931 hr, test.expected_hres, i);
8934 ok(hr == test.expected_hres,
8935 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
8936 hr, test.expected_hres, i);
8939 BSTR received = NULL;
8941 hr = IUri_GetAbsoluteUri(result, &received);
8942 ok(!strcmp_aw(test.expected_uri, received),
8943 "Error: Expected %s but got %s instead on test %d.\n",
8944 test.expected_uri, wine_dbgstr_w(received), i);
8945 SysFreeString(received);
8947 if(result) IUri_Release(result);
8950 if(builder) IUriBuilder_Release(builder);
8952 if(uri) IUri_Release(uri);
8957 static void test_IUriBuilder_Misc(void) {
8961 hr = pCreateUri(http_urlW, 0, 0, &uri);
8963 IUriBuilder *builder;
8965 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8966 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8971 hr = IUriBuilder_GetPort(builder, &has, &port);
8972 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8974 /* 'has' will be set to FALSE, even though uri had a port. */
8975 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
8976 /* Still sets 'port' to 80. */
8977 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
8980 if(builder) IUriBuilder_Release(builder);
8982 if(uri) IUri_Release(uri);
8985 static void test_CoInternetCombineIUri(void) {
8987 IUri *base, *relative, *result;
8991 hr = pCreateUri(http_urlW, 0, 0, &base);
8992 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
8994 result = (void*) 0xdeadbeef;
8995 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
8996 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8997 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9001 hr = pCreateUri(http_urlW, 0, 0, &relative);
9002 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9004 result = (void*) 0xdeadbeef;
9005 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9006 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9007 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9010 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9011 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9013 if(base) IUri_Release(base);
9014 if(relative) IUri_Release(relative);
9016 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9017 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9019 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9020 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9022 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9024 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9025 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9029 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9030 if(uri_combine_tests[i].todo) {
9032 ok(hr == uri_combine_tests[i].expected,
9033 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9034 hr, uri_combine_tests[i].expected, i);
9037 ok(hr == uri_combine_tests[i].expected,
9038 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9039 hr, uri_combine_tests[i]. expected, i);
9044 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9045 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9048 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9051 ok(hr == prop.expected,
9052 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9053 hr, prop.expected, i, j);
9056 ok(!strcmp_aw(prop.value, received) ||
9057 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9058 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9059 prop.value, wine_dbgstr_w(received), i, j);
9062 ok(hr == prop.expected,
9063 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9064 hr, prop.expected, i, j);
9065 ok(!strcmp_aw(prop.value, received) ||
9066 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9067 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9068 prop.value, wine_dbgstr_w(received), i, j);
9070 SysFreeString(received);
9073 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9074 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9077 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9080 ok(hr == prop.expected,
9081 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9082 hr, prop.expected, i, j);
9085 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9086 prop.value, received, i, j);
9089 ok(hr == prop.expected,
9090 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9091 hr, prop.expected, i, j);
9092 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9093 prop.value, received, i, j);
9097 if(result) IUri_Release(result);
9099 if(relative) IUri_Release(relative);
9100 heap_free(relativeW);
9102 if(base) IUri_Release(base);
9107 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9108 REFIID riid, void **ppv)
9110 ok(0, "unexpected call\n");
9111 return E_NOINTERFACE;
9114 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9119 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9124 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9125 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9126 DWORD *pcchResult, DWORD dwReserved)
9128 ok(0, "unexpected call %d\n", ParseAction);
9132 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9133 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9134 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9136 CHECK_EXPECT(CombineUrl);
9137 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9138 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9139 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9140 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9141 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9142 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9143 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Expected %d, but got %d.\n", INTERNET_MAX_URL_LENGTH+1, cchResult);
9145 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9146 *pcchResult = lstrlenW(combine_resultW);
9151 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9152 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9154 ok(0, "unexpected call\n");
9158 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9159 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9160 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9162 ok(0, "unexpected call\n");
9166 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9167 InternetProtocolInfo_QueryInterface,
9168 InternetProtocolInfo_AddRef,
9169 InternetProtocolInfo_Release,
9170 InternetProtocolInfo_ParseUrl,
9171 InternetProtocolInfo_CombineUrl,
9172 InternetProtocolInfo_CompareUrl,
9173 InternetProtocolInfo_QueryInfo
9176 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9178 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9180 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9181 *ppv = &protocol_info;
9185 ok(0, "unexpected call\n");
9186 return E_NOINTERFACE;
9189 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9194 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9199 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9200 REFIID riid, void **ppv)
9202 ok(0, "unexpected call\n");
9206 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9208 ok(0, "unexpected call\n");
9212 static const IClassFactoryVtbl ClassFactoryVtbl = {
9213 ClassFactory_QueryInterface,
9214 ClassFactory_AddRef,
9215 ClassFactory_Release,
9216 ClassFactory_CreateInstance,
9217 ClassFactory_LockServer
9220 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9222 static void register_protocols(void)
9224 IInternetSession *session;
9227 hres = pCoInternetGetSession(0, &session, 0);
9228 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
9232 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
9233 winetestW, 0, NULL, 0);
9234 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
9236 IInternetSession_Release(session);
9239 static void unregister_protocols(void) {
9240 IInternetSession *session;
9243 hr = pCoInternetGetSession(0, &session, 0);
9244 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
9248 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
9249 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
9251 IInternetSession_Release(session);
9254 static void test_CoInternetCombineIUri_Pluggable(void) {
9258 register_protocols();
9260 hr = pCreateUri(combine_baseW, 0, 0, &base);
9261 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9263 IUri *relative = NULL;
9265 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
9266 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9268 IUri *result = NULL;
9270 SET_EXPECT(CombineUrl);
9272 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9274 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9276 CHECK_CALLED(CombineUrl);
9279 BSTR received = NULL;
9280 hr = IUri_GetAbsoluteUri(result, &received);
9281 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9283 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9284 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9286 SysFreeString(received);
9288 if(result) IUri_Release(result);
9290 if(relative) IUri_Release(relative);
9292 if(base) IUri_Release(base);
9294 unregister_protocols();
9297 static void test_CoInternetCombineUrlEx(void) {
9299 IUri *base, *result;
9303 hr = pCreateUri(http_urlW, 0, 0, &base);
9304 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9306 result = (void*) 0xdeadbeef;
9307 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
9308 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9310 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
9313 result = (void*) 0xdeadbeef;
9314 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
9315 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9317 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9319 result = (void*) 0xdeadbeef;
9320 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
9321 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9323 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9325 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
9326 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9328 if(base) IUri_Release(base);
9330 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9331 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9333 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9334 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
9336 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9338 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
9340 if(uri_combine_tests[i].todo) {
9342 ok(hr == uri_combine_tests[i].expected,
9343 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9344 hr, uri_combine_tests[i].expected, i);
9347 ok(hr == uri_combine_tests[i].expected,
9348 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9349 hr, uri_combine_tests[i]. expected, i);
9354 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9355 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9357 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
9359 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9362 ok(hr == prop.expected,
9363 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9364 hr, prop.expected, i, j);
9367 ok(!strcmp_aw(value, received) ||
9368 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9369 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9370 value, wine_dbgstr_w(received), i, j);
9373 ok(hr == prop.expected,
9374 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9375 hr, prop.expected, i, j);
9376 ok(!strcmp_aw(value, received) ||
9377 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9378 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9379 value, wine_dbgstr_w(received), i, j);
9381 SysFreeString(received);
9384 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9385 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9388 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9391 ok(hr == prop.expected,
9392 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9393 hr, prop.expected, i, j);
9396 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9397 prop.value, received, i, j);
9400 ok(hr == prop.expected,
9401 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9402 hr, prop.expected, i, j);
9403 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9404 prop.value, received, i, j);
9408 if(result) IUri_Release(result);
9409 heap_free(relativeW);
9411 if(base) IUri_Release(base);
9419 hurlmon = GetModuleHandle("urlmon.dll");
9420 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
9421 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
9422 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
9423 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
9424 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
9425 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
9428 win_skip("CreateUri is not present, skipping tests.\n");
9432 trace("test CreateUri invalid flags...\n");
9433 test_CreateUri_InvalidFlags();
9435 trace("test CreateUri invalid args...\n");
9436 test_CreateUri_InvalidArgs();
9438 trace("test CreateUri invalid URIs...\n");
9439 test_CreateUri_InvalidUri();
9441 trace("test IUri_GetPropertyBSTR...\n");
9442 test_IUri_GetPropertyBSTR();
9444 trace("test IUri_GetPropertyDWORD...\n");
9445 test_IUri_GetPropertyDWORD();
9447 trace("test IUri_GetStrProperties...\n");
9448 test_IUri_GetStrProperties();
9450 trace("test IUri_GetDwordProperties...\n");
9451 test_IUri_GetDwordProperties();
9453 trace("test IUri_GetPropertyLength...\n");
9454 test_IUri_GetPropertyLength();
9456 trace("test IUri_GetProperties...\n");
9457 test_IUri_GetProperties();
9459 trace("test IUri_HasProperty...\n");
9460 test_IUri_HasProperty();
9462 trace("test IUri_IsEqual...\n");
9463 test_IUri_IsEqual();
9465 trace("test CreateUriWithFragment invalid args...\n");
9466 test_CreateUriWithFragment_InvalidArgs();
9468 trace("test CreateUriWithFragment invalid flags...\n");
9469 test_CreateUriWithFragment_InvalidFlags();
9471 trace("test CreateUriWithFragment...\n");
9472 test_CreateUriWithFragment();
9474 trace("test CreateIUriBuilder...\n");
9475 test_CreateIUriBuilder();
9477 trace("test IUriBuilder_CreateInvalidArgs...\n");
9478 test_IUriBuilder_CreateInvalidArgs();
9480 trace("test IUriBuilder...\n");
9483 trace("test IUriBuilder_GetInvalidArgs...\n");
9484 test_IUriBuilder_GetInvalidArgs();
9486 trace("test IUriBuilder_HasBeenModified...\n");
9487 test_IUriBuilder_HasBeenModified();
9489 trace("test IUriBuilder_IUriProperty...\n");
9490 test_IUriBuilder_IUriProperty();
9492 trace("test IUriBuilder_RemoveProperties...\n");
9493 test_IUriBuilder_RemoveProperties();
9495 trace("test IUriBuilder miscellaneous...\n");
9496 test_IUriBuilder_Misc();
9498 trace("test CoInternetCombineIUri...\n");
9499 test_CoInternetCombineIUri();
9501 trace("test CoInternetCombineUrlEx...\n");
9502 test_CoInternetCombineUrlEx();
9504 trace("test CoInternetCombineIUri pluggable...\n");
9505 test_CoInternetCombineIUri_Pluggable();