urlmon: Reimplement canonicalize_ipv6address on top of ntdll functions.
[wine.git] / dlls / urlmon / tests / uri.c
blobb161d1f3eec8b2617106455b1ae3a3c93c51178e
1 /*
2 * UrlMon IUri tests
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>
22 #include <stdarg.h>
23 #include <stddef.h>
25 #define COBJMACROS
26 #define CONST_VTABLE
27 #define WIN32_LEAN_AND_MEAN
29 #include "windef.h"
30 #include "winbase.h"
31 #include "urlmon.h"
32 #include "shlwapi.h"
33 #include "wininet.h"
34 #include "strsafe.h"
35 #include "initguid.h"
36 #include <wine/heap.h>
38 DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
40 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
41 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
42 #define URI_BUILDER_STR_PROPERTY_COUNT 7
44 #define DEFINE_EXPECT(func) \
45 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
47 #define SET_EXPECT(func) \
48 expect_ ## func = TRUE
50 #define CHECK_EXPECT(func) \
51 do { \
52 ok(expect_ ##func, "unexpected call " #func "\n"); \
53 expect_ ## func = FALSE; \
54 called_ ## func = TRUE; \
55 }while(0)
57 #define CHECK_EXPECT2(func) \
58 do { \
59 ok(expect_ ##func, "unexpected call " #func "\n"); \
60 called_ ## func = TRUE; \
61 }while(0)
63 #define CHECK_CALLED(func) \
64 do { \
65 ok(called_ ## func, "expected " #func "\n"); \
66 expect_ ## func = called_ ## func = FALSE; \
67 }while(0)
69 DEFINE_EXPECT(CombineUrl);
70 DEFINE_EXPECT(ParseUrl);
72 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
73 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
74 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
75 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
76 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
77 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
78 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
79 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
80 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
82 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
83 '.','o','r','g','/',0};
84 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
85 '.','o','r','g','/','#','F','r','a','g',0};
87 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
88 'e','s','t','i','n','g',0};
89 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
90 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
92 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
94 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
95 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
97 static PARSEACTION parse_action;
98 static DWORD parse_flags;
100 typedef struct _uri_create_flag_test {
101 DWORD flags;
102 HRESULT expected;
103 } uri_create_flag_test;
105 static const uri_create_flag_test invalid_flag_tests[] = {
106 /* Set of invalid flag combinations to test for. */
107 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
108 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
109 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
110 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
111 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
114 typedef struct _uri_str_property {
115 const char* value;
116 HRESULT expected;
117 BOOL todo;
118 const char* broken_value;
119 const char* value2;
120 HRESULT expected2;
121 } uri_str_property;
123 typedef struct _uri_dword_property {
124 DWORD value;
125 HRESULT expected;
126 BOOL todo;
127 BOOL broken_combine_hres;
128 } uri_dword_property;
130 typedef struct _uri_properties {
131 const char* uri;
132 DWORD create_flags;
133 HRESULT create_expected;
134 BOOL create_todo;
136 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
137 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
138 } uri_properties;
140 static const uri_properties uri_tests[] = {
141 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
143 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
144 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
145 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
146 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
147 {"",S_FALSE,FALSE}, /* EXTENSION */
148 {"",S_FALSE,FALSE}, /* FRAGMENT */
149 {"www.winehq.org",S_OK,FALSE}, /* HOST */
150 {"",S_FALSE,FALSE}, /* PASSWORD */
151 {"/",S_OK,FALSE}, /* PATH */
152 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
153 {"",S_FALSE,FALSE}, /* QUERY */
154 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
155 {"http",S_OK,FALSE}, /* SCHEME_NAME */
156 {"",S_FALSE,FALSE}, /* USER_INFO */
157 {"",S_FALSE,FALSE} /* USER_NAME */
160 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
161 {80,S_OK,FALSE}, /* PORT */
162 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
163 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
166 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
168 {"http://winehq.org/tests",S_OK,FALSE},
169 {"winehq.org",S_OK,FALSE},
170 {"http://winehq.org/tests",S_OK,FALSE},
171 {"winehq.org",S_OK,FALSE},
172 {"",S_FALSE,FALSE},
173 {"",S_FALSE,FALSE},
174 {"winehq.org",S_OK,FALSE},
175 {"",S_FALSE,FALSE},
176 {"/tests",S_OK,FALSE},
177 {"/tests",S_OK,FALSE},
178 {"",S_FALSE,FALSE},
179 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
180 {"http",S_OK,FALSE},
181 {"",S_FALSE,FALSE},
182 {"",S_FALSE,FALSE}
185 {Uri_HOST_DNS,S_OK,FALSE},
186 {80,S_OK,FALSE},
187 {URL_SCHEME_HTTP,S_OK,FALSE},
188 {URLZONE_INVALID,E_NOTIMPL,FALSE}
191 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
193 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
194 {"www.winehq.org",S_OK,FALSE},
195 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
196 {"winehq.org",S_OK,FALSE},
197 {"",S_FALSE,FALSE},
198 {"",S_FALSE,FALSE},
199 {"www.winehq.org",S_OK,FALSE},
200 {"",S_FALSE,FALSE},
201 {"/",S_OK,FALSE},
202 {"/?query=x&return=y",S_OK,FALSE},
203 {"?query=x&return=y",S_OK,FALSE},
204 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
205 {"http",S_OK,FALSE},
206 {"",S_FALSE,FALSE},
207 {"",S_FALSE,FALSE}
210 {Uri_HOST_DNS,S_OK,FALSE},
211 {80,S_OK,FALSE},
212 {URL_SCHEME_HTTP,S_OK,FALSE},
213 {URLZONE_INVALID,E_NOTIMPL,FALSE},
216 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
218 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
219 {"www.winehq.org",S_OK,FALSE},
220 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
221 {"winehq.org",S_OK,FALSE},
222 {"",S_FALSE,FALSE},
223 {"",S_FALSE,FALSE},
224 {"www.winehq.org",S_OK,FALSE},
225 {"",S_FALSE,FALSE},
226 {"/",S_OK,FALSE},
227 {"/?query=x&return=y",S_OK,FALSE},
228 {"?query=x&return=y",S_OK,FALSE},
229 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
230 {"https",S_OK,FALSE},
231 {"",S_FALSE,FALSE},
232 {"",S_FALSE,FALSE}
235 {Uri_HOST_DNS,S_OK,FALSE},
236 {443,S_OK,FALSE},
237 {URL_SCHEME_HTTPS,S_OK,FALSE},
238 {URLZONE_INVALID,E_NOTIMPL,FALSE},
241 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
243 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
244 {"usEr%3Ainfo@example.com",S_OK,FALSE},
245 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
246 {"example.com",S_OK,FALSE},
247 {"",S_FALSE,FALSE},
248 {"",S_FALSE,FALSE},
249 {"example.com",S_OK,FALSE},
250 {"",S_FALSE,FALSE},
251 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
252 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
253 {"",S_FALSE,FALSE},
254 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
255 {"http",S_OK,FALSE},
256 {"usEr%3Ainfo",S_OK,FALSE},
257 {"usEr%3Ainfo",S_OK,FALSE}
260 {Uri_HOST_DNS,S_OK,FALSE},
261 {80,S_OK,FALSE},
262 {URL_SCHEME_HTTP,S_OK,FALSE},
263 {URLZONE_INVALID,E_NOTIMPL,FALSE},
266 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
268 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
269 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
270 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
271 {"winehq.org",S_OK,FALSE},
272 {".txt",S_OK,FALSE},
273 {"",S_FALSE,FALSE},
274 {"ftp.winehq.org",S_OK,FALSE},
275 {"wine",S_OK,FALSE},
276 {"/dir/foo%20bar.txt",S_OK,FALSE},
277 {"/dir/foo%20bar.txt",S_OK,FALSE},
278 {"",S_FALSE,FALSE},
279 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
280 {"ftp",S_OK,FALSE},
281 {"winepass:wine",S_OK,FALSE},
282 {"winepass",S_OK,FALSE}
285 {Uri_HOST_DNS,S_OK,FALSE},
286 {9999,S_OK,FALSE},
287 {URL_SCHEME_FTP,S_OK,FALSE},
288 {URLZONE_INVALID,E_NOTIMPL,FALSE}
291 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
293 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
294 {"",S_FALSE,FALSE},
295 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
296 {"",S_FALSE,FALSE},
297 {".mp3",S_OK,FALSE},
298 {"",S_FALSE,FALSE},
299 {"",S_FALSE,FALSE},
300 {"",S_FALSE,FALSE},
301 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
302 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
303 {"",S_FALSE,FALSE},
304 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
305 {"file",S_OK,FALSE},
306 {"",S_FALSE,FALSE},
307 {"",S_FALSE,FALSE}
310 {Uri_HOST_UNKNOWN,S_OK,FALSE},
311 {0,S_FALSE,FALSE},
312 {URL_SCHEME_FILE,S_OK,FALSE},
313 {URLZONE_INVALID,E_NOTIMPL,FALSE}
316 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
318 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
319 {"",S_FALSE,FALSE},
320 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
321 {"",S_FALSE,FALSE},
322 {".mp3",S_OK,FALSE},
323 {"",S_FALSE,FALSE},
324 {"",S_FALSE,FALSE},
325 {"",S_FALSE,FALSE},
326 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
327 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
328 {"",S_FALSE,FALSE},
329 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
330 {"file",S_OK,FALSE},
331 {"",S_FALSE,FALSE},
332 {"",S_FALSE,FALSE}
335 {Uri_HOST_UNKNOWN,S_OK,FALSE},
336 {0,S_FALSE,FALSE},
337 {URL_SCHEME_FILE,S_OK,FALSE},
338 {URLZONE_INVALID,E_NOTIMPL,FALSE}
341 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
343 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
344 {"",S_FALSE,FALSE},
345 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
346 {"",S_FALSE,FALSE},
347 {".txt",S_OK,FALSE},
348 {"",S_FALSE,FALSE},
349 {"",S_FALSE,FALSE},
350 {"",S_FALSE,FALSE},
351 {"/tests/test%20file.README.txt",S_OK,FALSE},
352 {"/tests/test%20file.README.txt",S_OK,FALSE},
353 {"",S_FALSE,FALSE},
354 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
355 {"file",S_OK,FALSE},
356 {"",S_FALSE,FALSE},
357 {"",S_FALSE,FALSE}
360 {Uri_HOST_UNKNOWN,S_OK,FALSE},
361 {0,S_FALSE,FALSE},
362 {URL_SCHEME_FILE,S_OK,FALSE},
363 {URLZONE_INVALID,E_NOTIMPL,FALSE}
366 { "file:///z:/test dir/README.txt", 0, S_OK, FALSE,
368 {"file:///z:/test%20dir/README.txt",S_OK},
369 {"",S_FALSE},
370 {"file:///z:/test%20dir/README.txt",S_OK},
371 {"",S_FALSE},
372 {".txt",S_OK},
373 {"",S_FALSE},
374 {"",S_FALSE},
375 {"",S_FALSE},
376 {"/z:/test%20dir/README.txt",S_OK},
377 {"/z:/test%20dir/README.txt",S_OK},
378 {"",S_FALSE},
379 {"file:///z:/test dir/README.txt",S_OK},
380 {"file",S_OK},
381 {"",S_FALSE},
382 {"",S_FALSE}
385 {Uri_HOST_UNKNOWN,S_OK,FALSE},
386 {0,S_FALSE,FALSE},
387 {URL_SCHEME_FILE,S_OK,FALSE},
388 {URLZONE_INVALID,E_NOTIMPL,FALSE}
391 { "file:///z:/test dir/README.txt#hash part", 0, S_OK, FALSE,
393 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
394 {"",S_FALSE},
395 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
396 {"",S_FALSE},
397 {".txt#hash%20part",S_OK},
398 {"",S_FALSE},
399 {"",S_FALSE},
400 {"",S_FALSE},
401 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
402 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
403 {"",S_FALSE},
404 {"file:///z:/test dir/README.txt#hash part",S_OK},
405 {"file",S_OK},
406 {"",S_FALSE},
407 {"",S_FALSE}
410 {Uri_HOST_UNKNOWN,S_OK,FALSE},
411 {0,S_FALSE,FALSE},
412 {URL_SCHEME_FILE,S_OK,FALSE},
413 {URLZONE_INVALID,E_NOTIMPL,FALSE}
416 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
418 {"urn:nothing:should:happen here",S_OK,FALSE},
419 {"",S_FALSE,FALSE},
420 {"urn:nothing:should:happen here",S_OK,FALSE},
421 {"",S_FALSE,FALSE},
422 {"",S_FALSE,FALSE},
423 {"",S_FALSE,FALSE},
424 {"",S_FALSE,FALSE},
425 {"",S_FALSE,FALSE},
426 {"nothing:should:happen here",S_OK,FALSE},
427 {"nothing:should:happen here",S_OK,FALSE},
428 {"",S_FALSE,FALSE},
429 {"urn:nothing:should:happen here",S_OK,FALSE},
430 {"urn",S_OK,FALSE},
431 {"",S_FALSE,FALSE},
432 {"",S_FALSE,FALSE}
435 {Uri_HOST_UNKNOWN,S_OK,FALSE},
436 {0,S_FALSE,FALSE},
437 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
438 {URLZONE_INVALID,E_NOTIMPL,FALSE}
441 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
443 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
444 {"127.0.0.1",S_OK,FALSE},
445 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
446 {"",S_FALSE,FALSE},
447 {".txt",S_OK,FALSE},
448 {"",S_FALSE,FALSE},
449 {"127.0.0.1",S_OK,FALSE},
450 {"",S_FALSE,FALSE},
451 {"/test%20dir/test.txt",S_OK,FALSE},
452 {"/test%20dir/test.txt",S_OK,FALSE},
453 {"",S_FALSE,FALSE},
454 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
455 {"http",S_OK,FALSE},
456 {"",S_FALSE,FALSE},
457 {"",S_FALSE,FALSE}
460 {Uri_HOST_IPV4,S_OK,FALSE},
461 {80,S_OK,FALSE},
462 {URL_SCHEME_HTTP,S_OK,FALSE},
463 {URLZONE_INVALID,E_NOTIMPL,FALSE}
466 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
468 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
469 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
470 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
471 {"",S_FALSE,FALSE},
472 {"",S_FALSE,FALSE},
473 {"",S_FALSE,FALSE},
474 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
475 {"",S_FALSE,FALSE},
476 {"/",S_OK,FALSE},
477 {"/",S_OK,FALSE},
478 {"",S_FALSE,FALSE},
479 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
480 {"http",S_OK,FALSE},
481 {"",S_FALSE,FALSE},
482 {"",S_FALSE,FALSE}
485 {Uri_HOST_IPV6,S_OK,FALSE},
486 {80,S_OK,FALSE},
487 {URL_SCHEME_HTTP,S_OK,FALSE},
488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
491 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
493 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
494 {"[::13.1.68.3]",S_OK,FALSE},
495 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
496 {"",S_FALSE,FALSE},
497 {"",S_FALSE,FALSE},
498 {"",S_FALSE,FALSE},
499 {"::13.1.68.3",S_OK,FALSE},
500 {"",S_FALSE,FALSE},
501 {"/",S_OK,FALSE},
502 {"/",S_OK,FALSE},
503 {"",S_FALSE,FALSE},
504 {"ftp://[::13.1.68.3]",S_OK,FALSE},
505 {"ftp",S_OK,FALSE},
506 {"",S_FALSE,FALSE},
507 {"",S_FALSE,FALSE}
510 {Uri_HOST_IPV6,S_OK,FALSE},
511 {21,S_OK,FALSE},
512 {URL_SCHEME_FTP,S_OK,FALSE},
513 {URLZONE_INVALID,E_NOTIMPL,FALSE}
516 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
518 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
519 {"[fedc:ba98::3210]",S_OK,FALSE},
520 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
521 {"",S_FALSE,FALSE},
522 {"",S_FALSE,FALSE},
523 {"",S_FALSE,FALSE},
524 {"fedc:ba98::3210",S_OK,FALSE},
525 {"",S_FALSE,FALSE},
526 {"/",S_OK,FALSE},
527 {"/",S_OK,FALSE},
528 {"",S_FALSE,FALSE},
529 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
530 {"http",S_OK,FALSE},
531 {"",S_FALSE,FALSE},
532 {"",S_FALSE,FALSE},
535 {Uri_HOST_IPV6,S_OK,FALSE},
536 {80,S_OK,FALSE},
537 {URL_SCHEME_HTTP,S_OK,FALSE},
538 {URLZONE_INVALID,E_NOTIMPL,FALSE}
541 { "1234://www.winehq.org", 0, S_OK, FALSE,
543 {"1234://www.winehq.org/",S_OK,FALSE},
544 {"www.winehq.org",S_OK,FALSE},
545 {"1234://www.winehq.org/",S_OK,FALSE},
546 {"winehq.org",S_OK,FALSE},
547 {"",S_FALSE,FALSE},
548 {"",S_FALSE,FALSE},
549 {"www.winehq.org",S_OK,FALSE},
550 {"",S_FALSE,FALSE},
551 {"/",S_OK,FALSE},
552 {"/",S_OK,FALSE},
553 {"",S_FALSE,FALSE},
554 {"1234://www.winehq.org",S_OK,FALSE},
555 {"1234",S_OK,FALSE},
556 {"",S_FALSE,FALSE},
557 {"",S_FALSE,FALSE}
560 {Uri_HOST_DNS,S_OK,FALSE},
561 {0,S_FALSE,FALSE},
562 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
563 {URLZONE_INVALID,E_NOTIMPL,FALSE}
566 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
567 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
569 {"file:///C:/test/test.mp3",S_OK,FALSE},
570 {"",S_FALSE,FALSE},
571 {"file:///C:/test/test.mp3",S_OK,FALSE},
572 {"",S_FALSE,FALSE},
573 {".mp3",S_OK,FALSE},
574 {"",S_FALSE,FALSE},
575 {"",S_FALSE,FALSE},
576 {"",S_FALSE,FALSE},
577 {"/C:/test/test.mp3",S_OK,FALSE},
578 {"/C:/test/test.mp3",S_OK,FALSE},
579 {"",S_FALSE,FALSE},
580 {"C:/test/test.mp3",S_OK,FALSE},
581 {"file",S_OK,FALSE},
582 {"",S_FALSE,FALSE},
583 {"",S_FALSE,FALSE}
586 {Uri_HOST_UNKNOWN,S_OK,FALSE},
587 {0,S_FALSE,FALSE},
588 {URL_SCHEME_FILE,S_OK,FALSE},
589 {URLZONE_INVALID,E_NOTIMPL,FALSE}
592 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
593 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
595 {"file://server/test.mp3",S_OK,FALSE},
596 {"server",S_OK,FALSE},
597 {"file://server/test.mp3",S_OK,FALSE},
598 {"",S_FALSE,FALSE},
599 {".mp3",S_OK,FALSE},
600 {"",S_FALSE,FALSE},
601 {"server",S_OK,FALSE},
602 {"",S_FALSE,FALSE},
603 {"/test.mp3",S_OK,FALSE},
604 {"/test.mp3",S_OK,FALSE},
605 {"",S_FALSE,FALSE},
606 {"\\\\Server/test.mp3",S_OK,FALSE},
607 {"file",S_OK,FALSE},
608 {"",S_FALSE,FALSE},
609 {"",S_FALSE,FALSE}
612 {Uri_HOST_DNS,S_OK,FALSE},
613 {0,S_FALSE,FALSE},
614 {URL_SCHEME_FILE,S_OK,FALSE},
615 {URLZONE_INVALID,E_NOTIMPL,FALSE}
618 { "C:/test/test.mp3#fragment|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
620 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
621 {"",S_FALSE,FALSE},
622 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
623 {"",S_FALSE,FALSE},
624 {".mp3#fragment|part",S_OK,FALSE},
625 {"",S_FALSE,FALSE},
626 {"",S_FALSE,FALSE},
627 {"",S_FALSE,FALSE},
628 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
629 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
630 {"",S_FALSE,FALSE},
631 {"C:/test/test.mp3#fragment|part",S_OK,FALSE},
632 {"file",S_OK,FALSE},
633 {"",S_FALSE,FALSE},
634 {"",S_FALSE,FALSE}
637 {Uri_HOST_UNKNOWN,S_OK,FALSE},
638 {0,S_FALSE,FALSE},
639 {URL_SCHEME_FILE,S_OK,FALSE},
640 {URLZONE_INVALID,E_NOTIMPL,FALSE}
643 { "C:/test/test.mp3?query|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
645 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
646 {"",S_FALSE,FALSE},
647 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
648 {"",S_FALSE,FALSE},
649 {".mp3",S_OK,FALSE},
650 {"",S_FALSE,FALSE},
651 {"",S_FALSE,FALSE},
652 {"",S_FALSE,FALSE},
653 {"C:\\test\\test.mp3",S_OK,FALSE},
654 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
655 {"?query|part",S_OK,FALSE},
656 {"C:/test/test.mp3?query|part",S_OK,FALSE},
657 {"file",S_OK,FALSE},
658 {"",S_FALSE,FALSE},
659 {"",S_FALSE,FALSE}
662 {Uri_HOST_UNKNOWN,S_OK,FALSE},
663 {0,S_FALSE,FALSE},
664 {URL_SCHEME_FILE,S_OK,FALSE},
665 {URLZONE_INVALID,E_NOTIMPL,FALSE}
668 { "C:/test/test.mp3?query|part#hash|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
670 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
671 {"",S_FALSE,FALSE},
672 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
673 {"",S_FALSE,FALSE},
674 {".mp3",S_OK,FALSE},
675 {"#hash|part",S_OK,FALSE},
676 {"",S_FALSE,FALSE},
677 {"",S_FALSE,FALSE},
678 {"C:\\test\\test.mp3",S_OK,FALSE},
679 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
680 {"?query|part",S_OK,FALSE},
681 {"C:/test/test.mp3?query|part#hash|part",S_OK,FALSE},
682 {"file",S_OK,FALSE},
683 {"",S_FALSE,FALSE},
684 {"",S_FALSE,FALSE}
687 {Uri_HOST_UNKNOWN,S_OK,FALSE},
688 {0,S_FALSE,FALSE},
689 {URL_SCHEME_FILE,S_OK,FALSE},
690 {URLZONE_INVALID,E_NOTIMPL,FALSE}
693 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
695 {"*:www.winehq.org/test",S_OK,FALSE},
696 {"www.winehq.org",S_OK,FALSE},
697 {"*:www.winehq.org/test",S_OK,FALSE},
698 {"winehq.org",S_OK,FALSE},
699 {"",S_FALSE,FALSE},
700 {"",S_FALSE,FALSE},
701 {"www.winehq.org",S_OK,FALSE},
702 {"",S_FALSE,FALSE},
703 {"/test",S_OK,FALSE},
704 {"/test",S_OK,FALSE},
705 {"",S_FALSE,FALSE},
706 {"www.winehq.org/test",S_OK,FALSE},
707 {"*",S_OK,FALSE},
708 {"",S_FALSE,FALSE},
709 {"",S_FALSE,FALSE}
712 {Uri_HOST_DNS,S_OK,FALSE},
713 {0,S_FALSE,FALSE},
714 {URL_SCHEME_WILDCARD,S_OK,FALSE},
715 {URLZONE_INVALID,E_NOTIMPL,FALSE}
718 /* Valid since the '*' is the only character in the scheme name. */
719 { "*:www.winehq.org/test", 0, S_OK, FALSE,
721 {"*:www.winehq.org/test",S_OK,FALSE},
722 {"www.winehq.org",S_OK,FALSE},
723 {"*:www.winehq.org/test",S_OK,FALSE},
724 {"winehq.org",S_OK,FALSE},
725 {"",S_FALSE,FALSE},
726 {"",S_FALSE,FALSE},
727 {"www.winehq.org",S_OK,FALSE},
728 {"",S_FALSE,FALSE},
729 {"/test",S_OK,FALSE},
730 {"/test",S_OK,FALSE},
731 {"",S_FALSE,FALSE},
732 {"*:www.winehq.org/test",S_OK,FALSE},
733 {"*",S_OK,FALSE},
734 {"",S_FALSE,FALSE},
735 {"",S_FALSE,FALSE}
738 {Uri_HOST_DNS,S_OK,FALSE},
739 {0,S_FALSE,FALSE},
740 {URL_SCHEME_WILDCARD,S_OK,FALSE},
741 {URLZONE_INVALID,E_NOTIMPL,FALSE}
744 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
746 {"/../some dir/test.ext",S_OK,FALSE},
747 {"",S_FALSE,FALSE},
748 {"/../some dir/test.ext",S_OK,FALSE},
749 {"",S_FALSE,FALSE},
750 {".ext",S_OK,FALSE},
751 {"",S_FALSE,FALSE},
752 {"",S_FALSE,FALSE},
753 {"",S_FALSE,FALSE},
754 {"/../some dir/test.ext",S_OK,FALSE},
755 {"/../some dir/test.ext",S_OK,FALSE},
756 {"",S_FALSE,FALSE},
757 {"/../some dir/test.ext",S_OK,FALSE},
758 {"",S_FALSE,FALSE},
759 {"",S_FALSE,FALSE},
760 {"",S_FALSE,FALSE}
763 {Uri_HOST_UNKNOWN,S_OK,FALSE},
764 {0,S_FALSE,FALSE},
765 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
766 {URLZONE_INVALID,E_NOTIMPL,FALSE}
769 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
771 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
772 {"",S_OK,FALSE},
773 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
774 {"",S_FALSE,FALSE},
775 {"",S_FALSE,FALSE},
776 {"",S_FALSE,FALSE},
777 {"",S_OK,FALSE},
778 {"",S_FALSE,FALSE},
779 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
780 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
781 {"",S_FALSE,FALSE},
782 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
783 {"*",S_OK,FALSE},
784 {"",S_FALSE,FALSE},
785 {"",S_FALSE,FALSE},
788 {Uri_HOST_UNKNOWN,S_OK,FALSE},
789 {0,S_FALSE,FALSE},
790 {URL_SCHEME_WILDCARD,S_OK,FALSE},
791 {URLZONE_INVALID,E_NOTIMPL,FALSE}
794 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
795 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
797 {"zip:/.//google.com",S_OK,FALSE},
798 {"",S_FALSE,FALSE},
799 {"zip:/.//google.com",S_OK,FALSE},
800 {"",S_FALSE,FALSE},
801 {".com",S_OK,FALSE},
802 {"",S_FALSE,FALSE},
803 {"",S_FALSE,FALSE},
804 {"",S_FALSE,FALSE},
805 {"/.//google.com",S_OK,FALSE},
806 {"/.//google.com",S_OK,FALSE},
807 {"",S_FALSE,FALSE},
808 {"zip://google.com",S_OK,FALSE},
809 {"zip",S_OK,FALSE},
810 {"",S_FALSE,FALSE},
811 {"",S_FALSE,FALSE}
814 {Uri_HOST_UNKNOWN,S_OK,FALSE},
815 {0,S_FALSE,FALSE},
816 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
817 {URLZONE_INVALID,E_NOTIMPL,FALSE}
820 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
821 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
823 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
824 {"user:pass:word@winehq.org",S_OK,FALSE},
825 {"ftp://winehq.org/",S_OK,FALSE},
826 {"winehq.org",S_OK,FALSE},
827 {"",S_FALSE,FALSE},
828 {"",S_FALSE,FALSE},
829 {"winehq.org",S_OK,FALSE},
830 {"pass:word",S_OK,FALSE},
831 {"/",S_OK,FALSE},
832 {"/",S_OK,FALSE},
833 {"",S_FALSE,FALSE},
834 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
835 {"ftp",S_OK,FALSE},
836 {"user:pass:word",S_OK,FALSE},
837 {"user",S_OK,FALSE}
840 {Uri_HOST_DNS,S_OK,FALSE},
841 {21,S_OK,FALSE},
842 {URL_SCHEME_FTP,S_OK,FALSE},
843 {URLZONE_INVALID,E_NOTIMPL,FALSE}
846 /* Make sure % encoded unreserved characters are decoded. */
847 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
849 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
850 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
851 {"ftp://ftp.google.com/",S_OK,FALSE},
852 {"google.com",S_OK,FALSE},
853 {"",S_FALSE,FALSE},
854 {"",S_FALSE,FALSE},
855 {"ftp.google.com",S_OK,FALSE},
856 {"PASS",S_OK,FALSE},
857 {"/",S_OK,FALSE},
858 {"/",S_OK,FALSE},
859 {"",S_FALSE,FALSE},
860 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
861 {"ftp",S_OK,FALSE},
862 {"wINe:PASS",S_OK,FALSE},
863 {"wINe",S_OK,FALSE}
866 {Uri_HOST_DNS,S_OK,FALSE},
867 {21,S_OK,FALSE},
868 {URL_SCHEME_FTP,S_OK,FALSE},
869 {URLZONE_INVALID,E_NOTIMPL,FALSE}
872 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
873 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
875 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
876 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
877 {"ftp://ftp.google.com/",S_OK,FALSE},
878 {"google.com",S_OK,FALSE},
879 {"",S_FALSE,FALSE},
880 {"",S_FALSE,FALSE},
881 {"ftp.google.com",S_OK,FALSE},
882 {"PA%7B%7D",S_OK,FALSE},
883 {"/",S_OK,FALSE},
884 {"/",S_OK,FALSE},
885 {"",S_FALSE,FALSE},
886 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
887 {"ftp",S_OK,FALSE},
888 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
889 {"w%5D%5Be",S_OK,FALSE}
892 {Uri_HOST_DNS,S_OK,FALSE},
893 {21,S_OK,FALSE},
894 {URL_SCHEME_FTP,S_OK,FALSE},
895 {URLZONE_INVALID,E_NOTIMPL,FALSE}
898 /* You're allowed to have an empty password portion in the userinfo section. */
899 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
901 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
902 {"empty:@ftp.google.com",S_OK,FALSE},
903 {"ftp://ftp.google.com/",S_OK,FALSE},
904 {"google.com",S_OK,FALSE},
905 {"",S_FALSE,FALSE},
906 {"",S_FALSE,FALSE},
907 {"ftp.google.com",S_OK,FALSE},
908 {"",S_OK,FALSE},
909 {"/",S_OK,FALSE},
910 {"/",S_OK,FALSE},
911 {"",S_FALSE,FALSE},
912 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
913 {"ftp",S_OK,FALSE},
914 {"empty:",S_OK,FALSE},
915 {"empty",S_OK,FALSE}
918 {Uri_HOST_DNS,S_OK,FALSE},
919 {21,S_OK,FALSE},
920 {URL_SCHEME_FTP,S_OK,FALSE},
921 {URLZONE_INVALID,E_NOTIMPL,FALSE}
924 /* Make sure forbidden characters in "userinfo" get encoded. */
925 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
927 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
928 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
929 {"ftp://ftp.google.com/",S_OK,FALSE},
930 {"google.com",S_OK,FALSE},
931 {"",S_FALSE,FALSE},
932 {"",S_FALSE,FALSE},
933 {"ftp.google.com",S_OK,FALSE},
934 {"",S_FALSE,FALSE},
935 {"/",S_OK,FALSE},
936 {"/",S_OK,FALSE},
937 {"",S_FALSE,FALSE},
938 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
939 {"ftp",S_OK,FALSE},
940 {"%22%20%22weird",S_OK,FALSE},
941 {"%22%20%22weird",S_OK,FALSE}
944 {Uri_HOST_DNS,S_OK,FALSE},
945 {21,S_OK,FALSE},
946 {URL_SCHEME_FTP,S_OK,FALSE},
947 {URLZONE_INVALID,E_NOTIMPL,FALSE}
950 /* Make sure the forbidden characters don't get percent encoded. */
951 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
953 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
954 {"\" \"weird@ftp.google.com",S_OK,FALSE},
955 {"ftp://ftp.google.com/",S_OK,FALSE},
956 {"google.com",S_OK,FALSE},
957 {"",S_FALSE,FALSE},
958 {"",S_FALSE,FALSE},
959 {"ftp.google.com",S_OK,FALSE},
960 {"",S_FALSE,FALSE},
961 {"/",S_OK,FALSE},
962 {"/",S_OK,FALSE},
963 {"",S_FALSE,FALSE},
964 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
965 {"ftp",S_OK,FALSE},
966 {"\" \"weird",S_OK,FALSE},
967 {"\" \"weird",S_OK,FALSE}
970 {Uri_HOST_DNS,S_OK,FALSE},
971 {21,S_OK,FALSE},
972 {URL_SCHEME_FTP,S_OK,FALSE},
973 {URLZONE_INVALID,E_NOTIMPL,FALSE}
976 /* Make sure already percent encoded characters don't get unencoded. */
977 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
979 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
980 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
981 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
982 {"google.com",S_OK,FALSE},
983 {"",S_FALSE,FALSE},
984 {"",S_FALSE,FALSE},
985 {"ftp.google.com",S_OK,FALSE},
986 {"",S_FALSE,FALSE},
987 {"/\"%20\"weird",S_OK,FALSE},
988 {"/\"%20\"weird",S_OK,FALSE},
989 {"",S_FALSE,FALSE},
990 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
991 {"ftp",S_OK,FALSE},
992 {"\"%20\"weird",S_OK,FALSE},
993 {"\"%20\"weird",S_OK,FALSE}
996 {Uri_HOST_DNS,S_OK,FALSE},
997 {21,S_OK,FALSE},
998 {URL_SCHEME_FTP,S_OK,FALSE},
999 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1002 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
1003 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
1005 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1006 {"%xy:word@winehq.org",S_OK,FALSE},
1007 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1008 {"winehq.org",S_OK,FALSE},
1009 {"",S_FALSE,FALSE},
1010 {"",S_FALSE,FALSE},
1011 {"winehq.org",S_OK,FALSE},
1012 {"word",S_OK,FALSE},
1013 {"/",S_OK,FALSE},
1014 {"/",S_OK,FALSE},
1015 {"",S_FALSE,FALSE},
1016 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1017 {"zip",S_OK,FALSE},
1018 {"%xy:word",S_OK,FALSE},
1019 {"%xy",S_OK,FALSE}
1022 {Uri_HOST_DNS,S_OK,FALSE},
1023 {0,S_FALSE,FALSE},
1024 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1025 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1028 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
1029 * isn't known.
1031 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
1033 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1034 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
1035 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1036 {"winehq.org",S_OK,FALSE},
1037 {"",S_FALSE,FALSE},
1038 {"",S_FALSE,FALSE},
1039 {"winehq.org",S_OK,FALSE},
1040 {"%52%53ord",S_OK,FALSE},
1041 {"/",S_OK,FALSE},
1042 {"/",S_OK,FALSE},
1043 {"",S_FALSE,FALSE},
1044 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1045 {"zip",S_OK,FALSE},
1046 {"%2E:%52%53ord",S_OK,FALSE},
1047 {"%2E",S_OK,FALSE}
1050 {Uri_HOST_DNS,S_OK,FALSE},
1051 {0,S_FALSE,FALSE},
1052 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1053 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1056 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
1058 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1059 {"[](),'test':word@winehq.org",S_OK,FALSE},
1060 {"ftp://winehq.org/",S_OK,FALSE},
1061 {"winehq.org",S_OK,FALSE},
1062 {"",S_FALSE,FALSE},
1063 {"",S_FALSE,FALSE},
1064 {"winehq.org",S_OK,FALSE},
1065 {"word",S_OK,FALSE},
1066 {"/",S_OK,FALSE},
1067 {"/",S_OK,FALSE},
1068 {"",S_FALSE,FALSE},
1069 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1070 {"ftp",S_OK,FALSE},
1071 {"[](),'test':word",S_OK,FALSE},
1072 {"[](),'test'",S_OK,FALSE}
1075 {Uri_HOST_DNS,S_OK,FALSE},
1076 {21,S_OK,FALSE},
1077 {URL_SCHEME_FTP,S_OK,FALSE},
1078 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1081 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
1083 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1084 {"test",S_OK,FALSE},
1085 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1086 {"",S_FALSE,FALSE},
1087 {"",S_FALSE,FALSE},
1088 {"",S_FALSE,FALSE},
1089 {"test",S_OK,FALSE},
1090 {"",S_FALSE,FALSE},
1091 {"/",S_OK,FALSE},
1092 {"/?:word@winehq.org/",S_OK,FALSE},
1093 {"?:word@winehq.org/",S_OK,FALSE},
1094 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
1095 {"ftp",S_OK,FALSE},
1096 {"",S_FALSE,FALSE},
1097 {"",S_FALSE,FALSE}
1100 {Uri_HOST_DNS,S_OK,FALSE},
1101 {21,S_OK,FALSE},
1102 {URL_SCHEME_FTP,S_OK,FALSE},
1103 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1106 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1108 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1109 {"test",S_OK,FALSE},
1110 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1111 {"",S_FALSE,FALSE},
1112 {"",S_FALSE,FALSE},
1113 {"#:word@winehq.org/",S_OK,FALSE},
1114 {"test",S_OK,FALSE},
1115 {"",S_FALSE,FALSE},
1116 {"/",S_OK,FALSE},
1117 {"/",S_OK,FALSE},
1118 {"",S_FALSE,FALSE},
1119 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1120 {"ftp",S_OK,FALSE},
1121 {"",S_FALSE,FALSE},
1122 {"",S_FALSE,FALSE}
1125 {Uri_HOST_DNS,S_OK,FALSE},
1126 {21,S_OK,FALSE},
1127 {URL_SCHEME_FTP,S_OK,FALSE},
1128 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1131 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1132 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1134 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1135 {"test\\:word@winehq.org",S_OK,FALSE},
1136 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1137 {"winehq.org",S_OK,FALSE},
1138 {"",S_FALSE,FALSE},
1139 {"",S_FALSE,FALSE},
1140 {"winehq.org",S_OK,FALSE},
1141 {"word",S_OK,FALSE},
1142 {"/",S_OK,FALSE},
1143 {"/",S_OK,FALSE},
1144 {"",S_FALSE,FALSE},
1145 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1146 {"zip",S_OK,FALSE},
1147 {"test\\:word",S_OK,FALSE},
1148 {"test\\",S_OK,FALSE}
1151 {Uri_HOST_DNS,S_OK,FALSE},
1152 {0,S_FALSE,FALSE},
1153 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1154 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1157 /* It normalizes IPv4 addresses correctly. */
1158 { "http://127.000.000.100/", 0, S_OK, FALSE,
1160 {"http://127.0.0.100/",S_OK,FALSE},
1161 {"127.0.0.100",S_OK,FALSE},
1162 {"http://127.0.0.100/",S_OK,FALSE},
1163 {"",S_FALSE,FALSE},
1164 {"",S_FALSE,FALSE},
1165 {"",S_FALSE,FALSE},
1166 {"127.0.0.100",S_OK,FALSE},
1167 {"",S_FALSE,FALSE},
1168 {"/",S_OK,FALSE},
1169 {"/",S_OK,FALSE},
1170 {"",S_FALSE,FALSE},
1171 {"http://127.000.000.100/",S_OK,FALSE},
1172 {"http",S_OK,FALSE},
1173 {"",S_FALSE,FALSE},
1174 {"",S_FALSE,FALSE}
1177 {Uri_HOST_IPV4,S_OK,FALSE},
1178 {80,S_OK,FALSE},
1179 {URL_SCHEME_HTTP,S_OK,FALSE},
1180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1183 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1185 {"http://127.0.0.1:8000/",S_OK},
1186 {"127.0.0.1:8000",S_OK},
1187 {"http://127.0.0.1:8000/",S_OK},
1188 {"",S_FALSE},
1189 {"",S_FALSE},
1190 {"",S_FALSE},
1191 {"127.0.0.1",S_OK},
1192 {"",S_FALSE},
1193 {"/",S_OK},
1194 {"/",S_OK},
1195 {"",S_FALSE},
1196 {"http://127.0.0.1:8000",S_OK},
1197 {"http",S_OK},
1198 {"",S_FALSE},
1199 {"",S_FALSE}
1202 {Uri_HOST_IPV4,S_OK,FALSE},
1203 {8000,S_OK,FALSE},
1204 {URL_SCHEME_HTTP,S_OK,FALSE},
1205 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1208 /* Make sure it normalizes partial IPv4 addresses correctly. */
1209 { "http://127.0/", 0, S_OK, FALSE,
1211 {"http://127.0.0.0/",S_OK,FALSE},
1212 {"127.0.0.0",S_OK,FALSE},
1213 {"http://127.0.0.0/",S_OK,FALSE},
1214 {"",S_FALSE,FALSE},
1215 {"",S_FALSE,FALSE},
1216 {"",S_FALSE,FALSE},
1217 {"127.0.0.0",S_OK,FALSE},
1218 {"",S_FALSE,FALSE},
1219 {"/",S_OK,FALSE},
1220 {"/",S_OK,FALSE},
1221 {"",S_FALSE,FALSE},
1222 {"http://127.0/",S_OK,FALSE},
1223 {"http",S_OK,FALSE},
1224 {"",S_FALSE,FALSE},
1225 {"",S_FALSE,FALSE}
1228 {Uri_HOST_IPV4,S_OK,FALSE},
1229 {80,S_OK,FALSE},
1230 {URL_SCHEME_HTTP,S_OK,FALSE},
1231 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1234 /* Make sure it converts implicit IPv4's correctly. */
1235 { "http://123456/", 0, S_OK, FALSE,
1237 {"http://0.1.226.64/",S_OK,FALSE},
1238 {"0.1.226.64",S_OK,FALSE},
1239 {"http://0.1.226.64/",S_OK,FALSE},
1240 {"",S_FALSE,FALSE},
1241 {"",S_FALSE,FALSE},
1242 {"",S_FALSE,FALSE},
1243 {"0.1.226.64",S_OK,FALSE},
1244 {"",S_FALSE,FALSE},
1245 {"/",S_OK,FALSE},
1246 {"/",S_OK,FALSE},
1247 {"",S_FALSE,FALSE},
1248 {"http://123456/",S_OK,FALSE},
1249 {"http",S_OK,FALSE},
1250 {"",S_FALSE,FALSE},
1251 {"",S_FALSE,FALSE}
1254 {Uri_HOST_IPV4,S_OK,FALSE},
1255 {80,S_OK,FALSE},
1256 {URL_SCHEME_HTTP,S_OK,FALSE},
1257 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1260 /* UINT_MAX */
1261 { "http://4294967295/", 0, S_OK, FALSE,
1263 {"http://255.255.255.255/",S_OK,FALSE},
1264 {"255.255.255.255",S_OK,FALSE},
1265 {"http://255.255.255.255/",S_OK,FALSE},
1266 {"",S_FALSE,FALSE},
1267 {"",S_FALSE,FALSE},
1268 {"",S_FALSE,FALSE},
1269 {"255.255.255.255",S_OK,FALSE},
1270 {"",S_FALSE,FALSE},
1271 {"/",S_OK,FALSE},
1272 {"/",S_OK,FALSE},
1273 {"",S_FALSE,FALSE},
1274 {"http://4294967295/",S_OK,FALSE},
1275 {"http",S_OK,FALSE},
1276 {"",S_FALSE,FALSE},
1277 {"",S_FALSE,FALSE}
1280 {Uri_HOST_IPV4,S_OK,FALSE},
1281 {80,S_OK,FALSE},
1282 {URL_SCHEME_HTTP,S_OK,FALSE},
1283 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1286 /* UINT_MAX+1 */
1287 { "http://4294967296/", 0, S_OK, FALSE,
1289 {"http://4294967296/",S_OK,FALSE},
1290 {"4294967296",S_OK,FALSE},
1291 {"http://4294967296/",S_OK,FALSE},
1292 {"",S_FALSE,FALSE},
1293 {"",S_FALSE,FALSE},
1294 {"",S_FALSE,FALSE},
1295 {"4294967296",S_OK,FALSE},
1296 {"",S_FALSE,FALSE},
1297 {"/",S_OK,FALSE},
1298 {"/",S_OK,FALSE},
1299 {"",S_FALSE,FALSE},
1300 {"http://4294967296/",S_OK,FALSE},
1301 {"http",S_OK,FALSE},
1302 {"",S_FALSE,FALSE},
1303 {"",S_FALSE,FALSE}
1306 {Uri_HOST_DNS,S_OK,FALSE},
1307 {80,S_OK,FALSE},
1308 {URL_SCHEME_HTTP,S_OK,FALSE},
1309 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1312 /* Window's doesn't normalize IP address for unknown schemes. */
1313 { "1234://4294967295/", 0, S_OK, FALSE,
1315 {"1234://4294967295/",S_OK,FALSE},
1316 {"4294967295",S_OK,FALSE},
1317 {"1234://4294967295/",S_OK,FALSE},
1318 {"",S_FALSE,FALSE},
1319 {"",S_FALSE,FALSE},
1320 {"",S_FALSE,FALSE},
1321 {"4294967295",S_OK,FALSE},
1322 {"",S_FALSE,FALSE},
1323 {"/",S_OK,FALSE},
1324 {"/",S_OK,FALSE},
1325 {"",S_FALSE,FALSE},
1326 {"1234://4294967295/",S_OK,FALSE},
1327 {"1234",S_OK,FALSE},
1328 {"",S_FALSE,FALSE},
1329 {"",S_FALSE,FALSE}
1332 {Uri_HOST_IPV4,S_OK,FALSE},
1333 {0,S_FALSE,FALSE},
1334 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1335 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1338 /* Window's doesn't normalize IP address for unknown schemes. */
1339 { "1234://127.001/", 0, S_OK, FALSE,
1341 {"1234://127.001/",S_OK,FALSE},
1342 {"127.001",S_OK,FALSE},
1343 {"1234://127.001/",S_OK,FALSE},
1344 {"",S_FALSE,FALSE},
1345 {"",S_FALSE,FALSE},
1346 {"",S_FALSE,FALSE},
1347 {"127.001",S_OK,FALSE},
1348 {"",S_FALSE,FALSE},
1349 {"/",S_OK,FALSE},
1350 {"/",S_OK,FALSE},
1351 {"",S_FALSE,FALSE},
1352 {"1234://127.001/",S_OK,FALSE},
1353 {"1234",S_OK,FALSE},
1354 {"",S_FALSE,FALSE},
1355 {"",S_FALSE,FALSE}
1358 {Uri_HOST_IPV4,S_OK,FALSE},
1359 {0,S_FALSE,FALSE},
1360 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1361 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1364 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1366 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1367 {"[fedc:ba98::3210]",S_OK,FALSE},
1368 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1369 {"",S_FALSE,FALSE},
1370 {"",S_FALSE,FALSE},
1371 {"",S_FALSE,FALSE},
1372 {"fedc:ba98::3210",S_OK,FALSE},
1373 {"",S_FALSE,FALSE},
1374 {"/",S_OK,FALSE},
1375 {"/",S_OK,FALSE},
1376 {"",S_FALSE,FALSE},
1377 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1378 {"http",S_OK,FALSE},
1379 {"",S_FALSE,FALSE},
1380 {"",S_FALSE,FALSE},
1383 {Uri_HOST_IPV6,S_OK,FALSE},
1384 {80,S_OK,FALSE},
1385 {URL_SCHEME_HTTP,S_OK,FALSE},
1386 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1389 { "http://[::]", 0, S_OK, FALSE,
1391 {"http://[::]/",S_OK,FALSE},
1392 {"[::]",S_OK,FALSE},
1393 {"http://[::]/",S_OK,FALSE},
1394 {"",S_FALSE,FALSE},
1395 {"",S_FALSE,FALSE},
1396 {"",S_FALSE,FALSE},
1397 {"::",S_OK,FALSE},
1398 {"",S_FALSE,FALSE},
1399 {"/",S_OK,FALSE},
1400 {"/",S_OK,FALSE},
1401 {"",S_FALSE,FALSE},
1402 {"http://[::]",S_OK,FALSE},
1403 {"http",S_OK,FALSE},
1404 {"",S_FALSE,FALSE},
1405 {"",S_FALSE,FALSE},
1408 {Uri_HOST_IPV6,S_OK,FALSE},
1409 {80,S_OK,FALSE},
1410 {URL_SCHEME_HTTP,S_OK,FALSE},
1411 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1414 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1416 {"http://[fedc:ba98::]/",S_OK,FALSE},
1417 {"[fedc:ba98::]",S_OK,FALSE},
1418 {"http://[fedc:ba98::]/",S_OK,FALSE},
1419 {"",S_FALSE,FALSE},
1420 {"",S_FALSE,FALSE},
1421 {"",S_FALSE,FALSE},
1422 {"fedc:ba98::",S_OK,FALSE},
1423 {"",S_FALSE,FALSE},
1424 {"/",S_OK,FALSE},
1425 {"/",S_OK,FALSE},
1426 {"",S_FALSE,FALSE},
1427 {"http://[FEDC:BA98::]",S_OK,FALSE},
1428 {"http",S_OK,FALSE},
1429 {"",S_FALSE,FALSE},
1430 {"",S_FALSE,FALSE},
1433 {Uri_HOST_IPV6,S_OK,FALSE},
1434 {80,S_OK,FALSE},
1435 {URL_SCHEME_HTTP,S_OK,FALSE},
1436 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1439 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1440 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1442 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1443 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1444 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1445 {"",S_FALSE,FALSE},
1446 {"",S_FALSE,FALSE},
1447 {"",S_FALSE,FALSE},
1448 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1449 {"",S_FALSE,FALSE},
1450 {"/",S_OK,FALSE},
1451 {"/",S_OK,FALSE},
1452 {"",S_FALSE,FALSE},
1453 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1454 {"http",S_OK,FALSE},
1455 {"",S_FALSE,FALSE},
1456 {"",S_FALSE,FALSE},
1459 {Uri_HOST_IPV6,S_OK,FALSE},
1460 {80,S_OK,FALSE},
1461 {URL_SCHEME_HTTP,S_OK,FALSE},
1462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1465 { "http://[v2.34]/", 0, S_OK, FALSE,
1467 {"http://[v2.34]/",S_OK,FALSE},
1468 {"[v2.34]",S_OK,FALSE},
1469 {"http://[v2.34]/",S_OK,FALSE},
1470 {"",S_FALSE,FALSE},
1471 {"",S_FALSE,FALSE},
1472 {"",S_FALSE,FALSE},
1473 {"[v2.34]",S_OK,FALSE},
1474 {"",S_FALSE,FALSE},
1475 {"/",S_OK,FALSE},
1476 {"/",S_OK,FALSE},
1477 {"",S_FALSE,FALSE},
1478 {"http://[v2.34]/",S_OK,FALSE},
1479 {"http",S_OK,FALSE},
1480 {"",S_FALSE,FALSE},
1481 {"",S_FALSE,FALSE}
1484 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1485 {80,S_OK,FALSE},
1486 {URL_SCHEME_HTTP,S_OK,FALSE},
1487 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1490 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1491 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1493 {"http://[xyz:12345.com/test",S_OK,FALSE},
1494 {"[xyz:12345.com",S_OK,FALSE},
1495 {"http://[xyz:12345.com/test",S_OK,FALSE},
1496 {"[xyz:12345.com",S_OK,FALSE},
1497 {"",S_FALSE,FALSE},
1498 {"",S_FALSE,FALSE},
1499 {"[xyz:12345.com",S_OK,FALSE},
1500 {"",S_FALSE,FALSE},
1501 {"/test",S_OK,FALSE},
1502 {"/test",S_OK,FALSE},
1503 {"",S_FALSE,FALSE},
1504 {"http://[xyz:12345.com/test",S_OK,FALSE},
1505 {"http",S_OK,FALSE},
1506 {"",S_FALSE,FALSE},
1507 {"",S_FALSE,FALSE}
1510 {Uri_HOST_DNS,S_OK,FALSE},
1511 {80,S_OK,FALSE},
1512 {URL_SCHEME_HTTP,S_OK,FALSE},
1513 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1516 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1517 * of the host name (respectively).
1519 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1521 {"ftp://www.[works].com/",S_OK,FALSE},
1522 {"www.[works].com",S_OK,FALSE},
1523 {"ftp://www.[works].com/",S_OK,FALSE},
1524 {"[works].com",S_OK,FALSE},
1525 {"",S_FALSE,FALSE},
1526 {"",S_FALSE,FALSE},
1527 {"www.[works].com",S_OK,FALSE},
1528 {"",S_FALSE,FALSE},
1529 {"/",S_OK,FALSE},
1530 {"/",S_OK,FALSE},
1531 {"",S_FALSE,FALSE},
1532 {"ftp://www.[works].com/",S_OK,FALSE},
1533 {"ftp",S_OK,FALSE},
1534 {"",S_FALSE,FALSE},
1535 {"",S_FALSE,FALSE}
1538 {Uri_HOST_DNS,S_OK,FALSE},
1539 {21,S_OK,FALSE},
1540 {URL_SCHEME_FTP,S_OK,FALSE},
1541 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1544 /* Considers ':' a delimiter since it appears after the ']'. */
1545 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1547 {"http://www.google.com]:12345/",S_OK,FALSE},
1548 {"www.google.com]:12345",S_OK,FALSE},
1549 {"http://www.google.com]:12345/",S_OK,FALSE},
1550 {"google.com]",S_OK,FALSE},
1551 {"",S_FALSE,FALSE},
1552 {"",S_FALSE,FALSE},
1553 {"www.google.com]",S_OK,FALSE},
1554 {"",S_FALSE,FALSE},
1555 {"/",S_OK,FALSE},
1556 {"/",S_OK,FALSE},
1557 {"",S_FALSE,FALSE},
1558 {"http://www.google.com]:12345/",S_OK,FALSE},
1559 {"http",S_OK,FALSE},
1560 {"",S_FALSE,FALSE},
1561 {"",S_FALSE,FALSE}
1564 {Uri_HOST_DNS,S_OK,FALSE},
1565 {12345,S_OK,FALSE},
1566 {URL_SCHEME_HTTP,S_OK,FALSE},
1567 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1570 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1571 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1573 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1574 {"w%XXw%GEw.google.com",S_OK,FALSE},
1575 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1576 {"google.com",S_OK,FALSE},
1577 {"",S_FALSE,FALSE},
1578 {"",S_FALSE,FALSE},
1579 {"w%XXw%GEw.google.com",S_OK,FALSE},
1580 {"",S_FALSE,FALSE},
1581 {"/",S_OK,FALSE},
1582 {"/",S_OK,FALSE},
1583 {"",S_FALSE,FALSE},
1584 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1585 {"zip",S_OK,FALSE},
1586 {"",S_FALSE,FALSE},
1587 {"",S_FALSE,FALSE}
1590 {Uri_HOST_DNS,S_OK,FALSE},
1591 {0,S_FALSE,FALSE},
1592 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1593 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1596 /* Unknown scheme types hostname doesn't get lower cased. */
1597 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1599 {"zip://GOOGLE.com/",S_OK,FALSE},
1600 {"GOOGLE.com",S_OK,FALSE},
1601 {"zip://GOOGLE.com/",S_OK,FALSE},
1602 {"GOOGLE.com",S_OK,FALSE},
1603 {"",S_FALSE,FALSE},
1604 {"",S_FALSE,FALSE},
1605 {"GOOGLE.com",S_OK,FALSE},
1606 {"",S_FALSE,FALSE},
1607 {"/",S_OK,FALSE},
1608 {"/",S_OK,FALSE},
1609 {"",S_FALSE,FALSE},
1610 {"zip://GOOGLE.com/",S_OK,FALSE},
1611 {"zip",S_OK,FALSE},
1612 {"",S_FALSE,FALSE},
1613 {"",S_FALSE,FALSE}
1616 {Uri_HOST_DNS,S_OK,FALSE},
1617 {0,S_FALSE,FALSE},
1618 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1619 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1622 /* Hostname gets lower-cased for known scheme types. */
1623 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1625 {"http://www.google.com/",S_OK,FALSE},
1626 {"www.google.com",S_OK,FALSE},
1627 {"http://www.google.com/",S_OK,FALSE},
1628 {"google.com",S_OK,FALSE},
1629 {"",S_FALSE,FALSE},
1630 {"",S_FALSE,FALSE},
1631 {"www.google.com",S_OK,FALSE},
1632 {"",S_FALSE,FALSE},
1633 {"/",S_OK,FALSE},
1634 {"/",S_OK,FALSE},
1635 {"",S_FALSE,FALSE},
1636 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1637 {"http",S_OK,FALSE},
1638 {"",S_FALSE,FALSE},
1639 {"",S_FALSE,FALSE}
1642 {Uri_HOST_DNS,S_OK,FALSE},
1643 {80,S_OK,FALSE},
1644 {URL_SCHEME_HTTP,S_OK,FALSE},
1645 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1648 /* Characters that get % encoded in the hostname also have their percent
1649 * encoded forms lower cased.
1651 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1653 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1654 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1655 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1656 {"%7cgoogle%7c.com",S_OK,FALSE},
1657 {"",S_FALSE,FALSE},
1658 {"",S_FALSE,FALSE},
1659 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1660 {"",S_FALSE,FALSE},
1661 {"/",S_OK,FALSE},
1662 {"/",S_OK,FALSE},
1663 {"",S_FALSE,FALSE},
1664 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1665 {"http",S_OK,FALSE},
1666 {"",S_FALSE,FALSE},
1667 {"",S_FALSE,FALSE}
1670 {Uri_HOST_DNS,S_OK,FALSE},
1671 {80,S_OK,FALSE},
1672 {URL_SCHEME_HTTP,S_OK,FALSE},
1673 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1676 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1677 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1679 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1680 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1681 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1682 {"",S_FALSE,FALSE},
1683 {"",S_FALSE,FALSE},
1684 {"",S_FALSE,FALSE},
1685 {"1:2:3:4:5:6::",S_OK,FALSE},
1686 {"",S_FALSE,FALSE},
1687 {"/",S_OK,FALSE},
1688 {"/",S_OK,FALSE},
1689 {"",S_FALSE,FALSE},
1690 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1691 {"http",S_OK,FALSE},
1692 {"",S_FALSE,FALSE},
1693 {"",S_FALSE,FALSE},
1696 {Uri_HOST_IPV6,S_OK,FALSE},
1697 {80,S_OK,FALSE},
1698 {URL_SCHEME_HTTP,S_OK,FALSE},
1699 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1702 /* IPv4 addresses get normalized. */
1703 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1705 {"http://[::1.2.3.0]/",S_OK,FALSE},
1706 {"[::1.2.3.0]",S_OK,FALSE},
1707 {"http://[::1.2.3.0]/",S_OK,FALSE},
1708 {"",S_FALSE,FALSE},
1709 {"",S_FALSE,FALSE},
1710 {"",S_FALSE,FALSE},
1711 {"::1.2.3.0",S_OK,FALSE},
1712 {"",S_FALSE,FALSE},
1713 {"/",S_OK,FALSE},
1714 {"/",S_OK,FALSE},
1715 {"",S_FALSE,FALSE},
1716 {"http://[::001.002.003.000]",S_OK,FALSE},
1717 {"http",S_OK,FALSE},
1718 {"",S_FALSE,FALSE},
1719 {"",S_FALSE,FALSE},
1722 {Uri_HOST_IPV6,S_OK,FALSE},
1723 {80,S_OK,FALSE},
1724 {URL_SCHEME_HTTP,S_OK,FALSE},
1725 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1728 { "http://[::5efe:1.2.3.4]", 0, S_OK, FALSE,
1730 {"http://[::5efe:1.2.3.4]/",S_OK,FALSE},
1731 {"[::5efe:1.2.3.4]",S_OK,FALSE},
1732 {"http://[::5efe:1.2.3.4]/",S_OK,FALSE},
1733 {"",S_FALSE,FALSE},
1734 {"",S_FALSE,FALSE},
1735 {"",S_FALSE,FALSE},
1736 {"::5efe:1.2.3.4",S_OK,FALSE},
1737 {"",S_FALSE,FALSE},
1738 {"/",S_OK,FALSE},
1739 {"/",S_OK,FALSE},
1740 {"",S_FALSE,FALSE},
1741 {"http://[::5efe:1.2.3.4]",S_OK,FALSE},
1742 {"http",S_OK,FALSE},
1743 {"",S_FALSE,FALSE},
1744 {"",S_FALSE,FALSE},
1747 {Uri_HOST_IPV6,S_OK,FALSE},
1748 {80,S_OK,FALSE},
1749 {URL_SCHEME_HTTP,S_OK,FALSE},
1750 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1753 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1754 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1756 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1757 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1758 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1759 {"",S_FALSE,FALSE},
1760 {"",S_FALSE,FALSE},
1761 {"",S_FALSE,FALSE},
1762 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1763 {"",S_FALSE,FALSE},
1764 {"/",S_OK,FALSE},
1765 {"/",S_OK,FALSE},
1766 {"",S_FALSE,FALSE},
1767 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1768 {"zip",S_OK,FALSE},
1769 {"",S_FALSE,FALSE},
1770 {"",S_FALSE,FALSE},
1773 {Uri_HOST_IPV6,S_OK,FALSE},
1774 {0,S_FALSE,FALSE},
1775 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1776 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1779 /* IPv4 address is converted into 2 h16 components. */
1780 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1782 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1783 {"[ffff::c0de:6f20]",S_OK,FALSE},
1784 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1785 {"",S_FALSE,FALSE},
1786 {"",S_FALSE,FALSE},
1787 {"",S_FALSE,FALSE},
1788 {"ffff::c0de:6f20",S_OK,FALSE},
1789 {"",S_FALSE,FALSE},
1790 {"/",S_OK,FALSE},
1791 {"/",S_OK,FALSE},
1792 {"",S_FALSE,FALSE},
1793 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1794 {"http",S_OK,FALSE},
1795 {"",S_FALSE,FALSE},
1796 {"",S_FALSE,FALSE},
1799 {Uri_HOST_IPV6,S_OK,FALSE},
1800 {80,S_OK,FALSE},
1801 {URL_SCHEME_HTTP,S_OK,FALSE},
1802 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1805 /* Max value for a port. */
1806 { "http://google.com:65535", 0, S_OK, FALSE,
1808 {"http://google.com:65535/",S_OK,FALSE},
1809 {"google.com:65535",S_OK,FALSE},
1810 {"http://google.com:65535/",S_OK,FALSE},
1811 {"google.com",S_OK,FALSE},
1812 {"",S_FALSE,FALSE},
1813 {"",S_FALSE,FALSE},
1814 {"google.com",S_OK,FALSE},
1815 {"",S_FALSE,FALSE},
1816 {"/",S_OK,FALSE},
1817 {"/",S_OK,FALSE},
1818 {"",S_FALSE,FALSE},
1819 {"http://google.com:65535",S_OK,FALSE},
1820 {"http",S_OK,FALSE},
1821 {"",S_FALSE,FALSE},
1822 {"",S_FALSE,FALSE}
1825 {Uri_HOST_DNS,S_OK,FALSE},
1826 {65535,S_OK,FALSE},
1827 {URL_SCHEME_HTTP,S_OK,FALSE},
1828 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1831 { "zip://google.com:65536", 0, S_OK, FALSE,
1833 {"zip://google.com:65536/",S_OK,FALSE},
1834 {"google.com:65536",S_OK,FALSE},
1835 {"zip://google.com:65536/",S_OK,FALSE},
1836 {"google.com:65536",S_OK,FALSE},
1837 {"",S_FALSE,FALSE},
1838 {"",S_FALSE,FALSE},
1839 {"google.com:65536",S_OK,FALSE},
1840 {"",S_FALSE,FALSE},
1841 {"/",S_OK,FALSE},
1842 {"/",S_OK,FALSE},
1843 {"",S_FALSE,FALSE},
1844 {"zip://google.com:65536",S_OK,FALSE},
1845 {"zip",S_OK,FALSE},
1846 {"",S_FALSE,FALSE},
1847 {"",S_FALSE,FALSE}
1850 {Uri_HOST_DNS,S_OK,FALSE},
1851 {0,S_FALSE,FALSE},
1852 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1853 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1856 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1858 {"zip://google.com:65536:25/",S_OK,FALSE},
1859 {"google.com:65536:25",S_OK,FALSE},
1860 {"zip://google.com:65536:25/",S_OK,FALSE},
1861 {"google.com:65536:25",S_OK,FALSE},
1862 {"",S_FALSE,FALSE},
1863 {"",S_FALSE,FALSE},
1864 {"google.com:65536:25",S_OK,FALSE},
1865 {"",S_FALSE,FALSE},
1866 {"/",S_OK,FALSE},
1867 {"/",S_OK,FALSE},
1868 {"",S_FALSE,FALSE},
1869 {"zip://google.com:65536:25",S_OK,FALSE},
1870 {"zip",S_OK,FALSE},
1871 {"",S_FALSE,FALSE},
1872 {"",S_FALSE,FALSE}
1875 {Uri_HOST_DNS,S_OK,FALSE},
1876 {0,S_FALSE,FALSE},
1877 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1878 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1881 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1883 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1884 {"[::ffff]:abcd",S_OK,FALSE},
1885 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1886 {"",S_FALSE,FALSE},
1887 {"",S_FALSE,FALSE},
1888 {"",S_FALSE,FALSE},
1889 {"[::ffff]:abcd",S_OK,FALSE},
1890 {"",S_FALSE,FALSE},
1891 {"/",S_OK,FALSE},
1892 {"/",S_OK,FALSE},
1893 {"",S_FALSE,FALSE},
1894 {"zip://[::ffff]:abcd",S_OK,FALSE},
1895 {"zip",S_OK,FALSE},
1896 {"",S_FALSE,FALSE},
1897 {"",S_FALSE,FALSE}
1900 {Uri_HOST_DNS,S_OK,FALSE},
1901 {0,S_FALSE,FALSE},
1902 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1903 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1906 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1908 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1909 {"127.0.0.1:abcd",S_OK,FALSE},
1910 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1911 {"0.1:abcd",S_OK,FALSE},
1912 {"",S_FALSE,FALSE},
1913 {"",S_FALSE,FALSE},
1914 {"127.0.0.1:abcd",S_OK,FALSE},
1915 {"",S_FALSE,FALSE},
1916 {"/",S_OK,FALSE},
1917 {"/",S_OK,FALSE},
1918 {"",S_FALSE,FALSE},
1919 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1920 {"zip",S_OK,FALSE},
1921 {"",S_FALSE,FALSE},
1922 {"",S_FALSE,FALSE}
1925 {Uri_HOST_DNS,S_OK,FALSE},
1926 {0,S_FALSE,FALSE},
1927 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1928 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1931 /* Port is just copied over. */
1932 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1934 {"http://google.com:00035",S_OK,FALSE},
1935 {"google.com:00035",S_OK,FALSE},
1936 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1937 {"google.com",S_OK,FALSE},
1938 {"",S_FALSE,FALSE},
1939 {"",S_FALSE,FALSE},
1940 {"google.com",S_OK,FALSE},
1941 {"",S_FALSE,FALSE},
1942 {"",S_FALSE,FALSE},
1943 {"",S_FALSE,FALSE},
1944 {"",S_FALSE,FALSE},
1945 {"http://google.com:00035",S_OK,FALSE},
1946 {"http",S_OK,FALSE},
1947 {"",S_FALSE,FALSE},
1948 {"",S_FALSE,FALSE}
1951 {Uri_HOST_DNS,S_OK,FALSE},
1952 {35,S_OK,FALSE},
1953 {URL_SCHEME_HTTP,S_OK,FALSE},
1954 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1957 /* Default port is copied over. */
1958 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1960 {"http://google.com:80",S_OK,FALSE},
1961 {"google.com:80",S_OK,FALSE},
1962 {"http://google.com:80",S_OK,FALSE},
1963 {"google.com",S_OK,FALSE},
1964 {"",S_FALSE,FALSE},
1965 {"",S_FALSE,FALSE},
1966 {"google.com",S_OK,FALSE},
1967 {"",S_FALSE,FALSE},
1968 {"",S_FALSE,FALSE},
1969 {"",S_FALSE,FALSE},
1970 {"",S_FALSE,FALSE},
1971 {"http://google.com:80",S_OK,FALSE},
1972 {"http",S_OK,FALSE},
1973 {"",S_FALSE,FALSE},
1974 {"",S_FALSE,FALSE}
1977 {Uri_HOST_DNS,S_OK,FALSE},
1978 {80,S_OK,FALSE},
1979 {URL_SCHEME_HTTP,S_OK,FALSE},
1980 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1983 { "http://google.com.uk", 0, S_OK, FALSE,
1985 {"http://google.com.uk/",S_OK,FALSE},
1986 {"google.com.uk",S_OK,FALSE},
1987 {"http://google.com.uk/",S_OK,FALSE},
1988 {"google.com.uk",S_OK,FALSE,NULL,"com.uk",S_OK}, /* cf. google.co.uk below */
1989 {"",S_FALSE,FALSE},
1990 {"",S_FALSE,FALSE},
1991 {"google.com.uk",S_OK,FALSE},
1992 {"",S_FALSE,FALSE},
1993 {"/",S_OK,FALSE},
1994 {"/",S_OK,FALSE},
1995 {"",S_FALSE,FALSE},
1996 {"http://google.com.uk",S_OK,FALSE},
1997 {"http",S_OK,FALSE},
1998 {"",S_FALSE,FALSE},
1999 {"",S_FALSE,FALSE}
2002 {Uri_HOST_DNS,S_OK,FALSE},
2003 {80,S_OK,FALSE},
2004 {URL_SCHEME_HTTP,S_OK,FALSE},
2005 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2008 { "http://google.co.uk", 0, S_OK, FALSE,
2010 {"http://google.co.uk/",S_OK,FALSE},
2011 {"google.co.uk",S_OK,FALSE},
2012 {"http://google.co.uk/",S_OK,FALSE},
2013 {"google.co.uk",S_OK,FALSE},
2014 {"",S_FALSE,FALSE},
2015 {"",S_FALSE,FALSE},
2016 {"google.co.uk",S_OK,FALSE},
2017 {"",S_FALSE,FALSE},
2018 {"/",S_OK,FALSE},
2019 {"/",S_OK,FALSE},
2020 {"",S_FALSE,FALSE},
2021 {"http://google.co.uk",S_OK,FALSE},
2022 {"http",S_OK,FALSE},
2023 {"",S_FALSE,FALSE},
2024 {"",S_FALSE,FALSE}
2027 {Uri_HOST_DNS,S_OK,FALSE},
2028 {80,S_OK,FALSE},
2029 {URL_SCHEME_HTTP,S_OK,FALSE},
2030 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2033 { "http://google.com.com", 0, S_OK, FALSE,
2035 {"http://google.com.com/",S_OK,FALSE},
2036 {"google.com.com",S_OK,FALSE},
2037 {"http://google.com.com/",S_OK,FALSE},
2038 {"com.com",S_OK,FALSE},
2039 {"",S_FALSE,FALSE},
2040 {"",S_FALSE,FALSE},
2041 {"google.com.com",S_OK,FALSE},
2042 {"",S_FALSE,FALSE},
2043 {"/",S_OK,FALSE},
2044 {"/",S_OK,FALSE},
2045 {"",S_FALSE,FALSE},
2046 {"http://google.com.com",S_OK,FALSE},
2047 {"http",S_OK,FALSE},
2048 {"",S_FALSE,FALSE},
2049 {"",S_FALSE,FALSE}
2052 {Uri_HOST_DNS,S_OK,FALSE},
2053 {80,S_OK,FALSE},
2054 {URL_SCHEME_HTTP,S_OK,FALSE},
2055 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2058 { "http://google.uk.1", 0, S_OK, FALSE,
2060 {"http://google.uk.1/",S_OK,FALSE},
2061 {"google.uk.1",S_OK,FALSE},
2062 {"http://google.uk.1/",S_OK,FALSE},
2063 {"google.uk.1",S_OK,FALSE,NULL,"uk.1",S_OK},
2064 {"",S_FALSE,FALSE},
2065 {"",S_FALSE,FALSE},
2066 {"google.uk.1",S_OK,FALSE},
2067 {"",S_FALSE,FALSE},
2068 {"/",S_OK,FALSE},
2069 {"/",S_OK,FALSE},
2070 {"",S_FALSE,FALSE},
2071 {"http://google.uk.1",S_OK,FALSE},
2072 {"http",S_OK,FALSE},
2073 {"",S_FALSE,FALSE},
2074 {"",S_FALSE,FALSE}
2077 {Uri_HOST_DNS,S_OK,FALSE},
2078 {80,S_OK,FALSE},
2079 {URL_SCHEME_HTTP,S_OK,FALSE},
2080 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2083 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
2084 { "http://google.foo.uk", 0, S_OK, FALSE,
2086 {"http://google.foo.uk/",S_OK,FALSE},
2087 {"google.foo.uk",S_OK,FALSE},
2088 {"http://google.foo.uk/",S_OK,FALSE},
2089 {"foo.uk",S_OK,FALSE},
2090 {"",S_FALSE,FALSE},
2091 {"",S_FALSE,FALSE},
2092 {"google.foo.uk",S_OK,FALSE},
2093 {"",S_FALSE,FALSE},
2094 {"/",S_OK,FALSE},
2095 {"/",S_OK,FALSE},
2096 {"",S_FALSE,FALSE},
2097 {"http://google.foo.uk",S_OK,FALSE},
2098 {"http",S_OK,FALSE},
2099 {"",S_FALSE,FALSE},
2100 {"",S_FALSE,FALSE}
2103 {Uri_HOST_DNS,S_OK,FALSE},
2104 {80,S_OK,FALSE},
2105 {URL_SCHEME_HTTP,S_OK,FALSE},
2106 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2109 { "http://.com", 0, S_OK, FALSE,
2111 {"http://.com/",S_OK,FALSE},
2112 {".com",S_OK,FALSE},
2113 {"http://.com/",S_OK,FALSE},
2114 {".com",S_OK,FALSE},
2115 {"",S_FALSE,FALSE},
2116 {"",S_FALSE,FALSE},
2117 {".com",S_OK,FALSE},
2118 {"",S_FALSE,FALSE},
2119 {"/",S_OK,FALSE},
2120 {"/",S_OK,FALSE},
2121 {"",S_FALSE,FALSE},
2122 {"http://.com",S_OK,FALSE},
2123 {"http",S_OK,FALSE},
2124 {"",S_FALSE,FALSE},
2125 {"",S_FALSE,FALSE}
2128 {Uri_HOST_DNS,S_OK,FALSE},
2129 {80,S_OK,FALSE},
2130 {URL_SCHEME_HTTP,S_OK,FALSE},
2131 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2134 { "http://.uk", 0, S_OK, FALSE,
2136 {"http://.uk/",S_OK,FALSE},
2137 {".uk",S_OK,FALSE},
2138 {"http://.uk/",S_OK,FALSE},
2139 {"",S_FALSE,FALSE,NULL,".uk",S_OK},
2140 {"",S_FALSE,FALSE},
2141 {"",S_FALSE,FALSE},
2142 {".uk",S_OK,FALSE},
2143 {"",S_FALSE,FALSE},
2144 {"/",S_OK,FALSE},
2145 {"/",S_OK,FALSE},
2146 {"",S_FALSE,FALSE},
2147 {"http://.uk",S_OK,FALSE},
2148 {"http",S_OK,FALSE},
2149 {"",S_FALSE,FALSE},
2150 {"",S_FALSE,FALSE}
2153 {Uri_HOST_DNS,S_OK,FALSE},
2154 {80,S_OK,FALSE},
2155 {URL_SCHEME_HTTP,S_OK,FALSE},
2156 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2159 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
2161 {"http://www.co.google.com.[]/",S_OK,FALSE},
2162 {"www.co.google.com.[]",S_OK,FALSE},
2163 {"http://www.co.google.com.[]/",S_OK,FALSE},
2164 {"google.com.[]",S_OK,FALSE,NULL,"com.[]",S_OK},
2165 {"",S_FALSE,FALSE},
2166 {"",S_FALSE,FALSE},
2167 {"www.co.google.com.[]",S_OK,FALSE},
2168 {"",S_FALSE,FALSE},
2169 {"/",S_OK,FALSE},
2170 {"/",S_OK,FALSE},
2171 {"",S_FALSE,FALSE},
2172 {"http://www.co.google.com.[]",S_OK,FALSE},
2173 {"http",S_OK,FALSE},
2174 {"",S_FALSE,FALSE},
2175 {"",S_FALSE,FALSE}
2178 {Uri_HOST_DNS,S_OK,FALSE},
2179 {80,S_OK,FALSE},
2180 {URL_SCHEME_HTTP,S_OK,FALSE},
2181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2184 { "http://co.uk", 0, S_OK, FALSE,
2186 {"http://co.uk/",S_OK,FALSE},
2187 {"co.uk",S_OK,FALSE},
2188 {"http://co.uk/",S_OK,FALSE},
2189 {"",S_FALSE,FALSE},
2190 {"",S_FALSE,FALSE},
2191 {"",S_FALSE,FALSE},
2192 {"co.uk",S_OK,FALSE},
2193 {"",S_FALSE,FALSE},
2194 {"/",S_OK,FALSE},
2195 {"/",S_OK,FALSE},
2196 {"",S_FALSE,FALSE},
2197 {"http://co.uk",S_OK,FALSE},
2198 {"http",S_OK,FALSE},
2199 {"",S_FALSE,FALSE},
2200 {"",S_FALSE,FALSE}
2203 {Uri_HOST_DNS,S_OK,FALSE},
2204 {80,S_OK,FALSE},
2205 {URL_SCHEME_HTTP,S_OK,FALSE},
2206 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2209 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2211 {"http://www.co.google.us.test/",S_OK,FALSE},
2212 {"www.co.google.us.test",S_OK,FALSE},
2213 {"http://www.co.google.us.test/",S_OK,FALSE},
2214 {"us.test",S_OK,FALSE},
2215 {"",S_FALSE,FALSE},
2216 {"",S_FALSE,FALSE},
2217 {"www.co.google.us.test",S_OK,FALSE},
2218 {"",S_FALSE,FALSE},
2219 {"/",S_OK,FALSE},
2220 {"/",S_OK,FALSE},
2221 {"",S_FALSE,FALSE},
2222 {"http://www.co.google.us.test",S_OK,FALSE},
2223 {"http",S_OK,FALSE},
2224 {"",S_FALSE,FALSE},
2225 {"",S_FALSE,FALSE}
2228 {Uri_HOST_DNS,S_OK,FALSE},
2229 {80,S_OK,FALSE},
2230 {URL_SCHEME_HTTP,S_OK,FALSE},
2231 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2234 { "http://gov.uk", 0, S_OK, FALSE,
2236 {"http://gov.uk/",S_OK,FALSE},
2237 {"gov.uk",S_OK,FALSE},
2238 {"http://gov.uk/",S_OK,FALSE},
2239 {"",S_FALSE,FALSE},
2240 {"",S_FALSE,FALSE},
2241 {"",S_FALSE,FALSE},
2242 {"gov.uk",S_OK,FALSE},
2243 {"",S_FALSE,FALSE},
2244 {"/",S_OK,FALSE},
2245 {"/",S_OK,FALSE},
2246 {"",S_FALSE,FALSE},
2247 {"http://gov.uk",S_OK,FALSE},
2248 {"http",S_OK,FALSE},
2249 {"",S_FALSE,FALSE},
2250 {"",S_FALSE,FALSE}
2253 {Uri_HOST_DNS,S_OK,FALSE},
2254 {80,S_OK,FALSE},
2255 {URL_SCHEME_HTTP,S_OK,FALSE},
2256 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2259 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2261 {"zip://www.google.com\\test",S_OK,FALSE},
2262 {"www.google.com\\test",S_OK,FALSE},
2263 {"zip://www.google.com\\test",S_OK,FALSE},
2264 {"google.com\\test",S_OK,FALSE},
2265 {"",S_FALSE,FALSE},
2266 {"",S_FALSE,FALSE},
2267 {"www.google.com\\test",S_OK,FALSE},
2268 {"",S_FALSE,FALSE},
2269 {"",S_FALSE,FALSE},
2270 {"",S_FALSE,FALSE},
2271 {"",S_FALSE,FALSE},
2272 {"zip://www.google.com\\test",S_OK,FALSE},
2273 {"zip",S_OK,FALSE},
2274 {"",S_FALSE,FALSE},
2275 {"",S_FALSE,FALSE}
2278 {Uri_HOST_DNS,S_OK,FALSE},
2279 {0,S_FALSE,FALSE},
2280 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2281 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2284 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2286 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2287 {"",S_FALSE,FALSE},
2288 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2289 {"",S_FALSE,FALSE},
2290 {"",S_FALSE,FALSE},
2291 {"",S_FALSE,FALSE},
2292 {"",S_FALSE,FALSE},
2293 {"",S_FALSE,FALSE},
2294 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2295 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2296 {"",S_FALSE,FALSE},
2297 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2298 {"urn",S_OK,FALSE},
2299 {"",S_FALSE,FALSE},
2300 {"",S_FALSE,FALSE}
2303 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2304 {0,S_FALSE,FALSE},
2305 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2306 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2309 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2310 * are decoded and all '%' are encoded.
2312 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2314 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2315 {"",S_FALSE,FALSE},
2316 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2317 {"",S_FALSE,FALSE},
2318 {".mp3",S_OK,FALSE},
2319 {"",S_FALSE,FALSE},
2320 {"",S_FALSE,FALSE},
2321 {"",S_FALSE,FALSE},
2322 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2323 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2324 {"",S_FALSE,FALSE},
2325 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2326 {"file",S_OK,FALSE},
2327 {"",S_FALSE,FALSE},
2328 {"",S_FALSE,FALSE}
2331 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2332 {0,S_FALSE,FALSE},
2333 {URL_SCHEME_FILE,S_OK,FALSE},
2334 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2337 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2338 * is decoded and only %'s in front of invalid hex digits are encoded.
2340 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2342 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2343 {"",S_FALSE,FALSE},
2344 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2345 {"",S_FALSE,FALSE},
2346 {".mp3",S_OK,FALSE},
2347 {"",S_FALSE,FALSE},
2348 {"",S_FALSE,FALSE},
2349 {"",S_FALSE,FALSE},
2350 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2351 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2352 {"",S_FALSE,FALSE},
2353 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2354 {"file",S_OK,FALSE},
2355 {"",S_FALSE,FALSE},
2356 {"",S_FALSE,FALSE}
2359 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2360 {0,S_FALSE,FALSE},
2361 {URL_SCHEME_FILE,S_OK,FALSE},
2362 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2365 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2366 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2368 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2369 {"[::1.2.3.0]",S_OK,FALSE},
2370 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2371 {"",S_FALSE,FALSE},
2372 {"",S_FALSE,FALSE},
2373 {"",S_FALSE,FALSE},
2374 {"::1.2.3.0",S_OK,FALSE},
2375 {"",S_FALSE,FALSE},
2376 {"/%3F%23.T/test",S_OK,FALSE},
2377 {"/%3F%23.T/test",S_OK,FALSE},
2378 {"",S_FALSE,FALSE},
2379 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2380 {"http",S_OK,FALSE},
2381 {"",S_FALSE,FALSE},
2382 {"",S_FALSE,FALSE},
2385 {Uri_HOST_IPV6,S_OK,FALSE},
2386 {80,S_OK,FALSE},
2387 {URL_SCHEME_HTTP,S_OK,FALSE},
2388 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2391 /* Forbidden characters are always encoded for file URIs. */
2392 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2394 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2395 {"",S_FALSE,FALSE},
2396 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2397 {"",S_FALSE,FALSE},
2398 {".mp3",S_OK,FALSE},
2399 {"",S_FALSE,FALSE},
2400 {"",S_FALSE,FALSE},
2401 {"",S_FALSE,FALSE},
2402 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2403 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2404 {"",S_FALSE,FALSE},
2405 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2406 {"file",S_OK,FALSE},
2407 {"",S_FALSE,FALSE},
2408 {"",S_FALSE,FALSE}
2411 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2412 {0,S_FALSE,FALSE},
2413 {URL_SCHEME_FILE,S_OK,FALSE},
2414 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2417 /* Forbidden characters are never encoded for unknown scheme types. */
2418 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2420 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2421 {"4294967295",S_OK,FALSE},
2422 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2423 {"",S_FALSE,FALSE},
2424 {"",S_FALSE,FALSE},
2425 {"",S_FALSE,FALSE},
2426 {"4294967295",S_OK,FALSE},
2427 {"",S_FALSE,FALSE},
2428 {"/<|>\" test<|>",S_OK,FALSE},
2429 {"/<|>\" test<|>",S_OK,FALSE},
2430 {"",S_FALSE,FALSE},
2431 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2432 {"1234",S_OK,FALSE},
2433 {"",S_FALSE,FALSE},
2434 {"",S_FALSE,FALSE}
2437 {Uri_HOST_IPV4,S_OK,FALSE},
2438 {0,S_FALSE,FALSE},
2439 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2440 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2443 /* Make sure forbidden characters are percent encoded. */
2444 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2446 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2447 {"gov.uk",S_OK,FALSE},
2448 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2449 {"",S_FALSE,FALSE},
2450 {"",S_FALSE,FALSE},
2451 {"",S_FALSE,FALSE},
2452 {"gov.uk",S_OK,FALSE},
2453 {"",S_FALSE,FALSE},
2454 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2455 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2456 {"",S_FALSE,FALSE},
2457 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2458 {"http",S_OK,FALSE},
2459 {"",S_FALSE,FALSE},
2460 {"",S_FALSE,FALSE}
2463 {Uri_HOST_DNS,S_OK,FALSE},
2464 {80,S_OK,FALSE},
2465 {URL_SCHEME_HTTP,S_OK,FALSE},
2466 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2469 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2471 {"http://gov.uk/",S_OK,FALSE},
2472 {"gov.uk",S_OK,FALSE},
2473 {"http://gov.uk/",S_OK,FALSE},
2474 {"",S_FALSE,FALSE},
2475 {"",S_FALSE,FALSE},
2476 {"",S_FALSE,FALSE},
2477 {"gov.uk",S_OK,FALSE},
2478 {"",S_FALSE,FALSE},
2479 {"/",S_OK,FALSE},
2480 {"/",S_OK,FALSE},
2481 {"",S_FALSE,FALSE},
2482 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2483 {"http",S_OK,FALSE},
2484 {"",S_FALSE,FALSE},
2485 {"",S_FALSE,FALSE}
2488 {Uri_HOST_DNS,S_OK,FALSE},
2489 {80,S_OK,FALSE},
2490 {URL_SCHEME_HTTP,S_OK,FALSE},
2491 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2494 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2496 {"http://gov.uk/",S_OK,FALSE},
2497 {"gov.uk",S_OK,FALSE},
2498 {"http://gov.uk/",S_OK,FALSE},
2499 {"",S_FALSE,FALSE},
2500 {"",S_FALSE,FALSE},
2501 {"",S_FALSE,FALSE},
2502 {"gov.uk",S_OK,FALSE},
2503 {"",S_FALSE,FALSE},
2504 {"/",S_OK,FALSE},
2505 {"/",S_OK,FALSE},
2506 {"",S_FALSE,FALSE},
2507 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2508 {"http",S_OK,FALSE},
2509 {"",S_FALSE,FALSE},
2510 {"",S_FALSE,FALSE}
2513 {Uri_HOST_DNS,S_OK,FALSE},
2514 {80,S_OK,FALSE},
2515 {URL_SCHEME_HTTP,S_OK,FALSE},
2516 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2519 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2521 {"http://gov.uk/",S_OK,FALSE},
2522 {"gov.uk",S_OK,FALSE},
2523 {"http://gov.uk/",S_OK,FALSE},
2524 {"",S_FALSE,FALSE},
2525 {"",S_FALSE,FALSE},
2526 {"",S_FALSE,FALSE},
2527 {"gov.uk",S_OK,FALSE},
2528 {"",S_FALSE,FALSE},
2529 {"/",S_OK,FALSE},
2530 {"/",S_OK,FALSE},
2531 {"",S_FALSE,FALSE},
2532 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2533 {"http",S_OK,FALSE},
2534 {"",S_FALSE,FALSE},
2535 {"",S_FALSE,FALSE}
2538 {Uri_HOST_DNS,S_OK,FALSE},
2539 {80,S_OK,FALSE},
2540 {URL_SCHEME_HTTP,S_OK,FALSE},
2541 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2544 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2546 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2547 {"",S_FALSE,FALSE},
2548 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2549 {"",S_FALSE,FALSE},
2550 {".mp3",S_OK,FALSE},
2551 {"",S_FALSE,FALSE},
2552 {"",S_FALSE,FALSE},
2553 {"",S_FALSE,FALSE},
2554 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2555 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2556 {"",S_FALSE,FALSE},
2557 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2558 {"file",S_OK,FALSE},
2559 {"",S_FALSE,FALSE},
2560 {"",S_FALSE,FALSE}
2563 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2564 {0,S_FALSE,FALSE},
2565 {URL_SCHEME_FILE,S_OK,FALSE},
2566 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2569 /* Dot removal happens for unknown scheme types. */
2570 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2572 {"zip://gov.uk/",S_OK,FALSE},
2573 {"gov.uk",S_OK,FALSE},
2574 {"zip://gov.uk/",S_OK,FALSE},
2575 {"",S_FALSE,FALSE},
2576 {"",S_FALSE,FALSE},
2577 {"",S_FALSE,FALSE},
2578 {"gov.uk",S_OK,FALSE},
2579 {"",S_FALSE,FALSE},
2580 {"/",S_OK,FALSE},
2581 {"/",S_OK,FALSE},
2582 {"",S_FALSE,FALSE},
2583 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2584 {"zip",S_OK,FALSE},
2585 {"",S_FALSE,FALSE},
2586 {"",S_FALSE,FALSE}
2589 {Uri_HOST_DNS,S_OK,FALSE},
2590 {0,S_FALSE,FALSE},
2591 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2592 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2595 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2596 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2598 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2599 {"gov.uk",S_OK,FALSE},
2600 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2601 {"",S_FALSE,FALSE},
2602 {".",S_OK,FALSE},
2603 {"",S_FALSE,FALSE},
2604 {"gov.uk",S_OK,FALSE},
2605 {"",S_FALSE,FALSE},
2606 {"/test/test2/../../.",S_OK,FALSE},
2607 {"/test/test2/../../.",S_OK,FALSE},
2608 {"",S_FALSE,FALSE},
2609 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2610 {"http",S_OK,FALSE},
2611 {"",S_FALSE,FALSE},
2612 {"",S_FALSE,FALSE}
2615 {Uri_HOST_DNS,S_OK,FALSE},
2616 {80,S_OK,FALSE},
2617 {URL_SCHEME_HTTP,S_OK,FALSE},
2618 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2621 /* Dot removal doesn't happen for wildcard scheme types. */
2622 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2624 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2625 {"gov.uk",S_OK,FALSE},
2626 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2627 {"",S_FALSE,FALSE},
2628 {".",S_OK,FALSE},
2629 {"",S_FALSE,FALSE},
2630 {"gov.uk",S_OK,FALSE},
2631 {"",S_FALSE,FALSE},
2632 {"/test/test2/../../.",S_OK,FALSE},
2633 {"/test/test2/../../.",S_OK,FALSE},
2634 {"",S_FALSE,FALSE},
2635 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2636 {"*",S_OK,FALSE},
2637 {"",S_FALSE,FALSE},
2638 {"",S_FALSE,FALSE}
2641 {Uri_HOST_DNS,S_OK,FALSE},
2642 {0,S_FALSE,FALSE},
2643 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2644 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2647 /* Forbidden characters are encoded for opaque known scheme types. */
2648 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2650 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2651 {"",S_FALSE,FALSE},
2652 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2653 {"",S_FALSE,FALSE},
2654 {".com%22",S_OK,FALSE},
2655 {"",S_FALSE,FALSE},
2656 {"",S_FALSE,FALSE},
2657 {"",S_FALSE,FALSE},
2658 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2659 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2660 {"",S_FALSE,FALSE},
2661 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2662 {"mailto",S_OK,FALSE},
2663 {"",S_FALSE,FALSE},
2664 {"",S_FALSE,FALSE}
2667 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2668 {0,S_FALSE,FALSE},
2669 {URL_SCHEME_MAILTO,S_OK,FALSE},
2670 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2673 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2675 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2676 {"",S_FALSE,FALSE},
2677 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2678 {"",S_FALSE,FALSE},
2679 {".com",S_OK,FALSE},
2680 {"",S_FALSE,FALSE},
2681 {"",S_FALSE,FALSE},
2682 {"",S_FALSE,FALSE},
2683 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2684 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2685 {"",S_FALSE,FALSE},
2686 {"news:test.tes<|>t.com",S_OK,FALSE},
2687 {"news",S_OK,FALSE},
2688 {"",S_FALSE,FALSE},
2689 {"",S_FALSE,FALSE}
2692 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2693 {0,S_FALSE,FALSE},
2694 {URL_SCHEME_NEWS,S_OK,FALSE},
2695 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2698 /* Don't encode forbidden characters. */
2699 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2701 {"news:test.tes<|>t.com",S_OK,FALSE},
2702 {"",S_FALSE,FALSE},
2703 {"news:test.tes<|>t.com",S_OK,FALSE},
2704 {"",S_FALSE,FALSE},
2705 {".com",S_OK,FALSE},
2706 {"",S_FALSE,FALSE},
2707 {"",S_FALSE,FALSE},
2708 {"",S_FALSE,FALSE},
2709 {"test.tes<|>t.com",S_OK,FALSE},
2710 {"test.tes<|>t.com",S_OK,FALSE},
2711 {"",S_FALSE,FALSE},
2712 {"news:test.tes<|>t.com",S_OK,FALSE},
2713 {"news",S_OK,FALSE},
2714 {"",S_FALSE,FALSE},
2715 {"",S_FALSE,FALSE}
2718 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2719 {0,S_FALSE,FALSE},
2720 {URL_SCHEME_NEWS,S_OK,FALSE},
2721 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2724 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2725 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2727 {"urn:test.tes<|>t.com",S_OK,FALSE},
2728 {"",S_FALSE,FALSE},
2729 {"urn:test.tes<|>t.com",S_OK,FALSE},
2730 {"",S_FALSE,FALSE},
2731 {".com",S_OK,FALSE},
2732 {"",S_FALSE,FALSE},
2733 {"",S_FALSE,FALSE},
2734 {"",S_FALSE,FALSE},
2735 {"test.tes<|>t.com",S_OK,FALSE},
2736 {"test.tes<|>t.com",S_OK,FALSE},
2737 {"",S_FALSE,FALSE},
2738 {"urn:test.tes<|>t.com",S_OK,FALSE},
2739 {"urn",S_OK,FALSE},
2740 {"",S_FALSE,FALSE},
2741 {"",S_FALSE,FALSE}
2744 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2745 {0,S_FALSE,FALSE},
2746 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2747 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2750 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2751 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2753 {"news:test.test.com",S_OK,FALSE},
2754 {"",S_FALSE,FALSE},
2755 {"news:test.test.com",S_OK,FALSE},
2756 {"",S_FALSE,FALSE},
2757 {".com",S_OK,FALSE},
2758 {"",S_FALSE,FALSE},
2759 {"",S_FALSE,FALSE},
2760 {"",S_FALSE,FALSE},
2761 {"test.test.com",S_OK,FALSE},
2762 {"test.test.com",S_OK,FALSE},
2763 {"",S_FALSE,FALSE},
2764 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2765 {"news",S_OK,FALSE},
2766 {"",S_FALSE,FALSE},
2767 {"",S_FALSE,FALSE}
2770 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2771 {0,S_FALSE,FALSE},
2772 {URL_SCHEME_NEWS,S_OK,FALSE},
2773 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2776 /* Percent encoded characters are still decoded for known scheme types. */
2777 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2779 {"news:test.test.com",S_OK,FALSE},
2780 {"",S_FALSE,FALSE},
2781 {"news:test.test.com",S_OK,FALSE},
2782 {"",S_FALSE,FALSE},
2783 {".com",S_OK,FALSE},
2784 {"",S_FALSE,FALSE},
2785 {"",S_FALSE,FALSE},
2786 {"",S_FALSE,FALSE},
2787 {"test.test.com",S_OK,FALSE},
2788 {"test.test.com",S_OK,FALSE},
2789 {"",S_FALSE,FALSE},
2790 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2791 {"news",S_OK,FALSE},
2792 {"",S_FALSE,FALSE},
2793 {"",S_FALSE,FALSE}
2796 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2797 {0,S_FALSE,FALSE},
2798 {URL_SCHEME_NEWS,S_OK,FALSE},
2799 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2802 /* Percent encoded characters aren't decoded for unknown scheme types. */
2803 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2805 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2806 {"",S_FALSE,FALSE},
2807 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2808 {"",S_FALSE,FALSE},
2809 {".com",S_OK,FALSE},
2810 {"",S_FALSE,FALSE},
2811 {"",S_FALSE,FALSE},
2812 {"",S_FALSE,FALSE},
2813 {"test.%74%65%73%74.com",S_OK,FALSE},
2814 {"test.%74%65%73%74.com",S_OK,FALSE},
2815 {"",S_FALSE,FALSE},
2816 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2817 {"urn",S_OK,FALSE},
2818 {"",S_FALSE,FALSE},
2819 {"",S_FALSE,FALSE}
2822 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2823 {0,S_FALSE,FALSE},
2824 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2825 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2828 /* Unknown scheme types can have invalid % encoded data in query string. */
2829 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2831 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2832 {"www.winehq.org",S_OK,FALSE},
2833 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2834 {"winehq.org",S_OK,FALSE},
2835 {"",S_FALSE,FALSE},
2836 {"",S_FALSE,FALSE},
2837 {"www.winehq.org",S_OK,FALSE},
2838 {"",S_FALSE,FALSE},
2839 {"/",S_OK,FALSE},
2840 {"/?query=%xx&return=y",S_OK,FALSE},
2841 {"?query=%xx&return=y",S_OK,FALSE},
2842 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2843 {"zip",S_OK,FALSE},
2844 {"",S_FALSE,FALSE},
2845 {"",S_FALSE,FALSE}
2848 {Uri_HOST_DNS,S_OK,FALSE},
2849 {0,S_FALSE,FALSE},
2850 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2851 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2854 /* Known scheme types can have invalid % encoded data with the right flags. */
2855 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2857 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2858 {"www.winehq.org",S_OK,FALSE},
2859 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2860 {"winehq.org",S_OK,FALSE},
2861 {"",S_FALSE,FALSE},
2862 {"",S_FALSE,FALSE},
2863 {"www.winehq.org",S_OK,FALSE},
2864 {"",S_FALSE,FALSE},
2865 {"/",S_OK,FALSE},
2866 {"/?query=%xx&return=y",S_OK,FALSE},
2867 {"?query=%xx&return=y",S_OK,FALSE},
2868 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2869 {"http",S_OK,FALSE},
2870 {"",S_FALSE,FALSE},
2871 {"",S_FALSE,FALSE}
2874 {Uri_HOST_DNS,S_OK,FALSE},
2875 {80,S_OK,FALSE},
2876 {URL_SCHEME_HTTP,S_OK,FALSE},
2877 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2880 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2881 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2883 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2884 {"www.winehq.org",S_OK,FALSE},
2885 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2886 {"winehq.org",S_OK,FALSE},
2887 {"",S_FALSE,FALSE},
2888 {"",S_FALSE,FALSE},
2889 {"www.winehq.org",S_OK,FALSE},
2890 {"",S_FALSE,FALSE},
2891 {"/",S_OK,FALSE},
2892 {"/?query=<|>&return=y",S_OK,FALSE},
2893 {"?query=<|>&return=y",S_OK,FALSE},
2894 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2895 {"http",S_OK,FALSE},
2896 {"",S_FALSE,FALSE},
2897 {"",S_FALSE,FALSE}
2900 {Uri_HOST_DNS,S_OK,FALSE},
2901 {80,S_OK,FALSE},
2902 {URL_SCHEME_HTTP,S_OK,FALSE},
2903 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2906 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2907 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2909 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2910 {"www.winehq.org",S_OK,FALSE},
2911 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2912 {"winehq.org",S_OK,FALSE},
2913 {"",S_FALSE,FALSE},
2914 {"",S_FALSE,FALSE},
2915 {"www.winehq.org",S_OK,FALSE},
2916 {"",S_FALSE,FALSE},
2917 {"/",S_OK,FALSE},
2918 {"/?query=<|>&return=y",S_OK,FALSE},
2919 {"?query=<|>&return=y",S_OK,FALSE},
2920 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2921 {"http",S_OK,FALSE},
2922 {"",S_FALSE,FALSE},
2923 {"",S_FALSE,FALSE}
2926 {Uri_HOST_DNS,S_OK,FALSE},
2927 {80,S_OK,FALSE},
2928 {URL_SCHEME_HTTP,S_OK,FALSE},
2929 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2932 /* Forbidden characters are encoded for known scheme types. */
2933 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2935 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2936 {"www.winehq.org",S_OK,FALSE},
2937 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2938 {"winehq.org",S_OK,FALSE},
2939 {"",S_FALSE,FALSE},
2940 {"",S_FALSE,FALSE},
2941 {"www.winehq.org",S_OK,FALSE},
2942 {"",S_FALSE,FALSE},
2943 {"/",S_OK,FALSE},
2944 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2945 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2946 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2947 {"http",S_OK,FALSE},
2948 {"",S_FALSE,FALSE},
2949 {"",S_FALSE,FALSE}
2952 {Uri_HOST_DNS,S_OK,FALSE},
2953 {80,S_OK,FALSE},
2954 {URL_SCHEME_HTTP,S_OK,FALSE},
2955 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2958 /* Forbidden characters are not encoded for unknown scheme types. */
2959 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2961 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2962 {"www.winehq.org",S_OK,FALSE},
2963 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2964 {"winehq.org",S_OK,FALSE},
2965 {"",S_FALSE,FALSE},
2966 {"",S_FALSE,FALSE},
2967 {"www.winehq.org",S_OK,FALSE},
2968 {"",S_FALSE,FALSE},
2969 {"/",S_OK,FALSE},
2970 {"/?query=<|>&return=y",S_OK,FALSE},
2971 {"?query=<|>&return=y",S_OK,FALSE},
2972 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2973 {"zip",S_OK,FALSE},
2974 {"",S_FALSE,FALSE},
2975 {"",S_FALSE,FALSE}
2978 {Uri_HOST_DNS,S_OK,FALSE},
2979 {0,S_FALSE,FALSE},
2980 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2981 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2984 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2985 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2987 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2988 {"www.winehq.org",S_OK,FALSE},
2989 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2990 {"winehq.org",S_OK,FALSE},
2991 {"",S_FALSE,FALSE},
2992 {"",S_FALSE,FALSE},
2993 {"www.winehq.org",S_OK,FALSE},
2994 {"",S_FALSE,FALSE},
2995 {"/",S_OK,FALSE},
2996 {"/?query=01&return=y",S_OK,FALSE},
2997 {"?query=01&return=y",S_OK,FALSE},
2998 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2999 {"http",S_OK,FALSE},
3000 {"",S_FALSE,FALSE},
3001 {"",S_FALSE,FALSE}
3004 {Uri_HOST_DNS,S_OK,FALSE},
3005 {80,S_OK,FALSE},
3006 {URL_SCHEME_HTTP,S_OK,FALSE},
3007 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3010 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
3011 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
3013 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3014 {"www.winehq.org",S_OK,FALSE},
3015 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3016 {"winehq.org",S_OK,FALSE},
3017 {"",S_FALSE,FALSE},
3018 {"",S_FALSE,FALSE},
3019 {"www.winehq.org",S_OK,FALSE},
3020 {"",S_FALSE,FALSE},
3021 {"/",S_OK,FALSE},
3022 {"/?query=%30%31&return=y",S_OK,FALSE},
3023 {"?query=%30%31&return=y",S_OK,FALSE},
3024 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
3025 {"zip",S_OK,FALSE},
3026 {"",S_FALSE,FALSE},
3027 {"",S_FALSE,FALSE}
3030 {Uri_HOST_DNS,S_OK,FALSE},
3031 {0,S_FALSE,FALSE},
3032 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3033 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3036 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
3037 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3039 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3040 {"www.winehq.org",S_OK,FALSE},
3041 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3042 {"winehq.org",S_OK,FALSE},
3043 {"",S_FALSE,FALSE},
3044 {"",S_FALSE,FALSE},
3045 {"www.winehq.org",S_OK,FALSE},
3046 {"",S_FALSE,FALSE},
3047 {"/",S_OK,FALSE},
3048 {"/?query=%30%31&return=y",S_OK,FALSE},
3049 {"?query=%30%31&return=y",S_OK,FALSE},
3050 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
3051 {"http",S_OK,FALSE},
3052 {"",S_FALSE,FALSE},
3053 {"",S_FALSE,FALSE}
3056 {Uri_HOST_DNS,S_OK,FALSE},
3057 {80,S_OK,FALSE},
3058 {URL_SCHEME_HTTP,S_OK,FALSE},
3059 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3062 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3064 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3065 {"www.winehq.org",S_OK,FALSE},
3066 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3067 {"winehq.org",S_OK,FALSE},
3068 {"",S_FALSE,FALSE},
3069 {"",S_FALSE,FALSE},
3070 {"www.winehq.org",S_OK,FALSE},
3071 {"",S_FALSE,FALSE},
3072 {"",S_FALSE,FALSE},
3073 {"?query=12&return=y",S_OK,FALSE},
3074 {"?query=12&return=y",S_OK,FALSE},
3075 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3076 {"http",S_OK,FALSE},
3077 {"",S_FALSE,FALSE},
3078 {"",S_FALSE,FALSE}
3081 {Uri_HOST_DNS,S_OK,FALSE},
3082 {80,S_OK,FALSE},
3083 {URL_SCHEME_HTTP,S_OK,FALSE},
3084 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3087 /* Unknown scheme types can have invalid % encoded data in fragments. */
3088 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
3090 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3091 {"www.winehq.org",S_OK,FALSE},
3092 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3093 {"winehq.org",S_OK,FALSE},
3094 {"",S_FALSE,FALSE},
3095 {"#Te%xx",S_OK,FALSE},
3096 {"www.winehq.org",S_OK,FALSE},
3097 {"",S_FALSE,FALSE},
3098 {"/tests/",S_OK,FALSE},
3099 {"/tests/",S_OK,FALSE},
3100 {"",S_FALSE,FALSE},
3101 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3102 {"zip",S_OK,FALSE},
3103 {"",S_FALSE,FALSE},
3104 {"",S_FALSE,FALSE}
3107 {Uri_HOST_DNS,S_OK,FALSE},
3108 {0,S_FALSE,FALSE},
3109 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3110 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3113 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
3114 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3116 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3117 {"www.winehq.org",S_OK,FALSE},
3118 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3119 {"winehq.org",S_OK,FALSE},
3120 {"",S_FALSE,FALSE},
3121 {"#Te<|>",S_OK,FALSE},
3122 {"www.winehq.org",S_OK,FALSE},
3123 {"",S_FALSE,FALSE},
3124 {"/tests/",S_OK,FALSE},
3125 {"/tests/",S_OK,FALSE},
3126 {"",S_FALSE,FALSE},
3127 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3128 {"zip",S_OK,FALSE},
3129 {"",S_FALSE,FALSE},
3130 {"",S_FALSE,FALSE}
3133 {Uri_HOST_DNS,S_OK,FALSE},
3134 {0,S_FALSE,FALSE},
3135 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3136 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3139 /* Forbidden characters in the fragment are percent encoded for known schemes. */
3140 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3142 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3143 {"www.winehq.org",S_OK,FALSE},
3144 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3145 {"winehq.org",S_OK,FALSE},
3146 {"",S_FALSE,FALSE},
3147 {"#Te%3C%7C%3E",S_OK,FALSE},
3148 {"www.winehq.org",S_OK,FALSE},
3149 {"",S_FALSE,FALSE},
3150 {"/tests/",S_OK,FALSE},
3151 {"/tests/",S_OK,FALSE},
3152 {"",S_FALSE,FALSE},
3153 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3154 {"http",S_OK,FALSE},
3155 {"",S_FALSE,FALSE},
3156 {"",S_FALSE,FALSE}
3159 {Uri_HOST_DNS,S_OK,FALSE},
3160 {80,S_OK,FALSE},
3161 {URL_SCHEME_HTTP,S_OK,FALSE},
3162 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3165 /* Forbidden characters aren't encoded in the fragment with this flag. */
3166 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3168 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3169 {"www.winehq.org",S_OK,FALSE},
3170 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3171 {"winehq.org",S_OK,FALSE},
3172 {"",S_FALSE,FALSE},
3173 {"#Te<|>",S_OK,FALSE},
3174 {"www.winehq.org",S_OK,FALSE},
3175 {"",S_FALSE,FALSE},
3176 {"/tests/",S_OK,FALSE},
3177 {"/tests/",S_OK,FALSE},
3178 {"",S_FALSE,FALSE},
3179 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3180 {"http",S_OK,FALSE},
3181 {"",S_FALSE,FALSE},
3182 {"",S_FALSE,FALSE}
3185 {Uri_HOST_DNS,S_OK,FALSE},
3186 {80,S_OK,FALSE},
3187 {URL_SCHEME_HTTP,S_OK,FALSE},
3188 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3191 /* Forbidden characters aren't encoded in the fragment with this flag. */
3192 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3194 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3195 {"www.winehq.org",S_OK,FALSE},
3196 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3197 {"winehq.org",S_OK,FALSE},
3198 {"",S_FALSE,FALSE},
3199 {"#Te<|>",S_OK,FALSE},
3200 {"www.winehq.org",S_OK,FALSE},
3201 {"",S_FALSE,FALSE},
3202 {"/tests/",S_OK,FALSE},
3203 {"/tests/",S_OK,FALSE},
3204 {"",S_FALSE,FALSE},
3205 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3206 {"http",S_OK,FALSE},
3207 {"",S_FALSE,FALSE},
3208 {"",S_FALSE,FALSE}
3211 {Uri_HOST_DNS,S_OK,FALSE},
3212 {80,S_OK,FALSE},
3213 {URL_SCHEME_HTTP,S_OK,FALSE},
3214 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3217 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3218 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3220 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3221 {"www.winehq.org",S_OK,FALSE},
3222 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3223 {"winehq.org",S_OK,FALSE},
3224 {"",S_FALSE,FALSE},
3225 {"#Te%30%31%32",S_OK,FALSE},
3226 {"www.winehq.org",S_OK,FALSE},
3227 {"",S_FALSE,FALSE},
3228 {"/tests/",S_OK,FALSE},
3229 {"/tests/",S_OK,FALSE},
3230 {"",S_FALSE,FALSE},
3231 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3232 {"zip",S_OK,FALSE},
3233 {"",S_FALSE,FALSE},
3234 {"",S_FALSE,FALSE}
3237 {Uri_HOST_DNS,S_OK,FALSE},
3238 {0,S_FALSE,FALSE},
3239 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3240 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3243 /* Percent encoded, unreserved characters are decoded for known schemes. */
3244 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3246 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3247 {"www.winehq.org",S_OK,FALSE},
3248 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3249 {"winehq.org",S_OK,FALSE},
3250 {"",S_FALSE,FALSE},
3251 {"#Te012",S_OK,FALSE},
3252 {"www.winehq.org",S_OK,FALSE},
3253 {"",S_FALSE,FALSE},
3254 {"/tests/",S_OK,FALSE},
3255 {"/tests/",S_OK,FALSE},
3256 {"",S_FALSE,FALSE},
3257 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3258 {"http",S_OK,FALSE},
3259 {"",S_FALSE,FALSE},
3260 {"",S_FALSE,FALSE}
3263 {Uri_HOST_DNS,S_OK,FALSE},
3264 {80,S_OK,FALSE},
3265 {URL_SCHEME_HTTP,S_OK,FALSE},
3266 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3269 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3270 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3272 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3273 {"www.winehq.org",S_OK,FALSE},
3274 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3275 {"winehq.org",S_OK,FALSE},
3276 {"",S_FALSE,FALSE},
3277 {"#Te012",S_OK,FALSE},
3278 {"www.winehq.org",S_OK,FALSE},
3279 {"",S_FALSE,FALSE},
3280 {"/tests/",S_OK,FALSE},
3281 {"/tests/",S_OK,FALSE},
3282 {"",S_FALSE,FALSE},
3283 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3284 {"http",S_OK,FALSE},
3285 {"",S_FALSE,FALSE},
3286 {"",S_FALSE,FALSE}
3289 {Uri_HOST_DNS,S_OK,FALSE},
3290 {80,S_OK,FALSE},
3291 {URL_SCHEME_HTTP,S_OK,FALSE},
3292 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3295 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3296 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3298 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3299 {"www.winehq.org",S_OK,FALSE},
3300 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3301 {"winehq.org",S_OK,FALSE},
3302 {"",S_FALSE,FALSE},
3303 {"#Te%30%31%32",S_OK,FALSE},
3304 {"www.winehq.org",S_OK,FALSE},
3305 {"",S_FALSE,FALSE},
3306 {"/tests/",S_OK,FALSE},
3307 {"/tests/",S_OK,FALSE},
3308 {"",S_FALSE,FALSE},
3309 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3310 {"http",S_OK,FALSE},
3311 {"",S_FALSE,FALSE},
3312 {"",S_FALSE,FALSE}
3315 {Uri_HOST_DNS,S_OK,FALSE},
3316 {80,S_OK,FALSE},
3317 {URL_SCHEME_HTTP,S_OK,FALSE},
3318 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3321 /* Leading/Trailing whitespace is removed. */
3322 { " http://google.com/ ", 0, S_OK, FALSE,
3324 {"http://google.com/",S_OK,FALSE},
3325 {"google.com",S_OK,FALSE},
3326 {"http://google.com/",S_OK,FALSE},
3327 {"google.com",S_OK,FALSE},
3328 {"",S_FALSE,FALSE},
3329 {"",S_FALSE,FALSE},
3330 {"google.com",S_OK,FALSE},
3331 {"",S_FALSE,FALSE},
3332 {"/",S_OK,FALSE},
3333 {"/",S_OK,FALSE},
3334 {"",S_FALSE,FALSE},
3335 {"http://google.com/",S_OK,FALSE},
3336 {"http",S_OK,FALSE},
3337 {"",S_FALSE,FALSE},
3338 {"",S_FALSE,FALSE}
3341 {Uri_HOST_DNS,S_OK,FALSE},
3342 {80,S_OK,FALSE},
3343 {URL_SCHEME_HTTP,S_OK,FALSE},
3344 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3347 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3349 {"http://google.com/",S_OK,FALSE},
3350 {"google.com",S_OK,FALSE},
3351 {"http://google.com/",S_OK,FALSE},
3352 {"google.com",S_OK,FALSE},
3353 {"",S_FALSE,FALSE},
3354 {"",S_FALSE,FALSE},
3355 {"google.com",S_OK,FALSE},
3356 {"",S_FALSE,FALSE},
3357 {"/",S_OK,FALSE},
3358 {"/",S_OK,FALSE},
3359 {"",S_FALSE,FALSE},
3360 {"http://google.com/",S_OK,FALSE},
3361 {"http",S_OK,FALSE},
3362 {"",S_FALSE,FALSE},
3363 {"",S_FALSE,FALSE}
3366 {Uri_HOST_DNS,S_OK,FALSE},
3367 {80,S_OK,FALSE},
3368 {URL_SCHEME_HTTP,S_OK,FALSE},
3369 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3372 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3374 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3375 {"g%0aoogle.co%0dm",S_OK,FALSE},
3376 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3377 {"g%0aoogle.co%0dm",S_OK,FALSE},
3378 {"",S_FALSE,FALSE},
3379 {"",S_FALSE,FALSE},
3380 {"g%0aoogle.co%0dm",S_OK,FALSE},
3381 {"",S_FALSE,FALSE},
3382 {"/%0A%0A%0A",S_OK,FALSE},
3383 {"/%0A%0A%0A",S_OK,FALSE},
3384 {"",S_FALSE,FALSE},
3385 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3386 {"http",S_OK,FALSE},
3387 {"",S_FALSE,FALSE},
3388 {"",S_FALSE,FALSE}
3391 {Uri_HOST_DNS,S_OK,FALSE},
3392 {80,S_OK,FALSE},
3393 {URL_SCHEME_HTTP,S_OK,FALSE},
3394 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3397 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3399 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3400 {"g\noogle.co\rm",S_OK,FALSE},
3401 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3402 {"g\noogle.co\rm",S_OK,FALSE},
3403 {"",S_FALSE,FALSE},
3404 {"",S_FALSE,FALSE},
3405 {"g\noogle.co\rm",S_OK,FALSE},
3406 {"",S_FALSE,FALSE},
3407 {"/\n\n\n",S_OK,FALSE},
3408 {"/\n\n\n",S_OK,FALSE},
3409 {"",S_FALSE,FALSE},
3410 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3411 {"zip",S_OK,FALSE},
3412 {"",S_FALSE,FALSE},
3413 {"",S_FALSE,FALSE}
3416 {Uri_HOST_DNS,S_OK,FALSE},
3417 {0,S_FALSE,FALSE},
3418 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3419 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3422 /* Since file URLs are usually hierarchical, it returns an empty string
3423 * for the absolute URI property since it was declared as an opaque URI.
3425 { "file:index.html", 0, S_OK, FALSE,
3427 {"",S_FALSE,FALSE},
3428 {"",S_FALSE,FALSE},
3429 {"file:index.html",S_OK,FALSE},
3430 {"",S_FALSE,FALSE},
3431 {".html",S_OK,FALSE},
3432 {"",S_FALSE,FALSE},
3433 {"",S_FALSE,FALSE},
3434 {"",S_FALSE,FALSE},
3435 {"index.html",S_OK,FALSE},
3436 {"index.html",S_OK,FALSE},
3437 {"",S_FALSE,FALSE},
3438 {"file:index.html",S_OK,FALSE},
3439 {"file",S_OK,FALSE},
3440 {"",S_FALSE,FALSE},
3441 {"",S_FALSE,FALSE}
3444 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3445 {0,S_FALSE,FALSE},
3446 {URL_SCHEME_FILE,S_OK,FALSE},
3447 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3450 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3451 { "http:test.com/index.html", 0, S_OK, FALSE,
3453 {"",S_FALSE,FALSE},
3454 {"",S_FALSE,FALSE},
3455 {"http:test.com/index.html",S_OK,FALSE},
3456 {"",S_FALSE,FALSE},
3457 {".html",S_OK,FALSE},
3458 {"",S_FALSE,FALSE},
3459 {"",S_FALSE,FALSE},
3460 {"",S_FALSE,FALSE},
3461 {"test.com/index.html",S_OK,FALSE},
3462 {"test.com/index.html",S_OK,FALSE},
3463 {"",S_FALSE,FALSE},
3464 {"http:test.com/index.html",S_OK,FALSE},
3465 {"http",S_OK,FALSE},
3466 {"",S_FALSE,FALSE},
3467 {"",S_FALSE,FALSE}
3470 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3471 {80,S_OK,FALSE},
3472 {URL_SCHEME_HTTP,S_OK,FALSE},
3473 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3476 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3478 {"",S_FALSE,FALSE},
3479 {"",S_FALSE,FALSE},
3480 {"ftp:test.com/index.html",S_OK,FALSE},
3481 {"",S_FALSE,FALSE},
3482 {".html",S_OK,FALSE},
3483 {"",S_FALSE,FALSE},
3484 {"",S_FALSE,FALSE},
3485 {"",S_FALSE,FALSE},
3486 {"test.com/index.html",S_OK,FALSE},
3487 {"test.com/index.html",S_OK,FALSE},
3488 {"",S_FALSE,FALSE},
3489 {"ftp:test.com/index.html",S_OK,FALSE},
3490 {"ftp",S_OK,FALSE},
3491 {"",S_FALSE,FALSE},
3492 {"",S_FALSE,FALSE}
3495 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3496 {21,S_OK,FALSE},
3497 {URL_SCHEME_FTP,S_OK,FALSE},
3498 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3501 { "file://C|/test.mp3", 0, S_OK, FALSE,
3503 {"file:///C:/test.mp3",S_OK,FALSE},
3504 {"",S_FALSE,FALSE},
3505 {"file:///C:/test.mp3",S_OK,FALSE},
3506 {"",S_FALSE,FALSE},
3507 {".mp3",S_OK,FALSE},
3508 {"",S_FALSE,FALSE},
3509 {"",S_FALSE,FALSE},
3510 {"",S_FALSE,FALSE},
3511 {"/C:/test.mp3",S_OK,FALSE},
3512 {"/C:/test.mp3",S_OK,FALSE},
3513 {"",S_FALSE,FALSE},
3514 {"file://C|/test.mp3",S_OK,FALSE},
3515 {"file",S_OK,FALSE},
3516 {"",S_FALSE,FALSE},
3517 {"",S_FALSE,FALSE}
3520 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3521 {0,S_FALSE,FALSE},
3522 {URL_SCHEME_FILE,S_OK,FALSE},
3523 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3526 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3528 {"file:///C:/test.mp3",S_OK,FALSE},
3529 {"",S_FALSE,FALSE},
3530 {"file:///C:/test.mp3",S_OK,FALSE},
3531 {"",S_FALSE,FALSE},
3532 {".mp3",S_OK,FALSE},
3533 {"",S_FALSE,FALSE},
3534 {"",S_FALSE,FALSE},
3535 {"",S_FALSE,FALSE},
3536 {"/C:/test.mp3",S_OK,FALSE},
3537 {"/C:/test.mp3",S_OK,FALSE},
3538 {"",S_FALSE,FALSE},
3539 {"file:///C|/test.mp3",S_OK,FALSE},
3540 {"file",S_OK,FALSE},
3541 {"",S_FALSE,FALSE},
3542 {"",S_FALSE,FALSE}
3545 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3546 {0,S_FALSE,FALSE},
3547 {URL_SCHEME_FILE,S_OK,FALSE},
3548 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3551 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3552 * to '\\'.
3554 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3556 {"file://c:\\dir\\index.html",S_OK,FALSE},
3557 {"",S_FALSE,FALSE},
3558 {"file://c:\\dir\\index.html",S_OK,FALSE},
3559 {"",S_FALSE,FALSE},
3560 {".html",S_OK,FALSE},
3561 {"",S_FALSE,FALSE},
3562 {"",S_FALSE,FALSE},
3563 {"",S_FALSE,FALSE},
3564 {"c:\\dir\\index.html",S_OK,FALSE},
3565 {"c:\\dir\\index.html",S_OK,FALSE},
3566 {"",S_FALSE,FALSE},
3567 {"file://c:/dir/index.html",S_OK,FALSE},
3568 {"file",S_OK,FALSE},
3569 {"",S_FALSE,FALSE},
3570 {"",S_FALSE,FALSE}
3573 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3574 {0,S_FALSE,FALSE},
3575 {URL_SCHEME_FILE,S_OK,FALSE},
3576 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3579 /* Extra '/' after "file://" is removed. */
3580 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3582 {"file://c:\\dir\\index.html",S_OK,FALSE},
3583 {"",S_FALSE,FALSE},
3584 {"file://c:\\dir\\index.html",S_OK,FALSE},
3585 {"",S_FALSE,FALSE},
3586 {".html",S_OK,FALSE},
3587 {"",S_FALSE,FALSE},
3588 {"",S_FALSE,FALSE},
3589 {"",S_FALSE,FALSE},
3590 {"c:\\dir\\index.html",S_OK,FALSE},
3591 {"c:\\dir\\index.html",S_OK,FALSE},
3592 {"",S_FALSE,FALSE},
3593 {"file:///c:/dir/index.html",S_OK,FALSE},
3594 {"file",S_OK,FALSE},
3595 {"",S_FALSE,FALSE},
3596 {"",S_FALSE,FALSE}
3599 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3600 {0,S_FALSE,FALSE},
3601 {URL_SCHEME_FILE,S_OK,FALSE},
3602 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3605 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3606 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3608 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3609 {"",S_FALSE,FALSE},
3610 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3611 {"",S_FALSE,FALSE},
3612 {".html",S_OK,FALSE},
3613 {"",S_FALSE,FALSE},
3614 {"",S_FALSE,FALSE},
3615 {"",S_FALSE,FALSE},
3616 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3617 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3618 {"",S_FALSE,FALSE},
3619 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3620 {"file",S_OK,FALSE},
3621 {"",S_FALSE,FALSE},
3622 {"",S_FALSE,FALSE}
3625 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3626 {0,S_FALSE,FALSE},
3627 {URL_SCHEME_FILE,S_OK,FALSE},
3628 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3631 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3633 {"file://c:\\dir\\index.html",S_OK,FALSE},
3634 {"",S_FALSE,FALSE},
3635 {"file://c:\\dir\\index.html",S_OK,FALSE},
3636 {"",S_FALSE,FALSE},
3637 {".html",S_OK,FALSE},
3638 {"",S_FALSE,FALSE},
3639 {"",S_FALSE,FALSE},
3640 {"",S_FALSE,FALSE},
3641 {"c:\\dir\\index.html",S_OK,FALSE},
3642 {"c:\\dir\\index.html",S_OK,FALSE},
3643 {"",S_FALSE,FALSE},
3644 {"file://c|/dir\\index.html",S_OK,FALSE},
3645 {"file",S_OK,FALSE},
3646 {"",S_FALSE,FALSE},
3647 {"",S_FALSE,FALSE}
3650 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3651 {0,S_FALSE,FALSE},
3652 {URL_SCHEME_FILE,S_OK,FALSE},
3653 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3656 /* The backslashes after the scheme name are converted to forward slashes. */
3657 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3659 {"file://c:\\dir\\index.html",S_OK,FALSE},
3660 {"",S_FALSE,FALSE},
3661 {"file://c:\\dir\\index.html",S_OK,FALSE},
3662 {"",S_FALSE,FALSE},
3663 {".html",S_OK,FALSE},
3664 {"",S_FALSE,FALSE},
3665 {"",S_FALSE,FALSE},
3666 {"",S_FALSE,FALSE},
3667 {"c:\\dir\\index.html",S_OK,FALSE},
3668 {"c:\\dir\\index.html",S_OK,FALSE},
3669 {"",S_FALSE,FALSE},
3670 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3671 {"file",S_OK,FALSE},
3672 {"",S_FALSE,FALSE},
3673 {"",S_FALSE,FALSE}
3676 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3677 {0,S_FALSE,FALSE},
3678 {URL_SCHEME_FILE,S_OK,FALSE},
3679 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3682 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3684 {"file:///c:/dir/index.html",S_OK,FALSE},
3685 {"",S_FALSE,FALSE},
3686 {"file:///c:/dir/index.html",S_OK,FALSE},
3687 {"",S_FALSE,FALSE},
3688 {".html",S_OK,FALSE},
3689 {"",S_FALSE,FALSE},
3690 {"",S_FALSE,FALSE},
3691 {"",S_FALSE,FALSE},
3692 {"/c:/dir/index.html",S_OK,FALSE},
3693 {"/c:/dir/index.html",S_OK,FALSE},
3694 {"",S_FALSE,FALSE},
3695 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3696 {"file",S_OK,FALSE},
3697 {"",S_FALSE,FALSE},
3698 {"",S_FALSE,FALSE}
3701 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3702 {0,S_FALSE,FALSE},
3703 {URL_SCHEME_FILE,S_OK,FALSE},
3704 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3707 { "http:\\\\google.com", 0, S_OK, FALSE,
3709 {"http://google.com/",S_OK,FALSE},
3710 {"google.com",S_OK,FALSE},
3711 {"http://google.com/",S_OK,FALSE},
3712 {"google.com",S_OK,FALSE},
3713 {"",S_FALSE,FALSE},
3714 {"",S_FALSE,FALSE},
3715 {"google.com",S_OK,FALSE},
3716 {"",S_FALSE,FALSE},
3717 {"/",S_OK,FALSE},
3718 {"/",S_OK,FALSE},
3719 {"",S_FALSE,FALSE},
3720 {"http:\\\\google.com",S_OK,FALSE},
3721 {"http",S_OK,FALSE},
3722 {"",S_FALSE,FALSE},
3723 {"",S_FALSE,FALSE}
3726 {Uri_HOST_DNS,S_OK,FALSE},
3727 {80,S_OK,FALSE},
3728 {URL_SCHEME_HTTP,S_OK,FALSE},
3729 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3732 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3733 { "zip:\\\\google.com", 0, S_OK, FALSE,
3735 {"zip:\\\\google.com",S_OK,FALSE},
3736 {"",S_FALSE,FALSE},
3737 {"zip:\\\\google.com",S_OK,FALSE},
3738 {"",S_FALSE,FALSE},
3739 {".com",S_OK,FALSE},
3740 {"",S_FALSE,FALSE},
3741 {"",S_FALSE,FALSE},
3742 {"",S_FALSE,FALSE},
3743 {"\\\\google.com",S_OK,FALSE},
3744 {"\\\\google.com",S_OK,FALSE},
3745 {"",S_FALSE,FALSE},
3746 {"zip:\\\\google.com",S_OK,FALSE},
3747 {"zip",S_OK,FALSE},
3748 {"",S_FALSE,FALSE},
3749 {"",S_FALSE,FALSE}
3752 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3753 {0,S_FALSE,FALSE},
3754 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3755 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3758 /* Dot segments aren't removed. */
3759 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3761 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3762 {"",S_FALSE,FALSE},
3763 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3764 {"",S_FALSE,FALSE},
3765 {".html",S_OK,FALSE},
3766 {"",S_FALSE,FALSE},
3767 {"",S_FALSE,FALSE},
3768 {"",S_FALSE,FALSE},
3769 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3770 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3771 {"",S_FALSE,FALSE},
3772 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3773 {"file",S_OK,FALSE},
3774 {"",S_FALSE,FALSE},
3775 {"",S_FALSE,FALSE}
3778 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3779 {0,S_FALSE,FALSE},
3780 {URL_SCHEME_FILE,S_OK,FALSE},
3781 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3784 /* Forbidden characters aren't percent encoded. */
3785 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3787 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3788 {"",S_FALSE,FALSE},
3789 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3790 {"",S_FALSE,FALSE},
3791 {".html",S_OK,FALSE},
3792 {"",S_FALSE,FALSE},
3793 {"",S_FALSE,FALSE},
3794 {"",S_FALSE,FALSE},
3795 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3796 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3797 {"",S_FALSE,FALSE},
3798 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3799 {"file",S_OK,FALSE},
3800 {"",S_FALSE,FALSE},
3801 {"",S_FALSE,FALSE}
3804 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3805 {0,S_FALSE,FALSE},
3806 {URL_SCHEME_FILE,S_OK,FALSE},
3807 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3810 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3811 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3813 {"",S_FALSE,FALSE},
3814 {"",S_FALSE,FALSE},
3815 {"file:c:/dir/../../index.html",S_OK,FALSE},
3816 {"",S_FALSE,FALSE},
3817 {".html",S_OK,FALSE},
3818 {"",S_FALSE,FALSE},
3819 {"",S_FALSE,FALSE},
3820 {"",S_FALSE,FALSE},
3821 {"c:/dir/../../index.html",S_OK,FALSE},
3822 {"c:/dir/../../index.html",S_OK,FALSE},
3823 {"",S_FALSE,FALSE},
3824 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3825 {"file",S_OK,FALSE},
3826 {"",S_FALSE,FALSE},
3827 {"",S_FALSE,FALSE}
3830 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3831 {0,S_FALSE,FALSE},
3832 {URL_SCHEME_FILE,S_OK,FALSE},
3833 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3836 /* '/' are still converted to '\' even though it's an opaque URI. */
3837 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3839 {"",S_FALSE,FALSE},
3840 {"",S_FALSE,FALSE},
3841 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3842 {"",S_FALSE,FALSE},
3843 {".html",S_OK,FALSE},
3844 {"",S_FALSE,FALSE},
3845 {"",S_FALSE,FALSE},
3846 {"",S_FALSE,FALSE},
3847 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3848 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3849 {"",S_FALSE,FALSE},
3850 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3851 {"file",S_OK,FALSE},
3852 {"",S_FALSE,FALSE},
3853 {"",S_FALSE,FALSE}
3856 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3857 {0,S_FALSE,FALSE},
3858 {URL_SCHEME_FILE,S_OK,FALSE},
3859 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3862 /* Forbidden characters aren't percent encoded. */
3863 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3865 {"",S_FALSE,FALSE},
3866 {"",S_FALSE,FALSE},
3867 {"file:c:\\in^|dex.html",S_OK,FALSE},
3868 {"",S_FALSE,FALSE},
3869 {".html",S_OK,FALSE},
3870 {"",S_FALSE,FALSE},
3871 {"",S_FALSE,FALSE},
3872 {"",S_FALSE,FALSE},
3873 {"c:\\in^|dex.html",S_OK,FALSE},
3874 {"c:\\in^|dex.html",S_OK,FALSE},
3875 {"",S_FALSE,FALSE},
3876 {"file:c:\\in^|dex.html",S_OK,FALSE},
3877 {"file",S_OK,FALSE},
3878 {"",S_FALSE,FALSE},
3879 {"",S_FALSE,FALSE}
3882 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3883 {0,S_FALSE,FALSE},
3884 {URL_SCHEME_FILE,S_OK,FALSE},
3885 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3888 /* Doesn't have a UserName since the ':' appears at the beginning of the
3889 * userinfo section.
3891 { "http://:password@gov.uk", 0, S_OK, FALSE,
3893 {"http://:password@gov.uk/",S_OK,FALSE},
3894 {":password@gov.uk",S_OK,FALSE},
3895 {"http://gov.uk/",S_OK,FALSE},
3896 {"",S_FALSE,FALSE},
3897 {"",S_FALSE,FALSE},
3898 {"",S_FALSE,FALSE},
3899 {"gov.uk",S_OK,FALSE},
3900 {"password",S_OK,FALSE},
3901 {"/",S_OK,FALSE},
3902 {"/",S_OK,FALSE},
3903 {"",S_FALSE,FALSE},
3904 {"http://:password@gov.uk",S_OK,FALSE},
3905 {"http",S_OK,FALSE},
3906 {":password",S_OK,FALSE},
3907 {"",S_FALSE,FALSE}
3910 {Uri_HOST_DNS,S_OK,FALSE},
3911 {80,S_OK,FALSE},
3912 {URL_SCHEME_HTTP,S_OK,FALSE},
3913 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3916 /* Has a UserName since the userinfo section doesn't contain a password. */
3917 { "http://@gov.uk", 0, S_OK, FALSE,
3919 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3920 {"@gov.uk",S_OK,FALSE},
3921 {"http://gov.uk/",S_OK,FALSE},
3922 {"",S_FALSE,FALSE},
3923 {"",S_FALSE,FALSE},
3924 {"",S_FALSE,FALSE},
3925 {"gov.uk",S_OK,FALSE},
3926 {"",S_FALSE,FALSE},
3927 {"/",S_OK,FALSE},
3928 {"/",S_OK,FALSE},
3929 {"",S_FALSE,FALSE},
3930 {"http://@gov.uk",S_OK,FALSE},
3931 {"http",S_OK,FALSE},
3932 {"",S_OK,FALSE},
3933 {"",S_OK,FALSE}
3936 {Uri_HOST_DNS,S_OK,FALSE},
3937 {80,S_OK,FALSE},
3938 {URL_SCHEME_HTTP,S_OK,FALSE},
3939 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3942 /* ":@" not included in the absolute URI. */
3943 { "http://:@gov.uk", 0, S_OK, FALSE,
3945 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3946 {":@gov.uk",S_OK,FALSE},
3947 {"http://gov.uk/",S_OK,FALSE},
3948 {"",S_FALSE,FALSE},
3949 {"",S_FALSE,FALSE},
3950 {"",S_FALSE,FALSE},
3951 {"gov.uk",S_OK,FALSE},
3952 {"",S_OK,FALSE},
3953 {"/",S_OK,FALSE},
3954 {"/",S_OK,FALSE},
3955 {"",S_FALSE,FALSE},
3956 {"http://:@gov.uk",S_OK,FALSE},
3957 {"http",S_OK,FALSE},
3958 {":",S_OK,FALSE},
3959 {"",S_FALSE,FALSE}
3962 {Uri_HOST_DNS,S_OK,FALSE},
3963 {80,S_OK,FALSE},
3964 {URL_SCHEME_HTTP,S_OK,FALSE},
3965 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3968 /* '@' is included because it's an unknown scheme type. */
3969 { "zip://@gov.uk", 0, S_OK, FALSE,
3971 {"zip://@gov.uk/",S_OK,FALSE},
3972 {"@gov.uk",S_OK,FALSE},
3973 {"zip://@gov.uk/",S_OK,FALSE},
3974 {"",S_FALSE,FALSE},
3975 {"",S_FALSE,FALSE},
3976 {"",S_FALSE,FALSE},
3977 {"gov.uk",S_OK,FALSE},
3978 {"",S_FALSE,FALSE},
3979 {"/",S_OK,FALSE},
3980 {"/",S_OK,FALSE},
3981 {"",S_FALSE,FALSE},
3982 {"zip://@gov.uk",S_OK,FALSE},
3983 {"zip",S_OK,FALSE},
3984 {"",S_OK,FALSE},
3985 {"",S_OK,FALSE}
3988 {Uri_HOST_DNS,S_OK,FALSE},
3989 {0,S_FALSE,FALSE},
3990 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3991 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3994 /* ":@" are included because it's an unknown scheme type. */
3995 { "zip://:@gov.uk", 0, S_OK, FALSE,
3997 {"zip://:@gov.uk/",S_OK,FALSE},
3998 {":@gov.uk",S_OK,FALSE},
3999 {"zip://:@gov.uk/",S_OK,FALSE},
4000 {"",S_FALSE,FALSE},
4001 {"",S_FALSE,FALSE},
4002 {"",S_FALSE,FALSE},
4003 {"gov.uk",S_OK,FALSE},
4004 {"",S_OK,FALSE},
4005 {"/",S_OK,FALSE},
4006 {"/",S_OK,FALSE},
4007 {"",S_FALSE,FALSE},
4008 {"zip://:@gov.uk",S_OK,FALSE},
4009 {"zip",S_OK,FALSE},
4010 {":",S_OK,FALSE},
4011 {"",S_FALSE,FALSE}
4014 {Uri_HOST_DNS,S_OK,FALSE},
4015 {0,S_FALSE,FALSE},
4016 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4017 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4020 { "about:blank", 0, S_OK, FALSE,
4022 {"about:blank",S_OK,FALSE},
4023 {"",S_FALSE,FALSE},
4024 {"about:blank",S_OK,FALSE},
4025 {"",S_FALSE,FALSE},
4026 {"",S_FALSE,FALSE},
4027 {"",S_FALSE,FALSE},
4028 {"",S_FALSE,FALSE},
4029 {"",S_FALSE,FALSE},
4030 {"blank",S_OK,FALSE},
4031 {"blank",S_OK,FALSE},
4032 {"",S_FALSE,FALSE},
4033 {"about:blank",S_OK,FALSE},
4034 {"about",S_OK,FALSE},
4035 {"",S_FALSE,FALSE},
4036 {"",S_FALSE,FALSE}
4039 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4040 {0,S_FALSE,FALSE},
4041 {URL_SCHEME_ABOUT,S_OK,FALSE},
4042 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4045 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
4047 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4048 {"",S_FALSE,FALSE},
4049 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4050 {"",S_FALSE,FALSE},
4051 {".htm",S_OK,FALSE},
4052 {"",S_FALSE,FALSE},
4053 {"",S_FALSE,FALSE},
4054 {"",S_FALSE,FALSE},
4055 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4056 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4057 {"",S_FALSE,FALSE},
4058 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4059 {"mk",S_OK,FALSE},
4060 {"",S_FALSE,FALSE},
4061 {"",S_FALSE,FALSE}
4064 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4065 {0,S_FALSE,FALSE},
4066 {URL_SCHEME_MK,S_OK,FALSE},
4067 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4070 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
4072 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4073 {"",S_FALSE,FALSE},
4074 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4075 {"",S_FALSE,FALSE},
4076 {".htm",S_OK,FALSE},
4077 {"",S_FALSE,FALSE},
4078 {"",S_FALSE,FALSE},
4079 {"",S_FALSE,FALSE},
4080 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4081 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4082 {"",S_FALSE,FALSE},
4083 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4084 {"mk",S_OK,FALSE},
4085 {"",S_FALSE,FALSE},
4086 {"",S_FALSE,FALSE}
4089 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4090 {0,S_FALSE,FALSE},
4091 {URL_SCHEME_MK,S_OK,FALSE},
4092 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4095 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
4096 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
4098 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4099 {"server",S_OK,FALSE},
4100 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4101 {"",S_FALSE,FALSE},
4102 {".html",S_OK,FALSE},
4103 {"",S_FALSE,FALSE},
4104 {"server",S_OK,FALSE},
4105 {"",S_FALSE,FALSE},
4106 {"\\dir\\index.html",S_OK,FALSE},
4107 {"\\dir\\index.html",S_OK,FALSE},
4108 {"",S_FALSE,FALSE},
4109 {"file://server/dir/index.html",S_OK,FALSE},
4110 {"file",S_OK,FALSE},
4111 {"",S_FALSE,FALSE},
4112 {"",S_FALSE,FALSE}
4115 {Uri_HOST_DNS,S_OK,FALSE},
4116 {0,S_FALSE,FALSE},
4117 {URL_SCHEME_FILE,S_OK,FALSE},
4118 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4121 /* When CreateUri generates an IUri, it still displays the default port in the
4122 * authority.
4124 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4126 {"http://google.com:80/",S_OK,FALSE},
4127 {"google.com:80",S_OK,FALSE},
4128 {"http://google.com:80/",S_OK,FALSE},
4129 {"google.com",S_OK,FALSE},
4130 {"",S_FALSE,FALSE},
4131 {"",S_FALSE,FALSE},
4132 {"google.com",S_OK,FALSE},
4133 {"",S_FALSE,FALSE},
4134 {"/",S_OK,FALSE},
4135 {"/",S_OK,FALSE},
4136 {"",S_FALSE,FALSE},
4137 {"http://google.com:80/",S_OK,FALSE},
4138 {"http",S_OK,FALSE},
4139 {"",S_FALSE,FALSE},
4140 {"",S_FALSE,FALSE}
4143 {Uri_HOST_DNS,S_OK,FALSE},
4144 {80,S_OK,FALSE},
4145 {URL_SCHEME_HTTP,S_OK,FALSE},
4146 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4149 /* For res URIs the host is everything up until the first '/'. */
4150 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
4152 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4153 {"C:\\dir\\file.exe",S_OK,FALSE},
4154 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4155 {"",S_FALSE,FALSE},
4156 {".html",S_OK,FALSE},
4157 {"",S_FALSE,FALSE},
4158 {"C:\\dir\\file.exe",S_OK,FALSE},
4159 {"",S_FALSE,FALSE},
4160 {"/DATA/test.html",S_OK,FALSE},
4161 {"/DATA/test.html",S_OK,FALSE},
4162 {"",S_FALSE,FALSE},
4163 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4164 {"res",S_OK,FALSE},
4165 {"",S_FALSE,FALSE},
4166 {"",S_FALSE,FALSE}
4169 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4170 {0,S_FALSE,FALSE},
4171 {URL_SCHEME_RES,S_OK,FALSE},
4172 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4175 /* Res URI can contain a '|' in the host name. */
4176 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4178 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4179 {"c:\\di|r\\file.exe",S_OK,FALSE},
4180 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4181 {"",S_FALSE,FALSE},
4182 {"",S_FALSE,FALSE},
4183 {"",S_FALSE,FALSE},
4184 {"c:\\di|r\\file.exe",S_OK,FALSE},
4185 {"",S_FALSE,FALSE},
4186 {"/test",S_OK,FALSE},
4187 {"/test",S_OK,FALSE},
4188 {"",S_FALSE,FALSE},
4189 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4190 {"res",S_OK,FALSE},
4191 {"",S_FALSE,FALSE},
4192 {"",S_FALSE,FALSE}
4195 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4196 {0,S_FALSE,FALSE},
4197 {URL_SCHEME_RES,S_OK,FALSE},
4198 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4201 /* Res URIs can have invalid percent encoded values. */
4202 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4204 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4205 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4206 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4207 {"",S_FALSE,FALSE},
4208 {"",S_FALSE,FALSE},
4209 {"",S_FALSE,FALSE},
4210 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4211 {"",S_FALSE,FALSE},
4212 {"/test",S_OK,FALSE},
4213 {"/test",S_OK,FALSE},
4214 {"",S_FALSE,FALSE},
4215 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4216 {"res",S_OK,FALSE},
4217 {"",S_FALSE,FALSE},
4218 {"",S_FALSE,FALSE}
4221 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4222 {0,S_FALSE,FALSE},
4223 {URL_SCHEME_RES,S_OK,FALSE},
4224 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4227 /* Res doesn't get forbidden characters percent encoded in its path. */
4228 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4230 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4231 {"c:\\test",S_OK,FALSE},
4232 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4233 {"",S_FALSE,FALSE},
4234 {"",S_FALSE,FALSE},
4235 {"",S_FALSE,FALSE},
4236 {"c:\\test",S_OK,FALSE},
4237 {"",S_FALSE,FALSE},
4238 {"/tes<|>t",S_OK,FALSE},
4239 {"/tes<|>t",S_OK,FALSE},
4240 {"",S_FALSE,FALSE},
4241 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4242 {"res",S_OK,FALSE},
4243 {"",S_FALSE,FALSE},
4244 {"",S_FALSE,FALSE}
4247 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4248 {0,S_FALSE,FALSE},
4249 {URL_SCHEME_RES,S_OK,FALSE},
4250 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4253 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4255 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4256 {"",S_FALSE,FALSE},
4257 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4258 {"",S_FALSE,FALSE},
4259 {".jpg",S_OK,FALSE},
4260 {"",S_FALSE,FALSE},
4261 {"",S_FALSE,FALSE},
4262 {"",S_FALSE,FALSE},
4263 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4264 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4265 {"",S_FALSE,FALSE},
4266 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4267 {"mk",S_OK,FALSE},
4268 {"",S_FALSE,FALSE},
4269 {"",S_FALSE,FALSE}
4272 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4273 {0,S_FALSE,FALSE},
4274 {URL_SCHEME_MK,S_OK,FALSE},
4275 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4278 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4280 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4281 {"",S_FALSE,FALSE},
4282 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4283 {"",S_FALSE,FALSE},
4284 {".jpg",S_OK,FALSE},
4285 {"",S_FALSE,FALSE},
4286 {"",S_FALSE,FALSE},
4287 {"",S_FALSE,FALSE},
4288 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4289 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4290 {"",S_FALSE,FALSE},
4291 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4292 {"mk",S_OK,FALSE},
4293 {"",S_FALSE,FALSE},
4294 {"",S_FALSE,FALSE}
4297 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4298 {0,S_FALSE,FALSE},
4299 {URL_SCHEME_MK,S_OK,FALSE},
4300 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4303 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4305 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4306 {"",S_FALSE,FALSE},
4307 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4308 {"",S_FALSE,FALSE},
4309 {".jpg",S_OK,FALSE},
4310 {"",S_FALSE,FALSE},
4311 {"",S_FALSE,FALSE},
4312 {"",S_FALSE,FALSE},
4313 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4314 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4315 {"",S_FALSE,FALSE},
4316 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4317 {"xx",S_OK,FALSE},
4318 {"",S_FALSE,FALSE},
4319 {"",S_FALSE,FALSE}
4322 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4323 {0,S_FALSE,FALSE},
4324 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4325 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4328 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4330 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4331 {"",S_FALSE,FALSE},
4332 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4333 {"",S_FALSE,FALSE},
4334 {".jpg",S_OK,FALSE},
4335 {"",S_FALSE,FALSE},
4336 {"",S_FALSE,FALSE},
4337 {"",S_FALSE,FALSE},
4338 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4339 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4340 {"",S_FALSE,FALSE},
4341 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4342 {"mk",S_OK,FALSE},
4343 {"",S_FALSE,FALSE},
4344 {"",S_FALSE,FALSE}
4347 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4348 {0,S_FALSE,FALSE},
4349 {URL_SCHEME_MK,S_OK,FALSE},
4350 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4353 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4355 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4356 {"",S_FALSE,FALSE},
4357 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4358 {"",S_FALSE,FALSE},
4359 {".jpg",S_OK,FALSE},
4360 {"",S_FALSE,FALSE},
4361 {"",S_FALSE,FALSE},
4362 {"",S_FALSE,FALSE},
4363 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4364 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4365 {"",S_FALSE,FALSE},
4366 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4367 {"mk",S_OK,FALSE},
4368 {"",S_FALSE,FALSE},
4369 {"",S_FALSE,FALSE}
4372 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4373 {0,S_FALSE,FALSE},
4374 {URL_SCHEME_MK,S_OK,FALSE},
4375 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4378 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4380 {"mk:images/xxx.jpg",S_OK,FALSE},
4381 {"",S_FALSE,FALSE},
4382 {"mk:images/xxx.jpg",S_OK,FALSE},
4383 {"",S_FALSE,FALSE},
4384 {".jpg",S_OK,FALSE},
4385 {"",S_FALSE,FALSE},
4386 {"",S_FALSE,FALSE},
4387 {"",S_FALSE,FALSE},
4388 {"images/xxx.jpg",S_OK,FALSE},
4389 {"images/xxx.jpg",S_OK,FALSE},
4390 {"",S_FALSE,FALSE},
4391 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4392 {"mk",S_OK,FALSE},
4393 {"",S_FALSE,FALSE},
4394 {"",S_FALSE,FALSE}
4397 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4398 {0,S_FALSE,FALSE},
4399 {URL_SCHEME_MK,S_OK,FALSE},
4400 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4403 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4405 {"",S_OK,FALSE},
4406 {"",S_FALSE,FALSE},
4407 {"",S_OK,FALSE},
4408 {"",S_FALSE,FALSE},
4409 {"",S_FALSE,FALSE},
4410 {"",S_FALSE,FALSE},
4411 {"",S_FALSE,FALSE},
4412 {"",S_FALSE,FALSE},
4413 {"",S_OK,FALSE},
4414 {"",S_OK,FALSE},
4415 {"",S_FALSE,FALSE},
4416 {"",S_OK,FALSE},
4417 {"",S_FALSE,FALSE},
4418 {"",S_FALSE,FALSE},
4419 {"",S_FALSE,FALSE}
4422 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4423 {0,S_FALSE,FALSE},
4424 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4425 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4428 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4430 {"",S_OK,FALSE},
4431 {"",S_FALSE,FALSE},
4432 {"",S_OK,FALSE},
4433 {"",S_FALSE,FALSE},
4434 {"",S_FALSE,FALSE},
4435 {"",S_FALSE,FALSE},
4436 {"",S_FALSE,FALSE},
4437 {"",S_FALSE,FALSE},
4438 {"",S_OK,FALSE},
4439 {"",S_OK,FALSE},
4440 {"",S_FALSE,FALSE},
4441 {"",S_OK,FALSE},
4442 {"",S_FALSE,FALSE},
4443 {"",S_FALSE,FALSE},
4444 {"",S_FALSE,FALSE}
4447 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4448 {0,S_FALSE,FALSE},
4449 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4450 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4453 { "javascript:void", 0, S_OK, FALSE,
4455 {"javascript:void",S_OK},
4456 {"",S_FALSE},
4457 {"javascript:void",S_OK},
4458 {"",S_FALSE},
4459 {"",S_FALSE},
4460 {"",S_FALSE},
4461 {"",S_FALSE},
4462 {"",S_FALSE},
4463 {"void",S_OK},
4464 {"void",S_OK},
4465 {"",S_FALSE},
4466 {"javascript:void",S_OK},
4467 {"javascript",S_OK},
4468 {"",S_FALSE},
4469 {"",S_FALSE}
4472 {Uri_HOST_UNKNOWN,S_OK},
4473 {0,S_FALSE},
4474 {URL_SCHEME_JAVASCRIPT,S_OK},
4475 {URLZONE_INVALID,E_NOTIMPL}
4478 { "javascript://undefined", 0, S_OK, FALSE,
4480 {"javascript://undefined",S_OK},
4481 {"",S_FALSE},
4482 {"javascript://undefined",S_OK},
4483 {"",S_FALSE},
4484 {"",S_FALSE},
4485 {"",S_FALSE},
4486 {"",S_FALSE},
4487 {"",S_FALSE},
4488 {"//undefined",S_OK},
4489 {"//undefined",S_OK},
4490 {"",S_FALSE},
4491 {"javascript://undefined",S_OK},
4492 {"javascript",S_OK},
4493 {"",S_FALSE},
4494 {"",S_FALSE}
4497 {Uri_HOST_UNKNOWN,S_OK},
4498 {0,S_FALSE},
4499 {URL_SCHEME_JAVASCRIPT,S_OK},
4500 {URLZONE_INVALID,E_NOTIMPL}
4503 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4505 {"javascript:escape('/\\?#?')",S_OK},
4506 {"",S_FALSE},
4507 {"javascript:escape('/\\?#?')",S_OK},
4508 {"",S_FALSE},
4509 {"",S_FALSE},
4510 {"",S_FALSE},
4511 {"",S_FALSE},
4512 {"",S_FALSE},
4513 {"escape('/\\?#?')",S_OK},
4514 {"escape('/\\?#?')",S_OK},
4515 {"",S_FALSE},
4516 {"JavaSCript:escape('/\\?#?')",S_OK},
4517 {"javascript",S_OK},
4518 {"",S_FALSE},
4519 {"",S_FALSE}
4522 {Uri_HOST_UNKNOWN,S_OK},
4523 {0,S_FALSE},
4524 {URL_SCHEME_JAVASCRIPT,S_OK},
4525 {URLZONE_INVALID,E_NOTIMPL}
4528 { "*://google.com", 0, S_OK, FALSE,
4530 {"*:google.com/",S_OK,FALSE},
4531 {"google.com",S_OK},
4532 {"*:google.com/",S_OK,FALSE},
4533 {"google.com",S_OK,FALSE},
4534 {"",S_FALSE,FALSE},
4535 {"",S_FALSE,FALSE},
4536 {"google.com",S_OK,FALSE},
4537 {"",S_FALSE,FALSE},
4538 {"/",S_OK,FALSE},
4539 {"/",S_OK,FALSE},
4540 {"",S_FALSE,FALSE},
4541 {"*://google.com",S_OK,FALSE},
4542 {"*",S_OK,FALSE},
4543 {"",S_FALSE,FALSE},
4544 {"",S_FALSE,FALSE}
4547 {Uri_HOST_DNS,S_OK,FALSE},
4548 {0,S_FALSE,FALSE},
4549 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4550 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4553 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4555 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4556 {"",S_FALSE},
4557 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4558 {"",S_FALSE},
4559 {".txt",S_OK},
4560 {"",S_FALSE},
4561 {"",S_FALSE},
4562 {"",S_FALSE},
4563 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4564 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4565 {"",S_FALSE},
4566 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4567 {"mk",S_OK},
4568 {"",S_FALSE},
4569 {"",S_FALSE}
4572 {Uri_HOST_UNKNOWN,S_OK},
4573 {0,S_FALSE},
4574 {URL_SCHEME_MK,S_OK},
4575 {URLZONE_INVALID,E_NOTIMPL}
4578 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4580 {"gopher://test.winehq.org:151/file.txt",S_OK},
4581 {"test.winehq.org:151",S_OK},
4582 {"gopher://test.winehq.org:151/file.txt",S_OK},
4583 {"winehq.org",S_OK},
4584 {".txt",S_OK},
4585 {"",S_FALSE},
4586 {"test.winehq.org",S_OK},
4587 {"",S_FALSE},
4588 {"/file.txt",S_OK},
4589 {"/file.txt",S_OK},
4590 {"",S_FALSE},
4591 {"gopher://test.winehq.org:151/file.txt",S_OK},
4592 {"gopher",S_OK},
4593 {"",S_FALSE},
4594 {"",S_FALSE}
4597 {Uri_HOST_DNS,S_OK},
4598 {151,S_OK},
4599 {URL_SCHEME_GOPHER,S_OK},
4600 {URLZONE_INVALID,E_NOTIMPL}
4603 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4605 {"//host.com/path/file.txt?query",S_OK},
4606 {"host.com",S_OK},
4607 {"//host.com/path/file.txt?query",S_OK},
4608 {"host.com",S_OK},
4609 {".txt",S_OK},
4610 {"",S_FALSE},
4611 {"host.com",S_OK},
4612 {"",S_FALSE},
4613 {"/path/file.txt",S_OK},
4614 {"/path/file.txt?query",S_OK},
4615 {"?query",S_OK},
4616 {"//host.com/path/file.txt?query",S_OK},
4617 {"",S_FALSE},
4618 {"",S_FALSE},
4619 {"",S_FALSE},
4622 {Uri_HOST_DNS,S_OK},
4623 {0,S_FALSE},
4624 {URL_SCHEME_UNKNOWN,S_OK},
4625 {URLZONE_INVALID,E_NOTIMPL}
4628 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4630 {"//host/path/file.txt?query",S_OK},
4631 {"host",S_OK},
4632 {"//host/path/file.txt?query",S_OK},
4633 {"",S_FALSE},
4634 {".txt",S_OK},
4635 {"",S_FALSE},
4636 {"host",S_OK},
4637 {"",S_FALSE},
4638 {"/path/file.txt",S_OK},
4639 {"/path/file.txt?query",S_OK},
4640 {"?query",S_OK},
4641 {"//host/path/file.txt?query",S_OK},
4642 {"",S_FALSE},
4643 {"",S_FALSE},
4644 {"",S_FALSE},
4647 {Uri_HOST_DNS,S_OK},
4648 {0,S_FALSE},
4649 {URL_SCHEME_UNKNOWN,S_OK},
4650 {URLZONE_INVALID,E_NOTIMPL}
4653 { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4655 {"//host/",S_OK},
4656 {"host",S_OK},
4657 {"//host/",S_OK},
4658 {"",S_FALSE},
4659 {"",S_FALSE},
4660 {"",S_FALSE},
4661 {"host",S_OK},
4662 {"",S_FALSE},
4663 {"/",S_OK},
4664 {"/",S_OK},
4665 {"",S_FALSE},
4666 {"//host",S_OK},
4667 {"",S_FALSE},
4668 {"",S_FALSE},
4669 {"",S_FALSE},
4672 {Uri_HOST_DNS,S_OK},
4673 {0,S_FALSE},
4674 {URL_SCHEME_UNKNOWN,S_OK},
4675 {URLZONE_INVALID,E_NOTIMPL}
4678 { "mailto://", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4680 {"mailto:",S_OK},
4681 {"",S_FALSE},
4682 {"mailto:",S_OK},
4683 {"",S_FALSE},
4684 {"",S_FALSE},
4685 {"",S_FALSE},
4686 {"",S_FALSE},
4687 {"",S_FALSE},
4688 {"",S_FALSE},
4689 {"",S_FALSE},
4690 {"",S_FALSE},
4691 {"mailto://",S_OK,FALSE,"mailto:"},
4692 {"mailto",S_OK},
4693 {"",S_FALSE},
4694 {"",S_FALSE}
4697 {Uri_HOST_UNKNOWN,S_OK},
4698 {0,S_FALSE},
4699 {URL_SCHEME_MAILTO,S_OK},
4700 {URLZONE_INVALID,E_NOTIMPL}
4703 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4705 {"mailto:a@b.com",S_OK},
4706 {"",S_FALSE},
4707 {"mailto:a@b.com",S_OK},
4708 {"",S_FALSE},
4709 {".com",S_OK},
4710 {"",S_FALSE},
4711 {"",S_FALSE},
4712 {"",S_FALSE},
4713 {"a@b.com",S_OK},
4714 {"a@b.com",S_OK},
4715 {"",S_FALSE},
4716 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
4717 {"mailto",S_OK},
4718 {"",S_FALSE},
4719 {"",S_FALSE}
4722 {Uri_HOST_UNKNOWN,S_OK},
4723 {0,S_FALSE},
4724 {URL_SCHEME_MAILTO,S_OK},
4725 {URLZONE_INVALID,E_NOTIMPL}
4728 { "c:\\test file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4730 {"file://c:\\test file.html",S_OK,FALSE},
4731 {"",S_FALSE,FALSE},
4732 {"file://c:\\test file.html",S_OK,FALSE},
4733 {"",S_FALSE,FALSE},
4734 {".html",S_OK,FALSE},
4735 {"",S_FALSE,FALSE},
4736 {"",S_FALSE,FALSE},
4737 {"",S_FALSE,FALSE},
4738 {"c:\\test file.html",S_OK,FALSE},
4739 {"c:\\test file.html",S_OK,FALSE},
4740 {"",S_FALSE,FALSE},
4741 {"c:\\test file.html",S_OK,FALSE},
4742 {"file",S_OK,FALSE},
4743 {"",S_FALSE,FALSE},
4744 {"",S_FALSE,FALSE}
4747 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4748 {0,S_FALSE,FALSE},
4749 {URL_SCHEME_FILE,S_OK,FALSE},
4750 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4753 { "c:\\test%20file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4755 {"file://c:\\test%20file.html",S_OK,FALSE},
4756 {"",S_FALSE,FALSE},
4757 {"file://c:\\test%20file.html",S_OK,FALSE},
4758 {"",S_FALSE,FALSE},
4759 {".html",S_OK,FALSE},
4760 {"",S_FALSE,FALSE},
4761 {"",S_FALSE,FALSE},
4762 {"",S_FALSE,FALSE},
4763 {"c:\\test%20file.html",S_OK,FALSE},
4764 {"c:\\test%20file.html",S_OK,FALSE},
4765 {"",S_FALSE,FALSE},
4766 {"c:\\test%20file.html",S_OK,FALSE},
4767 {"file",S_OK,FALSE},
4768 {"",S_FALSE,FALSE},
4769 {"",S_FALSE,FALSE}
4772 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4773 {0,S_FALSE,FALSE},
4774 {URL_SCHEME_FILE,S_OK,FALSE},
4775 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4778 { "c:\\test file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4780 {"file:///c:/test%20file.html",S_OK,FALSE},
4781 {"",S_FALSE,FALSE},
4782 {"file:///c:/test%20file.html",S_OK,FALSE},
4783 {"",S_FALSE,FALSE},
4784 {".html",S_OK,FALSE},
4785 {"",S_FALSE,FALSE},
4786 {"",S_FALSE,FALSE},
4787 {"",S_FALSE,FALSE},
4788 {"/c:/test%20file.html",S_OK,FALSE},
4789 {"/c:/test%20file.html",S_OK,FALSE},
4790 {"",S_FALSE,FALSE},
4791 {"c:\\test file.html",S_OK,FALSE},
4792 {"file",S_OK,FALSE},
4793 {"",S_FALSE,FALSE},
4794 {"",S_FALSE,FALSE}
4797 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4798 {0,S_FALSE,FALSE},
4799 {URL_SCHEME_FILE,S_OK,FALSE},
4800 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4803 { "c:\\test%20file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4805 {"file:///c:/test%2520file.html",S_OK,FALSE},
4806 {"",S_FALSE,FALSE},
4807 {"file:///c:/test%2520file.html",S_OK,FALSE},
4808 {"",S_FALSE,FALSE},
4809 {".html",S_OK,FALSE},
4810 {"",S_FALSE,FALSE},
4811 {"",S_FALSE,FALSE},
4812 {"",S_FALSE,FALSE},
4813 {"/c:/test%2520file.html",S_OK,FALSE},
4814 {"/c:/test%2520file.html",S_OK,FALSE},
4815 {"",S_FALSE,FALSE},
4816 {"c:\\test%20file.html",S_OK,FALSE},
4817 {"file",S_OK,FALSE},
4818 {"",S_FALSE,FALSE},
4819 {"",S_FALSE,FALSE}
4822 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4823 {0,S_FALSE,FALSE},
4824 {URL_SCHEME_FILE,S_OK,FALSE},
4825 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4828 /* Path with Unicode characters. Unicode characters should not be encoded */
4829 {/* "http://127.0.0.1/测试/test.txt" with Chinese in UTF-8 encoding */
4830 "http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt", 0, S_OK, FALSE,
4832 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4833 {"127.0.0.1",S_OK,FALSE},
4834 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4835 {"",S_FALSE,FALSE},
4836 {".txt",S_OK,FALSE},
4837 {"",S_FALSE,FALSE},
4838 {"127.0.0.1",S_OK,FALSE},
4839 {"",S_FALSE,FALSE},
4840 {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4841 {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4842 {"",S_FALSE,FALSE},
4843 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4844 {"http",S_OK,FALSE},
4845 {"",S_FALSE,FALSE},
4846 {"",S_FALSE,FALSE}
4849 {Uri_HOST_IPV4,S_OK,FALSE},
4850 {80,S_OK,FALSE},
4851 {URL_SCHEME_HTTP,S_OK,FALSE},
4852 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4855 { "file:\xE6\xB5\x8B\xE8\xAF\x95.html", 0, S_OK, FALSE,
4857 {"",S_FALSE,FALSE},
4858 {"",S_FALSE,FALSE},
4859 {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE},
4860 {"",S_FALSE,FALSE},
4861 {".html",S_OK,FALSE},
4862 {"",S_FALSE,FALSE},
4863 {"",S_FALSE,FALSE},
4864 {"",S_FALSE,FALSE},
4865 {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE},
4866 {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE},
4867 {"",S_FALSE,FALSE},
4868 {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE},
4869 {"file",S_OK,FALSE},
4870 {"",S_FALSE,FALSE},
4871 {"",S_FALSE,FALSE}
4874 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4875 {0,S_FALSE,FALSE},
4876 {URL_SCHEME_FILE,S_OK,FALSE},
4877 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4880 /* Username with Unicode characters. Unicode characters should not be encoded */
4881 { "ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK, FALSE,
4883 {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4884 {"\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999",S_OK,FALSE},
4885 {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4886 {"winehq.org",S_OK,FALSE},
4887 {".txt",S_OK,FALSE},
4888 {"",S_FALSE,FALSE},
4889 {"ftp.winehq.org",S_OK,FALSE},
4890 {"wine",S_OK,FALSE},
4891 {"/dir/foobar.txt",S_OK,FALSE},
4892 {"/dir/foobar.txt",S_OK,FALSE},
4893 {"",S_FALSE,FALSE},
4894 {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4895 {"ftp",S_OK,FALSE},
4896 {"\xE6\xB5\x8B\xE8\xAF\x95:wine",S_OK,FALSE},
4897 {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE}
4900 {Uri_HOST_DNS,S_OK,FALSE},
4901 {9999,S_OK,FALSE},
4902 {URL_SCHEME_FTP,S_OK,FALSE},
4903 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4906 /* Password with Unicode characters. Unicode characters should not be encoded */
4907 { "ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK, FALSE,
4909 {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4910 {"winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999",S_OK,FALSE},
4911 {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4912 {"winehq.org",S_OK,FALSE},
4913 {".txt",S_OK,FALSE},
4914 {"",S_FALSE,FALSE},
4915 {"ftp.winehq.org",S_OK,FALSE},
4916 {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4917 {"/dir/foobar.txt",S_OK,FALSE},
4918 {"/dir/foobar.txt",S_OK,FALSE},
4919 {"",S_FALSE,FALSE},
4920 {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4921 {"ftp",S_OK,FALSE},
4922 {"winepass:\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4923 {"winepass",S_OK,FALSE}
4926 {Uri_HOST_DNS,S_OK,FALSE},
4927 {9999,S_OK,FALSE},
4928 {URL_SCHEME_FTP,S_OK,FALSE},
4929 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4932 /* Query with Unicode characters. Unicode characters should not be encoded */
4933 { "http://www.winehq.org/tests/..?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y", 0, S_OK, FALSE,
4935 {"http://www.winehq.org/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4936 {"www.winehq.org",S_OK,FALSE},
4937 {"http://www.winehq.org/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4938 {"winehq.org",S_OK,FALSE},
4939 {"",S_FALSE,FALSE},
4940 {"",S_FALSE,FALSE},
4941 {"www.winehq.org",S_OK,FALSE},
4942 {"",S_FALSE,FALSE},
4943 {"/",S_OK,FALSE},
4944 {"/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4945 {"?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4946 {"http://www.winehq.org/tests/..?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4947 {"http",S_OK,FALSE},
4948 {"",S_FALSE,FALSE},
4949 {"",S_FALSE,FALSE}
4952 {Uri_HOST_DNS,S_OK,FALSE},
4953 {80,S_OK,FALSE},
4954 {URL_SCHEME_HTTP,S_OK,FALSE},
4955 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4958 /* Fragment with Unicode characters. Unicode characters should not be encoded */
4959 { "http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95", 0, S_OK, FALSE,
4961 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4962 {"www.winehq.org",S_OK,FALSE},
4963 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4964 {"winehq.org",S_OK,FALSE},
4965 {"",S_FALSE,FALSE},
4966 {"#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4967 {"www.winehq.org",S_OK,FALSE},
4968 {"",S_FALSE,FALSE},
4969 {"/tests/",S_OK,FALSE},
4970 {"/tests/",S_OK,FALSE},
4971 {"",S_FALSE,FALSE},
4972 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4973 {"http",S_OK,FALSE},
4974 {"",S_FALSE,FALSE},
4975 {"",S_FALSE,FALSE}
4978 {Uri_HOST_DNS,S_OK,FALSE},
4979 {80,S_OK,FALSE},
4980 {URL_SCHEME_HTTP,S_OK,FALSE},
4981 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4984 /* ZERO WIDTH JOINER as non-printing Unicode characters should not be encoded if not preprocessed. */
4985 { "file:a\xE2\x80\x8D.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
4987 {"",S_FALSE,FALSE},
4988 {"",S_FALSE,FALSE},
4989 {"file:a\xE2\x80\x8D.html",S_OK,FALSE},
4990 {"",S_FALSE,FALSE},
4991 {".html",S_OK,FALSE},
4992 {"",S_FALSE,FALSE},
4993 {"",S_FALSE,FALSE},
4994 {"",S_FALSE,FALSE},
4995 {"a\xE2\x80\x8D.html",S_OK,FALSE},
4996 {"a\xE2\x80\x8D.html",S_OK,FALSE},
4997 {"",S_FALSE,FALSE},
4998 {"file:a\xE2\x80\x8D.html",S_OK,FALSE},
4999 {"file",S_OK,FALSE},
5000 {"",S_FALSE,FALSE},
5001 {"",S_FALSE,FALSE}
5004 {Uri_HOST_UNKNOWN,S_OK,FALSE},
5005 {0,S_FALSE,FALSE},
5006 {URL_SCHEME_FILE,S_OK,FALSE},
5007 {URLZONE_INVALID,E_NOTIMPL,FALSE}
5010 /* LEFT-TO-RIGHT MARK as non-printing Unicode characters should not be encoded if not preprocessed. */
5011 { "file:ab\xE2\x80\x8E.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
5013 {"",S_FALSE,FALSE},
5014 {"",S_FALSE,FALSE},
5015 {"file:ab\xE2\x80\x8D.html",S_OK,FALSE},
5016 {"",S_FALSE,FALSE},
5017 {".html",S_OK,FALSE},
5018 {"",S_FALSE,FALSE},
5019 {"",S_FALSE,FALSE},
5020 {"",S_FALSE,FALSE},
5021 {"ab\xE2\x80\x8D.html",S_OK,FALSE},
5022 {"ab\xE2\x80\x8D.html",S_OK,FALSE},
5023 {"",S_FALSE,FALSE},
5024 {"file:ab\xE2\x80\x8D.html",S_OK,FALSE},
5025 {"file",S_OK,FALSE},
5026 {"",S_FALSE,FALSE},
5027 {"",S_FALSE,FALSE}
5030 {Uri_HOST_UNKNOWN,S_OK,FALSE},
5031 {0,S_FALSE,FALSE},
5032 {URL_SCHEME_FILE,S_OK,FALSE},
5033 {URLZONE_INVALID,E_NOTIMPL,FALSE}
5036 /* Invalid Unicode characters should not be filtered */
5037 { "file:ab\xc3\x28.html", 0, S_OK, FALSE,
5039 {"",S_FALSE,FALSE},
5040 {"",S_FALSE,FALSE},
5041 {"file:ab\xc3\x28.html",S_OK,FALSE},
5042 {"",S_FALSE,FALSE},
5043 {".html",S_OK,FALSE},
5044 {"",S_FALSE,FALSE},
5045 {"",S_FALSE,FALSE},
5046 {"",S_FALSE,FALSE},
5047 {"ab\xc3\x28.html",S_OK,FALSE},
5048 {"ab\xc3\x28.html",S_OK,FALSE},
5049 {"",S_FALSE,FALSE},
5050 {"file:ab\xc3\x28.html",S_OK,FALSE},
5051 {"file",S_OK,FALSE},
5052 {"",S_FALSE,FALSE},
5053 {"",S_FALSE,FALSE}
5056 {Uri_HOST_UNKNOWN,S_OK,FALSE},
5057 {0,S_FALSE,FALSE},
5058 {URL_SCHEME_FILE,S_OK,FALSE},
5059 {URLZONE_INVALID,E_NOTIMPL,FALSE}
5062 /* Make sure % encoded unicode characters are not decoded. */
5063 { "ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/", 0, S_OK, FALSE,
5065 {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK,FALSE},
5066 {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com",S_OK,FALSE},
5067 {"ftp://ftp.google.com/",S_OK,FALSE},
5068 {"google.com",S_OK,FALSE},
5069 {"",S_FALSE,FALSE},
5070 {"",S_FALSE,FALSE},
5071 {"ftp.google.com",S_OK,FALSE},
5072 {"%E6%B5%8B%E8%AF%95",S_OK,FALSE},
5073 {"/",S_OK,FALSE},
5074 {"/",S_OK,FALSE},
5075 {"",S_FALSE,FALSE},
5076 {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK,FALSE},
5077 {"ftp",S_OK,FALSE},
5078 {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95",S_OK,FALSE},
5079 {"%E6%B5%8B%E8%AF%95",S_OK,FALSE}
5082 {Uri_HOST_DNS,S_OK,FALSE},
5083 {21,S_OK,FALSE},
5084 {URL_SCHEME_FTP,S_OK,FALSE},
5085 {URLZONE_INVALID,E_NOTIMPL,FALSE}
5090 typedef struct _invalid_uri {
5091 const char* uri;
5092 DWORD flags;
5093 BOOL todo;
5094 } invalid_uri;
5096 static const invalid_uri invalid_uri_tests[] = {
5097 /* Has to have a scheme name. */
5098 {"://www.winehq.org",0,FALSE},
5099 /* Windows doesn't like URIs which are implicitly file paths without the
5100 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
5102 {"C:/test/test.mp3",0,FALSE},
5103 {"\\\\Server/test/test.mp3",0,FALSE},
5104 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
5105 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
5106 /* Invalid schemes. */
5107 {"*abcd://not.valid.com",0,FALSE},
5108 {"*a*b*c*d://not.valid.com",0,FALSE},
5109 /* Not allowed to have invalid % encoded data. */
5110 {"ftp://google.co%XX/",0,FALSE},
5111 /* Too many h16 components. */
5112 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
5113 /* Not enough room for IPv4 address. */
5114 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
5115 /* Not enough h16 components. */
5116 {"http://[1:2:3:4]",0,FALSE},
5117 /* Not enough components including IPv4. */
5118 {"http://[1:192.0.1.0]",0,FALSE},
5119 /* Not allowed to have partial IPv4 in IPv6. */
5120 {"http://[::192.0]",0,FALSE},
5121 /* Can't have elision of 1 h16 at beginning of address. */
5122 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
5123 /* Expects a valid IP Literal. */
5124 {"ftp://[not.valid.uri]/",0,FALSE},
5125 /* Expects valid port for a known scheme type. */
5126 {"ftp://www.winehq.org:123fgh",0,FALSE},
5127 /* Port exceeds USHORT_MAX for known scheme type. */
5128 {"ftp://www.winehq.org:65536",0,FALSE},
5129 /* Invalid port with IPv4 address. */
5130 {"http://www.winehq.org:1abcd",0,FALSE},
5131 /* Invalid port with IPv6 address. */
5132 {"http://[::ffff]:32xy",0,FALSE},
5133 /* Not allowed to have backslashes with NO_CANONICALIZE. */
5134 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
5135 /* Not allowed to have invalid % encoded data in opaque URI path. */
5136 {"news:test%XX",0,FALSE},
5137 {"mailto:wine@winehq%G8.com",0,FALSE},
5138 /* Known scheme types can't have invalid % encoded data in query string. */
5139 {"http://google.com/?query=te%xx",0,FALSE},
5140 /* Invalid % encoded data in fragment of know scheme type. */
5141 {"ftp://google.com/#Test%xx",0,FALSE},
5142 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
5143 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
5144 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
5145 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
5146 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
5147 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
5148 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
5149 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
5150 /* res URIs aren't allowed to have forbidden dos path characters in the
5151 * hostname.
5153 {"res://c:\\te<st\\test/test",0,FALSE},
5154 {"res://c:\\te>st\\test/test",0,FALSE},
5155 {"res://c:\\te\"st\\test/test",0,FALSE},
5156 {"res://c:\\test/te%xxst",0,FALSE}
5159 typedef struct _uri_equality {
5160 const char* a;
5161 DWORD create_flags_a;
5162 const char* b;
5163 DWORD create_flags_b;
5164 BOOL equal;
5165 BOOL todo;
5166 } uri_equality;
5168 static const uri_equality equality_tests[] = {
5170 "HTTP://www.winehq.org/test dir/./",0,
5171 "http://www.winehq.org/test dir/../test dir/",0,
5172 TRUE
5175 /* http://www.winehq.org/test%20dir */
5176 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
5177 "http://www.winehq.org/test dir",0,
5178 TRUE
5181 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
5182 "file:///c:/test.mp3",0,
5183 TRUE
5186 "ftp://ftp.winehq.org/",0,
5187 "ftp://ftp.winehq.org",0,
5188 TRUE
5191 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
5192 "ftp://ftp.winehq.org/t%45stB/",0,
5193 FALSE
5196 "http://google.com/TEST",0,
5197 "http://google.com/test",0,
5198 FALSE
5201 "http://GOOGLE.com/",0,
5202 "http://google.com/",0,
5203 TRUE
5205 /* Performs case insensitive compare of host names (for known scheme types). */
5207 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
5208 "ftp://google.com/",0,
5209 TRUE
5212 "zip://GOOGLE.com/",0,
5213 "zip://google.com/",0,
5214 FALSE
5217 "file:///c:/TEST/TeST/",0,
5218 "file:///c:/test/test/",0,
5219 TRUE
5222 "file:///server/TEST",0,
5223 "file:///SERVER/TEST",0,
5224 TRUE
5227 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
5228 "http://google.com/",0,
5229 TRUE
5232 "ftp://google.com:21/",0,
5233 "ftp://google.com/",0,
5234 TRUE
5237 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
5238 "http://google.com/",0,
5239 TRUE
5242 "http://google.com:70/",0,
5243 "http://google.com:71/",0,
5244 FALSE
5247 "file:///c:/dir/file.txt", 0,
5248 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
5249 TRUE
5252 "file:///c:/dir/file.txt", 0,
5253 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
5254 TRUE
5257 "file:///c:/dir/file.txt", 0,
5258 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
5259 TRUE
5262 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
5263 "file:///c:/%20dir/file.txt", 0,
5264 TRUE
5267 "file:///c:/Dir/file.txt", 0,
5268 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
5269 TRUE
5272 "file:///c:/dir/file.txt", 0,
5273 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
5274 TRUE
5277 "file:///c:/dir/file.txt#a", 0,
5278 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
5279 FALSE
5281 /* Tests of an empty hash/fragment part */
5283 "http://google.com/test",0,
5284 "http://google.com/test#",0,
5285 FALSE
5288 "ftp://ftp.winehq.org/",0,
5289 "ftp://ftp.winehq.org/#",0,
5290 FALSE
5293 "file:///c:/dir/file.txt#", 0,
5294 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
5295 FALSE
5299 typedef struct _uri_with_fragment {
5300 const char* uri;
5301 const char* fragment;
5302 DWORD create_flags;
5303 HRESULT create_expected;
5304 BOOL create_todo;
5306 const char* expected_uri;
5307 BOOL expected_todo;
5308 } uri_with_fragment;
5310 static const uri_with_fragment uri_fragment_tests[] = {
5312 "http://google.com/","#fragment",0,S_OK,FALSE,
5313 "http://google.com/#fragment",FALSE
5316 "http://google.com/","fragment",0,S_OK,FALSE,
5317 "http://google.com/#fragment",FALSE
5320 "zip://test.com/","?test",0,S_OK,FALSE,
5321 "zip://test.com/#?test",FALSE
5323 /* The fragment can be empty. */
5325 "ftp://ftp.google.com/","",0,S_OK,FALSE,
5326 "ftp://ftp.google.com/#",FALSE
5330 typedef struct _uri_builder_property {
5331 BOOL change;
5332 const char *value;
5333 const char *expected_value;
5334 Uri_PROPERTY property;
5335 HRESULT expected;
5336 BOOL todo;
5337 } uri_builder_property;
5339 typedef struct _uri_builder_port {
5340 BOOL change;
5341 BOOL set;
5342 DWORD value;
5343 HRESULT expected;
5344 BOOL todo;
5345 } uri_builder_port;
5347 typedef struct _uri_builder_str_property {
5348 const char* expected;
5349 HRESULT result;
5350 BOOL todo;
5351 } uri_builder_str_property;
5353 typedef struct _uri_builder_dword_property {
5354 DWORD expected;
5355 HRESULT result;
5356 BOOL todo;
5357 } uri_builder_dword_property;
5359 typedef struct _uri_builder_test {
5360 const char *uri;
5361 DWORD create_flags;
5362 HRESULT create_builder_expected;
5363 BOOL create_builder_todo;
5365 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
5367 uri_builder_port port_prop;
5369 DWORD uri_flags;
5370 HRESULT uri_hres;
5371 BOOL uri_todo;
5373 DWORD uri_simple_encode_flags;
5374 HRESULT uri_simple_hres;
5375 BOOL uri_simple_todo;
5377 DWORD uri_with_flags;
5378 DWORD uri_with_builder_flags;
5379 DWORD uri_with_encode_flags;
5380 HRESULT uri_with_hres;
5381 BOOL uri_with_todo;
5383 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
5384 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
5385 } uri_builder_test;
5387 static const uri_builder_test uri_builder_tests[] = {
5388 { "http://google.com/",0,S_OK,FALSE,
5390 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5391 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
5392 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
5393 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5395 {FALSE},
5396 0,S_OK,FALSE,
5397 0,S_OK,FALSE,
5398 0,0,0,S_OK,FALSE,
5400 {"http://username:password@google.com/?query=x#fragment",S_OK},
5401 {"username:password@google.com",S_OK},
5402 {"http://google.com/?query=x#fragment",S_OK},
5403 {"google.com",S_OK},
5404 {"",S_FALSE},
5405 {"#fragment",S_OK},
5406 {"google.com",S_OK},
5407 {"password",S_OK},
5408 {"/",S_OK},
5409 {"/?query=x",S_OK},
5410 {"?query=x",S_OK},
5411 {"http://username:password@google.com/?query=x#fragment",S_OK},
5412 {"http",S_OK},
5413 {"username:password",S_OK},
5414 {"username",S_OK}
5417 {Uri_HOST_DNS,S_OK},
5418 {80,S_OK},
5419 {URL_SCHEME_HTTP,S_OK},
5420 {URLZONE_INVALID,E_NOTIMPL}
5423 { "http://google.com/",0,S_OK,FALSE,
5425 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5427 {TRUE,TRUE,120,S_OK,FALSE},
5428 0,S_OK,FALSE,
5429 0,S_OK,FALSE,
5430 0,0,0,S_OK,FALSE,
5432 {"test://google.com:120/",S_OK},
5433 {"google.com:120",S_OK},
5434 {"test://google.com:120/",S_OK},
5435 {"google.com",S_OK},
5436 {"",S_FALSE},
5437 {"",S_FALSE},
5438 {"google.com",S_OK},
5439 {"",S_FALSE},
5440 {"/",S_OK},
5441 {"/",S_OK},
5442 {"",S_FALSE},
5443 {"test://google.com:120/",S_OK},
5444 {"test",S_OK},
5445 {"",S_FALSE},
5446 {"",S_FALSE}
5449 {Uri_HOST_DNS,S_OK},
5450 {120,S_OK},
5451 {URL_SCHEME_UNKNOWN,S_OK},
5452 {URLZONE_INVALID,E_NOTIMPL}
5455 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5457 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5458 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5459 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5461 {FALSE},
5462 0,S_OK,FALSE,
5463 0,S_OK,FALSE,
5464 0,0,0,S_OK,FALSE,
5466 {"http://[::192.2.3.4]/",S_OK},
5467 {"[::192.2.3.4]",S_OK},
5468 {"http://[::192.2.3.4]/",S_OK},
5469 {"",S_FALSE},
5470 {"",S_FALSE},
5471 {"",S_FALSE},
5472 {"::192.2.3.4",S_OK},
5473 {"",S_FALSE},
5474 {"/",S_OK},
5475 {"/",S_OK},
5476 {"",S_FALSE},
5477 {"http://[::192.2.3.4]/",S_OK},
5478 {"http",S_OK},
5479 {"",S_FALSE},
5480 {"",S_FALSE}
5483 {Uri_HOST_IPV6,S_OK},
5484 {80,S_OK},
5485 {URL_SCHEME_HTTP,S_OK},
5486 {URLZONE_INVALID,E_NOTIMPL}
5489 { "http://google.com/",0,S_OK,FALSE,
5491 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5493 {FALSE},
5494 0,S_OK,FALSE,
5495 0,S_OK,FALSE,
5496 0,0,0,S_OK,FALSE,
5498 {"http://google.com/#Frag",S_OK},
5499 {"google.com",S_OK},
5500 {"http://google.com/#Frag",S_OK},
5501 {"google.com",S_OK},
5502 {"",S_FALSE},
5503 {"#Frag",S_OK},
5504 {"google.com",S_OK},
5505 {"",S_FALSE},
5506 {"/",S_OK},
5507 {"/",S_OK},
5508 {"",S_FALSE},
5509 {"http://google.com/#Frag",S_OK},
5510 {"http",S_OK},
5511 {"",S_FALSE},
5512 {"",S_FALSE}
5515 {Uri_HOST_DNS,S_OK},
5516 {80,S_OK},
5517 {URL_SCHEME_HTTP,S_OK},
5518 {URLZONE_INVALID,E_NOTIMPL}
5521 { "http://google.com/",0,S_OK,FALSE,
5523 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5525 {FALSE},
5526 0,S_OK,FALSE,
5527 0,S_OK,FALSE,
5528 0,0,0,S_OK,FALSE,
5530 {"http://google.com/#",S_OK},
5531 {"google.com",S_OK},
5532 {"http://google.com/#",S_OK},
5533 {"google.com",S_OK},
5534 {"",S_FALSE},
5535 {"#",S_OK},
5536 {"google.com",S_OK},
5537 {"",S_FALSE},
5538 {"/",S_OK},
5539 {"/",S_OK},
5540 {"",S_FALSE},
5541 {"http://google.com/#",S_OK},
5542 {"http",S_OK},
5543 {"",S_FALSE},
5544 {"",S_FALSE}
5547 {Uri_HOST_DNS,S_OK},
5548 {80,S_OK},
5549 {URL_SCHEME_HTTP,S_OK},
5550 {URLZONE_INVALID,E_NOTIMPL}
5553 { "http://google.com/",0,S_OK,FALSE,
5555 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5557 {FALSE},
5558 0,S_OK,FALSE,
5559 0,S_OK,FALSE,
5560 0,0,0,S_OK,FALSE,
5562 {"http://::password@google.com/",S_OK},
5563 {"::password@google.com",S_OK},
5564 {"http://google.com/",S_OK},
5565 {"google.com",S_OK},
5566 {"",S_FALSE},
5567 {"",S_FALSE},
5568 {"google.com",S_OK},
5569 {":password",S_OK},
5570 {"/",S_OK},
5571 {"/",S_OK},
5572 {"",S_FALSE},
5573 {"http://::password@google.com/",S_OK},
5574 {"http",S_OK},
5575 {"::password",S_OK},
5576 {"",S_FALSE}
5579 {Uri_HOST_DNS,S_OK},
5580 {80,S_OK},
5581 {URL_SCHEME_HTTP,S_OK},
5582 {URLZONE_INVALID,E_NOTIMPL}
5585 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5587 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5589 {FALSE},
5590 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5591 0,S_OK,FALSE,
5592 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5594 {":password@test/test",S_OK},
5595 {":password@",S_OK},
5596 {":password@test/test",S_OK},
5597 {"",S_FALSE},
5598 {"",S_FALSE},
5599 {"",S_FALSE},
5600 {"",S_FALSE},
5601 {"password",S_OK},
5602 {"test/test",S_OK},
5603 {"test/test",S_OK},
5604 {"",S_FALSE},
5605 {":password@test/test",S_OK},
5606 {"",S_FALSE},
5607 {":password",S_OK},
5608 {"",S_FALSE}
5611 {Uri_HOST_UNKNOWN,S_OK},
5612 {0,S_FALSE},
5613 {URL_SCHEME_UNKNOWN,S_OK},
5614 {URLZONE_INVALID,E_NOTIMPL}
5617 { "http://google.com/",0,S_OK,FALSE,
5619 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5621 {FALSE},
5622 0,S_OK,FALSE,
5623 0,S_OK,FALSE,
5624 0,0,0,S_OK,FALSE,
5626 {"http://google.com/test/test",S_OK},
5627 {"google.com",S_OK},
5628 {"http://google.com/test/test",S_OK},
5629 {"google.com",S_OK},
5630 {"",S_FALSE},
5631 {"",S_FALSE},
5632 {"google.com",S_OK},
5633 {"",S_FALSE},
5634 {"/test/test",S_OK},
5635 {"/test/test",S_OK},
5636 {"",S_FALSE},
5637 {"http://google.com/test/test",S_OK},
5638 {"http",S_OK},
5639 {"",S_FALSE},
5640 {"",S_FALSE}
5643 {Uri_HOST_DNS,S_OK},
5644 {80,S_OK},
5645 {URL_SCHEME_HTTP,S_OK},
5646 {URLZONE_INVALID,E_NOTIMPL}
5649 { "zip:testing/test",0,S_OK,FALSE,
5651 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5653 {FALSE},
5654 0,S_OK,FALSE,
5655 0,S_OK,FALSE,
5656 0,0,0,S_OK,FALSE,
5658 {"zip:test",S_OK},
5659 {"",S_FALSE},
5660 {"zip:test",S_OK},
5661 {"",S_FALSE},
5662 {"",S_FALSE},
5663 {"",S_FALSE},
5664 {"",S_FALSE},
5665 {"",S_FALSE},
5666 {"test",S_OK},
5667 {"test",S_OK},
5668 {"",S_FALSE},
5669 {"zip:test",S_OK},
5670 {"zip",S_OK},
5671 {"",S_FALSE},
5672 {"",S_FALSE}
5675 {Uri_HOST_UNKNOWN,S_OK},
5676 {0,S_FALSE},
5677 {URL_SCHEME_UNKNOWN,S_OK},
5678 {URLZONE_INVALID,E_NOTIMPL}
5681 { "http://google.com/",0,S_OK,FALSE,
5683 {FALSE},
5685 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5686 {TRUE,FALSE,555,S_OK,FALSE},
5687 0,S_OK,FALSE,
5688 0,S_OK,FALSE,
5689 0,0,0,S_OK,FALSE,
5691 {"http://google.com/",S_OK},
5692 {"google.com",S_OK},
5693 {"http://google.com/",S_OK},
5694 {"google.com",S_OK},
5695 {"",S_FALSE},
5696 {"",S_FALSE},
5697 {"google.com",S_OK},
5698 {"",S_FALSE},
5699 {"/",S_OK},
5700 {"/",S_OK},
5701 {"",S_FALSE},
5702 {"http://google.com/",S_OK},
5703 {"http",S_OK},
5704 {"",S_FALSE},
5705 {"",S_FALSE}
5708 {Uri_HOST_DNS,S_OK},
5709 /* Still returns 80, even though earlier the port was disabled. */
5710 {80,S_OK},
5711 {URL_SCHEME_HTTP,S_OK},
5712 {URLZONE_INVALID,E_NOTIMPL}
5715 { "http://google.com/",0,S_OK,FALSE,
5717 {FALSE},
5719 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5720 * you'll get 122345 instead.
5722 {TRUE,122345,222,S_OK,FALSE},
5723 0,S_OK,FALSE,
5724 0,S_OK,FALSE,
5725 0,0,0,S_OK,FALSE,
5727 {"http://google.com:222/",S_OK},
5728 {"google.com:222",S_OK},
5729 {"http://google.com:222/",S_OK},
5730 {"google.com",S_OK},
5731 {"",S_FALSE},
5732 {"",S_FALSE},
5733 {"google.com",S_OK},
5734 {"",S_FALSE},
5735 {"/",S_OK},
5736 {"/",S_OK},
5737 {"",S_FALSE},
5738 {"http://google.com:222/",S_OK},
5739 {"http",S_OK},
5740 {"",S_FALSE},
5741 {"",S_FALSE}
5744 {Uri_HOST_DNS,S_OK},
5745 {222,S_OK},
5746 {URL_SCHEME_HTTP,S_OK},
5747 {URLZONE_INVALID,E_NOTIMPL}
5750 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5751 { "http://google.com/",0,S_OK,FALSE,
5753 {FALSE},
5755 {TRUE,TRUE,999999,S_OK,FALSE},
5756 0,S_OK,FALSE,
5757 0,S_OK,FALSE,
5758 0,0,0,S_OK,FALSE,
5760 {"http://google.com:999999/",S_OK},
5761 {"google.com:999999",S_OK},
5762 {"http://google.com:999999/",S_OK},
5763 {"google.com",S_OK},
5764 {"",S_FALSE},
5765 {"",S_FALSE},
5766 {"google.com",S_OK},
5767 {"",S_FALSE},
5768 {"/",S_OK},
5769 {"/",S_OK},
5770 {"",S_FALSE},
5771 {"http://google.com:999999/",S_OK},
5772 {"http",S_OK},
5773 {"",S_FALSE},
5774 {"",S_FALSE}
5777 {Uri_HOST_DNS,S_OK},
5778 {999999,S_OK},
5779 {URL_SCHEME_HTTP,S_OK},
5780 {URLZONE_INVALID,E_NOTIMPL}
5783 { "http://google.com/",0,S_OK,FALSE,
5785 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5788 {FALSE},
5789 0,S_OK,FALSE,
5790 0,S_OK,FALSE,
5791 0,0,0,S_OK,FALSE,
5793 {"http://google.com/?test",S_OK},
5794 {"google.com",S_OK},
5795 {"http://google.com/?test",S_OK},
5796 {"google.com",S_OK},
5797 {"",S_FALSE},
5798 {"",S_FALSE},
5799 {"google.com",S_OK},
5800 {"",S_FALSE},
5801 {"/",S_OK},
5802 {"/?test",S_OK},
5803 {"?test",S_OK},
5804 {"http://google.com/?test",S_OK},
5805 {"http",S_OK},
5806 {"",S_FALSE},
5807 {"",S_FALSE}
5810 {Uri_HOST_DNS,S_OK},
5811 {80,S_OK},
5812 {URL_SCHEME_HTTP,S_OK},
5813 {URLZONE_INVALID,E_NOTIMPL}
5816 { "http://:password@google.com/",0,S_OK,FALSE,
5818 {FALSE},
5820 {FALSE},
5821 0,S_OK,FALSE,
5822 0,S_OK,FALSE,
5823 0,0,0,S_OK,FALSE,
5825 {"http://:password@google.com/",S_OK},
5826 {":password@google.com",S_OK},
5827 {"http://google.com/",S_OK},
5828 {"google.com",S_OK},
5829 {"",S_FALSE},
5830 {"",S_FALSE},
5831 {"google.com",S_OK},
5832 {"password",S_OK},
5833 {"/",S_OK},
5834 {"/",S_OK},
5835 {"",S_FALSE},
5836 {"http://:password@google.com/",S_OK},
5837 {"http",S_OK},
5838 {":password",S_OK},
5839 {"",S_FALSE}
5842 {Uri_HOST_DNS,S_OK},
5843 {80,S_OK},
5844 {URL_SCHEME_HTTP,S_OK},
5845 {URLZONE_INVALID,E_NOTIMPL}
5848 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5849 { NULL,0,S_OK,FALSE,
5851 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5852 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5854 {FALSE},
5855 0,S_OK,FALSE,
5856 0,S_OK,FALSE,
5857 0,0,0,S_OK,FALSE,
5859 {"http://google.com/",S_OK},
5860 {"google.com",S_OK},
5861 {"http://google.com/",S_OK},
5862 {"google.com",S_OK},
5863 {"",S_FALSE},
5864 {"",S_FALSE},
5865 {"google.com",S_OK},
5866 {"",S_FALSE},
5867 {"/",S_OK},
5868 {"/",S_OK},
5869 {"",S_FALSE},
5870 {"http://google.com/",S_OK},
5871 {"http",S_OK},
5872 {"",S_FALSE},
5873 {"",S_FALSE}
5876 {Uri_HOST_DNS,S_OK},
5877 {80,S_OK},
5878 {URL_SCHEME_HTTP,S_OK},
5879 {URLZONE_INVALID,E_NOTIMPL}
5882 /* Can't set the scheme name to NULL. */
5883 { "zip://google.com/",0,S_OK,FALSE,
5885 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5887 {FALSE},
5888 0,S_OK,FALSE,
5889 0,S_OK,FALSE,
5890 0,0,0,S_OK,FALSE,
5892 {"zip://google.com/",S_OK},
5893 {"google.com",S_OK},
5894 {"zip://google.com/",S_OK},
5895 {"google.com",S_OK},
5896 {"",S_FALSE},
5897 {"",S_FALSE},
5898 {"google.com",S_OK},
5899 {"",S_FALSE},
5900 {"/",S_OK},
5901 {"/",S_OK},
5902 {"",S_FALSE},
5903 {"zip://google.com/",S_OK},
5904 {"zip",S_OK},
5905 {"",S_FALSE},
5906 {"",S_FALSE}
5909 {Uri_HOST_DNS,S_OK},
5910 {0,S_FALSE},
5911 {URL_SCHEME_UNKNOWN,S_OK},
5912 {URLZONE_INVALID,E_NOTIMPL}
5915 /* Can't set the scheme name to an empty string. */
5916 { "zip://google.com/",0,S_OK,FALSE,
5918 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5920 {FALSE},
5921 0,S_OK,FALSE,
5922 0,S_OK,FALSE,
5923 0,0,0,S_OK,FALSE,
5925 {"zip://google.com/",S_OK},
5926 {"google.com",S_OK},
5927 {"zip://google.com/",S_OK},
5928 {"google.com",S_OK},
5929 {"",S_FALSE},
5930 {"",S_FALSE},
5931 {"google.com",S_OK},
5932 {"",S_FALSE},
5933 {"/",S_OK},
5934 {"/",S_OK},
5935 {"",S_FALSE},
5936 {"zip://google.com/",S_OK},
5937 {"zip",S_OK},
5938 {"",S_FALSE},
5939 {"",S_FALSE}
5942 {Uri_HOST_DNS,S_OK},
5943 {0,S_FALSE},
5944 {URL_SCHEME_UNKNOWN,S_OK},
5945 {URLZONE_INVALID,E_NOTIMPL}
5948 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5949 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5951 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5952 {{FALSE}},
5953 {FALSE},
5954 -1,S_OK,FALSE,
5955 0,S_OK,FALSE,
5956 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5958 {"http://google.com/../../",S_OK},
5959 {"google.com",S_OK},
5960 {"http://google.com/../../",S_OK},
5961 {"google.com",S_OK},
5962 {"",S_FALSE},
5963 {"",S_FALSE},
5964 {"google.com",S_OK},
5965 {"",S_FALSE},
5966 {"/../../",S_OK},
5967 {"/../../",S_OK},
5968 {"",S_FALSE},
5969 {"http://google.com/../../",S_OK},
5970 {"http",S_OK},
5971 {"",S_FALSE},
5972 {"",S_FALSE}
5975 {Uri_HOST_DNS,S_OK},
5976 {80,S_OK},
5977 {URL_SCHEME_HTTP,S_OK},
5978 {URLZONE_INVALID,E_NOTIMPL}
5981 { "http://google.com/",0,S_OK,FALSE,
5983 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5985 {FALSE},
5986 -1,S_OK,FALSE,
5987 0,S_OK,FALSE,
5988 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5990 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5991 {"google.com",S_OK},
5992 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5993 {"google.com",S_OK},
5994 {"",S_FALSE},
5995 {"#Fr%3C%7C%3Eg",S_OK},
5996 {"google.com",S_OK},
5997 {"",S_FALSE},
5998 {"/",S_OK},
5999 {"/",S_OK},
6000 {"",S_FALSE},
6001 {"http://google.com/#Fr<|>g",S_OK},
6002 {"http",S_OK},
6003 {"",S_FALSE},
6004 {"",S_FALSE}
6007 {Uri_HOST_DNS,S_OK},
6008 {80,S_OK},
6009 {URL_SCHEME_HTTP,S_OK},
6010 {URLZONE_INVALID,E_NOTIMPL}
6013 { "http://google.com/",0,S_OK,FALSE,
6015 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
6017 {FALSE},
6018 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
6019 0,S_OK,FALSE,
6020 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
6022 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
6023 {"google.com",S_OK},
6024 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
6025 {"google.com",S_OK},
6026 {"",S_FALSE},
6027 {"#Fr%3C%7C%3Eg",S_OK},
6028 {"google.com",S_OK},
6029 {"",S_FALSE},
6030 {"/",S_OK},
6031 {"/",S_OK},
6032 {"",S_FALSE},
6033 {"http://google.com/#Fr<|>g",S_OK},
6034 {"http",S_OK},
6035 {"",S_FALSE},
6036 {"",S_FALSE}
6039 {Uri_HOST_DNS,S_OK},
6040 {80,S_OK},
6041 {URL_SCHEME_HTTP,S_OK},
6042 {URLZONE_INVALID,E_NOTIMPL}
6045 { NULL,0,S_OK,FALSE,
6047 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
6048 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
6050 {FALSE},
6051 0,INET_E_INVALID_URL,FALSE,
6052 0,INET_E_INVALID_URL,FALSE,
6053 0,0,0,INET_E_INVALID_URL,FALSE
6055 { "http://google.com/",0,S_OK,FALSE,
6057 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
6059 {FALSE},
6060 0,INET_E_INVALID_URL,FALSE,
6061 0,INET_E_INVALID_URL,FALSE,
6062 0,0,0,INET_E_INVALID_URL,FALSE
6064 /* File scheme's can't have a username set. */
6065 { "file://google.com/",0,S_OK,FALSE,
6067 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6069 {FALSE},
6070 0,INET_E_INVALID_URL,FALSE,
6071 0,INET_E_INVALID_URL,FALSE,
6072 0,0,0,INET_E_INVALID_URL,FALSE
6074 /* File schemes can't have a password set. */
6075 { "file://google.com/",0,S_OK,FALSE,
6077 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6079 {FALSE},
6080 0,INET_E_INVALID_URL,FALSE,
6081 0,INET_E_INVALID_URL,FALSE,
6082 0,0,0,INET_E_INVALID_URL,FALSE
6084 /* UserName can't contain any character that is a delimiter for another
6085 * component that appears after it in a normal URI.
6087 { "http://google.com/",0,S_OK,FALSE,
6089 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6091 {FALSE},
6092 0,INET_E_INVALID_URL,FALSE,
6093 0,INET_E_INVALID_URL,FALSE,
6094 0,0,0,INET_E_INVALID_URL,FALSE
6096 { "http://google.com/",0,S_OK,FALSE,
6098 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6100 {FALSE},
6101 0,INET_E_INVALID_URL,FALSE,
6102 0,INET_E_INVALID_URL,FALSE,
6103 0,0,0,INET_E_INVALID_URL,FALSE
6105 { "http://google.com/",0,S_OK,FALSE,
6107 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6109 {FALSE},
6110 0,INET_E_INVALID_URL,FALSE,
6111 0,INET_E_INVALID_URL,FALSE,
6112 0,0,0,INET_E_INVALID_URL,FALSE
6114 { "http://google.com/",0,S_OK,FALSE,
6116 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6118 {FALSE},
6119 0,INET_E_INVALID_URL,FALSE,
6120 0,INET_E_INVALID_URL,FALSE,
6121 0,0,0,INET_E_INVALID_URL,FALSE
6123 { "http://google.com/",0,S_OK,FALSE,
6125 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6127 {FALSE},
6128 0,INET_E_INVALID_URL,FALSE,
6129 0,INET_E_INVALID_URL,FALSE,
6130 0,0,0,INET_E_INVALID_URL,FALSE
6132 { "http://google.com/",0,S_OK,FALSE,
6134 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6136 {FALSE},
6137 0,INET_E_INVALID_URL,FALSE,
6138 0,INET_E_INVALID_URL,FALSE,
6139 0,0,0,INET_E_INVALID_URL,FALSE
6141 { "http://google.com/",0,S_OK,FALSE,
6143 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6145 {FALSE},
6146 0,INET_E_INVALID_URL,FALSE,
6147 0,INET_E_INVALID_URL,FALSE,
6148 0,0,0,INET_E_INVALID_URL,FALSE
6150 { "http://google.com/",0,S_OK,FALSE,
6152 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6154 {FALSE},
6155 0,INET_E_INVALID_URL,FALSE,
6156 0,INET_E_INVALID_URL,FALSE,
6157 0,0,0,INET_E_INVALID_URL,FALSE
6159 { "http://google.com/",0,S_OK,FALSE,
6161 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6163 {FALSE},
6164 0,INET_E_INVALID_URL,FALSE,
6165 0,INET_E_INVALID_URL,FALSE,
6166 0,0,0,INET_E_INVALID_URL,FALSE
6168 { "http://google.com/",0,S_OK,FALSE,
6170 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
6172 {FALSE},
6173 0,INET_E_INVALID_URL,FALSE,
6174 0,INET_E_INVALID_URL,FALSE,
6175 0,0,0,INET_E_INVALID_URL,FALSE
6177 { "http://google.com/",0,S_OK,FALSE,
6179 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
6181 {FALSE},
6182 0,INET_E_INVALID_URL,FALSE,
6183 0,INET_E_INVALID_URL,FALSE,
6184 0,0,0,INET_E_INVALID_URL,FALSE
6186 { "http://google.com/",0,S_OK,FALSE,
6188 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
6190 {FALSE},
6191 0,INET_E_INVALID_URL,FALSE,
6192 0,INET_E_INVALID_URL,FALSE,
6193 0,0,0,INET_E_INVALID_URL,FALSE
6195 /* Hostname is allowed to contain a ':' (even for known scheme types). */
6196 { "http://google.com/",0,S_OK,FALSE,
6198 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
6200 {FALSE},
6201 0,S_OK,FALSE,
6202 0,S_OK,FALSE,
6203 0,0,0,S_OK,FALSE,
6205 {"http://winehq.org:test/",S_OK},
6206 {"winehq.org:test",S_OK},
6207 {"http://winehq.org:test/",S_OK},
6208 {"winehq.org:test",S_OK},
6209 {"",S_FALSE},
6210 {"",S_FALSE},
6211 {"winehq.org:test",S_OK},
6212 {"",S_FALSE},
6213 {"/",S_OK},
6214 {"/",S_OK},
6215 {"",S_FALSE},
6216 {"http://winehq.org:test/",S_OK},
6217 {"http",S_OK},
6218 {"",S_FALSE},
6219 {"",S_FALSE}
6222 {Uri_HOST_DNS,S_OK},
6223 {80,S_OK},
6224 {URL_SCHEME_HTTP,S_OK},
6225 {URLZONE_INVALID,E_NOTIMPL}
6228 /* Can't set the host name to NULL. */
6229 { "http://google.com/",0,S_OK,FALSE,
6231 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
6233 {FALSE},
6234 0,S_OK,FALSE,
6235 0,S_OK,FALSE,
6236 0,0,0,S_OK,FALSE,
6238 {"http://google.com/",S_OK},
6239 {"google.com",S_OK},
6240 {"http://google.com/",S_OK},
6241 {"google.com",S_OK},
6242 {"",S_FALSE},
6243 {"",S_FALSE},
6244 {"google.com",S_OK},
6245 {"",S_FALSE},
6246 {"/",S_OK},
6247 {"/",S_OK},
6248 {"",S_FALSE},
6249 {"http://google.com/",S_OK},
6250 {"http",S_OK},
6251 {"",S_FALSE},
6252 {"",S_FALSE}
6255 {Uri_HOST_DNS,S_OK},
6256 {80,S_OK},
6257 {URL_SCHEME_HTTP,S_OK},
6258 {URLZONE_INVALID,E_NOTIMPL}
6261 /* Can set the host name to an empty string. */
6262 { "http://google.com/",0,S_OK,FALSE,
6264 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
6266 {FALSE},
6267 0,S_OK,FALSE,
6268 0,S_OK,FALSE,
6269 0,0,0,S_OK,FALSE,
6271 {"http:///",S_OK},
6272 {"",S_OK},
6273 {"http:///",S_OK},
6274 {"",S_FALSE},
6275 {"",S_FALSE},
6276 {"",S_FALSE},
6277 {"",S_OK},
6278 {"",S_FALSE},
6279 {"/",S_OK},
6280 {"/",S_OK},
6281 {"",S_FALSE},
6282 {"http:///",S_OK},
6283 {"http",S_OK},
6284 {"",S_FALSE},
6285 {"",S_FALSE}
6288 {Uri_HOST_UNKNOWN,S_OK},
6289 {80,S_OK},
6290 {URL_SCHEME_HTTP,S_OK},
6291 {URLZONE_INVALID,E_NOTIMPL}
6294 { "http://google.com/",0,S_OK,FALSE,
6296 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
6298 {FALSE},
6299 0,INET_E_INVALID_URL,FALSE,
6300 0,INET_E_INVALID_URL,FALSE,
6301 0,0,0,INET_E_INVALID_URL,FALSE
6303 { "http://google.com/",0,S_OK,FALSE,
6305 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
6307 {FALSE},
6308 0,INET_E_INVALID_URL,FALSE,
6309 0,INET_E_INVALID_URL,FALSE,
6310 0,0,0,INET_E_INVALID_URL,FALSE
6312 { "http://google.com/",0,S_OK,FALSE,
6314 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
6316 {FALSE},
6317 0,INET_E_INVALID_URL,FALSE,
6318 0,INET_E_INVALID_URL,FALSE,
6319 0,0,0,INET_E_INVALID_URL,FALSE
6321 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6323 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6325 {FALSE},
6326 0,S_OK,FALSE,
6327 0,S_OK,FALSE,
6328 0,0,0,S_OK,FALSE,
6330 {"file:///c:/dir/file.html",S_OK},
6331 {"",S_FALSE},
6332 {"file:///c:/dir/file.html",S_OK},
6333 {"",S_FALSE},
6334 {".html",S_OK},
6335 {"",S_FALSE},
6336 {"",S_FALSE},
6337 {"",S_FALSE},
6338 {"/c:/dir/file.html",S_OK},
6339 {"/c:/dir/file.html",S_OK},
6340 {"",S_FALSE},
6341 {"file:///c:/dir/file.html",S_OK},
6342 {"file",S_OK},
6343 {"",S_FALSE},
6344 {"",S_FALSE}
6347 {Uri_HOST_UNKNOWN,S_OK},
6348 {0,S_FALSE},
6349 {URL_SCHEME_FILE,S_OK},
6350 {URLZONE_INVALID,E_NOTIMPL}
6353 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6355 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6357 {FALSE},
6358 0,S_OK,FALSE,
6359 0,S_OK,FALSE,
6360 0,0,0,S_OK,FALSE,
6362 {"file:///c:/dir/file.html#",S_OK},
6363 {"",S_FALSE},
6364 {"file:///c:/dir/file.html#",S_OK},
6365 {"",S_FALSE},
6366 {".html",S_OK},
6367 {"#",S_OK},
6368 {"",S_FALSE},
6369 {"",S_FALSE},
6370 {"/c:/dir/file.html",S_OK},
6371 {"/c:/dir/file.html",S_OK},
6372 {"",S_FALSE},
6373 {"file:///c:/dir/file.html#",S_OK},
6374 {"file",S_OK},
6375 {"",S_FALSE},
6376 {"",S_FALSE}
6379 {Uri_HOST_UNKNOWN,S_OK},
6380 {0,S_FALSE},
6381 {URL_SCHEME_FILE,S_OK},
6382 {URLZONE_INVALID,E_NOTIMPL}
6387 typedef struct _uri_builder_remove_test {
6388 const char *uri;
6389 DWORD create_flags;
6390 HRESULT create_builder_expected;
6391 BOOL create_builder_todo;
6393 DWORD remove_properties;
6394 HRESULT remove_expected;
6395 BOOL remove_todo;
6397 const char *expected_uri;
6398 DWORD expected_flags;
6399 HRESULT expected_hres;
6400 BOOL expected_todo;
6401 } uri_builder_remove_test;
6403 static const uri_builder_remove_test uri_builder_remove_tests[] = {
6404 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
6405 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
6406 "http://google.com/",0,S_OK,FALSE
6408 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
6409 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
6410 "http://winehq.org/",0,S_OK,FALSE
6412 { "zip://google.com?Test=x",0,S_OK,FALSE,
6413 Uri_HAS_HOST,S_OK,FALSE,
6414 "zip:/?Test=x",0,S_OK,FALSE
6416 /* Doesn't remove the whole userinfo component. */
6417 { "http://username:pass@google.com/",0,S_OK,FALSE,
6418 Uri_HAS_USER_INFO,S_OK,FALSE,
6419 "http://username:pass@google.com/",0,S_OK,FALSE
6421 /* Doesn't remove the domain. */
6422 { "http://google.com/",0,S_OK,FALSE,
6423 Uri_HAS_DOMAIN,S_OK,FALSE,
6424 "http://google.com/",0,S_OK,FALSE
6426 { "http://google.com:120/",0,S_OK,FALSE,
6427 Uri_HAS_AUTHORITY,S_OK,FALSE,
6428 "http://google.com:120/",0,S_OK,FALSE
6430 { "http://google.com/test.com/",0,S_OK,FALSE,
6431 Uri_HAS_EXTENSION,S_OK,FALSE,
6432 "http://google.com/test.com/",0,S_OK,FALSE
6434 { "http://google.com/?test=x",0,S_OK,FALSE,
6435 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
6436 "http://google.com/?test=x",0,S_OK,FALSE
6438 /* Can't remove the scheme name. */
6439 { "http://google.com/?test=x",0,S_OK,FALSE,
6440 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
6441 "http://google.com/?test=x",0,S_OK,FALSE
6445 typedef struct _uri_combine_str_property {
6446 const char *value;
6447 HRESULT expected;
6448 BOOL todo;
6449 const char *broken_value;
6450 const char *value_ex;
6451 } uri_combine_str_property;
6453 typedef struct _uri_combine_test {
6454 const char *base_uri;
6455 DWORD base_create_flags;
6456 const char *relative_uri;
6457 DWORD relative_create_flags;
6458 DWORD combine_flags;
6459 HRESULT expected;
6460 BOOL todo;
6462 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
6463 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
6464 } uri_combine_test;
6466 static const uri_combine_test uri_combine_tests[] = {
6467 { "http://google.com/fun/stuff",0,
6468 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
6469 0,S_OK,FALSE,
6471 {"http://google.com/not/fun/stuff",S_OK},
6472 {"google.com",S_OK},
6473 {"http://google.com/not/fun/stuff",S_OK},
6474 {"google.com",S_OK},
6475 {"",S_FALSE},
6476 {"",S_FALSE},
6477 {"google.com",S_OK},
6478 {"",S_FALSE},
6479 {"/not/fun/stuff",S_OK},
6480 {"/not/fun/stuff",S_OK},
6481 {"",S_FALSE},
6482 {"http://google.com/not/fun/stuff",S_OK},
6483 {"http",S_OK},
6484 {"",S_FALSE},
6485 {"",S_FALSE}
6488 {Uri_HOST_DNS,S_OK},
6489 {80,S_OK},
6490 {URL_SCHEME_HTTP,S_OK},
6491 {URLZONE_INVALID,E_NOTIMPL}
6494 { "http://google.com/test",0,
6495 "zip://test.com/cool",0,
6496 0,S_OK,FALSE,
6498 {"zip://test.com/cool",S_OK},
6499 {"test.com",S_OK},
6500 {"zip://test.com/cool",S_OK},
6501 {"test.com",S_OK},
6502 {"",S_FALSE},
6503 {"",S_FALSE},
6504 {"test.com",S_OK},
6505 {"",S_FALSE},
6506 {"/cool",S_OK},
6507 {"/cool",S_OK},
6508 {"",S_FALSE},
6509 {"zip://test.com/cool",S_OK},
6510 {"zip",S_OK},
6511 {"",S_FALSE},
6512 {"",S_FALSE}
6515 {Uri_HOST_DNS,S_OK},
6516 {0,S_FALSE},
6517 {URL_SCHEME_UNKNOWN,S_OK},
6518 {URLZONE_INVALID,E_NOTIMPL}
6521 { "http://google.com/use/base/path",0,
6522 "?relative",Uri_CREATE_ALLOW_RELATIVE,
6523 0,S_OK,FALSE,
6525 {"http://google.com/use/base/path?relative",S_OK},
6526 {"google.com",S_OK},
6527 {"http://google.com/use/base/path?relative",S_OK},
6528 {"google.com",S_OK},
6529 {"",S_FALSE},
6530 {"",S_FALSE},
6531 {"google.com",S_OK},
6532 {"",S_FALSE},
6533 {"/use/base/path",S_OK},
6534 {"/use/base/path?relative",S_OK},
6535 {"?relative",S_OK},
6536 {"http://google.com/use/base/path?relative",S_OK},
6537 {"http",S_OK},
6538 {"",S_FALSE},
6539 {"",S_FALSE}
6542 {Uri_HOST_DNS,S_OK},
6543 {80,S_OK},
6544 {URL_SCHEME_HTTP,S_OK},
6545 {URLZONE_INVALID,E_NOTIMPL}
6548 { "http://google.com/path",0,
6549 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6550 0,S_OK,FALSE,
6552 {"http://google.com/testing",S_OK},
6553 {"google.com",S_OK},
6554 {"http://google.com/testing",S_OK},
6555 {"google.com",S_OK},
6556 {"",S_FALSE},
6557 {"",S_FALSE},
6558 {"google.com",S_OK},
6559 {"",S_FALSE},
6560 {"/testing",S_OK},
6561 {"/testing",S_OK},
6562 {"",S_FALSE},
6563 {"http://google.com/testing",S_OK},
6564 {"http",S_OK},
6565 {"",S_FALSE},
6566 {"",S_FALSE}
6569 {Uri_HOST_DNS,S_OK},
6570 {80,S_OK},
6571 {URL_SCHEME_HTTP,S_OK},
6572 {URLZONE_INVALID,E_NOTIMPL}
6575 { "http://google.com/path",0,
6576 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6577 URL_DONT_SIMPLIFY,S_OK,FALSE,
6579 {"http://google.com:80/test/../test/.././testing",S_OK},
6580 {"google.com",S_OK},
6581 {"http://google.com:80/test/../test/.././testing",S_OK},
6582 {"google.com",S_OK},
6583 {"",S_FALSE},
6584 {"",S_FALSE},
6585 {"google.com",S_OK},
6586 {"",S_FALSE},
6587 {"/test/../test/.././testing",S_OK},
6588 {"/test/../test/.././testing",S_OK},
6589 {"",S_FALSE},
6590 {"http://google.com:80/test/../test/.././testing",S_OK},
6591 {"http",S_OK},
6592 {"",S_FALSE},
6593 {"",S_FALSE}
6596 {Uri_HOST_DNS,S_OK},
6597 {80,S_OK},
6598 {URL_SCHEME_HTTP,S_OK},
6599 {URLZONE_INVALID,E_NOTIMPL}
6602 { "http://winehq.org/test/abc",0,
6603 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6604 0,S_OK,FALSE,
6606 {"http://winehq.org/test/testing/test",S_OK},
6607 {"winehq.org",S_OK},
6608 {"http://winehq.org/test/testing/test",S_OK},
6609 {"winehq.org",S_OK},
6610 {"",S_FALSE},
6611 {"",S_FALSE},
6612 {"winehq.org",S_OK},
6613 {"",S_FALSE},
6614 {"/test/testing/test",S_OK},
6615 {"/test/testing/test",S_OK},
6616 {"",S_FALSE},
6617 {"http://winehq.org/test/testing/test",S_OK},
6618 {"http",S_OK},
6619 {"",S_FALSE},
6620 {"",S_FALSE}
6623 {Uri_HOST_DNS,S_OK},
6624 {80,S_OK},
6625 {URL_SCHEME_HTTP,S_OK},
6626 {URLZONE_INVALID,E_NOTIMPL}
6629 { "http://winehq.org/test/abc",0,
6630 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6631 URL_DONT_SIMPLIFY,S_OK,FALSE,
6633 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6634 /* Default port is hidden in the authority. */
6635 {"winehq.org",S_OK},
6636 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6637 {"winehq.org",S_OK},
6638 {"",S_FALSE},
6639 {"",S_FALSE},
6640 {"winehq.org",S_OK},
6641 {"",S_FALSE},
6642 {"/test/testing/abc/../test",S_OK},
6643 {"/test/testing/abc/../test",S_OK},
6644 {"",S_FALSE},
6645 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6646 {"http",S_OK},
6647 {"",S_FALSE},
6648 {"",S_FALSE}
6651 {Uri_HOST_DNS,S_OK},
6652 {80,S_OK},
6653 {URL_SCHEME_HTTP,S_OK},
6654 {URLZONE_INVALID,E_NOTIMPL}
6657 { "http://winehq.org/test?query",0,
6658 "testing",Uri_CREATE_ALLOW_RELATIVE,
6659 0,S_OK,FALSE,
6661 {"http://winehq.org/testing",S_OK},
6662 {"winehq.org",S_OK},
6663 {"http://winehq.org/testing",S_OK},
6664 {"winehq.org",S_OK},
6665 {"",S_FALSE},
6666 {"",S_FALSE},
6667 {"winehq.org",S_OK},
6668 {"",S_FALSE},
6669 {"/testing",S_OK},
6670 {"/testing",S_OK},
6671 {"",S_FALSE},
6672 {"http://winehq.org/testing",S_OK},
6673 {"http",S_OK},
6674 {"",S_FALSE},
6675 {"",S_FALSE}
6678 {Uri_HOST_DNS,S_OK},
6679 {80,S_OK},
6680 {URL_SCHEME_HTTP,S_OK},
6681 {URLZONE_INVALID,E_NOTIMPL}
6684 { "http://winehq.org/test#frag",0,
6685 "testing",Uri_CREATE_ALLOW_RELATIVE,
6686 0,S_OK,FALSE,
6688 {"http://winehq.org/testing",S_OK},
6689 {"winehq.org",S_OK},
6690 {"http://winehq.org/testing",S_OK},
6691 {"winehq.org",S_OK},
6692 {"",S_FALSE},
6693 {"",S_FALSE},
6694 {"winehq.org",S_OK},
6695 {"",S_FALSE},
6696 {"/testing",S_OK},
6697 {"/testing",S_OK},
6698 {"",S_FALSE},
6699 {"http://winehq.org/testing",S_OK},
6700 {"http",S_OK},
6701 {"",S_FALSE},
6702 {"",S_FALSE}
6705 {Uri_HOST_DNS,S_OK},
6706 {80,S_OK},
6707 {URL_SCHEME_HTTP,S_OK},
6708 {URLZONE_INVALID,E_NOTIMPL}
6711 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6712 "test",Uri_CREATE_ALLOW_RELATIVE,
6713 0,S_OK,FALSE,
6715 {"test",S_OK},
6716 {"",S_FALSE},
6717 {"test",S_OK},
6718 {"",S_FALSE},
6719 {"",S_FALSE},
6720 {"",S_FALSE},
6721 {"",S_FALSE},
6722 {"",S_FALSE},
6723 {"test",S_OK},
6724 {"test",S_OK},
6725 {"",S_FALSE},
6726 {"test",S_OK},
6727 {"",S_FALSE},
6728 {"",S_FALSE},
6729 {"",S_FALSE}
6732 {Uri_HOST_UNKNOWN,S_OK},
6733 {0,S_FALSE},
6734 {URL_SCHEME_UNKNOWN,S_OK},
6735 {URLZONE_INVALID,E_NOTIMPL}
6738 { "file:///c:/test/test",0,
6739 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6740 URL_FILE_USE_PATHURL,S_OK,FALSE,
6742 {"file://c:\\testing.mp3",S_OK},
6743 {"",S_FALSE},
6744 {"file://c:\\testing.mp3",S_OK},
6745 {"",S_FALSE},
6746 {".mp3",S_OK},
6747 {"",S_FALSE},
6748 {"",S_FALSE},
6749 {"",S_FALSE},
6750 {"c:\\testing.mp3",S_OK},
6751 {"c:\\testing.mp3",S_OK},
6752 {"",S_FALSE},
6753 {"file://c:\\testing.mp3",S_OK},
6754 {"file",S_OK},
6755 {"",S_FALSE},
6756 {"",S_FALSE}
6759 {Uri_HOST_UNKNOWN,S_OK},
6760 {0,S_FALSE},
6761 {URL_SCHEME_FILE,S_OK},
6762 {URLZONE_INVALID,E_NOTIMPL}
6765 { "file:///c:/test/test",0,
6766 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6767 0,S_OK,FALSE,
6769 {"file:///c:/testing.mp3",S_OK},
6770 {"",S_FALSE},
6771 {"file:///c:/testing.mp3",S_OK},
6772 {"",S_FALSE},
6773 {".mp3",S_OK},
6774 {"",S_FALSE},
6775 {"",S_FALSE},
6776 {"",S_FALSE},
6777 {"/c:/testing.mp3",S_OK},
6778 {"/c:/testing.mp3",S_OK},
6779 {"",S_FALSE},
6780 {"file:///c:/testing.mp3",S_OK},
6781 {"file",S_OK},
6782 {"",S_FALSE},
6783 {"",S_FALSE}
6786 {Uri_HOST_UNKNOWN,S_OK},
6787 {0,S_FALSE},
6788 {URL_SCHEME_FILE,S_OK},
6789 {URLZONE_INVALID,E_NOTIMPL}
6792 { "file://test.com/test/test",0,
6793 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6794 URL_FILE_USE_PATHURL,S_OK,FALSE,
6796 {"file://\\\\test.com\\testing.mp3",S_OK},
6797 {"test.com",S_OK},
6798 {"file://\\\\test.com\\testing.mp3",S_OK},
6799 {"test.com",S_OK},
6800 {".mp3",S_OK},
6801 {"",S_FALSE},
6802 {"test.com",S_OK},
6803 {"",S_FALSE},
6804 {"\\testing.mp3",S_OK},
6805 {"\\testing.mp3",S_OK},
6806 {"",S_FALSE},
6807 {"file://\\\\test.com\\testing.mp3",S_OK},
6808 {"file",S_OK},
6809 {"",S_FALSE},
6810 {"",S_FALSE}
6813 {Uri_HOST_DNS,S_OK},
6814 {0,S_FALSE},
6815 {URL_SCHEME_FILE,S_OK},
6816 {URLZONE_INVALID,E_NOTIMPL}
6819 /* URL_DONT_SIMPLIFY has no effect. */
6820 { "http://google.com/test",0,
6821 "zip://test.com/cool/../cool/test",0,
6822 URL_DONT_SIMPLIFY,S_OK,FALSE,
6824 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6825 {"test.com",S_OK},
6826 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6827 {"test.com",S_OK},
6828 {"",S_FALSE},
6829 {"",S_FALSE},
6830 {"test.com",S_OK},
6831 {"",S_FALSE},
6832 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6833 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6834 {"",S_FALSE},
6835 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6836 * On IE 7 it reduces the path in the Raw URI.
6838 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6839 {"zip",S_OK},
6840 {"",S_FALSE},
6841 {"",S_FALSE}
6844 {Uri_HOST_DNS,S_OK},
6845 {0,S_FALSE},
6846 {URL_SCHEME_UNKNOWN,S_OK},
6847 {URLZONE_INVALID,E_NOTIMPL}
6850 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6851 * resulting URI is converted into a dos path.
6853 { "http://google.com/test",0,
6854 "file:///c:/test/",0,
6855 URL_FILE_USE_PATHURL,S_OK,FALSE,
6857 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6858 {"",S_FALSE},
6859 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6860 {"",S_FALSE},
6861 {"",S_FALSE},
6862 {"",S_FALSE},
6863 {"",S_FALSE},
6864 {"",S_FALSE},
6865 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6866 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6867 {"",S_FALSE},
6868 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6869 {"file",S_OK},
6870 {"",S_FALSE},
6871 {"",S_FALSE}
6874 {Uri_HOST_UNKNOWN,S_OK},
6875 {0,S_FALSE},
6876 {URL_SCHEME_FILE,S_OK},
6877 {URLZONE_INVALID,E_NOTIMPL}
6880 { "http://google.com/test",0,
6881 "http://test.com/test#%30test",0,
6882 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6884 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6885 {"test.com",S_OK},
6886 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6887 {"test.com",S_OK},
6888 {"",S_FALSE},
6889 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6890 {"test.com",S_OK},
6891 {"",S_FALSE},
6892 {"/test",S_OK},
6893 {"/test",S_OK},
6894 {"",S_FALSE},
6895 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6896 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6897 {"http",S_OK},
6898 {"",S_FALSE},
6899 {"",S_FALSE}
6902 {Uri_HOST_DNS,S_OK},
6903 {80,S_OK},
6904 {URL_SCHEME_HTTP,S_OK},
6905 {URLZONE_INVALID,E_NOTIMPL}
6908 /* Windows validates the path component from the relative Uri. */
6909 { "http://google.com/test",0,
6910 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6911 0,E_INVALIDARG,FALSE
6913 /* Windows doesn't validate the query from the relative Uri. */
6914 { "http://google.com/test",0,
6915 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6916 0,S_OK,FALSE,
6918 {"http://google.com/test?Tes%XXt",S_OK},
6919 {"google.com",S_OK},
6920 {"http://google.com/test?Tes%XXt",S_OK},
6921 {"google.com",S_OK},
6922 {"",S_FALSE},
6923 {"",S_FALSE},
6924 {"google.com",S_OK},
6925 {"",S_FALSE},
6926 {"/test",S_OK},
6927 {"/test?Tes%XXt",S_OK},
6928 {"?Tes%XXt",S_OK},
6929 {"http://google.com/test?Tes%XXt",S_OK},
6930 {"http",S_OK},
6931 {"",S_FALSE},
6932 {"",S_FALSE}
6935 {Uri_HOST_DNS,S_OK},
6936 {80,S_OK},
6937 {URL_SCHEME_HTTP,S_OK},
6938 {URLZONE_INVALID,E_NOTIMPL}
6941 /* Windows doesn't validate the fragment from the relative Uri. */
6942 { "http://google.com/test",0,
6943 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6944 0,S_OK,FALSE,
6946 {"http://google.com/test#Tes%XXt",S_OK},
6947 {"google.com",S_OK},
6948 {"http://google.com/test#Tes%XXt",S_OK},
6949 {"google.com",S_OK},
6950 {"",S_FALSE},
6951 {"#Tes%XXt",S_OK},
6952 {"google.com",S_OK},
6953 {"",S_FALSE},
6954 {"/test",S_OK},
6955 {"/test",S_OK},
6956 {"",S_FALSE},
6957 {"http://google.com/test#Tes%XXt",S_OK},
6958 {"http",S_OK},
6959 {"",S_FALSE},
6960 {"",S_FALSE}
6963 {Uri_HOST_DNS,S_OK},
6964 {80,S_OK},
6965 {URL_SCHEME_HTTP,S_OK},
6966 {URLZONE_INVALID,E_NOTIMPL}
6969 /* Creates an IUri which contains an invalid dos path char. */
6970 { "file:///c:/test",0,
6971 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6972 URL_FILE_USE_PATHURL,S_OK,FALSE,
6974 {"file://c:\\test<ing",S_OK},
6975 {"",S_FALSE},
6976 {"file://c:\\test<ing",S_OK},
6977 {"",S_FALSE},
6978 {"",S_FALSE},
6979 {"",S_FALSE},
6980 {"",S_FALSE},
6981 {"",S_FALSE},
6982 {"c:\\test<ing",S_OK},
6983 {"c:\\test<ing",S_OK},
6984 {"",S_FALSE},
6985 {"file://c:\\test<ing",S_OK},
6986 {"file",S_OK},
6987 {"",S_FALSE},
6988 {"",S_FALSE}
6991 {Uri_HOST_UNKNOWN,S_OK},
6992 {0,S_FALSE},
6993 {URL_SCHEME_FILE,S_OK},
6994 {URLZONE_INVALID,E_NOTIMPL}
6997 /* Appends the path after the drive letter (if any). */
6998 { "file:///c:/test",0,
6999 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
7000 0,S_OK,FALSE,
7002 {"file:///c:/c:/testing",S_OK},
7003 {"",S_FALSE},
7004 {"file:///c:/c:/testing",S_OK},
7005 {"",S_FALSE},
7006 {"",S_FALSE},
7007 {"",S_FALSE},
7008 {"",S_FALSE},
7009 {"",S_FALSE},
7010 {"/c:/c:/testing",S_OK},
7011 {"/c:/c:/testing",S_OK},
7012 {"",S_FALSE},
7013 {"file:///c:/c:/testing",S_OK},
7014 {"file",S_OK},
7015 {"",S_FALSE},
7016 {"",S_FALSE}
7019 {Uri_HOST_UNKNOWN,S_OK},
7020 {0,S_FALSE},
7021 {URL_SCHEME_FILE,S_OK},
7022 {URLZONE_INVALID,E_NOTIMPL}
7025 /* A '/' is added if the base URI doesn't have a path and the
7026 * relative URI doesn't contain a path (since the base URI is
7027 * hierarchical.
7029 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
7030 "?test",Uri_CREATE_ALLOW_RELATIVE,
7031 0,S_OK,FALSE,
7033 {"http://google.com/?test",S_OK},
7034 {"google.com",S_OK},
7035 {"http://google.com/?test",S_OK},
7036 {"google.com",S_OK},
7037 {"",S_FALSE},
7038 {"",S_FALSE},
7039 {"google.com",S_OK},
7040 {"",S_FALSE},
7041 {"/",S_OK},
7042 {"/?test",S_OK},
7043 {"?test",S_OK},
7044 {"http://google.com/?test",S_OK},
7045 {"http",S_OK},
7046 {"",S_FALSE},
7047 {"",S_FALSE}
7050 {Uri_HOST_DNS,S_OK},
7051 {80,S_OK},
7052 {URL_SCHEME_HTTP,S_OK},
7053 {URLZONE_INVALID,E_NOTIMPL}
7056 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
7057 "?test",Uri_CREATE_ALLOW_RELATIVE,
7058 0,S_OK,FALSE,
7060 {"zip://google.com/?test",S_OK},
7061 {"google.com",S_OK},
7062 {"zip://google.com/?test",S_OK},
7063 {"google.com",S_OK},
7064 {"",S_FALSE},
7065 {"",S_FALSE},
7066 {"google.com",S_OK},
7067 {"",S_FALSE},
7068 {"/",S_OK},
7069 {"/?test",S_OK},
7070 {"?test",S_OK},
7071 {"zip://google.com/?test",S_OK},
7072 {"zip",S_OK},
7073 {"",S_FALSE},
7074 {"",S_FALSE}
7077 {Uri_HOST_DNS,S_OK},
7078 {0,S_FALSE},
7079 {URL_SCHEME_UNKNOWN,S_OK},
7080 {URLZONE_INVALID,E_NOTIMPL}
7083 /* No path is appended since the base URI is opaque. */
7084 { "zip:?testing",0,
7085 "?test",Uri_CREATE_ALLOW_RELATIVE,
7086 0,S_OK,FALSE,
7088 {"zip:?test",S_OK},
7089 {"",S_FALSE},
7090 {"zip:?test",S_OK},
7091 {"",S_FALSE},
7092 {"",S_FALSE},
7093 {"",S_FALSE},
7094 {"",S_FALSE},
7095 {"",S_FALSE},
7096 {"",S_OK},
7097 {"?test",S_OK},
7098 {"?test",S_OK},
7099 {"zip:?test",S_OK},
7100 {"zip",S_OK},
7101 {"",S_FALSE},
7102 {"",S_FALSE}
7105 {Uri_HOST_UNKNOWN,S_OK},
7106 {0,S_FALSE},
7107 {URL_SCHEME_UNKNOWN,S_OK},
7108 {URLZONE_INVALID,E_NOTIMPL}
7111 { "file:///c:/",0,
7112 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
7113 0,S_OK,FALSE,
7115 {"file:///c:/testing/test",S_OK},
7116 {"",S_FALSE},
7117 {"file:///c:/testing/test",S_OK},
7118 {"",S_FALSE},
7119 {"",S_FALSE},
7120 {"",S_FALSE},
7121 {"",S_FALSE},
7122 {"",S_FALSE},
7123 {"/c:/testing/test",S_OK},
7124 {"/c:/testing/test",S_OK},
7125 {"",S_FALSE},
7126 {"file:///c:/testing/test",S_OK},
7127 {"file",S_OK},
7128 {"",S_FALSE},
7129 {"",S_FALSE}
7132 {Uri_HOST_UNKNOWN,S_OK},
7133 {0,S_FALSE},
7134 {URL_SCHEME_FILE,S_OK},
7135 {URLZONE_INVALID,E_NOTIMPL}
7138 { "http://winehq.org/dir/testfile",0,
7139 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
7140 0,S_OK,FALSE,
7142 {"http://winehq.org/dir/test?querystring",S_OK},
7143 {"winehq.org",S_OK},
7144 {"http://winehq.org/dir/test?querystring",S_OK},
7145 {"winehq.org",S_OK},
7146 {"",S_FALSE},
7147 {"",S_FALSE},
7148 {"winehq.org",S_OK},
7149 {"",S_FALSE},
7150 {"/dir/test",S_OK},
7151 {"/dir/test?querystring",S_OK},
7152 {"?querystring",S_OK},
7153 {"http://winehq.org/dir/test?querystring",S_OK},
7154 {"http",S_OK},
7155 {"",S_FALSE},
7156 {"",S_FALSE}
7159 {Uri_HOST_DNS,S_OK},
7160 {80,S_OK},
7161 {URL_SCHEME_HTTP,S_OK},
7162 {URLZONE_INVALID,E_NOTIMPL}
7165 { "http://winehq.org/dir/test",0,
7166 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
7167 0,S_OK,FALSE,
7169 {"http://winehq.org/dir/test?querystring",S_OK},
7170 {"winehq.org",S_OK},
7171 {"http://winehq.org/dir/test?querystring",S_OK},
7172 {"winehq.org",S_OK},
7173 {"",S_FALSE},
7174 {"",S_FALSE},
7175 {"winehq.org",S_OK},
7176 {"",S_FALSE},
7177 {"/dir/test",S_OK},
7178 {"/dir/test?querystring",S_OK},
7179 {"?querystring",S_OK},
7180 {"http://winehq.org/dir/test?querystring",S_OK},
7181 {"http",S_OK},
7182 {"",S_FALSE},
7183 {"",S_FALSE}
7186 {Uri_HOST_DNS,S_OK},
7187 {80,S_OK},
7188 {URL_SCHEME_HTTP,S_OK},
7189 {URLZONE_INVALID,E_NOTIMPL}
7192 { "http://winehq.org/dir/test?querystring",0,
7193 "#hash",Uri_CREATE_ALLOW_RELATIVE,
7194 0,S_OK,FALSE,
7196 {"http://winehq.org/dir/test?querystring#hash",S_OK},
7197 {"winehq.org",S_OK},
7198 {"http://winehq.org/dir/test?querystring#hash",S_OK},
7199 {"winehq.org",S_OK},
7200 {"",S_FALSE},
7201 {"#hash",S_OK},
7202 {"winehq.org",S_OK},
7203 {"",S_FALSE},
7204 {"/dir/test",S_OK},
7205 {"/dir/test?querystring",S_OK},
7206 {"?querystring",S_OK},
7207 {"http://winehq.org/dir/test?querystring#hash",S_OK},
7208 {"http",S_OK},
7209 {"",S_FALSE},
7210 {"",S_FALSE}
7213 {Uri_HOST_DNS,S_OK},
7214 {80,S_OK},
7215 {URL_SCHEME_HTTP,S_OK},
7216 {URLZONE_INVALID,E_NOTIMPL}
7219 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
7220 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7221 0,S_OK,FALSE,
7223 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7224 {"",S_FALSE},
7225 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7226 {"",S_FALSE},
7227 {".txt",S_OK},
7228 {"",S_FALSE},
7229 {"",S_FALSE},
7230 {"",S_FALSE},
7231 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7232 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7233 {"",S_FALSE},
7234 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7235 {"mk",S_OK},
7236 {"",S_FALSE},
7237 {"",S_FALSE}
7240 {Uri_HOST_UNKNOWN,S_OK},
7241 {0,S_FALSE},
7242 {URL_SCHEME_MK,S_OK},
7243 {URLZONE_INVALID,E_NOTIMPL}
7246 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
7247 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7248 0,S_OK,FALSE,
7250 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7251 {"",S_FALSE},
7252 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7253 {"",S_FALSE},
7254 {".txt",S_OK},
7255 {"",S_FALSE},
7256 {"",S_FALSE},
7257 {"",S_FALSE},
7258 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7259 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7260 {"",S_FALSE},
7261 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7262 {"mk",S_OK},
7263 {"",S_FALSE},
7264 {"",S_FALSE}
7267 {Uri_HOST_UNKNOWN,S_OK},
7268 {0,S_FALSE},
7269 {URL_SCHEME_MK,S_OK},
7270 {URLZONE_INVALID,E_NOTIMPL}
7273 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
7274 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
7275 0,S_OK,FALSE,
7277 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7278 {"",S_FALSE},
7279 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7280 {"",S_FALSE},
7281 {".txt",S_OK},
7282 {"",S_FALSE},
7283 {"",S_FALSE},
7284 {"",S_FALSE},
7285 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7286 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7287 {"",S_FALSE},
7288 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7289 {"mk",S_OK},
7290 {"",S_FALSE},
7291 {"",S_FALSE}
7294 {Uri_HOST_UNKNOWN,S_OK},
7295 {0,S_FALSE},
7296 {URL_SCHEME_MK,S_OK},
7297 {URLZONE_INVALID,E_NOTIMPL}
7300 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7301 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7302 0,S_OK,FALSE,
7304 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7305 {"",S_FALSE},
7306 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7307 {"",S_FALSE},
7308 {".txt",S_OK},
7309 {"",S_FALSE},
7310 {"",S_FALSE},
7311 {"",S_FALSE},
7312 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7313 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7314 {"",S_FALSE},
7315 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7316 {"mk",S_OK},
7317 {"",S_FALSE},
7318 {"",S_FALSE}
7321 {Uri_HOST_UNKNOWN,S_OK},
7322 {0,S_FALSE},
7323 {URL_SCHEME_MK,S_OK},
7324 {URLZONE_INVALID,E_NOTIMPL}
7327 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7328 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7329 0,S_OK,FALSE,
7331 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7332 {"",S_FALSE},
7333 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7334 {"",S_FALSE},
7335 {".txt",S_OK},
7336 {"",S_FALSE},
7337 {"",S_FALSE},
7338 {"",S_FALSE},
7339 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7340 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7341 {"",S_FALSE},
7342 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7343 {"mk",S_OK},
7344 {"",S_FALSE},
7345 {"",S_FALSE}
7348 {Uri_HOST_UNKNOWN,S_OK},
7349 {0,S_FALSE},
7350 {URL_SCHEME_MK,S_OK},
7351 {URLZONE_INVALID,E_NOTIMPL}
7354 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7355 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7356 0,S_OK,FALSE,
7358 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7359 {"",S_FALSE},
7360 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7361 {"",S_FALSE},
7362 {".txt",S_OK},
7363 {"",S_FALSE},
7364 {"",S_FALSE},
7365 {"",S_FALSE},
7366 {"@MSITSTORE:/relative/path.txt",S_OK},
7367 {"@MSITSTORE:/relative/path.txt",S_OK},
7368 {"",S_FALSE},
7369 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7370 {"mk",S_OK},
7371 {"",S_FALSE},
7372 {"",S_FALSE}
7375 {Uri_HOST_UNKNOWN,S_OK},
7376 {0,S_FALSE},
7377 {URL_SCHEME_MK,S_OK},
7378 {URLZONE_INVALID,E_NOTIMPL}
7381 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7382 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7383 0,S_OK,FALSE,
7385 {"mk:@xxx:/relative/path.txt",S_OK},
7386 {"",S_FALSE},
7387 {"mk:@xxx:/relative/path.txt",S_OK},
7388 {"",S_FALSE},
7389 {".txt",S_OK},
7390 {"",S_FALSE},
7391 {"",S_FALSE},
7392 {"",S_FALSE},
7393 {"@xxx:/relative/path.txt",S_OK},
7394 {"@xxx:/relative/path.txt",S_OK},
7395 {"",S_FALSE},
7396 {"mk:@xxx:/relative/path.txt",S_OK},
7397 {"mk",S_OK},
7398 {"",S_FALSE},
7399 {"",S_FALSE}
7402 {Uri_HOST_UNKNOWN,S_OK},
7403 {0,S_FALSE},
7404 {URL_SCHEME_MK,S_OK},
7405 {URLZONE_INVALID,E_NOTIMPL}
7408 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7409 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7410 0,S_OK,FALSE,
7412 {"mk:/relative/path.txt",S_OK},
7413 {"",S_FALSE},
7414 {"mk:/relative/path.txt",S_OK},
7415 {"",S_FALSE},
7416 {".txt",S_OK},
7417 {"",S_FALSE},
7418 {"",S_FALSE},
7419 {"",S_FALSE},
7420 {"/relative/path.txt",S_OK},
7421 {"/relative/path.txt",S_OK},
7422 {"",S_FALSE},
7423 {"mk:/relative/path.txt",S_OK},
7424 {"mk",S_OK},
7425 {"",S_FALSE},
7426 {"",S_FALSE}
7429 {Uri_HOST_UNKNOWN,S_OK},
7430 {0,S_FALSE},
7431 {URL_SCHEME_MK,S_OK},
7432 {URLZONE_INVALID,E_NOTIMPL}
7435 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7436 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7437 0,S_OK,FALSE,
7439 {"ml:/relative/path.txt",S_OK},
7440 {"",S_FALSE},
7441 {"ml:/relative/path.txt",S_OK},
7442 {"",S_FALSE},
7443 {".txt",S_OK},
7444 {"",S_FALSE},
7445 {"",S_FALSE},
7446 {"",S_FALSE},
7447 {"/relative/path.txt",S_OK},
7448 {"/relative/path.txt",S_OK},
7449 {"",S_FALSE},
7450 {"ml:/relative/path.txt",S_OK},
7451 {"ml",S_OK},
7452 {"",S_FALSE},
7453 {"",S_FALSE}
7456 {Uri_HOST_UNKNOWN,S_OK},
7457 {0,S_FALSE},
7458 {URL_SCHEME_UNKNOWN,S_OK},
7459 {URLZONE_INVALID,E_NOTIMPL}
7462 { "http://winehq.org/dir/test?querystring",0,
7463 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
7464 0,S_OK,FALSE,
7466 {"http://winehq.com/#hash",S_OK},
7467 {"winehq.com",S_OK},
7468 {"http://winehq.com/#hash",S_OK},
7469 {"winehq.com",S_OK},
7470 {"",S_FALSE},
7471 {"#hash",S_OK},
7472 {"winehq.com",S_OK},
7473 {"",S_FALSE},
7474 {"/",S_OK},
7475 {"/",S_OK},
7476 {"",S_FALSE},
7477 {"http://winehq.com/#hash",S_OK},
7478 {"http",S_OK},
7479 {"",S_FALSE},
7480 {"",S_FALSE}
7483 {Uri_HOST_DNS,S_OK},
7484 {80,S_OK,FALSE,TRUE},
7485 {URL_SCHEME_HTTP,S_OK},
7486 {URLZONE_INVALID,E_NOTIMPL}
7489 { "http://winehq.org/dir/test?querystring",0,
7490 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
7491 0,S_OK,FALSE,
7493 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7494 {"winehq.com",S_OK},
7495 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7496 {"winehq.com",S_OK},
7497 {".txt",S_OK},
7498 {"#hash",S_OK},
7499 {"winehq.com",S_OK},
7500 {"",S_FALSE},
7501 {"/dir/file.txt",S_OK},
7502 {"/dir/file.txt?query",S_OK},
7503 {"?query",S_OK},
7504 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7505 {"http",S_OK},
7506 {"",S_FALSE},
7507 {"",S_FALSE}
7510 {Uri_HOST_DNS,S_OK},
7511 {80,S_OK,FALSE,TRUE},
7512 {URL_SCHEME_HTTP,S_OK},
7513 {URLZONE_INVALID,E_NOTIMPL}
7516 { "http://google.com/test",0,
7517 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7518 0,S_OK,FALSE,
7520 {"file:///c:/test/",S_OK},
7521 {"",S_FALSE},
7522 {"file:///c:/test/",S_OK},
7523 {"",S_FALSE},
7524 {"",S_FALSE},
7525 {"",S_FALSE},
7526 {"",S_FALSE},
7527 {"",S_FALSE},
7528 {"/c:/test/",S_OK},
7529 {"/c:/test/",S_OK},
7530 {"",S_FALSE},
7531 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7532 {"file",S_OK},
7533 {"",S_FALSE},
7534 {"",S_FALSE}
7537 {Uri_HOST_UNKNOWN,S_OK},
7538 {0,S_FALSE},
7539 {URL_SCHEME_FILE,S_OK},
7540 {URLZONE_INVALID,E_NOTIMPL}
7543 { "http://google.com/test",0,
7544 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7545 0,S_OK,FALSE,
7547 {"file:///c:/test/",S_OK},
7548 {"",S_FALSE},
7549 {"file:///c:/test/",S_OK},
7550 {"",S_FALSE},
7551 {"",S_FALSE},
7552 {"",S_FALSE},
7553 {"",S_FALSE},
7554 {"",S_FALSE},
7555 {"/c:/test/",S_OK},
7556 {"/c:/test/",S_OK},
7557 {"",S_FALSE},
7558 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7559 {"file",S_OK},
7560 {"",S_FALSE},
7561 {"",S_FALSE}
7564 {Uri_HOST_UNKNOWN,S_OK},
7565 {0,S_FALSE},
7566 {URL_SCHEME_FILE,S_OK},
7567 {URLZONE_INVALID,E_NOTIMPL}
7570 { "http://winehq.org",0,
7571 "mailto://",Uri_CREATE_NO_CANONICALIZE,
7572 0,S_OK,FALSE,
7574 {"mailto:",S_OK},
7575 {"",S_FALSE},
7576 {"mailto:",S_OK},
7577 {"",S_FALSE},
7578 {"",S_FALSE},
7579 {"",S_FALSE},
7580 {"",S_FALSE},
7581 {"",S_FALSE},
7582 {"",S_FALSE},
7583 {"",S_FALSE},
7584 {"",S_FALSE},
7585 {"mailto://",S_OK,FALSE,"mailto:"},
7586 {"mailto",S_OK},
7587 {"",S_FALSE},
7588 {"",S_FALSE}
7591 {Uri_HOST_UNKNOWN,S_OK},
7592 {0,S_FALSE},
7593 {URL_SCHEME_MAILTO,S_OK},
7594 {URLZONE_INVALID,E_NOTIMPL}
7597 { "http://winehq.org",0,
7598 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
7599 0,S_OK,FALSE,
7601 {"mailto:a@b.com",S_OK},
7602 {"",S_FALSE},
7603 {"mailto:a@b.com",S_OK},
7604 {"",S_FALSE},
7605 {".com",S_OK},
7606 {"",S_FALSE},
7607 {"",S_FALSE},
7608 {"",S_FALSE},
7609 {"a@b.com",S_OK},
7610 {"a@b.com",S_OK},
7611 {"",S_FALSE},
7612 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
7613 {"mailto",S_OK},
7614 {"",S_FALSE},
7615 {"",S_FALSE}
7618 {Uri_HOST_UNKNOWN,S_OK},
7619 {0,S_FALSE},
7620 {URL_SCHEME_MAILTO,S_OK},
7621 {URLZONE_INVALID,E_NOTIMPL}
7624 { "http://[::1]",0,
7625 "/",Uri_CREATE_ALLOW_RELATIVE,
7626 0,S_OK,FALSE,
7628 {"http://[::1]/",S_OK},
7629 {"[::1]",S_OK},
7630 {"http://[::1]/",S_OK},
7631 {"",S_FALSE},
7632 {"",S_FALSE},
7633 {"",S_FALSE},
7634 {"::1",S_OK},
7635 {"",S_FALSE},
7636 {"/",S_OK},
7637 {"/",S_OK},
7638 {"",S_FALSE},
7639 {"http://[::1]/",S_OK},
7640 {"http",S_OK},
7641 {"",S_FALSE},
7642 {"",S_FALSE}
7645 {Uri_HOST_IPV6,S_OK},
7646 {80,S_OK,FALSE,TRUE},
7647 {URL_SCHEME_HTTP,S_OK},
7648 {URLZONE_INVALID,E_NOTIMPL}
7653 typedef struct _uri_parse_test {
7654 const char *uri;
7655 DWORD uri_flags;
7656 PARSEACTION action;
7657 DWORD flags;
7658 const char *property;
7659 HRESULT expected;
7660 BOOL todo;
7661 const char *property2;
7662 } uri_parse_test;
7664 static const uri_parse_test uri_parse_tests[] = {
7665 /* PARSE_CANONICALIZE tests. */
7666 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
7667 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
7668 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
7669 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
7670 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
7671 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
7672 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
7673 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
7674 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
7675 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
7676 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
7677 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
7679 /* PARSE_FRIENDLY tests. */
7680 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
7681 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
7683 /* PARSE_ROOTDOCUMENT tests. */
7684 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
7685 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
7686 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7687 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7688 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7689 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7691 /* PARSE_DOCUMENT tests. */
7692 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
7693 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7694 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7695 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7696 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7697 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7699 /* PARSE_PATH_FROM_URL tests. */
7700 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
7701 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
7702 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
7703 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
7704 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
7705 {"file:/c:/dir/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\dir\\test.mp3",S_OK},
7706 {"file:/c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK},
7707 {"file://c:\\test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK},
7709 /* PARSE_URL_FROM_PATH tests. */
7710 /* This function almost seems to useless (just returns the absolute uri). */
7711 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
7712 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
7713 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
7714 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7715 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7717 /* PARSE_SCHEMA tests. */
7718 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
7719 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
7721 /* PARSE_SITE tests. */
7722 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
7723 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
7724 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7725 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7727 /* PARSE_DOMAIN tests. */
7728 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE,"com.uk"},
7729 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7730 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7731 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7733 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7734 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7735 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7736 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7737 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7740 static inline LPWSTR a2w(LPCSTR str) {
7741 LPWSTR ret = NULL;
7743 if(str) {
7744 DWORD len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
7745 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
7746 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
7749 return ret;
7752 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7753 LPWSTR strAW = a2w(strA);
7754 DWORD ret = lstrcmpW(strAW, strB);
7755 heap_free(strAW);
7756 return ret;
7759 static inline ULONG get_refcnt(IUri *uri) {
7760 IUri_AddRef(uri);
7761 return IUri_Release(uri);
7764 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7765 DWORD test_index) {
7766 HRESULT hr;
7767 LPWSTR valueW;
7769 valueW = a2w(prop->value);
7770 switch(prop->property) {
7771 case Uri_PROPERTY_FRAGMENT:
7772 hr = IUriBuilder_SetFragment(builder, valueW);
7773 todo_wine_if(prop->todo) {
7774 ok(hr == prop->expected,
7775 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7776 hr, prop->expected, test_index);
7778 break;
7779 case Uri_PROPERTY_HOST:
7780 hr = IUriBuilder_SetHost(builder, valueW);
7781 todo_wine_if(prop->todo) {
7782 ok(hr == prop->expected,
7783 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7784 hr, prop->expected, test_index);
7786 break;
7787 case Uri_PROPERTY_PASSWORD:
7788 hr = IUriBuilder_SetPassword(builder, valueW);
7789 todo_wine_if(prop->todo) {
7790 ok(hr == prop->expected,
7791 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7792 hr, prop->expected, test_index);
7794 break;
7795 case Uri_PROPERTY_PATH:
7796 hr = IUriBuilder_SetPath(builder, valueW);
7797 todo_wine_if(prop->todo) {
7798 ok(hr == prop->expected,
7799 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7800 hr, prop->expected, test_index);
7802 break;
7803 case Uri_PROPERTY_QUERY:
7804 hr = IUriBuilder_SetQuery(builder, valueW);
7805 todo_wine_if(prop->todo) {
7806 ok(hr == prop->expected,
7807 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7808 hr, prop->expected, test_index);
7810 break;
7811 case Uri_PROPERTY_SCHEME_NAME:
7812 hr = IUriBuilder_SetSchemeName(builder, valueW);
7813 todo_wine_if(prop->todo) {
7814 ok(hr == prop->expected,
7815 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7816 hr, prop->expected, test_index);
7818 break;
7819 case Uri_PROPERTY_USER_NAME:
7820 hr = IUriBuilder_SetUserName(builder, valueW);
7821 todo_wine_if(prop->todo) {
7822 ok(hr == prop->expected,
7823 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7824 hr, prop->expected, test_index);
7826 break;
7827 default:
7828 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7831 heap_free(valueW);
7835 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7836 * correctly.
7838 static void test_CreateUri_InvalidFlags(void) {
7839 DWORD i;
7841 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
7842 HRESULT hr;
7843 IUri *uri = (void*) 0xdeadbeef;
7845 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7846 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7847 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7848 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7852 static void test_CreateUri_InvalidArgs(void) {
7853 HRESULT hr;
7854 IUri *uri = (void*) 0xdeadbeef;
7856 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7857 static const WCHAR emptyW[] = {0};
7859 hr = pCreateUri(http_urlW, 0, 0, NULL);
7860 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7862 hr = pCreateUri(NULL, 0, 0, &uri);
7863 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7864 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7866 uri = (void*) 0xdeadbeef;
7867 hr = pCreateUri(invalidW, 0, 0, &uri);
7868 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7869 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7871 uri = (void*) 0xdeadbeef;
7872 hr = pCreateUri(emptyW, 0, 0, &uri);
7873 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7874 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7877 static void test_CreateUri_InvalidUri(void) {
7878 DWORD i;
7880 for(i = 0; i < ARRAY_SIZE(invalid_uri_tests); ++i) {
7881 invalid_uri test = invalid_uri_tests[i];
7882 IUri *uri = NULL;
7883 LPWSTR uriW;
7884 HRESULT hr;
7886 uriW = a2w(test.uri);
7887 hr = pCreateUri(uriW, test.flags, 0, &uri);
7888 todo_wine_if(test.todo)
7889 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7890 hr, E_INVALIDARG, i);
7891 if(uri) IUri_Release(uri);
7893 heap_free(uriW);
7897 static void test_IUri_GetPropertyBSTR(void) {
7898 IUri *uri = NULL;
7899 HRESULT hr;
7900 DWORD i;
7902 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7903 hr = pCreateUri(http_urlW, 0, 0, &uri);
7904 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7905 if(SUCCEEDED(hr)) {
7906 BSTR received = NULL;
7908 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7909 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7911 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7912 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7913 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
7914 if(SUCCEEDED(hr)) {
7915 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7916 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7917 SysFreeString(received);
7918 }else {
7919 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7922 /* Make sure it handles the ZONE property correctly. */
7923 received = NULL;
7924 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7925 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7926 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7927 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7928 SysFreeString(received);
7930 if(uri) IUri_Release(uri);
7932 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
7933 uri_properties test = uri_tests[i];
7934 LPWSTR uriW;
7935 uri = NULL;
7937 uriW = a2w(test.uri);
7938 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7939 todo_wine_if(test.create_todo)
7940 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7941 hr, test.create_expected, i);
7943 if(SUCCEEDED(hr)) {
7944 DWORD j;
7946 /* Checks all the string properties of the uri. */
7947 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7948 BSTR received = NULL;
7949 uri_str_property prop = test.str_props[j];
7951 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7952 todo_wine_if(prop.todo) {
7953 ok(hr == prop.expected ||
7954 (prop.value2 && hr == prop.expected2),
7955 "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7956 hr, prop.expected, i, j);
7957 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)) ||
7958 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7959 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7960 prop.value, wine_dbgstr_w(received), i, j);
7963 SysFreeString(received);
7967 if(uri) IUri_Release(uri);
7969 heap_free(uriW);
7973 static void test_IUri_GetPropertyDWORD(void) {
7974 IUri *uri = NULL;
7975 HRESULT hr;
7976 DWORD i;
7978 hr = pCreateUri(http_urlW, 0, 0, &uri);
7979 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7980 if(SUCCEEDED(hr)) {
7981 DWORD received = 0xdeadbeef;
7983 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7984 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7986 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7987 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7988 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7990 if(uri) IUri_Release(uri);
7992 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
7993 uri_properties test = uri_tests[i];
7994 LPWSTR uriW;
7995 uri = NULL;
7997 uriW = a2w(test.uri);
7998 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7999 todo_wine_if(test.create_todo)
8000 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
8001 hr, test.create_expected, i);
8003 if(SUCCEEDED(hr)) {
8004 DWORD j;
8006 /* Checks all the DWORD properties of the uri. */
8007 for(j = 0; j < ARRAY_SIZE(test.dword_props); ++j) {
8008 DWORD received;
8009 uri_dword_property prop = test.dword_props[j];
8011 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
8012 todo_wine_if(prop.todo) {
8013 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
8014 hr, prop.expected, i, j);
8015 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
8016 prop.value, received, i, j);
8021 if(uri) IUri_Release(uri);
8023 heap_free(uriW);
8027 /* Tests all the 'Get*' property functions which deal with strings. */
8028 static void test_IUri_GetStrProperties(void) {
8029 IUri *uri = NULL;
8030 HRESULT hr;
8031 DWORD i;
8033 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
8034 hr = pCreateUri(http_urlW, 0, 0, &uri);
8035 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8036 if(SUCCEEDED(hr)) {
8037 hr = IUri_GetAbsoluteUri(uri, NULL);
8038 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8040 hr = IUri_GetAuthority(uri, NULL);
8041 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8043 hr = IUri_GetDisplayUri(uri, NULL);
8044 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8046 hr = IUri_GetDomain(uri, NULL);
8047 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8049 hr = IUri_GetExtension(uri, NULL);
8050 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8052 hr = IUri_GetFragment(uri, NULL);
8053 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8055 hr = IUri_GetHost(uri, NULL);
8056 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8058 hr = IUri_GetPassword(uri, NULL);
8059 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8061 hr = IUri_GetPath(uri, NULL);
8062 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8064 hr = IUri_GetPathAndQuery(uri, NULL);
8065 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8067 hr = IUri_GetQuery(uri, NULL);
8068 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8070 hr = IUri_GetRawUri(uri, NULL);
8071 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8073 hr = IUri_GetSchemeName(uri, NULL);
8074 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8076 hr = IUri_GetUserInfo(uri, NULL);
8077 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8079 hr = IUri_GetUserName(uri, NULL);
8080 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8082 if(uri) IUri_Release(uri);
8084 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8085 uri_properties test = uri_tests[i];
8086 LPWSTR uriW;
8087 uri = NULL;
8089 uriW = a2w(test.uri);
8090 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8091 todo_wine_if(test.create_todo)
8092 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8093 hr, test.create_expected, i);
8095 if(SUCCEEDED(hr)) {
8096 uri_str_property prop;
8097 BSTR received = NULL;
8099 /* GetAbsoluteUri() tests. */
8100 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
8101 hr = IUri_GetAbsoluteUri(uri, &received);
8102 todo_wine_if(prop.todo) {
8103 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8104 hr, prop.expected, i);
8105 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
8106 "Error: Expected %s but got %s on uri_tests[%d].\n",
8107 prop.value, wine_dbgstr_w(received), i);
8109 SysFreeString(received);
8110 received = NULL;
8112 /* GetAuthority() tests. */
8113 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
8114 hr = IUri_GetAuthority(uri, &received);
8115 todo_wine_if(prop.todo) {
8116 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8117 hr, prop.expected, i);
8118 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8119 prop.value, wine_dbgstr_w(received), i);
8121 SysFreeString(received);
8122 received = NULL;
8124 /* GetDisplayUri() tests. */
8125 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
8126 hr = IUri_GetDisplayUri(uri, &received);
8127 todo_wine_if(prop.todo) {
8128 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8129 hr, prop.expected, i);
8130 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
8131 "Error: Expected %s but got %s on uri_tests[%d].\n",
8132 prop.value, wine_dbgstr_w(received), i);
8134 SysFreeString(received);
8135 received = NULL;
8137 /* GetDomain() tests. */
8138 prop = test.str_props[Uri_PROPERTY_DOMAIN];
8139 hr = IUri_GetDomain(uri, &received);
8140 todo_wine_if(prop.todo) {
8141 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8142 "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8143 hr, prop.expected, i);
8144 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)),
8145 "Error: Expected %s but got %s on uri_tests[%d].\n",
8146 prop.value, wine_dbgstr_w(received), i);
8148 SysFreeString(received);
8149 received = NULL;
8151 /* GetExtension() tests. */
8152 prop = test.str_props[Uri_PROPERTY_EXTENSION];
8153 hr = IUri_GetExtension(uri, &received);
8154 todo_wine_if(prop.todo) {
8155 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8156 hr, prop.expected, i);
8157 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8158 prop.value, wine_dbgstr_w(received), i);
8160 SysFreeString(received);
8161 received = NULL;
8163 /* GetFragment() tests. */
8164 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
8165 hr = IUri_GetFragment(uri, &received);
8166 todo_wine_if(prop.todo) {
8167 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8168 hr, prop.expected, i);
8169 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8170 prop.value, wine_dbgstr_w(received), i);
8172 SysFreeString(received);
8173 received = NULL;
8175 /* GetHost() tests. */
8176 prop = test.str_props[Uri_PROPERTY_HOST];
8177 hr = IUri_GetHost(uri, &received);
8178 todo_wine_if(prop.todo) {
8179 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8180 hr, prop.expected, i);
8181 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8182 prop.value, wine_dbgstr_w(received), i);
8184 SysFreeString(received);
8185 received = NULL;
8187 /* GetPassword() tests. */
8188 prop = test.str_props[Uri_PROPERTY_PASSWORD];
8189 hr = IUri_GetPassword(uri, &received);
8190 todo_wine_if(prop.todo) {
8191 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8192 hr, prop.expected, i);
8193 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8194 prop.value, wine_dbgstr_w(received), i);
8196 SysFreeString(received);
8197 received = NULL;
8199 /* GetPath() tests. */
8200 prop = test.str_props[Uri_PROPERTY_PATH];
8201 hr = IUri_GetPath(uri, &received);
8202 todo_wine_if(prop.todo) {
8203 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8204 hr, prop.expected, i);
8205 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8206 prop.value, wine_dbgstr_w(received), i);
8208 SysFreeString(received);
8209 received = NULL;
8211 /* GetPathAndQuery() tests. */
8212 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
8213 hr = IUri_GetPathAndQuery(uri, &received);
8214 todo_wine_if(prop.todo) {
8215 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8216 hr, prop.expected, i);
8217 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8218 prop.value, wine_dbgstr_w(received), i);
8220 SysFreeString(received);
8221 received = NULL;
8223 /* GetQuery() tests. */
8224 prop = test.str_props[Uri_PROPERTY_QUERY];
8225 hr = IUri_GetQuery(uri, &received);
8226 todo_wine_if(prop.todo) {
8227 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8228 hr, prop.expected, i);
8229 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8230 prop.value, wine_dbgstr_w(received), i);
8232 SysFreeString(received);
8233 received = NULL;
8235 /* GetRawUri() tests. */
8236 prop = test.str_props[Uri_PROPERTY_RAW_URI];
8237 hr = IUri_GetRawUri(uri, &received);
8238 todo_wine_if(prop.todo) {
8239 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8240 hr, prop.expected, i);
8241 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8242 prop.value, wine_dbgstr_w(received), i);
8244 SysFreeString(received);
8245 received = NULL;
8247 /* GetSchemeName() tests. */
8248 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
8249 hr = IUri_GetSchemeName(uri, &received);
8250 todo_wine_if(prop.todo) {
8251 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8252 hr, prop.expected, i);
8253 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8254 prop.value, wine_dbgstr_w(received), i);
8256 SysFreeString(received);
8257 received = NULL;
8259 /* GetUserInfo() tests. */
8260 prop = test.str_props[Uri_PROPERTY_USER_INFO];
8261 hr = IUri_GetUserInfo(uri, &received);
8262 todo_wine_if(prop.todo) {
8263 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8264 hr, prop.expected, i);
8265 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8266 prop.value, wine_dbgstr_w(received), i);
8268 SysFreeString(received);
8269 received = NULL;
8271 /* GetUserName() tests. */
8272 prop = test.str_props[Uri_PROPERTY_USER_NAME];
8273 hr = IUri_GetUserName(uri, &received);
8274 todo_wine_if(prop.todo) {
8275 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8276 hr, prop.expected, i);
8277 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8278 prop.value, wine_dbgstr_w(received), i);
8280 SysFreeString(received);
8283 if(uri) IUri_Release(uri);
8285 heap_free(uriW);
8289 static void test_IUri_GetDwordProperties(void) {
8290 IUri *uri = NULL;
8291 HRESULT hr;
8292 DWORD i;
8294 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8295 hr = pCreateUri(http_urlW, 0, 0, &uri);
8296 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8297 if(SUCCEEDED(hr)) {
8298 hr = IUri_GetHostType(uri, NULL);
8299 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8301 hr = IUri_GetPort(uri, NULL);
8302 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8304 hr = IUri_GetScheme(uri, NULL);
8305 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8307 hr = IUri_GetZone(uri, NULL);
8308 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8310 if(uri) IUri_Release(uri);
8312 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8313 uri_properties test = uri_tests[i];
8314 LPWSTR uriW;
8315 uri = NULL;
8317 uriW = a2w(test.uri);
8318 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8319 todo_wine_if(test.create_todo)
8320 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8321 hr, test.create_expected, i);
8323 if(SUCCEEDED(hr)) {
8324 uri_dword_property prop;
8325 DWORD received;
8327 /* Assign an insane value so tests don't accidentally pass when
8328 * they shouldn't!
8330 received = -9999999;
8332 /* GetHostType() tests. */
8333 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8334 hr = IUri_GetHostType(uri, &received);
8335 todo_wine_if(prop.todo) {
8336 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8337 hr, prop.expected, i);
8338 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8340 received = -9999999;
8342 /* GetPort() tests. */
8343 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8344 hr = IUri_GetPort(uri, &received);
8345 todo_wine_if(prop.todo) {
8346 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8347 hr, prop.expected, i);
8348 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8350 received = -9999999;
8352 /* GetScheme() tests. */
8353 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8354 hr = IUri_GetScheme(uri, &received);
8355 todo_wine_if(prop.todo) {
8356 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8357 hr, prop.expected, i);
8358 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8360 received = -9999999;
8362 /* GetZone() tests. */
8363 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8364 hr = IUri_GetZone(uri, &received);
8365 todo_wine_if(prop.todo) {
8366 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8367 hr, prop.expected, i);
8368 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8372 if(uri) IUri_Release(uri);
8374 heap_free(uriW);
8378 static void test_IUri_GetPropertyLength(void) {
8379 IUri *uri = NULL;
8380 HRESULT hr;
8381 DWORD i;
8383 /* Make sure it handles invalid args correctly. */
8384 hr = pCreateUri(http_urlW, 0, 0, &uri);
8385 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8386 if(SUCCEEDED(hr)) {
8387 DWORD received = 0xdeadbeef;
8389 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8390 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8392 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8393 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8394 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8396 if(uri) IUri_Release(uri);
8398 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8399 uri_properties test = uri_tests[i];
8400 LPWSTR uriW;
8401 uri = NULL;
8403 uriW = a2w(test.uri);
8404 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8405 todo_wine_if(test.create_todo)
8406 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8407 hr, test.create_expected, i);
8409 if(SUCCEEDED(hr)) {
8410 DWORD j;
8412 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8413 DWORD expectedLen, receivedLen;
8414 uri_str_property prop = test.str_props[j];
8415 LPWSTR expectedValueW;
8417 expectedLen = lstrlenA(prop.value);
8418 /* Value may be unicode encoded */
8419 expectedValueW = a2w(prop.value);
8420 expectedLen = lstrlenW(expectedValueW);
8421 heap_free(expectedValueW);
8423 /* This won't be necessary once GetPropertyLength is implemented. */
8424 receivedLen = -1;
8426 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8427 todo_wine_if(prop.todo) {
8428 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8429 "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8430 hr, prop.expected, i, j);
8431 ok(receivedLen == expectedLen || (prop.value2 && receivedLen == lstrlenA(prop.value2)) ||
8432 broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8433 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8434 expectedLen, receivedLen, i, j);
8439 if(uri) IUri_Release(uri);
8441 heap_free(uriW);
8445 static DWORD compute_expected_props(uri_properties *test, DWORD *mask)
8447 DWORD ret = 0, i;
8449 *mask = 0;
8451 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8452 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8453 ret |= 1<<i;
8454 if(test->str_props[i-Uri_PROPERTY_STRING_START].value2 == NULL ||
8455 test->str_props[i-Uri_PROPERTY_STRING_START].expected ==
8456 test->str_props[i-Uri_PROPERTY_STRING_START].expected2)
8457 *mask |= 1<<i;
8460 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8461 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8462 ret |= 1<<i;
8463 *mask |= 1<<i;
8466 return ret;
8469 static void test_IUri_GetProperties(void) {
8470 IUri *uri = NULL;
8471 HRESULT hr;
8472 DWORD i;
8474 hr = pCreateUri(http_urlW, 0, 0, &uri);
8475 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8476 if(SUCCEEDED(hr)) {
8477 hr = IUri_GetProperties(uri, NULL);
8478 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8480 if(uri) IUri_Release(uri);
8482 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8483 uri_properties test = uri_tests[i];
8484 LPWSTR uriW;
8485 uri = NULL;
8487 uriW = a2w(test.uri);
8488 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8489 todo_wine_if(test.create_todo)
8490 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8492 if(SUCCEEDED(hr)) {
8493 DWORD received = 0, expected_props, mask;
8494 DWORD j;
8496 hr = IUri_GetProperties(uri, &received);
8497 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8499 expected_props = compute_expected_props(&test, &mask);
8501 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8502 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8503 if(mask & (1 << j)) {
8504 if(expected_props & (1 << j))
8505 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8506 else
8507 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8512 if(uri) IUri_Release(uri);
8514 heap_free(uriW);
8518 static void test_IUri_HasProperty(void) {
8519 IUri *uri = NULL;
8520 HRESULT hr;
8521 DWORD i;
8523 hr = pCreateUri(http_urlW, 0, 0, &uri);
8524 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8525 if(SUCCEEDED(hr)) {
8526 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8527 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8529 if(uri) IUri_Release(uri);
8531 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8532 uri_properties test = uri_tests[i];
8533 LPWSTR uriW;
8534 uri = NULL;
8536 uriW = a2w(test.uri);
8538 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8539 todo_wine_if(test.create_todo)
8540 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8542 if(SUCCEEDED(hr)) {
8543 DWORD expected_props, j, mask;
8545 expected_props = compute_expected_props(&test, &mask);
8547 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8548 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8549 BOOL received = -1;
8551 hr = IUri_HasProperty(uri, j, &received);
8552 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8553 hr, S_OK, j, i);
8555 if(mask & (1 << j)) {
8556 if(expected_props & (1 << j)) {
8557 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8558 } else {
8559 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8565 if(uri) IUri_Release(uri);
8567 heap_free(uriW);
8571 struct custom_uri {
8572 IUri IUri_iface;
8573 IUri *uri;
8576 static inline struct custom_uri* impl_from_IUri(IUri *iface)
8578 return CONTAINING_RECORD(iface, struct custom_uri, IUri_iface);
8581 static HRESULT WINAPI custom_uri_QueryInterface(IUri *iface, REFIID iid, void **out)
8583 if (IsEqualIID(iid, &IID_IUri) || IsEqualIID(iid, &IID_IUnknown))
8585 *out = iface;
8586 IUri_AddRef(iface);
8587 return S_OK;
8590 *out = NULL;
8591 return E_NOINTERFACE;
8594 static ULONG WINAPI custom_uri_AddRef(IUri *iface)
8596 struct custom_uri *uri = impl_from_IUri(iface);
8597 return IUri_AddRef(uri->uri);
8600 static ULONG WINAPI custom_uri_Release(IUri *iface)
8602 struct custom_uri *uri = impl_from_IUri(iface);
8603 return IUri_Release(uri->uri);
8606 static HRESULT WINAPI custom_uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY property, BSTR *value, DWORD flags)
8608 struct custom_uri *uri = impl_from_IUri(iface);
8609 return IUri_GetPropertyBSTR(uri->uri, property, value, flags);
8612 static HRESULT WINAPI custom_uri_GetPropertyLength(IUri *iface, Uri_PROPERTY property, DWORD *length, DWORD flags)
8614 struct custom_uri *uri = impl_from_IUri(iface);
8615 return IUri_GetPropertyLength(uri->uri, property, length, flags);
8618 static HRESULT WINAPI custom_uri_GetPropertyDWORD(IUri *iface, Uri_PROPERTY property, DWORD *value, DWORD flags)
8620 struct custom_uri *uri = impl_from_IUri(iface);
8621 return IUri_GetPropertyDWORD(uri->uri, property, value, flags);
8624 static HRESULT WINAPI custom_uri_HasProperty(IUri *iface, Uri_PROPERTY property, BOOL *has_property)
8626 struct custom_uri *uri = impl_from_IUri(iface);
8627 return IUri_HasProperty(uri->uri, property, has_property);
8630 static HRESULT WINAPI custom_uri_GetAbsoluteUri(IUri *iface, BSTR *value)
8632 struct custom_uri *uri = impl_from_IUri(iface);
8633 return IUri_GetAbsoluteUri(uri->uri, value);
8636 static HRESULT WINAPI custom_uri_GetAuthority(IUri *iface, BSTR *value)
8638 struct custom_uri *uri = impl_from_IUri(iface);
8639 return IUri_GetAbsoluteUri(uri->uri, value);
8642 static HRESULT WINAPI custom_uri_GetDisplayUri(IUri *iface, BSTR *value)
8644 struct custom_uri *uri = impl_from_IUri(iface);
8645 return IUri_GetAbsoluteUri(uri->uri, value);
8648 static HRESULT WINAPI custom_uri_GetDomain(IUri *iface, BSTR *value)
8650 struct custom_uri *uri = impl_from_IUri(iface);
8651 return IUri_GetAbsoluteUri(uri->uri, value);
8654 static HRESULT WINAPI custom_uri_GetExtension(IUri *iface, BSTR *value)
8656 struct custom_uri *uri = impl_from_IUri(iface);
8657 return IUri_GetAbsoluteUri(uri->uri, value);
8660 static HRESULT WINAPI custom_uri_GetFragment(IUri *iface, BSTR *value)
8662 struct custom_uri *uri = impl_from_IUri(iface);
8663 return IUri_GetAbsoluteUri(uri->uri, value);
8666 static HRESULT WINAPI custom_uri_GetHost(IUri *iface, BSTR *value)
8668 struct custom_uri *uri = impl_from_IUri(iface);
8669 return IUri_GetAbsoluteUri(uri->uri, value);
8672 static HRESULT WINAPI custom_uri_GetPassword(IUri *iface, BSTR *value)
8674 struct custom_uri *uri = impl_from_IUri(iface);
8675 return IUri_GetAbsoluteUri(uri->uri, value);
8678 static HRESULT WINAPI custom_uri_GetPath(IUri *iface, BSTR *value)
8680 struct custom_uri *uri = impl_from_IUri(iface);
8681 return IUri_GetAbsoluteUri(uri->uri, value);
8684 static HRESULT WINAPI custom_uri_GetPathAndQuery(IUri *iface, BSTR *value)
8686 struct custom_uri *uri = impl_from_IUri(iface);
8687 return IUri_GetAbsoluteUri(uri->uri, value);
8690 static HRESULT WINAPI custom_uri_GetQuery(IUri *iface, BSTR *value)
8692 struct custom_uri *uri = impl_from_IUri(iface);
8693 return IUri_GetAbsoluteUri(uri->uri, value);
8696 static HRESULT WINAPI custom_uri_GetRawUri(IUri *iface, BSTR *value)
8698 struct custom_uri *uri = impl_from_IUri(iface);
8699 return IUri_GetAbsoluteUri(uri->uri, value);
8702 static HRESULT WINAPI custom_uri_GetSchemeName(IUri *iface, BSTR *value)
8704 struct custom_uri *uri = impl_from_IUri(iface);
8705 return IUri_GetSchemeName(uri->uri, value);
8708 static HRESULT WINAPI custom_uri_GetUserInfo(IUri *iface, BSTR *value)
8710 struct custom_uri *uri = impl_from_IUri(iface);
8711 return IUri_GetUserInfo(uri->uri, value);
8714 static HRESULT WINAPI custom_uri_GetUserName(IUri *iface, BSTR *value)
8716 struct custom_uri *uri = impl_from_IUri(iface);
8717 return IUri_GetUserName(uri->uri, value);
8720 static HRESULT WINAPI custom_uri_GetHostType(IUri *iface, DWORD *value)
8722 struct custom_uri *uri = impl_from_IUri(iface);
8723 return IUri_GetHostType(uri->uri, value);
8726 static HRESULT WINAPI custom_uri_GetPort(IUri *iface, DWORD *value)
8728 struct custom_uri *uri = impl_from_IUri(iface);
8729 return IUri_GetPort(uri->uri, value);
8732 static HRESULT WINAPI custom_uri_GetScheme(IUri *iface, DWORD *value)
8734 struct custom_uri *uri = impl_from_IUri(iface);
8735 return IUri_GetScheme(uri->uri, value);
8738 static HRESULT WINAPI custom_uri_GetZone(IUri *iface, DWORD *value)
8740 struct custom_uri *uri = impl_from_IUri(iface);
8741 return IUri_GetZone(uri->uri, value);
8744 static HRESULT WINAPI custom_uri_GetProperties(IUri *iface, DWORD *flags)
8746 struct custom_uri *uri = impl_from_IUri(iface);
8747 return IUri_GetProperties(uri->uri, flags);
8750 static HRESULT WINAPI custom_uri_IsEqual(IUri *iface, IUri *pUri, BOOL *is_equal)
8752 struct custom_uri *uri = impl_from_IUri(iface);
8753 return IUri_IsEqual(uri->uri, pUri, is_equal);
8756 static const IUriVtbl custom_uri_vtbl =
8758 custom_uri_QueryInterface,
8759 custom_uri_AddRef,
8760 custom_uri_Release,
8761 custom_uri_GetPropertyBSTR,
8762 custom_uri_GetPropertyLength,
8763 custom_uri_GetPropertyDWORD,
8764 custom_uri_HasProperty,
8765 custom_uri_GetAbsoluteUri,
8766 custom_uri_GetAuthority,
8767 custom_uri_GetDisplayUri,
8768 custom_uri_GetDomain,
8769 custom_uri_GetExtension,
8770 custom_uri_GetFragment,
8771 custom_uri_GetHost,
8772 custom_uri_GetPassword,
8773 custom_uri_GetPath,
8774 custom_uri_GetPathAndQuery,
8775 custom_uri_GetQuery,
8776 custom_uri_GetRawUri,
8777 custom_uri_GetSchemeName,
8778 custom_uri_GetUserInfo,
8779 custom_uri_GetUserName,
8780 custom_uri_GetHostType,
8781 custom_uri_GetPort,
8782 custom_uri_GetScheme,
8783 custom_uri_GetZone,
8784 custom_uri_GetProperties,
8785 custom_uri_IsEqual,
8788 static void test_IUri_IsEqual(void) {
8789 struct custom_uri custom_uri;
8790 IUri *uriA, *uriB;
8791 BOOL equal;
8792 HRESULT hres;
8793 DWORD i;
8795 uriA = uriB = NULL;
8797 /* Make sure IsEqual handles invalid args correctly. */
8798 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8799 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8800 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8801 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8803 equal = -1;
8804 hres = IUri_IsEqual(uriA, NULL, &equal);
8805 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8806 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8808 hres = IUri_IsEqual(uriA, uriB, NULL);
8809 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8811 equal = FALSE;
8812 hres = IUri_IsEqual(uriA, uriA, &equal);
8813 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8814 ok(equal, "Error: Expected equal URIs.\n");
8816 equal = FALSE;
8817 hres = IUri_IsEqual(uriA, uriB, &equal);
8818 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8819 ok(equal, "Error: Expected equal URIs.\n");
8821 IUri_Release(uriA);
8822 IUri_Release(uriB);
8824 custom_uri.IUri_iface.lpVtbl = &custom_uri_vtbl;
8826 for(i = 0; i < ARRAY_SIZE(equality_tests); ++i) {
8827 uri_equality test = equality_tests[i];
8828 LPWSTR uriA_W, uriB_W;
8830 uriA = uriB = NULL;
8832 uriA_W = a2w(test.a);
8833 uriB_W = a2w(test.b);
8835 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8836 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8838 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8839 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8841 equal = -1;
8842 hres = IUri_IsEqual(uriA, uriB, &equal);
8843 todo_wine_if(test.todo) {
8844 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8845 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8848 custom_uri.uri = uriB;
8850 equal = -1;
8851 hres = IUri_IsEqual(uriA, &custom_uri.IUri_iface, &equal);
8852 todo_wine {
8853 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8854 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8857 if(uriA) IUri_Release(uriA);
8858 if(uriB) IUri_Release(uriB);
8860 heap_free(uriA_W);
8861 heap_free(uriB_W);
8865 static void test_CreateUriWithFragment_InvalidArgs(void) {
8866 HRESULT hr;
8867 IUri *uri = (void*) 0xdeadbeef;
8868 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8870 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8871 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8872 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8874 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8875 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8877 /* Original URI can't already contain a fragment component. */
8878 uri = (void*) 0xdeadbeef;
8879 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8880 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8881 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8884 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8885 static void test_CreateUriWithFragment_InvalidFlags(void) {
8886 DWORD i;
8888 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
8889 HRESULT hr;
8890 IUri *uri = (void*) 0xdeadbeef;
8892 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8893 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8894 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8895 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8899 static void test_CreateUriWithFragment(void) {
8900 DWORD i;
8902 for(i = 0; i < ARRAY_SIZE(uri_fragment_tests); ++i) {
8903 HRESULT hr;
8904 IUri *uri = NULL;
8905 LPWSTR uriW, fragW;
8906 uri_with_fragment test = uri_fragment_tests[i];
8908 uriW = a2w(test.uri);
8909 fragW = a2w(test.fragment);
8911 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8912 todo_wine_if(test.expected_todo)
8913 ok(hr == test.create_expected,
8914 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8915 hr, test.create_expected, i);
8917 if(SUCCEEDED(hr)) {
8918 BSTR received = NULL;
8920 hr = IUri_GetAbsoluteUri(uri, &received);
8921 todo_wine_if(test.expected_todo) {
8922 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8923 hr, S_OK, i);
8924 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8925 test.expected_uri, wine_dbgstr_w(received), i);
8928 SysFreeString(received);
8931 if(uri) IUri_Release(uri);
8932 heap_free(uriW);
8933 heap_free(fragW);
8937 static void test_CreateIUriBuilder(void) {
8938 HRESULT hr;
8939 IUriBuilder *builder = NULL;
8940 IUri *uri;
8942 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8943 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8944 hr, E_POINTER);
8946 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8947 hr = pCreateUri(http_urlW, 0, 0, &uri);
8948 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8949 if(SUCCEEDED(hr)) {
8950 ULONG cur_count, orig_count;
8952 orig_count = get_refcnt(uri);
8953 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8954 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8955 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8957 cur_count = get_refcnt(uri);
8958 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8960 if(builder) IUriBuilder_Release(builder);
8961 cur_count = get_refcnt(uri);
8962 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8964 if(uri) IUri_Release(uri);
8967 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8968 DWORD test_index) {
8969 HRESULT hr;
8970 IUri *uri = NULL;
8972 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8973 todo_wine_if(test->uri_todo)
8974 ok(hr == test->uri_hres,
8975 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8976 hr, test->uri_hres, test_index);
8978 if(SUCCEEDED(hr)) {
8979 DWORD i;
8981 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
8982 uri_builder_str_property prop = test->expected_str_props[i];
8983 BSTR received = NULL;
8985 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8986 todo_wine_if(prop.todo)
8987 ok(hr == prop.result,
8988 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8989 hr, prop.result, test_index, i);
8990 if(SUCCEEDED(hr)) {
8991 todo_wine_if(prop.todo)
8992 ok(!strcmp_aw(prop.expected, received),
8993 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8994 prop.expected, wine_dbgstr_w(received), test_index, i);
8996 SysFreeString(received);
8999 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9000 uri_builder_dword_property prop = test->expected_dword_props[i];
9001 DWORD received = -2;
9003 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9004 todo_wine_if(prop.todo)
9005 ok(hr == prop.result,
9006 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
9007 hr, prop.result, test_index, i);
9008 if(SUCCEEDED(hr)) {
9009 todo_wine_if(prop.todo)
9010 ok(received == prop.expected,
9011 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
9012 prop.expected, received, test_index, i);
9016 if(uri) IUri_Release(uri);
9019 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
9020 DWORD test_index) {
9021 HRESULT hr;
9022 IUri *uri = NULL;
9024 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
9025 todo_wine_if(test->uri_simple_todo)
9026 ok(hr == test->uri_simple_hres,
9027 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9028 hr, test->uri_simple_hres, test_index);
9030 if(SUCCEEDED(hr)) {
9031 DWORD i;
9033 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
9034 uri_builder_str_property prop = test->expected_str_props[i];
9035 BSTR received = NULL;
9037 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
9038 todo_wine_if(prop.todo)
9039 ok(hr == prop.result,
9040 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
9041 hr, prop.result, test_index, i);
9042 if(SUCCEEDED(hr)) {
9043 todo_wine_if(prop.todo)
9044 ok(!strcmp_aw(prop.expected, received),
9045 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
9046 prop.expected, wine_dbgstr_w(received), test_index, i);
9048 SysFreeString(received);
9051 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9052 uri_builder_dword_property prop = test->expected_dword_props[i];
9053 DWORD received = -2;
9055 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9056 todo_wine_if(prop.todo)
9057 ok(hr == prop.result,
9058 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
9059 hr, prop.result, test_index, i);
9060 if(SUCCEEDED(hr)) {
9061 todo_wine_if(prop.todo)
9062 ok(received == prop.expected,
9063 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
9064 prop.expected, received, test_index, i);
9068 if(uri) IUri_Release(uri);
9071 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
9072 DWORD test_index) {
9073 HRESULT hr;
9074 IUri *uri = NULL;
9076 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
9077 test->uri_with_encode_flags, 0, &uri);
9078 todo_wine_if(test->uri_with_todo)
9079 ok(hr == test->uri_with_hres,
9080 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9081 hr, test->uri_with_hres, test_index);
9083 if(SUCCEEDED(hr)) {
9084 DWORD i;
9086 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
9087 uri_builder_str_property prop = test->expected_str_props[i];
9088 BSTR received = NULL;
9090 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
9091 todo_wine_if(prop.todo)
9092 ok(hr == prop.result,
9093 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
9094 hr, prop.result, test_index, i);
9095 if(SUCCEEDED(hr)) {
9096 todo_wine_if(prop.todo)
9097 ok(!strcmp_aw(prop.expected, received),
9098 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
9099 prop.expected, wine_dbgstr_w(received), test_index, i);
9101 SysFreeString(received);
9104 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9105 uri_builder_dword_property prop = test->expected_dword_props[i];
9106 DWORD received = -2;
9108 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9109 todo_wine_if(prop.todo)
9110 ok(hr == prop.result,
9111 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
9112 hr, prop.result, test_index, i);
9113 if(SUCCEEDED(hr)) {
9114 todo_wine_if(prop.todo)
9115 ok(received == prop.expected,
9116 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
9117 prop.expected, received, test_index, i);
9121 if(uri) IUri_Release(uri);
9124 static void test_IUriBuilder_CreateInvalidArgs(void) {
9125 IUriBuilder *builder;
9126 HRESULT hr;
9128 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9129 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9130 if(SUCCEEDED(hr)) {
9131 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
9133 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
9134 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
9135 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
9137 uri = (void*) 0xdeadbeef;
9138 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9139 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
9140 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
9142 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
9143 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9144 hr, E_POINTER);
9146 uri = (void*) 0xdeadbeef;
9147 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9148 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9149 hr, E_NOTIMPL);
9150 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
9152 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
9153 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9154 hr, E_POINTER);
9156 uri = (void*) 0xdeadbeef;
9157 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9158 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9159 hr, E_NOTIMPL);
9160 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9162 hr = pCreateUri(http_urlW, 0, 0, &test);
9163 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9164 if(SUCCEEDED(hr)) {
9165 hr = IUriBuilder_SetIUri(builder, test);
9166 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9168 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
9169 uri = NULL;
9170 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9171 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9172 ok(uri != NULL, "Error: The uri was NULL.\n");
9173 if(uri) IUri_Release(uri);
9175 uri = NULL;
9176 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9177 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9178 hr, S_OK);
9179 ok(uri != NULL, "Error: uri was NULL.\n");
9180 if(uri) IUri_Release(uri);
9182 uri = NULL;
9183 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
9184 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9185 hr, S_OK);
9186 ok(uri != NULL, "Error: uri was NULL.\n");
9187 if(uri) IUri_Release(uri);
9189 hr = IUriBuilder_SetFragment(builder, NULL);
9190 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9192 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
9193 uri = (void*) 0xdeadbeef;
9194 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9195 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9196 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
9198 uri = (void*) 0xdeadbeef;
9199 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9200 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9201 hr, S_OK);
9202 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9204 uri = (void*) 0xdeadbeef;
9205 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9206 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9207 hr, E_NOTIMPL);
9208 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9210 if(test) IUri_Release(test);
9212 if(builder) IUriBuilder_Release(builder);
9215 /* Tests invalid args to the "Get*" functions. */
9216 static void test_IUriBuilder_GetInvalidArgs(void) {
9217 IUriBuilder *builder = NULL;
9218 HRESULT hr;
9220 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9221 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9222 if(SUCCEEDED(hr)) {
9223 LPCWSTR received = (void*) 0xdeadbeef;
9224 DWORD len = -1, port = -1;
9225 BOOL set = -1;
9227 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
9228 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9229 hr, E_POINTER);
9230 hr = IUriBuilder_GetFragment(builder, NULL, &received);
9231 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9232 hr, E_POINTER);
9233 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9234 hr = IUriBuilder_GetFragment(builder, &len, NULL);
9235 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9236 hr, E_POINTER);
9237 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9239 hr = IUriBuilder_GetHost(builder, NULL, NULL);
9240 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9241 hr, E_POINTER);
9242 received = (void*) 0xdeadbeef;
9243 hr = IUriBuilder_GetHost(builder, NULL, &received);
9244 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9245 hr, E_POINTER);
9246 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9247 len = -1;
9248 hr = IUriBuilder_GetHost(builder, &len, NULL);
9249 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9250 hr, E_POINTER);
9251 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9253 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
9254 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9255 hr, E_POINTER);
9256 received = (void*) 0xdeadbeef;
9257 hr = IUriBuilder_GetPassword(builder, NULL, &received);
9258 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9259 hr, E_POINTER);
9260 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9261 len = -1;
9262 hr = IUriBuilder_GetPassword(builder, &len, NULL);
9263 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9264 hr, E_POINTER);
9265 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9267 hr = IUriBuilder_GetPath(builder, NULL, NULL);
9268 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9269 hr, E_POINTER);
9270 received = (void*) 0xdeadbeef;
9271 hr = IUriBuilder_GetPath(builder, NULL, &received);
9272 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9273 hr, E_POINTER);
9274 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9275 len = -1;
9276 hr = IUriBuilder_GetPath(builder, &len, NULL);
9277 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9278 hr, E_POINTER);
9279 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9281 hr = IUriBuilder_GetPort(builder, NULL, NULL);
9282 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9283 hr, E_POINTER);
9284 hr = IUriBuilder_GetPort(builder, NULL, &port);
9285 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9286 hr, E_POINTER);
9287 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
9288 hr = IUriBuilder_GetPort(builder, &set, NULL);
9289 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9290 hr, E_POINTER);
9291 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
9293 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
9294 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9295 hr, E_POINTER);
9296 received = (void*) 0xdeadbeef;
9297 hr = IUriBuilder_GetQuery(builder, NULL, &received);
9298 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9299 hr, E_POINTER);
9300 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9301 len = -1;
9302 hr = IUriBuilder_GetQuery(builder, &len, NULL);
9303 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9304 hr, E_POINTER);
9305 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9307 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
9308 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9309 hr, E_POINTER);
9310 received = (void*) 0xdeadbeef;
9311 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
9312 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9313 hr, E_POINTER);
9314 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9315 len = -1;
9316 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
9317 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9318 hr, E_POINTER);
9319 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9321 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
9322 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9323 hr, E_POINTER);
9324 received = (void*) 0xdeadbeef;
9325 hr = IUriBuilder_GetUserName(builder, NULL, &received);
9326 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9327 hr, E_POINTER);
9328 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9329 len = -1;
9330 hr = IUriBuilder_GetUserName(builder, &len, NULL);
9331 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9332 hr, E_POINTER);
9333 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9335 if(builder) IUriBuilder_Release(builder);
9338 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
9339 DWORD test_index) {
9340 HRESULT hr;
9341 DWORD i;
9342 LPCWSTR received = NULL;
9343 DWORD len = -1;
9344 const uri_builder_property *prop = NULL;
9346 /* Check if the property was set earlier. */
9347 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9348 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
9349 prop = &(test->properties[i]);
9352 if(prop) {
9353 /* Use expected_value unless it's NULL, then use value. */
9354 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9355 DWORD expected_len = expected ? strlen(expected) : 0;
9356 hr = IUriBuilder_GetFragment(builder, &len, &received);
9357 todo_wine_if(prop->todo) {
9358 ok(hr == (expected ? S_OK : S_FALSE),
9359 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9360 hr, (expected ? S_OK : S_FALSE), test_index);
9361 if(SUCCEEDED(hr)) {
9362 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9363 expected, wine_dbgstr_w(received), test_index);
9364 ok(expected_len == len,
9365 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9366 expected_len, len, test_index);
9369 } else {
9370 /* The property wasn't set earlier, so it should return whatever
9371 * the base IUri contains (if anything).
9373 IUri *uri = NULL;
9374 hr = IUriBuilder_GetIUri(builder, &uri);
9375 ok(hr == S_OK,
9376 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9377 hr, S_OK, test_index);
9378 if(SUCCEEDED(hr)) {
9379 if(!uri) {
9380 received = (void*) 0xdeadbeef;
9381 len = -1;
9383 hr = IUriBuilder_GetFragment(builder, &len, &received);
9384 ok(hr == S_FALSE,
9385 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9386 hr, S_FALSE, test_index);
9387 if(SUCCEEDED(hr)) {
9388 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9389 len, test_index);
9390 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9391 received, test_index);
9393 } else {
9394 BOOL has_prop = FALSE;
9395 BSTR expected = NULL;
9397 hr = IUri_GetFragment(uri, &expected);
9398 ok(SUCCEEDED(hr),
9399 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9400 hr, test_index);
9401 has_prop = hr == S_OK;
9403 hr = IUriBuilder_GetFragment(builder, &len, &received);
9404 if(has_prop) {
9405 ok(hr == S_OK,
9406 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9407 hr, S_OK, test_index);
9408 if(SUCCEEDED(hr)) {
9409 ok(!lstrcmpW(expected, received),
9410 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9411 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9412 ok(lstrlenW(expected) == len,
9413 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9414 lstrlenW(expected), len, test_index);
9416 } else {
9417 ok(hr == S_FALSE,
9418 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9419 hr, S_FALSE, test_index);
9420 if(SUCCEEDED(hr)) {
9421 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9422 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9423 len, test_index);
9426 SysFreeString(expected);
9429 if(uri) IUri_Release(uri);
9433 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
9434 DWORD test_index) {
9435 HRESULT hr;
9436 DWORD i;
9437 LPCWSTR received = NULL;
9438 DWORD len = -1;
9439 const uri_builder_property *prop = NULL;
9441 /* Check if the property was set earlier. */
9442 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9443 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
9444 prop = &(test->properties[i]);
9447 if(prop) {
9448 /* Use expected_value unless it's NULL, then use value. */
9449 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9450 DWORD expected_len = expected ? strlen(expected) : 0;
9451 hr = IUriBuilder_GetHost(builder, &len, &received);
9452 todo_wine_if(prop->todo) {
9453 ok(hr == (expected ? S_OK : S_FALSE),
9454 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9455 hr, (expected ? S_OK : S_FALSE), test_index);
9456 if(SUCCEEDED(hr)) {
9457 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9458 expected, wine_dbgstr_w(received), test_index);
9459 ok(expected_len == len,
9460 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9461 expected_len, len, test_index);
9464 } else {
9465 /* The property wasn't set earlier, so it should return whatever
9466 * the base IUri contains (if anything).
9468 IUri *uri = NULL;
9469 hr = IUriBuilder_GetIUri(builder, &uri);
9470 ok(hr == S_OK,
9471 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9472 hr, S_OK, test_index);
9473 if(SUCCEEDED(hr)) {
9474 if(!uri) {
9475 received = (void*) 0xdeadbeef;
9476 len = -1;
9478 hr = IUriBuilder_GetHost(builder, &len, &received);
9479 ok(hr == S_FALSE,
9480 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9481 hr, S_FALSE, test_index);
9482 if(SUCCEEDED(hr)) {
9483 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9484 len, test_index);
9485 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9486 received, test_index);
9488 } else {
9489 BOOL has_prop = FALSE;
9490 BSTR expected = NULL;
9492 hr = IUri_GetHost(uri, &expected);
9493 ok(SUCCEEDED(hr),
9494 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9495 hr, test_index);
9496 has_prop = hr == S_OK;
9498 hr = IUriBuilder_GetHost(builder, &len, &received);
9499 if(has_prop) {
9500 ok(hr == S_OK,
9501 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9502 hr, S_OK, test_index);
9503 if(SUCCEEDED(hr)) {
9504 ok(!lstrcmpW(expected, received),
9505 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9506 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9507 ok(lstrlenW(expected) == len,
9508 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9509 lstrlenW(expected), len, test_index);
9511 } else {
9512 ok(hr == S_FALSE,
9513 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9514 hr, S_FALSE, test_index);
9515 if(SUCCEEDED(hr)) {
9516 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9517 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9518 len, test_index);
9521 SysFreeString(expected);
9524 if(uri) IUri_Release(uri);
9528 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
9529 DWORD test_index) {
9530 HRESULT hr;
9531 DWORD i;
9532 LPCWSTR received = NULL;
9533 DWORD len = -1;
9534 const uri_builder_property *prop = NULL;
9536 /* Check if the property was set earlier. */
9537 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9538 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
9539 prop = &(test->properties[i]);
9542 if(prop) {
9543 /* Use expected_value unless it's NULL, then use value. */
9544 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9545 DWORD expected_len = expected ? strlen(expected) : 0;
9546 hr = IUriBuilder_GetPassword(builder, &len, &received);
9547 todo_wine_if(prop->todo) {
9548 ok(hr == (expected ? S_OK : S_FALSE),
9549 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9550 hr, (expected ? S_OK : S_FALSE), test_index);
9551 if(SUCCEEDED(hr)) {
9552 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9553 expected, wine_dbgstr_w(received), test_index);
9554 ok(expected_len == len,
9555 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9556 expected_len, len, test_index);
9559 } else {
9560 /* The property wasn't set earlier, so it should return whatever
9561 * the base IUri contains (if anything).
9563 IUri *uri = NULL;
9564 hr = IUriBuilder_GetIUri(builder, &uri);
9565 ok(hr == S_OK,
9566 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9567 hr, S_OK, test_index);
9568 if(SUCCEEDED(hr)) {
9569 if(!uri) {
9570 received = (void*) 0xdeadbeef;
9571 len = -1;
9573 hr = IUriBuilder_GetPassword(builder, &len, &received);
9574 ok(hr == S_FALSE,
9575 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9576 hr, S_FALSE, test_index);
9577 if(SUCCEEDED(hr)) {
9578 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9579 len, test_index);
9580 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9581 received, test_index);
9583 } else {
9584 BOOL has_prop = FALSE;
9585 BSTR expected = NULL;
9587 hr = IUri_GetPassword(uri, &expected);
9588 ok(SUCCEEDED(hr),
9589 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9590 hr, test_index);
9591 has_prop = hr == S_OK;
9593 hr = IUriBuilder_GetPassword(builder, &len, &received);
9594 if(has_prop) {
9595 ok(hr == S_OK,
9596 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9597 hr, S_OK, test_index);
9598 if(SUCCEEDED(hr)) {
9599 ok(!lstrcmpW(expected, received),
9600 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9601 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9602 ok(lstrlenW(expected) == len,
9603 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9604 lstrlenW(expected), len, test_index);
9606 } else {
9607 ok(hr == S_FALSE,
9608 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9609 hr, S_FALSE, test_index);
9610 if(SUCCEEDED(hr)) {
9611 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9612 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9613 len, test_index);
9616 SysFreeString(expected);
9619 if(uri) IUri_Release(uri);
9623 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9624 DWORD test_index) {
9625 HRESULT hr;
9626 DWORD i;
9627 LPCWSTR received = NULL;
9628 DWORD len = -1;
9629 const uri_builder_property *prop = NULL;
9631 /* Check if the property was set earlier. */
9632 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9633 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9634 prop = &(test->properties[i]);
9637 if(prop) {
9638 /* Use expected_value unless it's NULL, then use value. */
9639 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9640 DWORD expected_len = expected ? strlen(expected) : 0;
9641 hr = IUriBuilder_GetPath(builder, &len, &received);
9642 todo_wine_if(prop->todo) {
9643 ok(hr == (expected ? S_OK : S_FALSE),
9644 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9645 hr, (expected ? S_OK : S_FALSE), test_index);
9646 if(SUCCEEDED(hr)) {
9647 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9648 expected, wine_dbgstr_w(received), test_index);
9649 ok(expected_len == len,
9650 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9651 expected_len, len, test_index);
9654 } else {
9655 /* The property wasn't set earlier, so it should return whatever
9656 * the base IUri contains (if anything).
9658 IUri *uri = NULL;
9659 hr = IUriBuilder_GetIUri(builder, &uri);
9660 ok(hr == S_OK,
9661 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9662 hr, S_OK, test_index);
9663 if(SUCCEEDED(hr)) {
9664 if(!uri) {
9665 received = (void*) 0xdeadbeef;
9666 len = -1;
9668 hr = IUriBuilder_GetPath(builder, &len, &received);
9669 ok(hr == S_FALSE,
9670 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9671 hr, S_FALSE, test_index);
9672 if(SUCCEEDED(hr)) {
9673 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9674 len, test_index);
9675 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9676 received, test_index);
9678 } else {
9679 BOOL has_prop = FALSE;
9680 BSTR expected = NULL;
9682 hr = IUri_GetPath(uri, &expected);
9683 ok(SUCCEEDED(hr),
9684 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9685 hr, test_index);
9686 has_prop = hr == S_OK;
9688 hr = IUriBuilder_GetPath(builder, &len, &received);
9689 if(has_prop) {
9690 ok(hr == S_OK,
9691 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9692 hr, S_OK, test_index);
9693 if(SUCCEEDED(hr)) {
9694 ok(!lstrcmpW(expected, received),
9695 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9696 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9697 ok(lstrlenW(expected) == len,
9698 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9699 lstrlenW(expected), len, test_index);
9701 } else {
9702 ok(hr == S_FALSE,
9703 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9704 hr, S_FALSE, test_index);
9705 if(SUCCEEDED(hr)) {
9706 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9707 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9708 len, test_index);
9711 SysFreeString(expected);
9714 if(uri) IUri_Release(uri);
9718 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9719 DWORD test_index) {
9720 HRESULT hr;
9721 BOOL has_port = FALSE;
9722 DWORD received = -1;
9724 if(test->port_prop.change) {
9725 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9726 todo_wine_if(test->port_prop.todo) {
9727 ok(hr == S_OK,
9728 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9729 hr, S_OK, test_index);
9730 if(SUCCEEDED(hr)) {
9731 ok(has_port == test->port_prop.set,
9732 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9733 test->port_prop.set, has_port, test_index);
9734 ok(received == test->port_prop.value,
9735 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9736 test->port_prop.value, received, test_index);
9739 } else {
9740 IUri *uri = NULL;
9742 hr = IUriBuilder_GetIUri(builder, &uri);
9743 ok(hr == S_OK,
9744 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9745 hr, S_OK, test_index);
9746 if(SUCCEEDED(hr)) {
9747 if(!uri) {
9748 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9749 ok(hr == S_OK,
9750 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9751 hr, S_OK, test_index);
9752 if(SUCCEEDED(hr)) {
9753 ok(has_port == FALSE,
9754 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9755 has_port, test_index);
9756 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9757 received, test_index);
9759 } else {
9760 DWORD expected;
9762 hr = IUri_GetPort(uri, &expected);
9763 ok(SUCCEEDED(hr),
9764 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9765 hr, test_index);
9767 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9768 ok(hr == S_OK,
9769 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9770 hr, S_OK, test_index);
9771 if(SUCCEEDED(hr)) {
9772 ok(!has_port,
9773 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9774 test_index);
9775 ok(received == expected,
9776 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9777 expected, received, test_index);
9781 if(uri) IUri_Release(uri);
9785 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9786 DWORD test_index) {
9787 HRESULT hr;
9788 DWORD i;
9789 LPCWSTR received = NULL;
9790 DWORD len = -1;
9791 const uri_builder_property *prop = NULL;
9793 /* Check if the property was set earlier. */
9794 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9795 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9796 prop = &(test->properties[i]);
9799 if(prop) {
9800 /* Use expected_value unless it's NULL, then use value. */
9801 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9802 DWORD expected_len = expected ? strlen(expected) : 0;
9803 hr = IUriBuilder_GetQuery(builder, &len, &received);
9804 todo_wine_if(prop->todo) {
9805 ok(hr == (expected ? S_OK : S_FALSE),
9806 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9807 hr, (expected ? S_OK : S_FALSE), test_index);
9808 if(SUCCEEDED(hr)) {
9809 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9810 expected, wine_dbgstr_w(received), test_index);
9811 ok(expected_len == len,
9812 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9813 expected_len, len, test_index);
9816 } else {
9817 /* The property wasn't set earlier, so it should return whatever
9818 * the base IUri contains (if anything).
9820 IUri *uri = NULL;
9821 hr = IUriBuilder_GetIUri(builder, &uri);
9822 ok(hr == S_OK,
9823 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9824 hr, S_OK, test_index);
9825 if(SUCCEEDED(hr)) {
9826 if(!uri) {
9827 received = (void*) 0xdeadbeef;
9828 len = -1;
9830 hr = IUriBuilder_GetQuery(builder, &len, &received);
9831 ok(hr == S_FALSE,
9832 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9833 hr, S_FALSE, test_index);
9834 if(SUCCEEDED(hr)) {
9835 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9836 len, test_index);
9837 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9838 received, test_index);
9840 } else {
9841 BOOL has_prop = FALSE;
9842 BSTR expected = NULL;
9844 hr = IUri_GetQuery(uri, &expected);
9845 ok(SUCCEEDED(hr),
9846 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9847 hr, test_index);
9848 has_prop = hr == S_OK;
9850 hr = IUriBuilder_GetQuery(builder, &len, &received);
9851 if(has_prop) {
9852 ok(hr == S_OK,
9853 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9854 hr, S_OK, test_index);
9855 if(SUCCEEDED(hr)) {
9856 ok(!lstrcmpW(expected, received),
9857 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9858 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9859 ok(lstrlenW(expected) == len,
9860 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9861 lstrlenW(expected), len, test_index);
9863 } else {
9864 ok(hr == S_FALSE,
9865 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9866 hr, S_FALSE, test_index);
9867 if(SUCCEEDED(hr)) {
9868 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9869 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9870 len, test_index);
9873 SysFreeString(expected);
9876 if(uri) IUri_Release(uri);
9880 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9881 DWORD test_index) {
9882 HRESULT hr;
9883 DWORD i;
9884 LPCWSTR received = NULL;
9885 DWORD len = -1;
9886 const uri_builder_property *prop = NULL;
9888 /* Check if the property was set earlier. */
9889 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9890 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9891 prop = &(test->properties[i]);
9894 if(prop) {
9895 /* Use expected_value unless it's NULL, then use value. */
9896 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9897 DWORD expected_len = expected ? strlen(expected) : 0;
9898 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9899 todo_wine_if(prop->todo) {
9900 ok(hr == (expected ? S_OK : S_FALSE),
9901 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9902 hr, (expected ? S_OK : S_FALSE), test_index);
9903 if(SUCCEEDED(hr)) {
9904 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9905 expected, wine_dbgstr_w(received), test_index);
9906 ok(expected_len == len,
9907 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9908 expected_len, len, test_index);
9911 } else {
9912 /* The property wasn't set earlier, so it should return whatever
9913 * the base IUri contains (if anything).
9915 IUri *uri = NULL;
9916 hr = IUriBuilder_GetIUri(builder, &uri);
9917 ok(hr == S_OK,
9918 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9919 hr, S_OK, test_index);
9920 if(SUCCEEDED(hr)) {
9921 if(!uri) {
9922 received = (void*) 0xdeadbeef;
9923 len = -1;
9925 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9926 ok(hr == S_FALSE,
9927 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9928 hr, S_FALSE, test_index);
9929 if(SUCCEEDED(hr)) {
9930 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9931 len, test_index);
9932 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9933 received, test_index);
9935 } else {
9936 BOOL has_prop = FALSE;
9937 BSTR expected = NULL;
9939 hr = IUri_GetSchemeName(uri, &expected);
9940 ok(SUCCEEDED(hr),
9941 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9942 hr, test_index);
9943 has_prop = hr == S_OK;
9945 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9946 if(has_prop) {
9947 ok(hr == S_OK,
9948 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9949 hr, S_OK, test_index);
9950 if(SUCCEEDED(hr)) {
9951 ok(!lstrcmpW(expected, received),
9952 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9953 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9954 ok(lstrlenW(expected) == len,
9955 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9956 lstrlenW(expected), len, test_index);
9958 } else {
9959 ok(hr == S_FALSE,
9960 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9961 hr, S_FALSE, test_index);
9962 if(SUCCEEDED(hr)) {
9963 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9964 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9965 len, test_index);
9968 SysFreeString(expected);
9971 if(uri) IUri_Release(uri);
9975 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9976 DWORD test_index) {
9977 HRESULT hr;
9978 DWORD i;
9979 LPCWSTR received = NULL;
9980 DWORD len = -1;
9981 const uri_builder_property *prop = NULL;
9983 /* Check if the property was set earlier. */
9984 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9985 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9986 prop = &(test->properties[i]);
9989 if(prop && prop->value && *prop->value) {
9990 /* Use expected_value unless it's NULL, then use value. */
9991 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9992 DWORD expected_len = expected ? strlen(expected) : 0;
9993 hr = IUriBuilder_GetUserName(builder, &len, &received);
9994 todo_wine_if(prop->todo) {
9995 ok(hr == (expected ? S_OK : S_FALSE),
9996 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9997 hr, (expected ? S_OK : S_FALSE), test_index);
9998 if(SUCCEEDED(hr)) {
9999 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
10000 expected, wine_dbgstr_w(received), test_index);
10001 ok(expected_len == len,
10002 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
10003 expected_len, len, test_index);
10006 } else {
10007 /* The property wasn't set earlier, so it should return whatever
10008 * the base IUri contains (if anything).
10010 IUri *uri = NULL;
10011 hr = IUriBuilder_GetIUri(builder, &uri);
10012 ok(hr == S_OK,
10013 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10014 hr, S_OK, test_index);
10015 if(SUCCEEDED(hr)) {
10016 if(!uri) {
10017 received = (void*) 0xdeadbeef;
10018 len = -1;
10020 hr = IUriBuilder_GetUserName(builder, &len, &received);
10021 ok(hr == S_FALSE,
10022 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10023 hr, S_FALSE, test_index);
10024 if(SUCCEEDED(hr)) {
10025 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
10026 len, test_index);
10027 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
10028 received, test_index);
10030 } else {
10031 BSTR expected = NULL;
10032 BOOL has_prop = FALSE;
10034 hr = IUri_GetUserName(uri, &expected);
10035 ok(SUCCEEDED(hr),
10036 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
10037 hr, test_index);
10038 has_prop = hr == S_OK;
10040 hr = IUriBuilder_GetUserName(builder, &len, &received);
10041 if(has_prop) {
10042 ok(hr == S_OK,
10043 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10044 hr, S_OK, test_index);
10045 if(SUCCEEDED(hr)) {
10046 ok(!lstrcmpW(expected, received),
10047 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
10048 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
10049 ok(lstrlenW(expected) == len,
10050 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
10051 lstrlenW(expected), len, test_index);
10053 } else {
10054 ok(hr == S_FALSE,
10055 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10056 hr, S_FALSE, test_index);
10057 if(SUCCEEDED(hr)) {
10058 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
10059 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
10060 len, test_index);
10063 SysFreeString(expected);
10066 if(uri) IUri_Release(uri);
10070 /* Tests IUriBuilder functions. */
10071 static void test_IUriBuilder(void) {
10072 HRESULT hr;
10073 IUriBuilder *builder;
10074 DWORD i;
10076 for(i = 0; i < ARRAY_SIZE(uri_builder_tests); ++i) {
10077 IUri *uri = NULL;
10078 uri_builder_test test = uri_builder_tests[i];
10079 LPWSTR uriW = NULL;
10081 if(test.uri) {
10082 uriW = a2w(test.uri);
10083 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10084 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10085 hr, S_OK, i);
10086 if(FAILED(hr)) continue;
10088 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10089 todo_wine_if(test.create_builder_todo)
10090 ok(hr == test.create_builder_expected,
10091 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10092 hr, test.create_builder_expected, i);
10093 if(SUCCEEDED(hr)) {
10094 DWORD j;
10095 BOOL modified = FALSE, received = FALSE;
10097 /* Perform all the string property changes. */
10098 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
10099 uri_builder_property prop = test.properties[j];
10100 if(prop.change) {
10101 change_property(builder, &prop, i);
10102 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
10103 prop.property != Uri_PROPERTY_HOST)
10104 modified = TRUE;
10105 else if(prop.value && *prop.value)
10106 modified = TRUE;
10107 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
10108 /* Host name property can't be NULL, but it can be empty. */
10109 modified = TRUE;
10113 if(test.port_prop.change) {
10114 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
10115 modified = TRUE;
10116 todo_wine_if(test.port_prop.todo)
10117 ok(hr == test.port_prop.expected,
10118 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10119 hr, test.port_prop.expected, i);
10122 hr = IUriBuilder_HasBeenModified(builder, &received);
10123 ok(hr == S_OK,
10124 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10125 hr, S_OK, i);
10126 if(SUCCEEDED(hr))
10127 ok(received == modified,
10128 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
10129 modified, received, i);
10131 /* Test the "Get*" functions. */
10132 test_IUriBuilder_GetFragment(builder, &test, i);
10133 test_IUriBuilder_GetHost(builder, &test, i);
10134 test_IUriBuilder_GetPassword(builder, &test, i);
10135 test_IUriBuilder_GetPath(builder, &test, i);
10136 test_IUriBuilder_GetPort(builder, &test, i);
10137 test_IUriBuilder_GetQuery(builder, &test, i);
10138 test_IUriBuilder_GetSchemeName(builder, &test, i);
10139 test_IUriBuilder_GetUserName(builder, &test, i);
10141 test_IUriBuilder_CreateUri(builder, &test, i);
10142 test_IUriBuilder_CreateUriSimple(builder, &test, i);
10143 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
10145 if(builder) IUriBuilder_Release(builder);
10146 if(uri) IUri_Release(uri);
10147 heap_free(uriW);
10151 static void test_IUriBuilder_HasBeenModified(void) {
10152 HRESULT hr;
10153 IUriBuilder *builder = NULL;
10155 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10156 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10157 if(SUCCEEDED(hr)) {
10158 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
10159 IUri *uri = NULL;
10160 BOOL received;
10162 hr = IUriBuilder_HasBeenModified(builder, NULL);
10163 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10164 hr, E_POINTER);
10166 hr = IUriBuilder_SetHost(builder, hostW);
10167 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
10168 hr, S_OK);
10170 hr = IUriBuilder_HasBeenModified(builder, &received);
10171 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10172 hr, S_OK);
10173 if(SUCCEEDED(hr))
10174 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10176 hr = pCreateUri(http_urlW, 0, 0, &uri);
10177 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10178 if(SUCCEEDED(hr)) {
10179 LPCWSTR prop;
10180 DWORD len = -1;
10182 hr = IUriBuilder_SetIUri(builder, uri);
10183 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
10184 hr, S_OK);
10186 hr = IUriBuilder_HasBeenModified(builder, &received);
10187 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10188 hr, S_OK);
10189 if(SUCCEEDED(hr))
10190 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
10192 /* Test what happens with you call SetIUri with the same IUri again. */
10193 hr = IUriBuilder_SetHost(builder, hostW);
10194 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10196 hr = IUriBuilder_HasBeenModified(builder, &received);
10197 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10198 hr, S_OK);
10199 if(SUCCEEDED(hr))
10200 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10202 hr = IUriBuilder_SetIUri(builder, uri);
10203 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10205 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
10206 * reset any of the changes that were made to the IUriBuilder.
10208 hr = IUriBuilder_HasBeenModified(builder, &received);
10209 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10210 if(SUCCEEDED(hr))
10211 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10213 hr = IUriBuilder_GetHost(builder, &len, &prop);
10214 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10215 if(SUCCEEDED(hr)) {
10216 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10217 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
10218 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
10219 lstrlenW(hostW), len);
10222 hr = IUriBuilder_SetIUri(builder, NULL);
10223 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10225 hr = IUriBuilder_SetHost(builder, hostW);
10226 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10227 hr = IUriBuilder_HasBeenModified(builder, &received);
10228 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10229 hr, S_OK);
10230 if(SUCCEEDED(hr))
10231 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10233 hr = IUriBuilder_SetIUri(builder, NULL);
10234 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
10236 hr = IUriBuilder_HasBeenModified(builder, &received);
10237 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10238 hr, S_OK);
10239 if(SUCCEEDED(hr))
10240 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10242 hr = IUriBuilder_GetHost(builder, &len, &prop);
10243 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10244 if(SUCCEEDED(hr)) {
10245 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10246 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
10247 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
10248 lstrlenW(hostW), len);
10251 if(uri) IUri_Release(uri);
10253 if(builder) IUriBuilder_Release(builder);
10256 /* Test IUriBuilder {Get,Set}IUri functions. */
10257 static void test_IUriBuilder_IUriProperty(void) {
10258 IUriBuilder *builder = NULL;
10259 HRESULT hr;
10261 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10262 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10263 if(SUCCEEDED(hr)) {
10264 IUri *uri = NULL;
10266 hr = IUriBuilder_GetIUri(builder, NULL);
10267 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
10268 hr, E_POINTER);
10270 hr = pCreateUri(http_urlW, 0, 0, &uri);
10271 if(SUCCEEDED(hr)) {
10272 IUri *test = NULL;
10273 ULONG cur_count, orig_count;
10275 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10276 orig_count = get_refcnt(uri);
10277 hr = IUriBuilder_SetIUri(builder, uri);
10278 cur_count = get_refcnt(uri);
10279 if(SUCCEEDED(hr))
10280 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10281 orig_count+1, cur_count);
10283 hr = IUriBuilder_SetIUri(builder, NULL);
10284 cur_count = get_refcnt(uri);
10285 if(SUCCEEDED(hr))
10286 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10287 orig_count, cur_count);
10289 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10290 hr = IUriBuilder_SetIUri(builder, uri);
10291 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10292 orig_count = get_refcnt(uri);
10294 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
10295 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10296 if(SUCCEEDED(hr)) {
10297 cur_count = get_refcnt(uri);
10298 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10299 orig_count+1, cur_count);
10300 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
10301 uri, test);
10303 if(test) IUri_Release(test);
10305 test = NULL;
10306 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
10307 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10308 if(SUCCEEDED(hr)) {
10309 cur_count = get_refcnt(uri);
10310 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10311 orig_count+1, cur_count);
10312 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10314 if(test) IUri_Release(test);
10316 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10317 * the base IUri.
10319 test = NULL;
10320 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
10321 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10322 if(SUCCEEDED(hr))
10323 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10325 if(test) IUri_Release(test);
10327 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10328 * explicitly set (because it's a default flag).
10330 test = NULL;
10331 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
10332 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10333 if(SUCCEEDED(hr)) {
10334 cur_count = get_refcnt(uri);
10335 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10336 orig_count+1, cur_count);
10337 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10339 if(test) IUri_Release(test);
10341 test = NULL;
10342 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
10343 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10344 if(SUCCEEDED(hr)) {
10345 cur_count = get_refcnt(uri);
10346 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10347 orig_count+1, cur_count);
10348 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10350 if(test) IUri_Release(test);
10352 test = NULL;
10353 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
10354 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
10355 hr, S_OK);
10356 if(SUCCEEDED(hr)) {
10357 cur_count = get_refcnt(uri);
10358 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10359 orig_count+1, cur_count);
10360 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10362 if(test) IUri_Release(test);
10364 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10365 * the base IUri.
10367 test = NULL;
10368 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
10369 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10370 if(SUCCEEDED(hr))
10371 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10373 if(test) IUri_Release(test);
10375 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10376 * explicitly set (because it's a default flag).
10378 test = NULL;
10379 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
10380 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10381 if(SUCCEEDED(hr)) {
10382 cur_count = get_refcnt(uri);
10383 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10384 orig_count+1, cur_count);
10385 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10387 if(test) IUri_Release(test);
10389 if(uri) IUri_Release(uri);
10391 if(builder) IUriBuilder_Release(builder);
10394 static void test_IUriBuilder_RemoveProperties(void) {
10395 IUriBuilder *builder = NULL;
10396 HRESULT hr;
10397 DWORD i;
10399 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10400 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10401 if(SUCCEEDED(hr)) {
10402 /* Properties that can't be removed. */
10403 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
10404 Uri_HAS_SCHEME|Uri_HAS_ZONE;
10406 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
10407 hr = IUriBuilder_RemoveProperties(builder, i << 1);
10408 if((i << 1) & invalid) {
10409 ok(hr == E_INVALIDARG,
10410 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10411 hr, E_INVALIDARG, i);
10412 } else {
10413 ok(hr == S_OK,
10414 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10415 hr, S_OK, i);
10419 /* Also doesn't accept anything that's outside the range of the
10420 * Uri_HAS flags.
10422 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
10423 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
10424 hr, E_INVALIDARG);
10426 if(builder) IUriBuilder_Release(builder);
10428 for(i = 0; i < ARRAY_SIZE(uri_builder_remove_tests); ++i) {
10429 uri_builder_remove_test test = uri_builder_remove_tests[i];
10430 IUri *uri = NULL;
10431 LPWSTR uriW;
10433 uriW = a2w(test.uri);
10434 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10435 if(SUCCEEDED(hr)) {
10436 builder = NULL;
10438 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10439 todo_wine_if(test.create_builder_todo)
10440 ok(hr == test.create_builder_expected,
10441 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10442 hr, test.create_builder_expected, i);
10444 if(SUCCEEDED(hr)) {
10445 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10446 todo_wine_if(test.remove_todo)
10447 ok(hr == test.remove_expected,
10448 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10449 hr, test.remove_expected, i);
10450 if(SUCCEEDED(hr)) {
10451 IUri *result = NULL;
10453 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10454 todo_wine_if(test.expected_todo)
10455 ok(hr == test.expected_hres,
10456 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10457 hr, test.expected_hres, i);
10458 if(SUCCEEDED(hr)) {
10459 BSTR received = NULL;
10461 hr = IUri_GetAbsoluteUri(result, &received);
10462 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10463 ok(!strcmp_aw(test.expected_uri, received),
10464 "Error: Expected %s but got %s instead on test %d.\n",
10465 test.expected_uri, wine_dbgstr_w(received), i);
10466 SysFreeString(received);
10468 if(result) IUri_Release(result);
10471 if(builder) IUriBuilder_Release(builder);
10473 if(uri) IUri_Release(uri);
10474 heap_free(uriW);
10478 static void test_IUriBuilder_Misc(void) {
10479 HRESULT hr;
10480 IUri *uri;
10482 hr = pCreateUri(http_urlW, 0, 0, &uri);
10483 if(SUCCEEDED(hr)) {
10484 IUriBuilder *builder;
10486 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10487 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10488 if(SUCCEEDED(hr)) {
10489 BOOL has = -1;
10490 DWORD port = -1;
10492 hr = IUriBuilder_GetPort(builder, &has, &port);
10493 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10494 if(SUCCEEDED(hr)) {
10495 /* 'has' will be set to FALSE, even though uri had a port. */
10496 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10497 /* Still sets 'port' to 80. */
10498 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
10501 if(builder) IUriBuilder_Release(builder);
10503 if(uri) IUri_Release(uri);
10506 static void test_IUriBuilderFactory(void) {
10507 HRESULT hr;
10508 IUri *uri;
10509 IUriBuilderFactory *factory;
10510 IUriBuilder *builder;
10512 hr = pCreateUri(http_urlW, 0, 0, &uri);
10513 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10514 if(SUCCEEDED(hr)) {
10515 factory = NULL;
10516 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10517 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
10518 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10520 if(SUCCEEDED(hr)) {
10521 builder = (void*) 0xdeadbeef;
10522 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10523 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10524 hr, E_INVALIDARG);
10525 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10527 builder = (void*) 0xdeadbeef;
10528 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10529 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10530 hr, E_INVALIDARG);
10531 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10533 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10534 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10535 hr, E_POINTER);
10537 builder = NULL;
10538 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10539 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10540 hr, S_OK);
10541 if(SUCCEEDED(hr)) {
10542 IUri *tmp = (void*) 0xdeadbeef;
10543 LPCWSTR result;
10544 DWORD result_len;
10546 hr = IUriBuilder_GetIUri(builder, &tmp);
10547 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10548 hr, S_OK);
10549 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10551 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10552 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10553 hr, S_FALSE);
10555 if(builder) IUriBuilder_Release(builder);
10557 builder = (void*) 0xdeadbeef;
10558 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10559 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10560 hr, E_INVALIDARG);
10561 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10563 builder = (void*) 0xdeadbeef;
10564 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10565 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10566 hr, E_INVALIDARG);
10567 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10569 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10570 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10571 hr, E_POINTER);
10573 builder = NULL;
10574 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10575 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10576 hr, S_OK);
10577 if(SUCCEEDED(hr)) {
10578 IUri *tmp = NULL;
10580 hr = IUriBuilder_GetIUri(builder, &tmp);
10581 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10582 hr, S_OK);
10583 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10584 if(tmp) IUri_Release(tmp);
10586 if(builder) IUriBuilder_Release(builder);
10588 if(factory) IUriBuilderFactory_Release(factory);
10590 if(uri) IUri_Release(uri);
10593 static void test_CoInternetCombineIUri(void) {
10594 HRESULT hr;
10595 IUri *base, *relative, *result;
10596 DWORD i;
10598 base = NULL;
10599 hr = pCreateUri(http_urlW, 0, 0, &base);
10600 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10601 if(SUCCEEDED(hr)) {
10602 result = (void*) 0xdeadbeef;
10603 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10604 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10605 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10608 relative = NULL;
10609 hr = pCreateUri(http_urlW, 0, 0, &relative);
10610 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10611 if(SUCCEEDED(hr)) {
10612 result = (void*) 0xdeadbeef;
10613 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10614 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10615 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10618 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10619 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10621 if(base) IUri_Release(base);
10622 if(relative) IUri_Release(relative);
10624 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
10625 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10627 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10628 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10629 if(SUCCEEDED(hr)) {
10630 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10632 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10633 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10634 if(SUCCEEDED(hr)) {
10635 result = NULL;
10637 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10638 todo_wine_if(uri_combine_tests[i].todo)
10639 ok(hr == uri_combine_tests[i].expected ||
10640 broken(hr == S_OK && uri_combine_tests[i].expected == E_INVALIDARG) /* win10 1607 to 1709 */,
10641 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10642 hr, uri_combine_tests[i]. expected, i);
10643 if(SUCCEEDED(hr) && SUCCEEDED(uri_combine_tests[i].expected)) {
10644 DWORD j;
10646 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
10647 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10648 BSTR received;
10650 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10651 todo_wine_if(prop.todo) {
10652 ok(hr == prop.expected,
10653 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10654 hr, prop.expected, i, j);
10655 ok(!strcmp_aw(prop.value, received) ||
10656 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10657 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10658 prop.value, wine_dbgstr_w(received), i, j);
10660 SysFreeString(received);
10663 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
10664 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10665 DWORD received;
10667 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10668 todo_wine_if(prop.todo) {
10669 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10670 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10671 hr, prop.expected, i, j);
10672 if(!prop.broken_combine_hres || hr != S_FALSE)
10673 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10674 prop.value, received, i, j);
10678 if(result) IUri_Release(result);
10680 if(relative) IUri_Release(relative);
10681 heap_free(relativeW);
10683 if(base) IUri_Release(base);
10684 heap_free(baseW);
10688 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10689 REFIID riid, void **ppv)
10691 ok(0, "unexpected call\n");
10692 return E_NOINTERFACE;
10695 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10697 return 2;
10700 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10702 return 1;
10705 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10706 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10707 DWORD *pcchResult, DWORD dwReserved)
10709 CHECK_EXPECT(ParseUrl);
10710 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10711 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10712 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10713 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10714 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10716 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10717 *pcchResult = lstrlenW(parse_resultW);
10719 return S_OK;
10722 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10723 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10724 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10726 CHECK_EXPECT(CombineUrl);
10727 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10728 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10729 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10730 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10731 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10732 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10733 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10735 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10736 *pcchResult = lstrlenW(combine_resultW);
10738 return S_OK;
10741 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10742 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10744 ok(0, "unexpected call\n");
10745 return E_NOTIMPL;
10748 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10749 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10750 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10752 ok(0, "unexpected call\n");
10753 return E_NOTIMPL;
10756 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10757 InternetProtocolInfo_QueryInterface,
10758 InternetProtocolInfo_AddRef,
10759 InternetProtocolInfo_Release,
10760 InternetProtocolInfo_ParseUrl,
10761 InternetProtocolInfo_CombineUrl,
10762 InternetProtocolInfo_CompareUrl,
10763 InternetProtocolInfo_QueryInfo
10766 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10768 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10770 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10771 *ppv = &protocol_info;
10772 return S_OK;
10775 ok(0, "unexpected call\n");
10776 return E_NOINTERFACE;
10779 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10781 return 2;
10784 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10786 return 1;
10789 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10790 REFIID riid, void **ppv)
10792 ok(0, "unexpected call\n");
10793 return E_NOTIMPL;
10796 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10798 ok(0, "unexpected call\n");
10799 return S_OK;
10802 static const IClassFactoryVtbl ClassFactoryVtbl = {
10803 ClassFactory_QueryInterface,
10804 ClassFactory_AddRef,
10805 ClassFactory_Release,
10806 ClassFactory_CreateInstance,
10807 ClassFactory_LockServer
10810 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10812 static void register_protocols(void)
10814 IInternetSession *session;
10815 HRESULT hres;
10817 hres = pCoInternetGetSession(0, &session, 0);
10818 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10819 if(FAILED(hres))
10820 return;
10822 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10823 winetestW, 0, NULL, 0);
10824 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10826 IInternetSession_Release(session);
10829 static void unregister_protocols(void) {
10830 IInternetSession *session;
10831 HRESULT hr;
10833 hr = pCoInternetGetSession(0, &session, 0);
10834 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10835 if(FAILED(hr))
10836 return;
10838 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10839 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10841 IInternetSession_Release(session);
10844 static void test_CoInternetCombineIUri_Pluggable(void) {
10845 HRESULT hr;
10846 IUri *base = NULL;
10848 hr = pCreateUri(combine_baseW, 0, 0, &base);
10849 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10850 if(SUCCEEDED(hr)) {
10851 IUri *relative = NULL;
10853 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10854 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10855 if(SUCCEEDED(hr)) {
10856 IUri *result = NULL;
10858 SET_EXPECT(CombineUrl);
10860 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10861 &result, 0);
10862 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10864 CHECK_CALLED(CombineUrl);
10866 if(SUCCEEDED(hr)) {
10867 BSTR received = NULL;
10868 hr = IUri_GetAbsoluteUri(result, &received);
10869 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10870 if(SUCCEEDED(hr)) {
10871 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10872 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10874 SysFreeString(received);
10876 if(result) IUri_Release(result);
10878 if(relative) IUri_Release(relative);
10880 if(base) IUri_Release(base);
10883 static void test_CoInternetCombineUrlEx(void) {
10884 HRESULT hr;
10885 IUri *base, *result;
10886 DWORD i;
10888 base = NULL;
10889 hr = pCreateUri(http_urlW, 0, 0, &base);
10890 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10891 if(SUCCEEDED(hr)) {
10892 result = (void*) 0xdeadbeef;
10893 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10894 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10895 hr, E_UNEXPECTED);
10896 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10899 result = (void*) 0xdeadbeef;
10900 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10901 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10902 hr, E_INVALIDARG);
10903 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10905 result = (void*) 0xdeadbeef;
10906 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10907 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10908 hr, E_UNEXPECTED);
10909 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10911 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10912 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10913 hr, E_POINTER);
10914 if(base) IUri_Release(base);
10916 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
10917 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10919 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10920 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10921 if(SUCCEEDED(hr)) {
10922 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10924 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10925 &result, 0);
10926 todo_wine_if(uri_combine_tests[i].todo)
10927 ok(hr == uri_combine_tests[i].expected ||
10928 broken(hr == S_OK && uri_combine_tests[i].expected == E_INVALIDARG) /* win10 1607 to 1709 */,
10929 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10930 hr, uri_combine_tests[i]. expected, i);
10931 if(SUCCEEDED(hr) && SUCCEEDED(uri_combine_tests[i].expected)) {
10932 DWORD j;
10934 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
10935 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10936 BSTR received;
10937 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10939 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10940 todo_wine_if(prop.todo) {
10941 ok(hr == prop.expected,
10942 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10943 hr, prop.expected, i, j);
10944 ok(!strcmp_aw(value, received) ||
10945 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10946 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10947 value, wine_dbgstr_w(received), i, j);
10949 SysFreeString(received);
10952 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
10953 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10954 DWORD received;
10956 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10957 todo_wine_if(prop.todo) {
10958 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10959 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10960 hr, prop.expected, i, j);
10961 if(!prop.broken_combine_hres || hr != S_FALSE)
10962 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10963 prop.value, received, i, j);
10967 if(result) IUri_Release(result);
10968 heap_free(relativeW);
10970 if(base) IUri_Release(base);
10971 heap_free(baseW);
10975 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10976 HRESULT hr;
10977 IUri *base = NULL;
10979 hr = pCreateUri(combine_baseW, 0, 0, &base);
10980 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10981 if(SUCCEEDED(hr)) {
10982 IUri *result = NULL;
10984 SET_EXPECT(CombineUrl);
10986 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10987 &result, 0);
10988 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10990 CHECK_CALLED(CombineUrl);
10992 if(SUCCEEDED(hr)) {
10993 BSTR received = NULL;
10994 hr = IUri_GetAbsoluteUri(result, &received);
10995 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10996 if(SUCCEEDED(hr)) {
10997 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10998 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
11000 SysFreeString(received);
11002 if(result) IUri_Release(result);
11004 if(base) IUri_Release(base);
11007 static void test_CoInternetParseIUri_InvalidArgs(void) {
11008 HRESULT hr;
11009 IUri *uri = NULL;
11010 WCHAR tmp[3];
11011 WCHAR *longurl, *copy;
11012 DWORD result = -1;
11013 DWORD i, len;
11015 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11016 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11017 hr, E_INVALIDARG);
11018 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11020 hr = pCreateUri(http_urlW, 0, 0, &uri);
11021 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
11022 if(SUCCEEDED(hr)) {
11023 DWORD expected_len;
11025 result = -1;
11026 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
11027 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11028 hr, E_INVALIDARG);
11029 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11031 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
11032 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11033 hr, E_POINTER);
11035 result = -1;
11036 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
11037 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
11038 hr, E_FAIL);
11039 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11041 result = -1;
11042 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
11043 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11044 hr, E_FAIL);
11045 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11047 result = -1;
11048 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
11049 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11050 hr, E_FAIL);
11051 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11053 result = -1;
11054 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
11055 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11056 hr, E_FAIL);
11057 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11059 expected_len = lstrlenW(http_urlW);
11060 result = -1;
11061 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11062 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
11063 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11064 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
11065 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
11066 expected_len, result);
11068 if(uri) IUri_Release(uri);
11070 /* a long url that causes a crash on Wine */
11071 len = INTERNET_MAX_URL_LENGTH*2;
11072 longurl = heap_alloc((len+1)*sizeof(WCHAR));
11073 memcpy(longurl, http_urlW, sizeof(http_urlW));
11074 for(i = ARRAY_SIZE(http_urlW)-1; i < len; i++)
11075 longurl[i] = 'x';
11076 longurl[len] = 0;
11078 copy = heap_alloc((len+1)*sizeof(WCHAR));
11079 memcpy(copy, longurl, (len+1)*sizeof(WCHAR));
11081 hr = pCreateUri(longurl, 0, 0, &uri);
11082 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
11083 if(SUCCEEDED(hr)) {
11084 result = -1;
11085 memset(longurl, 0xcc, len*sizeof(WCHAR));
11086 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, longurl, len+1, &result, 0);
11087 ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08x.\n", hr);
11088 ok(!lstrcmpW(longurl, copy), "Error: expected long url '%s' but was '%s'.\n",
11089 wine_dbgstr_w(copy), wine_dbgstr_w(longurl));
11090 ok(result == len, "Error: Expected 'result' to be %d, but was %d instead.\n",
11091 len, result);
11093 heap_free(longurl);
11094 heap_free(copy);
11095 if(uri) IUri_Release(uri);
11098 static void test_CoInternetParseIUri(void) {
11099 DWORD i;
11101 for(i = 0; i < ARRAY_SIZE(uri_parse_tests); ++i) {
11102 HRESULT hr;
11103 IUri *uri;
11104 LPWSTR uriW;
11105 uri_parse_test test = uri_parse_tests[i];
11107 uriW = a2w(test.uri);
11108 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
11109 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
11110 if(SUCCEEDED(hr)) {
11111 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
11112 DWORD result_len = -1;
11114 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
11115 todo_wine_if(test.todo)
11116 ok(hr == test.expected,
11117 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11118 hr, test.expected, i);
11119 if(SUCCEEDED(hr)) {
11120 DWORD len = lstrlenA(test.property);
11121 ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)),
11122 "Error: Expected %s but got %s instead on uri_parse_tests[%d] - %s.\n",
11123 test.property, wine_dbgstr_w(result), i, wine_dbgstr_w(uriW));
11124 ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len),
11125 "Error: Expected %d, but got %d instead on uri_parse_tests[%d] - %s.\n",
11126 len, result_len, i, wine_dbgstr_w(uriW));
11127 } else {
11128 ok(!result_len,
11129 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
11130 result_len, i);
11133 if(uri) IUri_Release(uri);
11134 heap_free(uriW);
11138 static void test_CoInternetParseIUri_Pluggable(void) {
11139 HRESULT hr;
11140 IUri *uri = NULL;
11142 hr = pCreateUri(parse_urlW, 0, 0, &uri);
11143 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
11144 if(SUCCEEDED(hr)) {
11145 WCHAR result[200];
11146 DWORD result_len;
11148 SET_EXPECT(ParseUrl);
11150 parse_action = PARSE_CANONICALIZE;
11151 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
11153 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
11154 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
11156 CHECK_CALLED(ParseUrl);
11158 if(SUCCEEDED(hr)) {
11159 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
11160 lstrlenW(parse_resultW), result_len);
11161 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
11162 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
11165 if(uri) IUri_Release(uri);
11168 typedef struct {
11169 const char *url;
11170 DWORD uri_flags;
11171 const char *base_url;
11172 DWORD base_uri_flags;
11173 const char *legacy_url;
11174 const char *uniform_url;
11175 const char *no_canon_url;
11176 const char *uri_url;
11177 } create_urlmon_test_t;
11179 static const create_urlmon_test_t create_urlmon_tests[] = {
11181 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
11182 NULL,0,
11183 "http://www.winehq.org/",
11184 "http://www.winehq.org/",
11185 "http://www.winehq.org",
11186 "http://www.winehq.org"
11189 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
11190 NULL,0,
11191 "file://c:\\dir\\file.txt",
11192 "file:///c:/dir/file.txt",
11193 "file:///c:/dir/file.txt",
11194 "file:///c:/dir/file.txt"
11197 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
11198 NULL,0,
11199 "file://c:\\dir\\file.txt",
11200 "file:///c:/dir/file.txt",
11201 "file:///c:/dir/file.txt",
11202 "file://c:\\dir\\file.txt"
11205 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
11206 "http://www.winehq.org",0,
11207 "http://www.winehq.org/data",
11208 "http://www.winehq.org/data",
11209 "http://www.winehq.org:80/data",
11212 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
11213 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
11214 "file://c:\\dir\\file.txt",
11215 "file:///c:/dir/file.txt",
11216 "file:///c:/dir/file.txt",
11219 "",Uri_CREATE_ALLOW_RELATIVE,
11220 NULL,0,
11227 "test",Uri_CREATE_ALLOW_RELATIVE,
11228 NULL,0,
11229 "test",
11230 "test",
11231 "test",
11232 "test"
11235 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11236 NULL,0,
11237 "file://c:\\dir\\file.txt",
11238 "file:///c:/dir/file.txt",
11239 "file:///c:/dir/file.txt",
11240 "file:///c:/dir/file.txt",
11243 "c:\\dir\\file.txt#frag|part",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11244 NULL,0,
11245 "file://c:\\dir\\file.txt#frag|part",
11246 "file:///c:/dir/file.txt#frag%7Cpart",
11247 "file:///c:/dir/file.txt#frag%7Cpart",
11248 "file:///c:/dir/file.txt#frag%7Cpart",
11252 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
11253 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
11255 WCHAR *display_name;
11256 HRESULT hres;
11258 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11259 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
11260 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11261 wine_dbgstr_w(display_name), exurl);
11263 CoTaskMemFree(display_name);
11266 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
11267 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
11269 IUriContainer *uri_container;
11270 IUri *uri;
11271 BSTR display_uri;
11272 HRESULT hres;
11274 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11275 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
11277 uri = NULL;
11278 hres = IUriContainer_GetIUri(uri_container, &uri);
11279 IUriContainer_Release(uri_container);
11280 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
11281 ok(uri != NULL, "uri == NULL\n");
11283 hres = IUri_GetDisplayUri(uri, &display_uri);
11284 IUri_Release(uri);
11285 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
11286 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11287 wine_dbgstr_w(display_uri), exurl);
11288 SysFreeString(display_uri);
11291 static void test_CreateURLMoniker(void)
11293 const create_urlmon_test_t *test;
11294 IMoniker *mon, *base_mon;
11295 WCHAR *url, *base_url;
11296 IUri *uri, *base_uri;
11297 HRESULT hres;
11299 for(test = create_urlmon_tests; test < create_urlmon_tests + ARRAY_SIZE(create_urlmon_tests); test++) {
11300 url = a2w(test->url);
11301 base_url = a2w(test->base_url);
11303 if(base_url) {
11304 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11305 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11307 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11308 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11309 }else {
11310 base_uri = NULL;
11311 base_mon = NULL;
11314 hres = CreateURLMoniker(base_mon, url, &mon);
11315 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11316 test_urlmon_display_name(mon, test->legacy_url);
11317 test_display_uri(mon, test->legacy_url);
11318 IMoniker_Release(mon);
11320 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11321 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11322 test_urlmon_display_name(mon, test->legacy_url);
11323 test_display_uri(mon, test->legacy_url);
11324 IMoniker_Release(mon);
11326 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11327 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11328 test_urlmon_display_name(mon, test->uniform_url);
11329 test_display_uri(mon, test->uniform_url);
11330 IMoniker_Release(mon);
11332 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11333 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11334 test_urlmon_display_name(mon, test->no_canon_url);
11335 test_display_uri(mon, test->no_canon_url);
11336 IMoniker_Release(mon);
11338 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11339 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11341 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11342 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11343 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11344 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11345 IMoniker_Release(mon);
11347 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11348 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11349 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11350 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11351 IMoniker_Release(mon);
11353 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11354 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11355 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11356 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11357 IMoniker_Release(mon);
11359 IUri_Release(uri);
11360 heap_free(url);
11361 heap_free(base_url);
11362 if(base_uri)
11363 IUri_Release(base_uri);
11364 if(base_mon)
11365 IMoniker_Release(base_mon);
11369 static int add_default_flags(DWORD flags) {
11370 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11371 flags |= Uri_CREATE_CANONICALIZE;
11372 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11373 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11374 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11375 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11376 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11377 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11378 if(!(flags & Uri_CREATE_IE_SETTINGS))
11379 flags |= Uri_CREATE_NO_IE_SETTINGS;
11381 return flags;
11384 static void test_IPersistStream(void)
11386 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11388 props_order[Uri_PROPERTY_RAW_URI] = 1;
11389 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11390 props_order[Uri_PROPERTY_HOST] = 3;
11391 props_order[Uri_PROPERTY_PASSWORD] = 4;
11392 props_order[Uri_PROPERTY_PATH] = 5;
11393 props_order[Uri_PROPERTY_PORT] = 6;
11394 props_order[Uri_PROPERTY_QUERY] = 7;
11395 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11396 props_order[Uri_PROPERTY_USER_NAME] = 9;
11398 for(i = 0; i < ARRAY_SIZE(uri_tests); i++) {
11399 const uri_properties *test = uri_tests+i;
11400 LPWSTR uriW;
11401 IUri *uri;
11402 IPersistStream *persist_stream;
11403 IStream *stream;
11404 IMarshal *marshal;
11405 DWORD props, props_no, dw_data[6];
11406 WCHAR str_data[1024];
11407 ULARGE_INTEGER size, max_size;
11408 LARGE_INTEGER no_off;
11409 CLSID curi;
11410 BSTR raw_uri;
11411 HRESULT hr;
11413 if(test->create_todo || test->create_expected!=S_OK)
11414 continue;
11416 uriW = a2w(test->uri);
11417 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11418 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
11420 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11421 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11423 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
11424 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
11425 hr = IPersistStream_IsDirty(persist_stream);
11426 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11427 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11428 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
11429 hr = IPersistStream_IsDirty(persist_stream);
11430 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11431 no_off.QuadPart = 0;
11432 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11433 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11434 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11435 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11436 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11437 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
11438 ok(U(size).LowPart+2 == U(max_size).LowPart,
11439 "%d) Written data size is %d, max_size %d.\n",
11440 i, U(size).LowPart, U(max_size).LowPart);
11442 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11443 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11444 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11445 i, dw_data[0]-2, U(size).LowPart);
11446 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11447 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11448 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
11449 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
11450 ok(dw_data[2] == add_default_flags(test->create_flags),
11451 "%d) Incorrect value %x, expected %x (creation flags).\n",
11452 i, dw_data[2], add_default_flags(test->create_flags));
11453 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
11454 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
11455 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
11457 props_no = 0;
11458 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11459 if(!props_order[props])
11460 continue;
11462 if(props <= Uri_PROPERTY_STRING_LAST) {
11463 if(test->str_props[props].expected == S_OK)
11464 props_no++;
11465 } else {
11466 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11467 props_no++;
11470 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11471 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11472 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11473 props_no = 1;
11475 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11476 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11477 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
11479 dw_data[2] = 0;
11480 dw_data[3] = -1;
11481 while(props) {
11482 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11483 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11484 props--;
11485 ok(dw_data[2]<props_order[dw_data[0]],
11486 "%d) Incorrect properties order (%d, %d)\n",
11487 i, dw_data[0], dw_data[3]);
11488 dw_data[2] = props_order[dw_data[0]];
11489 dw_data[3] = dw_data[0];
11491 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11492 const uri_str_property *prop = test->str_props+dw_data[0];
11493 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11494 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11495 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11496 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11497 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11498 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11499 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
11500 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11501 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11502 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
11503 } else {
11504 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
11505 break;
11508 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11509 i, props, dw_data[0]);
11511 IUri_Release(uri);
11513 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11514 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11515 hr = IPersistStream_GetClassID(persist_stream, &curi);
11516 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
11517 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11518 IPersistStream_Release(persist_stream);
11520 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11521 &IID_IUri, (void**)&uri);
11522 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11523 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11524 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11525 hr = IPersistStream_Load(persist_stream, stream);
11526 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
11527 hr = IUri_GetRawUri(uri, &raw_uri);
11528 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11529 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11530 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11531 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11532 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11533 wine_dbgstr_w(raw_uri));
11534 SysFreeString(raw_uri);
11535 IPersistStream_Release(persist_stream);
11537 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11538 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
11539 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11540 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11541 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11542 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11543 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11544 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11545 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11546 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11547 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11548 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11549 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11550 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11551 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11552 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11553 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11554 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11555 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11556 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11557 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11558 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11559 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11560 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11561 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11562 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11563 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11564 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11565 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11567 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11568 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11569 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11570 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11571 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11572 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11573 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11574 i, dw_data[0]-2, U(size).LowPart);
11575 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11576 i, dw_data[1]);
11577 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11578 i, dw_data[2], dw_data[0]-8);
11579 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11580 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11581 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11582 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11583 U(max_size).LowPart += 3*sizeof(DWORD);
11584 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11585 i, dw_data[2], U(max_size).LowPart);
11586 IMarshal_Release(marshal);
11587 IUri_Release(uri);
11589 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11590 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11591 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11592 &IID_IUri, (void**)&uri);
11593 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11594 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11595 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11596 IUri_Release(uri);
11597 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11598 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11599 hr = IUri_GetRawUri(uri, &raw_uri);
11600 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11601 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11602 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11603 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11604 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11605 wine_dbgstr_w(raw_uri));
11606 SysFreeString(raw_uri);
11608 IMarshal_Release(marshal);
11609 IStream_Release(stream);
11610 IUri_Release(uri);
11611 heap_free(uriW);
11615 static void test_UninitializedUri(void)
11617 IUri *uri;
11618 IUriBuilderFactory *ubf;
11619 IPersistStream *ps;
11620 IUriBuilder *ub;
11621 BSTR bstr;
11622 DWORD dword;
11623 BOOL eq;
11624 ULARGE_INTEGER ui;
11625 HRESULT hr;
11627 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11628 &IID_IUri, (void**)&uri);
11629 if(FAILED(hr)) {
11630 win_skip("Skipping uninitialized Uri tests.\n");
11631 return;
11634 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11635 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11636 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11637 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11639 hr = IUri_GetAbsoluteUri(uri, NULL);
11640 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11641 hr = IUri_GetAbsoluteUri(uri, &bstr);
11642 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11643 hr = IUri_GetAuthority(uri, &bstr);
11644 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11645 hr = IUri_GetDisplayUri(uri, &bstr);
11646 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11647 hr = IUri_GetDomain(uri, &bstr);
11648 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11649 hr = IUri_GetExtension(uri, &bstr);
11650 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11651 hr = IUri_GetFragment(uri, &bstr);
11652 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11653 hr = IUri_GetHost(uri, &bstr);
11654 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11655 hr = IUri_GetHostType(uri, &dword);
11656 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11657 hr = IUri_GetPassword(uri, &bstr);
11658 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11659 hr = IUri_GetPassword(uri, &bstr);
11660 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11661 hr = IUri_GetPathAndQuery(uri, &bstr);
11662 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11663 hr = IUri_GetPort(uri, &dword);
11664 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11665 hr = IUri_GetProperties(uri, &dword);
11666 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11667 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11668 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11669 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11670 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11671 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11672 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11673 hr = IUri_GetQuery(uri, &bstr);
11674 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11675 hr = IUri_GetRawUri(uri, &bstr);
11676 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11677 hr = IUri_GetScheme(uri, &dword);
11678 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11679 hr = IUri_GetSchemeName(uri, &bstr);
11680 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11681 hr = IUri_GetUserInfo(uri, &bstr);
11682 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11683 hr = IUri_GetUserName(uri, &bstr);
11684 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11685 hr = IUri_GetZone(uri, &dword);
11686 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11687 hr = IUri_IsEqual(uri, uri, &eq);
11688 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11690 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11691 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11692 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11693 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11694 IUriBuilder_Release(ub);
11696 hr = IPersistStream_GetSizeMax(ps, &ui);
11697 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11698 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11699 hr = IPersistStream_IsDirty(ps);
11700 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11702 IPersistStream_Release(ps);
11703 IUriBuilderFactory_Release(ubf);
11704 IUri_Release(uri);
11707 START_TEST(uri) {
11708 HMODULE hurlmon;
11710 hurlmon = GetModuleHandleA("urlmon.dll");
11711 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11712 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11713 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11714 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11715 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11716 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11717 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11718 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11719 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11721 if(!pCreateUri) {
11722 win_skip("CreateUri is not present, skipping tests.\n");
11723 return;
11726 trace("test CreateUri invalid flags...\n");
11727 test_CreateUri_InvalidFlags();
11729 trace("test CreateUri invalid args...\n");
11730 test_CreateUri_InvalidArgs();
11732 trace("test CreateUri invalid URIs...\n");
11733 test_CreateUri_InvalidUri();
11735 trace("test IUri_GetPropertyBSTR...\n");
11736 test_IUri_GetPropertyBSTR();
11738 trace("test IUri_GetPropertyDWORD...\n");
11739 test_IUri_GetPropertyDWORD();
11741 trace("test IUri_GetStrProperties...\n");
11742 test_IUri_GetStrProperties();
11744 trace("test IUri_GetDwordProperties...\n");
11745 test_IUri_GetDwordProperties();
11747 trace("test IUri_GetPropertyLength...\n");
11748 test_IUri_GetPropertyLength();
11750 trace("test IUri_GetProperties...\n");
11751 test_IUri_GetProperties();
11753 trace("test IUri_HasProperty...\n");
11754 test_IUri_HasProperty();
11756 trace("test IUri_IsEqual...\n");
11757 test_IUri_IsEqual();
11759 trace("test CreateUriWithFragment invalid args...\n");
11760 test_CreateUriWithFragment_InvalidArgs();
11762 trace("test CreateUriWithFragment invalid flags...\n");
11763 test_CreateUriWithFragment_InvalidFlags();
11765 trace("test CreateUriWithFragment...\n");
11766 test_CreateUriWithFragment();
11768 trace("test CreateIUriBuilder...\n");
11769 test_CreateIUriBuilder();
11771 trace("test IUriBuilder_CreateInvalidArgs...\n");
11772 test_IUriBuilder_CreateInvalidArgs();
11774 trace("test IUriBuilder...\n");
11775 test_IUriBuilder();
11777 trace("test IUriBuilder_GetInvalidArgs...\n");
11778 test_IUriBuilder_GetInvalidArgs();
11780 trace("test IUriBuilder_HasBeenModified...\n");
11781 test_IUriBuilder_HasBeenModified();
11783 trace("test IUriBuilder_IUriProperty...\n");
11784 test_IUriBuilder_IUriProperty();
11786 trace("test IUriBuilder_RemoveProperties...\n");
11787 test_IUriBuilder_RemoveProperties();
11789 trace("test IUriBuilder miscellaneous...\n");
11790 test_IUriBuilder_Misc();
11792 trace("test IUriBuilderFactory...\n");
11793 test_IUriBuilderFactory();
11795 trace("test CoInternetCombineIUri...\n");
11796 test_CoInternetCombineIUri();
11798 trace("test CoInternetCombineUrlEx...\n");
11799 test_CoInternetCombineUrlEx();
11801 trace("test CoInternetParseIUri Invalid Args...\n");
11802 test_CoInternetParseIUri_InvalidArgs();
11804 trace("test CoInternetParseIUri...\n");
11805 test_CoInternetParseIUri();
11807 register_protocols();
11809 trace("test CoInternetCombineIUri pluggable...\n");
11810 test_CoInternetCombineIUri_Pluggable();
11812 trace("test CoInternetCombineUrlEx Pluggable...\n");
11813 test_CoInternetCombineUrlEx_Pluggable();
11815 trace("test CoInternetParseIUri pluggable...\n");
11816 test_CoInternetParseIUri_Pluggable();
11818 trace("test CreateURLMoniker...\n");
11819 test_CreateURLMoniker();
11821 CoInitialize(NULL);
11823 trace("test IPersistStream...\n");
11824 test_IPersistStream();
11826 trace("test uninitialized Uri...\n");
11827 test_UninitializedUri();
11829 CoUninitialize();
11830 unregister_protocols();