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>
27 #define WIN32_LEAN_AND_MEAN
36 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
37 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
38 #define URI_BUILDER_STR_PROPERTY_COUNT 7
40 #define DEFINE_EXPECT(func) \
41 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
43 #define SET_EXPECT(func) \
44 expect_ ## func = TRUE
46 #define CHECK_EXPECT(func) \
48 ok(expect_ ##func, "unexpected call " #func "\n"); \
49 expect_ ## func = FALSE; \
50 called_ ## func = TRUE; \
53 #define CHECK_EXPECT2(func) \
55 ok(expect_ ##func, "unexpected call " #func "\n"); \
56 called_ ## func = TRUE; \
59 #define CHECK_CALLED(func) \
61 ok(called_ ## func, "expected " #func "\n"); \
62 expect_ ## func = called_ ## func = FALSE; \
65 DEFINE_EXPECT(CombineUrl
);
66 DEFINE_EXPECT(ParseUrl
);
68 static HRESULT (WINAPI
*pCreateUri
)(LPCWSTR
, DWORD
, DWORD_PTR
, IUri
**);
69 static HRESULT (WINAPI
*pCreateUriWithFragment
)(LPCWSTR
, LPCWSTR
, DWORD
, DWORD_PTR
, IUri
**);
70 static HRESULT (WINAPI
*pCreateIUriBuilder
)(IUri
*, DWORD
, DWORD_PTR
, IUriBuilder
**);
71 static HRESULT (WINAPI
*pCoInternetCombineIUri
)(IUri
*,IUri
*,DWORD
,IUri
**,DWORD_PTR
);
72 static HRESULT (WINAPI
*pCoInternetGetSession
)(DWORD
,IInternetSession
**,DWORD
);
73 static HRESULT (WINAPI
*pCoInternetCombineUrlEx
)(IUri
*,LPCWSTR
,DWORD
,IUri
**,DWORD_PTR
);
74 static HRESULT (WINAPI
*pCoInternetParseIUri
)(IUri
*,PARSEACTION
,DWORD
,LPWSTR
,DWORD
,DWORD
*,DWORD_PTR
);
75 static HRESULT (WINAPI
*pCreateURLMonikerEx
)(IMoniker
*,LPCWSTR
,IMoniker
**,DWORD
);
76 static HRESULT (WINAPI
*pCreateURLMonikerEx2
)(IMoniker
*,IUri
*,IMoniker
**,DWORD
);
78 static const WCHAR http_urlW
[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
79 '.','o','r','g','/',0};
80 static const WCHAR http_url_fragW
[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
81 '.','o','r','g','/','#','F','r','a','g',0};
83 static const WCHAR combine_baseW
[] = {'w','i','n','e','t','e','s','t',':','?','t',
84 'e','s','t','i','n','g',0};
85 static const WCHAR combine_relativeW
[] = {'?','t','e','s','t',0};
86 static const WCHAR combine_resultW
[] = {'z','i','p',':','t','e','s','t',0};
88 static const WCHAR winetestW
[] = {'w','i','n','e','t','e','s','t',0};
90 static const WCHAR parse_urlW
[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
91 static const WCHAR parse_resultW
[] = {'z','i','p',':','t','e','s','t',0};
93 static PARSEACTION parse_action
;
94 static DWORD parse_flags
;
96 typedef struct _uri_create_flag_test
{
99 } uri_create_flag_test
;
101 static const uri_create_flag_test invalid_flag_tests
[] = {
102 /* Set of invalid flag combinations to test for. */
103 {Uri_CREATE_DECODE_EXTRA_INFO
| Uri_CREATE_NO_DECODE_EXTRA_INFO
, E_INVALIDARG
},
104 {Uri_CREATE_CANONICALIZE
| Uri_CREATE_NO_CANONICALIZE
, E_INVALIDARG
},
105 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES
| Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, E_INVALIDARG
},
106 {Uri_CREATE_PRE_PROCESS_HTML_URI
| Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, E_INVALIDARG
},
107 {Uri_CREATE_IE_SETTINGS
| Uri_CREATE_NO_IE_SETTINGS
, E_INVALIDARG
}
110 typedef struct _uri_str_property
{
114 const char* broken_value
;
117 typedef struct _uri_dword_property
{
121 } uri_dword_property
;
123 typedef struct _uri_properties
{
126 HRESULT create_expected
;
129 uri_str_property str_props
[URI_STR_PROPERTY_COUNT
];
130 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
133 static const uri_properties uri_tests
[] = {
134 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK
, FALSE
,
136 {"http://www.winehq.org/",S_OK
,FALSE
}, /* ABSOLUTE_URI */
137 {"www.winehq.org",S_OK
,FALSE
}, /* AUTHORITY */
138 {"http://www.winehq.org/",S_OK
,FALSE
}, /* DISPLAY_URI */
139 {"winehq.org",S_OK
,FALSE
}, /* DOMAIN */
140 {"",S_FALSE
,FALSE
}, /* EXTENSION */
141 {"",S_FALSE
,FALSE
}, /* FRAGMENT */
142 {"www.winehq.org",S_OK
,FALSE
}, /* HOST */
143 {"",S_FALSE
,FALSE
}, /* PASSWORD */
144 {"/",S_OK
,FALSE
}, /* PATH */
145 {"/",S_OK
,FALSE
}, /* PATH_AND_QUERY */
146 {"",S_FALSE
,FALSE
}, /* QUERY */
147 {"http://www.winehq.org/tests/../tests/../..",S_OK
,FALSE
}, /* RAW_URI */
148 {"http",S_OK
,FALSE
}, /* SCHEME_NAME */
149 {"",S_FALSE
,FALSE
}, /* USER_INFO */
150 {"",S_FALSE
,FALSE
} /* USER_NAME */
153 {Uri_HOST_DNS
,S_OK
,FALSE
}, /* HOST_TYPE */
154 {80,S_OK
,FALSE
}, /* PORT */
155 {URL_SCHEME_HTTP
,S_OK
,FALSE
}, /* SCHEME */
156 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
} /* ZONE */
159 { "http://winehq.org/tests/.././tests", 0, S_OK
, FALSE
,
161 {"http://winehq.org/tests",S_OK
,FALSE
},
162 {"winehq.org",S_OK
,FALSE
},
163 {"http://winehq.org/tests",S_OK
,FALSE
},
164 {"winehq.org",S_OK
,FALSE
},
167 {"winehq.org",S_OK
,FALSE
},
169 {"/tests",S_OK
,FALSE
},
170 {"/tests",S_OK
,FALSE
},
172 {"http://winehq.org/tests/.././tests",S_OK
,FALSE
},
178 {Uri_HOST_DNS
,S_OK
,FALSE
},
180 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
181 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
184 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
186 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
187 {"www.winehq.org",S_OK
,FALSE
},
188 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
189 {"winehq.org",S_OK
,FALSE
},
192 {"www.winehq.org",S_OK
,FALSE
},
195 {"/?query=x&return=y",S_OK
,FALSE
},
196 {"?query=x&return=y",S_OK
,FALSE
},
197 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
203 {Uri_HOST_DNS
,S_OK
,FALSE
},
205 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
206 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
209 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
211 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
212 {"www.winehq.org",S_OK
,FALSE
},
213 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
214 {"winehq.org",S_OK
,FALSE
},
217 {"www.winehq.org",S_OK
,FALSE
},
220 {"/?query=x&return=y",S_OK
,FALSE
},
221 {"?query=x&return=y",S_OK
,FALSE
},
222 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
223 {"https",S_OK
,FALSE
},
228 {Uri_HOST_DNS
,S_OK
,FALSE
},
230 {URL_SCHEME_HTTPS
,S_OK
,FALSE
},
231 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
234 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK
, FALSE
,
236 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
237 {"usEr%3Ainfo@example.com",S_OK
,FALSE
},
238 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
239 {"example.com",S_OK
,FALSE
},
242 {"example.com",S_OK
,FALSE
},
244 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
245 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
247 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK
,FALSE
},
249 {"usEr%3Ainfo",S_OK
,FALSE
},
250 {"usEr%3Ainfo",S_OK
,FALSE
}
253 {Uri_HOST_DNS
,S_OK
,FALSE
},
255 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
256 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
259 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK
, FALSE
,
261 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
262 {"winepass:wine@ftp.winehq.org:9999",S_OK
,FALSE
},
263 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
264 {"winehq.org",S_OK
,FALSE
},
267 {"ftp.winehq.org",S_OK
,FALSE
},
269 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
270 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
272 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK
,FALSE
},
274 {"winepass:wine",S_OK
,FALSE
},
275 {"winepass",S_OK
,FALSE
}
278 {Uri_HOST_DNS
,S_OK
,FALSE
},
280 {URL_SCHEME_FTP
,S_OK
,FALSE
},
281 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
284 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK
, FALSE
,
286 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
288 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
294 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
295 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
297 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
303 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
305 {URL_SCHEME_FILE
,S_OK
,FALSE
},
306 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
309 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
311 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
313 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
319 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
320 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
322 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
328 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
330 {URL_SCHEME_FILE
,S_OK
,FALSE
},
331 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
334 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK
, FALSE
,
336 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
338 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
344 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
345 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
347 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK
,FALSE
},
353 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
355 {URL_SCHEME_FILE
,S_OK
,FALSE
},
356 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
359 { "urn:nothing:should:happen here", 0, S_OK
, FALSE
,
361 {"urn:nothing:should:happen here",S_OK
,FALSE
},
363 {"urn:nothing:should:happen here",S_OK
,FALSE
},
369 {"nothing:should:happen here",S_OK
,FALSE
},
370 {"nothing:should:happen here",S_OK
,FALSE
},
372 {"urn:nothing:should:happen here",S_OK
,FALSE
},
378 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
380 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
381 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
384 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK
, FALSE
,
386 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
387 {"127.0.0.1",S_OK
,FALSE
},
388 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
392 {"127.0.0.1",S_OK
,FALSE
},
394 {"/test%20dir/test.txt",S_OK
,FALSE
},
395 {"/test%20dir/test.txt",S_OK
,FALSE
},
397 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK
,FALSE
},
403 {Uri_HOST_IPV4
,S_OK
,FALSE
},
405 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
406 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
409 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK
, FALSE
,
411 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
412 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK
,FALSE
},
413 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
417 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK
,FALSE
},
422 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK
,FALSE
},
428 {Uri_HOST_IPV6
,S_OK
,FALSE
},
430 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
431 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
434 { "ftp://[::13.1.68.3]", 0, S_OK
, FALSE
,
436 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
437 {"[::13.1.68.3]",S_OK
,FALSE
},
438 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
442 {"::13.1.68.3",S_OK
,FALSE
},
447 {"ftp://[::13.1.68.3]",S_OK
,FALSE
},
453 {Uri_HOST_IPV6
,S_OK
,FALSE
},
455 {URL_SCHEME_FTP
,S_OK
,FALSE
},
456 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
459 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK
, FALSE
,
461 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
462 {"[fedc:ba98::3210]",S_OK
,FALSE
},
463 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
467 {"fedc:ba98::3210",S_OK
,FALSE
},
472 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK
,FALSE
},
478 {Uri_HOST_IPV6
,S_OK
,FALSE
},
480 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
481 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
484 { "1234://www.winehq.org", 0, S_OK
, FALSE
,
486 {"1234://www.winehq.org/",S_OK
,FALSE
},
487 {"www.winehq.org",S_OK
,FALSE
},
488 {"1234://www.winehq.org/",S_OK
,FALSE
},
489 {"winehq.org",S_OK
,FALSE
},
492 {"www.winehq.org",S_OK
,FALSE
},
497 {"1234://www.winehq.org",S_OK
,FALSE
},
503 {Uri_HOST_DNS
,S_OK
,FALSE
},
505 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
506 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
509 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
510 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
512 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
514 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
520 {"/C:/test/test.mp3",S_OK
,FALSE
},
521 {"/C:/test/test.mp3",S_OK
,FALSE
},
523 {"C:/test/test.mp3",S_OK
,FALSE
},
529 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
531 {URL_SCHEME_FILE
,S_OK
,FALSE
},
532 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
535 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
536 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
538 {"file://server/test.mp3",S_OK
,FALSE
},
539 {"server",S_OK
,FALSE
},
540 {"file://server/test.mp3",S_OK
,FALSE
},
544 {"server",S_OK
,FALSE
},
546 {"/test.mp3",S_OK
,FALSE
},
547 {"/test.mp3",S_OK
,FALSE
},
549 {"\\\\Server/test.mp3",S_OK
,FALSE
},
555 {Uri_HOST_DNS
,S_OK
,FALSE
},
557 {URL_SCHEME_FILE
,S_OK
,FALSE
},
558 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
561 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
563 {"*:www.winehq.org/test",S_OK
,FALSE
},
564 {"www.winehq.org",S_OK
,FALSE
},
565 {"*:www.winehq.org/test",S_OK
,FALSE
},
566 {"winehq.org",S_OK
,FALSE
},
569 {"www.winehq.org",S_OK
,FALSE
},
571 {"/test",S_OK
,FALSE
},
572 {"/test",S_OK
,FALSE
},
574 {"www.winehq.org/test",S_OK
,FALSE
},
580 {Uri_HOST_DNS
,S_OK
,FALSE
},
582 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
583 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
586 /* Valid since the '*' is the only character in the scheme name. */
587 { "*:www.winehq.org/test", 0, S_OK
, FALSE
,
589 {"*:www.winehq.org/test",S_OK
,FALSE
},
590 {"www.winehq.org",S_OK
,FALSE
},
591 {"*:www.winehq.org/test",S_OK
,FALSE
},
592 {"winehq.org",S_OK
,FALSE
},
595 {"www.winehq.org",S_OK
,FALSE
},
597 {"/test",S_OK
,FALSE
},
598 {"/test",S_OK
,FALSE
},
600 {"*:www.winehq.org/test",S_OK
,FALSE
},
606 {Uri_HOST_DNS
,S_OK
,FALSE
},
608 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
609 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
612 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
614 {"/../some dir/test.ext",S_OK
,FALSE
},
616 {"/../some dir/test.ext",S_OK
,FALSE
},
622 {"/../some dir/test.ext",S_OK
,FALSE
},
623 {"/../some dir/test.ext",S_OK
,FALSE
},
625 {"/../some dir/test.ext",S_OK
,FALSE
},
631 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
633 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
634 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
637 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE
|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
639 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
641 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
647 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
648 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
650 {"//implicit/wildcard/uri scheme",S_OK
,FALSE
},
656 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
658 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
659 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
662 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
663 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, S_OK
, FALSE
,
665 {"zip:/.//google.com",S_OK
,FALSE
},
667 {"zip:/.//google.com",S_OK
,FALSE
},
673 {"/.//google.com",S_OK
,FALSE
},
674 {"/.//google.com",S_OK
,FALSE
},
676 {"zip://google.com",S_OK
,FALSE
},
682 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
684 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
685 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
688 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
689 { "ftp://user:pass:word@winehq.org/", 0, S_OK
, FALSE
,
691 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
692 {"user:pass:word@winehq.org",S_OK
,FALSE
},
693 {"ftp://winehq.org/",S_OK
,FALSE
},
694 {"winehq.org",S_OK
,FALSE
},
697 {"winehq.org",S_OK
,FALSE
},
698 {"pass:word",S_OK
,FALSE
},
702 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
704 {"user:pass:word",S_OK
,FALSE
},
708 {Uri_HOST_DNS
,S_OK
,FALSE
},
710 {URL_SCHEME_FTP
,S_OK
,FALSE
},
711 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
714 /* Make sure % encoded unreserved characters are decoded. */
715 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK
, FALSE
,
717 {"ftp://wINe:PASS@ftp.google.com/",S_OK
,FALSE
},
718 {"wINe:PASS@ftp.google.com",S_OK
,FALSE
},
719 {"ftp://ftp.google.com/",S_OK
,FALSE
},
720 {"google.com",S_OK
,FALSE
},
723 {"ftp.google.com",S_OK
,FALSE
},
728 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK
,FALSE
},
730 {"wINe:PASS",S_OK
,FALSE
},
734 {Uri_HOST_DNS
,S_OK
,FALSE
},
736 {URL_SCHEME_FTP
,S_OK
,FALSE
},
737 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
740 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
741 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK
, FALSE
,
743 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
744 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK
,FALSE
},
745 {"ftp://ftp.google.com/",S_OK
,FALSE
},
746 {"google.com",S_OK
,FALSE
},
749 {"ftp.google.com",S_OK
,FALSE
},
750 {"PA%7B%7D",S_OK
,FALSE
},
754 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
756 {"w%5D%5Be:PA%7B%7D",S_OK
,FALSE
},
757 {"w%5D%5Be",S_OK
,FALSE
}
760 {Uri_HOST_DNS
,S_OK
,FALSE
},
762 {URL_SCHEME_FTP
,S_OK
,FALSE
},
763 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
766 /* You're allowed to have an empty password portion in the userinfo section. */
767 { "ftp://empty:@ftp.google.com/", 0, S_OK
, FALSE
,
769 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
770 {"empty:@ftp.google.com",S_OK
,FALSE
},
771 {"ftp://ftp.google.com/",S_OK
,FALSE
},
772 {"google.com",S_OK
,FALSE
},
775 {"ftp.google.com",S_OK
,FALSE
},
780 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
782 {"empty:",S_OK
,FALSE
},
786 {Uri_HOST_DNS
,S_OK
,FALSE
},
788 {URL_SCHEME_FTP
,S_OK
,FALSE
},
789 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
792 /* Make sure forbidden characters in "userinfo" get encoded. */
793 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK
, FALSE
,
795 {"ftp://%22%20%22weird@ftp.google.com/",S_OK
,FALSE
},
796 {"%22%20%22weird@ftp.google.com",S_OK
,FALSE
},
797 {"ftp://ftp.google.com/",S_OK
,FALSE
},
798 {"google.com",S_OK
,FALSE
},
801 {"ftp.google.com",S_OK
,FALSE
},
806 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
808 {"%22%20%22weird",S_OK
,FALSE
},
809 {"%22%20%22weird",S_OK
,FALSE
}
812 {Uri_HOST_DNS
,S_OK
,FALSE
},
814 {URL_SCHEME_FTP
,S_OK
,FALSE
},
815 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
818 /* Make sure the forbidden characters don't get percent encoded. */
819 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
821 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
822 {"\" \"weird@ftp.google.com",S_OK
,FALSE
},
823 {"ftp://ftp.google.com/",S_OK
,FALSE
},
824 {"google.com",S_OK
,FALSE
},
827 {"ftp.google.com",S_OK
,FALSE
},
832 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
834 {"\" \"weird",S_OK
,FALSE
},
835 {"\" \"weird",S_OK
,FALSE
}
838 {Uri_HOST_DNS
,S_OK
,FALSE
},
840 {URL_SCHEME_FTP
,S_OK
,FALSE
},
841 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
844 /* Make sure already percent encoded characters don't get unencoded. */
845 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
847 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
848 {"\"%20\"weird@ftp.google.com",S_OK
,FALSE
},
849 {"ftp://ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
850 {"google.com",S_OK
,FALSE
},
853 {"ftp.google.com",S_OK
,FALSE
},
855 {"/\"%20\"weird",S_OK
,FALSE
},
856 {"/\"%20\"weird",S_OK
,FALSE
},
858 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
860 {"\"%20\"weird",S_OK
,FALSE
},
861 {"\"%20\"weird",S_OK
,FALSE
}
864 {Uri_HOST_DNS
,S_OK
,FALSE
},
866 {URL_SCHEME_FTP
,S_OK
,FALSE
},
867 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
870 /* Allowed to have invalid % encoded because its an unknown scheme type. */
871 { "zip://%xy:word@winehq.org/", 0, S_OK
, FALSE
,
873 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
874 {"%xy:word@winehq.org",S_OK
,FALSE
},
875 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
876 {"winehq.org",S_OK
,FALSE
},
879 {"winehq.org",S_OK
,FALSE
},
884 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
886 {"%xy:word",S_OK
,FALSE
},
890 {Uri_HOST_DNS
,S_OK
,FALSE
},
892 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
893 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
896 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
899 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK
, FALSE
,
901 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
902 {"%2E:%52%53ord@winehq.org",S_OK
,FALSE
},
903 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
904 {"winehq.org",S_OK
,FALSE
},
907 {"winehq.org",S_OK
,FALSE
},
908 {"%52%53ord",S_OK
,FALSE
},
912 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
914 {"%2E:%52%53ord",S_OK
,FALSE
},
918 {Uri_HOST_DNS
,S_OK
,FALSE
},
920 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
921 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
924 { "ftp://[](),'test':word@winehq.org/", 0, S_OK
, FALSE
,
926 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
927 {"[](),'test':word@winehq.org",S_OK
,FALSE
},
928 {"ftp://winehq.org/",S_OK
,FALSE
},
929 {"winehq.org",S_OK
,FALSE
},
932 {"winehq.org",S_OK
,FALSE
},
937 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
939 {"[](),'test':word",S_OK
,FALSE
},
940 {"[](),'test'",S_OK
,FALSE
}
943 {Uri_HOST_DNS
,S_OK
,FALSE
},
945 {URL_SCHEME_FTP
,S_OK
,FALSE
},
946 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
949 { "ftp://test?:word@winehq.org/", 0, S_OK
, FALSE
,
951 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
953 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
960 {"/?:word@winehq.org/",S_OK
,FALSE
},
961 {"?:word@winehq.org/",S_OK
,FALSE
},
962 {"ftp://test?:word@winehq.org/",S_OK
,FALSE
},
968 {Uri_HOST_DNS
,S_OK
,FALSE
},
970 {URL_SCHEME_FTP
,S_OK
,FALSE
},
971 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
974 { "ftp://test#:word@winehq.org/", 0, S_OK
, FALSE
,
976 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
978 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
981 {"#:word@winehq.org/",S_OK
,FALSE
},
987 {"ftp://test#:word@winehq.org/",S_OK
,FALSE
},
993 {Uri_HOST_DNS
,S_OK
,FALSE
},
995 {URL_SCHEME_FTP
,S_OK
,FALSE
},
996 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
999 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1000 { "zip://test\\:word@winehq.org/", 0, S_OK
, FALSE
,
1002 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1003 {"test\\:word@winehq.org",S_OK
,FALSE
},
1004 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1005 {"winehq.org",S_OK
,FALSE
},
1008 {"winehq.org",S_OK
,FALSE
},
1009 {"word",S_OK
,FALSE
},
1013 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1015 {"test\\:word",S_OK
,FALSE
},
1016 {"test\\",S_OK
,FALSE
}
1019 {Uri_HOST_DNS
,S_OK
,FALSE
},
1021 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1022 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1025 /* It normalizes IPv4 addresses correctly. */
1026 { "http://127.000.000.100/", 0, S_OK
, FALSE
,
1028 {"http://127.0.0.100/",S_OK
,FALSE
},
1029 {"127.0.0.100",S_OK
,FALSE
},
1030 {"http://127.0.0.100/",S_OK
,FALSE
},
1034 {"127.0.0.100",S_OK
,FALSE
},
1039 {"http://127.000.000.100/",S_OK
,FALSE
},
1040 {"http",S_OK
,FALSE
},
1045 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1047 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1048 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1051 { "http://127.0.0.1:8000", 0, S_OK
, FALSE
,
1053 {"http://127.0.0.1:8000/",S_OK
},
1054 {"127.0.0.1:8000",S_OK
},
1055 {"http://127.0.0.1:8000/",S_OK
},
1064 {"http://127.0.0.1:8000",S_OK
},
1070 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1072 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1073 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1076 /* Make sure it normalizes partial IPv4 addresses correctly. */
1077 { "http://127.0/", 0, S_OK
, FALSE
,
1079 {"http://127.0.0.0/",S_OK
,FALSE
},
1080 {"127.0.0.0",S_OK
,FALSE
},
1081 {"http://127.0.0.0/",S_OK
,FALSE
},
1085 {"127.0.0.0",S_OK
,FALSE
},
1090 {"http://127.0/",S_OK
,FALSE
},
1091 {"http",S_OK
,FALSE
},
1096 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1098 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1099 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1102 /* Make sure it converts implicit IPv4's correctly. */
1103 { "http://123456/", 0, S_OK
, FALSE
,
1105 {"http://0.1.226.64/",S_OK
,FALSE
},
1106 {"0.1.226.64",S_OK
,FALSE
},
1107 {"http://0.1.226.64/",S_OK
,FALSE
},
1111 {"0.1.226.64",S_OK
,FALSE
},
1116 {"http://123456/",S_OK
,FALSE
},
1117 {"http",S_OK
,FALSE
},
1122 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1124 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1125 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1129 { "http://4294967295/", 0, S_OK
, FALSE
,
1131 {"http://255.255.255.255/",S_OK
,FALSE
},
1132 {"255.255.255.255",S_OK
,FALSE
},
1133 {"http://255.255.255.255/",S_OK
,FALSE
},
1137 {"255.255.255.255",S_OK
,FALSE
},
1142 {"http://4294967295/",S_OK
,FALSE
},
1143 {"http",S_OK
,FALSE
},
1148 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1150 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1151 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1155 { "http://4294967296/", 0, S_OK
, FALSE
,
1157 {"http://4294967296/",S_OK
,FALSE
},
1158 {"4294967296",S_OK
,FALSE
},
1159 {"http://4294967296/",S_OK
,FALSE
},
1163 {"4294967296",S_OK
,FALSE
},
1168 {"http://4294967296/",S_OK
,FALSE
},
1169 {"http",S_OK
,FALSE
},
1174 {Uri_HOST_DNS
,S_OK
,FALSE
},
1176 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1177 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1180 /* Window's doesn't normalize IP address for unknown schemes. */
1181 { "1234://4294967295/", 0, S_OK
, FALSE
,
1183 {"1234://4294967295/",S_OK
,FALSE
},
1184 {"4294967295",S_OK
,FALSE
},
1185 {"1234://4294967295/",S_OK
,FALSE
},
1189 {"4294967295",S_OK
,FALSE
},
1194 {"1234://4294967295/",S_OK
,FALSE
},
1195 {"1234",S_OK
,FALSE
},
1200 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1202 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1203 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1206 /* Window's doesn't normalize IP address for unknown schemes. */
1207 { "1234://127.001/", 0, S_OK
, FALSE
,
1209 {"1234://127.001/",S_OK
,FALSE
},
1210 {"127.001",S_OK
,FALSE
},
1211 {"1234://127.001/",S_OK
,FALSE
},
1215 {"127.001",S_OK
,FALSE
},
1220 {"1234://127.001/",S_OK
,FALSE
},
1221 {"1234",S_OK
,FALSE
},
1226 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1228 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1229 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1232 { "http://[FEDC:BA98::3210]", 0, S_OK
, FALSE
,
1234 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1235 {"[fedc:ba98::3210]",S_OK
,FALSE
},
1236 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1240 {"fedc:ba98::3210",S_OK
,FALSE
},
1245 {"http://[FEDC:BA98::3210]",S_OK
,FALSE
},
1246 {"http",S_OK
,FALSE
},
1251 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1253 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1254 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1257 { "http://[::]", 0, S_OK
, FALSE
,
1259 {"http://[::]/",S_OK
,FALSE
},
1260 {"[::]",S_OK
,FALSE
},
1261 {"http://[::]/",S_OK
,FALSE
},
1270 {"http://[::]",S_OK
,FALSE
},
1271 {"http",S_OK
,FALSE
},
1276 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1278 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1279 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1282 { "http://[FEDC:BA98::]", 0, S_OK
, FALSE
,
1284 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1285 {"[fedc:ba98::]",S_OK
,FALSE
},
1286 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1290 {"fedc:ba98::",S_OK
,FALSE
},
1295 {"http://[FEDC:BA98::]",S_OK
,FALSE
},
1296 {"http",S_OK
,FALSE
},
1301 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1303 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1304 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1307 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1308 { "http://[1::3:4:5:6:7:8]", 0, S_OK
, FALSE
,
1310 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1311 {"[1:0:3:4:5:6:7:8]",S_OK
,FALSE
},
1312 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1316 {"1:0:3:4:5:6:7:8",S_OK
,FALSE
},
1321 {"http://[1::3:4:5:6:7:8]",S_OK
,FALSE
},
1322 {"http",S_OK
,FALSE
},
1327 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1329 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1330 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1333 { "http://[v2.34]/", 0, S_OK
, FALSE
,
1335 {"http://[v2.34]/",S_OK
,FALSE
},
1336 {"[v2.34]",S_OK
,FALSE
},
1337 {"http://[v2.34]/",S_OK
,FALSE
},
1341 {"[v2.34]",S_OK
,FALSE
},
1346 {"http://[v2.34]/",S_OK
,FALSE
},
1347 {"http",S_OK
,FALSE
},
1352 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
1354 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1355 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1358 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1359 { "http://[xyz:12345.com/test", 0, S_OK
, FALSE
,
1361 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1362 {"[xyz:12345.com",S_OK
,FALSE
},
1363 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1364 {"[xyz:12345.com",S_OK
,FALSE
},
1367 {"[xyz:12345.com",S_OK
,FALSE
},
1369 {"/test",S_OK
,FALSE
},
1370 {"/test",S_OK
,FALSE
},
1372 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1373 {"http",S_OK
,FALSE
},
1378 {Uri_HOST_DNS
,S_OK
,FALSE
},
1380 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1381 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1384 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1385 * of the host name (respectively).
1387 { "ftp://www.[works].com/", 0, S_OK
, FALSE
,
1389 {"ftp://www.[works].com/",S_OK
,FALSE
},
1390 {"www.[works].com",S_OK
,FALSE
},
1391 {"ftp://www.[works].com/",S_OK
,FALSE
},
1392 {"[works].com",S_OK
,FALSE
},
1395 {"www.[works].com",S_OK
,FALSE
},
1400 {"ftp://www.[works].com/",S_OK
,FALSE
},
1406 {Uri_HOST_DNS
,S_OK
,FALSE
},
1408 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1409 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1412 /* Considers ':' a delimiter since it appears after the ']'. */
1413 { "http://www.google.com]:12345/", 0, S_OK
, FALSE
,
1415 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1416 {"www.google.com]:12345",S_OK
,FALSE
},
1417 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1418 {"google.com]",S_OK
,FALSE
},
1421 {"www.google.com]",S_OK
,FALSE
},
1426 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1427 {"http",S_OK
,FALSE
},
1432 {Uri_HOST_DNS
,S_OK
,FALSE
},
1434 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1435 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1438 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1439 { "zip://w%XXw%GEw.google.com/", 0, S_OK
, FALSE
,
1441 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1442 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1443 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1444 {"google.com",S_OK
,FALSE
},
1447 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1452 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1458 {Uri_HOST_DNS
,S_OK
,FALSE
},
1460 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1461 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1464 /* Unknown scheme types hostname doesn't get lower cased. */
1465 { "zip://GOOGLE.com/", 0, S_OK
, FALSE
,
1467 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1468 {"GOOGLE.com",S_OK
,FALSE
},
1469 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1470 {"GOOGLE.com",S_OK
,FALSE
},
1473 {"GOOGLE.com",S_OK
,FALSE
},
1478 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1484 {Uri_HOST_DNS
,S_OK
,FALSE
},
1486 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1487 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1490 /* Hostname gets lower-cased for known scheme types. */
1491 { "http://WWW.GOOGLE.com/", 0, S_OK
, FALSE
,
1493 {"http://www.google.com/",S_OK
,FALSE
},
1494 {"www.google.com",S_OK
,FALSE
},
1495 {"http://www.google.com/",S_OK
,FALSE
},
1496 {"google.com",S_OK
,FALSE
},
1499 {"www.google.com",S_OK
,FALSE
},
1504 {"http://WWW.GOOGLE.com/",S_OK
,FALSE
},
1505 {"http",S_OK
,FALSE
},
1510 {Uri_HOST_DNS
,S_OK
,FALSE
},
1512 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1513 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1516 /* Characters that get % encoded in the hostname also have their percent
1517 * encoded forms lower cased.
1519 { "http://www.%7Cgoogle|.com/", 0, S_OK
, FALSE
,
1521 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1522 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1523 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1524 {"%7cgoogle%7c.com",S_OK
,FALSE
},
1527 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1532 {"http://www.%7Cgoogle|.com/",S_OK
,FALSE
},
1533 {"http",S_OK
,FALSE
},
1538 {Uri_HOST_DNS
,S_OK
,FALSE
},
1540 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1541 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1544 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1545 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK
, FALSE
,
1547 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1548 {"[1:2:3:4:5:6::]",S_OK
,FALSE
},
1549 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1553 {"1:2:3:4:5:6::",S_OK
,FALSE
},
1558 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK
,FALSE
},
1559 {"http",S_OK
,FALSE
},
1564 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1566 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1567 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1570 /* IPv4 addresses get normalized. */
1571 { "http://[::001.002.003.000]", 0, S_OK
, FALSE
,
1573 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1574 {"[::1.2.3.0]",S_OK
,FALSE
},
1575 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1579 {"::1.2.3.0",S_OK
,FALSE
},
1584 {"http://[::001.002.003.000]",S_OK
,FALSE
},
1585 {"http",S_OK
,FALSE
},
1590 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1592 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1593 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1596 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1597 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK
, FALSE
,
1599 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1600 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1601 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1605 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK
,FALSE
},
1610 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1616 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1618 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1619 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1622 /* IPv4 address is converted into 2 h16 components. */
1623 { "http://[ffff::192.222.111.32]", 0, S_OK
, FALSE
,
1625 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1626 {"[ffff::c0de:6f20]",S_OK
,FALSE
},
1627 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1631 {"ffff::c0de:6f20",S_OK
,FALSE
},
1636 {"http://[ffff::192.222.111.32]",S_OK
,FALSE
},
1637 {"http",S_OK
,FALSE
},
1642 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1644 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1645 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1648 /* Max value for a port. */
1649 { "http://google.com:65535", 0, S_OK
, FALSE
,
1651 {"http://google.com:65535/",S_OK
,FALSE
},
1652 {"google.com:65535",S_OK
,FALSE
},
1653 {"http://google.com:65535/",S_OK
,FALSE
},
1654 {"google.com",S_OK
,FALSE
},
1657 {"google.com",S_OK
,FALSE
},
1662 {"http://google.com:65535",S_OK
,FALSE
},
1663 {"http",S_OK
,FALSE
},
1668 {Uri_HOST_DNS
,S_OK
,FALSE
},
1670 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1671 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1674 { "zip://google.com:65536", 0, S_OK
, FALSE
,
1676 {"zip://google.com:65536/",S_OK
,FALSE
},
1677 {"google.com:65536",S_OK
,FALSE
},
1678 {"zip://google.com:65536/",S_OK
,FALSE
},
1679 {"google.com:65536",S_OK
,FALSE
},
1682 {"google.com:65536",S_OK
,FALSE
},
1687 {"zip://google.com:65536",S_OK
,FALSE
},
1693 {Uri_HOST_DNS
,S_OK
,FALSE
},
1695 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1696 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1699 { "zip://google.com:65536:25", 0, S_OK
, FALSE
,
1701 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1702 {"google.com:65536:25",S_OK
,FALSE
},
1703 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1704 {"google.com:65536:25",S_OK
,FALSE
},
1707 {"google.com:65536:25",S_OK
,FALSE
},
1712 {"zip://google.com:65536:25",S_OK
,FALSE
},
1718 {Uri_HOST_DNS
,S_OK
,FALSE
},
1720 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1721 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1724 { "zip://[::ffff]:abcd", 0, S_OK
, FALSE
,
1726 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1727 {"[::ffff]:abcd",S_OK
,FALSE
},
1728 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1732 {"[::ffff]:abcd",S_OK
,FALSE
},
1737 {"zip://[::ffff]:abcd",S_OK
,FALSE
},
1743 {Uri_HOST_DNS
,S_OK
,FALSE
},
1745 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1746 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1749 { "zip://127.0.0.1:abcd", 0, S_OK
, FALSE
,
1751 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1752 {"127.0.0.1:abcd",S_OK
,FALSE
},
1753 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1754 {"0.1:abcd",S_OK
,FALSE
},
1757 {"127.0.0.1:abcd",S_OK
,FALSE
},
1762 {"zip://127.0.0.1:abcd",S_OK
,FALSE
},
1768 {Uri_HOST_DNS
,S_OK
,FALSE
},
1770 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1771 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1774 /* Port is just copied over. */
1775 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1777 {"http://google.com:00035",S_OK
,FALSE
},
1778 {"google.com:00035",S_OK
,FALSE
},
1779 {"http://google.com:00035",S_OK
,FALSE
,"http://google.com:35"},
1780 {"google.com",S_OK
,FALSE
},
1783 {"google.com",S_OK
,FALSE
},
1788 {"http://google.com:00035",S_OK
,FALSE
},
1789 {"http",S_OK
,FALSE
},
1794 {Uri_HOST_DNS
,S_OK
,FALSE
},
1796 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1797 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1800 /* Default port is copied over. */
1801 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1803 {"http://google.com:80",S_OK
,FALSE
},
1804 {"google.com:80",S_OK
,FALSE
},
1805 {"http://google.com:80",S_OK
,FALSE
},
1806 {"google.com",S_OK
,FALSE
},
1809 {"google.com",S_OK
,FALSE
},
1814 {"http://google.com:80",S_OK
,FALSE
},
1815 {"http",S_OK
,FALSE
},
1820 {Uri_HOST_DNS
,S_OK
,FALSE
},
1822 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1823 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1826 { "http://google.com.uk", 0, S_OK
, FALSE
,
1828 {"http://google.com.uk/",S_OK
,FALSE
},
1829 {"google.com.uk",S_OK
,FALSE
},
1830 {"http://google.com.uk/",S_OK
,FALSE
},
1831 {"google.com.uk",S_OK
,FALSE
},
1834 {"google.com.uk",S_OK
,FALSE
},
1839 {"http://google.com.uk",S_OK
,FALSE
},
1840 {"http",S_OK
,FALSE
},
1845 {Uri_HOST_DNS
,S_OK
,FALSE
},
1847 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1848 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1851 { "http://google.com.com", 0, S_OK
, FALSE
,
1853 {"http://google.com.com/",S_OK
,FALSE
},
1854 {"google.com.com",S_OK
,FALSE
},
1855 {"http://google.com.com/",S_OK
,FALSE
},
1856 {"com.com",S_OK
,FALSE
},
1859 {"google.com.com",S_OK
,FALSE
},
1864 {"http://google.com.com",S_OK
,FALSE
},
1865 {"http",S_OK
,FALSE
},
1870 {Uri_HOST_DNS
,S_OK
,FALSE
},
1872 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1873 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1876 { "http://google.uk.1", 0, S_OK
, FALSE
,
1878 {"http://google.uk.1/",S_OK
,FALSE
},
1879 {"google.uk.1",S_OK
,FALSE
},
1880 {"http://google.uk.1/",S_OK
,FALSE
},
1881 {"google.uk.1",S_OK
,FALSE
},
1884 {"google.uk.1",S_OK
,FALSE
},
1889 {"http://google.uk.1",S_OK
,FALSE
},
1890 {"http",S_OK
,FALSE
},
1895 {Uri_HOST_DNS
,S_OK
,FALSE
},
1897 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1898 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1901 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1902 { "http://google.foo.uk", 0, S_OK
, FALSE
,
1904 {"http://google.foo.uk/",S_OK
,FALSE
},
1905 {"google.foo.uk",S_OK
,FALSE
},
1906 {"http://google.foo.uk/",S_OK
,FALSE
},
1907 {"foo.uk",S_OK
,FALSE
},
1910 {"google.foo.uk",S_OK
,FALSE
},
1915 {"http://google.foo.uk",S_OK
,FALSE
},
1916 {"http",S_OK
,FALSE
},
1921 {Uri_HOST_DNS
,S_OK
,FALSE
},
1923 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1924 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1927 { "http://.com", 0, S_OK
, FALSE
,
1929 {"http://.com/",S_OK
,FALSE
},
1930 {".com",S_OK
,FALSE
},
1931 {"http://.com/",S_OK
,FALSE
},
1932 {".com",S_OK
,FALSE
},
1935 {".com",S_OK
,FALSE
},
1940 {"http://.com",S_OK
,FALSE
},
1941 {"http",S_OK
,FALSE
},
1946 {Uri_HOST_DNS
,S_OK
,FALSE
},
1948 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1949 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1952 { "http://.uk", 0, S_OK
, FALSE
,
1954 {"http://.uk/",S_OK
,FALSE
},
1956 {"http://.uk/",S_OK
,FALSE
},
1965 {"http://.uk",S_OK
,FALSE
},
1966 {"http",S_OK
,FALSE
},
1971 {Uri_HOST_DNS
,S_OK
,FALSE
},
1973 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1974 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1977 { "http://www.co.google.com.[]", 0, S_OK
, FALSE
,
1979 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
1980 {"www.co.google.com.[]",S_OK
,FALSE
},
1981 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
1982 {"google.com.[]",S_OK
,FALSE
},
1985 {"www.co.google.com.[]",S_OK
,FALSE
},
1990 {"http://www.co.google.com.[]",S_OK
,FALSE
},
1991 {"http",S_OK
,FALSE
},
1996 {Uri_HOST_DNS
,S_OK
,FALSE
},
1998 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1999 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2002 { "http://co.uk", 0, S_OK
, FALSE
,
2004 {"http://co.uk/",S_OK
,FALSE
},
2005 {"co.uk",S_OK
,FALSE
},
2006 {"http://co.uk/",S_OK
,FALSE
},
2010 {"co.uk",S_OK
,FALSE
},
2015 {"http://co.uk",S_OK
,FALSE
},
2016 {"http",S_OK
,FALSE
},
2021 {Uri_HOST_DNS
,S_OK
,FALSE
},
2023 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2024 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2027 { "http://www.co.google.us.test", 0, S_OK
, FALSE
,
2029 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2030 {"www.co.google.us.test",S_OK
,FALSE
},
2031 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2032 {"us.test",S_OK
,FALSE
},
2035 {"www.co.google.us.test",S_OK
,FALSE
},
2040 {"http://www.co.google.us.test",S_OK
,FALSE
},
2041 {"http",S_OK
,FALSE
},
2046 {Uri_HOST_DNS
,S_OK
,FALSE
},
2048 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2049 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2052 { "http://gov.uk", 0, S_OK
, FALSE
,
2054 {"http://gov.uk/",S_OK
,FALSE
},
2055 {"gov.uk",S_OK
,FALSE
},
2056 {"http://gov.uk/",S_OK
,FALSE
},
2060 {"gov.uk",S_OK
,FALSE
},
2065 {"http://gov.uk",S_OK
,FALSE
},
2066 {"http",S_OK
,FALSE
},
2071 {Uri_HOST_DNS
,S_OK
,FALSE
},
2073 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2074 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2077 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2079 {"zip://www.google.com\\test",S_OK
,FALSE
},
2080 {"www.google.com\\test",S_OK
,FALSE
},
2081 {"zip://www.google.com\\test",S_OK
,FALSE
},
2082 {"google.com\\test",S_OK
,FALSE
},
2085 {"www.google.com\\test",S_OK
,FALSE
},
2090 {"zip://www.google.com\\test",S_OK
,FALSE
},
2096 {Uri_HOST_DNS
,S_OK
,FALSE
},
2098 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2099 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2102 { "urn:excepts:bad:%XY:encoded", 0, S_OK
, FALSE
,
2104 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2106 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2112 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2113 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2115 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2121 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2123 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2124 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2127 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2128 * are decoded and all '%' are encoded.
2130 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK
, FALSE
,
2132 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2134 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2136 {".mp3",S_OK
,FALSE
},
2140 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2141 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2143 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK
,FALSE
},
2144 {"file",S_OK
,FALSE
},
2149 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2151 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2152 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2155 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2156 * is decoded and only %'s in front of invalid hex digits are encoded.
2158 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK
, FALSE
,
2160 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2162 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2164 {".mp3",S_OK
,FALSE
},
2168 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2169 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2171 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK
,FALSE
},
2172 {"file",S_OK
,FALSE
},
2177 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2179 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2180 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2183 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2184 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK
, FALSE
,
2186 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2187 {"[::1.2.3.0]",S_OK
,FALSE
},
2188 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2192 {"::1.2.3.0",S_OK
,FALSE
},
2194 {"/%3F%23.T/test",S_OK
,FALSE
},
2195 {"/%3F%23.T/test",S_OK
,FALSE
},
2197 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK
,FALSE
},
2198 {"http",S_OK
,FALSE
},
2203 {Uri_HOST_IPV6
,S_OK
,FALSE
},
2205 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2206 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2209 /* Forbidden characters are always encoded for file URIs. */
2210 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2212 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2214 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2216 {".mp3",S_OK
,FALSE
},
2220 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2221 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2223 {"file:///C:/\"test\"/test.mp3",S_OK
,FALSE
},
2224 {"file",S_OK
,FALSE
},
2229 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2231 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2232 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2235 /* Forbidden characters are never encoded for unknown scheme types. */
2236 { "1234://4294967295/<|>\" test<|>", 0, S_OK
, FALSE
,
2238 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2239 {"4294967295",S_OK
,FALSE
},
2240 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2244 {"4294967295",S_OK
,FALSE
},
2246 {"/<|>\" test<|>",S_OK
,FALSE
},
2247 {"/<|>\" test<|>",S_OK
,FALSE
},
2249 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2250 {"1234",S_OK
,FALSE
},
2255 {Uri_HOST_IPV4
,S_OK
,FALSE
},
2257 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2258 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2261 /* Make sure forbidden characters are percent encoded. */
2262 { "http://gov.uk/<|> test<|>", 0, S_OK
, FALSE
,
2264 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2265 {"gov.uk",S_OK
,FALSE
},
2266 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2270 {"gov.uk",S_OK
,FALSE
},
2272 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2273 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2275 {"http://gov.uk/<|> test<|>",S_OK
,FALSE
},
2276 {"http",S_OK
,FALSE
},
2281 {Uri_HOST_DNS
,S_OK
,FALSE
},
2283 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2284 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2287 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK
, FALSE
,
2289 {"http://gov.uk/",S_OK
,FALSE
},
2290 {"gov.uk",S_OK
,FALSE
},
2291 {"http://gov.uk/",S_OK
,FALSE
},
2295 {"gov.uk",S_OK
,FALSE
},
2300 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK
,FALSE
},
2301 {"http",S_OK
,FALSE
},
2306 {Uri_HOST_DNS
,S_OK
,FALSE
},
2308 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2309 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2312 { "http://gov.uk/test/test2/../../..", 0, S_OK
, FALSE
,
2314 {"http://gov.uk/",S_OK
,FALSE
},
2315 {"gov.uk",S_OK
,FALSE
},
2316 {"http://gov.uk/",S_OK
,FALSE
},
2320 {"gov.uk",S_OK
,FALSE
},
2325 {"http://gov.uk/test/test2/../../..",S_OK
,FALSE
},
2326 {"http",S_OK
,FALSE
},
2331 {Uri_HOST_DNS
,S_OK
,FALSE
},
2333 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2334 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2337 { "http://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2339 {"http://gov.uk/",S_OK
,FALSE
},
2340 {"gov.uk",S_OK
,FALSE
},
2341 {"http://gov.uk/",S_OK
,FALSE
},
2345 {"gov.uk",S_OK
,FALSE
},
2350 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2351 {"http",S_OK
,FALSE
},
2356 {Uri_HOST_DNS
,S_OK
,FALSE
},
2358 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2359 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2362 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK
, FALSE
,
2364 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2366 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2368 {".mp3",S_OK
,FALSE
},
2372 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2373 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2375 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK
,FALSE
},
2376 {"file",S_OK
,FALSE
},
2381 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2383 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2384 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2387 /* Dot removal happens for unknown scheme types. */
2388 { "zip://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2390 {"zip://gov.uk/",S_OK
,FALSE
},
2391 {"gov.uk",S_OK
,FALSE
},
2392 {"zip://gov.uk/",S_OK
,FALSE
},
2396 {"gov.uk",S_OK
,FALSE
},
2401 {"zip://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2407 {Uri_HOST_DNS
,S_OK
,FALSE
},
2409 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2410 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2413 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2414 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2416 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2417 {"gov.uk",S_OK
,FALSE
},
2418 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2422 {"gov.uk",S_OK
,FALSE
},
2424 {"/test/test2/../../.",S_OK
,FALSE
},
2425 {"/test/test2/../../.",S_OK
,FALSE
},
2427 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2428 {"http",S_OK
,FALSE
},
2433 {Uri_HOST_DNS
,S_OK
,FALSE
},
2435 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2436 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2439 /* Dot removal doesn't happen for wildcard scheme types. */
2440 { "*:gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2442 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2443 {"gov.uk",S_OK
,FALSE
},
2444 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2448 {"gov.uk",S_OK
,FALSE
},
2450 {"/test/test2/../../.",S_OK
,FALSE
},
2451 {"/test/test2/../../.",S_OK
,FALSE
},
2453 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2459 {Uri_HOST_DNS
,S_OK
,FALSE
},
2461 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
2462 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2465 /* Forbidden characters are encoded for opaque known scheme types. */
2466 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK
, FALSE
,
2468 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2470 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2472 {".com%22",S_OK
,FALSE
},
2476 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2477 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2479 {"mailto:\"acco<|>unt@example.com\"",S_OK
,FALSE
},
2480 {"mailto",S_OK
,FALSE
},
2485 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2487 {URL_SCHEME_MAILTO
,S_OK
,FALSE
},
2488 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2491 { "news:test.tes<|>t.com", 0, S_OK
, FALSE
,
2493 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2495 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2497 {".com",S_OK
,FALSE
},
2501 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2502 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2504 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2505 {"news",S_OK
,FALSE
},
2510 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2512 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2513 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2516 /* Don't encode forbidden characters. */
2517 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2519 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2521 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2523 {".com",S_OK
,FALSE
},
2527 {"test.tes<|>t.com",S_OK
,FALSE
},
2528 {"test.tes<|>t.com",S_OK
,FALSE
},
2530 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2531 {"news",S_OK
,FALSE
},
2536 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2538 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2539 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2542 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2543 { "urn:test.tes<|>t.com", 0, S_OK
, FALSE
,
2545 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2547 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2549 {".com",S_OK
,FALSE
},
2553 {"test.tes<|>t.com",S_OK
,FALSE
},
2554 {"test.tes<|>t.com",S_OK
,FALSE
},
2556 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2562 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2564 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2565 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2568 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2569 { "news:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2571 {"news:test.test.com",S_OK
,FALSE
},
2573 {"news:test.test.com",S_OK
,FALSE
},
2575 {".com",S_OK
,FALSE
},
2579 {"test.test.com",S_OK
,FALSE
},
2580 {"test.test.com",S_OK
,FALSE
},
2582 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2583 {"news",S_OK
,FALSE
},
2588 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2590 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2591 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2594 /* Percent encoded characters are still decoded for known scheme types. */
2595 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2597 {"news:test.test.com",S_OK
,FALSE
},
2599 {"news:test.test.com",S_OK
,FALSE
},
2601 {".com",S_OK
,FALSE
},
2605 {"test.test.com",S_OK
,FALSE
},
2606 {"test.test.com",S_OK
,FALSE
},
2608 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2609 {"news",S_OK
,FALSE
},
2614 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2616 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2617 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2620 /* Percent encoded characters aren't decoded for unknown scheme types. */
2621 { "urn:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2623 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2625 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2627 {".com",S_OK
,FALSE
},
2631 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2632 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2634 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2640 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2642 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2643 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2646 /* Unknown scheme types can have invalid % encoded data in query string. */
2647 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK
, FALSE
,
2649 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2650 {"www.winehq.org",S_OK
,FALSE
},
2651 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2652 {"winehq.org",S_OK
,FALSE
},
2655 {"www.winehq.org",S_OK
,FALSE
},
2658 {"/?query=%xx&return=y",S_OK
,FALSE
},
2659 {"?query=%xx&return=y",S_OK
,FALSE
},
2660 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2666 {Uri_HOST_DNS
,S_OK
,FALSE
},
2668 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2669 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2672 /* Known scheme types can have invalid % encoded data with the right flags. */
2673 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2675 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2676 {"www.winehq.org",S_OK
,FALSE
},
2677 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2678 {"winehq.org",S_OK
,FALSE
},
2681 {"www.winehq.org",S_OK
,FALSE
},
2684 {"/?query=%xx&return=y",S_OK
,FALSE
},
2685 {"?query=%xx&return=y",S_OK
,FALSE
},
2686 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2687 {"http",S_OK
,FALSE
},
2692 {Uri_HOST_DNS
,S_OK
,FALSE
},
2694 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2695 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2698 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2699 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2701 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2702 {"www.winehq.org",S_OK
,FALSE
},
2703 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2704 {"winehq.org",S_OK
,FALSE
},
2707 {"www.winehq.org",S_OK
,FALSE
},
2710 {"/?query=<|>&return=y",S_OK
,FALSE
},
2711 {"?query=<|>&return=y",S_OK
,FALSE
},
2712 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2713 {"http",S_OK
,FALSE
},
2718 {Uri_HOST_DNS
,S_OK
,FALSE
},
2720 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2721 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2724 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2725 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2727 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2728 {"www.winehq.org",S_OK
,FALSE
},
2729 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2730 {"winehq.org",S_OK
,FALSE
},
2733 {"www.winehq.org",S_OK
,FALSE
},
2736 {"/?query=<|>&return=y",S_OK
,FALSE
},
2737 {"?query=<|>&return=y",S_OK
,FALSE
},
2738 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2739 {"http",S_OK
,FALSE
},
2744 {Uri_HOST_DNS
,S_OK
,FALSE
},
2746 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2747 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2750 /* Forbidden characters are encoded for known scheme types. */
2751 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2753 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2754 {"www.winehq.org",S_OK
,FALSE
},
2755 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2756 {"winehq.org",S_OK
,FALSE
},
2759 {"www.winehq.org",S_OK
,FALSE
},
2762 {"/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2763 {"?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2764 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2765 {"http",S_OK
,FALSE
},
2770 {Uri_HOST_DNS
,S_OK
,FALSE
},
2772 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2773 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2776 /* Forbidden characters are not encoded for unknown scheme types. */
2777 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2779 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2780 {"www.winehq.org",S_OK
,FALSE
},
2781 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2782 {"winehq.org",S_OK
,FALSE
},
2785 {"www.winehq.org",S_OK
,FALSE
},
2788 {"/?query=<|>&return=y",S_OK
,FALSE
},
2789 {"?query=<|>&return=y",S_OK
,FALSE
},
2790 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2796 {Uri_HOST_DNS
,S_OK
,FALSE
},
2798 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2799 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2802 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2803 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2805 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2806 {"www.winehq.org",S_OK
,FALSE
},
2807 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2808 {"winehq.org",S_OK
,FALSE
},
2811 {"www.winehq.org",S_OK
,FALSE
},
2814 {"/?query=01&return=y",S_OK
,FALSE
},
2815 {"?query=01&return=y",S_OK
,FALSE
},
2816 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2817 {"http",S_OK
,FALSE
},
2822 {Uri_HOST_DNS
,S_OK
,FALSE
},
2824 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2825 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2828 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2829 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2831 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2832 {"www.winehq.org",S_OK
,FALSE
},
2833 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2834 {"winehq.org",S_OK
,FALSE
},
2837 {"www.winehq.org",S_OK
,FALSE
},
2840 {"/?query=%30%31&return=y",S_OK
,FALSE
},
2841 {"?query=%30%31&return=y",S_OK
,FALSE
},
2842 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2848 {Uri_HOST_DNS
,S_OK
,FALSE
},
2850 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2851 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2854 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2855 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2857 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2858 {"www.winehq.org",S_OK
,FALSE
},
2859 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2860 {"winehq.org",S_OK
,FALSE
},
2863 {"www.winehq.org",S_OK
,FALSE
},
2866 {"/?query=%30%31&return=y",S_OK
,FALSE
},
2867 {"?query=%30%31&return=y",S_OK
,FALSE
},
2868 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2869 {"http",S_OK
,FALSE
},
2874 {Uri_HOST_DNS
,S_OK
,FALSE
},
2876 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2877 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2880 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2882 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2883 {"www.winehq.org",S_OK
,FALSE
},
2884 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2885 {"winehq.org",S_OK
,FALSE
},
2888 {"www.winehq.org",S_OK
,FALSE
},
2891 {"?query=12&return=y",S_OK
,FALSE
},
2892 {"?query=12&return=y",S_OK
,FALSE
},
2893 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2894 {"http",S_OK
,FALSE
},
2899 {Uri_HOST_DNS
,S_OK
,FALSE
},
2901 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2902 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2905 /* Unknown scheme types can have invalid % encoded data in fragments. */
2906 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK
, FALSE
,
2908 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2909 {"www.winehq.org",S_OK
,FALSE
},
2910 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2911 {"winehq.org",S_OK
,FALSE
},
2913 {"#Te%xx",S_OK
,FALSE
},
2914 {"www.winehq.org",S_OK
,FALSE
},
2916 {"/tests/",S_OK
,FALSE
},
2917 {"/tests/",S_OK
,FALSE
},
2919 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2925 {Uri_HOST_DNS
,S_OK
,FALSE
},
2927 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2928 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2931 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2932 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
2934 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2935 {"www.winehq.org",S_OK
,FALSE
},
2936 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2937 {"winehq.org",S_OK
,FALSE
},
2939 {"#Te<|>",S_OK
,FALSE
},
2940 {"www.winehq.org",S_OK
,FALSE
},
2942 {"/tests/",S_OK
,FALSE
},
2943 {"/tests/",S_OK
,FALSE
},
2945 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2951 {Uri_HOST_DNS
,S_OK
,FALSE
},
2953 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2954 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2957 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2958 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
2960 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
2961 {"www.winehq.org",S_OK
,FALSE
},
2962 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
2963 {"winehq.org",S_OK
,FALSE
},
2965 {"#Te%3C%7C%3E",S_OK
,FALSE
},
2966 {"www.winehq.org",S_OK
,FALSE
},
2968 {"/tests/",S_OK
,FALSE
},
2969 {"/tests/",S_OK
,FALSE
},
2971 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2972 {"http",S_OK
,FALSE
},
2977 {Uri_HOST_DNS
,S_OK
,FALSE
},
2979 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2980 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2983 /* Forbidden characters aren't encoded in the fragment with this flag. */
2984 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2986 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2987 {"www.winehq.org",S_OK
,FALSE
},
2988 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2989 {"winehq.org",S_OK
,FALSE
},
2991 {"#Te<|>",S_OK
,FALSE
},
2992 {"www.winehq.org",S_OK
,FALSE
},
2994 {"/tests/",S_OK
,FALSE
},
2995 {"/tests/",S_OK
,FALSE
},
2997 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2998 {"http",S_OK
,FALSE
},
3003 {Uri_HOST_DNS
,S_OK
,FALSE
},
3005 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3006 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3009 /* Forbidden characters aren't encoded in the fragment with this flag. */
3010 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
3012 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3013 {"www.winehq.org",S_OK
,FALSE
},
3014 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3015 {"winehq.org",S_OK
,FALSE
},
3017 {"#Te<|>",S_OK
,FALSE
},
3018 {"www.winehq.org",S_OK
,FALSE
},
3020 {"/tests/",S_OK
,FALSE
},
3021 {"/tests/",S_OK
,FALSE
},
3023 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3024 {"http",S_OK
,FALSE
},
3029 {Uri_HOST_DNS
,S_OK
,FALSE
},
3031 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3032 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3035 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3036 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3038 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3039 {"www.winehq.org",S_OK
,FALSE
},
3040 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3041 {"winehq.org",S_OK
,FALSE
},
3043 {"#Te%30%31%32",S_OK
,FALSE
},
3044 {"www.winehq.org",S_OK
,FALSE
},
3046 {"/tests/",S_OK
,FALSE
},
3047 {"/tests/",S_OK
,FALSE
},
3049 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3055 {Uri_HOST_DNS
,S_OK
,FALSE
},
3057 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3058 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3061 /* Percent encoded, unreserved characters are decoded for known schemes. */
3062 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3064 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3065 {"www.winehq.org",S_OK
,FALSE
},
3066 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3067 {"winehq.org",S_OK
,FALSE
},
3069 {"#Te012",S_OK
,FALSE
},
3070 {"www.winehq.org",S_OK
,FALSE
},
3072 {"/tests/",S_OK
,FALSE
},
3073 {"/tests/",S_OK
,FALSE
},
3075 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3076 {"http",S_OK
,FALSE
},
3081 {Uri_HOST_DNS
,S_OK
,FALSE
},
3083 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3084 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3087 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3088 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3090 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3091 {"www.winehq.org",S_OK
,FALSE
},
3092 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3093 {"winehq.org",S_OK
,FALSE
},
3095 {"#Te012",S_OK
,FALSE
},
3096 {"www.winehq.org",S_OK
,FALSE
},
3098 {"/tests/",S_OK
,FALSE
},
3099 {"/tests/",S_OK
,FALSE
},
3101 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3102 {"http",S_OK
,FALSE
},
3107 {Uri_HOST_DNS
,S_OK
,FALSE
},
3109 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3110 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3113 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3114 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
3116 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3117 {"www.winehq.org",S_OK
,FALSE
},
3118 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3119 {"winehq.org",S_OK
,FALSE
},
3121 {"#Te%30%31%32",S_OK
,FALSE
},
3122 {"www.winehq.org",S_OK
,FALSE
},
3124 {"/tests/",S_OK
,FALSE
},
3125 {"/tests/",S_OK
,FALSE
},
3127 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3128 {"http",S_OK
,FALSE
},
3133 {Uri_HOST_DNS
,S_OK
,FALSE
},
3135 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3136 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3139 /* Leading/Trailing whitespace is removed. */
3140 { " http://google.com/ ", 0, S_OK
, FALSE
,
3142 {"http://google.com/",S_OK
,FALSE
},
3143 {"google.com",S_OK
,FALSE
},
3144 {"http://google.com/",S_OK
,FALSE
},
3145 {"google.com",S_OK
,FALSE
},
3148 {"google.com",S_OK
,FALSE
},
3153 {"http://google.com/",S_OK
,FALSE
},
3154 {"http",S_OK
,FALSE
},
3159 {Uri_HOST_DNS
,S_OK
,FALSE
},
3161 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3162 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3165 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK
, FALSE
,
3167 {"http://google.com/",S_OK
,FALSE
},
3168 {"google.com",S_OK
,FALSE
},
3169 {"http://google.com/",S_OK
,FALSE
},
3170 {"google.com",S_OK
,FALSE
},
3173 {"google.com",S_OK
,FALSE
},
3178 {"http://google.com/",S_OK
,FALSE
},
3179 {"http",S_OK
,FALSE
},
3184 {Uri_HOST_DNS
,S_OK
,FALSE
},
3186 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3187 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3190 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3192 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3193 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3194 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3195 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3198 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3200 {"/%0A%0A%0A",S_OK
,FALSE
},
3201 {"/%0A%0A%0A",S_OK
,FALSE
},
3203 {"http://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3204 {"http",S_OK
,FALSE
},
3209 {Uri_HOST_DNS
,S_OK
,FALSE
},
3211 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3212 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3215 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3217 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3218 {"g\noogle.co\rm",S_OK
,FALSE
},
3219 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3220 {"g\noogle.co\rm",S_OK
,FALSE
},
3223 {"g\noogle.co\rm",S_OK
,FALSE
},
3225 {"/\n\n\n",S_OK
,FALSE
},
3226 {"/\n\n\n",S_OK
,FALSE
},
3228 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3234 {Uri_HOST_DNS
,S_OK
,FALSE
},
3236 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3237 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3240 /* Since file URLs are usually hierarchical, it returns an empty string
3241 * for the absolute URI property since it was declared as an opaque URI.
3243 { "file:index.html", 0, S_OK
, FALSE
,
3247 {"file:index.html",S_OK
,FALSE
},
3249 {".html",S_OK
,FALSE
},
3253 {"index.html",S_OK
,FALSE
},
3254 {"index.html",S_OK
,FALSE
},
3256 {"file:index.html",S_OK
,FALSE
},
3257 {"file",S_OK
,FALSE
},
3262 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3264 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3265 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3268 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3269 { "http:test.com/index.html", 0, S_OK
, FALSE
,
3273 {"http:test.com/index.html",S_OK
,FALSE
},
3275 {".html",S_OK
,FALSE
},
3279 {"test.com/index.html",S_OK
,FALSE
},
3280 {"test.com/index.html",S_OK
,FALSE
},
3282 {"http:test.com/index.html",S_OK
,FALSE
},
3283 {"http",S_OK
,FALSE
},
3288 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3290 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3291 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3294 { "ftp:test.com/index.html", 0, S_OK
, FALSE
,
3298 {"ftp:test.com/index.html",S_OK
,FALSE
},
3300 {".html",S_OK
,FALSE
},
3304 {"test.com/index.html",S_OK
,FALSE
},
3305 {"test.com/index.html",S_OK
,FALSE
},
3307 {"ftp:test.com/index.html",S_OK
,FALSE
},
3313 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3315 {URL_SCHEME_FTP
,S_OK
,FALSE
},
3316 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3319 { "file://C|/test.mp3", 0, S_OK
, FALSE
,
3321 {"file:///C:/test.mp3",S_OK
,FALSE
},
3323 {"file:///C:/test.mp3",S_OK
,FALSE
},
3325 {".mp3",S_OK
,FALSE
},
3329 {"/C:/test.mp3",S_OK
,FALSE
},
3330 {"/C:/test.mp3",S_OK
,FALSE
},
3332 {"file://C|/test.mp3",S_OK
,FALSE
},
3333 {"file",S_OK
,FALSE
},
3338 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3340 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3341 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3344 { "file:///C|/test.mp3", 0, S_OK
, FALSE
,
3346 {"file:///C:/test.mp3",S_OK
,FALSE
},
3348 {"file:///C:/test.mp3",S_OK
,FALSE
},
3350 {".mp3",S_OK
,FALSE
},
3354 {"/C:/test.mp3",S_OK
,FALSE
},
3355 {"/C:/test.mp3",S_OK
,FALSE
},
3357 {"file:///C|/test.mp3",S_OK
,FALSE
},
3358 {"file",S_OK
,FALSE
},
3363 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3365 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3366 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3369 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3372 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3374 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3376 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3378 {".html",S_OK
,FALSE
},
3382 {"c:\\dir\\index.html",S_OK
,FALSE
},
3383 {"c:\\dir\\index.html",S_OK
,FALSE
},
3385 {"file://c:/dir/index.html",S_OK
,FALSE
},
3386 {"file",S_OK
,FALSE
},
3391 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3393 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3394 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3397 /* Extra '/' after "file://" is removed. */
3398 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3400 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3402 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3404 {".html",S_OK
,FALSE
},
3408 {"c:\\dir\\index.html",S_OK
,FALSE
},
3409 {"c:\\dir\\index.html",S_OK
,FALSE
},
3411 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3412 {"file",S_OK
,FALSE
},
3417 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3419 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3420 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3423 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3424 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3426 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3428 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3430 {".html",S_OK
,FALSE
},
3434 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3435 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3437 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK
,FALSE
},
3438 {"file",S_OK
,FALSE
},
3443 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3445 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3446 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3449 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3451 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3453 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3455 {".html",S_OK
,FALSE
},
3459 {"c:\\dir\\index.html",S_OK
,FALSE
},
3460 {"c:\\dir\\index.html",S_OK
,FALSE
},
3462 {"file://c|/dir\\index.html",S_OK
,FALSE
},
3463 {"file",S_OK
,FALSE
},
3468 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3470 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3471 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3474 /* The backslashes after the scheme name are converted to forward slashes. */
3475 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3477 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3479 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3481 {".html",S_OK
,FALSE
},
3485 {"c:\\dir\\index.html",S_OK
,FALSE
},
3486 {"c:\\dir\\index.html",S_OK
,FALSE
},
3488 {"file:\\\\c:\\dir\\index.html",S_OK
,FALSE
},
3489 {"file",S_OK
,FALSE
},
3494 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3496 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3497 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3500 { "file:\\\\c:/dir/index.html", 0, S_OK
, FALSE
,
3502 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3504 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3506 {".html",S_OK
,FALSE
},
3510 {"/c:/dir/index.html",S_OK
,FALSE
},
3511 {"/c:/dir/index.html",S_OK
,FALSE
},
3513 {"file:\\\\c:/dir/index.html",S_OK
,FALSE
},
3514 {"file",S_OK
,FALSE
},
3519 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3521 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3522 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3525 { "http:\\\\google.com", 0, S_OK
, FALSE
,
3527 {"http://google.com/",S_OK
,FALSE
},
3528 {"google.com",S_OK
,FALSE
},
3529 {"http://google.com/",S_OK
,FALSE
},
3530 {"google.com",S_OK
,FALSE
},
3533 {"google.com",S_OK
,FALSE
},
3538 {"http:\\\\google.com",S_OK
,FALSE
},
3539 {"http",S_OK
,FALSE
},
3544 {Uri_HOST_DNS
,S_OK
,FALSE
},
3546 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3547 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3550 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3551 { "zip:\\\\google.com", 0, S_OK
, FALSE
,
3553 {"zip:\\\\google.com",S_OK
,FALSE
},
3555 {"zip:\\\\google.com",S_OK
,FALSE
},
3557 {".com",S_OK
,FALSE
},
3561 {"\\\\google.com",S_OK
,FALSE
},
3562 {"\\\\google.com",S_OK
,FALSE
},
3564 {"zip:\\\\google.com",S_OK
,FALSE
},
3570 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3572 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3573 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3576 /* Dot segments aren't removed. */
3577 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3579 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3581 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3583 {".html",S_OK
,FALSE
},
3587 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3588 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3590 {"file://c:\\dir\\../..\\./index.html",S_OK
,FALSE
},
3591 {"file",S_OK
,FALSE
},
3596 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3598 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3599 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3602 /* Forbidden characters aren't percent encoded. */
3603 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3605 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3607 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3609 {".html",S_OK
,FALSE
},
3613 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3614 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3616 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3617 {"file",S_OK
,FALSE
},
3622 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3624 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3625 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3628 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3629 { "file:c:\\dir\\../..\\index.html", 0, S_OK
, FALSE
,
3633 {"file:c:/dir/../../index.html",S_OK
,FALSE
},
3635 {".html",S_OK
,FALSE
},
3639 {"c:/dir/../../index.html",S_OK
,FALSE
},
3640 {"c:/dir/../../index.html",S_OK
,FALSE
},
3642 {"file:c:\\dir\\../..\\index.html",S_OK
,FALSE
},
3643 {"file",S_OK
,FALSE
},
3648 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3650 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3651 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3654 /* '/' are still converted to '\' even though it's an opaque URI. */
3655 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3659 {"file:c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3661 {".html",S_OK
,FALSE
},
3665 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3666 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3668 {"file:c:/dir\\../..\\index.html",S_OK
,FALSE
},
3669 {"file",S_OK
,FALSE
},
3674 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3676 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3677 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3680 /* Forbidden characters aren't percent encoded. */
3681 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3685 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3687 {".html",S_OK
,FALSE
},
3691 {"c:\\in^|dex.html",S_OK
,FALSE
},
3692 {"c:\\in^|dex.html",S_OK
,FALSE
},
3694 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3695 {"file",S_OK
,FALSE
},
3700 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3702 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3703 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3706 /* Doesn't have a UserName since the ':' appears at the beginning of the
3709 { "http://:password@gov.uk", 0, S_OK
, FALSE
,
3711 {"http://:password@gov.uk/",S_OK
,FALSE
},
3712 {":password@gov.uk",S_OK
,FALSE
},
3713 {"http://gov.uk/",S_OK
,FALSE
},
3717 {"gov.uk",S_OK
,FALSE
},
3718 {"password",S_OK
,FALSE
},
3722 {"http://:password@gov.uk",S_OK
,FALSE
},
3723 {"http",S_OK
,FALSE
},
3724 {":password",S_OK
,FALSE
},
3728 {Uri_HOST_DNS
,S_OK
,FALSE
},
3730 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3731 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3734 /* Has a UserName since the userinfo section doesn't contain a password. */
3735 { "http://@gov.uk", 0, S_OK
, FALSE
,
3737 {"http://gov.uk/",S_OK
,FALSE
,"http://@gov.uk/"},
3738 {"@gov.uk",S_OK
,FALSE
},
3739 {"http://gov.uk/",S_OK
,FALSE
},
3743 {"gov.uk",S_OK
,FALSE
},
3748 {"http://@gov.uk",S_OK
,FALSE
},
3749 {"http",S_OK
,FALSE
},
3754 {Uri_HOST_DNS
,S_OK
,FALSE
},
3756 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3757 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3760 /* ":@" not included in the absolute URI. */
3761 { "http://:@gov.uk", 0, S_OK
, FALSE
,
3763 {"http://gov.uk/",S_OK
,FALSE
,"http://:@gov.uk/"},
3764 {":@gov.uk",S_OK
,FALSE
},
3765 {"http://gov.uk/",S_OK
,FALSE
},
3769 {"gov.uk",S_OK
,FALSE
},
3774 {"http://:@gov.uk",S_OK
,FALSE
},
3775 {"http",S_OK
,FALSE
},
3780 {Uri_HOST_DNS
,S_OK
,FALSE
},
3782 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3783 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3786 /* '@' is included because it's an unknown scheme type. */
3787 { "zip://@gov.uk", 0, S_OK
, FALSE
,
3789 {"zip://@gov.uk/",S_OK
,FALSE
},
3790 {"@gov.uk",S_OK
,FALSE
},
3791 {"zip://@gov.uk/",S_OK
,FALSE
},
3795 {"gov.uk",S_OK
,FALSE
},
3800 {"zip://@gov.uk",S_OK
,FALSE
},
3806 {Uri_HOST_DNS
,S_OK
,FALSE
},
3808 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3809 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3812 /* ":@" are included because it's an unknown scheme type. */
3813 { "zip://:@gov.uk", 0, S_OK
, FALSE
,
3815 {"zip://:@gov.uk/",S_OK
,FALSE
},
3816 {":@gov.uk",S_OK
,FALSE
},
3817 {"zip://:@gov.uk/",S_OK
,FALSE
},
3821 {"gov.uk",S_OK
,FALSE
},
3826 {"zip://:@gov.uk",S_OK
,FALSE
},
3832 {Uri_HOST_DNS
,S_OK
,FALSE
},
3834 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3835 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3838 { "about:blank", 0, S_OK
, FALSE
,
3840 {"about:blank",S_OK
,FALSE
},
3842 {"about:blank",S_OK
,FALSE
},
3848 {"blank",S_OK
,FALSE
},
3849 {"blank",S_OK
,FALSE
},
3851 {"about:blank",S_OK
,FALSE
},
3852 {"about",S_OK
,FALSE
},
3857 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3859 {URL_SCHEME_ABOUT
,S_OK
,FALSE
},
3860 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3863 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK
,FALSE
,
3865 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3867 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3869 {".htm",S_OK
,FALSE
},
3873 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3874 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3876 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3882 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3884 {URL_SCHEME_MK
,S_OK
,FALSE
},
3885 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3888 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK
,FALSE
,
3890 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3892 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3894 {".htm",S_OK
,FALSE
},
3898 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3899 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3901 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3907 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3909 {URL_SCHEME_MK
,S_OK
,FALSE
},
3910 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3913 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3914 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3916 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
3917 {"server",S_OK
,FALSE
},
3918 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
3920 {".html",S_OK
,FALSE
},
3922 {"server",S_OK
,FALSE
},
3924 {"\\dir\\index.html",S_OK
,FALSE
},
3925 {"\\dir\\index.html",S_OK
,FALSE
},
3927 {"file://server/dir/index.html",S_OK
,FALSE
},
3928 {"file",S_OK
,FALSE
},
3933 {Uri_HOST_DNS
,S_OK
,FALSE
},
3935 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3936 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3939 /* When CreateUri generates an IUri, it still displays the default port in the
3942 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3944 {"http://google.com:80/",S_OK
,FALSE
},
3945 {"google.com:80",S_OK
,FALSE
},
3946 {"http://google.com:80/",S_OK
,FALSE
},
3947 {"google.com",S_OK
,FALSE
},
3950 {"google.com",S_OK
,FALSE
},
3955 {"http://google.com:80/",S_OK
,FALSE
},
3956 {"http",S_OK
,FALSE
},
3961 {Uri_HOST_DNS
,S_OK
,FALSE
},
3963 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3964 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3967 /* For res URIs the host is everything up until the first '/'. */
3968 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK
, FALSE
,
3970 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3971 {"C:\\dir\\file.exe",S_OK
,FALSE
},
3972 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3974 {".html",S_OK
,FALSE
},
3976 {"C:\\dir\\file.exe",S_OK
,FALSE
},
3978 {"/DATA/test.html",S_OK
,FALSE
},
3979 {"/DATA/test.html",S_OK
,FALSE
},
3981 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3987 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3989 {URL_SCHEME_RES
,S_OK
,FALSE
},
3990 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3993 /* Res URI can contain a '|' in the host name. */
3994 { "res://c:\\di|r\\file.exe/test", 0, S_OK
, FALSE
,
3996 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
3997 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
3998 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4002 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4004 {"/test",S_OK
,FALSE
},
4005 {"/test",S_OK
,FALSE
},
4007 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4013 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4015 {URL_SCHEME_RES
,S_OK
,FALSE
},
4016 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
4019 /* Res URIs can have invalid percent encoded values. */
4020 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK
, FALSE
,
4022 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4023 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4024 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4028 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4030 {"/test",S_OK
,FALSE
},
4031 {"/test",S_OK
,FALSE
},
4033 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4039 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4041 {URL_SCHEME_RES
,S_OK
,FALSE
},
4042 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4045 /* Res doesn't get forbidden characters percent encoded in it's path. */
4046 { "res://c:\\test/tes<|>t", 0, S_OK
, FALSE
,
4048 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4049 {"c:\\test",S_OK
,FALSE
},
4050 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4054 {"c:\\test",S_OK
,FALSE
},
4056 {"/tes<|>t",S_OK
,FALSE
},
4057 {"/tes<|>t",S_OK
,FALSE
},
4059 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4065 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4067 {URL_SCHEME_RES
,S_OK
,FALSE
},
4068 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4071 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4073 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4075 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4077 {".jpg",S_OK
,FALSE
},
4081 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4082 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4084 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4090 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4092 {URL_SCHEME_MK
,S_OK
,FALSE
},
4093 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4096 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4098 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4100 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4102 {".jpg",S_OK
,FALSE
},
4106 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4107 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4109 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4115 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4117 {URL_SCHEME_MK
,S_OK
,FALSE
},
4118 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4121 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4123 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4125 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4127 {".jpg",S_OK
,FALSE
},
4131 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4132 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4134 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4140 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4142 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4143 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4146 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4148 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4150 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4152 {".jpg",S_OK
,FALSE
},
4156 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4157 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4159 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4165 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4167 {URL_SCHEME_MK
,S_OK
,FALSE
},
4168 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4171 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4173 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4175 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4177 {".jpg",S_OK
,FALSE
},
4181 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4182 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4184 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4190 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4192 {URL_SCHEME_MK
,S_OK
,FALSE
},
4193 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4196 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK
, FALSE
,
4198 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4200 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4202 {".jpg",S_OK
,FALSE
},
4206 {"images/xxx.jpg",S_OK
,FALSE
},
4207 {"images/xxx.jpg",S_OK
,FALSE
},
4209 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK
,FALSE
},
4215 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4217 {URL_SCHEME_MK
,S_OK
,FALSE
},
4218 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4221 { "", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4240 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4242 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4243 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4246 { " \t ", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4265 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4267 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4268 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4271 { "javascript:void", 0, S_OK
, FALSE
,
4273 {"javascript:void",S_OK
},
4275 {"javascript:void",S_OK
},
4284 {"javascript:void",S_OK
},
4285 {"javascript",S_OK
},
4290 {Uri_HOST_UNKNOWN
,S_OK
},
4292 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4293 {URLZONE_INVALID
,E_NOTIMPL
}
4296 { "javascript://undefined", 0, S_OK
, FALSE
,
4298 {"javascript://undefined",S_OK
},
4300 {"javascript://undefined",S_OK
},
4306 {"//undefined",S_OK
},
4307 {"//undefined",S_OK
},
4309 {"javascript://undefined",S_OK
},
4310 {"javascript",S_OK
},
4315 {Uri_HOST_UNKNOWN
,S_OK
},
4317 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4318 {URLZONE_INVALID
,E_NOTIMPL
}
4321 { "JavaSCript:escape('/\\?#?')", 0, S_OK
, FALSE
,
4323 {"javascript:escape('/\\?#?')",S_OK
},
4325 {"javascript:escape('/\\?#?')",S_OK
},
4331 {"escape('/\\?#?')",S_OK
},
4332 {"escape('/\\?#?')",S_OK
},
4334 {"JavaSCript:escape('/\\?#?')",S_OK
},
4335 {"javascript",S_OK
},
4340 {Uri_HOST_UNKNOWN
,S_OK
},
4342 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4343 {URLZONE_INVALID
,E_NOTIMPL
}
4346 { "*://google.com", 0, S_OK
, FALSE
,
4348 {"*:google.com/",S_OK
,FALSE
},
4349 {"google.com",S_OK
},
4350 {"*:google.com/",S_OK
,FALSE
},
4351 {"google.com",S_OK
,FALSE
},
4354 {"google.com",S_OK
,FALSE
},
4359 {"*://google.com",S_OK
,FALSE
},
4365 {Uri_HOST_DNS
,S_OK
,FALSE
},
4367 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
4368 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4371 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK
,FALSE
,
4373 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4375 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4381 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4382 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4384 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4390 {Uri_HOST_UNKNOWN
,S_OK
},
4392 {URL_SCHEME_MK
,S_OK
},
4393 {URLZONE_INVALID
,E_NOTIMPL
}
4396 { "gopher://test.winehq.org:151/file.txt",0,S_OK
,FALSE
,
4398 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4399 {"test.winehq.org:151",S_OK
},
4400 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4401 {"winehq.org",S_OK
},
4404 {"test.winehq.org",S_OK
},
4409 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4415 {Uri_HOST_DNS
,S_OK
},
4417 {URL_SCHEME_GOPHER
,S_OK
},
4418 {URLZONE_INVALID
,E_NOTIMPL
}
4423 typedef struct _invalid_uri
{
4429 static const invalid_uri invalid_uri_tests
[] = {
4430 /* Has to have a scheme name. */
4431 {"://www.winehq.org",0,FALSE
},
4432 /* Window's doesn't like URI's which are implicitly file paths without the
4433 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4435 {"C:/test/test.mp3",0,FALSE
},
4436 {"\\\\Server/test/test.mp3",0,FALSE
},
4437 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
,FALSE
},
4438 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE
,FALSE
},
4439 /* Invalid schemes. */
4440 {"*abcd://not.valid.com",0,FALSE
},
4441 {"*a*b*c*d://not.valid.com",0,FALSE
},
4442 /* Not allowed to have invalid % encoded data. */
4443 {"ftp://google.co%XX/",0,FALSE
},
4444 /* To many h16 components. */
4445 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE
},
4446 /* Not enough room for IPv4 address. */
4447 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE
},
4448 /* Not enough h16 components. */
4449 {"http://[1:2:3:4]",0,FALSE
},
4450 /* Not enough components including IPv4. */
4451 {"http://[1:192.0.1.0]",0,FALSE
},
4452 /* Not allowed to have partial IPv4 in IPv6. */
4453 {"http://[::192.0]",0,FALSE
},
4454 /* Can't have elision of 1 h16 at beginning of address. */
4455 {"http://[::2:3:4:5:6:7:8]",0,FALSE
},
4456 /* Can't have elision of 1 h16 at end of address. */
4457 {"http://[1:2:3:4:5:6:7::]",0,FALSE
},
4458 /* Expects a valid IP Literal. */
4459 {"ftp://[not.valid.uri]/",0,FALSE
},
4460 /* Expects valid port for a known scheme type. */
4461 {"ftp://www.winehq.org:123fgh",0,FALSE
},
4462 /* Port exceeds USHORT_MAX for known scheme type. */
4463 {"ftp://www.winehq.org:65536",0,FALSE
},
4464 /* Invalid port with IPv4 address. */
4465 {"http://www.winehq.org:1abcd",0,FALSE
},
4466 /* Invalid port with IPv6 address. */
4467 {"http://[::ffff]:32xy",0,FALSE
},
4468 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4469 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE
,FALSE
},
4470 /* Not allowed to have invalid % encoded data in opaque URI path. */
4471 {"news:test%XX",0,FALSE
},
4472 {"mailto:wine@winehq%G8.com",0,FALSE
},
4473 /* Known scheme types can't have invalid % encoded data in query string. */
4474 {"http://google.com/?query=te%xx",0,FALSE
},
4475 /* Invalid % encoded data in fragment of know scheme type. */
4476 {"ftp://google.com/#Test%xx",0,FALSE
},
4477 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
4478 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
4479 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4480 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4481 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4482 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4483 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4484 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4485 /* res URIs aren't allowed to have forbidden dos path characters in the
4488 {"res://c:\\te<st\\test/test",0,FALSE
},
4489 {"res://c:\\te>st\\test/test",0,FALSE
},
4490 {"res://c:\\te\"st\\test/test",0,FALSE
},
4491 {"res://c:\\test/te%xxst",0,FALSE
}
4494 typedef struct _uri_equality
{
4496 DWORD create_flags_a
;
4498 DWORD create_flags_b
;
4503 static const uri_equality equality_tests
[] = {
4505 "HTTP://www.winehq.org/test dir/./",0,
4506 "http://www.winehq.org/test dir/../test dir/",0,
4510 /* http://www.winehq.org/test%20dir */
4511 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4512 "http://www.winehq.org/test dir",0,
4516 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
4517 "file:///c:/test.mp3",0,
4521 "ftp://ftp.winehq.org/",0,
4522 "ftp://ftp.winehq.org",0,
4526 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4527 "ftp://ftp.winehq.org/t%45stB/",0,
4531 "http://google.com/TEST",0,
4532 "http://google.com/test",0,
4536 "http://GOOGLE.com/",0,
4537 "http://google.com/",0,
4540 /* Performs case insensitive compare of host names (for known scheme types). */
4542 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE
,
4543 "ftp://google.com/",0,
4547 "zip://GOOGLE.com/",0,
4548 "zip://google.com/",0,
4552 "file:///c:/TEST/TeST/",0,
4553 "file:///c:/test/test/",0,
4557 "file:///server/TEST",0,
4558 "file:///SERVER/TEST",0,
4562 "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
4563 "http://google.com/",0,
4567 "ftp://google.com:21/",0,
4568 "ftp://google.com/",0,
4572 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE
,
4573 "http://google.com/",0,
4577 "http://google.com:70/",0,
4578 "http://google.com:71/",0,
4582 "file:///c:/dir/file.txt", 0,
4583 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4587 "file:///c:/dir/file.txt", 0,
4588 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4592 "file:///c:/dir/file.txt", 0,
4593 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4597 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4598 "file:///c:/%20dir/file.txt", 0,
4602 "file:///c:/Dir/file.txt", 0,
4603 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH
,
4607 "file:///c:/dir/file.txt", 0,
4608 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4612 "file:///c:/dir/file.txt#a", 0,
4613 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH
,
4618 typedef struct _uri_with_fragment
{
4620 const char* fragment
;
4622 HRESULT create_expected
;
4625 const char* expected_uri
;
4627 } uri_with_fragment
;
4629 static const uri_with_fragment uri_fragment_tests
[] = {
4631 "http://google.com/","#fragment",0,S_OK
,FALSE
,
4632 "http://google.com/#fragment",FALSE
4635 "http://google.com/","fragment",0,S_OK
,FALSE
,
4636 "http://google.com/#fragment",FALSE
4639 "zip://test.com/","?test",0,S_OK
,FALSE
,
4640 "zip://test.com/#?test",FALSE
4642 /* The fragment can be empty. */
4644 "ftp://ftp.google.com/","",0,S_OK
,FALSE
,
4645 "ftp://ftp.google.com/#",FALSE
4649 typedef struct _uri_builder_property
{
4652 const char *expected_value
;
4653 Uri_PROPERTY property
;
4656 } uri_builder_property
;
4658 typedef struct _uri_builder_port
{
4666 typedef struct _uri_builder_str_property
{
4667 const char* expected
;
4670 } uri_builder_str_property
;
4672 typedef struct _uri_builder_dword_property
{
4676 } uri_builder_dword_property
;
4678 typedef struct _uri_builder_test
{
4681 HRESULT create_builder_expected
;
4682 BOOL create_builder_todo
;
4684 uri_builder_property properties
[URI_BUILDER_STR_PROPERTY_COUNT
];
4686 uri_builder_port port_prop
;
4692 DWORD uri_simple_encode_flags
;
4693 HRESULT uri_simple_hres
;
4694 BOOL uri_simple_todo
;
4696 DWORD uri_with_flags
;
4697 DWORD uri_with_builder_flags
;
4698 DWORD uri_with_encode_flags
;
4699 HRESULT uri_with_hres
;
4702 uri_builder_str_property expected_str_props
[URI_STR_PROPERTY_COUNT
];
4703 uri_builder_dword_property expected_dword_props
[URI_DWORD_PROPERTY_COUNT
];
4706 static const uri_builder_test uri_builder_tests
[] = {
4707 { "http://google.com/",0,S_OK
,FALSE
,
4709 {TRUE
,"#fragment",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
4710 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
},
4711 {TRUE
,"?query=x",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
4712 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
4719 {"http://username:password@google.com/?query=x#fragment",S_OK
},
4720 {"username:password@google.com",S_OK
},
4721 {"http://google.com/?query=x#fragment",S_OK
},
4722 {"google.com",S_OK
},
4725 {"google.com",S_OK
},
4730 {"http://username:password@google.com/?query=x#fragment",S_OK
},
4732 {"username:password",S_OK
},
4736 {Uri_HOST_DNS
,S_OK
},
4738 {URL_SCHEME_HTTP
,S_OK
},
4739 {URLZONE_INVALID
,E_NOTIMPL
}
4742 { "http://google.com/",0,S_OK
,FALSE
,
4744 {TRUE
,"test",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
4746 {TRUE
,TRUE
,120,S_OK
,FALSE
},
4751 {"test://google.com:120/",S_OK
},
4752 {"google.com:120",S_OK
},
4753 {"test://google.com:120/",S_OK
},
4754 {"google.com",S_OK
},
4757 {"google.com",S_OK
},
4762 {"test://google.com:120/",S_OK
},
4768 {Uri_HOST_DNS
,S_OK
},
4770 {URL_SCHEME_UNKNOWN
,S_OK
},
4771 {URLZONE_INVALID
,E_NOTIMPL
}
4774 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4776 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
4777 {TRUE
,"::192.2.3.4",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
4778 {TRUE
,NULL
,NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
4785 {"http://[::192.2.3.4]/",S_OK
},
4786 {"[::192.2.3.4]",S_OK
},
4787 {"http://[::192.2.3.4]/",S_OK
},
4791 {"::192.2.3.4",S_OK
},
4796 {"http://[::192.2.3.4]/",S_OK
},
4802 {Uri_HOST_IPV6
,S_OK
},
4804 {URL_SCHEME_HTTP
,S_OK
},
4805 {URLZONE_INVALID
,E_NOTIMPL
}
4808 { "http://google.com/",0,S_OK
,FALSE
,
4810 {TRUE
,"Frag","#Frag",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
4817 {"http://google.com/#Frag",S_OK
},
4818 {"google.com",S_OK
},
4819 {"http://google.com/#Frag",S_OK
},
4820 {"google.com",S_OK
},
4823 {"google.com",S_OK
},
4828 {"http://google.com/#Frag",S_OK
},
4834 {Uri_HOST_DNS
,S_OK
},
4836 {URL_SCHEME_HTTP
,S_OK
},
4837 {URLZONE_INVALID
,E_NOTIMPL
}
4840 { "http://google.com/",0,S_OK
,FALSE
,
4842 {TRUE
,"","#",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
4849 {"http://google.com/#",S_OK
},
4850 {"google.com",S_OK
},
4851 {"http://google.com/#",S_OK
},
4852 {"google.com",S_OK
},
4855 {"google.com",S_OK
},
4860 {"http://google.com/#",S_OK
},
4866 {Uri_HOST_DNS
,S_OK
},
4868 {URL_SCHEME_HTTP
,S_OK
},
4869 {URLZONE_INVALID
,E_NOTIMPL
}
4872 { "http://google.com/",0,S_OK
,FALSE
,
4874 {TRUE
,":password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
4881 {"http://::password@google.com/",S_OK
},
4882 {"::password@google.com",S_OK
},
4883 {"http://google.com/",S_OK
},
4884 {"google.com",S_OK
},
4887 {"google.com",S_OK
},
4892 {"http://::password@google.com/",S_OK
},
4894 {"::password",S_OK
},
4898 {Uri_HOST_DNS
,S_OK
},
4900 {URL_SCHEME_HTTP
,S_OK
},
4901 {URLZONE_INVALID
,E_NOTIMPL
}
4904 { "test/test",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4906 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
4909 Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4911 Uri_CREATE_ALLOW_RELATIVE
,0,0,S_OK
,FALSE
,
4913 {":password@test/test",S_OK
},
4914 {":password@",S_OK
},
4915 {":password@test/test",S_OK
},
4924 {":password@test/test",S_OK
},
4930 {Uri_HOST_UNKNOWN
,S_OK
},
4932 {URL_SCHEME_UNKNOWN
,S_OK
},
4933 {URLZONE_INVALID
,E_NOTIMPL
}
4936 { "http://google.com/",0,S_OK
,FALSE
,
4938 {TRUE
,"test/test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
4945 {"http://google.com/test/test",S_OK
},
4946 {"google.com",S_OK
},
4947 {"http://google.com/test/test",S_OK
},
4948 {"google.com",S_OK
},
4951 {"google.com",S_OK
},
4953 {"/test/test",S_OK
},
4954 {"/test/test",S_OK
},
4956 {"http://google.com/test/test",S_OK
},
4962 {Uri_HOST_DNS
,S_OK
},
4964 {URL_SCHEME_HTTP
,S_OK
},
4965 {URLZONE_INVALID
,E_NOTIMPL
}
4968 { "zip:testing/test",0,S_OK
,FALSE
,
4970 {TRUE
,"test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
4994 {Uri_HOST_UNKNOWN
,S_OK
},
4996 {URL_SCHEME_UNKNOWN
,S_OK
},
4997 {URLZONE_INVALID
,E_NOTIMPL
}
5000 { "http://google.com/",0,S_OK
,FALSE
,
5004 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5005 {TRUE
,FALSE
,555,S_OK
,FALSE
},
5010 {"http://google.com/",S_OK
},
5011 {"google.com",S_OK
},
5012 {"http://google.com/",S_OK
},
5013 {"google.com",S_OK
},
5016 {"google.com",S_OK
},
5021 {"http://google.com/",S_OK
},
5027 {Uri_HOST_DNS
,S_OK
},
5028 /* Still returns 80, even though earlier the port was disabled. */
5030 {URL_SCHEME_HTTP
,S_OK
},
5031 {URLZONE_INVALID
,E_NOTIMPL
}
5034 { "http://google.com/",0,S_OK
,FALSE
,
5038 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5039 * you'll get 122345 instead.
5041 {TRUE
,122345,222,S_OK
,FALSE
},
5046 {"http://google.com:222/",S_OK
},
5047 {"google.com:222",S_OK
},
5048 {"http://google.com:222/",S_OK
},
5049 {"google.com",S_OK
},
5052 {"google.com",S_OK
},
5057 {"http://google.com:222/",S_OK
},
5063 {Uri_HOST_DNS
,S_OK
},
5065 {URL_SCHEME_HTTP
,S_OK
},
5066 {URLZONE_INVALID
,E_NOTIMPL
}
5069 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5070 { "http://google.com/",0,S_OK
,FALSE
,
5074 {TRUE
,TRUE
,999999,S_OK
,FALSE
},
5079 {"http://google.com:999999/",S_OK
},
5080 {"google.com:999999",S_OK
},
5081 {"http://google.com:999999/",S_OK
},
5082 {"google.com",S_OK
},
5085 {"google.com",S_OK
},
5090 {"http://google.com:999999/",S_OK
},
5096 {Uri_HOST_DNS
,S_OK
},
5098 {URL_SCHEME_HTTP
,S_OK
},
5099 {URLZONE_INVALID
,E_NOTIMPL
}
5102 { "http://google.com/",0,S_OK
,FALSE
,
5104 {TRUE
,"test","?test",Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
5112 {"http://google.com/?test",S_OK
},
5113 {"google.com",S_OK
},
5114 {"http://google.com/?test",S_OK
},
5115 {"google.com",S_OK
},
5118 {"google.com",S_OK
},
5123 {"http://google.com/?test",S_OK
},
5129 {Uri_HOST_DNS
,S_OK
},
5131 {URL_SCHEME_HTTP
,S_OK
},
5132 {URLZONE_INVALID
,E_NOTIMPL
}
5135 { "http://:password@google.com/",0,S_OK
,FALSE
,
5144 {"http://:password@google.com/",S_OK
},
5145 {":password@google.com",S_OK
},
5146 {"http://google.com/",S_OK
},
5147 {"google.com",S_OK
},
5150 {"google.com",S_OK
},
5155 {"http://:password@google.com/",S_OK
},
5161 {Uri_HOST_DNS
,S_OK
},
5163 {URL_SCHEME_HTTP
,S_OK
},
5164 {URLZONE_INVALID
,E_NOTIMPL
}
5167 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5168 { NULL
,0,S_OK
,FALSE
,
5170 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
5171 {TRUE
,"google.com",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5178 {"http://google.com/",S_OK
},
5179 {"google.com",S_OK
},
5180 {"http://google.com/",S_OK
},
5181 {"google.com",S_OK
},
5184 {"google.com",S_OK
},
5189 {"http://google.com/",S_OK
},
5195 {Uri_HOST_DNS
,S_OK
},
5197 {URL_SCHEME_HTTP
,S_OK
},
5198 {URLZONE_INVALID
,E_NOTIMPL
}
5201 /* Can't set the scheme name to NULL. */
5202 { "zip://google.com/",0,S_OK
,FALSE
,
5204 {TRUE
,NULL
,"zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5211 {"zip://google.com/",S_OK
},
5212 {"google.com",S_OK
},
5213 {"zip://google.com/",S_OK
},
5214 {"google.com",S_OK
},
5217 {"google.com",S_OK
},
5222 {"zip://google.com/",S_OK
},
5228 {Uri_HOST_DNS
,S_OK
},
5230 {URL_SCHEME_UNKNOWN
,S_OK
},
5231 {URLZONE_INVALID
,E_NOTIMPL
}
5234 /* Can't set the scheme name to an empty string. */
5235 { "zip://google.com/",0,S_OK
,FALSE
,
5237 {TRUE
,"","zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5244 {"zip://google.com/",S_OK
},
5245 {"google.com",S_OK
},
5246 {"zip://google.com/",S_OK
},
5247 {"google.com",S_OK
},
5250 {"google.com",S_OK
},
5255 {"zip://google.com/",S_OK
},
5261 {Uri_HOST_DNS
,S_OK
},
5263 {URL_SCHEME_UNKNOWN
,S_OK
},
5264 {URLZONE_INVALID
,E_NOTIMPL
}
5267 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5268 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5270 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE
,S_OK
,FALSE
,
5275 0,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5277 {"http://google.com/../../",S_OK
},
5278 {"google.com",S_OK
},
5279 {"http://google.com/../../",S_OK
},
5280 {"google.com",S_OK
},
5283 {"google.com",S_OK
},
5288 {"http://google.com/../../",S_OK
},
5294 {Uri_HOST_DNS
,S_OK
},
5296 {URL_SCHEME_HTTP
,S_OK
},
5297 {URLZONE_INVALID
,E_NOTIMPL
}
5300 { "http://google.com/",0,S_OK
,FALSE
,
5302 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5307 Uri_CREATE_NO_DECODE_EXTRA_INFO
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5309 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5310 {"google.com",S_OK
},
5311 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5312 {"google.com",S_OK
},
5314 {"#Fr%3C%7C%3Eg",S_OK
},
5315 {"google.com",S_OK
},
5320 {"http://google.com/#Fr<|>g",S_OK
},
5326 {Uri_HOST_DNS
,S_OK
},
5328 {URL_SCHEME_HTTP
,S_OK
},
5329 {URLZONE_INVALID
,E_NOTIMPL
}
5332 { "http://google.com/",0,S_OK
,FALSE
,
5334 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5337 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,E_INVALIDARG
,FALSE
,
5339 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5341 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5342 {"google.com",S_OK
},
5343 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5344 {"google.com",S_OK
},
5346 {"#Fr%3C%7C%3Eg",S_OK
},
5347 {"google.com",S_OK
},
5352 {"http://google.com/#Fr<|>g",S_OK
},
5358 {Uri_HOST_DNS
,S_OK
},
5360 {URL_SCHEME_HTTP
,S_OK
},
5361 {URLZONE_INVALID
,E_NOTIMPL
}
5364 { NULL
,0,S_OK
,FALSE
,
5366 {TRUE
,"/test/test/",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5367 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5370 0,INET_E_INVALID_URL
,FALSE
,
5371 0,INET_E_INVALID_URL
,FALSE
,
5372 0,0,0,INET_E_INVALID_URL
,FALSE
5374 { "http://google.com/",0,S_OK
,FALSE
,
5376 {TRUE
,"ht%xxtp",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
5379 0,INET_E_INVALID_URL
,FALSE
,
5380 0,INET_E_INVALID_URL
,FALSE
,
5381 0,0,0,INET_E_INVALID_URL
,FALSE
5383 /* File scheme's can't have a username set. */
5384 { "file://google.com/",0,S_OK
,FALSE
,
5386 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5389 0,INET_E_INVALID_URL
,FALSE
,
5390 0,INET_E_INVALID_URL
,FALSE
,
5391 0,0,0,INET_E_INVALID_URL
,FALSE
5393 /* File schemes can't have a password set. */
5394 { "file://google.com/",0,S_OK
,FALSE
,
5396 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5399 0,INET_E_INVALID_URL
,FALSE
,
5400 0,INET_E_INVALID_URL
,FALSE
,
5401 0,0,0,INET_E_INVALID_URL
,FALSE
5403 /* UserName can't contain any character that is a delimeter for another
5404 * component that appears after it in a normal URI.
5406 { "http://google.com/",0,S_OK
,FALSE
,
5408 {TRUE
,"user:pass",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5411 0,INET_E_INVALID_URL
,FALSE
,
5412 0,INET_E_INVALID_URL
,FALSE
,
5413 0,0,0,INET_E_INVALID_URL
,FALSE
5415 { "http://google.com/",0,S_OK
,FALSE
,
5417 {TRUE
,"user@google.com",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5420 0,INET_E_INVALID_URL
,FALSE
,
5421 0,INET_E_INVALID_URL
,FALSE
,
5422 0,0,0,INET_E_INVALID_URL
,FALSE
5424 { "http://google.com/",0,S_OK
,FALSE
,
5426 {TRUE
,"user/path",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5429 0,INET_E_INVALID_URL
,FALSE
,
5430 0,INET_E_INVALID_URL
,FALSE
,
5431 0,0,0,INET_E_INVALID_URL
,FALSE
5433 { "http://google.com/",0,S_OK
,FALSE
,
5435 {TRUE
,"user?Query",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5438 0,INET_E_INVALID_URL
,FALSE
,
5439 0,INET_E_INVALID_URL
,FALSE
,
5440 0,0,0,INET_E_INVALID_URL
,FALSE
5442 { "http://google.com/",0,S_OK
,FALSE
,
5444 {TRUE
,"user#Frag",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5447 0,INET_E_INVALID_URL
,FALSE
,
5448 0,INET_E_INVALID_URL
,FALSE
,
5449 0,0,0,INET_E_INVALID_URL
,FALSE
5451 { "http://google.com/",0,S_OK
,FALSE
,
5453 {TRUE
,"pass@google.com",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5456 0,INET_E_INVALID_URL
,FALSE
,
5457 0,INET_E_INVALID_URL
,FALSE
,
5458 0,0,0,INET_E_INVALID_URL
,FALSE
5460 { "http://google.com/",0,S_OK
,FALSE
,
5462 {TRUE
,"pass/path",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5465 0,INET_E_INVALID_URL
,FALSE
,
5466 0,INET_E_INVALID_URL
,FALSE
,
5467 0,0,0,INET_E_INVALID_URL
,FALSE
5469 { "http://google.com/",0,S_OK
,FALSE
,
5471 {TRUE
,"pass?query",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5474 0,INET_E_INVALID_URL
,FALSE
,
5475 0,INET_E_INVALID_URL
,FALSE
,
5476 0,0,0,INET_E_INVALID_URL
,FALSE
5478 { "http://google.com/",0,S_OK
,FALSE
,
5480 {TRUE
,"pass#frag",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5483 0,INET_E_INVALID_URL
,FALSE
,
5484 0,INET_E_INVALID_URL
,FALSE
,
5485 0,0,0,INET_E_INVALID_URL
,FALSE
5487 { "http://google.com/",0,S_OK
,FALSE
,
5489 {TRUE
,"winehq.org/test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5492 0,INET_E_INVALID_URL
,FALSE
,
5493 0,INET_E_INVALID_URL
,FALSE
,
5494 0,0,0,INET_E_INVALID_URL
,FALSE
5496 { "http://google.com/",0,S_OK
,FALSE
,
5498 {TRUE
,"winehq.org?test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5501 0,INET_E_INVALID_URL
,FALSE
,
5502 0,INET_E_INVALID_URL
,FALSE
,
5503 0,0,0,INET_E_INVALID_URL
,FALSE
5505 { "http://google.com/",0,S_OK
,FALSE
,
5507 {TRUE
,"winehq.org#test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5510 0,INET_E_INVALID_URL
,FALSE
,
5511 0,INET_E_INVALID_URL
,FALSE
,
5512 0,0,0,INET_E_INVALID_URL
,FALSE
5514 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5515 { "http://google.com/",0,S_OK
,FALSE
,
5517 {TRUE
,"winehq.org:test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
5524 {"http://winehq.org:test/",S_OK
},
5525 {"winehq.org:test",S_OK
},
5526 {"http://winehq.org:test/",S_OK
},
5527 {"winehq.org:test",S_OK
},
5530 {"winehq.org:test",S_OK
},
5535 {"http://winehq.org:test/",S_OK
},
5541 {Uri_HOST_DNS
,S_OK
},
5543 {URL_SCHEME_HTTP
,S_OK
},
5544 {URLZONE_INVALID
,E_NOTIMPL
}
5547 /* Can't set the host name to NULL. */
5548 { "http://google.com/",0,S_OK
,FALSE
,
5550 {TRUE
,NULL
,"google.com",Uri_PROPERTY_HOST
,E_INVALIDARG
,FALSE
}
5557 {"http://google.com/",S_OK
},
5558 {"google.com",S_OK
},
5559 {"http://google.com/",S_OK
},
5560 {"google.com",S_OK
},
5563 {"google.com",S_OK
},
5568 {"http://google.com/",S_OK
},
5574 {Uri_HOST_DNS
,S_OK
},
5576 {URL_SCHEME_HTTP
,S_OK
},
5577 {URLZONE_INVALID
,E_NOTIMPL
}
5580 /* Can set the host name to an empty string. */
5581 { "http://google.com/",0,S_OK
,FALSE
,
5583 {TRUE
,"",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5607 {Uri_HOST_UNKNOWN
,S_OK
},
5609 {URL_SCHEME_HTTP
,S_OK
},
5610 {URLZONE_INVALID
,E_NOTIMPL
}
5613 { "http://google.com/",0,S_OK
,FALSE
,
5615 {TRUE
,"/path?query",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5618 0,INET_E_INVALID_URL
,FALSE
,
5619 0,INET_E_INVALID_URL
,FALSE
,
5620 0,0,0,INET_E_INVALID_URL
,FALSE
5622 { "http://google.com/",0,S_OK
,FALSE
,
5624 {TRUE
,"/path#test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5627 0,INET_E_INVALID_URL
,FALSE
,
5628 0,INET_E_INVALID_URL
,FALSE
,
5629 0,0,0,INET_E_INVALID_URL
,FALSE
5631 { "http://google.com/",0,S_OK
,FALSE
,
5633 {TRUE
,"?path#test",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
}
5636 0,INET_E_INVALID_URL
,FALSE
,
5637 0,INET_E_INVALID_URL
,FALSE
,
5638 0,0,0,INET_E_INVALID_URL
,FALSE
5640 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
5642 {TRUE
,NULL
,NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
5649 {"file:///c:/dir/file.html",S_OK
},
5651 {"file:///c:/dir/file.html",S_OK
},
5657 {"/c:/dir/file.html",S_OK
},
5658 {"/c:/dir/file.html",S_OK
},
5660 {"file:///c:/dir/file.html",S_OK
},
5666 {Uri_HOST_UNKNOWN
,S_OK
},
5668 {URL_SCHEME_FILE
,S_OK
},
5669 {URLZONE_INVALID
,E_NOTIMPL
}
5672 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
5674 {TRUE
,"#",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
5681 {"file:///c:/dir/file.html#",S_OK
},
5683 {"file:///c:/dir/file.html#",S_OK
},
5689 {"/c:/dir/file.html",S_OK
},
5690 {"/c:/dir/file.html",S_OK
},
5692 {"file:///c:/dir/file.html#",S_OK
},
5698 {Uri_HOST_UNKNOWN
,S_OK
},
5700 {URL_SCHEME_FILE
,S_OK
},
5701 {URLZONE_INVALID
,E_NOTIMPL
}
5706 typedef struct _uri_builder_remove_test
{
5709 HRESULT create_builder_expected
;
5710 BOOL create_builder_todo
;
5712 DWORD remove_properties
;
5713 HRESULT remove_expected
;
5716 const char *expected_uri
;
5717 DWORD expected_flags
;
5718 HRESULT expected_hres
;
5720 } uri_builder_remove_test
;
5722 static const uri_builder_remove_test uri_builder_remove_tests
[] = {
5723 { "http://google.com/test?test=y#Frag",0,S_OK
,FALSE
,
5724 Uri_HAS_FRAGMENT
|Uri_HAS_PATH
|Uri_HAS_QUERY
,S_OK
,FALSE
,
5725 "http://google.com/",0,S_OK
,FALSE
5727 { "http://user:pass@winehq.org/",0,S_OK
,FALSE
,
5728 Uri_HAS_USER_NAME
|Uri_HAS_PASSWORD
,S_OK
,FALSE
,
5729 "http://winehq.org/",0,S_OK
,FALSE
5731 { "zip://google.com?Test=x",0,S_OK
,FALSE
,
5732 Uri_HAS_HOST
,S_OK
,FALSE
,
5733 "zip:/?Test=x",0,S_OK
,FALSE
5735 /* Doesn't remove the whole userinfo component. */
5736 { "http://username:pass@google.com/",0,S_OK
,FALSE
,
5737 Uri_HAS_USER_INFO
,S_OK
,FALSE
,
5738 "http://username:pass@google.com/",0,S_OK
,FALSE
5740 /* Doesn't remove the domain. */
5741 { "http://google.com/",0,S_OK
,FALSE
,
5742 Uri_HAS_DOMAIN
,S_OK
,FALSE
,
5743 "http://google.com/",0,S_OK
,FALSE
5745 { "http://google.com:120/",0,S_OK
,FALSE
,
5746 Uri_HAS_AUTHORITY
,S_OK
,FALSE
,
5747 "http://google.com:120/",0,S_OK
,FALSE
5749 { "http://google.com/test.com/",0,S_OK
,FALSE
,
5750 Uri_HAS_EXTENSION
,S_OK
,FALSE
,
5751 "http://google.com/test.com/",0,S_OK
,FALSE
5753 { "http://google.com/?test=x",0,S_OK
,FALSE
,
5754 Uri_HAS_PATH_AND_QUERY
,S_OK
,FALSE
,
5755 "http://google.com/?test=x",0,S_OK
,FALSE
5757 /* Can't remove the scheme name. */
5758 { "http://google.com/?test=x",0,S_OK
,FALSE
,
5759 Uri_HAS_SCHEME_NAME
|Uri_HAS_QUERY
,E_INVALIDARG
,FALSE
,
5760 "http://google.com/?test=x",0,S_OK
,FALSE
5764 typedef struct _uri_combine_str_property
{
5768 const char *broken_value
;
5769 const char *value_ex
;
5770 } uri_combine_str_property
;
5772 typedef struct _uri_combine_test
{
5773 const char *base_uri
;
5774 DWORD base_create_flags
;
5775 const char *relative_uri
;
5776 DWORD relative_create_flags
;
5777 DWORD combine_flags
;
5781 uri_combine_str_property str_props
[URI_STR_PROPERTY_COUNT
];
5782 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
5785 static const uri_combine_test uri_combine_tests
[] = {
5786 { "http://google.com/fun/stuff",0,
5787 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE
,
5790 {"http://google.com/not/fun/stuff",S_OK
},
5791 {"google.com",S_OK
},
5792 {"http://google.com/not/fun/stuff",S_OK
},
5793 {"google.com",S_OK
},
5796 {"google.com",S_OK
},
5798 {"/not/fun/stuff",S_OK
},
5799 {"/not/fun/stuff",S_OK
},
5801 {"http://google.com/not/fun/stuff",S_OK
},
5807 {Uri_HOST_DNS
,S_OK
},
5809 {URL_SCHEME_HTTP
,S_OK
},
5810 {URLZONE_INVALID
,E_NOTIMPL
}
5813 { "http://google.com/test",0,
5814 "zip://test.com/cool",0,
5817 {"zip://test.com/cool",S_OK
},
5819 {"zip://test.com/cool",S_OK
},
5828 {"zip://test.com/cool",S_OK
},
5834 {Uri_HOST_DNS
,S_OK
},
5836 {URL_SCHEME_UNKNOWN
,S_OK
},
5837 {URLZONE_INVALID
,E_NOTIMPL
}
5840 { "http://google.com/use/base/path",0,
5841 "?relative",Uri_CREATE_ALLOW_RELATIVE
,
5844 {"http://google.com/use/base/path?relative",S_OK
},
5845 {"google.com",S_OK
},
5846 {"http://google.com/use/base/path?relative",S_OK
},
5847 {"google.com",S_OK
},
5850 {"google.com",S_OK
},
5852 {"/use/base/path",S_OK
},
5853 {"/use/base/path?relative",S_OK
},
5855 {"http://google.com/use/base/path?relative",S_OK
},
5861 {Uri_HOST_DNS
,S_OK
},
5863 {URL_SCHEME_HTTP
,S_OK
},
5864 {URLZONE_INVALID
,E_NOTIMPL
}
5867 { "http://google.com/path",0,
5868 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
5871 {"http://google.com/testing",S_OK
},
5872 {"google.com",S_OK
},
5873 {"http://google.com/testing",S_OK
},
5874 {"google.com",S_OK
},
5877 {"google.com",S_OK
},
5882 {"http://google.com/testing",S_OK
},
5888 {Uri_HOST_DNS
,S_OK
},
5890 {URL_SCHEME_HTTP
,S_OK
},
5891 {URLZONE_INVALID
,E_NOTIMPL
}
5894 { "http://google.com/path",0,
5895 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
5896 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
5898 {"http://google.com:80/test/../test/.././testing",S_OK
},
5899 {"google.com",S_OK
},
5900 {"http://google.com:80/test/../test/.././testing",S_OK
},
5901 {"google.com",S_OK
},
5904 {"google.com",S_OK
},
5906 {"/test/../test/.././testing",S_OK
},
5907 {"/test/../test/.././testing",S_OK
},
5909 {"http://google.com:80/test/../test/.././testing",S_OK
},
5915 {Uri_HOST_DNS
,S_OK
},
5917 {URL_SCHEME_HTTP
,S_OK
},
5918 {URLZONE_INVALID
,E_NOTIMPL
}
5921 { "http://winehq.org/test/abc",0,
5922 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
5925 {"http://winehq.org/test/testing/test",S_OK
},
5926 {"winehq.org",S_OK
},
5927 {"http://winehq.org/test/testing/test",S_OK
},
5928 {"winehq.org",S_OK
},
5931 {"winehq.org",S_OK
},
5933 {"/test/testing/test",S_OK
},
5934 {"/test/testing/test",S_OK
},
5936 {"http://winehq.org/test/testing/test",S_OK
},
5942 {Uri_HOST_DNS
,S_OK
},
5944 {URL_SCHEME_HTTP
,S_OK
},
5945 {URLZONE_INVALID
,E_NOTIMPL
}
5948 { "http://winehq.org/test/abc",0,
5949 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
5950 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
5952 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
5953 /* Default port is hidden in the authority. */
5954 {"winehq.org",S_OK
},
5955 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
5956 {"winehq.org",S_OK
},
5959 {"winehq.org",S_OK
},
5961 {"/test/testing/abc/../test",S_OK
},
5962 {"/test/testing/abc/../test",S_OK
},
5964 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
5970 {Uri_HOST_DNS
,S_OK
},
5972 {URL_SCHEME_HTTP
,S_OK
},
5973 {URLZONE_INVALID
,E_NOTIMPL
}
5976 { "http://winehq.org/test?query",0,
5977 "testing",Uri_CREATE_ALLOW_RELATIVE
,
5980 {"http://winehq.org/testing",S_OK
},
5981 {"winehq.org",S_OK
},
5982 {"http://winehq.org/testing",S_OK
},
5983 {"winehq.org",S_OK
},
5986 {"winehq.org",S_OK
},
5991 {"http://winehq.org/testing",S_OK
},
5997 {Uri_HOST_DNS
,S_OK
},
5999 {URL_SCHEME_HTTP
,S_OK
},
6000 {URLZONE_INVALID
,E_NOTIMPL
}
6003 { "http://winehq.org/test#frag",0,
6004 "testing",Uri_CREATE_ALLOW_RELATIVE
,
6007 {"http://winehq.org/testing",S_OK
},
6008 {"winehq.org",S_OK
},
6009 {"http://winehq.org/testing",S_OK
},
6010 {"winehq.org",S_OK
},
6013 {"winehq.org",S_OK
},
6018 {"http://winehq.org/testing",S_OK
},
6024 {Uri_HOST_DNS
,S_OK
},
6026 {URL_SCHEME_HTTP
,S_OK
},
6027 {URLZONE_INVALID
,E_NOTIMPL
}
6030 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE
,
6031 "test",Uri_CREATE_ALLOW_RELATIVE
,
6051 {Uri_HOST_UNKNOWN
,S_OK
},
6053 {URL_SCHEME_UNKNOWN
,S_OK
},
6054 {URLZONE_INVALID
,E_NOTIMPL
}
6057 { "file:///c:/test/test",0,
6058 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6059 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6061 {"file://c:\\testing.mp3",S_OK
},
6063 {"file://c:\\testing.mp3",S_OK
},
6069 {"c:\\testing.mp3",S_OK
},
6070 {"c:\\testing.mp3",S_OK
},
6072 {"file://c:\\testing.mp3",S_OK
},
6078 {Uri_HOST_UNKNOWN
,S_OK
},
6080 {URL_SCHEME_FILE
,S_OK
},
6081 {URLZONE_INVALID
,E_NOTIMPL
}
6084 { "file:///c:/test/test",0,
6085 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6088 {"file:///c:/testing.mp3",S_OK
},
6090 {"file:///c:/testing.mp3",S_OK
},
6096 {"/c:/testing.mp3",S_OK
},
6097 {"/c:/testing.mp3",S_OK
},
6099 {"file:///c:/testing.mp3",S_OK
},
6105 {Uri_HOST_UNKNOWN
,S_OK
},
6107 {URL_SCHEME_FILE
,S_OK
},
6108 {URLZONE_INVALID
,E_NOTIMPL
}
6111 { "file://test.com/test/test",0,
6112 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6113 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6115 {"file://\\\\test.com\\testing.mp3",S_OK
},
6117 {"file://\\\\test.com\\testing.mp3",S_OK
},
6123 {"\\testing.mp3",S_OK
},
6124 {"\\testing.mp3",S_OK
},
6126 {"file://\\\\test.com\\testing.mp3",S_OK
},
6132 {Uri_HOST_DNS
,S_OK
},
6134 {URL_SCHEME_FILE
,S_OK
},
6135 {URLZONE_INVALID
,E_NOTIMPL
}
6138 /* URL_DONT_SIMPLIFY has no effect. */
6139 { "http://google.com/test",0,
6140 "zip://test.com/cool/../cool/test",0,
6141 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6143 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6145 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6151 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6152 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6154 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6155 * On IE 7 it reduces the path in the Raw URI.
6157 {"zip://test.com/cool/../cool/test",S_OK
,FALSE
,"zip://test.com/cool/test"},
6163 {Uri_HOST_DNS
,S_OK
},
6165 {URL_SCHEME_UNKNOWN
,S_OK
},
6166 {URLZONE_INVALID
,E_NOTIMPL
}
6169 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6170 * resulting URI is converted into a dos path.
6172 { "http://google.com/test",0,
6173 "file:///c:/test/",0,
6174 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6176 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6178 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6184 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6185 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6187 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6193 {Uri_HOST_UNKNOWN
,S_OK
},
6195 {URL_SCHEME_FILE
,S_OK
},
6196 {URLZONE_INVALID
,E_NOTIMPL
}
6199 { "http://google.com/test",0,
6200 "http://test.com/test#%30test",0,
6201 URL_DONT_UNESCAPE_EXTRA_INFO
,S_OK
,FALSE
,
6203 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6205 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6208 {"#0test",S_OK
,FALSE
,NULL
,"#%30test"},
6214 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6215 {"http://test.com/test#%30test",S_OK
,FALSE
,"http://test.com/test#0test"},
6221 {Uri_HOST_DNS
,S_OK
},
6223 {URL_SCHEME_HTTP
,S_OK
},
6224 {URLZONE_INVALID
,E_NOTIMPL
}
6227 /* Windows validates the path component from the relative Uri. */
6228 { "http://google.com/test",0,
6229 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE
,
6230 0,E_INVALIDARG
,FALSE
6232 /* Windows doesn't validate the query from the relative Uri. */
6233 { "http://google.com/test",0,
6234 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6237 {"http://google.com/test?Tes%XXt",S_OK
},
6238 {"google.com",S_OK
},
6239 {"http://google.com/test?Tes%XXt",S_OK
},
6240 {"google.com",S_OK
},
6243 {"google.com",S_OK
},
6246 {"/test?Tes%XXt",S_OK
},
6248 {"http://google.com/test?Tes%XXt",S_OK
},
6254 {Uri_HOST_DNS
,S_OK
},
6256 {URL_SCHEME_HTTP
,S_OK
},
6257 {URLZONE_INVALID
,E_NOTIMPL
}
6260 /* Windows doesn't validate the fragment from the relative Uri. */
6261 { "http://google.com/test",0,
6262 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6265 {"http://google.com/test#Tes%XXt",S_OK
},
6266 {"google.com",S_OK
},
6267 {"http://google.com/test#Tes%XXt",S_OK
},
6268 {"google.com",S_OK
},
6271 {"google.com",S_OK
},
6276 {"http://google.com/test#Tes%XXt",S_OK
},
6282 {Uri_HOST_DNS
,S_OK
},
6284 {URL_SCHEME_HTTP
,S_OK
},
6285 {URLZONE_INVALID
,E_NOTIMPL
}
6288 /* Creates an IUri which contains an invalid dos path char. */
6289 { "file:///c:/test",0,
6290 "/test<ing",Uri_CREATE_ALLOW_RELATIVE
,
6291 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6293 {"file://c:\\test<ing",S_OK
},
6295 {"file://c:\\test<ing",S_OK
},
6301 {"c:\\test<ing",S_OK
},
6302 {"c:\\test<ing",S_OK
},
6304 {"file://c:\\test<ing",S_OK
},
6310 {Uri_HOST_UNKNOWN
,S_OK
},
6312 {URL_SCHEME_FILE
,S_OK
},
6313 {URLZONE_INVALID
,E_NOTIMPL
}
6316 /* Appends the path after the drive letter (if any). */
6317 { "file:///c:/test",0,
6318 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE
,
6321 {"file:///c:/c:/testing",S_OK
},
6323 {"file:///c:/c:/testing",S_OK
},
6329 {"/c:/c:/testing",S_OK
},
6330 {"/c:/c:/testing",S_OK
},
6332 {"file:///c:/c:/testing",S_OK
},
6338 {Uri_HOST_UNKNOWN
,S_OK
},
6340 {URL_SCHEME_FILE
,S_OK
},
6341 {URLZONE_INVALID
,E_NOTIMPL
}
6344 /* A '/' is added if the base URI doesn't have a path and the
6345 * relative URI doesn't contain a path (since the base URI is
6348 { "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
6349 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6352 {"http://google.com/?test",S_OK
},
6353 {"google.com",S_OK
},
6354 {"http://google.com/?test",S_OK
},
6355 {"google.com",S_OK
},
6358 {"google.com",S_OK
},
6363 {"http://google.com/?test",S_OK
},
6369 {Uri_HOST_DNS
,S_OK
},
6371 {URL_SCHEME_HTTP
,S_OK
},
6372 {URLZONE_INVALID
,E_NOTIMPL
}
6375 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE
,
6376 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6379 {"zip://google.com/?test",S_OK
},
6380 {"google.com",S_OK
},
6381 {"zip://google.com/?test",S_OK
},
6382 {"google.com",S_OK
},
6385 {"google.com",S_OK
},
6390 {"zip://google.com/?test",S_OK
},
6396 {Uri_HOST_DNS
,S_OK
},
6398 {URL_SCHEME_UNKNOWN
,S_OK
},
6399 {URLZONE_INVALID
,E_NOTIMPL
}
6402 /* No path is appended since the base URI is opaque. */
6404 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6424 {Uri_HOST_UNKNOWN
,S_OK
},
6426 {URL_SCHEME_UNKNOWN
,S_OK
},
6427 {URLZONE_INVALID
,E_NOTIMPL
}
6431 "../testing/test",Uri_CREATE_ALLOW_RELATIVE
,
6434 {"file:///c:/testing/test",S_OK
},
6436 {"file:///c:/testing/test",S_OK
},
6442 {"/c:/testing/test",S_OK
},
6443 {"/c:/testing/test",S_OK
},
6445 {"file:///c:/testing/test",S_OK
},
6451 {Uri_HOST_UNKNOWN
,S_OK
},
6453 {URL_SCHEME_FILE
,S_OK
},
6454 {URLZONE_INVALID
,E_NOTIMPL
}
6457 { "http://winehq.org/dir/testfile",0,
6458 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
6461 {"http://winehq.org/dir/test?querystring",S_OK
},
6462 {"winehq.org",S_OK
},
6463 {"http://winehq.org/dir/test?querystring",S_OK
},
6464 {"winehq.org",S_OK
},
6467 {"winehq.org",S_OK
},
6470 {"/dir/test?querystring",S_OK
},
6471 {"?querystring",S_OK
},
6472 {"http://winehq.org/dir/test?querystring",S_OK
},
6478 {Uri_HOST_DNS
,S_OK
},
6480 {URL_SCHEME_HTTP
,S_OK
},
6481 {URLZONE_INVALID
,E_NOTIMPL
}
6484 { "http://winehq.org/dir/test",0,
6485 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
6488 {"http://winehq.org/dir/test?querystring",S_OK
},
6489 {"winehq.org",S_OK
},
6490 {"http://winehq.org/dir/test?querystring",S_OK
},
6491 {"winehq.org",S_OK
},
6494 {"winehq.org",S_OK
},
6497 {"/dir/test?querystring",S_OK
},
6498 {"?querystring",S_OK
},
6499 {"http://winehq.org/dir/test?querystring",S_OK
},
6505 {Uri_HOST_DNS
,S_OK
},
6507 {URL_SCHEME_HTTP
,S_OK
},
6508 {URLZONE_INVALID
,E_NOTIMPL
}
6511 { "http://winehq.org/dir/test?querystring",0,
6512 "#hash",Uri_CREATE_ALLOW_RELATIVE
,
6515 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6516 {"winehq.org",S_OK
},
6517 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6518 {"winehq.org",S_OK
},
6521 {"winehq.org",S_OK
},
6524 {"/dir/test?querystring",S_OK
},
6525 {"?querystring",S_OK
},
6526 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6532 {Uri_HOST_DNS
,S_OK
},
6534 {URL_SCHEME_HTTP
,S_OK
},
6535 {URLZONE_INVALID
,E_NOTIMPL
}
6538 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6539 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6542 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6544 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6550 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6551 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6553 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6559 {Uri_HOST_UNKNOWN
,S_OK
},
6561 {URL_SCHEME_MK
,S_OK
},
6562 {URLZONE_INVALID
,E_NOTIMPL
}
6565 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6566 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6569 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6571 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6577 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6578 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6580 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6586 {Uri_HOST_UNKNOWN
,S_OK
},
6588 {URL_SCHEME_MK
,S_OK
},
6589 {URLZONE_INVALID
,E_NOTIMPL
}
6592 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6593 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6596 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6598 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6604 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6605 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6607 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6613 {Uri_HOST_UNKNOWN
,S_OK
},
6615 {URL_SCHEME_MK
,S_OK
},
6616 {URLZONE_INVALID
,E_NOTIMPL
}
6621 typedef struct _uri_parse_test
{
6626 const char *property
;
6631 static const uri_parse_test uri_parse_tests
[] = {
6632 /* PARSE_CANONICALIZE tests. */
6633 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"zip://google.com/test<|>",S_OK
,FALSE
},
6634 {"http://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"http://google.com/test%3C%7C%3E",S_OK
,FALSE
},
6635 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE
,URL_UNESCAPE
,"http://google.com/0#?",S_OK
,FALSE
},
6636 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_UNSAFE
,"test %3C%7C%3E",S_OK
,FALSE
},
6637 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_SPACES_ONLY
,"test%20<|>",S_OK
,FALSE
},
6638 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_UNESCAPE
|URL_ESCAPE_UNSAFE
,"test%20%3C%7C%3E",S_OK
,FALSE
},
6639 {"http://google.com/%20",0,PARSE_CANONICALIZE
,URL_ESCAPE_PERCENT
,"http://google.com/%2520",S_OK
,FALSE
},
6640 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"http://google.com/test/../",S_OK
,FALSE
},
6641 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_NO_META
,"http://google.com/test/../",S_OK
,FALSE
},
6642 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"http://google.com/",S_OK
,FALSE
},
6643 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"zip://google.com/",S_OK
,FALSE
},
6644 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"file:///c:/test/../test",S_OK
,FALSE
},
6646 /* PARSE_FRIENDLY tests. */
6647 {"http://test@google.com/test#test",0,PARSE_FRIENDLY
,0,"http://google.com/test#test",S_OK
,FALSE
},
6648 {"zip://test@google.com/test",0,PARSE_FRIENDLY
,0,"zip://test@google.com/test",S_OK
,FALSE
},
6650 /* PARSE_ROOTDOCUMENT tests. */
6651 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT
,0,"http://google.com:200/",S_OK
,FALSE
},
6652 {"http://google.com",Uri_CREATE_NO_CANONICALIZE
,PARSE_ROOTDOCUMENT
,0,"http://google.com/",S_OK
,FALSE
},
6653 {"zip://google.com/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6654 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6655 {"file://server/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6656 {"zip:test/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6658 /* PARSE_DOCUMENT tests. */
6659 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT
,0,"http://test@google.com/test?query",S_OK
,FALSE
},
6660 {"http:testing#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6661 {"file:///c:/test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6662 {"zip://google.com/#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6663 {"zip:test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6664 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6666 /* PARSE_PATH_FROM_URL tests. */
6667 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\test.mp3",S_OK
,FALSE
},
6668 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\t<|>est.mp3",S_OK
,FALSE
},
6669 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL
,0,"c:\\te%XX t\\",S_OK
,FALSE
},
6670 {"file://server/test",0,PARSE_PATH_FROM_URL
,0,"\\\\server\\test",S_OK
,FALSE
},
6671 {"http://google.com/",0,PARSE_PATH_FROM_URL
,0,"",E_INVALIDARG
,FALSE
},
6673 /* PARSE_URL_FROM_PATH tests. */
6674 /* This function almost seems to useless (just returns the absolute uri). */
6675 {"test.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"test.com",S_OK
,FALSE
},
6676 {"/test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"/test/test",S_OK
,FALSE
},
6677 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH
,PARSE_URL_FROM_PATH
,0,"file://c:\\test\\test",S_OK
,FALSE
},
6678 {"file:c:/test",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
6679 {"http:google.com/",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
6681 /* PARSE_SCHEMA tests. */
6682 {"http://google.com/test",0,PARSE_SCHEMA
,0,"http",S_OK
,FALSE
},
6683 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SCHEMA
,0,"",S_OK
,FALSE
},
6685 /* PARSE_SITE tests. */
6686 {"http://google.uk.com/",0,PARSE_SITE
,0,"google.uk.com",S_OK
,FALSE
},
6687 {"http://google.com.com/",0,PARSE_SITE
,0,"google.com.com",S_OK
,FALSE
},
6688 {"google.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SITE
,0,"",S_OK
,FALSE
},
6689 {"file://server/test",0,PARSE_SITE
,0,"server",S_OK
,FALSE
},
6691 /* PARSE_DOMAIN tests. */
6692 {"http://google.com.uk/",0,PARSE_DOMAIN
,0,"google.com.uk",S_OK
,FALSE
},
6693 {"http://google.com.com/",0,PARSE_DOMAIN
,0,"com.com",S_OK
,FALSE
},
6694 {"test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
6695 {"file://server/test",0,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
6697 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6698 {"http://google.com/test#Test",0,PARSE_ANCHOR
,0,"#Test",S_OK
,FALSE
},
6699 {"http://google.com/test#Test",0,PARSE_LOCATION
,0,"#Test",S_OK
,FALSE
},
6700 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_ANCHOR
,0,"",S_OK
,FALSE
},
6701 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_LOCATION
,0,"",S_OK
,FALSE
}
6704 static inline LPWSTR
a2w(LPCSTR str
) {
6708 DWORD len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
6709 ret
= HeapAlloc(GetProcessHeap(), 0, len
*sizeof(WCHAR
));
6710 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
6716 static inline BOOL
heap_free(void* mem
) {
6717 return HeapFree(GetProcessHeap(), 0, mem
);
6720 static inline DWORD
strcmp_aw(LPCSTR strA
, LPCWSTR strB
) {
6721 LPWSTR strAW
= a2w(strA
);
6722 DWORD ret
= lstrcmpW(strAW
, strB
);
6727 static inline ULONG
get_refcnt(IUri
*uri
) {
6729 return IUri_Release(uri
);
6732 static void change_property(IUriBuilder
*builder
, const uri_builder_property
*prop
,
6737 valueW
= a2w(prop
->value
);
6738 switch(prop
->property
) {
6739 case Uri_PROPERTY_FRAGMENT
:
6740 hr
= IUriBuilder_SetFragment(builder
, valueW
);
6743 ok(hr
== prop
->expected
,
6744 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6745 hr
, prop
->expected
, test_index
);
6748 ok(hr
== prop
->expected
,
6749 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6750 hr
, prop
->expected
, test_index
);
6753 case Uri_PROPERTY_HOST
:
6754 hr
= IUriBuilder_SetHost(builder
, valueW
);
6757 ok(hr
== prop
->expected
,
6758 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6759 hr
, prop
->expected
, test_index
);
6762 ok(hr
== prop
->expected
,
6763 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6764 hr
, prop
->expected
, test_index
);
6767 case Uri_PROPERTY_PASSWORD
:
6768 hr
= IUriBuilder_SetPassword(builder
, valueW
);
6771 ok(hr
== prop
->expected
,
6772 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6773 hr
, prop
->expected
, test_index
);
6776 ok(hr
== prop
->expected
,
6777 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6778 hr
, prop
->expected
, test_index
);
6781 case Uri_PROPERTY_PATH
:
6782 hr
= IUriBuilder_SetPath(builder
, valueW
);
6785 ok(hr
== prop
->expected
,
6786 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6787 hr
, prop
->expected
, test_index
);
6790 ok(hr
== prop
->expected
,
6791 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6792 hr
, prop
->expected
, test_index
);
6795 case Uri_PROPERTY_QUERY
:
6796 hr
= IUriBuilder_SetQuery(builder
, valueW
);
6799 ok(hr
== prop
->expected
,
6800 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6801 hr
, prop
->expected
, test_index
);
6804 ok(hr
== prop
->expected
,
6805 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6806 hr
, prop
->expected
, test_index
);
6809 case Uri_PROPERTY_SCHEME_NAME
:
6810 hr
= IUriBuilder_SetSchemeName(builder
, valueW
);
6813 ok(hr
== prop
->expected
,
6814 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6815 hr
, prop
->expected
, test_index
);
6818 ok(hr
== prop
->expected
,
6819 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6820 hr
, prop
->expected
, test_index
);
6823 case Uri_PROPERTY_USER_NAME
:
6824 hr
= IUriBuilder_SetUserName(builder
, valueW
);
6827 ok(hr
== prop
->expected
,
6828 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6829 hr
, prop
->expected
, test_index
);
6832 ok(hr
== prop
->expected
,
6833 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6834 hr
, prop
->expected
, test_index
);
6838 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop
->property
, test_index
);
6845 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6848 static void test_CreateUri_InvalidFlags(void) {
6851 for(i
= 0; i
< sizeof(invalid_flag_tests
)/sizeof(invalid_flag_tests
[0]); ++i
) {
6853 IUri
*uri
= (void*) 0xdeadbeef;
6855 hr
= pCreateUri(http_urlW
, invalid_flag_tests
[i
].flags
, 0, &uri
);
6856 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6857 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
6858 ok(uri
== NULL
, "Error: expected the IUri to be NULL, but it was %p instead\n", uri
);
6862 static void test_CreateUri_InvalidArgs(void) {
6864 IUri
*uri
= (void*) 0xdeadbeef;
6866 const WCHAR invalidW
[] = {'i','n','v','a','l','i','d',0};
6867 static const WCHAR emptyW
[] = {0};
6869 hr
= pCreateUri(http_urlW
, 0, 0, NULL
);
6870 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
6872 hr
= pCreateUri(NULL
, 0, 0, &uri
);
6873 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
6874 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
6876 uri
= (void*) 0xdeadbeef;
6877 hr
= pCreateUri(invalidW
, 0, 0, &uri
);
6878 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
6879 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
6881 uri
= (void*) 0xdeadbeef;
6882 hr
= pCreateUri(emptyW
, 0, 0, &uri
);
6883 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
6884 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
6887 static void test_CreateUri_InvalidUri(void) {
6890 for(i
= 0; i
< sizeof(invalid_uri_tests
)/sizeof(invalid_uri_tests
[0]); ++i
) {
6891 invalid_uri test
= invalid_uri_tests
[i
];
6896 uriW
= a2w(test
.uri
);
6897 hr
= pCreateUri(uriW
, test
.flags
, 0, &uri
);
6900 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6901 hr
, E_INVALIDARG
, i
);
6904 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6905 hr
, E_INVALIDARG
, i
);
6907 if(uri
) IUri_Release(uri
);
6913 static void test_IUri_GetPropertyBSTR(void) {
6918 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6919 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
6920 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
6922 BSTR received
= NULL
;
6924 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, NULL
, 0);
6925 ok(hr
== E_POINTER
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
6927 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6928 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_PORT
, &received
, 0);
6929 ok(hr
== S_OK
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
6930 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
6931 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
6932 SysFreeString(received
);
6934 /* Make sure it handles the ZONE property correctly. */
6936 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_ZONE
, &received
, 0);
6937 ok(hr
== S_FALSE
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, S_FALSE
);
6938 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
6939 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
6940 SysFreeString(received
);
6942 if(uri
) IUri_Release(uri
);
6944 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
6945 uri_properties test
= uri_tests
[i
];
6949 uriW
= a2w(test
.uri
);
6950 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
6951 if(test
.create_todo
) {
6953 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6954 hr
, test
.create_expected
, i
);
6957 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6958 hr
, test
.create_expected
, i
);
6964 /* Checks all the string properties of the uri. */
6965 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
6966 BSTR received
= NULL
;
6967 uri_str_property prop
= test
.str_props
[j
];
6969 hr
= IUri_GetPropertyBSTR(uri
, j
, &received
, 0);
6972 ok(hr
== prop
.expected
, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6973 hr
, prop
.expected
, i
, j
);
6976 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
6977 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6978 prop
.value
, wine_dbgstr_w(received
), i
, j
);
6981 ok(hr
== prop
.expected
, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6982 hr
, prop
.expected
, i
, j
);
6983 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
6984 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6985 prop
.value
, wine_dbgstr_w(received
), i
, j
);
6988 SysFreeString(received
);
6992 if(uri
) IUri_Release(uri
);
6998 static void test_IUri_GetPropertyDWORD(void) {
7003 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7004 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7006 DWORD received
= 0xdeadbeef;
7008 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_DWORD_START
, NULL
, 0);
7009 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7011 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_ABSOLUTE_URI
, &received
, 0);
7012 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7013 ok(received
== 0, "Error: Expected received=%d but instead received=%d.\n", 0, received
);
7015 if(uri
) IUri_Release(uri
);
7017 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7018 uri_properties test
= uri_tests
[i
];
7022 uriW
= a2w(test
.uri
);
7023 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7024 if(test
.create_todo
) {
7026 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7027 hr
, test
.create_expected
, i
);
7030 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7031 hr
, test
.create_expected
, i
);
7037 /* Checks all the DWORD properties of the uri. */
7038 for(j
= 0; j
< sizeof(test
.dword_props
)/sizeof(test
.dword_props
[0]); ++j
) {
7040 uri_dword_property prop
= test
.dword_props
[j
];
7042 hr
= IUri_GetPropertyDWORD(uri
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
7045 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7046 hr
, prop
.expected
, i
, j
);
7049 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7050 prop
.value
, received
, i
, j
);
7053 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7054 hr
, prop
.expected
, i
, j
);
7055 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7056 prop
.value
, received
, i
, j
);
7061 if(uri
) IUri_Release(uri
);
7067 /* Tests all the 'Get*' property functions which deal with strings. */
7068 static void test_IUri_GetStrProperties(void) {
7073 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7074 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7075 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7077 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
7078 ok(hr
== E_POINTER
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7080 hr
= IUri_GetAuthority(uri
, NULL
);
7081 ok(hr
== E_POINTER
, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7083 hr
= IUri_GetDisplayUri(uri
, NULL
);
7084 ok(hr
== E_POINTER
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7086 hr
= IUri_GetDomain(uri
, NULL
);
7087 ok(hr
== E_POINTER
, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7089 hr
= IUri_GetExtension(uri
, NULL
);
7090 ok(hr
== E_POINTER
, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7092 hr
= IUri_GetFragment(uri
, NULL
);
7093 ok(hr
== E_POINTER
, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7095 hr
= IUri_GetHost(uri
, NULL
);
7096 ok(hr
== E_POINTER
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7098 hr
= IUri_GetPassword(uri
, NULL
);
7099 ok(hr
== E_POINTER
, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7101 hr
= IUri_GetPath(uri
, NULL
);
7102 ok(hr
== E_POINTER
, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7104 hr
= IUri_GetPathAndQuery(uri
, NULL
);
7105 ok(hr
== E_POINTER
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7107 hr
= IUri_GetQuery(uri
, NULL
);
7108 ok(hr
== E_POINTER
, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7110 hr
= IUri_GetRawUri(uri
, NULL
);
7111 ok(hr
== E_POINTER
, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7113 hr
= IUri_GetSchemeName(uri
, NULL
);
7114 ok(hr
== E_POINTER
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7116 hr
= IUri_GetUserInfo(uri
, NULL
);
7117 ok(hr
== E_POINTER
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7119 hr
= IUri_GetUserName(uri
, NULL
);
7120 ok(hr
== E_POINTER
, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7122 if(uri
) IUri_Release(uri
);
7124 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7125 uri_properties test
= uri_tests
[i
];
7129 uriW
= a2w(test
.uri
);
7130 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7131 if(test
.create_todo
) {
7133 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7134 hr
, test
.create_expected
, i
);
7137 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7138 hr
, test
.create_expected
, i
);
7142 uri_str_property prop
;
7143 BSTR received
= NULL
;
7145 /* GetAbsoluteUri() tests. */
7146 prop
= test
.str_props
[Uri_PROPERTY_ABSOLUTE_URI
];
7147 hr
= IUri_GetAbsoluteUri(uri
, &received
);
7150 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7151 hr
, prop
.expected
, i
);
7154 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7155 "Error: Expected %s but got %s on uri_tests[%d].\n",
7156 prop
.value
, wine_dbgstr_w(received
), i
);
7159 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7160 hr
, prop
.expected
, i
);
7161 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7162 "Error: Expected %s but got %s on uri_tests[%d].\n",
7163 prop
.value
, wine_dbgstr_w(received
), i
);
7165 SysFreeString(received
);
7168 /* GetAuthority() tests. */
7169 prop
= test
.str_props
[Uri_PROPERTY_AUTHORITY
];
7170 hr
= IUri_GetAuthority(uri
, &received
);
7173 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7174 hr
, prop
.expected
, i
);
7177 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7178 prop
.value
, wine_dbgstr_w(received
), i
);
7181 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7182 hr
, prop
.expected
, i
);
7183 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7184 prop
.value
, wine_dbgstr_w(received
), i
);
7186 SysFreeString(received
);
7189 /* GetDisplayUri() tests. */
7190 prop
= test
.str_props
[Uri_PROPERTY_DISPLAY_URI
];
7191 hr
= IUri_GetDisplayUri(uri
, &received
);
7194 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7195 hr
, prop
.expected
, i
);
7198 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7199 "Error: Expected %s but got %s on uri_test[%d].\n",
7200 prop
.value
, wine_dbgstr_w(received
), i
);
7203 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7204 hr
, prop
.expected
, i
);
7205 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7206 "Error: Expected %s but got %s on uri_tests[%d].\n",
7207 prop
.value
, wine_dbgstr_w(received
), i
);
7209 SysFreeString(received
);
7212 /* GetDomain() tests. */
7213 prop
= test
.str_props
[Uri_PROPERTY_DOMAIN
];
7214 hr
= IUri_GetDomain(uri
, &received
);
7217 ok(hr
== prop
.expected
, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7218 hr
, prop
.expected
, i
);
7221 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7222 prop
.value
, wine_dbgstr_w(received
), i
);
7225 ok(hr
== prop
.expected
, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7226 hr
, prop
.expected
, i
);
7227 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7228 prop
.value
, wine_dbgstr_w(received
), i
);
7230 SysFreeString(received
);
7233 /* GetExtension() tests. */
7234 prop
= test
.str_props
[Uri_PROPERTY_EXTENSION
];
7235 hr
= IUri_GetExtension(uri
, &received
);
7238 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7239 hr
, prop
.expected
, i
);
7242 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7243 prop
.value
, wine_dbgstr_w(received
), i
);
7246 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7247 hr
, prop
.expected
, i
);
7248 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7249 prop
.value
, wine_dbgstr_w(received
), i
);
7251 SysFreeString(received
);
7254 /* GetFragment() tests. */
7255 prop
= test
.str_props
[Uri_PROPERTY_FRAGMENT
];
7256 hr
= IUri_GetFragment(uri
, &received
);
7259 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7260 hr
, prop
.expected
, i
);
7263 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7264 prop
.value
, wine_dbgstr_w(received
), i
);
7267 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7268 hr
, prop
.expected
, i
);
7269 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7270 prop
.value
, wine_dbgstr_w(received
), i
);
7272 SysFreeString(received
);
7275 /* GetHost() tests. */
7276 prop
= test
.str_props
[Uri_PROPERTY_HOST
];
7277 hr
= IUri_GetHost(uri
, &received
);
7280 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7281 hr
, prop
.expected
, i
);
7284 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7285 prop
.value
, wine_dbgstr_w(received
), i
);
7288 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7289 hr
, prop
.expected
, i
);
7290 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7291 prop
.value
, wine_dbgstr_w(received
), i
);
7293 SysFreeString(received
);
7296 /* GetPassword() tests. */
7297 prop
= test
.str_props
[Uri_PROPERTY_PASSWORD
];
7298 hr
= IUri_GetPassword(uri
, &received
);
7301 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7302 hr
, prop
.expected
, i
);
7305 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7306 prop
.value
, wine_dbgstr_w(received
), i
);
7309 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7310 hr
, prop
.expected
, i
);
7311 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7312 prop
.value
, wine_dbgstr_w(received
), i
);
7314 SysFreeString(received
);
7317 /* GetPath() tests. */
7318 prop
= test
.str_props
[Uri_PROPERTY_PATH
];
7319 hr
= IUri_GetPath(uri
, &received
);
7322 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7323 hr
, prop
.expected
, i
);
7326 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7327 prop
.value
, wine_dbgstr_w(received
), i
);
7330 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7331 hr
, prop
.expected
, i
);
7332 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7333 prop
.value
, wine_dbgstr_w(received
), i
);
7335 SysFreeString(received
);
7338 /* GetPathAndQuery() tests. */
7339 prop
= test
.str_props
[Uri_PROPERTY_PATH_AND_QUERY
];
7340 hr
= IUri_GetPathAndQuery(uri
, &received
);
7343 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7344 hr
, prop
.expected
, i
);
7347 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7348 prop
.value
, wine_dbgstr_w(received
), i
);
7351 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7352 hr
, prop
.expected
, i
);
7353 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7354 prop
.value
, wine_dbgstr_w(received
), i
);
7356 SysFreeString(received
);
7359 /* GetQuery() tests. */
7360 prop
= test
.str_props
[Uri_PROPERTY_QUERY
];
7361 hr
= IUri_GetQuery(uri
, &received
);
7364 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7365 hr
, prop
.expected
, i
);
7368 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7369 prop
.value
, wine_dbgstr_w(received
), i
);
7372 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7373 hr
, prop
.expected
, i
);
7374 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7375 prop
.value
, wine_dbgstr_w(received
), i
);
7377 SysFreeString(received
);
7380 /* GetRawUri() tests. */
7381 prop
= test
.str_props
[Uri_PROPERTY_RAW_URI
];
7382 hr
= IUri_GetRawUri(uri
, &received
);
7385 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7386 hr
, prop
.expected
, i
);
7389 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7390 prop
.value
, wine_dbgstr_w(received
), i
);
7393 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7394 hr
, prop
.expected
, i
);
7395 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7396 prop
.value
, wine_dbgstr_w(received
), i
);
7398 SysFreeString(received
);
7401 /* GetSchemeName() tests. */
7402 prop
= test
.str_props
[Uri_PROPERTY_SCHEME_NAME
];
7403 hr
= IUri_GetSchemeName(uri
, &received
);
7406 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7407 hr
, prop
.expected
, i
);
7410 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7411 prop
.value
, wine_dbgstr_w(received
), i
);
7414 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7415 hr
, prop
.expected
, i
);
7416 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7417 prop
.value
, wine_dbgstr_w(received
), i
);
7419 SysFreeString(received
);
7422 /* GetUserInfo() tests. */
7423 prop
= test
.str_props
[Uri_PROPERTY_USER_INFO
];
7424 hr
= IUri_GetUserInfo(uri
, &received
);
7427 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7428 hr
, prop
.expected
, i
);
7431 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7432 prop
.value
, wine_dbgstr_w(received
), i
);
7435 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7436 hr
, prop
.expected
, i
);
7437 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7438 prop
.value
, wine_dbgstr_w(received
), i
);
7440 SysFreeString(received
);
7443 /* GetUserName() tests. */
7444 prop
= test
.str_props
[Uri_PROPERTY_USER_NAME
];
7445 hr
= IUri_GetUserName(uri
, &received
);
7448 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7449 hr
, prop
.expected
, i
);
7452 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7453 prop
.value
, wine_dbgstr_w(received
), i
);
7456 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7457 hr
, prop
.expected
, i
);
7458 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7459 prop
.value
, wine_dbgstr_w(received
), i
);
7461 SysFreeString(received
);
7464 if(uri
) IUri_Release(uri
);
7470 static void test_IUri_GetDwordProperties(void) {
7475 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7476 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7477 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7479 hr
= IUri_GetHostType(uri
, NULL
);
7480 ok(hr
== E_INVALIDARG
, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7482 hr
= IUri_GetPort(uri
, NULL
);
7483 ok(hr
== E_INVALIDARG
, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7485 hr
= IUri_GetScheme(uri
, NULL
);
7486 ok(hr
== E_INVALIDARG
, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7488 hr
= IUri_GetZone(uri
, NULL
);
7489 ok(hr
== E_INVALIDARG
, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7491 if(uri
) IUri_Release(uri
);
7493 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7494 uri_properties test
= uri_tests
[i
];
7498 uriW
= a2w(test
.uri
);
7499 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7500 if(test
.create_todo
) {
7502 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7503 hr
, test
.create_expected
, i
);
7506 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7507 hr
, test
.create_expected
, i
);
7511 uri_dword_property prop
;
7514 /* Assign an insane value so tests don't accidentally pass when
7517 received
= -9999999;
7519 /* GetHostType() tests. */
7520 prop
= test
.dword_props
[Uri_PROPERTY_HOST_TYPE
-Uri_PROPERTY_DWORD_START
];
7521 hr
= IUri_GetHostType(uri
, &received
);
7524 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7525 hr
, prop
.expected
, i
);
7528 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7531 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7532 hr
, prop
.expected
, i
);
7533 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7535 received
= -9999999;
7537 /* GetPort() tests. */
7538 prop
= test
.dword_props
[Uri_PROPERTY_PORT
-Uri_PROPERTY_DWORD_START
];
7539 hr
= IUri_GetPort(uri
, &received
);
7542 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7543 hr
, prop
.expected
, i
);
7546 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7549 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7550 hr
, prop
.expected
, i
);
7551 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7553 received
= -9999999;
7555 /* GetScheme() tests. */
7556 prop
= test
.dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
];
7557 hr
= IUri_GetScheme(uri
, &received
);
7560 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7561 hr
, prop
.expected
, i
);
7564 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7567 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7568 hr
, prop
.expected
, i
);
7569 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7571 received
= -9999999;
7573 /* GetZone() tests. */
7574 prop
= test
.dword_props
[Uri_PROPERTY_ZONE
-Uri_PROPERTY_DWORD_START
];
7575 hr
= IUri_GetZone(uri
, &received
);
7578 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7579 hr
, prop
.expected
, i
);
7582 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7585 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7586 hr
, prop
.expected
, i
);
7587 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7591 if(uri
) IUri_Release(uri
);
7597 static void test_IUri_GetPropertyLength(void) {
7602 /* Make sure it handles invalid args correctly. */
7603 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7604 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7606 DWORD received
= 0xdeadbeef;
7608 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_STRING_START
, NULL
, 0);
7609 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7611 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_DWORD_START
, &received
, 0);
7612 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7613 ok(received
== 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received
);
7615 if(uri
) IUri_Release(uri
);
7617 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7618 uri_properties test
= uri_tests
[i
];
7622 uriW
= a2w(test
.uri
);
7623 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7624 if(test
.create_todo
) {
7626 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7627 hr
, test
.create_expected
, i
);
7630 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7631 hr
, test
.create_expected
, i
);
7637 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
7638 DWORD expectedLen
, brokenLen
, receivedLen
;
7639 uri_str_property prop
= test
.str_props
[j
];
7641 expectedLen
= lstrlen(prop
.value
);
7642 brokenLen
= lstrlen(prop
.broken_value
);
7644 /* This won't be necessary once GetPropertyLength is implemented. */
7647 hr
= IUri_GetPropertyLength(uri
, j
, &receivedLen
, 0);
7650 ok(hr
== prop
.expected
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7651 hr
, prop
.expected
, i
, j
);
7654 ok(receivedLen
== expectedLen
|| broken(receivedLen
== brokenLen
),
7655 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7656 expectedLen
, receivedLen
, i
, j
);
7659 ok(hr
== prop
.expected
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7660 hr
, prop
.expected
, i
, j
);
7661 ok(receivedLen
== expectedLen
|| broken(receivedLen
== brokenLen
),
7662 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7663 expectedLen
, receivedLen
, i
, j
);
7668 if(uri
) IUri_Release(uri
);
7674 static DWORD
compute_expected_props(uri_properties
*test
)
7678 for(i
=Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_STRING_LAST
; i
++) {
7679 if(test
->str_props
[i
-Uri_PROPERTY_STRING_START
].expected
== S_OK
)
7683 for(i
=Uri_PROPERTY_DWORD_START
; i
<= Uri_PROPERTY_DWORD_LAST
; i
++) {
7684 if(test
->dword_props
[i
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
7691 static void test_IUri_GetProperties(void) {
7696 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7697 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7699 hr
= IUri_GetProperties(uri
, NULL
);
7700 ok(hr
== E_INVALIDARG
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7702 if(uri
) IUri_Release(uri
);
7704 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7705 uri_properties test
= uri_tests
[i
];
7709 uriW
= a2w(test
.uri
);
7710 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7711 if(test
.create_todo
) {
7713 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7716 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7720 DWORD received
= 0, expected_props
;
7723 hr
= IUri_GetProperties(uri
, &received
);
7724 ok(hr
== S_OK
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7726 expected_props
= compute_expected_props(&test
);
7728 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
7729 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7730 if(expected_props
& (1 << j
))
7731 ok(received
& (1 << j
), "Error: Expected flag for property %d on uri_tests[%d].\n", j
, i
);
7733 ok(!(received
& (1 << j
)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j
, i
);
7737 if(uri
) IUri_Release(uri
);
7743 static void test_IUri_HasProperty(void) {
7748 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7749 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7751 hr
= IUri_HasProperty(uri
, Uri_PROPERTY_RAW_URI
, NULL
);
7752 ok(hr
== E_INVALIDARG
, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7754 if(uri
) IUri_Release(uri
);
7756 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7757 uri_properties test
= uri_tests
[i
];
7761 uriW
= a2w(test
.uri
);
7763 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7764 if(test
.create_todo
) {
7766 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7769 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7773 DWORD expected_props
, j
;
7775 expected_props
= compute_expected_props(&test
);
7777 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
7778 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7781 hr
= IUri_HasProperty(uri
, j
, &received
);
7782 ok(hr
== S_OK
, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7785 if(expected_props
& (1 << j
)) {
7786 ok(received
== TRUE
, "Error: Expected to have property %d on uri_tests[%d].\n", j
, i
);
7788 ok(received
== FALSE
, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j
, i
);
7793 if(uri
) IUri_Release(uri
);
7799 static void test_IUri_IsEqual(void) {
7807 /* Make sure IsEqual handles invalid args correctly. */
7808 hres
= pCreateUri(http_urlW
, 0, 0, &uriA
);
7809 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7810 hres
= pCreateUri(http_urlW
, 0, 0, &uriB
);
7811 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7814 hres
= IUri_IsEqual(uriA
, NULL
, &equal
);
7815 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7816 ok(!equal
, "Error: Expected equal to be FALSE, but was %d instead.\n", equal
);
7818 hres
= IUri_IsEqual(uriA
, uriB
, NULL
);
7819 ok(hres
== E_POINTER
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, E_POINTER
);
7824 for(i
= 0; i
< sizeof(equality_tests
)/sizeof(equality_tests
[0]); ++i
) {
7825 uri_equality test
= equality_tests
[i
];
7826 LPWSTR uriA_W
, uriB_W
;
7830 uriA_W
= a2w(test
.a
);
7831 uriB_W
= a2w(test
.b
);
7833 hres
= pCreateUri(uriA_W
, test
.create_flags_a
, 0, &uriA
);
7834 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres
, S_OK
, i
);
7836 hres
= pCreateUri(uriB_W
, test
.create_flags_b
, 0, &uriB
);
7837 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres
, S_OK
, i
);
7840 hres
= IUri_IsEqual(uriA
, uriB
, &equal
);
7841 if(test
.todo
) todo_wine
{
7842 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
7843 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
7845 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
7846 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
7848 if(uriA
) IUri_Release(uriA
);
7849 if(uriB
) IUri_Release(uriB
);
7856 static void test_CreateUriWithFragment_InvalidArgs(void) {
7858 IUri
*uri
= (void*) 0xdeadbeef;
7859 const WCHAR fragmentW
[] = {'#','f','r','a','g','m','e','n','t',0};
7861 hr
= pCreateUriWithFragment(NULL
, fragmentW
, 0, 0, &uri
);
7862 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7863 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
7865 hr
= pCreateUriWithFragment(http_urlW
, fragmentW
, 0, 0, NULL
);
7866 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7868 /* Original URI can't already contain a fragment component. */
7869 uri
= (void*) 0xdeadbeef;
7870 hr
= pCreateUriWithFragment(http_url_fragW
, fragmentW
, 0, 0, &uri
);
7871 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7872 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
7875 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7876 static void test_CreateUriWithFragment_InvalidFlags(void) {
7879 for(i
= 0; i
< sizeof(invalid_flag_tests
)/sizeof(invalid_flag_tests
[0]); ++i
) {
7881 IUri
*uri
= (void*) 0xdeadbeef;
7883 hr
= pCreateUriWithFragment(http_urlW
, NULL
, invalid_flag_tests
[i
].flags
, 0, &uri
);
7884 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7885 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
7886 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
7890 static void test_CreateUriWithFragment(void) {
7893 for(i
= 0; i
< sizeof(uri_fragment_tests
)/sizeof(uri_fragment_tests
[0]); ++i
) {
7897 uri_with_fragment test
= uri_fragment_tests
[i
];
7899 uriW
= a2w(test
.uri
);
7900 fragW
= a2w(test
.fragment
);
7902 hr
= pCreateUriWithFragment(uriW
, fragW
, test
.create_flags
, 0, &uri
);
7903 if(test
.expected_todo
) {
7905 ok(hr
== test
.create_expected
,
7906 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7907 hr
, test
.create_expected
, i
);
7910 ok(hr
== test
.create_expected
,
7911 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7912 hr
, test
.create_expected
, i
);
7915 BSTR received
= NULL
;
7917 hr
= IUri_GetAbsoluteUri(uri
, &received
);
7918 if(test
.expected_todo
) {
7921 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7925 ok(!strcmp_aw(test
.expected_uri
, received
),
7926 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7927 test
.expected_uri
, wine_dbgstr_w(received
), i
);
7930 ok(hr
== S_OK
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7932 ok(!strcmp_aw(test
.expected_uri
, received
), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7933 test
.expected_uri
, wine_dbgstr_w(received
), i
);
7936 SysFreeString(received
);
7939 if(uri
) IUri_Release(uri
);
7945 static void test_CreateIUriBuilder(void) {
7947 IUriBuilder
*builder
= NULL
;
7950 hr
= pCreateIUriBuilder(NULL
, 0, 0, NULL
);
7951 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7954 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7955 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7956 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7958 ULONG cur_count
, orig_count
;
7960 orig_count
= get_refcnt(uri
);
7961 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
7962 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7963 ok(builder
!= NULL
, "Error: Expecting builder not to be NULL\n");
7965 cur_count
= get_refcnt(uri
);
7966 ok(cur_count
== orig_count
+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
+1, cur_count
);
7968 if(builder
) IUriBuilder_Release(builder
);
7969 cur_count
= get_refcnt(uri
);
7970 ok(cur_count
== orig_count
, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
, cur_count
);
7972 if(uri
) IUri_Release(uri
);
7975 static void test_IUriBuilder_CreateUri(IUriBuilder
*builder
, const uri_builder_test
*test
,
7980 hr
= IUriBuilder_CreateUri(builder
, test
->uri_flags
, 0, 0, &uri
);
7981 if(test
->uri_todo
) {
7983 ok(hr
== test
->uri_hres
,
7984 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7985 hr
, test
->uri_hres
, test_index
);
7988 ok(hr
== test
->uri_hres
,
7989 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7990 hr
, test
->uri_hres
, test_index
);
7996 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
7997 uri_builder_str_property prop
= test
->expected_str_props
[i
];
7998 BSTR received
= NULL
;
8000 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8003 ok(hr
== prop
.result
,
8004 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8005 hr
, prop
.result
, test_index
, i
);
8008 ok(hr
== prop
.result
,
8009 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8010 hr
, prop
.result
, test_index
, i
);
8015 ok(!strcmp_aw(prop
.expected
, received
),
8016 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8017 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8020 ok(!strcmp_aw(prop
.expected
, received
),
8021 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8022 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8025 SysFreeString(received
);
8028 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8029 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8030 DWORD received
= -2;
8032 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8035 ok(hr
== prop
.result
,
8036 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8037 hr
, prop
.result
, test_index
, i
);
8040 ok(hr
== prop
.result
,
8041 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8042 hr
, prop
.result
, test_index
, i
);
8047 ok(received
== prop
.expected
,
8048 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8049 prop
.expected
, received
, test_index
, i
);
8052 ok(received
== prop
.expected
,
8053 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8054 prop
.expected
, received
, test_index
, i
);
8059 if(uri
) IUri_Release(uri
);
8062 static void test_IUriBuilder_CreateUriSimple(IUriBuilder
*builder
, const uri_builder_test
*test
,
8067 hr
= IUriBuilder_CreateUriSimple(builder
, test
->uri_simple_encode_flags
, 0, &uri
);
8068 if(test
->uri_simple_todo
) {
8070 ok(hr
== test
->uri_simple_hres
,
8071 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8072 hr
, test
->uri_simple_hres
, test_index
);
8075 ok(hr
== test
->uri_simple_hres
,
8076 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8077 hr
, test
->uri_simple_hres
, test_index
);
8083 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8084 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8085 BSTR received
= NULL
;
8087 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8090 ok(hr
== prop
.result
,
8091 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8092 hr
, prop
.result
, test_index
, i
);
8095 ok(hr
== prop
.result
,
8096 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8097 hr
, prop
.result
, test_index
, i
);
8102 ok(!strcmp_aw(prop
.expected
, received
),
8103 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8104 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8107 ok(!strcmp_aw(prop
.expected
, received
),
8108 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8109 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8112 SysFreeString(received
);
8115 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8116 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8117 DWORD received
= -2;
8119 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8122 ok(hr
== prop
.result
,
8123 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8124 hr
, prop
.result
, test_index
, i
);
8127 ok(hr
== prop
.result
,
8128 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8129 hr
, prop
.result
, test_index
, i
);
8134 ok(received
== prop
.expected
,
8135 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8136 prop
.expected
, received
, test_index
, i
);
8139 ok(received
== prop
.expected
,
8140 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8141 prop
.expected
, received
, test_index
, i
);
8146 if(uri
) IUri_Release(uri
);
8149 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder
*builder
, const uri_builder_test
*test
,
8154 hr
= IUriBuilder_CreateUriWithFlags(builder
, test
->uri_with_flags
, test
->uri_with_builder_flags
,
8155 test
->uri_with_encode_flags
, 0, &uri
);
8156 if(test
->uri_with_todo
) {
8158 ok(hr
== test
->uri_with_hres
,
8159 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8160 hr
, test
->uri_with_hres
, test_index
);
8163 ok(hr
== test
->uri_with_hres
,
8164 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8165 hr
, test
->uri_with_hres
, test_index
);
8171 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8172 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8173 BSTR received
= NULL
;
8175 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8178 ok(hr
== prop
.result
,
8179 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8180 hr
, prop
.result
, test_index
, i
);
8183 ok(hr
== prop
.result
,
8184 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8185 hr
, prop
.result
, test_index
, i
);
8190 ok(!strcmp_aw(prop
.expected
, received
),
8191 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8192 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8195 ok(!strcmp_aw(prop
.expected
, received
),
8196 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8197 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8200 SysFreeString(received
);
8203 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8204 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8205 DWORD received
= -2;
8207 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8210 ok(hr
== prop
.result
,
8211 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8212 hr
, prop
.result
, test_index
, i
);
8215 ok(hr
== prop
.result
,
8216 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8217 hr
, prop
.result
, test_index
, i
);
8222 ok(received
== prop
.expected
,
8223 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8224 prop
.expected
, received
, test_index
, i
);
8227 ok(received
== prop
.expected
,
8228 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8229 prop
.expected
, received
, test_index
, i
);
8234 if(uri
) IUri_Release(uri
);
8237 static void test_IUriBuilder_CreateInvalidArgs(void) {
8238 IUriBuilder
*builder
;
8241 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
8242 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8244 IUri
*test
= NULL
, *uri
= (void*) 0xdeadbeef;
8246 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8247 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, NULL
);
8248 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8250 uri
= (void*) 0xdeadbeef;
8251 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8252 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_NOTIMPL
);
8253 ok(uri
== NULL
, "Error: expected uri to be NULL, but was %p instead.\n", uri
);
8255 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, NULL
);
8256 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8259 uri
= (void*) 0xdeadbeef;
8260 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8261 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8263 ok(!uri
, "Error: Expected uri to NULL, but was %p instead.\n", uri
);
8265 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, NULL
);
8266 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8269 uri
= (void*) 0xdeadbeef;
8270 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8271 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8273 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8275 hr
= pCreateUri(http_urlW
, 0, 0, &test
);
8276 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8278 hr
= IUriBuilder_SetIUri(builder
, test
);
8279 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8281 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8283 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8284 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8285 ok(uri
!= NULL
, "Error: The uri was NULL.\n");
8286 if(uri
) IUri_Release(uri
);
8289 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8290 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8292 ok(uri
!= NULL
, "Error: uri was NULL.\n");
8293 if(uri
) IUri_Release(uri
);
8296 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &uri
);
8297 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8299 ok(uri
!= NULL
, "Error: uri was NULL.\n");
8300 if(uri
) IUri_Release(uri
);
8302 hr
= IUriBuilder_SetFragment(builder
, NULL
);
8303 ok(hr
== S_OK
, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8305 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8306 uri
= (void*) 0xdeadbeef;
8307 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8308 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8309 ok(!uri
, "Error: Expected uri to be NULL but was %p instead.\n", uri
);
8311 uri
= (void*) 0xdeadbeef;
8312 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8313 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8315 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8317 uri
= (void*) 0xdeadbeef;
8318 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8319 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8321 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8323 if(test
) IUri_Release(test
);
8325 if(builder
) IUriBuilder_Release(builder
);
8328 /* Tests invalid args to the "Get*" functions. */
8329 static void test_IUriBuilder_GetInvalidArgs(void) {
8330 IUriBuilder
*builder
= NULL
;
8333 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
8334 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8336 LPCWSTR received
= (void*) 0xdeadbeef;
8337 DWORD len
= -1, port
= -1;
8340 hr
= IUriBuilder_GetFragment(builder
, NULL
, NULL
);
8341 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8343 hr
= IUriBuilder_GetFragment(builder
, NULL
, &received
);
8344 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8346 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8347 hr
= IUriBuilder_GetFragment(builder
, &len
, NULL
);
8348 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8350 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8352 hr
= IUriBuilder_GetHost(builder
, NULL
, NULL
);
8353 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8355 received
= (void*) 0xdeadbeef;
8356 hr
= IUriBuilder_GetHost(builder
, NULL
, &received
);
8357 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8359 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8361 hr
= IUriBuilder_GetHost(builder
, &len
, NULL
);
8362 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8364 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8366 hr
= IUriBuilder_GetPassword(builder
, NULL
, NULL
);
8367 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8369 received
= (void*) 0xdeadbeef;
8370 hr
= IUriBuilder_GetPassword(builder
, NULL
, &received
);
8371 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8373 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8375 hr
= IUriBuilder_GetPassword(builder
, &len
, NULL
);
8376 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8378 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8380 hr
= IUriBuilder_GetPath(builder
, NULL
, NULL
);
8381 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8383 received
= (void*) 0xdeadbeef;
8384 hr
= IUriBuilder_GetPath(builder
, NULL
, &received
);
8385 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8387 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8389 hr
= IUriBuilder_GetPath(builder
, &len
, NULL
);
8390 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8392 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8394 hr
= IUriBuilder_GetPort(builder
, NULL
, NULL
);
8395 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8397 hr
= IUriBuilder_GetPort(builder
, NULL
, &port
);
8398 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8400 ok(!port
, "Error: Expected port to be 0, but was %d instead.\n", port
);
8401 hr
= IUriBuilder_GetPort(builder
, &set
, NULL
);
8402 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8404 ok(!set
, "Error: Expected set to be FALSE, but was %d instead.\n", set
);
8406 hr
= IUriBuilder_GetQuery(builder
, NULL
, NULL
);
8407 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8409 received
= (void*) 0xdeadbeef;
8410 hr
= IUriBuilder_GetQuery(builder
, NULL
, &received
);
8411 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8413 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8415 hr
= IUriBuilder_GetQuery(builder
, &len
, NULL
);
8416 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8418 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8420 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, NULL
);
8421 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8423 received
= (void*) 0xdeadbeef;
8424 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, &received
);
8425 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8427 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8429 hr
= IUriBuilder_GetSchemeName(builder
, &len
, NULL
);
8430 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8432 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8434 hr
= IUriBuilder_GetUserName(builder
, NULL
, NULL
);
8435 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8437 received
= (void*) 0xdeadbeef;
8438 hr
= IUriBuilder_GetUserName(builder
, NULL
, &received
);
8439 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8441 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8443 hr
= IUriBuilder_GetUserName(builder
, &len
, NULL
);
8444 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8446 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8448 if(builder
) IUriBuilder_Release(builder
);
8451 static void test_IUriBuilder_GetFragment(IUriBuilder
*builder
, const uri_builder_test
*test
,
8455 LPCWSTR received
= NULL
;
8457 const uri_builder_property
*prop
= NULL
;
8459 /* Check if the property was set earlier. */
8460 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8461 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_FRAGMENT
)
8462 prop
= &(test
->properties
[i
]);
8466 /* Use expected_value unless it's NULL, then use value. */
8467 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8468 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8471 ok(hr
== (expected
? S_OK
: S_FALSE
),
8472 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8473 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8477 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8478 expected
, wine_dbgstr_w(received
), test_index
);
8481 ok(lstrlen(expected
) == len
,
8482 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8483 lstrlen(expected
), len
, test_index
);
8487 ok(hr
== (expected
? S_OK
: S_FALSE
),
8488 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8489 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8490 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8491 expected
, wine_dbgstr_w(received
), test_index
);
8492 ok(lstrlen(expected
) == len
,
8493 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8494 lstrlen(expected
), len
, test_index
);
8497 /* The property wasn't set earlier, so it should return whatever
8498 * the base IUri contains (if anything).
8501 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8503 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8504 hr
, S_OK
, test_index
);
8507 received
= (void*) 0xdeadbeef;
8510 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8512 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8513 hr
, S_FALSE
, test_index
);
8515 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8517 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8518 received
, test_index
);
8521 BOOL has_prop
= FALSE
;
8522 BSTR expected
= NULL
;
8524 hr
= IUri_GetFragment(uri
, &expected
);
8526 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8528 has_prop
= hr
== S_OK
;
8530 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8533 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8534 hr
, S_OK
, test_index
);
8536 ok(!lstrcmpW(expected
, received
),
8537 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8538 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8539 ok(lstrlenW(expected
) == len
,
8540 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8541 lstrlenW(expected
), len
, test_index
);
8545 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8546 hr
, S_FALSE
, test_index
);
8548 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8549 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8553 SysFreeString(expected
);
8556 if(uri
) IUri_Release(uri
);
8560 static void test_IUriBuilder_GetHost(IUriBuilder
*builder
, const uri_builder_test
*test
,
8564 LPCWSTR received
= NULL
;
8566 const uri_builder_property
*prop
= NULL
;
8568 /* Check if the property was set earlier. */
8569 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8570 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_HOST
)
8571 prop
= &(test
->properties
[i
]);
8575 /* Use expected_value unless it's NULL, then use value. */
8576 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8577 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8580 ok(hr
== (expected
? S_OK
: S_FALSE
),
8581 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8582 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8586 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8587 expected
, wine_dbgstr_w(received
), test_index
);
8590 ok(lstrlen(expected
) == len
,
8591 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8592 lstrlen(expected
), len
, test_index
);
8596 ok(hr
== (expected
? S_OK
: S_FALSE
),
8597 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8598 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8599 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8600 expected
, wine_dbgstr_w(received
), test_index
);
8601 ok(lstrlen(expected
) == len
,
8602 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8603 lstrlen(expected
), len
, test_index
);
8606 /* The property wasn't set earlier, so it should return whatever
8607 * the base IUri contains (if anything).
8610 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8612 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8613 hr
, S_OK
, test_index
);
8616 received
= (void*) 0xdeadbeef;
8619 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8621 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8622 hr
, S_FALSE
, test_index
);
8624 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8626 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8627 received
, test_index
);
8630 BOOL has_prop
= FALSE
;
8631 BSTR expected
= NULL
;
8633 hr
= IUri_GetHost(uri
, &expected
);
8635 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8637 has_prop
= hr
== S_OK
;
8639 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8642 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8643 hr
, S_OK
, test_index
);
8645 ok(!lstrcmpW(expected
, received
),
8646 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8647 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8648 ok(lstrlenW(expected
) == len
,
8649 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8650 lstrlenW(expected
), len
, test_index
);
8654 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8655 hr
, S_FALSE
, test_index
);
8657 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8658 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8662 SysFreeString(expected
);
8665 if(uri
) IUri_Release(uri
);
8669 static void test_IUriBuilder_GetPassword(IUriBuilder
*builder
, const uri_builder_test
*test
,
8673 LPCWSTR received
= NULL
;
8675 const uri_builder_property
*prop
= NULL
;
8677 /* Check if the property was set earlier. */
8678 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8679 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PASSWORD
)
8680 prop
= &(test
->properties
[i
]);
8684 /* Use expected_value unless it's NULL, then use value. */
8685 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8686 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8689 ok(hr
== (expected
? S_OK
: S_FALSE
),
8690 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8691 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8695 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8696 expected
, wine_dbgstr_w(received
), test_index
);
8699 ok(lstrlen(expected
) == len
,
8700 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8701 lstrlen(expected
), len
, test_index
);
8705 ok(hr
== (expected
? S_OK
: S_FALSE
),
8706 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8707 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8708 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8709 expected
, wine_dbgstr_w(received
), test_index
);
8710 ok(lstrlen(expected
) == len
,
8711 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8712 lstrlen(expected
), len
, test_index
);
8715 /* The property wasn't set earlier, so it should return whatever
8716 * the base IUri contains (if anything).
8719 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8721 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8722 hr
, S_OK
, test_index
);
8725 received
= (void*) 0xdeadbeef;
8728 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8730 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8731 hr
, S_FALSE
, test_index
);
8733 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8735 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8736 received
, test_index
);
8739 BOOL has_prop
= FALSE
;
8740 BSTR expected
= NULL
;
8742 hr
= IUri_GetPassword(uri
, &expected
);
8744 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8746 has_prop
= hr
== S_OK
;
8748 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8751 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8752 hr
, S_OK
, test_index
);
8754 ok(!lstrcmpW(expected
, received
),
8755 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8756 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8757 ok(lstrlenW(expected
) == len
,
8758 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8759 lstrlenW(expected
), len
, test_index
);
8763 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8764 hr
, S_FALSE
, test_index
);
8766 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8767 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8771 SysFreeString(expected
);
8774 if(uri
) IUri_Release(uri
);
8778 static void test_IUriBuilder_GetPath(IUriBuilder
*builder
, const uri_builder_test
*test
,
8782 LPCWSTR received
= NULL
;
8784 const uri_builder_property
*prop
= NULL
;
8786 /* Check if the property was set earlier. */
8787 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8788 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PATH
)
8789 prop
= &(test
->properties
[i
]);
8793 /* Use expected_value unless it's NULL, then use value. */
8794 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8795 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8798 ok(hr
== (expected
? S_OK
: S_FALSE
),
8799 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8800 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8804 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8805 expected
, wine_dbgstr_w(received
), test_index
);
8808 ok(lstrlen(expected
) == len
,
8809 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8810 lstrlen(expected
), len
, test_index
);
8814 ok(hr
== (expected
? S_OK
: S_FALSE
),
8815 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8816 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8817 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8818 expected
, wine_dbgstr_w(received
), test_index
);
8819 ok(lstrlen(expected
) == len
,
8820 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8821 lstrlen(expected
), len
, test_index
);
8824 /* The property wasn't set earlier, so it should return whatever
8825 * the base IUri contains (if anything).
8828 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8830 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8831 hr
, S_OK
, test_index
);
8834 received
= (void*) 0xdeadbeef;
8837 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8839 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8840 hr
, S_FALSE
, test_index
);
8842 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8844 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8845 received
, test_index
);
8848 BOOL has_prop
= FALSE
;
8849 BSTR expected
= NULL
;
8851 hr
= IUri_GetPath(uri
, &expected
);
8853 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8855 has_prop
= hr
== S_OK
;
8857 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8860 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8861 hr
, S_OK
, test_index
);
8863 ok(!lstrcmpW(expected
, received
),
8864 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8865 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8866 ok(lstrlenW(expected
) == len
,
8867 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8868 lstrlenW(expected
), len
, test_index
);
8872 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8873 hr
, S_FALSE
, test_index
);
8875 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8876 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8880 SysFreeString(expected
);
8883 if(uri
) IUri_Release(uri
);
8887 static void test_IUriBuilder_GetPort(IUriBuilder
*builder
, const uri_builder_test
*test
,
8890 BOOL has_port
= FALSE
;
8891 DWORD received
= -1;
8893 if(test
->port_prop
.change
) {
8894 DWORD expected
= test
->port_prop
.value
;
8896 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
8897 if(test
->port_prop
.todo
) {
8900 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8901 hr
, S_OK
, test_index
);
8905 ok(has_port
== test
->port_prop
.set
,
8906 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8907 test
->port_prop
.set
, has_port
, test_index
);
8910 ok(received
== expected
,
8911 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8912 expected
, received
, test_index
);
8917 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8918 hr
, S_OK
, test_index
);
8919 ok(has_port
== test
->port_prop
.set
,
8920 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8921 test
->port_prop
.set
, has_port
, test_index
);
8922 ok(received
== test
->port_prop
.value
,
8923 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8924 test
->port_prop
.value
, received
, test_index
);
8929 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8931 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8932 hr
, S_OK
, test_index
);
8935 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
8937 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8938 hr
, S_OK
, test_index
);
8940 ok(has_port
== FALSE
,
8941 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8942 has_port
, test_index
);
8943 ok(!received
, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8944 received
, test_index
);
8949 hr
= IUri_GetPort(uri
, &expected
);
8951 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8954 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
8956 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8957 hr
, S_OK
, test_index
);
8960 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8962 ok(received
== expected
,
8963 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8964 expected
, received
, test_index
);
8968 if(uri
) IUri_Release(uri
);
8972 static void test_IUriBuilder_GetQuery(IUriBuilder
*builder
, const uri_builder_test
*test
,
8976 LPCWSTR received
= NULL
;
8978 const uri_builder_property
*prop
= NULL
;
8980 /* Check if the property was set earlier. */
8981 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8982 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_QUERY
)
8983 prop
= &(test
->properties
[i
]);
8987 /* Use expected_value unless it's NULL, then use value. */
8988 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8989 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
8992 ok(hr
== (expected
? S_OK
: S_FALSE
),
8993 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8994 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8998 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8999 expected
, wine_dbgstr_w(received
), test_index
);
9002 ok(lstrlen(expected
) == len
,
9003 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9004 lstrlen(expected
), len
, test_index
);
9008 ok(hr
== (expected
? S_OK
: S_FALSE
),
9009 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9010 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9011 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9012 expected
, wine_dbgstr_w(received
), test_index
);
9013 ok(lstrlen(expected
) == len
,
9014 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9015 lstrlen(expected
), len
, test_index
);
9018 /* The property wasn't set earlier, so it should return whatever
9019 * the base IUri contains (if anything).
9022 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9024 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9025 hr
, S_OK
, test_index
);
9028 received
= (void*) 0xdeadbeef;
9031 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9033 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9034 hr
, S_FALSE
, test_index
);
9036 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9038 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9039 received
, test_index
);
9042 BOOL has_prop
= FALSE
;
9043 BSTR expected
= NULL
;
9045 hr
= IUri_GetQuery(uri
, &expected
);
9047 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9049 has_prop
= hr
== S_OK
;
9051 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9054 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9055 hr
, S_OK
, test_index
);
9057 ok(!lstrcmpW(expected
, received
),
9058 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9059 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9060 ok(lstrlenW(expected
) == len
,
9061 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9062 lstrlenW(expected
), len
, test_index
);
9066 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9067 hr
, S_FALSE
, test_index
);
9069 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9070 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9074 SysFreeString(expected
);
9077 if(uri
) IUri_Release(uri
);
9081 static void test_IUriBuilder_GetSchemeName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9085 LPCWSTR received
= NULL
;
9087 const uri_builder_property
*prop
= NULL
;
9089 /* Check if the property was set earlier. */
9090 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9091 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_SCHEME_NAME
)
9092 prop
= &(test
->properties
[i
]);
9096 /* Use expected_value unless it's NULL, then use value. */
9097 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9098 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9101 ok(hr
== (expected
? S_OK
: S_FALSE
),
9102 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9103 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9107 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9108 expected
, wine_dbgstr_w(received
), test_index
);
9111 ok(lstrlen(expected
) == len
,
9112 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9113 lstrlen(expected
), len
, test_index
);
9117 ok(hr
== (expected
? S_OK
: S_FALSE
),
9118 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9119 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9120 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9121 expected
, wine_dbgstr_w(received
), test_index
);
9122 ok(lstrlen(expected
) == len
,
9123 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9124 lstrlen(expected
), len
, test_index
);
9127 /* The property wasn't set earlier, so it should return whatever
9128 * the base IUri contains (if anything).
9131 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9133 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9134 hr
, S_OK
, test_index
);
9137 received
= (void*) 0xdeadbeef;
9140 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9142 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9143 hr
, S_FALSE
, test_index
);
9145 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9147 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9148 received
, test_index
);
9151 BOOL has_prop
= FALSE
;
9152 BSTR expected
= NULL
;
9154 hr
= IUri_GetSchemeName(uri
, &expected
);
9156 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9158 has_prop
= hr
== S_OK
;
9160 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9163 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9164 hr
, S_OK
, test_index
);
9166 ok(!lstrcmpW(expected
, received
),
9167 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9168 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9169 ok(lstrlenW(expected
) == len
,
9170 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9171 lstrlenW(expected
), len
, test_index
);
9175 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9176 hr
, S_FALSE
, test_index
);
9178 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9179 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9183 SysFreeString(expected
);
9186 if(uri
) IUri_Release(uri
);
9190 static void test_IUriBuilder_GetUserName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9194 LPCWSTR received
= NULL
;
9196 const uri_builder_property
*prop
= NULL
;
9198 /* Check if the property was set earlier. */
9199 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9200 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_USER_NAME
)
9201 prop
= &(test
->properties
[i
]);
9204 if(prop
&& prop
->value
&& *prop
->value
) {
9205 /* Use expected_value unless it's NULL, then use value. */
9206 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9207 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9210 ok(hr
== (expected
? S_OK
: S_FALSE
),
9211 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9212 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9216 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9217 expected
, wine_dbgstr_w(received
), test_index
);
9220 ok(lstrlen(expected
) == len
,
9221 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9222 lstrlen(expected
), len
, test_index
);
9226 ok(hr
== (expected
? S_OK
: S_FALSE
),
9227 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9228 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9229 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9230 expected
, wine_dbgstr_w(received
), test_index
);
9231 ok(lstrlen(expected
) == len
,
9232 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9233 lstrlen(expected
), len
, test_index
);
9236 /* The property wasn't set earlier, so it should return whatever
9237 * the base IUri contains (if anything).
9240 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9242 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9243 hr
, S_OK
, test_index
);
9246 received
= (void*) 0xdeadbeef;
9249 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9251 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9252 hr
, S_FALSE
, test_index
);
9254 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9256 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9257 received
, test_index
);
9260 BSTR expected
= NULL
;
9261 BOOL has_prop
= FALSE
;
9263 hr
= IUri_GetUserName(uri
, &expected
);
9265 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9267 has_prop
= hr
== S_OK
;
9269 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9272 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9273 hr
, S_OK
, test_index
);
9275 ok(!lstrcmpW(expected
, received
),
9276 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9277 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9278 ok(lstrlenW(expected
) == len
,
9279 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9280 lstrlenW(expected
), len
, test_index
);
9284 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9285 hr
, S_FALSE
, test_index
);
9287 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9288 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9292 SysFreeString(expected
);
9295 if(uri
) IUri_Release(uri
);
9299 /* Tests IUriBuilder functions. */
9300 static void test_IUriBuilder(void) {
9302 IUriBuilder
*builder
;
9305 for(i
= 0; i
< sizeof(uri_builder_tests
)/sizeof(uri_builder_tests
[0]); ++i
) {
9307 uri_builder_test test
= uri_builder_tests
[i
];
9311 uriW
= a2w(test
.uri
);
9312 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
9313 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9315 if(FAILED(hr
)) continue;
9317 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9318 if(test
.create_builder_todo
) {
9320 ok(hr
== test
.create_builder_expected
,
9321 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9322 hr
, test
.create_builder_expected
, i
);
9325 ok(hr
== test
.create_builder_expected
,
9326 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9327 hr
, test
.create_builder_expected
, i
);
9331 BOOL modified
= FALSE
, received
= FALSE
;
9333 /* Perform all the string property changes. */
9334 for(j
= 0; j
< URI_BUILDER_STR_PROPERTY_COUNT
; ++j
) {
9335 uri_builder_property prop
= test
.properties
[j
];
9337 change_property(builder
, &prop
, i
);
9338 if(prop
.property
!= Uri_PROPERTY_SCHEME_NAME
&&
9339 prop
.property
!= Uri_PROPERTY_HOST
)
9341 else if(prop
.value
&& *prop
.value
)
9343 else if(prop
.value
&& !*prop
.value
&& prop
.property
== Uri_PROPERTY_HOST
)
9344 /* Host name property can't be NULL, but it can be empty. */
9349 if(test
.port_prop
.change
) {
9350 hr
= IUriBuilder_SetPort(builder
, test
.port_prop
.set
, test
.port_prop
.value
);
9352 if(test
.port_prop
.todo
) {
9354 ok(hr
== test
.port_prop
.expected
,
9355 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9356 hr
, test
.port_prop
.expected
, i
);
9359 ok(hr
== test
.port_prop
.expected
,
9360 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9361 hr
, test
.port_prop
.expected
, i
);
9365 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9367 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9370 ok(received
== modified
,
9371 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9372 modified
, received
, i
);
9374 /* Test the "Get*" functions. */
9375 test_IUriBuilder_GetFragment(builder
, &test
, i
);
9376 test_IUriBuilder_GetHost(builder
, &test
, i
);
9377 test_IUriBuilder_GetPassword(builder
, &test
, i
);
9378 test_IUriBuilder_GetPath(builder
, &test
, i
);
9379 test_IUriBuilder_GetPort(builder
, &test
, i
);
9380 test_IUriBuilder_GetQuery(builder
, &test
, i
);
9381 test_IUriBuilder_GetSchemeName(builder
, &test
, i
);
9382 test_IUriBuilder_GetUserName(builder
, &test
, i
);
9384 test_IUriBuilder_CreateUri(builder
, &test
, i
);
9385 test_IUriBuilder_CreateUriSimple(builder
, &test
, i
);
9386 test_IUriBuilder_CreateUriWithFlags(builder
, &test
, i
);
9388 if(builder
) IUriBuilder_Release(builder
);
9389 if(uri
) IUri_Release(uri
);
9394 static void test_IUriBuilder_HasBeenModified(void) {
9396 IUriBuilder
*builder
= NULL
;
9398 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9399 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9401 static const WCHAR hostW
[] = {'g','o','o','g','l','e','.','c','o','m',0};
9405 hr
= IUriBuilder_HasBeenModified(builder
, NULL
);
9406 ok(hr
== E_POINTER
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9409 hr
= IUriBuilder_SetHost(builder
, hostW
);
9410 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9413 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9414 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9417 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9419 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9420 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9425 hr
= IUriBuilder_SetIUri(builder
, uri
);
9426 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9429 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9430 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9433 ok(received
== FALSE
, "Error: Expected received to be FALSE.\n");
9435 /* Test what happens with you call SetIUri with the same IUri again. */
9436 hr
= IUriBuilder_SetHost(builder
, hostW
);
9437 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9439 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9440 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9443 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9445 hr
= IUriBuilder_SetIUri(builder
, uri
);
9446 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9448 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9449 * reset any of the changes that were made to the IUriBuilder.
9451 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9452 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9454 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9456 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
9457 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9459 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
9460 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
9461 ok(len
== lstrlenW(hostW
), "Error: Expected len to be %d, but was %d instead.\n",
9462 lstrlenW(hostW
), len
);
9465 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9466 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9468 hr
= IUriBuilder_SetHost(builder
, hostW
);
9469 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9470 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9471 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9474 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9476 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9477 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr
, S_OK
);
9479 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9480 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9483 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9485 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
9486 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9488 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
9489 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
9490 ok(len
== lstrlenW(hostW
), "Error: Expected len to %d, but was %d instead.\n",
9491 lstrlenW(hostW
), len
);
9494 if(uri
) IUri_Release(uri
);
9496 if(builder
) IUriBuilder_Release(builder
);
9499 /* Test IUriBuilder {Get,Set}IUri functions. */
9500 static void test_IUriBuilder_IUriProperty(void) {
9501 IUriBuilder
*builder
= NULL
;
9504 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9505 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9509 hr
= IUriBuilder_GetIUri(builder
, NULL
);
9510 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9513 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9516 ULONG cur_count
, orig_count
;
9518 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9519 orig_count
= get_refcnt(uri
);
9520 hr
= IUriBuilder_SetIUri(builder
, uri
);
9521 cur_count
= get_refcnt(uri
);
9523 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9524 orig_count
+1, cur_count
);
9526 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9527 cur_count
= get_refcnt(uri
);
9529 ok(cur_count
== orig_count
, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9530 orig_count
, cur_count
);
9532 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9533 hr
= IUriBuilder_SetIUri(builder
, uri
);
9534 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9535 orig_count
= get_refcnt(uri
);
9537 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, &test
);
9538 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9540 cur_count
= get_refcnt(uri
);
9541 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9542 orig_count
+1, cur_count
);
9543 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n",
9546 if(test
) IUri_Release(test
);
9549 hr
= IUriBuilder_CreateUri(builder
, -1, 0, 0, &test
);
9550 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9552 cur_count
= get_refcnt(uri
);
9553 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9554 orig_count
+1, cur_count
);
9555 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9557 if(test
) IUri_Release(test
);
9559 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9563 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, &test
);
9564 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9566 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
9568 if(test
) IUri_Release(test
);
9570 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9571 * explicitly set (because it's a default flags).
9574 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, &test
);
9575 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9577 cur_count
= get_refcnt(uri
);
9578 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9579 orig_count
+1, cur_count
);
9580 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
9582 if(test
) IUri_Release(test
);
9585 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, &test
);
9586 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9588 cur_count
= get_refcnt(uri
);
9589 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9590 orig_count
+1, cur_count
);
9591 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9593 if(test
) IUri_Release(test
);
9596 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &test
);
9597 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9600 cur_count
= get_refcnt(uri
);
9601 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9602 orig_count
+1, cur_count
);
9603 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9605 if(test
) IUri_Release(test
);
9607 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9611 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, 0, &test
);
9612 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9614 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
9616 if(test
) IUri_Release(test
);
9618 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9619 * explicitly set (because it's a default flags).
9622 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, 0, &test
);
9623 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9625 cur_count
= get_refcnt(uri
);
9626 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9627 orig_count
+1, cur_count
);
9628 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
9630 if(test
) IUri_Release(test
);
9632 if(uri
) IUri_Release(uri
);
9634 if(builder
) IUriBuilder_Release(builder
);
9637 static void test_IUriBuilder_RemoveProperties(void) {
9638 IUriBuilder
*builder
= NULL
;
9642 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9643 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9645 /* Properties that can't be removed. */
9646 const DWORD invalid
= Uri_HAS_ABSOLUTE_URI
|Uri_HAS_DISPLAY_URI
|Uri_HAS_RAW_URI
|Uri_HAS_HOST_TYPE
|
9647 Uri_HAS_SCHEME
|Uri_HAS_ZONE
;
9649 for(i
= Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_DWORD_LAST
; ++i
) {
9650 hr
= IUriBuilder_RemoveProperties(builder
, i
<< 1);
9651 if((i
<< 1) & invalid
) {
9652 ok(hr
== E_INVALIDARG
,
9653 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9654 hr
, E_INVALIDARG
, i
);
9657 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9662 /* Also doesn't accept anything that's outside the range of the
9665 hr
= IUriBuilder_RemoveProperties(builder
, (Uri_PROPERTY_DWORD_LAST
+1) << 1);
9666 ok(hr
== E_INVALIDARG
, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9669 if(builder
) IUriBuilder_Release(builder
);
9671 for(i
= 0; i
< sizeof(uri_builder_remove_tests
)/sizeof(uri_builder_remove_tests
[0]); ++i
) {
9672 uri_builder_remove_test test
= uri_builder_remove_tests
[i
];
9676 uriW
= a2w(test
.uri
);
9677 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
9681 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9682 if(test
.create_builder_todo
) {
9684 ok(hr
== test
.create_builder_expected
,
9685 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9686 hr
, test
.create_builder_expected
, i
);
9689 ok(hr
== test
.create_builder_expected
,
9690 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9691 hr
, test
.create_builder_expected
, i
);
9694 hr
= IUriBuilder_RemoveProperties(builder
, test
.remove_properties
);
9695 if(test
.remove_todo
) {
9697 ok(hr
== test
.remove_expected
,
9698 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9699 hr
, test
.remove_expected
, i
);
9702 ok(hr
== test
.remove_expected
,
9703 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9704 hr
, test
.remove_expected
, i
);
9707 IUri
*result
= NULL
;
9709 hr
= IUriBuilder_CreateUri(builder
, test
.expected_flags
, 0, 0, &result
);
9710 if(test
.expected_todo
) {
9712 ok(hr
== test
.expected_hres
,
9713 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9714 hr
, test
.expected_hres
, i
);
9717 ok(hr
== test
.expected_hres
,
9718 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9719 hr
, test
.expected_hres
, i
);
9722 BSTR received
= NULL
;
9724 hr
= IUri_GetAbsoluteUri(result
, &received
);
9725 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
9726 ok(!strcmp_aw(test
.expected_uri
, received
),
9727 "Error: Expected %s but got %s instead on test %d.\n",
9728 test
.expected_uri
, wine_dbgstr_w(received
), i
);
9729 SysFreeString(received
);
9731 if(result
) IUri_Release(result
);
9734 if(builder
) IUriBuilder_Release(builder
);
9736 if(uri
) IUri_Release(uri
);
9741 static void test_IUriBuilder_Misc(void) {
9745 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9747 IUriBuilder
*builder
;
9749 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9750 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9755 hr
= IUriBuilder_GetPort(builder
, &has
, &port
);
9756 ok(hr
== S_OK
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9758 /* 'has' will be set to FALSE, even though uri had a port. */
9759 ok(has
== FALSE
, "Error: Expected 'has' to be FALSE, was %d instead.\n", has
);
9760 /* Still sets 'port' to 80. */
9761 ok(port
== 80, "Error: Expected the port to be 80, but, was %d instead.\n", port
);
9764 if(builder
) IUriBuilder_Release(builder
);
9766 if(uri
) IUri_Release(uri
);
9769 static void test_IUriBuilderFactory(void) {
9772 IUriBuilderFactory
*factory
;
9773 IUriBuilder
*builder
;
9775 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9776 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
9779 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&factory
);
9780 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x.\n", hr
);
9781 ok(factory
!= NULL
, "Error: Expected 'factory' to not be NULL.\n");
9784 builder
= (void*) 0xdeadbeef;
9785 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 10, 0, &builder
);
9786 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9788 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9790 builder
= (void*) 0xdeadbeef;
9791 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 10, &builder
);
9792 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9794 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9796 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, NULL
);
9797 ok(hr
== E_POINTER
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9801 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, &builder
);
9802 ok(hr
== S_OK
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9805 IUri
*tmp
= (void*) 0xdeadbeef;
9809 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
9810 ok(hr
== S_OK
, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9812 ok(!tmp
, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp
);
9814 hr
= IUriBuilder_GetHost(builder
, &result_len
, &result
);
9815 ok(hr
== S_FALSE
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9818 if(builder
) IUriBuilder_Release(builder
);
9820 builder
= (void*) 0xdeadbeef;
9821 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 10, 0, &builder
);
9822 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9824 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9826 builder
= (void*) 0xdeadbeef;
9827 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 10, &builder
);
9828 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9830 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9832 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, NULL
);
9833 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9837 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, &builder
);
9838 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9843 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
9844 ok(hr
== S_OK
, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9846 ok(tmp
== uri
, "Error: Expected tmp to be %p, but was %p.\n", uri
, tmp
);
9847 if(uri
) IUri_Release(uri
);
9849 if(builder
) IUriBuilder_Release(builder
);
9851 if(factory
) IUriBuilderFactory_Release(factory
);
9853 if(uri
) IUri_Release(uri
);
9856 static void test_CoInternetCombineIUri(void) {
9858 IUri
*base
, *relative
, *result
;
9862 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
9863 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
9865 result
= (void*) 0xdeadbeef;
9866 hr
= pCoInternetCombineIUri(base
, NULL
, 0, &result
, 0);
9867 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
9868 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
9872 hr
= pCreateUri(http_urlW
, 0, 0, &relative
);
9873 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
9875 result
= (void*) 0xdeadbeef;
9876 hr
= pCoInternetCombineIUri(NULL
, relative
, 0, &result
, 0);
9877 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
9878 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
9881 hr
= pCoInternetCombineIUri(base
, relative
, 0, NULL
, 0);
9882 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
9884 if(base
) IUri_Release(base
);
9885 if(relative
) IUri_Release(relative
);
9887 for(i
= 0; i
< sizeof(uri_combine_tests
)/sizeof(uri_combine_tests
[0]); ++i
) {
9888 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
9890 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
9891 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
9893 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
9895 hr
= pCreateUri(relativeW
, uri_combine_tests
[i
].relative_create_flags
, 0, &relative
);
9896 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
9900 hr
= pCoInternetCombineIUri(base
, relative
, uri_combine_tests
[i
].combine_flags
, &result
, 0);
9901 if(uri_combine_tests
[i
].todo
) {
9903 ok(hr
== uri_combine_tests
[i
].expected
,
9904 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9905 hr
, uri_combine_tests
[i
].expected
, i
);
9908 ok(hr
== uri_combine_tests
[i
].expected
,
9909 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9910 hr
, uri_combine_tests
[i
]. expected
, i
);
9915 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].str_props
)/sizeof(uri_combine_tests
[i
].str_props
[0]); ++j
) {
9916 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
9919 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
9922 ok(hr
== prop
.expected
,
9923 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9924 hr
, prop
.expected
, i
, j
);
9927 ok(!strcmp_aw(prop
.value
, received
) ||
9928 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
9929 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9930 prop
.value
, wine_dbgstr_w(received
), i
, j
);
9933 ok(hr
== prop
.expected
,
9934 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9935 hr
, prop
.expected
, i
, j
);
9936 ok(!strcmp_aw(prop
.value
, received
) ||
9937 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
9938 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9939 prop
.value
, wine_dbgstr_w(received
), i
, j
);
9941 SysFreeString(received
);
9944 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].dword_props
)/sizeof(uri_combine_tests
[i
].dword_props
[0]); ++j
) {
9945 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
9948 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
9951 ok(hr
== prop
.expected
,
9952 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9953 hr
, prop
.expected
, i
, j
);
9956 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9957 prop
.value
, received
, i
, j
);
9960 ok(hr
== prop
.expected
,
9961 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9962 hr
, prop
.expected
, i
, j
);
9963 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9964 prop
.value
, received
, i
, j
);
9968 if(result
) IUri_Release(result
);
9970 if(relative
) IUri_Release(relative
);
9971 heap_free(relativeW
);
9973 if(base
) IUri_Release(base
);
9978 static HRESULT WINAPI
InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
*iface
,
9979 REFIID riid
, void **ppv
)
9981 ok(0, "unexpected call\n");
9982 return E_NOINTERFACE
;
9985 static ULONG WINAPI
InternetProtocolInfo_AddRef(IInternetProtocolInfo
*iface
)
9990 static ULONG WINAPI
InternetProtocolInfo_Release(IInternetProtocolInfo
*iface
)
9995 static HRESULT WINAPI
InternetProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
9996 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
9997 DWORD
*pcchResult
, DWORD dwReserved
)
9999 CHECK_EXPECT(ParseUrl
);
10000 ok(!lstrcmpW(pwzUrl
, parse_urlW
), "Error: Expected %s, but got %s instead.\n",
10001 wine_dbgstr_w(parse_urlW
), wine_dbgstr_w(pwzUrl
));
10002 ok(ParseAction
== parse_action
, "Error: Expected %d, but got %d.\n", parse_action
, ParseAction
);
10003 ok(dwParseFlags
== parse_flags
, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags
, dwParseFlags
);
10004 ok(cchResult
== 200, "Error: Got %d.\n", cchResult
);
10006 memcpy(pwzResult
, parse_resultW
, sizeof(parse_resultW
));
10007 *pcchResult
= lstrlenW(parse_resultW
);
10012 static HRESULT WINAPI
InternetProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
,
10013 LPCWSTR pwzBaseUrl
, LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
,
10014 LPWSTR pwzResult
, DWORD cchResult
, DWORD
*pcchResult
, DWORD dwReserved
)
10016 CHECK_EXPECT(CombineUrl
);
10017 ok(!lstrcmpW(pwzBaseUrl
, combine_baseW
), "Error: Expected %s, but got %s instead.\n",
10018 wine_dbgstr_w(combine_baseW
), wine_dbgstr_w(pwzBaseUrl
));
10019 ok(!lstrcmpW(pwzRelativeUrl
, combine_relativeW
), "Error: Expected %s, but got %s instead.\n",
10020 wine_dbgstr_w(combine_relativeW
), wine_dbgstr_w(pwzRelativeUrl
));
10021 ok(dwCombineFlags
== (URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
),
10022 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags
);
10023 ok(cchResult
== INTERNET_MAX_URL_LENGTH
+1, "Error: Got %d.\n", cchResult
);
10025 memcpy(pwzResult
, combine_resultW
, sizeof(combine_resultW
));
10026 *pcchResult
= lstrlenW(combine_resultW
);
10031 static HRESULT WINAPI
InternetProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
,
10032 LPCWSTR pwzUrl1
, LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
10034 ok(0, "unexpected call\n");
10038 static HRESULT WINAPI
InternetProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
,
10039 LPCWSTR pwzUrl
, QUERYOPTION OueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
,
10040 DWORD cbBuffer
, DWORD
*pcbBuf
, DWORD dwReserved
)
10042 ok(0, "unexpected call\n");
10046 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
= {
10047 InternetProtocolInfo_QueryInterface
,
10048 InternetProtocolInfo_AddRef
,
10049 InternetProtocolInfo_Release
,
10050 InternetProtocolInfo_ParseUrl
,
10051 InternetProtocolInfo_CombineUrl
,
10052 InternetProtocolInfo_CompareUrl
,
10053 InternetProtocolInfo_QueryInfo
10056 static IInternetProtocolInfo protocol_info
= { &InternetProtocolInfoVtbl
};
10058 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
10060 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
)) {
10061 *ppv
= &protocol_info
;
10065 ok(0, "unexpected call\n");
10066 return E_NOINTERFACE
;
10069 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
10074 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
10079 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
10080 REFIID riid
, void **ppv
)
10082 ok(0, "unexpected call\n");
10086 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
10088 ok(0, "unexpected call\n");
10092 static const IClassFactoryVtbl ClassFactoryVtbl
= {
10093 ClassFactory_QueryInterface
,
10094 ClassFactory_AddRef
,
10095 ClassFactory_Release
,
10096 ClassFactory_CreateInstance
,
10097 ClassFactory_LockServer
10100 static IClassFactory protocol_cf
= { &ClassFactoryVtbl
};
10102 static void register_protocols(void)
10104 IInternetSession
*session
;
10107 hres
= pCoInternetGetSession(0, &session
, 0);
10108 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
10112 hres
= IInternetSession_RegisterNameSpace(session
, &protocol_cf
, &IID_NULL
,
10113 winetestW
, 0, NULL
, 0);
10114 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
10116 IInternetSession_Release(session
);
10119 static void unregister_protocols(void) {
10120 IInternetSession
*session
;
10123 hr
= pCoInternetGetSession(0, &session
, 0);
10124 ok(hr
== S_OK
, "CoInternetGetSession failed: 0x%08x\n", hr
);
10128 hr
= IInternetSession_UnregisterNameSpace(session
, &protocol_cf
, winetestW
);
10129 ok(hr
== S_OK
, "UnregisterNameSpace failed: 0x%08x\n", hr
);
10131 IInternetSession_Release(session
);
10134 static void test_CoInternetCombineIUri_Pluggable(void) {
10138 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10139 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10140 if(SUCCEEDED(hr
)) {
10141 IUri
*relative
= NULL
;
10143 hr
= pCreateUri(combine_relativeW
, Uri_CREATE_ALLOW_RELATIVE
, 0, &relative
);
10144 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10145 if(SUCCEEDED(hr
)) {
10146 IUri
*result
= NULL
;
10148 SET_EXPECT(CombineUrl
);
10150 hr
= pCoInternetCombineIUri(base
, relative
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10152 ok(hr
== S_OK
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10154 CHECK_CALLED(CombineUrl
);
10156 if(SUCCEEDED(hr
)) {
10157 BSTR received
= NULL
;
10158 hr
= IUri_GetAbsoluteUri(result
, &received
);
10159 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10160 if(SUCCEEDED(hr
)) {
10161 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10162 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10164 SysFreeString(received
);
10166 if(result
) IUri_Release(result
);
10168 if(relative
) IUri_Release(relative
);
10170 if(base
) IUri_Release(base
);
10173 static void test_CoInternetCombineUrlEx(void) {
10175 IUri
*base
, *result
;
10179 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
10180 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10181 if(SUCCEEDED(hr
)) {
10182 result
= (void*) 0xdeadbeef;
10183 hr
= pCoInternetCombineUrlEx(base
, NULL
, 0, &result
, 0);
10184 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10186 ok(!result
, "Error: Expected 'result' to be NULL was %p instead.\n", result
);
10189 result
= (void*) 0xdeadbeef;
10190 hr
= pCoInternetCombineUrlEx(NULL
, http_urlW
, 0, &result
, 0);
10191 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10193 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10195 result
= (void*) 0xdeadbeef;
10196 hr
= pCoInternetCombineUrlEx(NULL
, NULL
, 0, &result
, 0);
10197 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10199 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10201 hr
= pCoInternetCombineUrlEx(base
, http_urlW
, 0, NULL
, 0);
10202 ok(hr
== E_POINTER
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10204 if(base
) IUri_Release(base
);
10206 for(i
= 0; i
< sizeof(uri_combine_tests
)/sizeof(uri_combine_tests
[0]); ++i
) {
10207 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
10209 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
10210 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10211 if(SUCCEEDED(hr
)) {
10212 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
10214 hr
= pCoInternetCombineUrlEx(base
, relativeW
, uri_combine_tests
[i
].combine_flags
,
10216 if(uri_combine_tests
[i
].todo
) {
10218 ok(hr
== uri_combine_tests
[i
].expected
,
10219 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10220 hr
, uri_combine_tests
[i
].expected
, i
);
10223 ok(hr
== uri_combine_tests
[i
].expected
,
10224 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10225 hr
, uri_combine_tests
[i
]. expected
, i
);
10227 if(SUCCEEDED(hr
)) {
10230 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].str_props
)/sizeof(uri_combine_tests
[i
].str_props
[0]); ++j
) {
10231 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
10233 LPCSTR value
= (prop
.value_ex
) ? prop
.value_ex
: prop
.value
;
10235 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
10238 ok(hr
== prop
.expected
,
10239 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10240 hr
, prop
.expected
, i
, j
);
10243 ok(!strcmp_aw(value
, received
) ||
10244 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10245 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10246 value
, wine_dbgstr_w(received
), i
, j
);
10249 ok(hr
== prop
.expected
,
10250 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10251 hr
, prop
.expected
, i
, j
);
10252 ok(!strcmp_aw(value
, received
) ||
10253 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10254 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10255 value
, wine_dbgstr_w(received
), i
, j
);
10257 SysFreeString(received
);
10260 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].dword_props
)/sizeof(uri_combine_tests
[i
].dword_props
[0]); ++j
) {
10261 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
10264 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
10267 ok(hr
== prop
.expected
,
10268 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10269 hr
, prop
.expected
, i
, j
);
10272 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10273 prop
.value
, received
, i
, j
);
10276 ok(hr
== prop
.expected
,
10277 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10278 hr
, prop
.expected
, i
, j
);
10279 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10280 prop
.value
, received
, i
, j
);
10284 if(result
) IUri_Release(result
);
10285 heap_free(relativeW
);
10287 if(base
) IUri_Release(base
);
10292 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10296 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10297 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10298 if(SUCCEEDED(hr
)) {
10299 IUri
*result
= NULL
;
10301 SET_EXPECT(CombineUrl
);
10303 hr
= pCoInternetCombineUrlEx(base
, combine_relativeW
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10305 ok(hr
== S_OK
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10307 CHECK_CALLED(CombineUrl
);
10309 if(SUCCEEDED(hr
)) {
10310 BSTR received
= NULL
;
10311 hr
= IUri_GetAbsoluteUri(result
, &received
);
10312 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10313 if(SUCCEEDED(hr
)) {
10314 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10315 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10317 SysFreeString(received
);
10319 if(result
) IUri_Release(result
);
10321 if(base
) IUri_Release(base
);
10324 static void test_CoInternetParseIUri_InvalidArgs(void) {
10330 hr
= pCoInternetParseIUri(NULL
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
10331 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10333 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10335 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10336 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10337 if(SUCCEEDED(hr
)) {
10338 DWORD expected_len
;
10341 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, NULL
, 0, &result
, 0);
10342 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10344 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10346 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, NULL
, 0);
10347 ok(hr
== E_POINTER
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10351 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_URL
, 0, tmp
, 3, &result
, 0);
10352 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10354 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10357 hr
= pCoInternetParseIUri(uri
, PARSE_MIME
, 0, tmp
, 3, &result
, 0);
10358 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10360 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10363 hr
= pCoInternetParseIUri(uri
, PARSE_SERVER
, 0, tmp
, 3, &result
, 0);
10364 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10366 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10369 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_DOMAIN
, 0, tmp
, 3, &result
, 0);
10370 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10372 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10374 expected_len
= lstrlenW(http_urlW
);
10376 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
10377 ok(hr
== STRSAFE_E_INSUFFICIENT_BUFFER
,
10378 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10379 hr
, STRSAFE_E_INSUFFICIENT_BUFFER
);
10380 ok(result
== expected_len
, "Error: Expected 'result' to be %d, but was %d instead.\n",
10381 expected_len
, result
);
10383 if(uri
) IUri_Release(uri
);
10386 static void test_CoInternetParseIUri(void) {
10389 for(i
= 0; i
< sizeof(uri_parse_tests
)/sizeof(uri_parse_tests
[0]); ++i
) {
10393 uri_parse_test test
= uri_parse_tests
[i
];
10395 uriW
= a2w(test
.uri
);
10396 hr
= pCreateUri(uriW
, test
.uri_flags
, 0, &uri
);
10397 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr
, i
);
10398 if(SUCCEEDED(hr
)) {
10399 WCHAR result
[INTERNET_MAX_URL_LENGTH
+1];
10400 DWORD result_len
= -1;
10402 hr
= pCoInternetParseIUri(uri
, test
.action
, test
.flags
, result
, INTERNET_MAX_URL_LENGTH
+1, &result_len
, 0);
10405 ok(hr
== test
.expected
,
10406 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10407 hr
, test
.expected
, i
);
10410 ok(hr
== test
.expected
,
10411 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10412 hr
, test
.expected
, i
);
10414 if(SUCCEEDED(hr
)) {
10415 DWORD len
= lstrlenA(test
.property
);
10416 ok(!strcmp_aw(test
.property
, result
),
10417 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10418 test
.property
, wine_dbgstr_w(result
), i
);
10419 ok(len
== result_len
,
10420 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10421 len
, result_len
, i
);
10424 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10428 if(uri
) IUri_Release(uri
);
10433 static void test_CoInternetParseIUri_Pluggable(void) {
10437 hr
= pCreateUri(parse_urlW
, 0, 0, &uri
);
10438 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr
);
10439 if(SUCCEEDED(hr
)) {
10443 SET_EXPECT(ParseUrl
);
10445 parse_action
= PARSE_CANONICALIZE
;
10446 parse_flags
= URL_UNESCAPE
|URL_ESCAPE_UNSAFE
;
10448 hr
= pCoInternetParseIUri(uri
, parse_action
, parse_flags
, result
, 200, &result_len
, 0);
10449 ok(hr
== S_OK
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10451 CHECK_CALLED(ParseUrl
);
10453 if(SUCCEEDED(hr
)) {
10454 ok(result_len
== lstrlenW(parse_resultW
), "Error: Expected %d, but got %d.\n",
10455 lstrlenW(parse_resultW
), result_len
);
10456 ok(!lstrcmpW(result
, parse_resultW
), "Error: Expected %s, but got %s.\n",
10457 wine_dbgstr_w(parse_resultW
), wine_dbgstr_w(result
));
10460 if(uri
) IUri_Release(uri
);
10466 const char *base_url
;
10467 DWORD base_uri_flags
;
10468 const char *legacy_url
;
10469 const char *uniform_url
;
10470 const char *no_canon_url
;
10471 const char *uri_url
;
10472 } create_urlmon_test_t
;
10474 static const create_urlmon_test_t create_urlmon_tests
[] = {
10476 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE
,
10478 "http://www.winehq.org/",
10479 "http://www.winehq.org/",
10480 "http://www.winehq.org",
10481 "http://www.winehq.org"
10484 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE
,
10486 "file://c:\\dir\\file.txt",
10487 "file:///c:/dir/file.txt",
10488 "file:///c:/dir/file.txt",
10489 "file:///c:/dir/file.txt"
10492 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH
,
10494 "file://c:\\dir\\file.txt",
10495 "file:///c:/dir/file.txt",
10496 "file:///c:/dir/file.txt",
10497 "file://c:\\dir\\file.txt"
10500 "dat%61",Uri_CREATE_ALLOW_RELATIVE
,
10501 "http://www.winehq.org",0,
10502 "http://www.winehq.org/data",
10503 "http://www.winehq.org/data",
10504 "http://www.winehq.org:80/data",
10507 "file.txt",Uri_CREATE_ALLOW_RELATIVE
,
10508 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE
,
10509 "file://c:\\dir\\file.txt",
10510 "file:///c:/dir/file.txt",
10511 "file:///c:/dir/file.txt",
10514 "",Uri_CREATE_ALLOW_RELATIVE
,
10522 "test",Uri_CREATE_ALLOW_RELATIVE
,
10530 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
10532 "file://c:\\dir\\file.txt",
10533 "file:///c:/dir/file.txt",
10534 "file:///c:/dir/file.txt",
10535 "file:///c:/dir/file.txt",
10539 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10540 static void _test_urlmon_display_name(unsigned line
, IMoniker
*mon
, const char *exurl
)
10542 WCHAR
*display_name
;
10545 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &display_name
);
10546 ok_(__FILE__
,line
)(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
10547 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_name
), "unexpected display name: %s, expected %s\n",
10548 wine_dbgstr_w(display_name
), exurl
);
10550 CoTaskMemFree(display_name
);
10553 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10554 static void _test_display_uri(unsigned line
, IMoniker
*mon
, const char *exurl
)
10556 IUriContainer
*uri_container
;
10561 hres
= IMoniker_QueryInterface(mon
, &IID_IUriContainer
, (void**)&uri_container
);
10562 ok(hres
== S_OK
, "Could not get IUriContainer iface: %08x\n", hres
);
10565 hres
= IUriContainer_GetIUri(uri_container
, &uri
);
10566 IUriContainer_Release(uri_container
);
10567 ok(hres
== S_OK
, "GetIUri failed: %08x\n", hres
);
10568 ok(uri
!= NULL
, "uri == NULL\n");
10570 hres
= IUri_GetDisplayUri(uri
, &display_uri
);
10572 ok(hres
== S_OK
, "GetDisplayUri failed: %08x\n", hres
);
10573 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_uri
), "unexpected display uri: %s, expected %s\n",
10574 wine_dbgstr_w(display_uri
), exurl
);
10575 SysFreeString(display_uri
);
10578 static void test_CreateURLMoniker(void)
10580 const create_urlmon_test_t
*test
;
10581 IMoniker
*mon
, *base_mon
;
10582 WCHAR
*url
, *base_url
;
10583 IUri
*uri
, *base_uri
;
10586 for(test
= create_urlmon_tests
; test
< create_urlmon_tests
+ sizeof(create_urlmon_tests
)/sizeof(*create_urlmon_tests
); test
++) {
10587 url
= a2w(test
->url
);
10588 base_url
= a2w(test
->base_url
);
10591 hres
= pCreateUri(base_url
, test
->base_uri_flags
, 0, &base_uri
);
10592 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
10594 hres
= pCreateURLMonikerEx2(NULL
, base_uri
, &base_mon
, URL_MK_NO_CANONICALIZE
);
10595 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10601 hres
= CreateURLMoniker(base_mon
, url
, &mon
);
10602 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10603 test_urlmon_display_name(mon
, test
->legacy_url
);
10604 test_display_uri(mon
, test
->legacy_url
);
10605 IMoniker_Release(mon
);
10607 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_LEGACY
);
10608 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10609 test_urlmon_display_name(mon
, test
->legacy_url
);
10610 test_display_uri(mon
, test
->legacy_url
);
10611 IMoniker_Release(mon
);
10613 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_UNIFORM
);
10614 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10615 test_urlmon_display_name(mon
, test
->uniform_url
);
10616 test_display_uri(mon
, test
->uniform_url
);
10617 IMoniker_Release(mon
);
10619 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_NO_CANONICALIZE
);
10620 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10621 test_urlmon_display_name(mon
, test
->no_canon_url
);
10622 test_display_uri(mon
, test
->no_canon_url
);
10623 IMoniker_Release(mon
);
10625 hres
= pCreateUri(url
, test
->uri_flags
, 0, &uri
);
10626 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
10628 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_LEGACY
);
10629 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10630 test_urlmon_display_name(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
10631 test_display_uri(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
10632 IMoniker_Release(mon
);
10634 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_UNIFORM
);
10635 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10636 test_urlmon_display_name(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
10637 test_display_uri(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
10638 IMoniker_Release(mon
);
10640 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_NO_CANONICALIZE
);
10641 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10642 test_urlmon_display_name(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
10643 test_display_uri(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
10644 IMoniker_Release(mon
);
10648 heap_free(base_url
);
10650 IUri_Release(base_uri
);
10652 IMoniker_Release(base_mon
);
10656 static int add_default_flags(DWORD flags
) {
10657 if(!(flags
& Uri_CREATE_NO_CANONICALIZE
))
10658 flags
|= Uri_CREATE_CANONICALIZE
;
10659 if(!(flags
& Uri_CREATE_NO_DECODE_EXTRA_INFO
))
10660 flags
|= Uri_CREATE_DECODE_EXTRA_INFO
;
10661 if(!(flags
& Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
))
10662 flags
|= Uri_CREATE_CRACK_UNKNOWN_SCHEMES
;
10663 if(!(flags
& Uri_CREATE_NO_PRE_PROCESS_HTML_URI
))
10664 flags
|= Uri_CREATE_PRE_PROCESS_HTML_URI
;
10665 if(!(flags
& Uri_CREATE_IE_SETTINGS
))
10666 flags
|= Uri_CREATE_NO_IE_SETTINGS
;
10671 static void test_IPersistStream(void)
10673 int i
, props_order
[Uri_PROPERTY_DWORD_LAST
+1] = { 0 };
10675 props_order
[Uri_PROPERTY_RAW_URI
] = 1;
10676 props_order
[Uri_PROPERTY_FRAGMENT
] = 2;
10677 props_order
[Uri_PROPERTY_HOST
] = 3;
10678 props_order
[Uri_PROPERTY_PASSWORD
] = 4;
10679 props_order
[Uri_PROPERTY_PATH
] = 5;
10680 props_order
[Uri_PROPERTY_PORT
] = 6;
10681 props_order
[Uri_PROPERTY_QUERY
] = 7;
10682 props_order
[Uri_PROPERTY_SCHEME_NAME
] = 8;
10683 props_order
[Uri_PROPERTY_USER_NAME
] = 9;
10685 for(i
=0; i
<sizeof(uri_tests
)/sizeof(*uri_tests
); i
++) {
10686 const uri_properties
*test
= uri_tests
+i
;
10689 IPersistStream
*persist_stream
;
10691 DWORD props
, props_no
, dw_data
[6];
10692 WCHAR str_data
[1024];
10693 ULARGE_INTEGER size
, max_size
;
10694 LARGE_INTEGER no_off
;
10697 if(test
->create_todo
|| test
->create_expected
!=S_OK
)
10700 uriW
= a2w(test
->uri
);
10701 hr
= pCreateUri(uriW
, test
->create_flags
, 0, &uri
);
10702 ok(hr
== S_OK
, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i
, hr
);
10704 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
10705 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10707 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &stream
);
10708 ok(hr
== S_OK
, "CreateStreamOnHGlobal failed 0x%08x.\n", hr
);
10709 hr
= IPersistStream_IsDirty(persist_stream
);
10710 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
10711 hr
= IPersistStream_Save(persist_stream
, stream
, FALSE
);
10712 ok(hr
== S_OK
, "%d) Save failed 0x%08x, expected S_OK.\n", i
, hr
);
10713 hr
= IPersistStream_IsDirty(persist_stream
);
10714 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
10715 no_off
.QuadPart
= 0;
10716 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
10717 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10718 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10719 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10720 hr
= IPersistStream_GetSizeMax(persist_stream
, &max_size
);
10721 ok(hr
== S_OK
, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i
, hr
);
10722 ok(U(size
).LowPart
+2 == U(max_size
).LowPart
,
10723 "%d) Written data size is %d, max_size %d.\n",
10724 i
, U(size
).LowPart
, U(max_size
).LowPart
);
10726 hr
= IStream_Read(stream
, (void*)dw_data
, sizeof(DWORD
), NULL
);
10727 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10728 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
10729 i
, dw_data
[0]-2, U(size
).LowPart
);
10730 hr
= IStream_Read(stream
, (void*)dw_data
, 6*sizeof(DWORD
), NULL
);
10731 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10732 ok(dw_data
[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[0]);
10733 ok(dw_data
[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[1]);
10734 ok(dw_data
[2] == add_default_flags(test
->create_flags
),
10735 "%d) Incorrect value %x, expected %x (creation flags).\n",
10736 i
, dw_data
[2], add_default_flags(test
->create_flags
));
10737 ok(dw_data
[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[3]);
10738 ok(dw_data
[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[4]);
10739 ok(dw_data
[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[5]);
10742 for(props
=0; props
<=Uri_PROPERTY_DWORD_LAST
; props
++) {
10743 if(!props_order
[props
])
10746 if(props
<= Uri_PROPERTY_STRING_LAST
) {
10747 if(test
->str_props
[props
].expected
== S_OK
)
10750 if(test
->dword_props
[props
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
10754 if(test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTP
10755 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_FTP
10756 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTPS
)
10759 hr
= IStream_Read(stream
, (void*)&props
, sizeof(DWORD
), NULL
);
10760 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10761 ok(props
== props_no
, "%d) Properties no is %d, expected %d.\n", i
, props
, props_no
);
10766 hr
= IStream_Read(stream
, (void*)dw_data
, 2*sizeof(DWORD
), NULL
);
10767 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10769 ok(dw_data
[2]<props_order
[dw_data
[0]],
10770 "%d) Incorrect properties order (%d, %d)\n",
10771 i
, dw_data
[0], dw_data
[3]);
10772 dw_data
[2] = props_order
[dw_data
[0]];
10773 dw_data
[3] = dw_data
[0];
10775 if(dw_data
[0]<=Uri_PROPERTY_STRING_LAST
) {
10776 const uri_str_property
*prop
= test
->str_props
+dw_data
[0];
10777 hr
= IStream_Read(stream
, (void*)str_data
, dw_data
[1], NULL
);
10778 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10779 ok(!strcmp_aw(prop
->value
, str_data
) || broken(prop
->broken_value
&& !strcmp_aw(prop
->broken_value
, str_data
)),
10780 "%d) Expected %s but got %s (%d).\n", i
, prop
->value
, wine_dbgstr_w(str_data
), dw_data
[0]);
10781 } else if(dw_data
[0]>=Uri_PROPERTY_DWORD_START
&& dw_data
[0]<=Uri_PROPERTY_DWORD_LAST
) {
10782 const uri_dword_property
*prop
= test
->dword_props
+dw_data
[0]-Uri_PROPERTY_DWORD_START
;
10783 ok(dw_data
[1] == sizeof(DWORD
), "%d) Size of dword property is %d (%d)\n", i
, dw_data
[1], dw_data
[0]);
10784 hr
= IStream_Read(stream
, (void*)&dw_data
[1], sizeof(DWORD
), NULL
);
10785 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10786 ok(prop
->value
== dw_data
[1], "%d) Expected %d but got %d (%d).\n", i
, prop
->value
, dw_data
[1], dw_data
[0]);
10788 ok(FALSE
, "%d) Incorrect property type (%d)\n", i
, dw_data
[0]);
10792 ok(props
== 0, "%d) No all properties were processed %d. Next property type: %d\n",
10793 i
, props
, dw_data
[0]);
10795 IStream_Release(stream
);
10796 IPersistStream_Release(persist_stream
);
10805 hurlmon
= GetModuleHandle("urlmon.dll");
10806 pCoInternetGetSession
= (void*) GetProcAddress(hurlmon
, "CoInternetGetSession");
10807 pCreateUri
= (void*) GetProcAddress(hurlmon
, "CreateUri");
10808 pCreateUriWithFragment
= (void*) GetProcAddress(hurlmon
, "CreateUriWithFragment");
10809 pCreateIUriBuilder
= (void*) GetProcAddress(hurlmon
, "CreateIUriBuilder");
10810 pCoInternetCombineIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineIUri");
10811 pCoInternetCombineUrlEx
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineUrlEx");
10812 pCoInternetParseIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetParseIUri");
10813 pCreateURLMonikerEx
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx");
10814 pCreateURLMonikerEx2
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx2");
10817 win_skip("CreateUri is not present, skipping tests.\n");
10821 trace("test CreateUri invalid flags...\n");
10822 test_CreateUri_InvalidFlags();
10824 trace("test CreateUri invalid args...\n");
10825 test_CreateUri_InvalidArgs();
10827 trace("test CreateUri invalid URIs...\n");
10828 test_CreateUri_InvalidUri();
10830 trace("test IUri_GetPropertyBSTR...\n");
10831 test_IUri_GetPropertyBSTR();
10833 trace("test IUri_GetPropertyDWORD...\n");
10834 test_IUri_GetPropertyDWORD();
10836 trace("test IUri_GetStrProperties...\n");
10837 test_IUri_GetStrProperties();
10839 trace("test IUri_GetDwordProperties...\n");
10840 test_IUri_GetDwordProperties();
10842 trace("test IUri_GetPropertyLength...\n");
10843 test_IUri_GetPropertyLength();
10845 trace("test IUri_GetProperties...\n");
10846 test_IUri_GetProperties();
10848 trace("test IUri_HasProperty...\n");
10849 test_IUri_HasProperty();
10851 trace("test IUri_IsEqual...\n");
10852 test_IUri_IsEqual();
10854 trace("test CreateUriWithFragment invalid args...\n");
10855 test_CreateUriWithFragment_InvalidArgs();
10857 trace("test CreateUriWithFragment invalid flags...\n");
10858 test_CreateUriWithFragment_InvalidFlags();
10860 trace("test CreateUriWithFragment...\n");
10861 test_CreateUriWithFragment();
10863 trace("test CreateIUriBuilder...\n");
10864 test_CreateIUriBuilder();
10866 trace("test IUriBuilder_CreateInvalidArgs...\n");
10867 test_IUriBuilder_CreateInvalidArgs();
10869 trace("test IUriBuilder...\n");
10870 test_IUriBuilder();
10872 trace("test IUriBuilder_GetInvalidArgs...\n");
10873 test_IUriBuilder_GetInvalidArgs();
10875 trace("test IUriBuilder_HasBeenModified...\n");
10876 test_IUriBuilder_HasBeenModified();
10878 trace("test IUriBuilder_IUriProperty...\n");
10879 test_IUriBuilder_IUriProperty();
10881 trace("test IUriBuilder_RemoveProperties...\n");
10882 test_IUriBuilder_RemoveProperties();
10884 trace("test IUriBuilder miscellaneous...\n");
10885 test_IUriBuilder_Misc();
10887 trace("test IUriBuilderFactory...\n");
10888 test_IUriBuilderFactory();
10890 trace("test CoInternetCombineIUri...\n");
10891 test_CoInternetCombineIUri();
10893 trace("test CoInternetCombineUrlEx...\n");
10894 test_CoInternetCombineUrlEx();
10896 trace("test CoInternetParseIUri Invalid Args...\n");
10897 test_CoInternetParseIUri_InvalidArgs();
10899 trace("test CoInternetParseIUri...\n");
10900 test_CoInternetParseIUri();
10902 register_protocols();
10904 trace("test CoInternetCombineIUri pluggable...\n");
10905 test_CoInternetCombineIUri_Pluggable();
10907 trace("test CoInternetCombineUrlEx Pluggable...\n");
10908 test_CoInternetCombineUrlEx_Pluggable();
10910 trace("test CoInternetParseIUri pluggable...\n");
10911 test_CoInternetParseIUri_Pluggable();
10913 trace("test CreateURLMoniker...\n");
10914 test_CreateURLMoniker();
10916 trace("test IPersistStream...\n");
10917 test_IPersistStream();
10919 unregister_protocols();