ucrtbase: Store exception record in ExceptionInformation[6] during unwinding.
[wine.git] / dlls / urlmon / tests / uri.c
blobcc6f5796fddcf76bbc6b9298125f9444d137e0e7
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"
37 DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
39 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
40 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
41 #define URI_BUILDER_STR_PROPERTY_COUNT 7
43 #define DEFINE_EXPECT(func) \
44 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
46 #define SET_EXPECT(func) \
47 expect_ ## func = TRUE
49 #define CHECK_EXPECT(func) \
50 do { \
51 ok(expect_ ##func, "unexpected call " #func "\n"); \
52 expect_ ## func = FALSE; \
53 called_ ## func = TRUE; \
54 }while(0)
56 #define CHECK_EXPECT2(func) \
57 do { \
58 ok(expect_ ##func, "unexpected call " #func "\n"); \
59 called_ ## func = TRUE; \
60 }while(0)
62 #define CHECK_CALLED(func) \
63 do { \
64 ok(called_ ## func, "expected " #func "\n"); \
65 expect_ ## func = called_ ## func = FALSE; \
66 }while(0)
68 DEFINE_EXPECT(CombineUrl);
69 DEFINE_EXPECT(ParseUrl);
71 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
72 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
73 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
74 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
75 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
76 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
77 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
78 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
79 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
81 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
82 '.','o','r','g','/',0};
83 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
84 '.','o','r','g','/','#','F','r','a','g',0};
86 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
87 'e','s','t','i','n','g',0};
88 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
89 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
91 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
93 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
94 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
96 static PARSEACTION parse_action;
97 static DWORD parse_flags;
99 typedef struct _uri_create_flag_test {
100 DWORD flags;
101 HRESULT expected;
102 } uri_create_flag_test;
104 static const uri_create_flag_test invalid_flag_tests[] = {
105 /* Set of invalid flag combinations to test for. */
106 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
107 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
108 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
109 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
110 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
113 typedef struct _uri_str_property {
114 const char* value;
115 HRESULT expected;
116 BOOL todo;
117 const char* broken_value;
118 const char* value2;
119 HRESULT expected2;
120 } uri_str_property;
122 typedef struct _uri_dword_property {
123 DWORD value;
124 HRESULT expected;
125 BOOL todo;
126 BOOL broken_combine_hres;
127 } uri_dword_property;
129 typedef struct _uri_properties {
130 const char* uri;
131 DWORD create_flags;
132 HRESULT create_expected;
133 BOOL create_todo;
135 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
136 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
137 } uri_properties;
139 static const uri_properties uri_tests[] = {
140 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
142 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
143 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
144 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
145 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
146 {"",S_FALSE,FALSE}, /* EXTENSION */
147 {"",S_FALSE,FALSE}, /* FRAGMENT */
148 {"www.winehq.org",S_OK,FALSE}, /* HOST */
149 {"",S_FALSE,FALSE}, /* PASSWORD */
150 {"/",S_OK,FALSE}, /* PATH */
151 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
152 {"",S_FALSE,FALSE}, /* QUERY */
153 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
154 {"http",S_OK,FALSE}, /* SCHEME_NAME */
155 {"",S_FALSE,FALSE}, /* USER_INFO */
156 {"",S_FALSE,FALSE} /* USER_NAME */
159 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
160 {80,S_OK,FALSE}, /* PORT */
161 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
162 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
165 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
167 {"http://winehq.org/tests",S_OK,FALSE},
168 {"winehq.org",S_OK,FALSE},
169 {"http://winehq.org/tests",S_OK,FALSE},
170 {"winehq.org",S_OK,FALSE},
171 {"",S_FALSE,FALSE},
172 {"",S_FALSE,FALSE},
173 {"winehq.org",S_OK,FALSE},
174 {"",S_FALSE,FALSE},
175 {"/tests",S_OK,FALSE},
176 {"/tests",S_OK,FALSE},
177 {"",S_FALSE,FALSE},
178 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
179 {"http",S_OK,FALSE},
180 {"",S_FALSE,FALSE},
181 {"",S_FALSE,FALSE}
184 {Uri_HOST_DNS,S_OK,FALSE},
185 {80,S_OK,FALSE},
186 {URL_SCHEME_HTTP,S_OK,FALSE},
187 {URLZONE_INVALID,E_NOTIMPL,FALSE}
190 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
192 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
193 {"www.winehq.org",S_OK,FALSE},
194 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
195 {"winehq.org",S_OK,FALSE},
196 {"",S_FALSE,FALSE},
197 {"",S_FALSE,FALSE},
198 {"www.winehq.org",S_OK,FALSE},
199 {"",S_FALSE,FALSE},
200 {"/",S_OK,FALSE},
201 {"/?query=x&return=y",S_OK,FALSE},
202 {"?query=x&return=y",S_OK,FALSE},
203 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
204 {"http",S_OK,FALSE},
205 {"",S_FALSE,FALSE},
206 {"",S_FALSE,FALSE}
209 {Uri_HOST_DNS,S_OK,FALSE},
210 {80,S_OK,FALSE},
211 {URL_SCHEME_HTTP,S_OK,FALSE},
212 {URLZONE_INVALID,E_NOTIMPL,FALSE},
215 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
217 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
218 {"www.winehq.org",S_OK,FALSE},
219 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
220 {"winehq.org",S_OK,FALSE},
221 {"",S_FALSE,FALSE},
222 {"",S_FALSE,FALSE},
223 {"www.winehq.org",S_OK,FALSE},
224 {"",S_FALSE,FALSE},
225 {"/",S_OK,FALSE},
226 {"/?query=x&return=y",S_OK,FALSE},
227 {"?query=x&return=y",S_OK,FALSE},
228 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
229 {"https",S_OK,FALSE},
230 {"",S_FALSE,FALSE},
231 {"",S_FALSE,FALSE}
234 {Uri_HOST_DNS,S_OK,FALSE},
235 {443,S_OK,FALSE},
236 {URL_SCHEME_HTTPS,S_OK,FALSE},
237 {URLZONE_INVALID,E_NOTIMPL,FALSE},
240 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
242 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
243 {"usEr%3Ainfo@example.com",S_OK,FALSE},
244 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
245 {"example.com",S_OK,FALSE},
246 {"",S_FALSE,FALSE},
247 {"",S_FALSE,FALSE},
248 {"example.com",S_OK,FALSE},
249 {"",S_FALSE,FALSE},
250 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
251 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
252 {"",S_FALSE,FALSE},
253 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
254 {"http",S_OK,FALSE},
255 {"usEr%3Ainfo",S_OK,FALSE},
256 {"usEr%3Ainfo",S_OK,FALSE}
259 {Uri_HOST_DNS,S_OK,FALSE},
260 {80,S_OK,FALSE},
261 {URL_SCHEME_HTTP,S_OK,FALSE},
262 {URLZONE_INVALID,E_NOTIMPL,FALSE},
265 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
267 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
268 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
269 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
270 {"winehq.org",S_OK,FALSE},
271 {".txt",S_OK,FALSE},
272 {"",S_FALSE,FALSE},
273 {"ftp.winehq.org",S_OK,FALSE},
274 {"wine",S_OK,FALSE},
275 {"/dir/foo%20bar.txt",S_OK,FALSE},
276 {"/dir/foo%20bar.txt",S_OK,FALSE},
277 {"",S_FALSE,FALSE},
278 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
279 {"ftp",S_OK,FALSE},
280 {"winepass:wine",S_OK,FALSE},
281 {"winepass",S_OK,FALSE}
284 {Uri_HOST_DNS,S_OK,FALSE},
285 {9999,S_OK,FALSE},
286 {URL_SCHEME_FTP,S_OK,FALSE},
287 {URLZONE_INVALID,E_NOTIMPL,FALSE}
290 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
292 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
293 {"",S_FALSE,FALSE},
294 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
295 {"",S_FALSE,FALSE},
296 {".mp3",S_OK,FALSE},
297 {"",S_FALSE,FALSE},
298 {"",S_FALSE,FALSE},
299 {"",S_FALSE,FALSE},
300 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
301 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
302 {"",S_FALSE,FALSE},
303 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
304 {"file",S_OK,FALSE},
305 {"",S_FALSE,FALSE},
306 {"",S_FALSE,FALSE}
309 {Uri_HOST_UNKNOWN,S_OK,FALSE},
310 {0,S_FALSE,FALSE},
311 {URL_SCHEME_FILE,S_OK,FALSE},
312 {URLZONE_INVALID,E_NOTIMPL,FALSE}
315 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
317 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
318 {"",S_FALSE,FALSE},
319 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
320 {"",S_FALSE,FALSE},
321 {".mp3",S_OK,FALSE},
322 {"",S_FALSE,FALSE},
323 {"",S_FALSE,FALSE},
324 {"",S_FALSE,FALSE},
325 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
326 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
327 {"",S_FALSE,FALSE},
328 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
329 {"file",S_OK,FALSE},
330 {"",S_FALSE,FALSE},
331 {"",S_FALSE,FALSE}
334 {Uri_HOST_UNKNOWN,S_OK,FALSE},
335 {0,S_FALSE,FALSE},
336 {URL_SCHEME_FILE,S_OK,FALSE},
337 {URLZONE_INVALID,E_NOTIMPL,FALSE}
340 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
342 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
343 {"",S_FALSE,FALSE},
344 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
345 {"",S_FALSE,FALSE},
346 {".txt",S_OK,FALSE},
347 {"",S_FALSE,FALSE},
348 {"",S_FALSE,FALSE},
349 {"",S_FALSE,FALSE},
350 {"/tests/test%20file.README.txt",S_OK,FALSE},
351 {"/tests/test%20file.README.txt",S_OK,FALSE},
352 {"",S_FALSE,FALSE},
353 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
354 {"file",S_OK,FALSE},
355 {"",S_FALSE,FALSE},
356 {"",S_FALSE,FALSE}
359 {Uri_HOST_UNKNOWN,S_OK,FALSE},
360 {0,S_FALSE,FALSE},
361 {URL_SCHEME_FILE,S_OK,FALSE},
362 {URLZONE_INVALID,E_NOTIMPL,FALSE}
365 { "file:///z:/test dir/README.txt", 0, S_OK, FALSE,
367 {"file:///z:/test%20dir/README.txt",S_OK},
368 {"",S_FALSE},
369 {"file:///z:/test%20dir/README.txt",S_OK},
370 {"",S_FALSE},
371 {".txt",S_OK},
372 {"",S_FALSE},
373 {"",S_FALSE},
374 {"",S_FALSE},
375 {"/z:/test%20dir/README.txt",S_OK},
376 {"/z:/test%20dir/README.txt",S_OK},
377 {"",S_FALSE},
378 {"file:///z:/test dir/README.txt",S_OK},
379 {"file",S_OK},
380 {"",S_FALSE},
381 {"",S_FALSE}
384 {Uri_HOST_UNKNOWN,S_OK,FALSE},
385 {0,S_FALSE,FALSE},
386 {URL_SCHEME_FILE,S_OK,FALSE},
387 {URLZONE_INVALID,E_NOTIMPL,FALSE}
390 { "file:///z:/test dir/README.txt#hash part", 0, S_OK, FALSE,
392 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
393 {"",S_FALSE},
394 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
395 {"",S_FALSE},
396 {".txt#hash%20part",S_OK},
397 {"",S_FALSE},
398 {"",S_FALSE},
399 {"",S_FALSE},
400 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
401 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
402 {"",S_FALSE},
403 {"file:///z:/test dir/README.txt#hash part",S_OK},
404 {"file",S_OK},
405 {"",S_FALSE},
406 {"",S_FALSE}
409 {Uri_HOST_UNKNOWN,S_OK,FALSE},
410 {0,S_FALSE,FALSE},
411 {URL_SCHEME_FILE,S_OK,FALSE},
412 {URLZONE_INVALID,E_NOTIMPL,FALSE}
415 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
417 {"urn:nothing:should:happen here",S_OK,FALSE},
418 {"",S_FALSE,FALSE},
419 {"urn:nothing:should:happen here",S_OK,FALSE},
420 {"",S_FALSE,FALSE},
421 {"",S_FALSE,FALSE},
422 {"",S_FALSE,FALSE},
423 {"",S_FALSE,FALSE},
424 {"",S_FALSE,FALSE},
425 {"nothing:should:happen here",S_OK,FALSE},
426 {"nothing:should:happen here",S_OK,FALSE},
427 {"",S_FALSE,FALSE},
428 {"urn:nothing:should:happen here",S_OK,FALSE},
429 {"urn",S_OK,FALSE},
430 {"",S_FALSE,FALSE},
431 {"",S_FALSE,FALSE}
434 {Uri_HOST_UNKNOWN,S_OK,FALSE},
435 {0,S_FALSE,FALSE},
436 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
437 {URLZONE_INVALID,E_NOTIMPL,FALSE}
440 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
442 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
443 {"127.0.0.1",S_OK,FALSE},
444 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
445 {"",S_FALSE,FALSE},
446 {".txt",S_OK,FALSE},
447 {"",S_FALSE,FALSE},
448 {"127.0.0.1",S_OK,FALSE},
449 {"",S_FALSE,FALSE},
450 {"/test%20dir/test.txt",S_OK,FALSE},
451 {"/test%20dir/test.txt",S_OK,FALSE},
452 {"",S_FALSE,FALSE},
453 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
454 {"http",S_OK,FALSE},
455 {"",S_FALSE,FALSE},
456 {"",S_FALSE,FALSE}
459 {Uri_HOST_IPV4,S_OK,FALSE},
460 {80,S_OK,FALSE},
461 {URL_SCHEME_HTTP,S_OK,FALSE},
462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
465 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
467 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
468 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
469 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
470 {"",S_FALSE,FALSE},
471 {"",S_FALSE,FALSE},
472 {"",S_FALSE,FALSE},
473 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
474 {"",S_FALSE,FALSE},
475 {"/",S_OK,FALSE},
476 {"/",S_OK,FALSE},
477 {"",S_FALSE,FALSE},
478 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
479 {"http",S_OK,FALSE},
480 {"",S_FALSE,FALSE},
481 {"",S_FALSE,FALSE}
484 {Uri_HOST_IPV6,S_OK,FALSE},
485 {80,S_OK,FALSE},
486 {URL_SCHEME_HTTP,S_OK,FALSE},
487 {URLZONE_INVALID,E_NOTIMPL,FALSE}
490 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
492 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
493 {"[::13.1.68.3]",S_OK,FALSE},
494 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
495 {"",S_FALSE,FALSE},
496 {"",S_FALSE,FALSE},
497 {"",S_FALSE,FALSE},
498 {"::13.1.68.3",S_OK,FALSE},
499 {"",S_FALSE,FALSE},
500 {"/",S_OK,FALSE},
501 {"/",S_OK,FALSE},
502 {"",S_FALSE,FALSE},
503 {"ftp://[::13.1.68.3]",S_OK,FALSE},
504 {"ftp",S_OK,FALSE},
505 {"",S_FALSE,FALSE},
506 {"",S_FALSE,FALSE}
509 {Uri_HOST_IPV6,S_OK,FALSE},
510 {21,S_OK,FALSE},
511 {URL_SCHEME_FTP,S_OK,FALSE},
512 {URLZONE_INVALID,E_NOTIMPL,FALSE}
515 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
517 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
518 {"[fedc:ba98::3210]",S_OK,FALSE},
519 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
520 {"",S_FALSE,FALSE},
521 {"",S_FALSE,FALSE},
522 {"",S_FALSE,FALSE},
523 {"fedc:ba98::3210",S_OK,FALSE},
524 {"",S_FALSE,FALSE},
525 {"/",S_OK,FALSE},
526 {"/",S_OK,FALSE},
527 {"",S_FALSE,FALSE},
528 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
529 {"http",S_OK,FALSE},
530 {"",S_FALSE,FALSE},
531 {"",S_FALSE,FALSE},
534 {Uri_HOST_IPV6,S_OK,FALSE},
535 {80,S_OK,FALSE},
536 {URL_SCHEME_HTTP,S_OK,FALSE},
537 {URLZONE_INVALID,E_NOTIMPL,FALSE}
540 { "1234://www.winehq.org", 0, S_OK, FALSE,
542 {"1234://www.winehq.org/",S_OK,FALSE},
543 {"www.winehq.org",S_OK,FALSE},
544 {"1234://www.winehq.org/",S_OK,FALSE},
545 {"winehq.org",S_OK,FALSE},
546 {"",S_FALSE,FALSE},
547 {"",S_FALSE,FALSE},
548 {"www.winehq.org",S_OK,FALSE},
549 {"",S_FALSE,FALSE},
550 {"/",S_OK,FALSE},
551 {"/",S_OK,FALSE},
552 {"",S_FALSE,FALSE},
553 {"1234://www.winehq.org",S_OK,FALSE},
554 {"1234",S_OK,FALSE},
555 {"",S_FALSE,FALSE},
556 {"",S_FALSE,FALSE}
559 {Uri_HOST_DNS,S_OK,FALSE},
560 {0,S_FALSE,FALSE},
561 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
562 {URLZONE_INVALID,E_NOTIMPL,FALSE}
565 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
566 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
568 {"file:///C:/test/test.mp3",S_OK,FALSE},
569 {"",S_FALSE,FALSE},
570 {"file:///C:/test/test.mp3",S_OK,FALSE},
571 {"",S_FALSE,FALSE},
572 {".mp3",S_OK,FALSE},
573 {"",S_FALSE,FALSE},
574 {"",S_FALSE,FALSE},
575 {"",S_FALSE,FALSE},
576 {"/C:/test/test.mp3",S_OK,FALSE},
577 {"/C:/test/test.mp3",S_OK,FALSE},
578 {"",S_FALSE,FALSE},
579 {"C:/test/test.mp3",S_OK,FALSE},
580 {"file",S_OK,FALSE},
581 {"",S_FALSE,FALSE},
582 {"",S_FALSE,FALSE}
585 {Uri_HOST_UNKNOWN,S_OK,FALSE},
586 {0,S_FALSE,FALSE},
587 {URL_SCHEME_FILE,S_OK,FALSE},
588 {URLZONE_INVALID,E_NOTIMPL,FALSE}
591 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
592 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
594 {"file://server/test.mp3",S_OK,FALSE},
595 {"server",S_OK,FALSE},
596 {"file://server/test.mp3",S_OK,FALSE},
597 {"",S_FALSE,FALSE},
598 {".mp3",S_OK,FALSE},
599 {"",S_FALSE,FALSE},
600 {"server",S_OK,FALSE},
601 {"",S_FALSE,FALSE},
602 {"/test.mp3",S_OK,FALSE},
603 {"/test.mp3",S_OK,FALSE},
604 {"",S_FALSE,FALSE},
605 {"\\\\Server/test.mp3",S_OK,FALSE},
606 {"file",S_OK,FALSE},
607 {"",S_FALSE,FALSE},
608 {"",S_FALSE,FALSE}
611 {Uri_HOST_DNS,S_OK,FALSE},
612 {0,S_FALSE,FALSE},
613 {URL_SCHEME_FILE,S_OK,FALSE},
614 {URLZONE_INVALID,E_NOTIMPL,FALSE}
617 { "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,
619 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
620 {"",S_FALSE,FALSE},
621 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
622 {"",S_FALSE,FALSE},
623 {".mp3#fragment|part",S_OK,FALSE},
624 {"",S_FALSE,FALSE},
625 {"",S_FALSE,FALSE},
626 {"",S_FALSE,FALSE},
627 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
628 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
629 {"",S_FALSE,FALSE},
630 {"C:/test/test.mp3#fragment|part",S_OK,FALSE},
631 {"file",S_OK,FALSE},
632 {"",S_FALSE,FALSE},
633 {"",S_FALSE,FALSE}
636 {Uri_HOST_UNKNOWN,S_OK,FALSE},
637 {0,S_FALSE,FALSE},
638 {URL_SCHEME_FILE,S_OK,FALSE},
639 {URLZONE_INVALID,E_NOTIMPL,FALSE}
642 { "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,
644 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
645 {"",S_FALSE,FALSE},
646 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
647 {"",S_FALSE,FALSE},
648 {".mp3",S_OK,FALSE},
649 {"",S_FALSE,FALSE},
650 {"",S_FALSE,FALSE},
651 {"",S_FALSE,FALSE},
652 {"C:\\test\\test.mp3",S_OK,FALSE},
653 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
654 {"?query|part",S_OK,FALSE},
655 {"C:/test/test.mp3?query|part",S_OK,FALSE},
656 {"file",S_OK,FALSE},
657 {"",S_FALSE,FALSE},
658 {"",S_FALSE,FALSE}
661 {Uri_HOST_UNKNOWN,S_OK,FALSE},
662 {0,S_FALSE,FALSE},
663 {URL_SCHEME_FILE,S_OK,FALSE},
664 {URLZONE_INVALID,E_NOTIMPL,FALSE}
667 { "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,
669 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
670 {"",S_FALSE,FALSE},
671 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
672 {"",S_FALSE,FALSE},
673 {".mp3",S_OK,FALSE},
674 {"#hash|part",S_OK,FALSE},
675 {"",S_FALSE,FALSE},
676 {"",S_FALSE,FALSE},
677 {"C:\\test\\test.mp3",S_OK,FALSE},
678 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
679 {"?query|part",S_OK,FALSE},
680 {"C:/test/test.mp3?query|part#hash|part",S_OK,FALSE},
681 {"file",S_OK,FALSE},
682 {"",S_FALSE,FALSE},
683 {"",S_FALSE,FALSE}
686 {Uri_HOST_UNKNOWN,S_OK,FALSE},
687 {0,S_FALSE,FALSE},
688 {URL_SCHEME_FILE,S_OK,FALSE},
689 {URLZONE_INVALID,E_NOTIMPL,FALSE}
692 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
694 {"*:www.winehq.org/test",S_OK,FALSE},
695 {"www.winehq.org",S_OK,FALSE},
696 {"*:www.winehq.org/test",S_OK,FALSE},
697 {"winehq.org",S_OK,FALSE},
698 {"",S_FALSE,FALSE},
699 {"",S_FALSE,FALSE},
700 {"www.winehq.org",S_OK,FALSE},
701 {"",S_FALSE,FALSE},
702 {"/test",S_OK,FALSE},
703 {"/test",S_OK,FALSE},
704 {"",S_FALSE,FALSE},
705 {"www.winehq.org/test",S_OK,FALSE},
706 {"*",S_OK,FALSE},
707 {"",S_FALSE,FALSE},
708 {"",S_FALSE,FALSE}
711 {Uri_HOST_DNS,S_OK,FALSE},
712 {0,S_FALSE,FALSE},
713 {URL_SCHEME_WILDCARD,S_OK,FALSE},
714 {URLZONE_INVALID,E_NOTIMPL,FALSE}
717 /* Valid since the '*' is the only character in the scheme name. */
718 { "*:www.winehq.org/test", 0, S_OK, FALSE,
720 {"*:www.winehq.org/test",S_OK,FALSE},
721 {"www.winehq.org",S_OK,FALSE},
722 {"*:www.winehq.org/test",S_OK,FALSE},
723 {"winehq.org",S_OK,FALSE},
724 {"",S_FALSE,FALSE},
725 {"",S_FALSE,FALSE},
726 {"www.winehq.org",S_OK,FALSE},
727 {"",S_FALSE,FALSE},
728 {"/test",S_OK,FALSE},
729 {"/test",S_OK,FALSE},
730 {"",S_FALSE,FALSE},
731 {"*:www.winehq.org/test",S_OK,FALSE},
732 {"*",S_OK,FALSE},
733 {"",S_FALSE,FALSE},
734 {"",S_FALSE,FALSE}
737 {Uri_HOST_DNS,S_OK,FALSE},
738 {0,S_FALSE,FALSE},
739 {URL_SCHEME_WILDCARD,S_OK,FALSE},
740 {URLZONE_INVALID,E_NOTIMPL,FALSE}
743 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
745 {"/../some dir/test.ext",S_OK,FALSE},
746 {"",S_FALSE,FALSE},
747 {"/../some dir/test.ext",S_OK,FALSE},
748 {"",S_FALSE,FALSE},
749 {".ext",S_OK,FALSE},
750 {"",S_FALSE,FALSE},
751 {"",S_FALSE,FALSE},
752 {"",S_FALSE,FALSE},
753 {"/../some dir/test.ext",S_OK,FALSE},
754 {"/../some dir/test.ext",S_OK,FALSE},
755 {"",S_FALSE,FALSE},
756 {"/../some dir/test.ext",S_OK,FALSE},
757 {"",S_FALSE,FALSE},
758 {"",S_FALSE,FALSE},
759 {"",S_FALSE,FALSE}
762 {Uri_HOST_UNKNOWN,S_OK,FALSE},
763 {0,S_FALSE,FALSE},
764 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
765 {URLZONE_INVALID,E_NOTIMPL,FALSE}
768 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
770 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
771 {"",S_OK,FALSE},
772 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
773 {"",S_FALSE,FALSE},
774 {"",S_FALSE,FALSE},
775 {"",S_FALSE,FALSE},
776 {"",S_OK,FALSE},
777 {"",S_FALSE,FALSE},
778 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
779 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
780 {"",S_FALSE,FALSE},
781 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
782 {"*",S_OK,FALSE},
783 {"",S_FALSE,FALSE},
784 {"",S_FALSE,FALSE},
787 {Uri_HOST_UNKNOWN,S_OK,FALSE},
788 {0,S_FALSE,FALSE},
789 {URL_SCHEME_WILDCARD,S_OK,FALSE},
790 {URLZONE_INVALID,E_NOTIMPL,FALSE}
793 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
794 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
796 {"zip:/.//google.com",S_OK,FALSE},
797 {"",S_FALSE,FALSE},
798 {"zip:/.//google.com",S_OK,FALSE},
799 {"",S_FALSE,FALSE},
800 {".com",S_OK,FALSE},
801 {"",S_FALSE,FALSE},
802 {"",S_FALSE,FALSE},
803 {"",S_FALSE,FALSE},
804 {"/.//google.com",S_OK,FALSE},
805 {"/.//google.com",S_OK,FALSE},
806 {"",S_FALSE,FALSE},
807 {"zip://google.com",S_OK,FALSE},
808 {"zip",S_OK,FALSE},
809 {"",S_FALSE,FALSE},
810 {"",S_FALSE,FALSE}
813 {Uri_HOST_UNKNOWN,S_OK,FALSE},
814 {0,S_FALSE,FALSE},
815 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
816 {URLZONE_INVALID,E_NOTIMPL,FALSE}
819 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
820 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
822 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
823 {"user:pass:word@winehq.org",S_OK,FALSE},
824 {"ftp://winehq.org/",S_OK,FALSE},
825 {"winehq.org",S_OK,FALSE},
826 {"",S_FALSE,FALSE},
827 {"",S_FALSE,FALSE},
828 {"winehq.org",S_OK,FALSE},
829 {"pass:word",S_OK,FALSE},
830 {"/",S_OK,FALSE},
831 {"/",S_OK,FALSE},
832 {"",S_FALSE,FALSE},
833 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
834 {"ftp",S_OK,FALSE},
835 {"user:pass:word",S_OK,FALSE},
836 {"user",S_OK,FALSE}
839 {Uri_HOST_DNS,S_OK,FALSE},
840 {21,S_OK,FALSE},
841 {URL_SCHEME_FTP,S_OK,FALSE},
842 {URLZONE_INVALID,E_NOTIMPL,FALSE}
845 /* Make sure % encoded unreserved characters are decoded. */
846 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
848 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
849 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
850 {"ftp://ftp.google.com/",S_OK,FALSE},
851 {"google.com",S_OK,FALSE},
852 {"",S_FALSE,FALSE},
853 {"",S_FALSE,FALSE},
854 {"ftp.google.com",S_OK,FALSE},
855 {"PASS",S_OK,FALSE},
856 {"/",S_OK,FALSE},
857 {"/",S_OK,FALSE},
858 {"",S_FALSE,FALSE},
859 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
860 {"ftp",S_OK,FALSE},
861 {"wINe:PASS",S_OK,FALSE},
862 {"wINe",S_OK,FALSE}
865 {Uri_HOST_DNS,S_OK,FALSE},
866 {21,S_OK,FALSE},
867 {URL_SCHEME_FTP,S_OK,FALSE},
868 {URLZONE_INVALID,E_NOTIMPL,FALSE}
871 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
872 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
874 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
875 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
876 {"ftp://ftp.google.com/",S_OK,FALSE},
877 {"google.com",S_OK,FALSE},
878 {"",S_FALSE,FALSE},
879 {"",S_FALSE,FALSE},
880 {"ftp.google.com",S_OK,FALSE},
881 {"PA%7B%7D",S_OK,FALSE},
882 {"/",S_OK,FALSE},
883 {"/",S_OK,FALSE},
884 {"",S_FALSE,FALSE},
885 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
886 {"ftp",S_OK,FALSE},
887 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
888 {"w%5D%5Be",S_OK,FALSE}
891 {Uri_HOST_DNS,S_OK,FALSE},
892 {21,S_OK,FALSE},
893 {URL_SCHEME_FTP,S_OK,FALSE},
894 {URLZONE_INVALID,E_NOTIMPL,FALSE}
897 /* You're allowed to have an empty password portion in the userinfo section. */
898 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
900 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
901 {"empty:@ftp.google.com",S_OK,FALSE},
902 {"ftp://ftp.google.com/",S_OK,FALSE},
903 {"google.com",S_OK,FALSE},
904 {"",S_FALSE,FALSE},
905 {"",S_FALSE,FALSE},
906 {"ftp.google.com",S_OK,FALSE},
907 {"",S_OK,FALSE},
908 {"/",S_OK,FALSE},
909 {"/",S_OK,FALSE},
910 {"",S_FALSE,FALSE},
911 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
912 {"ftp",S_OK,FALSE},
913 {"empty:",S_OK,FALSE},
914 {"empty",S_OK,FALSE}
917 {Uri_HOST_DNS,S_OK,FALSE},
918 {21,S_OK,FALSE},
919 {URL_SCHEME_FTP,S_OK,FALSE},
920 {URLZONE_INVALID,E_NOTIMPL,FALSE}
923 /* Make sure forbidden characters in "userinfo" get encoded. */
924 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
926 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
927 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
928 {"ftp://ftp.google.com/",S_OK,FALSE},
929 {"google.com",S_OK,FALSE},
930 {"",S_FALSE,FALSE},
931 {"",S_FALSE,FALSE},
932 {"ftp.google.com",S_OK,FALSE},
933 {"",S_FALSE,FALSE},
934 {"/",S_OK,FALSE},
935 {"/",S_OK,FALSE},
936 {"",S_FALSE,FALSE},
937 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
938 {"ftp",S_OK,FALSE},
939 {"%22%20%22weird",S_OK,FALSE},
940 {"%22%20%22weird",S_OK,FALSE}
943 {Uri_HOST_DNS,S_OK,FALSE},
944 {21,S_OK,FALSE},
945 {URL_SCHEME_FTP,S_OK,FALSE},
946 {URLZONE_INVALID,E_NOTIMPL,FALSE}
949 /* Make sure the forbidden characters don't get percent encoded. */
950 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
952 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
953 {"\" \"weird@ftp.google.com",S_OK,FALSE},
954 {"ftp://ftp.google.com/",S_OK,FALSE},
955 {"google.com",S_OK,FALSE},
956 {"",S_FALSE,FALSE},
957 {"",S_FALSE,FALSE},
958 {"ftp.google.com",S_OK,FALSE},
959 {"",S_FALSE,FALSE},
960 {"/",S_OK,FALSE},
961 {"/",S_OK,FALSE},
962 {"",S_FALSE,FALSE},
963 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
964 {"ftp",S_OK,FALSE},
965 {"\" \"weird",S_OK,FALSE},
966 {"\" \"weird",S_OK,FALSE}
969 {Uri_HOST_DNS,S_OK,FALSE},
970 {21,S_OK,FALSE},
971 {URL_SCHEME_FTP,S_OK,FALSE},
972 {URLZONE_INVALID,E_NOTIMPL,FALSE}
975 /* Make sure already percent encoded characters don't get unencoded. */
976 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
978 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
979 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
980 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
981 {"google.com",S_OK,FALSE},
982 {"",S_FALSE,FALSE},
983 {"",S_FALSE,FALSE},
984 {"ftp.google.com",S_OK,FALSE},
985 {"",S_FALSE,FALSE},
986 {"/\"%20\"weird",S_OK,FALSE},
987 {"/\"%20\"weird",S_OK,FALSE},
988 {"",S_FALSE,FALSE},
989 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
990 {"ftp",S_OK,FALSE},
991 {"\"%20\"weird",S_OK,FALSE},
992 {"\"%20\"weird",S_OK,FALSE}
995 {Uri_HOST_DNS,S_OK,FALSE},
996 {21,S_OK,FALSE},
997 {URL_SCHEME_FTP,S_OK,FALSE},
998 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1001 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
1002 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
1004 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1005 {"%xy:word@winehq.org",S_OK,FALSE},
1006 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1007 {"winehq.org",S_OK,FALSE},
1008 {"",S_FALSE,FALSE},
1009 {"",S_FALSE,FALSE},
1010 {"winehq.org",S_OK,FALSE},
1011 {"word",S_OK,FALSE},
1012 {"/",S_OK,FALSE},
1013 {"/",S_OK,FALSE},
1014 {"",S_FALSE,FALSE},
1015 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1016 {"zip",S_OK,FALSE},
1017 {"%xy:word",S_OK,FALSE},
1018 {"%xy",S_OK,FALSE}
1021 {Uri_HOST_DNS,S_OK,FALSE},
1022 {0,S_FALSE,FALSE},
1023 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1024 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1027 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
1028 * isn't known.
1030 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
1032 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1033 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
1034 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1035 {"winehq.org",S_OK,FALSE},
1036 {"",S_FALSE,FALSE},
1037 {"",S_FALSE,FALSE},
1038 {"winehq.org",S_OK,FALSE},
1039 {"%52%53ord",S_OK,FALSE},
1040 {"/",S_OK,FALSE},
1041 {"/",S_OK,FALSE},
1042 {"",S_FALSE,FALSE},
1043 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1044 {"zip",S_OK,FALSE},
1045 {"%2E:%52%53ord",S_OK,FALSE},
1046 {"%2E",S_OK,FALSE}
1049 {Uri_HOST_DNS,S_OK,FALSE},
1050 {0,S_FALSE,FALSE},
1051 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1052 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1055 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
1057 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1058 {"[](),'test':word@winehq.org",S_OK,FALSE},
1059 {"ftp://winehq.org/",S_OK,FALSE},
1060 {"winehq.org",S_OK,FALSE},
1061 {"",S_FALSE,FALSE},
1062 {"",S_FALSE,FALSE},
1063 {"winehq.org",S_OK,FALSE},
1064 {"word",S_OK,FALSE},
1065 {"/",S_OK,FALSE},
1066 {"/",S_OK,FALSE},
1067 {"",S_FALSE,FALSE},
1068 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1069 {"ftp",S_OK,FALSE},
1070 {"[](),'test':word",S_OK,FALSE},
1071 {"[](),'test'",S_OK,FALSE}
1074 {Uri_HOST_DNS,S_OK,FALSE},
1075 {21,S_OK,FALSE},
1076 {URL_SCHEME_FTP,S_OK,FALSE},
1077 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1080 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
1082 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1083 {"test",S_OK,FALSE},
1084 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1085 {"",S_FALSE,FALSE},
1086 {"",S_FALSE,FALSE},
1087 {"",S_FALSE,FALSE},
1088 {"test",S_OK,FALSE},
1089 {"",S_FALSE,FALSE},
1090 {"/",S_OK,FALSE},
1091 {"/?:word@winehq.org/",S_OK,FALSE},
1092 {"?:word@winehq.org/",S_OK,FALSE},
1093 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
1094 {"ftp",S_OK,FALSE},
1095 {"",S_FALSE,FALSE},
1096 {"",S_FALSE,FALSE}
1099 {Uri_HOST_DNS,S_OK,FALSE},
1100 {21,S_OK,FALSE},
1101 {URL_SCHEME_FTP,S_OK,FALSE},
1102 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1105 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1107 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1108 {"test",S_OK,FALSE},
1109 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1110 {"",S_FALSE,FALSE},
1111 {"",S_FALSE,FALSE},
1112 {"#:word@winehq.org/",S_OK,FALSE},
1113 {"test",S_OK,FALSE},
1114 {"",S_FALSE,FALSE},
1115 {"/",S_OK,FALSE},
1116 {"/",S_OK,FALSE},
1117 {"",S_FALSE,FALSE},
1118 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1119 {"ftp",S_OK,FALSE},
1120 {"",S_FALSE,FALSE},
1121 {"",S_FALSE,FALSE}
1124 {Uri_HOST_DNS,S_OK,FALSE},
1125 {21,S_OK,FALSE},
1126 {URL_SCHEME_FTP,S_OK,FALSE},
1127 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1130 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1131 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1133 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1134 {"test\\:word@winehq.org",S_OK,FALSE},
1135 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1136 {"winehq.org",S_OK,FALSE},
1137 {"",S_FALSE,FALSE},
1138 {"",S_FALSE,FALSE},
1139 {"winehq.org",S_OK,FALSE},
1140 {"word",S_OK,FALSE},
1141 {"/",S_OK,FALSE},
1142 {"/",S_OK,FALSE},
1143 {"",S_FALSE,FALSE},
1144 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1145 {"zip",S_OK,FALSE},
1146 {"test\\:word",S_OK,FALSE},
1147 {"test\\",S_OK,FALSE}
1150 {Uri_HOST_DNS,S_OK,FALSE},
1151 {0,S_FALSE,FALSE},
1152 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1153 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1156 /* It normalizes IPv4 addresses correctly. */
1157 { "http://127.000.000.100/", 0, S_OK, FALSE,
1159 {"http://127.0.0.100/",S_OK,FALSE},
1160 {"127.0.0.100",S_OK,FALSE},
1161 {"http://127.0.0.100/",S_OK,FALSE},
1162 {"",S_FALSE,FALSE},
1163 {"",S_FALSE,FALSE},
1164 {"",S_FALSE,FALSE},
1165 {"127.0.0.100",S_OK,FALSE},
1166 {"",S_FALSE,FALSE},
1167 {"/",S_OK,FALSE},
1168 {"/",S_OK,FALSE},
1169 {"",S_FALSE,FALSE},
1170 {"http://127.000.000.100/",S_OK,FALSE},
1171 {"http",S_OK,FALSE},
1172 {"",S_FALSE,FALSE},
1173 {"",S_FALSE,FALSE}
1176 {Uri_HOST_IPV4,S_OK,FALSE},
1177 {80,S_OK,FALSE},
1178 {URL_SCHEME_HTTP,S_OK,FALSE},
1179 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1182 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1184 {"http://127.0.0.1:8000/",S_OK},
1185 {"127.0.0.1:8000",S_OK},
1186 {"http://127.0.0.1:8000/",S_OK},
1187 {"",S_FALSE},
1188 {"",S_FALSE},
1189 {"",S_FALSE},
1190 {"127.0.0.1",S_OK},
1191 {"",S_FALSE},
1192 {"/",S_OK},
1193 {"/",S_OK},
1194 {"",S_FALSE},
1195 {"http://127.0.0.1:8000",S_OK},
1196 {"http",S_OK},
1197 {"",S_FALSE},
1198 {"",S_FALSE}
1201 {Uri_HOST_IPV4,S_OK,FALSE},
1202 {8000,S_OK,FALSE},
1203 {URL_SCHEME_HTTP,S_OK,FALSE},
1204 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1207 /* Make sure it normalizes partial IPv4 addresses correctly. */
1208 { "http://127.0/", 0, S_OK, FALSE,
1210 {"http://127.0.0.0/",S_OK,FALSE},
1211 {"127.0.0.0",S_OK,FALSE},
1212 {"http://127.0.0.0/",S_OK,FALSE},
1213 {"",S_FALSE,FALSE},
1214 {"",S_FALSE,FALSE},
1215 {"",S_FALSE,FALSE},
1216 {"127.0.0.0",S_OK,FALSE},
1217 {"",S_FALSE,FALSE},
1218 {"/",S_OK,FALSE},
1219 {"/",S_OK,FALSE},
1220 {"",S_FALSE,FALSE},
1221 {"http://127.0/",S_OK,FALSE},
1222 {"http",S_OK,FALSE},
1223 {"",S_FALSE,FALSE},
1224 {"",S_FALSE,FALSE}
1227 {Uri_HOST_IPV4,S_OK,FALSE},
1228 {80,S_OK,FALSE},
1229 {URL_SCHEME_HTTP,S_OK,FALSE},
1230 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1233 /* Make sure it converts implicit IPv4's correctly. */
1234 { "http://123456/", 0, S_OK, FALSE,
1236 {"http://0.1.226.64/",S_OK,FALSE},
1237 {"0.1.226.64",S_OK,FALSE},
1238 {"http://0.1.226.64/",S_OK,FALSE},
1239 {"",S_FALSE,FALSE},
1240 {"",S_FALSE,FALSE},
1241 {"",S_FALSE,FALSE},
1242 {"0.1.226.64",S_OK,FALSE},
1243 {"",S_FALSE,FALSE},
1244 {"/",S_OK,FALSE},
1245 {"/",S_OK,FALSE},
1246 {"",S_FALSE,FALSE},
1247 {"http://123456/",S_OK,FALSE},
1248 {"http",S_OK,FALSE},
1249 {"",S_FALSE,FALSE},
1250 {"",S_FALSE,FALSE}
1253 {Uri_HOST_IPV4,S_OK,FALSE},
1254 {80,S_OK,FALSE},
1255 {URL_SCHEME_HTTP,S_OK,FALSE},
1256 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1259 /* UINT_MAX */
1260 { "http://4294967295/", 0, S_OK, FALSE,
1262 {"http://255.255.255.255/",S_OK,FALSE},
1263 {"255.255.255.255",S_OK,FALSE},
1264 {"http://255.255.255.255/",S_OK,FALSE},
1265 {"",S_FALSE,FALSE},
1266 {"",S_FALSE,FALSE},
1267 {"",S_FALSE,FALSE},
1268 {"255.255.255.255",S_OK,FALSE},
1269 {"",S_FALSE,FALSE},
1270 {"/",S_OK,FALSE},
1271 {"/",S_OK,FALSE},
1272 {"",S_FALSE,FALSE},
1273 {"http://4294967295/",S_OK,FALSE},
1274 {"http",S_OK,FALSE},
1275 {"",S_FALSE,FALSE},
1276 {"",S_FALSE,FALSE}
1279 {Uri_HOST_IPV4,S_OK,FALSE},
1280 {80,S_OK,FALSE},
1281 {URL_SCHEME_HTTP,S_OK,FALSE},
1282 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1285 /* UINT_MAX+1 */
1286 { "http://4294967296/", 0, S_OK, FALSE,
1288 {"http://4294967296/",S_OK,FALSE},
1289 {"4294967296",S_OK,FALSE},
1290 {"http://4294967296/",S_OK,FALSE},
1291 {"",S_FALSE,FALSE},
1292 {"",S_FALSE,FALSE},
1293 {"",S_FALSE,FALSE},
1294 {"4294967296",S_OK,FALSE},
1295 {"",S_FALSE,FALSE},
1296 {"/",S_OK,FALSE},
1297 {"/",S_OK,FALSE},
1298 {"",S_FALSE,FALSE},
1299 {"http://4294967296/",S_OK,FALSE},
1300 {"http",S_OK,FALSE},
1301 {"",S_FALSE,FALSE},
1302 {"",S_FALSE,FALSE}
1305 {Uri_HOST_DNS,S_OK,FALSE},
1306 {80,S_OK,FALSE},
1307 {URL_SCHEME_HTTP,S_OK,FALSE},
1308 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1311 /* Window's doesn't normalize IP address for unknown schemes. */
1312 { "1234://4294967295/", 0, S_OK, FALSE,
1314 {"1234://4294967295/",S_OK,FALSE},
1315 {"4294967295",S_OK,FALSE},
1316 {"1234://4294967295/",S_OK,FALSE},
1317 {"",S_FALSE,FALSE},
1318 {"",S_FALSE,FALSE},
1319 {"",S_FALSE,FALSE},
1320 {"4294967295",S_OK,FALSE},
1321 {"",S_FALSE,FALSE},
1322 {"/",S_OK,FALSE},
1323 {"/",S_OK,FALSE},
1324 {"",S_FALSE,FALSE},
1325 {"1234://4294967295/",S_OK,FALSE},
1326 {"1234",S_OK,FALSE},
1327 {"",S_FALSE,FALSE},
1328 {"",S_FALSE,FALSE}
1331 {Uri_HOST_IPV4,S_OK,FALSE},
1332 {0,S_FALSE,FALSE},
1333 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1334 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1337 /* Window's doesn't normalize IP address for unknown schemes. */
1338 { "1234://127.001/", 0, S_OK, FALSE,
1340 {"1234://127.001/",S_OK,FALSE},
1341 {"127.001",S_OK,FALSE},
1342 {"1234://127.001/",S_OK,FALSE},
1343 {"",S_FALSE,FALSE},
1344 {"",S_FALSE,FALSE},
1345 {"",S_FALSE,FALSE},
1346 {"127.001",S_OK,FALSE},
1347 {"",S_FALSE,FALSE},
1348 {"/",S_OK,FALSE},
1349 {"/",S_OK,FALSE},
1350 {"",S_FALSE,FALSE},
1351 {"1234://127.001/",S_OK,FALSE},
1352 {"1234",S_OK,FALSE},
1353 {"",S_FALSE,FALSE},
1354 {"",S_FALSE,FALSE}
1357 {Uri_HOST_IPV4,S_OK,FALSE},
1358 {0,S_FALSE,FALSE},
1359 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1360 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1363 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1365 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1366 {"[fedc:ba98::3210]",S_OK,FALSE},
1367 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1368 {"",S_FALSE,FALSE},
1369 {"",S_FALSE,FALSE},
1370 {"",S_FALSE,FALSE},
1371 {"fedc:ba98::3210",S_OK,FALSE},
1372 {"",S_FALSE,FALSE},
1373 {"/",S_OK,FALSE},
1374 {"/",S_OK,FALSE},
1375 {"",S_FALSE,FALSE},
1376 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1377 {"http",S_OK,FALSE},
1378 {"",S_FALSE,FALSE},
1379 {"",S_FALSE,FALSE},
1382 {Uri_HOST_IPV6,S_OK,FALSE},
1383 {80,S_OK,FALSE},
1384 {URL_SCHEME_HTTP,S_OK,FALSE},
1385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1388 { "http://[::]", 0, S_OK, FALSE,
1390 {"http://[::]/",S_OK,FALSE},
1391 {"[::]",S_OK,FALSE},
1392 {"http://[::]/",S_OK,FALSE},
1393 {"",S_FALSE,FALSE},
1394 {"",S_FALSE,FALSE},
1395 {"",S_FALSE,FALSE},
1396 {"::",S_OK,FALSE},
1397 {"",S_FALSE,FALSE},
1398 {"/",S_OK,FALSE},
1399 {"/",S_OK,FALSE},
1400 {"",S_FALSE,FALSE},
1401 {"http://[::]",S_OK,FALSE},
1402 {"http",S_OK,FALSE},
1403 {"",S_FALSE,FALSE},
1404 {"",S_FALSE,FALSE},
1407 {Uri_HOST_IPV6,S_OK,FALSE},
1408 {80,S_OK,FALSE},
1409 {URL_SCHEME_HTTP,S_OK,FALSE},
1410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1413 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1415 {"http://[fedc:ba98::]/",S_OK,FALSE},
1416 {"[fedc:ba98::]",S_OK,FALSE},
1417 {"http://[fedc:ba98::]/",S_OK,FALSE},
1418 {"",S_FALSE,FALSE},
1419 {"",S_FALSE,FALSE},
1420 {"",S_FALSE,FALSE},
1421 {"fedc:ba98::",S_OK,FALSE},
1422 {"",S_FALSE,FALSE},
1423 {"/",S_OK,FALSE},
1424 {"/",S_OK,FALSE},
1425 {"",S_FALSE,FALSE},
1426 {"http://[FEDC:BA98::]",S_OK,FALSE},
1427 {"http",S_OK,FALSE},
1428 {"",S_FALSE,FALSE},
1429 {"",S_FALSE,FALSE},
1432 {Uri_HOST_IPV6,S_OK,FALSE},
1433 {80,S_OK,FALSE},
1434 {URL_SCHEME_HTTP,S_OK,FALSE},
1435 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1438 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1439 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1441 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1442 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1443 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1444 {"",S_FALSE,FALSE},
1445 {"",S_FALSE,FALSE},
1446 {"",S_FALSE,FALSE},
1447 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1448 {"",S_FALSE,FALSE},
1449 {"/",S_OK,FALSE},
1450 {"/",S_OK,FALSE},
1451 {"",S_FALSE,FALSE},
1452 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1453 {"http",S_OK,FALSE},
1454 {"",S_FALSE,FALSE},
1455 {"",S_FALSE,FALSE},
1458 {Uri_HOST_IPV6,S_OK,FALSE},
1459 {80,S_OK,FALSE},
1460 {URL_SCHEME_HTTP,S_OK,FALSE},
1461 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1464 { "http://[v2.34]/", 0, S_OK, FALSE,
1466 {"http://[v2.34]/",S_OK,FALSE},
1467 {"[v2.34]",S_OK,FALSE},
1468 {"http://[v2.34]/",S_OK,FALSE},
1469 {"",S_FALSE,FALSE},
1470 {"",S_FALSE,FALSE},
1471 {"",S_FALSE,FALSE},
1472 {"[v2.34]",S_OK,FALSE},
1473 {"",S_FALSE,FALSE},
1474 {"/",S_OK,FALSE},
1475 {"/",S_OK,FALSE},
1476 {"",S_FALSE,FALSE},
1477 {"http://[v2.34]/",S_OK,FALSE},
1478 {"http",S_OK,FALSE},
1479 {"",S_FALSE,FALSE},
1480 {"",S_FALSE,FALSE}
1483 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1484 {80,S_OK,FALSE},
1485 {URL_SCHEME_HTTP,S_OK,FALSE},
1486 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1489 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1490 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1492 {"http://[xyz:12345.com/test",S_OK,FALSE},
1493 {"[xyz:12345.com",S_OK,FALSE},
1494 {"http://[xyz:12345.com/test",S_OK,FALSE},
1495 {"[xyz:12345.com",S_OK,FALSE},
1496 {"",S_FALSE,FALSE},
1497 {"",S_FALSE,FALSE},
1498 {"[xyz:12345.com",S_OK,FALSE},
1499 {"",S_FALSE,FALSE},
1500 {"/test",S_OK,FALSE},
1501 {"/test",S_OK,FALSE},
1502 {"",S_FALSE,FALSE},
1503 {"http://[xyz:12345.com/test",S_OK,FALSE},
1504 {"http",S_OK,FALSE},
1505 {"",S_FALSE,FALSE},
1506 {"",S_FALSE,FALSE}
1509 {Uri_HOST_DNS,S_OK,FALSE},
1510 {80,S_OK,FALSE},
1511 {URL_SCHEME_HTTP,S_OK,FALSE},
1512 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1515 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1516 * of the host name (respectively).
1518 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1520 {"ftp://www.[works].com/",S_OK,FALSE},
1521 {"www.[works].com",S_OK,FALSE},
1522 {"ftp://www.[works].com/",S_OK,FALSE},
1523 {"[works].com",S_OK,FALSE},
1524 {"",S_FALSE,FALSE},
1525 {"",S_FALSE,FALSE},
1526 {"www.[works].com",S_OK,FALSE},
1527 {"",S_FALSE,FALSE},
1528 {"/",S_OK,FALSE},
1529 {"/",S_OK,FALSE},
1530 {"",S_FALSE,FALSE},
1531 {"ftp://www.[works].com/",S_OK,FALSE},
1532 {"ftp",S_OK,FALSE},
1533 {"",S_FALSE,FALSE},
1534 {"",S_FALSE,FALSE}
1537 {Uri_HOST_DNS,S_OK,FALSE},
1538 {21,S_OK,FALSE},
1539 {URL_SCHEME_FTP,S_OK,FALSE},
1540 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1543 /* Considers ':' a delimiter since it appears after the ']'. */
1544 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1546 {"http://www.google.com]:12345/",S_OK,FALSE},
1547 {"www.google.com]:12345",S_OK,FALSE},
1548 {"http://www.google.com]:12345/",S_OK,FALSE},
1549 {"google.com]",S_OK,FALSE},
1550 {"",S_FALSE,FALSE},
1551 {"",S_FALSE,FALSE},
1552 {"www.google.com]",S_OK,FALSE},
1553 {"",S_FALSE,FALSE},
1554 {"/",S_OK,FALSE},
1555 {"/",S_OK,FALSE},
1556 {"",S_FALSE,FALSE},
1557 {"http://www.google.com]:12345/",S_OK,FALSE},
1558 {"http",S_OK,FALSE},
1559 {"",S_FALSE,FALSE},
1560 {"",S_FALSE,FALSE}
1563 {Uri_HOST_DNS,S_OK,FALSE},
1564 {12345,S_OK,FALSE},
1565 {URL_SCHEME_HTTP,S_OK,FALSE},
1566 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1569 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1570 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1572 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1573 {"w%XXw%GEw.google.com",S_OK,FALSE},
1574 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1575 {"google.com",S_OK,FALSE},
1576 {"",S_FALSE,FALSE},
1577 {"",S_FALSE,FALSE},
1578 {"w%XXw%GEw.google.com",S_OK,FALSE},
1579 {"",S_FALSE,FALSE},
1580 {"/",S_OK,FALSE},
1581 {"/",S_OK,FALSE},
1582 {"",S_FALSE,FALSE},
1583 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1584 {"zip",S_OK,FALSE},
1585 {"",S_FALSE,FALSE},
1586 {"",S_FALSE,FALSE}
1589 {Uri_HOST_DNS,S_OK,FALSE},
1590 {0,S_FALSE,FALSE},
1591 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1592 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1595 /* Unknown scheme types hostname doesn't get lower cased. */
1596 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1598 {"zip://GOOGLE.com/",S_OK,FALSE},
1599 {"GOOGLE.com",S_OK,FALSE},
1600 {"zip://GOOGLE.com/",S_OK,FALSE},
1601 {"GOOGLE.com",S_OK,FALSE},
1602 {"",S_FALSE,FALSE},
1603 {"",S_FALSE,FALSE},
1604 {"GOOGLE.com",S_OK,FALSE},
1605 {"",S_FALSE,FALSE},
1606 {"/",S_OK,FALSE},
1607 {"/",S_OK,FALSE},
1608 {"",S_FALSE,FALSE},
1609 {"zip://GOOGLE.com/",S_OK,FALSE},
1610 {"zip",S_OK,FALSE},
1611 {"",S_FALSE,FALSE},
1612 {"",S_FALSE,FALSE}
1615 {Uri_HOST_DNS,S_OK,FALSE},
1616 {0,S_FALSE,FALSE},
1617 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1618 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1621 /* Hostname gets lower-cased for known scheme types. */
1622 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1624 {"http://www.google.com/",S_OK,FALSE},
1625 {"www.google.com",S_OK,FALSE},
1626 {"http://www.google.com/",S_OK,FALSE},
1627 {"google.com",S_OK,FALSE},
1628 {"",S_FALSE,FALSE},
1629 {"",S_FALSE,FALSE},
1630 {"www.google.com",S_OK,FALSE},
1631 {"",S_FALSE,FALSE},
1632 {"/",S_OK,FALSE},
1633 {"/",S_OK,FALSE},
1634 {"",S_FALSE,FALSE},
1635 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1636 {"http",S_OK,FALSE},
1637 {"",S_FALSE,FALSE},
1638 {"",S_FALSE,FALSE}
1641 {Uri_HOST_DNS,S_OK,FALSE},
1642 {80,S_OK,FALSE},
1643 {URL_SCHEME_HTTP,S_OK,FALSE},
1644 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1647 /* Characters that get % encoded in the hostname also have their percent
1648 * encoded forms lower cased.
1650 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1652 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1653 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1654 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1655 {"%7cgoogle%7c.com",S_OK,FALSE},
1656 {"",S_FALSE,FALSE},
1657 {"",S_FALSE,FALSE},
1658 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1659 {"",S_FALSE,FALSE},
1660 {"/",S_OK,FALSE},
1661 {"/",S_OK,FALSE},
1662 {"",S_FALSE,FALSE},
1663 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1664 {"http",S_OK,FALSE},
1665 {"",S_FALSE,FALSE},
1666 {"",S_FALSE,FALSE}
1669 {Uri_HOST_DNS,S_OK,FALSE},
1670 {80,S_OK,FALSE},
1671 {URL_SCHEME_HTTP,S_OK,FALSE},
1672 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1675 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1676 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1678 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1679 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1680 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1681 {"",S_FALSE,FALSE},
1682 {"",S_FALSE,FALSE},
1683 {"",S_FALSE,FALSE},
1684 {"1:2:3:4:5:6::",S_OK,FALSE},
1685 {"",S_FALSE,FALSE},
1686 {"/",S_OK,FALSE},
1687 {"/",S_OK,FALSE},
1688 {"",S_FALSE,FALSE},
1689 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1690 {"http",S_OK,FALSE},
1691 {"",S_FALSE,FALSE},
1692 {"",S_FALSE,FALSE},
1695 {Uri_HOST_IPV6,S_OK,FALSE},
1696 {80,S_OK,FALSE},
1697 {URL_SCHEME_HTTP,S_OK,FALSE},
1698 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1701 /* IPv4 addresses get normalized. */
1702 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1704 {"http://[::1.2.3.0]/",S_OK,FALSE},
1705 {"[::1.2.3.0]",S_OK,FALSE},
1706 {"http://[::1.2.3.0]/",S_OK,FALSE},
1707 {"",S_FALSE,FALSE},
1708 {"",S_FALSE,FALSE},
1709 {"",S_FALSE,FALSE},
1710 {"::1.2.3.0",S_OK,FALSE},
1711 {"",S_FALSE,FALSE},
1712 {"/",S_OK,FALSE},
1713 {"/",S_OK,FALSE},
1714 {"",S_FALSE,FALSE},
1715 {"http://[::001.002.003.000]",S_OK,FALSE},
1716 {"http",S_OK,FALSE},
1717 {"",S_FALSE,FALSE},
1718 {"",S_FALSE,FALSE},
1721 {Uri_HOST_IPV6,S_OK,FALSE},
1722 {80,S_OK,FALSE},
1723 {URL_SCHEME_HTTP,S_OK,FALSE},
1724 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1727 { "http://[::5efe:1.2.3.4]", 0, S_OK, FALSE,
1729 {"http://[::5efe:1.2.3.4]/",S_OK,FALSE},
1730 {"[::5efe:1.2.3.4]",S_OK,FALSE},
1731 {"http://[::5efe:1.2.3.4]/",S_OK,FALSE},
1732 {"",S_FALSE,FALSE},
1733 {"",S_FALSE,FALSE},
1734 {"",S_FALSE,FALSE},
1735 {"::5efe:1.2.3.4",S_OK,FALSE},
1736 {"",S_FALSE,FALSE},
1737 {"/",S_OK,FALSE},
1738 {"/",S_OK,FALSE},
1739 {"",S_FALSE,FALSE},
1740 {"http://[::5efe:1.2.3.4]",S_OK,FALSE},
1741 {"http",S_OK,FALSE},
1742 {"",S_FALSE,FALSE},
1743 {"",S_FALSE,FALSE},
1746 {Uri_HOST_IPV6,S_OK,FALSE},
1747 {80,S_OK,FALSE},
1748 {URL_SCHEME_HTTP,S_OK,FALSE},
1749 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1752 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1753 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1755 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1756 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1757 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1758 {"",S_FALSE,FALSE},
1759 {"",S_FALSE,FALSE},
1760 {"",S_FALSE,FALSE},
1761 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1762 {"",S_FALSE,FALSE},
1763 {"/",S_OK,FALSE},
1764 {"/",S_OK,FALSE},
1765 {"",S_FALSE,FALSE},
1766 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1767 {"zip",S_OK,FALSE},
1768 {"",S_FALSE,FALSE},
1769 {"",S_FALSE,FALSE},
1772 {Uri_HOST_IPV6,S_OK,FALSE},
1773 {0,S_FALSE,FALSE},
1774 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1775 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1778 /* IPv4 address is converted into 2 h16 components. */
1779 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1781 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1782 {"[ffff::c0de:6f20]",S_OK,FALSE},
1783 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1784 {"",S_FALSE,FALSE},
1785 {"",S_FALSE,FALSE},
1786 {"",S_FALSE,FALSE},
1787 {"ffff::c0de:6f20",S_OK,FALSE},
1788 {"",S_FALSE,FALSE},
1789 {"/",S_OK,FALSE},
1790 {"/",S_OK,FALSE},
1791 {"",S_FALSE,FALSE},
1792 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1793 {"http",S_OK,FALSE},
1794 {"",S_FALSE,FALSE},
1795 {"",S_FALSE,FALSE},
1798 {Uri_HOST_IPV6,S_OK,FALSE},
1799 {80,S_OK,FALSE},
1800 {URL_SCHEME_HTTP,S_OK,FALSE},
1801 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1804 /* Max value for a port. */
1805 { "http://google.com:65535", 0, S_OK, FALSE,
1807 {"http://google.com:65535/",S_OK,FALSE},
1808 {"google.com:65535",S_OK,FALSE},
1809 {"http://google.com:65535/",S_OK,FALSE},
1810 {"google.com",S_OK,FALSE},
1811 {"",S_FALSE,FALSE},
1812 {"",S_FALSE,FALSE},
1813 {"google.com",S_OK,FALSE},
1814 {"",S_FALSE,FALSE},
1815 {"/",S_OK,FALSE},
1816 {"/",S_OK,FALSE},
1817 {"",S_FALSE,FALSE},
1818 {"http://google.com:65535",S_OK,FALSE},
1819 {"http",S_OK,FALSE},
1820 {"",S_FALSE,FALSE},
1821 {"",S_FALSE,FALSE}
1824 {Uri_HOST_DNS,S_OK,FALSE},
1825 {65535,S_OK,FALSE},
1826 {URL_SCHEME_HTTP,S_OK,FALSE},
1827 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1830 { "zip://google.com:65536", 0, S_OK, FALSE,
1832 {"zip://google.com:65536/",S_OK,FALSE},
1833 {"google.com:65536",S_OK,FALSE},
1834 {"zip://google.com:65536/",S_OK,FALSE},
1835 {"google.com:65536",S_OK,FALSE},
1836 {"",S_FALSE,FALSE},
1837 {"",S_FALSE,FALSE},
1838 {"google.com:65536",S_OK,FALSE},
1839 {"",S_FALSE,FALSE},
1840 {"/",S_OK,FALSE},
1841 {"/",S_OK,FALSE},
1842 {"",S_FALSE,FALSE},
1843 {"zip://google.com:65536",S_OK,FALSE},
1844 {"zip",S_OK,FALSE},
1845 {"",S_FALSE,FALSE},
1846 {"",S_FALSE,FALSE}
1849 {Uri_HOST_DNS,S_OK,FALSE},
1850 {0,S_FALSE,FALSE},
1851 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1852 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1855 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1857 {"zip://google.com:65536:25/",S_OK,FALSE},
1858 {"google.com:65536:25",S_OK,FALSE},
1859 {"zip://google.com:65536:25/",S_OK,FALSE},
1860 {"google.com:65536:25",S_OK,FALSE},
1861 {"",S_FALSE,FALSE},
1862 {"",S_FALSE,FALSE},
1863 {"google.com:65536:25",S_OK,FALSE},
1864 {"",S_FALSE,FALSE},
1865 {"/",S_OK,FALSE},
1866 {"/",S_OK,FALSE},
1867 {"",S_FALSE,FALSE},
1868 {"zip://google.com:65536:25",S_OK,FALSE},
1869 {"zip",S_OK,FALSE},
1870 {"",S_FALSE,FALSE},
1871 {"",S_FALSE,FALSE}
1874 {Uri_HOST_DNS,S_OK,FALSE},
1875 {0,S_FALSE,FALSE},
1876 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1877 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1880 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1882 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1883 {"[::ffff]:abcd",S_OK,FALSE},
1884 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1885 {"",S_FALSE,FALSE},
1886 {"",S_FALSE,FALSE},
1887 {"",S_FALSE,FALSE},
1888 {"[::ffff]:abcd",S_OK,FALSE},
1889 {"",S_FALSE,FALSE},
1890 {"/",S_OK,FALSE},
1891 {"/",S_OK,FALSE},
1892 {"",S_FALSE,FALSE},
1893 {"zip://[::ffff]:abcd",S_OK,FALSE},
1894 {"zip",S_OK,FALSE},
1895 {"",S_FALSE,FALSE},
1896 {"",S_FALSE,FALSE}
1899 {Uri_HOST_DNS,S_OK,FALSE},
1900 {0,S_FALSE,FALSE},
1901 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1902 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1905 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1907 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1908 {"127.0.0.1:abcd",S_OK,FALSE},
1909 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1910 {"0.1:abcd",S_OK,FALSE},
1911 {"",S_FALSE,FALSE},
1912 {"",S_FALSE,FALSE},
1913 {"127.0.0.1:abcd",S_OK,FALSE},
1914 {"",S_FALSE,FALSE},
1915 {"/",S_OK,FALSE},
1916 {"/",S_OK,FALSE},
1917 {"",S_FALSE,FALSE},
1918 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1919 {"zip",S_OK,FALSE},
1920 {"",S_FALSE,FALSE},
1921 {"",S_FALSE,FALSE}
1924 {Uri_HOST_DNS,S_OK,FALSE},
1925 {0,S_FALSE,FALSE},
1926 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1927 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1930 /* Port is just copied over. */
1931 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1933 {"http://google.com:00035",S_OK,FALSE},
1934 {"google.com:00035",S_OK,FALSE},
1935 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1936 {"google.com",S_OK,FALSE},
1937 {"",S_FALSE,FALSE},
1938 {"",S_FALSE,FALSE},
1939 {"google.com",S_OK,FALSE},
1940 {"",S_FALSE,FALSE},
1941 {"",S_FALSE,FALSE},
1942 {"",S_FALSE,FALSE},
1943 {"",S_FALSE,FALSE},
1944 {"http://google.com:00035",S_OK,FALSE},
1945 {"http",S_OK,FALSE},
1946 {"",S_FALSE,FALSE},
1947 {"",S_FALSE,FALSE}
1950 {Uri_HOST_DNS,S_OK,FALSE},
1951 {35,S_OK,FALSE},
1952 {URL_SCHEME_HTTP,S_OK,FALSE},
1953 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1956 /* Default port is copied over. */
1957 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1959 {"http://google.com:80",S_OK,FALSE},
1960 {"google.com:80",S_OK,FALSE},
1961 {"http://google.com:80",S_OK,FALSE},
1962 {"google.com",S_OK,FALSE},
1963 {"",S_FALSE,FALSE},
1964 {"",S_FALSE,FALSE},
1965 {"google.com",S_OK,FALSE},
1966 {"",S_FALSE,FALSE},
1967 {"",S_FALSE,FALSE},
1968 {"",S_FALSE,FALSE},
1969 {"",S_FALSE,FALSE},
1970 {"http://google.com:80",S_OK,FALSE},
1971 {"http",S_OK,FALSE},
1972 {"",S_FALSE,FALSE},
1973 {"",S_FALSE,FALSE}
1976 {Uri_HOST_DNS,S_OK,FALSE},
1977 {80,S_OK,FALSE},
1978 {URL_SCHEME_HTTP,S_OK,FALSE},
1979 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1982 { "http://google.com.uk", 0, S_OK, FALSE,
1984 {"http://google.com.uk/",S_OK,FALSE},
1985 {"google.com.uk",S_OK,FALSE},
1986 {"http://google.com.uk/",S_OK,FALSE},
1987 {"google.com.uk",S_OK,FALSE,NULL,"com.uk",S_OK}, /* cf. google.co.uk below */
1988 {"",S_FALSE,FALSE},
1989 {"",S_FALSE,FALSE},
1990 {"google.com.uk",S_OK,FALSE},
1991 {"",S_FALSE,FALSE},
1992 {"/",S_OK,FALSE},
1993 {"/",S_OK,FALSE},
1994 {"",S_FALSE,FALSE},
1995 {"http://google.com.uk",S_OK,FALSE},
1996 {"http",S_OK,FALSE},
1997 {"",S_FALSE,FALSE},
1998 {"",S_FALSE,FALSE}
2001 {Uri_HOST_DNS,S_OK,FALSE},
2002 {80,S_OK,FALSE},
2003 {URL_SCHEME_HTTP,S_OK,FALSE},
2004 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2007 { "http://google.co.uk", 0, S_OK, FALSE,
2009 {"http://google.co.uk/",S_OK,FALSE},
2010 {"google.co.uk",S_OK,FALSE},
2011 {"http://google.co.uk/",S_OK,FALSE},
2012 {"google.co.uk",S_OK,FALSE},
2013 {"",S_FALSE,FALSE},
2014 {"",S_FALSE,FALSE},
2015 {"google.co.uk",S_OK,FALSE},
2016 {"",S_FALSE,FALSE},
2017 {"/",S_OK,FALSE},
2018 {"/",S_OK,FALSE},
2019 {"",S_FALSE,FALSE},
2020 {"http://google.co.uk",S_OK,FALSE},
2021 {"http",S_OK,FALSE},
2022 {"",S_FALSE,FALSE},
2023 {"",S_FALSE,FALSE}
2026 {Uri_HOST_DNS,S_OK,FALSE},
2027 {80,S_OK,FALSE},
2028 {URL_SCHEME_HTTP,S_OK,FALSE},
2029 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2032 { "http://google.com.com", 0, S_OK, FALSE,
2034 {"http://google.com.com/",S_OK,FALSE},
2035 {"google.com.com",S_OK,FALSE},
2036 {"http://google.com.com/",S_OK,FALSE},
2037 {"com.com",S_OK,FALSE},
2038 {"",S_FALSE,FALSE},
2039 {"",S_FALSE,FALSE},
2040 {"google.com.com",S_OK,FALSE},
2041 {"",S_FALSE,FALSE},
2042 {"/",S_OK,FALSE},
2043 {"/",S_OK,FALSE},
2044 {"",S_FALSE,FALSE},
2045 {"http://google.com.com",S_OK,FALSE},
2046 {"http",S_OK,FALSE},
2047 {"",S_FALSE,FALSE},
2048 {"",S_FALSE,FALSE}
2051 {Uri_HOST_DNS,S_OK,FALSE},
2052 {80,S_OK,FALSE},
2053 {URL_SCHEME_HTTP,S_OK,FALSE},
2054 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2057 { "http://google.uk.1", 0, S_OK, FALSE,
2059 {"http://google.uk.1/",S_OK,FALSE},
2060 {"google.uk.1",S_OK,FALSE},
2061 {"http://google.uk.1/",S_OK,FALSE},
2062 {"google.uk.1",S_OK,FALSE,NULL,"uk.1",S_OK},
2063 {"",S_FALSE,FALSE},
2064 {"",S_FALSE,FALSE},
2065 {"google.uk.1",S_OK,FALSE},
2066 {"",S_FALSE,FALSE},
2067 {"/",S_OK,FALSE},
2068 {"/",S_OK,FALSE},
2069 {"",S_FALSE,FALSE},
2070 {"http://google.uk.1",S_OK,FALSE},
2071 {"http",S_OK,FALSE},
2072 {"",S_FALSE,FALSE},
2073 {"",S_FALSE,FALSE}
2076 {Uri_HOST_DNS,S_OK,FALSE},
2077 {80,S_OK,FALSE},
2078 {URL_SCHEME_HTTP,S_OK,FALSE},
2079 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2082 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
2083 { "http://google.foo.uk", 0, S_OK, FALSE,
2085 {"http://google.foo.uk/",S_OK,FALSE},
2086 {"google.foo.uk",S_OK,FALSE},
2087 {"http://google.foo.uk/",S_OK,FALSE},
2088 {"foo.uk",S_OK,FALSE},
2089 {"",S_FALSE,FALSE},
2090 {"",S_FALSE,FALSE},
2091 {"google.foo.uk",S_OK,FALSE},
2092 {"",S_FALSE,FALSE},
2093 {"/",S_OK,FALSE},
2094 {"/",S_OK,FALSE},
2095 {"",S_FALSE,FALSE},
2096 {"http://google.foo.uk",S_OK,FALSE},
2097 {"http",S_OK,FALSE},
2098 {"",S_FALSE,FALSE},
2099 {"",S_FALSE,FALSE}
2102 {Uri_HOST_DNS,S_OK,FALSE},
2103 {80,S_OK,FALSE},
2104 {URL_SCHEME_HTTP,S_OK,FALSE},
2105 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2108 { "http://.com", 0, S_OK, FALSE,
2110 {"http://.com/",S_OK,FALSE},
2111 {".com",S_OK,FALSE},
2112 {"http://.com/",S_OK,FALSE},
2113 {".com",S_OK,FALSE},
2114 {"",S_FALSE,FALSE},
2115 {"",S_FALSE,FALSE},
2116 {".com",S_OK,FALSE},
2117 {"",S_FALSE,FALSE},
2118 {"/",S_OK,FALSE},
2119 {"/",S_OK,FALSE},
2120 {"",S_FALSE,FALSE},
2121 {"http://.com",S_OK,FALSE},
2122 {"http",S_OK,FALSE},
2123 {"",S_FALSE,FALSE},
2124 {"",S_FALSE,FALSE}
2127 {Uri_HOST_DNS,S_OK,FALSE},
2128 {80,S_OK,FALSE},
2129 {URL_SCHEME_HTTP,S_OK,FALSE},
2130 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2133 { "http://.uk", 0, S_OK, FALSE,
2135 {"http://.uk/",S_OK,FALSE},
2136 {".uk",S_OK,FALSE},
2137 {"http://.uk/",S_OK,FALSE},
2138 {"",S_FALSE,FALSE,NULL,".uk",S_OK},
2139 {"",S_FALSE,FALSE},
2140 {"",S_FALSE,FALSE},
2141 {".uk",S_OK,FALSE},
2142 {"",S_FALSE,FALSE},
2143 {"/",S_OK,FALSE},
2144 {"/",S_OK,FALSE},
2145 {"",S_FALSE,FALSE},
2146 {"http://.uk",S_OK,FALSE},
2147 {"http",S_OK,FALSE},
2148 {"",S_FALSE,FALSE},
2149 {"",S_FALSE,FALSE}
2152 {Uri_HOST_DNS,S_OK,FALSE},
2153 {80,S_OK,FALSE},
2154 {URL_SCHEME_HTTP,S_OK,FALSE},
2155 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2158 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
2160 {"http://www.co.google.com.[]/",S_OK,FALSE},
2161 {"www.co.google.com.[]",S_OK,FALSE},
2162 {"http://www.co.google.com.[]/",S_OK,FALSE},
2163 {"google.com.[]",S_OK,FALSE,NULL,"com.[]",S_OK},
2164 {"",S_FALSE,FALSE},
2165 {"",S_FALSE,FALSE},
2166 {"www.co.google.com.[]",S_OK,FALSE},
2167 {"",S_FALSE,FALSE},
2168 {"/",S_OK,FALSE},
2169 {"/",S_OK,FALSE},
2170 {"",S_FALSE,FALSE},
2171 {"http://www.co.google.com.[]",S_OK,FALSE},
2172 {"http",S_OK,FALSE},
2173 {"",S_FALSE,FALSE},
2174 {"",S_FALSE,FALSE}
2177 {Uri_HOST_DNS,S_OK,FALSE},
2178 {80,S_OK,FALSE},
2179 {URL_SCHEME_HTTP,S_OK,FALSE},
2180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2183 { "http://co.uk", 0, S_OK, FALSE,
2185 {"http://co.uk/",S_OK,FALSE},
2186 {"co.uk",S_OK,FALSE},
2187 {"http://co.uk/",S_OK,FALSE},
2188 {"",S_FALSE,FALSE},
2189 {"",S_FALSE,FALSE},
2190 {"",S_FALSE,FALSE},
2191 {"co.uk",S_OK,FALSE},
2192 {"",S_FALSE,FALSE},
2193 {"/",S_OK,FALSE},
2194 {"/",S_OK,FALSE},
2195 {"",S_FALSE,FALSE},
2196 {"http://co.uk",S_OK,FALSE},
2197 {"http",S_OK,FALSE},
2198 {"",S_FALSE,FALSE},
2199 {"",S_FALSE,FALSE}
2202 {Uri_HOST_DNS,S_OK,FALSE},
2203 {80,S_OK,FALSE},
2204 {URL_SCHEME_HTTP,S_OK,FALSE},
2205 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2208 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2210 {"http://www.co.google.us.test/",S_OK,FALSE},
2211 {"www.co.google.us.test",S_OK,FALSE},
2212 {"http://www.co.google.us.test/",S_OK,FALSE},
2213 {"us.test",S_OK,FALSE},
2214 {"",S_FALSE,FALSE},
2215 {"",S_FALSE,FALSE},
2216 {"www.co.google.us.test",S_OK,FALSE},
2217 {"",S_FALSE,FALSE},
2218 {"/",S_OK,FALSE},
2219 {"/",S_OK,FALSE},
2220 {"",S_FALSE,FALSE},
2221 {"http://www.co.google.us.test",S_OK,FALSE},
2222 {"http",S_OK,FALSE},
2223 {"",S_FALSE,FALSE},
2224 {"",S_FALSE,FALSE}
2227 {Uri_HOST_DNS,S_OK,FALSE},
2228 {80,S_OK,FALSE},
2229 {URL_SCHEME_HTTP,S_OK,FALSE},
2230 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2233 { "http://gov.uk", 0, S_OK, FALSE,
2235 {"http://gov.uk/",S_OK,FALSE},
2236 {"gov.uk",S_OK,FALSE},
2237 {"http://gov.uk/",S_OK,FALSE},
2238 {"",S_FALSE,FALSE},
2239 {"",S_FALSE,FALSE},
2240 {"",S_FALSE,FALSE},
2241 {"gov.uk",S_OK,FALSE},
2242 {"",S_FALSE,FALSE},
2243 {"/",S_OK,FALSE},
2244 {"/",S_OK,FALSE},
2245 {"",S_FALSE,FALSE},
2246 {"http://gov.uk",S_OK,FALSE},
2247 {"http",S_OK,FALSE},
2248 {"",S_FALSE,FALSE},
2249 {"",S_FALSE,FALSE}
2252 {Uri_HOST_DNS,S_OK,FALSE},
2253 {80,S_OK,FALSE},
2254 {URL_SCHEME_HTTP,S_OK,FALSE},
2255 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2258 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2260 {"zip://www.google.com\\test",S_OK,FALSE},
2261 {"www.google.com\\test",S_OK,FALSE},
2262 {"zip://www.google.com\\test",S_OK,FALSE},
2263 {"google.com\\test",S_OK,FALSE},
2264 {"",S_FALSE,FALSE},
2265 {"",S_FALSE,FALSE},
2266 {"www.google.com\\test",S_OK,FALSE},
2267 {"",S_FALSE,FALSE},
2268 {"",S_FALSE,FALSE},
2269 {"",S_FALSE,FALSE},
2270 {"",S_FALSE,FALSE},
2271 {"zip://www.google.com\\test",S_OK,FALSE},
2272 {"zip",S_OK,FALSE},
2273 {"",S_FALSE,FALSE},
2274 {"",S_FALSE,FALSE}
2277 {Uri_HOST_DNS,S_OK,FALSE},
2278 {0,S_FALSE,FALSE},
2279 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2280 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2283 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2285 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2286 {"",S_FALSE,FALSE},
2287 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2288 {"",S_FALSE,FALSE},
2289 {"",S_FALSE,FALSE},
2290 {"",S_FALSE,FALSE},
2291 {"",S_FALSE,FALSE},
2292 {"",S_FALSE,FALSE},
2293 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2294 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2295 {"",S_FALSE,FALSE},
2296 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2297 {"urn",S_OK,FALSE},
2298 {"",S_FALSE,FALSE},
2299 {"",S_FALSE,FALSE}
2302 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2303 {0,S_FALSE,FALSE},
2304 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2305 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2308 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2309 * are decoded and all '%' are encoded.
2311 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2313 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2314 {"",S_FALSE,FALSE},
2315 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2316 {"",S_FALSE,FALSE},
2317 {".mp3",S_OK,FALSE},
2318 {"",S_FALSE,FALSE},
2319 {"",S_FALSE,FALSE},
2320 {"",S_FALSE,FALSE},
2321 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2322 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2323 {"",S_FALSE,FALSE},
2324 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2325 {"file",S_OK,FALSE},
2326 {"",S_FALSE,FALSE},
2327 {"",S_FALSE,FALSE}
2330 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2331 {0,S_FALSE,FALSE},
2332 {URL_SCHEME_FILE,S_OK,FALSE},
2333 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2336 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2337 * is decoded and only %'s in front of invalid hex digits are encoded.
2339 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2341 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2342 {"",S_FALSE,FALSE},
2343 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2344 {"",S_FALSE,FALSE},
2345 {".mp3",S_OK,FALSE},
2346 {"",S_FALSE,FALSE},
2347 {"",S_FALSE,FALSE},
2348 {"",S_FALSE,FALSE},
2349 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2350 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2351 {"",S_FALSE,FALSE},
2352 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2353 {"file",S_OK,FALSE},
2354 {"",S_FALSE,FALSE},
2355 {"",S_FALSE,FALSE}
2358 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2359 {0,S_FALSE,FALSE},
2360 {URL_SCHEME_FILE,S_OK,FALSE},
2361 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2364 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2365 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2367 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2368 {"[::1.2.3.0]",S_OK,FALSE},
2369 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2370 {"",S_FALSE,FALSE},
2371 {"",S_FALSE,FALSE},
2372 {"",S_FALSE,FALSE},
2373 {"::1.2.3.0",S_OK,FALSE},
2374 {"",S_FALSE,FALSE},
2375 {"/%3F%23.T/test",S_OK,FALSE},
2376 {"/%3F%23.T/test",S_OK,FALSE},
2377 {"",S_FALSE,FALSE},
2378 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2379 {"http",S_OK,FALSE},
2380 {"",S_FALSE,FALSE},
2381 {"",S_FALSE,FALSE},
2384 {Uri_HOST_IPV6,S_OK,FALSE},
2385 {80,S_OK,FALSE},
2386 {URL_SCHEME_HTTP,S_OK,FALSE},
2387 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2390 /* Forbidden characters are always encoded for file URIs. */
2391 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2393 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2394 {"",S_FALSE,FALSE},
2395 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2396 {"",S_FALSE,FALSE},
2397 {".mp3",S_OK,FALSE},
2398 {"",S_FALSE,FALSE},
2399 {"",S_FALSE,FALSE},
2400 {"",S_FALSE,FALSE},
2401 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2402 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2403 {"",S_FALSE,FALSE},
2404 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2405 {"file",S_OK,FALSE},
2406 {"",S_FALSE,FALSE},
2407 {"",S_FALSE,FALSE}
2410 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2411 {0,S_FALSE,FALSE},
2412 {URL_SCHEME_FILE,S_OK,FALSE},
2413 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2416 /* Forbidden characters are never encoded for unknown scheme types. */
2417 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2419 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2420 {"4294967295",S_OK,FALSE},
2421 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2422 {"",S_FALSE,FALSE},
2423 {"",S_FALSE,FALSE},
2424 {"",S_FALSE,FALSE},
2425 {"4294967295",S_OK,FALSE},
2426 {"",S_FALSE,FALSE},
2427 {"/<|>\" test<|>",S_OK,FALSE},
2428 {"/<|>\" test<|>",S_OK,FALSE},
2429 {"",S_FALSE,FALSE},
2430 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2431 {"1234",S_OK,FALSE},
2432 {"",S_FALSE,FALSE},
2433 {"",S_FALSE,FALSE}
2436 {Uri_HOST_IPV4,S_OK,FALSE},
2437 {0,S_FALSE,FALSE},
2438 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2439 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2442 /* Make sure forbidden characters are percent encoded. */
2443 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2445 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2446 {"gov.uk",S_OK,FALSE},
2447 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2448 {"",S_FALSE,FALSE},
2449 {"",S_FALSE,FALSE},
2450 {"",S_FALSE,FALSE},
2451 {"gov.uk",S_OK,FALSE},
2452 {"",S_FALSE,FALSE},
2453 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2454 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2455 {"",S_FALSE,FALSE},
2456 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2457 {"http",S_OK,FALSE},
2458 {"",S_FALSE,FALSE},
2459 {"",S_FALSE,FALSE}
2462 {Uri_HOST_DNS,S_OK,FALSE},
2463 {80,S_OK,FALSE},
2464 {URL_SCHEME_HTTP,S_OK,FALSE},
2465 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2468 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2470 {"http://gov.uk/",S_OK,FALSE},
2471 {"gov.uk",S_OK,FALSE},
2472 {"http://gov.uk/",S_OK,FALSE},
2473 {"",S_FALSE,FALSE},
2474 {"",S_FALSE,FALSE},
2475 {"",S_FALSE,FALSE},
2476 {"gov.uk",S_OK,FALSE},
2477 {"",S_FALSE,FALSE},
2478 {"/",S_OK,FALSE},
2479 {"/",S_OK,FALSE},
2480 {"",S_FALSE,FALSE},
2481 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2482 {"http",S_OK,FALSE},
2483 {"",S_FALSE,FALSE},
2484 {"",S_FALSE,FALSE}
2487 {Uri_HOST_DNS,S_OK,FALSE},
2488 {80,S_OK,FALSE},
2489 {URL_SCHEME_HTTP,S_OK,FALSE},
2490 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2493 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2495 {"http://gov.uk/",S_OK,FALSE},
2496 {"gov.uk",S_OK,FALSE},
2497 {"http://gov.uk/",S_OK,FALSE},
2498 {"",S_FALSE,FALSE},
2499 {"",S_FALSE,FALSE},
2500 {"",S_FALSE,FALSE},
2501 {"gov.uk",S_OK,FALSE},
2502 {"",S_FALSE,FALSE},
2503 {"/",S_OK,FALSE},
2504 {"/",S_OK,FALSE},
2505 {"",S_FALSE,FALSE},
2506 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2507 {"http",S_OK,FALSE},
2508 {"",S_FALSE,FALSE},
2509 {"",S_FALSE,FALSE}
2512 {Uri_HOST_DNS,S_OK,FALSE},
2513 {80,S_OK,FALSE},
2514 {URL_SCHEME_HTTP,S_OK,FALSE},
2515 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2518 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2520 {"http://gov.uk/",S_OK,FALSE},
2521 {"gov.uk",S_OK,FALSE},
2522 {"http://gov.uk/",S_OK,FALSE},
2523 {"",S_FALSE,FALSE},
2524 {"",S_FALSE,FALSE},
2525 {"",S_FALSE,FALSE},
2526 {"gov.uk",S_OK,FALSE},
2527 {"",S_FALSE,FALSE},
2528 {"/",S_OK,FALSE},
2529 {"/",S_OK,FALSE},
2530 {"",S_FALSE,FALSE},
2531 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2532 {"http",S_OK,FALSE},
2533 {"",S_FALSE,FALSE},
2534 {"",S_FALSE,FALSE}
2537 {Uri_HOST_DNS,S_OK,FALSE},
2538 {80,S_OK,FALSE},
2539 {URL_SCHEME_HTTP,S_OK,FALSE},
2540 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2543 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2545 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2546 {"",S_FALSE,FALSE},
2547 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2548 {"",S_FALSE,FALSE},
2549 {".mp3",S_OK,FALSE},
2550 {"",S_FALSE,FALSE},
2551 {"",S_FALSE,FALSE},
2552 {"",S_FALSE,FALSE},
2553 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2554 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2555 {"",S_FALSE,FALSE},
2556 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2557 {"file",S_OK,FALSE},
2558 {"",S_FALSE,FALSE},
2559 {"",S_FALSE,FALSE}
2562 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2563 {0,S_FALSE,FALSE},
2564 {URL_SCHEME_FILE,S_OK,FALSE},
2565 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2568 /* Dot removal happens for unknown scheme types. */
2569 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2571 {"zip://gov.uk/",S_OK,FALSE},
2572 {"gov.uk",S_OK,FALSE},
2573 {"zip://gov.uk/",S_OK,FALSE},
2574 {"",S_FALSE,FALSE},
2575 {"",S_FALSE,FALSE},
2576 {"",S_FALSE,FALSE},
2577 {"gov.uk",S_OK,FALSE},
2578 {"",S_FALSE,FALSE},
2579 {"/",S_OK,FALSE},
2580 {"/",S_OK,FALSE},
2581 {"",S_FALSE,FALSE},
2582 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2583 {"zip",S_OK,FALSE},
2584 {"",S_FALSE,FALSE},
2585 {"",S_FALSE,FALSE}
2588 {Uri_HOST_DNS,S_OK,FALSE},
2589 {0,S_FALSE,FALSE},
2590 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2591 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2594 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2595 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2597 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2598 {"gov.uk",S_OK,FALSE},
2599 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2600 {"",S_FALSE,FALSE},
2601 {".",S_OK,FALSE},
2602 {"",S_FALSE,FALSE},
2603 {"gov.uk",S_OK,FALSE},
2604 {"",S_FALSE,FALSE},
2605 {"/test/test2/../../.",S_OK,FALSE},
2606 {"/test/test2/../../.",S_OK,FALSE},
2607 {"",S_FALSE,FALSE},
2608 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2609 {"http",S_OK,FALSE},
2610 {"",S_FALSE,FALSE},
2611 {"",S_FALSE,FALSE}
2614 {Uri_HOST_DNS,S_OK,FALSE},
2615 {80,S_OK,FALSE},
2616 {URL_SCHEME_HTTP,S_OK,FALSE},
2617 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2620 /* Dot removal doesn't happen for wildcard scheme types. */
2621 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2623 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2624 {"gov.uk",S_OK,FALSE},
2625 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2626 {"",S_FALSE,FALSE},
2627 {".",S_OK,FALSE},
2628 {"",S_FALSE,FALSE},
2629 {"gov.uk",S_OK,FALSE},
2630 {"",S_FALSE,FALSE},
2631 {"/test/test2/../../.",S_OK,FALSE},
2632 {"/test/test2/../../.",S_OK,FALSE},
2633 {"",S_FALSE,FALSE},
2634 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2635 {"*",S_OK,FALSE},
2636 {"",S_FALSE,FALSE},
2637 {"",S_FALSE,FALSE}
2640 {Uri_HOST_DNS,S_OK,FALSE},
2641 {0,S_FALSE,FALSE},
2642 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2643 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2646 /* Forbidden characters are encoded for opaque known scheme types. */
2647 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2649 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2650 {"",S_FALSE,FALSE},
2651 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2652 {"",S_FALSE,FALSE},
2653 {".com%22",S_OK,FALSE},
2654 {"",S_FALSE,FALSE},
2655 {"",S_FALSE,FALSE},
2656 {"",S_FALSE,FALSE},
2657 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2658 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2659 {"",S_FALSE,FALSE},
2660 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2661 {"mailto",S_OK,FALSE},
2662 {"",S_FALSE,FALSE},
2663 {"",S_FALSE,FALSE}
2666 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2667 {0,S_FALSE,FALSE},
2668 {URL_SCHEME_MAILTO,S_OK,FALSE},
2669 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2672 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2674 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2675 {"",S_FALSE,FALSE},
2676 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2677 {"",S_FALSE,FALSE},
2678 {".com",S_OK,FALSE},
2679 {"",S_FALSE,FALSE},
2680 {"",S_FALSE,FALSE},
2681 {"",S_FALSE,FALSE},
2682 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2683 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2684 {"",S_FALSE,FALSE},
2685 {"news:test.tes<|>t.com",S_OK,FALSE},
2686 {"news",S_OK,FALSE},
2687 {"",S_FALSE,FALSE},
2688 {"",S_FALSE,FALSE}
2691 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2692 {0,S_FALSE,FALSE},
2693 {URL_SCHEME_NEWS,S_OK,FALSE},
2694 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2697 /* Don't encode forbidden characters. */
2698 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2700 {"news:test.tes<|>t.com",S_OK,FALSE},
2701 {"",S_FALSE,FALSE},
2702 {"news:test.tes<|>t.com",S_OK,FALSE},
2703 {"",S_FALSE,FALSE},
2704 {".com",S_OK,FALSE},
2705 {"",S_FALSE,FALSE},
2706 {"",S_FALSE,FALSE},
2707 {"",S_FALSE,FALSE},
2708 {"test.tes<|>t.com",S_OK,FALSE},
2709 {"test.tes<|>t.com",S_OK,FALSE},
2710 {"",S_FALSE,FALSE},
2711 {"news:test.tes<|>t.com",S_OK,FALSE},
2712 {"news",S_OK,FALSE},
2713 {"",S_FALSE,FALSE},
2714 {"",S_FALSE,FALSE}
2717 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2718 {0,S_FALSE,FALSE},
2719 {URL_SCHEME_NEWS,S_OK,FALSE},
2720 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2723 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2724 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2726 {"urn:test.tes<|>t.com",S_OK,FALSE},
2727 {"",S_FALSE,FALSE},
2728 {"urn:test.tes<|>t.com",S_OK,FALSE},
2729 {"",S_FALSE,FALSE},
2730 {".com",S_OK,FALSE},
2731 {"",S_FALSE,FALSE},
2732 {"",S_FALSE,FALSE},
2733 {"",S_FALSE,FALSE},
2734 {"test.tes<|>t.com",S_OK,FALSE},
2735 {"test.tes<|>t.com",S_OK,FALSE},
2736 {"",S_FALSE,FALSE},
2737 {"urn:test.tes<|>t.com",S_OK,FALSE},
2738 {"urn",S_OK,FALSE},
2739 {"",S_FALSE,FALSE},
2740 {"",S_FALSE,FALSE}
2743 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2744 {0,S_FALSE,FALSE},
2745 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2746 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2749 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2750 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2752 {"news:test.test.com",S_OK,FALSE},
2753 {"",S_FALSE,FALSE},
2754 {"news:test.test.com",S_OK,FALSE},
2755 {"",S_FALSE,FALSE},
2756 {".com",S_OK,FALSE},
2757 {"",S_FALSE,FALSE},
2758 {"",S_FALSE,FALSE},
2759 {"",S_FALSE,FALSE},
2760 {"test.test.com",S_OK,FALSE},
2761 {"test.test.com",S_OK,FALSE},
2762 {"",S_FALSE,FALSE},
2763 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2764 {"news",S_OK,FALSE},
2765 {"",S_FALSE,FALSE},
2766 {"",S_FALSE,FALSE}
2769 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2770 {0,S_FALSE,FALSE},
2771 {URL_SCHEME_NEWS,S_OK,FALSE},
2772 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2775 /* Percent encoded characters are still decoded for known scheme types. */
2776 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2778 {"news:test.test.com",S_OK,FALSE},
2779 {"",S_FALSE,FALSE},
2780 {"news:test.test.com",S_OK,FALSE},
2781 {"",S_FALSE,FALSE},
2782 {".com",S_OK,FALSE},
2783 {"",S_FALSE,FALSE},
2784 {"",S_FALSE,FALSE},
2785 {"",S_FALSE,FALSE},
2786 {"test.test.com",S_OK,FALSE},
2787 {"test.test.com",S_OK,FALSE},
2788 {"",S_FALSE,FALSE},
2789 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2790 {"news",S_OK,FALSE},
2791 {"",S_FALSE,FALSE},
2792 {"",S_FALSE,FALSE}
2795 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2796 {0,S_FALSE,FALSE},
2797 {URL_SCHEME_NEWS,S_OK,FALSE},
2798 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2801 /* Percent encoded characters aren't decoded for unknown scheme types. */
2802 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2804 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2805 {"",S_FALSE,FALSE},
2806 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2807 {"",S_FALSE,FALSE},
2808 {".com",S_OK,FALSE},
2809 {"",S_FALSE,FALSE},
2810 {"",S_FALSE,FALSE},
2811 {"",S_FALSE,FALSE},
2812 {"test.%74%65%73%74.com",S_OK,FALSE},
2813 {"test.%74%65%73%74.com",S_OK,FALSE},
2814 {"",S_FALSE,FALSE},
2815 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2816 {"urn",S_OK,FALSE},
2817 {"",S_FALSE,FALSE},
2818 {"",S_FALSE,FALSE}
2821 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2822 {0,S_FALSE,FALSE},
2823 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2824 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2827 /* Unknown scheme types can have invalid % encoded data in query string. */
2828 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2830 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2831 {"www.winehq.org",S_OK,FALSE},
2832 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2833 {"winehq.org",S_OK,FALSE},
2834 {"",S_FALSE,FALSE},
2835 {"",S_FALSE,FALSE},
2836 {"www.winehq.org",S_OK,FALSE},
2837 {"",S_FALSE,FALSE},
2838 {"/",S_OK,FALSE},
2839 {"/?query=%xx&return=y",S_OK,FALSE},
2840 {"?query=%xx&return=y",S_OK,FALSE},
2841 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2842 {"zip",S_OK,FALSE},
2843 {"",S_FALSE,FALSE},
2844 {"",S_FALSE,FALSE}
2847 {Uri_HOST_DNS,S_OK,FALSE},
2848 {0,S_FALSE,FALSE},
2849 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2850 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2853 /* Known scheme types can have invalid % encoded data with the right flags. */
2854 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2856 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2857 {"www.winehq.org",S_OK,FALSE},
2858 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2859 {"winehq.org",S_OK,FALSE},
2860 {"",S_FALSE,FALSE},
2861 {"",S_FALSE,FALSE},
2862 {"www.winehq.org",S_OK,FALSE},
2863 {"",S_FALSE,FALSE},
2864 {"/",S_OK,FALSE},
2865 {"/?query=%xx&return=y",S_OK,FALSE},
2866 {"?query=%xx&return=y",S_OK,FALSE},
2867 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2868 {"http",S_OK,FALSE},
2869 {"",S_FALSE,FALSE},
2870 {"",S_FALSE,FALSE}
2873 {Uri_HOST_DNS,S_OK,FALSE},
2874 {80,S_OK,FALSE},
2875 {URL_SCHEME_HTTP,S_OK,FALSE},
2876 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2879 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2880 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2882 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2883 {"www.winehq.org",S_OK,FALSE},
2884 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2885 {"winehq.org",S_OK,FALSE},
2886 {"",S_FALSE,FALSE},
2887 {"",S_FALSE,FALSE},
2888 {"www.winehq.org",S_OK,FALSE},
2889 {"",S_FALSE,FALSE},
2890 {"/",S_OK,FALSE},
2891 {"/?query=<|>&return=y",S_OK,FALSE},
2892 {"?query=<|>&return=y",S_OK,FALSE},
2893 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2894 {"http",S_OK,FALSE},
2895 {"",S_FALSE,FALSE},
2896 {"",S_FALSE,FALSE}
2899 {Uri_HOST_DNS,S_OK,FALSE},
2900 {80,S_OK,FALSE},
2901 {URL_SCHEME_HTTP,S_OK,FALSE},
2902 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2905 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2906 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2908 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2909 {"www.winehq.org",S_OK,FALSE},
2910 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2911 {"winehq.org",S_OK,FALSE},
2912 {"",S_FALSE,FALSE},
2913 {"",S_FALSE,FALSE},
2914 {"www.winehq.org",S_OK,FALSE},
2915 {"",S_FALSE,FALSE},
2916 {"/",S_OK,FALSE},
2917 {"/?query=<|>&return=y",S_OK,FALSE},
2918 {"?query=<|>&return=y",S_OK,FALSE},
2919 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2920 {"http",S_OK,FALSE},
2921 {"",S_FALSE,FALSE},
2922 {"",S_FALSE,FALSE}
2925 {Uri_HOST_DNS,S_OK,FALSE},
2926 {80,S_OK,FALSE},
2927 {URL_SCHEME_HTTP,S_OK,FALSE},
2928 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2931 /* Forbidden characters are encoded for known scheme types. */
2932 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2934 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2935 {"www.winehq.org",S_OK,FALSE},
2936 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2937 {"winehq.org",S_OK,FALSE},
2938 {"",S_FALSE,FALSE},
2939 {"",S_FALSE,FALSE},
2940 {"www.winehq.org",S_OK,FALSE},
2941 {"",S_FALSE,FALSE},
2942 {"/",S_OK,FALSE},
2943 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2944 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2945 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2946 {"http",S_OK,FALSE},
2947 {"",S_FALSE,FALSE},
2948 {"",S_FALSE,FALSE}
2951 {Uri_HOST_DNS,S_OK,FALSE},
2952 {80,S_OK,FALSE},
2953 {URL_SCHEME_HTTP,S_OK,FALSE},
2954 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2957 /* Forbidden characters are not encoded for unknown scheme types. */
2958 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2960 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2961 {"www.winehq.org",S_OK,FALSE},
2962 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2963 {"winehq.org",S_OK,FALSE},
2964 {"",S_FALSE,FALSE},
2965 {"",S_FALSE,FALSE},
2966 {"www.winehq.org",S_OK,FALSE},
2967 {"",S_FALSE,FALSE},
2968 {"/",S_OK,FALSE},
2969 {"/?query=<|>&return=y",S_OK,FALSE},
2970 {"?query=<|>&return=y",S_OK,FALSE},
2971 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2972 {"zip",S_OK,FALSE},
2973 {"",S_FALSE,FALSE},
2974 {"",S_FALSE,FALSE}
2977 {Uri_HOST_DNS,S_OK,FALSE},
2978 {0,S_FALSE,FALSE},
2979 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2980 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2983 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2984 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2986 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2987 {"www.winehq.org",S_OK,FALSE},
2988 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2989 {"winehq.org",S_OK,FALSE},
2990 {"",S_FALSE,FALSE},
2991 {"",S_FALSE,FALSE},
2992 {"www.winehq.org",S_OK,FALSE},
2993 {"",S_FALSE,FALSE},
2994 {"/",S_OK,FALSE},
2995 {"/?query=01&return=y",S_OK,FALSE},
2996 {"?query=01&return=y",S_OK,FALSE},
2997 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2998 {"http",S_OK,FALSE},
2999 {"",S_FALSE,FALSE},
3000 {"",S_FALSE,FALSE}
3003 {Uri_HOST_DNS,S_OK,FALSE},
3004 {80,S_OK,FALSE},
3005 {URL_SCHEME_HTTP,S_OK,FALSE},
3006 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3009 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
3010 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
3012 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3013 {"www.winehq.org",S_OK,FALSE},
3014 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3015 {"winehq.org",S_OK,FALSE},
3016 {"",S_FALSE,FALSE},
3017 {"",S_FALSE,FALSE},
3018 {"www.winehq.org",S_OK,FALSE},
3019 {"",S_FALSE,FALSE},
3020 {"/",S_OK,FALSE},
3021 {"/?query=%30%31&return=y",S_OK,FALSE},
3022 {"?query=%30%31&return=y",S_OK,FALSE},
3023 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
3024 {"zip",S_OK,FALSE},
3025 {"",S_FALSE,FALSE},
3026 {"",S_FALSE,FALSE}
3029 {Uri_HOST_DNS,S_OK,FALSE},
3030 {0,S_FALSE,FALSE},
3031 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3032 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3035 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
3036 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3038 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3039 {"www.winehq.org",S_OK,FALSE},
3040 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3041 {"winehq.org",S_OK,FALSE},
3042 {"",S_FALSE,FALSE},
3043 {"",S_FALSE,FALSE},
3044 {"www.winehq.org",S_OK,FALSE},
3045 {"",S_FALSE,FALSE},
3046 {"/",S_OK,FALSE},
3047 {"/?query=%30%31&return=y",S_OK,FALSE},
3048 {"?query=%30%31&return=y",S_OK,FALSE},
3049 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
3050 {"http",S_OK,FALSE},
3051 {"",S_FALSE,FALSE},
3052 {"",S_FALSE,FALSE}
3055 {Uri_HOST_DNS,S_OK,FALSE},
3056 {80,S_OK,FALSE},
3057 {URL_SCHEME_HTTP,S_OK,FALSE},
3058 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3061 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3063 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3064 {"www.winehq.org",S_OK,FALSE},
3065 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3066 {"winehq.org",S_OK,FALSE},
3067 {"",S_FALSE,FALSE},
3068 {"",S_FALSE,FALSE},
3069 {"www.winehq.org",S_OK,FALSE},
3070 {"",S_FALSE,FALSE},
3071 {"",S_FALSE,FALSE},
3072 {"?query=12&return=y",S_OK,FALSE},
3073 {"?query=12&return=y",S_OK,FALSE},
3074 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3075 {"http",S_OK,FALSE},
3076 {"",S_FALSE,FALSE},
3077 {"",S_FALSE,FALSE}
3080 {Uri_HOST_DNS,S_OK,FALSE},
3081 {80,S_OK,FALSE},
3082 {URL_SCHEME_HTTP,S_OK,FALSE},
3083 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3086 /* Unknown scheme types can have invalid % encoded data in fragments. */
3087 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
3089 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3090 {"www.winehq.org",S_OK,FALSE},
3091 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3092 {"winehq.org",S_OK,FALSE},
3093 {"",S_FALSE,FALSE},
3094 {"#Te%xx",S_OK,FALSE},
3095 {"www.winehq.org",S_OK,FALSE},
3096 {"",S_FALSE,FALSE},
3097 {"/tests/",S_OK,FALSE},
3098 {"/tests/",S_OK,FALSE},
3099 {"",S_FALSE,FALSE},
3100 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3101 {"zip",S_OK,FALSE},
3102 {"",S_FALSE,FALSE},
3103 {"",S_FALSE,FALSE}
3106 {Uri_HOST_DNS,S_OK,FALSE},
3107 {0,S_FALSE,FALSE},
3108 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3109 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3112 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
3113 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3115 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3116 {"www.winehq.org",S_OK,FALSE},
3117 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3118 {"winehq.org",S_OK,FALSE},
3119 {"",S_FALSE,FALSE},
3120 {"#Te<|>",S_OK,FALSE},
3121 {"www.winehq.org",S_OK,FALSE},
3122 {"",S_FALSE,FALSE},
3123 {"/tests/",S_OK,FALSE},
3124 {"/tests/",S_OK,FALSE},
3125 {"",S_FALSE,FALSE},
3126 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3127 {"zip",S_OK,FALSE},
3128 {"",S_FALSE,FALSE},
3129 {"",S_FALSE,FALSE}
3132 {Uri_HOST_DNS,S_OK,FALSE},
3133 {0,S_FALSE,FALSE},
3134 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3135 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3138 /* Forbidden characters in the fragment are percent encoded for known schemes. */
3139 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3141 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3142 {"www.winehq.org",S_OK,FALSE},
3143 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3144 {"winehq.org",S_OK,FALSE},
3145 {"",S_FALSE,FALSE},
3146 {"#Te%3C%7C%3E",S_OK,FALSE},
3147 {"www.winehq.org",S_OK,FALSE},
3148 {"",S_FALSE,FALSE},
3149 {"/tests/",S_OK,FALSE},
3150 {"/tests/",S_OK,FALSE},
3151 {"",S_FALSE,FALSE},
3152 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3153 {"http",S_OK,FALSE},
3154 {"",S_FALSE,FALSE},
3155 {"",S_FALSE,FALSE}
3158 {Uri_HOST_DNS,S_OK,FALSE},
3159 {80,S_OK,FALSE},
3160 {URL_SCHEME_HTTP,S_OK,FALSE},
3161 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3164 /* Forbidden characters aren't encoded in the fragment with this flag. */
3165 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3167 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3168 {"www.winehq.org",S_OK,FALSE},
3169 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3170 {"winehq.org",S_OK,FALSE},
3171 {"",S_FALSE,FALSE},
3172 {"#Te<|>",S_OK,FALSE},
3173 {"www.winehq.org",S_OK,FALSE},
3174 {"",S_FALSE,FALSE},
3175 {"/tests/",S_OK,FALSE},
3176 {"/tests/",S_OK,FALSE},
3177 {"",S_FALSE,FALSE},
3178 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3179 {"http",S_OK,FALSE},
3180 {"",S_FALSE,FALSE},
3181 {"",S_FALSE,FALSE}
3184 {Uri_HOST_DNS,S_OK,FALSE},
3185 {80,S_OK,FALSE},
3186 {URL_SCHEME_HTTP,S_OK,FALSE},
3187 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3190 /* Forbidden characters aren't encoded in the fragment with this flag. */
3191 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3193 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3194 {"www.winehq.org",S_OK,FALSE},
3195 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3196 {"winehq.org",S_OK,FALSE},
3197 {"",S_FALSE,FALSE},
3198 {"#Te<|>",S_OK,FALSE},
3199 {"www.winehq.org",S_OK,FALSE},
3200 {"",S_FALSE,FALSE},
3201 {"/tests/",S_OK,FALSE},
3202 {"/tests/",S_OK,FALSE},
3203 {"",S_FALSE,FALSE},
3204 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3205 {"http",S_OK,FALSE},
3206 {"",S_FALSE,FALSE},
3207 {"",S_FALSE,FALSE}
3210 {Uri_HOST_DNS,S_OK,FALSE},
3211 {80,S_OK,FALSE},
3212 {URL_SCHEME_HTTP,S_OK,FALSE},
3213 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3216 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3217 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3219 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3220 {"www.winehq.org",S_OK,FALSE},
3221 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3222 {"winehq.org",S_OK,FALSE},
3223 {"",S_FALSE,FALSE},
3224 {"#Te%30%31%32",S_OK,FALSE},
3225 {"www.winehq.org",S_OK,FALSE},
3226 {"",S_FALSE,FALSE},
3227 {"/tests/",S_OK,FALSE},
3228 {"/tests/",S_OK,FALSE},
3229 {"",S_FALSE,FALSE},
3230 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3231 {"zip",S_OK,FALSE},
3232 {"",S_FALSE,FALSE},
3233 {"",S_FALSE,FALSE}
3236 {Uri_HOST_DNS,S_OK,FALSE},
3237 {0,S_FALSE,FALSE},
3238 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3239 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3242 /* Percent encoded, unreserved characters are decoded for known schemes. */
3243 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3245 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3246 {"www.winehq.org",S_OK,FALSE},
3247 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3248 {"winehq.org",S_OK,FALSE},
3249 {"",S_FALSE,FALSE},
3250 {"#Te012",S_OK,FALSE},
3251 {"www.winehq.org",S_OK,FALSE},
3252 {"",S_FALSE,FALSE},
3253 {"/tests/",S_OK,FALSE},
3254 {"/tests/",S_OK,FALSE},
3255 {"",S_FALSE,FALSE},
3256 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3257 {"http",S_OK,FALSE},
3258 {"",S_FALSE,FALSE},
3259 {"",S_FALSE,FALSE}
3262 {Uri_HOST_DNS,S_OK,FALSE},
3263 {80,S_OK,FALSE},
3264 {URL_SCHEME_HTTP,S_OK,FALSE},
3265 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3268 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3269 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3271 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3272 {"www.winehq.org",S_OK,FALSE},
3273 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3274 {"winehq.org",S_OK,FALSE},
3275 {"",S_FALSE,FALSE},
3276 {"#Te012",S_OK,FALSE},
3277 {"www.winehq.org",S_OK,FALSE},
3278 {"",S_FALSE,FALSE},
3279 {"/tests/",S_OK,FALSE},
3280 {"/tests/",S_OK,FALSE},
3281 {"",S_FALSE,FALSE},
3282 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3283 {"http",S_OK,FALSE},
3284 {"",S_FALSE,FALSE},
3285 {"",S_FALSE,FALSE}
3288 {Uri_HOST_DNS,S_OK,FALSE},
3289 {80,S_OK,FALSE},
3290 {URL_SCHEME_HTTP,S_OK,FALSE},
3291 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3294 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3295 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3297 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3298 {"www.winehq.org",S_OK,FALSE},
3299 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3300 {"winehq.org",S_OK,FALSE},
3301 {"",S_FALSE,FALSE},
3302 {"#Te%30%31%32",S_OK,FALSE},
3303 {"www.winehq.org",S_OK,FALSE},
3304 {"",S_FALSE,FALSE},
3305 {"/tests/",S_OK,FALSE},
3306 {"/tests/",S_OK,FALSE},
3307 {"",S_FALSE,FALSE},
3308 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3309 {"http",S_OK,FALSE},
3310 {"",S_FALSE,FALSE},
3311 {"",S_FALSE,FALSE}
3314 {Uri_HOST_DNS,S_OK,FALSE},
3315 {80,S_OK,FALSE},
3316 {URL_SCHEME_HTTP,S_OK,FALSE},
3317 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3320 /* Leading/Trailing whitespace is removed. */
3321 { " http://google.com/ ", 0, S_OK, FALSE,
3323 {"http://google.com/",S_OK,FALSE},
3324 {"google.com",S_OK,FALSE},
3325 {"http://google.com/",S_OK,FALSE},
3326 {"google.com",S_OK,FALSE},
3327 {"",S_FALSE,FALSE},
3328 {"",S_FALSE,FALSE},
3329 {"google.com",S_OK,FALSE},
3330 {"",S_FALSE,FALSE},
3331 {"/",S_OK,FALSE},
3332 {"/",S_OK,FALSE},
3333 {"",S_FALSE,FALSE},
3334 {"http://google.com/",S_OK,FALSE},
3335 {"http",S_OK,FALSE},
3336 {"",S_FALSE,FALSE},
3337 {"",S_FALSE,FALSE}
3340 {Uri_HOST_DNS,S_OK,FALSE},
3341 {80,S_OK,FALSE},
3342 {URL_SCHEME_HTTP,S_OK,FALSE},
3343 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3346 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3348 {"http://google.com/",S_OK,FALSE},
3349 {"google.com",S_OK,FALSE},
3350 {"http://google.com/",S_OK,FALSE},
3351 {"google.com",S_OK,FALSE},
3352 {"",S_FALSE,FALSE},
3353 {"",S_FALSE,FALSE},
3354 {"google.com",S_OK,FALSE},
3355 {"",S_FALSE,FALSE},
3356 {"/",S_OK,FALSE},
3357 {"/",S_OK,FALSE},
3358 {"",S_FALSE,FALSE},
3359 {"http://google.com/",S_OK,FALSE},
3360 {"http",S_OK,FALSE},
3361 {"",S_FALSE,FALSE},
3362 {"",S_FALSE,FALSE}
3365 {Uri_HOST_DNS,S_OK,FALSE},
3366 {80,S_OK,FALSE},
3367 {URL_SCHEME_HTTP,S_OK,FALSE},
3368 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3371 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3373 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3374 {"g%0aoogle.co%0dm",S_OK,FALSE},
3375 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3376 {"g%0aoogle.co%0dm",S_OK,FALSE},
3377 {"",S_FALSE,FALSE},
3378 {"",S_FALSE,FALSE},
3379 {"g%0aoogle.co%0dm",S_OK,FALSE},
3380 {"",S_FALSE,FALSE},
3381 {"/%0A%0A%0A",S_OK,FALSE},
3382 {"/%0A%0A%0A",S_OK,FALSE},
3383 {"",S_FALSE,FALSE},
3384 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3385 {"http",S_OK,FALSE},
3386 {"",S_FALSE,FALSE},
3387 {"",S_FALSE,FALSE}
3390 {Uri_HOST_DNS,S_OK,FALSE},
3391 {80,S_OK,FALSE},
3392 {URL_SCHEME_HTTP,S_OK,FALSE},
3393 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3396 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3398 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3399 {"g\noogle.co\rm",S_OK,FALSE},
3400 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3401 {"g\noogle.co\rm",S_OK,FALSE},
3402 {"",S_FALSE,FALSE},
3403 {"",S_FALSE,FALSE},
3404 {"g\noogle.co\rm",S_OK,FALSE},
3405 {"",S_FALSE,FALSE},
3406 {"/\n\n\n",S_OK,FALSE},
3407 {"/\n\n\n",S_OK,FALSE},
3408 {"",S_FALSE,FALSE},
3409 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3410 {"zip",S_OK,FALSE},
3411 {"",S_FALSE,FALSE},
3412 {"",S_FALSE,FALSE}
3415 {Uri_HOST_DNS,S_OK,FALSE},
3416 {0,S_FALSE,FALSE},
3417 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3418 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3421 /* Since file URLs are usually hierarchical, it returns an empty string
3422 * for the absolute URI property since it was declared as an opaque URI.
3424 { "file:index.html", 0, S_OK, FALSE,
3426 {"",S_FALSE,FALSE},
3427 {"",S_FALSE,FALSE},
3428 {"file:index.html",S_OK,FALSE},
3429 {"",S_FALSE,FALSE},
3430 {".html",S_OK,FALSE},
3431 {"",S_FALSE,FALSE},
3432 {"",S_FALSE,FALSE},
3433 {"",S_FALSE,FALSE},
3434 {"index.html",S_OK,FALSE},
3435 {"index.html",S_OK,FALSE},
3436 {"",S_FALSE,FALSE},
3437 {"file:index.html",S_OK,FALSE},
3438 {"file",S_OK,FALSE},
3439 {"",S_FALSE,FALSE},
3440 {"",S_FALSE,FALSE}
3443 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3444 {0,S_FALSE,FALSE},
3445 {URL_SCHEME_FILE,S_OK,FALSE},
3446 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3449 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3450 { "http:test.com/index.html", 0, S_OK, FALSE,
3452 {"",S_FALSE,FALSE},
3453 {"",S_FALSE,FALSE},
3454 {"http:test.com/index.html",S_OK,FALSE},
3455 {"",S_FALSE,FALSE},
3456 {".html",S_OK,FALSE},
3457 {"",S_FALSE,FALSE},
3458 {"",S_FALSE,FALSE},
3459 {"",S_FALSE,FALSE},
3460 {"test.com/index.html",S_OK,FALSE},
3461 {"test.com/index.html",S_OK,FALSE},
3462 {"",S_FALSE,FALSE},
3463 {"http:test.com/index.html",S_OK,FALSE},
3464 {"http",S_OK,FALSE},
3465 {"",S_FALSE,FALSE},
3466 {"",S_FALSE,FALSE}
3469 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3470 {80,S_OK,FALSE},
3471 {URL_SCHEME_HTTP,S_OK,FALSE},
3472 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3475 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3477 {"",S_FALSE,FALSE},
3478 {"",S_FALSE,FALSE},
3479 {"ftp:test.com/index.html",S_OK,FALSE},
3480 {"",S_FALSE,FALSE},
3481 {".html",S_OK,FALSE},
3482 {"",S_FALSE,FALSE},
3483 {"",S_FALSE,FALSE},
3484 {"",S_FALSE,FALSE},
3485 {"test.com/index.html",S_OK,FALSE},
3486 {"test.com/index.html",S_OK,FALSE},
3487 {"",S_FALSE,FALSE},
3488 {"ftp:test.com/index.html",S_OK,FALSE},
3489 {"ftp",S_OK,FALSE},
3490 {"",S_FALSE,FALSE},
3491 {"",S_FALSE,FALSE}
3494 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3495 {21,S_OK,FALSE},
3496 {URL_SCHEME_FTP,S_OK,FALSE},
3497 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3500 { "file://C|/test.mp3", 0, S_OK, FALSE,
3502 {"file:///C:/test.mp3",S_OK,FALSE},
3503 {"",S_FALSE,FALSE},
3504 {"file:///C:/test.mp3",S_OK,FALSE},
3505 {"",S_FALSE,FALSE},
3506 {".mp3",S_OK,FALSE},
3507 {"",S_FALSE,FALSE},
3508 {"",S_FALSE,FALSE},
3509 {"",S_FALSE,FALSE},
3510 {"/C:/test.mp3",S_OK,FALSE},
3511 {"/C:/test.mp3",S_OK,FALSE},
3512 {"",S_FALSE,FALSE},
3513 {"file://C|/test.mp3",S_OK,FALSE},
3514 {"file",S_OK,FALSE},
3515 {"",S_FALSE,FALSE},
3516 {"",S_FALSE,FALSE}
3519 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3520 {0,S_FALSE,FALSE},
3521 {URL_SCHEME_FILE,S_OK,FALSE},
3522 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3525 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3527 {"file:///C:/test.mp3",S_OK,FALSE},
3528 {"",S_FALSE,FALSE},
3529 {"file:///C:/test.mp3",S_OK,FALSE},
3530 {"",S_FALSE,FALSE},
3531 {".mp3",S_OK,FALSE},
3532 {"",S_FALSE,FALSE},
3533 {"",S_FALSE,FALSE},
3534 {"",S_FALSE,FALSE},
3535 {"/C:/test.mp3",S_OK,FALSE},
3536 {"/C:/test.mp3",S_OK,FALSE},
3537 {"",S_FALSE,FALSE},
3538 {"file:///C|/test.mp3",S_OK,FALSE},
3539 {"file",S_OK,FALSE},
3540 {"",S_FALSE,FALSE},
3541 {"",S_FALSE,FALSE}
3544 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3545 {0,S_FALSE,FALSE},
3546 {URL_SCHEME_FILE,S_OK,FALSE},
3547 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3550 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3551 * to '\\'.
3553 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3555 {"file://c:\\dir\\index.html",S_OK,FALSE},
3556 {"",S_FALSE,FALSE},
3557 {"file://c:\\dir\\index.html",S_OK,FALSE},
3558 {"",S_FALSE,FALSE},
3559 {".html",S_OK,FALSE},
3560 {"",S_FALSE,FALSE},
3561 {"",S_FALSE,FALSE},
3562 {"",S_FALSE,FALSE},
3563 {"c:\\dir\\index.html",S_OK,FALSE},
3564 {"c:\\dir\\index.html",S_OK,FALSE},
3565 {"",S_FALSE,FALSE},
3566 {"file://c:/dir/index.html",S_OK,FALSE},
3567 {"file",S_OK,FALSE},
3568 {"",S_FALSE,FALSE},
3569 {"",S_FALSE,FALSE}
3572 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3573 {0,S_FALSE,FALSE},
3574 {URL_SCHEME_FILE,S_OK,FALSE},
3575 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3578 /* Extra '/' after "file://" is removed. */
3579 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3581 {"file://c:\\dir\\index.html",S_OK,FALSE},
3582 {"",S_FALSE,FALSE},
3583 {"file://c:\\dir\\index.html",S_OK,FALSE},
3584 {"",S_FALSE,FALSE},
3585 {".html",S_OK,FALSE},
3586 {"",S_FALSE,FALSE},
3587 {"",S_FALSE,FALSE},
3588 {"",S_FALSE,FALSE},
3589 {"c:\\dir\\index.html",S_OK,FALSE},
3590 {"c:\\dir\\index.html",S_OK,FALSE},
3591 {"",S_FALSE,FALSE},
3592 {"file:///c:/dir/index.html",S_OK,FALSE},
3593 {"file",S_OK,FALSE},
3594 {"",S_FALSE,FALSE},
3595 {"",S_FALSE,FALSE}
3598 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3599 {0,S_FALSE,FALSE},
3600 {URL_SCHEME_FILE,S_OK,FALSE},
3601 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3604 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3605 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3607 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3608 {"",S_FALSE,FALSE},
3609 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3610 {"",S_FALSE,FALSE},
3611 {".html",S_OK,FALSE},
3612 {"",S_FALSE,FALSE},
3613 {"",S_FALSE,FALSE},
3614 {"",S_FALSE,FALSE},
3615 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3616 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3617 {"",S_FALSE,FALSE},
3618 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3619 {"file",S_OK,FALSE},
3620 {"",S_FALSE,FALSE},
3621 {"",S_FALSE,FALSE}
3624 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3625 {0,S_FALSE,FALSE},
3626 {URL_SCHEME_FILE,S_OK,FALSE},
3627 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3630 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3632 {"file://c:\\dir\\index.html",S_OK,FALSE},
3633 {"",S_FALSE,FALSE},
3634 {"file://c:\\dir\\index.html",S_OK,FALSE},
3635 {"",S_FALSE,FALSE},
3636 {".html",S_OK,FALSE},
3637 {"",S_FALSE,FALSE},
3638 {"",S_FALSE,FALSE},
3639 {"",S_FALSE,FALSE},
3640 {"c:\\dir\\index.html",S_OK,FALSE},
3641 {"c:\\dir\\index.html",S_OK,FALSE},
3642 {"",S_FALSE,FALSE},
3643 {"file://c|/dir\\index.html",S_OK,FALSE},
3644 {"file",S_OK,FALSE},
3645 {"",S_FALSE,FALSE},
3646 {"",S_FALSE,FALSE}
3649 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3650 {0,S_FALSE,FALSE},
3651 {URL_SCHEME_FILE,S_OK,FALSE},
3652 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3655 /* The backslashes after the scheme name are converted to forward slashes. */
3656 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3658 {"file://c:\\dir\\index.html",S_OK,FALSE},
3659 {"",S_FALSE,FALSE},
3660 {"file://c:\\dir\\index.html",S_OK,FALSE},
3661 {"",S_FALSE,FALSE},
3662 {".html",S_OK,FALSE},
3663 {"",S_FALSE,FALSE},
3664 {"",S_FALSE,FALSE},
3665 {"",S_FALSE,FALSE},
3666 {"c:\\dir\\index.html",S_OK,FALSE},
3667 {"c:\\dir\\index.html",S_OK,FALSE},
3668 {"",S_FALSE,FALSE},
3669 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3670 {"file",S_OK,FALSE},
3671 {"",S_FALSE,FALSE},
3672 {"",S_FALSE,FALSE}
3675 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3676 {0,S_FALSE,FALSE},
3677 {URL_SCHEME_FILE,S_OK,FALSE},
3678 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3681 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3683 {"file:///c:/dir/index.html",S_OK,FALSE},
3684 {"",S_FALSE,FALSE},
3685 {"file:///c:/dir/index.html",S_OK,FALSE},
3686 {"",S_FALSE,FALSE},
3687 {".html",S_OK,FALSE},
3688 {"",S_FALSE,FALSE},
3689 {"",S_FALSE,FALSE},
3690 {"",S_FALSE,FALSE},
3691 {"/c:/dir/index.html",S_OK,FALSE},
3692 {"/c:/dir/index.html",S_OK,FALSE},
3693 {"",S_FALSE,FALSE},
3694 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3695 {"file",S_OK,FALSE},
3696 {"",S_FALSE,FALSE},
3697 {"",S_FALSE,FALSE}
3700 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3701 {0,S_FALSE,FALSE},
3702 {URL_SCHEME_FILE,S_OK,FALSE},
3703 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3706 { "http:\\\\google.com", 0, S_OK, FALSE,
3708 {"http://google.com/",S_OK,FALSE},
3709 {"google.com",S_OK,FALSE},
3710 {"http://google.com/",S_OK,FALSE},
3711 {"google.com",S_OK,FALSE},
3712 {"",S_FALSE,FALSE},
3713 {"",S_FALSE,FALSE},
3714 {"google.com",S_OK,FALSE},
3715 {"",S_FALSE,FALSE},
3716 {"/",S_OK,FALSE},
3717 {"/",S_OK,FALSE},
3718 {"",S_FALSE,FALSE},
3719 {"http:\\\\google.com",S_OK,FALSE},
3720 {"http",S_OK,FALSE},
3721 {"",S_FALSE,FALSE},
3722 {"",S_FALSE,FALSE}
3725 {Uri_HOST_DNS,S_OK,FALSE},
3726 {80,S_OK,FALSE},
3727 {URL_SCHEME_HTTP,S_OK,FALSE},
3728 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3731 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3732 { "zip:\\\\google.com", 0, S_OK, FALSE,
3734 {"zip:\\\\google.com",S_OK,FALSE},
3735 {"",S_FALSE,FALSE},
3736 {"zip:\\\\google.com",S_OK,FALSE},
3737 {"",S_FALSE,FALSE},
3738 {".com",S_OK,FALSE},
3739 {"",S_FALSE,FALSE},
3740 {"",S_FALSE,FALSE},
3741 {"",S_FALSE,FALSE},
3742 {"\\\\google.com",S_OK,FALSE},
3743 {"\\\\google.com",S_OK,FALSE},
3744 {"",S_FALSE,FALSE},
3745 {"zip:\\\\google.com",S_OK,FALSE},
3746 {"zip",S_OK,FALSE},
3747 {"",S_FALSE,FALSE},
3748 {"",S_FALSE,FALSE}
3751 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3752 {0,S_FALSE,FALSE},
3753 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3754 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3757 /* Dot segments aren't removed. */
3758 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3760 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3761 {"",S_FALSE,FALSE},
3762 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3763 {"",S_FALSE,FALSE},
3764 {".html",S_OK,FALSE},
3765 {"",S_FALSE,FALSE},
3766 {"",S_FALSE,FALSE},
3767 {"",S_FALSE,FALSE},
3768 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3769 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3770 {"",S_FALSE,FALSE},
3771 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3772 {"file",S_OK,FALSE},
3773 {"",S_FALSE,FALSE},
3774 {"",S_FALSE,FALSE}
3777 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3778 {0,S_FALSE,FALSE},
3779 {URL_SCHEME_FILE,S_OK,FALSE},
3780 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3783 /* Forbidden characters aren't percent encoded. */
3784 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3786 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3787 {"",S_FALSE,FALSE},
3788 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3789 {"",S_FALSE,FALSE},
3790 {".html",S_OK,FALSE},
3791 {"",S_FALSE,FALSE},
3792 {"",S_FALSE,FALSE},
3793 {"",S_FALSE,FALSE},
3794 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3795 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3796 {"",S_FALSE,FALSE},
3797 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3798 {"file",S_OK,FALSE},
3799 {"",S_FALSE,FALSE},
3800 {"",S_FALSE,FALSE}
3803 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3804 {0,S_FALSE,FALSE},
3805 {URL_SCHEME_FILE,S_OK,FALSE},
3806 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3809 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3810 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3812 {"",S_FALSE,FALSE},
3813 {"",S_FALSE,FALSE},
3814 {"file:c:/dir/../../index.html",S_OK,FALSE},
3815 {"",S_FALSE,FALSE},
3816 {".html",S_OK,FALSE},
3817 {"",S_FALSE,FALSE},
3818 {"",S_FALSE,FALSE},
3819 {"",S_FALSE,FALSE},
3820 {"c:/dir/../../index.html",S_OK,FALSE},
3821 {"c:/dir/../../index.html",S_OK,FALSE},
3822 {"",S_FALSE,FALSE},
3823 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3824 {"file",S_OK,FALSE},
3825 {"",S_FALSE,FALSE},
3826 {"",S_FALSE,FALSE}
3829 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3830 {0,S_FALSE,FALSE},
3831 {URL_SCHEME_FILE,S_OK,FALSE},
3832 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3835 /* '/' are still converted to '\' even though it's an opaque URI. */
3836 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3838 {"",S_FALSE,FALSE},
3839 {"",S_FALSE,FALSE},
3840 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3841 {"",S_FALSE,FALSE},
3842 {".html",S_OK,FALSE},
3843 {"",S_FALSE,FALSE},
3844 {"",S_FALSE,FALSE},
3845 {"",S_FALSE,FALSE},
3846 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3847 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3848 {"",S_FALSE,FALSE},
3849 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3850 {"file",S_OK,FALSE},
3851 {"",S_FALSE,FALSE},
3852 {"",S_FALSE,FALSE}
3855 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3856 {0,S_FALSE,FALSE},
3857 {URL_SCHEME_FILE,S_OK,FALSE},
3858 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3861 /* Forbidden characters aren't percent encoded. */
3862 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3864 {"",S_FALSE,FALSE},
3865 {"",S_FALSE,FALSE},
3866 {"file:c:\\in^|dex.html",S_OK,FALSE},
3867 {"",S_FALSE,FALSE},
3868 {".html",S_OK,FALSE},
3869 {"",S_FALSE,FALSE},
3870 {"",S_FALSE,FALSE},
3871 {"",S_FALSE,FALSE},
3872 {"c:\\in^|dex.html",S_OK,FALSE},
3873 {"c:\\in^|dex.html",S_OK,FALSE},
3874 {"",S_FALSE,FALSE},
3875 {"file:c:\\in^|dex.html",S_OK,FALSE},
3876 {"file",S_OK,FALSE},
3877 {"",S_FALSE,FALSE},
3878 {"",S_FALSE,FALSE}
3881 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3882 {0,S_FALSE,FALSE},
3883 {URL_SCHEME_FILE,S_OK,FALSE},
3884 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3887 /* Doesn't have a UserName since the ':' appears at the beginning of the
3888 * userinfo section.
3890 { "http://:password@gov.uk", 0, S_OK, FALSE,
3892 {"http://:password@gov.uk/",S_OK,FALSE},
3893 {":password@gov.uk",S_OK,FALSE},
3894 {"http://gov.uk/",S_OK,FALSE},
3895 {"",S_FALSE,FALSE},
3896 {"",S_FALSE,FALSE},
3897 {"",S_FALSE,FALSE},
3898 {"gov.uk",S_OK,FALSE},
3899 {"password",S_OK,FALSE},
3900 {"/",S_OK,FALSE},
3901 {"/",S_OK,FALSE},
3902 {"",S_FALSE,FALSE},
3903 {"http://:password@gov.uk",S_OK,FALSE},
3904 {"http",S_OK,FALSE},
3905 {":password",S_OK,FALSE},
3906 {"",S_FALSE,FALSE}
3909 {Uri_HOST_DNS,S_OK,FALSE},
3910 {80,S_OK,FALSE},
3911 {URL_SCHEME_HTTP,S_OK,FALSE},
3912 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3915 /* Has a UserName since the userinfo section doesn't contain a password. */
3916 { "http://@gov.uk", 0, S_OK, FALSE,
3918 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3919 {"@gov.uk",S_OK,FALSE},
3920 {"http://gov.uk/",S_OK,FALSE},
3921 {"",S_FALSE,FALSE},
3922 {"",S_FALSE,FALSE},
3923 {"",S_FALSE,FALSE},
3924 {"gov.uk",S_OK,FALSE},
3925 {"",S_FALSE,FALSE},
3926 {"/",S_OK,FALSE},
3927 {"/",S_OK,FALSE},
3928 {"",S_FALSE,FALSE},
3929 {"http://@gov.uk",S_OK,FALSE},
3930 {"http",S_OK,FALSE},
3931 {"",S_OK,FALSE},
3932 {"",S_OK,FALSE}
3935 {Uri_HOST_DNS,S_OK,FALSE},
3936 {80,S_OK,FALSE},
3937 {URL_SCHEME_HTTP,S_OK,FALSE},
3938 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3941 /* ":@" not included in the absolute URI. */
3942 { "http://:@gov.uk", 0, S_OK, FALSE,
3944 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3945 {":@gov.uk",S_OK,FALSE},
3946 {"http://gov.uk/",S_OK,FALSE},
3947 {"",S_FALSE,FALSE},
3948 {"",S_FALSE,FALSE},
3949 {"",S_FALSE,FALSE},
3950 {"gov.uk",S_OK,FALSE},
3951 {"",S_OK,FALSE},
3952 {"/",S_OK,FALSE},
3953 {"/",S_OK,FALSE},
3954 {"",S_FALSE,FALSE},
3955 {"http://:@gov.uk",S_OK,FALSE},
3956 {"http",S_OK,FALSE},
3957 {":",S_OK,FALSE},
3958 {"",S_FALSE,FALSE}
3961 {Uri_HOST_DNS,S_OK,FALSE},
3962 {80,S_OK,FALSE},
3963 {URL_SCHEME_HTTP,S_OK,FALSE},
3964 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3967 /* '@' is included because it's an unknown scheme type. */
3968 { "zip://@gov.uk", 0, S_OK, FALSE,
3970 {"zip://@gov.uk/",S_OK,FALSE},
3971 {"@gov.uk",S_OK,FALSE},
3972 {"zip://@gov.uk/",S_OK,FALSE},
3973 {"",S_FALSE,FALSE},
3974 {"",S_FALSE,FALSE},
3975 {"",S_FALSE,FALSE},
3976 {"gov.uk",S_OK,FALSE},
3977 {"",S_FALSE,FALSE},
3978 {"/",S_OK,FALSE},
3979 {"/",S_OK,FALSE},
3980 {"",S_FALSE,FALSE},
3981 {"zip://@gov.uk",S_OK,FALSE},
3982 {"zip",S_OK,FALSE},
3983 {"",S_OK,FALSE},
3984 {"",S_OK,FALSE}
3987 {Uri_HOST_DNS,S_OK,FALSE},
3988 {0,S_FALSE,FALSE},
3989 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3990 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3993 /* ":@" are included because it's an unknown scheme type. */
3994 { "zip://:@gov.uk", 0, S_OK, FALSE,
3996 {"zip://:@gov.uk/",S_OK,FALSE},
3997 {":@gov.uk",S_OK,FALSE},
3998 {"zip://:@gov.uk/",S_OK,FALSE},
3999 {"",S_FALSE,FALSE},
4000 {"",S_FALSE,FALSE},
4001 {"",S_FALSE,FALSE},
4002 {"gov.uk",S_OK,FALSE},
4003 {"",S_OK,FALSE},
4004 {"/",S_OK,FALSE},
4005 {"/",S_OK,FALSE},
4006 {"",S_FALSE,FALSE},
4007 {"zip://:@gov.uk",S_OK,FALSE},
4008 {"zip",S_OK,FALSE},
4009 {":",S_OK,FALSE},
4010 {"",S_FALSE,FALSE}
4013 {Uri_HOST_DNS,S_OK,FALSE},
4014 {0,S_FALSE,FALSE},
4015 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4016 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4019 { "about:blank", 0, S_OK, FALSE,
4021 {"about:blank",S_OK,FALSE},
4022 {"",S_FALSE,FALSE},
4023 {"about:blank",S_OK,FALSE},
4024 {"",S_FALSE,FALSE},
4025 {"",S_FALSE,FALSE},
4026 {"",S_FALSE,FALSE},
4027 {"",S_FALSE,FALSE},
4028 {"",S_FALSE,FALSE},
4029 {"blank",S_OK,FALSE},
4030 {"blank",S_OK,FALSE},
4031 {"",S_FALSE,FALSE},
4032 {"about:blank",S_OK,FALSE},
4033 {"about",S_OK,FALSE},
4034 {"",S_FALSE,FALSE},
4035 {"",S_FALSE,FALSE}
4038 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4039 {0,S_FALSE,FALSE},
4040 {URL_SCHEME_ABOUT,S_OK,FALSE},
4041 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4044 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
4046 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4047 {"",S_FALSE,FALSE},
4048 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4049 {"",S_FALSE,FALSE},
4050 {".htm",S_OK,FALSE},
4051 {"",S_FALSE,FALSE},
4052 {"",S_FALSE,FALSE},
4053 {"",S_FALSE,FALSE},
4054 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4055 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4056 {"",S_FALSE,FALSE},
4057 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4058 {"mk",S_OK,FALSE},
4059 {"",S_FALSE,FALSE},
4060 {"",S_FALSE,FALSE}
4063 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4064 {0,S_FALSE,FALSE},
4065 {URL_SCHEME_MK,S_OK,FALSE},
4066 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4069 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
4071 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4072 {"",S_FALSE,FALSE},
4073 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4074 {"",S_FALSE,FALSE},
4075 {".htm",S_OK,FALSE},
4076 {"",S_FALSE,FALSE},
4077 {"",S_FALSE,FALSE},
4078 {"",S_FALSE,FALSE},
4079 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4080 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4081 {"",S_FALSE,FALSE},
4082 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4083 {"mk",S_OK,FALSE},
4084 {"",S_FALSE,FALSE},
4085 {"",S_FALSE,FALSE}
4088 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4089 {0,S_FALSE,FALSE},
4090 {URL_SCHEME_MK,S_OK,FALSE},
4091 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4094 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
4095 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
4097 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4098 {"server",S_OK,FALSE},
4099 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4100 {"",S_FALSE,FALSE},
4101 {".html",S_OK,FALSE},
4102 {"",S_FALSE,FALSE},
4103 {"server",S_OK,FALSE},
4104 {"",S_FALSE,FALSE},
4105 {"\\dir\\index.html",S_OK,FALSE},
4106 {"\\dir\\index.html",S_OK,FALSE},
4107 {"",S_FALSE,FALSE},
4108 {"file://server/dir/index.html",S_OK,FALSE},
4109 {"file",S_OK,FALSE},
4110 {"",S_FALSE,FALSE},
4111 {"",S_FALSE,FALSE}
4114 {Uri_HOST_DNS,S_OK,FALSE},
4115 {0,S_FALSE,FALSE},
4116 {URL_SCHEME_FILE,S_OK,FALSE},
4117 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4120 /* When CreateUri generates an IUri, it still displays the default port in the
4121 * authority.
4123 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4125 {"http://google.com:80/",S_OK,FALSE},
4126 {"google.com:80",S_OK,FALSE},
4127 {"http://google.com:80/",S_OK,FALSE},
4128 {"google.com",S_OK,FALSE},
4129 {"",S_FALSE,FALSE},
4130 {"",S_FALSE,FALSE},
4131 {"google.com",S_OK,FALSE},
4132 {"",S_FALSE,FALSE},
4133 {"/",S_OK,FALSE},
4134 {"/",S_OK,FALSE},
4135 {"",S_FALSE,FALSE},
4136 {"http://google.com:80/",S_OK,FALSE},
4137 {"http",S_OK,FALSE},
4138 {"",S_FALSE,FALSE},
4139 {"",S_FALSE,FALSE}
4142 {Uri_HOST_DNS,S_OK,FALSE},
4143 {80,S_OK,FALSE},
4144 {URL_SCHEME_HTTP,S_OK,FALSE},
4145 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4148 /* For res URIs the host is everything up until the first '/'. */
4149 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
4151 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4152 {"C:\\dir\\file.exe",S_OK,FALSE},
4153 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4154 {"",S_FALSE,FALSE},
4155 {".html",S_OK,FALSE},
4156 {"",S_FALSE,FALSE},
4157 {"C:\\dir\\file.exe",S_OK,FALSE},
4158 {"",S_FALSE,FALSE},
4159 {"/DATA/test.html",S_OK,FALSE},
4160 {"/DATA/test.html",S_OK,FALSE},
4161 {"",S_FALSE,FALSE},
4162 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4163 {"res",S_OK,FALSE},
4164 {"",S_FALSE,FALSE},
4165 {"",S_FALSE,FALSE}
4168 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4169 {0,S_FALSE,FALSE},
4170 {URL_SCHEME_RES,S_OK,FALSE},
4171 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4174 /* Res URI can contain a '|' in the host name. */
4175 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4177 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4178 {"c:\\di|r\\file.exe",S_OK,FALSE},
4179 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4180 {"",S_FALSE,FALSE},
4181 {"",S_FALSE,FALSE},
4182 {"",S_FALSE,FALSE},
4183 {"c:\\di|r\\file.exe",S_OK,FALSE},
4184 {"",S_FALSE,FALSE},
4185 {"/test",S_OK,FALSE},
4186 {"/test",S_OK,FALSE},
4187 {"",S_FALSE,FALSE},
4188 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4189 {"res",S_OK,FALSE},
4190 {"",S_FALSE,FALSE},
4191 {"",S_FALSE,FALSE}
4194 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4195 {0,S_FALSE,FALSE},
4196 {URL_SCHEME_RES,S_OK,FALSE},
4197 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4200 /* Res URIs can have invalid percent encoded values. */
4201 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4203 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4204 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4205 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4206 {"",S_FALSE,FALSE},
4207 {"",S_FALSE,FALSE},
4208 {"",S_FALSE,FALSE},
4209 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4210 {"",S_FALSE,FALSE},
4211 {"/test",S_OK,FALSE},
4212 {"/test",S_OK,FALSE},
4213 {"",S_FALSE,FALSE},
4214 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4215 {"res",S_OK,FALSE},
4216 {"",S_FALSE,FALSE},
4217 {"",S_FALSE,FALSE}
4220 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4221 {0,S_FALSE,FALSE},
4222 {URL_SCHEME_RES,S_OK,FALSE},
4223 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4226 /* Res doesn't get forbidden characters percent encoded in its path. */
4227 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4229 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4230 {"c:\\test",S_OK,FALSE},
4231 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4232 {"",S_FALSE,FALSE},
4233 {"",S_FALSE,FALSE},
4234 {"",S_FALSE,FALSE},
4235 {"c:\\test",S_OK,FALSE},
4236 {"",S_FALSE,FALSE},
4237 {"/tes<|>t",S_OK,FALSE},
4238 {"/tes<|>t",S_OK,FALSE},
4239 {"",S_FALSE,FALSE},
4240 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4241 {"res",S_OK,FALSE},
4242 {"",S_FALSE,FALSE},
4243 {"",S_FALSE,FALSE}
4246 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4247 {0,S_FALSE,FALSE},
4248 {URL_SCHEME_RES,S_OK,FALSE},
4249 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4252 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4254 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4255 {"",S_FALSE,FALSE},
4256 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4257 {"",S_FALSE,FALSE},
4258 {".jpg",S_OK,FALSE},
4259 {"",S_FALSE,FALSE},
4260 {"",S_FALSE,FALSE},
4261 {"",S_FALSE,FALSE},
4262 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4263 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4264 {"",S_FALSE,FALSE},
4265 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4266 {"mk",S_OK,FALSE},
4267 {"",S_FALSE,FALSE},
4268 {"",S_FALSE,FALSE}
4271 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4272 {0,S_FALSE,FALSE},
4273 {URL_SCHEME_MK,S_OK,FALSE},
4274 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4277 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4279 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4280 {"",S_FALSE,FALSE},
4281 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4282 {"",S_FALSE,FALSE},
4283 {".jpg",S_OK,FALSE},
4284 {"",S_FALSE,FALSE},
4285 {"",S_FALSE,FALSE},
4286 {"",S_FALSE,FALSE},
4287 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4288 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4289 {"",S_FALSE,FALSE},
4290 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4291 {"mk",S_OK,FALSE},
4292 {"",S_FALSE,FALSE},
4293 {"",S_FALSE,FALSE}
4296 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4297 {0,S_FALSE,FALSE},
4298 {URL_SCHEME_MK,S_OK,FALSE},
4299 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4302 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4304 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4305 {"",S_FALSE,FALSE},
4306 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4307 {"",S_FALSE,FALSE},
4308 {".jpg",S_OK,FALSE},
4309 {"",S_FALSE,FALSE},
4310 {"",S_FALSE,FALSE},
4311 {"",S_FALSE,FALSE},
4312 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4313 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4314 {"",S_FALSE,FALSE},
4315 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4316 {"xx",S_OK,FALSE},
4317 {"",S_FALSE,FALSE},
4318 {"",S_FALSE,FALSE}
4321 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4322 {0,S_FALSE,FALSE},
4323 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4324 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4327 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4329 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4330 {"",S_FALSE,FALSE},
4331 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4332 {"",S_FALSE,FALSE},
4333 {".jpg",S_OK,FALSE},
4334 {"",S_FALSE,FALSE},
4335 {"",S_FALSE,FALSE},
4336 {"",S_FALSE,FALSE},
4337 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4338 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4339 {"",S_FALSE,FALSE},
4340 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4341 {"mk",S_OK,FALSE},
4342 {"",S_FALSE,FALSE},
4343 {"",S_FALSE,FALSE}
4346 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4347 {0,S_FALSE,FALSE},
4348 {URL_SCHEME_MK,S_OK,FALSE},
4349 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4352 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4354 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4355 {"",S_FALSE,FALSE},
4356 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4357 {"",S_FALSE,FALSE},
4358 {".jpg",S_OK,FALSE},
4359 {"",S_FALSE,FALSE},
4360 {"",S_FALSE,FALSE},
4361 {"",S_FALSE,FALSE},
4362 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4363 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4364 {"",S_FALSE,FALSE},
4365 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4366 {"mk",S_OK,FALSE},
4367 {"",S_FALSE,FALSE},
4368 {"",S_FALSE,FALSE}
4371 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4372 {0,S_FALSE,FALSE},
4373 {URL_SCHEME_MK,S_OK,FALSE},
4374 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4377 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4379 {"mk:images/xxx.jpg",S_OK,FALSE},
4380 {"",S_FALSE,FALSE},
4381 {"mk:images/xxx.jpg",S_OK,FALSE},
4382 {"",S_FALSE,FALSE},
4383 {".jpg",S_OK,FALSE},
4384 {"",S_FALSE,FALSE},
4385 {"",S_FALSE,FALSE},
4386 {"",S_FALSE,FALSE},
4387 {"images/xxx.jpg",S_OK,FALSE},
4388 {"images/xxx.jpg",S_OK,FALSE},
4389 {"",S_FALSE,FALSE},
4390 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4391 {"mk",S_OK,FALSE},
4392 {"",S_FALSE,FALSE},
4393 {"",S_FALSE,FALSE}
4396 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4397 {0,S_FALSE,FALSE},
4398 {URL_SCHEME_MK,S_OK,FALSE},
4399 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4402 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4404 {"",S_OK,FALSE},
4405 {"",S_FALSE,FALSE},
4406 {"",S_OK,FALSE},
4407 {"",S_FALSE,FALSE},
4408 {"",S_FALSE,FALSE},
4409 {"",S_FALSE,FALSE},
4410 {"",S_FALSE,FALSE},
4411 {"",S_FALSE,FALSE},
4412 {"",S_OK,FALSE},
4413 {"",S_OK,FALSE},
4414 {"",S_FALSE,FALSE},
4415 {"",S_OK,FALSE},
4416 {"",S_FALSE,FALSE},
4417 {"",S_FALSE,FALSE},
4418 {"",S_FALSE,FALSE}
4421 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4422 {0,S_FALSE,FALSE},
4423 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4424 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4427 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4429 {"",S_OK,FALSE},
4430 {"",S_FALSE,FALSE},
4431 {"",S_OK,FALSE},
4432 {"",S_FALSE,FALSE},
4433 {"",S_FALSE,FALSE},
4434 {"",S_FALSE,FALSE},
4435 {"",S_FALSE,FALSE},
4436 {"",S_FALSE,FALSE},
4437 {"",S_OK,FALSE},
4438 {"",S_OK,FALSE},
4439 {"",S_FALSE,FALSE},
4440 {"",S_OK,FALSE},
4441 {"",S_FALSE,FALSE},
4442 {"",S_FALSE,FALSE},
4443 {"",S_FALSE,FALSE}
4446 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4447 {0,S_FALSE,FALSE},
4448 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4449 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4452 { "javascript:void", 0, S_OK, FALSE,
4454 {"javascript:void",S_OK},
4455 {"",S_FALSE},
4456 {"javascript:void",S_OK},
4457 {"",S_FALSE},
4458 {"",S_FALSE},
4459 {"",S_FALSE},
4460 {"",S_FALSE},
4461 {"",S_FALSE},
4462 {"void",S_OK},
4463 {"void",S_OK},
4464 {"",S_FALSE},
4465 {"javascript:void",S_OK},
4466 {"javascript",S_OK},
4467 {"",S_FALSE},
4468 {"",S_FALSE}
4471 {Uri_HOST_UNKNOWN,S_OK},
4472 {0,S_FALSE},
4473 {URL_SCHEME_JAVASCRIPT,S_OK},
4474 {URLZONE_INVALID,E_NOTIMPL}
4477 { "javascript://undefined", 0, S_OK, FALSE,
4479 {"javascript://undefined",S_OK},
4480 {"",S_FALSE},
4481 {"javascript://undefined",S_OK},
4482 {"",S_FALSE},
4483 {"",S_FALSE},
4484 {"",S_FALSE},
4485 {"",S_FALSE},
4486 {"",S_FALSE},
4487 {"//undefined",S_OK},
4488 {"//undefined",S_OK},
4489 {"",S_FALSE},
4490 {"javascript://undefined",S_OK},
4491 {"javascript",S_OK},
4492 {"",S_FALSE},
4493 {"",S_FALSE}
4496 {Uri_HOST_UNKNOWN,S_OK},
4497 {0,S_FALSE},
4498 {URL_SCHEME_JAVASCRIPT,S_OK},
4499 {URLZONE_INVALID,E_NOTIMPL}
4502 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4504 {"javascript:escape('/\\?#?')",S_OK},
4505 {"",S_FALSE},
4506 {"javascript:escape('/\\?#?')",S_OK},
4507 {"",S_FALSE},
4508 {"",S_FALSE},
4509 {"",S_FALSE},
4510 {"",S_FALSE},
4511 {"",S_FALSE},
4512 {"escape('/\\?#?')",S_OK},
4513 {"escape('/\\?#?')",S_OK},
4514 {"",S_FALSE},
4515 {"JavaSCript:escape('/\\?#?')",S_OK},
4516 {"javascript",S_OK},
4517 {"",S_FALSE},
4518 {"",S_FALSE}
4521 {Uri_HOST_UNKNOWN,S_OK},
4522 {0,S_FALSE},
4523 {URL_SCHEME_JAVASCRIPT,S_OK},
4524 {URLZONE_INVALID,E_NOTIMPL}
4527 { "*://google.com", 0, S_OK, FALSE,
4529 {"*:google.com/",S_OK,FALSE},
4530 {"google.com",S_OK},
4531 {"*:google.com/",S_OK,FALSE},
4532 {"google.com",S_OK,FALSE},
4533 {"",S_FALSE,FALSE},
4534 {"",S_FALSE,FALSE},
4535 {"google.com",S_OK,FALSE},
4536 {"",S_FALSE,FALSE},
4537 {"/",S_OK,FALSE},
4538 {"/",S_OK,FALSE},
4539 {"",S_FALSE,FALSE},
4540 {"*://google.com",S_OK,FALSE},
4541 {"*",S_OK,FALSE},
4542 {"",S_FALSE,FALSE},
4543 {"",S_FALSE,FALSE}
4546 {Uri_HOST_DNS,S_OK,FALSE},
4547 {0,S_FALSE,FALSE},
4548 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4549 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4552 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4554 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4555 {"",S_FALSE},
4556 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4557 {"",S_FALSE},
4558 {".txt",S_OK},
4559 {"",S_FALSE},
4560 {"",S_FALSE},
4561 {"",S_FALSE},
4562 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4563 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4564 {"",S_FALSE},
4565 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4566 {"mk",S_OK},
4567 {"",S_FALSE},
4568 {"",S_FALSE}
4571 {Uri_HOST_UNKNOWN,S_OK},
4572 {0,S_FALSE},
4573 {URL_SCHEME_MK,S_OK},
4574 {URLZONE_INVALID,E_NOTIMPL}
4577 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4579 {"gopher://test.winehq.org:151/file.txt",S_OK},
4580 {"test.winehq.org:151",S_OK},
4581 {"gopher://test.winehq.org:151/file.txt",S_OK},
4582 {"winehq.org",S_OK},
4583 {".txt",S_OK},
4584 {"",S_FALSE},
4585 {"test.winehq.org",S_OK},
4586 {"",S_FALSE},
4587 {"/file.txt",S_OK},
4588 {"/file.txt",S_OK},
4589 {"",S_FALSE},
4590 {"gopher://test.winehq.org:151/file.txt",S_OK},
4591 {"gopher",S_OK},
4592 {"",S_FALSE},
4593 {"",S_FALSE}
4596 {Uri_HOST_DNS,S_OK},
4597 {151,S_OK},
4598 {URL_SCHEME_GOPHER,S_OK},
4599 {URLZONE_INVALID,E_NOTIMPL}
4602 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4604 {"//host.com/path/file.txt?query",S_OK},
4605 {"host.com",S_OK},
4606 {"//host.com/path/file.txt?query",S_OK},
4607 {"host.com",S_OK},
4608 {".txt",S_OK},
4609 {"",S_FALSE},
4610 {"host.com",S_OK},
4611 {"",S_FALSE},
4612 {"/path/file.txt",S_OK},
4613 {"/path/file.txt?query",S_OK},
4614 {"?query",S_OK},
4615 {"//host.com/path/file.txt?query",S_OK},
4616 {"",S_FALSE},
4617 {"",S_FALSE},
4618 {"",S_FALSE},
4621 {Uri_HOST_DNS,S_OK},
4622 {0,S_FALSE},
4623 {URL_SCHEME_UNKNOWN,S_OK},
4624 {URLZONE_INVALID,E_NOTIMPL}
4627 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4629 {"//host/path/file.txt?query",S_OK},
4630 {"host",S_OK},
4631 {"//host/path/file.txt?query",S_OK},
4632 {"",S_FALSE},
4633 {".txt",S_OK},
4634 {"",S_FALSE},
4635 {"host",S_OK},
4636 {"",S_FALSE},
4637 {"/path/file.txt",S_OK},
4638 {"/path/file.txt?query",S_OK},
4639 {"?query",S_OK},
4640 {"//host/path/file.txt?query",S_OK},
4641 {"",S_FALSE},
4642 {"",S_FALSE},
4643 {"",S_FALSE},
4646 {Uri_HOST_DNS,S_OK},
4647 {0,S_FALSE},
4648 {URL_SCHEME_UNKNOWN,S_OK},
4649 {URLZONE_INVALID,E_NOTIMPL}
4652 { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4654 {"//host/",S_OK},
4655 {"host",S_OK},
4656 {"//host/",S_OK},
4657 {"",S_FALSE},
4658 {"",S_FALSE},
4659 {"",S_FALSE},
4660 {"host",S_OK},
4661 {"",S_FALSE},
4662 {"/",S_OK},
4663 {"/",S_OK},
4664 {"",S_FALSE},
4665 {"//host",S_OK},
4666 {"",S_FALSE},
4667 {"",S_FALSE},
4668 {"",S_FALSE},
4671 {Uri_HOST_DNS,S_OK},
4672 {0,S_FALSE},
4673 {URL_SCHEME_UNKNOWN,S_OK},
4674 {URLZONE_INVALID,E_NOTIMPL}
4677 { "mailto://", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4679 {"mailto:",S_OK},
4680 {"",S_FALSE},
4681 {"mailto:",S_OK},
4682 {"",S_FALSE},
4683 {"",S_FALSE},
4684 {"",S_FALSE},
4685 {"",S_FALSE},
4686 {"",S_FALSE},
4687 {"",S_FALSE},
4688 {"",S_FALSE},
4689 {"",S_FALSE},
4690 {"mailto://",S_OK,FALSE,"mailto:"},
4691 {"mailto",S_OK},
4692 {"",S_FALSE},
4693 {"",S_FALSE}
4696 {Uri_HOST_UNKNOWN,S_OK},
4697 {0,S_FALSE},
4698 {URL_SCHEME_MAILTO,S_OK},
4699 {URLZONE_INVALID,E_NOTIMPL}
4702 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4704 {"mailto:a@b.com",S_OK},
4705 {"",S_FALSE},
4706 {"mailto:a@b.com",S_OK},
4707 {"",S_FALSE},
4708 {".com",S_OK},
4709 {"",S_FALSE},
4710 {"",S_FALSE},
4711 {"",S_FALSE},
4712 {"a@b.com",S_OK},
4713 {"a@b.com",S_OK},
4714 {"",S_FALSE},
4715 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
4716 {"mailto",S_OK},
4717 {"",S_FALSE},
4718 {"",S_FALSE}
4721 {Uri_HOST_UNKNOWN,S_OK},
4722 {0,S_FALSE},
4723 {URL_SCHEME_MAILTO,S_OK},
4724 {URLZONE_INVALID,E_NOTIMPL}
4727 { "c:\\test file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4729 {"file://c:\\test file.html",S_OK,FALSE},
4730 {"",S_FALSE,FALSE},
4731 {"file://c:\\test file.html",S_OK,FALSE},
4732 {"",S_FALSE,FALSE},
4733 {".html",S_OK,FALSE},
4734 {"",S_FALSE,FALSE},
4735 {"",S_FALSE,FALSE},
4736 {"",S_FALSE,FALSE},
4737 {"c:\\test file.html",S_OK,FALSE},
4738 {"c:\\test file.html",S_OK,FALSE},
4739 {"",S_FALSE,FALSE},
4740 {"c:\\test file.html",S_OK,FALSE},
4741 {"file",S_OK,FALSE},
4742 {"",S_FALSE,FALSE},
4743 {"",S_FALSE,FALSE}
4746 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4747 {0,S_FALSE,FALSE},
4748 {URL_SCHEME_FILE,S_OK,FALSE},
4749 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4752 { "c:\\test%20file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4754 {"file://c:\\test%20file.html",S_OK,FALSE},
4755 {"",S_FALSE,FALSE},
4756 {"file://c:\\test%20file.html",S_OK,FALSE},
4757 {"",S_FALSE,FALSE},
4758 {".html",S_OK,FALSE},
4759 {"",S_FALSE,FALSE},
4760 {"",S_FALSE,FALSE},
4761 {"",S_FALSE,FALSE},
4762 {"c:\\test%20file.html",S_OK,FALSE},
4763 {"c:\\test%20file.html",S_OK,FALSE},
4764 {"",S_FALSE,FALSE},
4765 {"c:\\test%20file.html",S_OK,FALSE},
4766 {"file",S_OK,FALSE},
4767 {"",S_FALSE,FALSE},
4768 {"",S_FALSE,FALSE}
4771 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4772 {0,S_FALSE,FALSE},
4773 {URL_SCHEME_FILE,S_OK,FALSE},
4774 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4777 { "c:\\test file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4779 {"file:///c:/test%20file.html",S_OK,FALSE},
4780 {"",S_FALSE,FALSE},
4781 {"file:///c:/test%20file.html",S_OK,FALSE},
4782 {"",S_FALSE,FALSE},
4783 {".html",S_OK,FALSE},
4784 {"",S_FALSE,FALSE},
4785 {"",S_FALSE,FALSE},
4786 {"",S_FALSE,FALSE},
4787 {"/c:/test%20file.html",S_OK,FALSE},
4788 {"/c:/test%20file.html",S_OK,FALSE},
4789 {"",S_FALSE,FALSE},
4790 {"c:\\test file.html",S_OK,FALSE},
4791 {"file",S_OK,FALSE},
4792 {"",S_FALSE,FALSE},
4793 {"",S_FALSE,FALSE}
4796 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4797 {0,S_FALSE,FALSE},
4798 {URL_SCHEME_FILE,S_OK,FALSE},
4799 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4802 { "c:\\test%20file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4804 {"file:///c:/test%2520file.html",S_OK,FALSE},
4805 {"",S_FALSE,FALSE},
4806 {"file:///c:/test%2520file.html",S_OK,FALSE},
4807 {"",S_FALSE,FALSE},
4808 {".html",S_OK,FALSE},
4809 {"",S_FALSE,FALSE},
4810 {"",S_FALSE,FALSE},
4811 {"",S_FALSE,FALSE},
4812 {"/c:/test%2520file.html",S_OK,FALSE},
4813 {"/c:/test%2520file.html",S_OK,FALSE},
4814 {"",S_FALSE,FALSE},
4815 {"c:\\test%20file.html",S_OK,FALSE},
4816 {"file",S_OK,FALSE},
4817 {"",S_FALSE,FALSE},
4818 {"",S_FALSE,FALSE}
4821 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4822 {0,S_FALSE,FALSE},
4823 {URL_SCHEME_FILE,S_OK,FALSE},
4824 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4827 /* Path with Unicode characters. Unicode characters should not be encoded */
4828 {/* "http://127.0.0.1/测试/test.txt" with Chinese in UTF-8 encoding */
4829 "http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt", 0, S_OK, FALSE,
4831 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4832 {"127.0.0.1",S_OK,FALSE},
4833 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4834 {"",S_FALSE,FALSE},
4835 {".txt",S_OK,FALSE},
4836 {"",S_FALSE,FALSE},
4837 {"127.0.0.1",S_OK,FALSE},
4838 {"",S_FALSE,FALSE},
4839 {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4840 {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4841 {"",S_FALSE,FALSE},
4842 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK,FALSE},
4843 {"http",S_OK,FALSE},
4844 {"",S_FALSE,FALSE},
4845 {"",S_FALSE,FALSE}
4848 {Uri_HOST_IPV4,S_OK,FALSE},
4849 {80,S_OK,FALSE},
4850 {URL_SCHEME_HTTP,S_OK,FALSE},
4851 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4854 { "file:\xE6\xB5\x8B\xE8\xAF\x95.html", 0, S_OK, FALSE,
4856 {"",S_FALSE,FALSE},
4857 {"",S_FALSE,FALSE},
4858 {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE},
4859 {"",S_FALSE,FALSE},
4860 {".html",S_OK,FALSE},
4861 {"",S_FALSE,FALSE},
4862 {"",S_FALSE,FALSE},
4863 {"",S_FALSE,FALSE},
4864 {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE},
4865 {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE},
4866 {"",S_FALSE,FALSE},
4867 {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK,FALSE},
4868 {"file",S_OK,FALSE},
4869 {"",S_FALSE,FALSE},
4870 {"",S_FALSE,FALSE}
4873 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4874 {0,S_FALSE,FALSE},
4875 {URL_SCHEME_FILE,S_OK,FALSE},
4876 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4879 /* Username with Unicode characters. Unicode characters should not be encoded */
4880 { "ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK, FALSE,
4882 {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4883 {"\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999",S_OK,FALSE},
4884 {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4885 {"winehq.org",S_OK,FALSE},
4886 {".txt",S_OK,FALSE},
4887 {"",S_FALSE,FALSE},
4888 {"ftp.winehq.org",S_OK,FALSE},
4889 {"wine",S_OK,FALSE},
4890 {"/dir/foobar.txt",S_OK,FALSE},
4891 {"/dir/foobar.txt",S_OK,FALSE},
4892 {"",S_FALSE,FALSE},
4893 {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4894 {"ftp",S_OK,FALSE},
4895 {"\xE6\xB5\x8B\xE8\xAF\x95:wine",S_OK,FALSE},
4896 {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE}
4899 {Uri_HOST_DNS,S_OK,FALSE},
4900 {9999,S_OK,FALSE},
4901 {URL_SCHEME_FTP,S_OK,FALSE},
4902 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4905 /* Password with Unicode characters. Unicode characters should not be encoded */
4906 { "ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK, FALSE,
4908 {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4909 {"winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999",S_OK,FALSE},
4910 {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4911 {"winehq.org",S_OK,FALSE},
4912 {".txt",S_OK,FALSE},
4913 {"",S_FALSE,FALSE},
4914 {"ftp.winehq.org",S_OK,FALSE},
4915 {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4916 {"/dir/foobar.txt",S_OK,FALSE},
4917 {"/dir/foobar.txt",S_OK,FALSE},
4918 {"",S_FALSE,FALSE},
4919 {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK,FALSE},
4920 {"ftp",S_OK,FALSE},
4921 {"winepass:\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4922 {"winepass",S_OK,FALSE}
4925 {Uri_HOST_DNS,S_OK,FALSE},
4926 {9999,S_OK,FALSE},
4927 {URL_SCHEME_FTP,S_OK,FALSE},
4928 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4931 /* Query with Unicode characters. Unicode characters should not be encoded */
4932 { "http://www.winehq.org/tests/..?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y", 0, S_OK, FALSE,
4934 {"http://www.winehq.org/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4935 {"www.winehq.org",S_OK,FALSE},
4936 {"http://www.winehq.org/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4937 {"winehq.org",S_OK,FALSE},
4938 {"",S_FALSE,FALSE},
4939 {"",S_FALSE,FALSE},
4940 {"www.winehq.org",S_OK,FALSE},
4941 {"",S_FALSE,FALSE},
4942 {"/",S_OK,FALSE},
4943 {"/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4944 {"?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4945 {"http://www.winehq.org/tests/..?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK,FALSE},
4946 {"http",S_OK,FALSE},
4947 {"",S_FALSE,FALSE},
4948 {"",S_FALSE,FALSE}
4951 {Uri_HOST_DNS,S_OK,FALSE},
4952 {80,S_OK,FALSE},
4953 {URL_SCHEME_HTTP,S_OK,FALSE},
4954 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4957 /* Fragment with Unicode characters. Unicode characters should not be encoded */
4958 { "http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95", 0, S_OK, FALSE,
4960 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4961 {"www.winehq.org",S_OK,FALSE},
4962 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4963 {"winehq.org",S_OK,FALSE},
4964 {"",S_FALSE,FALSE},
4965 {"#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4966 {"www.winehq.org",S_OK,FALSE},
4967 {"",S_FALSE,FALSE},
4968 {"/tests/",S_OK,FALSE},
4969 {"/tests/",S_OK,FALSE},
4970 {"",S_FALSE,FALSE},
4971 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK,FALSE},
4972 {"http",S_OK,FALSE},
4973 {"",S_FALSE,FALSE},
4974 {"",S_FALSE,FALSE}
4977 {Uri_HOST_DNS,S_OK,FALSE},
4978 {80,S_OK,FALSE},
4979 {URL_SCHEME_HTTP,S_OK,FALSE},
4980 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4983 /* ZERO WIDTH JOINER as non-printing Unicode characters should not be encoded if not preprocessed. */
4984 { "file:a\xE2\x80\x8D.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
4986 {"",S_FALSE,FALSE},
4987 {"",S_FALSE,FALSE},
4988 {"file:a\xE2\x80\x8D.html",S_OK,FALSE},
4989 {"",S_FALSE,FALSE},
4990 {".html",S_OK,FALSE},
4991 {"",S_FALSE,FALSE},
4992 {"",S_FALSE,FALSE},
4993 {"",S_FALSE,FALSE},
4994 {"a\xE2\x80\x8D.html",S_OK,FALSE},
4995 {"a\xE2\x80\x8D.html",S_OK,FALSE},
4996 {"",S_FALSE,FALSE},
4997 {"file:a\xE2\x80\x8D.html",S_OK,FALSE},
4998 {"file",S_OK,FALSE},
4999 {"",S_FALSE,FALSE},
5000 {"",S_FALSE,FALSE}
5003 {Uri_HOST_UNKNOWN,S_OK,FALSE},
5004 {0,S_FALSE,FALSE},
5005 {URL_SCHEME_FILE,S_OK,FALSE},
5006 {URLZONE_INVALID,E_NOTIMPL,FALSE}
5009 /* LEFT-TO-RIGHT MARK as non-printing Unicode characters should not be encoded if not preprocessed. */
5010 { "file:ab\xE2\x80\x8E.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
5012 {"",S_FALSE,FALSE},
5013 {"",S_FALSE,FALSE},
5014 {"file:ab\xE2\x80\x8D.html",S_OK,FALSE},
5015 {"",S_FALSE,FALSE},
5016 {".html",S_OK,FALSE},
5017 {"",S_FALSE,FALSE},
5018 {"",S_FALSE,FALSE},
5019 {"",S_FALSE,FALSE},
5020 {"ab\xE2\x80\x8D.html",S_OK,FALSE},
5021 {"ab\xE2\x80\x8D.html",S_OK,FALSE},
5022 {"",S_FALSE,FALSE},
5023 {"file:ab\xE2\x80\x8D.html",S_OK,FALSE},
5024 {"file",S_OK,FALSE},
5025 {"",S_FALSE,FALSE},
5026 {"",S_FALSE,FALSE}
5029 {Uri_HOST_UNKNOWN,S_OK,FALSE},
5030 {0,S_FALSE,FALSE},
5031 {URL_SCHEME_FILE,S_OK,FALSE},
5032 {URLZONE_INVALID,E_NOTIMPL,FALSE}
5035 /* Invalid Unicode characters should not be filtered */
5036 { "file:ab\xc3\x28.html", 0, S_OK, FALSE,
5038 {"",S_FALSE,FALSE},
5039 {"",S_FALSE,FALSE},
5040 {"file:ab\xc3\x28.html",S_OK,FALSE},
5041 {"",S_FALSE,FALSE},
5042 {".html",S_OK,FALSE},
5043 {"",S_FALSE,FALSE},
5044 {"",S_FALSE,FALSE},
5045 {"",S_FALSE,FALSE},
5046 {"ab\xc3\x28.html",S_OK,FALSE},
5047 {"ab\xc3\x28.html",S_OK,FALSE},
5048 {"",S_FALSE,FALSE},
5049 {"file:ab\xc3\x28.html",S_OK,FALSE},
5050 {"file",S_OK,FALSE},
5051 {"",S_FALSE,FALSE},
5052 {"",S_FALSE,FALSE}
5055 {Uri_HOST_UNKNOWN,S_OK,FALSE},
5056 {0,S_FALSE,FALSE},
5057 {URL_SCHEME_FILE,S_OK,FALSE},
5058 {URLZONE_INVALID,E_NOTIMPL,FALSE}
5061 /* Make sure % encoded unicode characters are not decoded. */
5062 { "ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/", 0, S_OK, FALSE,
5064 {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK,FALSE},
5065 {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com",S_OK,FALSE},
5066 {"ftp://ftp.google.com/",S_OK,FALSE},
5067 {"google.com",S_OK,FALSE},
5068 {"",S_FALSE,FALSE},
5069 {"",S_FALSE,FALSE},
5070 {"ftp.google.com",S_OK,FALSE},
5071 {"%E6%B5%8B%E8%AF%95",S_OK,FALSE},
5072 {"/",S_OK,FALSE},
5073 {"/",S_OK,FALSE},
5074 {"",S_FALSE,FALSE},
5075 {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK,FALSE},
5076 {"ftp",S_OK,FALSE},
5077 {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95",S_OK,FALSE},
5078 {"%E6%B5%8B%E8%AF%95",S_OK,FALSE}
5081 {Uri_HOST_DNS,S_OK,FALSE},
5082 {21,S_OK,FALSE},
5083 {URL_SCHEME_FTP,S_OK,FALSE},
5084 {URLZONE_INVALID,E_NOTIMPL,FALSE}
5089 typedef struct _invalid_uri {
5090 const char* uri;
5091 DWORD flags;
5092 BOOL todo;
5093 } invalid_uri;
5095 static const invalid_uri invalid_uri_tests[] = {
5096 /* Has to have a scheme name. */
5097 {"://www.winehq.org",0,FALSE},
5098 /* Windows doesn't like URIs which are implicitly file paths without the
5099 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
5101 {"C:/test/test.mp3",0,FALSE},
5102 {"\\\\Server/test/test.mp3",0,FALSE},
5103 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
5104 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
5105 /* Invalid schemes. */
5106 {"*abcd://not.valid.com",0,FALSE},
5107 {"*a*b*c*d://not.valid.com",0,FALSE},
5108 /* Not allowed to have invalid % encoded data. */
5109 {"ftp://google.co%XX/",0,FALSE},
5110 /* Too many h16 components. */
5111 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
5112 /* Not enough room for IPv4 address. */
5113 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
5114 /* Not enough h16 components. */
5115 {"http://[1:2:3:4]",0,FALSE},
5116 /* Not enough components including IPv4. */
5117 {"http://[1:192.0.1.0]",0,FALSE},
5118 /* Not allowed to have partial IPv4 in IPv6. */
5119 {"http://[::192.0]",0,FALSE},
5120 /* Expects a valid IP Literal. */
5121 {"ftp://[not.valid.uri]/",0,FALSE},
5122 /* Expects valid port for a known scheme type. */
5123 {"ftp://www.winehq.org:123fgh",0,FALSE},
5124 /* Port exceeds USHORT_MAX for known scheme type. */
5125 {"ftp://www.winehq.org:65536",0,FALSE},
5126 /* Invalid port with IPv4 address. */
5127 {"http://www.winehq.org:1abcd",0,FALSE},
5128 /* Invalid port with IPv6 address. */
5129 {"http://[::ffff]:32xy",0,FALSE},
5130 /* Not allowed to have backslashes with NO_CANONICALIZE. */
5131 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
5132 /* Not allowed to have invalid % encoded data in opaque URI path. */
5133 {"news:test%XX",0,FALSE},
5134 {"mailto:wine@winehq%G8.com",0,FALSE},
5135 /* Known scheme types can't have invalid % encoded data in query string. */
5136 {"http://google.com/?query=te%xx",0,FALSE},
5137 /* Invalid % encoded data in fragment of know scheme type. */
5138 {"ftp://google.com/#Test%xx",0,FALSE},
5139 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
5140 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
5141 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
5142 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
5143 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,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 /* res URIs aren't allowed to have forbidden dos path characters in the
5148 * hostname.
5150 {"res://c:\\te<st\\test/test",0,FALSE},
5151 {"res://c:\\te>st\\test/test",0,FALSE},
5152 {"res://c:\\te\"st\\test/test",0,FALSE},
5153 {"res://c:\\test/te%xxst",0,FALSE}
5156 typedef struct _uri_equality {
5157 const char* a;
5158 DWORD create_flags_a;
5159 const char* b;
5160 DWORD create_flags_b;
5161 BOOL equal;
5162 BOOL todo;
5163 } uri_equality;
5165 static const uri_equality equality_tests[] = {
5167 "HTTP://www.winehq.org/test dir/./",0,
5168 "http://www.winehq.org/test dir/../test dir/",0,
5169 TRUE
5172 /* http://www.winehq.org/test%20dir */
5173 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
5174 "http://www.winehq.org/test dir",0,
5175 TRUE
5178 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
5179 "file:///c:/test.mp3",0,
5180 TRUE
5183 "ftp://ftp.winehq.org/",0,
5184 "ftp://ftp.winehq.org",0,
5185 TRUE
5188 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
5189 "ftp://ftp.winehq.org/t%45stB/",0,
5190 FALSE
5193 "http://google.com/TEST",0,
5194 "http://google.com/test",0,
5195 FALSE
5198 "http://GOOGLE.com/",0,
5199 "http://google.com/",0,
5200 TRUE
5202 /* Performs case insensitive compare of host names (for known scheme types). */
5204 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
5205 "ftp://google.com/",0,
5206 TRUE
5209 "zip://GOOGLE.com/",0,
5210 "zip://google.com/",0,
5211 FALSE
5214 "file:///c:/TEST/TeST/",0,
5215 "file:///c:/test/test/",0,
5216 TRUE
5219 "file:///server/TEST",0,
5220 "file:///SERVER/TEST",0,
5221 TRUE
5224 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
5225 "http://google.com/",0,
5226 TRUE
5229 "ftp://google.com:21/",0,
5230 "ftp://google.com/",0,
5231 TRUE
5234 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
5235 "http://google.com/",0,
5236 TRUE
5239 "http://google.com:70/",0,
5240 "http://google.com:71/",0,
5241 FALSE
5244 "file:///c:/dir/file.txt", 0,
5245 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
5246 TRUE
5249 "file:///c:/dir/file.txt", 0,
5250 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
5251 TRUE
5254 "file:///c:/dir/file.txt", 0,
5255 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
5256 TRUE
5259 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
5260 "file:///c:/%20dir/file.txt", 0,
5261 TRUE
5264 "file:///c:/Dir/file.txt", 0,
5265 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
5266 TRUE
5269 "file:///c:/dir/file.txt", 0,
5270 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
5271 TRUE
5274 "file:///c:/dir/file.txt#a", 0,
5275 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
5276 FALSE
5278 /* Tests of an empty hash/fragment part */
5280 "http://google.com/test",0,
5281 "http://google.com/test#",0,
5282 FALSE
5285 "ftp://ftp.winehq.org/",0,
5286 "ftp://ftp.winehq.org/#",0,
5287 FALSE
5290 "file:///c:/dir/file.txt#", 0,
5291 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
5292 FALSE
5296 typedef struct _uri_with_fragment {
5297 const char* uri;
5298 const char* fragment;
5299 DWORD create_flags;
5300 HRESULT create_expected;
5301 BOOL create_todo;
5303 const char* expected_uri;
5304 BOOL expected_todo;
5305 } uri_with_fragment;
5307 static const uri_with_fragment uri_fragment_tests[] = {
5309 "http://google.com/","#fragment",0,S_OK,FALSE,
5310 "http://google.com/#fragment",FALSE
5313 "http://google.com/","fragment",0,S_OK,FALSE,
5314 "http://google.com/#fragment",FALSE
5317 "zip://test.com/","?test",0,S_OK,FALSE,
5318 "zip://test.com/#?test",FALSE
5320 /* The fragment can be empty. */
5322 "ftp://ftp.google.com/","",0,S_OK,FALSE,
5323 "ftp://ftp.google.com/#",FALSE
5327 typedef struct _uri_builder_property {
5328 BOOL change;
5329 const char *value;
5330 const char *expected_value;
5331 Uri_PROPERTY property;
5332 HRESULT expected;
5333 BOOL todo;
5334 } uri_builder_property;
5336 typedef struct _uri_builder_port {
5337 BOOL change;
5338 BOOL set;
5339 DWORD value;
5340 HRESULT expected;
5341 BOOL todo;
5342 } uri_builder_port;
5344 typedef struct _uri_builder_str_property {
5345 const char* expected;
5346 HRESULT result;
5347 BOOL todo;
5348 } uri_builder_str_property;
5350 typedef struct _uri_builder_dword_property {
5351 DWORD expected;
5352 HRESULT result;
5353 BOOL todo;
5354 } uri_builder_dword_property;
5356 typedef struct _uri_builder_test {
5357 const char *uri;
5358 DWORD create_flags;
5359 HRESULT create_builder_expected;
5360 BOOL create_builder_todo;
5362 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
5364 uri_builder_port port_prop;
5366 DWORD uri_flags;
5367 HRESULT uri_hres;
5368 BOOL uri_todo;
5370 DWORD uri_simple_encode_flags;
5371 HRESULT uri_simple_hres;
5372 BOOL uri_simple_todo;
5374 DWORD uri_with_flags;
5375 DWORD uri_with_builder_flags;
5376 DWORD uri_with_encode_flags;
5377 HRESULT uri_with_hres;
5378 BOOL uri_with_todo;
5380 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
5381 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
5382 } uri_builder_test;
5384 static const uri_builder_test uri_builder_tests[] = {
5385 { "http://google.com/",0,S_OK,FALSE,
5387 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5388 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
5389 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
5390 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5392 {FALSE},
5393 0,S_OK,FALSE,
5394 0,S_OK,FALSE,
5395 0,0,0,S_OK,FALSE,
5397 {"http://username:password@google.com/?query=x#fragment",S_OK},
5398 {"username:password@google.com",S_OK},
5399 {"http://google.com/?query=x#fragment",S_OK},
5400 {"google.com",S_OK},
5401 {"",S_FALSE},
5402 {"#fragment",S_OK},
5403 {"google.com",S_OK},
5404 {"password",S_OK},
5405 {"/",S_OK},
5406 {"/?query=x",S_OK},
5407 {"?query=x",S_OK},
5408 {"http://username:password@google.com/?query=x#fragment",S_OK},
5409 {"http",S_OK},
5410 {"username:password",S_OK},
5411 {"username",S_OK}
5414 {Uri_HOST_DNS,S_OK},
5415 {80,S_OK},
5416 {URL_SCHEME_HTTP,S_OK},
5417 {URLZONE_INVALID,E_NOTIMPL}
5420 { "http://google.com/",0,S_OK,FALSE,
5422 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5424 {TRUE,TRUE,120,S_OK,FALSE},
5425 0,S_OK,FALSE,
5426 0,S_OK,FALSE,
5427 0,0,0,S_OK,FALSE,
5429 {"test://google.com:120/",S_OK},
5430 {"google.com:120",S_OK},
5431 {"test://google.com:120/",S_OK},
5432 {"google.com",S_OK},
5433 {"",S_FALSE},
5434 {"",S_FALSE},
5435 {"google.com",S_OK},
5436 {"",S_FALSE},
5437 {"/",S_OK},
5438 {"/",S_OK},
5439 {"",S_FALSE},
5440 {"test://google.com:120/",S_OK},
5441 {"test",S_OK},
5442 {"",S_FALSE},
5443 {"",S_FALSE}
5446 {Uri_HOST_DNS,S_OK},
5447 {120,S_OK},
5448 {URL_SCHEME_UNKNOWN,S_OK},
5449 {URLZONE_INVALID,E_NOTIMPL}
5452 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5454 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5455 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5456 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5458 {FALSE},
5459 0,S_OK,FALSE,
5460 0,S_OK,FALSE,
5461 0,0,0,S_OK,FALSE,
5463 {"http://[::192.2.3.4]/",S_OK},
5464 {"[::192.2.3.4]",S_OK},
5465 {"http://[::192.2.3.4]/",S_OK},
5466 {"",S_FALSE},
5467 {"",S_FALSE},
5468 {"",S_FALSE},
5469 {"::192.2.3.4",S_OK},
5470 {"",S_FALSE},
5471 {"/",S_OK},
5472 {"/",S_OK},
5473 {"",S_FALSE},
5474 {"http://[::192.2.3.4]/",S_OK},
5475 {"http",S_OK},
5476 {"",S_FALSE},
5477 {"",S_FALSE}
5480 {Uri_HOST_IPV6,S_OK},
5481 {80,S_OK},
5482 {URL_SCHEME_HTTP,S_OK},
5483 {URLZONE_INVALID,E_NOTIMPL}
5486 { "http://google.com/",0,S_OK,FALSE,
5488 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5490 {FALSE},
5491 0,S_OK,FALSE,
5492 0,S_OK,FALSE,
5493 0,0,0,S_OK,FALSE,
5495 {"http://google.com/#Frag",S_OK},
5496 {"google.com",S_OK},
5497 {"http://google.com/#Frag",S_OK},
5498 {"google.com",S_OK},
5499 {"",S_FALSE},
5500 {"#Frag",S_OK},
5501 {"google.com",S_OK},
5502 {"",S_FALSE},
5503 {"/",S_OK},
5504 {"/",S_OK},
5505 {"",S_FALSE},
5506 {"http://google.com/#Frag",S_OK},
5507 {"http",S_OK},
5508 {"",S_FALSE},
5509 {"",S_FALSE}
5512 {Uri_HOST_DNS,S_OK},
5513 {80,S_OK},
5514 {URL_SCHEME_HTTP,S_OK},
5515 {URLZONE_INVALID,E_NOTIMPL}
5518 { "http://google.com/",0,S_OK,FALSE,
5520 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5522 {FALSE},
5523 0,S_OK,FALSE,
5524 0,S_OK,FALSE,
5525 0,0,0,S_OK,FALSE,
5527 {"http://google.com/#",S_OK},
5528 {"google.com",S_OK},
5529 {"http://google.com/#",S_OK},
5530 {"google.com",S_OK},
5531 {"",S_FALSE},
5532 {"#",S_OK},
5533 {"google.com",S_OK},
5534 {"",S_FALSE},
5535 {"/",S_OK},
5536 {"/",S_OK},
5537 {"",S_FALSE},
5538 {"http://google.com/#",S_OK},
5539 {"http",S_OK},
5540 {"",S_FALSE},
5541 {"",S_FALSE}
5544 {Uri_HOST_DNS,S_OK},
5545 {80,S_OK},
5546 {URL_SCHEME_HTTP,S_OK},
5547 {URLZONE_INVALID,E_NOTIMPL}
5550 { "http://google.com/",0,S_OK,FALSE,
5552 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5554 {FALSE},
5555 0,S_OK,FALSE,
5556 0,S_OK,FALSE,
5557 0,0,0,S_OK,FALSE,
5559 {"http://::password@google.com/",S_OK},
5560 {"::password@google.com",S_OK},
5561 {"http://google.com/",S_OK},
5562 {"google.com",S_OK},
5563 {"",S_FALSE},
5564 {"",S_FALSE},
5565 {"google.com",S_OK},
5566 {":password",S_OK},
5567 {"/",S_OK},
5568 {"/",S_OK},
5569 {"",S_FALSE},
5570 {"http://::password@google.com/",S_OK},
5571 {"http",S_OK},
5572 {"::password",S_OK},
5573 {"",S_FALSE}
5576 {Uri_HOST_DNS,S_OK},
5577 {80,S_OK},
5578 {URL_SCHEME_HTTP,S_OK},
5579 {URLZONE_INVALID,E_NOTIMPL}
5582 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5584 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5586 {FALSE},
5587 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5588 0,S_OK,FALSE,
5589 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5591 {":password@test/test",S_OK},
5592 {":password@",S_OK},
5593 {":password@test/test",S_OK},
5594 {"",S_FALSE},
5595 {"",S_FALSE},
5596 {"",S_FALSE},
5597 {"",S_FALSE},
5598 {"password",S_OK},
5599 {"test/test",S_OK},
5600 {"test/test",S_OK},
5601 {"",S_FALSE},
5602 {":password@test/test",S_OK},
5603 {"",S_FALSE},
5604 {":password",S_OK},
5605 {"",S_FALSE}
5608 {Uri_HOST_UNKNOWN,S_OK},
5609 {0,S_FALSE},
5610 {URL_SCHEME_UNKNOWN,S_OK},
5611 {URLZONE_INVALID,E_NOTIMPL}
5614 { "http://google.com/",0,S_OK,FALSE,
5616 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5618 {FALSE},
5619 0,S_OK,FALSE,
5620 0,S_OK,FALSE,
5621 0,0,0,S_OK,FALSE,
5623 {"http://google.com/test/test",S_OK},
5624 {"google.com",S_OK},
5625 {"http://google.com/test/test",S_OK},
5626 {"google.com",S_OK},
5627 {"",S_FALSE},
5628 {"",S_FALSE},
5629 {"google.com",S_OK},
5630 {"",S_FALSE},
5631 {"/test/test",S_OK},
5632 {"/test/test",S_OK},
5633 {"",S_FALSE},
5634 {"http://google.com/test/test",S_OK},
5635 {"http",S_OK},
5636 {"",S_FALSE},
5637 {"",S_FALSE}
5640 {Uri_HOST_DNS,S_OK},
5641 {80,S_OK},
5642 {URL_SCHEME_HTTP,S_OK},
5643 {URLZONE_INVALID,E_NOTIMPL}
5646 { "zip:testing/test",0,S_OK,FALSE,
5648 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5650 {FALSE},
5651 0,S_OK,FALSE,
5652 0,S_OK,FALSE,
5653 0,0,0,S_OK,FALSE,
5655 {"zip:test",S_OK},
5656 {"",S_FALSE},
5657 {"zip:test",S_OK},
5658 {"",S_FALSE},
5659 {"",S_FALSE},
5660 {"",S_FALSE},
5661 {"",S_FALSE},
5662 {"",S_FALSE},
5663 {"test",S_OK},
5664 {"test",S_OK},
5665 {"",S_FALSE},
5666 {"zip:test",S_OK},
5667 {"zip",S_OK},
5668 {"",S_FALSE},
5669 {"",S_FALSE}
5672 {Uri_HOST_UNKNOWN,S_OK},
5673 {0,S_FALSE},
5674 {URL_SCHEME_UNKNOWN,S_OK},
5675 {URLZONE_INVALID,E_NOTIMPL}
5678 { "http://google.com/",0,S_OK,FALSE,
5680 {FALSE},
5682 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5683 {TRUE,FALSE,555,S_OK,FALSE},
5684 0,S_OK,FALSE,
5685 0,S_OK,FALSE,
5686 0,0,0,S_OK,FALSE,
5688 {"http://google.com/",S_OK},
5689 {"google.com",S_OK},
5690 {"http://google.com/",S_OK},
5691 {"google.com",S_OK},
5692 {"",S_FALSE},
5693 {"",S_FALSE},
5694 {"google.com",S_OK},
5695 {"",S_FALSE},
5696 {"/",S_OK},
5697 {"/",S_OK},
5698 {"",S_FALSE},
5699 {"http://google.com/",S_OK},
5700 {"http",S_OK},
5701 {"",S_FALSE},
5702 {"",S_FALSE}
5705 {Uri_HOST_DNS,S_OK},
5706 /* Still returns 80, even though earlier the port was disabled. */
5707 {80,S_OK},
5708 {URL_SCHEME_HTTP,S_OK},
5709 {URLZONE_INVALID,E_NOTIMPL}
5712 { "http://google.com/",0,S_OK,FALSE,
5714 {FALSE},
5716 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5717 * you'll get 122345 instead.
5719 {TRUE,122345,222,S_OK,FALSE},
5720 0,S_OK,FALSE,
5721 0,S_OK,FALSE,
5722 0,0,0,S_OK,FALSE,
5724 {"http://google.com:222/",S_OK},
5725 {"google.com:222",S_OK},
5726 {"http://google.com:222/",S_OK},
5727 {"google.com",S_OK},
5728 {"",S_FALSE},
5729 {"",S_FALSE},
5730 {"google.com",S_OK},
5731 {"",S_FALSE},
5732 {"/",S_OK},
5733 {"/",S_OK},
5734 {"",S_FALSE},
5735 {"http://google.com:222/",S_OK},
5736 {"http",S_OK},
5737 {"",S_FALSE},
5738 {"",S_FALSE}
5741 {Uri_HOST_DNS,S_OK},
5742 {222,S_OK},
5743 {URL_SCHEME_HTTP,S_OK},
5744 {URLZONE_INVALID,E_NOTIMPL}
5747 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5748 { "http://google.com/",0,S_OK,FALSE,
5750 {FALSE},
5752 {TRUE,TRUE,999999,S_OK,FALSE},
5753 0,S_OK,FALSE,
5754 0,S_OK,FALSE,
5755 0,0,0,S_OK,FALSE,
5757 {"http://google.com:999999/",S_OK},
5758 {"google.com:999999",S_OK},
5759 {"http://google.com:999999/",S_OK},
5760 {"google.com",S_OK},
5761 {"",S_FALSE},
5762 {"",S_FALSE},
5763 {"google.com",S_OK},
5764 {"",S_FALSE},
5765 {"/",S_OK},
5766 {"/",S_OK},
5767 {"",S_FALSE},
5768 {"http://google.com:999999/",S_OK},
5769 {"http",S_OK},
5770 {"",S_FALSE},
5771 {"",S_FALSE}
5774 {Uri_HOST_DNS,S_OK},
5775 {999999,S_OK},
5776 {URL_SCHEME_HTTP,S_OK},
5777 {URLZONE_INVALID,E_NOTIMPL}
5780 { "http://google.com/",0,S_OK,FALSE,
5782 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5785 {FALSE},
5786 0,S_OK,FALSE,
5787 0,S_OK,FALSE,
5788 0,0,0,S_OK,FALSE,
5790 {"http://google.com/?test",S_OK},
5791 {"google.com",S_OK},
5792 {"http://google.com/?test",S_OK},
5793 {"google.com",S_OK},
5794 {"",S_FALSE},
5795 {"",S_FALSE},
5796 {"google.com",S_OK},
5797 {"",S_FALSE},
5798 {"/",S_OK},
5799 {"/?test",S_OK},
5800 {"?test",S_OK},
5801 {"http://google.com/?test",S_OK},
5802 {"http",S_OK},
5803 {"",S_FALSE},
5804 {"",S_FALSE}
5807 {Uri_HOST_DNS,S_OK},
5808 {80,S_OK},
5809 {URL_SCHEME_HTTP,S_OK},
5810 {URLZONE_INVALID,E_NOTIMPL}
5813 { "http://:password@google.com/",0,S_OK,FALSE,
5815 {FALSE},
5817 {FALSE},
5818 0,S_OK,FALSE,
5819 0,S_OK,FALSE,
5820 0,0,0,S_OK,FALSE,
5822 {"http://:password@google.com/",S_OK},
5823 {":password@google.com",S_OK},
5824 {"http://google.com/",S_OK},
5825 {"google.com",S_OK},
5826 {"",S_FALSE},
5827 {"",S_FALSE},
5828 {"google.com",S_OK},
5829 {"password",S_OK},
5830 {"/",S_OK},
5831 {"/",S_OK},
5832 {"",S_FALSE},
5833 {"http://:password@google.com/",S_OK},
5834 {"http",S_OK},
5835 {":password",S_OK},
5836 {"",S_FALSE}
5839 {Uri_HOST_DNS,S_OK},
5840 {80,S_OK},
5841 {URL_SCHEME_HTTP,S_OK},
5842 {URLZONE_INVALID,E_NOTIMPL}
5845 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5846 { NULL,0,S_OK,FALSE,
5848 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5849 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5851 {FALSE},
5852 0,S_OK,FALSE,
5853 0,S_OK,FALSE,
5854 0,0,0,S_OK,FALSE,
5856 {"http://google.com/",S_OK},
5857 {"google.com",S_OK},
5858 {"http://google.com/",S_OK},
5859 {"google.com",S_OK},
5860 {"",S_FALSE},
5861 {"",S_FALSE},
5862 {"google.com",S_OK},
5863 {"",S_FALSE},
5864 {"/",S_OK},
5865 {"/",S_OK},
5866 {"",S_FALSE},
5867 {"http://google.com/",S_OK},
5868 {"http",S_OK},
5869 {"",S_FALSE},
5870 {"",S_FALSE}
5873 {Uri_HOST_DNS,S_OK},
5874 {80,S_OK},
5875 {URL_SCHEME_HTTP,S_OK},
5876 {URLZONE_INVALID,E_NOTIMPL}
5879 /* Can't set the scheme name to NULL. */
5880 { "zip://google.com/",0,S_OK,FALSE,
5882 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5884 {FALSE},
5885 0,S_OK,FALSE,
5886 0,S_OK,FALSE,
5887 0,0,0,S_OK,FALSE,
5889 {"zip://google.com/",S_OK},
5890 {"google.com",S_OK},
5891 {"zip://google.com/",S_OK},
5892 {"google.com",S_OK},
5893 {"",S_FALSE},
5894 {"",S_FALSE},
5895 {"google.com",S_OK},
5896 {"",S_FALSE},
5897 {"/",S_OK},
5898 {"/",S_OK},
5899 {"",S_FALSE},
5900 {"zip://google.com/",S_OK},
5901 {"zip",S_OK},
5902 {"",S_FALSE},
5903 {"",S_FALSE}
5906 {Uri_HOST_DNS,S_OK},
5907 {0,S_FALSE},
5908 {URL_SCHEME_UNKNOWN,S_OK},
5909 {URLZONE_INVALID,E_NOTIMPL}
5912 /* Can't set the scheme name to an empty string. */
5913 { "zip://google.com/",0,S_OK,FALSE,
5915 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5917 {FALSE},
5918 0,S_OK,FALSE,
5919 0,S_OK,FALSE,
5920 0,0,0,S_OK,FALSE,
5922 {"zip://google.com/",S_OK},
5923 {"google.com",S_OK},
5924 {"zip://google.com/",S_OK},
5925 {"google.com",S_OK},
5926 {"",S_FALSE},
5927 {"",S_FALSE},
5928 {"google.com",S_OK},
5929 {"",S_FALSE},
5930 {"/",S_OK},
5931 {"/",S_OK},
5932 {"",S_FALSE},
5933 {"zip://google.com/",S_OK},
5934 {"zip",S_OK},
5935 {"",S_FALSE},
5936 {"",S_FALSE}
5939 {Uri_HOST_DNS,S_OK},
5940 {0,S_FALSE},
5941 {URL_SCHEME_UNKNOWN,S_OK},
5942 {URLZONE_INVALID,E_NOTIMPL}
5945 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5946 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5948 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5949 {{FALSE}},
5950 {FALSE},
5951 -1,S_OK,FALSE,
5952 0,S_OK,FALSE,
5953 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5955 {"http://google.com/../../",S_OK},
5956 {"google.com",S_OK},
5957 {"http://google.com/../../",S_OK},
5958 {"google.com",S_OK},
5959 {"",S_FALSE},
5960 {"",S_FALSE},
5961 {"google.com",S_OK},
5962 {"",S_FALSE},
5963 {"/../../",S_OK},
5964 {"/../../",S_OK},
5965 {"",S_FALSE},
5966 {"http://google.com/../../",S_OK},
5967 {"http",S_OK},
5968 {"",S_FALSE},
5969 {"",S_FALSE}
5972 {Uri_HOST_DNS,S_OK},
5973 {80,S_OK},
5974 {URL_SCHEME_HTTP,S_OK},
5975 {URLZONE_INVALID,E_NOTIMPL}
5978 { "http://google.com/",0,S_OK,FALSE,
5980 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5982 {FALSE},
5983 -1,S_OK,FALSE,
5984 0,S_OK,FALSE,
5985 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5987 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5988 {"google.com",S_OK},
5989 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5990 {"google.com",S_OK},
5991 {"",S_FALSE},
5992 {"#Fr%3C%7C%3Eg",S_OK},
5993 {"google.com",S_OK},
5994 {"",S_FALSE},
5995 {"/",S_OK},
5996 {"/",S_OK},
5997 {"",S_FALSE},
5998 {"http://google.com/#Fr<|>g",S_OK},
5999 {"http",S_OK},
6000 {"",S_FALSE},
6001 {"",S_FALSE}
6004 {Uri_HOST_DNS,S_OK},
6005 {80,S_OK},
6006 {URL_SCHEME_HTTP,S_OK},
6007 {URLZONE_INVALID,E_NOTIMPL}
6010 { "http://google.com/",0,S_OK,FALSE,
6012 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
6014 {FALSE},
6015 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
6016 0,S_OK,FALSE,
6017 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
6019 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
6020 {"google.com",S_OK},
6021 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
6022 {"google.com",S_OK},
6023 {"",S_FALSE},
6024 {"#Fr%3C%7C%3Eg",S_OK},
6025 {"google.com",S_OK},
6026 {"",S_FALSE},
6027 {"/",S_OK},
6028 {"/",S_OK},
6029 {"",S_FALSE},
6030 {"http://google.com/#Fr<|>g",S_OK},
6031 {"http",S_OK},
6032 {"",S_FALSE},
6033 {"",S_FALSE}
6036 {Uri_HOST_DNS,S_OK},
6037 {80,S_OK},
6038 {URL_SCHEME_HTTP,S_OK},
6039 {URLZONE_INVALID,E_NOTIMPL}
6042 { NULL,0,S_OK,FALSE,
6044 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
6045 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
6047 {FALSE},
6048 0,INET_E_INVALID_URL,FALSE,
6049 0,INET_E_INVALID_URL,FALSE,
6050 0,0,0,INET_E_INVALID_URL,FALSE
6052 { "http://google.com/",0,S_OK,FALSE,
6054 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
6056 {FALSE},
6057 0,INET_E_INVALID_URL,FALSE,
6058 0,INET_E_INVALID_URL,FALSE,
6059 0,0,0,INET_E_INVALID_URL,FALSE
6061 /* File scheme's can't have a username set. */
6062 { "file://google.com/",0,S_OK,FALSE,
6064 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6066 {FALSE},
6067 0,INET_E_INVALID_URL,FALSE,
6068 0,INET_E_INVALID_URL,FALSE,
6069 0,0,0,INET_E_INVALID_URL,FALSE
6071 /* File schemes can't have a password set. */
6072 { "file://google.com/",0,S_OK,FALSE,
6074 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6076 {FALSE},
6077 0,INET_E_INVALID_URL,FALSE,
6078 0,INET_E_INVALID_URL,FALSE,
6079 0,0,0,INET_E_INVALID_URL,FALSE
6081 /* UserName can't contain any character that is a delimiter for another
6082 * component that appears after it in a normal URI.
6084 { "http://google.com/",0,S_OK,FALSE,
6086 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6088 {FALSE},
6089 0,INET_E_INVALID_URL,FALSE,
6090 0,INET_E_INVALID_URL,FALSE,
6091 0,0,0,INET_E_INVALID_URL,FALSE
6093 { "http://google.com/",0,S_OK,FALSE,
6095 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6097 {FALSE},
6098 0,INET_E_INVALID_URL,FALSE,
6099 0,INET_E_INVALID_URL,FALSE,
6100 0,0,0,INET_E_INVALID_URL,FALSE
6102 { "http://google.com/",0,S_OK,FALSE,
6104 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6106 {FALSE},
6107 0,INET_E_INVALID_URL,FALSE,
6108 0,INET_E_INVALID_URL,FALSE,
6109 0,0,0,INET_E_INVALID_URL,FALSE
6111 { "http://google.com/",0,S_OK,FALSE,
6113 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6115 {FALSE},
6116 0,INET_E_INVALID_URL,FALSE,
6117 0,INET_E_INVALID_URL,FALSE,
6118 0,0,0,INET_E_INVALID_URL,FALSE
6120 { "http://google.com/",0,S_OK,FALSE,
6122 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
6124 {FALSE},
6125 0,INET_E_INVALID_URL,FALSE,
6126 0,INET_E_INVALID_URL,FALSE,
6127 0,0,0,INET_E_INVALID_URL,FALSE
6129 { "http://google.com/",0,S_OK,FALSE,
6131 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6133 {FALSE},
6134 0,INET_E_INVALID_URL,FALSE,
6135 0,INET_E_INVALID_URL,FALSE,
6136 0,0,0,INET_E_INVALID_URL,FALSE
6138 { "http://google.com/",0,S_OK,FALSE,
6140 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6142 {FALSE},
6143 0,INET_E_INVALID_URL,FALSE,
6144 0,INET_E_INVALID_URL,FALSE,
6145 0,0,0,INET_E_INVALID_URL,FALSE
6147 { "http://google.com/",0,S_OK,FALSE,
6149 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6151 {FALSE},
6152 0,INET_E_INVALID_URL,FALSE,
6153 0,INET_E_INVALID_URL,FALSE,
6154 0,0,0,INET_E_INVALID_URL,FALSE
6156 { "http://google.com/",0,S_OK,FALSE,
6158 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
6160 {FALSE},
6161 0,INET_E_INVALID_URL,FALSE,
6162 0,INET_E_INVALID_URL,FALSE,
6163 0,0,0,INET_E_INVALID_URL,FALSE
6165 { "http://google.com/",0,S_OK,FALSE,
6167 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
6169 {FALSE},
6170 0,INET_E_INVALID_URL,FALSE,
6171 0,INET_E_INVALID_URL,FALSE,
6172 0,0,0,INET_E_INVALID_URL,FALSE
6174 { "http://google.com/",0,S_OK,FALSE,
6176 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
6178 {FALSE},
6179 0,INET_E_INVALID_URL,FALSE,
6180 0,INET_E_INVALID_URL,FALSE,
6181 0,0,0,INET_E_INVALID_URL,FALSE
6183 { "http://google.com/",0,S_OK,FALSE,
6185 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
6187 {FALSE},
6188 0,INET_E_INVALID_URL,FALSE,
6189 0,INET_E_INVALID_URL,FALSE,
6190 0,0,0,INET_E_INVALID_URL,FALSE
6192 /* Hostname is allowed to contain a ':' (even for known scheme types). */
6193 { "http://google.com/",0,S_OK,FALSE,
6195 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
6197 {FALSE},
6198 0,S_OK,FALSE,
6199 0,S_OK,FALSE,
6200 0,0,0,S_OK,FALSE,
6202 {"http://winehq.org:test/",S_OK},
6203 {"winehq.org:test",S_OK},
6204 {"http://winehq.org:test/",S_OK},
6205 {"winehq.org:test",S_OK},
6206 {"",S_FALSE},
6207 {"",S_FALSE},
6208 {"winehq.org:test",S_OK},
6209 {"",S_FALSE},
6210 {"/",S_OK},
6211 {"/",S_OK},
6212 {"",S_FALSE},
6213 {"http://winehq.org:test/",S_OK},
6214 {"http",S_OK},
6215 {"",S_FALSE},
6216 {"",S_FALSE}
6219 {Uri_HOST_DNS,S_OK},
6220 {80,S_OK},
6221 {URL_SCHEME_HTTP,S_OK},
6222 {URLZONE_INVALID,E_NOTIMPL}
6225 /* Can't set the host name to NULL. */
6226 { "http://google.com/",0,S_OK,FALSE,
6228 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
6230 {FALSE},
6231 0,S_OK,FALSE,
6232 0,S_OK,FALSE,
6233 0,0,0,S_OK,FALSE,
6235 {"http://google.com/",S_OK},
6236 {"google.com",S_OK},
6237 {"http://google.com/",S_OK},
6238 {"google.com",S_OK},
6239 {"",S_FALSE},
6240 {"",S_FALSE},
6241 {"google.com",S_OK},
6242 {"",S_FALSE},
6243 {"/",S_OK},
6244 {"/",S_OK},
6245 {"",S_FALSE},
6246 {"http://google.com/",S_OK},
6247 {"http",S_OK},
6248 {"",S_FALSE},
6249 {"",S_FALSE}
6252 {Uri_HOST_DNS,S_OK},
6253 {80,S_OK},
6254 {URL_SCHEME_HTTP,S_OK},
6255 {URLZONE_INVALID,E_NOTIMPL}
6258 /* Can set the host name to an empty string. */
6259 { "http://google.com/",0,S_OK,FALSE,
6261 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
6263 {FALSE},
6264 0,S_OK,FALSE,
6265 0,S_OK,FALSE,
6266 0,0,0,S_OK,FALSE,
6268 {"http:///",S_OK},
6269 {"",S_OK},
6270 {"http:///",S_OK},
6271 {"",S_FALSE},
6272 {"",S_FALSE},
6273 {"",S_FALSE},
6274 {"",S_OK},
6275 {"",S_FALSE},
6276 {"/",S_OK},
6277 {"/",S_OK},
6278 {"",S_FALSE},
6279 {"http:///",S_OK},
6280 {"http",S_OK},
6281 {"",S_FALSE},
6282 {"",S_FALSE}
6285 {Uri_HOST_UNKNOWN,S_OK},
6286 {80,S_OK},
6287 {URL_SCHEME_HTTP,S_OK},
6288 {URLZONE_INVALID,E_NOTIMPL}
6291 { "http://google.com/",0,S_OK,FALSE,
6293 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
6295 {FALSE},
6296 0,INET_E_INVALID_URL,FALSE,
6297 0,INET_E_INVALID_URL,FALSE,
6298 0,0,0,INET_E_INVALID_URL,FALSE
6300 { "http://google.com/",0,S_OK,FALSE,
6302 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
6304 {FALSE},
6305 0,INET_E_INVALID_URL,FALSE,
6306 0,INET_E_INVALID_URL,FALSE,
6307 0,0,0,INET_E_INVALID_URL,FALSE
6309 { "http://google.com/",0,S_OK,FALSE,
6311 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
6313 {FALSE},
6314 0,INET_E_INVALID_URL,FALSE,
6315 0,INET_E_INVALID_URL,FALSE,
6316 0,0,0,INET_E_INVALID_URL,FALSE
6318 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6320 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6322 {FALSE},
6323 0,S_OK,FALSE,
6324 0,S_OK,FALSE,
6325 0,0,0,S_OK,FALSE,
6327 {"file:///c:/dir/file.html",S_OK},
6328 {"",S_FALSE},
6329 {"file:///c:/dir/file.html",S_OK},
6330 {"",S_FALSE},
6331 {".html",S_OK},
6332 {"",S_FALSE},
6333 {"",S_FALSE},
6334 {"",S_FALSE},
6335 {"/c:/dir/file.html",S_OK},
6336 {"/c:/dir/file.html",S_OK},
6337 {"",S_FALSE},
6338 {"file:///c:/dir/file.html",S_OK},
6339 {"file",S_OK},
6340 {"",S_FALSE},
6341 {"",S_FALSE}
6344 {Uri_HOST_UNKNOWN,S_OK},
6345 {0,S_FALSE},
6346 {URL_SCHEME_FILE,S_OK},
6347 {URLZONE_INVALID,E_NOTIMPL}
6350 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6352 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6354 {FALSE},
6355 0,S_OK,FALSE,
6356 0,S_OK,FALSE,
6357 0,0,0,S_OK,FALSE,
6359 {"file:///c:/dir/file.html#",S_OK},
6360 {"",S_FALSE},
6361 {"file:///c:/dir/file.html#",S_OK},
6362 {"",S_FALSE},
6363 {".html",S_OK},
6364 {"#",S_OK},
6365 {"",S_FALSE},
6366 {"",S_FALSE},
6367 {"/c:/dir/file.html",S_OK},
6368 {"/c:/dir/file.html",S_OK},
6369 {"",S_FALSE},
6370 {"file:///c:/dir/file.html#",S_OK},
6371 {"file",S_OK},
6372 {"",S_FALSE},
6373 {"",S_FALSE}
6376 {Uri_HOST_UNKNOWN,S_OK},
6377 {0,S_FALSE},
6378 {URL_SCHEME_FILE,S_OK},
6379 {URLZONE_INVALID,E_NOTIMPL}
6384 typedef struct _uri_builder_remove_test {
6385 const char *uri;
6386 DWORD create_flags;
6387 HRESULT create_builder_expected;
6388 BOOL create_builder_todo;
6390 DWORD remove_properties;
6391 HRESULT remove_expected;
6392 BOOL remove_todo;
6394 const char *expected_uri;
6395 DWORD expected_flags;
6396 HRESULT expected_hres;
6397 BOOL expected_todo;
6398 } uri_builder_remove_test;
6400 static const uri_builder_remove_test uri_builder_remove_tests[] = {
6401 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
6402 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
6403 "http://google.com/",0,S_OK,FALSE
6405 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
6406 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
6407 "http://winehq.org/",0,S_OK,FALSE
6409 { "zip://google.com?Test=x",0,S_OK,FALSE,
6410 Uri_HAS_HOST,S_OK,FALSE,
6411 "zip:/?Test=x",0,S_OK,FALSE
6413 /* Doesn't remove the whole userinfo component. */
6414 { "http://username:pass@google.com/",0,S_OK,FALSE,
6415 Uri_HAS_USER_INFO,S_OK,FALSE,
6416 "http://username:pass@google.com/",0,S_OK,FALSE
6418 /* Doesn't remove the domain. */
6419 { "http://google.com/",0,S_OK,FALSE,
6420 Uri_HAS_DOMAIN,S_OK,FALSE,
6421 "http://google.com/",0,S_OK,FALSE
6423 { "http://google.com:120/",0,S_OK,FALSE,
6424 Uri_HAS_AUTHORITY,S_OK,FALSE,
6425 "http://google.com:120/",0,S_OK,FALSE
6427 { "http://google.com/test.com/",0,S_OK,FALSE,
6428 Uri_HAS_EXTENSION,S_OK,FALSE,
6429 "http://google.com/test.com/",0,S_OK,FALSE
6431 { "http://google.com/?test=x",0,S_OK,FALSE,
6432 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
6433 "http://google.com/?test=x",0,S_OK,FALSE
6435 /* Can't remove the scheme name. */
6436 { "http://google.com/?test=x",0,S_OK,FALSE,
6437 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
6438 "http://google.com/?test=x",0,S_OK,FALSE
6442 typedef struct _uri_combine_str_property {
6443 const char *value;
6444 HRESULT expected;
6445 BOOL todo;
6446 const char *broken_value;
6447 const char *value_ex;
6448 } uri_combine_str_property;
6450 typedef struct _uri_combine_test {
6451 const char *base_uri;
6452 DWORD base_create_flags;
6453 const char *relative_uri;
6454 DWORD relative_create_flags;
6455 DWORD combine_flags;
6456 HRESULT expected;
6457 BOOL todo;
6459 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
6460 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
6461 } uri_combine_test;
6463 static const uri_combine_test uri_combine_tests[] = {
6464 { "http://google.com/fun/stuff",0,
6465 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
6466 0,S_OK,FALSE,
6468 {"http://google.com/not/fun/stuff",S_OK},
6469 {"google.com",S_OK},
6470 {"http://google.com/not/fun/stuff",S_OK},
6471 {"google.com",S_OK},
6472 {"",S_FALSE},
6473 {"",S_FALSE},
6474 {"google.com",S_OK},
6475 {"",S_FALSE},
6476 {"/not/fun/stuff",S_OK},
6477 {"/not/fun/stuff",S_OK},
6478 {"",S_FALSE},
6479 {"http://google.com/not/fun/stuff",S_OK},
6480 {"http",S_OK},
6481 {"",S_FALSE},
6482 {"",S_FALSE}
6485 {Uri_HOST_DNS,S_OK},
6486 {80,S_OK},
6487 {URL_SCHEME_HTTP,S_OK},
6488 {URLZONE_INVALID,E_NOTIMPL}
6491 { "http://google.com/test",0,
6492 "zip://test.com/cool",0,
6493 0,S_OK,FALSE,
6495 {"zip://test.com/cool",S_OK},
6496 {"test.com",S_OK},
6497 {"zip://test.com/cool",S_OK},
6498 {"test.com",S_OK},
6499 {"",S_FALSE},
6500 {"",S_FALSE},
6501 {"test.com",S_OK},
6502 {"",S_FALSE},
6503 {"/cool",S_OK},
6504 {"/cool",S_OK},
6505 {"",S_FALSE},
6506 {"zip://test.com/cool",S_OK},
6507 {"zip",S_OK},
6508 {"",S_FALSE},
6509 {"",S_FALSE}
6512 {Uri_HOST_DNS,S_OK},
6513 {0,S_FALSE},
6514 {URL_SCHEME_UNKNOWN,S_OK},
6515 {URLZONE_INVALID,E_NOTIMPL}
6518 { "http://google.com/use/base/path",0,
6519 "?relative",Uri_CREATE_ALLOW_RELATIVE,
6520 0,S_OK,FALSE,
6522 {"http://google.com/use/base/path?relative",S_OK},
6523 {"google.com",S_OK},
6524 {"http://google.com/use/base/path?relative",S_OK},
6525 {"google.com",S_OK},
6526 {"",S_FALSE},
6527 {"",S_FALSE},
6528 {"google.com",S_OK},
6529 {"",S_FALSE},
6530 {"/use/base/path",S_OK},
6531 {"/use/base/path?relative",S_OK},
6532 {"?relative",S_OK},
6533 {"http://google.com/use/base/path?relative",S_OK},
6534 {"http",S_OK},
6535 {"",S_FALSE},
6536 {"",S_FALSE}
6539 {Uri_HOST_DNS,S_OK},
6540 {80,S_OK},
6541 {URL_SCHEME_HTTP,S_OK},
6542 {URLZONE_INVALID,E_NOTIMPL}
6545 { "http://google.com/path",0,
6546 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6547 0,S_OK,FALSE,
6549 {"http://google.com/testing",S_OK},
6550 {"google.com",S_OK},
6551 {"http://google.com/testing",S_OK},
6552 {"google.com",S_OK},
6553 {"",S_FALSE},
6554 {"",S_FALSE},
6555 {"google.com",S_OK},
6556 {"",S_FALSE},
6557 {"/testing",S_OK},
6558 {"/testing",S_OK},
6559 {"",S_FALSE},
6560 {"http://google.com/testing",S_OK},
6561 {"http",S_OK},
6562 {"",S_FALSE},
6563 {"",S_FALSE}
6566 {Uri_HOST_DNS,S_OK},
6567 {80,S_OK},
6568 {URL_SCHEME_HTTP,S_OK},
6569 {URLZONE_INVALID,E_NOTIMPL}
6572 { "http://google.com/path",0,
6573 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6574 URL_DONT_SIMPLIFY,S_OK,FALSE,
6576 {"http://google.com:80/test/../test/.././testing",S_OK},
6577 {"google.com",S_OK},
6578 {"http://google.com:80/test/../test/.././testing",S_OK},
6579 {"google.com",S_OK},
6580 {"",S_FALSE},
6581 {"",S_FALSE},
6582 {"google.com",S_OK},
6583 {"",S_FALSE},
6584 {"/test/../test/.././testing",S_OK},
6585 {"/test/../test/.././testing",S_OK},
6586 {"",S_FALSE},
6587 {"http://google.com:80/test/../test/.././testing",S_OK},
6588 {"http",S_OK},
6589 {"",S_FALSE},
6590 {"",S_FALSE}
6593 {Uri_HOST_DNS,S_OK},
6594 {80,S_OK},
6595 {URL_SCHEME_HTTP,S_OK},
6596 {URLZONE_INVALID,E_NOTIMPL}
6599 { "http://winehq.org/test/abc",0,
6600 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6601 0,S_OK,FALSE,
6603 {"http://winehq.org/test/testing/test",S_OK},
6604 {"winehq.org",S_OK},
6605 {"http://winehq.org/test/testing/test",S_OK},
6606 {"winehq.org",S_OK},
6607 {"",S_FALSE},
6608 {"",S_FALSE},
6609 {"winehq.org",S_OK},
6610 {"",S_FALSE},
6611 {"/test/testing/test",S_OK},
6612 {"/test/testing/test",S_OK},
6613 {"",S_FALSE},
6614 {"http://winehq.org/test/testing/test",S_OK},
6615 {"http",S_OK},
6616 {"",S_FALSE},
6617 {"",S_FALSE}
6620 {Uri_HOST_DNS,S_OK},
6621 {80,S_OK},
6622 {URL_SCHEME_HTTP,S_OK},
6623 {URLZONE_INVALID,E_NOTIMPL}
6626 { "http://winehq.org/test/abc",0,
6627 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6628 URL_DONT_SIMPLIFY,S_OK,FALSE,
6630 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6631 /* Default port is hidden in the authority. */
6632 {"winehq.org",S_OK},
6633 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6634 {"winehq.org",S_OK},
6635 {"",S_FALSE},
6636 {"",S_FALSE},
6637 {"winehq.org",S_OK},
6638 {"",S_FALSE},
6639 {"/test/testing/abc/../test",S_OK},
6640 {"/test/testing/abc/../test",S_OK},
6641 {"",S_FALSE},
6642 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6643 {"http",S_OK},
6644 {"",S_FALSE},
6645 {"",S_FALSE}
6648 {Uri_HOST_DNS,S_OK},
6649 {80,S_OK},
6650 {URL_SCHEME_HTTP,S_OK},
6651 {URLZONE_INVALID,E_NOTIMPL}
6654 { "http://winehq.org/test?query",0,
6655 "testing",Uri_CREATE_ALLOW_RELATIVE,
6656 0,S_OK,FALSE,
6658 {"http://winehq.org/testing",S_OK},
6659 {"winehq.org",S_OK},
6660 {"http://winehq.org/testing",S_OK},
6661 {"winehq.org",S_OK},
6662 {"",S_FALSE},
6663 {"",S_FALSE},
6664 {"winehq.org",S_OK},
6665 {"",S_FALSE},
6666 {"/testing",S_OK},
6667 {"/testing",S_OK},
6668 {"",S_FALSE},
6669 {"http://winehq.org/testing",S_OK},
6670 {"http",S_OK},
6671 {"",S_FALSE},
6672 {"",S_FALSE}
6675 {Uri_HOST_DNS,S_OK},
6676 {80,S_OK},
6677 {URL_SCHEME_HTTP,S_OK},
6678 {URLZONE_INVALID,E_NOTIMPL}
6681 { "http://winehq.org/test#frag",0,
6682 "testing",Uri_CREATE_ALLOW_RELATIVE,
6683 0,S_OK,FALSE,
6685 {"http://winehq.org/testing",S_OK},
6686 {"winehq.org",S_OK},
6687 {"http://winehq.org/testing",S_OK},
6688 {"winehq.org",S_OK},
6689 {"",S_FALSE},
6690 {"",S_FALSE},
6691 {"winehq.org",S_OK},
6692 {"",S_FALSE},
6693 {"/testing",S_OK},
6694 {"/testing",S_OK},
6695 {"",S_FALSE},
6696 {"http://winehq.org/testing",S_OK},
6697 {"http",S_OK},
6698 {"",S_FALSE},
6699 {"",S_FALSE}
6702 {Uri_HOST_DNS,S_OK},
6703 {80,S_OK},
6704 {URL_SCHEME_HTTP,S_OK},
6705 {URLZONE_INVALID,E_NOTIMPL}
6708 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6709 "test",Uri_CREATE_ALLOW_RELATIVE,
6710 0,S_OK,FALSE,
6712 {"test",S_OK},
6713 {"",S_FALSE},
6714 {"test",S_OK},
6715 {"",S_FALSE},
6716 {"",S_FALSE},
6717 {"",S_FALSE},
6718 {"",S_FALSE},
6719 {"",S_FALSE},
6720 {"test",S_OK},
6721 {"test",S_OK},
6722 {"",S_FALSE},
6723 {"test",S_OK},
6724 {"",S_FALSE},
6725 {"",S_FALSE},
6726 {"",S_FALSE}
6729 {Uri_HOST_UNKNOWN,S_OK},
6730 {0,S_FALSE},
6731 {URL_SCHEME_UNKNOWN,S_OK},
6732 {URLZONE_INVALID,E_NOTIMPL}
6735 { "file:///c:/test/test",0,
6736 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6737 URL_FILE_USE_PATHURL,S_OK,FALSE,
6739 {"file://c:\\testing.mp3",S_OK},
6740 {"",S_FALSE},
6741 {"file://c:\\testing.mp3",S_OK},
6742 {"",S_FALSE},
6743 {".mp3",S_OK},
6744 {"",S_FALSE},
6745 {"",S_FALSE},
6746 {"",S_FALSE},
6747 {"c:\\testing.mp3",S_OK},
6748 {"c:\\testing.mp3",S_OK},
6749 {"",S_FALSE},
6750 {"file://c:\\testing.mp3",S_OK},
6751 {"file",S_OK},
6752 {"",S_FALSE},
6753 {"",S_FALSE}
6756 {Uri_HOST_UNKNOWN,S_OK},
6757 {0,S_FALSE},
6758 {URL_SCHEME_FILE,S_OK},
6759 {URLZONE_INVALID,E_NOTIMPL}
6762 { "file:///c:/test/test",0,
6763 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6764 0,S_OK,FALSE,
6766 {"file:///c:/testing.mp3",S_OK},
6767 {"",S_FALSE},
6768 {"file:///c:/testing.mp3",S_OK},
6769 {"",S_FALSE},
6770 {".mp3",S_OK},
6771 {"",S_FALSE},
6772 {"",S_FALSE},
6773 {"",S_FALSE},
6774 {"/c:/testing.mp3",S_OK},
6775 {"/c:/testing.mp3",S_OK},
6776 {"",S_FALSE},
6777 {"file:///c:/testing.mp3",S_OK},
6778 {"file",S_OK},
6779 {"",S_FALSE},
6780 {"",S_FALSE}
6783 {Uri_HOST_UNKNOWN,S_OK},
6784 {0,S_FALSE},
6785 {URL_SCHEME_FILE,S_OK},
6786 {URLZONE_INVALID,E_NOTIMPL}
6789 { "file://test.com/test/test",0,
6790 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6791 URL_FILE_USE_PATHURL,S_OK,FALSE,
6793 {"file://\\\\test.com\\testing.mp3",S_OK},
6794 {"test.com",S_OK},
6795 {"file://\\\\test.com\\testing.mp3",S_OK},
6796 {"test.com",S_OK},
6797 {".mp3",S_OK},
6798 {"",S_FALSE},
6799 {"test.com",S_OK},
6800 {"",S_FALSE},
6801 {"\\testing.mp3",S_OK},
6802 {"\\testing.mp3",S_OK},
6803 {"",S_FALSE},
6804 {"file://\\\\test.com\\testing.mp3",S_OK},
6805 {"file",S_OK},
6806 {"",S_FALSE},
6807 {"",S_FALSE}
6810 {Uri_HOST_DNS,S_OK},
6811 {0,S_FALSE},
6812 {URL_SCHEME_FILE,S_OK},
6813 {URLZONE_INVALID,E_NOTIMPL}
6816 /* URL_DONT_SIMPLIFY has no effect. */
6817 { "http://google.com/test",0,
6818 "zip://test.com/cool/../cool/test",0,
6819 URL_DONT_SIMPLIFY,S_OK,FALSE,
6821 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6822 {"test.com",S_OK},
6823 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6824 {"test.com",S_OK},
6825 {"",S_FALSE},
6826 {"",S_FALSE},
6827 {"test.com",S_OK},
6828 {"",S_FALSE},
6829 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6830 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6831 {"",S_FALSE},
6832 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6833 * On IE 7 it reduces the path in the Raw URI.
6835 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6836 {"zip",S_OK},
6837 {"",S_FALSE},
6838 {"",S_FALSE}
6841 {Uri_HOST_DNS,S_OK},
6842 {0,S_FALSE},
6843 {URL_SCHEME_UNKNOWN,S_OK},
6844 {URLZONE_INVALID,E_NOTIMPL}
6847 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6848 * resulting URI is converted into a dos path.
6850 { "http://google.com/test",0,
6851 "file:///c:/test/",0,
6852 URL_FILE_USE_PATHURL,S_OK,FALSE,
6854 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6855 {"",S_FALSE},
6856 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6857 {"",S_FALSE},
6858 {"",S_FALSE},
6859 {"",S_FALSE},
6860 {"",S_FALSE},
6861 {"",S_FALSE},
6862 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6863 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6864 {"",S_FALSE},
6865 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6866 {"file",S_OK},
6867 {"",S_FALSE},
6868 {"",S_FALSE}
6871 {Uri_HOST_UNKNOWN,S_OK},
6872 {0,S_FALSE},
6873 {URL_SCHEME_FILE,S_OK},
6874 {URLZONE_INVALID,E_NOTIMPL}
6877 { "http://google.com/test",0,
6878 "http://test.com/test#%30test",0,
6879 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6881 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6882 {"test.com",S_OK},
6883 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6884 {"test.com",S_OK},
6885 {"",S_FALSE},
6886 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6887 {"test.com",S_OK},
6888 {"",S_FALSE},
6889 {"/test",S_OK},
6890 {"/test",S_OK},
6891 {"",S_FALSE},
6892 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6893 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6894 {"http",S_OK},
6895 {"",S_FALSE},
6896 {"",S_FALSE}
6899 {Uri_HOST_DNS,S_OK},
6900 {80,S_OK},
6901 {URL_SCHEME_HTTP,S_OK},
6902 {URLZONE_INVALID,E_NOTIMPL}
6905 /* Windows validates the path component from the relative Uri. */
6906 { "http://google.com/test",0,
6907 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6908 0,E_INVALIDARG,FALSE
6910 /* Windows doesn't validate the query from the relative Uri. */
6911 { "http://google.com/test",0,
6912 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6913 0,S_OK,FALSE,
6915 {"http://google.com/test?Tes%XXt",S_OK},
6916 {"google.com",S_OK},
6917 {"http://google.com/test?Tes%XXt",S_OK},
6918 {"google.com",S_OK},
6919 {"",S_FALSE},
6920 {"",S_FALSE},
6921 {"google.com",S_OK},
6922 {"",S_FALSE},
6923 {"/test",S_OK},
6924 {"/test?Tes%XXt",S_OK},
6925 {"?Tes%XXt",S_OK},
6926 {"http://google.com/test?Tes%XXt",S_OK},
6927 {"http",S_OK},
6928 {"",S_FALSE},
6929 {"",S_FALSE}
6932 {Uri_HOST_DNS,S_OK},
6933 {80,S_OK},
6934 {URL_SCHEME_HTTP,S_OK},
6935 {URLZONE_INVALID,E_NOTIMPL}
6938 /* Windows doesn't validate the fragment from the relative Uri. */
6939 { "http://google.com/test",0,
6940 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6941 0,S_OK,FALSE,
6943 {"http://google.com/test#Tes%XXt",S_OK},
6944 {"google.com",S_OK},
6945 {"http://google.com/test#Tes%XXt",S_OK},
6946 {"google.com",S_OK},
6947 {"",S_FALSE},
6948 {"#Tes%XXt",S_OK},
6949 {"google.com",S_OK},
6950 {"",S_FALSE},
6951 {"/test",S_OK},
6952 {"/test",S_OK},
6953 {"",S_FALSE},
6954 {"http://google.com/test#Tes%XXt",S_OK},
6955 {"http",S_OK},
6956 {"",S_FALSE},
6957 {"",S_FALSE}
6960 {Uri_HOST_DNS,S_OK},
6961 {80,S_OK},
6962 {URL_SCHEME_HTTP,S_OK},
6963 {URLZONE_INVALID,E_NOTIMPL}
6966 /* Creates an IUri which contains an invalid dos path char. */
6967 { "file:///c:/test",0,
6968 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6969 URL_FILE_USE_PATHURL,S_OK,FALSE,
6971 {"file://c:\\test<ing",S_OK},
6972 {"",S_FALSE},
6973 {"file://c:\\test<ing",S_OK},
6974 {"",S_FALSE},
6975 {"",S_FALSE},
6976 {"",S_FALSE},
6977 {"",S_FALSE},
6978 {"",S_FALSE},
6979 {"c:\\test<ing",S_OK},
6980 {"c:\\test<ing",S_OK},
6981 {"",S_FALSE},
6982 {"file://c:\\test<ing",S_OK},
6983 {"file",S_OK},
6984 {"",S_FALSE},
6985 {"",S_FALSE}
6988 {Uri_HOST_UNKNOWN,S_OK},
6989 {0,S_FALSE},
6990 {URL_SCHEME_FILE,S_OK},
6991 {URLZONE_INVALID,E_NOTIMPL}
6994 /* Appends the path after the drive letter (if any). */
6995 { "file:///c:/test",0,
6996 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6997 0,S_OK,FALSE,
6999 {"file:///c:/c:/testing",S_OK},
7000 {"",S_FALSE},
7001 {"file:///c:/c:/testing",S_OK},
7002 {"",S_FALSE},
7003 {"",S_FALSE},
7004 {"",S_FALSE},
7005 {"",S_FALSE},
7006 {"",S_FALSE},
7007 {"/c:/c:/testing",S_OK},
7008 {"/c:/c:/testing",S_OK},
7009 {"",S_FALSE},
7010 {"file:///c:/c:/testing",S_OK},
7011 {"file",S_OK},
7012 {"",S_FALSE},
7013 {"",S_FALSE}
7016 {Uri_HOST_UNKNOWN,S_OK},
7017 {0,S_FALSE},
7018 {URL_SCHEME_FILE,S_OK},
7019 {URLZONE_INVALID,E_NOTIMPL}
7022 /* A '/' is added if the base URI doesn't have a path and the
7023 * relative URI doesn't contain a path (since the base URI is
7024 * hierarchical.
7026 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
7027 "?test",Uri_CREATE_ALLOW_RELATIVE,
7028 0,S_OK,FALSE,
7030 {"http://google.com/?test",S_OK},
7031 {"google.com",S_OK},
7032 {"http://google.com/?test",S_OK},
7033 {"google.com",S_OK},
7034 {"",S_FALSE},
7035 {"",S_FALSE},
7036 {"google.com",S_OK},
7037 {"",S_FALSE},
7038 {"/",S_OK},
7039 {"/?test",S_OK},
7040 {"?test",S_OK},
7041 {"http://google.com/?test",S_OK},
7042 {"http",S_OK},
7043 {"",S_FALSE},
7044 {"",S_FALSE}
7047 {Uri_HOST_DNS,S_OK},
7048 {80,S_OK},
7049 {URL_SCHEME_HTTP,S_OK},
7050 {URLZONE_INVALID,E_NOTIMPL}
7053 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
7054 "?test",Uri_CREATE_ALLOW_RELATIVE,
7055 0,S_OK,FALSE,
7057 {"zip://google.com/?test",S_OK},
7058 {"google.com",S_OK},
7059 {"zip://google.com/?test",S_OK},
7060 {"google.com",S_OK},
7061 {"",S_FALSE},
7062 {"",S_FALSE},
7063 {"google.com",S_OK},
7064 {"",S_FALSE},
7065 {"/",S_OK},
7066 {"/?test",S_OK},
7067 {"?test",S_OK},
7068 {"zip://google.com/?test",S_OK},
7069 {"zip",S_OK},
7070 {"",S_FALSE},
7071 {"",S_FALSE}
7074 {Uri_HOST_DNS,S_OK},
7075 {0,S_FALSE},
7076 {URL_SCHEME_UNKNOWN,S_OK},
7077 {URLZONE_INVALID,E_NOTIMPL}
7080 /* No path is appended since the base URI is opaque. */
7081 { "zip:?testing",0,
7082 "?test",Uri_CREATE_ALLOW_RELATIVE,
7083 0,S_OK,FALSE,
7085 {"zip:?test",S_OK},
7086 {"",S_FALSE},
7087 {"zip:?test",S_OK},
7088 {"",S_FALSE},
7089 {"",S_FALSE},
7090 {"",S_FALSE},
7091 {"",S_FALSE},
7092 {"",S_FALSE},
7093 {"",S_OK},
7094 {"?test",S_OK},
7095 {"?test",S_OK},
7096 {"zip:?test",S_OK},
7097 {"zip",S_OK},
7098 {"",S_FALSE},
7099 {"",S_FALSE}
7102 {Uri_HOST_UNKNOWN,S_OK},
7103 {0,S_FALSE},
7104 {URL_SCHEME_UNKNOWN,S_OK},
7105 {URLZONE_INVALID,E_NOTIMPL}
7108 { "file:///c:/",0,
7109 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
7110 0,S_OK,FALSE,
7112 {"file:///c:/testing/test",S_OK},
7113 {"",S_FALSE},
7114 {"file:///c:/testing/test",S_OK},
7115 {"",S_FALSE},
7116 {"",S_FALSE},
7117 {"",S_FALSE},
7118 {"",S_FALSE},
7119 {"",S_FALSE},
7120 {"/c:/testing/test",S_OK},
7121 {"/c:/testing/test",S_OK},
7122 {"",S_FALSE},
7123 {"file:///c:/testing/test",S_OK},
7124 {"file",S_OK},
7125 {"",S_FALSE},
7126 {"",S_FALSE}
7129 {Uri_HOST_UNKNOWN,S_OK},
7130 {0,S_FALSE},
7131 {URL_SCHEME_FILE,S_OK},
7132 {URLZONE_INVALID,E_NOTIMPL}
7135 { "http://winehq.org/dir/testfile",0,
7136 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
7137 0,S_OK,FALSE,
7139 {"http://winehq.org/dir/test?querystring",S_OK},
7140 {"winehq.org",S_OK},
7141 {"http://winehq.org/dir/test?querystring",S_OK},
7142 {"winehq.org",S_OK},
7143 {"",S_FALSE},
7144 {"",S_FALSE},
7145 {"winehq.org",S_OK},
7146 {"",S_FALSE},
7147 {"/dir/test",S_OK},
7148 {"/dir/test?querystring",S_OK},
7149 {"?querystring",S_OK},
7150 {"http://winehq.org/dir/test?querystring",S_OK},
7151 {"http",S_OK},
7152 {"",S_FALSE},
7153 {"",S_FALSE}
7156 {Uri_HOST_DNS,S_OK},
7157 {80,S_OK},
7158 {URL_SCHEME_HTTP,S_OK},
7159 {URLZONE_INVALID,E_NOTIMPL}
7162 { "http://winehq.org/dir/test",0,
7163 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
7164 0,S_OK,FALSE,
7166 {"http://winehq.org/dir/test?querystring",S_OK},
7167 {"winehq.org",S_OK},
7168 {"http://winehq.org/dir/test?querystring",S_OK},
7169 {"winehq.org",S_OK},
7170 {"",S_FALSE},
7171 {"",S_FALSE},
7172 {"winehq.org",S_OK},
7173 {"",S_FALSE},
7174 {"/dir/test",S_OK},
7175 {"/dir/test?querystring",S_OK},
7176 {"?querystring",S_OK},
7177 {"http://winehq.org/dir/test?querystring",S_OK},
7178 {"http",S_OK},
7179 {"",S_FALSE},
7180 {"",S_FALSE}
7183 {Uri_HOST_DNS,S_OK},
7184 {80,S_OK},
7185 {URL_SCHEME_HTTP,S_OK},
7186 {URLZONE_INVALID,E_NOTIMPL}
7189 { "http://winehq.org/dir/test?querystring",0,
7190 "#hash",Uri_CREATE_ALLOW_RELATIVE,
7191 0,S_OK,FALSE,
7193 {"http://winehq.org/dir/test?querystring#hash",S_OK},
7194 {"winehq.org",S_OK},
7195 {"http://winehq.org/dir/test?querystring#hash",S_OK},
7196 {"winehq.org",S_OK},
7197 {"",S_FALSE},
7198 {"#hash",S_OK},
7199 {"winehq.org",S_OK},
7200 {"",S_FALSE},
7201 {"/dir/test",S_OK},
7202 {"/dir/test?querystring",S_OK},
7203 {"?querystring",S_OK},
7204 {"http://winehq.org/dir/test?querystring#hash",S_OK},
7205 {"http",S_OK},
7206 {"",S_FALSE},
7207 {"",S_FALSE}
7210 {Uri_HOST_DNS,S_OK},
7211 {80,S_OK},
7212 {URL_SCHEME_HTTP,S_OK},
7213 {URLZONE_INVALID,E_NOTIMPL}
7216 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
7217 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7218 0,S_OK,FALSE,
7220 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7221 {"",S_FALSE},
7222 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7223 {"",S_FALSE},
7224 {".txt",S_OK},
7225 {"",S_FALSE},
7226 {"",S_FALSE},
7227 {"",S_FALSE},
7228 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7229 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7230 {"",S_FALSE},
7231 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7232 {"mk",S_OK},
7233 {"",S_FALSE},
7234 {"",S_FALSE}
7237 {Uri_HOST_UNKNOWN,S_OK},
7238 {0,S_FALSE},
7239 {URL_SCHEME_MK,S_OK},
7240 {URLZONE_INVALID,E_NOTIMPL}
7243 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
7244 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7245 0,S_OK,FALSE,
7247 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7248 {"",S_FALSE},
7249 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7250 {"",S_FALSE},
7251 {".txt",S_OK},
7252 {"",S_FALSE},
7253 {"",S_FALSE},
7254 {"",S_FALSE},
7255 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7256 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7257 {"",S_FALSE},
7258 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
7259 {"mk",S_OK},
7260 {"",S_FALSE},
7261 {"",S_FALSE}
7264 {Uri_HOST_UNKNOWN,S_OK},
7265 {0,S_FALSE},
7266 {URL_SCHEME_MK,S_OK},
7267 {URLZONE_INVALID,E_NOTIMPL}
7270 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
7271 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
7272 0,S_OK,FALSE,
7274 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7275 {"",S_FALSE},
7276 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7277 {"",S_FALSE},
7278 {".txt",S_OK},
7279 {"",S_FALSE},
7280 {"",S_FALSE},
7281 {"",S_FALSE},
7282 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7283 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7284 {"",S_FALSE},
7285 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7286 {"mk",S_OK},
7287 {"",S_FALSE},
7288 {"",S_FALSE}
7291 {Uri_HOST_UNKNOWN,S_OK},
7292 {0,S_FALSE},
7293 {URL_SCHEME_MK,S_OK},
7294 {URLZONE_INVALID,E_NOTIMPL}
7297 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7298 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7299 0,S_OK,FALSE,
7301 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7302 {"",S_FALSE},
7303 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7304 {"",S_FALSE},
7305 {".txt",S_OK},
7306 {"",S_FALSE},
7307 {"",S_FALSE},
7308 {"",S_FALSE},
7309 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7310 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7311 {"",S_FALSE},
7312 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7313 {"mk",S_OK},
7314 {"",S_FALSE},
7315 {"",S_FALSE}
7318 {Uri_HOST_UNKNOWN,S_OK},
7319 {0,S_FALSE},
7320 {URL_SCHEME_MK,S_OK},
7321 {URLZONE_INVALID,E_NOTIMPL}
7324 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7325 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7326 0,S_OK,FALSE,
7328 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7329 {"",S_FALSE},
7330 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7331 {"",S_FALSE},
7332 {".txt",S_OK},
7333 {"",S_FALSE},
7334 {"",S_FALSE},
7335 {"",S_FALSE},
7336 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7337 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7338 {"",S_FALSE},
7339 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7340 {"mk",S_OK},
7341 {"",S_FALSE},
7342 {"",S_FALSE}
7345 {Uri_HOST_UNKNOWN,S_OK},
7346 {0,S_FALSE},
7347 {URL_SCHEME_MK,S_OK},
7348 {URLZONE_INVALID,E_NOTIMPL}
7351 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7352 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7353 0,S_OK,FALSE,
7355 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7356 {"",S_FALSE},
7357 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7358 {"",S_FALSE},
7359 {".txt",S_OK},
7360 {"",S_FALSE},
7361 {"",S_FALSE},
7362 {"",S_FALSE},
7363 {"@MSITSTORE:/relative/path.txt",S_OK},
7364 {"@MSITSTORE:/relative/path.txt",S_OK},
7365 {"",S_FALSE},
7366 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7367 {"mk",S_OK},
7368 {"",S_FALSE},
7369 {"",S_FALSE}
7372 {Uri_HOST_UNKNOWN,S_OK},
7373 {0,S_FALSE},
7374 {URL_SCHEME_MK,S_OK},
7375 {URLZONE_INVALID,E_NOTIMPL}
7378 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7379 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7380 0,S_OK,FALSE,
7382 {"mk:@xxx:/relative/path.txt",S_OK},
7383 {"",S_FALSE},
7384 {"mk:@xxx:/relative/path.txt",S_OK},
7385 {"",S_FALSE},
7386 {".txt",S_OK},
7387 {"",S_FALSE},
7388 {"",S_FALSE},
7389 {"",S_FALSE},
7390 {"@xxx:/relative/path.txt",S_OK},
7391 {"@xxx:/relative/path.txt",S_OK},
7392 {"",S_FALSE},
7393 {"mk:@xxx:/relative/path.txt",S_OK},
7394 {"mk",S_OK},
7395 {"",S_FALSE},
7396 {"",S_FALSE}
7399 {Uri_HOST_UNKNOWN,S_OK},
7400 {0,S_FALSE},
7401 {URL_SCHEME_MK,S_OK},
7402 {URLZONE_INVALID,E_NOTIMPL}
7405 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7406 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7407 0,S_OK,FALSE,
7409 {"mk:/relative/path.txt",S_OK},
7410 {"",S_FALSE},
7411 {"mk:/relative/path.txt",S_OK},
7412 {"",S_FALSE},
7413 {".txt",S_OK},
7414 {"",S_FALSE},
7415 {"",S_FALSE},
7416 {"",S_FALSE},
7417 {"/relative/path.txt",S_OK},
7418 {"/relative/path.txt",S_OK},
7419 {"",S_FALSE},
7420 {"mk:/relative/path.txt",S_OK},
7421 {"mk",S_OK},
7422 {"",S_FALSE},
7423 {"",S_FALSE}
7426 {Uri_HOST_UNKNOWN,S_OK},
7427 {0,S_FALSE},
7428 {URL_SCHEME_MK,S_OK},
7429 {URLZONE_INVALID,E_NOTIMPL}
7432 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7433 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7434 0,S_OK,FALSE,
7436 {"ml:/relative/path.txt",S_OK},
7437 {"",S_FALSE},
7438 {"ml:/relative/path.txt",S_OK},
7439 {"",S_FALSE},
7440 {".txt",S_OK},
7441 {"",S_FALSE},
7442 {"",S_FALSE},
7443 {"",S_FALSE},
7444 {"/relative/path.txt",S_OK},
7445 {"/relative/path.txt",S_OK},
7446 {"",S_FALSE},
7447 {"ml:/relative/path.txt",S_OK},
7448 {"ml",S_OK},
7449 {"",S_FALSE},
7450 {"",S_FALSE}
7453 {Uri_HOST_UNKNOWN,S_OK},
7454 {0,S_FALSE},
7455 {URL_SCHEME_UNKNOWN,S_OK},
7456 {URLZONE_INVALID,E_NOTIMPL}
7459 { "http://winehq.org/dir/test?querystring",0,
7460 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
7461 0,S_OK,FALSE,
7463 {"http://winehq.com/#hash",S_OK},
7464 {"winehq.com",S_OK},
7465 {"http://winehq.com/#hash",S_OK},
7466 {"winehq.com",S_OK},
7467 {"",S_FALSE},
7468 {"#hash",S_OK},
7469 {"winehq.com",S_OK},
7470 {"",S_FALSE},
7471 {"/",S_OK},
7472 {"/",S_OK},
7473 {"",S_FALSE},
7474 {"http://winehq.com/#hash",S_OK},
7475 {"http",S_OK},
7476 {"",S_FALSE},
7477 {"",S_FALSE}
7480 {Uri_HOST_DNS,S_OK},
7481 {80,S_OK,FALSE,TRUE},
7482 {URL_SCHEME_HTTP,S_OK},
7483 {URLZONE_INVALID,E_NOTIMPL}
7486 { "http://winehq.org/dir/test?querystring",0,
7487 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
7488 0,S_OK,FALSE,
7490 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7491 {"winehq.com",S_OK},
7492 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7493 {"winehq.com",S_OK},
7494 {".txt",S_OK},
7495 {"#hash",S_OK},
7496 {"winehq.com",S_OK},
7497 {"",S_FALSE},
7498 {"/dir/file.txt",S_OK},
7499 {"/dir/file.txt?query",S_OK},
7500 {"?query",S_OK},
7501 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7502 {"http",S_OK},
7503 {"",S_FALSE},
7504 {"",S_FALSE}
7507 {Uri_HOST_DNS,S_OK},
7508 {80,S_OK,FALSE,TRUE},
7509 {URL_SCHEME_HTTP,S_OK},
7510 {URLZONE_INVALID,E_NOTIMPL}
7513 { "http://google.com/test",0,
7514 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7515 0,S_OK,FALSE,
7517 {"file:///c:/test/",S_OK},
7518 {"",S_FALSE},
7519 {"file:///c:/test/",S_OK},
7520 {"",S_FALSE},
7521 {"",S_FALSE},
7522 {"",S_FALSE},
7523 {"",S_FALSE},
7524 {"",S_FALSE},
7525 {"/c:/test/",S_OK},
7526 {"/c:/test/",S_OK},
7527 {"",S_FALSE},
7528 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7529 {"file",S_OK},
7530 {"",S_FALSE},
7531 {"",S_FALSE}
7534 {Uri_HOST_UNKNOWN,S_OK},
7535 {0,S_FALSE},
7536 {URL_SCHEME_FILE,S_OK},
7537 {URLZONE_INVALID,E_NOTIMPL}
7540 { "http://google.com/test",0,
7541 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7542 0,S_OK,FALSE,
7544 {"file:///c:/test/",S_OK},
7545 {"",S_FALSE},
7546 {"file:///c:/test/",S_OK},
7547 {"",S_FALSE},
7548 {"",S_FALSE},
7549 {"",S_FALSE},
7550 {"",S_FALSE},
7551 {"",S_FALSE},
7552 {"/c:/test/",S_OK},
7553 {"/c:/test/",S_OK},
7554 {"",S_FALSE},
7555 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7556 {"file",S_OK},
7557 {"",S_FALSE},
7558 {"",S_FALSE}
7561 {Uri_HOST_UNKNOWN,S_OK},
7562 {0,S_FALSE},
7563 {URL_SCHEME_FILE,S_OK},
7564 {URLZONE_INVALID,E_NOTIMPL}
7567 { "http://winehq.org",0,
7568 "mailto://",Uri_CREATE_NO_CANONICALIZE,
7569 0,S_OK,FALSE,
7571 {"mailto:",S_OK},
7572 {"",S_FALSE},
7573 {"mailto:",S_OK},
7574 {"",S_FALSE},
7575 {"",S_FALSE},
7576 {"",S_FALSE},
7577 {"",S_FALSE},
7578 {"",S_FALSE},
7579 {"",S_FALSE},
7580 {"",S_FALSE},
7581 {"",S_FALSE},
7582 {"mailto://",S_OK,FALSE,"mailto:"},
7583 {"mailto",S_OK},
7584 {"",S_FALSE},
7585 {"",S_FALSE}
7588 {Uri_HOST_UNKNOWN,S_OK},
7589 {0,S_FALSE},
7590 {URL_SCHEME_MAILTO,S_OK},
7591 {URLZONE_INVALID,E_NOTIMPL}
7594 { "http://winehq.org",0,
7595 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
7596 0,S_OK,FALSE,
7598 {"mailto:a@b.com",S_OK},
7599 {"",S_FALSE},
7600 {"mailto:a@b.com",S_OK},
7601 {"",S_FALSE},
7602 {".com",S_OK},
7603 {"",S_FALSE},
7604 {"",S_FALSE},
7605 {"",S_FALSE},
7606 {"a@b.com",S_OK},
7607 {"a@b.com",S_OK},
7608 {"",S_FALSE},
7609 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
7610 {"mailto",S_OK},
7611 {"",S_FALSE},
7612 {"",S_FALSE}
7615 {Uri_HOST_UNKNOWN,S_OK},
7616 {0,S_FALSE},
7617 {URL_SCHEME_MAILTO,S_OK},
7618 {URLZONE_INVALID,E_NOTIMPL}
7621 { "http://[::1]",0,
7622 "/",Uri_CREATE_ALLOW_RELATIVE,
7623 0,S_OK,FALSE,
7625 {"http://[::1]/",S_OK},
7626 {"[::1]",S_OK},
7627 {"http://[::1]/",S_OK},
7628 {"",S_FALSE},
7629 {"",S_FALSE},
7630 {"",S_FALSE},
7631 {"::1",S_OK},
7632 {"",S_FALSE},
7633 {"/",S_OK},
7634 {"/",S_OK},
7635 {"",S_FALSE},
7636 {"http://[::1]/",S_OK},
7637 {"http",S_OK},
7638 {"",S_FALSE},
7639 {"",S_FALSE}
7642 {Uri_HOST_IPV6,S_OK},
7643 {80,S_OK,FALSE,TRUE},
7644 {URL_SCHEME_HTTP,S_OK},
7645 {URLZONE_INVALID,E_NOTIMPL}
7650 typedef struct _uri_parse_test {
7651 const char *uri;
7652 DWORD uri_flags;
7653 PARSEACTION action;
7654 DWORD flags;
7655 const char *property;
7656 HRESULT expected;
7657 BOOL todo;
7658 const char *property2;
7659 } uri_parse_test;
7661 static const uri_parse_test uri_parse_tests[] = {
7662 /* PARSE_CANONICALIZE tests. */
7663 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
7664 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
7665 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
7666 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
7667 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
7668 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
7669 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
7670 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
7671 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
7672 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
7673 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
7674 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
7676 /* PARSE_FRIENDLY tests. */
7677 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
7678 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
7680 /* PARSE_ROOTDOCUMENT tests. */
7681 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
7682 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
7683 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7684 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7685 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7686 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7688 /* PARSE_DOCUMENT tests. */
7689 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
7690 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7691 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7692 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7693 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7694 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7696 /* PARSE_PATH_FROM_URL tests. */
7697 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
7698 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
7699 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
7700 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
7701 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
7702 {"file:/c:/dir/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\dir\\test.mp3",S_OK},
7703 {"file:/c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK},
7704 {"file://c:\\test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK},
7706 /* PARSE_URL_FROM_PATH tests. */
7707 /* This function almost seems to useless (just returns the absolute uri). */
7708 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
7709 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
7710 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
7711 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7712 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7714 /* PARSE_SCHEMA tests. */
7715 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
7716 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
7718 /* PARSE_SITE tests. */
7719 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
7720 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
7721 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7722 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7724 /* PARSE_DOMAIN tests. */
7725 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE,"com.uk"},
7726 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7727 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7728 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7730 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7731 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7732 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7733 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7734 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7737 static inline LPWSTR a2w(LPCSTR str) {
7738 LPWSTR ret = NULL;
7740 if(str) {
7741 DWORD len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
7742 ret = malloc(len * sizeof(WCHAR));
7743 MultiByteToWideChar(CP_UTF8, 0, str, -1, ret, len);
7746 return ret;
7749 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7750 LPWSTR strAW = a2w(strA);
7751 DWORD ret = lstrcmpW(strAW, strB);
7752 free(strAW);
7753 return ret;
7756 static inline ULONG get_refcnt(IUri *uri) {
7757 IUri_AddRef(uri);
7758 return IUri_Release(uri);
7761 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7762 DWORD test_index) {
7763 HRESULT hr;
7764 LPWSTR valueW;
7766 valueW = a2w(prop->value);
7767 switch(prop->property) {
7768 case Uri_PROPERTY_FRAGMENT:
7769 hr = IUriBuilder_SetFragment(builder, valueW);
7770 todo_wine_if(prop->todo) {
7771 ok(hr == prop->expected,
7772 "Error: IUriBuilder_SetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
7773 hr, prop->expected, test_index);
7775 break;
7776 case Uri_PROPERTY_HOST:
7777 hr = IUriBuilder_SetHost(builder, valueW);
7778 todo_wine_if(prop->todo) {
7779 ok(hr == prop->expected,
7780 "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
7781 hr, prop->expected, test_index);
7783 break;
7784 case Uri_PROPERTY_PASSWORD:
7785 hr = IUriBuilder_SetPassword(builder, valueW);
7786 todo_wine_if(prop->todo) {
7787 ok(hr == prop->expected,
7788 "Error: IUriBuilder_SetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
7789 hr, prop->expected, test_index);
7791 break;
7792 case Uri_PROPERTY_PATH:
7793 hr = IUriBuilder_SetPath(builder, valueW);
7794 todo_wine_if(prop->todo) {
7795 ok(hr == prop->expected,
7796 "Error: IUriBuilder_SetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
7797 hr, prop->expected, test_index);
7799 break;
7800 case Uri_PROPERTY_QUERY:
7801 hr = IUriBuilder_SetQuery(builder, valueW);
7802 todo_wine_if(prop->todo) {
7803 ok(hr == prop->expected,
7804 "Error: IUriBuilder_SetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
7805 hr, prop->expected, test_index);
7807 break;
7808 case Uri_PROPERTY_SCHEME_NAME:
7809 hr = IUriBuilder_SetSchemeName(builder, valueW);
7810 todo_wine_if(prop->todo) {
7811 ok(hr == prop->expected,
7812 "Error: IUriBuilder_SetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
7813 hr, prop->expected, test_index);
7815 break;
7816 case Uri_PROPERTY_USER_NAME:
7817 hr = IUriBuilder_SetUserName(builder, valueW);
7818 todo_wine_if(prop->todo) {
7819 ok(hr == prop->expected,
7820 "Error: IUriBuilder_SetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
7821 hr, prop->expected, test_index);
7823 break;
7824 default:
7825 trace("Unsupported operation for %d on uri_builder_tests[%ld].\n", prop->property, test_index);
7828 free(valueW);
7832 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7833 * correctly.
7835 static void test_CreateUri_InvalidFlags(void) {
7836 DWORD i;
7838 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
7839 HRESULT hr;
7840 IUri *uri = (void*) 0xdeadbeef;
7842 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7843 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx, flags=0x%08lx\n",
7844 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7845 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7849 static void test_CreateUri_InvalidArgs(void) {
7850 HRESULT hr;
7851 IUri *uri = (void*) 0xdeadbeef;
7853 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7854 static const WCHAR emptyW[] = {0};
7856 hr = pCreateUri(http_urlW, 0, 0, NULL);
7857 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx\n", hr, E_INVALIDARG);
7859 hr = pCreateUri(NULL, 0, 0, &uri);
7860 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx\n", hr, E_INVALIDARG);
7861 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7863 uri = (void*) 0xdeadbeef;
7864 hr = pCreateUri(invalidW, 0, 0, &uri);
7865 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
7866 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7868 uri = (void*) 0xdeadbeef;
7869 hr = pCreateUri(emptyW, 0, 0, &uri);
7870 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
7871 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7874 static void test_CreateUri_InvalidUri(void) {
7875 DWORD i;
7877 for(i = 0; i < ARRAY_SIZE(invalid_uri_tests); ++i) {
7878 invalid_uri test = invalid_uri_tests[i];
7879 IUri *uri = NULL;
7880 LPWSTR uriW;
7881 HRESULT hr;
7883 uriW = a2w(test.uri);
7884 hr = pCreateUri(uriW, test.flags, 0, &uri);
7885 todo_wine_if(test.todo)
7886 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on invalid_uri_tests[%ld].\n",
7887 hr, E_INVALIDARG, i);
7888 if(uri) IUri_Release(uri);
7890 free(uriW);
7894 static void test_IUri_GetPropertyBSTR(void) {
7895 IUri *uri = NULL;
7896 HRESULT hr;
7897 DWORD i;
7899 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7900 hr = pCreateUri(http_urlW, 0, 0, &uri);
7901 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
7902 if(SUCCEEDED(hr)) {
7903 BSTR received = NULL;
7905 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7906 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
7908 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7909 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7910 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08lx, expected E_INVALIDARG or S_OK.\n", hr);
7911 if(SUCCEEDED(hr)) {
7912 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7913 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7914 SysFreeString(received);
7915 }else {
7916 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7919 /* Make sure it handles the ZONE property correctly. */
7920 received = NULL;
7921 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7922 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08lx, expected 0x%08lx.\n", hr, S_FALSE);
7923 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7924 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7925 SysFreeString(received);
7927 if(uri) IUri_Release(uri);
7929 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
7930 uri_properties test = uri_tests[i];
7931 LPWSTR uriW;
7932 uri = NULL;
7934 uriW = a2w(test.uri);
7935 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7936 todo_wine_if(test.create_todo)
7937 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx. Failed on uri_tests[%ld].\n",
7938 hr, test.create_expected, i);
7940 if(SUCCEEDED(hr)) {
7941 DWORD j;
7943 /* Checks all the string properties of the uri. */
7944 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7945 BSTR received = NULL;
7946 uri_str_property prop = test.str_props[j];
7948 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7949 todo_wine_if(prop.todo) {
7950 ok(hr == prop.expected ||
7951 (prop.value2 && hr == prop.expected2),
7952 "GetPropertyBSTR returned 0x%08lx, expected 0x%08lx. On uri_tests[%ld].str_props[%ld].\n",
7953 hr, prop.expected, i, j);
7954 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)) ||
7955 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7956 "Expected %s but got %s on uri_tests[%ld].str_props[%ld].\n",
7957 prop.value, wine_dbgstr_w(received), i, j);
7960 SysFreeString(received);
7964 if(uri) IUri_Release(uri);
7966 free(uriW);
7970 static void test_IUri_GetPropertyDWORD(void) {
7971 IUri *uri = NULL;
7972 HRESULT hr;
7973 DWORD i;
7975 hr = pCreateUri(http_urlW, 0, 0, &uri);
7976 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
7977 if(SUCCEEDED(hr)) {
7978 DWORD received = 0xdeadbeef;
7980 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7981 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
7983 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7984 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
7985 ok(received == 0, "Error: Expected received=%d but instead received=%ld.\n", 0, received);
7987 if(uri) IUri_Release(uri);
7989 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
7990 uri_properties test = uri_tests[i];
7991 LPWSTR uriW;
7992 uri = NULL;
7994 uriW = a2w(test.uri);
7995 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7996 todo_wine_if(test.create_todo)
7997 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx. Failed on uri_tests[%ld].\n",
7998 hr, test.create_expected, i);
8000 if(SUCCEEDED(hr)) {
8001 DWORD j;
8003 /* Checks all the DWORD properties of the uri. */
8004 for(j = 0; j < ARRAY_SIZE(test.dword_props); ++j) {
8005 DWORD received;
8006 uri_dword_property prop = test.dword_props[j];
8008 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
8009 todo_wine_if(prop.todo) {
8010 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08lx, expected 0x%08lx. On uri_tests[%ld].dword_props[%ld].\n",
8011 hr, prop.expected, i, j);
8012 ok(prop.value == received, "Expected %ld but got %ld on uri_tests[%ld].dword_props[%ld].\n",
8013 prop.value, received, i, j);
8018 if(uri) IUri_Release(uri);
8020 free(uriW);
8024 /* Tests all the 'Get*' property functions which deal with strings. */
8025 static void test_IUri_GetStrProperties(void) {
8026 IUri *uri = NULL;
8027 HRESULT hr;
8028 DWORD i;
8030 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
8031 hr = pCreateUri(http_urlW, 0, 0, &uri);
8032 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8033 if(SUCCEEDED(hr)) {
8034 hr = IUri_GetAbsoluteUri(uri, NULL);
8035 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8037 hr = IUri_GetAuthority(uri, NULL);
8038 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8040 hr = IUri_GetDisplayUri(uri, NULL);
8041 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8043 hr = IUri_GetDomain(uri, NULL);
8044 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8046 hr = IUri_GetExtension(uri, NULL);
8047 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8049 hr = IUri_GetFragment(uri, NULL);
8050 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8052 hr = IUri_GetHost(uri, NULL);
8053 ok(hr == E_POINTER, "Error: GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8055 hr = IUri_GetPassword(uri, NULL);
8056 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8058 hr = IUri_GetPath(uri, NULL);
8059 ok(hr == E_POINTER, "Error: GetPath returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8061 hr = IUri_GetPathAndQuery(uri, NULL);
8062 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8064 hr = IUri_GetQuery(uri, NULL);
8065 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8067 hr = IUri_GetRawUri(uri, NULL);
8068 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8070 hr = IUri_GetSchemeName(uri, NULL);
8071 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8073 hr = IUri_GetUserInfo(uri, NULL);
8074 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8076 hr = IUri_GetUserName(uri, NULL);
8077 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
8079 if(uri) IUri_Release(uri);
8081 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8082 uri_properties test = uri_tests[i];
8083 LPWSTR uriW;
8084 uri = NULL;
8086 uriW = a2w(test.uri);
8087 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8088 todo_wine_if(test.create_todo)
8089 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8090 hr, test.create_expected, i);
8092 if(SUCCEEDED(hr)) {
8093 uri_str_property prop;
8094 BSTR received = NULL;
8096 /* GetAbsoluteUri() tests. */
8097 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
8098 hr = IUri_GetAbsoluteUri(uri, &received);
8099 todo_wine_if(prop.todo) {
8100 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8101 hr, prop.expected, i);
8102 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
8103 "Error: Expected %s but got %s on uri_tests[%ld].\n",
8104 prop.value, wine_dbgstr_w(received), i);
8106 SysFreeString(received);
8107 received = NULL;
8109 /* GetAuthority() tests. */
8110 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
8111 hr = IUri_GetAuthority(uri, &received);
8112 todo_wine_if(prop.todo) {
8113 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8114 hr, prop.expected, i);
8115 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8116 prop.value, wine_dbgstr_w(received), i);
8118 SysFreeString(received);
8119 received = NULL;
8121 /* GetDisplayUri() tests. */
8122 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
8123 hr = IUri_GetDisplayUri(uri, &received);
8124 todo_wine_if(prop.todo) {
8125 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8126 hr, prop.expected, i);
8127 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
8128 "Error: Expected %s but got %s on uri_tests[%ld].\n",
8129 prop.value, wine_dbgstr_w(received), i);
8131 SysFreeString(received);
8132 received = NULL;
8134 /* GetDomain() tests. */
8135 prop = test.str_props[Uri_PROPERTY_DOMAIN];
8136 hr = IUri_GetDomain(uri, &received);
8137 todo_wine_if(prop.todo) {
8138 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8139 "Error: GetDomain returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8140 hr, prop.expected, i);
8141 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)),
8142 "Error: Expected %s but got %s on uri_tests[%ld].\n",
8143 prop.value, wine_dbgstr_w(received), i);
8145 SysFreeString(received);
8146 received = NULL;
8148 /* GetExtension() tests. */
8149 prop = test.str_props[Uri_PROPERTY_EXTENSION];
8150 hr = IUri_GetExtension(uri, &received);
8151 todo_wine_if(prop.todo) {
8152 ok(hr == prop.expected, "Error: GetExtension returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8153 hr, prop.expected, i);
8154 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8155 prop.value, wine_dbgstr_w(received), i);
8157 SysFreeString(received);
8158 received = NULL;
8160 /* GetFragment() tests. */
8161 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
8162 hr = IUri_GetFragment(uri, &received);
8163 todo_wine_if(prop.todo) {
8164 ok(hr == prop.expected, "Error: GetFragment returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8165 hr, prop.expected, i);
8166 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8167 prop.value, wine_dbgstr_w(received), i);
8169 SysFreeString(received);
8170 received = NULL;
8172 /* GetHost() tests. */
8173 prop = test.str_props[Uri_PROPERTY_HOST];
8174 hr = IUri_GetHost(uri, &received);
8175 todo_wine_if(prop.todo) {
8176 ok(hr == prop.expected, "Error: GetHost returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8177 hr, prop.expected, i);
8178 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8179 prop.value, wine_dbgstr_w(received), i);
8181 SysFreeString(received);
8182 received = NULL;
8184 /* GetPassword() tests. */
8185 prop = test.str_props[Uri_PROPERTY_PASSWORD];
8186 hr = IUri_GetPassword(uri, &received);
8187 todo_wine_if(prop.todo) {
8188 ok(hr == prop.expected, "Error: GetPassword returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8189 hr, prop.expected, i);
8190 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8191 prop.value, wine_dbgstr_w(received), i);
8193 SysFreeString(received);
8194 received = NULL;
8196 /* GetPath() tests. */
8197 prop = test.str_props[Uri_PROPERTY_PATH];
8198 hr = IUri_GetPath(uri, &received);
8199 todo_wine_if(prop.todo) {
8200 ok(hr == prop.expected, "Error: GetPath returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8201 hr, prop.expected, i);
8202 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8203 prop.value, wine_dbgstr_w(received), i);
8205 SysFreeString(received);
8206 received = NULL;
8208 /* GetPathAndQuery() tests. */
8209 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
8210 hr = IUri_GetPathAndQuery(uri, &received);
8211 todo_wine_if(prop.todo) {
8212 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8213 hr, prop.expected, i);
8214 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8215 prop.value, wine_dbgstr_w(received), i);
8217 SysFreeString(received);
8218 received = NULL;
8220 /* GetQuery() tests. */
8221 prop = test.str_props[Uri_PROPERTY_QUERY];
8222 hr = IUri_GetQuery(uri, &received);
8223 todo_wine_if(prop.todo) {
8224 ok(hr == prop.expected, "Error: GetQuery returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8225 hr, prop.expected, i);
8226 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8227 prop.value, wine_dbgstr_w(received), i);
8229 SysFreeString(received);
8230 received = NULL;
8232 /* GetRawUri() tests. */
8233 prop = test.str_props[Uri_PROPERTY_RAW_URI];
8234 hr = IUri_GetRawUri(uri, &received);
8235 todo_wine_if(prop.todo) {
8236 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8237 hr, prop.expected, i);
8238 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8239 prop.value, wine_dbgstr_w(received), i);
8241 SysFreeString(received);
8242 received = NULL;
8244 /* GetSchemeName() tests. */
8245 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
8246 hr = IUri_GetSchemeName(uri, &received);
8247 todo_wine_if(prop.todo) {
8248 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8249 hr, prop.expected, i);
8250 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8251 prop.value, wine_dbgstr_w(received), i);
8253 SysFreeString(received);
8254 received = NULL;
8256 /* GetUserInfo() tests. */
8257 prop = test.str_props[Uri_PROPERTY_USER_INFO];
8258 hr = IUri_GetUserInfo(uri, &received);
8259 todo_wine_if(prop.todo) {
8260 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8261 hr, prop.expected, i);
8262 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8263 prop.value, wine_dbgstr_w(received), i);
8265 SysFreeString(received);
8266 received = NULL;
8268 /* GetUserName() tests. */
8269 prop = test.str_props[Uri_PROPERTY_USER_NAME];
8270 hr = IUri_GetUserName(uri, &received);
8271 todo_wine_if(prop.todo) {
8272 ok(hr == prop.expected, "Error: GetUserName returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8273 hr, prop.expected, i);
8274 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%ld].\n",
8275 prop.value, wine_dbgstr_w(received), i);
8277 SysFreeString(received);
8280 if(uri) IUri_Release(uri);
8282 free(uriW);
8286 static void test_IUri_GetDwordProperties(void) {
8287 IUri *uri = NULL;
8288 HRESULT hr;
8289 DWORD i;
8291 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8292 hr = pCreateUri(http_urlW, 0, 0, &uri);
8293 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8294 if(SUCCEEDED(hr)) {
8295 hr = IUri_GetHostType(uri, NULL);
8296 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8298 hr = IUri_GetPort(uri, NULL);
8299 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8301 hr = IUri_GetScheme(uri, NULL);
8302 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8304 hr = IUri_GetZone(uri, NULL);
8305 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8307 if(uri) IUri_Release(uri);
8309 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8310 uri_properties test = uri_tests[i];
8311 LPWSTR uriW;
8312 uri = NULL;
8314 uriW = a2w(test.uri);
8315 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8316 todo_wine_if(test.create_todo)
8317 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8318 hr, test.create_expected, i);
8320 if(SUCCEEDED(hr)) {
8321 uri_dword_property prop;
8322 DWORD received;
8324 /* Assign an insane value so tests don't accidentally pass when
8325 * they shouldn't!
8327 received = -9999999;
8329 /* GetHostType() tests. */
8330 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8331 hr = IUri_GetHostType(uri, &received);
8332 todo_wine_if(prop.todo) {
8333 ok(hr == prop.expected, "Error: GetHostType returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8334 hr, prop.expected, i);
8335 ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
8337 received = -9999999;
8339 /* GetPort() tests. */
8340 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8341 hr = IUri_GetPort(uri, &received);
8342 todo_wine_if(prop.todo) {
8343 ok(hr == prop.expected, "Error: GetPort returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8344 hr, prop.expected, i);
8345 ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
8347 received = -9999999;
8349 /* GetScheme() tests. */
8350 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8351 hr = IUri_GetScheme(uri, &received);
8352 todo_wine_if(prop.todo) {
8353 ok(hr == prop.expected, "Error: GetScheme returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8354 hr, prop.expected, i);
8355 ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
8357 received = -9999999;
8359 /* GetZone() tests. */
8360 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8361 hr = IUri_GetZone(uri, &received);
8362 todo_wine_if(prop.todo) {
8363 ok(hr == prop.expected, "Error: GetZone returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].\n",
8364 hr, prop.expected, i);
8365 ok(received == prop.value, "Error: Expected %ld but got %ld on uri_tests[%ld].\n", prop.value, received, i);
8369 if(uri) IUri_Release(uri);
8371 free(uriW);
8375 static void test_IUri_GetPropertyLength(void) {
8376 IUri *uri = NULL;
8377 HRESULT hr;
8378 DWORD i;
8380 /* Make sure it handles invalid args correctly. */
8381 hr = pCreateUri(http_urlW, 0, 0, &uri);
8382 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8383 if(SUCCEEDED(hr)) {
8384 DWORD received = 0xdeadbeef;
8386 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8387 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8389 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8390 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8391 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08lx.\n", received);
8393 if(uri) IUri_Release(uri);
8395 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8396 uri_properties test = uri_tests[i];
8397 LPWSTR uriW;
8398 uri = NULL;
8400 uriW = a2w(test.uri);
8401 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8402 todo_wine_if(test.create_todo)
8403 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_test[%ld].\n",
8404 hr, test.create_expected, i);
8406 if(SUCCEEDED(hr)) {
8407 DWORD j;
8409 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8410 DWORD expectedLen, receivedLen;
8411 uri_str_property prop = test.str_props[j];
8412 LPWSTR expectedValueW;
8414 expectedLen = lstrlenA(prop.value);
8415 /* Value may be unicode encoded */
8416 expectedValueW = a2w(prop.value);
8417 expectedLen = lstrlenW(expectedValueW);
8418 free(expectedValueW);
8420 /* This won't be necessary once GetPropertyLength is implemented. */
8421 receivedLen = -1;
8423 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8424 todo_wine_if(prop.todo) {
8425 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8426 "Error: GetPropertyLength returned 0x%08lx, expected 0x%08lx on uri_tests[%ld].str_props[%ld].\n",
8427 hr, prop.expected, i, j);
8428 ok(receivedLen == expectedLen || (prop.value2 && receivedLen == lstrlenA(prop.value2)) ||
8429 broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8430 "Error: Expected a length of %ld but got %ld on uri_tests[%ld].str_props[%ld].\n",
8431 expectedLen, receivedLen, i, j);
8436 if(uri) IUri_Release(uri);
8438 free(uriW);
8442 static DWORD compute_expected_props(uri_properties *test, DWORD *mask)
8444 DWORD ret = 0, i;
8446 *mask = 0;
8448 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8449 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8450 ret |= 1<<i;
8451 if(test->str_props[i-Uri_PROPERTY_STRING_START].value2 == NULL ||
8452 test->str_props[i-Uri_PROPERTY_STRING_START].expected ==
8453 test->str_props[i-Uri_PROPERTY_STRING_START].expected2)
8454 *mask |= 1<<i;
8457 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8458 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8459 ret |= 1<<i;
8460 *mask |= 1<<i;
8463 return ret;
8466 static void test_IUri_GetProperties(void) {
8467 IUri *uri = NULL;
8468 HRESULT hr;
8469 DWORD i;
8471 hr = pCreateUri(http_urlW, 0, 0, &uri);
8472 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8473 if(SUCCEEDED(hr)) {
8474 hr = IUri_GetProperties(uri, NULL);
8475 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8477 if(uri) IUri_Release(uri);
8479 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8480 uri_properties test = uri_tests[i];
8481 LPWSTR uriW;
8482 uri = NULL;
8484 uriW = a2w(test.uri);
8485 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8486 todo_wine_if(test.create_todo)
8487 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, test.create_expected);
8489 if(SUCCEEDED(hr)) {
8490 DWORD received = 0, expected_props, mask;
8491 DWORD j;
8493 hr = IUri_GetProperties(uri, &received);
8494 ok(hr == S_OK, "Error: GetProperties returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8496 expected_props = compute_expected_props(&test, &mask);
8498 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8499 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8500 if(mask & (1 << j)) {
8501 if(expected_props & (1 << j))
8502 ok(received & (1 << j), "Error: Expected flag for property %ld on uri_tests[%ld].\n", j, i);
8503 else
8504 ok(!(received & (1 << j)), "Error: Received flag for property %ld when not expected on uri_tests[%ld].\n", j, i);
8509 if(uri) IUri_Release(uri);
8511 free(uriW);
8515 static void test_IUri_HasProperty(void) {
8516 IUri *uri = NULL;
8517 HRESULT hr;
8518 DWORD i;
8520 hr = pCreateUri(http_urlW, 0, 0, &uri);
8521 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8522 if(SUCCEEDED(hr)) {
8523 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8524 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8526 if(uri) IUri_Release(uri);
8528 for(i = 0; i < ARRAY_SIZE(uri_tests); ++i) {
8529 uri_properties test = uri_tests[i];
8530 LPWSTR uriW;
8531 uri = NULL;
8533 uriW = a2w(test.uri);
8535 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8536 todo_wine_if(test.create_todo)
8537 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, test.create_expected);
8539 if(SUCCEEDED(hr)) {
8540 DWORD expected_props, j, mask;
8542 expected_props = compute_expected_props(&test, &mask);
8544 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8545 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8546 BOOL received = -1;
8548 hr = IUri_HasProperty(uri, j, &received);
8549 ok(hr == S_OK, "Error: HasProperty returned 0x%08lx, expected 0x%08lx for property %ld on uri_tests[%ld].\n",
8550 hr, S_OK, j, i);
8552 if(mask & (1 << j)) {
8553 if(expected_props & (1 << j)) {
8554 ok(received == TRUE, "Error: Expected to have property %ld on uri_tests[%ld].\n", j, i);
8555 } else {
8556 ok(received == FALSE, "Error: Wasn't expecting to have property %ld on uri_tests[%ld].\n", j, i);
8562 if(uri) IUri_Release(uri);
8564 free(uriW);
8568 struct custom_uri {
8569 IUri IUri_iface;
8570 IUri *uri;
8573 static inline struct custom_uri* impl_from_IUri(IUri *iface)
8575 return CONTAINING_RECORD(iface, struct custom_uri, IUri_iface);
8578 static HRESULT WINAPI custom_uri_QueryInterface(IUri *iface, REFIID iid, void **out)
8580 if (IsEqualIID(iid, &IID_IUri) || IsEqualIID(iid, &IID_IUnknown))
8582 *out = iface;
8583 IUri_AddRef(iface);
8584 return S_OK;
8587 *out = NULL;
8588 return E_NOINTERFACE;
8591 static ULONG WINAPI custom_uri_AddRef(IUri *iface)
8593 struct custom_uri *uri = impl_from_IUri(iface);
8594 return IUri_AddRef(uri->uri);
8597 static ULONG WINAPI custom_uri_Release(IUri *iface)
8599 struct custom_uri *uri = impl_from_IUri(iface);
8600 return IUri_Release(uri->uri);
8603 static HRESULT WINAPI custom_uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY property, BSTR *value, DWORD flags)
8605 struct custom_uri *uri = impl_from_IUri(iface);
8606 return IUri_GetPropertyBSTR(uri->uri, property, value, flags);
8609 static HRESULT WINAPI custom_uri_GetPropertyLength(IUri *iface, Uri_PROPERTY property, DWORD *length, DWORD flags)
8611 struct custom_uri *uri = impl_from_IUri(iface);
8612 return IUri_GetPropertyLength(uri->uri, property, length, flags);
8615 static HRESULT WINAPI custom_uri_GetPropertyDWORD(IUri *iface, Uri_PROPERTY property, DWORD *value, DWORD flags)
8617 struct custom_uri *uri = impl_from_IUri(iface);
8618 return IUri_GetPropertyDWORD(uri->uri, property, value, flags);
8621 static HRESULT WINAPI custom_uri_HasProperty(IUri *iface, Uri_PROPERTY property, BOOL *has_property)
8623 struct custom_uri *uri = impl_from_IUri(iface);
8624 return IUri_HasProperty(uri->uri, property, has_property);
8627 static HRESULT WINAPI custom_uri_GetAbsoluteUri(IUri *iface, BSTR *value)
8629 struct custom_uri *uri = impl_from_IUri(iface);
8630 return IUri_GetAbsoluteUri(uri->uri, value);
8633 static HRESULT WINAPI custom_uri_GetAuthority(IUri *iface, BSTR *value)
8635 struct custom_uri *uri = impl_from_IUri(iface);
8636 return IUri_GetAbsoluteUri(uri->uri, value);
8639 static HRESULT WINAPI custom_uri_GetDisplayUri(IUri *iface, BSTR *value)
8641 struct custom_uri *uri = impl_from_IUri(iface);
8642 return IUri_GetAbsoluteUri(uri->uri, value);
8645 static HRESULT WINAPI custom_uri_GetDomain(IUri *iface, BSTR *value)
8647 struct custom_uri *uri = impl_from_IUri(iface);
8648 return IUri_GetAbsoluteUri(uri->uri, value);
8651 static HRESULT WINAPI custom_uri_GetExtension(IUri *iface, BSTR *value)
8653 struct custom_uri *uri = impl_from_IUri(iface);
8654 return IUri_GetAbsoluteUri(uri->uri, value);
8657 static HRESULT WINAPI custom_uri_GetFragment(IUri *iface, BSTR *value)
8659 struct custom_uri *uri = impl_from_IUri(iface);
8660 return IUri_GetAbsoluteUri(uri->uri, value);
8663 static HRESULT WINAPI custom_uri_GetHost(IUri *iface, BSTR *value)
8665 struct custom_uri *uri = impl_from_IUri(iface);
8666 return IUri_GetAbsoluteUri(uri->uri, value);
8669 static HRESULT WINAPI custom_uri_GetPassword(IUri *iface, BSTR *value)
8671 struct custom_uri *uri = impl_from_IUri(iface);
8672 return IUri_GetAbsoluteUri(uri->uri, value);
8675 static HRESULT WINAPI custom_uri_GetPath(IUri *iface, BSTR *value)
8677 struct custom_uri *uri = impl_from_IUri(iface);
8678 return IUri_GetAbsoluteUri(uri->uri, value);
8681 static HRESULT WINAPI custom_uri_GetPathAndQuery(IUri *iface, BSTR *value)
8683 struct custom_uri *uri = impl_from_IUri(iface);
8684 return IUri_GetAbsoluteUri(uri->uri, value);
8687 static HRESULT WINAPI custom_uri_GetQuery(IUri *iface, BSTR *value)
8689 struct custom_uri *uri = impl_from_IUri(iface);
8690 return IUri_GetAbsoluteUri(uri->uri, value);
8693 static HRESULT WINAPI custom_uri_GetRawUri(IUri *iface, BSTR *value)
8695 struct custom_uri *uri = impl_from_IUri(iface);
8696 return IUri_GetAbsoluteUri(uri->uri, value);
8699 static HRESULT WINAPI custom_uri_GetSchemeName(IUri *iface, BSTR *value)
8701 struct custom_uri *uri = impl_from_IUri(iface);
8702 return IUri_GetSchemeName(uri->uri, value);
8705 static HRESULT WINAPI custom_uri_GetUserInfo(IUri *iface, BSTR *value)
8707 struct custom_uri *uri = impl_from_IUri(iface);
8708 return IUri_GetUserInfo(uri->uri, value);
8711 static HRESULT WINAPI custom_uri_GetUserName(IUri *iface, BSTR *value)
8713 struct custom_uri *uri = impl_from_IUri(iface);
8714 return IUri_GetUserName(uri->uri, value);
8717 static HRESULT WINAPI custom_uri_GetHostType(IUri *iface, DWORD *value)
8719 struct custom_uri *uri = impl_from_IUri(iface);
8720 return IUri_GetHostType(uri->uri, value);
8723 static HRESULT WINAPI custom_uri_GetPort(IUri *iface, DWORD *value)
8725 struct custom_uri *uri = impl_from_IUri(iface);
8726 return IUri_GetPort(uri->uri, value);
8729 static HRESULT WINAPI custom_uri_GetScheme(IUri *iface, DWORD *value)
8731 struct custom_uri *uri = impl_from_IUri(iface);
8732 return IUri_GetScheme(uri->uri, value);
8735 static HRESULT WINAPI custom_uri_GetZone(IUri *iface, DWORD *value)
8737 struct custom_uri *uri = impl_from_IUri(iface);
8738 return IUri_GetZone(uri->uri, value);
8741 static HRESULT WINAPI custom_uri_GetProperties(IUri *iface, DWORD *flags)
8743 struct custom_uri *uri = impl_from_IUri(iface);
8744 return IUri_GetProperties(uri->uri, flags);
8747 static HRESULT WINAPI custom_uri_IsEqual(IUri *iface, IUri *pUri, BOOL *is_equal)
8749 struct custom_uri *uri = impl_from_IUri(iface);
8750 return IUri_IsEqual(uri->uri, pUri, is_equal);
8753 static const IUriVtbl custom_uri_vtbl =
8755 custom_uri_QueryInterface,
8756 custom_uri_AddRef,
8757 custom_uri_Release,
8758 custom_uri_GetPropertyBSTR,
8759 custom_uri_GetPropertyLength,
8760 custom_uri_GetPropertyDWORD,
8761 custom_uri_HasProperty,
8762 custom_uri_GetAbsoluteUri,
8763 custom_uri_GetAuthority,
8764 custom_uri_GetDisplayUri,
8765 custom_uri_GetDomain,
8766 custom_uri_GetExtension,
8767 custom_uri_GetFragment,
8768 custom_uri_GetHost,
8769 custom_uri_GetPassword,
8770 custom_uri_GetPath,
8771 custom_uri_GetPathAndQuery,
8772 custom_uri_GetQuery,
8773 custom_uri_GetRawUri,
8774 custom_uri_GetSchemeName,
8775 custom_uri_GetUserInfo,
8776 custom_uri_GetUserName,
8777 custom_uri_GetHostType,
8778 custom_uri_GetPort,
8779 custom_uri_GetScheme,
8780 custom_uri_GetZone,
8781 custom_uri_GetProperties,
8782 custom_uri_IsEqual,
8785 static void test_IUri_IsEqual(void) {
8786 struct custom_uri custom_uri;
8787 IUri *uriA, *uriB;
8788 BOOL equal;
8789 HRESULT hres;
8790 DWORD i;
8792 uriA = uriB = NULL;
8794 /* Make sure IsEqual handles invalid args correctly. */
8795 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8796 ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
8797 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8798 ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
8800 equal = -1;
8801 hres = IUri_IsEqual(uriA, NULL, &equal);
8802 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
8803 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8805 hres = IUri_IsEqual(uriA, uriB, NULL);
8806 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, E_POINTER);
8808 equal = FALSE;
8809 hres = IUri_IsEqual(uriA, uriA, &equal);
8810 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
8811 ok(equal, "Error: Expected equal URIs.\n");
8813 equal = FALSE;
8814 hres = IUri_IsEqual(uriA, uriB, &equal);
8815 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx.\n", hres, S_OK);
8816 ok(equal, "Error: Expected equal URIs.\n");
8818 IUri_Release(uriA);
8819 IUri_Release(uriB);
8821 custom_uri.IUri_iface.lpVtbl = &custom_uri_vtbl;
8823 for(i = 0; i < ARRAY_SIZE(equality_tests); ++i) {
8824 uri_equality test = equality_tests[i];
8825 LPWSTR uriA_W, uriB_W;
8827 uriA = uriB = NULL;
8829 uriA_W = a2w(test.a);
8830 uriB_W = a2w(test.b);
8832 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8833 ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].a\n", hres, S_OK, i);
8835 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8836 ok(hres == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].b\n", hres, S_OK, i);
8838 equal = -1;
8839 hres = IUri_IsEqual(uriA, uriB, &equal);
8840 todo_wine_if(test.todo) {
8841 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].\n", hres, S_OK, i);
8842 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%ld].\n", test.equal, i);
8845 custom_uri.uri = uriB;
8847 equal = -1;
8848 hres = IUri_IsEqual(uriA, &custom_uri.IUri_iface, &equal);
8849 todo_wine {
8850 ok(hres == S_OK, "Error: IsEqual returned 0x%08lx, expected 0x%08lx on equality_tests[%ld].\n", hres, S_OK, i);
8851 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%ld].\n", test.equal, i);
8854 if(uriA) IUri_Release(uriA);
8855 if(uriB) IUri_Release(uriB);
8857 free(uriA_W);
8858 free(uriB_W);
8862 static void test_CreateUriWithFragment_InvalidArgs(void) {
8863 HRESULT hr;
8864 IUri *uri = (void*) 0xdeadbeef;
8865 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8867 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8868 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8869 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8871 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8872 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8874 /* Original URI can't already contain a fragment component. */
8875 uri = (void*) 0xdeadbeef;
8876 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8877 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
8878 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8881 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8882 static void test_CreateUriWithFragment_InvalidFlags(void) {
8883 DWORD i;
8885 for(i = 0; i < ARRAY_SIZE(invalid_flag_tests); ++i) {
8886 HRESULT hr;
8887 IUri *uri = (void*) 0xdeadbeef;
8889 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8890 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx. flags=0x%08lx.\n",
8891 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8892 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8896 static void test_CreateUriWithFragment(void) {
8897 DWORD i;
8899 for(i = 0; i < ARRAY_SIZE(uri_fragment_tests); ++i) {
8900 HRESULT hr;
8901 IUri *uri = NULL;
8902 LPWSTR uriW, fragW;
8903 uri_with_fragment test = uri_fragment_tests[i];
8905 uriW = a2w(test.uri);
8906 fragW = a2w(test.fragment);
8908 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8909 todo_wine_if(test.expected_todo)
8910 ok(hr == test.create_expected,
8911 "Error: CreateUriWithFragment returned 0x%08lx, expected 0x%08lx on uri_fragment_tests[%ld].\n",
8912 hr, test.create_expected, i);
8914 if(SUCCEEDED(hr)) {
8915 BSTR received = NULL;
8917 hr = IUri_GetAbsoluteUri(uri, &received);
8918 todo_wine_if(test.expected_todo) {
8919 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08lx, expected 0x%08lx on uri_fragment_tests[%ld].\n",
8920 hr, S_OK, i);
8921 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%ld].\n",
8922 test.expected_uri, wine_dbgstr_w(received), i);
8925 SysFreeString(received);
8928 if(uri) IUri_Release(uri);
8929 free(uriW);
8930 free(fragW);
8934 static void test_CreateIUriBuilder(void) {
8935 HRESULT hr;
8936 IUriBuilder *builder = NULL;
8937 IUri *uri;
8939 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8940 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx\n",
8941 hr, E_POINTER);
8943 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8944 hr = pCreateUri(http_urlW, 0, 0, &uri);
8945 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8946 if(SUCCEEDED(hr)) {
8947 ULONG cur_count, orig_count;
8949 orig_count = get_refcnt(uri);
8950 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8951 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
8952 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8954 cur_count = get_refcnt(uri);
8955 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %lu, but was %lu instead.\n", orig_count+1, cur_count);
8957 if(builder) IUriBuilder_Release(builder);
8958 cur_count = get_refcnt(uri);
8959 ok(cur_count == orig_count, "Error: Expected the ref count to be %lu, but was %lu instead.\n", orig_count, cur_count);
8961 if(uri) IUri_Release(uri);
8964 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8965 DWORD test_index) {
8966 HRESULT hr;
8967 IUri *uri = NULL;
8969 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8970 todo_wine_if(test->uri_todo)
8971 ok(hr == test->uri_hres,
8972 "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
8973 hr, test->uri_hres, test_index);
8975 if(SUCCEEDED(hr)) {
8976 DWORD i;
8978 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
8979 uri_builder_str_property prop = test->expected_str_props[i];
8980 BSTR received = NULL;
8982 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8983 todo_wine_if(prop.todo)
8984 ok(hr == prop.result,
8985 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
8986 hr, prop.result, test_index, i);
8987 if(SUCCEEDED(hr)) {
8988 todo_wine_if(prop.todo)
8989 ok(!strcmp_aw(prop.expected, received),
8990 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
8991 prop.expected, wine_dbgstr_w(received), test_index, i);
8993 SysFreeString(received);
8996 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
8997 uri_builder_dword_property prop = test->expected_dword_props[i];
8998 DWORD received = -2;
9000 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9001 todo_wine_if(prop.todo)
9002 ok(hr == prop.result,
9003 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9004 hr, prop.result, test_index, i);
9005 if(SUCCEEDED(hr)) {
9006 todo_wine_if(prop.todo)
9007 ok(received == prop.expected,
9008 "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9009 prop.expected, received, test_index, i);
9013 if(uri) IUri_Release(uri);
9016 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
9017 DWORD test_index) {
9018 HRESULT hr;
9019 IUri *uri = NULL;
9021 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
9022 todo_wine_if(test->uri_simple_todo)
9023 ok(hr == test->uri_simple_hres,
9024 "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9025 hr, test->uri_simple_hres, test_index);
9027 if(SUCCEEDED(hr)) {
9028 DWORD i;
9030 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
9031 uri_builder_str_property prop = test->expected_str_props[i];
9032 BSTR received = NULL;
9034 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
9035 todo_wine_if(prop.todo)
9036 ok(hr == prop.result,
9037 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9038 hr, prop.result, test_index, i);
9039 if(SUCCEEDED(hr)) {
9040 todo_wine_if(prop.todo)
9041 ok(!strcmp_aw(prop.expected, received),
9042 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9043 prop.expected, wine_dbgstr_w(received), test_index, i);
9045 SysFreeString(received);
9048 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9049 uri_builder_dword_property prop = test->expected_dword_props[i];
9050 DWORD received = -2;
9052 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9053 todo_wine_if(prop.todo)
9054 ok(hr == prop.result,
9055 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9056 hr, prop.result, test_index, i);
9057 if(SUCCEEDED(hr)) {
9058 todo_wine_if(prop.todo)
9059 ok(received == prop.expected,
9060 "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9061 prop.expected, received, test_index, i);
9065 if(uri) IUri_Release(uri);
9068 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
9069 DWORD test_index) {
9070 HRESULT hr;
9071 IUri *uri = NULL;
9073 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
9074 test->uri_with_encode_flags, 0, &uri);
9075 todo_wine_if(test->uri_with_todo)
9076 ok(hr == test->uri_with_hres,
9077 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9078 hr, test->uri_with_hres, test_index);
9080 if(SUCCEEDED(hr)) {
9081 DWORD i;
9083 for(i = 0; i < ARRAY_SIZE(test->expected_str_props); ++i) {
9084 uri_builder_str_property prop = test->expected_str_props[i];
9085 BSTR received = NULL;
9087 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
9088 todo_wine_if(prop.todo)
9089 ok(hr == prop.result,
9090 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9091 hr, prop.result, test_index, i);
9092 if(SUCCEEDED(hr)) {
9093 todo_wine_if(prop.todo)
9094 ok(!strcmp_aw(prop.expected, received),
9095 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].expected_str_props[%ld].\n",
9096 prop.expected, wine_dbgstr_w(received), test_index, i);
9098 SysFreeString(received);
9101 for(i = 0; i < ARRAY_SIZE(test->expected_dword_props); ++i) {
9102 uri_builder_dword_property prop = test->expected_dword_props[i];
9103 DWORD received = -2;
9105 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
9106 todo_wine_if(prop.todo)
9107 ok(hr == prop.result,
9108 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9109 hr, prop.result, test_index, i);
9110 if(SUCCEEDED(hr)) {
9111 todo_wine_if(prop.todo)
9112 ok(received == prop.expected,
9113 "Error: Expected %ld but got %ld instead on uri_builder_tests[%ld].expected_dword_props[%ld].\n",
9114 prop.expected, received, test_index, i);
9118 if(uri) IUri_Release(uri);
9121 static void test_IUriBuilder_CreateInvalidArgs(void) {
9122 IUriBuilder *builder;
9123 HRESULT hr;
9125 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9126 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9127 if(SUCCEEDED(hr)) {
9128 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
9130 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
9131 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
9132 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_POINTER);
9134 uri = (void*) 0xdeadbeef;
9135 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9136 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_NOTIMPL);
9137 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
9139 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
9140 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
9141 hr, E_POINTER);
9143 uri = (void*) 0xdeadbeef;
9144 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9145 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
9146 hr, E_NOTIMPL);
9147 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
9149 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
9150 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
9151 hr, E_POINTER);
9153 uri = (void*) 0xdeadbeef;
9154 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9155 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
9156 hr, E_NOTIMPL);
9157 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9159 hr = pCreateUri(http_urlW, 0, 0, &test);
9160 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9161 if(SUCCEEDED(hr)) {
9162 hr = IUriBuilder_SetIUri(builder, test);
9163 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9165 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
9166 uri = NULL;
9167 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9168 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9169 ok(uri != NULL, "Error: The uri was NULL.\n");
9170 if(uri) IUri_Release(uri);
9172 uri = NULL;
9173 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9174 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
9175 hr, S_OK);
9176 ok(uri != NULL, "Error: uri was NULL.\n");
9177 if(uri) IUri_Release(uri);
9179 uri = NULL;
9180 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
9181 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
9182 hr, S_OK);
9183 ok(uri != NULL, "Error: uri was NULL.\n");
9184 if(uri) IUri_Release(uri);
9186 hr = IUriBuilder_SetFragment(builder, NULL);
9187 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9189 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
9190 uri = (void*) 0xdeadbeef;
9191 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9192 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9193 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
9195 uri = (void*) 0xdeadbeef;
9196 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9197 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n",
9198 hr, S_OK);
9199 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9201 uri = (void*) 0xdeadbeef;
9202 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9203 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
9204 hr, E_NOTIMPL);
9205 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9207 if(test) IUri_Release(test);
9209 if(builder) IUriBuilder_Release(builder);
9212 /* Tests invalid args to the "Get*" functions. */
9213 static void test_IUriBuilder_GetInvalidArgs(void) {
9214 IUriBuilder *builder = NULL;
9215 HRESULT hr;
9217 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9218 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
9219 if(SUCCEEDED(hr)) {
9220 LPCWSTR received = (void*) 0xdeadbeef;
9221 DWORD len = -1, port = -1;
9222 BOOL set = -1;
9224 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
9225 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
9226 hr, E_POINTER);
9227 hr = IUriBuilder_GetFragment(builder, NULL, &received);
9228 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
9229 hr, E_POINTER);
9230 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9231 hr = IUriBuilder_GetFragment(builder, &len, NULL);
9232 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx.\n",
9233 hr, E_POINTER);
9234 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9236 hr = IUriBuilder_GetHost(builder, NULL, NULL);
9237 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
9238 hr, E_POINTER);
9239 received = (void*) 0xdeadbeef;
9240 hr = IUriBuilder_GetHost(builder, NULL, &received);
9241 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
9242 hr, E_POINTER);
9243 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9244 len = -1;
9245 hr = IUriBuilder_GetHost(builder, &len, NULL);
9246 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n",
9247 hr, E_POINTER);
9248 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9250 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
9251 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
9252 hr, E_POINTER);
9253 received = (void*) 0xdeadbeef;
9254 hr = IUriBuilder_GetPassword(builder, NULL, &received);
9255 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
9256 hr, E_POINTER);
9257 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9258 len = -1;
9259 hr = IUriBuilder_GetPassword(builder, &len, NULL);
9260 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx.\n",
9261 hr, E_POINTER);
9262 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9264 hr = IUriBuilder_GetPath(builder, NULL, NULL);
9265 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
9266 hr, E_POINTER);
9267 received = (void*) 0xdeadbeef;
9268 hr = IUriBuilder_GetPath(builder, NULL, &received);
9269 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
9270 hr, E_POINTER);
9271 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9272 len = -1;
9273 hr = IUriBuilder_GetPath(builder, &len, NULL);
9274 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx.\n",
9275 hr, E_POINTER);
9276 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9278 hr = IUriBuilder_GetPort(builder, NULL, NULL);
9279 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
9280 hr, E_POINTER);
9281 hr = IUriBuilder_GetPort(builder, NULL, &port);
9282 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
9283 hr, E_POINTER);
9284 ok(!port, "Error: Expected port to be 0, but was %ld instead.\n", port);
9285 hr = IUriBuilder_GetPort(builder, &set, NULL);
9286 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n",
9287 hr, E_POINTER);
9288 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
9290 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
9291 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
9292 hr, E_POINTER);
9293 received = (void*) 0xdeadbeef;
9294 hr = IUriBuilder_GetQuery(builder, NULL, &received);
9295 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
9296 hr, E_POINTER);
9297 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9298 len = -1;
9299 hr = IUriBuilder_GetQuery(builder, &len, NULL);
9300 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx.\n",
9301 hr, E_POINTER);
9302 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9304 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
9305 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
9306 hr, E_POINTER);
9307 received = (void*) 0xdeadbeef;
9308 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
9309 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
9310 hr, E_POINTER);
9311 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9312 len = -1;
9313 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
9314 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx.\n",
9315 hr, E_POINTER);
9316 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9318 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
9319 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
9320 hr, E_POINTER);
9321 received = (void*) 0xdeadbeef;
9322 hr = IUriBuilder_GetUserName(builder, NULL, &received);
9323 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
9324 hr, E_POINTER);
9325 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9326 len = -1;
9327 hr = IUriBuilder_GetUserName(builder, &len, NULL);
9328 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx.\n",
9329 hr, E_POINTER);
9330 ok(!len, "Error: Expected len to be 0, but was %ld instead.\n", len);
9332 if(builder) IUriBuilder_Release(builder);
9335 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
9336 DWORD test_index) {
9337 HRESULT hr;
9338 DWORD i;
9339 LPCWSTR received = NULL;
9340 DWORD len = -1;
9341 const uri_builder_property *prop = NULL;
9343 /* Check if the property was set earlier. */
9344 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9345 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
9346 prop = &(test->properties[i]);
9349 if(prop) {
9350 /* Use expected_value unless it's NULL, then use value. */
9351 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9352 DWORD expected_len = expected ? strlen(expected) : 0;
9353 hr = IUriBuilder_GetFragment(builder, &len, &received);
9354 todo_wine_if(prop->todo) {
9355 ok(hr == (expected ? S_OK : S_FALSE),
9356 "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9357 hr, (expected ? S_OK : S_FALSE), test_index);
9358 if(SUCCEEDED(hr)) {
9359 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9360 expected, wine_dbgstr_w(received), test_index);
9361 ok(expected_len == len,
9362 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9363 expected_len, len, test_index);
9366 } else {
9367 /* The property wasn't set earlier, so it should return whatever
9368 * the base IUri contains (if anything).
9370 IUri *uri = NULL;
9371 hr = IUriBuilder_GetIUri(builder, &uri);
9372 ok(hr == S_OK,
9373 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9374 hr, S_OK, test_index);
9375 if(SUCCEEDED(hr)) {
9376 if(!uri) {
9377 received = (void*) 0xdeadbeef;
9378 len = -1;
9380 hr = IUriBuilder_GetFragment(builder, &len, &received);
9381 ok(hr == S_FALSE,
9382 "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9383 hr, S_FALSE, test_index);
9384 if(SUCCEEDED(hr)) {
9385 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9386 len, test_index);
9387 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9388 received, test_index);
9390 } else {
9391 BOOL has_prop = FALSE;
9392 BSTR expected = NULL;
9394 hr = IUri_GetFragment(uri, &expected);
9395 ok(SUCCEEDED(hr),
9396 "Error: Expected IUri_GetFragment to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9397 hr, test_index);
9398 has_prop = hr == S_OK;
9400 hr = IUriBuilder_GetFragment(builder, &len, &received);
9401 if(has_prop) {
9402 ok(hr == S_OK,
9403 "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9404 hr, S_OK, test_index);
9405 if(SUCCEEDED(hr)) {
9406 ok(!lstrcmpW(expected, received),
9407 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
9408 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9409 ok(lstrlenW(expected) == len,
9410 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
9411 lstrlenW(expected), len, test_index);
9413 } else {
9414 ok(hr == S_FALSE,
9415 "Error: IUriBuilder_GetFragment returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9416 hr, S_FALSE, test_index);
9417 if(SUCCEEDED(hr)) {
9418 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
9419 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9420 len, test_index);
9423 SysFreeString(expected);
9426 if(uri) IUri_Release(uri);
9430 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
9431 DWORD test_index) {
9432 HRESULT hr;
9433 DWORD i;
9434 LPCWSTR received = NULL;
9435 DWORD len = -1;
9436 const uri_builder_property *prop = NULL;
9438 /* Check if the property was set earlier. */
9439 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9440 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
9441 prop = &(test->properties[i]);
9444 if(prop) {
9445 /* Use expected_value unless it's NULL, then use value. */
9446 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9447 DWORD expected_len = expected ? strlen(expected) : 0;
9448 hr = IUriBuilder_GetHost(builder, &len, &received);
9449 todo_wine_if(prop->todo) {
9450 ok(hr == (expected ? S_OK : S_FALSE),
9451 "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9452 hr, (expected ? S_OK : S_FALSE), test_index);
9453 if(SUCCEEDED(hr)) {
9454 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9455 expected, wine_dbgstr_w(received), test_index);
9456 ok(expected_len == len,
9457 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9458 expected_len, len, test_index);
9461 } else {
9462 /* The property wasn't set earlier, so it should return whatever
9463 * the base IUri contains (if anything).
9465 IUri *uri = NULL;
9466 hr = IUriBuilder_GetIUri(builder, &uri);
9467 ok(hr == S_OK,
9468 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9469 hr, S_OK, test_index);
9470 if(SUCCEEDED(hr)) {
9471 if(!uri) {
9472 received = (void*) 0xdeadbeef;
9473 len = -1;
9475 hr = IUriBuilder_GetHost(builder, &len, &received);
9476 ok(hr == S_FALSE,
9477 "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9478 hr, S_FALSE, test_index);
9479 if(SUCCEEDED(hr)) {
9480 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9481 len, test_index);
9482 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9483 received, test_index);
9485 } else {
9486 BOOL has_prop = FALSE;
9487 BSTR expected = NULL;
9489 hr = IUri_GetHost(uri, &expected);
9490 ok(SUCCEEDED(hr),
9491 "Error: Expected IUri_GetHost to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9492 hr, test_index);
9493 has_prop = hr == S_OK;
9495 hr = IUriBuilder_GetHost(builder, &len, &received);
9496 if(has_prop) {
9497 ok(hr == S_OK,
9498 "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9499 hr, S_OK, test_index);
9500 if(SUCCEEDED(hr)) {
9501 ok(!lstrcmpW(expected, received),
9502 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
9503 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9504 ok(lstrlenW(expected) == len,
9505 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
9506 lstrlenW(expected), len, test_index);
9508 } else {
9509 ok(hr == S_FALSE,
9510 "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9511 hr, S_FALSE, test_index);
9512 if(SUCCEEDED(hr)) {
9513 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
9514 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9515 len, test_index);
9518 SysFreeString(expected);
9521 if(uri) IUri_Release(uri);
9525 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
9526 DWORD test_index) {
9527 HRESULT hr;
9528 DWORD i;
9529 LPCWSTR received = NULL;
9530 DWORD len = -1;
9531 const uri_builder_property *prop = NULL;
9533 /* Check if the property was set earlier. */
9534 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9535 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
9536 prop = &(test->properties[i]);
9539 if(prop) {
9540 /* Use expected_value unless it's NULL, then use value. */
9541 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9542 DWORD expected_len = expected ? strlen(expected) : 0;
9543 hr = IUriBuilder_GetPassword(builder, &len, &received);
9544 todo_wine_if(prop->todo) {
9545 ok(hr == (expected ? S_OK : S_FALSE),
9546 "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9547 hr, (expected ? S_OK : S_FALSE), test_index);
9548 if(SUCCEEDED(hr)) {
9549 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9550 expected, wine_dbgstr_w(received), test_index);
9551 ok(expected_len == len,
9552 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9553 expected_len, len, test_index);
9556 } else {
9557 /* The property wasn't set earlier, so it should return whatever
9558 * the base IUri contains (if anything).
9560 IUri *uri = NULL;
9561 hr = IUriBuilder_GetIUri(builder, &uri);
9562 ok(hr == S_OK,
9563 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9564 hr, S_OK, test_index);
9565 if(SUCCEEDED(hr)) {
9566 if(!uri) {
9567 received = (void*) 0xdeadbeef;
9568 len = -1;
9570 hr = IUriBuilder_GetPassword(builder, &len, &received);
9571 ok(hr == S_FALSE,
9572 "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9573 hr, S_FALSE, test_index);
9574 if(SUCCEEDED(hr)) {
9575 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9576 len, test_index);
9577 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9578 received, test_index);
9580 } else {
9581 BOOL has_prop = FALSE;
9582 BSTR expected = NULL;
9584 hr = IUri_GetPassword(uri, &expected);
9585 ok(SUCCEEDED(hr),
9586 "Error: Expected IUri_GetPassword to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9587 hr, test_index);
9588 has_prop = hr == S_OK;
9590 hr = IUriBuilder_GetPassword(builder, &len, &received);
9591 if(has_prop) {
9592 ok(hr == S_OK,
9593 "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9594 hr, S_OK, test_index);
9595 if(SUCCEEDED(hr)) {
9596 ok(!lstrcmpW(expected, received),
9597 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
9598 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9599 ok(lstrlenW(expected) == len,
9600 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
9601 lstrlenW(expected), len, test_index);
9603 } else {
9604 ok(hr == S_FALSE,
9605 "Error: IUriBuilder_GetPassword returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9606 hr, S_FALSE, test_index);
9607 if(SUCCEEDED(hr)) {
9608 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
9609 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9610 len, test_index);
9613 SysFreeString(expected);
9616 if(uri) IUri_Release(uri);
9620 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9621 DWORD test_index) {
9622 HRESULT hr;
9623 DWORD i;
9624 LPCWSTR received = NULL;
9625 DWORD len = -1;
9626 const uri_builder_property *prop = NULL;
9628 /* Check if the property was set earlier. */
9629 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9630 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9631 prop = &(test->properties[i]);
9634 if(prop) {
9635 /* Use expected_value unless it's NULL, then use value. */
9636 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9637 DWORD expected_len = expected ? strlen(expected) : 0;
9638 hr = IUriBuilder_GetPath(builder, &len, &received);
9639 todo_wine_if(prop->todo) {
9640 ok(hr == (expected ? S_OK : S_FALSE),
9641 "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9642 hr, (expected ? S_OK : S_FALSE), test_index);
9643 if(SUCCEEDED(hr)) {
9644 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9645 expected, wine_dbgstr_w(received), test_index);
9646 ok(expected_len == len,
9647 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9648 expected_len, len, test_index);
9651 } else {
9652 /* The property wasn't set earlier, so it should return whatever
9653 * the base IUri contains (if anything).
9655 IUri *uri = NULL;
9656 hr = IUriBuilder_GetIUri(builder, &uri);
9657 ok(hr == S_OK,
9658 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9659 hr, S_OK, test_index);
9660 if(SUCCEEDED(hr)) {
9661 if(!uri) {
9662 received = (void*) 0xdeadbeef;
9663 len = -1;
9665 hr = IUriBuilder_GetPath(builder, &len, &received);
9666 ok(hr == S_FALSE,
9667 "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9668 hr, S_FALSE, test_index);
9669 if(SUCCEEDED(hr)) {
9670 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9671 len, test_index);
9672 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9673 received, test_index);
9675 } else {
9676 BOOL has_prop = FALSE;
9677 BSTR expected = NULL;
9679 hr = IUri_GetPath(uri, &expected);
9680 ok(SUCCEEDED(hr),
9681 "Error: Expected IUri_GetPath to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9682 hr, test_index);
9683 has_prop = hr == S_OK;
9685 hr = IUriBuilder_GetPath(builder, &len, &received);
9686 if(has_prop) {
9687 ok(hr == S_OK,
9688 "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9689 hr, S_OK, test_index);
9690 if(SUCCEEDED(hr)) {
9691 ok(!lstrcmpW(expected, received),
9692 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
9693 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9694 ok(lstrlenW(expected) == len,
9695 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
9696 lstrlenW(expected), len, test_index);
9698 } else {
9699 ok(hr == S_FALSE,
9700 "Error: IUriBuilder_GetPath returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9701 hr, S_FALSE, test_index);
9702 if(SUCCEEDED(hr)) {
9703 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
9704 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9705 len, test_index);
9708 SysFreeString(expected);
9711 if(uri) IUri_Release(uri);
9715 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9716 DWORD test_index) {
9717 HRESULT hr;
9718 BOOL has_port = FALSE;
9719 DWORD received = -1;
9721 if(test->port_prop.change) {
9722 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9723 todo_wine_if(test->port_prop.todo) {
9724 ok(hr == S_OK,
9725 "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9726 hr, S_OK, test_index);
9727 if(SUCCEEDED(hr)) {
9728 ok(has_port == test->port_prop.set,
9729 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%ld].\n",
9730 test->port_prop.set, has_port, test_index);
9731 ok(received == test->port_prop.value,
9732 "Error: Expected port to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9733 test->port_prop.value, received, test_index);
9736 } else {
9737 IUri *uri = NULL;
9739 hr = IUriBuilder_GetIUri(builder, &uri);
9740 ok(hr == S_OK,
9741 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9742 hr, S_OK, test_index);
9743 if(SUCCEEDED(hr)) {
9744 if(!uri) {
9745 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9746 ok(hr == S_OK,
9747 "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9748 hr, S_OK, test_index);
9749 if(SUCCEEDED(hr)) {
9750 ok(has_port == FALSE,
9751 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%ld].\n",
9752 has_port, test_index);
9753 ok(!received, "Error: Expected received to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9754 received, test_index);
9756 } else {
9757 DWORD expected;
9759 hr = IUri_GetPort(uri, &expected);
9760 ok(SUCCEEDED(hr),
9761 "Error: Expected IUri_Port to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9762 hr, test_index);
9764 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9765 ok(hr == S_OK,
9766 "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9767 hr, S_OK, test_index);
9768 if(SUCCEEDED(hr)) {
9769 ok(!has_port,
9770 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%ld].\n",
9771 test_index);
9772 ok(received == expected,
9773 "Error: Expected received to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9774 expected, received, test_index);
9778 if(uri) IUri_Release(uri);
9782 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9783 DWORD test_index) {
9784 HRESULT hr;
9785 DWORD i;
9786 LPCWSTR received = NULL;
9787 DWORD len = -1;
9788 const uri_builder_property *prop = NULL;
9790 /* Check if the property was set earlier. */
9791 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9792 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9793 prop = &(test->properties[i]);
9796 if(prop) {
9797 /* Use expected_value unless it's NULL, then use value. */
9798 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9799 DWORD expected_len = expected ? strlen(expected) : 0;
9800 hr = IUriBuilder_GetQuery(builder, &len, &received);
9801 todo_wine_if(prop->todo) {
9802 ok(hr == (expected ? S_OK : S_FALSE),
9803 "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9804 hr, (expected ? S_OK : S_FALSE), test_index);
9805 if(SUCCEEDED(hr)) {
9806 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9807 expected, wine_dbgstr_w(received), test_index);
9808 ok(expected_len == len,
9809 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9810 expected_len, len, test_index);
9813 } else {
9814 /* The property wasn't set earlier, so it should return whatever
9815 * the base IUri contains (if anything).
9817 IUri *uri = NULL;
9818 hr = IUriBuilder_GetIUri(builder, &uri);
9819 ok(hr == S_OK,
9820 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9821 hr, S_OK, test_index);
9822 if(SUCCEEDED(hr)) {
9823 if(!uri) {
9824 received = (void*) 0xdeadbeef;
9825 len = -1;
9827 hr = IUriBuilder_GetQuery(builder, &len, &received);
9828 ok(hr == S_FALSE,
9829 "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9830 hr, S_FALSE, test_index);
9831 if(SUCCEEDED(hr)) {
9832 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9833 len, test_index);
9834 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9835 received, test_index);
9837 } else {
9838 BOOL has_prop = FALSE;
9839 BSTR expected = NULL;
9841 hr = IUri_GetQuery(uri, &expected);
9842 ok(SUCCEEDED(hr),
9843 "Error: Expected IUri_GetQuery to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9844 hr, test_index);
9845 has_prop = hr == S_OK;
9847 hr = IUriBuilder_GetQuery(builder, &len, &received);
9848 if(has_prop) {
9849 ok(hr == S_OK,
9850 "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9851 hr, S_OK, test_index);
9852 if(SUCCEEDED(hr)) {
9853 ok(!lstrcmpW(expected, received),
9854 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
9855 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9856 ok(lstrlenW(expected) == len,
9857 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
9858 lstrlenW(expected), len, test_index);
9860 } else {
9861 ok(hr == S_FALSE,
9862 "Error: IUriBuilder_GetQuery returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9863 hr, S_FALSE, test_index);
9864 if(SUCCEEDED(hr)) {
9865 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
9866 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9867 len, test_index);
9870 SysFreeString(expected);
9873 if(uri) IUri_Release(uri);
9877 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9878 DWORD test_index) {
9879 HRESULT hr;
9880 DWORD i;
9881 LPCWSTR received = NULL;
9882 DWORD len = -1;
9883 const uri_builder_property *prop = NULL;
9885 /* Check if the property was set earlier. */
9886 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9887 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9888 prop = &(test->properties[i]);
9891 if(prop) {
9892 /* Use expected_value unless it's NULL, then use value. */
9893 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9894 DWORD expected_len = expected ? strlen(expected) : 0;
9895 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9896 todo_wine_if(prop->todo) {
9897 ok(hr == (expected ? S_OK : S_FALSE),
9898 "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9899 hr, (expected ? S_OK : S_FALSE), test_index);
9900 if(SUCCEEDED(hr)) {
9901 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9902 expected, wine_dbgstr_w(received), test_index);
9903 ok(expected_len == len,
9904 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
9905 expected_len, len, test_index);
9908 } else {
9909 /* The property wasn't set earlier, so it should return whatever
9910 * the base IUri contains (if anything).
9912 IUri *uri = NULL;
9913 hr = IUriBuilder_GetIUri(builder, &uri);
9914 ok(hr == S_OK,
9915 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9916 hr, S_OK, test_index);
9917 if(SUCCEEDED(hr)) {
9918 if(!uri) {
9919 received = (void*) 0xdeadbeef;
9920 len = -1;
9922 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9923 ok(hr == S_FALSE,
9924 "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9925 hr, S_FALSE, test_index);
9926 if(SUCCEEDED(hr)) {
9927 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9928 len, test_index);
9929 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
9930 received, test_index);
9932 } else {
9933 BOOL has_prop = FALSE;
9934 BSTR expected = NULL;
9936 hr = IUri_GetSchemeName(uri, &expected);
9937 ok(SUCCEEDED(hr),
9938 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
9939 hr, test_index);
9940 has_prop = hr == S_OK;
9942 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9943 if(has_prop) {
9944 ok(hr == S_OK,
9945 "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9946 hr, S_OK, test_index);
9947 if(SUCCEEDED(hr)) {
9948 ok(!lstrcmpW(expected, received),
9949 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
9950 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9951 ok(lstrlenW(expected) == len,
9952 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
9953 lstrlenW(expected), len, test_index);
9955 } else {
9956 ok(hr == S_FALSE,
9957 "Error: IUriBuilder_GetSchemeName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9958 hr, S_FALSE, test_index);
9959 if(SUCCEEDED(hr)) {
9960 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
9961 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
9962 len, test_index);
9965 SysFreeString(expected);
9968 if(uri) IUri_Release(uri);
9972 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9973 DWORD test_index) {
9974 HRESULT hr;
9975 DWORD i;
9976 LPCWSTR received = NULL;
9977 DWORD len = -1;
9978 const uri_builder_property *prop = NULL;
9980 /* Check if the property was set earlier. */
9981 for(i = 0; i < ARRAY_SIZE(test->properties); ++i) {
9982 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9983 prop = &(test->properties[i]);
9986 if(prop && prop->value && *prop->value) {
9987 /* Use expected_value unless it's NULL, then use value. */
9988 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9989 DWORD expected_len = expected ? strlen(expected) : 0;
9990 hr = IUriBuilder_GetUserName(builder, &len, &received);
9991 todo_wine_if(prop->todo) {
9992 ok(hr == (expected ? S_OK : S_FALSE),
9993 "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
9994 hr, (expected ? S_OK : S_FALSE), test_index);
9995 if(SUCCEEDED(hr)) {
9996 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%ld].\n",
9997 expected, wine_dbgstr_w(received), test_index);
9998 ok(expected_len == len,
9999 "Error: Expected the length to be %ld, but was %ld instead on uri_builder_tests[%ld].\n",
10000 expected_len, len, test_index);
10003 } else {
10004 /* The property wasn't set earlier, so it should return whatever
10005 * the base IUri contains (if anything).
10007 IUri *uri = NULL;
10008 hr = IUriBuilder_GetIUri(builder, &uri);
10009 ok(hr == S_OK,
10010 "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10011 hr, S_OK, test_index);
10012 if(SUCCEEDED(hr)) {
10013 if(!uri) {
10014 received = (void*) 0xdeadbeef;
10015 len = -1;
10017 hr = IUriBuilder_GetUserName(builder, &len, &received);
10018 ok(hr == S_FALSE,
10019 "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10020 hr, S_FALSE, test_index);
10021 if(SUCCEEDED(hr)) {
10022 ok(!len, "Error: Expected len to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10023 len, test_index);
10024 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%ld].\n",
10025 received, test_index);
10027 } else {
10028 BSTR expected = NULL;
10029 BOOL has_prop = FALSE;
10031 hr = IUri_GetUserName(uri, &expected);
10032 ok(SUCCEEDED(hr),
10033 "Error: Expected IUri_GetUserName to succeed, but got 0x%08lx instead on uri_builder_tests[%ld].\n",
10034 hr, test_index);
10035 has_prop = hr == S_OK;
10037 hr = IUriBuilder_GetUserName(builder, &len, &received);
10038 if(has_prop) {
10039 ok(hr == S_OK,
10040 "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10041 hr, S_OK, test_index);
10042 if(SUCCEEDED(hr)) {
10043 ok(!lstrcmpW(expected, received),
10044 "Error: Expected %s but got %s instead on uri_builder_tests[%ld].\n",
10045 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
10046 ok(lstrlenW(expected) == len,
10047 "Error: Expected the length to be %d, but was %ld instead on uri_builder_tests[%ld].\n",
10048 lstrlenW(expected), len, test_index);
10050 } else {
10051 ok(hr == S_FALSE,
10052 "Error: IUriBuilder_GetUserName returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10053 hr, S_FALSE, test_index);
10054 if(SUCCEEDED(hr)) {
10055 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%ld].\n", test_index);
10056 ok(!len, "Error: Expected the length to be 0, but was %ld instead on uri_builder_tests[%ld].\n",
10057 len, test_index);
10060 SysFreeString(expected);
10063 if(uri) IUri_Release(uri);
10067 /* Tests IUriBuilder functions. */
10068 static void test_IUriBuilder(void) {
10069 HRESULT hr;
10070 IUriBuilder *builder;
10071 DWORD i;
10073 for(i = 0; i < ARRAY_SIZE(uri_builder_tests); ++i) {
10074 IUri *uri = NULL;
10075 uri_builder_test test = uri_builder_tests[i];
10076 LPWSTR uriW = NULL;
10078 if(test.uri) {
10079 uriW = a2w(test.uri);
10080 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10081 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10082 hr, S_OK, i);
10083 if(FAILED(hr)) continue;
10085 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10086 todo_wine_if(test.create_builder_todo)
10087 ok(hr == test.create_builder_expected,
10088 "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10089 hr, test.create_builder_expected, i);
10090 if(SUCCEEDED(hr)) {
10091 DWORD j;
10092 BOOL modified = FALSE, received = FALSE;
10094 /* Perform all the string property changes. */
10095 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
10096 uri_builder_property prop = test.properties[j];
10097 if(prop.change) {
10098 change_property(builder, &prop, i);
10099 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
10100 prop.property != Uri_PROPERTY_HOST)
10101 modified = TRUE;
10102 else if(prop.value && *prop.value)
10103 modified = TRUE;
10104 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
10105 /* Host name property can't be NULL, but it can be empty. */
10106 modified = TRUE;
10110 if(test.port_prop.change) {
10111 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
10112 modified = TRUE;
10113 todo_wine_if(test.port_prop.todo)
10114 ok(hr == test.port_prop.expected,
10115 "Error: IUriBuilder_SetPort returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10116 hr, test.port_prop.expected, i);
10119 hr = IUriBuilder_HasBeenModified(builder, &received);
10120 ok(hr == S_OK,
10121 "Error IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx on uri_builder_tests[%ld].\n",
10122 hr, S_OK, i);
10123 if(SUCCEEDED(hr))
10124 ok(received == modified,
10125 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%ld].\n",
10126 modified, received, i);
10128 /* Test the "Get*" functions. */
10129 test_IUriBuilder_GetFragment(builder, &test, i);
10130 test_IUriBuilder_GetHost(builder, &test, i);
10131 test_IUriBuilder_GetPassword(builder, &test, i);
10132 test_IUriBuilder_GetPath(builder, &test, i);
10133 test_IUriBuilder_GetPort(builder, &test, i);
10134 test_IUriBuilder_GetQuery(builder, &test, i);
10135 test_IUriBuilder_GetSchemeName(builder, &test, i);
10136 test_IUriBuilder_GetUserName(builder, &test, i);
10138 test_IUriBuilder_CreateUri(builder, &test, i);
10139 test_IUriBuilder_CreateUriSimple(builder, &test, i);
10140 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
10142 if(builder) IUriBuilder_Release(builder);
10143 if(uri) IUri_Release(uri);
10144 free(uriW);
10148 static void test_IUriBuilder_HasBeenModified(void) {
10149 HRESULT hr;
10150 IUriBuilder *builder = NULL;
10152 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10153 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10154 if(SUCCEEDED(hr)) {
10155 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
10156 IUri *uri = NULL;
10157 BOOL received;
10159 hr = IUriBuilder_HasBeenModified(builder, NULL);
10160 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10161 hr, E_POINTER);
10163 hr = IUriBuilder_SetHost(builder, hostW);
10164 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n",
10165 hr, S_OK);
10167 hr = IUriBuilder_HasBeenModified(builder, &received);
10168 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10169 hr, S_OK);
10170 if(SUCCEEDED(hr))
10171 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10173 hr = pCreateUri(http_urlW, 0, 0, &uri);
10174 ok(hr == S_OK, "Error: CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10175 if(SUCCEEDED(hr)) {
10176 LPCWSTR prop;
10177 DWORD len = -1;
10179 hr = IUriBuilder_SetIUri(builder, uri);
10180 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n",
10181 hr, S_OK);
10183 hr = IUriBuilder_HasBeenModified(builder, &received);
10184 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10185 hr, S_OK);
10186 if(SUCCEEDED(hr))
10187 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
10189 /* Test what happens with you call SetIUri with the same IUri again. */
10190 hr = IUriBuilder_SetHost(builder, hostW);
10191 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10193 hr = IUriBuilder_HasBeenModified(builder, &received);
10194 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10195 hr, S_OK);
10196 if(SUCCEEDED(hr))
10197 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10199 hr = IUriBuilder_SetIUri(builder, uri);
10200 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10202 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
10203 * reset any of the changes that were made to the IUriBuilder.
10205 hr = IUriBuilder_HasBeenModified(builder, &received);
10206 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10207 if(SUCCEEDED(hr))
10208 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10210 hr = IUriBuilder_GetHost(builder, &len, &prop);
10211 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10212 if(SUCCEEDED(hr)) {
10213 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10214 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
10215 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %ld instead.\n",
10216 lstrlenW(hostW), len);
10219 hr = IUriBuilder_SetIUri(builder, NULL);
10220 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10222 hr = IUriBuilder_SetHost(builder, hostW);
10223 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10224 hr = IUriBuilder_HasBeenModified(builder, &received);
10225 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10226 hr, S_OK);
10227 if(SUCCEEDED(hr))
10228 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10230 hr = IUriBuilder_SetIUri(builder, NULL);
10231 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%09lx.\n", hr, S_OK);
10233 hr = IUriBuilder_HasBeenModified(builder, &received);
10234 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08lx, expected 0x%08lx.\n",
10235 hr, S_OK);
10236 if(SUCCEEDED(hr))
10237 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10239 hr = IUriBuilder_GetHost(builder, &len, &prop);
10240 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10241 if(SUCCEEDED(hr)) {
10242 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10243 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
10244 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %ld instead.\n",
10245 lstrlenW(hostW), len);
10248 if(uri) IUri_Release(uri);
10250 if(builder) IUriBuilder_Release(builder);
10253 /* Test IUriBuilder {Get,Set}IUri functions. */
10254 static void test_IUriBuilder_IUriProperty(void) {
10255 IUriBuilder *builder = NULL;
10256 HRESULT hr;
10258 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10259 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10260 if(SUCCEEDED(hr)) {
10261 IUri *uri = NULL;
10263 hr = IUriBuilder_GetIUri(builder, NULL);
10264 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08lx, expected 0x%08lx.\n",
10265 hr, E_POINTER);
10267 hr = pCreateUri(http_urlW, 0, 0, &uri);
10268 if(SUCCEEDED(hr)) {
10269 IUri *test = NULL;
10270 ULONG cur_count, orig_count;
10272 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10273 orig_count = get_refcnt(uri);
10274 hr = IUriBuilder_SetIUri(builder, uri);
10275 cur_count = get_refcnt(uri);
10276 if(SUCCEEDED(hr))
10277 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10278 orig_count+1, cur_count);
10280 hr = IUriBuilder_SetIUri(builder, NULL);
10281 cur_count = get_refcnt(uri);
10282 if(SUCCEEDED(hr))
10283 ok(cur_count == orig_count, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10284 orig_count, cur_count);
10286 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10287 hr = IUriBuilder_SetIUri(builder, uri);
10288 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10289 orig_count = get_refcnt(uri);
10291 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
10292 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10293 if(SUCCEEDED(hr)) {
10294 cur_count = get_refcnt(uri);
10295 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10296 orig_count+1, cur_count);
10297 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
10298 uri, test);
10300 if(test) IUri_Release(test);
10302 test = NULL;
10303 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
10304 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10305 if(SUCCEEDED(hr)) {
10306 cur_count = get_refcnt(uri);
10307 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10308 orig_count+1, cur_count);
10309 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10311 if(test) IUri_Release(test);
10313 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10314 * the base IUri.
10316 test = NULL;
10317 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
10318 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10319 if(SUCCEEDED(hr))
10320 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10322 if(test) IUri_Release(test);
10324 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10325 * explicitly set (because it's a default flag).
10327 test = NULL;
10328 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
10329 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10330 if(SUCCEEDED(hr)) {
10331 cur_count = get_refcnt(uri);
10332 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10333 orig_count+1, cur_count);
10334 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10336 if(test) IUri_Release(test);
10338 test = NULL;
10339 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
10340 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10341 if(SUCCEEDED(hr)) {
10342 cur_count = get_refcnt(uri);
10343 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10344 orig_count+1, cur_count);
10345 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10347 if(test) IUri_Release(test);
10349 test = NULL;
10350 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
10351 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n",
10352 hr, S_OK);
10353 if(SUCCEEDED(hr)) {
10354 cur_count = get_refcnt(uri);
10355 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10356 orig_count+1, cur_count);
10357 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10359 if(test) IUri_Release(test);
10361 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10362 * the base IUri.
10364 test = NULL;
10365 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
10366 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10367 if(SUCCEEDED(hr))
10368 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10370 if(test) IUri_Release(test);
10372 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10373 * explicitly set (because it's a default flag).
10375 test = NULL;
10376 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
10377 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10378 if(SUCCEEDED(hr)) {
10379 cur_count = get_refcnt(uri);
10380 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %ld, but was %ld instead.\n",
10381 orig_count+1, cur_count);
10382 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10384 if(test) IUri_Release(test);
10386 if(uri) IUri_Release(uri);
10388 if(builder) IUriBuilder_Release(builder);
10391 static void test_IUriBuilder_RemoveProperties(void) {
10392 IUriBuilder *builder = NULL;
10393 HRESULT hr;
10394 DWORD i;
10396 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10397 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10398 if(SUCCEEDED(hr)) {
10399 /* Properties that can't be removed. */
10400 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
10401 Uri_HAS_SCHEME|Uri_HAS_ZONE;
10403 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
10404 hr = IUriBuilder_RemoveProperties(builder, i << 1);
10405 if((i << 1) & invalid) {
10406 ok(hr == E_INVALIDARG,
10407 "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx with prop=%ld.\n",
10408 hr, E_INVALIDARG, i);
10409 } else {
10410 ok(hr == S_OK,
10411 "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx with prop=%ld.\n",
10412 hr, S_OK, i);
10416 /* Also doesn't accept anything that's outside the range of the
10417 * Uri_HAS flags.
10419 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
10420 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08lx, expected 0x%08lx.\n",
10421 hr, E_INVALIDARG);
10423 if(builder) IUriBuilder_Release(builder);
10425 for(i = 0; i < ARRAY_SIZE(uri_builder_remove_tests); ++i) {
10426 uri_builder_remove_test test = uri_builder_remove_tests[i];
10427 IUri *uri = NULL;
10428 LPWSTR uriW;
10430 uriW = a2w(test.uri);
10431 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10432 if(SUCCEEDED(hr)) {
10433 builder = NULL;
10435 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10436 todo_wine_if(test.create_builder_todo)
10437 ok(hr == test.create_builder_expected,
10438 "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx on test %ld.\n",
10439 hr, test.create_builder_expected, i);
10441 if(SUCCEEDED(hr)) {
10442 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10443 todo_wine_if(test.remove_todo)
10444 ok(hr == test.remove_expected,
10445 "Error: IUriBuilder returned 0x%08lx, expected 0x%08lx on test %ld.\n",
10446 hr, test.remove_expected, i);
10447 if(SUCCEEDED(hr)) {
10448 IUri *result = NULL;
10450 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10451 todo_wine_if(test.expected_todo)
10452 ok(hr == test.expected_hres,
10453 "Error: IUriBuilder_CreateUri returned 0x%08lx, expected 0x%08lx on test %ld.\n",
10454 hr, test.expected_hres, i);
10455 if(SUCCEEDED(hr)) {
10456 BSTR received = NULL;
10458 hr = IUri_GetAbsoluteUri(result, &received);
10459 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
10460 ok(!strcmp_aw(test.expected_uri, received),
10461 "Error: Expected %s but got %s instead on test %ld.\n",
10462 test.expected_uri, wine_dbgstr_w(received), i);
10463 SysFreeString(received);
10465 if(result) IUri_Release(result);
10468 if(builder) IUriBuilder_Release(builder);
10470 if(uri) IUri_Release(uri);
10471 free(uriW);
10475 static void test_IUriBuilder_Misc(void) {
10476 HRESULT hr;
10477 IUri *uri;
10479 hr = pCreateUri(http_urlW, 0, 0, &uri);
10480 if(SUCCEEDED(hr)) {
10481 IUriBuilder *builder;
10483 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10484 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10485 if(SUCCEEDED(hr)) {
10486 BOOL has = -1;
10487 DWORD port = -1;
10489 hr = IUriBuilder_GetPort(builder, &has, &port);
10490 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10491 if(SUCCEEDED(hr)) {
10492 /* 'has' will be set to FALSE, even though uri had a port. */
10493 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10494 /* Still sets 'port' to 80. */
10495 ok(port == 80, "Error: Expected the port to be 80, but, was %ld instead.\n", port);
10498 if(builder) IUriBuilder_Release(builder);
10500 if(uri) IUri_Release(uri);
10503 static void test_IUriBuilderFactory(void) {
10504 HRESULT hr;
10505 IUri *uri;
10506 IUriBuilderFactory *factory;
10507 IUriBuilder *builder;
10509 hr = pCreateUri(http_urlW, 0, 0, &uri);
10510 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
10511 if(SUCCEEDED(hr)) {
10512 factory = NULL;
10513 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10514 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx.\n", hr);
10515 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10517 if(SUCCEEDED(hr)) {
10518 builder = (void*) 0xdeadbeef;
10519 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10520 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10521 hr, E_INVALIDARG);
10522 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10524 builder = (void*) 0xdeadbeef;
10525 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10526 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10527 hr, E_INVALIDARG);
10528 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10530 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10531 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10532 hr, E_POINTER);
10534 builder = NULL;
10535 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10536 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10537 hr, S_OK);
10538 if(SUCCEEDED(hr)) {
10539 IUri *tmp = (void*) 0xdeadbeef;
10540 LPCWSTR result;
10541 DWORD result_len;
10543 hr = IUriBuilder_GetIUri(builder, &tmp);
10544 ok(hr == S_OK, "Error: GetIUri returned 0x%08lx, expected 0x%08lx.\n",
10545 hr, S_OK);
10546 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10548 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10549 ok(hr == S_FALSE, "Error: GetHost returned 0x%08lx, expected 0x%08lx.\n",
10550 hr, S_FALSE);
10552 if(builder) IUriBuilder_Release(builder);
10554 builder = (void*) 0xdeadbeef;
10555 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10556 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10557 hr, E_INVALIDARG);
10558 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10560 builder = (void*) 0xdeadbeef;
10561 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10562 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10563 hr, E_INVALIDARG);
10564 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10566 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10567 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10568 hr, E_POINTER);
10570 builder = NULL;
10571 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10572 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08lx, expected 0x%08lx.\n",
10573 hr, S_OK);
10574 if(SUCCEEDED(hr)) {
10575 IUri *tmp = NULL;
10577 hr = IUriBuilder_GetIUri(builder, &tmp);
10578 ok(hr == S_OK, "Error: GetIUri return 0x%08lx, expected 0x%08lx.\n",
10579 hr, S_OK);
10580 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10581 if(tmp) IUri_Release(tmp);
10583 if(builder) IUriBuilder_Release(builder);
10585 if(factory) IUriBuilderFactory_Release(factory);
10587 if(uri) IUri_Release(uri);
10590 static void test_CoInternetCombineIUri(void) {
10591 HRESULT hr;
10592 IUri *base, *relative, *result;
10593 DWORD i;
10595 base = NULL;
10596 hr = pCreateUri(http_urlW, 0, 0, &base);
10597 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx.\n", hr);
10598 if(SUCCEEDED(hr)) {
10599 result = (void*) 0xdeadbeef;
10600 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10601 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
10602 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10605 relative = NULL;
10606 hr = pCreateUri(http_urlW, 0, 0, &relative);
10607 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx.\n", hr);
10608 if(SUCCEEDED(hr)) {
10609 result = (void*) 0xdeadbeef;
10610 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10611 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
10612 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10615 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10616 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, E_INVALIDARG);
10618 if(base) IUri_Release(base);
10619 if(relative) IUri_Release(relative);
10621 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
10622 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10624 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10625 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
10626 if(SUCCEEDED(hr)) {
10627 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10629 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10630 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
10631 if(SUCCEEDED(hr)) {
10632 result = NULL;
10634 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10635 todo_wine_if(uri_combine_tests[i].todo)
10636 ok(hr == uri_combine_tests[i].expected ||
10637 broken(hr == S_OK && uri_combine_tests[i].expected == E_INVALIDARG) /* win10 1607 to 1709 */,
10638 "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].\n",
10639 hr, uri_combine_tests[i]. expected, i);
10640 if(SUCCEEDED(hr) && SUCCEEDED(uri_combine_tests[i].expected)) {
10641 DWORD j;
10643 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
10644 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10645 BSTR received;
10647 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10648 todo_wine_if(prop.todo) {
10649 ok(hr == prop.expected,
10650 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].str_props[%ld].\n",
10651 hr, prop.expected, i, j);
10652 ok(!strcmp_aw(prop.value, received) ||
10653 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10654 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%ld].str_props[%ld].\n",
10655 prop.value, wine_dbgstr_w(received), i, j);
10657 SysFreeString(received);
10660 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
10661 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10662 DWORD received;
10664 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10665 todo_wine_if(prop.todo) {
10666 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10667 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].dword_props[%ld].\n",
10668 hr, prop.expected, i, j);
10669 if(!prop.broken_combine_hres || hr != S_FALSE)
10670 ok(prop.value == received, "Error: Expected %ld, but got %ld instead on uri_combine_tests[%ld].dword_props[%ld].\n",
10671 prop.value, received, i, j);
10675 if(result) IUri_Release(result);
10677 if(relative) IUri_Release(relative);
10678 free(relativeW);
10680 if(base) IUri_Release(base);
10681 free(baseW);
10685 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10686 REFIID riid, void **ppv)
10688 ok(0, "unexpected call\n");
10689 return E_NOINTERFACE;
10692 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10694 return 2;
10697 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10699 return 1;
10702 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10703 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10704 DWORD *pcchResult, DWORD dwReserved)
10706 CHECK_EXPECT(ParseUrl);
10707 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10708 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10709 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10710 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08lx, but got 0x%08lx.\n", parse_flags, dwParseFlags);
10711 ok(cchResult == 200, "Error: Got %ld.\n", cchResult);
10713 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10714 *pcchResult = lstrlenW(parse_resultW);
10716 return S_OK;
10719 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10720 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10721 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10723 CHECK_EXPECT(CombineUrl);
10724 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10725 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10726 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10727 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10728 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10729 "Error: Expected 0, but got 0x%08lx.\n", dwCombineFlags);
10730 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %ld.\n", cchResult);
10732 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10733 *pcchResult = lstrlenW(combine_resultW);
10735 return S_OK;
10738 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10739 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10741 ok(0, "unexpected call\n");
10742 return E_NOTIMPL;
10745 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10746 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10747 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10749 ok(0, "unexpected call\n");
10750 return E_NOTIMPL;
10753 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10754 InternetProtocolInfo_QueryInterface,
10755 InternetProtocolInfo_AddRef,
10756 InternetProtocolInfo_Release,
10757 InternetProtocolInfo_ParseUrl,
10758 InternetProtocolInfo_CombineUrl,
10759 InternetProtocolInfo_CompareUrl,
10760 InternetProtocolInfo_QueryInfo
10763 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10765 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10767 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10768 *ppv = &protocol_info;
10769 return S_OK;
10772 ok(0, "unexpected call\n");
10773 return E_NOINTERFACE;
10776 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10778 return 2;
10781 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10783 return 1;
10786 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10787 REFIID riid, void **ppv)
10789 ok(0, "unexpected call\n");
10790 return E_NOTIMPL;
10793 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10795 ok(0, "unexpected call\n");
10796 return S_OK;
10799 static const IClassFactoryVtbl ClassFactoryVtbl = {
10800 ClassFactory_QueryInterface,
10801 ClassFactory_AddRef,
10802 ClassFactory_Release,
10803 ClassFactory_CreateInstance,
10804 ClassFactory_LockServer
10807 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10809 static void register_protocols(void)
10811 IInternetSession *session;
10812 HRESULT hres;
10814 hres = pCoInternetGetSession(0, &session, 0);
10815 ok(hres == S_OK, "CoInternetGetSession failed: %08lx\n", hres);
10816 if(FAILED(hres))
10817 return;
10819 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10820 winetestW, 0, NULL, 0);
10821 ok(hres == S_OK, "RegisterNameSpace failed: %08lx\n", hres);
10823 IInternetSession_Release(session);
10826 static void unregister_protocols(void) {
10827 IInternetSession *session;
10828 HRESULT hr;
10830 hr = pCoInternetGetSession(0, &session, 0);
10831 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08lx\n", hr);
10832 if(FAILED(hr))
10833 return;
10835 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10836 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08lx\n", hr);
10838 IInternetSession_Release(session);
10841 static void test_CoInternetCombineIUri_Pluggable(void) {
10842 HRESULT hr;
10843 IUri *base = NULL;
10845 hr = pCreateUri(combine_baseW, 0, 0, &base);
10846 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
10847 if(SUCCEEDED(hr)) {
10848 IUri *relative = NULL;
10850 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10851 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
10852 if(SUCCEEDED(hr)) {
10853 IUri *result = NULL;
10855 SET_EXPECT(CombineUrl);
10857 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10858 &result, 0);
10859 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10861 CHECK_CALLED(CombineUrl);
10863 if(SUCCEEDED(hr)) {
10864 BSTR received = NULL;
10865 hr = IUri_GetAbsoluteUri(result, &received);
10866 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
10867 if(SUCCEEDED(hr)) {
10868 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10869 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10871 SysFreeString(received);
10873 if(result) IUri_Release(result);
10875 if(relative) IUri_Release(relative);
10877 if(base) IUri_Release(base);
10880 static void test_CoInternetCombineUrlEx(void) {
10881 HRESULT hr;
10882 IUri *base, *result;
10883 DWORD i;
10885 base = NULL;
10886 hr = pCreateUri(http_urlW, 0, 0, &base);
10887 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
10888 if(SUCCEEDED(hr)) {
10889 result = (void*) 0xdeadbeef;
10890 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10891 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
10892 hr, E_UNEXPECTED);
10893 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10896 result = (void*) 0xdeadbeef;
10897 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10898 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
10899 hr, E_INVALIDARG);
10900 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10902 result = (void*) 0xdeadbeef;
10903 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10904 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
10905 hr, E_UNEXPECTED);
10906 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10908 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10909 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n",
10910 hr, E_POINTER);
10911 if(base) IUri_Release(base);
10913 for(i = 0; i < ARRAY_SIZE(uri_combine_tests); ++i) {
10914 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10916 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10917 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx on uri_combine_tests[%ld].\n", hr, i);
10918 if(SUCCEEDED(hr)) {
10919 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10921 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10922 &result, 0);
10923 todo_wine_if(uri_combine_tests[i].todo)
10924 ok(hr == uri_combine_tests[i].expected ||
10925 broken(hr == S_OK && uri_combine_tests[i].expected == E_INVALIDARG) /* win10 1607 to 1709 */,
10926 "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].\n",
10927 hr, uri_combine_tests[i]. expected, i);
10928 if(SUCCEEDED(hr) && SUCCEEDED(uri_combine_tests[i].expected)) {
10929 DWORD j;
10931 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].str_props); ++j) {
10932 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10933 BSTR received;
10934 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10936 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10937 todo_wine_if(prop.todo) {
10938 ok(hr == prop.expected,
10939 "Error: IUri_GetPropertyBSTR returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].str_props[%ld].\n",
10940 hr, prop.expected, i, j);
10941 ok(!strcmp_aw(value, received) ||
10942 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10943 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%ld].str_props[%ld].\n",
10944 value, wine_dbgstr_w(received), i, j);
10946 SysFreeString(received);
10949 for(j = 0; j < ARRAY_SIZE(uri_combine_tests[i].dword_props); ++j) {
10950 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10951 DWORD received;
10953 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10954 todo_wine_if(prop.todo) {
10955 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10956 "Error: IUri_GetPropertyDWORD returned 0x%08lx, expected 0x%08lx on uri_combine_tests[%ld].dword_props[%ld].\n",
10957 hr, prop.expected, i, j);
10958 if(!prop.broken_combine_hres || hr != S_FALSE)
10959 ok(prop.value == received, "Error: Expected %ld, but got %ld instead on uri_combine_tests[%ld].dword_props[%ld].\n",
10960 prop.value, received, i, j);
10964 if(result) IUri_Release(result);
10965 free(relativeW);
10967 if(base) IUri_Release(base);
10968 free(baseW);
10972 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10973 HRESULT hr;
10974 IUri *base = NULL;
10976 hr = pCreateUri(combine_baseW, 0, 0, &base);
10977 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
10978 if(SUCCEEDED(hr)) {
10979 IUri *result = NULL;
10981 SET_EXPECT(CombineUrl);
10983 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10984 &result, 0);
10985 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
10987 CHECK_CALLED(CombineUrl);
10989 if(SUCCEEDED(hr)) {
10990 BSTR received = NULL;
10991 hr = IUri_GetAbsoluteUri(result, &received);
10992 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08lx instead.\n", hr);
10993 if(SUCCEEDED(hr)) {
10994 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10995 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10997 SysFreeString(received);
10999 if(result) IUri_Release(result);
11001 if(base) IUri_Release(base);
11004 static void test_CoInternetParseIUri_InvalidArgs(void) {
11005 HRESULT hr;
11006 IUri *uri = NULL;
11007 WCHAR tmp[3];
11008 WCHAR *longurl, *copy;
11009 DWORD result = -1;
11010 DWORD i, len;
11012 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11013 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11014 hr, E_INVALIDARG);
11015 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11017 hr = pCreateUri(http_urlW, 0, 0, &uri);
11018 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
11019 if(SUCCEEDED(hr)) {
11020 DWORD expected_len;
11022 result = -1;
11023 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
11024 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11025 hr, E_INVALIDARG);
11026 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11028 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
11029 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11030 hr, E_POINTER);
11032 result = -1;
11033 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
11034 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx expected 0x%08lx.\n",
11035 hr, E_FAIL);
11036 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11038 result = -1;
11039 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
11040 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11041 hr, E_FAIL);
11042 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11044 result = -1;
11045 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
11046 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11047 hr, E_FAIL);
11048 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11050 result = -1;
11051 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
11052 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11053 hr, E_FAIL);
11054 ok(!result, "Error: Expected 'result' to be 0, but was %ld.\n", result);
11056 expected_len = lstrlenW(http_urlW);
11057 result = -1;
11058 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11059 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
11060 "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n",
11061 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
11062 ok(result == expected_len, "Error: Expected 'result' to be %ld, but was %ld instead.\n",
11063 expected_len, result);
11065 if(uri) IUri_Release(uri);
11067 /* a long url that causes a crash on Wine */
11068 len = INTERNET_MAX_URL_LENGTH*2;
11069 longurl = malloc((len + 1) * sizeof(WCHAR));
11070 memcpy(longurl, http_urlW, sizeof(http_urlW));
11071 for(i = ARRAY_SIZE(http_urlW)-1; i < len; i++)
11072 longurl[i] = 'x';
11073 longurl[len] = 0;
11075 copy = malloc((len + 1) * sizeof(WCHAR));
11076 memcpy(copy, longurl, (len+1)*sizeof(WCHAR));
11078 hr = pCreateUri(longurl, 0, 0, &uri);
11079 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx.\n", hr);
11080 if(SUCCEEDED(hr)) {
11081 result = -1;
11082 memset(longurl, 0xcc, len*sizeof(WCHAR));
11083 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, longurl, len+1, &result, 0);
11084 ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08lx.\n", hr);
11085 ok(!lstrcmpW(longurl, copy), "Error: expected long url '%s' but was '%s'.\n",
11086 wine_dbgstr_w(copy), wine_dbgstr_w(longurl));
11087 ok(result == len, "Error: Expected 'result' to be %ld, but was %ld instead.\n",
11088 len, result);
11090 free(longurl);
11091 free(copy);
11092 if(uri) IUri_Release(uri);
11095 static void test_CoInternetParseIUri(void) {
11096 DWORD i;
11098 for(i = 0; i < ARRAY_SIZE(uri_parse_tests); ++i) {
11099 HRESULT hr;
11100 IUri *uri;
11101 LPWSTR uriW;
11102 uri_parse_test test = uri_parse_tests[i];
11104 uriW = a2w(test.uri);
11105 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
11106 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08lx on uri_parse_tests[%ld].\n", hr, i);
11107 if(SUCCEEDED(hr)) {
11108 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
11109 DWORD result_len = -1;
11111 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
11112 todo_wine_if(test.todo)
11113 ok(hr == test.expected,
11114 "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx on uri_parse_tests[%ld].\n",
11115 hr, test.expected, i);
11116 if(SUCCEEDED(hr)) {
11117 DWORD len = lstrlenA(test.property);
11118 ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)),
11119 "Error: Expected %s but got %s instead on uri_parse_tests[%ld] - %s.\n",
11120 test.property, wine_dbgstr_w(result), i, wine_dbgstr_w(uriW));
11121 ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len),
11122 "Error: Expected %ld, but got %ld instead on uri_parse_tests[%ld] - %s.\n",
11123 len, result_len, i, wine_dbgstr_w(uriW));
11124 } else {
11125 ok(!result_len,
11126 "Error: Expected 'result_len' to be 0, but was %ld on uri_parse_tests[%ld].\n",
11127 result_len, i);
11130 if(uri) IUri_Release(uri);
11131 free(uriW);
11135 static void test_CoInternetParseIUri_Pluggable(void) {
11136 HRESULT hr;
11137 IUri *uri = NULL;
11139 hr = pCreateUri(parse_urlW, 0, 0, &uri);
11140 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08lx.\n", hr);
11141 if(SUCCEEDED(hr)) {
11142 WCHAR result[200];
11143 DWORD result_len;
11145 SET_EXPECT(ParseUrl);
11147 parse_action = PARSE_CANONICALIZE;
11148 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
11150 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
11151 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08lx, expected 0x%08lx.\n", hr, S_OK);
11153 CHECK_CALLED(ParseUrl);
11155 if(SUCCEEDED(hr)) {
11156 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %ld.\n",
11157 lstrlenW(parse_resultW), result_len);
11158 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
11159 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
11162 if(uri) IUri_Release(uri);
11165 typedef struct {
11166 const char *url;
11167 DWORD uri_flags;
11168 const char *base_url;
11169 DWORD base_uri_flags;
11170 const char *legacy_url;
11171 const char *uniform_url;
11172 const char *no_canon_url;
11173 const char *uri_url;
11174 } create_urlmon_test_t;
11176 static const create_urlmon_test_t create_urlmon_tests[] = {
11178 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
11179 NULL,0,
11180 "http://www.winehq.org/",
11181 "http://www.winehq.org/",
11182 "http://www.winehq.org",
11183 "http://www.winehq.org"
11186 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
11187 NULL,0,
11188 "file://c:\\dir\\file.txt",
11189 "file:///c:/dir/file.txt",
11190 "file:///c:/dir/file.txt",
11191 "file:///c:/dir/file.txt"
11194 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
11195 NULL,0,
11196 "file://c:\\dir\\file.txt",
11197 "file:///c:/dir/file.txt",
11198 "file:///c:/dir/file.txt",
11199 "file://c:\\dir\\file.txt"
11202 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
11203 "http://www.winehq.org",0,
11204 "http://www.winehq.org/data",
11205 "http://www.winehq.org/data",
11206 "http://www.winehq.org:80/data",
11209 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
11210 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
11211 "file://c:\\dir\\file.txt",
11212 "file:///c:/dir/file.txt",
11213 "file:///c:/dir/file.txt",
11216 "",Uri_CREATE_ALLOW_RELATIVE,
11217 NULL,0,
11224 "test",Uri_CREATE_ALLOW_RELATIVE,
11225 NULL,0,
11226 "test",
11227 "test",
11228 "test",
11229 "test"
11232 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11233 NULL,0,
11234 "file://c:\\dir\\file.txt",
11235 "file:///c:/dir/file.txt",
11236 "file:///c:/dir/file.txt",
11237 "file:///c:/dir/file.txt",
11240 "c:\\dir\\file.txt#frag|part",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11241 NULL,0,
11242 "file://c:\\dir\\file.txt#frag|part",
11243 "file:///c:/dir/file.txt#frag%7Cpart",
11244 "file:///c:/dir/file.txt#frag%7Cpart",
11245 "file:///c:/dir/file.txt#frag%7Cpart",
11249 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
11250 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
11252 WCHAR *display_name;
11253 HRESULT hres;
11255 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11256 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08lx\n", hres);
11257 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11258 wine_dbgstr_w(display_name), exurl);
11260 CoTaskMemFree(display_name);
11263 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
11264 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
11266 IUriContainer *uri_container;
11267 IUri *uri;
11268 BSTR display_uri;
11269 HRESULT hres;
11271 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11272 ok(hres == S_OK, "Could not get IUriContainer iface: %08lx\n", hres);
11274 uri = NULL;
11275 hres = IUriContainer_GetIUri(uri_container, &uri);
11276 IUriContainer_Release(uri_container);
11277 ok(hres == S_OK, "GetIUri failed: %08lx\n", hres);
11278 ok(uri != NULL, "uri == NULL\n");
11280 hres = IUri_GetDisplayUri(uri, &display_uri);
11281 IUri_Release(uri);
11282 ok(hres == S_OK, "GetDisplayUri failed: %08lx\n", hres);
11283 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11284 wine_dbgstr_w(display_uri), exurl);
11285 SysFreeString(display_uri);
11288 static void test_CreateURLMoniker(void)
11290 const create_urlmon_test_t *test;
11291 IMoniker *mon, *base_mon;
11292 WCHAR *url, *base_url;
11293 IUri *uri, *base_uri;
11294 HRESULT hres;
11296 for(test = create_urlmon_tests; test < create_urlmon_tests + ARRAY_SIZE(create_urlmon_tests); test++) {
11297 url = a2w(test->url);
11298 base_url = a2w(test->base_url);
11300 if(base_url) {
11301 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11302 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
11304 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11305 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
11306 }else {
11307 base_uri = NULL;
11308 base_mon = NULL;
11311 hres = CreateURLMoniker(base_mon, url, &mon);
11312 ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
11313 test_urlmon_display_name(mon, test->legacy_url);
11314 test_display_uri(mon, test->legacy_url);
11315 IMoniker_Release(mon);
11317 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11318 ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
11319 test_urlmon_display_name(mon, test->legacy_url);
11320 test_display_uri(mon, test->legacy_url);
11321 IMoniker_Release(mon);
11323 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11324 ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
11325 test_urlmon_display_name(mon, test->uniform_url);
11326 test_display_uri(mon, test->uniform_url);
11327 IMoniker_Release(mon);
11329 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11330 ok(hres == S_OK, "CreateURLMoniker failed: %08lx\n", hres);
11331 test_urlmon_display_name(mon, test->no_canon_url);
11332 test_display_uri(mon, test->no_canon_url);
11333 IMoniker_Release(mon);
11335 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11336 ok(hres == S_OK, "CreateUri failed: %08lx\n", hres);
11338 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11339 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
11340 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11341 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11342 IMoniker_Release(mon);
11344 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11345 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
11346 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11347 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11348 IMoniker_Release(mon);
11350 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11351 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08lx\n", hres);
11352 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11353 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11354 IMoniker_Release(mon);
11356 IUri_Release(uri);
11357 free(url);
11358 free(base_url);
11359 if(base_uri)
11360 IUri_Release(base_uri);
11361 if(base_mon)
11362 IMoniker_Release(base_mon);
11366 static int add_default_flags(DWORD flags) {
11367 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11368 flags |= Uri_CREATE_CANONICALIZE;
11369 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11370 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11371 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11372 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11373 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11374 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11375 if(!(flags & Uri_CREATE_IE_SETTINGS))
11376 flags |= Uri_CREATE_NO_IE_SETTINGS;
11378 return flags;
11381 static void test_IPersistStream(void)
11383 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11385 props_order[Uri_PROPERTY_RAW_URI] = 1;
11386 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11387 props_order[Uri_PROPERTY_HOST] = 3;
11388 props_order[Uri_PROPERTY_PASSWORD] = 4;
11389 props_order[Uri_PROPERTY_PATH] = 5;
11390 props_order[Uri_PROPERTY_PORT] = 6;
11391 props_order[Uri_PROPERTY_QUERY] = 7;
11392 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11393 props_order[Uri_PROPERTY_USER_NAME] = 9;
11395 for(i = 0; i < ARRAY_SIZE(uri_tests); i++) {
11396 const uri_properties *test = uri_tests+i;
11397 LPWSTR uriW;
11398 IUri *uri;
11399 IPersistStream *persist_stream;
11400 IStream *stream;
11401 IMarshal *marshal;
11402 DWORD props, props_no, dw_data[6];
11403 WCHAR str_data[1024];
11404 ULARGE_INTEGER size, max_size;
11405 LARGE_INTEGER no_off;
11406 CLSID curi;
11407 BSTR raw_uri;
11408 HRESULT hr;
11410 if(test->create_todo || test->create_expected!=S_OK)
11411 continue;
11413 uriW = a2w(test->uri);
11414 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11415 ok(hr == S_OK, "%d) CreateUri failed 0x%08lx, expected S_OK..\n", i, hr);
11417 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11418 ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
11420 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
11421 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08lx.\n", hr);
11422 hr = IPersistStream_IsDirty(persist_stream);
11423 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08lx, expected S_FALSE.\n", i, hr);
11424 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11425 ok(hr == S_OK, "%d) Save failed 0x%08lx, expected S_OK.\n", i, hr);
11426 hr = IPersistStream_IsDirty(persist_stream);
11427 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08lx, expected S_FALSE.\n", i, hr);
11428 no_off.QuadPart = 0;
11429 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11430 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11431 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11432 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11433 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11434 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08lx, expected S_OK.\n", i, hr);
11435 ok(size.LowPart+2 == max_size.LowPart,
11436 "%d) Written data size is %ld, max_size %ld.\n",
11437 i, size.LowPart, max_size.LowPart);
11439 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11440 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11441 ok(dw_data[0]-2 == size.LowPart, "%d) Structure size is %ld, expected %ld\n",
11442 i, dw_data[0]-2, size.LowPart);
11443 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11444 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11445 ok(dw_data[0] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[0]);
11446 ok(dw_data[1] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[1]);
11447 ok(dw_data[2] == add_default_flags(test->create_flags),
11448 "%d) Incorrect value %lx, expected %x (creation flags).\n",
11449 i, dw_data[2], add_default_flags(test->create_flags));
11450 ok(dw_data[3] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[3]);
11451 ok(dw_data[4] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[4]);
11452 ok(dw_data[5] == 0, "%d) Incorrect value %lx, expected 0 (unknown).\n", i, dw_data[5]);
11454 props_no = 0;
11455 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11456 if(!props_order[props])
11457 continue;
11459 if(props <= Uri_PROPERTY_STRING_LAST) {
11460 if(test->str_props[props].expected == S_OK)
11461 props_no++;
11462 } else {
11463 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11464 props_no++;
11467 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11468 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11469 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11470 props_no = 1;
11472 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11473 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11474 ok(props == props_no, "%d) Properties no is %ld, expected %ld.\n", i, props, props_no);
11476 dw_data[2] = 0;
11477 dw_data[3] = -1;
11478 while(props) {
11479 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11480 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11481 props--;
11482 ok(dw_data[2]<props_order[dw_data[0]],
11483 "%d) Incorrect properties order (%ld, %ld)\n",
11484 i, dw_data[0], dw_data[3]);
11485 dw_data[2] = props_order[dw_data[0]];
11486 dw_data[3] = dw_data[0];
11488 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11489 const uri_str_property *prop = test->str_props+dw_data[0];
11490 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11491 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11492 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11493 "%d) Expected %s but got %s (%ld).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11494 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11495 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11496 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %ld (%ld)\n", i, dw_data[1], dw_data[0]);
11497 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11498 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11499 ok(prop->value == dw_data[1], "%d) Expected %ld but got %ld (%ld).\n", i, prop->value, dw_data[1], dw_data[0]);
11500 } else {
11501 ok(FALSE, "%d) Incorrect property type (%ld)\n", i, dw_data[0]);
11502 break;
11505 ok(props == 0, "%d) Not all properties were processed %ld. Next property type: %ld\n",
11506 i, props, dw_data[0]);
11508 IUri_Release(uri);
11510 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11511 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11512 hr = IPersistStream_GetClassID(persist_stream, &curi);
11513 ok(hr == S_OK, "%d) GetClassID failed 0x%08lx, expected S_OK.\n", i, hr);
11514 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11515 IPersistStream_Release(persist_stream);
11517 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11518 &IID_IUri, (void**)&uri);
11519 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08lx.\n", i, hr);
11520 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11521 ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
11522 hr = IPersistStream_Load(persist_stream, stream);
11523 ok(hr == S_OK, "%d) Load failed 0x%08lx, expected S_OK.\n", i, hr);
11524 hr = IUri_GetRawUri(uri, &raw_uri);
11525 ok(hr == S_OK, "%d) GetRawUri failed 0x%08lx, expected S_OK.\n", i, hr);
11526 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11527 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11528 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11529 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11530 wine_dbgstr_w(raw_uri));
11531 SysFreeString(raw_uri);
11532 IPersistStream_Release(persist_stream);
11534 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11535 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08lx, expected S_OK.\n", i, hr);
11536 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11537 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11538 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11539 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11540 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11541 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11542 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11543 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11544 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11545 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11546 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11547 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11548 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11549 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11550 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11551 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11552 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11553 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11554 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11555 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08lx, expected S_OK.\n", i, hr);
11556 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11557 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11558 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08lx, expected E_INVALIDARG.\n", i, hr);
11559 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11560 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11561 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08lx, expected S_OK.\n", i, hr);
11562 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11564 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11565 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11566 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11567 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11568 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11569 ok(hr == S_OK, "%d) Read failed 0x%08lx, expected S_OK.\n", i, hr);
11570 ok(dw_data[0]-2 == size.LowPart, "%d) Structure size is %ld, expected %ld\n",
11571 i, dw_data[0]-2, size.LowPart);
11572 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %ld, expected MSHCTX_LOCAL.\n",
11573 i, dw_data[1]);
11574 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %ld, expected %ld (PersistStream size).\n",
11575 i, dw_data[2], dw_data[0]-8);
11576 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11577 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11578 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11579 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11580 max_size.LowPart += 3*sizeof(DWORD);
11581 ok(dw_data[2] == max_size.LowPart, "%d) Incorrect value %ld, expected %ld (PersistStream size).\n",
11582 i, dw_data[2], max_size.LowPart);
11583 IMarshal_Release(marshal);
11584 IUri_Release(uri);
11586 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11587 ok(hr == S_OK, "%d) Seek failed 0x%08lx, expected S_OK.\n", i, hr);
11588 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11589 &IID_IUri, (void**)&uri);
11590 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08lx.\n", i, hr);
11591 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11592 ok(hr == S_OK, "%d) QueryInterface failed 0x%08lx, expected S_OK.\n", i, hr);
11593 IUri_Release(uri);
11594 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11595 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08lx, expected S_OK.\n", i, hr);
11596 hr = IUri_GetRawUri(uri, &raw_uri);
11597 ok(hr == S_OK, "%d) GetRawUri failed 0x%08lx, expected S_OK.\n", i, hr);
11598 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11599 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11600 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11601 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11602 wine_dbgstr_w(raw_uri));
11603 SysFreeString(raw_uri);
11605 IMarshal_Release(marshal);
11606 IStream_Release(stream);
11607 IUri_Release(uri);
11608 free(uriW);
11612 static void test_UninitializedUri(void)
11614 IUri *uri;
11615 IUriBuilderFactory *ubf;
11616 IPersistStream *ps;
11617 IUriBuilder *ub;
11618 BSTR bstr;
11619 DWORD dword;
11620 BOOL eq;
11621 ULARGE_INTEGER ui;
11622 HRESULT hr;
11624 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11625 &IID_IUri, (void**)&uri);
11626 if(FAILED(hr)) {
11627 win_skip("Skipping uninitialized Uri tests.\n");
11628 return;
11631 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11632 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %lx.\n", hr);
11633 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11634 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %lx.\n", hr);
11636 hr = IUri_GetAbsoluteUri(uri, NULL);
11637 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %lx, expected E_UNEXPECTED.\n", hr);
11638 hr = IUri_GetAbsoluteUri(uri, &bstr);
11639 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %lx, expected E_UNEXPECTED.\n", hr);
11640 hr = IUri_GetAuthority(uri, &bstr);
11641 ok(hr == E_UNEXPECTED, "GetAuthority returned %lx, expected E_UNEXPECTED.\n", hr);
11642 hr = IUri_GetDisplayUri(uri, &bstr);
11643 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %lx, expected E_UNEXPECTED.\n", hr);
11644 hr = IUri_GetDomain(uri, &bstr);
11645 ok(hr == E_UNEXPECTED, "GetDomain returned %lx, expected E_UNEXPECTED.\n", hr);
11646 hr = IUri_GetExtension(uri, &bstr);
11647 ok(hr == E_UNEXPECTED, "GetExtension returned %lx, expected E_UNEXPECTED.\n", hr);
11648 hr = IUri_GetFragment(uri, &bstr);
11649 ok(hr == E_UNEXPECTED, "GetFragment returned %lx, expected E_UNEXPECTED.\n", hr);
11650 hr = IUri_GetHost(uri, &bstr);
11651 ok(hr == E_UNEXPECTED, "GetHost returned %lx, expected E_UNEXPECTED.\n", hr);
11652 hr = IUri_GetHostType(uri, &dword);
11653 ok(hr == E_UNEXPECTED, "GetHostType returned %lx, expected E_UNEXPECTED.\n", hr);
11654 hr = IUri_GetPassword(uri, &bstr);
11655 ok(hr == E_UNEXPECTED, "GetPassword returned %lx, expected E_UNEXPECTED.\n", hr);
11656 hr = IUri_GetPassword(uri, &bstr);
11657 ok(hr == E_UNEXPECTED, "GetPassword returned %lx, expected E_UNEXPECTED.\n", hr);
11658 hr = IUri_GetPathAndQuery(uri, &bstr);
11659 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %lx, expected E_UNEXPECTED.\n", hr);
11660 hr = IUri_GetPort(uri, &dword);
11661 ok(hr == E_UNEXPECTED, "GetPort returned %lx, expected E_UNEXPECTED.\n", hr);
11662 hr = IUri_GetProperties(uri, &dword);
11663 ok(hr == E_UNEXPECTED, "GetProperties returned %lx, expected E_UNEXPECTED.\n", hr);
11664 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11665 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %lx, expected E_UNEXPECTED.\n", hr);
11666 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11667 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %lx, expected E_UNEXPECTED.\n", hr);
11668 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11669 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %lx, expected E_UNEXPECTED.\n", hr);
11670 hr = IUri_GetQuery(uri, &bstr);
11671 ok(hr == E_UNEXPECTED, "GetQuery returned %lx, expected E_UNEXPECTED.\n", hr);
11672 hr = IUri_GetRawUri(uri, &bstr);
11673 ok(hr == E_UNEXPECTED, "GetRawUri returned %lx, expected E_UNEXPECTED.\n", hr);
11674 hr = IUri_GetScheme(uri, &dword);
11675 ok(hr == E_UNEXPECTED, "GetScheme returned %lx, expected E_UNEXPECTED.\n", hr);
11676 hr = IUri_GetSchemeName(uri, &bstr);
11677 ok(hr == E_UNEXPECTED, "GetSchemeName returned %lx, expected E_UNEXPECTED.\n", hr);
11678 hr = IUri_GetUserInfo(uri, &bstr);
11679 ok(hr == E_UNEXPECTED, "GetUserInfo returned %lx, expected E_UNEXPECTED.\n", hr);
11680 hr = IUri_GetUserName(uri, &bstr);
11681 ok(hr == E_UNEXPECTED, "GetUserName returned %lx, expected E_UNEXPECTED.\n", hr);
11682 hr = IUri_GetZone(uri, &dword);
11683 ok(hr == E_UNEXPECTED, "GetZone returned %lx, expected E_UNEXPECTED.\n", hr);
11684 hr = IUri_IsEqual(uri, uri, &eq);
11685 ok(hr == E_UNEXPECTED, "IsEqual returned %lx, expected E_UNEXPECTED.\n", hr);
11687 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11688 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %lx, expected E_UNEXPECTED.\n", hr);
11689 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11690 ok(hr == S_OK, "CreateIUriBuilder returned %lx, expected S_OK.\n", hr);
11691 IUriBuilder_Release(ub);
11693 hr = IPersistStream_GetSizeMax(ps, &ui);
11694 ok(hr == S_OK, "GetSizeMax returned %lx, expected S_OK.\n", hr);
11695 ok(ui.u.LowPart == 34, "ui.LowPart = %ld, expected 34.\n", ui.u.LowPart);
11696 hr = IPersistStream_IsDirty(ps);
11697 ok(hr == S_FALSE, "IsDirty returned %lx, expected S_FALSE.\n", hr);
11699 IPersistStream_Release(ps);
11700 IUriBuilderFactory_Release(ubf);
11701 IUri_Release(uri);
11704 START_TEST(uri) {
11705 HMODULE hurlmon;
11707 hurlmon = GetModuleHandleA("urlmon.dll");
11708 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11709 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11710 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11711 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11712 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11713 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11714 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11715 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11716 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11718 if(!pCreateUri) {
11719 win_skip("CreateUri is not present, skipping tests.\n");
11720 return;
11723 trace("test CreateUri invalid flags...\n");
11724 test_CreateUri_InvalidFlags();
11726 trace("test CreateUri invalid args...\n");
11727 test_CreateUri_InvalidArgs();
11729 trace("test CreateUri invalid URIs...\n");
11730 test_CreateUri_InvalidUri();
11732 trace("test IUri_GetPropertyBSTR...\n");
11733 test_IUri_GetPropertyBSTR();
11735 trace("test IUri_GetPropertyDWORD...\n");
11736 test_IUri_GetPropertyDWORD();
11738 trace("test IUri_GetStrProperties...\n");
11739 test_IUri_GetStrProperties();
11741 trace("test IUri_GetDwordProperties...\n");
11742 test_IUri_GetDwordProperties();
11744 trace("test IUri_GetPropertyLength...\n");
11745 test_IUri_GetPropertyLength();
11747 trace("test IUri_GetProperties...\n");
11748 test_IUri_GetProperties();
11750 trace("test IUri_HasProperty...\n");
11751 test_IUri_HasProperty();
11753 trace("test IUri_IsEqual...\n");
11754 test_IUri_IsEqual();
11756 trace("test CreateUriWithFragment invalid args...\n");
11757 test_CreateUriWithFragment_InvalidArgs();
11759 trace("test CreateUriWithFragment invalid flags...\n");
11760 test_CreateUriWithFragment_InvalidFlags();
11762 trace("test CreateUriWithFragment...\n");
11763 test_CreateUriWithFragment();
11765 trace("test CreateIUriBuilder...\n");
11766 test_CreateIUriBuilder();
11768 trace("test IUriBuilder_CreateInvalidArgs...\n");
11769 test_IUriBuilder_CreateInvalidArgs();
11771 trace("test IUriBuilder...\n");
11772 test_IUriBuilder();
11774 trace("test IUriBuilder_GetInvalidArgs...\n");
11775 test_IUriBuilder_GetInvalidArgs();
11777 trace("test IUriBuilder_HasBeenModified...\n");
11778 test_IUriBuilder_HasBeenModified();
11780 trace("test IUriBuilder_IUriProperty...\n");
11781 test_IUriBuilder_IUriProperty();
11783 trace("test IUriBuilder_RemoveProperties...\n");
11784 test_IUriBuilder_RemoveProperties();
11786 trace("test IUriBuilder miscellaneous...\n");
11787 test_IUriBuilder_Misc();
11789 trace("test IUriBuilderFactory...\n");
11790 test_IUriBuilderFactory();
11792 trace("test CoInternetCombineIUri...\n");
11793 test_CoInternetCombineIUri();
11795 trace("test CoInternetCombineUrlEx...\n");
11796 test_CoInternetCombineUrlEx();
11798 trace("test CoInternetParseIUri Invalid Args...\n");
11799 test_CoInternetParseIUri_InvalidArgs();
11801 trace("test CoInternetParseIUri...\n");
11802 test_CoInternetParseIUri();
11804 register_protocols();
11806 trace("test CoInternetCombineIUri pluggable...\n");
11807 test_CoInternetCombineIUri_Pluggable();
11809 trace("test CoInternetCombineUrlEx Pluggable...\n");
11810 test_CoInternetCombineUrlEx_Pluggable();
11812 trace("test CoInternetParseIUri pluggable...\n");
11813 test_CoInternetParseIUri_Pluggable();
11815 trace("test CreateURLMoniker...\n");
11816 test_CreateURLMoniker();
11818 CoInitialize(NULL);
11820 trace("test IPersistStream...\n");
11821 test_IPersistStream();
11823 trace("test uninitialized Uri...\n");
11824 test_UninitializedUri();
11826 CoUninitialize();
11827 unregister_protocols();